summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2006-05-16 02:39:05 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2006-05-16 02:39:05 +0000
commit2c4a12df266ae54394936a5d22e8ad3e0317ae02 (patch)
tree27f03878bbb0e3333de3beeb7f503de5d3412bca /src
parentAdd Pedro to the excludes, at least until after the release (diff)
downloadinkscape-2c4a12df266ae54394936a5d22e8ad3e0317ae02.tar.gz
inkscape-2c4a12df266ae54394936a5d22e8ad3e0317ae02.zip
show handles toggle
(bzr r850)
Diffstat (limited to 'src')
-rw-r--r--src/node-context.cpp6
-rw-r--r--src/nodepath.cpp16
-rw-r--r--src/nodepath.h7
-rw-r--r--src/widgets/toolbox.cpp26
4 files changed, 49 insertions, 6 deletions
diff --git a/src/node-context.cpp b/src/node-context.cpp
index 67511ea30..d7848e3bb 100644
--- a/src/node-context.cpp
+++ b/src/node-context.cpp
@@ -174,7 +174,7 @@ sp_node_context_setup(SPEventContext *ec)
nc->added_node = false;
if (item) {
- nc->nodepath = sp_nodepath_new(ec->desktop, item);
+ nc->nodepath = sp_nodepath_new(ec->desktop, item, (prefs_get_int_attribute("tools.nodes", "show_handles", 1) != 0));
if ( nc->nodepath) {
//point pack to parent in case nodepath is deleted
nc->nodepath->nodeContext = nc;
@@ -241,7 +241,7 @@ sp_node_context_selection_changed(Inkscape::Selection *selection, gpointer data)
nc->nodepath = NULL;
ec->shape_knot_holder = NULL;
if (item) {
- nc->nodepath = sp_nodepath_new(desktop, item);
+ nc->nodepath = sp_nodepath_new(desktop, item, (prefs_get_int_attribute("tools.nodes", "show_handles", 1) != 0));
if (nc->nodepath) {
nc->nodepath->nodeContext = nc;
}
@@ -292,7 +292,7 @@ sp_nodepath_update_from_item(SPNodeContext *nc, SPItem *item)
item = selection->singleItem();
if (item) {
- nc->nodepath = sp_nodepath_new(desktop, item);
+ nc->nodepath = sp_nodepath_new(desktop, item, (prefs_get_int_attribute("tools.nodes", "show_handles", 1) != 0));
if (nc->nodepath) {
nc->nodepath->nodeContext = nc;
}
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index 4b9559737..1ffef1880 100644
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
@@ -137,7 +137,7 @@ static Inkscape::NodePath::Node *active_node = NULL;
/**
* \brief Creates new nodepath from item
*/
-Inkscape::NodePath::Path *sp_nodepath_new(SPDesktop *desktop, SPItem *item)
+Inkscape::NodePath::Path *sp_nodepath_new(SPDesktop *desktop, SPItem *item, bool show_handles)
{
Inkscape::XML::Node *repr = SP_OBJECT(item)->repr;
@@ -186,6 +186,7 @@ Inkscape::NodePath::Path *sp_nodepath_new(SPDesktop *desktop, SPItem *item)
np->nodeContext = NULL; //Let the context that makes this set it
np->livarot_path = NULL;
np->local_change = 0;
+ np->show_handles = show_handles;
// we need to update item's transform from the repr here,
// because they may be out of sync when we respond
@@ -1336,6 +1337,9 @@ static void sp_node_update_handles(Inkscape::NodePath::Node *node, bool fire_mov
if (node->n.other->selected) show_handles = TRUE;
}
+ if (node->subpath->nodepath->show_handles == false)
+ show_handles = FALSE;
+
sp_node_update_handle(node, -1, show_handles, fire_move_signals);
sp_node_update_handle(node, 1, show_handles, fire_move_signals);
}
@@ -1364,6 +1368,16 @@ static void sp_nodepath_update_handles(Inkscape::NodePath::Path *nodepath)
}
}
+void
+sp_nodepath_show_handles(bool show)
+{
+ Inkscape::NodePath::Path *nodepath = sp_nodepath_current();
+ if (nodepath == NULL) return;
+
+ nodepath->show_handles = show;
+ sp_nodepath_update_handles(nodepath);
+}
+
/**
* Adds all selected nodes in nodepath to list.
*/
diff --git a/src/nodepath.h b/src/nodepath.h
index 2b6131684..2b8243f5b 100644
--- a/src/nodepath.h
+++ b/src/nodepath.h
@@ -133,6 +133,9 @@ class Path {
/// true if we changed repr, to tell this change from an external one such as from undo, simplify, or another desktop
unsigned int local_change;
+
+ /// true if we're showing selected nodes' handles
+ bool show_handles;
};
@@ -231,7 +234,7 @@ class Node {
} // namespace Inkscape
// Do function documentation in nodepath.cpp
-Inkscape::NodePath::Path * sp_nodepath_new (SPDesktop * desktop, SPItem * item);
+Inkscape::NodePath::Path * sp_nodepath_new (SPDesktop * desktop, SPItem * item, bool show_handles);
void sp_nodepath_destroy (Inkscape::NodePath::Path * nodepath);
void sp_nodepath_deselect (Inkscape::NodePath::Path *nodepath);
void sp_nodepath_select_all (Inkscape::NodePath::Path *nodepath, bool invert);
@@ -267,6 +270,8 @@ void sp_node_selected_set_line_type (NRPathcode code);
void sp_node_selected_move (gdouble dx, gdouble dy);
void sp_node_selected_move_screen (gdouble dx, gdouble dy);
+void sp_nodepath_show_handles(bool show);
+
void sp_nodepath_selected_nodes_rotate (Inkscape::NodePath::Path * nodepath, gdouble angle, int which, bool screen);
void sp_nodepath_selected_nodes_scale (Inkscape::NodePath::Path * nodepath, gdouble grow, int which);
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index 27cc68e25..3d6434bf2 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -376,7 +376,11 @@ sp_node_path_edit_symmetrical(void)
sp_node_selected_set_type(Inkscape::NodePath::NODE_SYMM);
}
-
+static void toggle_show_handles (GtkWidget *button, gpointer data) {
+ bool show = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+ prefs_set_int_attribute ("tools.nodes", "show_handles", show ? 1 : 0);
+ sp_nodepath_show_handles(show);
+}
//################################
//## Node Editing Toolbox ##
@@ -435,6 +439,26 @@ sp_node_toolbox_new(SPDesktop *desktop)
sp_toolbox_button_normal_new_from_verb(tb, Inkscape::ICON_SIZE_SMALL_TOOLBAR, Inkscape::Verb::get(SP_VERB_SELECTION_OUTLINE), view, tt);
+ aux_toolbox_space(tb, AUX_BETWEEN_BUTTON_GROUPS);
+
+ GtkWidget *cvbox = gtk_vbox_new (FALSE, 0);
+ GtkWidget *cbox = gtk_hbox_new (FALSE, 0);
+
+ {
+ GtkWidget *button = sp_button_new_from_data( Inkscape::ICON_SIZE_DECORATION,
+ SP_BUTTON_TYPE_TOGGLE,
+ NULL,
+ "nodes_show_handles",
+ _("Show the Bezier handles of selected nodes"),
+ tt);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), prefs_get_int_attribute ("tools.nodes", "show_handles", 1));
+ g_signal_connect_after (G_OBJECT (button), "clicked", G_CALLBACK (toggle_show_handles), desktop);
+ gtk_box_pack_start(GTK_BOX(cbox), button, FALSE, FALSE, 0);
+ }
+
+ gtk_box_pack_start(GTK_BOX(cvbox), cbox, TRUE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(tb), cvbox, FALSE, FALSE, 0);
+
gtk_widget_show_all(tb);
return tb;