diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2008-06-08 17:17:15 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2008-06-08 17:17:15 +0000 |
| commit | 489962b2aac37af521097a33eebf6103db0eb5a8 (patch) | |
| tree | ea1ea0d5d24be3edc3650e888d30e8eab0d02ba9 | |
| parent | Patch from sas for LP #231690 (crash when combining two paths) (diff) | |
| download | inkscape-489962b2aac37af521097a33eebf6103db0eb5a8.tar.gz inkscape-489962b2aac37af521097a33eebf6103db0eb5a8.zip | |
Add 'Mode' label and icon for regular Bezier mode in pen/pencil toolbar
(bzr r5854)
| -rw-r--r-- | share/icons/icons.svg | 49 | ||||
| -rw-r--r-- | src/widgets/toolbox.cpp | 81 |
2 files changed, 108 insertions, 22 deletions
diff --git a/share/icons/icons.svg b/share/icons/icons.svg index 521fedc8c..49c68fb6e 100644 --- a/share/icons/icons.svg +++ b/share/icons/icons.svg @@ -4816,9 +4816,9 @@ inkscape:window-x="0" inkscape:window-height="738" inkscape:window-width="1024" - inkscape:cy="998.16248" - inkscape:cx="498.50454" - inkscape:zoom="2.8284271" + inkscape:cy="1178.0461" + inkscape:cx="907.49743" + inkscape:zoom="1" gridtolerance="6" snaptogrid="false" showgrid="true" @@ -15854,7 +15854,7 @@ http://www.inkscape.org/</dc:description> inkscape:label="#g10193"> <path style="fill:#ffffff;fill-rule:evenodd;stroke:#4d4d4d;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;fill-opacity:1" - d="m 761.929,60.2113 c -0.341,1.1815 -0.434,2.1722 -0.428,2.9985 0.007,0.8263 0.116,1.4884 0.255,2.0113 0.28,1.0457 0.664,1.5403 1.036,1.6214 0.373,0.081 1.266,-0.1462 2.152,-0.4406 0.442,-0.1473 0.882,-0.3107 1.252,-0.4833 0.371,-0.1727 0.671,-0.3537 0.852,-0.5751 -0.642,-0.7005 -1.6,-1.2993 -2.621,-1.9965 -0.51,-0.3486 -1.031,-0.7275 -1.484,-1.2168 -0.453,-0.4893 -0.842,-1.0903 -1.014,-1.9189 z m 2.529,-1.1931 c -0.245,0.7787 -0.148,1.6545 0.242,2.344 0.331,0.5876 0.857,1.0304 1.462,1.3172 0.534,0.2475 1.118,0.3672 1.751,0.3599 -0.695,-0.4195 -1.3,-0.8194 -1.788,-1.2282 -0.489,-0.4088 -0.858,-0.8259 -1.114,-1.2213 -0.512,-0.7908 -0.557,-1.4896 -0.553,-1.5716 z m 2.798,-1.0336 c -0.478,1.0131 -0.361,1.7247 0.011,2.1965 0.372,0.4718 1,0.7295 1.723,0.9146 -0.657,-0.5111 -1.145,-1.2455 -1.425,-1.8896 -0.28,-0.6441 -0.351,-1.1905 -0.309,-1.2215 z m 3.526,-2.2026 c -0.576,0.3318 -0.506,1.3817 -0.778,1.7629 -0.526,0.7366 -1.062,0.8467 -0.78,1.4355 0.366,0.7639 0.525,0.3781 1.516,0.4737 0.309,0.0298 1.227,0.9745 1.55,0.9163 -0.981,-1.5403 -1.545,-2.9813 -1.508,-4.5884 z" + d="m 761.9292,60.21133 c -0.34137,1.181513 -0.43463,2.172159 -0.42806,2.998443 0.00657,0.826285 0.11557,1.488459 0.25528,2.011317 0.27943,1.045715 0.66322,1.540335 1.03581,1.621389 0.37259,0.081054 1.26622,-0.146136 2.15134,-0.440622 0.44256,-0.147244 0.88196,-0.310625 1.25249,-0.483276 0.37054,-0.172651 0.67107,-0.353657 0.85194,-0.575062 -0.64166,-0.70055 -1.60046,-1.299361 -2.62089,-1.996548 -0.51022,-0.348594 -1.03108,-0.727445 -1.4839,-1.21676 -0.45282,-0.489314 -0.84236,-1.090331 -1.01401,-1.918881 z m 2.5287,-1.193128 c -0.24496,0.778698 -0.14819,1.654513 0.24209,2.343998 0.33138,0.587557 0.85717,1.030384 1.46227,1.317179 0.53412,0.247488 1.1181,0.367175 1.75111,0.359913 -0.69504,-0.41948 -1.30039,-0.819409 -1.78873,-1.228217 -0.48834,-0.408808 -0.85785,-0.825924 -1.11375,-1.221303 -0.5118,-0.790759 -0.55663,-1.489553 -0.55299,-1.57157 z m 2.79833,-1.033595 c -0.47824,1.01311 -0.36141,1.724718 0.01069,2.196492 0.3721,0.471773 0.99966,0.729504 1.72325,0.914601 -0.65709,-0.511056 -1.14488,-1.245524 -1.42498,-1.889597 -0.2801,-0.644072 -0.35119,-1.190531 -0.30896,-1.221496 z m 3.52585,-2.202582 c -0.57651,0.33177 -0.50581,1.381684 -0.77804,1.762893 -0.52605,0.736628 -1.06252,0.84666 -0.7801,1.43544 0.36643,0.763927 0.52535,0.378154 1.51603,0.473736 0.30917,0.029829 1.22686,0.974511 1.5502,0.916281 -0.98093,-1.540319 -1.54468,-2.981247 -1.50809,-4.58835 z" id="path9858" inkscape:path-effect="#path-effect9860" inkscape:original-d="M 762.79223,66.842479 C 763.60219,63.119243 765.48859,60.073058 771.53884,58.084463" @@ -16765,7 +16765,46 @@ http://www.inkscape.org/</dc:description> </g> <path style="color:#000000;fill:none;stroke:#0000ff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" - d="m 496.30127,255.01138 c -2.05871,-0.26142 -3.7811,-2.06568 -3.94025,-4.13574 -0.23236,-2.06273 1.11891,-4.16029 3.09291,-4.80202 1.95058,-0.71096 4.30568,0.11085 5.39504,1.87722 0.68182,1.02879 0.83485,2.31056 0.67167,3.51285 -0.17539,1.20282 0.31555,2.52456 1.39832,3.14493 1.34843,0.86475 3.32905,0.33453 4.06507,-1.08834 0.81332,-1.38006 0.20885,-3.33927 -1.24074,-4.02117" + d="m 950.55798,67.642154 c -2.05871,-0.26142 -3.7811,-2.06568 -3.94025,-4.13574 -0.23236,-2.06273 1.11891,-4.16029 3.09291,-4.80202 1.95058,-0.71096 4.30568,0.11085 5.39504,1.87722 0.68182,1.02879 0.83485,2.31056 0.67167,3.51285 -0.17539,1.20282 0.31555,2.52456 1.39832,3.14493 1.34843,0.86475 3.32905,0.33453 4.06507,-1.08834 0.81332,-1.38006 0.20885,-3.33927 -1.24074,-4.02117" id="spiro_splines_mode" sodipodi:nodetypes="cccccccs" /> + <g + id="bezier_mode" + transform="matrix(0.6666666,0,0,0.6666666,983.89131,-64.933593)" + inkscape:label="bezier_mode"> + <rect + y="180" + x="-110" + height="24" + width="24" + id="rect4983" + style="opacity:1;color:#000000;fill:none;stroke:none;stroke-width:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;display:inline" /> + <path + sodipodi:nodetypes="csc" + id="path4985" + d="M -107.5,202 C -108,194 -106.8635,189.64296 -103.53506,186.59779 -100.59756,183.91029 -96,182 -88,182.5" + style="fill:none;stroke:#646464;stroke-width:2.25000023;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" /> + <rect + style="opacity:1;color:#000000;fill:#0000ff;fill-opacity:0.39215686000000000;fill-rule:evenodd;stroke:#0000ff;stroke-width:1.50000015;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;marker-start:none;marker-mid:none;marker-end:none;display:inline" + id="rect4987" + width="6.1177053" + height="5.9961357" + x="-106.5" + y="183.50386" /> + <rect + style="opacity:1;color:#000000;fill:#6464ff;fill-opacity:0.39215686;fill-rule:evenodd;stroke:#6464ff;stroke-width:1.20047224;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;marker-start:none;marker-mid:none;marker-end:none;display:inline" + id="rect4989" + width="4.7995281" + height="4.8015094" + x="-109.89069" + y="198.89249" /> + <use + x="0" + y="0" + xlink:href="#rect10541" + id="use4993" + transform="matrix(1.2004728,0,0,1.2004728,40.464902,-59.444174)" + width="1250" + height="1250" /> + </g> </svg> diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 94fef0945..76ca4e02e 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -362,11 +362,13 @@ static gchar const * ui_descr = " </toolbar>" " <toolbar name='PenToolbar'>" - " <toolitem action='SpiroSplineModeActionPen' />" + " <toolitem action='FreehandModeActionPenTemp' />" + " <toolitem action='FreehandModeActionPen' />" " </toolbar>" " <toolbar name='PencilToolbar'>" - " <toolitem action='SpiroSplineModeActionPencil' />" + " <toolitem action='FreehandModeActionPencilTemp' />" + " <toolitem action='FreehandModeActionPencil' />" " </toolbar>" " <toolbar name='CalligraphyToolbar'>" @@ -3082,35 +3084,80 @@ static void sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActio //## Pen/Pencil ## //######################## -static void sp_pc_spiro_spline_mode_changed(GtkToggleAction *act, GObject* /*tbl*/) +static void sp_pc_spiro_spline_mode_changed(EgeSelectOneAction* act, GObject* /*tbl*/) { - prefs_set_int_attribute("tools.freehand", "spiro-spline-mode", gtk_toggle_action_get_active(act) ? 1 : 0); + prefs_set_int_attribute("tools.freehand", "spiro-spline-mode", ege_select_one_action_get_active(act)); } -static void sp_add_spiro_toggle(GtkActionGroup* mainActions, GObject* holder, const char* action_name) +static void sp_add_spiro_toggle(GtkActionGroup* mainActions, GObject* holder, bool tool_is_pencil) { - /* Spiro Spline Mode toggle button */ + // FIXME: No action is needed, we only want a simple label. But sp_toolbox_add_label() always + // adds the label at the end of the toolbar, whence this workarund. How to avoid this? { - InkToggleAction* act = ink_toggle_action_new(action_name, - _("Spiro Spline Mode"), - _("Automatically apply the 'Spiro Spline' live path effect to newly drawn paths"), - "spiro_splines_mode", - Inkscape::ICON_SIZE_DECORATION ); - gtk_action_group_add_action(mainActions, GTK_ACTION(act)); - g_signal_connect_after(G_OBJECT(act), "toggled", G_CALLBACK(sp_pc_spiro_spline_mode_changed), holder); - gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act), prefs_get_int_attribute("tools.freehand", "spiro-spline-mode", 0)); - g_object_set_data( holder, "spiro_spline_mode", act ); + EgeOutputAction* act = ege_output_action_new( + tool_is_pencil ? + "FreehandModeActionPencilTemp" : + "FreehandModeActionPenTemp", + _("<b>Mode:</b>"), "", 0 ); + ege_output_action_set_use_markup( act, TRUE ); + gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); + g_object_set_data( holder, "freehand_mode_action", act ); + } + + /* Freehand mode toggle buttons */ + { + EgeAdjustmentAction* eact = 0; + //gchar const *flatsidedstr = prefs_get_string_attribute( "tools.shapes.star", "isflatsided" ); + //bool isSpiroMode = flatsidedstr ? (strcmp(flatsidedstr, "false") != 0) : true; + guint spiroMode = prefs_get_int_attribute("tools.freehand", "spiro-spline-mode", 0); + Inkscape::IconSize secondarySize = prefToSize("toolbox", "secondary", 1); + + { + GtkListStore* model = gtk_list_store_new( 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); + + GtkTreeIter iter; + gtk_list_store_append( model, &iter ); + gtk_list_store_set( model, &iter, + 0, _("Bézier"), + 1, _("Regular Bézier mode"), + 2, "bezier_mode", + -1 ); + + gtk_list_store_append( model, &iter ); + gtk_list_store_set( model, &iter, + 0, _("Spiro"), + 1, _("Spiro splines mode"), + 2, "spiro_splines_mode", + -1 ); + + EgeSelectOneAction* act = ege_select_one_action_new(tool_is_pencil ? + "FreehandModeActionPencil" : + "FreehandModeActionPen", + (""), (""), NULL, GTK_TREE_MODEL(model) ); + gtk_action_group_add_action( mainActions, GTK_ACTION(act) ); + g_object_set_data( holder, "freehande_mode_action", act ); + + ege_select_one_action_set_appearance( act, "full" ); + ege_select_one_action_set_radio_action_type( act, INK_RADIO_ACTION_TYPE ); + g_object_set( G_OBJECT(act), "icon-property", "iconId", NULL ); + ege_select_one_action_set_icon_column( act, 2 ); + ege_select_one_action_set_icon_size( act, secondarySize ); + ege_select_one_action_set_tooltip_column( act, 1 ); + + ege_select_one_action_set_active( act, spiroMode); + g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(sp_pc_spiro_spline_mode_changed), holder); + } } } static void sp_pen_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* mainActions, GObject* holder) { - sp_add_spiro_toggle(mainActions, holder, "SpiroSplineModeActionPen"); + sp_add_spiro_toggle(mainActions, holder, false); } static void sp_pencil_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* mainActions, GObject* holder) { - sp_add_spiro_toggle(mainActions, holder, "SpiroSplineModeActionPencil"); + sp_add_spiro_toggle(mainActions, holder, true); } //######################## |
