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

« back to all changes in this revision

Viewing changes to app/tools/gimpvectoroptions.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
 * gimpvectoroptions.c
23
23
 
24
24
#include <gtk/gtk.h>
25
25
 
 
26
#include "libgimpconfig/gimpconfig.h"
26
27
#include "libgimpwidgets/gimpwidgets.h"
27
28
 
28
29
#include "tools-types.h"
29
30
 
30
 
#include "config/gimpconfig-params.h"
31
 
 
32
 
#include "core/gimptoolinfo.h"
33
 
 
34
31
#include "widgets/gimphelp-ids.h"
35
 
#include "widgets/gimppropwidgets.h"
36
32
#include "widgets/gimpwidgets-utils.h"
37
33
 
38
34
#include "gimpvectoroptions.h"
49
45
};
50
46
 
51
47
 
52
 
static void   gimp_vector_options_class_init (GimpVectorOptionsClass *options_class);
53
 
 
54
 
static void   gimp_vector_options_set_property (GObject         *object,
55
 
                                                guint            property_id,
56
 
                                                const GValue    *value,
57
 
                                                GParamSpec      *pspec);
58
 
static void   gimp_vector_options_get_property (GObject         *object,
59
 
                                                guint            property_id,
60
 
                                                GValue          *value,
61
 
                                                GParamSpec      *pspec);
62
 
 
63
 
 
64
 
static GimpToolOptionsClass *parent_class = NULL;
65
 
 
66
 
 
67
 
GType
68
 
gimp_vector_options_get_type (void)
69
 
{
70
 
  static GType type = 0;
71
 
 
72
 
  if (! type)
73
 
    {
74
 
      static const GTypeInfo info =
75
 
      {
76
 
        sizeof (GimpVectorOptionsClass),
77
 
        (GBaseInitFunc) NULL,
78
 
        (GBaseFinalizeFunc) NULL,
79
 
        (GClassInitFunc) gimp_vector_options_class_init,
80
 
        NULL,           /* class_finalize */
81
 
        NULL,           /* class_data     */
82
 
        sizeof (GimpVectorOptions),
83
 
        0,              /* n_preallocs    */
84
 
        (GInstanceInitFunc) NULL
85
 
      };
86
 
 
87
 
      type = g_type_register_static (GIMP_TYPE_TOOL_OPTIONS,
88
 
                                     "GimpVectorOptions",
89
 
                                     &info, 0);
90
 
    }
91
 
 
92
 
  return type;
93
 
}
 
48
static void   gimp_vector_options_set_property (GObject      *object,
 
49
                                                guint         property_id,
 
50
                                                const GValue *value,
 
51
                                                GParamSpec   *pspec);
 
52
static void   gimp_vector_options_get_property (GObject      *object,
 
53
                                                guint         property_id,
 
54
                                                GValue       *value,
 
55
                                                GParamSpec   *pspec);
 
56
 
 
57
 
 
58
G_DEFINE_TYPE (GimpVectorOptions, gimp_vector_options, GIMP_TYPE_TOOL_OPTIONS)
 
59
 
94
60
 
95
61
static void
96
62
gimp_vector_options_class_init (GimpVectorOptionsClass *klass)
97
63
{
98
64
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
99
65
 
100
 
  parent_class = g_type_class_peek_parent (klass);
101
 
 
102
66
  object_class->set_property = gimp_vector_options_set_property;
103
67
  object_class->get_property = gimp_vector_options_get_property;
104
68
 
106
70
                                 "vectors-edit-mode", NULL,
107
71
                                 GIMP_TYPE_VECTOR_MODE,
108
72
                                 GIMP_VECTOR_MODE_DESIGN,
109
 
                                 0);
 
73
                                 GIMP_PARAM_STATIC_STRINGS);
110
74
 
111
75
  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VECTORS_POLYGONAL,
112
76
                                    "vectors-polygonal",
113
77
                                    N_("Restrict editing to polygons"),
114
78
                                    FALSE,
115
 
                                    0);
 
79
                                    GIMP_PARAM_STATIC_STRINGS);
 
80
}
 
81
 
 
82
static void
 
83
gimp_vector_options_init (GimpVectorOptions *options)
 
84
{
116
85
}
117
86
 
118
87
static void
160
129
    }
161
130
}
162
131
 
 
132
static void
 
133
button_append_modifier (GtkWidget       *button,
 
134
                        GdkModifierType  modifiers)
 
135
{
 
136
  gchar *str = g_strdup_printf ("%s (%s)",
 
137
                                gtk_button_get_label (GTK_BUTTON (button)),
 
138
                                gimp_get_mod_string (modifiers));
 
139
 
 
140
  gtk_button_set_label (GTK_BUTTON (button), str);
 
141
  g_free (str);
 
142
}
163
143
 
164
144
GtkWidget *
165
145
gimp_vector_options_gui (GimpToolOptions *tool_options)
166
146
{
167
 
  GObject   *config = G_OBJECT (tool_options);
168
 
  GtkWidget *vbox;
169
 
  GtkWidget *frame;
170
 
  GtkWidget *button;
171
 
  gchar     *str;
172
 
 
173
 
  vbox = gimp_tool_options_gui (tool_options);
 
147
  GObject           *config  = G_OBJECT (tool_options);
 
148
  GimpVectorOptions *options = GIMP_VECTOR_OPTIONS (tool_options);
 
149
  GtkWidget         *vbox    = gimp_tool_options_gui (tool_options);
 
150
  GtkWidget         *frame;
 
151
  GtkWidget         *button;
 
152
  gchar             *str;
174
153
 
175
154
  /*  tool toggle  */
176
155
  frame = gimp_prop_enum_radio_frame_new (config, "vectors-edit-mode",
178
157
  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
179
158
  gtk_widget_show (frame);
180
159
 
 
160
  button = g_object_get_data (G_OBJECT (frame), "radio-button");
 
161
 
 
162
  if (GTK_IS_RADIO_BUTTON (button))
 
163
    {
 
164
      GSList *list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
 
165
 
 
166
      /* GIMP_VECTOR_MODE_MOVE  */
 
167
      button_append_modifier (list->data, GDK_MOD1_MASK);
 
168
 
 
169
      if (list->next)   /* GIMP_VECTOR_MODE_EDIT  */
 
170
        button_append_modifier (list->next->data, GDK_CONTROL_MASK);
 
171
    }
 
172
 
181
173
  button = gimp_prop_check_button_new (config, "vectors-polygonal",
182
174
                                       _("Polygonal"));
183
175
  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
193
185
                                              GDK_CONTROL_MASK));
194
186
 
195
187
  button = gimp_button_new ();
196
 
  gtk_button_set_label (GTK_BUTTON (button), _("Create selection from path"));
 
188
  gtk_button_set_label (GTK_BUTTON (button), _("Create Selection from Path"));
197
189
  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
198
190
  gtk_widget_set_sensitive (button, FALSE);
199
191
  gimp_help_set_help_data (button, str, GIMP_HELP_PATH_SELECTION_REPLACE);
201
193
 
202
194
  g_free (str);
203
195
 
204
 
  g_object_set_data (G_OBJECT (tool_options),
205
 
                     "gimp-vectors-to-selection", button);
 
196
  options->to_selection_button = button;
206
197
 
207
 
  button = gtk_button_new_with_label (_("Stroke path"));
 
198
  button = gtk_button_new_with_label (_("Stroke Path"));
208
199
  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
209
200
  gtk_widget_set_sensitive (button, FALSE);
210
201
  gimp_help_set_help_data (button, NULL, GIMP_HELP_PATH_STROKE);
211
202
  gtk_widget_show (button);
212
203
 
213
 
  g_object_set_data (G_OBJECT (tool_options),
214
 
                     "gimp-stroke-vectors", button);
 
204
  options->stroke_button = button;
215
205
 
216
206
  return vbox;
217
207
}