mirror of https://github.com/GNOME/gimp.git
register GimpPaintApplicationMode with the type system.
2003-03-24 Michael Natterer <mitch@gimp.org> * app/paint/paint-enums.[ch]: register GimpPaintApplicationMode with the type system. * app/paint/gimppaintoptions.[ch]: replaced "gboolean incremental" with "GimpPaintApplicationMode application_mode" * app/paint/gimpairbrush.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/paint/gimppencil.c: changed accordingly. * tools/pdbgen/pdb/paint_tools.pdb: ditto. Set all paint options values using g_object_set(). * app/widgets/gimppropwidgets.[ch]: added gimp_prop_enum_check_button_new() which can represent two specified enum values and renders itself "inconsistent" for all other values. * app/tools/paint_options.c: use it for the "Incremental" toggle. * app/pdb/paint_tools_cmds.c * tools/pdbgen/enums.pl: regenerated.
This commit is contained in:
parent
3d8cc9a2a1
commit
c40a6f9920
26
ChangeLog
26
ChangeLog
|
@ -1,3 +1,29 @@
|
|||
2003-03-24 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/paint/paint-enums.[ch]: register GimpPaintApplicationMode
|
||||
with the type system.
|
||||
|
||||
* app/paint/gimppaintoptions.[ch]: replaced "gboolean incremental"
|
||||
with "GimpPaintApplicationMode application_mode"
|
||||
|
||||
* app/paint/gimpairbrush.c
|
||||
* app/paint/gimperaser.c
|
||||
* app/paint/gimppaintbrush.c
|
||||
* app/paint/gimppencil.c: changed accordingly.
|
||||
|
||||
* tools/pdbgen/pdb/paint_tools.pdb: ditto. Set all paint options
|
||||
values using g_object_set().
|
||||
|
||||
* app/widgets/gimppropwidgets.[ch]: added
|
||||
gimp_prop_enum_check_button_new() which can represent two
|
||||
specified enum values and renders itself "inconsistent" for all
|
||||
other values.
|
||||
|
||||
* app/tools/paint_options.c: use it for the "Incremental" toggle.
|
||||
|
||||
* app/pdb/paint_tools_cmds.c
|
||||
* tools/pdbgen/enums.pl: regenerated.
|
||||
|
||||
2003-03-24 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/common/compose.c: added some stock icons to the dialog.
|
||||
|
|
|
@ -226,10 +226,9 @@ gimp_airbrush_motion (GimpPaintCore *paint_core,
|
|||
|
||||
context = GIMP_CONTEXT (paint_options);
|
||||
|
||||
paint_appl_mode = (paint_options->incremental ?
|
||||
GIMP_PAINT_INCREMENTAL : GIMP_PAINT_CONSTANT);
|
||||
paint_appl_mode = paint_options->application_mode;
|
||||
|
||||
pressure = ((GimpAirbrushOptions *) paint_options)->pressure / 100.0;
|
||||
pressure = GIMP_AIRBRUSH_OPTIONS (paint_options)->pressure / 100.0;
|
||||
|
||||
if (paint_options->pressure_options->size)
|
||||
scale = paint_core->cur_coords.pressure;
|
||||
|
|
|
@ -145,7 +145,6 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
|
|||
guchar col[MAX_CHANNELS];
|
||||
gdouble scale;
|
||||
GimpBrushApplicationMode brush_mode;
|
||||
GimpPaintApplicationMode paint_appl_mode;
|
||||
|
||||
if (! (gimage = gimp_item_get_image (GIMP_ITEM (drawable))))
|
||||
return;
|
||||
|
@ -157,9 +156,6 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
|
|||
|
||||
gimp_image_get_background (gimage, drawable, col);
|
||||
|
||||
paint_appl_mode = (paint_options->incremental ?
|
||||
GIMP_PAINT_INCREMENTAL : GIMP_PAINT_CONSTANT);
|
||||
|
||||
if (pressure_options->size)
|
||||
scale = paint_core->cur_coords.pressure;
|
||||
else
|
||||
|
@ -198,5 +194,5 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
|
|||
GIMP_ANTI_ERASE_MODE : GIMP_ERASE_MODE),
|
||||
brush_mode,
|
||||
scale,
|
||||
paint_appl_mode);
|
||||
paint_options->application_mode);
|
||||
}
|
||||
|
|
|
@ -159,8 +159,7 @@ gimp_paintbrush_motion (GimpPaintCore *paint_core,
|
|||
pressure_options = paint_options->pressure_options;
|
||||
gradient_options = paint_options->gradient_options;
|
||||
|
||||
paint_appl_mode = (paint_options->incremental ?
|
||||
GIMP_PAINT_INCREMENTAL : GIMP_PAINT_CONSTANT);
|
||||
paint_appl_mode = paint_options->application_mode;
|
||||
|
||||
if (gradient_options->use_fade)
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "gimppaintoptions.h"
|
||||
|
||||
|
||||
#define DEFAULT_INCREMENTAL FALSE
|
||||
#define DEFAULT_APPLICATION_MODE GIMP_PAINT_CONSTANT
|
||||
|
||||
#define DEFAULT_PRESSURE_OPACITY TRUE
|
||||
#define DEFAULT_PRESSURE_PRESSURE TRUE
|
||||
|
@ -51,7 +51,7 @@
|
|||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_INCREMENTAL,
|
||||
PROP_APPLICATION_MODE,
|
||||
PROP_PRESSURE_OPACITY,
|
||||
PROP_PRESSURE_PRESSURE,
|
||||
PROP_PRESSURE_RATE,
|
||||
|
@ -126,10 +126,11 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
|
|||
object_class->get_property = gimp_paint_options_get_property;
|
||||
object_class->notify = gimp_paint_options_notify;
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_INCREMENTAL,
|
||||
"incremental", NULL,
|
||||
DEFAULT_INCREMENTAL,
|
||||
0);
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_APPLICATION_MODE,
|
||||
"application-mode", NULL,
|
||||
GIMP_TYPE_PAINT_APPLICATION_MODE,
|
||||
DEFAULT_APPLICATION_MODE,
|
||||
0);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_OPACITY,
|
||||
"pressure-opacity", NULL,
|
||||
|
@ -186,7 +187,7 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
|
|||
static void
|
||||
gimp_paint_options_init (GimpPaintOptions *options)
|
||||
{
|
||||
options->incremental_save = DEFAULT_INCREMENTAL;
|
||||
options->application_mode_save = DEFAULT_APPLICATION_MODE;
|
||||
|
||||
options->pressure_options = g_new0 (GimpPressureOptions, 1);
|
||||
options->gradient_options = g_new0 (GimpGradientOptions, 1);
|
||||
|
@ -209,8 +210,8 @@ gimp_paint_options_set_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_INCREMENTAL:
|
||||
options->incremental = g_value_get_boolean (value);
|
||||
case PROP_APPLICATION_MODE:
|
||||
options->application_mode = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case PROP_PRESSURE_OPACITY:
|
||||
|
@ -275,8 +276,8 @@ gimp_paint_options_get_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_INCREMENTAL:
|
||||
g_value_set_boolean (value, options->incremental);
|
||||
case PROP_APPLICATION_MODE:
|
||||
g_value_set_enum (value, options->application_mode);
|
||||
break;
|
||||
|
||||
case PROP_PRESSURE_OPACITY:
|
||||
|
@ -336,15 +337,15 @@ gimp_paint_options_notify (GObject *object,
|
|||
{
|
||||
if (options->gradient_options->use_gradient)
|
||||
{
|
||||
options->incremental_save = options->incremental;
|
||||
options->incremental = TRUE;
|
||||
options->application_mode_save = options->application_mode;
|
||||
options->application_mode = GIMP_PAINT_INCREMENTAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
options->incremental = options->incremental_save;
|
||||
options->application_mode = options->application_mode_save;
|
||||
}
|
||||
|
||||
g_object_notify (object, "incremental");
|
||||
g_object_notify (object, "application-mode");
|
||||
}
|
||||
|
||||
if (G_OBJECT_CLASS (parent_class)->notify)
|
||||
|
|
|
@ -60,13 +60,13 @@ typedef struct _GimpPaintOptionsClass GimpPaintOptionsClass;
|
|||
|
||||
struct _GimpPaintOptions
|
||||
{
|
||||
GimpToolOptions parent_instance;
|
||||
GimpToolOptions parent_instance;
|
||||
|
||||
gboolean incremental;
|
||||
gboolean incremental_save;
|
||||
GimpPaintApplicationMode application_mode;
|
||||
GimpPaintApplicationMode application_mode_save;
|
||||
|
||||
GimpPressureOptions *pressure_options;
|
||||
GimpGradientOptions *gradient_options;
|
||||
GimpPressureOptions *pressure_options;
|
||||
GimpGradientOptions *gradient_options;
|
||||
};
|
||||
|
||||
struct _GimpPaintOptionsClass
|
||||
|
|
|
@ -153,8 +153,7 @@ gimp_pencil_motion (GimpPaintCore *paint_core,
|
|||
|
||||
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
|
||||
paint_appl_mode = (paint_options->incremental ?
|
||||
GIMP_PAINT_INCREMENTAL : GIMP_PAINT_CONSTANT);
|
||||
paint_appl_mode = paint_options->application_mode;
|
||||
|
||||
if (pressure_options->size)
|
||||
scale = paint_core->cur_coords.pressure;
|
||||
|
|
|
@ -126,5 +126,24 @@ gimp_ink_blob_type_get_type (void)
|
|||
}
|
||||
|
||||
|
||||
static const GEnumValue gimp_paint_application_mode_enum_values[] =
|
||||
{
|
||||
{ GIMP_PAINT_CONSTANT, N_("Constant"), "constant" },
|
||||
{ GIMP_PAINT_INCREMENTAL, N_("Incremental"), "incremental" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
GType
|
||||
gimp_paint_application_mode_get_type (void)
|
||||
{
|
||||
static GType enum_type = 0;
|
||||
|
||||
if (!enum_type)
|
||||
enum_type = g_enum_register_static ("GimpPaintApplicationMode", gimp_paint_application_mode_enum_values);
|
||||
|
||||
return enum_type;
|
||||
}
|
||||
|
||||
|
||||
/* Generated data ends here */
|
||||
|
||||
|
|
|
@ -107,6 +107,17 @@ typedef enum /*< pdb-skip >*/
|
|||
} GimpInkBlobType;
|
||||
|
||||
|
||||
#define GIMP_TYPE_PAINT_APPLICATION_MODE (gimp_paint_application_mode_get_type ())
|
||||
|
||||
GType gimp_paint_application_mode_get_type (void) G_GNUC_CONST;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_PAINT_CONSTANT, /*< desc="Constant" >*/
|
||||
GIMP_PAINT_INCREMENTAL /*< desc="Incremental" >*/
|
||||
} GimpPaintApplicationMode;
|
||||
|
||||
|
||||
/*
|
||||
* non-registered enums; register them if needed
|
||||
*/
|
||||
|
@ -118,11 +129,5 @@ typedef enum /*< skip >*/
|
|||
GIMP_BRUSH_PRESSURE /*< skip >*/
|
||||
} GimpBrushApplicationMode;
|
||||
|
||||
typedef enum /*< skip >*/
|
||||
{
|
||||
GIMP_PAINT_CONSTANT,
|
||||
GIMP_PAINT_INCREMENTAL
|
||||
} GimpPaintApplicationMode;
|
||||
|
||||
|
||||
#endif /* __PAINT_ENUMS_H__ */
|
||||
|
|
|
@ -514,8 +514,10 @@ convolve_invoker (Gimp *gimp,
|
|||
{
|
||||
options = gimp_paint_options_new (gimp, GIMP_TYPE_CONVOLVE_OPTIONS);
|
||||
|
||||
GIMP_CONVOLVE_OPTIONS (options)->type = convolve_type;
|
||||
GIMP_CONVOLVE_OPTIONS (options)->rate = pressure;
|
||||
g_object_set (options,
|
||||
"type", convolve_type,
|
||||
"rate", pressure,
|
||||
NULL);
|
||||
|
||||
success = paint_tools_stroke (gimp,
|
||||
GIMP_TYPE_CONVOLVE,
|
||||
|
@ -684,9 +686,11 @@ dodgeburn_invoker (Gimp *gimp,
|
|||
{
|
||||
options = gimp_paint_options_new (gimp, GIMP_TYPE_DODGE_BURN_OPTIONS);
|
||||
|
||||
GIMP_DODGE_BURN_OPTIONS (options)->exposure = exposure;
|
||||
GIMP_DODGE_BURN_OPTIONS (options)->type = dodgeburn_type;
|
||||
GIMP_DODGE_BURN_OPTIONS (options)->mode = dodgeburn_mode;
|
||||
g_object_set (options,
|
||||
"type", dodgeburn_type,
|
||||
"mode", dodgeburn_mode,
|
||||
"exposure", exposure,
|
||||
NULL);
|
||||
|
||||
success = paint_tools_stroke (gimp,
|
||||
GIMP_TYPE_DODGE_BURN,
|
||||
|
@ -855,9 +859,10 @@ eraser_invoker (Gimp *gimp,
|
|||
{
|
||||
options = gimp_paint_options_new (gimp, GIMP_TYPE_ERASER_OPTIONS);
|
||||
|
||||
options->incremental = method;
|
||||
|
||||
GIMP_ERASER_OPTIONS (options)->hard = hardness;
|
||||
g_object_set (options,
|
||||
"application-mode", method,
|
||||
"hard", hardness,
|
||||
NULL);
|
||||
|
||||
success = paint_tools_stroke (gimp,
|
||||
GIMP_TYPE_ERASER,
|
||||
|
@ -1026,10 +1031,11 @@ paintbrush_invoker (Gimp *gimp,
|
|||
{
|
||||
options = gimp_paint_options_new (gimp, GIMP_TYPE_PAINT_OPTIONS);
|
||||
|
||||
options->incremental = method;
|
||||
|
||||
options->gradient_options->fade_length = fade_out;
|
||||
options->gradient_options->gradient_length = gradient_length;
|
||||
g_object_set (options,
|
||||
"application-mode", method,
|
||||
"fade-length", fade_out,
|
||||
"gradient-length", gradient_length,
|
||||
NULL);
|
||||
|
||||
success = paint_tools_stroke (gimp,
|
||||
GIMP_TYPE_PAINTBRUSH,
|
||||
|
@ -1264,7 +1270,9 @@ smudge_invoker (Gimp *gimp,
|
|||
{
|
||||
options = gimp_paint_options_new (gimp, GIMP_TYPE_SMUDGE_OPTIONS);
|
||||
|
||||
GIMP_SMUDGE_OPTIONS (options)->rate = pressure;
|
||||
g_object_set (options,
|
||||
"rate", pressure,
|
||||
NULL);
|
||||
|
||||
success = paint_tools_stroke (gimp,
|
||||
GIMP_TYPE_SMUDGE,
|
||||
|
|
|
@ -155,9 +155,12 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
|
|||
tool_options->tool_info->tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
|
||||
tool_options->tool_info->tool_type == GIMP_TYPE_PENCIL_TOOL)
|
||||
{
|
||||
incremental_toggle = gimp_prop_check_button_new (config,
|
||||
"incremental",
|
||||
_("Incremental"));
|
||||
incremental_toggle =
|
||||
gimp_prop_enum_check_button_new (config,
|
||||
"application-mode",
|
||||
_("Incremental"),
|
||||
GIMP_PAINT_CONSTANT,
|
||||
GIMP_PAINT_INCREMENTAL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), incremental_toggle, FALSE, FALSE, 0);
|
||||
gtk_widget_show (incremental_toggle);
|
||||
}
|
||||
|
|
|
@ -155,9 +155,12 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
|
|||
tool_options->tool_info->tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
|
||||
tool_options->tool_info->tool_type == GIMP_TYPE_PENCIL_TOOL)
|
||||
{
|
||||
incremental_toggle = gimp_prop_check_button_new (config,
|
||||
"incremental",
|
||||
_("Incremental"));
|
||||
incremental_toggle =
|
||||
gimp_prop_enum_check_button_new (config,
|
||||
"application-mode",
|
||||
_("Incremental"),
|
||||
GIMP_PAINT_CONSTANT,
|
||||
GIMP_PAINT_INCREMENTAL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), incremental_toggle, FALSE, FALSE, 0);
|
||||
gtk_widget_show (incremental_toggle);
|
||||
}
|
||||
|
|
|
@ -156,6 +156,127 @@ gimp_prop_check_button_notify (GObject *config,
|
|||
}
|
||||
|
||||
|
||||
static void gimp_prop_enum_check_button_callback (GtkWidget *widget,
|
||||
GObject *config);
|
||||
static void gimp_prop_enum_check_button_notify (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GtkWidget *button);
|
||||
|
||||
GtkWidget *
|
||||
gimp_prop_enum_check_button_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
const gchar *label,
|
||||
gint false_value,
|
||||
gint true_value)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
GtkWidget *button;
|
||||
gint value;
|
||||
|
||||
param_spec = check_param_spec (config, property_name,
|
||||
G_TYPE_PARAM_ENUM, G_STRLOC);
|
||||
if (! param_spec)
|
||||
return NULL;
|
||||
|
||||
g_object_get (config,
|
||||
property_name, &value,
|
||||
NULL);
|
||||
|
||||
button = gtk_check_button_new_with_mnemonic (label);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), value == true_value);
|
||||
|
||||
if (value != false_value && value != true_value)
|
||||
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
||||
set_param_spec (G_OBJECT (button), button, param_spec);
|
||||
|
||||
g_object_set_data (G_OBJECT (button), "false-value",
|
||||
GINT_TO_POINTER (false_value));
|
||||
g_object_set_data (G_OBJECT (button), "true-value",
|
||||
GINT_TO_POINTER (true_value));
|
||||
|
||||
g_signal_connect (button, "toggled",
|
||||
G_CALLBACK (gimp_prop_enum_check_button_callback),
|
||||
config);
|
||||
|
||||
connect_notify (config, property_name,
|
||||
G_CALLBACK (gimp_prop_enum_check_button_notify),
|
||||
button);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_prop_enum_check_button_callback (GtkWidget *widget,
|
||||
GObject *config)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
gint false_value;
|
||||
gint true_value;
|
||||
|
||||
param_spec = get_param_spec (G_OBJECT (widget));
|
||||
if (! param_spec)
|
||||
return;
|
||||
|
||||
false_value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
|
||||
"false-value"));
|
||||
true_value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
|
||||
"true-value"));
|
||||
|
||||
g_object_set (config,
|
||||
param_spec->name,
|
||||
GTK_TOGGLE_BUTTON (widget)->active ? true_value : false_value,
|
||||
NULL);
|
||||
|
||||
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (widget), FALSE);
|
||||
|
||||
gimp_toggle_button_sensitive_update (GTK_TOGGLE_BUTTON (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_prop_enum_check_button_notify (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GtkWidget *button)
|
||||
{
|
||||
gint value;
|
||||
gint false_value;
|
||||
gint true_value;
|
||||
gboolean active = FALSE;
|
||||
gboolean inconsistent = FALSE;
|
||||
|
||||
g_object_get (config,
|
||||
param_spec->name, &value,
|
||||
NULL);
|
||||
|
||||
false_value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button),
|
||||
"false-value"));
|
||||
true_value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button),
|
||||
"true-value"));
|
||||
|
||||
if (value == true_value)
|
||||
active = TRUE;
|
||||
else if (value != false_value)
|
||||
inconsistent = TRUE;
|
||||
|
||||
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (button),
|
||||
inconsistent);
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (button)->active != active)
|
||||
{
|
||||
g_signal_handlers_block_by_func (button,
|
||||
gimp_prop_enum_check_button_callback,
|
||||
config);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), active);
|
||||
gimp_toggle_button_sensitive_update (GTK_TOGGLE_BUTTON (button));
|
||||
|
||||
g_signal_handlers_unblock_by_func (button,
|
||||
gimp_prop_enum_check_button_callback,
|
||||
config);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************/
|
||||
/* option menus */
|
||||
/******************/
|
||||
|
|
|
@ -49,6 +49,12 @@ GtkWidget * gimp_prop_paint_mode_menu_new (GObject *config,
|
|||
const gchar *property_name,
|
||||
gboolean with_behind_mode);
|
||||
|
||||
GtkWidget * gimp_prop_enum_check_button_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
const gchar *label,
|
||||
gint false_value,
|
||||
gint true_value);
|
||||
|
||||
GtkWidget * gimp_prop_enum_radio_frame_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
const gchar *title,
|
||||
|
|
|
@ -156,6 +156,127 @@ gimp_prop_check_button_notify (GObject *config,
|
|||
}
|
||||
|
||||
|
||||
static void gimp_prop_enum_check_button_callback (GtkWidget *widget,
|
||||
GObject *config);
|
||||
static void gimp_prop_enum_check_button_notify (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GtkWidget *button);
|
||||
|
||||
GtkWidget *
|
||||
gimp_prop_enum_check_button_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
const gchar *label,
|
||||
gint false_value,
|
||||
gint true_value)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
GtkWidget *button;
|
||||
gint value;
|
||||
|
||||
param_spec = check_param_spec (config, property_name,
|
||||
G_TYPE_PARAM_ENUM, G_STRLOC);
|
||||
if (! param_spec)
|
||||
return NULL;
|
||||
|
||||
g_object_get (config,
|
||||
property_name, &value,
|
||||
NULL);
|
||||
|
||||
button = gtk_check_button_new_with_mnemonic (label);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), value == true_value);
|
||||
|
||||
if (value != false_value && value != true_value)
|
||||
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
||||
set_param_spec (G_OBJECT (button), button, param_spec);
|
||||
|
||||
g_object_set_data (G_OBJECT (button), "false-value",
|
||||
GINT_TO_POINTER (false_value));
|
||||
g_object_set_data (G_OBJECT (button), "true-value",
|
||||
GINT_TO_POINTER (true_value));
|
||||
|
||||
g_signal_connect (button, "toggled",
|
||||
G_CALLBACK (gimp_prop_enum_check_button_callback),
|
||||
config);
|
||||
|
||||
connect_notify (config, property_name,
|
||||
G_CALLBACK (gimp_prop_enum_check_button_notify),
|
||||
button);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_prop_enum_check_button_callback (GtkWidget *widget,
|
||||
GObject *config)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
gint false_value;
|
||||
gint true_value;
|
||||
|
||||
param_spec = get_param_spec (G_OBJECT (widget));
|
||||
if (! param_spec)
|
||||
return;
|
||||
|
||||
false_value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
|
||||
"false-value"));
|
||||
true_value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
|
||||
"true-value"));
|
||||
|
||||
g_object_set (config,
|
||||
param_spec->name,
|
||||
GTK_TOGGLE_BUTTON (widget)->active ? true_value : false_value,
|
||||
NULL);
|
||||
|
||||
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (widget), FALSE);
|
||||
|
||||
gimp_toggle_button_sensitive_update (GTK_TOGGLE_BUTTON (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_prop_enum_check_button_notify (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GtkWidget *button)
|
||||
{
|
||||
gint value;
|
||||
gint false_value;
|
||||
gint true_value;
|
||||
gboolean active = FALSE;
|
||||
gboolean inconsistent = FALSE;
|
||||
|
||||
g_object_get (config,
|
||||
param_spec->name, &value,
|
||||
NULL);
|
||||
|
||||
false_value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button),
|
||||
"false-value"));
|
||||
true_value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button),
|
||||
"true-value"));
|
||||
|
||||
if (value == true_value)
|
||||
active = TRUE;
|
||||
else if (value != false_value)
|
||||
inconsistent = TRUE;
|
||||
|
||||
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (button),
|
||||
inconsistent);
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (button)->active != active)
|
||||
{
|
||||
g_signal_handlers_block_by_func (button,
|
||||
gimp_prop_enum_check_button_callback,
|
||||
config);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), active);
|
||||
gimp_toggle_button_sensitive_update (GTK_TOGGLE_BUTTON (button));
|
||||
|
||||
g_signal_handlers_unblock_by_func (button,
|
||||
gimp_prop_enum_check_button_callback,
|
||||
config);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************/
|
||||
/* option menus */
|
||||
/******************/
|
||||
|
|
|
@ -49,6 +49,12 @@ GtkWidget * gimp_prop_paint_mode_menu_new (GObject *config,
|
|||
const gchar *property_name,
|
||||
gboolean with_behind_mode);
|
||||
|
||||
GtkWidget * gimp_prop_enum_check_button_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
const gchar *label,
|
||||
gint false_value,
|
||||
gint true_value);
|
||||
|
||||
GtkWidget * gimp_prop_enum_radio_frame_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
const gchar *title,
|
||||
|
|
|
@ -397,13 +397,6 @@ package Gimp::CodeGen::enums;
|
|||
mapping => { GIMP_BLUR_CONVOLVE => '0',
|
||||
GIMP_SHARPEN_CONVOLVE => '1' }
|
||||
},
|
||||
GimpBrushApplicationMode =>
|
||||
{ contig => 1,
|
||||
header => 'paint/paint-enums.h',
|
||||
symbols => [ qw(GIMP_BRUSH_HARD GIMP_BRUSH_SOFT) ],
|
||||
mapping => { GIMP_BRUSH_HARD => '0',
|
||||
GIMP_BRUSH_SOFT => '1' }
|
||||
},
|
||||
GimpPaintApplicationMode =>
|
||||
{ contig => 1,
|
||||
header => 'paint/paint-enums.h',
|
||||
|
@ -411,6 +404,13 @@ package Gimp::CodeGen::enums;
|
|||
mapping => { GIMP_PAINT_CONSTANT => '0',
|
||||
GIMP_PAINT_INCREMENTAL => '1' }
|
||||
},
|
||||
GimpBrushApplicationMode =>
|
||||
{ contig => 1,
|
||||
header => 'paint/paint-enums.h',
|
||||
symbols => [ qw(GIMP_BRUSH_HARD GIMP_BRUSH_SOFT) ],
|
||||
mapping => { GIMP_BRUSH_HARD => '0',
|
||||
GIMP_BRUSH_SOFT => '1' }
|
||||
},
|
||||
GimpRunMode =>
|
||||
{ contig => 1,
|
||||
header => 'plug-in/plug-in-types.h',
|
||||
|
|
|
@ -290,8 +290,10 @@ HELP
|
|||
{
|
||||
options = gimp_paint_options_new (gimp, GIMP_TYPE_CONVOLVE_OPTIONS);
|
||||
|
||||
GIMP_CONVOLVE_OPTIONS (options)->type = convolve_type;
|
||||
GIMP_CONVOLVE_OPTIONS (options)->rate = pressure;
|
||||
g_object_set (options,
|
||||
"type", convolve_type,
|
||||
"rate", pressure,
|
||||
NULL);
|
||||
|
||||
success = paint_tools_stroke (gimp,
|
||||
GIMP_TYPE_CONVOLVE,
|
||||
|
@ -367,9 +369,10 @@ HELP
|
|||
{
|
||||
options = gimp_paint_options_new (gimp, GIMP_TYPE_ERASER_OPTIONS);
|
||||
|
||||
options->incremental = method;
|
||||
|
||||
GIMP_ERASER_OPTIONS (options)->hard = hardness;
|
||||
g_object_set (options,
|
||||
"application-mode", method,
|
||||
"hard", hardness,
|
||||
NULL);
|
||||
|
||||
success = paint_tools_stroke (gimp,
|
||||
GIMP_TYPE_ERASER,
|
||||
|
@ -410,10 +413,11 @@ HELP
|
|||
{
|
||||
options = gimp_paint_options_new (gimp, GIMP_TYPE_ERASER_OPTIONS);
|
||||
|
||||
options->incremental = method;
|
||||
|
||||
GIMP_ERASER_OPTIONS (options)->hard = hardness;
|
||||
GIMP_ERASER_OPTIONS (options)->anti_erase = TRUE;
|
||||
g_object_set (options,
|
||||
"application-mode", method,
|
||||
"hard", hardness,
|
||||
"anti-erase", TRUE,
|
||||
NULL);
|
||||
|
||||
success = paint_tools_stroke (gimp,
|
||||
GIMP_TYPE_ERASER,
|
||||
|
@ -462,10 +466,11 @@ HELP
|
|||
{
|
||||
options = gimp_paint_options_new (gimp, GIMP_TYPE_PAINT_OPTIONS);
|
||||
|
||||
options->incremental = method;
|
||||
|
||||
options->gradient_options->fade_length = fade_out;
|
||||
options->gradient_options->gradient_length = gradient_length;
|
||||
g_object_set (options,
|
||||
"application-mode", method,
|
||||
"fade-length", fade_out,
|
||||
"gradient-length", gradient_length,
|
||||
NULL);
|
||||
|
||||
success = paint_tools_stroke (gimp,
|
||||
GIMP_TYPE_PAINTBRUSH,
|
||||
|
@ -583,7 +588,9 @@ HELP
|
|||
{
|
||||
options = gimp_paint_options_new (gimp, GIMP_TYPE_SMUDGE_OPTIONS);
|
||||
|
||||
GIMP_SMUDGE_OPTIONS (options)->rate = pressure;
|
||||
g_object_set (options,
|
||||
"rate", pressure,
|
||||
NULL);
|
||||
|
||||
success = paint_tools_stroke (gimp,
|
||||
GIMP_TYPE_SMUDGE,
|
||||
|
@ -663,9 +670,11 @@ HELP
|
|||
{
|
||||
options = gimp_paint_options_new (gimp, GIMP_TYPE_DODGE_BURN_OPTIONS);
|
||||
|
||||
GIMP_DODGE_BURN_OPTIONS (options)->exposure = exposure;
|
||||
GIMP_DODGE_BURN_OPTIONS (options)->type = dodgeburn_type;
|
||||
GIMP_DODGE_BURN_OPTIONS (options)->mode = dodgeburn_mode;
|
||||
g_object_set (options,
|
||||
"type", dodgeburn_type,
|
||||
"mode", dodgeburn_mode,
|
||||
"exposure", exposure,
|
||||
NULL);
|
||||
|
||||
success = paint_tools_stroke (gimp,
|
||||
GIMP_TYPE_DODGE_BURN,
|
||||
|
|
Loading…
Reference in New Issue