Commit 6c7f0c68 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

added gimp_tool_get_options() so tools don't need to incude

2006-09-05  Michael Natterer  <mitch@gimp.org>

	* app/tools/gimptool.[ch]: added gimp_tool_get_options() so tools
	don't need to incude "core/gimptoolinfo.h" just to get to
	their options.

	* app/tools/gimp*tool.h: added macros GIMP_FOO_TOOL_GET_OPTIONS()
	which return specific tool options types and do all casting
	themselves.

	* app/tools/*.c: use the new macros and don't include
	"core/gimptoolinfo.h" in most files.

	* app/tools/gimpcolorpickertool.c (gimp_color_picker_tool_register):
	make it use the parent context's FG and BG.

	* app/tools/gimpcolortool.c (gimp_color_tool_real_picked): set the
	color on the tool's options, not on the user context.
parent a76e59de
2006-09-05 Michael Natterer <mitch@gimp.org>
* app/tools/gimptool.[ch]: added gimp_tool_get_options() so tools
don't need to incude "core/gimptoolinfo.h" just to get to
their options.
* app/tools/gimp*tool.h: added macros GIMP_FOO_TOOL_GET_OPTIONS()
which return specific tool options types and do all casting
themselves.
* app/tools/*.c: use the new macros and don't include
"core/gimptoolinfo.h" in most files.
* app/tools/gimpcolorpickertool.c (gimp_color_picker_tool_register):
make it use the parent context's FG and BG.
* app/tools/gimpcolortool.c (gimp_color_tool_real_picked): set the
color on the tool's options, not on the user context.
2006-09-05 Michael Natterer <mitch@gimp.org> 2006-09-05 Michael Natterer <mitch@gimp.org>
   
* app/widgets/gimpmenudock.c: don't #include "core/gimptoolinfo.h" * app/widgets/gimpmenudock.c: don't #include "core/gimptoolinfo.h"
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#include "tools-types.h" #include "tools-types.h"
#include "core/gimptoolinfo.h"
#include "paint/gimpairbrushoptions.h" #include "paint/gimpairbrushoptions.h"
#include "widgets/gimphelp-ids.h" #include "widgets/gimphelp-ids.h"
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include "core/gimpimage-guides.h" #include "core/gimpimage-guides.h"
#include "core/gimpimage-undo.h" #include "core/gimpimage-undo.h"
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "core/gimptoolinfo.h"
#include "core/gimplist.h" #include "core/gimplist.h"
#include "widgets/gimphelp-ids.h" #include "widgets/gimphelp-ids.h"
...@@ -177,10 +176,7 @@ gimp_align_tool_constructor (GType type, ...@@ -177,10 +176,7 @@ gimp_align_tool_constructor (GType type,
tool = GIMP_TOOL (object); tool = GIMP_TOOL (object);
align_tool = GIMP_ALIGN_TOOL (object); align_tool = GIMP_ALIGN_TOOL (object);
options = G_OBJECT (gimp_tool_get_options (tool));
g_assert (GIMP_IS_TOOL_INFO (tool->tool_info));
options = G_OBJECT (tool->tool_info->tool_options);
container = GTK_CONTAINER (g_object_get_data (options, container = GTK_CONTAINER (g_object_get_data (options,
"controls-container")); "controls-container"));
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpdatafactory.h" #include "core/gimpdatafactory.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpwidgets-utils.h" #include "widgets/gimpwidgets-utils.h"
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include "core/gimpgradient.h" #include "core/gimpgradient.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimpprogress.h" #include "core/gimpprogress.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimphelp-ids.h" #include "widgets/gimphelp-ids.h"
...@@ -180,17 +179,11 @@ gimp_blend_tool_button_release (GimpTool *tool, ...@@ -180,17 +179,11 @@ gimp_blend_tool_button_release (GimpTool *tool,
GdkModifierType state, GdkModifierType state,
GimpDisplay *display) GimpDisplay *display)
{ {
GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (tool); GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (tool);
GimpPaintOptions *paint_options; GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (tool);
GimpBlendOptions *options; GimpPaintOptions *paint_options = GIMP_PAINT_OPTIONS (options);
GimpContext *context; GimpContext *context = GIMP_CONTEXT (options);
GimpImage *image; GimpImage *image = display->image;
paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options);
options = GIMP_BLEND_OPTIONS (paint_options);
context = GIMP_CONTEXT (options);
image = display->image;
gimp_tool_pop_status (tool, display); gimp_tool_pop_status (tool, display);
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#define GIMP_IS_BLEND_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BLEND_TOOL)) #define GIMP_IS_BLEND_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BLEND_TOOL))
#define GIMP_BLEND_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_BLEND_TOOL, GimpBlendToolClass)) #define GIMP_BLEND_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_BLEND_TOOL, GimpBlendToolClass))
#define GIMP_BLEND_TOOL_GET_OPTIONS(t) (GIMP_BLEND_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
typedef struct _GimpBlendTool GimpBlendTool; typedef struct _GimpBlendTool GimpBlendTool;
typedef struct _GimpBlendToolClass GimpBlendToolClass; typedef struct _GimpBlendToolClass GimpBlendToolClass;
......
...@@ -150,7 +150,7 @@ gimp_brush_tool_constructor (GType type, ...@@ -150,7 +150,7 @@ gimp_brush_tool_constructor (GType type,
G_CALLBACK (gimp_brush_tool_notify_brush), G_CALLBACK (gimp_brush_tool_notify_brush),
brush_tool, 0); brush_tool, 0);
g_signal_connect_object (tool->tool_info->tool_options, "brush-changed", g_signal_connect_object (gimp_tool_get_options (tool), "brush-changed",
G_CALLBACK (gimp_brush_tool_brush_changed), G_CALLBACK (gimp_brush_tool_brush_changed),
brush_tool, 0); brush_tool, 0);
...@@ -194,10 +194,8 @@ gimp_brush_tool_oper_update (GimpTool *tool, ...@@ -194,10 +194,8 @@ gimp_brush_tool_oper_update (GimpTool *tool,
gboolean proximity, gboolean proximity,
GimpDisplay *display) GimpDisplay *display)
{ {
GimpBrushTool *brush_tool = GIMP_BRUSH_TOOL (tool); GimpBrushTool *brush_tool = GIMP_BRUSH_TOOL (tool);
GimpPaintOptions *paint_options; GimpPaintOptions *paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (tool);
paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options);
if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool))) if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool)); gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
...@@ -294,7 +292,7 @@ gimp_brush_tool_draw (GimpDrawTool *draw_tool) ...@@ -294,7 +292,7 @@ gimp_brush_tool_draw (GimpDrawTool *draw_tool)
GimpPaintOptions *paint_options; GimpPaintOptions *paint_options;
gdouble brush_x, brush_y; gdouble brush_x, brush_y;
paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options); paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (draw_tool);
brush_x = (brush_tool->brush_x - brush_x = (brush_tool->brush_x -
((gdouble) brush_core->brush_bound_width / 2.0)); ((gdouble) brush_core->brush_bound_width / 2.0));
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "core/gimpdrawable-bucket-fill.h" #include "core/gimpdrawable-bucket-fill.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimppickable.h" #include "core/gimppickable.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimphelp-ids.h" #include "widgets/gimphelp-ids.h"
...@@ -127,9 +126,7 @@ gimp_bucket_fill_tool_button_press (GimpTool *tool, ...@@ -127,9 +126,7 @@ gimp_bucket_fill_tool_button_press (GimpTool *tool,
GimpDisplay *display) GimpDisplay *display)
{ {
GimpBucketFillTool *bucket_tool = GIMP_BUCKET_FILL_TOOL (tool); GimpBucketFillTool *bucket_tool = GIMP_BUCKET_FILL_TOOL (tool);
GimpBucketFillOptions *options; GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
options = GIMP_BUCKET_FILL_OPTIONS (tool->tool_info->tool_options);
bucket_tool->target_x = coords->x; bucket_tool->target_x = coords->x;
bucket_tool->target_y = coords->y; bucket_tool->target_y = coords->y;
...@@ -157,11 +154,8 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool, ...@@ -157,11 +154,8 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool,
GimpDisplay *display) GimpDisplay *display)
{ {
GimpBucketFillTool *bucket_tool = GIMP_BUCKET_FILL_TOOL (tool); GimpBucketFillTool *bucket_tool = GIMP_BUCKET_FILL_TOOL (tool);
GimpBucketFillOptions *options; GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
GimpContext *context; GimpContext *context = GIMP_CONTEXT (options);
options = GIMP_BUCKET_FILL_OPTIONS (tool->tool_info->tool_options);
context = GIMP_CONTEXT (options);
/* if the 3rd button isn't pressed, fill the selected region */ /* if the 3rd button isn't pressed, fill the selected region */
if (! (state & GDK_BUTTON3_MASK)) if (! (state & GDK_BUTTON3_MASK))
...@@ -192,9 +186,7 @@ gimp_bucket_fill_tool_modifier_key (GimpTool *tool, ...@@ -192,9 +186,7 @@ gimp_bucket_fill_tool_modifier_key (GimpTool *tool,
GdkModifierType state, GdkModifierType state,
GimpDisplay *display) GimpDisplay *display)
{ {
GimpBucketFillOptions *options; GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
options = GIMP_BUCKET_FILL_OPTIONS (tool->tool_info->tool_options);
if (key == GDK_CONTROL_MASK) if (key == GDK_CONTROL_MASK)
{ {
...@@ -224,11 +216,9 @@ gimp_bucket_fill_tool_cursor_update (GimpTool *tool, ...@@ -224,11 +216,9 @@ gimp_bucket_fill_tool_cursor_update (GimpTool *tool,
GdkModifierType state, GdkModifierType state,
GimpDisplay *display) GimpDisplay *display)
{ {
GimpBucketFillOptions *options; GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_BAD; GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_BAD;
options = GIMP_BUCKET_FILL_OPTIONS (tool->tool_info->tool_options);
if (gimp_image_coords_in_active_pickable (display->image, coords, if (gimp_image_coords_in_active_pickable (display->image, coords,
options->sample_merged, TRUE)) options->sample_merged, TRUE))
{ {
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#define GIMP_IS_BUCKET_FILL_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BUCKET_FILL_TOOL)) #define GIMP_IS_BUCKET_FILL_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BUCKET_FILL_TOOL))
#define GIMP_BUCKET_FILL_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_BUCKET_FILL_TOOL, GimpBucketFillToolClass)) #define GIMP_BUCKET_FILL_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_BUCKET_FILL_TOOL, GimpBucketFillToolClass))
#define GIMP_BUCKET_FILL_TOOL_GET_OPTIONS(t) (GIMP_BUCKET_FILL_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
typedef struct _GimpBucketFillTool GimpBucketFillTool; typedef struct _GimpBucketFillTool GimpBucketFillTool;
typedef struct _GimpBucketFillToolClass GimpBucketFillToolClass; typedef struct _GimpBucketFillToolClass GimpBucketFillToolClass;
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "core/gimpimage-contiguous-region.h" #include "core/gimpimage-contiguous-region.h"
#include "core/gimpitem.h" #include "core/gimpitem.h"
#include "core/gimppickable.h" #include "core/gimppickable.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimphelp-ids.h" #include "widgets/gimphelp-ids.h"
...@@ -94,15 +93,13 @@ static GimpChannel * ...@@ -94,15 +93,13 @@ static GimpChannel *
gimp_by_color_select_tool_get_mask (GimpRegionSelectTool *region_select, gimp_by_color_select_tool_get_mask (GimpRegionSelectTool *region_select,
GimpDisplay *display) GimpDisplay *display)
{ {
GimpTool *tool = GIMP_TOOL (region_select); GimpTool *tool = GIMP_TOOL (region_select);
GimpSelectionOptions *options; GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
GimpDrawable *drawable; GimpDrawable *drawable;
GimpPickable *pickable; GimpPickable *pickable;
guchar *col; guchar *col;
gint x, y; gint x, y;
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
drawable = gimp_image_active_drawable (display->image); drawable = gimp_image_active_drawable (display->image);
x = region_select->x; x = region_select->x;
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#include "tools-types.h" #include "tools-types.h"
#include "core/gimptoolinfo.h"
#include "paint/gimpclone.h" #include "paint/gimpclone.h"
#include "paint/gimpcloneoptions.h" #include "paint/gimpcloneoptions.h"
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpdrawable.h" #include "core/gimpdrawable.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpcolorframe.h" #include "widgets/gimpcolorframe.h"
#include "widgets/gimphelp-ids.h" #include "widgets/gimphelp-ids.h"
...@@ -95,7 +94,7 @@ gimp_color_picker_tool_register (GimpToolRegisterCallback callback, ...@@ -95,7 +94,7 @@ gimp_color_picker_tool_register (GimpToolRegisterCallback callback,
(* callback) (GIMP_TYPE_COLOR_PICKER_TOOL, (* callback) (GIMP_TYPE_COLOR_PICKER_TOOL,
GIMP_TYPE_COLOR_PICKER_OPTIONS, GIMP_TYPE_COLOR_PICKER_OPTIONS,
gimp_color_picker_options_gui, gimp_color_picker_options_gui,
0, GIMP_CONTEXT_FOREGROUND_MASK | GIMP_CONTEXT_BACKGROUND_MASK,
"gimp-color-picker-tool", "gimp-color-picker-tool",
_("Color Picker"), _("Color Picker"),
_("Pick colors from the image"), _("Pick colors from the image"),
...@@ -143,7 +142,7 @@ gimp_color_picker_tool_constructor (GType type, ...@@ -143,7 +142,7 @@ gimp_color_picker_tool_constructor (GType type,
tool = GIMP_TOOL (object); tool = GIMP_TOOL (object);
gimp_color_tool_enable (GIMP_COLOR_TOOL (object), gimp_color_tool_enable (GIMP_COLOR_TOOL (object),
GIMP_COLOR_OPTIONS (tool->tool_info->tool_options)); GIMP_COLOR_TOOL_GET_OPTIONS (tool));
return object; return object;
} }
...@@ -190,9 +189,7 @@ gimp_color_picker_tool_modifier_key (GimpTool *tool, ...@@ -190,9 +189,7 @@ gimp_color_picker_tool_modifier_key (GimpTool *tool,
GdkModifierType state, GdkModifierType state,
GimpDisplay *display) GimpDisplay *display)
{ {
GimpColorPickerOptions *options; GimpColorPickerOptions *options = GIMP_COLOR_PICKER_TOOL_GET_OPTIONS (tool);
options = GIMP_COLOR_PICKER_OPTIONS (tool->tool_info->tool_options);
if (key == GDK_SHIFT_MASK) if (key == GDK_SHIFT_MASK)
{ {
...@@ -227,9 +224,7 @@ gimp_color_picker_tool_oper_update (GimpTool *tool, ...@@ -227,9 +224,7 @@ gimp_color_picker_tool_oper_update (GimpTool *tool,
gboolean proximity, gboolean proximity,
GimpDisplay *display) GimpDisplay *display)
{ {
GimpColorPickerOptions *options; GimpColorPickerOptions *options = GIMP_COLOR_PICKER_TOOL_GET_OPTIONS (tool);
options = GIMP_COLOR_PICKER_OPTIONS (tool->tool_info->tool_options);
GIMP_COLOR_TOOL (tool)->pick_mode = options->pick_mode; GIMP_COLOR_TOOL (tool)->pick_mode = options->pick_mode;
...@@ -247,7 +242,7 @@ gimp_color_picker_tool_picked (GimpColorTool *color_tool, ...@@ -247,7 +242,7 @@ gimp_color_picker_tool_picked (GimpColorTool *color_tool,
GimpColorPickerTool *picker_tool = GIMP_COLOR_PICKER_TOOL (color_tool); GimpColorPickerTool *picker_tool = GIMP_COLOR_PICKER_TOOL (color_tool);
GimpColorPickerOptions *options; GimpColorPickerOptions *options;
options = GIMP_COLOR_PICKER_OPTIONS (color_tool->options); options = GIMP_COLOR_PICKER_TOOL_GET_OPTIONS (color_tool);
if (options->use_info_window && ! picker_tool->dialog) if (options->use_info_window && ! picker_tool->dialog)
gimp_color_picker_tool_info_create (picker_tool); gimp_color_picker_tool_info_create (picker_tool);
...@@ -284,7 +279,7 @@ gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool) ...@@ -284,7 +279,7 @@ gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool)
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (picker_tool->dialog), gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (picker_tool->dialog),
GIMP_VIEWABLE (tool->drawable), GIMP_VIEWABLE (tool->drawable),
GIMP_CONTEXT (tool->tool_info->tool_options)); GIMP_CONTEXT (gimp_tool_get_options (tool)));
g_signal_connect (picker_tool->dialog, "response", g_signal_connect (picker_tool->dialog, "response",
G_CALLBACK (gimp_color_picker_tool_info_response), G_CALLBACK (gimp_color_picker_tool_info_response),
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#define GIMP_IS_COLOR_PICKER_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_PICKER_TOOL)) #define GIMP_IS_COLOR_PICKER_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_PICKER_TOOL))
#define GIMP_COLOR_PICKER_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_PICKER_TOOL, GimpColorPickerToolClass)) #define GIMP_COLOR_PICKER_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_PICKER_TOOL, GimpColorPickerToolClass))
#define GIMP_COLOR_PICKER_TOOL_GET_OPTIONS(t) (GIMP_COLOR_PICKER_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
typedef struct _GimpColorPickerTool GimpColorPickerTool; typedef struct _GimpColorPickerTool GimpColorPickerTool;
typedef struct _GimpColorPickerToolClass GimpColorPickerToolClass; typedef struct _GimpColorPickerToolClass GimpColorPickerToolClass;
......
...@@ -611,10 +611,12 @@ gimp_color_tool_real_picked (GimpColorTool *color_tool, ...@@ -611,10 +611,12 @@ gimp_color_tool_real_picked (GimpColorTool *color_tool,
gint color_index) gint color_index)
{ {
GimpTool *tool = GIMP_TOOL (color_tool); GimpTool *tool = GIMP_TOOL (color_tool);
GimpContext *user_context; GimpContext *context;
GimpDialogFactory *dialog_factory; GimpDialogFactory *dialog_factory;
user_context = gimp_get_user_context (tool->display->image->gimp); /* use this tool's own options here (NOT color_tool->options) */
context = GIMP_CONTEXT (gimp_tool_get_options (tool));
dialog_factory = gimp_dialog_factory_from_name ("dock"); dialog_factory = gimp_dialog_factory_from_name ("dock");
if (color_tool->pick_mode == GIMP_COLOR_PICK_MODE_FOREGROUND || if (color_tool->pick_mode == GIMP_COLOR_PICK_MODE_FOREGROUND ||
...@@ -660,11 +662,11 @@ gimp_color_tool_real_picked (GimpColorTool *color_tool, ...@@ -660,11 +662,11 @@ gimp_color_tool_real_picked (GimpColorTool *color_tool,
break; break;
case GIMP_COLOR_PICK_MODE_FOREGROUND: case GIMP_COLOR_PICK_MODE_FOREGROUND:
gimp_context_set_foreground (user_context, color); gimp_context_set_foreground (context, color);
break; break;
case GIMP_COLOR_PICK_MODE_BACKGROUND: case GIMP_COLOR_PICK_MODE_BACKGROUND:
gimp_context_set_background (user_context, color); gimp_context_set_background (context, color);
break; break;
case GIMP_COLOR_PICK_MODE_PALETTE: case GIMP_COLOR_PICK_MODE_PALETTE:
...@@ -691,7 +693,7 @@ gimp_color_tool_real_picked (GimpColorTool *color_tool, ...@@ -691,7 +693,7 @@ gimp_color_tool_real_picked (GimpColorTool *color_tool,
if (! data) if (! data)
{ {
data = GIMP_DATA (gimp_context_get_palette (user_context)); data = GIMP_DATA (gimp_context_get_palette (context));
gimp_data_editor_set_data (GIMP_DATA_EDITOR (palette_editor), gimp_data_editor_set_data (GIMP_DATA_EDITOR (palette_editor),
data); data);
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#define GIMP_IS_COLOR_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_TOOL)) #define GIMP_IS_COLOR_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_TOOL))
#define GIMP_COLOR_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_TOOL, GimpColorToolClass)) #define GIMP_COLOR_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_TOOL, GimpColorToolClass))
#define GIMP_COLOR_TOOL_GET_OPTIONS(t) (GIMP_COLOR_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
typedef struct _GimpColorToolClass GimpColorToolClass; typedef struct _GimpColorToolClass GimpColorToolClass;
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#include "tools-types.h" #include "tools-types.h"
#include "core/gimptoolinfo.h"
#include "paint/gimpconvolveoptions.h" #include "paint/gimpconvolveoptions.h"
#include "widgets/gimphelp-ids.h" #include "widgets/gimphelp-ids.h"
...@@ -110,9 +108,7 @@ gimp_convolve_tool_modifier_key (GimpTool *tool, ...@@ -110,9 +108,7 @@ gimp_convolve_tool_modifier_key (GimpTool *tool,
GdkModifierType state, GdkModifierType state,
GimpDisplay *display) GimpDisplay *display)
{ {
GimpConvolveOptions *options; GimpConvolveOptions *options = GIMP_CONVOLVE_TOOL_GET_OPTIONS (tool);
options = GIMP_CONVOLVE_OPTIONS (tool->tool_info->tool_options);
if ((key == GDK_CONTROL_MASK) && if ((key == GDK_CONTROL_MASK) &&
! (state & GDK_SHIFT_MASK)) /* leave stuff untouched in line draw mode */ ! (state & GDK_SHIFT_MASK)) /* leave stuff untouched in line draw mode */
...@@ -139,9 +135,7 @@ gimp_convolve_tool_cursor_update (GimpTool *tool, ...@@ -139,9 +135,7 @@ gimp_convolve_tool_cursor_update (GimpTool *tool,
GdkModifierType state, GdkModifierType state,
GimpDisplay *display) GimpDisplay *display)
{ {
GimpConvolveOptions *options; GimpConvolveOptions *options = GIMP_CONVOLVE_TOOL_GET_OPTIONS (tool);
options = GIMP_CONVOLVE_OPTIONS (tool->tool_info->tool_options);
gimp_tool_control_set_toggled (tool->control, gimp_tool_control_set_toggled (tool->control,
(options->type == GIMP_SHARPEN_CONVOLVE)); (options->type == GIMP_SHARPEN_CONVOLVE));
...@@ -156,9 +150,7 @@ gimp_convolve_tool_oper_update (GimpTool *tool, ...@@ -156,9 +150,7 @@ gimp_convolve_tool_oper_update (GimpTool *tool,
gboolean proximity, gboolean proximity,
GimpDisplay *display) GimpDisplay *display)
{ {
GimpConvolveOptions *options; GimpConvolveOptions *options = GIMP_CONVOLVE_TOOL_GET_OPTIONS (tool);
options = GIMP_CONVOLVE_OPTIONS (tool->tool_info->tool_options);
gimp_convolve_tool_status_update (tool, options->type); gimp_convolve_tool_status_update (tool, options->type);
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#define GIMP_IS_CONVOLVE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONVOLVE_TOOL)) #define GIMP_IS_CONVOLVE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONVOLVE_TOOL))
#define GIMP_CONVOLVE_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CONVOLVE_TOOL, GimpConvolveToolClass)) #define GIMP_CONVOLVE_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CONVOLVE_TOOL, GimpConvolveToolClass))
#define GIMP_CONVOLVE_TOOL_GET_OPTIONS(t) (GIMP_CONVOLVE_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
typedef struct _GimpConvolveTool GimpConvolveTool; typedef struct _GimpConvolveTool GimpConvolveTool;
typedef struct _GimpConvolveToolClass GimpConvolveToolClass; typedef struct _GimpConvolveToolClass GimpConvolveToolClass;
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimpimage-crop.h" #include "core/gimpimage-crop.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimphelp-ids.h" #include "widgets/gimphelp-ids.h"
...@@ -199,7 +198,7 @@ gimp_crop_tool_button_release (GimpTool *tool, ...@@ -199,7 +198,7 @@ gimp_crop_tool_button_release (GimpTool *tool,
GdkModifierType state, GdkModifierType state,
GimpDisplay *display) GimpDisplay *display)
{ {
GimpCropOptions *options = GIMP_CROP_OPTIONS (tool->tool_info->tool_options); GimpCropOptions *options = GIMP_CROP_TOOL_GET_OPTIONS (tool);
if (options->crop_mode == GIMP_CROP_MODE_CROP) if (options->crop_mode == GIMP_CROP_MODE_CROP)
gimp_tool_push_status (tool, display, gimp_tool_push_status (tool, display,
...@@ -243,14 +242,12 @@ gimp_crop_tool_execute (GimpRectangleTool *rectangle, ...@@ -243,14 +242,12 @@ gimp_crop_tool_execute (GimpRectangleTool *rectangle,
gint w, gint w,
gint h)