summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3ce6da1)
raw | patch | inline | side by side (parent: 3ce6da1)
author | tweenk <tweenk@users.sourceforge.net> | |
Tue, 7 Jul 2009 02:00:16 +0000 (02:00 +0000) | ||
committer | tweenk <tweenk@users.sourceforge.net> | |
Tue, 7 Jul 2009 02:00:16 +0000 (02:00 +0000) |
src/common-context.cpp | patch | blob | history | |
src/preferences-skeleton.h | patch | blob | history | |
src/widgets/toolbox.cpp | patch | blob | history |
diff --git a/src/common-context.cpp b/src/common-context.cpp
index 48a7f308c68427ca8451ac364a5d3bae8297d68f..2229f3a23fa58bf384756f4c89506bab0c93fa87 100644 (file)
--- 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") {
index 431884328812e32b90b36da3eaced9e43013e677..21bacd5a4d146e95b9d2a3a6be1238bc1ea8cbf2 100644 (file)
" <eventcontext id=\"pen\" mode=\"drag\" selcue=\"1\" style=\"stroke-width:1px;\" usecurrent=\"0\"/>\n"
" </group>\n"
" <eventcontext id=\"calligraphic\" style=\"fill:black;fill-opacity:1;fill-rule:nonzero;stroke:none;\"\n"
-" mass=\"2\" drag=\"1\" angle=\"30\" width=\"15\" thinning=\"10\" flatness=\"90\" cap_rounding=\"0.0\" usecurrent=\"1\"\n"
+" mass=\"2\" angle=\"30\" width=\"15\" thinning=\"10\" flatness=\"90\" cap_rounding=\"0.0\" usecurrent=\"1\"\n"
" tracebackground=\"0\" usepressure=\"1\" usetilt=\"0\" keep_selected=\"1\">\n"
" <group id=\"preset\">\n"
" <group id=\"cp0\" name=\"Dip pen\" mass=\"2\" wiggle=\"0.0\" angle=\"30.0\" thinning=\"10\" tremor=\"0.0\" flatness=\"90\" cap_rounding=\"0.0\" tracebackground=\"0\" usepressure=\"1\" usetilt=\"1\" />\n"
index 291bb9dbb644d5e0a44c74def16c3f23607f2ea1..8dcd1951daeb3a1cb5d2a209c60f16d93a6c15cf 100644 (file)
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
#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"
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 },
} 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")},
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)
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);
}
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 );