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

« back to all changes in this revision

Viewing changes to app/tools/gimppaintoptions-gui.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-1999 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
20
20
 
21
21
#include <gtk/gtk.h>
22
22
 
23
 
#include "libgimpbase/gimpbase.h"
24
23
#include "libgimpwidgets/gimpwidgets.h"
25
24
 
26
25
#include "tools-types.h"
27
26
 
28
 
#include "config/gimpconfig.h"
29
 
 
30
 
#include "core/gimp.h"
31
27
#include "core/gimptoolinfo.h"
32
28
 
33
29
#include "paint/gimppaintoptions.h"
43
39
#include "gimpclonetool.h"
44
40
#include "gimpconvolvetool.h"
45
41
#include "gimpdodgeburntool.h"
46
 
#include "gimpdodgeburntool.h"
47
42
#include "gimperasertool.h"
 
43
#include "gimphealtool.h"
48
44
#include "gimpinktool.h"
49
 
#include "gimppaintbrushtool.h"
50
45
#include "gimppaintoptions-gui.h"
51
46
#include "gimppenciltool.h"
 
47
#include "gimpperspectiveclonetool.h"
52
48
#include "gimpsmudgetool.h"
53
49
#include "gimptooloptions-gui.h"
54
50
 
65
61
                                         GimpPaintOptions    *paint_options,
66
62
                                         GType                tool_type,
67
63
                                         GtkWidget           *incremental_toggle);
68
 
 
 
64
static GtkWidget * jitter_options_gui   (GimpJitterOptions   *jitter,
 
65
                                         GimpPaintOptions    *paint_options,
 
66
                                         GType                tool_type);
69
67
 
70
68
/*  public functions  */
71
69
 
74
72
{
75
73
  GObject          *config  = G_OBJECT (tool_options);
76
74
  GimpPaintOptions *options = GIMP_PAINT_OPTIONS (tool_options);
77
 
  GtkWidget        *vbox;
 
75
  GtkWidget        *vbox    = gimp_tool_options_gui (tool_options);
78
76
  GtkWidget        *frame;
79
77
  GtkWidget        *table;
80
78
  GtkWidget        *menu;
84
82
  gint              table_row          = 0;
85
83
  GType             tool_type;
86
84
 
87
 
  vbox = gimp_tool_options_gui (tool_options);
88
 
 
89
85
  tool_type = tool_options->tool_info->tool_type;
90
86
 
91
87
  /*  the main table  */
97
93
 
98
94
  g_object_set_data (G_OBJECT (vbox), GIMP_PAINT_OPTIONS_TABLE_KEY, table);
99
95
 
100
 
  /*  the opacity scale  */
101
 
  gimp_prop_opacity_entry_new (config, "opacity",
102
 
                               GTK_TABLE (table), 0, table_row++,
103
 
                               _("Opacity:"));
104
 
 
105
96
  /*  the paint mode menu  */
106
 
  menu = gimp_prop_paint_mode_menu_new (config, "paint-mode", TRUE);
 
97
  menu  = gimp_prop_paint_mode_menu_new (config, "paint-mode", TRUE, FALSE);
107
98
  label = gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++,
108
99
                                     _("Mode:"), 0.0, 0.5,
109
100
                                     menu, 2, FALSE);
117
108
      gtk_widget_set_sensitive (label, FALSE);
118
109
    }
119
110
 
120
 
  if (tool_type != GIMP_TYPE_BUCKET_FILL_TOOL &&
121
 
      tool_type != GIMP_TYPE_BLEND_TOOL       &&
122
 
      tool_type != GIMP_TYPE_INK_TOOL)
 
111
  /*  the opacity scale  */
 
112
  gimp_prop_opacity_entry_new (config, "opacity",
 
113
                               GTK_TABLE (table), 0, table_row++,
 
114
                               _("Opacity:"));
 
115
 
 
116
  /*  the brush  */
 
117
  if (g_type_is_a (tool_type, GIMP_TYPE_BRUSH_TOOL))
123
118
    {
124
 
      button = gimp_brush_box_new (NULL, GIMP_CONTEXT (tool_options), 2);
 
119
      button = gimp_prop_brush_box_new (NULL, GIMP_CONTEXT (tool_options), 2,
 
120
                                        "brush-view-type", "brush-view-size");
125
121
      gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++,
126
122
                                 _("Brush:"), 0.0, 0.5,
127
123
                                 button, 2, FALSE);
 
124
 
 
125
      if (tool_type != GIMP_TYPE_SMUDGE_TOOL)
 
126
        {
 
127
          GtkObject *adj;
 
128
 
 
129
          adj = gimp_prop_scale_entry_new (config, "brush-scale",
 
130
                                           GTK_TABLE (table), 0, table_row++,
 
131
                                           _("Scale:"),
 
132
                                           0.01, 0.1, 2,
 
133
                                           FALSE, 0.0, 0.0);
 
134
 
 
135
          gimp_scale_entry_set_logarithmic (adj, TRUE);
 
136
        }
128
137
    }
129
138
 
 
139
  /*  the gradient  */
130
140
  if (tool_type == GIMP_TYPE_BLEND_TOOL)
131
141
    {
132
 
      button = gimp_gradient_box_new (NULL, GIMP_CONTEXT (tool_options),
133
 
                                      "gradient-reverse", 2);
 
142
      button = gimp_prop_gradient_box_new (NULL, GIMP_CONTEXT (tool_options), 2,
 
143
                                           "gradient-view-type",
 
144
                                           "gradient-view-size",
 
145
                                           "gradient-reverse");
134
146
      gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++,
135
147
                                 _("Gradient:"), 0.0, 0.5,
136
148
                                 button, 2, TRUE);
152
164
      gtk_widget_show (frame);
153
165
    }
154
166
 
 
167
  frame = jitter_options_gui (options->jitter_options,
 
168
                              options, tool_type);
 
169
  if (frame)
 
170
    {
 
171
      gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
 
172
      gtk_widget_show (frame);
 
173
    }
 
174
 
155
175
  /*  the "incremental" toggle  */
156
176
  if (tool_type == GIMP_TYPE_PENCIL_TOOL     ||
157
177
      tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
168
188
    }
169
189
 
170
190
  /* the "hard edge" toggle */
171
 
  if (tool_type == GIMP_TYPE_ERASER_TOOL     ||
172
 
      tool_type == GIMP_TYPE_CLONE_TOOL      ||
173
 
      tool_type == GIMP_TYPE_CONVOLVE_TOOL   ||
174
 
      tool_type == GIMP_TYPE_DODGE_BURN_TOOL ||
 
191
  if (tool_type == GIMP_TYPE_ERASER_TOOL            ||
 
192
      tool_type == GIMP_TYPE_CLONE_TOOL             ||
 
193
      tool_type == GIMP_TYPE_HEAL_TOOL              ||
 
194
      tool_type == GIMP_TYPE_PERSPECTIVE_CLONE_TOOL ||
 
195
      tool_type == GIMP_TYPE_CONVOLVE_TOOL          ||
 
196
      tool_type == GIMP_TYPE_DODGE_BURN_TOOL        ||
175
197
      tool_type == GIMP_TYPE_SMUDGE_TOOL)
176
198
    {
177
199
      button = gimp_prop_check_button_new (config, "hard", _("Hard edge"));
204
226
  GtkWidget *wbox   = NULL;
205
227
  GtkWidget *button;
206
228
 
207
 
  if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL) ||
208
 
      tool_type == GIMP_TYPE_CLONE_TOOL                  ||
209
 
      tool_type == GIMP_TYPE_CONVOLVE_TOOL               ||
210
 
      tool_type == GIMP_TYPE_DODGE_BURN_TOOL             ||
211
 
      tool_type == GIMP_TYPE_ERASER_TOOL                 ||
212
 
      tool_type == GIMP_TYPE_SMUDGE_TOOL)
 
229
  if (g_type_is_a (tool_type, GIMP_TYPE_BRUSH_TOOL))
213
230
    {
214
231
      GtkWidget *inner_frame;
215
232
 
216
 
      frame = gtk_expander_new (_("Pressure sensitivity"));
217
 
      gtk_expander_set_expanded (GTK_EXPANDER (frame), FALSE);
 
233
      frame = gimp_prop_expander_new (G_OBJECT (paint_options),
 
234
                                      "pressure-expanded",
 
235
                                      _("Pressure sensitivity"));
218
236
 
219
237
      inner_frame = gimp_frame_new ("<expander>");
220
238
      gtk_container_add (GTK_CONTAINER (frame), inner_frame);
229
247
  /*  the opacity toggle  */
230
248
  if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL) ||
231
249
      tool_type == GIMP_TYPE_CLONE_TOOL                  ||
 
250
      tool_type == GIMP_TYPE_HEAL_TOOL                   ||
 
251
      tool_type == GIMP_TYPE_PERSPECTIVE_CLONE_TOOL      ||
232
252
      tool_type == GIMP_TYPE_DODGE_BURN_TOOL             ||
233
253
      tool_type == GIMP_TYPE_ERASER_TOOL)
234
254
    {
239
259
    }
240
260
 
241
261
  /*  the pressure toggle  */
242
 
  if (tool_type == GIMP_TYPE_AIRBRUSH_TOOL   ||
243
 
      tool_type == GIMP_TYPE_CLONE_TOOL      ||
244
 
      tool_type == GIMP_TYPE_CONVOLVE_TOOL   ||
245
 
      tool_type == GIMP_TYPE_DODGE_BURN_TOOL ||
246
 
      tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
 
262
  if (tool_type == GIMP_TYPE_AIRBRUSH_TOOL          ||
 
263
      tool_type == GIMP_TYPE_CLONE_TOOL             ||
 
264
      tool_type == GIMP_TYPE_HEAL_TOOL              ||
 
265
      tool_type == GIMP_TYPE_PERSPECTIVE_CLONE_TOOL ||
 
266
      tool_type == GIMP_TYPE_CONVOLVE_TOOL          ||
 
267
      tool_type == GIMP_TYPE_DODGE_BURN_TOOL        ||
 
268
      tool_type == GIMP_TYPE_PAINTBRUSH_TOOL        ||
247
269
      tool_type == GIMP_TYPE_SMUDGE_TOOL)
248
270
    {
249
271
      button = gimp_prop_check_button_new (config, "pressure-hardness",
264
286
    }
265
287
 
266
288
  /*  the size toggle  */
267
 
  if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL) ||
268
 
      tool_type == GIMP_TYPE_CLONE_TOOL                  ||
269
 
      tool_type == GIMP_TYPE_CONVOLVE_TOOL               ||
270
 
      tool_type == GIMP_TYPE_DODGE_BURN_TOOL             ||
271
 
      tool_type == GIMP_TYPE_ERASER_TOOL)
 
289
  if (tool_type == GIMP_TYPE_CLONE_TOOL             ||
 
290
      tool_type == GIMP_TYPE_HEAL_TOOL              ||
 
291
      tool_type == GIMP_TYPE_PERSPECTIVE_CLONE_TOOL ||
 
292
      tool_type == GIMP_TYPE_CONVOLVE_TOOL          ||
 
293
      tool_type == GIMP_TYPE_DODGE_BURN_TOOL        ||
 
294
      tool_type == GIMP_TYPE_ERASER_TOOL            ||
 
295
      tool_type == GIMP_TYPE_PAINTBRUSH_TOOL        ||
 
296
      tool_type == GIMP_TYPE_PENCIL_TOOL)
272
297
    {
273
298
      button = gimp_prop_check_button_new (config, "pressure-size",
274
299
                                           _("Size"));
276
301
      gtk_widget_show (button);
277
302
    }
278
303
 
 
304
  /* the inverse size toggle */
 
305
  if (tool_type == GIMP_TYPE_AIRBRUSH_TOOL)
 
306
    {
 
307
      button = gimp_prop_check_button_new (config, "pressure-inverse-size",
 
308
                                           _("Size"));
 
309
      gtk_container_add (GTK_CONTAINER (wbox), button);
 
310
      gtk_widget_show (button);
 
311
    }
 
312
 
279
313
  /*  the color toggle  */
280
314
  if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL))
281
315
    {
295
329
{
296
330
  GObject   *config = G_OBJECT (paint_options);
297
331
  GtkWidget *frame  = NULL;
298
 
  GtkWidget *table;
299
 
  GtkWidget *spinbutton;
300
 
  GtkWidget *button;
301
 
  GtkWidget *menu;
302
332
 
303
 
  if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL) ||
304
 
      tool_type == GIMP_TYPE_CLONE_TOOL                  ||
305
 
      tool_type == GIMP_TYPE_CONVOLVE_TOOL               ||
306
 
      tool_type == GIMP_TYPE_DODGE_BURN_TOOL             ||
307
 
      tool_type == GIMP_TYPE_ERASER_TOOL                 ||
308
 
      tool_type == GIMP_TYPE_SMUDGE_TOOL)
 
333
  if (g_type_is_a (tool_type, GIMP_TYPE_BRUSH_TOOL))
309
334
    {
310
 
      frame = gimp_frame_new (NULL);
311
 
 
312
 
      button = gimp_prop_check_button_new (config, "use-fade",
313
 
                                           _("Fade out"));
314
 
      gtk_frame_set_label_widget (GTK_FRAME (frame), button);
315
 
      gtk_widget_show (button);
 
335
      GtkWidget *table;
 
336
      GtkWidget *spinbutton;
 
337
      GtkWidget *menu;
316
338
 
317
339
      table = gtk_table_new (1, 3, FALSE);
318
340
      gtk_table_set_col_spacings (GTK_TABLE (table), 2);
319
 
      gtk_container_add (GTK_CONTAINER (frame), table);
320
 
      if (fade->use_fade)
321
 
        gtk_widget_show (table);
322
341
 
323
 
      g_signal_connect_object (button, "toggled",
324
 
                               G_CALLBACK (gimp_toggle_button_set_visible),
325
 
                               table, 0);
 
342
      frame = gimp_prop_expanding_frame_new (config, "use-fade",
 
343
                                             _("Fade out"),
 
344
                                             table, NULL);
326
345
 
327
346
      /*  the fade-out sizeentry  */
328
347
      spinbutton = gimp_prop_spin_button_new (config, "fade-length",
347
366
}
348
367
 
349
368
static GtkWidget *
 
369
jitter_options_gui (GimpJitterOptions  *jitter,
 
370
                    GimpPaintOptions   *paint_options,
 
371
                    GType               tool_type)
 
372
{
 
373
  GObject   *config = G_OBJECT (paint_options);
 
374
  GtkWidget *frame  = NULL;
 
375
 
 
376
  if (g_type_is_a (tool_type, GIMP_TYPE_BRUSH_TOOL))
 
377
    {
 
378
      GtkWidget *table;
 
379
 
 
380
      table = gtk_table_new (1, 3, FALSE);
 
381
      gtk_table_set_col_spacings (GTK_TABLE (table), 2);
 
382
 
 
383
      frame = gimp_prop_expanding_frame_new (config, "use-jitter",
 
384
                                             _("Apply Jitter"),
 
385
                                             table, NULL);
 
386
 
 
387
      gimp_prop_scale_entry_new (config, "jitter-amount",
 
388
                                 GTK_TABLE (table), 0, 0,
 
389
                                 _("Amount:"),
 
390
                                 0.01, 0.1, 2,
 
391
                                 TRUE, 0.0, 5.0);
 
392
    }
 
393
 
 
394
  return frame;
 
395
}
 
396
 
 
397
static GtkWidget *
350
398
gradient_options_gui (GimpGradientOptions *gradient,
351
399
                      GimpPaintOptions    *paint_options,
352
400
                      GType                tool_type,
354
402
{
355
403
  GObject   *config = G_OBJECT (paint_options);
356
404
  GtkWidget *frame  = NULL;
357
 
  GtkWidget *table;
358
 
  GtkWidget *spinbutton;
359
 
  GtkWidget *button;
360
 
  GtkWidget *menu;
361
 
  GtkWidget *combo;
362
405
 
363
406
  if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL))
364
407
    {
365
 
      frame = gimp_frame_new (NULL);
366
 
 
367
 
      button = gimp_prop_check_button_new (config, "use-gradient",
368
 
                                           _("Use color from gradient"));
369
 
      gtk_frame_set_label_widget (GTK_FRAME (frame), button);
370
 
      gtk_widget_show (button);
 
408
      GtkWidget *table;
 
409
      GtkWidget *spinbutton;
 
410
      GtkWidget *button;
 
411
      GtkWidget *menu;
 
412
      GtkWidget *combo;
371
413
 
372
414
      table = gtk_table_new (3, 3, FALSE);
373
415
      gtk_table_set_col_spacings (GTK_TABLE (table), 2);
374
416
      gtk_table_set_row_spacings (GTK_TABLE (table), 2);
375
 
      gtk_container_add (GTK_CONTAINER (frame), table);
376
 
      if (gradient->use_gradient)
377
 
        gtk_widget_show (table);
378
417
 
379
 
      g_signal_connect_object (button, "toggled",
380
 
                               G_CALLBACK (gimp_toggle_button_set_visible),
381
 
                               table, 0);
 
418
      frame = gimp_prop_expanding_frame_new (config, "use-gradient",
 
419
                                             _("Use color from gradient"),
 
420
                                             table, &button);
382
421
 
383
422
      if (incremental_toggle)
384
423
        {
389
428
        }
390
429
 
391
430
      /*  the gradient view  */
392
 
      button = gimp_gradient_box_new (NULL, GIMP_CONTEXT (config),
393
 
                                      "gradient-reverse", 2);
 
431
      button = gimp_prop_gradient_box_new (NULL, GIMP_CONTEXT (config), 2,
 
432
                                           "gradient-view-type",
 
433
                                           "gradient-view-size",
 
434
                                           "gradient-reverse");
394
435
      gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
395
436
                                 _("Gradient:"), 0.0, 0.5,
396
437
                                 button, 2, TRUE);