add "gboolean use_context_color" parameter to gimp_stroke_options_new()
2008-10-25 Michael Natterer <mitch@gimp.org> * app/core/gimpstrokeoptions.[ch]: add "gboolean use_context_color" parameter to gimp_stroke_options_new() and set the passed context as parent of the new options only if it's TRUE. Also fixed the GimpConfig::duplicate() implementation to really duplicate the object and not just return an object containing default values. * app/core/gimpfilloptions.[ch]: add gimp_fill_options_new(). * app/actions/select-commands.c * app/dialogs/stroke-dialog.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/paths.pdb: pass TRUE to gimp_stroke_options_new(). * app/pdb/edit-cmds.c * app/pdb/paths-cmds.c: regenerated. svn path=/trunk/; revision=27393
This commit is contained in:

committed by
Michael Natterer

parent
90c26cf10e
commit
efb6d15acf
19
ChangeLog
19
ChangeLog
@ -1,3 +1,22 @@
|
|||||||
|
2008-10-25 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* app/core/gimpstrokeoptions.[ch]: add "gboolean use_context_color"
|
||||||
|
parameter to gimp_stroke_options_new() and set the passed context
|
||||||
|
as parent of the new options only if it's TRUE. Also fixed the
|
||||||
|
GimpConfig::duplicate() implementation to really duplicate the
|
||||||
|
object and not just return an object containing default values.
|
||||||
|
|
||||||
|
* app/core/gimpfilloptions.[ch]: add gimp_fill_options_new().
|
||||||
|
|
||||||
|
* app/actions/select-commands.c
|
||||||
|
* app/dialogs/stroke-dialog.c
|
||||||
|
* app/actions/vectors-commands.c
|
||||||
|
* tools/pdbgen/pdb/edit.pdb
|
||||||
|
* tools/pdbgen/pdb/paths.pdb: pass TRUE to gimp_stroke_options_new().
|
||||||
|
|
||||||
|
* app/pdb/edit-cmds.c
|
||||||
|
* app/pdb/paths-cmds.c: regenerated.
|
||||||
|
|
||||||
2008-10-25 Michael Natterer <mitch@gimp.org>
|
2008-10-25 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* app/core/gimpfilloptions.[ch]: add non-serializable properties
|
* app/core/gimpfilloptions.[ch]: add non-serializable properties
|
||||||
|
@ -369,7 +369,7 @@ select_stroke_last_vals_cmd_callback (GtkAction *action,
|
|||||||
if (options)
|
if (options)
|
||||||
g_object_ref (options);
|
g_object_ref (options);
|
||||||
else
|
else
|
||||||
options = gimp_stroke_options_new (image->gimp, context);
|
options = gimp_stroke_options_new (image->gimp, context, TRUE);
|
||||||
|
|
||||||
if (! gimp_item_stroke (GIMP_ITEM (gimp_image_get_mask (image)),
|
if (! gimp_item_stroke (GIMP_ITEM (gimp_image_get_mask (image)),
|
||||||
drawable, context, options, FALSE, NULL, &error))
|
drawable, context, options, FALSE, NULL, &error))
|
||||||
|
@ -420,7 +420,7 @@ vectors_stroke_last_vals_cmd_callback (GtkAction *action,
|
|||||||
if (options)
|
if (options)
|
||||||
g_object_ref (options);
|
g_object_ref (options);
|
||||||
else
|
else
|
||||||
options = gimp_stroke_options_new (image->gimp, context);
|
options = gimp_stroke_options_new (image->gimp, context, TRUE);
|
||||||
|
|
||||||
if (! gimp_item_stroke (GIMP_ITEM (vectors), drawable, context, options, FALSE,
|
if (! gimp_item_stroke (GIMP_ITEM (vectors), drawable, context, options, FALSE,
|
||||||
NULL, &error))
|
NULL, &error))
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "core-types.h"
|
#include "core-types.h"
|
||||||
|
|
||||||
|
#include "gimp.h"
|
||||||
#include "gimpfilloptions.h"
|
#include "gimpfilloptions.h"
|
||||||
#include "gimpviewable.h"
|
#include "gimpviewable.h"
|
||||||
|
|
||||||
@ -156,3 +157,16 @@ gimp_fill_options_get_property (GObject *object,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* public functions */
|
||||||
|
|
||||||
|
GimpFillOptions *
|
||||||
|
gimp_fill_options_new (Gimp *gimp)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||||
|
|
||||||
|
return g_object_new (GIMP_TYPE_FILL_OPTIONS,
|
||||||
|
"gimp", gimp,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
@ -54,7 +54,9 @@ struct _GimpFillOptionsClass
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GType gimp_fill_options_get_type (void) G_GNUC_CONST;
|
GType gimp_fill_options_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
GimpFillOptions * gimp_fill_options_new (Gimp *gimp);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_FILL_OPTIONS_H__ */
|
#endif /* __GIMP_FILL_OPTIONS_H__ */
|
||||||
|
@ -94,6 +94,8 @@ G_DEFINE_TYPE_WITH_CODE (GimpStrokeOptions, gimp_stroke_options,
|
|||||||
|
|
||||||
#define parent_class gimp_stroke_options_parent_class
|
#define parent_class gimp_stroke_options_parent_class
|
||||||
|
|
||||||
|
static GimpConfigInterface *parent_config_iface = NULL;
|
||||||
|
|
||||||
static guint stroke_options_signals[LAST_SIGNAL] = { 0 };
|
static guint stroke_options_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
|
|
||||||
@ -185,6 +187,11 @@ gimp_stroke_options_config_iface_init (gpointer iface,
|
|||||||
{
|
{
|
||||||
GimpConfigInterface *config_iface = (GimpConfigInterface *) iface;
|
GimpConfigInterface *config_iface = (GimpConfigInterface *) iface;
|
||||||
|
|
||||||
|
parent_config_iface = g_type_interface_peek_parent (config_iface);
|
||||||
|
|
||||||
|
if (! parent_config_iface)
|
||||||
|
parent_config_iface = g_type_default_interface_peek (GIMP_TYPE_CONFIG);
|
||||||
|
|
||||||
config_iface->duplicate = gimp_stroke_options_duplicate;
|
config_iface->duplicate = gimp_stroke_options_duplicate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,8 +332,7 @@ gimp_stroke_options_duplicate (GimpConfig *config)
|
|||||||
GimpStrokeOptions *options = GIMP_STROKE_OPTIONS (config);
|
GimpStrokeOptions *options = GIMP_STROKE_OPTIONS (config);
|
||||||
GimpStrokeOptions *new_options;
|
GimpStrokeOptions *new_options;
|
||||||
|
|
||||||
new_options = gimp_stroke_options_new (GIMP_CONTEXT (options)->gimp,
|
new_options = GIMP_STROKE_OPTIONS (parent_config_iface->duplicate (config));
|
||||||
GIMP_CONTEXT (options));
|
|
||||||
|
|
||||||
if (options->paint_options)
|
if (options->paint_options)
|
||||||
{
|
{
|
||||||
@ -345,13 +351,15 @@ gimp_stroke_options_duplicate (GimpConfig *config)
|
|||||||
|
|
||||||
GimpStrokeOptions *
|
GimpStrokeOptions *
|
||||||
gimp_stroke_options_new (Gimp *gimp,
|
gimp_stroke_options_new (Gimp *gimp,
|
||||||
GimpContext *context)
|
GimpContext *context,
|
||||||
|
gboolean use_context_color)
|
||||||
{
|
{
|
||||||
GimpPaintInfo *paint_info = NULL;
|
GimpPaintInfo *paint_info = NULL;
|
||||||
GimpStrokeOptions *options;
|
GimpStrokeOptions *options;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||||
g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
|
g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
|
||||||
|
g_return_val_if_fail (use_context_color == FALSE || context != NULL, NULL);
|
||||||
|
|
||||||
if (context)
|
if (context)
|
||||||
paint_info = gimp_context_get_paint_info (context);
|
paint_info = gimp_context_get_paint_info (context);
|
||||||
@ -364,13 +372,15 @@ gimp_stroke_options_new (Gimp *gimp,
|
|||||||
"paint-info", paint_info,
|
"paint-info", paint_info,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gimp_context_define_properties (GIMP_CONTEXT (options),
|
if (use_context_color)
|
||||||
GIMP_CONTEXT_FOREGROUND_MASK |
|
{
|
||||||
GIMP_CONTEXT_PATTERN_MASK,
|
gimp_context_define_properties (GIMP_CONTEXT (options),
|
||||||
FALSE);
|
GIMP_CONTEXT_FOREGROUND_MASK |
|
||||||
|
GIMP_CONTEXT_PATTERN_MASK,
|
||||||
|
FALSE);
|
||||||
|
|
||||||
if (context)
|
gimp_context_set_parent (GIMP_CONTEXT (options), context);
|
||||||
gimp_context_set_parent (GIMP_CONTEXT (options), context);
|
}
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,8 @@ struct _GimpStrokeOptionsClass
|
|||||||
GType gimp_stroke_options_get_type (void) G_GNUC_CONST;
|
GType gimp_stroke_options_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
GimpStrokeOptions * gimp_stroke_options_new (Gimp *gimp,
|
GimpStrokeOptions * gimp_stroke_options_new (Gimp *gimp,
|
||||||
GimpContext *context);
|
GimpContext *context,
|
||||||
|
gboolean use_context_color);
|
||||||
void gimp_stroke_options_take_dash_pattern (GimpStrokeOptions *options,
|
void gimp_stroke_options_take_dash_pattern (GimpStrokeOptions *options,
|
||||||
GimpDashPreset preset,
|
GimpDashPreset preset,
|
||||||
GArray *pattern);
|
GArray *pattern);
|
||||||
|
@ -88,7 +88,7 @@ stroke_dialog_new (GimpItem *item,
|
|||||||
|
|
||||||
image = gimp_item_get_image (item);
|
image = gimp_item_get_image (item);
|
||||||
|
|
||||||
options = gimp_stroke_options_new (context->gimp, context);
|
options = gimp_stroke_options_new (context->gimp, context, TRUE);
|
||||||
|
|
||||||
saved_options = g_object_get_data (G_OBJECT (context->gimp),
|
saved_options = g_object_get_data (G_OBJECT (context->gimp),
|
||||||
"saved-stroke-options");
|
"saved-stroke-options");
|
||||||
@ -307,7 +307,7 @@ stroke_dialog_response (GtkWidget *widget,
|
|||||||
if (saved_options)
|
if (saved_options)
|
||||||
g_object_ref (saved_options);
|
g_object_ref (saved_options);
|
||||||
else
|
else
|
||||||
saved_options = gimp_stroke_options_new (context->gimp, context);
|
saved_options = gimp_stroke_options_new (context->gimp, context, TRUE);
|
||||||
|
|
||||||
gimp_config_sync (G_OBJECT (options), G_OBJECT (saved_options), 0);
|
gimp_config_sync (G_OBJECT (options), G_OBJECT (saved_options), 0);
|
||||||
|
|
||||||
|
@ -747,7 +747,7 @@ edit_stroke_invoker (GimpProcedure *procedure,
|
|||||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
|
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||||
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
|
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context, TRUE);
|
||||||
|
|
||||||
g_object_set (options,
|
g_object_set (options,
|
||||||
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
||||||
@ -787,7 +787,7 @@ edit_stroke_vectors_invoker (GimpProcedure *procedure,
|
|||||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) &&
|
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) &&
|
||||||
gimp_pdb_item_is_attached (GIMP_ITEM (vectors), error))
|
gimp_pdb_item_is_attached (GIMP_ITEM (vectors), error))
|
||||||
{
|
{
|
||||||
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
|
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context, TRUE);
|
||||||
|
|
||||||
g_object_set (options,
|
g_object_set (options,
|
||||||
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
||||||
|
@ -333,7 +333,7 @@ path_stroke_current_invoker (GimpProcedure *procedure,
|
|||||||
|
|
||||||
if (vectors && drawable)
|
if (vectors && drawable)
|
||||||
{
|
{
|
||||||
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
|
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context, TRUE);
|
||||||
|
|
||||||
g_object_set (options,
|
g_object_set (options,
|
||||||
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
||||||
|
@ -833,7 +833,7 @@ HELP
|
|||||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
|
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||||
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
|
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context, TRUE);
|
||||||
|
|
||||||
g_object_set (options,
|
g_object_set (options,
|
||||||
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
||||||
@ -876,7 +876,7 @@ HELP
|
|||||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) &&
|
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) &&
|
||||||
gimp_pdb_item_is_attached (GIMP_ITEM (vectors), error))
|
gimp_pdb_item_is_attached (GIMP_ITEM (vectors), error))
|
||||||
{
|
{
|
||||||
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
|
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context, TRUE);
|
||||||
|
|
||||||
g_object_set (options,
|
g_object_set (options,
|
||||||
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
||||||
|
@ -268,7 +268,7 @@ sub path_stroke_current {
|
|||||||
|
|
||||||
if (vectors && drawable)
|
if (vectors && drawable)
|
||||||
{
|
{
|
||||||
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
|
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context, TRUE);
|
||||||
|
|
||||||
g_object_set (options,
|
g_object_set (options,
|
||||||
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
"method", GIMP_STROKE_METHOD_PAINT_CORE,
|
||||||
|
Reference in New Issue
Block a user