Commit 23bd1216 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

implement the whole paint_options fiddling here instead of in each

2004-08-26  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpitem.c (gimp_item_stroke): implement the whole
	paint_options fiddling here instead of in each subclass and pass
	either GimpStrokeOptions or GimpPaintOptions (instead of
	GimpStrokeOptions or GimpPaintInfo) to GimpItem::stroke().

	Also copied code (that needs to be abstracted to a utility
	function) from the tool_manager which makes sure we really use the
	global brush, pattern etc. if these options are checked in prefs.
	Fixes bug #150716.

	* app/core/gimpchannel.c (gimp_channel_stroke)
	* app/vectors/gimpvectors.c (gimp_vectors_stroke): removed the
	duplicated code mentioned above and simply use the paint_options
	passed.
parent e919974b
2004-08-26 Michael Natterer <mitch@gimp.org>
* app/core/gimpitem.c (gimp_item_stroke): implement the whole
paint_options fiddling here instead of in each subclass and pass
either GimpStrokeOptions or GimpPaintOptions (instead of
GimpStrokeOptions or GimpPaintInfo) to GimpItem::stroke().
Also copied code (that needs to be abstracted to a utility
function) from the tool_manager which makes sure we really use the
global brush, pattern etc. if these options are checked in prefs.
Fixes bug #150716.
* app/core/gimpchannel.c (gimp_channel_stroke)
* app/vectors/gimpvectors.c (gimp_vectors_stroke): removed the
duplicated code mentioned above and simply use the paint_options
passed.
2004-08-26 DindinX <david@dindinx.org>
* app/widgets/gimpviewrenderervectors.h: GimpViewRendererVector is
......
......@@ -52,6 +52,8 @@
#include "gimppaintinfo.h"
#include "gimpprojection.h"
#include "gimpstrokeoptions.h"
#include "gimptoolinfo.h"
#include "gimptooloptions.h"
#include "gimp-intl.h"
......@@ -622,42 +624,19 @@ gimp_channel_stroke (GimpItem *item,
offset_x, offset_y);
retval = TRUE;
}
else if (GIMP_IS_PAINT_INFO (stroke_desc))
else if (GIMP_IS_PAINT_OPTIONS (stroke_desc))
{
GimpImage *gimage = gimp_item_get_image (item);
GimpPaintInfo *paint_info = GIMP_PAINT_INFO (stroke_desc);
GimpPaintOptions *paint_options;
GimpPaintOptions *paint_options = GIMP_PAINT_OPTIONS (stroke_desc);
GimpPaintCore *core;
if (use_default_values)
{
paint_options =
gimp_paint_options_new (gimage->gimp,
paint_info->paint_options_type);
/* undefine the paint-relevant context properties and get them
* from the passed context
*/
gimp_context_define_properties (GIMP_CONTEXT (paint_options),
GIMP_CONTEXT_PAINT_PROPS_MASK,
FALSE);
gimp_context_set_parent (GIMP_CONTEXT (paint_options), context);
}
else
{
paint_options = paint_info->paint_options;
}
core = g_object_new (paint_info->paint_type, NULL);
core = g_object_new (GIMP_TOOL_OPTIONS (paint_options)->tool_info->paint_info->paint_type, NULL);
retval = gimp_paint_core_stroke_boundary (core, drawable,
paint_options,
segs_in, n_segs_in,
offset_x, offset_y);
g_object_unref (core);
if (use_default_values)
g_object_unref (paint_options);
g_object_unref (core);
}
return retval;
......
......@@ -27,6 +27,11 @@
#include "core-types.h"
#include "config/gimpconfig.h"
#include "config/gimpcoreconfig.h"
#include "paint/gimppaintoptions.h"
#include "gimp.h"
#include "gimp-parasites.h"
#include "gimpdrawable.h"
......@@ -992,9 +997,66 @@ gimp_item_stroke (GimpItem *item,
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_PAINT,
item_class->stroke_desc);
if (GIMP_IS_STROKE_OPTIONS (stroke_desc))
{
g_object_ref (stroke_desc);
}
else if (GIMP_IS_PAINT_INFO (stroke_desc))
{
GimpImage *gimage = gimp_item_get_image (item);
GimpPaintInfo *paint_info = GIMP_PAINT_INFO (stroke_desc);
GimpPaintOptions *paint_options;
if (use_default_values)
{
paint_options =
gimp_paint_options_new (gimage->gimp,
paint_info->paint_options_type);
/* undefine the paint-relevant context properties and get them
* from the passed context
*/
gimp_context_define_properties (GIMP_CONTEXT (paint_options),
GIMP_CONTEXT_PAINT_PROPS_MASK,
FALSE);
gimp_context_set_parent (GIMP_CONTEXT (paint_options), context);
}
else
{
GimpCoreConfig *config = context->gimp->config;
GimpContextPropMask global_props = 0;
paint_options =
gimp_config_duplicate (GIMP_CONFIG (paint_info->paint_options));
/* FG and BG are always shared between all tools */
global_props |= GIMP_CONTEXT_FOREGROUND_MASK;
global_props |= GIMP_CONTEXT_BACKGROUND_MASK;
if (config->global_brush)
global_props |= GIMP_CONTEXT_BRUSH_MASK;
if (config->global_pattern)
global_props |= GIMP_CONTEXT_PATTERN_MASK;
if (config->global_palette)
global_props |= GIMP_CONTEXT_PALETTE_MASK;
if (config->global_gradient)
global_props |= GIMP_CONTEXT_GRADIENT_MASK;
if (config->global_font)
global_props |= GIMP_CONTEXT_FONT_MASK;
gimp_context_copy_properties (context,
GIMP_CONTEXT (paint_options),
global_props);
}
stroke_desc = GIMP_OBJECT (paint_options);
}
retval = item_class->stroke (item, drawable, context,
stroke_desc, use_default_values);
g_object_unref (stroke_desc);
gimp_image_undo_group_end (gimage);
}
......
......@@ -37,6 +37,8 @@
#include "core/gimpmarshal.h"
#include "core/gimppaintinfo.h"
#include "core/gimpstrokeoptions.h"
#include "core/gimptoolinfo.h"
#include "core/gimptooloptions.h"
#include "paint/gimppaintcore-stroke.h"
#include "paint/gimppaintoptions.h"
......@@ -582,40 +584,16 @@ gimp_vectors_stroke (GimpItem *item,
}
else if (GIMP_IS_PAINT_INFO (stroke_desc))
{
GimpImage *gimage = gimp_item_get_image (item);
GimpPaintInfo *paint_info = GIMP_PAINT_INFO (stroke_desc);
GimpPaintOptions *paint_options;
GimpPaintOptions *paint_options = GIMP_PAINT_OPTIONS (stroke_desc);
GimpPaintCore *core;
if (use_default_values)
{
paint_options =
gimp_paint_options_new (gimage->gimp,
paint_info->paint_options_type);
/* undefine the paint-relevant context properties and get them
* from the passed context
*/
gimp_context_define_properties (GIMP_CONTEXT (paint_options),
GIMP_CONTEXT_PAINT_PROPS_MASK,
FALSE);
gimp_context_set_parent (GIMP_CONTEXT (paint_options), context);
}
else
{
paint_options = paint_info->paint_options;
}
core = g_object_new (paint_info->paint_type, NULL);
core = g_object_new (GIMP_TOOL_OPTIONS (paint_options)->tool_info->paint_info->paint_type, NULL);
retval = gimp_paint_core_stroke_vectors (core, drawable,
paint_options,
vectors);
g_object_unref (core);
if (use_default_values)
g_object_unref (paint_options);
}
return retval;
......
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