From 5f320e669222a58f8d1e3cc7ebac98f81c108e31 Mon Sep 17 00:00:00 2001 From: johncoswell Date: Thu, 8 Mar 2007 02:35:11 +0000 Subject: [PATCH] Add units selector to offset and remove offset range limits --- src/flood-context.cpp | 3 ++- src/flood-context.h | 3 +++ src/widgets/toolbox.cpp | 17 ++++++++++++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/flood-context.cpp b/src/flood-context.cpp index 6ee1f9a68..5d106a795 100644 --- a/src/flood-context.cpp +++ b/src/flood-context.cpp @@ -302,7 +302,7 @@ static void do_trace(GdkPixbuf *px, SPDesktop *desktop, NR::Matrix transform) { long totalNodeCount = 0L; - double offset = prefs_get_double_attribute_limited("tools.paintbucket", "offset", 1.5, 0.0, 2.0); + double offset = prefs_get_double_attribute("tools.paintbucket", "offset", 2.0); for (unsigned int i=0 ; i #include #include "event-context.h" +#include "helper/unit-menu.h" +#include "helper/units.h" + struct SPKnotHolder; #define SP_TYPE_FLOOD_CONTEXT (sp_flood_context_get_type ()) diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index fe6e6f676..975a8cbda 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -4442,7 +4442,10 @@ static void paintbucket_tolerance_changed(GtkAdjustment *adj, GtkWidget *tbl) static void paintbucket_offset_changed(GtkAdjustment *adj, GtkWidget *tbl) { - prefs_set_double_attribute("tools.paintbucket", "offset", (gint)adj->value); + GtkWidget *us = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(tbl), "units"); + SPUnit const *unit = sp_unit_selector_get_unit(SP_UNIT_SELECTOR(us)); + + prefs_set_double_attribute("tools.paintbucket", "offset", (gdouble)sp_units_get_pixels(adj->value, *unit)); spinbutton_defocus(GTK_OBJECT(tbl)); } @@ -4466,16 +4469,24 @@ sp_paintbucket_toolbox_new(SPDesktop *desktop) // interval gtk_box_pack_start(GTK_BOX(tbl), gtk_hbox_new(FALSE, 0), FALSE, FALSE, AUX_BETWEEN_BUTTON_GROUPS); + // Create the units menu. + GtkWidget *us = sp_unit_selector_new(SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE); + sp_unit_selector_setsize(us, AUX_OPTION_MENU_WIDTH, AUX_OPTION_MENU_HEIGHT); + sp_unit_selector_set_unit (SP_UNIT_SELECTOR(us), sp_desktop_namedview(desktop)->doc_units); + // Offset spinbox { GtkWidget *offset = sp_tb_spinbutton(_("Offset:"), _("The amount to grow the path after it has been traced"), - "tools.paintbucket", "offset", 5, NULL, tbl, TRUE, - "inkscape:paintbucket-offset", 0.0, 2.0, 0.1, 0.5, + "tools.paintbucket", "offset", 5, us, tbl, TRUE, + "inkscape:paintbucket-offset", -1e6, 1e6, 0.1, 0.5, paintbucket_offset_changed, 1, 2); gtk_box_pack_start(GTK_BOX(tbl), offset, FALSE, FALSE, AUX_SPACING); + + gtk_box_pack_start(GTK_BOX(tbl), us, FALSE, FALSE, AUX_SPACING); + gtk_object_set_data(GTK_OBJECT(tbl), "units", us); } // interval -- 2.30.2