diff options
| author | bulia byak <buliabyak@gmail.com> | 2006-05-16 02:39:05 +0000 |
|---|---|---|
| committer | buliabyak <buliabyak@users.sourceforge.net> | 2006-05-16 02:39:05 +0000 |
| commit | 2c4a12df266ae54394936a5d22e8ad3e0317ae02 (patch) | |
| tree | 27f03878bbb0e3333de3beeb7f503de5d3412bca | |
| parent | Add Pedro to the excludes, at least until after the release (diff) | |
| download | inkscape-2c4a12df266ae54394936a5d22e8ad3e0317ae02.tar.gz inkscape-2c4a12df266ae54394936a5d22e8ad3e0317ae02.zip | |
show handles toggle
(bzr r850)
| -rw-r--r-- | share/icons/icons.svg | 32 | ||||
| -rw-r--r-- | src/node-context.cpp | 6 | ||||
| -rw-r--r-- | src/nodepath.cpp | 16 | ||||
| -rw-r--r-- | src/nodepath.h | 7 | ||||
| -rw-r--r-- | src/widgets/toolbox.cpp | 26 |
5 files changed, 78 insertions, 9 deletions
diff --git a/share/icons/icons.svg b/share/icons/icons.svg index 2d7504f44..c4f49248a 100644 --- a/share/icons/icons.svg +++ b/share/icons/icons.svg @@ -3483,9 +3483,9 @@ inkscape:window-x="0" inkscape:window-height="998" inkscape:window-width="1235" - inkscape:cy="766.53747" - inkscape:cx="477.92614" - inkscape:zoom="6.39741" + inkscape:cy="1191.7808" + inkscape:cx="779.0784" + inkscape:zoom="8.2983948" gridtolerance="1.0000000px" snaptogrid="false" showgrid="true" @@ -12723,4 +12723,30 @@ http://www.inkscape.org/</dc:description> xlink:href="#g3813" y="0" x="0" /> + <g + transform="translate(64.4787,-188)" + id="nodes_show_handles"> + <path + style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#646464;stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:0;stroke-dasharray:none;stroke-opacity:1" + d="M 679.0213,257.89258 L 679.0213,247" + id="path3726" + sodipodi:nodetypes="cc" /> + <rect + y="-260.44827" + x="-681.52057" + height="4.9501772" + width="4.9663944" + id="rect3728" + style="opacity:1;color:black;fill:#6464ff;fill-opacity:0.39215686;fill-rule:evenodd;stroke:blue;stroke-width:1.00000155;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline" + transform="matrix(-1,-2.790265e-6,-2.867107e-6,-1,0,0)" /> + <rect + style="opacity:1;color:black;fill:#6464ff;fill-opacity:0.39215686;fill-rule:evenodd;stroke:blue;stroke-width:1.00000072;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline" + id="rect3730" + width="2.022052" + height="2.0266623" + x="-248.02205" + y="678.01025" + transform="matrix(0,-1,1,0,0,0)" + ry="1.011026" /> + </g> </svg> 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; |
