mirror of https://github.com/GNOME/gimp.git
added new signal "reconnect" which is emitted when the underlying image
2002-09-27 Michael Natterer <mitch@gimp.org> * app/display/gimpdisplayshell.[ch]: added new signal "reconnect" which is emitted when the underlying image changes (happens on "Revert"). Set the sensitivity of the new "Toggle QuickMask" menu item. Don't configure the QMask button in gimp_display_shell_new(). * app/display/gimpdisplayshell-handlers.c (gimp_display_shell_connect): configure the QMask button here so it's consistent after "Revert". * app/display/gimpnavigationview.c: connect to the shell's "reconnect" signal and update accordingly.
This commit is contained in:
parent
0ce8a599e2
commit
fb092e7f88
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2002-09-27 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/display/gimpdisplayshell.[ch]: added new signal "reconnect"
|
||||
which is emitted when the underlying image changes (happens on
|
||||
"Revert"). Set the sensitivity of the new "Toggle QuickMask" menu
|
||||
item. Don't configure the QMask button in gimp_display_shell_new().
|
||||
|
||||
* app/display/gimpdisplayshell-handlers.c (gimp_display_shell_connect):
|
||||
configure the QMask button here so it's consistent after "Revert".
|
||||
|
||||
* app/display/gimpnavigationview.c: connect to the shell's
|
||||
"reconnect" signal and update accordingly.
|
||||
|
||||
2002-09-27 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/tools/gimpmagnifytool.c (gimp_magnify_tool_init): set the
|
||||
|
|
|
@ -84,6 +84,7 @@ enum
|
|||
{
|
||||
SCALED,
|
||||
SCROLLED,
|
||||
RECONNECT,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
@ -185,9 +186,22 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass)
|
|||
gimp_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
display_shell_signals[RECONNECT] =
|
||||
g_signal_new ("reconnect",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GimpDisplayShellClass, reconnect),
|
||||
NULL, NULL,
|
||||
gimp_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
object_class->destroy = gimp_display_shell_destroy;
|
||||
|
||||
widget_class->delete_event = gimp_display_shell_delete_event;
|
||||
|
||||
klass->scaled = NULL;
|
||||
klass->scrolled = NULL;
|
||||
klass->reconnect = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -410,9 +424,9 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
image_width = gdisp->gimage->width;
|
||||
image_height = gdisp->gimage->height;
|
||||
|
||||
/* adjust the initial scale -- so that window fits on screen
|
||||
* the 75% value is the same as in gdisplay_shrink_wrap. It
|
||||
* probably should be a user-configurable option.
|
||||
/* adjust the initial scale -- so that window fits on screen the 75%
|
||||
* value is the same as in gimp_display_shell_shrink_wrap. It
|
||||
* probably should be a user-configurable option.
|
||||
*/
|
||||
s_width = gdk_screen_width () * 0.75;
|
||||
s_height = gdk_screen_height () * 0.75;
|
||||
|
@ -644,19 +658,7 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
gtk_widget_set_size_request (GTK_WIDGET (shell->qmask), 16, 16);
|
||||
GTK_WIDGET_UNSET_FLAGS (shell->qmask, GTK_CAN_FOCUS);
|
||||
|
||||
if (gdisp->gimage->qmask_state)
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmask), TRUE);
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_QMASK_ON,
|
||||
GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmask), FALSE);
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_QMASK_OFF,
|
||||
GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_QMASK_OFF, GTK_ICON_SIZE_MENU);
|
||||
gtk_container_add (GTK_CONTAINER (shell->qmask), image);
|
||||
gtk_widget_show (image);
|
||||
|
||||
|
@ -793,6 +795,8 @@ gimp_display_shell_reconnect (GimpDisplayShell *shell)
|
|||
|
||||
gimp_statusbar_resize_cursor (GIMP_STATUSBAR (shell->statusbar));
|
||||
gimp_display_shell_shrink_wrap (shell);
|
||||
|
||||
g_signal_emit (G_OBJECT (shell), display_shell_signals[RECONNECT], 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1126,16 +1130,17 @@ gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell,
|
|||
|
||||
/* Select */
|
||||
|
||||
SET_SENSITIVE ("/Select/Invert", lp && sel);
|
||||
SET_SENSITIVE ("/Select/All", lp);
|
||||
SET_SENSITIVE ("/Select/None", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Float", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Feather...", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Sharpen", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Shrink...", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Grow...", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Border...", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Save to Channel", lp && sel && !fs);
|
||||
SET_SENSITIVE ("/Select/Invert", lp && sel);
|
||||
SET_SENSITIVE ("/Select/All", lp);
|
||||
SET_SENSITIVE ("/Select/None", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Float", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Feather...", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Sharpen", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Shrink...", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Grow...", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Border...", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Toggle QuickMask", gdisp);
|
||||
SET_SENSITIVE ("/Select/Save to Channel", lp && sel && !fs);
|
||||
|
||||
/* View */
|
||||
|
||||
|
@ -2531,7 +2536,5 @@ gimp_display_shell_close_warning_callback (GtkWidget *widget,
|
|||
shell->warning_dialog = NULL;
|
||||
|
||||
if (close)
|
||||
{
|
||||
gimp_display_delete (shell->gdisp);
|
||||
}
|
||||
gimp_display_delete (shell->gdisp);
|
||||
}
|
||||
|
|
|
@ -146,8 +146,9 @@ struct _GimpDisplayShellClass
|
|||
{
|
||||
GtkWindowClass parent_class;
|
||||
|
||||
void (* scaled) (GimpDisplayShell *shell);
|
||||
void (* scrolled) (GimpDisplayShell *shell);
|
||||
void (* scaled) (GimpDisplayShell *shell);
|
||||
void (* scrolled) (GimpDisplayShell *shell);
|
||||
void (* reconnect) (GimpDisplayShell *shell);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
|
|||
shell);
|
||||
|
||||
gimp_display_shell_invalidate_preview_handler (gimage, shell);
|
||||
gimp_display_shell_qmask_changed_handler (gimage, shell);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -262,9 +263,7 @@ gimp_display_shell_invalidate_preview_handler (GimpImage *gimage,
|
|||
GimpDisplayShell *shell)
|
||||
{
|
||||
if (shell->icon_idle_id)
|
||||
{
|
||||
g_source_remove (shell->icon_idle_id);
|
||||
}
|
||||
g_source_remove (shell->icon_idle_id);
|
||||
|
||||
shell->icon_idle_id = g_idle_add_full (G_PRIORITY_LOW,
|
||||
gimp_display_shell_idle_update_icon,
|
||||
|
|
|
@ -84,6 +84,7 @@ enum
|
|||
{
|
||||
SCALED,
|
||||
SCROLLED,
|
||||
RECONNECT,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
@ -185,9 +186,22 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass)
|
|||
gimp_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
display_shell_signals[RECONNECT] =
|
||||
g_signal_new ("reconnect",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GimpDisplayShellClass, reconnect),
|
||||
NULL, NULL,
|
||||
gimp_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
object_class->destroy = gimp_display_shell_destroy;
|
||||
|
||||
widget_class->delete_event = gimp_display_shell_delete_event;
|
||||
|
||||
klass->scaled = NULL;
|
||||
klass->scrolled = NULL;
|
||||
klass->reconnect = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -410,9 +424,9 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
image_width = gdisp->gimage->width;
|
||||
image_height = gdisp->gimage->height;
|
||||
|
||||
/* adjust the initial scale -- so that window fits on screen
|
||||
* the 75% value is the same as in gdisplay_shrink_wrap. It
|
||||
* probably should be a user-configurable option.
|
||||
/* adjust the initial scale -- so that window fits on screen the 75%
|
||||
* value is the same as in gimp_display_shell_shrink_wrap. It
|
||||
* probably should be a user-configurable option.
|
||||
*/
|
||||
s_width = gdk_screen_width () * 0.75;
|
||||
s_height = gdk_screen_height () * 0.75;
|
||||
|
@ -644,19 +658,7 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
gtk_widget_set_size_request (GTK_WIDGET (shell->qmask), 16, 16);
|
||||
GTK_WIDGET_UNSET_FLAGS (shell->qmask, GTK_CAN_FOCUS);
|
||||
|
||||
if (gdisp->gimage->qmask_state)
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmask), TRUE);
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_QMASK_ON,
|
||||
GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmask), FALSE);
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_QMASK_OFF,
|
||||
GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_QMASK_OFF, GTK_ICON_SIZE_MENU);
|
||||
gtk_container_add (GTK_CONTAINER (shell->qmask), image);
|
||||
gtk_widget_show (image);
|
||||
|
||||
|
@ -793,6 +795,8 @@ gimp_display_shell_reconnect (GimpDisplayShell *shell)
|
|||
|
||||
gimp_statusbar_resize_cursor (GIMP_STATUSBAR (shell->statusbar));
|
||||
gimp_display_shell_shrink_wrap (shell);
|
||||
|
||||
g_signal_emit (G_OBJECT (shell), display_shell_signals[RECONNECT], 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1126,16 +1130,17 @@ gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell,
|
|||
|
||||
/* Select */
|
||||
|
||||
SET_SENSITIVE ("/Select/Invert", lp && sel);
|
||||
SET_SENSITIVE ("/Select/All", lp);
|
||||
SET_SENSITIVE ("/Select/None", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Float", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Feather...", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Sharpen", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Shrink...", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Grow...", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Border...", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Save to Channel", lp && sel && !fs);
|
||||
SET_SENSITIVE ("/Select/Invert", lp && sel);
|
||||
SET_SENSITIVE ("/Select/All", lp);
|
||||
SET_SENSITIVE ("/Select/None", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Float", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Feather...", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Sharpen", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Shrink...", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Grow...", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Border...", lp && sel);
|
||||
SET_SENSITIVE ("/Select/Toggle QuickMask", gdisp);
|
||||
SET_SENSITIVE ("/Select/Save to Channel", lp && sel && !fs);
|
||||
|
||||
/* View */
|
||||
|
||||
|
@ -2531,7 +2536,5 @@ gimp_display_shell_close_warning_callback (GtkWidget *widget,
|
|||
shell->warning_dialog = NULL;
|
||||
|
||||
if (close)
|
||||
{
|
||||
gimp_display_delete (shell->gdisp);
|
||||
}
|
||||
gimp_display_delete (shell->gdisp);
|
||||
}
|
||||
|
|
|
@ -146,8 +146,9 @@ struct _GimpDisplayShellClass
|
|||
{
|
||||
GtkWindowClass parent_class;
|
||||
|
||||
void (* scaled) (GimpDisplayShell *shell);
|
||||
void (* scrolled) (GimpDisplayShell *shell);
|
||||
void (* scaled) (GimpDisplayShell *shell);
|
||||
void (* scrolled) (GimpDisplayShell *shell);
|
||||
void (* reconnect) (GimpDisplayShell *shell);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -93,6 +93,8 @@ static void gimp_navigation_view_shell_scaled (GimpDisplayShell *shell,
|
|||
GimpNavigationView *view);
|
||||
static void gimp_navigation_view_shell_scrolled (GimpDisplayShell *shell,
|
||||
GimpNavigationView *view);
|
||||
static void gimp_navigation_view_shell_reconnect (GimpDisplayShell *shell,
|
||||
GimpNavigationView *view);
|
||||
static void gimp_navigation_view_update_marker (GimpNavigationView *view);
|
||||
|
||||
|
||||
|
@ -195,8 +197,7 @@ gimp_navigation_view_destroy (GtkObject *object)
|
|||
if (view->shell)
|
||||
gimp_navigation_view_set_shell (view, NULL);
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
|
||||
|
@ -226,6 +227,9 @@ gimp_navigation_view_set_shell (GimpNavigationView *view,
|
|||
g_signal_handlers_disconnect_by_func (G_OBJECT (view->shell),
|
||||
gimp_navigation_view_shell_scrolled,
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (view->shell),
|
||||
gimp_navigation_view_shell_reconnect,
|
||||
view);
|
||||
}
|
||||
else if (shell)
|
||||
{
|
||||
|
@ -245,6 +249,9 @@ gimp_navigation_view_set_shell (GimpNavigationView *view,
|
|||
g_signal_connect (G_OBJECT (view->shell), "scrolled",
|
||||
G_CALLBACK (gimp_navigation_view_shell_scrolled),
|
||||
view);
|
||||
g_signal_connect (G_OBJECT (view->shell), "reconnect",
|
||||
G_CALLBACK (gimp_navigation_view_shell_reconnect),
|
||||
view);
|
||||
|
||||
gimp_navigation_view_shell_scaled (view->shell, view);
|
||||
}
|
||||
|
@ -708,6 +715,14 @@ gimp_navigation_view_shell_scrolled (GimpDisplayShell *shell,
|
|||
gimp_navigation_view_update_marker (view);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_navigation_view_shell_reconnect (GimpDisplayShell *shell,
|
||||
GimpNavigationView *view)
|
||||
{
|
||||
gimp_preview_set_viewable (GIMP_PREVIEW (view->preview),
|
||||
GIMP_VIEWABLE (shell->gdisp->gimage));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_navigation_view_update_marker (GimpNavigationView *view)
|
||||
{
|
||||
|
|
|
@ -93,6 +93,8 @@ static void gimp_navigation_view_shell_scaled (GimpDisplayShell *shell,
|
|||
GimpNavigationView *view);
|
||||
static void gimp_navigation_view_shell_scrolled (GimpDisplayShell *shell,
|
||||
GimpNavigationView *view);
|
||||
static void gimp_navigation_view_shell_reconnect (GimpDisplayShell *shell,
|
||||
GimpNavigationView *view);
|
||||
static void gimp_navigation_view_update_marker (GimpNavigationView *view);
|
||||
|
||||
|
||||
|
@ -195,8 +197,7 @@ gimp_navigation_view_destroy (GtkObject *object)
|
|||
if (view->shell)
|
||||
gimp_navigation_view_set_shell (view, NULL);
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
|
||||
|
@ -226,6 +227,9 @@ gimp_navigation_view_set_shell (GimpNavigationView *view,
|
|||
g_signal_handlers_disconnect_by_func (G_OBJECT (view->shell),
|
||||
gimp_navigation_view_shell_scrolled,
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (view->shell),
|
||||
gimp_navigation_view_shell_reconnect,
|
||||
view);
|
||||
}
|
||||
else if (shell)
|
||||
{
|
||||
|
@ -245,6 +249,9 @@ gimp_navigation_view_set_shell (GimpNavigationView *view,
|
|||
g_signal_connect (G_OBJECT (view->shell), "scrolled",
|
||||
G_CALLBACK (gimp_navigation_view_shell_scrolled),
|
||||
view);
|
||||
g_signal_connect (G_OBJECT (view->shell), "reconnect",
|
||||
G_CALLBACK (gimp_navigation_view_shell_reconnect),
|
||||
view);
|
||||
|
||||
gimp_navigation_view_shell_scaled (view->shell, view);
|
||||
}
|
||||
|
@ -708,6 +715,14 @@ gimp_navigation_view_shell_scrolled (GimpDisplayShell *shell,
|
|||
gimp_navigation_view_update_marker (view);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_navigation_view_shell_reconnect (GimpDisplayShell *shell,
|
||||
GimpNavigationView *view)
|
||||
{
|
||||
gimp_preview_set_viewable (GIMP_PREVIEW (view->preview),
|
||||
GIMP_VIEWABLE (shell->gdisp->gimage));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_navigation_view_update_marker (GimpNavigationView *view)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue