Commit 3c8b37f1 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

added "update_guide" signal.

2001-11-14  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpimage.[ch]: added "update_guide" signal.

	* app/display/gimpdisplay-foreach.[ch]: removed
	gdisplays_expose_guide().

	* app/display/gimpdisplayshell-handlers.c: added a handler for
	"update_guide" and expose the guide there.

	* app/undo.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimpmovetool.c: call gimp_image_update_guide() instead
	of gdisplays_expose_guide().
parent 58ea7641
2001-11-14 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage.[ch]: added "update_guide" signal.
* app/display/gimpdisplay-foreach.[ch]: removed
gdisplays_expose_guide().
* app/display/gimpdisplayshell-handlers.c: added a handler for
"update_guide" and expose the guide there.
* app/undo.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c: call gimp_image_update_guide() instead
of gdisplays_expose_guide().
2001-11-14 Abel Cheung <maddog@linux.org.hk>
* configure.in (ALL_LINGUAS): Rename zh_TW.Big5 -> zh_TW to
......
......@@ -181,6 +181,7 @@ enum
CLEAN,
DIRTY,
UPDATE,
UPDATE_GUIDE,
COLORMAP_CHANGED,
UNDO_EVENT,
LAST_SIGNAL
......@@ -375,6 +376,16 @@ gimp_image_class_init (GimpImageClass *klass)
G_TYPE_INT,
G_TYPE_INT);
gimp_image_signals[UPDATE_GUIDE] =
g_signal_new ("update_guide",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpImageClass, update_guide),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
gimp_image_signals[COLORMAP_CHANGED] =
g_signal_new ("colormap_changed",
G_TYPE_FROM_CLASS (klass),
......@@ -417,6 +428,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->clean = NULL;
klass->dirty = NULL;
klass->update = NULL;
klass->update_guide = NULL;
klass->colormap_changed = gimp_image_real_colormap_changed;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
......@@ -2094,6 +2106,17 @@ gimp_image_update (GimpImage *gimage,
x, y, width, height);
}
void
gimp_image_update_guide (GimpImage *gimage,
GimpGuide *guide)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (guide != NULL);
g_signal_emit (G_OBJECT (gimage), gimp_image_signals[UPDATE_GUIDE], 0,
guide);
}
void
gimp_image_selection_control (GimpImage *gimage,
GimpSelectionControl control)
......
......@@ -152,6 +152,8 @@ struct _GimpImageClass
gint y,
gint width,
gint height);
void (* update_guide) (GimpImage *gimage,
GimpGuide *guide);
void (* colormap_changed) (GimpImage *gimage,
gint color_index);
void (* undo_event) (GimpImage *gimage,
......@@ -316,6 +318,8 @@ void gimp_image_update (GimpImage *gimage,
gint y,
gint width,
gint height);
void gimp_image_update_guide (GimpImage *gimage,
GimpGuide *guide);
void gimp_image_selection_control (GimpImage *gimage,
GimpSelectionControl control);
......
......@@ -181,6 +181,7 @@ enum
CLEAN,
DIRTY,
UPDATE,
UPDATE_GUIDE,
COLORMAP_CHANGED,
UNDO_EVENT,
LAST_SIGNAL
......@@ -375,6 +376,16 @@ gimp_image_class_init (GimpImageClass *klass)
G_TYPE_INT,
G_TYPE_INT);
gimp_image_signals[UPDATE_GUIDE] =
g_signal_new ("update_guide",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpImageClass, update_guide),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
gimp_image_signals[COLORMAP_CHANGED] =
g_signal_new ("colormap_changed",
G_TYPE_FROM_CLASS (klass),
......@@ -417,6 +428,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->clean = NULL;
klass->dirty = NULL;
klass->update = NULL;
klass->update_guide = NULL;
klass->colormap_changed = gimp_image_real_colormap_changed;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
......@@ -2094,6 +2106,17 @@ gimp_image_update (GimpImage *gimage,
x, y, width, height);
}
void
gimp_image_update_guide (GimpImage *gimage,
GimpGuide *guide)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (guide != NULL);
g_signal_emit (G_OBJECT (gimage), gimp_image_signals[UPDATE_GUIDE], 0,
guide);
}
void
gimp_image_selection_control (GimpImage *gimage,
GimpSelectionControl control)
......
......@@ -152,6 +152,8 @@ struct _GimpImageClass
gint y,
gint width,
gint height);
void (* update_guide) (GimpImage *gimage,
GimpGuide *guide);
void (* colormap_changed) (GimpImage *gimage,
gint color_index);
void (* undo_event) (GimpImage *gimage,
......@@ -316,6 +318,8 @@ void gimp_image_update (GimpImage *gimage,
gint y,
gint width,
gint height);
void gimp_image_update_guide (GimpImage *gimage,
GimpGuide *guide);
void gimp_image_selection_control (GimpImage *gimage,
GimpSelectionControl control);
......
......@@ -181,6 +181,7 @@ enum
CLEAN,
DIRTY,
UPDATE,
UPDATE_GUIDE,
COLORMAP_CHANGED,
UNDO_EVENT,
LAST_SIGNAL
......@@ -375,6 +376,16 @@ gimp_image_class_init (GimpImageClass *klass)
G_TYPE_INT,
G_TYPE_INT);
gimp_image_signals[UPDATE_GUIDE] =
g_signal_new ("update_guide",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpImageClass, update_guide),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
gimp_image_signals[COLORMAP_CHANGED] =
g_signal_new ("colormap_changed",
G_TYPE_FROM_CLASS (klass),
......@@ -417,6 +428,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->clean = NULL;
klass->dirty = NULL;
klass->update = NULL;
klass->update_guide = NULL;
klass->colormap_changed = gimp_image_real_colormap_changed;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
......@@ -2094,6 +2106,17 @@ gimp_image_update (GimpImage *gimage,
x, y, width, height);
}
void
gimp_image_update_guide (GimpImage *gimage,
GimpGuide *guide)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (guide != NULL);
g_signal_emit (G_OBJECT (gimage), gimp_image_signals[UPDATE_GUIDE], 0,
guide);
}
void
gimp_image_selection_control (GimpImage *gimage,
GimpSelectionControl control)
......
......@@ -152,6 +152,8 @@ struct _GimpImageClass
gint y,
gint width,
gint height);
void (* update_guide) (GimpImage *gimage,
GimpGuide *guide);
void (* colormap_changed) (GimpImage *gimage,
gint color_index);
void (* undo_event) (GimpImage *gimage,
......@@ -316,6 +318,8 @@ void gimp_image_update (GimpImage *gimage,
gint y,
gint width,
gint height);
void gimp_image_update_guide (GimpImage *gimage,
GimpGuide *guide);
void gimp_image_selection_control (GimpImage *gimage,
GimpSelectionControl control);
......
......@@ -181,6 +181,7 @@ enum
CLEAN,
DIRTY,
UPDATE,
UPDATE_GUIDE,
COLORMAP_CHANGED,
UNDO_EVENT,
LAST_SIGNAL
......@@ -375,6 +376,16 @@ gimp_image_class_init (GimpImageClass *klass)
G_TYPE_INT,
G_TYPE_INT);
gimp_image_signals[UPDATE_GUIDE] =
g_signal_new ("update_guide",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpImageClass, update_guide),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
gimp_image_signals[COLORMAP_CHANGED] =
g_signal_new ("colormap_changed",
G_TYPE_FROM_CLASS (klass),
......@@ -417,6 +428,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->clean = NULL;
klass->dirty = NULL;
klass->update = NULL;
klass->update_guide = NULL;
klass->colormap_changed = gimp_image_real_colormap_changed;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
......@@ -2094,6 +2106,17 @@ gimp_image_update (GimpImage *gimage,
x, y, width, height);
}
void
gimp_image_update_guide (GimpImage *gimage,
GimpGuide *guide)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (guide != NULL);
g_signal_emit (G_OBJECT (gimage), gimp_image_signals[UPDATE_GUIDE], 0,
guide);
}
void
gimp_image_selection_control (GimpImage *gimage,
GimpSelectionControl control)
......
......@@ -152,6 +152,8 @@ struct _GimpImageClass
gint y,
gint width,
gint height);
void (* update_guide) (GimpImage *gimage,
GimpGuide *guide);
void (* colormap_changed) (GimpImage *gimage,
gint color_index);
void (* undo_event) (GimpImage *gimage,
......@@ -316,6 +318,8 @@ void gimp_image_update (GimpImage *gimage,
gint y,
gint width,
gint height);
void gimp_image_update_guide (GimpImage *gimage,
GimpGuide *guide);
void gimp_image_selection_control (GimpImage *gimage,
GimpSelectionControl control);
......
......@@ -181,6 +181,7 @@ enum
CLEAN,
DIRTY,
UPDATE,
UPDATE_GUIDE,
COLORMAP_CHANGED,
UNDO_EVENT,
LAST_SIGNAL
......@@ -375,6 +376,16 @@ gimp_image_class_init (GimpImageClass *klass)
G_TYPE_INT,
G_TYPE_INT);
gimp_image_signals[UPDATE_GUIDE] =
g_signal_new ("update_guide",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpImageClass, update_guide),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
gimp_image_signals[COLORMAP_CHANGED] =
g_signal_new ("colormap_changed",
G_TYPE_FROM_CLASS (klass),
......@@ -417,6 +428,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->clean = NULL;
klass->dirty = NULL;
klass->update = NULL;
klass->update_guide = NULL;
klass->colormap_changed = gimp_image_real_colormap_changed;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
......@@ -2094,6 +2106,17 @@ gimp_image_update (GimpImage *gimage,
x, y, width, height);
}
void
gimp_image_update_guide (GimpImage *gimage,
GimpGuide *guide)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (guide != NULL);
g_signal_emit (G_OBJECT (gimage), gimp_image_signals[UPDATE_GUIDE], 0,
guide);
}
void
gimp_image_selection_control (GimpImage *gimage,
GimpSelectionControl control)
......
......@@ -152,6 +152,8 @@ struct _GimpImageClass
gint y,
gint width,
gint height);
void (* update_guide) (GimpImage *gimage,
GimpGuide *guide);
void (* colormap_changed) (GimpImage *gimage,
gint color_index);
void (* undo_event) (GimpImage *gimage,
......@@ -316,6 +318,8 @@ void gimp_image_update (GimpImage *gimage,
gint y,
gint width,
gint height);
void gimp_image_update_guide (GimpImage *gimage,
GimpGuide *guide);
void gimp_image_selection_control (GimpImage *gimage,
GimpSelectionControl control);
......
......@@ -898,9 +898,9 @@ undo_push_image_mod (GimpImage *gimage,
gpointer tiles_ptr,
gboolean sparse)
{
glong size;
gint dwidth, dheight;
Undo *new;
glong size;
gint dwidth, dheight;
Undo *new;
ImageUndo *image_undo;
TileManager *tiles;
......@@ -1175,9 +1175,9 @@ undo_free_mask (UndoState state,
/***************************************/
/* Layer displacement Undo functions */
typedef struct _LayerDisplayUndo LayerDisplaceUndo;
typedef struct _LayerDisplaceUndo LayerDisplaceUndo;
struct _LayerDisplayUndo
struct _LayerDisplaceUndo
{
gint info[3];
PathUndo *path_undo;
......@@ -2387,14 +2387,12 @@ undo_pop_qmask (GimpImage *gimage,
tmp = gimage->qmask_state;
gimage->qmask_state = data->qmask;
data->qmask = tmp;
/* make sure the buttons on all displays are updated */
gdisplays_flush ();
gimp_image_qmask_changed (gimage);
return TRUE;
}
static void
undo_free_qmask (UndoState state,
UndoType type,
......@@ -2455,7 +2453,7 @@ undo_pop_guide (GimpImage *gimage,
data = data_ptr;
gdisplays_expose_guide (gimage, data->guide);
gimp_image_update_guide (gimage, data->guide);
tmp_ref = data->guide->ref_count;
tmp = *(data->guide);
......@@ -2463,7 +2461,7 @@ undo_pop_guide (GimpImage *gimage,
data->guide->ref_count = tmp_ref;
data->orig = tmp;
gdisplays_expose_guide (gimage, data->guide);
gimp_image_update_guide (gimage, data->guide);
return TRUE;
}
......
......@@ -181,6 +181,7 @@ enum
CLEAN,
DIRTY,
UPDATE,
UPDATE_GUIDE,
COLORMAP_CHANGED,
UNDO_EVENT,
LAST_SIGNAL
......@@ -375,6 +376,16 @@ gimp_image_class_init (GimpImageClass *klass)
G_TYPE_INT,
G_TYPE_INT);
gimp_image_signals[UPDATE_GUIDE] =
g_signal_new ("update_guide",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpImageClass, update_guide),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
gimp_image_signals[COLORMAP_CHANGED] =
g_signal_new ("colormap_changed",
G_TYPE_FROM_CLASS (klass),
......@@ -417,6 +428,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->clean = NULL;
klass->dirty = NULL;
klass->update = NULL;
klass->update_guide = NULL;
klass->colormap_changed = gimp_image_real_colormap_changed;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
......@@ -2094,6 +2106,17 @@ gimp_image_update (GimpImage *gimage,
x, y, width, height);
}
void
gimp_image_update_guide (GimpImage *gimage,
GimpGuide *guide)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (guide != NULL);
g_signal_emit (G_OBJECT (gimage), gimp_image_signals[UPDATE_GUIDE], 0,
guide);
}
void
gimp_image_selection_control (GimpImage *gimage,
GimpSelectionControl control)
......
......@@ -152,6 +152,8 @@ struct _GimpImageClass
gint y,
gint width,
gint height);
void (* update_guide) (GimpImage *gimage,
GimpGuide *guide);
void (* colormap_changed) (GimpImage *gimage,
gint color_index);
void (* undo_event) (GimpImage *gimage,
......@@ -316,6 +318,8 @@ void gimp_image_update (GimpImage *gimage,
gint y,
gint width,
gint height);
void gimp_image_update_guide (GimpImage *gimage,
GimpGuide *guide);
void gimp_image_selection_control (GimpImage *gimage,
GimpSelectionControl control);
......
......@@ -181,6 +181,7 @@ enum
CLEAN,
DIRTY,
UPDATE,
UPDATE_GUIDE,
COLORMAP_CHANGED,
UNDO_EVENT,
LAST_SIGNAL
......@@ -375,6 +376,16 @@ gimp_image_class_init (GimpImageClass *klass)
G_TYPE_INT,
G_TYPE_INT);
gimp_image_signals[UPDATE_GUIDE] =
g_signal_new ("update_guide",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpImageClass, update_guide),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
gimp_image_signals[COLORMAP_CHANGED] =
g_signal_new ("colormap_changed",
G_TYPE_FROM_CLASS (klass),
......@@ -417,6 +428,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->clean = NULL;
klass->dirty = NULL;
klass->update = NULL;
klass->update_guide = NULL;
klass->colormap_changed = gimp_image_real_colormap_changed;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
......@@ -2094,6 +2106,17 @@ gimp_image_update (GimpImage *gimage,
x, y, width, height);
}
void
gimp_image_update_guide (GimpImage *gimage,
GimpGuide *guide)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (guide != NULL);
g_signal_emit (G_OBJECT (gimage), gimp_image_signals[UPDATE_GUIDE], 0,
guide);
}
void
gimp_image_selection_control (GimpImage *gimage,
GimpSelectionControl control)
......
......@@ -152,6 +152,8 @@ struct _GimpImageClass
gint y,
gint width,
gint height);
void (* update_guide) (GimpImage *gimage,
GimpGuide *guide);
void (* colormap_changed) (GimpImage *gimage,
gint color_index);
void (* undo_event) (GimpImage *gimage,
......@@ -316,6 +318,8 @@ void gimp_image_update (GimpImage *gimage,
gint y,
gint width,
gint height);
void gimp_image_update_guide (GimpImage *gimage,
GimpGuide *guide);
void gimp_image_selection_control (GimpImage *gimage,
GimpSelectionControl control);
......
......@@ -38,26 +38,6 @@ gdisplays_foreach (GFunc func,
g_slist_foreach (display_list, func, user_data);
}
void
gdisplays_expose_guide (GimpImage *gimage,
GimpGuide *guide)
{
GimpDisplay *gdisp;
GSList *list;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (guide != NULL);
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = (GimpDisplay *) list->data;
if (gdisp->gimage == gimage)
gimp_display_shell_expose_guide (GIMP_DISPLAY_SHELL (gdisp->shell),
guide);
}
}
void
gdisplays_expose_full (void)
{
......
......@@ -26,8 +26,6 @@ GimpDisplay * gdisplays_check_valid (GimpDisplay *gdisp,
GimpImage *gimage);
void gdisplays_reconnect (GimpImage *old,
GimpImage *new);
void gdisplays_expose_guide (GimpImage *gimage,
GimpGuide *guide);
void gdisplays_expose_full (void);
gboolean gdisplays_dirty (void);
void gdisplays_delete (void);
......
......@@ -48,6 +48,9 @@ static void gimp_display_shell_unit_changed_handler (GimpImage *g
GimpDisplayShell *shell);
static void gimp_display_shell_qmask_changed_handler (GimpImage *gimage,
GimpDisplayShell *shell);
static void gimp_display_shell_update_guide_handler (GimpImage *gimage,
GimpGuide *guide,
GimpDisplayShell *shell);
/* public functions */
......@@ -88,6 +91,9 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
g_signal_connect (G_OBJECT (gimage), "qmask_changed",
G_CALLBACK (gimp_display_shell_qmask_changed_handler),
shell);
g_signal_connect (G_OBJECT (gimage), "update_guide",
G_CALLBACK (gimp_display_shell_update_guide_handler),
shell);
}
void
......@@ -101,6 +107,9 @@ gimp_display_shell_disconnect (GimpDisplayShell *shell)
gimage = shell->gdisp->gimage;
g_signal_handlers_disconnect_by_func (G_OBJECT (gimage),
gimp_display_shell_update_guide_handler,