Code

Implemented use of "short_label" for toolbar items.
[inkscape.git] / src / widgets / select-toolbar.cpp
1 /*
2  * Selector aux toolbar
3  *
4  * Authors:
5  *   Lauris Kaplinski <lauris@kaplinski.com>
6  *   bulia byak <buliabyak@users.sf.net>
7  *   Jon A. Cruz <jon@joncruz.org>
8  *
9  * Copyright (C) 2003-2005 authors
10  *
11  * Released under GNU GPL, read the file 'COPYING' for more information
12  */
14 #ifdef HAVE_CONFIG_H
15 # include "config.h"
16 #endif
18 #include <gtk/gtk.h>
19 #include <gtk/gtkaction.h>
21 #include "widgets/button.h"
22 #include "widgets/spw-utilities.h"
23 #include "widgets/widget-sizes.h"
24 #include "widgets/spinbutton-events.h"
25 #include "widgets/icon.h"
26 #include "widgets/sp-widget.h"
28 #include "prefs-utils.h"
29 #include "selection-chemistry.h"
30 #include "document.h"
31 #include "inkscape.h"
32 #include "desktop-style.h"
33 #include "desktop.h"
34 #include "desktop-handles.h"
35 #include "sp-namedview.h"
36 #include "toolbox.h"
37 #include <glibmm/i18n.h>
38 #include "helper/unit-menu.h"
39 #include "helper/units.h"
40 #include "inkscape.h"
41 #include "verbs.h"
42 #include "prefs-utils.h"
43 #include "selection.h"
44 #include "selection-chemistry.h"
45 #include "sp-item-transform.h"
46 #include "message-stack.h"
47 #include "display/sp-canvas.h"
48 #include "helper/unit-tracker.h"
49 #include "ege-adjustment-action.h"
50 #include "ege-output-action.h"
51 #include "ink-action.h"
53 using Inkscape::UnitTracker;
55 static void
56 sp_selection_layout_widget_update(SPWidget *spw, Inkscape::Selection *sel)
57 {
58     if (g_object_get_data(G_OBJECT(spw), "update")) {
59         return;
60     }
62     g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(TRUE));
63     bool setActive = false;
65     using NR::X;
66     using NR::Y;
67     if ( sel && !sel->isEmpty() ) {
68         NR::Maybe<NR::Rect> const bbox(sel->bounds());
69         if ( bbox && !bbox->isEmpty() ) {
70             UnitTracker *tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(G_OBJECT(spw), "tracker"));
71             SPUnit const &unit = *tracker->getActiveUnit();
73             struct { char const *key; double val; } const keyval[] = {
74                 { "X", bbox->min()[X] },
75                 { "Y", bbox->min()[Y] },
76                 { "width", bbox->extent(X) },
77                 { "height", bbox->extent(Y) }
78             };
80             if (unit.base == SP_UNIT_DIMENSIONLESS) {
81                 double const val = 1. / unit.unittobase;
82                 for (unsigned i = 0; i < G_N_ELEMENTS(keyval); ++i) {
83                     GtkAdjustment *a = (GtkAdjustment *) g_object_get_data(G_OBJECT(spw), keyval[i].key);
84                     gtk_adjustment_set_value(a, val);
85                     tracker->setFullVal( a, keyval[i].val );
86                 }
87             } else {
88                 for (unsigned i = 0; i < G_N_ELEMENTS(keyval); ++i) {
89                     GtkAdjustment *a = (GtkAdjustment *) g_object_get_data(G_OBJECT(spw), keyval[i].key);
90                     gtk_adjustment_set_value(a, sp_pixels_get_units(keyval[i].val, unit));
91                 }
92             }
94             setActive = true;
95         } else {
96             setActive = false;
97         }
98     } else {
99         setActive = false;
100     }
102     GtkActionGroup *selectionActions = GTK_ACTION_GROUP( g_object_get_data(G_OBJECT(spw), "selectionActions") );
103     if ( selectionActions ) {
104 //         gtk_action_group_set_sensitive( selectionActions, setActive );
105     }
107     g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(FALSE));
111 static void
112 sp_selection_layout_widget_modify_selection(SPWidget *spw, Inkscape::Selection *selection, guint flags, gpointer data)
114     SPDesktop *desktop = (SPDesktop *) data;
115     if ((sp_desktop_selection(desktop) == selection) // only respond to changes in our desktop
116         && (flags & (SP_OBJECT_MODIFIED_FLAG        |
117                      SP_OBJECT_PARENT_MODIFIED_FLAG |
118                      SP_OBJECT_CHILD_MODIFIED_FLAG   )))
119     {
120         sp_selection_layout_widget_update(spw, selection);
121     }
124 static void
125 sp_selection_layout_widget_change_selection(SPWidget *spw, Inkscape::Selection *selection, gpointer data)
127     SPDesktop *desktop = (SPDesktop *) data;
128     if (sp_desktop_selection(desktop) == selection) // only respond to changes in our desktop
129         sp_selection_layout_widget_update(spw, selection);
132 static void
133 sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw)
135     if (g_object_get_data(G_OBJECT(spw), "update")) {
136         return;
137     }
139     UnitTracker *tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(G_OBJECT(spw), "tracker"));
140     if ( !tracker || tracker->isUpdating() ) {
141         /*
142          * When only units are being changed, don't treat changes
143          * to adjuster values as object changes.
144          */
145         return;
146     }
147     g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(TRUE));
149     SPDesktop *desktop = SP_ACTIVE_DESKTOP;
150     Inkscape::Selection *selection = sp_desktop_selection(desktop);
151     SPDocument *document = sp_desktop_document(desktop);
153     sp_document_ensure_up_to_date (document);
154     NR::Maybe<NR::Rect> bbox = selection->bounds();
156     if ( !bbox || bbox->isEmpty() ) {
157         g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(FALSE));
158         return;
159     }
161     gdouble x0 = 0;
162     gdouble y0 = 0;
163     gdouble x1 = 0;
164     gdouble y1 = 0;
165     gdouble xrel = 0;
166     gdouble yrel = 0;
167     SPUnit const &unit = *tracker->getActiveUnit();
169     GtkAdjustment* a_x = GTK_ADJUSTMENT( g_object_get_data( G_OBJECT(spw), "X" ) );
170     GtkAdjustment* a_y = GTK_ADJUSTMENT( g_object_get_data( G_OBJECT(spw), "Y" ) );
171     GtkAdjustment* a_w = GTK_ADJUSTMENT( g_object_get_data( G_OBJECT(spw), "width" ) );
172     GtkAdjustment* a_h = GTK_ADJUSTMENT( g_object_get_data( G_OBJECT(spw), "height" ) );
174     if (unit.base == SP_UNIT_ABSOLUTE || unit.base == SP_UNIT_DEVICE) {
175         x0 = sp_units_get_pixels (a_x->value, unit);
176         y0 = sp_units_get_pixels (a_y->value, unit);
177         x1 = x0 + sp_units_get_pixels (a_w->value, unit);
178         xrel = sp_units_get_pixels (a_w->value, unit) / bbox->extent(NR::X);
179         y1 = y0 + sp_units_get_pixels (a_h->value, unit);
180         yrel = sp_units_get_pixels (a_h->value, unit) / bbox->extent(NR::Y);
181     } else {
182         double const x0_propn = a_x->value * unit.unittobase;
183         x0 = bbox->min()[NR::X] * x0_propn;
184         double const y0_propn = a_y->value * unit.unittobase;
185         y0 = y0_propn * bbox->min()[NR::Y];
186         xrel = a_w->value * unit.unittobase;
187         x1 = x0 + xrel * bbox->extent(NR::X);
188         yrel = a_h->value * unit.unittobase;
189         y1 = y0 + yrel * bbox->extent(NR::Y);
190     }
192     // Keep proportions if lock is on
193     GtkToggleAction *lock = GTK_TOGGLE_ACTION( g_object_get_data(G_OBJECT(spw), "lock") );
194     if ( gtk_toggle_action_get_active(lock) ) {
195         if (adj == a_h) {
196             x1 = x0 + yrel * bbox->extent(NR::X);
197         } else if (adj == a_w) {
198             y1 = y0 + xrel * bbox->extent(NR::Y);
199         }
200     }
202     // scales and moves, in px
203     double mh = fabs(x0 - bbox->min()[NR::X]);
204     double sh = fabs(x1 - bbox->max()[NR::X]);
205     double mv = fabs(y0 - bbox->min()[NR::Y]);
206     double sv = fabs(y1 - bbox->max()[NR::Y]);
208     // unless the unit is %, convert the scales and moves to the unit
209     if (unit.base == SP_UNIT_ABSOLUTE || unit.base == SP_UNIT_DEVICE) {
210         mh = sp_pixels_get_units (mh, unit);
211         sh = sp_pixels_get_units (sh, unit);
212         mv = sp_pixels_get_units (mv, unit);
213         sv = sp_pixels_get_units (sv, unit);
214     }
216     // do the action only if one of the scales/moves is greater than half the last significant
217     // digit in the spinbox (currently spinboxes have 3 fractional digits, so that makes 0.0005). If
218     // the value was changed by the user, the difference will be at least that much; otherwise it's
219     // just rounding difference between the spinbox value and actual value, so no action is
220     // performed
221     char const * const actionkey = ( mh > 5e-4 ? "selector:toolbar:move:horizontal" :
222                                      sh > 5e-4 ? "selector:toolbar:scale:horizontal" :
223                                      mv > 5e-4 ? "selector:toolbar:move:vertical" :
224                                      sv > 5e-4 ? "selector:toolbar:scale:vertical" : NULL );
226     if (actionkey != NULL) {
228         // FIXME: fix for GTK breakage, see comment in SelectedStyle::on_opacity_changed
229         sp_canvas_force_full_redraw_after_interruptions(sp_desktop_canvas(desktop), 0);
231         gdouble strokewidth = stroke_average_width (selection->itemList());
232         int transform_stroke = prefs_get_int_attribute ("options.transform", "stroke", 1);
234         NR::Matrix scaler = get_scale_transform_with_stroke (*bbox, strokewidth, transform_stroke, x0, y0, x1, y1);
236         sp_selection_apply_affine(selection, scaler);
237         sp_document_maybe_done (document, actionkey, SP_VERB_CONTEXT_SELECT,
238                                 _("Transform by toolbar"));
240         // resume interruptibility
241         sp_canvas_end_forced_full_redraws(sp_desktop_canvas(desktop));
242     }
244     g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(FALSE));
247 static EgeAdjustmentAction * create_adjustment_action( gchar const *name,
248                                                        gchar const *label,
249                                                        gchar const *shortLabel,
250                                                        gchar const *data,
251                                                        gdouble lower,
252                                                        GtkWidget* focusTarget,
253                                                        UnitTracker* tracker,
254                                                        GtkWidget* spw,
255                                                        gchar const *tooltip,
256                                                        gboolean altx )
258     GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, lower, 1e6, SPIN_STEP, SPIN_PAGE_STEP, SPIN_PAGE_STEP ) );
259     if (tracker) {
260         tracker->addAdjustment(adj);
261     }
262     if ( spw ) {
263         g_object_set_data( G_OBJECT(spw), data, adj );
264     }
266     EgeAdjustmentAction* act = ege_adjustment_action_new( adj, name, Q_(label), tooltip, 0, SPIN_STEP, 3 );
267     if ( shortLabel ) {
268         g_object_set( act, "short_label", Q_(shortLabel), NULL );
269     }
271     gtk_signal_connect( GTK_OBJECT(adj), "value_changed", GTK_SIGNAL_FUNC(sp_object_layout_any_value_changed), spw );
272     if ( focusTarget ) {
273         ege_adjustment_action_set_focuswidget( act, focusTarget );
274     }
276     if ( altx ) { // this spinbutton will be activated by alt-x
277         g_object_set( G_OBJECT(act), "self-id", "altx", NULL );
278     }
280     // Using a cast just to make sure we pass in the right kind of function pointer
281     g_object_set( G_OBJECT(act), "tool-post", static_cast<EgeWidgetFixup>(sp_set_font_size_smaller), NULL );
283     return act;
286 // toggle button callbacks and updaters
288 static void toggle_stroke( GtkToggleAction* act, gpointer data ) {
289     gboolean active = gtk_toggle_action_get_active( act );
290     prefs_set_int_attribute( "options.transform", "stroke", active ? 1 : 0 );
291     SPDesktop *desktop = (SPDesktop *)data;
292     if ( active ) {
293         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>stroke width</b> is <b>scaled</b> when objects are scaled."));
294     } else {
295         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>stroke width</b> is <b>not scaled</b> when objects are scaled."));
296     }
299 static void toggle_corners( GtkToggleAction* act, gpointer data) {
300     gboolean active = gtk_toggle_action_get_active( act );
301     prefs_set_int_attribute( "options.transform", "rectcorners", active ? 1 : 0 );
302     SPDesktop *desktop = (SPDesktop *)data;
303     if ( active ) {
304         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>rounded rectangle corners</b> are <b>scaled</b> when rectangles are scaled."));
305     } else {
306         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>rounded rectangle corners</b> are <b>not scaled</b> when rectangles are scaled."));
307     }
310 static void toggle_gradient( GtkToggleAction *act, gpointer data ) {
311     gboolean active = gtk_toggle_action_get_active( act );
312     prefs_set_int_attribute( "options.transform", "gradient", active ? 1 : 0 );
313     SPDesktop *desktop = (SPDesktop *)data;
314     if ( active ) {
315         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>gradients</b> are <b>transformed</b> along with their objects when those are transformed (moved, scaled, rotated, or skewed)."));
316     } else {
317         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>gradients</b> remain <b>fixed</b> when objects are transformed (moved, scaled, rotated, or skewed)."));
318     }
321 static void toggle_pattern( GtkToggleAction* act, gpointer data ) {
322     gboolean active = gtk_toggle_action_get_active( act );
323     prefs_set_int_attribute( "options.transform", "pattern", active ? 1 : 0 );
324     SPDesktop *desktop = (SPDesktop *)data;
325     if ( active ) {
326         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>patterns</b> are <b>transformed</b> along with their objects when those are transformed (moved, scaled, rotated, or skewed)."));
327     } else {
328         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>patterns</b> remain <b>fixed</b> when objects are transformed (moved, scaled, rotated, or skewed)."));
329     }
332 static void toggle_lock( GtkToggleAction *act, gpointer /*data*/ ) {
333     gboolean active = gtk_toggle_action_get_active( act );
334     if ( active ) {
335         g_object_set( G_OBJECT(act), "iconId", "width_height_lock", NULL );
336     } else {
337         g_object_set( G_OBJECT(act), "iconId", "lock_unlocked", NULL );
338     }
341 static void destroy_tracker( GObject* obj, gpointer /*user_data*/ )
343     UnitTracker *tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(obj, "tracker"));
344     if ( tracker ) {
345         delete tracker;
346         g_object_set_data( obj, "tracker", 0 );
347     }
350 static void trigger_sp_action( GtkAction* /*act*/, gpointer user_data )
352     SPAction* targetAction = SP_ACTION(user_data);
353     if ( targetAction ) {
354         sp_action_perform( targetAction, NULL );
355     }
358 static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::View::View* view, Inkscape::IconSize size )
360     GtkAction* act = 0;
362     SPAction* targetAction = verb->get_action(view);
363     InkAction* inky = ink_action_new( verb->get_id(), verb->get_name(), verb->get_tip(), verb->get_image(), size  );
364     act = GTK_ACTION(inky);
366     g_signal_connect( G_OBJECT(inky), "activate", GTK_SIGNAL_FUNC(trigger_sp_action), targetAction );
368     return act;
371 void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
373     Inkscape::UI::View::View *view = desktop;
375     GtkAction* act = 0;
377     GtkActionGroup* selectionActions = mainActions; // temporary
379     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_EDIT_SELECT_ALL), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
380     gtk_action_group_add_action( selectionActions, act );
381     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
382     gtk_action_group_add_action( selectionActions, act );
383     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_EDIT_DESELECT), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
384     gtk_action_group_add_action( selectionActions, act );
386     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_ROTATE_90_CCW), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
387     gtk_action_group_add_action( selectionActions, act );
388     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_ROTATE_90_CW), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
389     gtk_action_group_add_action( selectionActions, act );
390     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_FLIP_HORIZONTAL), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
391     gtk_action_group_add_action( selectionActions, act );
392     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_FLIP_VERTICAL), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
393     gtk_action_group_add_action( selectionActions, act );
395     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_TO_BACK), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
396     gtk_action_group_add_action( selectionActions, act );
397     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_LOWER), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
398     gtk_action_group_add_action( selectionActions, act );
399     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_RAISE), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
400     gtk_action_group_add_action( selectionActions, act );
401     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_TO_FRONT), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
402     gtk_action_group_add_action( selectionActions, act );
404     // Create the parent widget for x y w h tracker.
405     GtkWidget *spw = sp_widget_new_global(INKSCAPE);
407     // Remember the desktop's canvas widget, to be used for defocusing.
408     g_object_set_data(G_OBJECT(spw), "dtw", sp_desktop_canvas(desktop));
410     // The vb frame holds all other widgets and is used to set sensitivity depending on selection state.
411     GtkWidget *vb = gtk_hbox_new(FALSE, 0);
412     gtk_widget_show(vb);
413     gtk_container_add(GTK_CONTAINER(spw), vb);
415     // Create the units menu.
416     UnitTracker* tracker = new UnitTracker( SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE );
417     tracker->addUnit( SP_UNIT_PERCENT, 0 );
418     tracker->setActiveUnit( sp_desktop_namedview(desktop)->doc_units );
420     g_object_set_data( G_OBJECT(spw), "tracker", tracker );
421     g_signal_connect( G_OBJECT(spw), "destroy", G_CALLBACK(destroy_tracker), spw );
423     EgeAdjustmentAction* eact = 0;
425     // four spinbuttons
427     //TRANSLATORS: only translate "string" in "context|string".
428     // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
429     eact = create_adjustment_action( "XAction", _("select_toolbar|X position"), _("select_toolbar|X"), "X",
430                                      -1e6, GTK_WIDGET(desktop->canvas), tracker, spw,
431                                      _("Horizontal coordinate of selection"), TRUE );
432     gtk_action_group_add_action( selectionActions, GTK_ACTION(eact) );
434     //TRANSLATORS: only translate "string" in "context|string".
435     // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
436     eact = create_adjustment_action( "YAction", _("select_toolbar|Y position"), _("select_toolbar|Y"), "Y",
437                                      -1e6, GTK_WIDGET(desktop->canvas), tracker, spw,
438                                      _("Vertical coordinate of selection"), FALSE );
439     gtk_action_group_add_action( selectionActions, GTK_ACTION(eact) );
441     //TRANSLATORS: only translate "string" in "context|string".
442     // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
443     eact = create_adjustment_action( "WidthAction", _("select_toolbar|Width"), _("select_toolbar|W"), "width",
444                                      1e-3, GTK_WIDGET(desktop->canvas), tracker, spw,
445                                      _("Width of selection"), FALSE );
446     gtk_action_group_add_action( selectionActions, GTK_ACTION(eact) );
448     // lock toggle
449     {
450     InkToggleAction* itact = ink_toggle_action_new( "LockAction",
451                                                     _("Lock width and height"),
452                                                     _("When locked, change both width and height by the same proportion"),
453                                                     "lock_unlocked",
454                                                     Inkscape::ICON_SIZE_DECORATION );
455     g_object_set( itact, "short_label", "Lock", NULL );
456     g_object_set_data( G_OBJECT(spw), "lock", itact );
457     g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_lock), desktop) ;
458     gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
459     }
461     //TRANSLATORS: only translate "string" in "context|string".
462     // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
463     eact = create_adjustment_action( "HeightAction", _("select_toolbar|Height"), _("select_toolbar|H"), "height",
464                                      1e-3, GTK_WIDGET(desktop->canvas), tracker, spw,
465                                      _("Height of selection"), FALSE );
466     gtk_action_group_add_action( selectionActions, GTK_ACTION(eact) );
468     // Add the units menu.
469     act = tracker->createAction( "UnitsAction", _("Units"), ("") );
470     gtk_action_group_add_action( selectionActions, act );
472     g_object_set_data( G_OBJECT(spw), "selectionActions", selectionActions );
474     // Force update when selection changes.
475     gtk_signal_connect(GTK_OBJECT(spw), "modify_selection", GTK_SIGNAL_FUNC(sp_selection_layout_widget_modify_selection), desktop);
476     gtk_signal_connect(GTK_OBJECT(spw), "change_selection", GTK_SIGNAL_FUNC(sp_selection_layout_widget_change_selection), desktop);
478     // Update now.
479     sp_selection_layout_widget_update(SP_WIDGET(spw), SP_ACTIVE_DESKTOP ? sp_desktop_selection(SP_ACTIVE_DESKTOP) : NULL);
481     // Insert spw into the toolbar.
482     gtk_box_pack_start(GTK_BOX(holder), spw, FALSE, FALSE, 0);
484     // "Transform with object" buttons
486     {
487         EgeOutputAction* act = ege_output_action_new( "transform_affect_label", _("Affect:"), "", 0 );
488         ege_output_action_set_use_markup( act, TRUE );
489         g_object_set( act, "visible-overflown", FALSE, NULL );
490         gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
491     }
493     {
494     InkToggleAction* itact = ink_toggle_action_new( "transform_stroke",
495                                                     _("Scale stroke width"),
496                                                     _("When scaling objects, scale the stroke width by the same proportion"),
497                                                     "transform_stroke",
498                                                     Inkscape::ICON_SIZE_DECORATION );
499     gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs_get_int_attribute("options.transform", "stroke", 1) );
500     g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_stroke), desktop) ;
501     gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
502     }
504     {
505     InkToggleAction* itact = ink_toggle_action_new( "transform_corners",
506                                                     _("Scale rounded corners"),
507                                                     _("When scaling rectangles, scale the radii of rounded corners"),
508                                                     "transform_corners",
509                                                   Inkscape::ICON_SIZE_DECORATION );
510     gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs_get_int_attribute("options.transform", "rectcorners", 1) );
511     g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_corners), desktop) ;
512     gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
513     }
515     {
516     InkToggleAction* itact = ink_toggle_action_new( "transform_gradient",
517                                                     _("Move gradients"),
518                                                     _("Move gradients (in fill or stroke) along with the objects"),
519                                                     "transform_gradient",
520                                                   Inkscape::ICON_SIZE_DECORATION );
521     gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs_get_int_attribute("options.transform", "gradient", 1) );
522     g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_gradient), desktop) ;
523     gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
524     }
526     {
527     InkToggleAction* itact = ink_toggle_action_new( "transform_pattern",
528                                                     _("Move patterns"),
529                                                     _("Move patterns (in fill or stroke) along with the objects"),
530                                                     "transform_pattern",
531                                                   Inkscape::ICON_SIZE_DECORATION );
532     gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs_get_int_attribute("options.transform", "pattern", 1) );
533     g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_pattern), desktop) ;
534     gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
535     }
539 /*
540   Local Variables:
541   mode:c++
542   c-file-style:"stroustrup"
543   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
544   indent-tabs-mode:nil
545   fill-column:99
546   End:
547 */
548 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :