Let all GimpImageMap tools remember the state of the preview toggle (bug
2004-02-22 Sven Neumann <sven@gimp.org> Let all GimpImageMap tools remember the state of the preview toggle (bug #135059): * app/tools/Makefile.am * app/tools/gimpimagemapoptions.[ch] * app/tools/tools-types.h: added new GimpToolOptions class to hold the preview setting. * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorizetool.c * app/tools/gimpcoloroptions.[ch] * app/tools/gimphuesaturationtool.c * app/tools/gimpimagemaptool.[ch] * app/tools/gimpposterizetool.c * app/tools/tools-types.h: use the new class.
This commit is contained in:

committed by
Sven Neumann

parent
0d84268f41
commit
5077aa4c85
19
ChangeLog
19
ChangeLog
@ -1,3 +1,22 @@
|
||||
2004-02-22 Sven Neumann <sven@gimp.org>
|
||||
|
||||
Let all GimpImageMap tools remember the state of the preview toggle
|
||||
(bug #135059):
|
||||
|
||||
* app/tools/Makefile.am
|
||||
* app/tools/gimpimagemapoptions.[ch]
|
||||
* app/tools/tools-types.h: added new GimpToolOptions class to hold
|
||||
the preview setting.
|
||||
|
||||
* app/tools/gimpbrightnesscontrasttool.c
|
||||
* app/tools/gimpcolorbalancetool.c
|
||||
* app/tools/gimpcolorizetool.c
|
||||
* app/tools/gimpcoloroptions.[ch]
|
||||
* app/tools/gimphuesaturationtool.c
|
||||
* app/tools/gimpimagemaptool.[ch]
|
||||
* app/tools/gimpposterizetool.c
|
||||
* app/tools/tools-types.h: use the new class.
|
||||
|
||||
2004-02-21 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* app/widgets/gimpenummenu.c (gimp_enum_stock_box_set_child_padding):
|
||||
|
@ -68,6 +68,8 @@ libapptools_a_sources = \
|
||||
gimphistogramoptions.h \
|
||||
gimphuesaturationtool.c \
|
||||
gimphuesaturationtool.h \
|
||||
gimpimagemapoptions.c \
|
||||
gimpimagemapoptions.h \
|
||||
gimpimagemaptool.c \
|
||||
gimpimagemaptool.h \
|
||||
gimpinkoptions.c \
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "gimpbrightnesscontrasttool.h"
|
||||
#include "gimpimagemapoptions.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
@ -78,7 +79,7 @@ gimp_brightness_contrast_tool_register (GimpToolRegisterCallback callback,
|
||||
gpointer data)
|
||||
{
|
||||
(* callback) (GIMP_TYPE_BRIGHTNESS_CONTRAST_TOOL,
|
||||
G_TYPE_NONE, NULL,
|
||||
GIMP_TYPE_IMAGE_MAP_OPTIONS, NULL,
|
||||
0,
|
||||
"gimp-brightness-contrast-tool",
|
||||
_("Brightness-Contrast"),
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "gimpcolorbalancetool.h"
|
||||
#include "gimpimagemapoptions.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
@ -89,7 +90,7 @@ gimp_color_balance_tool_register (GimpToolRegisterCallback callback,
|
||||
gpointer data)
|
||||
{
|
||||
(* callback) (GIMP_TYPE_COLOR_BALANCE_TOOL,
|
||||
G_TYPE_NONE, NULL,
|
||||
GIMP_TYPE_IMAGE_MAP_OPTIONS, NULL,
|
||||
0,
|
||||
"gimp-color-balance-tool",
|
||||
_("Color Balance"),
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "gimpcolorizetool.h"
|
||||
#include "gimpimagemapoptions.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
@ -89,7 +90,7 @@ gimp_colorize_tool_register (GimpToolRegisterCallback callback,
|
||||
gpointer data)
|
||||
{
|
||||
(* callback) (GIMP_TYPE_COLORIZE_TOOL,
|
||||
G_TYPE_NONE, NULL,
|
||||
GIMP_TYPE_IMAGE_MAP_OPTIONS, NULL,
|
||||
0,
|
||||
"gimp-colorize-tool",
|
||||
_("Colorize"),
|
||||
|
@ -56,9 +56,6 @@ static void gimp_color_options_get_property (GObject *object,
|
||||
GParamSpec *pspec);
|
||||
|
||||
|
||||
static GimpToolOptionsClass *parent_class = NULL;
|
||||
|
||||
|
||||
GType
|
||||
gimp_color_options_get_type (void)
|
||||
{
|
||||
@ -79,7 +76,7 @@ gimp_color_options_get_type (void)
|
||||
NULL /* instance_init */
|
||||
};
|
||||
|
||||
type = g_type_register_static (GIMP_TYPE_TOOL_OPTIONS,
|
||||
type = g_type_register_static (GIMP_TYPE_IMAGE_MAP_OPTIONS,
|
||||
"GimpColorOptions",
|
||||
&info, 0);
|
||||
}
|
||||
@ -92,8 +89,6 @@ gimp_color_options_class_init (GimpColorOptionsClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->set_property = gimp_color_options_set_property;
|
||||
object_class->get_property = gimp_color_options_get_property;
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#define __GIMP_COLOR_OPTIONS_H__
|
||||
|
||||
|
||||
#include "core/gimptooloptions.h"
|
||||
#include "gimpimagemapoptions.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_COLOR_OPTIONS (gimp_color_options_get_type ())
|
||||
@ -31,15 +31,15 @@
|
||||
#define GIMP_COLOR_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_OPTIONS, GimpColorOptionsClass))
|
||||
|
||||
|
||||
typedef struct _GimpToolOptionsClass GimpColorOptionsClass;
|
||||
typedef GimpImageMapOptionsClass GimpColorOptionsClass;
|
||||
|
||||
struct _GimpColorOptions
|
||||
{
|
||||
GimpToolOptions parent_instance;
|
||||
GimpImageMapOptions parent_instance;
|
||||
|
||||
gboolean sample_merged;
|
||||
gboolean sample_average;
|
||||
gdouble average_radius;
|
||||
gboolean sample_merged;
|
||||
gboolean sample_average;
|
||||
gdouble average_radius;
|
||||
};
|
||||
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "gimphuesaturationtool.h"
|
||||
#include "gimpimagemapoptions.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
@ -103,7 +104,7 @@ gimp_hue_saturation_tool_register (GimpToolRegisterCallback callback,
|
||||
gpointer data)
|
||||
{
|
||||
(* callback) (GIMP_TYPE_HUE_SATURATION_TOOL,
|
||||
G_TYPE_NONE, NULL,
|
||||
GIMP_TYPE_IMAGE_MAP_OPTIONS, NULL,
|
||||
0,
|
||||
"gimp-hue-saturation-tool",
|
||||
_("Hue-Saturation"),
|
||||
|
127
app/tools/gimpimagemapoptions.c
Normal file
127
app/tools/gimpimagemapoptions.c
Normal file
@ -0,0 +1,127 @@
|
||||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995-2001 Spencer Kimball, Peter Mattis, and others
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "tools-types.h"
|
||||
|
||||
#include "config/gimpconfig-params.h"
|
||||
|
||||
#include "gimpimagemapoptions.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_PREVIEW
|
||||
};
|
||||
|
||||
|
||||
static void gimp_image_map_options_class_init (GimpImageMapOptionsClass *klass);
|
||||
|
||||
static void gimp_image_map_options_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_image_map_options_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
|
||||
GType
|
||||
gimp_image_map_options_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (! type)
|
||||
{
|
||||
static const GTypeInfo info =
|
||||
{
|
||||
sizeof (GimpImageMapOptionsClass),
|
||||
(GBaseInitFunc) NULL,
|
||||
(GBaseFinalizeFunc) NULL,
|
||||
(GClassInitFunc) gimp_image_map_options_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpImageMapOptions),
|
||||
0, /* n_preallocs */
|
||||
NULL /* instance_init */
|
||||
};
|
||||
|
||||
type = g_type_register_static (GIMP_TYPE_TOOL_OPTIONS,
|
||||
"GimpImageMapOptions",
|
||||
&info, 0);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_image_map_options_class_init (GimpImageMapOptionsClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->set_property = gimp_image_map_options_set_property;
|
||||
object_class->get_property = gimp_image_map_options_get_property;
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PREVIEW,
|
||||
"preview", NULL,
|
||||
TRUE,
|
||||
0);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_image_map_options_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpImageMapOptions *options = GIMP_IMAGE_MAP_OPTIONS (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_PREVIEW:
|
||||
options->preview = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_image_map_options_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpImageMapOptions *options = GIMP_IMAGE_MAP_OPTIONS (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_PREVIEW:
|
||||
g_value_set_boolean (value, options->preview);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
47
app/tools/gimpimagemapoptions.h
Normal file
47
app/tools/gimpimagemapoptions.h
Normal file
@ -0,0 +1,47 @@
|
||||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_IMAGE_MAP_OPTIONS_H__
|
||||
#define __GIMP_IMAGE_MAP_OPTIONS_H__
|
||||
|
||||
|
||||
#include "core/gimptooloptions.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_IMAGE_MAP_OPTIONS (gimp_image_map_options_get_type ())
|
||||
#define GIMP_IMAGE_MAP_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_IMAGE_MAP_OPTIONS, GimpImageMapOptions))
|
||||
#define GIMP_IMAGE_MAP_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_IMAGE_MAP_OPTIONS, GimpImageMapOptionsClass))
|
||||
#define GIMP_IS_IMAGE_MAP_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_IMAGE_MAP_OPTIONS))
|
||||
#define GIMP_IS_IMAGE_MAP_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_IMAGE_MAP_OPTIONS))
|
||||
#define GIMP_IMAGE_MAP_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_IMAGE_MAP_OPTIONS, GimpImageMapOptionsClass))
|
||||
|
||||
|
||||
typedef struct _GimpToolOptionsClass GimpImageMapOptionsClass;
|
||||
|
||||
struct _GimpImageMapOptions
|
||||
{
|
||||
GimpToolOptions parent_instance;
|
||||
|
||||
gboolean preview;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_image_map_options_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
#endif /* __GIMP_IMAGE_MAP_OPTIONS_H__ */
|
@ -33,6 +33,7 @@
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "widgets/gimpitemfactory.h"
|
||||
#include "widgets/gimppropwidgets.h"
|
||||
#include "widgets/gimptooldialog.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
@ -76,8 +77,9 @@ static void gimp_image_map_tool_response (GtkWidget *widget,
|
||||
gint response_id,
|
||||
GimpImageMapTool *image_map_tool);
|
||||
|
||||
static void gimp_image_map_tool_preview_toggled (GtkWidget *widget,
|
||||
GimpImageMapTool *image_map_tool);
|
||||
static void gimp_image_map_tool_notify_preview (GObject *config,
|
||||
GParamSpec *pspec,
|
||||
GimpImageMapTool *image_map_tool);
|
||||
|
||||
|
||||
static GimpToolClass *parent_class = NULL;
|
||||
@ -146,7 +148,6 @@ gimp_image_map_tool_init (GimpImageMapTool *image_map_tool)
|
||||
|
||||
image_map_tool->drawable = NULL;
|
||||
image_map_tool->image_map = NULL;
|
||||
image_map_tool->preview = TRUE;
|
||||
|
||||
image_map_tool->shell_desc = NULL;
|
||||
image_map_tool->shell = NULL;
|
||||
@ -156,13 +157,16 @@ gimp_image_map_tool_init (GimpImageMapTool *image_map_tool)
|
||||
void
|
||||
gimp_image_map_tool_preview (GimpImageMapTool *image_map_tool)
|
||||
{
|
||||
GimpTool *tool;
|
||||
GimpTool *tool;
|
||||
GimpImageMapOptions *options;
|
||||
|
||||
g_return_if_fail (GIMP_IS_IMAGE_MAP_TOOL (image_map_tool));
|
||||
|
||||
tool = GIMP_TOOL (image_map_tool);
|
||||
|
||||
if (image_map_tool->preview)
|
||||
options = GIMP_IMAGE_MAP_OPTIONS (tool->tool_info->tool_options);
|
||||
|
||||
if (options->preview)
|
||||
{
|
||||
gimp_tool_control_set_preserve (tool->control, TRUE);
|
||||
|
||||
@ -231,15 +235,16 @@ gimp_image_map_tool_initialize (GimpTool *tool,
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (shell)->vbox), vbox);
|
||||
|
||||
/* The preview toggle */
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("_Preview"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||
image_map_tool->preview);
|
||||
toggle = gimp_prop_check_button_new (G_OBJECT (tool_info->tool_options),
|
||||
"preview",
|
||||
_("_Preview"));
|
||||
|
||||
gtk_box_pack_end (GTK_BOX (image_map_tool->main_vbox), toggle,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (toggle);
|
||||
|
||||
g_signal_connect (toggle, "toggled",
|
||||
G_CALLBACK (gimp_image_map_tool_preview_toggled),
|
||||
g_signal_connect (tool_info->tool_options, "notify::preview",
|
||||
G_CALLBACK (gimp_image_map_tool_notify_preview),
|
||||
image_map_tool);
|
||||
|
||||
/* Fill in subclass widgets */
|
||||
@ -346,8 +351,9 @@ gimp_image_map_tool_response (GtkWidget *widget,
|
||||
gint response_id,
|
||||
GimpImageMapTool *image_map_tool)
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
GimpTool *tool;
|
||||
GimpDisplayShell *shell;
|
||||
GimpImageMapOptions *options;
|
||||
GimpTool *tool;
|
||||
|
||||
tool = GIMP_TOOL (image_map_tool);
|
||||
|
||||
@ -366,7 +372,9 @@ gimp_image_map_tool_response (GtkWidget *widget,
|
||||
|
||||
gimp_tool_control_set_preserve (tool->control, TRUE);
|
||||
|
||||
if (! image_map_tool->preview)
|
||||
options = GIMP_IMAGE_MAP_OPTIONS (tool->tool_info->tool_options);
|
||||
|
||||
if (! options->preview)
|
||||
{
|
||||
gimp_image_map_tool_map (image_map_tool);
|
||||
}
|
||||
@ -411,14 +419,14 @@ gimp_image_map_tool_response (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_image_map_tool_preview_toggled (GtkWidget *widget,
|
||||
GimpImageMapTool *image_map_tool)
|
||||
gimp_image_map_tool_notify_preview (GObject *config,
|
||||
GParamSpec *pspec,
|
||||
GimpImageMapTool *image_map_tool)
|
||||
{
|
||||
GimpTool *tool = GIMP_TOOL (image_map_tool);
|
||||
GimpTool *tool = GIMP_TOOL (image_map_tool);
|
||||
GimpImageMapOptions *options = GIMP_IMAGE_MAP_OPTIONS (config);
|
||||
|
||||
image_map_tool->preview = GTK_TOGGLE_BUTTON (widget)->active;
|
||||
|
||||
if (image_map_tool->preview)
|
||||
if (options->preview)
|
||||
{
|
||||
gimp_tool_control_set_preserve (tool->control, TRUE);
|
||||
|
||||
|
@ -40,8 +40,6 @@ struct _GimpImageMapTool
|
||||
GimpDrawable *drawable;
|
||||
GimpImageMap *image_map;
|
||||
|
||||
gboolean preview;
|
||||
|
||||
/* the dialog */
|
||||
const gchar *shell_desc;
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "gimpimagemapoptions.h"
|
||||
#include "gimpposterizetool.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
@ -71,7 +72,7 @@ gimp_posterize_tool_register (GimpToolRegisterCallback callback,
|
||||
gpointer data)
|
||||
{
|
||||
(* callback) (GIMP_TYPE_POSTERIZE_TOOL,
|
||||
G_TYPE_NONE, NULL,
|
||||
GIMP_TYPE_IMAGE_MAP_OPTIONS, NULL,
|
||||
0,
|
||||
"gimp-posterize-tool",
|
||||
_("Posterize"),
|
||||
|
@ -38,6 +38,7 @@ typedef struct _GimpPaintTool GimpPaintTool;
|
||||
typedef struct _GimpTransformTool GimpTransformTool;
|
||||
|
||||
typedef struct _GimpColorOptions GimpColorOptions;
|
||||
typedef struct _GimpImageMapOptions GimpImageMapOptions;
|
||||
|
||||
|
||||
/* functions */
|
||||
|
Reference in New Issue
Block a user