Commit 8c09210d authored by Michael Natterer's avatar Michael Natterer 😴

app: move stuff from GimpOperationTool to GimpImageMapTool

Add new string members to GimpImageMapTool and use them instead of the
resp. fields of GimpToolInfo. Change ::get_operation() to return the
operation name and a lot of strings for the UI, and create both the
GeglNode and the config object in GimpOperationTool. Lots of various
cleanups in GimpImageMapTool subclasses. This is an intermediate state
on the way of making the whole filter applying mechanism more generic
and less depending on subclasses.
parent b72d7337
......@@ -323,6 +323,7 @@ gimp_gegl_procedure_execute_async (GimpProcedure *procedure,
procedure->original_name,
gimp_procedure_get_label (procedure),
gimp_procedure_get_label (procedure),
gimp_procedure_get_label (procedure),
gimp_viewable_get_icon_name (GIMP_VIEWABLE (procedure)),
gimp_procedure_get_help_id (procedure));
......
......@@ -71,10 +71,13 @@ static void gimp_brightness_contrast_tool_motion (GimpTool
GdkModifierType state,
GimpDisplay *display);
static GeglNode *
static gchar *
gimp_brightness_contrast_tool_get_operation (GimpImageMapTool *image_map_tool,
GObject **config,
gchar **undo_desc);
gchar **title,
gchar **description,
gchar **undo_desc,
gchar **icon_name,
gchar **help_id);
static void gimp_brightness_contrast_tool_dialog (GimpImageMapTool *image_map_tool);
static void brightness_contrast_to_levels_callback (GtkWidget *widget,
......@@ -114,7 +117,6 @@ gimp_brightness_contrast_tool_class_init (GimpBrightnessContrastToolClass *klass
tool_class->button_release = gimp_brightness_contrast_tool_button_release;
tool_class->motion = gimp_brightness_contrast_tool_motion;
im_tool_class->dialog_desc = _("Adjust Brightness and Contrast");
im_tool_class->settings_name = "brightness-contrast";
im_tool_class->import_dialog_title = _("Import Brightness-Contrast settings");
im_tool_class->export_dialog_title = _("Export Brightness-Contrast settings");
......@@ -160,21 +162,17 @@ gimp_brightness_contrast_tool_initialize (GimpTool *tool,
return TRUE;
}
static GeglNode *
static gchar *
gimp_brightness_contrast_tool_get_operation (GimpImageMapTool *im_tool,
GObject **config,
gchar **undo_desc)
gchar **title,
gchar **description,
gchar **undo_desc,
gchar **icon_name,
gchar **help_id)
{
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (im_tool);
*description = g_strdup (_("Adjust Brightness and Contrast"));
bc_tool->config = g_object_new (GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG, NULL);
*config = G_OBJECT (bc_tool->config);
return gegl_node_new_child (NULL,
"operation", "gimp:brightness-contrast",
"config", bc_tool->config,
NULL);
return g_strdup ("gimp:brightness-contrast");
}
static void
......@@ -186,11 +184,18 @@ gimp_brightness_contrast_tool_button_press (GimpTool *tool,
GimpDisplay *display)
{
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool);
gdouble brightness;
gdouble contrast;
g_object_get (GIMP_IMAGE_MAP_TOOL (tool)->config,
"brightness", &brightness,
"contrast", &contrast,
NULL);
bc_tool->x = coords->x - bc_tool->config->contrast * 127.0;
bc_tool->y = coords->y + bc_tool->config->brightness * 127.0;
bc_tool->dx = bc_tool->config->contrast * 127.0;
bc_tool->dy = - bc_tool->config->brightness * 127.0;
bc_tool->x = coords->x - contrast * 127.0;
bc_tool->y = coords->y + brightness * 127.0;
bc_tool->dx = contrast * 127.0;
bc_tool->dy = - brightness * 127.0;
gimp_tool_control_activate (tool->control);
tool->display = display;
......@@ -212,7 +217,7 @@ gimp_brightness_contrast_tool_button_release (GimpTool *tool,
return;
if (release_type == GIMP_BUTTON_RELEASE_CANCEL)
gimp_config_reset (GIMP_CONFIG (bc_tool->config));
gimp_config_reset (GIMP_CONFIG (GIMP_IMAGE_MAP_TOOL (tool)->config));
}
static void
......@@ -227,7 +232,7 @@ gimp_brightness_contrast_tool_motion (GimpTool *tool,
bc_tool->dx = (coords->x - bc_tool->x);
bc_tool->dy = - (coords->y - bc_tool->y);
g_object_set (bc_tool->config,
g_object_set (GIMP_IMAGE_MAP_TOOL (tool)->config,
"brightness", CLAMP (bc_tool->dy, -127.0, 127.0) / 127.0,
"contrast", CLAMP (bc_tool->dx, -127.0, 127.0) / 127.0,
NULL);
......
......@@ -35,16 +35,14 @@ typedef struct _GimpBrightnessContrastToolClass GimpBrightnessContrastToolClass;
struct _GimpBrightnessContrastTool
{
GimpImageMapTool parent_instance;
GimpImageMapTool parent_instance;
GimpBrightnessContrastConfig *config;
gdouble x, y;
gdouble dx, dy;
gdouble x, y;
gdouble dx, dy;
/* dialog */
GtkWidget *brightness_scale;
GtkWidget *contrast_scale;
GtkWidget *brightness_scale;
GtkWidget *contrast_scale;
};
struct _GimpBrightnessContrastToolClass
......
......@@ -51,14 +51,17 @@ static gboolean gimp_color_balance_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error);
static GeglNode * gimp_color_balance_tool_get_operation (GimpImageMapTool *im_tool,
GObject **config,
gchar **undo_desc);
static gchar * gimp_color_balance_tool_get_operation (GimpImageMapTool *im_tool,
gchar **title,
gchar **description,
gchar **undo_desc,
gchar **icon_name,
gchar **help_id);
static void gimp_color_balance_tool_dialog (GimpImageMapTool *im_tool);
static void gimp_color_balance_tool_reset (GimpImageMapTool *im_tool);
static void color_balance_range_reset_callback (GtkWidget *widget,
GimpColorBalanceTool *cb_tool);
static void color_balance_range_reset_callback (GtkWidget *widget,
GimpImageMapTool *im_tool);
G_DEFINE_TYPE (GimpColorBalanceTool, gimp_color_balance_tool,
......@@ -91,7 +94,6 @@ gimp_color_balance_tool_class_init (GimpColorBalanceToolClass *klass)
tool_class->initialize = gimp_color_balance_tool_initialize;
im_tool_class->dialog_desc = _("Adjust Color Balance");
im_tool_class->settings_name = "color-balance";
im_tool_class->import_dialog_title = _("Import Color Balance Settings");
im_tool_class->export_dialog_title = _("Export Color Balance Settings");
......@@ -127,21 +129,17 @@ gimp_color_balance_tool_initialize (GimpTool *tool,
return GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
}
static GeglNode *
static gchar *
gimp_color_balance_tool_get_operation (GimpImageMapTool *im_tool,
GObject **config,
gchar **undo_desc)
gchar **title,
gchar **description,
gchar **undo_desc,
gchar **icon_name,
gchar **help_id)
{
GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (im_tool);
*description = g_strdup (_("Adjust Color Balance"));
cb_tool->config = g_object_new (GIMP_TYPE_COLOR_BALANCE_CONFIG, NULL);
*config = G_OBJECT (cb_tool->config);
return gegl_node_new_child (NULL,
"operation", "gimp:color-balance",
"config", cb_tool->config,
NULL);
return g_strdup ("gimp:color-balance");
}
......@@ -248,19 +246,22 @@ gimp_color_balance_tool_dialog (GimpImageMapTool *image_map_tool)
static void
gimp_color_balance_tool_reset (GimpImageMapTool *im_tool)
{
GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (im_tool);
GimpTransferMode range = cb_tool->config->range;
GimpTransferMode range;
g_object_get (im_tool->config,
"range", &range,
NULL);
GIMP_IMAGE_MAP_TOOL_CLASS (parent_class)->reset (im_tool);
g_object_set (cb_tool->config,
g_object_set (im_tool->config,
"range", range,
NULL);
}
static void
color_balance_range_reset_callback (GtkWidget *widget,
GimpColorBalanceTool *cb_tool)
color_balance_range_reset_callback (GtkWidget *widget,
GimpImageMapTool *im_tool)
{
gimp_color_balance_config_reset_range (cb_tool->config);
gimp_color_balance_config_reset_range (GIMP_COLOR_BALANCE_CONFIG (im_tool->config));
}
......@@ -36,9 +36,7 @@ typedef struct _GimpColorBalanceToolClass GimpColorBalanceToolClass;
struct _GimpColorBalanceTool
{
GimpImageMapTool parent_instance;
GimpColorBalanceConfig *config;
GimpImageMapTool parent_instance;
};
struct _GimpColorBalanceToolClass
......
......@@ -27,8 +27,6 @@
#include "tools-types.h"
#include "operations/gimpcolorizeconfig.h"
#include "core/gimpdrawable.h"
#include "core/gimperror.h"
#include "core/gimpimage.h"
......@@ -52,9 +50,12 @@ static gboolean gimp_colorize_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error);
static GeglNode * gimp_colorize_tool_get_operation (GimpImageMapTool *im_tool,
GObject **config,
gchar **undo_desc);
static gchar * gimp_colorize_tool_get_operation (GimpImageMapTool *im_tool,
gchar **title,
gchar **description,
gchar **undo_desc,
gchar **icon_name,
gchar **help_id);
static void gimp_colorize_tool_dialog (GimpImageMapTool *im_tool);
static void gimp_colorize_tool_color_picked (GimpImageMapTool *im_tool,
gpointer identifier,
......@@ -94,7 +95,6 @@ gimp_colorize_tool_class_init (GimpColorizeToolClass *klass)
tool_class->initialize = gimp_colorize_tool_initialize;
im_tool_class->dialog_desc = _("Colorize the Image");
im_tool_class->settings_name = "colorize";
im_tool_class->import_dialog_title = _("Import Colorize Settings");
im_tool_class->export_dialog_title = _("Export Colorize Settings");
......@@ -130,17 +130,17 @@ gimp_colorize_tool_initialize (GimpTool *tool,
return GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
}
static GeglNode *
static gchar *
gimp_colorize_tool_get_operation (GimpImageMapTool *im_tool,
GObject **config,
gchar **undo_desc)
gchar **title,
gchar **description,
gchar **undo_desc,
gchar **icon_name,
gchar **help_id)
{
*config = g_object_new (GIMP_TYPE_COLORIZE_CONFIG, NULL);
*description = g_strdup (_("Colorize the Image"));
return gegl_node_new_child (NULL,
"operation", "gimp:colorize",
"config", *config,
NULL);
return g_strdup ("gimp:colorize");
}
......@@ -149,9 +149,9 @@ gimp_colorize_tool_get_operation (GimpImageMapTool *im_tool,
/***************************/
static void
gimp_colorize_tool_dialog (GimpImageMapTool *image_map_tool)
gimp_colorize_tool_dialog (GimpImageMapTool *im_tool)
{
GimpColorizeTool *col_tool = GIMP_COLORIZE_TOOL (image_map_tool);
GimpColorizeTool *col_tool = GIMP_COLORIZE_TOOL (im_tool);
GtkWidget *main_vbox;
GtkWidget *frame;
GtkWidget *vbox;
......@@ -159,7 +159,7 @@ gimp_colorize_tool_dialog (GimpImageMapTool *image_map_tool)
GtkWidget *hbox;
GtkWidget *button;
main_vbox = gimp_image_map_tool_dialog_get_vbox (image_map_tool);
main_vbox = gimp_image_map_tool_dialog_get_vbox (im_tool);
frame = gimp_frame_new (_("Select Color"));
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
......@@ -170,21 +170,21 @@ gimp_colorize_tool_dialog (GimpImageMapTool *image_map_tool)
gtk_widget_show (vbox);
/* Create the hue scale widget */
scale = gimp_prop_spin_scale_new (image_map_tool->config, "hue",
scale = gimp_prop_spin_scale_new (im_tool->config, "hue",
_("_Hue"), 1.0 / 360.0, 15.0 / 360.0, 0);
gimp_prop_widget_set_factor (scale, 360.0, 0.0, 0.0, 1);
gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
gtk_widget_show (scale);
/* Create the saturation scale widget */
scale = gimp_prop_spin_scale_new (image_map_tool->config, "saturation",
scale = gimp_prop_spin_scale_new (im_tool->config, "saturation",
_("_Saturation"), 0.01, 0.1, 0);
gimp_prop_widget_set_factor (scale, 100.0, 0.0, 0.0, 1);
gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
gtk_widget_show (scale);
/* Create the lightness scale widget */
scale = gimp_prop_spin_scale_new (image_map_tool->config, "lightness",
scale = gimp_prop_spin_scale_new (im_tool->config, "lightness",
_("_Lightness"), 0.01, 0.1, 0);
gimp_prop_widget_set_factor (scale, 100.0, 0.0, 0.0, 1);
gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
......@@ -195,7 +195,7 @@ gimp_colorize_tool_dialog (GimpImageMapTool *image_map_tool)
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
button = gimp_prop_color_button_new (image_map_tool->config, "color",
button = gimp_prop_color_button_new (im_tool->config, "color",
_("Colorize Color"),
128, 24,
GIMP_COLOR_AREA_FLAT);
......@@ -205,7 +205,7 @@ gimp_colorize_tool_dialog (GimpImageMapTool *image_map_tool)
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
gtk_widget_show (button);
button = gimp_image_map_tool_add_color_picker (image_map_tool,
button = gimp_image_map_tool_add_color_picker (im_tool,
"colorize",
GIMP_STOCK_COLOR_PICKER_GRAY,
_("Pick color from image"));
......
......@@ -89,15 +89,19 @@ static void gimp_curves_tool_color_picked (GimpColorTool *color_t
const Babl *sample_format,
gpointer pixel,
const GimpRGB *color);
static GeglNode * gimp_curves_tool_get_operation (GimpImageMapTool *image_map_tool,
GObject **config,
gchar **undo_desc);
static void gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool);
static void gimp_curves_tool_reset (GimpImageMapTool *image_map_tool);
static gboolean gimp_curves_tool_settings_import(GimpImageMapTool *image_map_tool,
static gchar * gimp_curves_tool_get_operation (GimpImageMapTool *im_tool,
gchar **title,
gchar **description,
gchar **undo_desc,
gchar **icon_name,
gchar **help_id);
static void gimp_curves_tool_dialog (GimpImageMapTool *im_tool);
static void gimp_curves_tool_reset (GimpImageMapTool *im_tool);
static gboolean gimp_curves_tool_settings_import(GimpImageMapTool *im_tool,
GInputStream *input,
GError **error);
static gboolean gimp_curves_tool_settings_export(GimpImageMapTool *image_map_tool,
static gboolean gimp_curves_tool_settings_export(GimpImageMapTool *im_tool,
GOutputStream *output,
GError **error);
......@@ -168,7 +172,6 @@ gimp_curves_tool_class_init (GimpCurvesToolClass *klass)
color_tool_class->picked = gimp_curves_tool_color_picked;
im_tool_class->dialog_desc = _("Adjust Color Curves");
im_tool_class->settings_name = "curves";
im_tool_class->import_dialog_title = _("Import Curves");
im_tool_class->export_dialog_title = _("Export Curves");
......@@ -194,6 +197,10 @@ gimp_curves_tool_constructed (GObject *object)
{
G_OBJECT_CLASS (parent_class)->constructed (object);
g_signal_connect_object (GIMP_IMAGE_MAP_TOOL (object)->config, "notify",
G_CALLBACK (gimp_curves_tool_config_notify),
object, 0);
/* always pick colors */
gimp_color_tool_enable (GIMP_COLOR_TOOL (object),
GIMP_COLOR_TOOL_GET_OPTIONS (object));
......@@ -246,8 +253,9 @@ gimp_curves_tool_button_release (GimpTool *tool,
GimpButtonReleaseType release_type,
GimpDisplay *display)
{
GimpCurvesTool *c_tool = GIMP_CURVES_TOOL (tool);
GimpCurvesConfig *config = c_tool->config;
GimpCurvesTool *c_tool = GIMP_CURVES_TOOL (tool);
GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool);
GimpCurvesConfig *config = GIMP_CURVES_CONFIG (im_tool->config);
if (state & gimp_get_extend_selection_mask ())
{
......@@ -363,8 +371,10 @@ gimp_curves_tool_color_picked (GimpColorTool *color_tool,
gpointer pixel,
const GimpRGB *color)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (color_tool);
GimpDrawable *drawable;
GimpCurvesTool *tool = GIMP_CURVES_TOOL (color_tool);
GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (color_tool);
GimpCurvesConfig *config = GIMP_CURVES_CONFIG (im_tool->config);
GimpDrawable *drawable;
drawable = GIMP_IMAGE_MAP_TOOL (tool)->drawable;
......@@ -381,28 +391,20 @@ gimp_curves_tool_color_picked (GimpColorTool *color_tool,
color->b);
gimp_curve_view_set_xpos (GIMP_CURVE_VIEW (tool->graph),
tool->picked_color[tool->config->channel]);
tool->picked_color[config->channel]);
}
static GeglNode *
gimp_curves_tool_get_operation (GimpImageMapTool *image_map_tool,
GObject **config,
gchar **undo_desc)
static gchar *
gimp_curves_tool_get_operation (GimpImageMapTool *im_tool,
gchar **title,
gchar **description,
gchar **undo_desc,
gchar **icon_name,
gchar **help_id)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
tool->config = g_object_new (GIMP_TYPE_CURVES_CONFIG, NULL);
*description = g_strdup (_("Adjust Color Curves"));
g_signal_connect_object (tool->config, "notify",
G_CALLBACK (gimp_curves_tool_config_notify),
tool, 0);
*config = G_OBJECT (tool->config);
return gegl_node_new_child (NULL,
"operation", "gimp:curves",
"config", tool->config,
NULL);
return g_strdup ("gimp:curves");
}
......@@ -411,11 +413,11 @@ gimp_curves_tool_get_operation (GimpImageMapTool *image_map_tool,
/*******************/
static void
gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
gimp_curves_tool_dialog (GimpImageMapTool *im_tool)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
GimpToolOptions *tool_options = GIMP_TOOL_GET_OPTIONS (image_map_tool);
GimpCurvesConfig *config = tool->config;
GimpCurvesTool *tool = GIMP_CURVES_TOOL (im_tool);
GimpToolOptions *tool_options = GIMP_TOOL_GET_OPTIONS (im_tool);
GimpCurvesConfig *config = GIMP_CURVES_CONFIG (im_tool->config);
GtkListStore *store;
GtkSizeGroup *label_group;
GtkWidget *main_vbox;
......@@ -429,12 +431,12 @@ gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
GtkWidget *bar;
GtkWidget *combo;
g_signal_connect (image_map_tool->settings_box, "file-dialog-setup",
g_signal_connect (im_tool->settings_box, "file-dialog-setup",
G_CALLBACK (gimp_curves_tool_export_setup),
image_map_tool);
im_tool);
main_vbox = gimp_image_map_tool_dialog_get_vbox (image_map_tool);
label_group = gimp_image_map_tool_dialog_get_label_group (image_map_tool);
main_vbox = gimp_image_map_tool_dialog_get_vbox (im_tool);
label_group = gimp_image_map_tool_dialog_get_label_group (im_tool);
/* The combo box for selecting channels */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
......@@ -577,13 +579,13 @@ gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
}
static void
gimp_curves_tool_reset (GimpImageMapTool *image_map_tool)
gimp_curves_tool_reset (GimpImageMapTool *im_tool)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
GimpCurvesConfig *config = GIMP_CURVES_CONFIG (im_tool->config);
GimpCurvesConfig *default_config;
GimpHistogramChannel channel;
default_config = GIMP_CURVES_CONFIG (image_map_tool->default_config);
default_config = GIMP_CURVES_CONFIG (im_tool->default_config);
for (channel = GIMP_HISTOGRAM_VALUE;
channel <= GIMP_HISTOGRAM_ALPHA;
......@@ -591,35 +593,35 @@ gimp_curves_tool_reset (GimpImageMapTool *image_map_tool)
{
if (default_config)
{
GimpCurveType curve_type = tool->config->curve[channel]->curve_type;
GimpCurveType curve_type = config->curve[channel]->curve_type;
g_object_freeze_notify (G_OBJECT (tool->config->curve[channel]));
g_object_freeze_notify (G_OBJECT (config->curve[channel]));
gimp_config_copy (GIMP_CONFIG (default_config->curve[channel]),
GIMP_CONFIG (tool->config->curve[channel]),
GIMP_CONFIG (config->curve[channel]),
0);
g_object_set (tool->config->curve[channel],
g_object_set (config->curve[channel],
"curve-type", curve_type,
NULL);
g_object_thaw_notify (G_OBJECT (tool->config->curve[channel]));
g_object_thaw_notify (G_OBJECT (config->curve[channel]));
}
else
{
gimp_curve_reset (tool->config->curve[channel], FALSE);
gimp_curve_reset (config->curve[channel], FALSE);
}
}
}
static gboolean
gimp_curves_tool_settings_import (GimpImageMapTool *image_map_tool,
gimp_curves_tool_settings_import (GimpImageMapTool *im_tool,
GInputStream *input,
GError **error)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
gchar header[64];
gsize bytes_read;
GimpCurvesConfig *config = GIMP_CURVES_CONFIG (im_tool->config);
gchar header[64];
gsize bytes_read;
if (! g_input_stream_read_all (input, header, sizeof (header),
&bytes_read, NULL, error) ||
......@@ -632,24 +634,25 @@ gimp_curves_tool_settings_import (GimpImageMapTool *image_map_tool,
g_seekable_seek (G_SEEKABLE (input), 0, G_SEEK_SET, NULL, NULL);
if (g_str_has_prefix (header, "# GIMP Curves File\n"))
return gimp_curves_config_load_cruft (tool->config, input, error);
return gimp_curves_config_load_cruft (config, input, error);
return GIMP_IMAGE_MAP_TOOL_CLASS (parent_class)->settings_import (image_map_tool,
return GIMP_IMAGE_MAP_TOOL_CLASS (parent_class)->settings_import (im_tool,
input,
error);
}
static gboolean
gimp_curves_tool_settings_export (GimpImageMapTool *image_map_tool,
gimp_curves_tool_settings_export (GimpImageMapTool *im_tool,
GOutputStream *output,
GError **error)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
GimpCurvesTool *tool = GIMP_CURVES_TOOL (im_tool);
GimpCurvesConfig *config = GIMP_CURVES_CONFIG (im_tool->config);
if (tool->export_old_format)
return gimp_curves_config_save_cruft (tool->config, output, error);
return gimp_curves_config_save_cruft (config, output, error);
return GIMP_IMAGE_MAP_TOOL_CLASS (parent_class)->settings_export (image_map_tool,
return GIMP_IMAGE_MAP_TOOL_CLASS (parent_class)->settings_export (im_tool,
output,
error);
}
......@@ -679,8 +682,9 @@ gimp_curves_tool_export_setup (GimpSettingsBox *settings_box,
static void
gimp_curves_tool_update_channel (GimpCurvesTool *tool)
{
GimpCurvesConfig *config = GIMP_CURVES_TOOL (tool)->config;
GimpCurve *curve = config->curve[config->channel];
GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool);
GimpCurvesConfig *config = GIMP_CURVES_CONFIG (im_tool->config);
GimpCurve *curve = config->curve[config->channel];
GimpHistogramChannel channel;
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu),
......@@ -773,7 +777,8 @@ static void
curves_channel_callback (GtkWidget *widget,
GimpCurvesTool *tool)
{
GimpCurvesConfig *config = tool->config;
GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool);
GimpCurvesConfig *config = GIMP_CURVES_CONFIG (im_tool->config);
gint value;
if (gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value) &&
......@@ -789,7 +794,10 @@ static void
curves_channel_reset_callback (GtkWidget *widget,
GimpCurvesTool *tool)
{
gimp_curve_reset (tool->config->curve[tool->config->channel], FALSE);
GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool);
GimpCurvesConfig *config = GIMP_CURVES_CONFIG (im_tool->config);
gimp_curve_reset (config->curve[config->channel], FALSE);
}
static gboolean
......@@ -827,7 +835,8 @@ curves_curve_type_callback (GtkWidget *widget,
if (gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value))
{
GimpCurvesConfig *config = tool->config;
GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool);
GimpCurvesConfig *config = GIMP_CURVES_CONFIG (im_tool->config);
GimpCurveType curve_type = value;
if (config->curve[config->channel]->curve_type != curve_type)
......
......@@ -34,21 +34,19 @@ typedef struct _GimpCurvesToolClass GimpCurvesToolClass;
struct _GimpCurvesTool
{
GimpImageMapTool parent_instance;
GimpCurvesConfig *config;
GimpImageMapTool parent_instance;
/* dialog */
gdouble picked_color[5];
gdouble picked_color[5];
GtkWidget *channel_menu;
GtkWidget *xrange;
GtkWidget *yrange;
GtkWidget *graph;
GtkWidget *curve_type;
GtkWidget *channel_menu;
GtkWidget *xrange;
GtkWidget *yrange;
GtkWidget *graph;
GtkWidget *curve_type;
/* export dialog */
gboolean export_old_format;
gboolean export_old_format;
};
struct _GimpCurvesToolClass
......
......@@ -49,10 +49,16 @@ enum
/* local function prototypes */
static void gimp_gegl_tool_dialog (GimpImageMapTool *im_tool);
static gchar * gimp_gegl_tool_get_operation (GimpImageMapTool *im_tool,
gchar **title,
gchar **description,
gchar **undo_desc,
gchar **icon_name,
gchar **help_id);
static void gimp_gegl_tool_dialog (GimpImageMapTool *im_tool);
static void gimp_gegl_tool_operation_changed (GtkWidget *widget,
GimpGeglTool *tool);
static void gimp_gegl_tool_operation_changed (GtkWidget *widget,
GimpGeglTool *tool);
G_DEFINE_TYPE (GimpGeglTool, gimp_gegl_tool, GIMP_TYPE_OPERATION_TOOL)
......@@ -82,9 +88,8 @@ gimp_gegl_tool_class_init (GimpGeglToolClass *klass)
{
GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass);
im_tool_class->dialog_desc = _("GEGL Operation");
im_tool_class->dialog = gimp_gegl_tool_dialog;
im_tool_class->get_operation = gimp_gegl_tool_get_operation;
im_tool_class->dialog = gimp_gegl_tool_dialog;
}
static void
......@@ -324,6 +329,31 @@ gimp_get_geglopclasses (void)
/* Gegl dialog */
/*****************/
static gchar *
gimp_gegl_tool_get_operation (GimpImageMapTool *im_tool,
gchar **title,
gchar **description,
gchar **undo_desc,
gchar **icon_name,
gchar **help_id)
{
gchar *operation;
operation = GIMP_IMAGE_MAP_TOOL_GET_CLASS (im_tool)->get_operation (im_tool,
title,
description,
undo_desc,
icon_name,
help_id);
if (*description)
g_free (*description);
*description = g_strdup (_("GEGL Operation"));
return operation;
}
static void
gimp_gegl_tool_dialog (GimpImageMapTool *image_map_tool)
{
......@@ -463,6 +493,7 @@ gimp_gegl_tool_operation_changed (GtkWidget *widget,
gimp_operation_tool_set_operation (GIMP_OPERATION_TOOL (tool),
operation,
_("GEGL Operation"),
_("GEGL Operation"),