~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/tools/gimpdodgeburntool.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* The GIMP -- an image manipulation program
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
24
24
 
25
25
#include "tools-types.h"
26
26
 
27
 
#include "core/gimptoolinfo.h"
28
 
 
29
27
#include "paint/gimpdodgeburnoptions.h"
30
28
 
31
29
#include "widgets/gimphelp-ids.h"
32
 
#include "widgets/gimppropwidgets.h"
33
30
#include "widgets/gimpwidgets-utils.h"
34
31
 
35
32
#include "gimpdodgeburntool.h"
39
36
#include "gimp-intl.h"
40
37
 
41
38
 
42
 
static void   gimp_dodge_burn_tool_class_init (GimpDodgeBurnToolClass *klass);
43
 
static void   gimp_dodge_burn_tool_init       (GimpDodgeBurnTool      *dodgeburn);
44
 
 
45
 
static void   gimp_dodge_burn_tool_modifier_key  (GimpTool        *tool,
46
 
                                                  GdkModifierType  key,
47
 
                                                  gboolean         press,
48
 
                                                  GdkModifierType  state,
49
 
                                                  GimpDisplay     *gdisp);
50
 
static void   gimp_dodge_burn_tool_cursor_update (GimpTool        *tool,
51
 
                                                  GimpCoords      *coords,
52
 
                                                  GdkModifierType  state,
53
 
                                                  GimpDisplay     *gdisp);
54
 
 
55
 
static GtkWidget * gimp_dodge_burn_options_gui   (GimpToolOptions *tool_options);
56
 
 
57
 
 
58
 
static GimpPaintToolClass *parent_class = NULL;
 
39
static void   gimp_dodge_burn_tool_modifier_key  (GimpTool          *tool,
 
40
                                                  GdkModifierType    key,
 
41
                                                  gboolean           press,
 
42
                                                  GdkModifierType    state,
 
43
                                                  GimpDisplay       *display);
 
44
static void   gimp_dodge_burn_tool_cursor_update (GimpTool          *tool,
 
45
                                                  GimpCoords        *coords,
 
46
                                                  GdkModifierType    state,
 
47
                                                  GimpDisplay       *display);
 
48
static void   gimp_dodge_burn_tool_oper_update   (GimpTool          *tool,
 
49
                                                  GimpCoords        *coords,
 
50
                                                  GdkModifierType    state,
 
51
                                                  gboolean           proximity,
 
52
                                                  GimpDisplay       *display);
 
53
static void   gimp_dodge_burn_tool_status_update (GimpTool          *tool,
 
54
                                                  GimpDodgeBurnType  type);
 
55
 
 
56
static GtkWidget * gimp_dodge_burn_options_gui   (GimpToolOptions   *tool_options);
 
57
 
 
58
 
 
59
G_DEFINE_TYPE (GimpDodgeBurnTool, gimp_dodge_burn_tool, GIMP_TYPE_BRUSH_TOOL)
 
60
 
 
61
#define parent_class gimp_dodge_burn_tool_parent_class
59
62
 
60
63
 
61
64
void
67
70
                gimp_dodge_burn_options_gui,
68
71
                GIMP_PAINT_OPTIONS_CONTEXT_MASK,
69
72
                "gimp-dodge-burn-tool",
70
 
                _("Dodge/Burn"),
71
 
                _("Dodge or Burn strokes"),
72
 
                N_("Dod_geBurn"), "<shift>D",
 
73
                _("Dodge / Burn"),
 
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,
75
78
                data);
76
79
}
77
80
 
78
 
GType
79
 
gimp_dodge_burn_tool_get_type (void)
80
 
{
81
 
  static GType tool_type = 0;
82
 
 
83
 
  if (!tool_type)
84
 
    {
85
 
      static const GTypeInfo tool_info =
86
 
      {
87
 
        sizeof (GimpDodgeBurnToolClass),
88
 
        (GBaseInitFunc) NULL,
89
 
        (GBaseFinalizeFunc) NULL,
90
 
        (GClassInitFunc) gimp_dodge_burn_tool_class_init,
91
 
        NULL,           /* class_finalize */
92
 
        NULL,           /* class_data     */
93
 
        sizeof (GimpDodgeBurnTool),
94
 
        0,              /* n_preallocs    */
95
 
        (GInstanceInitFunc) gimp_dodge_burn_tool_init,
96
 
      };
97
 
 
98
 
      tool_type = g_type_register_static (GIMP_TYPE_PAINT_TOOL,
99
 
                                          "GimpDodgeBurnTool",
100
 
                                          &tool_info, 0);
101
 
    }
102
 
 
103
 
  return tool_type;
104
 
}
105
 
 
106
81
static void
107
82
gimp_dodge_burn_tool_class_init (GimpDodgeBurnToolClass *klass)
108
83
{
109
 
  GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
110
 
 
111
 
  parent_class = g_type_class_peek_parent (klass);
 
84
  GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
112
85
 
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;
115
89
}
116
90
 
117
91
static void
123
97
                                            GIMP_TOOL_CURSOR_DODGE);
124
98
  gimp_tool_control_set_toggle_tool_cursor (tool->control,
125
99
                                            GIMP_TOOL_CURSOR_BURN);
 
100
 
 
101
  gimp_dodge_burn_tool_status_update (tool, GIMP_BURN);
126
102
}
127
103
 
128
104
static void
130
106
                                   GdkModifierType  key,
131
107
                                   gboolean         press,
132
108
                                   GdkModifierType  state,
133
 
                                   GimpDisplay     *gdisp)
 
109
                                   GimpDisplay     *display)
134
110
{
135
 
  GimpDodgeBurnOptions *options;
136
 
 
137
 
  options = GIMP_DODGE_BURN_OPTIONS (tool->tool_info->tool_options);
 
111
  GimpDodgeBurnOptions *options = GIMP_DODGE_BURN_TOOL_GET_OPTIONS (tool);
138
112
 
139
113
  if (key == GDK_CONTROL_MASK &&
140
114
      ! (state & GDK_SHIFT_MASK)) /* leave stuff untouched in line draw mode */
154
128
        }
155
129
    }
156
130
 
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,
 
132
                                                display);
158
133
}
159
134
 
160
135
static void
161
136
gimp_dodge_burn_tool_cursor_update (GimpTool        *tool,
162
137
                                    GimpCoords      *coords,
163
138
                                    GdkModifierType  state,
164
 
                                    GimpDisplay     *gdisp)
165
 
{
166
 
  GimpDodgeBurnOptions *options;
167
 
 
168
 
  options = GIMP_DODGE_BURN_OPTIONS (tool->tool_info->tool_options);
169
 
 
170
 
  gimp_tool_control_set_toggle (tool->control, (options->type == GIMP_BURN));
171
 
 
172
 
  GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp);
 
139
                                    GimpDisplay     *display)
 
140
{
 
141
  GimpDodgeBurnOptions *options = GIMP_DODGE_BURN_TOOL_GET_OPTIONS (tool);
 
142
 
 
143
  gimp_tool_control_set_toggled (tool->control, (options->type == GIMP_BURN));
 
144
 
 
145
  GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state,
 
146
                                                 display);
 
147
}
 
148
 
 
149
static void
 
150
gimp_dodge_burn_tool_oper_update (GimpTool        *tool,
 
151
                                  GimpCoords      *coords,
 
152
                                  GdkModifierType  state,
 
153
                                  gboolean         proximity,
 
154
                                  GimpDisplay     *display)
 
155
{
 
156
  GimpDodgeBurnOptions *options = GIMP_DODGE_BURN_TOOL_GET_OPTIONS (tool);
 
157
 
 
158
  gimp_dodge_burn_tool_status_update (tool, options->type);
 
159
 
 
160
  GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, proximity,
 
161
                                               display);
 
162
}
 
163
 
 
164
static void
 
165
gimp_dodge_burn_tool_status_update (GimpTool          *tool,
 
166
                                    GimpDodgeBurnType  type)
 
167
{
 
168
  GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
 
169
 
 
170
  switch (type)
 
171
    {
 
172
    case GIMP_DODGE:
 
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");
 
176
      break;
 
177
 
 
178
    case GIMP_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");
 
182
      break;
 
183
 
 
184
    default:
 
185
      break;
 
186
    }
173
187
}
174
188
 
175
189
 
178
192
static GtkWidget *
179
193
gimp_dodge_burn_options_gui (GimpToolOptions *tool_options)
180
194
{
181
 
  GObject   *config;
182
 
  GtkWidget *vbox;
 
195
  GObject   *config = G_OBJECT (tool_options);
 
196
  GtkWidget *vbox   = gimp_paint_options_gui (tool_options);
183
197
  GtkWidget *table;
184
198
  GtkWidget *frame;
185
199
  gchar     *str;
186
200
 
187
 
  config = G_OBJECT (tool_options);
188
 
 
189
 
  vbox = gimp_paint_options_gui (tool_options);
190
 
 
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));
194
204
 
195
205
  frame = gimp_prop_enum_radio_frame_new (config, "type",