mirror of https://github.com/GNOME/gimp.git
app: implement GimpTool::options_notify()
This commit is contained in:
parent
5fa1e9ea40
commit
dc9018bd14
|
@ -66,52 +66,52 @@
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
|
|
||||||
static void gimp_image_map_tool_class_init (GimpImageMapToolClass *klass);
|
static void gimp_image_map_tool_class_init (GimpImageMapToolClass *klass);
|
||||||
static void gimp_image_map_tool_base_init (GimpImageMapToolClass *klass);
|
static void gimp_image_map_tool_base_init (GimpImageMapToolClass *klass);
|
||||||
|
|
||||||
static void gimp_image_map_tool_init (GimpImageMapTool *im_tool);
|
static void gimp_image_map_tool_init (GimpImageMapTool *im_tool);
|
||||||
|
|
||||||
static GObject * gimp_image_map_tool_constructor (GType type,
|
static GObject * gimp_image_map_tool_constructor (GType type,
|
||||||
guint n_params,
|
guint n_params,
|
||||||
GObjectConstructParam *params);
|
GObjectConstructParam *params);
|
||||||
static void gimp_image_map_tool_finalize (GObject *object);
|
static void gimp_image_map_tool_finalize (GObject *object);
|
||||||
|
|
||||||
static gboolean gimp_image_map_tool_initialize (GimpTool *tool,
|
static gboolean gimp_image_map_tool_initialize (GimpTool *tool,
|
||||||
GimpDisplay *display,
|
GimpDisplay *display,
|
||||||
GError **error);
|
GError **error);
|
||||||
static void gimp_image_map_tool_control (GimpTool *tool,
|
static void gimp_image_map_tool_control (GimpTool *tool,
|
||||||
GimpToolAction action,
|
GimpToolAction action,
|
||||||
GimpDisplay *display);
|
GimpDisplay *display);
|
||||||
static gboolean gimp_image_map_tool_key_press (GimpTool *tool,
|
static gboolean gimp_image_map_tool_key_press (GimpTool *tool,
|
||||||
GdkEventKey *kevent,
|
GdkEventKey *kevent,
|
||||||
GimpDisplay *display);
|
GimpDisplay *display);
|
||||||
|
static void gimp_image_map_tool_options_notify (GimpTool *tool,
|
||||||
|
GimpToolOptions *options,
|
||||||
|
const GParamSpec *pspec);
|
||||||
|
|
||||||
static gboolean gimp_image_map_tool_pick_color (GimpColorTool *color_tool,
|
static gboolean gimp_image_map_tool_pick_color (GimpColorTool *color_tool,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
GimpImageType *sample_type,
|
GimpImageType *sample_type,
|
||||||
GimpRGB *color,
|
GimpRGB *color,
|
||||||
gint *color_index);
|
gint *color_index);
|
||||||
static void gimp_image_map_tool_map (GimpImageMapTool *im_tool);
|
static void gimp_image_map_tool_map (GimpImageMapTool *im_tool);
|
||||||
static void gimp_image_map_tool_dialog (GimpImageMapTool *im_tool);
|
static void gimp_image_map_tool_dialog (GimpImageMapTool *im_tool);
|
||||||
static void gimp_image_map_tool_reset (GimpImageMapTool *im_tool);
|
static void gimp_image_map_tool_reset (GimpImageMapTool *im_tool);
|
||||||
|
|
||||||
static void gimp_image_map_tool_flush (GimpImageMap *image_map,
|
static void gimp_image_map_tool_flush (GimpImageMap *image_map,
|
||||||
GimpImageMapTool *im_tool);
|
GimpImageMapTool *im_tool);
|
||||||
|
|
||||||
static void gimp_image_map_tool_response (GtkWidget *widget,
|
static void gimp_image_map_tool_response (GtkWidget *widget,
|
||||||
gint response_id,
|
gint response_id,
|
||||||
GimpImageMapTool *im_tool);
|
GimpImageMapTool *im_tool);
|
||||||
|
|
||||||
static void gimp_image_map_tool_dialog_hide (GimpImageMapTool *im_tool);
|
static void gimp_image_map_tool_dialog_hide (GimpImageMapTool *im_tool);
|
||||||
static void gimp_image_map_tool_dialog_destroy (GimpImageMapTool *im_tool);
|
static void gimp_image_map_tool_dialog_destroy (GimpImageMapTool *im_tool);
|
||||||
|
|
||||||
static void gimp_image_map_tool_notify_preview (GObject *config,
|
static void gimp_image_map_tool_gegl_notify (GObject *config,
|
||||||
GParamSpec *pspec,
|
const GParamSpec *pspec,
|
||||||
GimpImageMapTool *im_tool);
|
GimpImageMapTool *im_tool);
|
||||||
static void gimp_image_map_tool_gegl_notify (GObject *config,
|
|
||||||
const GParamSpec *pspec,
|
|
||||||
GimpImageMapTool *im_tool);
|
|
||||||
|
|
||||||
|
|
||||||
static GimpColorToolClass *parent_class = NULL;
|
static GimpColorToolClass *parent_class = NULL;
|
||||||
|
@ -161,6 +161,7 @@ gimp_image_map_tool_class_init (GimpImageMapToolClass *klass)
|
||||||
tool_class->initialize = gimp_image_map_tool_initialize;
|
tool_class->initialize = gimp_image_map_tool_initialize;
|
||||||
tool_class->control = gimp_image_map_tool_control;
|
tool_class->control = gimp_image_map_tool_control;
|
||||||
tool_class->key_press = gimp_image_map_tool_key_press;
|
tool_class->key_press = gimp_image_map_tool_key_press;
|
||||||
|
tool_class->options_notify = gimp_image_map_tool_options_notify;
|
||||||
|
|
||||||
color_tool_class->pick = gimp_image_map_tool_pick_color;
|
color_tool_class->pick = gimp_image_map_tool_pick_color;
|
||||||
|
|
||||||
|
@ -370,10 +371,6 @@ gimp_image_map_tool_initialize (GimpTool *tool,
|
||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
gtk_widget_show (toggle);
|
gtk_widget_show (toggle);
|
||||||
|
|
||||||
g_signal_connect_object (tool_info->tool_options, "notify::preview",
|
|
||||||
G_CALLBACK (gimp_image_map_tool_notify_preview),
|
|
||||||
image_map_tool, 0);
|
|
||||||
|
|
||||||
/* Fill in subclass widgets */
|
/* Fill in subclass widgets */
|
||||||
gimp_image_map_tool_dialog (image_map_tool);
|
gimp_image_map_tool_dialog (image_map_tool);
|
||||||
|
|
||||||
|
@ -466,6 +463,40 @@ gimp_image_map_tool_key_press (GimpTool *tool,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_image_map_tool_options_notify (GimpTool *tool,
|
||||||
|
GimpToolOptions *options,
|
||||||
|
const GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (tool);
|
||||||
|
|
||||||
|
if (! strcmp (pspec->name, "preview") &&
|
||||||
|
image_map_tool->image_map)
|
||||||
|
{
|
||||||
|
GimpImageMapOptions *im_options = GIMP_IMAGE_MAP_OPTIONS (options);
|
||||||
|
|
||||||
|
if (im_options->preview)
|
||||||
|
{
|
||||||
|
gimp_tool_control_set_preserve (tool->control, TRUE);
|
||||||
|
|
||||||
|
gimp_image_map_tool_map (image_map_tool);
|
||||||
|
|
||||||
|
gimp_tool_control_set_preserve (tool->control, FALSE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gimp_tool_control_set_preserve (tool->control, TRUE);
|
||||||
|
|
||||||
|
gimp_image_map_clear (image_map_tool->image_map);
|
||||||
|
|
||||||
|
gimp_tool_control_set_preserve (tool->control, FALSE);
|
||||||
|
|
||||||
|
gimp_image_map_tool_flush (image_map_tool->image_map,
|
||||||
|
image_map_tool);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gimp_image_map_tool_pick_color (GimpColorTool *color_tool,
|
gimp_image_map_tool_pick_color (GimpColorTool *color_tool,
|
||||||
gint x,
|
gint x,
|
||||||
|
@ -688,38 +719,6 @@ gimp_image_map_tool_dialog_destroy (GimpImageMapTool *image_map_tool)
|
||||||
image_map_tool->label_group = NULL;
|
image_map_tool->label_group = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gimp_image_map_tool_notify_preview (GObject *config,
|
|
||||||
GParamSpec *pspec,
|
|
||||||
GimpImageMapTool *image_map_tool)
|
|
||||||
{
|
|
||||||
GimpTool *tool = GIMP_TOOL (image_map_tool);
|
|
||||||
GimpImageMapOptions *options = GIMP_IMAGE_MAP_OPTIONS (config);
|
|
||||||
|
|
||||||
if (image_map_tool->image_map)
|
|
||||||
{
|
|
||||||
if (options->preview)
|
|
||||||
{
|
|
||||||
gimp_tool_control_set_preserve (tool->control, TRUE);
|
|
||||||
|
|
||||||
gimp_image_map_tool_map (image_map_tool);
|
|
||||||
|
|
||||||
gimp_tool_control_set_preserve (tool->control, FALSE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gimp_tool_control_set_preserve (tool->control, TRUE);
|
|
||||||
|
|
||||||
gimp_image_map_clear (image_map_tool->image_map);
|
|
||||||
|
|
||||||
gimp_tool_control_set_preserve (tool->control, FALSE);
|
|
||||||
|
|
||||||
gimp_image_map_tool_flush (image_map_tool->image_map,
|
|
||||||
image_map_tool);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_image_map_tool_preview (GimpImageMapTool *image_map_tool)
|
gimp_image_map_tool_preview (GimpImageMapTool *image_map_tool)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue