PKGBUILDs/extra/gimp-refocus/refocus-gimp-preview.patch
2009-10-09 21:23:22 -05:00

440 lines
15 KiB
Diff

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;