Code

store paint bucket offset units in preferences to work around toolbar initialization...
authorjohncoswell <johncoswell@users.sourceforge.net>
Thu, 1 Nov 2007 02:42:00 +0000 (02:42 +0000)
committerjohncoswell <johncoswell@users.sourceforge.net>
Thu, 1 Nov 2007 02:42:00 +0000 (02:42 +0000)
src/widgets/toolbox.cpp

index 803041c6e887f09c7574bf87d77b3c0a9b96c48b..94e43a00b7e2a1b34b48d35e6b198d341a471f7d 100644 (file)
@@ -4962,11 +4962,12 @@ static void paintbucket_autogap_changed(EgeSelectOneAction* act, GObject *tbl)
 
 static void paintbucket_offset_changed(GtkAdjustment *adj, GObject *tbl)
 {
-    UnitTracker* tracker = reinterpret_cast<UnitTracker*>(g_object_get_data( tbl, "tracker" ));
+    UnitTracker* tracker = static_cast<UnitTracker*>(g_object_get_data( tbl, "tracker" ));
     SPUnit const *unit = tracker->getActiveUnit();
 
-
     prefs_set_double_attribute("tools.paintbucket", "offset", (gdouble)sp_units_get_pixels(adj->value, *unit));
+
+    prefs_set_string_attribute("tools.paintbucket", "offsetunits", sp_unit_get_abbreviation(unit));
 }
 
 static void paintbucket_defaults(GtkWidget *, GObject *dataKludge)
@@ -5036,7 +5037,7 @@ static void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
 
     // Create the units menu.
     UnitTracker* tracker = new UnitTracker( SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE );
-    tracker->setActiveUnit( sp_desktop_namedview(desktop)->doc_units );
+    tracker->setActiveUnit(sp_unit_get_by_abbreviation(prefs_get_string_attribute("tools.paintbucket", "offsetunits")));
     g_object_set_data( holder, "tracker", tracker );
     {
         GtkAction* act = tracker->createAction( "PaintbucketUnitsAction", _("Units"), ("") );