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

« back to all changes in this revision

Viewing changes to app/tools/gimpbucketfilloptions.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
20
20
 
21
21
#include <gtk/gtk.h>
22
22
 
 
23
#include "libgimpconfig/gimpconfig.h"
23
24
#include "libgimpwidgets/gimpwidgets.h"
24
25
 
25
26
#include "tools-types.h"
26
27
 
27
 
#include "config/gimpconfig-params.h"
28
28
#include "config/gimpguiconfig.h"
29
29
 
30
30
#include "core/gimp.h"
33
33
 
34
34
#include "display/gimpdisplay.h"
35
35
 
36
 
#include "widgets/gimppropwidgets.h"
37
36
#include "widgets/gimpviewablebox.h"
38
37
#include "widgets/gimpwidgets-utils.h"
39
38
 
50
49
  PROP_FILL_SELECTION,
51
50
  PROP_FILL_TRANSPARENT,
52
51
  PROP_SAMPLE_MERGED,
53
 
  PROP_THRESHOLD
 
52
  PROP_THRESHOLD,
 
53
  PROP_FILL_CRITERION
54
54
};
55
55
 
56
56
 
57
 
static void   gimp_bucket_fill_options_class_init   (GimpBucketFillOptionsClass *klass);
58
 
 
59
57
static void   gimp_bucket_fill_options_set_property (GObject         *object,
60
58
                                                     guint            property_id,
61
59
                                                     const GValue    *value,
71
69
                                               GtkWidget             *widget);
72
70
 
73
71
 
74
 
static GimpPaintOptionsClass *parent_class = NULL;
75
 
 
76
 
 
77
 
GType
78
 
gimp_bucket_fill_options_get_type (void)
79
 
{
80
 
  static GType type = 0;
81
 
 
82
 
  if (! type)
83
 
    {
84
 
      static const GTypeInfo info =
85
 
      {
86
 
        sizeof (GimpBucketFillOptionsClass),
87
 
        (GBaseInitFunc) NULL,
88
 
        (GBaseFinalizeFunc) NULL,
89
 
        (GClassInitFunc) gimp_bucket_fill_options_class_init,
90
 
        NULL,           /* class_finalize */
91
 
        NULL,           /* class_data     */
92
 
        sizeof (GimpBucketFillOptions),
93
 
        0,              /* n_preallocs    */
94
 
        (GInstanceInitFunc) NULL
95
 
      };
96
 
 
97
 
      type = g_type_register_static (GIMP_TYPE_PAINT_OPTIONS,
98
 
                                     "GimpBucketFillOptions",
99
 
                                     &info, 0);
100
 
    }
101
 
 
102
 
  return type;
103
 
}
 
72
G_DEFINE_TYPE (GimpBucketFillOptions, gimp_bucket_fill_options,
 
73
               GIMP_TYPE_PAINT_OPTIONS)
 
74
 
 
75
#define parent_class gimp_bucket_fill_options_parent_class
 
76
 
104
77
 
105
78
static void
106
79
gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *klass)
108
81
  GObjectClass         *object_class  = G_OBJECT_CLASS (klass);
109
82
  GimpToolOptionsClass *options_class = GIMP_TOOL_OPTIONS_CLASS (klass);
110
83
 
111
 
  parent_class = g_type_class_peek_parent (klass);
112
 
 
113
84
  object_class->set_property = gimp_bucket_fill_options_set_property;
114
85
  object_class->get_property = gimp_bucket_fill_options_get_property;
115
86
 
119
90
                                 "fill-mode", NULL,
120
91
                                 GIMP_TYPE_BUCKET_FILL_MODE,
121
92
                                 GIMP_FG_BUCKET_FILL,
122
 
                                 0);
 
93
                                 GIMP_PARAM_STATIC_STRINGS);
123
94
  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FILL_SELECTION,
124
95
                                    "fill-selection", NULL,
125
96
                                    FALSE,
126
 
                                    0);
 
97
                                    GIMP_PARAM_STATIC_STRINGS);
127
98
  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FILL_TRANSPARENT,
128
99
                                    "fill-transparent",
129
100
                                    N_("Allow completely transparent regions "
130
101
                                       "to be filled"),
131
102
                                    TRUE,
132
 
                                    0);
 
103
                                    GIMP_PARAM_STATIC_STRINGS);
133
104
  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SAMPLE_MERGED,
134
105
                                    "sample-merged",
135
106
                                    N_("Base filled area on all visible "
136
107
                                       "layers"),
137
108
                                    FALSE,
138
 
                                    0);
 
109
                                    GIMP_PARAM_STATIC_STRINGS);
139
110
  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_THRESHOLD,
140
111
                                   "threshold",
141
112
                                   N_("Maximum color difference"),
142
113
                                   0.0, 255.0, 15.0,
143
 
                                   0);
 
114
                                   GIMP_PARAM_STATIC_STRINGS);
 
115
  GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_FILL_CRITERION,
 
116
                                 "fill-criterion", NULL,
 
117
                                 GIMP_TYPE_SELECT_CRITERION,
 
118
                                 GIMP_SELECT_CRITERION_COMPOSITE,
 
119
                                 GIMP_PARAM_STATIC_STRINGS);
 
120
}
 
121
 
 
122
static void
 
123
gimp_bucket_fill_options_init (GimpBucketFillOptions *options)
 
124
{
144
125
}
145
126
 
146
127
static void
168
149
    case PROP_THRESHOLD:
169
150
      options->threshold = g_value_get_double (value);
170
151
      break;
 
152
    case PROP_FILL_CRITERION:
 
153
      options->fill_criterion = g_value_get_enum (value);
 
154
      break;
 
155
 
171
156
    default:
172
157
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
173
158
      break;
199
184
    case PROP_THRESHOLD:
200
185
      g_value_set_double (value, options->threshold);
201
186
      break;
 
187
    case PROP_FILL_CRITERION:
 
188
      g_value_set_enum (value, options->fill_criterion);
 
189
      break;
 
190
 
202
191
    default:
203
192
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
204
193
      break;
224
213
gimp_bucket_fill_options_gui (GimpToolOptions *tool_options)
225
214
{
226
215
  GObject   *config = G_OBJECT (tool_options);
227
 
  GtkWidget *vbox;
 
216
  GtkWidget *vbox   = gimp_paint_options_gui (tool_options);
228
217
  GtkWidget *vbox2;
229
218
  GtkWidget *table;
230
219
  GtkWidget *frame;
231
220
  GtkWidget *hbox;
232
221
  GtkWidget *button;
 
222
  GtkWidget *combo;
233
223
  gchar     *str;
234
224
 
235
 
  vbox = gimp_paint_options_gui (tool_options);
236
 
 
237
225
  /*  fill type  */
238
 
  str = g_strdup_printf (_("Fill Type  %s"),
 
226
  str = g_strdup_printf (_("Fill Type  (%s)"),
239
227
                         gimp_get_mod_string (GDK_CONTROL_MASK)),
240
228
  frame = gimp_prop_enum_radio_frame_new (config, "fill-mode", str, 0, 0);
241
229
  g_free (str);
243
231
  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
244
232
  gtk_widget_show (frame);
245
233
 
246
 
  hbox = gimp_pattern_box_new (NULL, GIMP_CONTEXT (tool_options), 2);
 
234
  hbox = gimp_prop_pattern_box_new (NULL, GIMP_CONTEXT (tool_options), 2,
 
235
                                    "pattern-view-type", "pattern-view-size");
247
236
  gimp_enum_radio_frame_add (GTK_FRAME (frame), hbox, GIMP_PATTERN_BUCKET_FILL);
248
237
 
249
238
  /*  fill selection  */
250
 
  str = g_strdup_printf (_("Affected Area  %s"),
 
239
  str = g_strdup_printf (_("Affected Area  (%s)"),
251
240
                         gimp_get_mod_string (GDK_SHIFT_MASK));
252
241
  frame = gimp_prop_boolean_radio_frame_new (config, "fill-selection",
253
242
                                             str,
254
243
                                             _("Fill whole selection"),
255
244
                                             _("Fill similar colors"));
256
245
  g_free (str);
 
246
  gtk_box_reorder_child (GTK_BOX (gtk_bin_get_child (GTK_BIN (frame))),
 
247
                         g_object_get_data (G_OBJECT (frame), "radio-button"),
 
248
                         1);
257
249
 
258
250
  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
259
251
  gtk_widget_show (frame);
285
277
  gtk_widget_show (button);
286
278
 
287
279
  /*  the threshold scale  */
288
 
  table = gtk_table_new (1, 3, FALSE);
 
280
  table = gtk_table_new (2, 3, FALSE);
289
281
  gtk_table_set_col_spacings (GTK_TABLE (table), 2);
290
282
  gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
291
283
  gtk_widget_show (table);
296
288
                             1.0, 16.0, 1,
297
289
                             FALSE, 0.0, 0.0);
298
290
 
 
291
  /*  the fill criterion combo  */
 
292
  combo = gimp_prop_enum_combo_box_new (config, "fill-criterion", 0, 0);
 
293
  gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
 
294
                             _("Fill by:"), 0.0, 0.5,
 
295
                             combo, 2, FALSE);
 
296
 
299
297
  return vbox;
300
298
}
301
299