Issue #3533 - Tool preset doesn't restore opacity and paint mode
There is no non-hackish way of fixing this without adding a new
"use-opacity-paint-mode" property to GimpToolPreset and a new toggle
in GimpToolPresetEditor. Restoring opacity and paint mode can now be
controlled explicitly, and defaults to TRUE.
(cherry picked from commit 97b714d428
)
This commit is contained in:
@ -39,14 +39,15 @@
|
||||
* with gradients, which is why we special case the gradient tool in
|
||||
* gimp_tool_preset_set_options().
|
||||
*/
|
||||
#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 FALSE
|
||||
#define DEFAULT_USE_PATTERN TRUE
|
||||
#define DEFAULT_USE_PALETTE FALSE
|
||||
#define DEFAULT_USE_FONT TRUE
|
||||
#define DEFAULT_USE_FG_BG FALSE
|
||||
#define DEFAULT_USE_OPACITY_PAINT_MODE TRUE
|
||||
#define DEFAULT_USE_BRUSH TRUE
|
||||
#define DEFAULT_USE_DYNAMICS TRUE
|
||||
#define DEFAULT_USE_MYBRUSH TRUE
|
||||
#define DEFAULT_USE_GRADIENT FALSE
|
||||
#define DEFAULT_USE_PATTERN TRUE
|
||||
#define DEFAULT_USE_PALETTE FALSE
|
||||
#define DEFAULT_USE_FONT TRUE
|
||||
|
||||
enum
|
||||
{
|
||||
@ -55,6 +56,7 @@ enum
|
||||
PROP_GIMP,
|
||||
PROP_TOOL_OPTIONS,
|
||||
PROP_USE_FG_BG,
|
||||
PROP_USE_OPACITY_PAINT_MODE,
|
||||
PROP_USE_BRUSH,
|
||||
PROP_USE_DYNAMICS,
|
||||
PROP_USE_MYBRUSH,
|
||||
@ -149,6 +151,13 @@ gimp_tool_preset_class_init (GimpToolPresetClass *klass)
|
||||
DEFAULT_USE_FG_BG,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_USE_OPACITY_PAINT_MODE,
|
||||
"use-opacity-paint-mode",
|
||||
_("Apply stored opacity/paint mode"),
|
||||
NULL,
|
||||
DEFAULT_USE_OPACITY_PAINT_MODE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_USE_BRUSH,
|
||||
"use-brush",
|
||||
_("Apply stored brush"),
|
||||
@ -257,6 +266,9 @@ gimp_tool_preset_set_property (GObject *object,
|
||||
case PROP_USE_FG_BG:
|
||||
tool_preset->use_fg_bg = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_USE_OPACITY_PAINT_MODE:
|
||||
tool_preset->use_opacity_paint_mode = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_USE_BRUSH:
|
||||
tool_preset->use_brush = g_value_get_boolean (value);
|
||||
break;
|
||||
@ -310,6 +322,9 @@ gimp_tool_preset_get_property (GObject *object,
|
||||
case PROP_USE_FG_BG:
|
||||
g_value_set_boolean (value, tool_preset->use_fg_bg);
|
||||
break;
|
||||
case PROP_USE_OPACITY_PAINT_MODE:
|
||||
g_value_set_boolean (value, tool_preset->use_opacity_paint_mode);
|
||||
break;
|
||||
case PROP_USE_BRUSH:
|
||||
g_value_set_boolean (value, tool_preset->use_brush);
|
||||
break;
|
||||
@ -535,6 +550,10 @@ gimp_tool_preset_set_options (GimpToolPreset *preset,
|
||||
! (serialize_props & GIMP_CONTEXT_PROP_MASK_BACKGROUND))
|
||||
g_object_set (preset, "use-fg-bg", FALSE, NULL);
|
||||
|
||||
if (! (serialize_props & GIMP_CONTEXT_PROP_MASK_OPACITY) &&
|
||||
! (serialize_props & GIMP_CONTEXT_PROP_MASK_PAINT_MODE))
|
||||
g_object_set (preset, "use-opacity-paint-mode", FALSE, NULL);
|
||||
|
||||
if (! (serialize_props & GIMP_CONTEXT_PROP_MASK_BRUSH))
|
||||
g_object_set (preset, "use-brush", FALSE, NULL);
|
||||
|
||||
@ -655,6 +674,12 @@ gimp_tool_preset_get_prop_mask (GimpToolPreset *preset)
|
||||
use_props |= (GIMP_CONTEXT_PROP_MASK_BACKGROUND & serialize_props);
|
||||
}
|
||||
|
||||
if (preset->use_opacity_paint_mode)
|
||||
{
|
||||
use_props |= (GIMP_CONTEXT_PROP_MASK_OPACITY & serialize_props);
|
||||
use_props |= (GIMP_CONTEXT_PROP_MASK_PAINT_MODE & serialize_props);
|
||||
}
|
||||
|
||||
if (preset->use_brush)
|
||||
use_props |= (GIMP_CONTEXT_PROP_MASK_BRUSH & serialize_props);
|
||||
|
||||
|
@ -40,6 +40,7 @@ struct _GimpToolPreset
|
||||
GimpToolOptions *tool_options;
|
||||
|
||||
gboolean use_fg_bg;
|
||||
gboolean use_opacity_paint_mode;
|
||||
gboolean use_brush;
|
||||
gboolean use_dynamics;
|
||||
gboolean use_mybrush;
|
||||
|
Reference in New Issue
Block a user