Code

add Affect: label
[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 *data,
250                                                        gdouble lower,
251                                                        GtkWidget* focusTarget,
252                                                        UnitTracker* tracker,
253                                                        GtkWidget* spw,
254                                                        gchar const *tooltip,
255                                                        gboolean altx )
257     GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, lower, 1e6, SPIN_STEP, SPIN_PAGE_STEP, SPIN_PAGE_STEP ) );
258     if (tracker) {
259         tracker->addAdjustment(adj);
260     }
261     if ( spw ) {
262         g_object_set_data( G_OBJECT(spw), data, adj );
263     }
265     EgeAdjustmentAction* act = ege_adjustment_action_new( adj, name, Q_(label), tooltip, 0, SPIN_STEP, 3 );
267     gtk_signal_connect( GTK_OBJECT(adj), "value_changed", GTK_SIGNAL_FUNC(sp_object_layout_any_value_changed), spw );
268     if ( focusTarget ) {
269         ege_adjustment_action_set_focuswidget( act, focusTarget );
270     }
272     if ( altx ) { // this spinbutton will be activated by alt-x
273         g_object_set( G_OBJECT(act), "self-id", "altx", NULL );
274     }
276     // Using a cast just to make sure we pass in the right kind of function pointer
277     g_object_set( G_OBJECT(act), "tool-post", static_cast<EgeWidgetFixup>(sp_set_font_size_smaller), NULL );
279     return act;
282 // toggle button callbacks and updaters
284 static void toggle_stroke( GtkToggleAction* act, gpointer data ) {
285     gboolean active = gtk_toggle_action_get_active( act );
286     prefs_set_int_attribute( "options.transform", "stroke", active ? 1 : 0 );
287     SPDesktop *desktop = (SPDesktop *)data;
288     if ( active ) {
289         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>stroke width</b> is <b>scaled</b> when objects are scaled."));
290     } else {
291         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>stroke width</b> is <b>not scaled</b> when objects are scaled."));
292     }
295 static void toggle_corners( GtkToggleAction* act, gpointer data) {
296     gboolean active = gtk_toggle_action_get_active( act );
297     prefs_set_int_attribute( "options.transform", "rectcorners", active ? 1 : 0 );
298     SPDesktop *desktop = (SPDesktop *)data;
299     if ( active ) {
300         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>rounded rectangle corners</b> are <b>scaled</b> when rectangles are scaled."));
301     } else {
302         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>rounded rectangle corners</b> are <b>not scaled</b> when rectangles are scaled."));
303     }
306 static void toggle_gradient( GtkToggleAction *act, gpointer data ) {
307     gboolean active = gtk_toggle_action_get_active( act );
308     prefs_set_int_attribute( "options.transform", "gradient", active ? 1 : 0 );
309     SPDesktop *desktop = (SPDesktop *)data;
310     if ( active ) {
311         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)."));
312     } else {
313         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>gradients</b> remain <b>fixed</b> when objects are transformed (moved, scaled, rotated, or skewed)."));
314     }
317 static void toggle_pattern( GtkToggleAction* act, gpointer data ) {
318     gboolean active = gtk_toggle_action_get_active( act );
319     prefs_set_int_attribute( "options.transform", "pattern", active ? 1 : 0 );
320     SPDesktop *desktop = (SPDesktop *)data;
321     if ( active ) {
322         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)."));
323     } else {
324         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>patterns</b> remain <b>fixed</b> when objects are transformed (moved, scaled, rotated, or skewed)."));
325     }
328 static void toggle_lock( GtkToggleAction *act, gpointer data ) {
329     gboolean active = gtk_toggle_action_get_active( act );
330     if ( active ) {
331         g_object_set( G_OBJECT(act), "iconId", "width_height_lock", NULL );
332     } else {
333         g_object_set( G_OBJECT(act), "iconId", "lock_unlocked", NULL );
334     }
337 static void destroy_tracker( GObject* obj, gpointer /*user_data*/ )
339     UnitTracker *tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(obj, "tracker"));
340     if ( tracker ) {
341         delete tracker;
342         g_object_set_data( obj, "tracker", 0 );
343     }
346 static void trigger_sp_action( GtkAction* act, gpointer user_data )
348     SPAction* targetAction = SP_ACTION(user_data);
349     if ( targetAction ) {
350         sp_action_perform( targetAction, NULL );
351     }
354 static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::View::View* view, Inkscape::IconSize size )
356     GtkAction* act = 0;
358     SPAction* targetAction = verb->get_action(view);
359     InkAction* inky = ink_action_new( verb->get_id(), verb->get_name(), verb->get_tip(), verb->get_image(), size  );
360     act = GTK_ACTION(inky);
362     g_signal_connect( G_OBJECT(inky), "activate", GTK_SIGNAL_FUNC(trigger_sp_action), targetAction );
364     return act;
367 void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
369     Inkscape::UI::View::View *view = desktop;
371     GtkAction* act = 0;
373     GtkActionGroup* selectionActions = mainActions; // temporary
375     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_ROTATE_90_CCW), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
376     gtk_action_group_add_action( selectionActions, act );
377     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_ROTATE_90_CW), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
378     gtk_action_group_add_action( selectionActions, act );
379     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_FLIP_HORIZONTAL), 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_OBJECT_FLIP_VERTICAL), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
382     gtk_action_group_add_action( selectionActions, act );
384     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_TO_BACK), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
385     gtk_action_group_add_action( selectionActions, act );
386     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_LOWER), 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_SELECTION_RAISE), 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_SELECTION_TO_FRONT), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
391     gtk_action_group_add_action( selectionActions, act );
393     // Create the parent widget for x y w h tracker.
394     GtkWidget *spw = sp_widget_new_global(INKSCAPE);
396     // Remember the desktop's canvas widget, to be used for defocusing.
397     g_object_set_data(G_OBJECT(spw), "dtw", sp_desktop_canvas(desktop));
399     // The vb frame holds all other widgets and is used to set sensitivity depending on selection state.
400     GtkWidget *vb = gtk_hbox_new(FALSE, 0);
401     gtk_widget_show(vb);
402     gtk_container_add(GTK_CONTAINER(spw), vb);
404     // Create the units menu.
405     UnitTracker* tracker = new UnitTracker( SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE );
406     tracker->addUnit( SP_UNIT_PERCENT, 0 );
407     tracker->setActiveUnit( sp_desktop_namedview(desktop)->doc_units );
409     g_object_set_data( G_OBJECT(spw), "tracker", tracker );
410     g_signal_connect( G_OBJECT(spw), "destroy", G_CALLBACK(destroy_tracker), spw );
412     EgeAdjustmentAction* eact = 0;
414     // four spinbuttons
416     //TRANSLATORS: only translate "string" in "context|string".
417     // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
418     eact = create_adjustment_action( "XAction", _("select_toolbar|X"), "X",
419                                      -1e6, GTK_WIDGET(desktop->canvas), tracker, spw,
420                                      _("Horizontal coordinate of selection"), TRUE );
421     gtk_action_group_add_action( selectionActions, GTK_ACTION(eact) );
423     //TRANSLATORS: only translate "string" in "context|string".
424     // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
425     eact = create_adjustment_action( "YAction", _("select_toolbar|Y"), "Y",
426                                      -1e6, GTK_WIDGET(desktop->canvas), tracker, spw,
427                                      _("Vertical coordinate of selection"), FALSE );
428     gtk_action_group_add_action( selectionActions, GTK_ACTION(eact) );
430     //TRANSLATORS: only translate "string" in "context|string".
431     // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
432     eact = create_adjustment_action( "WidthAction", _("select_toolbar|W"), "width",
433                                      1e-3, GTK_WIDGET(desktop->canvas), tracker, spw,
434                                      _("Width of selection"), FALSE );
435     gtk_action_group_add_action( selectionActions, GTK_ACTION(eact) );
437     // lock toggle
438     {
439     InkToggleAction* itact = ink_toggle_action_new( "LockAction",
440                                                     _("Lock"),
441                                                     _("When locked, change both width and height by the same proportion"),
442                                                     "lock_unlocked",
443                                                     Inkscape::ICON_SIZE_DECORATION );
444     g_object_set_data( G_OBJECT(spw), "lock", itact );
445     g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_lock), desktop) ;
446     gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
447     }
449     //TRANSLATORS: only translate "string" in "context|string".
450     // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
451     eact = create_adjustment_action( "HeightAction", _("select_toolbar|H"), "height",
452                                      1e-3, GTK_WIDGET(desktop->canvas), tracker, spw,
453                                      _("Height of selection"), FALSE );
454     gtk_action_group_add_action( selectionActions, GTK_ACTION(eact) );
456     // Add the units menu.
457     act = tracker->createAction( "UnitsAction", _("Units"), _("") );
458     gtk_action_group_add_action( selectionActions, act );
460     g_object_set_data( G_OBJECT(spw), "selectionActions", selectionActions );
462     // Force update when selection changes.
463     gtk_signal_connect(GTK_OBJECT(spw), "modify_selection", GTK_SIGNAL_FUNC(sp_selection_layout_widget_modify_selection), desktop);
464     gtk_signal_connect(GTK_OBJECT(spw), "change_selection", GTK_SIGNAL_FUNC(sp_selection_layout_widget_change_selection), desktop);
466     // Update now.
467     sp_selection_layout_widget_update(SP_WIDGET(spw), SP_ACTIVE_DESKTOP ? sp_desktop_selection(SP_ACTIVE_DESKTOP) : NULL);
469     // Insert spw into the toolbar.
470     gtk_box_pack_start(GTK_BOX(holder), spw, FALSE, FALSE, 0);
472     // "Transform with object" buttons
474     {
475         EgeOutputAction* act = ege_output_action_new( "transform_affect_label", _("Affect:"), "", 0 );
476         ege_output_action_set_use_markup( act, TRUE );
477         gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
478     }
480     {
481     InkToggleAction* itact = ink_toggle_action_new( "transform_stroke",
482                                                     _("Stroke"),
483                                                     _("When scaling objects, scale the stroke width by the same proportion"),
484                                                     "transform_stroke",
485                                                     Inkscape::ICON_SIZE_DECORATION );
486     gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs_get_int_attribute("options.transform", "stroke", 1) );
487     g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_stroke), desktop) ;
488     gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
489     }
491     {
492     InkToggleAction* itact = ink_toggle_action_new( "transform_corners",
493                                                     _("Corners"),
494                                                     _("When scaling rectangles, scale the radii of rounded corners"),
495                                                     "transform_corners",
496                                                   Inkscape::ICON_SIZE_DECORATION );
497     gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs_get_int_attribute("options.transform", "rectcorners", 1) );
498     g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_corners), desktop) ;
499     gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
500     }
502     {
503     InkToggleAction* itact = ink_toggle_action_new( "transform_gradient",
504                                                     _("Gradient"),
505                                                     _("Move gradients (in fill or stroke) along with the objects"),
506                                                     "transform_gradient",
507                                                   Inkscape::ICON_SIZE_DECORATION );
508     gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs_get_int_attribute("options.transform", "gradient", 1) );
509     g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_gradient), desktop) ;
510     gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
511     }
513     {
514     InkToggleAction* itact = ink_toggle_action_new( "transform_pattern",
515                                                     _("Patterns"),
516                                                     _("Move patterns (in fill or stroke) along with the objects"),
517                                                     "transform_pattern",
518                                                   Inkscape::ICON_SIZE_DECORATION );
519     gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs_get_int_attribute("options.transform", "pattern", 1) );
520     g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_pattern), desktop) ;
521     gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
522     }
526 /*
527   Local Variables:
528   mode:c++
529   c-file-style:"stroustrup"
530   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
531   indent-tabs-mode:nil
532   fill-column:99
533   End:
534 */
535 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :