From ed078f9723aad2f1126a95fd8461a077fe038018 Mon Sep 17 00:00:00 2001 From: johncoswell Date: Thu, 1 Nov 2007 02:42:00 +0000 Subject: [PATCH] store paint bucket offset units in preferences to work around toolbar initialization issue --- src/widgets/toolbox.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 803041c6e..94e43a00b 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -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(g_object_get_data( tbl, "tracker" )); + UnitTracker* tracker = static_cast(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"), ("") ); -- 2.30.2