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

« back to all changes in this revision

Viewing changes to libgimpwidgets/gimpoffsetarea.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:
40
40
};
41
41
 
42
42
 
43
 
static void      gimp_offset_area_class_init (GimpOffsetAreaClass *klass);
44
 
static void      gimp_offset_area_init       (GimpOffsetArea      *area);
45
 
 
46
 
static void      gimp_offset_area_resize        (GimpOffsetArea   *area);
47
 
static void      gimp_offset_area_size_allocate (GtkWidget        *widget,
48
 
                                                 GtkAllocation    *allocation);
49
 
static gboolean  gimp_offset_area_event         (GtkWidget        *widget,
50
 
                                                 GdkEvent         *event);
51
 
static gboolean  gimp_offset_area_expose_event  (GtkWidget        *widget,
52
 
                                                 GdkEventExpose   *eevent);
53
 
 
 
43
static void      gimp_offset_area_resize        (GimpOffsetArea *area);
 
44
static void      gimp_offset_area_size_allocate (GtkWidget      *widget,
 
45
                                                 GtkAllocation  *allocation);
 
46
static gboolean  gimp_offset_area_event         (GtkWidget      *widget,
 
47
                                                 GdkEvent       *event);
 
48
static gboolean  gimp_offset_area_expose_event  (GtkWidget      *widget,
 
49
                                                 GdkEventExpose *eevent);
 
50
 
 
51
 
 
52
G_DEFINE_TYPE (GimpOffsetArea, gimp_offset_area, GTK_TYPE_DRAWING_AREA)
 
53
 
 
54
#define parent_class gimp_offset_area_parent_class
54
55
 
55
56
static guint gimp_offset_area_signals[LAST_SIGNAL] = { 0 };
56
57
 
57
 
static GtkDrawingAreaClass *parent_class = NULL;
58
 
 
59
 
 
60
 
GType
61
 
gimp_offset_area_get_type (void)
62
 
{
63
 
  static GType area_type = 0;
64
 
 
65
 
  if (! area_type)
66
 
    {
67
 
      static const GTypeInfo area_info =
68
 
      {
69
 
        sizeof (GimpOffsetAreaClass),
70
 
        (GBaseInitFunc) NULL,
71
 
        (GBaseFinalizeFunc) NULL,
72
 
        (GClassInitFunc) gimp_offset_area_class_init,
73
 
        NULL,           /* class_finalize */
74
 
        NULL,           /* class_data     */
75
 
        sizeof (GimpOffsetArea),
76
 
        0,              /* n_preallocs    */
77
 
        (GInstanceInitFunc) gimp_offset_area_init,
78
 
      };
79
 
 
80
 
      area_type = g_type_register_static (GTK_TYPE_DRAWING_AREA,
81
 
                                          "GimpOffsetArea",
82
 
                                          &area_info, 0);
83
 
    }
84
 
 
85
 
  return area_type;
86
 
}
87
58
 
88
59
static void
89
60
gimp_offset_area_class_init (GimpOffsetAreaClass *klass)
90
61
{
91
62
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
92
63
 
93
 
  parent_class = g_type_class_peek_parent (klass);
94
 
 
95
64
  gimp_offset_area_signals[OFFSETS_CHANGED] =
96
 
    g_signal_new ("offsets_changed",
97
 
                  G_TYPE_FROM_CLASS (klass),
98
 
                  G_SIGNAL_RUN_FIRST,
99
 
                  G_STRUCT_OFFSET (GimpOffsetAreaClass, offsets_changed),
100
 
                  NULL, NULL,
101
 
                  _gimp_widgets_marshal_VOID__INT_INT,
102
 
                  G_TYPE_NONE, 2,
103
 
                  G_TYPE_INT,
104
 
                  G_TYPE_INT);
 
65
    g_signal_new ("offsets-changed",
 
66
                  G_TYPE_FROM_CLASS (klass),
 
67
                  G_SIGNAL_RUN_FIRST,
 
68
                  G_STRUCT_OFFSET (GimpOffsetAreaClass, offsets_changed),
 
69
                  NULL, NULL,
 
70
                  _gimp_widgets_marshal_VOID__INT_INT,
 
71
                  G_TYPE_NONE, 2,
 
72
                  G_TYPE_INT,
 
73
                  G_TYPE_INT);
105
74
 
106
75
  widget_class->event         = gimp_offset_area_event;
107
76
  widget_class->expose_event  = gimp_offset_area_expose_event;
185
154
 * @height: the new height
186
155
 *
187
156
 * Sets the size of the image/drawable displayed by the #GimpOffsetArea.
188
 
 * If the offsets change as a result of this change, the %offsets_changed
 
157
 * If the offsets change as a result of this change, the "offsets-changed"
189
158
 * signal is emitted.
190
159
 **/
191
160
void
235
204
 * @offset_y: the Y offset
236
205
 *
237
206
 * Sets the offsets of the image/drawable displayed by the #GimpOffsetArea.
238
 
 * It does not emit the %offsets_changed signal.
 
207
 * It does not emit the "offsets-changed" signal.
239
208
 **/
240
209
void
241
210
gimp_offset_area_set_offsets (GimpOffsetArea *area,
359
328
    {
360
329
    case GDK_BUTTON_PRESS:
361
330
      gdk_pointer_grab (widget->window, FALSE,
362
 
                        (GDK_BUTTON1_MOTION_MASK |
363
 
                         GDK_BUTTON_RELEASE_MASK),
364
 
                        NULL, NULL, event->button.time);
 
331
                        (GDK_BUTTON1_MOTION_MASK |
 
332
                         GDK_BUTTON_RELEASE_MASK),
 
333
                        NULL, NULL, event->button.time);
365
334
 
366
335
      orig_offset_x = area->offset_x;
367
336
      orig_offset_y = area->offset_y;
440
409
  if (area->orig_width > area->width || area->orig_height > area->height)
441
410
    {
442
411
       if (area->orig_width > area->width)
443
 
        {
444
 
          x = area->display_ratio_x * (area->orig_width - area->width);
445
 
          w = area->display_ratio_x * area->width;
446
 
        }
 
412
        {
 
413
          x = area->display_ratio_x * (area->orig_width - area->width);
 
414
          w = area->display_ratio_x * area->width;
 
415
        }
447
416
      else
448
 
        {
449
 
          x = -1;
450
 
          w = widget->allocation.width + 2;
451
 
        }
 
417
        {
 
418
          x = -1;
 
419
          w = widget->allocation.width + 2;
 
420
        }
452
421
 
453
422
      if (area->orig_height > area->height)
454
 
        {
455
 
          y = area->display_ratio_y * (area->orig_height - area->height);
456
 
          h = area->display_ratio_y * area->height;
457
 
        }
 
423
        {
 
424
          y = area->display_ratio_y * (area->orig_height - area->height);
 
425
          h = area->display_ratio_y * area->height;
 
426
        }
458
427
      else
459
 
        {
460
 
          y = -1;
461
 
          h = widget->allocation.height + 2;
462
 
        }
 
428
        {
 
429
          y = -1;
 
430
          h = widget->allocation.height + 2;
 
431
        }
463
432
 
464
433
      w = MAX (w, 1);
465
434
      h = MAX (h, 1);