diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-07-04 21:41:25 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-07-04 21:41:25 +0000 |
| commit | 1d2fa48c9a62c4929264cf5b59907f8d4f0e55b5 (patch) | |
| tree | 1c61f6d9affb0953e1d528704be7333d427fb516 /src | |
| parent | More icons clean-up. (diff) | |
| download | inkscape-1d2fa48c9a62c4929264cf5b59907f8d4f0e55b5.tar.gz inkscape-1d2fa48c9a62c4929264cf5b59907f8d4f0e55b5.zip | |
Fix a bug with select knots and modifiers
Diffstat (limited to 'src')
| -rw-r--r-- | src/knotholder.cpp | 38 | ||||
| -rw-r--r-- | src/knotholder.h | 2 | ||||
| -rw-r--r-- | src/ui/shape-editor.cpp | 12 | ||||
| -rw-r--r-- | src/ui/tool/control-point-selection.cpp | 2 |
4 files changed, 29 insertions, 25 deletions
diff --git a/src/knotholder.cpp b/src/knotholder.cpp index 6ff914733..29054bcd9 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -226,23 +226,13 @@ KnotHolder::knot_moved_handler(SPKnot *knot, Geom::Point const &p, guint state) // this was a local change and the knotholder does not need to be recreated: this->local_change = TRUE; - if (!(state & GDK_SHIFT_MASK)) { - unselect_knots(); - } + for(std::list<KnotHolderEntity *>::iterator i = this->entity.begin(); i != this->entity.end(); ++i) { KnotHolderEntity *e = *i; - if (!(state & GDK_SHIFT_MASK)) { - e->knot->selectKnot(false); - } if (e->knot == knot) { Geom::Point const q = p * item->i2dt_affine().inverse(); e->knot_set(q, e->knot->drag_origin * item->i2dt_affine().inverse(), state); - e->knot_click(state); - if (!(e->knot->flags & SP_KNOT_SELECTED) || !(state & GDK_SHIFT_MASK)){ - e->knot->selectKnot(true); - } else { - e->knot->selectKnot(false); - } + break; } } @@ -255,13 +245,30 @@ KnotHolder::knot_moved_handler(SPKnot *knot, Geom::Point const &p, guint state) } void -KnotHolder::knot_ungrabbed_handler(SPKnot */*knot*/, guint) +KnotHolder::knot_ungrabbed_handler(SPKnot *knot, guint state) { - this->dragging = false; + this->dragging = false; - if (this->released) { + if (this->released) { this->released(this->item); } else { + if (!(state & GDK_SHIFT_MASK)) { + unselect_knots(); + } + for(std::list<KnotHolderEntity *>::iterator i = this->entity.begin(); i != this->entity.end(); ++i) { + KnotHolderEntity *e = *i; + if (!(state & GDK_SHIFT_MASK)) { + e->knot->selectKnot(false); + } + if (e->knot == knot) { + // no need to test whether knot_click exists since it's virtual now + if (!(e->knot->flags & SP_KNOT_SELECTED) || !(state & GDK_SHIFT_MASK)){ + e->knot->selectKnot(true); + } else { + e->knot->selectKnot(false); + } + } + } SPObject *object = (SPObject *) this->item; // Caution: this call involves a screen update, which may process events, and as a @@ -307,7 +314,6 @@ KnotHolder::knot_ungrabbed_handler(SPKnot */*knot*/, guint) } } } - DocumentUndo::done(object->document, object_verb, _("Move handle")); } } diff --git a/src/knotholder.h b/src/knotholder.h index 559454727..d683b53ac 100644 --- a/src/knotholder.h +++ b/src/knotholder.h @@ -52,7 +52,7 @@ public: void unselect_knots(); void knot_moved_handler(SPKnot *knot, Geom::Point const &p, unsigned int state); void knot_clicked_handler(SPKnot *knot, unsigned int state); - void knot_ungrabbed_handler(SPKnot *knot, unsigned int); + void knot_ungrabbed_handler(SPKnot *knot, unsigned int state); void transform_selected(Geom::Affine transform); void add(KnotHolderEntity *e); diff --git a/src/ui/shape-editor.cpp b/src/ui/shape-editor.cpp index 51ea959cd..6a8f5e931 100644 --- a/src/ui/shape-editor.cpp +++ b/src/ui/shape-editor.cpp @@ -17,7 +17,8 @@ #include "desktop.h" #include "document.h" #include "knotholder.h" -#include "sp-ellipse.h" +#include "sp-shape.h" +#include "sp-path.h" #include "inkscape.h" #include "ui/object-edit.h" #include "ui/shape-editor.h" @@ -96,12 +97,9 @@ void ShapeEditor::event_attr_changed(Inkscape::XML::Node * node, gchar const *na if (changed_kh) { // this can happen if an LPEItem's knotholder handle was dragged, in which case we want // to keep the knotholder; in all other cases (e.g., if the LPE itself changes) we delete it - sh->reset_item(!strcmp(name, "d") || - !strcmp(node->name(),"svg:rect") || - !strcmp(node->name(),"svg:star") | - !strcmp(node->name(),"svg:spiral") || - !strcmp(node->name(),"svg:ellipse") || - SP_IS_GENERICELLIPSE(SP_ACTIVE_DOCUMENT->getObjectById(node->attribute("id")))); + SPObject * obj = SP_ACTIVE_DOCUMENT->getObjectById(node->attribute("id")); + bool is_shape = SP_IS_SHAPE(obj) && !SP_IS_PATH(obj); + sh->reset_item(!strcmp(name, "d") || is_shape); } } } diff --git a/src/ui/tool/control-point-selection.cpp b/src/ui/tool/control-point-selection.cpp index 81c6851c7..a5611addc 100644 --- a/src/ui/tool/control-point-selection.cpp +++ b/src/ui/tool/control-point-selection.cpp @@ -645,7 +645,7 @@ void ControlPointSelection::_commitHandlesTransform(CommitEvent ce) signal_commit.emit(ce); } -bool ControlPointSelection::event(Inkscape::UI::Tools::ToolBase * event_context, GdkEvent *event) +bool ControlPointSelection::event(Inkscape::UI::Tools::ToolBase * /*event_context*/, GdkEvent *event) { // implement generic event handling that should apply for all control point selections here; // for example, keyboard moves and transformations. This way this functionality doesn't need |
