From 4c779815d6887a0c1214d15f98bed3a8408897f7 Mon Sep 17 00:00:00 2001 From: Steren Giannini Date: Tue, 29 Dec 2009 14:19:19 +0100 Subject: Spray UI : first refactoring of the toolbar (bzr r8908.1.1) --- src/widgets/toolbox.cpp | 90 ++++++++++++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 34 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 436213946..76234516d 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -304,19 +304,19 @@ static gchar const * ui_descr = " " " " - " " + " " " " " " - " " " " + " " " " - " " " " " " - " " - " " + " " + " " " " - " " + " " + " " " " " " @@ -743,7 +743,6 @@ Glib::RefPtr create_or_fetch_actions( SPDesktop* desktop ) //SP_VERB_EDIT_TILE, //SP_VERB_EDIT_UNTILE, SP_VERB_DIALOG_ALIGN_DISTRIBUTE, - SP_VERB_DIALOG_SPRAY_OPTION, SP_VERB_DIALOG_DISPLAY, SP_VERB_DIALOG_FILL_STROKE, SP_VERB_DIALOG_NAMEDVIEW, @@ -4408,14 +4407,6 @@ static void sp_spray_width_value_changed( GtkAdjustment *adj, GObject */*tbl*/ ) prefs->setDouble( "/tools/spray/width", adj->value ); } -/* -static void sp_spray_force_value_changed( GtkAdjustment * / *adj* /, GObject * / *tbl* / ) -{ - //Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - //prefs->setDouble( "/tools/spray/force", adj->value * 0.01 ); -} -*/ - static void sp_spray_mean_value_changed( GtkAdjustment *adj, GObject */*tbl*/ ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -4447,23 +4438,19 @@ static void sp_spray_population_value_changed( GtkAdjustment *adj, GObject */*tb prefs->setDouble( "/tools/spray/population", adj->value ); } -/*static void spray_toggle_doh (GtkToggleAction *act, gpointer ) { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setBool("/tools/spray/doh", gtk_toggle_action_get_active(act)); -} -static void spray_toggle_dos (GtkToggleAction *act, gpointer ) { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setBool("/tools/spray/dos", gtk_toggle_action_get_active(act)); -} -static void spray_toggle_dol (GtkToggleAction *act, gpointer ) { +static void sp_spray_rotation_value_changed( GtkAdjustment *adj, GObject */*tbl*/ ) +{ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setBool("/tools/spray/dol", gtk_toggle_action_get_active(act)); + prefs->setDouble( "/tools/spray/rotation", adj->value ); } -static void spray_toggle_doo (GtkToggleAction *act, gpointer ) { + +static void sp_spray_scale_value_changed( GtkAdjustment *adj, GObject */*tbl*/ ) +{ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setBool("/tools/spray/doo", gtk_toggle_action_get_active(act)); + prefs->setDouble( "/tools/spray/scale", adj->value ); } -*/ + + static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder) { Inkscape::IconSize secondarySize = prefToSize("/toolbox/secondary", 1); @@ -4490,7 +4477,7 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction gchar const* labels[] = {_("(minimum mean)"), 0, 0, _("(default)"), 0, 0, 0, _("(maximum mean)")}; gdouble values[] = {1, 5, 10, 20, 30, 50, 70, 100}; EgeAdjustmentAction *eact = create_adjustment_action( "SprayMeanAction", - _("Mean"), _("Mean:"), _("The mean of the spray action"), + _("Focus"), _("Focus:"), _("0 to spray a spot. Increase to enlarge the ring radius."), "/tools/spray/mean", 20, GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "spray-mean", 1, 100, 1.0, 10.0, @@ -4503,10 +4490,10 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction { /* Standard_deviation */ - gchar const* labels[] = {_("(minimum standard_deviation)"), 0, 0, _("(default)"), 0, 0, 0, _("(maximum standard_deviation)")}; + gchar const* labels[] = {_("(minimum scatter)"), 0, 0, _("(default)"), 0, 0, 0, _("(maximum scatter)")}; gdouble values[] = {1, 5, 10, 20, 30, 50, 70, 100}; EgeAdjustmentAction *eact = create_adjustment_action( "SprayStandard_deviationAction", - _("SD"), _("SD:"), _("The standard deviation of the spray action"), + _("Scatter"), _("Scatter:"), _("Increase to scatter sprayed objects."), "/tools/spray/standard_deviation", 20, GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "spray-standard_deviation", 1, 100, 1.0, 10.0, @@ -4566,8 +4553,8 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction gchar const* labels[] = {_("(low population)"), 0, 0, _("(default)"), 0, 0, _("(high population)")}; gdouble values[] = {10, 25, 35, 50, 60, 80, 100}; EgeAdjustmentAction *eact = create_adjustment_action( "SprayPopulationAction", - _("Population"), _("Population:"), - _("This setting adjusts the number of items sprayed"), + _("Amount"), _("Amount:"), + _("Adjusts the number of items sprayed per clic."), "/tools/spray/population", 50, GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "spray-population", 1, 100, 1.0, 10.0, @@ -4582,13 +4569,48 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction { InkToggleAction* act = ink_toggle_action_new( "SprayPressureAction", _("Pressure"), - _("Use the pressure of the input device to alter the force of spray action"), + _("Use the pressure of the input device to alter the amount of sprayed objects."), "use_pressure", Inkscape::ICON_SIZE_DECORATION ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_spray_pressure_state_changed), NULL); gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/spray/usepressure", true) ); } + + { /* Rotation */ + gchar const* labels[] = {_("(low rotation variation)"), 0, 0, _("(default)"), 0, 0, _("(high rotation variation)")}; + gdouble values[] = {10, 25, 35, 50, 60, 80, 100}; + EgeAdjustmentAction *eact = create_adjustment_action( "SprayRotationAction", + _("Rotation"), _("Rotation:"), + _("Variation of the rotation of the sprayed objects. 0% for the same rotation than the original object."), + "/tools/spray/rotation", 50, + GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "spray-rotation", + 1, 100, 1.0, 10.0, + labels, values, G_N_ELEMENTS(labels), + sp_spray_rotation_value_changed, 1, 0 ); + gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); + gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); + g_object_set_data( holder, "spray_rotation", eact ); + } + + { /* Scale */ + gchar const* labels[] = {_("(low scale variation)"), 0, 0, _("(default)"), 0, 0, _("(high scale variation)")}; + gdouble values[] = {10, 25, 35, 50, 60, 80, 100}; + EgeAdjustmentAction *eact = create_adjustment_action( "SprayScaleAction", + _("Scale"), _("Scale:"), + _("Variation in the scale of the sprayed objects. 0% for the same scale than the original object."), + "/tools/spray/scale", 50, + GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "spray-scale", + 1, 100, 1.0, 10.0, + labels, values, G_N_ELEMENTS(labels), + sp_spray_scale_value_changed, 1, 0 ); + gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); + gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); + g_object_set_data( holder, "spray_scale", eact ); + } + + + } -- cgit v1.2.3 From f75902d1e78a4241157dc57e68c9479624b840c1 Mon Sep 17 00:00:00 2001 From: Steren Giannini Date: Tue, 29 Dec 2009 15:39:10 +0100 Subject: french comments translated and some clean up (bzr r8908.1.2) --- src/widgets/toolbox.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 76234516d..a21353045 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -4478,7 +4478,7 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction gdouble values[] = {1, 5, 10, 20, 30, 50, 70, 100}; EgeAdjustmentAction *eact = create_adjustment_action( "SprayMeanAction", _("Focus"), _("Focus:"), _("0 to spray a spot. Increase to enlarge the ring radius."), - "/tools/spray/mean", 20, + "/tools/spray/mean", 0, GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "spray-mean", 1, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), @@ -4494,7 +4494,7 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction gdouble values[] = {1, 5, 10, 20, 30, 50, 70, 100}; EgeAdjustmentAction *eact = create_adjustment_action( "SprayStandard_deviationAction", _("Scatter"), _("Scatter:"), _("Increase to scatter sprayed objects."), - "/tools/spray/standard_deviation", 20, + "/tools/spray/standard_deviation", 70, GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "spray-standard_deviation", 1, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), @@ -4542,7 +4542,7 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction ege_select_one_action_set_icon_size( act, secondarySize ); ege_select_one_action_set_tooltip_column( act, 1 ); - gint mode = prefs->getInt("/tools/spray/mode", 0); + gint mode = prefs->getInt("/tools/spray/mode", 1); ege_select_one_action_set_active( act, mode ); g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(sp_spray_mode_changed), holder ); @@ -4555,7 +4555,7 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction EgeAdjustmentAction *eact = create_adjustment_action( "SprayPopulationAction", _("Amount"), _("Amount:"), _("Adjusts the number of items sprayed per clic."), - "/tools/spray/population", 50, + "/tools/spray/population", 70, GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "spray-population", 1, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), @@ -4583,7 +4583,7 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction EgeAdjustmentAction *eact = create_adjustment_action( "SprayRotationAction", _("Rotation"), _("Rotation:"), _("Variation of the rotation of the sprayed objects. 0% for the same rotation than the original object."), - "/tools/spray/rotation", 50, + "/tools/spray/rotation", 0, GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "spray-rotation", 1, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), @@ -4599,7 +4599,7 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction EgeAdjustmentAction *eact = create_adjustment_action( "SprayScaleAction", _("Scale"), _("Scale:"), _("Variation in the scale of the sprayed objects. 0% for the same scale than the original object."), - "/tools/spray/scale", 50, + "/tools/spray/scale", 0, GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "spray-scale", 1, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), -- cgit v1.2.3 From eaa1d0779063c37b447c00a9bc19afbc9c944804 Mon Sep 17 00:00:00 2001 From: Steren Giannini Date: Tue, 29 Dec 2009 16:29:29 +0100 Subject: rotation and scale variation in toolbar, still need some debug (bzr r8908.1.4) --- src/widgets/toolbox.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index a21353045..88fc1235d 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -4441,13 +4441,13 @@ static void sp_spray_population_value_changed( GtkAdjustment *adj, GObject */*tb static void sp_spray_rotation_value_changed( GtkAdjustment *adj, GObject */*tbl*/ ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble( "/tools/spray/rotation", adj->value ); + prefs->setDouble( "/tools/spray/rotation_variation", adj->value ); } static void sp_spray_scale_value_changed( GtkAdjustment *adj, GObject */*tbl*/ ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble( "/tools/spray/scale", adj->value ); + prefs->setDouble( "/tools/spray/scale_variation", adj->value ); } -- cgit v1.2.3 From c49db3d908dc2abddc682a271c86a0f977b8772a Mon Sep 17 00:00:00 2001 From: Steren Giannini Date: Wed, 30 Dec 2009 16:00:50 +0100 Subject: Spray toolbar is working + spray-context.cpp small cleanup (bzr r8908.1.5) --- src/widgets/toolbox.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 88fc1235d..b6c2f9c03 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -4480,7 +4480,7 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction _("Focus"), _("Focus:"), _("0 to spray a spot. Increase to enlarge the ring radius."), "/tools/spray/mean", 0, GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "spray-mean", - 1, 100, 1.0, 10.0, + 0, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), sp_spray_mean_value_changed, 1, 0 ); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); @@ -4583,9 +4583,9 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction EgeAdjustmentAction *eact = create_adjustment_action( "SprayRotationAction", _("Rotation"), _("Rotation:"), _("Variation of the rotation of the sprayed objects. 0% for the same rotation than the original object."), - "/tools/spray/rotation", 0, + "/tools/spray/rotation_variation", 0, GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "spray-rotation", - 1, 100, 1.0, 10.0, + 0, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), sp_spray_rotation_value_changed, 1, 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); @@ -4599,9 +4599,9 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction EgeAdjustmentAction *eact = create_adjustment_action( "SprayScaleAction", _("Scale"), _("Scale:"), _("Variation in the scale of the sprayed objects. 0% for the same scale than the original object."), - "/tools/spray/scale", 0, + "/tools/spray/scale_variation", 0, GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "spray-scale", - 1, 100, 1.0, 10.0, + 0, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), sp_spray_scale_value_changed, 1, 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); -- cgit v1.2.3