app: separate handling of reverse-gradient from paint dynamics

because it belongs to the gradient and should be changed whenever the
gradient gets changed.

Introduce gimp_paint_options_copy_gradient_props() and call it at the
right places in the tool manager.
This commit is contained in:
Michael Natterer
2011-12-06 22:32:23 +01:00
parent 1b5a0f9d9d
commit 4300612962
3 changed files with 38 additions and 14 deletions

View File

@ -745,19 +745,16 @@ gimp_paint_options_copy_dynamics_props (GimpPaintOptions *src,
GimpUnit fade_unit; GimpUnit fade_unit;
GimpRepeatMode fade_repeat; GimpRepeatMode fade_repeat;
gboolean gradient_reverse;
g_return_if_fail (GIMP_IS_PAINT_OPTIONS (src)); g_return_if_fail (GIMP_IS_PAINT_OPTIONS (src));
g_return_if_fail (GIMP_IS_PAINT_OPTIONS (dest)); g_return_if_fail (GIMP_IS_PAINT_OPTIONS (dest));
g_object_get (src, g_object_get (src,
"dynamics-expanded", &dynamics_expanded, "dynamics-expanded", &dynamics_expanded,
"fade-reverse", &fade_reverse, "fade-reverse", &fade_reverse,
"fade-length", &fade_length, "fade-length", &fade_length,
"fade-unit", &fade_unit, "fade-unit", &fade_unit,
"fade-repeat", &fade_repeat, "fade-repeat", &fade_repeat,
"gradient-reverse", &gradient_reverse, NULL);
NULL);
g_object_set (dest, g_object_set (dest,
"dynamics-expanded", dynamics_expanded, "dynamics-expanded", dynamics_expanded,
@ -765,7 +762,23 @@ gimp_paint_options_copy_dynamics_props (GimpPaintOptions *src,
"fade-length", fade_length, "fade-length", fade_length,
"fade-unit", fade_unit, "fade-unit", fade_unit,
"fade-repeat", fade_repeat, "fade-repeat", fade_repeat,
"gradient-reverse", gradient_reverse, NULL);
}
void
gimp_paint_options_copy_gradient_props (GimpPaintOptions *src,
GimpPaintOptions *dest)
{
gboolean gradient_reverse;
g_return_if_fail (GIMP_IS_PAINT_OPTIONS (src));
g_return_if_fail (GIMP_IS_PAINT_OPTIONS (dest));
g_object_get (src,
"gradient-reverse", &gradient_reverse,
NULL); NULL);
g_object_set (dest,
"gradient-reverse", gradient_reverse,
NULL);
} }

View File

@ -131,12 +131,12 @@ gboolean gimp_paint_options_get_gradient_color (GimpPaintOptions *paint_options,
GimpBrushApplicationMode GimpBrushApplicationMode
gimp_paint_options_get_brush_mode (GimpPaintOptions *paint_options); gimp_paint_options_get_brush_mode (GimpPaintOptions *paint_options);
void gimp_paint_options_copy_brush_props (GimpPaintOptions *src, void gimp_paint_options_copy_brush_props (GimpPaintOptions *src,
GimpPaintOptions *dest); GimpPaintOptions *dest);
void gimp_paint_options_copy_dynamics_props (GimpPaintOptions *src, void gimp_paint_options_copy_dynamics_props (GimpPaintOptions *src,
GimpPaintOptions *dest); GimpPaintOptions *dest);
void gimp_paint_options_copy_gradient_props (GimpPaintOptions *src,
GimpPaintOptions *dest);
#endif /* __GIMP_PAINT_OPTIONS_H__ */ #endif /* __GIMP_PAINT_OPTIONS_H__ */

View File

@ -679,6 +679,10 @@ tool_manager_preset_changed (GimpContext *user_context,
if (config->global_dynamics && preset->use_dynamics) if (config->global_dynamics && preset->use_dynamics)
gimp_paint_options_copy_dynamics_props (GIMP_PAINT_OPTIONS (src), gimp_paint_options_copy_dynamics_props (GIMP_PAINT_OPTIONS (src),
GIMP_PAINT_OPTIONS (dest)); GIMP_PAINT_OPTIONS (dest));
if (config->global_gradient && preset->use_gradient)
gimp_paint_options_copy_gradient_props (GIMP_PAINT_OPTIONS (src),
GIMP_PAINT_OPTIONS (dest));
} }
} }
@ -743,6 +747,10 @@ tool_manager_connect_options (GimpToolManager *tool_manager,
if (config->global_dynamics) if (config->global_dynamics)
gimp_paint_options_copy_dynamics_props (tool_manager->shared_paint_options, gimp_paint_options_copy_dynamics_props (tool_manager->shared_paint_options,
GIMP_PAINT_OPTIONS (tool_info->tool_options)); GIMP_PAINT_OPTIONS (tool_info->tool_options));
if (config->global_gradient)
gimp_paint_options_copy_gradient_props (tool_manager->shared_paint_options,
GIMP_PAINT_OPTIONS (tool_info->tool_options));
} }
} }
} }
@ -764,6 +772,9 @@ tool_manager_disconnect_options (GimpToolManager *tool_manager,
gimp_paint_options_copy_dynamics_props (GIMP_PAINT_OPTIONS (tool_info->tool_options), gimp_paint_options_copy_dynamics_props (GIMP_PAINT_OPTIONS (tool_info->tool_options),
tool_manager->shared_paint_options); tool_manager->shared_paint_options);
gimp_paint_options_copy_gradient_props (GIMP_PAINT_OPTIONS (tool_info->tool_options),
tool_manager->shared_paint_options);
} }
gimp_context_set_parent (GIMP_CONTEXT (tool_info->tool_options), NULL); gimp_context_set_parent (GIMP_CONTEXT (tool_info->tool_options), NULL);