diff options
| author | Eric Greveson <eric@greveson.co.uk> | 2013-07-03 22:57:43 +0000 |
|---|---|---|
| committer | Eric Greveson <eric@greveson.co.uk> | 2013-07-03 22:57:43 +0000 |
| commit | a99dd8508525d8519e46b0acd22e550bf3e39d62 (patch) | |
| tree | ca6c9b77a81e16b500ceedd873838e2a0b06d006 /src | |
| parent | Changed dbus interface to treat 'division' like other boolops, with a new (diff) | |
| parent | Shape calculations. do not quantize the coordinates. (Bug 168158) (diff) | |
| download | inkscape-a99dd8508525d8519e46b0acd22e550bf3e39d62.tar.gz inkscape-a99dd8508525d8519e46b0acd22e550bf3e39d62.zip | |
Merge recent changes from inkscape trunk
(bzr r12387.1.6)
Diffstat (limited to 'src')
| -rw-r--r-- | src/event-context.cpp | 7 | ||||
| -rw-r--r-- | src/libavoid/makefile | 17 | ||||
| -rw-r--r-- | src/livarot/Shape.cpp | 8 | ||||
| -rw-r--r-- | src/livarot/Shape.h | 8 | ||||
| -rw-r--r-- | src/livarot/ShapeMisc.cpp | 12 | ||||
| -rw-r--r-- | src/livarot/ShapeSweep.cpp | 8 | ||||
| -rw-r--r-- | src/live_effects/lpe-bendpath.cpp | 9 | ||||
| -rw-r--r-- | src/rdf.cpp | 4 | ||||
| -rw-r--r-- | src/ui/dialog/filter-effects-dialog.cpp | 15 | ||||
| -rw-r--r-- | src/ui/dialog/filter-effects-dialog.h | 1 | ||||
| -rw-r--r-- | src/ui/dialog/layers.cpp | 4 | ||||
| -rw-r--r-- | src/ui/dialog/symbols.cpp | 1 | ||||
| -rw-r--r-- | src/ui/dialog/transformation.cpp | 35 | ||||
| -rw-r--r-- | src/ui/tool/multi-path-manipulator.cpp | 8 | ||||
| -rw-r--r-- | src/verbs.cpp | 3 |
15 files changed, 87 insertions, 53 deletions
diff --git a/src/event-context.cpp b/src/event-context.cpp index 628380a2c..4bbb012e0 100644 --- a/src/event-context.cpp +++ b/src/event-context.cpp @@ -590,13 +590,6 @@ static gint sp_event_context_private_root_handler( ret = sp_shortcut_invoke(shortcut, desktop); break; - case GDK_KEY_D: - case GDK_KEY_d: - if (!MOD__SHIFT(event) && !MOD__CTRL(event) && !MOD__ALT(event)) { - sp_toggle_dropper(desktop); - ret = TRUE; - } - break; case GDK_KEY_Q: case GDK_KEY_q: if (desktop->quick_zoomed()) { diff --git a/src/libavoid/makefile b/src/libavoid/makefile deleted file mode 100644 index e4f83a52d..000000000 --- a/src/libavoid/makefile +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - - - -OBJEXT = o - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) libavoid/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) libavoid/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/livarot/Shape.cpp b/src/livarot/Shape.cpp index c29444a33..130b1b03a 100644 --- a/src/livarot/Shape.cpp +++ b/src/livarot/Shape.cpp @@ -334,8 +334,8 @@ Shape::AddPoint (const Geom::Point x) pData[n].nextLinkedPoint = -1; pData[n].askForWindingS = NULL; pData[n].askForWindingB = -1; - pData[n].rx[0] = Round(p.x[0]); - pData[n].rx[1] = Round(p.x[1]); + pData[n].rx[0] = /*Round*/ (p.x[0]); + pData[n].rx[1] = /*Round*/ (p.x[1]); } if (_has_voronoi_data) { @@ -2116,8 +2116,8 @@ void Shape::initialisePointData() pData[i].pending = 0; pData[i].edgeOnLeft = -1; pData[i].nextLinkedPoint = -1; - pData[i].rx[0] = Round(getPoint(i).x[0]); - pData[i].rx[1] = Round(getPoint(i).x[1]); + pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]); + pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]); } _point_data_initialised = true; diff --git a/src/livarot/Shape.h b/src/livarot/Shape.h index dcd172da2..b999b9dca 100644 --- a/src/livarot/Shape.h +++ b/src/livarot/Shape.h @@ -266,10 +266,10 @@ public: // be careful when using this function // the coordinate rounding function - inline static double Round(double x) - { - return ldexp(rint(ldexp(x, 5)), -5); - } +// inline static double Round(double x) +// { +// return ldexp(rint(ldexp(x, 5)), -5); +// } // 2 miscannellous variations on it, to scale to and back the rounding grid inline static double HalfRound(double x) diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp index 6fd40790f..5bb8a25ef 100644 --- a/src/livarot/ShapeMisc.cpp +++ b/src/livarot/ShapeMisc.cpp @@ -49,8 +49,8 @@ Shape::ConvertToForme (Path * dest) for (int i = 0; i < numberOfPoints(); i++) { - pData[i].rx[0] = Round (getPoint(i).x[0]); - pData[i].rx[1] = Round (getPoint(i).x[1]); + pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]); + pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]); } for (int i = 0; i < numberOfEdges(); i++) { @@ -199,8 +199,8 @@ Shape::ConvertToForme (Path * dest, int nbP, Path * *orig, bool splitWhenForced) for (int i = 0; i < numberOfPoints(); i++) { - pData[i].rx[0] = Round (getPoint(i).x[0]); - pData[i].rx[1] = Round (getPoint(i).x[1]); + pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]); + pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]); } for (int i = 0; i < numberOfEdges(); i++) { @@ -352,8 +352,8 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in for (int i = 0; i < numberOfPoints(); i++) { - pData[i].rx[0] = Round (getPoint(i).x[0]); - pData[i].rx[1] = Round (getPoint(i).x[1]); + pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]); + pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]); } for (int i = 0; i < numberOfEdges(); i++) { diff --git a/src/livarot/ShapeSweep.cpp b/src/livarot/ShapeSweep.cpp index c2fd83e31..ffe5a9d73 100644 --- a/src/livarot/ShapeSweep.cpp +++ b/src/livarot/ShapeSweep.cpp @@ -250,8 +250,8 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) } Geom::Point rPtX; - rPtX[0]= Round (ptX[0]); - rPtX[1]= Round (ptX[1]); + rPtX[0]= /*Round*/ (ptX[0]); + rPtX[1]= /*Round*/ (ptX[1]); int lastPointNo = -1; lastPointNo = AddPoint (rPtX); pData[lastPointNo].rx = rPtX; @@ -1051,8 +1051,8 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) } Geom::Point rPtX; - rPtX[0]= Round (ptX[0]); - rPtX[1]= Round (ptX[1]); + rPtX[0]= /*Round*/ (ptX[0]); + rPtX[1]= /*Round*/ (ptX[1]); int lastPointNo = -1; lastPointNo = AddPoint (rPtX); pData[lastPointNo].rx = rPtX; diff --git a/src/live_effects/lpe-bendpath.cpp b/src/live_effects/lpe-bendpath.cpp index 49660c91b..eaf9fe4a6 100644 --- a/src/live_effects/lpe-bendpath.cpp +++ b/src/live_effects/lpe-bendpath.cpp @@ -94,6 +94,10 @@ LPEBendPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd bend_path.changed = false; } + if (uskeleton.empty()) { + return pwd2_in; /// \todo or throw an exception instead? might be better to throw an exception so that the UI can display an error message or smth + } + D2<Piecewise<SBasis> > patternd2 = make_cuts_independent(pwd2_in); Piecewise<SBasis> x = vertical_pattern.get_value() ? Piecewise<SBasis>(patternd2[1]) : Piecewise<SBasis>(patternd2[0]); Piecewise<SBasis> y = vertical_pattern.get_value() ? Piecewise<SBasis>(patternd2[0]) : Piecewise<SBasis>(patternd2[1]); @@ -105,9 +109,9 @@ LPEBendPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd x-= bboxHorizontal.min(); y-= bboxVertical.middle(); - double scaling = uskeleton.cuts.back()/bboxHorizontal.extent(); + double scaling = uskeleton.cuts.back()/bboxHorizontal.extent(); - if (scaling != 1.0) { + if (scaling != 1.0) { x*=scaling; } @@ -117,7 +121,6 @@ LPEBendPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd if (prop_scale != 1.0) y *= prop_scale; } - Piecewise<D2<SBasis> > output = compose(uskeleton,x) + y*compose(n,x); return output; } diff --git a/src/rdf.cpp b/src/rdf.cpp index 017de42c1..72aea4898 100644 --- a/src/rdf.cpp +++ b/src/rdf.cpp @@ -202,8 +202,8 @@ struct rdf_license_t rdf_licenses [] = { rdf_license_cc_a_nc_nd, }, - { N_("Public Domain"), - "http://creativecommons.org/licenses/publicdomain/", + { N_("CC0 Public Domain Dedication"), + "http://creativecommons.org/publicdomain/zero/1.0/", rdf_license_pd, }, diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 4c289d54e..4401d5658 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1155,7 +1155,13 @@ FilterEffectsDialog::FilterModifier::FilterModifier(FilterEffectsDialog& d) sw->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); _list.get_column(1)->set_resizable(true); - + _list.set_reorderable(true); + + // We can track the drag/drop reordering from the row_delete (occurs after + // row_inserted and may occur many times when adding a new item) + _model->signal_row_deleted().connect( + sigc::mem_fun(*this, &FilterModifier::on_filter_reorder)); + sw->set_shadow_type(Gtk::SHADOW_IN); show_all_children(); _add.signal_clicked().connect(sigc::mem_fun(*this, &FilterModifier::add_filter)); @@ -1301,6 +1307,13 @@ void FilterEffectsDialog::FilterModifier::on_name_edited(const Glib::ustring& pa } } +void FilterEffectsDialog::FilterModifier::on_filter_reorder(const Gtk::TreeModel::Path& path) { + for(Gtk::TreeModel::iterator i = _model->children().begin(); i != _model->children().end(); ++i) { + SPObject* object = (*i)[_columns.filter]; + object->getRepr()->setPosition(0); + } +} + void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustring& path) { Gtk::TreeIter iter = _model->get_iter(path); diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h index 658aac790..a2a2a3c6e 100644 --- a/src/ui/dialog/filter-effects-dialog.h +++ b/src/ui/dialog/filter-effects-dialog.h @@ -86,6 +86,7 @@ private: void on_filter_selection_changed(); void on_name_edited(const Glib::ustring&, const Glib::ustring&); + void on_filter_reorder(const Gtk::TreeModel::Path& path); void on_selection_toggled(const Glib::ustring&); void update_filters(); diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 32d85574d..c41046123 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -405,13 +405,13 @@ void LayersPanel::_addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::R SPObject *child = _desktop->layer_manager->nthChildOf(layer, i); if ( child ) { #if DUMP_LAYERS - g_message(" %3d layer:%p {%s} [%s]", level, child, child->id, child->label() ); + g_message(" %3d layer:%p {%s} [%s]", level, child, child->getId(), child->label() ); #endif // DUMP_LAYERS Gtk::TreeModel::iterator iter = parentRow ? _store->prepend(parentRow->children()) : _store->prepend(); Gtk::TreeModel::Row row = *iter; row[_model->_colObject] = child; - row[_model->_colLabel] = child->label() ? child->label() : child->getId(); + row[_model->_colLabel] = child->defaultLabel(); row[_model->_colVisible] = SP_IS_ITEM(child) ? !SP_ITEM(child)->isHidden() : false; row[_model->_colLocked] = SP_IS_ITEM(child) ? SP_ITEM(child)->isLocked() : false; diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 09bf1a863..26bc52947 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -26,6 +26,7 @@ #include <gtkmm/label.h> #if WITH_GTKMM_3_0 +# include <gtkmm/togglebutton.h> # include <gtkmm/grid.h> #else # include <gtkmm/table.h> diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 2ae98beda..ce8af3f1f 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -31,6 +31,7 @@ #include "inkscape.h" #include "selection.h" #include "selection-chemistry.h" +#include "message-stack.h" #include "verbs.h" #include "preferences.h" #include "sp-namedview.h" @@ -902,10 +903,21 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) if (!_units_skew.isAbsolute()) { // percentage double skewX = _scalar_skew_horizontal.getValue("%"); double skewY = _scalar_skew_vertical.getValue("%"); + if (fabs(0.01*skewX*0.01*skewY - 1.0) < Geom::EPSILON) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } sp_item_skew_rel (item, 0.01*skewX, 0.01*skewY); } else if (_units_skew.isRadial()) { //deg or rad double angleX = _scalar_skew_horizontal.getValue("rad"); double angleY = _scalar_skew_vertical.getValue("rad"); + if ((fabs(angleX - angleY + M_PI/2) < Geom::EPSILON) + || (fabs(angleX - angleY - M_PI/2) < Geom::EPSILON) + || (fabs((angleX - angleY)/3 + M_PI/2) < Geom::EPSILON) + || (fabs((angleX - angleY)/3 - M_PI/2) < Geom::EPSILON)) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } double skewX = tan(-angleX); double skewY = tan(angleY); sp_item_skew_rel (item, skewX, skewY); @@ -916,6 +928,10 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) if (bbox) { double width = bbox->dimensions()[Geom::X]; double height = bbox->dimensions()[Geom::Y]; + if (fabs(skewX*skewY - width*height) < Geom::EPSILON) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } sp_item_skew_rel (item, skewX/height, skewY/width); } } @@ -931,16 +947,31 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) if (!_units_skew.isAbsolute()) { // percentage double skewX = _scalar_skew_horizontal.getValue("%"); double skewY = _scalar_skew_vertical.getValue("%"); + if (fabs(0.01*skewX*0.01*skewY - 1.0) < Geom::EPSILON) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } sp_selection_skew_relative(selection, *center, 0.01*skewX, 0.01*skewY); } else if (_units_skew.isRadial()) { //deg or rad double angleX = _scalar_skew_horizontal.getValue("rad"); double angleY = _scalar_skew_vertical.getValue("rad"); + if ((fabs(angleX - angleY + M_PI/2) < Geom::EPSILON) + || (fabs(angleX - angleY - M_PI/2) < Geom::EPSILON) + || (fabs((angleX - angleY)/3 + M_PI/2) < Geom::EPSILON) + || (fabs((angleX - angleY)/3 - M_PI/2) < Geom::EPSILON)) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } double skewX = tan(-angleX); double skewY = tan(angleY); sp_selection_skew_relative(selection, *center, skewX, skewY); } else { // absolute displacement double skewX = _scalar_skew_horizontal.getValue("px"); double skewY = _scalar_skew_vertical.getValue("px"); + if (fabs(skewX*skewY - width*height) < Geom::EPSILON) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } sp_selection_skew_relative(selection, *center, skewX/height, skewY/width); } } @@ -961,6 +992,10 @@ void Transformation::applyPageTransform(Inkscape::Selection *selection) double f = _scalar_transform_f.getValue(); Geom::Affine displayed(a, b, c, d, e, f); + if (displayed.isSingular()) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } if (_check_replace_matrix.get_active()) { for (GSList const *l = selection->itemList(); l != NULL; l = l->next) { diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index 70bd0e859..5d5ea2adc 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -224,10 +224,12 @@ void MultiPathManipulator::shiftSelection(int dir) SubpathList::iterator last_j; NodeList::iterator last_k; bool anything_found = false; + bool anynode_found = false; for (MapType::iterator i = _mmap.begin(); i != _mmap.end(); ++i) { SubpathList &sp = i->second->subpathList(); for (SubpathList::iterator j = sp.begin(); j != sp.end(); ++j) { + anynode_found = true; for (NodeList::iterator k = (*j)->begin(); k != (*j)->end(); ++k) { if (k->selected()) { last_i = i; @@ -249,10 +251,12 @@ void MultiPathManipulator::shiftSelection(int dir) if (!anything_found) { // select first / last node // this should never fail because there must be at least 1 non-empty manipulator - if (dir == 1) { + if (anynode_found) { + if (dir == 1) { _selection.insert((*_mmap.begin()->second->subpathList().begin())->begin().ptr()); - } else { + } else { _selection.insert((--(*--(--_mmap.end())->second->subpathList().end())->end()).ptr()); + } } return; } diff --git a/src/verbs.cpp b/src/verbs.cpp index fed9622fb..2e6417ce1 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -47,6 +47,7 @@ #include "document.h" #include "draw-context.h" #include "extension/effect.h" +#include "event-context.h" #include "file.h" #include "gradient-drag.h" #include "helper/action.h" @@ -1618,7 +1619,7 @@ void ContextVerb::perform(SPAction *action, void *data) tools_switch(dt, TOOLS_MEASURE); break; case SP_VERB_CONTEXT_DROPPER: - tools_switch(dt, TOOLS_DROPPER); + sp_toggle_dropper(dt); // Functionality defined in event-context.cpp break; case SP_VERB_CONTEXT_CONNECTOR: tools_switch(dt, TOOLS_CONNECTOR); |
