Commit 3eb00e03 authored by David Odin's avatar David Odin

added a new function to set the default cursor on preview:

* libgimpwidgets/gimppreview.[ch]: added a new function to set the
  default cursor on preview: gimp_preview_set_default_cursor().

* libgimpwidgets/gimpscrolledpreview.c: changed accordlingly.

* plug-ins/common/flarefx.c:
* plug-ins/common/nova.c: use this function.

This addresses bug #90519.
parent e31b8f6a
2004-10-13 DindinX <dindinx@gimp.org>
* libgimpwidgets/gimppreview.[ch]: added a new function to set the
default cursor on preview: gimp_preview_set_default_cursor().
* libgimpwidgets/gimpscrolledpreview.c: changed accordlingly.
* plug-ins/common/flarefx.c:
* plug-ins/common/nova.c: use this function.
This addresses bug #90519.
2004-10-13 DindinX <dindinx@gimp.org>
* plug-ins/common/cubism.c: Added a preview and done some cleanups.
......
......@@ -185,15 +185,17 @@ gimp_preview_init (GimpPreview *preview)
gtk_container_add (GTK_CONTAINER (preview->frame), preview->table);
gtk_widget_show (preview->table);
preview->timeout_id = 0;
preview->timeout_id = 0;
preview->xmin = preview->ymin = 0;
preview->xmax = preview->ymax = 1;
preview->width = preview->xmax - preview->xmin;
preview->height = preview->ymax - preview->ymin;
preview->xmin = preview->ymin = 0;
preview->xmax = preview->ymax = 1;
preview->width = preview->xmax - preview->xmin;
preview->height = preview->ymax - preview->ymin;
preview->xoff = 0;
preview->yoff = 0;
preview->xoff = 0;
preview->yoff = 0;
preview->default_cursor = NULL;
/* preview area */
frame = gtk_frame_new (NULL);
......@@ -453,7 +455,8 @@ gimp_preview_invalidate_now (GimpPreview *preview)
static void
gimp_preview_set_cursor (GimpPreview *preview)
{
gdk_window_set_cursor (preview->area->window, NULL);
gdk_window_set_cursor (preview->area->window,
preview->default_cursor);
}
/**
......@@ -572,7 +575,7 @@ gimp_preview_get_position (GimpPreview *preview,
*y = preview->yoff + GIMP_PREVIEW (preview)->ymin;
}
/*
/**
* gimp_preview_draw:
* @preview: a #GimpPreview widget
*
......@@ -594,7 +597,7 @@ gimp_preview_draw (GimpPreview *preview)
class->draw (preview);
}
/*
/**
* gimp_preview_draw_buffer:
* @preview: a #GimpPreview widget
* @buffer: a pixel buffer the size of the preview
......@@ -617,7 +620,7 @@ gimp_preview_draw_buffer (GimpPreview *preview,
class->draw_buffer (preview, buffer, rowstride);
}
/*
/**
* gimp_preview_invalidate:
* @preview: a #GimpPreview widget
*
......@@ -649,3 +652,30 @@ gimp_preview_invalidate (GimpPreview *preview)
preview, NULL);
}
}
/**
* gimp_preview_set_default_cursor:
* @preview: a #GimpPreview widget
* @cursor: a #GdkCursor or NULL
*
* Sets the default mouse cursor for the preview. Note that this will be
* overriden by a GDK_FLEUR if the preview has scrollbars, or by a GDK_WATCH
* when the preview is invalidated.
*
* Since: GIMP 2.2
**/
void
gimp_preview_set_default_cursor (GimpPreview *preview,
GdkCursor *cursor)
{
g_return_if_fail (GIMP_IS_PREVIEW (preview));
if (preview->default_cursor)
gdk_cursor_unref (preview->default_cursor);
if (cursor)
gdk_cursor_ref (cursor);
preview->default_cursor = cursor;
}
......@@ -52,6 +52,7 @@ struct _GimpPreview
GtkWidget *frame;
GtkWidget *toggle;
GdkCursor *cursor_busy;
GdkCursor *default_cursor;
/*< private >*/
gint xoff, yoff;
......@@ -81,31 +82,34 @@ struct _GimpPreviewClass
};
GType gimp_preview_get_type (void) G_GNUC_CONST;
GType gimp_preview_get_type (void) G_GNUC_CONST;
void gimp_preview_set_update (GimpPreview *preview,
gboolean update);
gboolean gimp_preview_get_update (GimpPreview *preview);
void gimp_preview_set_update (GimpPreview *preview,
gboolean update);
gboolean gimp_preview_get_update (GimpPreview *preview);
void gimp_preview_set_bounds (GimpPreview *preview,
gint xmin,
gint ymin,
gint xmax,
gint ymax);
void gimp_preview_set_bounds (GimpPreview *preview,
gint xmin,
gint ymin,
gint xmax,
gint ymax);
void gimp_preview_get_position (GimpPreview *preview,
gint *x,
gint *y);
void gimp_preview_get_size (GimpPreview *preview,
gint *width,
gint *height);
void gimp_preview_get_position (GimpPreview *preview,
gint *x,
gint *y);
void gimp_preview_get_size (GimpPreview *preview,
gint *width,
gint *height);
void gimp_preview_draw (GimpPreview *preview);
void gimp_preview_draw_buffer (GimpPreview *preview,
const guchar *buffer,
gint rowstride);
void gimp_preview_draw (GimpPreview *preview);
void gimp_preview_draw_buffer (GimpPreview *preview,
const guchar *buffer,
gint rowstride);
void gimp_preview_invalidate (GimpPreview *preview);
void gimp_preview_invalidate (GimpPreview *preview);
void gimp_preview_set_default_cursor (GimpPreview *preview,
GdkCursor *cursor);
G_END_DECLS
......
......@@ -231,7 +231,7 @@ gimp_scrolled_preview_area_size_allocate (GtkWidget *widget,
GtkAllocation *allocation,
GimpScrolledPreview *preview)
{
GdkCursor *cursor = NULL;
GdkCursor *cursor = GIMP_PREVIEW (preview)->default_cursor;
gint width = GIMP_PREVIEW (preview)->xmax - GIMP_PREVIEW (preview)->xmin;
gint height = GIMP_PREVIEW (preview)->ymax - GIMP_PREVIEW (preview)->ymin;
......@@ -627,6 +627,6 @@ gimp_scrolled_preview_set_cursor (GimpPreview *preview)
}
else
{
gdk_window_set_cursor (preview->area->window, NULL);
gdk_window_set_cursor (preview->area->window, preview->default_cursor);
}
}
......@@ -890,7 +890,7 @@ flare_center_cursor_update (FlareCenter *center)
}
/*
* Set the preview area'a cursor on realize
* Set the preview area's cursor on realize
*/
static void
flare_center_preview_realize (GtkWidget *widget,
......@@ -899,7 +899,7 @@ flare_center_preview_realize (GtkWidget *widget,
GdkDisplay *display = gtk_widget_get_display (widget);
GdkCursor *cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
gdk_window_set_cursor (widget->window, cursor);
gimp_preview_set_default_cursor (center->preview, cursor);
gdk_cursor_unref (cursor);
}
......
......@@ -589,7 +589,7 @@ nova_center_preview_realize (GtkWidget *widget,
GdkDisplay *display = gtk_widget_get_display (widget);
GdkCursor *cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
gdk_window_set_cursor (widget->window, cursor);
gimp_preview_set_default_cursor (center->preview, cursor);
gdk_cursor_unref (cursor);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment