[gimp] app: make dynamics tool options a checkbox
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: make dynamics tool options a checkbox
- Date: Thu, 3 Feb 2022 22:07:27 +0000 (UTC)
commit 614e1c6b4cfc5a68266dfa2566cad74a4775f171
Author: Asalle <asalle kim gmail com>
Date: Sat Jan 1 23:10:26 2022 +0100
app: make dynamics tool options a checkbox
Fixes #4333
If the checkbox is unchecked: dynamics falls back to "Dynamics Off",
the current dynamics name and its options are hidden in the UI.
If the checkbox is checked: dynamics is set to previously used one
or the default one, all dynamics options are seen in the UI.
app/core/gimp-user-install.c | 15 +++++-
app/paint/gimpbrushcore.c | 12 ++++-
app/paint/gimppaintoptions.c | 35 ++++++++-----
app/paint/gimppaintoptions.h | 3 +-
app/tools/gimppaintoptions-gui.c | 22 ++++----
data/dynamics/Dynamics-Off.gdyn | 61 ----------------------
data/dynamics/Makefile.am | 1 -
data/dynamics/meson.build | 1 -
data/tool-presets/FX/FX-Confetti.gtp | 2 +-
data/tool-presets/FX/FX-Radial-Softlight.gtp | 2 +-
data/tool-presets/FX/Smooth-Clone.gtp | 2 +-
data/tool-presets/FX/Vignette.gtp | 2 +-
.../Paint/Airbrush-Color-From-Gradient.gtp | 2 +-
.../Paint/Paintbrush-Color-From-Gradient.gtp | 2 +-
.../Paint/Pencil-Color-From-Gradient.gtp | 2 +-
data/tool-presets/Sketch/Pencil-Soft.gtp | 2 +-
data/tool-presets/Sketch/Pencil.gtp | 2 +-
17 files changed, 67 insertions(+), 101 deletions(-)
---
diff --git a/app/core/gimp-user-install.c b/app/core/gimp-user-install.c
index d01a09c3bf..a76faf864c 100644
--- a/app/core/gimp-user-install.c
+++ b/app/core/gimp-user-install.c
@@ -763,7 +763,8 @@ user_update_gimpressionist (const GMatchInfo *matched_value,
"GimpImageMapOptions" "|" \
"GimpBlendOptions" "|" \
"gimp-blend-tool" "|" \
- "gimp-tool-blend"
+ "gimp-tool-blend" "|" \
+ "dynamics \"Dynamics Off\""
static gboolean
user_update_tool_presets (const GMatchInfo *matched_value,
@@ -788,6 +789,10 @@ user_update_tool_presets (const GMatchInfo *matched_value,
{
g_string_append (new_value, "gimp-tool-gradient");
}
+ else if (g_strcmp0 (match, "dynamics \"Dynamics Off\"") == 0)
+ {
+ g_string_append (new_value, "dynamics-enabled no");
+ }
else
{
g_message ("(WARNING) %s: invalid match \"%s\"", G_STRFUNC, match);
@@ -802,7 +807,9 @@ user_update_tool_presets (const GMatchInfo *matched_value,
* gimp-blend-tool may appear. Apparently that is also "devicerc", as
* well as "toolrc" (but this one is skipped anyway).
*/
-#define CONTEXTRC_UPDATE_PATTERN "gimp-blend-tool"
+#define CONTEXTRC_UPDATE_PATTERN \
+ "gimp-blend-tool" "|" \
+ "dynamics \"Dynamics Off\""
static gboolean
user_update_contextrc_over20 (const GMatchInfo *matched_value,
@@ -815,6 +822,10 @@ user_update_contextrc_over20 (const GMatchInfo *matched_value,
{
g_string_append (new_value, "gimp-gradient-tool");
}
+ if (g_strcmp0 (match, "dynamics \"Dynamics Off\"") == 0)
+ {
+ g_string_append (new_value, "dynamics-enabled no");
+ }
else
{
g_message ("(WARNING) %s: invalid match \"%s\"", G_STRFUNC, match);
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index d9796ae489..7a6a9578fb 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -365,7 +365,17 @@ gimp_brush_core_start (GimpPaintCore *paint_core,
gimp_brush_core_set_brush (core, gimp_context_get_brush (context));
- gimp_brush_core_set_dynamics (core, gimp_context_get_dynamics (context));
+ if (gimp_paint_options_get_dynamics_enabled (paint_options))
+ {
+ gimp_brush_core_set_dynamics (core, gimp_context_get_dynamics (context));
+ }
+ else
+ {
+ GimpDynamics *dynamics_off = GIMP_DYNAMICS (gimp_dynamics_new (context,
+ "Dynamics Off"));
+ gimp_brush_core_set_dynamics (core, dynamics_off);
+ g_object_unref (dynamics_off);
+ }
if (! core->main_brush)
{
diff --git a/app/paint/gimppaintoptions.c b/app/paint/gimppaintoptions.c
index 60c5959002..f402640d52 100644
--- a/app/paint/gimppaintoptions.c
+++ b/app/paint/gimppaintoptions.c
@@ -62,7 +62,7 @@
#define DEFAULT_USE_JITTER FALSE
#define DEFAULT_JITTER_AMOUNT 0.2
-#define DEFAULT_DYNAMICS_EXPANDED FALSE
+#define DEFAULT_DYNAMICS_ENABLED TRUE
#define DEFAULT_FADE_LENGTH 100.0
#define DEFAULT_FADE_REVERSE FALSE
@@ -108,7 +108,7 @@ enum
PROP_USE_JITTER,
PROP_JITTER_AMOUNT,
- PROP_DYNAMICS_EXPANDED,
+ PROP_DYNAMICS_ENABLED,
PROP_FADE_LENGTH,
PROP_FADE_REVERSE,
@@ -303,6 +303,14 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
_("Scatter brush as you paint"),
DEFAULT_USE_JITTER,
GIMP_PARAM_STATIC_STRINGS);
+
+ GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_DYNAMICS_ENABLED,
+ "dynamics-enabled",
+ _("Enable dynamics"),
+ _("Apply dynamics curves to paint settings"),
+ DEFAULT_DYNAMICS_ENABLED,
+ GIMP_PARAM_STATIC_STRINGS);
+
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_JITTER_AMOUNT,
"jitter-amount",
_("Amount"),
@@ -310,13 +318,6 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
0.0, 50.0, DEFAULT_JITTER_AMOUNT,
GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_DYNAMICS_EXPANDED,
- "dynamics-expanded",
- _("Dynamics Options"),
- NULL,
- DEFAULT_DYNAMICS_EXPANDED,
- GIMP_PARAM_STATIC_STRINGS);
-
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_FADE_LENGTH,
"fade-length",
_("Fade length"),
@@ -564,8 +565,8 @@ gimp_paint_options_set_property (GObject *object,
jitter_options->jitter_amount = g_value_get_double (value);
break;
- case PROP_DYNAMICS_EXPANDED:
- options->dynamics_expanded = g_value_get_boolean (value);
+ case PROP_DYNAMICS_ENABLED:
+ options->dynamics_enabled = g_value_get_boolean (value);
break;
case PROP_FADE_LENGTH:
@@ -710,8 +711,8 @@ gimp_paint_options_get_property (GObject *object,
g_value_set_double (value, jitter_options->jitter_amount);
break;
- case PROP_DYNAMICS_EXPANDED:
- g_value_set_boolean (value, options->dynamics_expanded);
+ case PROP_DYNAMICS_ENABLED:
+ g_value_set_boolean (value, options->dynamics_enabled);
break;
case PROP_FADE_LENGTH:
@@ -982,6 +983,12 @@ gimp_paint_options_get_jitter (GimpPaintOptions *paint_options,
return 0.0;
}
+gboolean
+gimp_paint_options_get_dynamics_enabled (GimpPaintOptions *paint_options)
+{
+ return paint_options->dynamics_enabled;
+}
+
gboolean
gimp_paint_options_get_gradient_color (GimpPaintOptions *paint_options,
GimpImage *image,
@@ -1180,7 +1187,7 @@ static const gchar *brush_props[] =
static const gchar *dynamics_props[] =
{
- "dynamics-expanded",
+ "dynamics-enabled",
"fade-reverse",
"fade-length",
"fade-unit",
diff --git a/app/paint/gimppaintoptions.h b/app/paint/gimppaintoptions.h
index 10218ee833..e5803a9b0c 100644
--- a/app/paint/gimppaintoptions.h
+++ b/app/paint/gimppaintoptions.h
@@ -107,7 +107,7 @@ struct _GimpPaintOptions
GimpJitterOptions *jitter_options;
- gboolean dynamics_expanded;
+ gboolean dynamics_enabled;
GimpFadeOptions *fade_options;
GimpGradientPaintOptions *gradient_options;
GimpSmoothingOptions *smoothing_options;
@@ -172,5 +172,6 @@ void gimp_paint_options_copy_props (GimpPaintOptions *src,
GimpPaintOptions *dest,
GimpContextPropMask prop_mask);
+gboolean gimp_paint_options_get_dynamics_enabled (GimpPaintOptions *paint_options);
#endif /* __GIMP_PAINT_OPTIONS_H__ */
diff --git a/app/tools/gimppaintoptions-gui.c b/app/tools/gimppaintoptions-gui.c
index 012c82f2bb..ec477a0f2b 100644
--- a/app/tools/gimppaintoptions-gui.c
+++ b/app/tools/gimppaintoptions-gui.c
@@ -214,14 +214,6 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
g_object_unref (link_group);
- button = gimp_prop_dynamics_box_new (NULL, GIMP_CONTEXT (tool_options),
- _("Dynamics"), 2,
- "dynamics-view-type",
- "dynamics-view-size",
- "gimp-dynamics-editor",
- _("Edit this dynamics"));
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-
frame = dynamics_options_gui (options, tool_type);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
@@ -304,16 +296,24 @@ dynamics_options_gui (GimpPaintOptions *paint_options,
GtkWidget *menu;
GtkWidget *combo;
GtkWidget *checkbox;
+ GtkWidget *button;
GtkWidget *vbox;
GtkWidget *inner_vbox;
GtkWidget *hbox;
GtkWidget *box;
- frame = gimp_prop_expander_new (config, "dynamics-expanded", NULL);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
- gtk_widget_show (vbox);
+ frame = gimp_prop_expanding_frame_new (config, "dynamics-enabled",
+ NULL, vbox, NULL);
+ button = gimp_prop_dynamics_box_new (NULL,
+ GIMP_CONTEXT (config),
+ _("Dynamics"), 2,
+ "dynamics-view-type",
+ "dynamics-view-size",
+ "gimp-dynamics-editor",
+ _("Edit this dynamics"));
+ gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
inner_frame = gimp_frame_new (_("Fade Options"));
gtk_box_pack_start (GTK_BOX (vbox), inner_frame, FALSE, FALSE, 0);
diff --git a/data/dynamics/Makefile.am b/data/dynamics/Makefile.am
index e42ac19844..fe32aee0ac 100644
--- a/data/dynamics/Makefile.am
+++ b/data/dynamics/Makefile.am
@@ -9,7 +9,6 @@ dynamicsdatadir = $(gimpdatadir)/dynamics
dynamicsdata_DATA = \
Basic-Dynamics.gdyn \
Color-From-Gradient.gdyn \
- Dynamics-Off.gdyn \
Fade-Tapering.gdyn \
Random-Color.gdyn \
Tilt-Angle.gdyn \
diff --git a/data/dynamics/meson.build b/data/dynamics/meson.build
index e12a7578e3..9005fcf777 100644
--- a/data/dynamics/meson.build
+++ b/data/dynamics/meson.build
@@ -1,7 +1,6 @@
dynamics = files(
'Basic-Dynamics.gdyn',
'Color-From-Gradient.gdyn',
- 'Dynamics-Off.gdyn',
'Fade-Tapering.gdyn',
'Random-Color.gdyn',
'Tilt-Angle.gdyn',
diff --git a/data/tool-presets/FX/FX-Confetti.gtp b/data/tool-presets/FX/FX-Confetti.gtp
index 46edb93f19..d79d2ce93c 100644
--- a/data/tool-presets/FX/FX-Confetti.gtp
+++ b/data/tool-presets/FX/FX-Confetti.gtp
@@ -13,7 +13,7 @@
(brush-aspect-ratio 0.100000)
(use-jitter yes)
(jitter-amount 5.000000)
- (dynamics-expanded yes)
+ (dynamics-enabled yes)
(fade-length 140.000000)
(fade-unit percent))
(use-fg-bg no)
diff --git a/data/tool-presets/FX/FX-Radial-Softlight.gtp b/data/tool-presets/FX/FX-Radial-Softlight.gtp
index 529895d446..dc1e6203bc 100644
--- a/data/tool-presets/FX/FX-Radial-Softlight.gtp
+++ b/data/tool-presets/FX/FX-Radial-Softlight.gtp
@@ -8,7 +8,7 @@
(paint-mode softlight)
(gradient "FG to Transparent")
(brush-size 400.000000)
- (dynamics-expanded yes)
+ (dynamics-enabled yes)
(gradient-type radial))
(use-fg-bg no)
(use-brush no)
diff --git a/data/tool-presets/FX/Smooth-Clone.gtp b/data/tool-presets/FX/Smooth-Clone.gtp
index 0b9635a063..5b412690eb 100644
--- a/data/tool-presets/FX/Smooth-Clone.gtp
+++ b/data/tool-presets/FX/Smooth-Clone.gtp
@@ -6,7 +6,7 @@
(tool "gimp-clone-tool")
(foreground (color-rgb 0.318741 0.318741 0.318741))
(brush "2. Hardness 050")
- (dynamics "Dynamics Off")
+ (enable-dynamics no)
(pattern "Paper")
(brush-size 150.000000)
(sample-merged yes))
diff --git a/data/tool-presets/FX/Vignette.gtp b/data/tool-presets/FX/Vignette.gtp
index f3f9169a59..f446618f38 100644
--- a/data/tool-presets/FX/Vignette.gtp
+++ b/data/tool-presets/FX/Vignette.gtp
@@ -8,7 +8,7 @@
(paint-mode multiply)
(gradient "FG to Transparent")
(brush-size 250.000000)
- (dynamics-expanded yes)
+ (dynamics-enabled yes)
(fade-length 138.000000)
(fade-unit percent)
(gradient-reverse yes)
diff --git a/data/tool-presets/Paint/Airbrush-Color-From-Gradient.gtp
b/data/tool-presets/Paint/Airbrush-Color-From-Gradient.gtp
index 9e436af772..47d2bee819 100644
--- a/data/tool-presets/Paint/Airbrush-Color-From-Gradient.gtp
+++ b/data/tool-presets/Paint/Airbrush-Color-From-Gradient.gtp
@@ -10,7 +10,7 @@
(gradient "Default")
(palette "Default")
(brush-size 500.000000)
- (dynamics-expanded yes)
+ (dynamics-enabled yes)
(fade-repeat triangular)
(rate 30.000000))
(use-fg-bg no)
diff --git a/data/tool-presets/Paint/Paintbrush-Color-From-Gradient.gtp
b/data/tool-presets/Paint/Paintbrush-Color-From-Gradient.gtp
index acf389be5f..d02bc56628 100644
--- a/data/tool-presets/Paint/Paintbrush-Color-From-Gradient.gtp
+++ b/data/tool-presets/Paint/Paintbrush-Color-From-Gradient.gtp
@@ -11,7 +11,7 @@
(palette "Default")
(brush-size 500.000000)
(jitter-amount 9.170000)
- (dynamics-expanded yes)
+ (dynamics-enabled yes)
(fade-repeat triangular))
(use-fg-bg no)
(use-brush no)
diff --git a/data/tool-presets/Paint/Pencil-Color-From-Gradient.gtp
b/data/tool-presets/Paint/Pencil-Color-From-Gradient.gtp
index da6f6959d2..cc57d08f53 100644
--- a/data/tool-presets/Paint/Pencil-Color-From-Gradient.gtp
+++ b/data/tool-presets/Paint/Pencil-Color-From-Gradient.gtp
@@ -10,7 +10,7 @@
(gradient "Default")
(palette "Default")
(brush-size 500.000000)
- (dynamics-expanded yes)
+ (dynamics-enabled yes)
(fade-repeat triangular))
(use-fg-bg no)
(use-brush no)
diff --git a/data/tool-presets/Sketch/Pencil-Soft.gtp b/data/tool-presets/Sketch/Pencil-Soft.gtp
index a5ebcf0d57..b06410e200 100644
--- a/data/tool-presets/Sketch/Pencil-Soft.gtp
+++ b/data/tool-presets/Sketch/Pencil-Soft.gtp
@@ -12,7 +12,7 @@
(brush-size 200.000000)
(application-mode incremental)
(use-jitter yes)
- (dynamics-expanded yes)
+ (dynamics-enabled yes)
(fade-length 140.000000)
(fade-unit percent))
(use-fg-bg no)
diff --git a/data/tool-presets/Sketch/Pencil.gtp b/data/tool-presets/Sketch/Pencil.gtp
index 8edcfaeb99..137a0e811c 100644
--- a/data/tool-presets/Sketch/Pencil.gtp
+++ b/data/tool-presets/Sketch/Pencil.gtp
@@ -11,7 +11,7 @@
(brush-size 50.000000)
(application-mode incremental)
(use-jitter yes)
- (dynamics-expanded yes)
+ (dynamics-enabled yes)
(fade-length 140.000000)
(fade-unit percent))
(use-fg-bg yes)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]