From: tweenk Date: Tue, 7 Jul 2009 02:00:16 +0000 (+0000) Subject: Fix LP #390162: Wrong defaults for Calligraphy tool X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f2d929f1294c7bd59bf3d77eb51849ffd37c08a8;p=inkscape.git Fix LP #390162: Wrong defaults for Calligraphy tool --- diff --git a/src/common-context.cpp b/src/common-context.cpp index 48a7f308c..2229f3a23 100644 --- a/src/common-context.cpp +++ b/src/common-context.cpp @@ -166,19 +166,20 @@ static void sp_common_context_set(SPEventContext *ec, Inkscape::Preferences::Ent if (full_path.compare(0, presets_path.size(), presets_path) == 0) return; if (path == "mass") { - ctx->mass = CLAMP(value->getDouble(0.2), -1000.0, 1000.0); + ctx->mass = 0.01 * CLAMP(value->getInt(10), 0, 100); } else if (path == "wiggle") { - ctx->drag = CLAMP((1 - value->getDouble(1 - DRAG_DEFAULT)), DRAG_MIN, DRAG_MAX); // drag is inverse to wiggle + ctx->drag = CLAMP((1 - 0.01 * value->getInt()), + DRAG_MIN, DRAG_MAX); // drag is inverse to wiggle } else if (path == "angle") { ctx->angle = CLAMP(value->getDouble(), -90, 90); } else if (path == "width") { - ctx->width = CLAMP(value->getDouble(0.1), -1000.0, 1000.0); + ctx->width = 0.01 * CLAMP(value->getInt(10), 1, 100); } else if (path == "thinning") { - ctx->vel_thin = CLAMP(value->getDouble(0.1), -1.0, 1.0); + ctx->vel_thin = 0.01 * CLAMP(value->getInt(10), -100, 100); } else if (path == "tremor") { - ctx->tremor = CLAMP(value->getDouble(), 0.0, 1.0); + ctx->tremor = 0.01 * CLAMP(value->getInt(), 0, 100); } else if (path == "flatness") { - ctx->flatness = CLAMP(value->getDouble(1.0), 0, 1.0); + ctx->flatness = 0.01 * CLAMP(value->getInt(), 0, 100); } else if (path == "usepressure") { ctx->usepressure = value->getBool(); } else if (path == "usetilt") { diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 431884328..21bacd5a4 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -87,7 +87,7 @@ static char const preferences_skeleton[] = " \n" " \n" " \n" " \n" " \n" diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 291bb9dbb..8dcd1951d 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -66,6 +66,7 @@ #include "../lpe-tool-context.h" #include "../mod360.h" #include "../node-context.h" +#include "../ui/tool/node-tool.h" #include "../pen-context.h" #include "../preferences.h" #include "../selection-chemistry.h" @@ -144,7 +145,7 @@ static struct { sp_verb_t doubleclick_verb; } const tools[] = { { "SPSelectContext", "select_tool", SP_VERB_CONTEXT_SELECT, SP_VERB_CONTEXT_SELECT_PREFS}, - { "SPNodeContext", "node_tool", SP_VERB_CONTEXT_NODE, SP_VERB_CONTEXT_NODE_PREFS }, + { "InkNodeTool", "node_tool", SP_VERB_CONTEXT_NODE, SP_VERB_CONTEXT_NODE_PREFS }, { "SPTweakContext", "tweak_tool", SP_VERB_CONTEXT_TWEAK, SP_VERB_CONTEXT_TWEAK_PREFS }, { "SPZoomContext", "zoom_tool", SP_VERB_CONTEXT_ZOOM, SP_VERB_CONTEXT_ZOOM_PREFS }, { "SPRectContext", "rect_tool", SP_VERB_CONTEXT_RECT, SP_VERB_CONTEXT_RECT_PREFS }, @@ -177,7 +178,7 @@ static struct { } const aux_toolboxes[] = { { "SPSelectContext", "select_toolbox", 0, sp_select_toolbox_prep, "SelectToolbar", SP_VERB_INVALID, 0, 0}, - { "SPNodeContext", "node_toolbox", 0, sp_node_toolbox_prep, "NodeToolbar", + { "InkNodeTool", "node_toolbox", 0, sp_node_toolbox_prep, "NodeToolbar", SP_VERB_INVALID, 0, 0}, { "SPTweakContext", "tweak_toolbox", 0, sp_tweak_toolbox_prep, "TweakToolbar", SP_VERB_CONTEXT_TWEAK_PREFS, "/tools/tweak", N_("Color/opacity used for color tweaking")}, @@ -999,6 +1000,16 @@ static ShapeEditor *get_current_shape_editor() return event_context->shape_editor; } +/** Temporary hack: Returns the node tool in the active desktop. + * Will go away during tool refactoring. */ +static InkNodeTool *get_node_tool() +{ + if (!SP_ACTIVE_DESKTOP) return NULL; + SPEventContext *ec = SP_ACTIVE_DESKTOP->event_context; + if (!INK_IS_NODE_TOOL(ec)) return NULL; + return INK_NODE_TOOL(ec); +} + void sp_node_path_edit_add(void) @@ -4434,14 +4445,14 @@ static void update_presets_list (GObject *tbl) static void sp_ddc_mass_value_changed( GtkAdjustment *adj, GObject* tbl ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble( "/tools/calligraphic/mass", adj->value * 0.01 ); + prefs->setDouble( "/tools/calligraphic/mass", adj->value ); update_presets_list(tbl); } static void sp_ddc_wiggle_value_changed( GtkAdjustment *adj, GObject* tbl ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble( "/tools/calligraphic/wiggle", adj->value * 0.01 ); + prefs->setDouble( "/tools/calligraphic/wiggle", adj->value ); update_presets_list(tbl); } @@ -4455,28 +4466,28 @@ static void sp_ddc_angle_value_changed( GtkAdjustment *adj, GObject* tbl ) static void sp_ddc_width_value_changed( GtkAdjustment *adj, GObject *tbl ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble( "/tools/calligraphic/width", adj->value * 0.01 ); + prefs->setDouble( "/tools/calligraphic/width", adj->value ); update_presets_list(tbl); } static void sp_ddc_velthin_value_changed( GtkAdjustment *adj, GObject* tbl ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble("/tools/calligraphic/thinning", adj->value * 0.01 ); + prefs->setDouble("/tools/calligraphic/thinning", adj->value ); update_presets_list(tbl); } static void sp_ddc_flatness_value_changed( GtkAdjustment *adj, GObject* tbl ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble( "/tools/calligraphic/flatness", adj->value * 0.01); + prefs->setDouble( "/tools/calligraphic/flatness", adj->value ); update_presets_list(tbl); } static void sp_ddc_tremor_value_changed( GtkAdjustment *adj, GObject* tbl ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble( "/tools/calligraphic/tremor", adj->value * 0.01 ); + prefs->setDouble( "/tools/calligraphic/tremor", adj->value ); update_presets_list(tbl); } @@ -4716,7 +4727,7 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "altx-calligraphy", 1, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_ddc_width_value_changed, 0.01, 0, 100 ); + sp_ddc_width_value_changed, 1, 0); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); @@ -4733,7 +4744,7 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL, -100, 100, 1, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_ddc_velthin_value_changed, 0.01, 0, 100); + sp_ddc_velthin_value_changed, 1, 0); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); } @@ -4767,7 +4778,7 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL, 0.0, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_ddc_flatness_value_changed, 0.01, 0, 100 ); + sp_ddc_flatness_value_changed, 1, 0); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); } @@ -4800,7 +4811,7 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL, 0.0, 100, 1, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_ddc_tremor_value_changed, 0.01, 0, 100 ); + sp_ddc_tremor_value_changed, 1, 0); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); @@ -4818,7 +4829,7 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL, 0.0, 100, 1, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_ddc_wiggle_value_changed, 0.01, 0, 100 ); + sp_ddc_wiggle_value_changed, 1, 0); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); @@ -4835,7 +4846,7 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL, 0.0, 100, 1, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_ddc_mass_value_changed, 0.01, 0, 100 ); + sp_ddc_mass_value_changed, 1, 0); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );