Commit f0c16197 authored by Michael Natterer's avatar Michael Natterer 😴

app: add "use MyPaint brush" to GimpToolPreset

parent c6be8c60
......@@ -38,6 +38,7 @@
#define DEFAULT_USE_FG_BG FALSE
#define DEFAULT_USE_BRUSH TRUE
#define DEFAULT_USE_DYNAMICS TRUE
#define DEFAULT_USE_MYBRUSH TRUE
#define DEFAULT_USE_GRADIENT TRUE
#define DEFAULT_USE_PATTERN TRUE
#define DEFAULT_USE_PALETTE TRUE
......@@ -52,6 +53,7 @@ enum
PROP_USE_FG_BG,
PROP_USE_BRUSH,
PROP_USE_DYNAMICS,
PROP_USE_MYBRUSH,
PROP_USE_GRADIENT,
PROP_USE_PATTERN,
PROP_USE_PALETTE,
......@@ -146,6 +148,10 @@ gimp_tool_preset_class_init (GimpToolPresetClass *klass)
"use-dynamics", NULL,
DEFAULT_USE_DYNAMICS,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_USE_MYBRUSH,
"use-mypaint-brush", NULL,
DEFAULT_USE_MYBRUSH,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_USE_PATTERN,
"use-pattern", NULL,
TRUE,
......@@ -229,6 +235,9 @@ gimp_tool_preset_set_property (GObject *object,
case PROP_USE_DYNAMICS:
tool_preset->use_dynamics = g_value_get_boolean (value);
break;
case PROP_USE_MYBRUSH:
tool_preset->use_mybrush = g_value_get_boolean (value);
break;
case PROP_USE_PATTERN:
tool_preset->use_pattern = g_value_get_boolean (value);
break;
......@@ -276,6 +285,9 @@ gimp_tool_preset_get_property (GObject *object,
case PROP_USE_BRUSH:
g_value_set_boolean (value, tool_preset->use_brush);
break;
case PROP_USE_MYBRUSH:
g_value_set_boolean (value, tool_preset->use_mybrush);
break;
case PROP_USE_DYNAMICS:
g_value_set_boolean (value, tool_preset->use_dynamics);
break;
......@@ -386,6 +398,7 @@ gimp_tool_preset_deserialize_property (GimpConfig *config,
GIMP_CONTEXT (options),
GIMP_CONTEXT_PROP_MASK_BRUSH |
GIMP_CONTEXT_PROP_MASK_DYNAMICS |
GIMP_CONTEXT_PROP_MASK_MYBRUSH |
GIMP_CONTEXT_PROP_MASK_PATTERN |
GIMP_CONTEXT_PROP_MASK_GRADIENT |
GIMP_CONTEXT_PROP_MASK_PALETTE |
......@@ -483,6 +496,9 @@ gimp_tool_preset_set_options (GimpToolPreset *preset,
if (! (serialize_props & GIMP_CONTEXT_PROP_MASK_DYNAMICS))
g_object_set (preset, "use-dynamics", FALSE, NULL);
if (! (serialize_props & GIMP_CONTEXT_PROP_MASK_MYBRUSH))
g_object_set (preset, "use-mypaint-brush", FALSE, NULL);
if (! (serialize_props & GIMP_CONTEXT_PROP_MASK_GRADIENT))
g_object_set (preset, "use-gradient", FALSE, NULL);
......@@ -595,6 +611,9 @@ gimp_tool_preset_get_prop_mask (GimpToolPreset *preset)
if (preset->use_dynamics)
use_props |= (GIMP_CONTEXT_PROP_MASK_DYNAMICS & serialize_props);
if (preset->use_mybrush)
use_props |= (GIMP_CONTEXT_PROP_MASK_MYBRUSH & serialize_props);
if (preset->use_pattern)
use_props |= (GIMP_CONTEXT_PROP_MASK_PATTERN & serialize_props);
......
......@@ -42,6 +42,7 @@ struct _GimpToolPreset
gboolean use_fg_bg;
gboolean use_brush;
gboolean use_dynamics;
gboolean use_mybrush;
gboolean use_gradient;
gboolean use_pattern;
gboolean use_palette;
......
......@@ -48,6 +48,7 @@ struct _GimpToolPresetEditorPrivate
GtkWidget *fg_bg_toggle;
GtkWidget *brush_toggle;
GtkWidget *dynamics_toggle;
GtkWidget *mybrush_toggle;
GtkWidget *gradient_toggle;
GtkWidget *pattern_toggle;
GtkWidget *palette_toggle;
......@@ -172,6 +173,12 @@ gimp_tool_preset_editor_constructed (GObject *object)
gtk_box_pack_start (GTK_BOX (data_editor), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = editor->priv->mybrush_toggle =
gimp_prop_check_button_new (G_OBJECT (preset), "use-mypaint-brush",
_("Apply stored MyPaint brush"));
gtk_box_pack_start (GTK_BOX (data_editor), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = editor->priv->gradient_toggle =
gimp_prop_check_button_new (G_OBJECT (preset), "use-gradient",
_("Apply stored gradient"));
......@@ -311,6 +318,9 @@ gimp_tool_preset_editor_sync_data (GimpToolPresetEditor *editor)
gtk_widget_set_sensitive (priv->dynamics_toggle,
(serialize_props &
GIMP_CONTEXT_PROP_MASK_DYNAMICS) != 0);
gtk_widget_set_sensitive (priv->mybrush_toggle,
(serialize_props &
GIMP_CONTEXT_PROP_MASK_MYBRUSH) != 0);
gtk_widget_set_sensitive (priv->gradient_toggle,
(serialize_props &
GIMP_CONTEXT_PROP_MASK_GRADIENT) != 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment