Code

more unreffing temporary styles properly
[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 "ink-action.h"
52 using Inkscape::UnitTracker;
54 static void
55 sp_selection_layout_widget_update(SPWidget *spw, Inkscape::Selection *sel)
56 {
57     if (g_object_get_data(G_OBJECT(spw), "update")) {
58         return;
59     }
61     g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(TRUE));
62     bool setActive = false;
64     using NR::X;
65     using NR::Y;
66     if ( sel && !sel->isEmpty() ) {
67         NR::Maybe<NR::Rect> const bbox(sel->bounds());
68         if ( bbox && !bbox->isEmpty() ) {
69             UnitTracker *tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(G_OBJECT(spw), "tracker"));
70             SPUnit const &unit = *tracker->getActiveUnit();
72             struct { char const *key; double val; } const keyval[] = {
73                 { "X", bbox->min()[X] },
74                 { "Y", bbox->min()[Y] },
75                 { "width", bbox->extent(X) },
76                 { "height", bbox->extent(Y) }
77             };
79             if (unit.base == SP_UNIT_DIMENSIONLESS) {
80                 double const val = 1. / unit.unittobase;
81                 for (unsigned i = 0; i < G_N_ELEMENTS(keyval); ++i) {
82                     GtkAdjustment *a = (GtkAdjustment *) g_object_get_data(G_OBJECT(spw), keyval[i].key);
83                     gtk_adjustment_set_value(a, val);
84                     tracker->setFullVal( a, keyval[i].val );
85                 }
86             } else {
87                 for (unsigned i = 0; i < G_N_ELEMENTS(keyval); ++i) {
88                     GtkAdjustment *a = (GtkAdjustment *) g_object_get_data(G_OBJECT(spw), keyval[i].key);
89                     gtk_adjustment_set_value(a, sp_pixels_get_units(keyval[i].val, unit));
90                 }
91             }
93             setActive = true;
94         } else {
95             setActive = false;
96         }
97     } else {
98         setActive = false;
99     }
101     GtkActionGroup *selectionActions = GTK_ACTION_GROUP( g_object_get_data(G_OBJECT(spw), "selectionActions") );
102     if ( selectionActions ) {
103 //         gtk_action_group_set_sensitive( selectionActions, setActive );
104     }
106     g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(FALSE));
110 static void
111 sp_selection_layout_widget_modify_selection(SPWidget *spw, Inkscape::Selection *selection, guint flags, gpointer data)
113     SPDesktop *desktop = (SPDesktop *) data;
114     if ((sp_desktop_selection(desktop) == selection) // only respond to changes in our desktop
115         && (flags & (SP_OBJECT_MODIFIED_FLAG        |
116                      SP_OBJECT_PARENT_MODIFIED_FLAG |
117                      SP_OBJECT_CHILD_MODIFIED_FLAG   )))
118     {
119         sp_selection_layout_widget_update(spw, selection);
120     }
123 static void
124 sp_selection_layout_widget_change_selection(SPWidget *spw, Inkscape::Selection *selection, gpointer data)
126     SPDesktop *desktop = (SPDesktop *) data;
127     if (sp_desktop_selection(desktop) == selection) // only respond to changes in our desktop
128         sp_selection_layout_widget_update(spw, selection);
131 static void
132 sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw)
134     if (g_object_get_data(G_OBJECT(spw), "update")) {
135         return;
136     }
138     UnitTracker *tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(G_OBJECT(spw), "tracker"));
139     if ( !tracker || tracker->isUpdating() ) {
140         /*
141          * When only units are being changed, don't treat changes
142          * to adjuster values as object changes.
143          */
144         return;
145     }
146     g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(TRUE));
148     SPDesktop *desktop = SP_ACTIVE_DESKTOP;
149     Inkscape::Selection *selection = sp_desktop_selection(desktop);
150     SPDocument *document = sp_desktop_document(desktop);
152     sp_document_ensure_up_to_date (document);
153     NR::Maybe<NR::Rect> bbox = selection->bounds();
155     if ( !bbox || bbox->isEmpty() ) {
156         g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(FALSE));
157         return;
158     }
160     gdouble x0 = 0;
161     gdouble y0 = 0;
162     gdouble x1 = 0;
163     gdouble y1 = 0;
164     gdouble xrel = 0;
165     gdouble yrel = 0;
166     SPUnit const &unit = *tracker->getActiveUnit();
168     GtkAdjustment* a_x = GTK_ADJUSTMENT( g_object_get_data( G_OBJECT(spw), "X" ) );
169     GtkAdjustment* a_y = GTK_ADJUSTMENT( g_object_get_data( G_OBJECT(spw), "Y" ) );
170     GtkAdjustment* a_w = GTK_ADJUSTMENT( g_object_get_data( G_OBJECT(spw), "width" ) );
171     GtkAdjustment* a_h = GTK_ADJUSTMENT( g_object_get_data( G_OBJECT(spw), "height" ) );
173     if (unit.base == SP_UNIT_ABSOLUTE || unit.base == SP_UNIT_DEVICE) {
174         x0 = sp_units_get_pixels (a_x->value, unit);
175         y0 = sp_units_get_pixels (a_y->value, unit);
176         x1 = x0 + sp_units_get_pixels (a_w->value, unit);
177         xrel = sp_units_get_pixels (a_w->value, unit) / bbox->extent(NR::X);
178         y1 = y0 + sp_units_get_pixels (a_h->value, unit);
179         yrel = sp_units_get_pixels (a_h->value, unit) / bbox->extent(NR::Y);
180     } else {
181         double const x0_propn = a_x->value * unit.unittobase;
182         x0 = bbox->min()[NR::X] * x0_propn;
183         double const y0_propn = a_y->value * unit.unittobase;
184         y0 = y0_propn * bbox->min()[NR::Y];
185         xrel = a_w->value * unit.unittobase;
186         x1 = x0 + xrel * bbox->extent(NR::X);
187         yrel = a_h->value * unit.unittobase;
188         y1 = y0 + yrel * bbox->extent(NR::Y);
189     }
191     // Keep proportions if lock is on
192     GtkToggleAction *lock = GTK_TOGGLE_ACTION( g_object_get_data(G_OBJECT(spw), "lock") );
193     if ( gtk_toggle_action_get_active(lock) ) {
194         if (adj == a_h) {
195             x1 = x0 + yrel * bbox->extent(NR::X);
196         } else if (adj == a_w) {
197             y1 = y0 + xrel * bbox->extent(NR::Y);
198         }
199     }
201     // scales and moves, in px
202     double mh = fabs(x0 - bbox->min()[NR::X]);
203     double sh = fabs(x1 - bbox->max()[NR::X]);
204     double mv = fabs(y0 - bbox->min()[NR::Y]);
205     double sv = fabs(y1 - bbox->max()[NR::Y]);
207     // unless the unit is %, convert the scales and moves to the unit
208     if (unit.base == SP_UNIT_ABSOLUTE || unit.base == SP_UNIT_DEVICE) {
209         mh = sp_pixels_get_units (mh, unit);
210         sh = sp_pixels_get_units (sh, unit);
211         mv = sp_pixels_get_units (mv, unit);
212         sv = sp_pixels_get_units (sv, unit);
213     }
215     // do the action only if one of the scales/moves is greater than half the last significant
216     // digit in the spinbox (currently spinboxes have 3 fractional digits, so that makes 0.0005). If
217     // the value was changed by the user, the difference will be at least that much; otherwise it's
218     // just rounding difference between the spinbox value and actual value, so no action is
219     // performed
220     char const * const actionkey = ( mh > 5e-4 ? "selector:toolbar:move:horizontal" :
221                                      sh > 5e-4 ? "selector:toolbar:scale:horizontal" :
222                                      mv > 5e-4 ? "selector:toolbar:move:vertical" :
223                                      sv > 5e-4 ? "selector:toolbar:scale:vertical" : NULL );
225     if (actionkey != NULL) {
227         // FIXME: fix for GTK breakage, see comment in SelectedStyle::on_opacity_changed
228         sp_canvas_force_full_redraw_after_interruptions(sp_desktop_canvas(desktop), 0);
230         gdouble strokewidth = stroke_average_width (selection->itemList());
231         int transform_stroke = prefs_get_int_attribute ("options.transform", "stroke", 1);
233         NR::Matrix scaler = get_scale_transform_with_stroke (*bbox, strokewidth, transform_stroke, x0, y0, x1, y1);
235         sp_selection_apply_affine(selection, scaler);
236         sp_document_maybe_done (document, actionkey, SP_VERB_CONTEXT_SELECT,
237                                 _("Transform by toolbar"));
239         // resume interruptibility
240         sp_canvas_end_forced_full_redraws(sp_desktop_canvas(desktop));
241     }
243     g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(FALSE));
246 static EgeAdjustmentAction * create_adjustment_action( gchar const *name,
247                                                        gchar const *label,
248                                                        gchar const *data,
249                                                        gdouble lower,
250                                                        GtkWidget* focusTarget,
251                                                        UnitTracker* tracker,
252                                                        GtkWidget* spw,
253                                                        gchar const *tooltip,
254                                                        gboolean altx )
256     GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, lower, 1e6, SPIN_STEP, SPIN_PAGE_STEP, SPIN_PAGE_STEP ) );
257     if (tracker) {
258         tracker->addAdjustment(adj);
259     }
260     if ( spw ) {
261         g_object_set_data( G_OBJECT(spw), data, adj );
262     }
264     EgeAdjustmentAction* act = ege_adjustment_action_new( adj, name, Q_(label), tooltip, 0, SPIN_STEP, 3 );
266     gtk_signal_connect( GTK_OBJECT(adj), "value_changed", GTK_SIGNAL_FUNC(sp_object_layout_any_value_changed), spw );
267     if ( focusTarget ) {
268         ege_adjustment_action_set_focuswidget( act, focusTarget );
269     }
271     if ( altx ) { // this spinbutton will be activated by alt-x
272         g_object_set( G_OBJECT(act), "self-id", "altx", NULL );
273     }
275     // Using a cast just to make sure we pass in the right kind of function pointer
276     g_object_set( G_OBJECT(act), "tool-post", static_cast<EgeWidgetFixup>(sp_set_font_size_smaller), NULL );
278     return act;
281 // toggle button callbacks and updaters
283 static void toggle_stroke( GtkToggleAction* act, gpointer data ) {
284     gboolean active = gtk_toggle_action_get_active( act );
285     prefs_set_int_attribute( "options.transform", "stroke", active ? 1 : 0 );
286     SPDesktop *desktop = (SPDesktop *)data;
287     if ( active ) {
288         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>stroke width</b> is <b>scaled</b> when objects are scaled."));
289     } else {
290         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>stroke width</b> is <b>not scaled</b> when objects are scaled."));
291     }
294 static void toggle_corners( GtkToggleAction* act, gpointer data) {
295     gboolean active = gtk_toggle_action_get_active( act );
296     prefs_set_int_attribute( "options.transform", "rectcorners", active ? 1 : 0 );
297     SPDesktop *desktop = (SPDesktop *)data;
298     if ( active ) {
299         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>rounded rectangle corners</b> are <b>scaled</b> when rectangles are scaled."));
300     } else {
301         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>rounded rectangle corners</b> are <b>not scaled</b> when rectangles are scaled."));
302     }
305 static void toggle_gradient( GtkToggleAction *act, gpointer data ) {
306     gboolean active = gtk_toggle_action_get_active( act );
307     prefs_set_int_attribute( "options.transform", "gradient", active ? 1 : 0 );
308     SPDesktop *desktop = (SPDesktop *)data;
309     if ( active ) {
310         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)."));
311     } else {
312         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>gradients</b> remain <b>fixed</b> when objects are transformed (moved, scaled, rotated, or skewed)."));
313     }
316 static void toggle_pattern( GtkToggleAction* act, gpointer data ) {
317     gboolean active = gtk_toggle_action_get_active( act );
318     prefs_set_int_attribute( "options.transform", "pattern", active ? 1 : 0 );
319     SPDesktop *desktop = (SPDesktop *)data;
320     if ( active ) {
321         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)."));
322     } else {
323         desktop->messageStack()->flash(Inkscape::INFORMATION_MESSAGE, _("Now <b>patterns</b> remain <b>fixed</b> when objects are transformed (moved, scaled, rotated, or skewed)."));
324     }
327 static void toggle_lock( GtkToggleAction *act, gpointer data ) {
328     gboolean active = gtk_toggle_action_get_active( act );
329     if ( active ) {
330         g_object_set( G_OBJECT(act), "iconId", "width_height_lock", NULL );
331     } else {
332         g_object_set( G_OBJECT(act), "iconId", "lock_unlocked", NULL );
333     }
336 static void destroy_tracker( GObject* obj, gpointer /*user_data*/ )
338     UnitTracker *tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(obj, "tracker"));
339     if ( tracker ) {
340         delete tracker;
341         g_object_set_data( obj, "tracker", 0 );
342     }
345 static void trigger_sp_action( GtkAction* act, gpointer user_data )
347     SPAction* targetAction = SP_ACTION(user_data);
348     if ( targetAction ) {
349         sp_action_perform( targetAction, NULL );
350     }
353 static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::View::View* view, Inkscape::IconSize size )
355     GtkAction* act = 0;
357     SPAction* targetAction = verb->get_action(view);
358     InkAction* inky = ink_action_new( verb->get_id(), verb->get_name(), verb->get_tip(), verb->get_image(), size  );
359     act = GTK_ACTION(inky);
361     g_signal_connect( G_OBJECT(inky), "activate", GTK_SIGNAL_FUNC(trigger_sp_action), targetAction );
363     return act;
366 void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
368     Inkscape::UI::View::View *view = desktop;
370     GtkAction* act = 0;
372     GtkActionGroup* selectionActions = mainActions; // temporary
374     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_ROTATE_90_CCW), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
375     gtk_action_group_add_action( selectionActions, act );
376     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_ROTATE_90_CW), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
377     gtk_action_group_add_action( selectionActions, act );
378     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_FLIP_HORIZONTAL), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
379     gtk_action_group_add_action( selectionActions, act );
380     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_FLIP_VERTICAL), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
381     gtk_action_group_add_action( selectionActions, act );
383     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_TO_BACK), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
384     gtk_action_group_add_action( selectionActions, act );
385     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_LOWER), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
386     gtk_action_group_add_action( selectionActions, act );
387     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_RAISE), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
388     gtk_action_group_add_action( selectionActions, act );
389     act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_TO_FRONT), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
390     gtk_action_group_add_action( selectionActions, act );
392     // Create the parent widget for x y w h tracker.
393     GtkWidget *spw = sp_widget_new_global(INKSCAPE);
395     // Remember the desktop's canvas widget, to be used for defocusing.
396     g_object_set_data(G_OBJECT(spw), "dtw", sp_desktop_canvas(desktop));
398     // The vb frame holds all other widgets and is used to set sensitivity depending on selection state.
399     GtkWidget *vb = gtk_hbox_new(FALSE, 0);
400     gtk_widget_show(vb);
401     gtk_container_add(GTK_CONTAINER(spw), vb);
403     // Create the units menu.
404     UnitTracker* tracker = new UnitTracker( SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE );
405     tracker->addUnit( SP_UNIT_PERCENT, 0 );
406     tracker->setActiveUnit( sp_desktop_namedview(desktop)->doc_units );
408     g_object_set_data( G_OBJECT(spw), "tracker", tracker );
409     g_signal_connect( G_OBJECT(spw), "destroy", G_CALLBACK(destroy_tracker), spw );
411     EgeAdjustmentAction* eact = 0;
413     // four spinbuttons
415     //TRANSLATORS: only translate "string" in "context|string".
416     // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
417     eact = create_adjustment_action( "XAction", _("select_toolbar|X"), "X",
418                                      -1e6, GTK_WIDGET(desktop->canvas), tracker, spw,
419                                      _("Horizontal coordinate of selection"), TRUE );
420     gtk_action_group_add_action( selectionActions, GTK_ACTION(eact) );
422     //TRANSLATORS: only translate "string" in "context|string".
423     // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
424     eact = create_adjustment_action( "YAction", _("select_toolbar|Y"), "Y",
425                                      -1e6, GTK_WIDGET(desktop->canvas), tracker, spw,
426                                      _("Vertical coordinate of selection"), FALSE );
427     gtk_action_group_add_action( selectionActions, GTK_ACTION(eact) );
429     //TRANSLATORS: only translate "string" in "context|string".
430     // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
431     eact = create_adjustment_action( "WidthAction", _("select_toolbar|W"), "width",
432                                      1e-3, GTK_WIDGET(desktop->canvas), tracker, spw,
433                                      _("Width of selection"), FALSE );
434     gtk_action_group_add_action( selectionActions, GTK_ACTION(eact) );
436     // lock toggle
437     {
438     InkToggleAction* itact = ink_toggle_action_new( "LockAction",
439                                                     _("Lock"),
440                                                     _("When locked, change both width and height by the same proportion"),
441                                                     "lock_unlocked",
442                                                     Inkscape::ICON_SIZE_DECORATION );
443     g_object_set_data( G_OBJECT(spw), "lock", itact );
444     g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_lock), desktop) ;
445     gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
446     }
448     //TRANSLATORS: only translate "string" in "context|string".
449     // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
450     eact = create_adjustment_action( "HeightAction", _("select_toolbar|H"), "height",
451                                      1e-3, GTK_WIDGET(desktop->canvas), tracker, spw,
452                                      _("Height of selection"), FALSE );
453     gtk_action_group_add_action( selectionActions, GTK_ACTION(eact) );
455     // Add the units menu.
456     act = tracker->createAction( "UnitsAction", _("Units"), _("") );
457     gtk_action_group_add_action( selectionActions, act );
459     g_object_set_data( G_OBJECT(spw), "selectionActions", selectionActions );
461     // Force update when selection changes.
462     gtk_signal_connect(GTK_OBJECT(spw), "modify_selection", GTK_SIGNAL_FUNC(sp_selection_layout_widget_modify_selection), desktop);
463     gtk_signal_connect(GTK_OBJECT(spw), "change_selection", GTK_SIGNAL_FUNC(sp_selection_layout_widget_change_selection), desktop);
465     // Update now.
466     sp_selection_layout_widget_update(SP_WIDGET(spw), SP_ACTIVE_DESKTOP ? sp_desktop_selection(SP_ACTIVE_DESKTOP) : NULL);
468     // Insert spw into the toolbar.
469     gtk_box_pack_start(GTK_BOX(holder), spw, FALSE, FALSE, 0);
471     // "Transform with object" buttons
473     {
474     InkToggleAction* itact = ink_toggle_action_new( "transform_stroke",
475                                                     _("Stroke"),
476                                                     _("When scaling objects, scale the stroke width by the same proportion"),
477                                                     "transform_stroke",
478                                                     Inkscape::ICON_SIZE_DECORATION );
479     gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs_get_int_attribute("options.transform", "stroke", 1) );
480     g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_stroke), desktop) ;
481     gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
482     }
484     {
485     InkToggleAction* itact = ink_toggle_action_new( "transform_corners",
486                                                     _("Corners"),
487                                                     _("When scaling rectangles, scale the radii of rounded corners"),
488                                                     "transform_corners",
489                                                   Inkscape::ICON_SIZE_DECORATION );
490     gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs_get_int_attribute("options.transform", "rectcorners", 1) );
491     g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_corners), desktop) ;
492     gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
493     }
495     {
496     InkToggleAction* itact = ink_toggle_action_new( "transform_gradient",
497                                                     _("Gradient"),
498                                                     _("Transform gradients (in fill or stroke) along with the objects"),
499                                                     "transform_gradient",
500                                                   Inkscape::ICON_SIZE_DECORATION );
501     gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs_get_int_attribute("options.transform", "gradient", 1) );
502     g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_gradient), desktop) ;
503     gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
504     }
506     {
507     InkToggleAction* itact = ink_toggle_action_new( "transform_pattern",
508                                                     _("Patterns"),
509                                                     _("Transform patterns (in fill or stroke) along with the objects"),
510                                                     "transform_pattern",
511                                                   Inkscape::ICON_SIZE_DECORATION );
512     gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs_get_int_attribute("options.transform", "pattern", 1) );
513     g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_pattern), desktop) ;
514     gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
515     }
519 /*
520   Local Variables:
521   mode:c++
522   c-file-style:"stroustrup"
523   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
524   indent-tabs-mode:nil
525   fill-column:99
526   End:
527 */
528 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :