1
/* The GIMP -- an image manipulation program
1
/* GIMP - The GNU Image Manipulation Program
2
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
4
* This program is free software; you can redistribute it and/or modify
25
25
#include "tools-types.h"
27
#include "core/gimptoolinfo.h"
29
27
#include "paint/gimpdodgeburnoptions.h"
31
29
#include "widgets/gimphelp-ids.h"
32
#include "widgets/gimppropwidgets.h"
33
30
#include "widgets/gimpwidgets-utils.h"
35
32
#include "gimpdodgeburntool.h"
39
36
#include "gimp-intl.h"
42
static void gimp_dodge_burn_tool_class_init (GimpDodgeBurnToolClass *klass);
43
static void gimp_dodge_burn_tool_init (GimpDodgeBurnTool *dodgeburn);
45
static void gimp_dodge_burn_tool_modifier_key (GimpTool *tool,
48
GdkModifierType state,
50
static void gimp_dodge_burn_tool_cursor_update (GimpTool *tool,
52
GdkModifierType state,
55
static GtkWidget * gimp_dodge_burn_options_gui (GimpToolOptions *tool_options);
58
static GimpPaintToolClass *parent_class = NULL;
39
static void gimp_dodge_burn_tool_modifier_key (GimpTool *tool,
42
GdkModifierType state,
43
GimpDisplay *display);
44
static void gimp_dodge_burn_tool_cursor_update (GimpTool *tool,
46
GdkModifierType state,
47
GimpDisplay *display);
48
static void gimp_dodge_burn_tool_oper_update (GimpTool *tool,
50
GdkModifierType state,
52
GimpDisplay *display);
53
static void gimp_dodge_burn_tool_status_update (GimpTool *tool,
54
GimpDodgeBurnType type);
56
static GtkWidget * gimp_dodge_burn_options_gui (GimpToolOptions *tool_options);
59
G_DEFINE_TYPE (GimpDodgeBurnTool, gimp_dodge_burn_tool, GIMP_TYPE_BRUSH_TOOL)
61
#define parent_class gimp_dodge_burn_tool_parent_class
67
70
gimp_dodge_burn_options_gui,
68
71
GIMP_PAINT_OPTIONS_CONTEXT_MASK,
69
72
"gimp-dodge-burn-tool",
71
_("Dodge or Burn strokes"),
72
N_("Dod_geBurn"), "<shift>D",
74
_("Dodge / Burn Tool: Selectively lighten or darken using a brush"),
75
N_("Dod_ge / Burn"), "<shift>D",
73
76
NULL, GIMP_HELP_TOOL_DODGE_BURN,
74
77
GIMP_STOCK_TOOL_DODGE,
79
gimp_dodge_burn_tool_get_type (void)
81
static GType tool_type = 0;
85
static const GTypeInfo tool_info =
87
sizeof (GimpDodgeBurnToolClass),
89
(GBaseFinalizeFunc) NULL,
90
(GClassInitFunc) gimp_dodge_burn_tool_class_init,
91
NULL, /* class_finalize */
92
NULL, /* class_data */
93
sizeof (GimpDodgeBurnTool),
95
(GInstanceInitFunc) gimp_dodge_burn_tool_init,
98
tool_type = g_type_register_static (GIMP_TYPE_PAINT_TOOL,
107
82
gimp_dodge_burn_tool_class_init (GimpDodgeBurnToolClass *klass)
109
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
111
parent_class = g_type_class_peek_parent (klass);
84
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
113
86
tool_class->modifier_key = gimp_dodge_burn_tool_modifier_key;
114
87
tool_class->cursor_update = gimp_dodge_burn_tool_cursor_update;
88
tool_class->oper_update = gimp_dodge_burn_tool_oper_update;
130
106
GdkModifierType key,
132
108
GdkModifierType state,
109
GimpDisplay *display)
135
GimpDodgeBurnOptions *options;
137
options = GIMP_DODGE_BURN_OPTIONS (tool->tool_info->tool_options);
111
GimpDodgeBurnOptions *options = GIMP_DODGE_BURN_TOOL_GET_OPTIONS (tool);
139
113
if (key == GDK_CONTROL_MASK &&
140
114
! (state & GDK_SHIFT_MASK)) /* leave stuff untouched in line draw mode */
157
GIMP_TOOL_CLASS (parent_class)->modifier_key (tool, key, press, state, gdisp);
131
GIMP_TOOL_CLASS (parent_class)->modifier_key (tool, key, press, state,
161
136
gimp_dodge_burn_tool_cursor_update (GimpTool *tool,
162
137
GimpCoords *coords,
163
138
GdkModifierType state,
166
GimpDodgeBurnOptions *options;
168
options = GIMP_DODGE_BURN_OPTIONS (tool->tool_info->tool_options);
170
gimp_tool_control_set_toggle (tool->control, (options->type == GIMP_BURN));
172
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp);
139
GimpDisplay *display)
141
GimpDodgeBurnOptions *options = GIMP_DODGE_BURN_TOOL_GET_OPTIONS (tool);
143
gimp_tool_control_set_toggled (tool->control, (options->type == GIMP_BURN));
145
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state,
150
gimp_dodge_burn_tool_oper_update (GimpTool *tool,
152
GdkModifierType state,
154
GimpDisplay *display)
156
GimpDodgeBurnOptions *options = GIMP_DODGE_BURN_TOOL_GET_OPTIONS (tool);
158
gimp_dodge_burn_tool_status_update (tool, options->type);
160
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, proximity,
165
gimp_dodge_burn_tool_status_update (GimpTool *tool,
166
GimpDodgeBurnType type)
168
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
173
paint_tool->status = _("Click to dodge");
174
paint_tool->status_line = _("Click to dodge the line");
175
paint_tool->status_ctrl = _("%s to burn");
179
paint_tool->status = _("Click to burn");
180
paint_tool->status_line = _("Click to burn the line");
181
paint_tool->status_ctrl = _("%s to dodge");
178
192
static GtkWidget *
179
193
gimp_dodge_burn_options_gui (GimpToolOptions *tool_options)
195
GObject *config = G_OBJECT (tool_options);
196
GtkWidget *vbox = gimp_paint_options_gui (tool_options);
183
197
GtkWidget *table;
184
198
GtkWidget *frame;
187
config = G_OBJECT (tool_options);
189
vbox = gimp_paint_options_gui (tool_options);
191
201
/* the type (dodge or burn) */
192
str = g_strdup_printf (_("Type %s"),
202
str = g_strdup_printf (_("Type (%s)"),
193
203
gimp_get_mod_string (GDK_CONTROL_MASK));
195
205
frame = gimp_prop_enum_radio_frame_new (config, "type",