diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp
index 00e7c61b1dc223a13db66fb02ecab01cc4fafddf..fbf42eaca1b8ebc71f1ce116c0db6036b134a5af 100644 (file)
--- a/src/shape-editor.cpp
+++ b/src/shape-editor.cpp
#include "config.h"
#endif
+#include <string.h>
#include <glibmm/i18n.h>
#include "sp-object.h"
#include "shape-editor.h"
-ShapeEditorsCollective::ShapeEditorsCollective(SPDesktop *dt) {
+ShapeEditorsCollective::ShapeEditorsCollective(SPDesktop */*dt*/) {
}
ShapeEditorsCollective::~ShapeEditorsCollective() {
}
bool ShapeEditor::has_local_change () {
- if (this->nodepath)
+ if (this->nodepath)
return (this->nodepath->local_change != 0);
- else if (this->knotholder)
+ else if (this->knotholder)
return (this->knotholder->local_change != 0);
else
return false;
::restore_nodepath_selection (this->nodepath, saved);
}
+bool ShapeEditor::nodepath_edits_repr_key(gchar const *name) {
+ if (nodepath && name) {
+ return ( !strcmp(name, nodepath->repr_key) || !strcmp(name, nodepath->repr_nodetypes_key) );
+ }
+
+ return false;
+}
-static void shapeeditor_event_attr_changed(Inkscape::XML::Node *repr, gchar const *name,
- gchar const *old_value, gchar const *new_value,
- bool is_interactive, gpointer data)
+static void shapeeditor_event_attr_changed(Inkscape::XML::Node */*repr*/, gchar const *name,
+ gchar const */*old_value*/, gchar const */*new_value*/,
+ bool /*is_interactive*/, gpointer data)
{
gboolean changed = FALSE;
g_assert(data);
ShapeEditor *sh = ((ShapeEditor *) data);
- if ( sh->has_nodepath() || sh->has_knotholder() )
+ if ( sh->has_knotholder() || ( sh->has_nodepath() && sh->nodepath_edits_repr_key(name) ) )
{
- changed = !sh->has_local_change();
+ changed = !sh->has_local_change();
sh->decrement_local_change();
}
if (item) {
this->nodepath = sp_nodepath_new(desktop, item, (prefs_get_int_attribute("tools.nodes", "show_handles", 1) != 0));
if (this->nodepath) {
- this->nodepath->shape_editor = this;
+ this->nodepath->shape_editor = this;
}
this->knotholder = sp_item_knot_holder(item, desktop);
@@ -214,11 +222,11 @@ void ShapeEditor::set_item_livepatheffect_parameter(SPItem *item, SPObject *lpeo
if (lpeobject) {
this->knotholder = NULL; // it's a path, no special knotholder needed.
- this->nodepath = sp_nodepath_new( desktop, lpeobject,
+ this->nodepath = sp_nodepath_new( desktop, lpeobject,
(prefs_get_int_attribute("tools.nodes", "show_handles", 1) != 0),
key, item);
if (this->nodepath) {
- this->nodepath->shape_editor = this;
+ this->nodepath->shape_editor = this;
// setting new listener
Inkscape::XML::Node *repr = SP_OBJECT_REPR(lpeobject);
bool ShapeEditor::is_over_stroke (NR::Point event_p, bool remember) {
- if (!this->nodepath)
+ if (!this->nodepath)
return false; // no stroke in knotholder
SPItem *item = get_item();
delta = desktop->d2w(delta);
double stroke_tolerance =
- ( !SP_OBJECT_STYLE(item)->stroke.isNone() ?
- desktop->current_zoom() *
- SP_OBJECT_STYLE (item)->stroke_width.computed *
- sp_item_i2d_affine (item).expansion() * 0.5
+ (( !SP_OBJECT_STYLE(item)->stroke.isNone() ?
+ desktop->current_zoom() *
+ SP_OBJECT_STYLE (item)->stroke_width.computed * 0.5 *
+ sp_item_i2d_affine (item).expansion()
: 0.0)
- + prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100); //(double) SP_EVENT_CONTEXT(nc)->tolerance;
-
+ + prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100)) /sp_item_i2d_affine (item).expansion();
bool close = (NR::L2 (delta) < stroke_tolerance);
if (remember && close) {
}
void ShapeEditor::select_all (bool invert) {
- if (this->nodepath)
+ if (this->nodepath)
sp_nodepath_select_all (this->nodepath, invert);
}
void ShapeEditor::select_all_from_subpath (bool invert) {
- if (this->nodepath)
+ if (this->nodepath)
sp_nodepath_select_all_from_subpath (this->nodepath, invert);
}
void ShapeEditor::select_next () {
}
void ShapeEditor::show_handles (bool show) {
- if (this->nodepath)
+ if (this->nodepath && !this->nodepath->straight_path)
sp_nodepath_show_handles (this->nodepath, show);
}
+void ShapeEditor::show_helperpath (bool show) {
+ if (this->nodepath)
+ sp_nodepath_show_helperpath (this->nodepath, show);
+}
void ShapeEditor::flip (NR::Dim2 axis, NR::Maybe<NR::Point> center) {
- if (this->nodepath)
+ if (this->nodepath)
sp_nodepath_flip (this->nodepath, axis, center);
}
void ShapeEditor::distribute (NR::Dim2 axis) {
- if (this->nodepath)
+ if (this->nodepath)
sp_nodepath_selected_distribute (this->nodepath, axis);
}
void ShapeEditor::align (NR::Dim2 axis) {
- if (this->nodepath)
+ if (this->nodepath)
sp_nodepath_selected_align (this->nodepath, axis);
}