mirror of https://github.com/GNOME/gimp.git
libgimpwidgets/gimppreview.c renamed the "updated" signal to "invalidated"
* libgimpwidgets/gimppreview.c * libgimpwidgets/gimppreview.h: renamed the "updated" signal to "invalidated" and the confusing "update" virtual function to "draw". Renamed the property with saner names, too. Removed _get_width and _get_height functions in favor of a _get_size on. Added a gimp_preview_invalidate function that emit the "invalidated" signal if needed. * libgimp/gimpdrawablepreview.c * libgimp/gimpdrawablepreview.h: modified accordingly and fixed the scrollbar range. * plug-ins/common/despeckle.c * plug-ins/common/gauss.c * plug-ins/common/neon.c * plug-ins/common/sobel.c * plug-ins/common/softglow.c * plug-ins/common/spread.c * plug-ins/common/unsharp.c: modified accordingly.
This commit is contained in:
parent
111c6af7bc
commit
06c4f31bb7
26
ChangeLog
26
ChangeLog
|
@ -1,3 +1,29 @@
|
|||
2004-08-31 DindinX <david@dindinx.org>
|
||||
|
||||
* libgimpwidgets/gimppreview.c
|
||||
* libgimpwidgets/gimppreview.h: renamed the "updated" signal to
|
||||
"invalidated" and the confusing "update" virtual function to "draw".
|
||||
|
||||
Renamed the property with saner names, too.
|
||||
|
||||
Removed _get_width and _get_height functions in favor of a _get_size
|
||||
on.
|
||||
|
||||
Added a gimp_preview_invalidate function that emit the "invalidated"
|
||||
signal if needed.
|
||||
|
||||
* libgimp/gimpdrawablepreview.c
|
||||
* libgimp/gimpdrawablepreview.h: modified accordingly and fixed the
|
||||
scrollbar range.
|
||||
|
||||
* plug-ins/common/despeckle.c
|
||||
* plug-ins/common/gauss.c
|
||||
* plug-ins/common/neon.c
|
||||
* plug-ins/common/sobel.c
|
||||
* plug-ins/common/softglow.c
|
||||
* plug-ins/common/spread.c
|
||||
* plug-ins/common/unsharp.c: modified accordingly.
|
||||
|
||||
2004-08-31 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* plug-ins/script-fu/script-fu-scripts.c: removed the script title
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
|
||||
#define PREVIEW_SIZE (128)
|
||||
|
||||
static void gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass);
|
||||
static void gimp_drawable_preview_update (GimpPreview *preview);
|
||||
static void gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass);
|
||||
static void gimp_drawable_preview_draw_original (GimpPreview *preview);
|
||||
|
||||
|
||||
static GimpPreviewClass *parent_class = NULL;
|
||||
|
@ -76,11 +76,11 @@ gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass)
|
|||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
preview_class->update = gimp_drawable_preview_update;
|
||||
preview_class->draw = gimp_drawable_preview_draw_original;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_preview_update (GimpPreview *preview)
|
||||
gimp_drawable_preview_draw_original (GimpPreview *preview)
|
||||
{
|
||||
GimpDrawablePreview *drawable_preview = GIMP_DRAWABLE_PREVIEW (preview);
|
||||
GimpDrawable *drawable = drawable_preview->drawable;
|
||||
|
@ -153,12 +153,12 @@ gimp_drawable_preview_new (GimpDrawable *drawable)
|
|||
1.0,
|
||||
MIN (preview->width, sel_width));
|
||||
gtk_range_set_range (GTK_RANGE (preview->hscr),
|
||||
0, sel_width-1);
|
||||
0, sel_width - preview->width - 1);
|
||||
gtk_range_set_increments (GTK_RANGE (preview->vscr),
|
||||
1.0,
|
||||
MIN (preview->height, sel_height));
|
||||
gtk_range_set_range (GTK_RANGE (preview->vscr),
|
||||
0, sel_height-1);
|
||||
0, sel_height - preview->height - 1);
|
||||
|
||||
gtk_widget_set_size_request (preview->area,
|
||||
preview->width, preview->height);
|
||||
|
@ -189,8 +189,8 @@ gimp_drawable_preview_new_with_toggle (GimpDrawable *drawable,
|
|||
g_return_val_if_fail (toggle != NULL, NULL);
|
||||
|
||||
drawable_preview = g_object_new (GIMP_TYPE_DRAWABLE_PREVIEW,
|
||||
"show_toggle_preview", TRUE,
|
||||
"update_preview", *toggle,
|
||||
"show_update_toggle", TRUE,
|
||||
"update", *toggle,
|
||||
NULL);
|
||||
|
||||
drawable_preview->drawable = drawable;
|
||||
|
@ -209,12 +209,12 @@ gimp_drawable_preview_new_with_toggle (GimpDrawable *drawable,
|
|||
1.0,
|
||||
MIN (preview->width, sel_width));
|
||||
gtk_range_set_range (GTK_RANGE (preview->hscr),
|
||||
0, sel_width-1);
|
||||
0, sel_width -preview->width - 1);
|
||||
gtk_range_set_increments (GTK_RANGE (preview->vscr),
|
||||
1.0,
|
||||
MIN (preview->height, sel_height));
|
||||
gtk_range_set_range (GTK_RANGE (preview->vscr),
|
||||
0, sel_height-1);
|
||||
0, sel_height - preview->height - 1);
|
||||
|
||||
gtk_widget_set_size_request (preview->area,
|
||||
preview->width, preview->height);
|
||||
|
|
|
@ -43,6 +43,7 @@ typedef struct _GimpDrawablePreviewClass GimpDrawablePreviewClass;
|
|||
struct _GimpDrawablePreview
|
||||
{
|
||||
GimpPreview parent_instance;
|
||||
|
||||
GimpDrawable *drawable;
|
||||
};
|
||||
|
||||
|
|
|
@ -35,15 +35,15 @@
|
|||
|
||||
enum
|
||||
{
|
||||
UPDATED,
|
||||
INVALIDATED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_UPDATE_PREVIEW,
|
||||
PROP_SHOW_TOGGLE_PREVIEW
|
||||
PROP_UPDATE,
|
||||
PROP_SHOW_UPDATE_TOGGLE
|
||||
};
|
||||
|
||||
static void gimp_preview_class_init (GimpPreviewClass *klass);
|
||||
|
@ -57,11 +57,11 @@ static void gimp_preview_set_property (GObject *object,
|
|||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void gimp_preview_emit_updated (GimpPreview *preview);
|
||||
static void gimp_preview_emit_invalidated (GimpPreview *preview);
|
||||
static gboolean gimp_preview_button_release (GtkWidget *hs,
|
||||
GdkEventButton *ev,
|
||||
GimpPreview *preview);
|
||||
static void gimp_preview_update (GimpPreview *preview);
|
||||
static void gimp_preview_draw (GimpPreview *preview);
|
||||
static void gimp_preview_area_size_allocate (GimpPreview *preview);
|
||||
static void gimp_preview_h_scroll (GtkAdjustment *hadj,
|
||||
GimpPreview *preview);
|
||||
|
@ -114,31 +114,31 @@ gimp_preview_class_init (GimpPreviewClass *klass)
|
|||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
preview_signals[UPDATED] =
|
||||
g_signal_new ("updated",
|
||||
preview_signals[INVALIDATED] =
|
||||
g_signal_new ("invalidated",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GimpPreviewClass, updated),
|
||||
G_STRUCT_OFFSET (GimpPreviewClass, invalidated),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
klass->update = NULL;
|
||||
klass->draw = NULL;
|
||||
|
||||
object_class->get_property = gimp_preview_get_property;
|
||||
object_class->set_property = gimp_preview_set_property;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_UPDATE_PREVIEW,
|
||||
g_param_spec_boolean ("update_preview",
|
||||
PROP_UPDATE,
|
||||
g_param_spec_boolean ("update",
|
||||
NULL, NULL,
|
||||
TRUE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_SHOW_TOGGLE_PREVIEW,
|
||||
g_param_spec_boolean ("show_toggle_preview",
|
||||
PROP_SHOW_UPDATE_TOGGLE,
|
||||
g_param_spec_boolean ("show_update_toggle",
|
||||
NULL, NULL,
|
||||
FALSE,
|
||||
G_PARAM_READWRITE |
|
||||
|
@ -253,11 +253,11 @@ gimp_preview_get_property (GObject *object,
|
|||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_UPDATE_PREVIEW:
|
||||
case PROP_UPDATE:
|
||||
g_value_set_boolean (value, preview->update_preview);
|
||||
break;
|
||||
|
||||
case PROP_SHOW_TOGGLE_PREVIEW:
|
||||
case PROP_SHOW_UPDATE_TOGGLE:
|
||||
g_value_set_boolean (value, GTK_WIDGET_VISIBLE (preview->toggle_update));
|
||||
break;
|
||||
|
||||
|
@ -277,12 +277,12 @@ gimp_preview_set_property (GObject *object,
|
|||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_UPDATE_PREVIEW:
|
||||
case PROP_UPDATE:
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (preview->toggle_update),
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_SHOW_TOGGLE_PREVIEW:
|
||||
case PROP_SHOW_UPDATE_TOGGLE:
|
||||
if (g_value_get_boolean (value))
|
||||
gtk_widget_show (preview->toggle_update);
|
||||
else
|
||||
|
@ -295,15 +295,6 @@ gimp_preview_set_property (GObject *object,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_preview_emit_updated (GimpPreview *preview)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_PREVIEW (preview));
|
||||
|
||||
if (preview->update_preview)
|
||||
g_signal_emit (preview, preview_signals[UPDATED], 0);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_preview_button_release (GtkWidget *hs,
|
||||
GdkEventButton *ev,
|
||||
|
@ -311,13 +302,13 @@ gimp_preview_button_release (GtkWidget *hs,
|
|||
{
|
||||
g_return_val_if_fail (GIMP_IS_PREVIEW (preview), FALSE);
|
||||
|
||||
gimp_preview_emit_updated (preview);
|
||||
gimp_preview_invalidate (preview);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_preview_update (GimpPreview *preview)
|
||||
gimp_preview_draw (GimpPreview *preview)
|
||||
{
|
||||
GimpPreviewClass *class;
|
||||
|
||||
|
@ -325,8 +316,8 @@ gimp_preview_update (GimpPreview *preview)
|
|||
|
||||
class = GIMP_PREVIEW_GET_CLASS (preview);
|
||||
|
||||
if (class->update)
|
||||
class->update (preview);
|
||||
if (class->draw)
|
||||
class->draw (preview);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -334,8 +325,8 @@ gimp_preview_area_size_allocate (GimpPreview *preview)
|
|||
{
|
||||
g_return_if_fail (GIMP_IS_PREVIEW (preview));
|
||||
|
||||
gimp_preview_update (preview);
|
||||
gimp_preview_emit_updated (preview);
|
||||
gimp_preview_draw (preview);
|
||||
gimp_preview_invalidate (preview);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -346,7 +337,7 @@ gimp_preview_h_scroll (GtkAdjustment *hadj, GimpPreview *preview)
|
|||
preview->xoff = hadj->value;
|
||||
|
||||
if (!preview->in_drag)
|
||||
gimp_preview_update (preview);
|
||||
gimp_preview_draw (preview);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -357,7 +348,7 @@ gimp_preview_v_scroll (GtkAdjustment *vadj, GimpPreview *preview)
|
|||
preview->yoff = vadj->value;
|
||||
|
||||
if (!preview->in_drag)
|
||||
gimp_preview_update (preview);
|
||||
gimp_preview_draw (preview);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -366,8 +357,8 @@ gimp_preview_area_event (GtkWidget *area,
|
|||
GimpPreview *preview)
|
||||
{
|
||||
GdkEventButton *button_event;
|
||||
gint x, y;
|
||||
gint dx, dy;
|
||||
gint x, y;
|
||||
gint dx, dy;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_PREVIEW (preview), FALSE);
|
||||
|
||||
|
@ -394,7 +385,7 @@ gimp_preview_area_event (GtkWidget *area,
|
|||
{
|
||||
gtk_grab_remove (area);
|
||||
preview->in_drag = FALSE;
|
||||
gimp_preview_emit_updated (preview);
|
||||
gimp_preview_invalidate (preview);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -413,7 +404,7 @@ gimp_preview_area_event (GtkWidget *area,
|
|||
0, preview->ymax - preview->ymin - preview->height);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (preview->hadj), xoff);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (preview->vadj), yoff);
|
||||
gimp_preview_update (preview);
|
||||
gimp_preview_draw (preview);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -433,47 +424,36 @@ gimp_preview_toggle_callback (GtkWidget *toggle,
|
|||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)))
|
||||
{
|
||||
preview->update_preview = TRUE;
|
||||
gimp_preview_emit_updated (preview);
|
||||
gimp_preview_invalidate (preview);
|
||||
}
|
||||
else
|
||||
{
|
||||
preview->update_preview = FALSE;
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (toggle), "update_preview");
|
||||
g_object_notify (G_OBJECT (toggle), "update");
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_preview_get_width:
|
||||
* gimp_preview_get_size:
|
||||
* @preview: a #GimpPreview widget
|
||||
*
|
||||
* Return value: the @preview's width
|
||||
* @width: return location for the preview area width
|
||||
* @height: return location for the preview area height
|
||||
*
|
||||
* Since: GIMP 2.2
|
||||
**/
|
||||
gint
|
||||
gimp_preview_get_width (GimpPreview *preview)
|
||||
void
|
||||
gimp_preview_get_size (GimpPreview *preview,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_PREVIEW (preview), 0);
|
||||
g_return_if_fail (GIMP_IS_PREVIEW (preview));
|
||||
|
||||
return preview->width;
|
||||
}
|
||||
if (width)
|
||||
*width = preview->width;
|
||||
|
||||
|
||||
/**
|
||||
* gimp_preview_get_height:
|
||||
* @preview: a #GimpPreview widget
|
||||
*
|
||||
* Return value: the @preview's height
|
||||
*
|
||||
* Since: GIMP 2.2
|
||||
**/
|
||||
gint
|
||||
gimp_preview_get_height (GimpPreview *preview)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_PREVIEW (preview), 0);
|
||||
|
||||
return preview->height;
|
||||
if (height)
|
||||
*height = preview->height;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -512,7 +492,22 @@ gimp_preview_show_update_toggle (GimpPreview *preview,
|
|||
g_return_if_fail (GIMP_IS_PREVIEW (preview));
|
||||
|
||||
g_object_set (preview,
|
||||
"show_toggle_preview", show_update,
|
||||
"show_update_toggle", show_update,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* gimp_preview_invalidate:
|
||||
* @preview: a #GimpPreview widget
|
||||
*
|
||||
* Since: GIMP 2.2
|
||||
**/
|
||||
void
|
||||
gimp_preview_invalidate (GimpPreview *preview)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_PREVIEW (preview));
|
||||
|
||||
if (preview->update_preview)
|
||||
g_signal_emit (preview, preview_signals[INVALIDATED], 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,25 +63,28 @@ struct _GimpPreviewClass
|
|||
GtkTableClass parent_class;
|
||||
|
||||
/* virtuals */
|
||||
void (* update) (GimpPreview *preview);
|
||||
void (* draw) (GimpPreview *preview);
|
||||
|
||||
/* signal */
|
||||
void (* updated) (GimpPreview *preview);
|
||||
void (* invalidated) (GimpPreview *preview);
|
||||
};
|
||||
|
||||
|
||||
GType gimp_preview_get_type (void) G_GNUC_CONST;
|
||||
|
||||
gint gimp_preview_get_width (GimpPreview *preview);
|
||||
gint gimp_preview_get_height (GimpPreview *preview);
|
||||
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_position (GimpPreview *preview,
|
||||
gint *x,
|
||||
gint *y);
|
||||
|
||||
void gimp_preview_show_update_toggle (GimpPreview *preview,
|
||||
gboolean show_update);
|
||||
|
||||
void gimp_preview_invalidate (GimpPreview *preview);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GIMP_PREVIEW_H__ */
|
||||
|
|
|
@ -601,7 +601,7 @@ despeckle_dialog (void)
|
|||
preview = gimp_drawable_preview_new (drawable);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), preview, FALSE, FALSE, 0);
|
||||
gtk_widget_show (preview);
|
||||
g_signal_connect (preview, "updated",
|
||||
g_signal_connect (preview, "invalidated",
|
||||
G_CALLBACK (preview_update), NULL);
|
||||
|
||||
preview_init ();
|
||||
|
@ -689,8 +689,6 @@ despeckle_dialog (void)
|
|||
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
preview_update (preview);
|
||||
|
||||
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
|
@ -915,7 +913,7 @@ dialog_iscale_update (GtkAdjustment *adjustment,
|
|||
if (value == &despeckle_radius)
|
||||
preview_init ();
|
||||
|
||||
preview_update (preview);
|
||||
gimp_preview_invalidate (GIMP_PREVIEW (preview));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -927,7 +925,7 @@ dialog_adaptive_callback (GtkWidget *widget,
|
|||
else
|
||||
filter_type &= ~FILTER_ADAPTIVE;
|
||||
|
||||
preview_update (preview);
|
||||
gimp_preview_invalidate (GIMP_PREVIEW (preview));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -939,5 +937,5 @@ dialog_recursive_callback (GtkWidget *widget,
|
|||
else
|
||||
filter_type &= ~FILTER_RECURSIVE;
|
||||
|
||||
preview_update (preview);
|
||||
gimp_preview_invalidate (GIMP_PREVIEW (preview));
|
||||
}
|
||||
|
|
|
@ -516,13 +516,13 @@ gauss_dialog (gint32 image_ID,
|
|||
/* FIXME: Shouldn't need two signal connections here,
|
||||
gimp_coordinates_new() seems to be severily broken. */
|
||||
g_signal_connect_swapped (size, "value_changed",
|
||||
G_CALLBACK (update_preview),
|
||||
G_CALLBACK (gimp_preview_invalidate),
|
||||
preview);
|
||||
g_signal_connect_swapped (size, "refval_changed",
|
||||
G_CALLBACK (update_preview),
|
||||
G_CALLBACK (gimp_preview_invalidate),
|
||||
preview);
|
||||
|
||||
g_signal_connect (preview, "updated",
|
||||
g_signal_connect (preview, "invalidated",
|
||||
G_CALLBACK (update_preview),
|
||||
size);
|
||||
|
||||
|
@ -658,8 +658,7 @@ gauss (GimpDrawable *drawable,
|
|||
{
|
||||
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
|
||||
|
||||
width = gimp_preview_get_width (GIMP_PREVIEW (preview));
|
||||
height = gimp_preview_get_height (GIMP_PREVIEW (preview));
|
||||
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -262,19 +262,21 @@ neon (GimpDrawable *drawable,
|
|||
if (preview)
|
||||
{
|
||||
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
|
||||
x2 = x1 + gimp_preview_get_width (GIMP_PREVIEW (preview));
|
||||
y2 = y1 + gimp_preview_get_height (GIMP_PREVIEW (preview));
|
||||
|
||||
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
|
||||
x2 = x1 + width;
|
||||
y2 = y1 + height;
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
|
||||
width = (x2 - x1);
|
||||
height = (y2 - y1);
|
||||
}
|
||||
|
||||
if (radius < 1.0)
|
||||
return;
|
||||
|
||||
width = (x2 - x1);
|
||||
height = (y2 - y1);
|
||||
bytes = drawable->bpp;
|
||||
has_alpha = gimp_drawable_has_alpha(drawable->drawable_id);
|
||||
|
||||
|
@ -704,7 +706,7 @@ neon_dialog (GimpDrawable *drawable)
|
|||
preview = gimp_drawable_preview_new (drawable);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), preview, FALSE, FALSE, 0);
|
||||
gtk_widget_show (preview);
|
||||
g_signal_connect (preview, "updated",
|
||||
g_signal_connect (preview, "invalidated",
|
||||
G_CALLBACK (neon_preview_update), NULL);
|
||||
|
||||
table = gtk_table_new (2, 3, FALSE);
|
||||
|
|
|
@ -248,7 +248,7 @@ sobel_dialog (GimpDrawable *drawable)
|
|||
preview = gimp_drawable_preview_new (drawable);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), preview, FALSE, FALSE, 0);
|
||||
gtk_widget_show (preview);
|
||||
g_signal_connect (preview, "updated",
|
||||
g_signal_connect (preview, "invalidated",
|
||||
G_CALLBACK (sobel_update_preview), NULL);
|
||||
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("Sobel _Horizontally"));
|
||||
|
@ -260,7 +260,7 @@ sobel_dialog (GimpDrawable *drawable)
|
|||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&bvals.horizontal);
|
||||
g_signal_connect_swapped (toggle, "toggled",
|
||||
G_CALLBACK (sobel_update_preview), preview);
|
||||
G_CALLBACK (gimp_preview_invalidate), preview);
|
||||
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("Sobel _Vertically"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
|
@ -271,7 +271,7 @@ sobel_dialog (GimpDrawable *drawable)
|
|||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&bvals.vertical);
|
||||
g_signal_connect_swapped (toggle, "toggled",
|
||||
G_CALLBACK (sobel_update_preview), preview);
|
||||
G_CALLBACK (gimp_preview_invalidate), preview);
|
||||
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("_Keep sign of result (one direction only)"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
|
@ -282,7 +282,7 @@ sobel_dialog (GimpDrawable *drawable)
|
|||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&bvals.keep_sign);
|
||||
g_signal_connect_swapped (toggle, "toggled",
|
||||
G_CALLBACK (sobel_update_preview), preview);
|
||||
G_CALLBACK (gimp_preview_invalidate), preview);
|
||||
|
||||
gtk_widget_show (dlg);
|
||||
|
||||
|
@ -350,20 +350,21 @@ sobel (GimpDrawable *drawable,
|
|||
if (preview)
|
||||
{
|
||||
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
|
||||
x2 = x1 + gimp_preview_get_width (GIMP_PREVIEW (preview));
|
||||
y2 = y1 + gimp_preview_get_height (GIMP_PREVIEW (preview));
|
||||
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
|
||||
x2 = x1 + width;
|
||||
y2 = y1 + height;
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
|
||||
gimp_progress_init (_("Sobel Edge Detecting..."));
|
||||
width = x2 - x1;
|
||||
height = y2 - y1;
|
||||
}
|
||||
|
||||
/* Get the size of the input image. (This will/must be the same
|
||||
* as the size of the output image.
|
||||
*/
|
||||
width = x2 - x1;
|
||||
height = y2 - y1;
|
||||
bytes = drawable->bpp;
|
||||
alpha = gimp_drawable_has_alpha (drawable->drawable_id);
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ static void run (const gchar *name,
|
|||
static void softglow (GimpDrawable *drawable,
|
||||
GtkWidget *preview);
|
||||
static gboolean softglow_dialog (GimpDrawable *drawable);
|
||||
static void softglow_update_preview (GtkWidget *preview);
|
||||
|
||||
/*
|
||||
* Gaussian blur helper functions
|
||||
|
@ -258,16 +257,17 @@ softglow (GimpDrawable *drawable,
|
|||
if (preview)
|
||||
{
|
||||
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
|
||||
x2 = x1 + gimp_preview_get_width (GIMP_PREVIEW (preview));
|
||||
y2 = y1 + gimp_preview_get_height (GIMP_PREVIEW (preview));
|
||||
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
|
||||
x2 = x1 + width;
|
||||
y2 = y1 + height;
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
|
||||
width = (x2 - x1);
|
||||
height = (y2 - y1);
|
||||
}
|
||||
|
||||
width = (x2 - x1);
|
||||
height = (y2 - y1);
|
||||
bytes = drawable->bpp;
|
||||
has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
|
||||
|
||||
|
@ -677,7 +677,7 @@ softglow_dialog (GimpDrawable *drawable)
|
|||
preview = gimp_drawable_preview_new (drawable);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), preview, FALSE, FALSE, 0);
|
||||
gtk_widget_show (preview);
|
||||
g_signal_connect_swapped (preview, "updated",
|
||||
g_signal_connect_swapped (preview, "invalidated",
|
||||
G_CALLBACK (softglow), drawable);
|
||||
|
||||
table = gtk_table_new (3, 3, FALSE);
|
||||
|
@ -697,7 +697,7 @@ softglow_dialog (GimpDrawable *drawable)
|
|||
G_CALLBACK (gimp_double_adjustment_update),
|
||||
&svals.glow_radius);
|
||||
g_signal_connect_swapped (scale_data, "value_changed",
|
||||
G_CALLBACK (softglow_update_preview), preview);
|
||||
G_CALLBACK (gimp_preview_invalidate), preview);
|
||||
|
||||
/* Label, scale, entry for svals.amount */
|
||||
scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
|
||||
|
@ -710,7 +710,7 @@ softglow_dialog (GimpDrawable *drawable)
|
|||
G_CALLBACK (gimp_double_adjustment_update),
|
||||
&svals.brightness);
|
||||
g_signal_connect_swapped (scale_data, "value_changed",
|
||||
G_CALLBACK (softglow_update_preview), preview);
|
||||
G_CALLBACK (gimp_preview_invalidate), preview);
|
||||
|
||||
/* Label, scale, entry for svals.amount */
|
||||
scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 2,
|
||||
|
@ -723,7 +723,7 @@ softglow_dialog (GimpDrawable *drawable)
|
|||
G_CALLBACK (gimp_double_adjustment_update),
|
||||
&svals.sharpness);
|
||||
g_signal_connect_swapped (scale_data, "value_changed",
|
||||
G_CALLBACK (softglow_update_preview), preview);
|
||||
G_CALLBACK (gimp_preview_invalidate), preview);
|
||||
|
||||
gtk_widget_show (dlg);
|
||||
|
||||
|
@ -734,8 +734,3 @@ softglow_dialog (GimpDrawable *drawable)
|
|||
return run;
|
||||
}
|
||||
|
||||
static void
|
||||
softglow_update_preview (GtkWidget *preview)
|
||||
{
|
||||
softglow (GIMP_DRAWABLE_PREVIEW (preview)->drawable, preview);
|
||||
}
|
||||
|
|
|
@ -302,8 +302,7 @@ spread_updating_preview (GimpPreview *preview, GtkWidget *size)
|
|||
param.width = drawable_preview->drawable->width;
|
||||
param.height = drawable_preview->drawable->height;
|
||||
|
||||
width = gimp_preview_get_width (preview);
|
||||
height = gimp_preview_get_height (preview);
|
||||
gimp_preview_get_size (preview, &width, &height);
|
||||
|
||||
bpp = drawable_preview->drawable->bpp;
|
||||
dest = buffer = g_new (guchar, width * height * bpp);
|
||||
|
@ -386,10 +385,10 @@ spread_dialog (gint32 image_ID,
|
|||
0, 0);
|
||||
gtk_container_add (GTK_CONTAINER (frame), size);
|
||||
gtk_widget_show (size);
|
||||
g_signal_connect (preview, "updated",
|
||||
g_signal_connect (preview, "invalidated",
|
||||
G_CALLBACK (spread_updating_preview), size);
|
||||
g_signal_connect_swapped (size, "value_changed",
|
||||
G_CALLBACK (spread_updating_preview), preview);
|
||||
G_CALLBACK (gimp_preview_invalidate), preview);
|
||||
gtk_widget_show (dlg);
|
||||
|
||||
spread_updating_preview (GIMP_PREVIEW(preview), size);
|
||||
|
|
|
@ -682,7 +682,7 @@ unsharp_mask_dialog (GimpDrawable *drawable)
|
|||
&unsharp_params.update_preview);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), preview, FALSE, FALSE, 0);
|
||||
gtk_widget_show (preview);
|
||||
g_signal_connect (preview, "updated",
|
||||
g_signal_connect (preview, "invalidated",
|
||||
G_CALLBACK (preview_update), NULL);
|
||||
|
||||
table = gtk_table_new (3, 3, FALSE);
|
||||
|
@ -701,7 +701,7 @@ unsharp_mask_dialog (GimpDrawable *drawable)
|
|||
G_CALLBACK (gimp_double_adjustment_update),
|
||||
&unsharp_params.radius);
|
||||
g_signal_connect_swapped (adj, "value_changed",
|
||||
G_CALLBACK (preview_update),
|
||||
G_CALLBACK (gimp_preview_invalidate),
|
||||
preview);
|
||||
|
||||
scrollbar = GIMP_SCALE_ENTRY_SCALE (adj);
|
||||
|
@ -721,7 +721,7 @@ unsharp_mask_dialog (GimpDrawable *drawable)
|
|||
G_CALLBACK (gimp_double_adjustment_update),
|
||||
&unsharp_params.amount);
|
||||
g_signal_connect_swapped (adj, "value_changed",
|
||||
G_CALLBACK (preview_update),
|
||||
G_CALLBACK (gimp_preview_invalidate),
|
||||
preview);
|
||||
|
||||
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 2,
|
||||
|
@ -736,7 +736,7 @@ unsharp_mask_dialog (GimpDrawable *drawable)
|
|||
G_CALLBACK (gimp_int_adjustment_update),
|
||||
&unsharp_params.threshold);
|
||||
g_signal_connect_swapped (adj, "value_changed",
|
||||
G_CALLBACK (preview_update),
|
||||
G_CALLBACK (gimp_preview_invalidate),
|
||||
preview);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
|
|
Loading…
Reference in New Issue