43
static void gimp_offset_area_class_init (GimpOffsetAreaClass *klass);
44
static void gimp_offset_area_init (GimpOffsetArea *area);
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,
51
static gboolean gimp_offset_area_expose_event (GtkWidget *widget,
52
GdkEventExpose *eevent);
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,
48
static gboolean gimp_offset_area_expose_event (GtkWidget *widget,
49
GdkEventExpose *eevent);
52
G_DEFINE_TYPE (GimpOffsetArea, gimp_offset_area, GTK_TYPE_DRAWING_AREA)
54
#define parent_class gimp_offset_area_parent_class
55
56
static guint gimp_offset_area_signals[LAST_SIGNAL] = { 0 };
57
static GtkDrawingAreaClass *parent_class = NULL;
61
gimp_offset_area_get_type (void)
63
static GType area_type = 0;
67
static const GTypeInfo area_info =
69
sizeof (GimpOffsetAreaClass),
71
(GBaseFinalizeFunc) NULL,
72
(GClassInitFunc) gimp_offset_area_class_init,
73
NULL, /* class_finalize */
74
NULL, /* class_data */
75
sizeof (GimpOffsetArea),
77
(GInstanceInitFunc) gimp_offset_area_init,
80
area_type = g_type_register_static (GTK_TYPE_DRAWING_AREA,
89
60
gimp_offset_area_class_init (GimpOffsetAreaClass *klass)
91
62
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
93
parent_class = g_type_class_peek_parent (klass);
95
64
gimp_offset_area_signals[OFFSETS_CHANGED] =
96
g_signal_new ("offsets_changed",
97
G_TYPE_FROM_CLASS (klass),
99
G_STRUCT_OFFSET (GimpOffsetAreaClass, offsets_changed),
101
_gimp_widgets_marshal_VOID__INT_INT,
65
g_signal_new ("offsets-changed",
66
G_TYPE_FROM_CLASS (klass),
68
G_STRUCT_OFFSET (GimpOffsetAreaClass, offsets_changed),
70
_gimp_widgets_marshal_VOID__INT_INT,
106
75
widget_class->event = gimp_offset_area_event;
107
76
widget_class->expose_event = gimp_offset_area_expose_event;
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);
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)
442
411
if (area->orig_width > area->width)
444
x = area->display_ratio_x * (area->orig_width - area->width);
445
w = area->display_ratio_x * area->width;
413
x = area->display_ratio_x * (area->orig_width - area->width);
414
w = area->display_ratio_x * area->width;
450
w = widget->allocation.width + 2;
419
w = widget->allocation.width + 2;
453
422
if (area->orig_height > area->height)
455
y = area->display_ratio_y * (area->orig_height - area->height);
456
h = area->display_ratio_y * area->height;
424
y = area->display_ratio_y * (area->orig_height - area->height);
425
h = area->display_ratio_y * area->height;
461
h = widget->allocation.height + 2;
430
h = widget->allocation.height + 2;