summaryrefslogtreecommitdiff
path: root/community/gimp-refocus/refocus-gimp-preview.patch
blob: 089365dcb318da3e2cef99bbbc87a4d75d81fa9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
diff -ur src/gimppreview.c src/gimppreview.c
--- src/gimppreview.c	2008-03-17 17:20:49.000000000 -0700
+++ src/gimppreview.c	2008-03-17 17:15:51.000000000 -0700
@@ -36,18 +36,18 @@
 #include "gimppreview.h"
 
 
-static void gimp_preview_init (GimpPreview * preview);
-static void gimp_preview_class_init (GimpPreviewClass * klass);
+static void gimp_preview_init (RefocusPreview * preview);
+static void gimp_preview_class_init (RefocusPreviewClass * klass);
 
 static void gimp_preview_plus_callback (GtkWidget * widget, gpointer data);
 static void gimp_preview_minus_callback (GtkWidget * widget, gpointer data);
 static gint gimp_preview_event (GtkWidget * widget, GdkEvent * event,
                                 gpointer data);
-static void gimp_preview_recompute_sizes (GimpPreview * preview,
+static void gimp_preview_recompute_sizes (RefocusPreview * preview,
                                           gdouble newscale);
-static void gimp_preview_update_preview (GimpPreview * preview);
+static void gimp_preview_update_preview (RefocusPreview * preview);
 
-static void gimp_preview_image_set_size (GimpPreview * preview, gint width,
+static void gimp_preview_image_set_size (RefocusPreview * preview, gint width,
                                          gint height);
 static void gimp_preview_size_request (GtkWidget * widget,
                                        GtkRequisition * requisition);
@@ -58,7 +58,7 @@
                                  GtkCallback callback,
                                  gpointer callback_data);
 gboolean gimp_preview_update_preview_idle_fun (gpointer data);
-void gimp_preview_schedule_update (GimpPreview * preview);
+void gimp_preview_schedule_update (RefocusPreview * preview);
 
 #define PROGRESS_BAR_HEIGHT (10)
 #define PREVIEW_SIZE (100)
@@ -94,11 +94,11 @@
 
 
 /*
- * Apps which use a GimpPreview widget should not be accessing the private
+ * Apps which use a RefocusPreview widget should not be accessing the private
  * data!
  */
 #define PREVIEW_DATA(preview) \
-        ((GimpPreviewData*)(GIMP_PREVIEW (preview)->private_data))
+        ((RefocusPreviewData*)(GIMP_PREVIEW (preview)->private_data))
 
 typedef struct
 {
@@ -126,7 +126,7 @@
   GtkWidget *image;
   GtkWidget *progress_bar;
 }
-GimpPreviewData;
+RefocusPreviewData;
 
 
 /* Convert coordinate in preview space to image coordinates */
@@ -155,20 +155,20 @@
   if (!preview_type)
     {
       GTypeInfo preview_info = {
-        sizeof (GimpPreviewClass),
+        sizeof (RefocusPreviewClass),
         (GBaseInitFunc) NULL,
         (GBaseFinalizeFunc) NULL,
         (GClassInitFunc) gimp_preview_class_init,
         (GClassFinalizeFunc) NULL,
         (gconstpointer) NULL,   /* class_data */
-        sizeof (GimpPreview),
+        sizeof (RefocusPreview),
         0,                      /* n_preallocs */
         (GInstanceInitFunc) gimp_preview_init,
         (GTypeValueTable *) NULL /* value_table */
       };
 
       preview_type =
-        g_type_register_static (GTK_TYPE_CONTAINER, "GimpPreview",
+        g_type_register_static (GTK_TYPE_CONTAINER, "RefocusPreview",
                                 &preview_info, 0);
     }
 
@@ -181,7 +181,7 @@
  * by GTK's internal mechanisms.
  */
 static void
-gimp_preview_class_init (GimpPreviewClass * klass)
+gimp_preview_class_init (RefocusPreviewClass * klass)
 {
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
   GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
@@ -190,7 +190,7 @@
     g_signal_new ("update_preview",
                   G_TYPE_FROM_CLASS (klass),
                   G_SIGNAL_RUN_FIRST,
-                  G_STRUCT_OFFSET (GimpPreviewClass, update_preview),
+                  G_STRUCT_OFFSET (RefocusPreviewClass, update_preview),
                   NULL,
                   NULL,
                   g_cclosure_marshal_VOID__POINTER,
@@ -200,7 +200,7 @@
     g_signal_new ("preview_changed",
                   G_TYPE_FROM_CLASS (klass),
                   G_SIGNAL_RUN_FIRST,
-                  G_STRUCT_OFFSET (GimpPreviewClass, preview_changed),
+                  G_STRUCT_OFFSET (RefocusPreviewClass, preview_changed),
                   NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
 
   klass->update_preview = NULL;
@@ -212,7 +212,7 @@
 
 
 void
-gimp_preview_set_scale_amount(GimpPreview *preview, gdouble scale_amount)
+gimp_preview_set_scale_amount(RefocusPreview *preview, gdouble scale_amount)
 {
   /*
    * If the caller wants to set the scale amount, let them do so.
@@ -269,7 +269,7 @@
  * by GTK's internal mechanisms.
  */
 static void
-gimp_preview_init (GimpPreview * preview)
+gimp_preview_init (RefocusPreview * preview)
 {
   gchar buffer[10];
 
@@ -277,7 +277,7 @@
   GTK_WIDGET_SET_FLAGS (preview, GTK_NO_WINDOW);
   GTK_CONTAINER (preview)->resize_mode = GTK_RESIZE_IMMEDIATE;
 
-  preview->private_data = g_malloc0 (sizeof (GimpPreviewData));
+  preview->private_data = g_malloc0 (sizeof (RefocusPreviewData));
 
 
   PREVIEW_DATA (preview)->label = gtk_label_new ("");
@@ -307,7 +307,7 @@
 gimp_preview_new_with_args (GimpDrawable * drawable, gint cb_preview_size,
                             gdouble cb_scale_amount, gint cb_allow_scale)
 {
-  GimpPreview *preview;
+  RefocusPreview *preview;
   GtkWidget *frame;
   GtkWidget *hbox;
   GtkWidget *event_box;
@@ -454,7 +454,7 @@
 static void
 gimp_preview_size_request (GtkWidget * widget, GtkRequisition * requisition)
 {
-  GimpPreview *preview = GIMP_PREVIEW (widget);
+  RefocusPreview *preview = GIMP_PREVIEW (widget);
   GtkRequisition resize_box_requisition;
 
 #ifdef PREVIEW_DEBUG
@@ -478,7 +478,7 @@
 static void
 gimp_preview_size_allocate (GtkWidget * widget, GtkAllocation * allocation)
 {
-  GimpPreview *preview = GIMP_PREVIEW (widget);
+  RefocusPreview *preview = GIMP_PREVIEW (widget);
   GtkAllocation resize_box_allocation, progress_bar_allocation,
     event_box_allocation;
   GtkRequisition resize_box_requisition;
@@ -543,7 +543,7 @@
                      gboolean include_internals,
                      GtkCallback callback, gpointer callback_data)
 {
-  GimpPreview *preview = GIMP_PREVIEW (container);
+  RefocusPreview *preview = GIMP_PREVIEW (container);
 
   if (PREVIEW_DATA (preview)->resize_box)
     {
@@ -564,7 +564,7 @@
  * Plug-ins call this to do an update of the preview area.
  */
 void
-gimp_preview_update (GimpPreview * preview)
+gimp_preview_update (RefocusPreview * preview)
 {
   gimp_preview_recompute_sizes (preview, preview->scale);
   gimp_preview_update_preview (preview);
@@ -579,7 +579,7 @@
 static void
 gimp_preview_plus_callback (GtkWidget * widget, gpointer data)
 {
-  GimpPreview *preview;
+  RefocusPreview *preview;
   gchar buffer[10];
   gdouble new_scale;
 
@@ -616,7 +616,7 @@
 static void
 gimp_preview_minus_callback (GtkWidget * widget, gpointer data)
 {
-  GimpPreview *preview;
+  RefocusPreview *preview;
   gchar buffer[10];
   gdouble new_scale;
 
@@ -651,7 +651,7 @@
 static gint
 gimp_preview_event (GtkWidget * widget, GdkEvent * event, gpointer data)
 {
-  GimpPreview *preview;
+  RefocusPreview *preview;
   GdkEventButton *button_event;
   gint x, y;
   gint dx, dy;
@@ -733,7 +733,7 @@
  * This function is also used for initializing the preview.
  */
 static void
-gimp_preview_recompute_sizes (GimpPreview * preview, gdouble new_scale)
+gimp_preview_recompute_sizes (RefocusPreview * preview, gdouble new_scale)
 {
 
   /* The center of the preview in image coordinates.
@@ -765,7 +765,7 @@
 }
 
 void
-gimp_preview_generate_update_event (GimpPreview * preview)
+gimp_preview_generate_update_event (RefocusPreview * preview)
      /* Signal the user that the preview must be updated */
 {
   const gdouble scale = preview->scale;
@@ -783,7 +783,7 @@
            0,
            preview->drawable->height - image_y);
 
-  GimpPreviewEvent preview_event;
+  RefocusPreviewEvent preview_event;
 
   preview_event.event_id = PREVIEW_DATA (preview)->current_event_id;
   preview_event.scale = preview->scale;
@@ -814,7 +814,7 @@
  * to step through source and destination!
  */
 static void
-gimp_preview_update_preview (GimpPreview * preview)
+gimp_preview_update_preview (RefocusPreview * preview)
 {
   GimpPixelRgn region;
   guchar *image_data = NULL;
@@ -1012,7 +1012,7 @@
 
 
 void
-gimp_preview_force_redraw (GimpPreview * preview)
+gimp_preview_force_redraw (RefocusPreview * preview)
 {
   gtk_widget_queue_draw (GTK_WIDGET (PREVIEW_DATA (preview)->image));
 }
@@ -1022,7 +1022,7 @@
 gboolean
 gimp_preview_update_preview_idle_fun (gpointer data)
 {
-  GimpPreview *preview = GIMP_PREVIEW (data);
+  RefocusPreview *preview = GIMP_PREVIEW (data);
   gint event_id = PREVIEW_DATA (preview)->current_event_id;
 
 #ifdef PREVIEW_DEBUG
@@ -1041,7 +1041,7 @@
 }
 
 void
-gimp_preview_schedule_update (GimpPreview * preview)
+gimp_preview_schedule_update (RefocusPreview * preview)
 {
   PREVIEW_DATA (preview)->current_event_id++;
 
@@ -1082,7 +1082,7 @@
 }
 
 void
-gimp_preview_image_set_size (GimpPreview * preview, gint width, gint height)
+gimp_preview_image_set_size (RefocusPreview * preview, gint width, gint height)
 {
   const gint real_width = MIN (preview->max_width, width);
   const gint real_height = MIN (preview->max_height, height);
@@ -1120,8 +1120,8 @@
 
 /**
  * gimp_preview_draw_row:
- * @preview: the #GimpPreview
- * @event_id: event_id that was sent with the #GimpPreviewEvent.
+ * @preview: the #RefocusPreview
+ * @event_id: event_id that was sent with the #RefocusPreviewEvent.
  * @type: the format of the data (e.g. %GIMP_RGBA_IMAGE).
  * @row:the relative number of the row within the preview.
  * The top row of the preview is number 0.
@@ -1137,7 +1137,7 @@
  * with the same event-id will be ignored by the preview.
  **/
 gboolean
-gimp_preview_draw_row (GimpPreview * preview, const gint event_id,
+gimp_preview_draw_row (RefocusPreview * preview, const gint event_id,
                        GimpImageType type, gint row,
                        const guchar * const data)
 {
@@ -1247,8 +1247,8 @@
 
 /**
  * gimp_preview_draw_unscaled_row:
- * @preview: the #GimpPreview
- * @event_id: event_id that was sent with the #GimpPreviewEvent.
+ * @preview: the #RefocusPreview
+ * @event_id: event_id that was sent with the #RefocusPreviewEvent.
  * @type: the format of the data (e.g. %GIMP_RGBA_IMAGE).
  * @row:row is the relative position of the row w.r.t. preview_event->image_y.
  * The top row has number 0.
@@ -1267,7 +1267,7 @@
  * with the same event-id will be ignored by the preview.
  **/
 gboolean
-gimp_preview_draw_unscaled_row (GimpPreview * preview, const gint event_id,
+gimp_preview_draw_unscaled_row (RefocusPreview * preview, const gint event_id,
                                 GimpImageType type, const gint row,
                                 const guchar * const data)
 {
@@ -1445,8 +1445,8 @@
 
 /**
  * gimp_preview_progress_set_fraction:
- * @preview: the #GimpPreview.
- * @event_id: event_id that was sent with the #GimpPreviewEvent.
+ * @preview: the #RefocusPreview.
+ * @event_id: event_id that was sent with the #RefocusPreviewEvent.
  * @fraction: the fraction completed.
  *
  * Set the progress bar of the preview to @fraction completed.
@@ -1456,7 +1456,7 @@
  * with the same event-id will be ignored by the preview.
  **/
 gboolean
-gimp_preview_progress_set_fraction (GimpPreview * preview,
+gimp_preview_progress_set_fraction (RefocusPreview * preview,
                                     const gint event_id, double fraction)
 {
   const gboolean return_status =
diff -ur src/gimppreview.h src/gimppreview.h
--- src/gimppreview.h	2003-01-30 13:30:18.000000000 -0800
+++ src/gimppreview.h	2008-03-17 17:16:29.000000000 -0700
@@ -33,24 +33,24 @@
 #define PREVIEW_FIXED_SIZE           0
 #define PREVIEW_DEFAULT_SIZE         -1
 #define GIMP_TYPE_PREVIEW            (gimp_preview_get_type ())
-#define GIMP_PREVIEW(obj)            (GTK_CHECK_CAST ((obj), GIMP_TYPE_PREVIEW, GimpPreview))
-#define GIMP_PREVIEW_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PREVIEW, GimpPreviewClass))
+#define GIMP_PREVIEW(obj)            (GTK_CHECK_CAST ((obj), GIMP_TYPE_PREVIEW, RefocusPreview))
+#define GIMP_PREVIEW_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PREVIEW, RefocusPreviewClass))
 #define GIMP_IS_PREVIEW(obj)         (GTK_CHECK_TYPE ((obj), GIMP_TYPE_PREVIEW))
 #define GIMP_IS_PREVIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PREVIEW))
-typedef struct _GimpPreview GimpPreview;
-typedef struct _GimpPreviewClass GimpPreviewClass;
-typedef struct _GimpPreviewEvent GimpPreviewEvent;
+typedef struct _RefocusPreview RefocusPreview;
+typedef struct _RefocusPreviewClass RefocusPreviewClass;
+typedef struct _RefocusPreviewEvent RefocusPreviewEvent;
 
-struct _GimpPreviewClass
+struct _RefocusPreviewClass
 {
   GtkContainerClass parent_class;
 
-  void (*update_preview) (GimpPreview * preview, GimpPreviewEvent * event);
-  void (*preview_changed) (GimpPreview * preview);
+  void (*update_preview) (RefocusPreview * preview, RefocusPreviewEvent * event);
+  void (*preview_changed) (RefocusPreview * preview);
 };
 
 
-struct _GimpPreview
+struct _RefocusPreview
 {
   GtkContainer parent;
 
@@ -75,13 +75,13 @@
 };
 
 /**
- * GimpPreviewEvent:
+ * RefocusPreviewEvent:
  * @event_id: Id of this event. This is needed for gimp_preview_draw_row,
  * gimp_preview_draw_unscaled_row and gimp_preview_progress_set_fraction.
  * @scale: Current scale of the preview.
  *
  **/
-struct _GimpPreviewEvent
+struct _RefocusPreviewEvent
 {
   gint event_id;                /* Id of this event */
   gdouble scale;                /* Scale of preview */
@@ -113,20 +113,20 @@
                                        gint preview_size,
                                        gdouble scale_amount,
                                        gint allow_scale);
-void gimp_preview_update (GimpPreview * preview);
+void gimp_preview_update (RefocusPreview * preview);
 
-gboolean gimp_preview_draw_row (GimpPreview * preview, const gint event_id,
+gboolean gimp_preview_draw_row (RefocusPreview * preview, const gint event_id,
                                 GimpImageType type, const gint row,
                                 const guchar * const data);
 
-gboolean gimp_preview_draw_unscaled_row (GimpPreview * preview,
+gboolean gimp_preview_draw_unscaled_row (RefocusPreview * preview,
                                          const gint event_id,
                                          GimpImageType type, const gint row,
                                          const guchar * const data);
 
-void gimp_preview_force_redraw (GimpPreview * preview);
+void gimp_preview_force_redraw (RefocusPreview * preview);
 
-gboolean gimp_preview_progress_set_fraction (GimpPreview * preview,
+gboolean gimp_preview_progress_set_fraction (RefocusPreview * preview,
                                              const gint event_id,
                                              double fraction);
 
diff -ur src/refocus.c src/refocus.c
--- src/refocus.c	2008-03-17 17:20:49.000000000 -0700
+++ src/refocus.c	2008-03-17 17:18:48.000000000 -0700
@@ -25,6 +25,7 @@
 #include <time.h>
 #include <string.h>
 #include <libgimp/gimp.h>
+#include <libgimp/gimpcompat.h>
 #include <gtk/gtk.h>
 #include <sys/types.h>
 #include <signal.h>
@@ -372,7 +373,7 @@
 }
 
 static void
-preview_callback (GtkWidget * widget, GimpPreviewEvent * event, gpointer data)
+preview_callback (GtkWidget * widget, RefocusPreviewEvent * event, gpointer data)
 {
   TileSource source;
   TileSink sink;