diff --git a/ChangeLog b/ChangeLog index 48538f1ae6..3ce131b3b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2003-02-25 Michael Natterer + + * app/display/gimpdisplayshell.[ch]: replaced the "gboolean + title_dirty" in GimpDisplayShell by "guint title_idle_id". + (gimp_display_shell_flush): Call gimp_display_shell_update_title() + unconditionally. Don't call info_window_update(). + + * app/display/gimpdisplayshell-handlers.c + * app/display/gimpdisplayshell-scale.c: ditto. + + * app/display/gimpdisplayshell-title.c: update the title in an + idle function. Call info_window_update() from the idle function. + 2003-02-25 Sven Neumann * app/config/gimpdisplayconfig.[ch] diff --git a/app/display/gimpdisplayshell-draw.c b/app/display/gimpdisplayshell-draw.c index bc24444e27..d15a4da562 100644 --- a/app/display/gimpdisplayshell-draw.c +++ b/app/display/gimpdisplayshell-draw.c @@ -89,6 +89,8 @@ static void gimp_display_shell_destroy (GtkObject *object static gboolean gimp_display_shell_delete_event (GtkWidget *widget, GdkEventAny *aevent); +static void gimp_display_shell_real_scaled (GimpDisplayShell *shell); + static void gimp_display_shell_close_warning_dialog (GimpDisplayShell *shell, GimpImage *gimage); static void gimp_display_shell_close_warning_callback (GtkWidget *widget, @@ -171,7 +173,7 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass) widget_class->delete_event = gimp_display_shell_delete_event; - klass->scaled = NULL; + klass->scaled = gimp_display_shell_real_scaled; klass->scrolled = NULL; klass->reconnect = NULL; } @@ -218,8 +220,6 @@ gimp_display_shell_init (GimpDisplayShell *shell) 3); shell->render_gc = NULL; - shell->title_dirty = FALSE; - shell->icon_size = 32; shell->icon_idle_id = 0; @@ -350,6 +350,12 @@ gimp_display_shell_destroy (GtkObject *object) shell->padding_gc = NULL; } + if (shell->title_idle_id) + { + g_source_remove (shell->title_idle_id); + shell->title_idle_id = 0; + } + if (shell->info_dialog) { info_window_free (shell->info_dialog); @@ -380,6 +386,12 @@ gimp_display_shell_delete_event (GtkWidget *widget, return TRUE; } +static void +gimp_display_shell_real_scaled (GimpDisplayShell *shell) +{ + gimp_display_shell_update_title (shell); +} + GtkWidget * gimp_display_shell_new (GimpDisplay *gdisp, guint scale, @@ -1112,15 +1124,7 @@ gimp_display_shell_flush (GimpDisplayShell *shell) { g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - if (shell->title_dirty) - { - gimp_display_shell_update_title (shell); - - shell->title_dirty = FALSE; - } - - /* update the gdisplay's info dialog */ - info_window_update (shell->gdisp); + gimp_display_shell_update_title (shell); } void diff --git a/app/display/gimpdisplayshell-draw.h b/app/display/gimpdisplayshell-draw.h index 0c036979f3..0a7f68b120 100644 --- a/app/display/gimpdisplayshell-draw.h +++ b/app/display/gimpdisplayshell-draw.h @@ -112,7 +112,7 @@ struct _GimpDisplayShell guchar *render_buf; /* buffer for rendering the image */ GdkGC *render_gc; /* GC for rendering the image */ - gboolean title_dirty; /* checked by _flush() */ + guint title_idle_id; /* title update idle ID */ gint icon_size; /* size of the icon pixmap */ guint icon_idle_id; /* ID of the idle-function */ diff --git a/app/display/gimpdisplayshell-handlers.c b/app/display/gimpdisplayshell-handlers.c index 7751db7b15..06f4209cc6 100644 --- a/app/display/gimpdisplayshell-handlers.c +++ b/app/display/gimpdisplayshell-handlers.c @@ -263,7 +263,7 @@ static void gimp_display_shell_clean_dirty_handler (GimpImage *gimage, GimpDisplayShell *shell) { - shell->title_dirty = TRUE; + gimp_display_shell_update_title (shell); } static void @@ -272,14 +272,14 @@ gimp_display_shell_undo_event_handler (GimpImage *gimage, GimpUndo *undo, GimpDisplayShell *shell) { - shell->title_dirty = TRUE; + gimp_display_shell_update_title (shell); } static void gimp_display_shell_name_changed_handler (GimpImage *gimage, GimpDisplayShell *shell) { - shell->title_dirty = TRUE; + gimp_display_shell_update_title (shell); } static void diff --git a/app/display/gimpdisplayshell-scale.c b/app/display/gimpdisplayshell-scale.c index cd2ee70fbb..3aa6e1f554 100644 --- a/app/display/gimpdisplayshell-scale.c +++ b/app/display/gimpdisplayshell-scale.c @@ -39,6 +39,7 @@ #include "gimpdisplayshell.h" #include "gimpdisplayshell-scale.h" #include "gimpdisplayshell-scroll.h" +#include "gimpdisplayshell-title.h" #include "gimpstatusbar.h" @@ -420,14 +421,7 @@ gimp_display_shell_scale_resize (GimpDisplayShell *shell, gimp_display_shell_scale_setup (shell); if (resize_window || redisplay) - { - gimp_display_shell_expose_full (shell); - - /* title may have changed if it includes the zoom ratio */ - shell->title_dirty = TRUE; - - gimp_display_shell_flush (shell); - } + gimp_display_shell_expose_full (shell); /* re-enable the active tool */ tool_manager_control_active (gimp, RESUME, shell->gdisp); diff --git a/app/display/gimpdisplayshell-title.c b/app/display/gimpdisplayshell-title.c index f81737d2d6..3dedc03b94 100644 --- a/app/display/gimpdisplayshell-title.c +++ b/app/display/gimpdisplayshell-title.c @@ -26,6 +26,11 @@ #include "display-types.h" +#ifdef __GNUC__ +#warning FIXME #include "gui/gui-types.h" +#endif +#include "gui/gui-types.h" + #include "config/gimpdisplayconfig.h" #include "core/gimp.h" @@ -34,6 +39,8 @@ #include "file/file-utils.h" +#include "gui/info-window.h" + #include "gimpdisplay.h" #include "gimpdisplayshell.h" #include "gimpdisplayshell-title.h" @@ -45,21 +52,42 @@ #define MAX_TITLE_BUF 256 -static void gimp_display_shell_format_title (GimpDisplayShell *gdisp, - gchar *title, - gint title_len, - const gchar *format); +static gboolean gimp_display_shell_update_title_idle (gpointer data); +static void gimp_display_shell_format_title (GimpDisplayShell *gdisp, + gchar *title, + gint title_len, + const gchar *format); + + +/* public functions */ void gimp_display_shell_update_title (GimpDisplayShell *shell) { + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); + + if (shell->title_idle_id) + g_source_remove (shell->title_idle_id); + + shell->title_idle_id = g_idle_add (gimp_display_shell_update_title_idle, + shell); +} + + +/* private functions */ + +static gboolean +gimp_display_shell_update_title_idle (gpointer data) +{ + GimpDisplayShell *shell; GimpDisplayConfig *config; gchar title[MAX_TITLE_BUF]; - g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - + shell = GIMP_DISPLAY_SHELL (data); config = GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config); + shell->title_idle_id = 0; + /* format the title */ gimp_display_shell_format_title (shell, title, sizeof (title), config->image_title_format); @@ -74,6 +102,13 @@ gimp_display_shell_update_title (GimpDisplayShell *shell) gimp_statusbar_pop (GIMP_STATUSBAR (shell->statusbar), "title"); gimp_statusbar_push (GIMP_STATUSBAR (shell->statusbar), "title", title); + +#ifdef __GNUC__ +#warning FIXME: dont call info_window_update() here. +#endif + info_window_update (shell->gdisp); + + return FALSE; } @@ -259,7 +294,7 @@ gimp_display_shell_format_title (GimpDisplayShell *shell, i += print (title, title_len, i, "%s", gimp_object_get_name (GIMP_OBJECT (drawable))); else - i += print (title, title_len, i, "%s", "(none)"); + i += print (title, title_len, i, "%s", _("(none)")); } break; diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c index bc24444e27..d15a4da562 100644 --- a/app/display/gimpdisplayshell.c +++ b/app/display/gimpdisplayshell.c @@ -89,6 +89,8 @@ static void gimp_display_shell_destroy (GtkObject *object static gboolean gimp_display_shell_delete_event (GtkWidget *widget, GdkEventAny *aevent); +static void gimp_display_shell_real_scaled (GimpDisplayShell *shell); + static void gimp_display_shell_close_warning_dialog (GimpDisplayShell *shell, GimpImage *gimage); static void gimp_display_shell_close_warning_callback (GtkWidget *widget, @@ -171,7 +173,7 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass) widget_class->delete_event = gimp_display_shell_delete_event; - klass->scaled = NULL; + klass->scaled = gimp_display_shell_real_scaled; klass->scrolled = NULL; klass->reconnect = NULL; } @@ -218,8 +220,6 @@ gimp_display_shell_init (GimpDisplayShell *shell) 3); shell->render_gc = NULL; - shell->title_dirty = FALSE; - shell->icon_size = 32; shell->icon_idle_id = 0; @@ -350,6 +350,12 @@ gimp_display_shell_destroy (GtkObject *object) shell->padding_gc = NULL; } + if (shell->title_idle_id) + { + g_source_remove (shell->title_idle_id); + shell->title_idle_id = 0; + } + if (shell->info_dialog) { info_window_free (shell->info_dialog); @@ -380,6 +386,12 @@ gimp_display_shell_delete_event (GtkWidget *widget, return TRUE; } +static void +gimp_display_shell_real_scaled (GimpDisplayShell *shell) +{ + gimp_display_shell_update_title (shell); +} + GtkWidget * gimp_display_shell_new (GimpDisplay *gdisp, guint scale, @@ -1112,15 +1124,7 @@ gimp_display_shell_flush (GimpDisplayShell *shell) { g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - if (shell->title_dirty) - { - gimp_display_shell_update_title (shell); - - shell->title_dirty = FALSE; - } - - /* update the gdisplay's info dialog */ - info_window_update (shell->gdisp); + gimp_display_shell_update_title (shell); } void diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h index 0c036979f3..0a7f68b120 100644 --- a/app/display/gimpdisplayshell.h +++ b/app/display/gimpdisplayshell.h @@ -112,7 +112,7 @@ struct _GimpDisplayShell guchar *render_buf; /* buffer for rendering the image */ GdkGC *render_gc; /* GC for rendering the image */ - gboolean title_dirty; /* checked by _flush() */ + guint title_idle_id; /* title update idle ID */ gint icon_size; /* size of the icon pixmap */ guint icon_idle_id; /* ID of the idle-function */