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

« back to all changes in this revision

Viewing changes to modules/colorsel_water.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:
51
51
 
52
52
  gfloat             pressure_adjust;
53
53
  guint32            motion_time;
54
 
  gint               button_state;
55
54
};
56
55
 
57
56
struct _ColorselWaterClass
69
68
static gboolean   button_press_event        (GtkWidget          *widget,
70
69
                                             GdkEventButton     *event,
71
70
                                             ColorselWater      *water);
72
 
static gboolean   button_release_event      (GtkWidget          *widget,
73
 
                                             GdkEventButton     *event,
74
 
                                             ColorselWater      *water);
75
71
static gboolean   motion_notify_event       (GtkWidget          *widget,
76
72
                                             GdkEventMotion     *event,
77
73
                                             ColorselWater      *water);
87
83
  GIMP_MODULE_ABI_VERSION,
88
84
  N_("Watercolor style color selector"),
89
85
  "Raph Levien <raph@acm.org>, Sven Neumann <sven@gimp.org>",
90
 
  "v0.3",
91
 
  "(c) 1998-1999, released under the GPL",
92
 
  "May, 10 1999"
 
86
  "v0.4",
 
87
  "released under the GPL",
 
88
  "1998-2006"
93
89
};
94
90
 
95
91
static const GtkTargetEntry targets[] =
121
117
{
122
118
  if (! colorsel_water_type)
123
119
    {
124
 
      static const GTypeInfo select_info =
 
120
      const GTypeInfo select_info =
125
121
      {
126
122
        sizeof (ColorselWaterClass),
127
123
        (GBaseInitFunc) NULL,
176
172
 
177
173
  area = gtk_drawing_area_new ();
178
174
  gtk_container_add (GTK_CONTAINER (frame), area);
179
 
  g_signal_connect (area, "expose_event",
 
175
  g_signal_connect (area, "expose-event",
180
176
                    G_CALLBACK (select_area_expose),
181
177
                    NULL);
182
178
 
183
179
  /* Event signals */
184
 
  g_signal_connect (area, "motion_notify_event",
 
180
  g_signal_connect (area, "motion-notify-event",
185
181
                    G_CALLBACK (motion_notify_event),
186
182
                    water);
187
 
  g_signal_connect (area, "button_press_event",
 
183
  g_signal_connect (area, "button-press-event",
188
184
                    G_CALLBACK (button_press_event),
189
185
                    water);
190
 
  g_signal_connect (area, "button_release_event",
191
 
                    G_CALLBACK (button_release_event),
192
 
                    water);
193
 
  g_signal_connect (area, "proximity_out_event",
 
186
  g_signal_connect (area, "proximity-out-event",
194
187
                    G_CALLBACK (proximity_out_event),
195
188
                    water);
196
189
 
210
203
 
211
204
  adj = gtk_adjustment_new (200.0 - water->pressure_adjust * 100.0,
212
205
                            0.0, 200.0, 1.0, 1.0, 0.0);
213
 
  g_signal_connect (adj, "value_changed",
 
206
  g_signal_connect (adj, "value-changed",
214
207
                    G_CALLBACK (pressure_adjust_update),
215
208
                    water);
216
209
 
349
342
  water->last_x = event->x / widget->allocation.width;
350
343
  water->last_y = event->y / widget->allocation.height;
351
344
 
352
 
  water->button_state |= 1 << event->button;
353
 
 
354
345
  erase = (event->button != 1);
355
346
  /* FIXME: (event->source == GDK_SOURCE_ERASER) */
356
347
 
 
348
  if (event->state & GDK_SHIFT_MASK)
 
349
    erase = !erase;
 
350
 
357
351
  add_pigment (water, erase, water->last_x, water->last_y, 0.05);
358
352
 
359
353
  water->motion_time = event->time;
362
356
}
363
357
 
364
358
static gboolean
365
 
button_release_event (GtkWidget      *widget,
366
 
                      GdkEventButton *event,
367
 
                      ColorselWater  *water)
368
 
{
369
 
  water->button_state &= ~(1 << event->button);
370
 
 
371
 
  return TRUE;
372
 
}
373
 
 
374
 
static gboolean
375
359
motion_notify_event (GtkWidget      *widget,
376
360
                     GdkEventMotion *event,
377
361
                     ColorselWater  *water)
386
370
                      GDK_BUTTON3_MASK |
387
371
                      GDK_BUTTON4_MASK))
388
372
    {
389
 
      guint32 last_motion_time;
390
 
 
391
 
      last_motion_time = event->time;
 
373
      guint32 last_motion_time = event->time;
392
374
 
393
375
      erase = ((event->state &
394
376
                (GDK_BUTTON2_MASK | GDK_BUTTON3_MASK | GDK_BUTTON4_MASK)) ||
395
377
               FALSE);
396
378
      /* FIXME: (event->source == GDK_SOURCE_ERASER) */
397
379
 
 
380
      if (event->state & GDK_SHIFT_MASK)
 
381
        erase = !erase;
 
382
 
398
383
      water->motion_time = event->time;
399
384
 
400
385
      if (gdk_device_get_history (event->device,