Code

Rename LPE: mirror reflect --> mirror symmetry
[inkscape.git] / src / widgets / select-toolbar.cpp
index f996abe7a062a83028e5b70b3e6503f62986044b..30d52cbaeb04503559c5909ce51bf22930ee07f0 100644 (file)
@@ -64,7 +64,10 @@ sp_selection_layout_widget_update(SPWidget *spw, Inkscape::Selection *sel)
     using NR::X;
     using NR::Y;
     if ( sel && !sel->isEmpty() ) {
-        NR::Maybe<NR::Rect> const bbox(sel->bounds());
+        int prefs_bbox = prefs_get_int_attribute("tools", "bounding_box", 0);
+        SPItem::BBoxType bbox_type = (prefs_bbox ==0)? 
+            SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX;
+        NR::Maybe<NR::Rect> const bbox(sel->bounds(bbox_type));
         if ( bbox && !bbox->isEmpty() ) {
             UnitTracker *tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(G_OBJECT(spw), "tracker"));
             SPUnit const &unit = *tracker->getActiveUnit();
@@ -151,7 +154,10 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw)
     SPDocument *document = sp_desktop_document(desktop);
 
     sp_document_ensure_up_to_date (document);
-    NR::Maybe<NR::Rect> bbox = selection->bounds();
+    int prefs_bbox = prefs_get_int_attribute("tools", "bounding_box", 0);
+    SPItem::BBoxType bbox_type = (prefs_bbox ==0)? 
+        SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX;
+    NR::Maybe<NR::Rect> bbox = selection->bounds(bbox_type);
 
     if ( !bbox || bbox->isEmpty() ) {
         g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(FALSE));
@@ -371,43 +377,44 @@ static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::Vi
 void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
 {
     Inkscape::UI::View::View *view = desktop;
+    Inkscape::IconSize secondarySize = prefToSize("toolbox", "secondary", 1);
 
     GtkAction* act = 0;
 
     GtkActionGroup* selectionActions = mainActions; // temporary
     std::vector<GtkAction*>* contextActions = new std::vector<GtkAction*>();
 
-    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_EDIT_SELECT_ALL), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_EDIT_SELECT_ALL), view, secondarySize );
     gtk_action_group_add_action( selectionActions, act );
-    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS), view, secondarySize );
     gtk_action_group_add_action( selectionActions, act );
-    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_EDIT_DESELECT), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_EDIT_DESELECT), view, secondarySize );
     gtk_action_group_add_action( selectionActions, act );
     contextActions->push_back( act );
 
-    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_ROTATE_90_CCW), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_ROTATE_90_CCW), view, secondarySize );
     gtk_action_group_add_action( selectionActions, act );
     contextActions->push_back( act );
-    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_ROTATE_90_CW), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_ROTATE_90_CW), view, secondarySize );
     gtk_action_group_add_action( selectionActions, act );
     contextActions->push_back( act );
-    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_FLIP_HORIZONTAL), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_FLIP_HORIZONTAL), view, secondarySize );
     gtk_action_group_add_action( selectionActions, act );
     contextActions->push_back( act );
-    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_FLIP_VERTICAL), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_OBJECT_FLIP_VERTICAL), view, secondarySize );
     gtk_action_group_add_action( selectionActions, act );
     contextActions->push_back( act );
 
-    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_TO_BACK), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_TO_BACK), view, secondarySize );
     gtk_action_group_add_action( selectionActions, act );
     contextActions->push_back( act );
-    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_LOWER), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_LOWER), view, secondarySize );
     gtk_action_group_add_action( selectionActions, act );
     contextActions->push_back( act );
-    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_RAISE), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_RAISE), view, secondarySize );
     gtk_action_group_add_action( selectionActions, act );
     contextActions->push_back( act );
-    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_TO_FRONT), view, Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+    act = create_action_for_verb( Inkscape::Verb::get(SP_VERB_SELECTION_TO_FRONT), view, secondarySize );
     gtk_action_group_add_action( selectionActions, act );
     contextActions->push_back( act );
 
@@ -501,7 +508,13 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb
     }
 
     // Insert spw into the toolbar.
-    gtk_box_pack_start(GTK_BOX(holder), spw, FALSE, FALSE, 0);
+    if ( GTK_IS_BOX(holder) ) {
+        gtk_box_pack_start(GTK_BOX(holder), spw, FALSE, FALSE, 0);
+    } else if ( GTK_IS_TOOLBAR(holder) ) {
+        gtk_toolbar_append_widget( GTK_TOOLBAR(holder), spw, "Text", "priv" );
+    } else {
+        g_warning("Unexpected holder type");
+    }
 
     // "Transform with object" buttons