mirror of https://github.com/GNOME/gimp.git
connect to the user context's "display_changed" and to the image context's
1999-06-21 Michael Natterer <mitschel@cs.tu-berlin.de> * app/context_manager.c: connect to the user context's "display_changed" and to the image context's "remove" signal to avoid dangling references and to set the menu sensitivity on display change. * app/disp_callbacks.c * app/file_new_dialog.c * app/fileops.c * app/gdisplay.c * app/gdisplay_ops.c * app/gimpcontext.c * app/interface.[ch]: entirely moved the active display stuff to the user context: - The active display is set by any event in the display shell, by File/New and File/Open. - gdisplay_delete() resets the active display to NULL if we deleted the active display. - Reduced gdisplay_active() to a single statement returning the context's active display. Should replace it by a macro. - gdisplay_flush_whenever() sets the menu sensitivity for the active display. - Removed global variable popup_shell since it was only set all the time but never used. I guess it's original job is now done by the context anyway. - gdisplay_set_menu_sensitivity() works with gdisp == NULL. - There are mysterious Gdk-CRITICALs if both <Image> and one of it's sub-menus are teared-off. Probably a gtk+ bug. To do all this stuff at a central place, there needs to be a GimpSet of displays (and ideally, GDisplay should be a GtkObject). * app/commands.c * app/lc_dialog.c: fixed segfaults happening with teared-off menus.
This commit is contained in:
parent
1446497832
commit
a72dbe86b4
37
ChangeLog
37
ChangeLog
|
@ -1,3 +1,40 @@
|
|||
1999-06-21 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||
|
||||
* app/context_manager.c: connect to the user context's
|
||||
"display_changed" and to the image context's "remove" signal to
|
||||
avoid dangling references and to set the menu sensitivity on
|
||||
display change.
|
||||
|
||||
* app/disp_callbacks.c
|
||||
* app/file_new_dialog.c
|
||||
* app/fileops.c
|
||||
* app/gdisplay.c
|
||||
* app/gdisplay_ops.c
|
||||
* app/gimpcontext.c
|
||||
* app/interface.[ch]: entirely moved the active display stuff to
|
||||
the user context:
|
||||
|
||||
- The active display is set by any event in the display shell,
|
||||
by File/New and File/Open.
|
||||
- gdisplay_delete() resets the active display to NULL if we
|
||||
deleted the active display.
|
||||
- Reduced gdisplay_active() to a single statement returning the
|
||||
context's active display. Should replace it by a macro.
|
||||
- gdisplay_flush_whenever() sets the menu sensitivity for the
|
||||
active display.
|
||||
- Removed global variable popup_shell since it was only set all
|
||||
the time but never used. I guess it's original job is now done
|
||||
by the context anyway.
|
||||
- gdisplay_set_menu_sensitivity() works with gdisp == NULL.
|
||||
- There are mysterious Gdk-CRITICALs if both <Image> and one of
|
||||
it's sub-menus are teared-off. Probably a gtk+ bug.
|
||||
|
||||
To do all this stuff at a central place, there needs to be a
|
||||
GimpSet of displays (and ideally, GDisplay should be a GtkObject).
|
||||
|
||||
* app/commands.c
|
||||
* app/lc_dialog.c: fixed segfaults happening with teared-off menus.
|
||||
|
||||
1999-06-21 Tuomas Kuosmanen <tigert@gimp.org>
|
||||
|
||||
* pixmaps/delete.xpm: New icon for Delete (layer, path, channel etc..)
|
||||
|
|
|
@ -1027,6 +1027,8 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
if (!tool_info[callback_action].init_func)
|
||||
{
|
||||
/* Activate the approriate widget */
|
||||
|
@ -1035,16 +1037,14 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
else
|
||||
{
|
||||
/* if the tool_info has an init_func */
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
gtk_widget_activate (tool_info[callback_action].tool_widget);
|
||||
|
||||
(* tool_info[callback_action].init_func) (gdisp);
|
||||
if (gdisp)
|
||||
(* tool_info[callback_action].init_func) (gdisp);
|
||||
}
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
if (gdisp)
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1027,6 +1027,8 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
if (!tool_info[callback_action].init_func)
|
||||
{
|
||||
/* Activate the approriate widget */
|
||||
|
@ -1035,16 +1037,14 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
else
|
||||
{
|
||||
/* if the tool_info has an init_func */
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
gtk_widget_activate (tool_info[callback_action].tool_widget);
|
||||
|
||||
(* tool_info[callback_action].init_func) (gdisp);
|
||||
if (gdisp)
|
||||
(* tool_info[callback_action].init_func) (gdisp);
|
||||
}
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
if (gdisp)
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -18,6 +18,29 @@
|
|||
|
||||
#include "context_manager.h"
|
||||
|
||||
#include "appenv.h"
|
||||
#include "gdisplay.h"
|
||||
|
||||
static void
|
||||
user_context_display_changed (GimpContext *context,
|
||||
GDisplay *display,
|
||||
gpointer data)
|
||||
{
|
||||
gdisplay_set_menu_sensitivity (display);
|
||||
}
|
||||
|
||||
/* FIXME: finally, install callbacks for all created contexts to prevent
|
||||
* the image from appearing without notifying us
|
||||
*/
|
||||
static void
|
||||
image_context_image_removed (GimpSet *set,
|
||||
GimpImage *gimage,
|
||||
GimpContext *user_context)
|
||||
{
|
||||
if (gimp_context_get_image (user_context) == gimage)
|
||||
gimp_context_set_image (user_context, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
context_manager_init (void)
|
||||
{
|
||||
|
@ -38,6 +61,13 @@ context_manager_init (void)
|
|||
context = gimp_context_new ("User", NULL, NULL);
|
||||
gimp_context_set_user (context);
|
||||
gimp_context_set_current (context);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (context), "display_changed",
|
||||
GTK_SIGNAL_FUNC (user_context_display_changed),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (image_context), "remove",
|
||||
GTK_SIGNAL_FUNC (image_context_image_removed),
|
||||
context);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -547,7 +547,8 @@ gimp_context_set_display (GimpContext *context,
|
|||
context->display = display;
|
||||
|
||||
/* set the image _before_ emitting the display_changed signal */
|
||||
gimp_context_set_image (orig, display ? display->gimage : NULL);
|
||||
if (display)
|
||||
gimp_context_set_image (orig, display);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (context),
|
||||
gimp_context_signals[DISPLAY_CHANGED],
|
||||
|
|
|
@ -328,10 +328,6 @@ gdisplay_delete (GDisplay *gdisp)
|
|||
if (gdisp->window_info_dialog)
|
||||
info_window_free (gdisp->window_info_dialog);
|
||||
|
||||
/* set popup_shell to NULL if appropriate */
|
||||
if (popup_shell == gdisp->shell)
|
||||
popup_shell= NULL;
|
||||
|
||||
/* set the active display to NULL */
|
||||
context = gimp_context_get_user ();
|
||||
if (gimp_context_get_display (context) == gdisp)
|
||||
|
@ -603,8 +599,9 @@ gdisplay_flush_displays_only (GDisplay *gdisp)
|
|||
static void
|
||||
gdisplay_flush_whenever (GDisplay *gdisp, gboolean now)
|
||||
{
|
||||
GSList *list;
|
||||
GArea *ga;
|
||||
GSList *list;
|
||||
GArea *ga;
|
||||
GimpContext *context;
|
||||
|
||||
/* Flush the items in the displays and updates lists -
|
||||
* but only if gdisplay has been mapped and exposed
|
||||
|
@ -645,6 +642,11 @@ gdisplay_flush_whenever (GDisplay *gdisp, gboolean now)
|
|||
if (gdisp->window_info_dialog)
|
||||
info_window_update (gdisp->window_info_dialog,
|
||||
(void *) gdisp);
|
||||
|
||||
/* ensure the consistency of the tear-off menus */
|
||||
context = gimp_context_get_user ();
|
||||
if (gimp_context_get_display (context) == gdisp)
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1541,95 +1543,131 @@ gdisplay_remove_tool_cursor (GDisplay *gdisp)
|
|||
void
|
||||
gdisplay_set_menu_sensitivity (GDisplay *gdisp)
|
||||
{
|
||||
Layer *layer;
|
||||
gint fs;
|
||||
gint aux;
|
||||
gint lm;
|
||||
gint lp;
|
||||
Layer *layer = NULL;
|
||||
gint fs = FALSE;
|
||||
gint aux = FALSE;
|
||||
gint lm = FALSE;
|
||||
gint lp = FALSE;
|
||||
gint alpha = FALSE;
|
||||
GimpDrawable *drawable;
|
||||
gint base_type;
|
||||
gint type;
|
||||
gint lind;
|
||||
gint lnum;
|
||||
GimpDrawable *drawable = NULL;
|
||||
gint base_type = 0;
|
||||
gint type = -1;
|
||||
gint lind = -1;
|
||||
gint lnum = -1;
|
||||
|
||||
fs = (gimage_floating_sel (gdisp->gimage) != NULL);
|
||||
aux = (gimage_get_active_channel (gdisp->gimage) != NULL);
|
||||
if ((layer = gimage_get_active_layer (gdisp->gimage)) != NULL)
|
||||
lm = (layer->mask) ? TRUE : FALSE;
|
||||
else
|
||||
lm = FALSE;
|
||||
base_type = gimage_base_type (gdisp->gimage);
|
||||
lp = (gdisp->gimage->layers != NULL);
|
||||
alpha = layer && layer_has_alpha (layer);
|
||||
|
||||
type = -1;
|
||||
lind = -1;
|
||||
lnum = -1;
|
||||
if (lp)
|
||||
if (gdisp)
|
||||
{
|
||||
drawable = gimage_active_drawable (gdisp->gimage);
|
||||
type = drawable_type (drawable);
|
||||
lind = gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
lnum = g_slist_length (gdisp->gimage->layers);
|
||||
fs = (gimage_floating_sel (gdisp->gimage) != NULL);
|
||||
aux = (gimage_get_active_channel (gdisp->gimage) != NULL);
|
||||
if ((layer = gimage_get_active_layer (gdisp->gimage)) != NULL)
|
||||
lm = (layer->mask) ? TRUE : FALSE;
|
||||
base_type = gimage_base_type (gdisp->gimage);
|
||||
lp = (gdisp->gimage->layers != NULL);
|
||||
alpha = layer && layer_has_alpha (layer);
|
||||
|
||||
if (lp)
|
||||
{
|
||||
drawable = gimage_active_drawable (gdisp->gimage);
|
||||
type = drawable_type (drawable);
|
||||
lind = gimage_get_layer_index (gdisp->gimage,
|
||||
gdisp->gimage->active_layer);
|
||||
lnum = g_slist_length (gdisp->gimage->layers);
|
||||
}
|
||||
}
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Previous Layer"), !fs && !aux && lp && lind > 0);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Next Layer"), !fs && !aux && lp && lind < (lnum - 1));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Raise Layer"), !fs && !aux && lp && alpha && lind > 0);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Lower Layer"), !fs && !aux && lp && alpha && lind < (lnum - 1));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Layer to Top"), !fs && !aux && lp && alpha && lind > 0);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Layer to Bottom"), !fs && !aux && lp && alpha && lind < (lnum - 1));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Anchor Layer"), fs && !aux && lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Merge Visible Layers"), !fs && !aux && lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Flatten Image"), !fs && !aux && lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Alpha To Selection"), !aux && lp && alpha);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Mask To Selection"), !aux && lm && lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Add Alpha Channel"), !fs && !aux && lp && !lm && !alpha);
|
||||
#define SET_SENSITIVE(menu,condition) \
|
||||
menus_set_sensitive_locale ("<Image>", N_(menu), (condition))
|
||||
#define SET_STATE(menu,condition) \
|
||||
menus_set_state_locale ("<Image>", N_(menu), (condition))
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/RGB"), (base_type != RGB));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Grayscale"), (base_type != GRAY));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Indexed"), (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/File/Save", gdisp);
|
||||
SET_SENSITIVE ("/File/Save as", gdisp);
|
||||
SET_SENSITIVE ("/File/Revert", gdisp);
|
||||
SET_SENSITIVE ("/File/Close", gdisp);
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Threshold"), (base_type != INDEXED));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Posterize") , (base_type != INDEXED));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Equalize"), (base_type != INDEXED));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Invert"), (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Edit", gdisp && lp);
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Color Balance"), (base_type == RGB));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Brightness-Contrast"), (base_type != INDEXED));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Hue-Saturation"), (base_type == RGB));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Curves"), (base_type != INDEXED));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Levels"), (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Select", gdisp && lp);
|
||||
SET_SENSITIVE ("/Select/Save To Channel", !fs);
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Desaturate"), (base_type == RGB));
|
||||
if (!gdisp)
|
||||
{
|
||||
SET_SENSITIVE ("/View", FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_SENSITIVE ("/View", TRUE);
|
||||
SET_STATE ("/View/Toggle Rulers",
|
||||
GTK_WIDGET_VISIBLE (gdisp->origin) ? 1 : 0);
|
||||
SET_STATE ("/View/Toggle Guides", gdisp->draw_guides);
|
||||
SET_STATE ("/View/Snap To Guides", gdisp->snap_to_guides);
|
||||
SET_STATE ("/View/Toggle Statusbar",
|
||||
GTK_WIDGET_VISIBLE (gdisp->statusarea) ? 1 : 0);
|
||||
SET_STATE ("/View/Dot for dot", gdisp->dot_for_dot);
|
||||
}
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Alpha/Add Alpha Channel"), !fs && !aux && lp && !lm && !alpha);
|
||||
if (!gdisp)
|
||||
{
|
||||
SET_SENSITIVE ("/Image", FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_SENSITIVE ("/Image", TRUE);
|
||||
SET_SENSITIVE ("/Image/RGB", (base_type != RGB));
|
||||
SET_SENSITIVE ("/Image/Grayscale", (base_type != GRAY));
|
||||
SET_SENSITIVE ("/Image/Indexed", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Threshold", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Posterize" , (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Equalize", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Invert", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Color Balance", (base_type == RGB));
|
||||
SET_SENSITIVE ("/Image/Colors/Brightness-Contrast",
|
||||
(base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Hue-Saturation", (base_type == RGB));
|
||||
SET_SENSITIVE ("/Image/Colors/Curves", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Levels", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Desaturate", (base_type == RGB));
|
||||
SET_SENSITIVE ("/Image/Alpha/Add Alpha Channel",
|
||||
!fs && !aux && lp && !lm && !alpha);
|
||||
SET_SENSITIVE ("/Image/Colors", lp);
|
||||
SET_SENSITIVE ("/Image/Channel Ops/Offset", lp);
|
||||
SET_SENSITIVE ("/Image/Histogram", lp);
|
||||
}
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Select"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Cut"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Copy"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Paste"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Paste Into"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Clear"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Fill"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Stroke"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Cut Named"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Copy Named"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Paste Named"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Channel Ops/Offset"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Histogram"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Filters"), lp);
|
||||
if (!gdisp)
|
||||
{
|
||||
SET_SENSITIVE ("/Layers/Stack", FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_SENSITIVE ("/Layers/Stack", TRUE);
|
||||
SET_SENSITIVE ("/Layers/Stack/Previous Layer",
|
||||
!fs && !aux && lp && lind > 0);
|
||||
SET_SENSITIVE ("/Layers/Stack/Next Layer",
|
||||
!fs && !aux && lp && lind < (lnum - 1));
|
||||
SET_SENSITIVE ("/Layers/Stack/Raise Layer",
|
||||
!fs && !aux && lp && alpha && lind > 0);
|
||||
SET_SENSITIVE ("/Layers/Stack/Lower Layer",
|
||||
!fs && !aux && lp && alpha && lind < (lnum - 1));
|
||||
SET_SENSITIVE ("/Layers/Stack/Layer to Top",
|
||||
!fs && !aux && lp && alpha && lind > 0);
|
||||
SET_SENSITIVE ("/Layers/Stack/Layer to Bottom",
|
||||
!fs && !aux && lp && alpha && lind < (lnum - 1));
|
||||
}
|
||||
|
||||
/* save selection to channel */
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Select/Save To Channel"), !fs);
|
||||
SET_SENSITIVE ("/Layers/Anchor Layer", gdisp && fs && !aux && lp);
|
||||
SET_SENSITIVE ("/Layers/Merge Visible Layers", gdisp && !fs && !aux && lp);
|
||||
SET_SENSITIVE ("/Layers/Flatten Image", gdisp && !fs && !aux && lp);
|
||||
SET_SENSITIVE ("/Layers/Alpha To Selection", gdisp && !aux && lp && alpha);
|
||||
SET_SENSITIVE ("/Layers/Mask To Selection", gdisp && !aux && lm && lp);
|
||||
SET_SENSITIVE ("/Layers/Add Alpha Channel",
|
||||
gdisp && !fs && !aux && lp && !lm && !alpha);
|
||||
|
||||
menus_set_state_locale ("<Image>", N_("/View/Toggle Rulers"), GTK_WIDGET_VISIBLE (gdisp->origin) ? 1 : 0);
|
||||
menus_set_state_locale ("<Image>", N_("/View/Toggle Guides"), gdisp->draw_guides);
|
||||
menus_set_state_locale ("<Image>", N_("/View/Snap To Guides"), gdisp->snap_to_guides);
|
||||
menus_set_state_locale ("<Image>", N_("/View/Toggle Statusbar"), GTK_WIDGET_VISIBLE (gdisp->statusarea) ? 1 : 0);
|
||||
menus_set_state_locale ("<Image>", N_("/View/Dot for dot"), gdisp->dot_for_dot);
|
||||
SET_SENSITIVE ("/Filters", gdisp && lp);
|
||||
SET_SENSITIVE ("/Script-Fu", gdisp && lp);
|
||||
|
||||
#undef SET_STATE
|
||||
#undef SET_SENSITIVE
|
||||
|
||||
plug_in_set_menu_sensitivity (type);
|
||||
}
|
||||
|
@ -1682,59 +1720,7 @@ gdisplay_expose_full (GDisplay *gdisp)
|
|||
GDisplay *
|
||||
gdisplay_active ()
|
||||
{
|
||||
/* FIXME: this function may become useless once the GimpContext, which also
|
||||
* has an active display, is properly tested
|
||||
* TODO: ensure that gimp_context_get_display (gimp_context_get_user ())
|
||||
* _always_ return the correct display
|
||||
*
|
||||
* ideally, this function's body should be:
|
||||
* {
|
||||
* return gimp_context_get_display (gimp_context_get_user ());
|
||||
* }
|
||||
*/
|
||||
|
||||
GtkWidget *event_widget;
|
||||
GtkWidget *toplevel_widget;
|
||||
GdkEvent *event;
|
||||
GDisplay *gdisp = NULL;
|
||||
|
||||
/* If the popup shell is valid, then get the gdisplay associated
|
||||
* with that shell
|
||||
*/
|
||||
event = gtk_get_current_event ();
|
||||
event_widget = gtk_get_event_widget (event);
|
||||
if (event != NULL)
|
||||
gdk_event_free (event);
|
||||
|
||||
if (event_widget == NULL)
|
||||
return NULL;
|
||||
|
||||
toplevel_widget = gtk_widget_get_toplevel (event_widget);
|
||||
|
||||
if (display_ht)
|
||||
gdisp = g_hash_table_lookup (display_ht, toplevel_widget);
|
||||
|
||||
if (gdisp)
|
||||
return gdisp;
|
||||
|
||||
/* The following is insane, since the checking if the display is valid
|
||||
* should not be here - this will be corrected, if the active_image stuff
|
||||
* moves to GimpContext. */
|
||||
|
||||
gdisp = gimp_context_get_display (gimp_context_get_user ());
|
||||
|
||||
if (g_slist_index(display_list, gdisp) >= 0)
|
||||
return gdisp;
|
||||
|
||||
/* disabled, since tear-off menus may have pointers to gone displays...
|
||||
* if (popup_shell)
|
||||
* {
|
||||
* gdisp = gtk_object_get_user_data (GTK_OBJECT (popup_shell));
|
||||
* return gdisp;
|
||||
* }
|
||||
*/
|
||||
|
||||
return NULL;
|
||||
return gimp_context_get_display (gimp_context_get_user ());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1770,7 +1756,8 @@ gdisplay_update_title (GDisplay *gdisp)
|
|||
gdk_window_set_title (gdisp->shell->window, title);
|
||||
|
||||
/* update the statusbar */
|
||||
context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "title");
|
||||
context_id =
|
||||
gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "title");
|
||||
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), context_id);
|
||||
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), context_id, title);
|
||||
}
|
||||
|
|
|
@ -146,12 +146,7 @@ file_new_create_image (NewImageValues *vals)
|
|||
|
||||
gdisplay = gdisplay_new (gimage, 0x0101);
|
||||
|
||||
/* Update L&C because the last automatic update at image creation
|
||||
* time happened when the new image had no layers at all
|
||||
*
|
||||
* TODO: make L&C aware of the image's "repaint" signal
|
||||
*/
|
||||
lc_dialog_flush ();
|
||||
gimp_context_set_display (gimp_context_get_user (), gdisplay);
|
||||
}
|
||||
|
||||
g_free (vals);
|
||||
|
|
|
@ -116,11 +116,6 @@ gdisplay_shell_events (GtkWidget *w,
|
|||
case GDK_KEY_PRESS:
|
||||
/* Setting the context's display automatically sets the image, too */
|
||||
gimp_context_set_display (gimp_context_get_user (), gdisp);
|
||||
|
||||
/* Always set the menu sensitivity to ensure the consitency of the
|
||||
* tear-off menus
|
||||
*/
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -284,9 +279,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
|
||||
case 3:
|
||||
state |= GDK_BUTTON3_MASK;
|
||||
popup_shell = gdisp->shell;
|
||||
gtk_menu_popup (GTK_MENU (gdisp->popup), NULL, NULL, NULL, NULL, 3, bevent->time);
|
||||
|
||||
gtk_menu_popup (GTK_MENU (gdisp->popup),
|
||||
NULL, NULL, NULL, NULL, 3, bevent->time);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -543,7 +537,6 @@ gdisplay_origin_button_press (GtkWidget *widget,
|
|||
if (event->button == 1)
|
||||
{
|
||||
gdisp = data;
|
||||
popup_shell = gdisp->shell;
|
||||
gtk_menu_popup (GTK_MENU (gdisp->popup),
|
||||
NULL, NULL, NULL, NULL, 1, event->time);
|
||||
}
|
||||
|
|
|
@ -116,11 +116,6 @@ gdisplay_shell_events (GtkWidget *w,
|
|||
case GDK_KEY_PRESS:
|
||||
/* Setting the context's display automatically sets the image, too */
|
||||
gimp_context_set_display (gimp_context_get_user (), gdisp);
|
||||
|
||||
/* Always set the menu sensitivity to ensure the consitency of the
|
||||
* tear-off menus
|
||||
*/
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -284,9 +279,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
|
||||
case 3:
|
||||
state |= GDK_BUTTON3_MASK;
|
||||
popup_shell = gdisp->shell;
|
||||
gtk_menu_popup (GTK_MENU (gdisp->popup), NULL, NULL, NULL, NULL, 3, bevent->time);
|
||||
|
||||
gtk_menu_popup (GTK_MENU (gdisp->popup),
|
||||
NULL, NULL, NULL, NULL, 3, bevent->time);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -543,7 +537,6 @@ gdisplay_origin_button_press (GtkWidget *widget,
|
|||
if (event->button == 1)
|
||||
{
|
||||
gdisp = data;
|
||||
popup_shell = gdisp->shell;
|
||||
gtk_menu_popup (GTK_MENU (gdisp->popup),
|
||||
NULL, NULL, NULL, NULL, 1, event->time);
|
||||
}
|
||||
|
|
|
@ -122,12 +122,12 @@ gdisplay_close_window (GDisplay *gdisp,
|
|||
*/
|
||||
if (!kill_it && (gdisp->gimage->ref_count == 1) &&
|
||||
(gdisp->gimage->dirty > 0) && confirm_on_close )
|
||||
gdisplay_close_warning_dialog (g_basename (gimage_filename (gdisp->gimage)), gdisp);
|
||||
{
|
||||
gdisplay_close_warning_dialog
|
||||
(g_basename (gimage_filename (gdisp->gimage)), gdisp);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If POPUP_SHELL references this shell, then reset it. */
|
||||
if (popup_shell == gdisp->shell)
|
||||
popup_shell = NULL;
|
||||
gtk_widget_destroy (gdisp->shell);
|
||||
}
|
||||
}
|
||||
|
@ -306,10 +306,6 @@ gdisplay_close_warning_callback (GtkWidget *w,
|
|||
mbox = (GtkWidget *) client_data;
|
||||
gdisp = (GDisplay *) gtk_object_get_user_data (GTK_OBJECT (mbox));
|
||||
|
||||
/* If POPUP_SHELL references this shell, then reset it. */
|
||||
if (popup_shell == gdisp->shell)
|
||||
popup_shell = NULL;
|
||||
|
||||
gtk_widget_destroy (gdisp->shell);
|
||||
gtk_widget_destroy (mbox);
|
||||
}
|
||||
|
|
|
@ -328,10 +328,6 @@ gdisplay_delete (GDisplay *gdisp)
|
|||
if (gdisp->window_info_dialog)
|
||||
info_window_free (gdisp->window_info_dialog);
|
||||
|
||||
/* set popup_shell to NULL if appropriate */
|
||||
if (popup_shell == gdisp->shell)
|
||||
popup_shell= NULL;
|
||||
|
||||
/* set the active display to NULL */
|
||||
context = gimp_context_get_user ();
|
||||
if (gimp_context_get_display (context) == gdisp)
|
||||
|
@ -603,8 +599,9 @@ gdisplay_flush_displays_only (GDisplay *gdisp)
|
|||
static void
|
||||
gdisplay_flush_whenever (GDisplay *gdisp, gboolean now)
|
||||
{
|
||||
GSList *list;
|
||||
GArea *ga;
|
||||
GSList *list;
|
||||
GArea *ga;
|
||||
GimpContext *context;
|
||||
|
||||
/* Flush the items in the displays and updates lists -
|
||||
* but only if gdisplay has been mapped and exposed
|
||||
|
@ -645,6 +642,11 @@ gdisplay_flush_whenever (GDisplay *gdisp, gboolean now)
|
|||
if (gdisp->window_info_dialog)
|
||||
info_window_update (gdisp->window_info_dialog,
|
||||
(void *) gdisp);
|
||||
|
||||
/* ensure the consistency of the tear-off menus */
|
||||
context = gimp_context_get_user ();
|
||||
if (gimp_context_get_display (context) == gdisp)
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1541,95 +1543,131 @@ gdisplay_remove_tool_cursor (GDisplay *gdisp)
|
|||
void
|
||||
gdisplay_set_menu_sensitivity (GDisplay *gdisp)
|
||||
{
|
||||
Layer *layer;
|
||||
gint fs;
|
||||
gint aux;
|
||||
gint lm;
|
||||
gint lp;
|
||||
Layer *layer = NULL;
|
||||
gint fs = FALSE;
|
||||
gint aux = FALSE;
|
||||
gint lm = FALSE;
|
||||
gint lp = FALSE;
|
||||
gint alpha = FALSE;
|
||||
GimpDrawable *drawable;
|
||||
gint base_type;
|
||||
gint type;
|
||||
gint lind;
|
||||
gint lnum;
|
||||
GimpDrawable *drawable = NULL;
|
||||
gint base_type = 0;
|
||||
gint type = -1;
|
||||
gint lind = -1;
|
||||
gint lnum = -1;
|
||||
|
||||
fs = (gimage_floating_sel (gdisp->gimage) != NULL);
|
||||
aux = (gimage_get_active_channel (gdisp->gimage) != NULL);
|
||||
if ((layer = gimage_get_active_layer (gdisp->gimage)) != NULL)
|
||||
lm = (layer->mask) ? TRUE : FALSE;
|
||||
else
|
||||
lm = FALSE;
|
||||
base_type = gimage_base_type (gdisp->gimage);
|
||||
lp = (gdisp->gimage->layers != NULL);
|
||||
alpha = layer && layer_has_alpha (layer);
|
||||
|
||||
type = -1;
|
||||
lind = -1;
|
||||
lnum = -1;
|
||||
if (lp)
|
||||
if (gdisp)
|
||||
{
|
||||
drawable = gimage_active_drawable (gdisp->gimage);
|
||||
type = drawable_type (drawable);
|
||||
lind = gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
lnum = g_slist_length (gdisp->gimage->layers);
|
||||
fs = (gimage_floating_sel (gdisp->gimage) != NULL);
|
||||
aux = (gimage_get_active_channel (gdisp->gimage) != NULL);
|
||||
if ((layer = gimage_get_active_layer (gdisp->gimage)) != NULL)
|
||||
lm = (layer->mask) ? TRUE : FALSE;
|
||||
base_type = gimage_base_type (gdisp->gimage);
|
||||
lp = (gdisp->gimage->layers != NULL);
|
||||
alpha = layer && layer_has_alpha (layer);
|
||||
|
||||
if (lp)
|
||||
{
|
||||
drawable = gimage_active_drawable (gdisp->gimage);
|
||||
type = drawable_type (drawable);
|
||||
lind = gimage_get_layer_index (gdisp->gimage,
|
||||
gdisp->gimage->active_layer);
|
||||
lnum = g_slist_length (gdisp->gimage->layers);
|
||||
}
|
||||
}
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Previous Layer"), !fs && !aux && lp && lind > 0);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Next Layer"), !fs && !aux && lp && lind < (lnum - 1));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Raise Layer"), !fs && !aux && lp && alpha && lind > 0);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Lower Layer"), !fs && !aux && lp && alpha && lind < (lnum - 1));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Layer to Top"), !fs && !aux && lp && alpha && lind > 0);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Layer to Bottom"), !fs && !aux && lp && alpha && lind < (lnum - 1));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Anchor Layer"), fs && !aux && lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Merge Visible Layers"), !fs && !aux && lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Flatten Image"), !fs && !aux && lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Alpha To Selection"), !aux && lp && alpha);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Mask To Selection"), !aux && lm && lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Add Alpha Channel"), !fs && !aux && lp && !lm && !alpha);
|
||||
#define SET_SENSITIVE(menu,condition) \
|
||||
menus_set_sensitive_locale ("<Image>", N_(menu), (condition))
|
||||
#define SET_STATE(menu,condition) \
|
||||
menus_set_state_locale ("<Image>", N_(menu), (condition))
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/RGB"), (base_type != RGB));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Grayscale"), (base_type != GRAY));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Indexed"), (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/File/Save", gdisp);
|
||||
SET_SENSITIVE ("/File/Save as", gdisp);
|
||||
SET_SENSITIVE ("/File/Revert", gdisp);
|
||||
SET_SENSITIVE ("/File/Close", gdisp);
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Threshold"), (base_type != INDEXED));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Posterize") , (base_type != INDEXED));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Equalize"), (base_type != INDEXED));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Invert"), (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Edit", gdisp && lp);
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Color Balance"), (base_type == RGB));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Brightness-Contrast"), (base_type != INDEXED));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Hue-Saturation"), (base_type == RGB));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Curves"), (base_type != INDEXED));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Levels"), (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Select", gdisp && lp);
|
||||
SET_SENSITIVE ("/Select/Save To Channel", !fs);
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Desaturate"), (base_type == RGB));
|
||||
if (!gdisp)
|
||||
{
|
||||
SET_SENSITIVE ("/View", FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_SENSITIVE ("/View", TRUE);
|
||||
SET_STATE ("/View/Toggle Rulers",
|
||||
GTK_WIDGET_VISIBLE (gdisp->origin) ? 1 : 0);
|
||||
SET_STATE ("/View/Toggle Guides", gdisp->draw_guides);
|
||||
SET_STATE ("/View/Snap To Guides", gdisp->snap_to_guides);
|
||||
SET_STATE ("/View/Toggle Statusbar",
|
||||
GTK_WIDGET_VISIBLE (gdisp->statusarea) ? 1 : 0);
|
||||
SET_STATE ("/View/Dot for dot", gdisp->dot_for_dot);
|
||||
}
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Alpha/Add Alpha Channel"), !fs && !aux && lp && !lm && !alpha);
|
||||
if (!gdisp)
|
||||
{
|
||||
SET_SENSITIVE ("/Image", FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_SENSITIVE ("/Image", TRUE);
|
||||
SET_SENSITIVE ("/Image/RGB", (base_type != RGB));
|
||||
SET_SENSITIVE ("/Image/Grayscale", (base_type != GRAY));
|
||||
SET_SENSITIVE ("/Image/Indexed", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Threshold", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Posterize" , (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Equalize", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Invert", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Color Balance", (base_type == RGB));
|
||||
SET_SENSITIVE ("/Image/Colors/Brightness-Contrast",
|
||||
(base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Hue-Saturation", (base_type == RGB));
|
||||
SET_SENSITIVE ("/Image/Colors/Curves", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Levels", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Desaturate", (base_type == RGB));
|
||||
SET_SENSITIVE ("/Image/Alpha/Add Alpha Channel",
|
||||
!fs && !aux && lp && !lm && !alpha);
|
||||
SET_SENSITIVE ("/Image/Colors", lp);
|
||||
SET_SENSITIVE ("/Image/Channel Ops/Offset", lp);
|
||||
SET_SENSITIVE ("/Image/Histogram", lp);
|
||||
}
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Select"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Cut"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Copy"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Paste"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Paste Into"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Clear"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Fill"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Stroke"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Cut Named"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Copy Named"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Paste Named"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Channel Ops/Offset"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Histogram"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Filters"), lp);
|
||||
if (!gdisp)
|
||||
{
|
||||
SET_SENSITIVE ("/Layers/Stack", FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_SENSITIVE ("/Layers/Stack", TRUE);
|
||||
SET_SENSITIVE ("/Layers/Stack/Previous Layer",
|
||||
!fs && !aux && lp && lind > 0);
|
||||
SET_SENSITIVE ("/Layers/Stack/Next Layer",
|
||||
!fs && !aux && lp && lind < (lnum - 1));
|
||||
SET_SENSITIVE ("/Layers/Stack/Raise Layer",
|
||||
!fs && !aux && lp && alpha && lind > 0);
|
||||
SET_SENSITIVE ("/Layers/Stack/Lower Layer",
|
||||
!fs && !aux && lp && alpha && lind < (lnum - 1));
|
||||
SET_SENSITIVE ("/Layers/Stack/Layer to Top",
|
||||
!fs && !aux && lp && alpha && lind > 0);
|
||||
SET_SENSITIVE ("/Layers/Stack/Layer to Bottom",
|
||||
!fs && !aux && lp && alpha && lind < (lnum - 1));
|
||||
}
|
||||
|
||||
/* save selection to channel */
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Select/Save To Channel"), !fs);
|
||||
SET_SENSITIVE ("/Layers/Anchor Layer", gdisp && fs && !aux && lp);
|
||||
SET_SENSITIVE ("/Layers/Merge Visible Layers", gdisp && !fs && !aux && lp);
|
||||
SET_SENSITIVE ("/Layers/Flatten Image", gdisp && !fs && !aux && lp);
|
||||
SET_SENSITIVE ("/Layers/Alpha To Selection", gdisp && !aux && lp && alpha);
|
||||
SET_SENSITIVE ("/Layers/Mask To Selection", gdisp && !aux && lm && lp);
|
||||
SET_SENSITIVE ("/Layers/Add Alpha Channel",
|
||||
gdisp && !fs && !aux && lp && !lm && !alpha);
|
||||
|
||||
menus_set_state_locale ("<Image>", N_("/View/Toggle Rulers"), GTK_WIDGET_VISIBLE (gdisp->origin) ? 1 : 0);
|
||||
menus_set_state_locale ("<Image>", N_("/View/Toggle Guides"), gdisp->draw_guides);
|
||||
menus_set_state_locale ("<Image>", N_("/View/Snap To Guides"), gdisp->snap_to_guides);
|
||||
menus_set_state_locale ("<Image>", N_("/View/Toggle Statusbar"), GTK_WIDGET_VISIBLE (gdisp->statusarea) ? 1 : 0);
|
||||
menus_set_state_locale ("<Image>", N_("/View/Dot for dot"), gdisp->dot_for_dot);
|
||||
SET_SENSITIVE ("/Filters", gdisp && lp);
|
||||
SET_SENSITIVE ("/Script-Fu", gdisp && lp);
|
||||
|
||||
#undef SET_STATE
|
||||
#undef SET_SENSITIVE
|
||||
|
||||
plug_in_set_menu_sensitivity (type);
|
||||
}
|
||||
|
@ -1682,59 +1720,7 @@ gdisplay_expose_full (GDisplay *gdisp)
|
|||
GDisplay *
|
||||
gdisplay_active ()
|
||||
{
|
||||
/* FIXME: this function may become useless once the GimpContext, which also
|
||||
* has an active display, is properly tested
|
||||
* TODO: ensure that gimp_context_get_display (gimp_context_get_user ())
|
||||
* _always_ return the correct display
|
||||
*
|
||||
* ideally, this function's body should be:
|
||||
* {
|
||||
* return gimp_context_get_display (gimp_context_get_user ());
|
||||
* }
|
||||
*/
|
||||
|
||||
GtkWidget *event_widget;
|
||||
GtkWidget *toplevel_widget;
|
||||
GdkEvent *event;
|
||||
GDisplay *gdisp = NULL;
|
||||
|
||||
/* If the popup shell is valid, then get the gdisplay associated
|
||||
* with that shell
|
||||
*/
|
||||
event = gtk_get_current_event ();
|
||||
event_widget = gtk_get_event_widget (event);
|
||||
if (event != NULL)
|
||||
gdk_event_free (event);
|
||||
|
||||
if (event_widget == NULL)
|
||||
return NULL;
|
||||
|
||||
toplevel_widget = gtk_widget_get_toplevel (event_widget);
|
||||
|
||||
if (display_ht)
|
||||
gdisp = g_hash_table_lookup (display_ht, toplevel_widget);
|
||||
|
||||
if (gdisp)
|
||||
return gdisp;
|
||||
|
||||
/* The following is insane, since the checking if the display is valid
|
||||
* should not be here - this will be corrected, if the active_image stuff
|
||||
* moves to GimpContext. */
|
||||
|
||||
gdisp = gimp_context_get_display (gimp_context_get_user ());
|
||||
|
||||
if (g_slist_index(display_list, gdisp) >= 0)
|
||||
return gdisp;
|
||||
|
||||
/* disabled, since tear-off menus may have pointers to gone displays...
|
||||
* if (popup_shell)
|
||||
* {
|
||||
* gdisp = gtk_object_get_user_data (GTK_OBJECT (popup_shell));
|
||||
* return gdisp;
|
||||
* }
|
||||
*/
|
||||
|
||||
return NULL;
|
||||
return gimp_context_get_display (gimp_context_get_user ());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1770,7 +1756,8 @@ gdisplay_update_title (GDisplay *gdisp)
|
|||
gdk_window_set_title (gdisp->shell->window, title);
|
||||
|
||||
/* update the statusbar */
|
||||
context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "title");
|
||||
context_id =
|
||||
gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "title");
|
||||
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), context_id);
|
||||
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), context_id, title);
|
||||
}
|
||||
|
|
|
@ -116,11 +116,6 @@ gdisplay_shell_events (GtkWidget *w,
|
|||
case GDK_KEY_PRESS:
|
||||
/* Setting the context's display automatically sets the image, too */
|
||||
gimp_context_set_display (gimp_context_get_user (), gdisp);
|
||||
|
||||
/* Always set the menu sensitivity to ensure the consitency of the
|
||||
* tear-off menus
|
||||
*/
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -284,9 +279,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
|
||||
case 3:
|
||||
state |= GDK_BUTTON3_MASK;
|
||||
popup_shell = gdisp->shell;
|
||||
gtk_menu_popup (GTK_MENU (gdisp->popup), NULL, NULL, NULL, NULL, 3, bevent->time);
|
||||
|
||||
gtk_menu_popup (GTK_MENU (gdisp->popup),
|
||||
NULL, NULL, NULL, NULL, 3, bevent->time);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -543,7 +537,6 @@ gdisplay_origin_button_press (GtkWidget *widget,
|
|||
if (event->button == 1)
|
||||
{
|
||||
gdisp = data;
|
||||
popup_shell = gdisp->shell;
|
||||
gtk_menu_popup (GTK_MENU (gdisp->popup),
|
||||
NULL, NULL, NULL, NULL, 1, event->time);
|
||||
}
|
||||
|
|
|
@ -95,18 +95,11 @@ extern int num_tools;
|
|||
/* Widgets for each tool button--these are used from command.c to activate on
|
||||
* tool selection via both menus and keyboard accelerators.
|
||||
*/
|
||||
GtkWidget *tool_label;
|
||||
GtkTooltips *tool_tips;
|
||||
GtkWidget * tool_label;
|
||||
GtkTooltips * tool_tips;
|
||||
|
||||
/* The popup shell is a pointer to the gdisplay shell that posted the latest
|
||||
* popup menu. When this is null, and a command is invoked, then the
|
||||
* assumption is that the command was a result of a keyboard accelerator
|
||||
*/
|
||||
GtkWidget *popup_shell = NULL;
|
||||
|
||||
|
||||
static GdkColor colors[12];
|
||||
static GtkWidget *toolbox_shell = NULL;
|
||||
static GdkColor colors[12];
|
||||
static GtkWidget * toolbox_shell = NULL;
|
||||
|
||||
static void
|
||||
tools_select_update (GtkWidget *w,
|
||||
|
@ -133,7 +126,9 @@ tools_button_press (GtkWidget *w,
|
|||
}
|
||||
|
||||
static gint
|
||||
toolbox_delete (GtkWidget *w, GdkEvent *e, gpointer data)
|
||||
toolbox_delete (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
gpointer data)
|
||||
{
|
||||
app_exit (0);
|
||||
|
||||
|
@ -147,7 +142,9 @@ toolbox_destroy ()
|
|||
}
|
||||
|
||||
static gint
|
||||
toolbox_check_device (GtkWidget *w, GdkEvent *e, gpointer data)
|
||||
toolbox_check_device (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
gpointer data)
|
||||
{
|
||||
devices_check_change (e);
|
||||
|
||||
|
@ -163,8 +160,8 @@ gdisplay_destroy (GtkWidget *w,
|
|||
|
||||
static gint
|
||||
gdisplay_delete (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
GDisplay *gdisp)
|
||||
GdkEvent *e,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
gdisplay_close_window (gdisp, FALSE);
|
||||
|
||||
|
@ -274,9 +271,9 @@ create_color_area (GtkWidget *parent)
|
|||
gtk_widget_show (frame);
|
||||
}
|
||||
|
||||
|
||||
GdkPixmap *
|
||||
create_tool_pixmap (GtkWidget *parent, ToolType type)
|
||||
create_tool_pixmap (GtkWidget *parent,
|
||||
ToolType type)
|
||||
{
|
||||
/*
|
||||
* FIXME this really should be dones without using the #defined tool names
|
||||
|
@ -369,7 +366,6 @@ create_tools (GtkWidget *parent)
|
|||
gtk_widget_show (table);
|
||||
}
|
||||
|
||||
|
||||
static GdkPixmap *
|
||||
create_pixmap (GdkWindow *parent, GdkBitmap **mask,
|
||||
char **data, int width, int height)
|
||||
|
@ -582,7 +578,6 @@ toolbox_raise_callback (GtkWidget *widget,
|
|||
gdk_window_raise(toolbox_shell->window);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
create_display_shell (GDisplay* gdisp,
|
||||
int width,
|
||||
|
@ -860,7 +855,7 @@ static void double_query_box_ok_callback (GtkWidget *, gpointer);
|
|||
static void size_query_box_ok_callback (GtkWidget *, gpointer);
|
||||
|
||||
/* create a generic query box without any entry widget */
|
||||
QueryBox *
|
||||
static QueryBox *
|
||||
create_query_box (gchar *title,
|
||||
gchar *message,
|
||||
GtkObject *object,
|
||||
|
|
|
@ -22,15 +22,14 @@
|
|||
#include "gdisplayF.h"
|
||||
#include "libgimp/gimpunit.h"
|
||||
|
||||
/* typedefs */
|
||||
/* typedefs */
|
||||
typedef void (*QueryFunc) (GtkWidget *, gpointer, gpointer);
|
||||
|
||||
/* externed variables */
|
||||
extern GtkWidget *tool_widgets[];
|
||||
extern GtkWidget *popup_shell;
|
||||
extern GtkTooltips *tool_tips;
|
||||
/* externed variables */
|
||||
extern GtkWidget * tool_widgets[];
|
||||
extern GtkTooltips * tool_tips;
|
||||
|
||||
/* function declarations */
|
||||
/* function declarations */
|
||||
GtkWidget * create_pixmap_widget (GdkWindow *parent,
|
||||
char **data,
|
||||
int width,
|
||||
|
@ -51,15 +50,9 @@ void create_display_shell (GDisplay *gdisp,
|
|||
char *title,
|
||||
int type);
|
||||
|
||||
/* commented out because these functions are not in interface.c
|
||||
* is this a bug or did I miss something?? -- michael
|
||||
* void position_dialog (GtkWidget *, gpointer, gpointer);
|
||||
* void center_dialog (GtkWidget *, gpointer, gpointer);
|
||||
*/
|
||||
|
||||
/* some simple query dialogs
|
||||
* if object != NULL then the query boxes will connect their cancel callback
|
||||
* to the provided signal of this object
|
||||
/* some simple query dialogs
|
||||
* if object != NULL then the query boxes will connect their cancel callback
|
||||
* to the provided signal of this object
|
||||
*/
|
||||
GtkWidget * query_string_box (gchar *title,
|
||||
gchar *message,
|
||||
|
@ -101,7 +94,7 @@ GtkWidget * query_size_box (gchar *title,
|
|||
QueryFunc callback,
|
||||
gpointer data);
|
||||
|
||||
/* a simple message box */
|
||||
/* a simple message box */
|
||||
GtkWidget * message_box (char *message,
|
||||
GtkCallback callback,
|
||||
gpointer data);
|
||||
|
@ -109,4 +102,4 @@ GtkWidget * message_box (char *message,
|
|||
void tools_push_label (char *label);
|
||||
void tools_pop_label (void);
|
||||
|
||||
#endif /* INTERFACE_H */
|
||||
#endif /* __INTERFACE_H__ */
|
||||
|
|
|
@ -95,18 +95,11 @@ extern int num_tools;
|
|||
/* Widgets for each tool button--these are used from command.c to activate on
|
||||
* tool selection via both menus and keyboard accelerators.
|
||||
*/
|
||||
GtkWidget *tool_label;
|
||||
GtkTooltips *tool_tips;
|
||||
GtkWidget * tool_label;
|
||||
GtkTooltips * tool_tips;
|
||||
|
||||
/* The popup shell is a pointer to the gdisplay shell that posted the latest
|
||||
* popup menu. When this is null, and a command is invoked, then the
|
||||
* assumption is that the command was a result of a keyboard accelerator
|
||||
*/
|
||||
GtkWidget *popup_shell = NULL;
|
||||
|
||||
|
||||
static GdkColor colors[12];
|
||||
static GtkWidget *toolbox_shell = NULL;
|
||||
static GdkColor colors[12];
|
||||
static GtkWidget * toolbox_shell = NULL;
|
||||
|
||||
static void
|
||||
tools_select_update (GtkWidget *w,
|
||||
|
@ -133,7 +126,9 @@ tools_button_press (GtkWidget *w,
|
|||
}
|
||||
|
||||
static gint
|
||||
toolbox_delete (GtkWidget *w, GdkEvent *e, gpointer data)
|
||||
toolbox_delete (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
gpointer data)
|
||||
{
|
||||
app_exit (0);
|
||||
|
||||
|
@ -147,7 +142,9 @@ toolbox_destroy ()
|
|||
}
|
||||
|
||||
static gint
|
||||
toolbox_check_device (GtkWidget *w, GdkEvent *e, gpointer data)
|
||||
toolbox_check_device (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
gpointer data)
|
||||
{
|
||||
devices_check_change (e);
|
||||
|
||||
|
@ -163,8 +160,8 @@ gdisplay_destroy (GtkWidget *w,
|
|||
|
||||
static gint
|
||||
gdisplay_delete (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
GDisplay *gdisp)
|
||||
GdkEvent *e,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
gdisplay_close_window (gdisp, FALSE);
|
||||
|
||||
|
@ -274,9 +271,9 @@ create_color_area (GtkWidget *parent)
|
|||
gtk_widget_show (frame);
|
||||
}
|
||||
|
||||
|
||||
GdkPixmap *
|
||||
create_tool_pixmap (GtkWidget *parent, ToolType type)
|
||||
create_tool_pixmap (GtkWidget *parent,
|
||||
ToolType type)
|
||||
{
|
||||
/*
|
||||
* FIXME this really should be dones without using the #defined tool names
|
||||
|
@ -369,7 +366,6 @@ create_tools (GtkWidget *parent)
|
|||
gtk_widget_show (table);
|
||||
}
|
||||
|
||||
|
||||
static GdkPixmap *
|
||||
create_pixmap (GdkWindow *parent, GdkBitmap **mask,
|
||||
char **data, int width, int height)
|
||||
|
@ -582,7 +578,6 @@ toolbox_raise_callback (GtkWidget *widget,
|
|||
gdk_window_raise(toolbox_shell->window);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
create_display_shell (GDisplay* gdisp,
|
||||
int width,
|
||||
|
@ -860,7 +855,7 @@ static void double_query_box_ok_callback (GtkWidget *, gpointer);
|
|||
static void size_query_box_ok_callback (GtkWidget *, gpointer);
|
||||
|
||||
/* create a generic query box without any entry widget */
|
||||
QueryBox *
|
||||
static QueryBox *
|
||||
create_query_box (gchar *title,
|
||||
gchar *message,
|
||||
GtkObject *object,
|
||||
|
|
|
@ -22,15 +22,14 @@
|
|||
#include "gdisplayF.h"
|
||||
#include "libgimp/gimpunit.h"
|
||||
|
||||
/* typedefs */
|
||||
/* typedefs */
|
||||
typedef void (*QueryFunc) (GtkWidget *, gpointer, gpointer);
|
||||
|
||||
/* externed variables */
|
||||
extern GtkWidget *tool_widgets[];
|
||||
extern GtkWidget *popup_shell;
|
||||
extern GtkTooltips *tool_tips;
|
||||
/* externed variables */
|
||||
extern GtkWidget * tool_widgets[];
|
||||
extern GtkTooltips * tool_tips;
|
||||
|
||||
/* function declarations */
|
||||
/* function declarations */
|
||||
GtkWidget * create_pixmap_widget (GdkWindow *parent,
|
||||
char **data,
|
||||
int width,
|
||||
|
@ -51,15 +50,9 @@ void create_display_shell (GDisplay *gdisp,
|
|||
char *title,
|
||||
int type);
|
||||
|
||||
/* commented out because these functions are not in interface.c
|
||||
* is this a bug or did I miss something?? -- michael
|
||||
* void position_dialog (GtkWidget *, gpointer, gpointer);
|
||||
* void center_dialog (GtkWidget *, gpointer, gpointer);
|
||||
*/
|
||||
|
||||
/* some simple query dialogs
|
||||
* if object != NULL then the query boxes will connect their cancel callback
|
||||
* to the provided signal of this object
|
||||
/* some simple query dialogs
|
||||
* if object != NULL then the query boxes will connect their cancel callback
|
||||
* to the provided signal of this object
|
||||
*/
|
||||
GtkWidget * query_string_box (gchar *title,
|
||||
gchar *message,
|
||||
|
@ -101,7 +94,7 @@ GtkWidget * query_size_box (gchar *title,
|
|||
QueryFunc callback,
|
||||
gpointer data);
|
||||
|
||||
/* a simple message box */
|
||||
/* a simple message box */
|
||||
GtkWidget * message_box (char *message,
|
||||
GtkCallback callback,
|
||||
gpointer data);
|
||||
|
@ -109,4 +102,4 @@ GtkWidget * message_box (char *message,
|
|||
void tools_push_label (char *label);
|
||||
void tools_pop_label (void);
|
||||
|
||||
#endif /* INTERFACE_H */
|
||||
#endif /* __INTERFACE_H__ */
|
||||
|
|
|
@ -146,12 +146,7 @@ file_new_create_image (NewImageValues *vals)
|
|||
|
||||
gdisplay = gdisplay_new (gimage, 0x0101);
|
||||
|
||||
/* Update L&C because the last automatic update at image creation
|
||||
* time happened when the new image had no layers at all
|
||||
*
|
||||
* TODO: make L&C aware of the image's "repaint" signal
|
||||
*/
|
||||
lc_dialog_flush ();
|
||||
gimp_context_set_display (gimp_context_get_user (), gdisplay);
|
||||
}
|
||||
|
||||
g_free (vals);
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "gdisplay.h"
|
||||
#include "general.h"
|
||||
#include "gimage.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "fileops.h"
|
||||
#include "interface.h"
|
||||
#include "menus.h"
|
||||
|
@ -141,7 +142,9 @@ GSList *save_procs = NULL;
|
|||
static PlugInProcDef *load_file_proc = NULL;
|
||||
static PlugInProcDef *save_file_proc = NULL;
|
||||
|
||||
static GimpImage* the_gimage = NULL;
|
||||
static GimpImage *the_gimage = NULL;
|
||||
|
||||
extern GSList *display_list; /* from gdisplay.c */
|
||||
|
||||
#define FILE_ERR_MESSAGE(str) G_STMT_START{ \
|
||||
if (message_handler == MESSAGE_BOX) \
|
||||
|
@ -215,7 +218,6 @@ file_open_callback (GtkWidget *w,
|
|||
GtkWidget *option_menu;
|
||||
GtkWidget *load_menu;
|
||||
GtkWidget *open_options_genbutton;
|
||||
GDisplay *gdisplay;
|
||||
|
||||
if (!fileload)
|
||||
{
|
||||
|
@ -251,8 +253,6 @@ file_open_callback (GtkWidget *w,
|
|||
gtk_window_set_title (GTK_WINDOW (fileload), _("Load Image"));
|
||||
}
|
||||
|
||||
gdisplay = gdisplay_active ();
|
||||
|
||||
if (!open_options)
|
||||
{
|
||||
GtkWidget* frame;
|
||||
|
@ -411,18 +411,20 @@ file_save_callback (GtkWidget *w,
|
|||
GDisplay *gdisplay;
|
||||
|
||||
gdisplay = gdisplay_active ();
|
||||
if (!gdisplay) return;
|
||||
|
||||
/* Only save if the gimage has been modified */
|
||||
if (gdisplay->gimage->dirty != 0)
|
||||
{
|
||||
if (gdisplay->gimage->has_filename == FALSE)
|
||||
{
|
||||
popup_shell = gdisplay->shell;
|
||||
file_save_as_callback (w, client_data);
|
||||
}
|
||||
else
|
||||
file_save (gdisplay->gimage, gimage_filename (gdisplay->gimage),
|
||||
g_basename (gimage_filename(gdisplay->gimage)), 2);
|
||||
{
|
||||
file_save (gdisplay->gimage, gimage_filename (gdisplay->gimage),
|
||||
g_basename (gimage_filename(gdisplay->gimage)), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -464,6 +466,7 @@ file_save_as_callback (GtkWidget *w,
|
|||
}
|
||||
|
||||
gdisplay = gdisplay_active ();
|
||||
if (!gdisplay) return;
|
||||
the_gimage = gdisplay->gimage;
|
||||
|
||||
if (!save_options)
|
||||
|
@ -517,6 +520,7 @@ file_revert_callback (GtkWidget *w,
|
|||
char *filename, *raw_filename;
|
||||
|
||||
gdisplay = gdisplay_active ();
|
||||
if (!gdisplay) return;
|
||||
|
||||
if (gdisplay->gimage->has_filename == FALSE)
|
||||
g_message (_("Can't revert. No filename associated with this image"));
|
||||
|
@ -649,6 +653,7 @@ int
|
|||
file_open (char *filename, char *raw_filename)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GDisplay *gdisplay;
|
||||
|
||||
if ((gimage = file_open_image (filename, raw_filename, RUN_INTERACTIVE)) != NULL)
|
||||
{
|
||||
|
@ -659,7 +664,11 @@ file_open (char *filename, char *raw_filename)
|
|||
gimage_clean_all (gimage);
|
||||
|
||||
/* display the image */
|
||||
gdisplay_new (gimage, 0x0101);
|
||||
gdisplay = gdisplay_new (gimage, 0x0101);
|
||||
|
||||
/* always activate the first display */
|
||||
if (g_slist_length (display_list) == 1)
|
||||
gimp_context_set_display (gimp_context_get_user (), gdisplay);
|
||||
|
||||
idea_add (filename);
|
||||
menus_last_opened_add (filename);
|
||||
|
@ -1549,8 +1558,12 @@ file_dialog_hide (GtkWidget *filesel)
|
|||
|
||||
menus_set_sensitive_locale ("<Toolbox>", N_("/File/Open"), TRUE);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/File/Open"), TRUE);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/File/Save"), TRUE);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/File/Save as"), TRUE);
|
||||
|
||||
if (gdisplay_active())
|
||||
{
|
||||
menus_set_sensitive_locale ("<Image>", N_("/File/Save"), TRUE);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/File/Save as"), TRUE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
259
app/gdisplay.c
259
app/gdisplay.c
|
@ -328,10 +328,6 @@ gdisplay_delete (GDisplay *gdisp)
|
|||
if (gdisp->window_info_dialog)
|
||||
info_window_free (gdisp->window_info_dialog);
|
||||
|
||||
/* set popup_shell to NULL if appropriate */
|
||||
if (popup_shell == gdisp->shell)
|
||||
popup_shell= NULL;
|
||||
|
||||
/* set the active display to NULL */
|
||||
context = gimp_context_get_user ();
|
||||
if (gimp_context_get_display (context) == gdisp)
|
||||
|
@ -603,8 +599,9 @@ gdisplay_flush_displays_only (GDisplay *gdisp)
|
|||
static void
|
||||
gdisplay_flush_whenever (GDisplay *gdisp, gboolean now)
|
||||
{
|
||||
GSList *list;
|
||||
GArea *ga;
|
||||
GSList *list;
|
||||
GArea *ga;
|
||||
GimpContext *context;
|
||||
|
||||
/* Flush the items in the displays and updates lists -
|
||||
* but only if gdisplay has been mapped and exposed
|
||||
|
@ -645,6 +642,11 @@ gdisplay_flush_whenever (GDisplay *gdisp, gboolean now)
|
|||
if (gdisp->window_info_dialog)
|
||||
info_window_update (gdisp->window_info_dialog,
|
||||
(void *) gdisp);
|
||||
|
||||
/* ensure the consistency of the tear-off menus */
|
||||
context = gimp_context_get_user ();
|
||||
if (gimp_context_get_display (context) == gdisp)
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1541,95 +1543,131 @@ gdisplay_remove_tool_cursor (GDisplay *gdisp)
|
|||
void
|
||||
gdisplay_set_menu_sensitivity (GDisplay *gdisp)
|
||||
{
|
||||
Layer *layer;
|
||||
gint fs;
|
||||
gint aux;
|
||||
gint lm;
|
||||
gint lp;
|
||||
Layer *layer = NULL;
|
||||
gint fs = FALSE;
|
||||
gint aux = FALSE;
|
||||
gint lm = FALSE;
|
||||
gint lp = FALSE;
|
||||
gint alpha = FALSE;
|
||||
GimpDrawable *drawable;
|
||||
gint base_type;
|
||||
gint type;
|
||||
gint lind;
|
||||
gint lnum;
|
||||
GimpDrawable *drawable = NULL;
|
||||
gint base_type = 0;
|
||||
gint type = -1;
|
||||
gint lind = -1;
|
||||
gint lnum = -1;
|
||||
|
||||
fs = (gimage_floating_sel (gdisp->gimage) != NULL);
|
||||
aux = (gimage_get_active_channel (gdisp->gimage) != NULL);
|
||||
if ((layer = gimage_get_active_layer (gdisp->gimage)) != NULL)
|
||||
lm = (layer->mask) ? TRUE : FALSE;
|
||||
else
|
||||
lm = FALSE;
|
||||
base_type = gimage_base_type (gdisp->gimage);
|
||||
lp = (gdisp->gimage->layers != NULL);
|
||||
alpha = layer && layer_has_alpha (layer);
|
||||
|
||||
type = -1;
|
||||
lind = -1;
|
||||
lnum = -1;
|
||||
if (lp)
|
||||
if (gdisp)
|
||||
{
|
||||
drawable = gimage_active_drawable (gdisp->gimage);
|
||||
type = drawable_type (drawable);
|
||||
lind = gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
lnum = g_slist_length (gdisp->gimage->layers);
|
||||
fs = (gimage_floating_sel (gdisp->gimage) != NULL);
|
||||
aux = (gimage_get_active_channel (gdisp->gimage) != NULL);
|
||||
if ((layer = gimage_get_active_layer (gdisp->gimage)) != NULL)
|
||||
lm = (layer->mask) ? TRUE : FALSE;
|
||||
base_type = gimage_base_type (gdisp->gimage);
|
||||
lp = (gdisp->gimage->layers != NULL);
|
||||
alpha = layer && layer_has_alpha (layer);
|
||||
|
||||
if (lp)
|
||||
{
|
||||
drawable = gimage_active_drawable (gdisp->gimage);
|
||||
type = drawable_type (drawable);
|
||||
lind = gimage_get_layer_index (gdisp->gimage,
|
||||
gdisp->gimage->active_layer);
|
||||
lnum = g_slist_length (gdisp->gimage->layers);
|
||||
}
|
||||
}
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Previous Layer"), !fs && !aux && lp && lind > 0);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Next Layer"), !fs && !aux && lp && lind < (lnum - 1));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Raise Layer"), !fs && !aux && lp && alpha && lind > 0);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Lower Layer"), !fs && !aux && lp && alpha && lind < (lnum - 1));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Layer to Top"), !fs && !aux && lp && alpha && lind > 0);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Stack/Layer to Bottom"), !fs && !aux && lp && alpha && lind < (lnum - 1));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Anchor Layer"), fs && !aux && lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Merge Visible Layers"), !fs && !aux && lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Flatten Image"), !fs && !aux && lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Alpha To Selection"), !aux && lp && alpha);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Mask To Selection"), !aux && lm && lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Layers/Add Alpha Channel"), !fs && !aux && lp && !lm && !alpha);
|
||||
#define SET_SENSITIVE(menu,condition) \
|
||||
menus_set_sensitive_locale ("<Image>", N_(menu), (condition))
|
||||
#define SET_STATE(menu,condition) \
|
||||
menus_set_state_locale ("<Image>", N_(menu), (condition))
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/RGB"), (base_type != RGB));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Grayscale"), (base_type != GRAY));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Indexed"), (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/File/Save", gdisp);
|
||||
SET_SENSITIVE ("/File/Save as", gdisp);
|
||||
SET_SENSITIVE ("/File/Revert", gdisp);
|
||||
SET_SENSITIVE ("/File/Close", gdisp);
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Threshold"), (base_type != INDEXED));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Posterize") , (base_type != INDEXED));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Equalize"), (base_type != INDEXED));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Invert"), (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Edit", gdisp && lp);
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Color Balance"), (base_type == RGB));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Brightness-Contrast"), (base_type != INDEXED));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Hue-Saturation"), (base_type == RGB));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Curves"), (base_type != INDEXED));
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Levels"), (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Select", gdisp && lp);
|
||||
SET_SENSITIVE ("/Select/Save To Channel", !fs);
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors/Desaturate"), (base_type == RGB));
|
||||
if (!gdisp)
|
||||
{
|
||||
SET_SENSITIVE ("/View", FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_SENSITIVE ("/View", TRUE);
|
||||
SET_STATE ("/View/Toggle Rulers",
|
||||
GTK_WIDGET_VISIBLE (gdisp->origin) ? 1 : 0);
|
||||
SET_STATE ("/View/Toggle Guides", gdisp->draw_guides);
|
||||
SET_STATE ("/View/Snap To Guides", gdisp->snap_to_guides);
|
||||
SET_STATE ("/View/Toggle Statusbar",
|
||||
GTK_WIDGET_VISIBLE (gdisp->statusarea) ? 1 : 0);
|
||||
SET_STATE ("/View/Dot for dot", gdisp->dot_for_dot);
|
||||
}
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Alpha/Add Alpha Channel"), !fs && !aux && lp && !lm && !alpha);
|
||||
if (!gdisp)
|
||||
{
|
||||
SET_SENSITIVE ("/Image", FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_SENSITIVE ("/Image", TRUE);
|
||||
SET_SENSITIVE ("/Image/RGB", (base_type != RGB));
|
||||
SET_SENSITIVE ("/Image/Grayscale", (base_type != GRAY));
|
||||
SET_SENSITIVE ("/Image/Indexed", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Threshold", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Posterize" , (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Equalize", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Invert", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Color Balance", (base_type == RGB));
|
||||
SET_SENSITIVE ("/Image/Colors/Brightness-Contrast",
|
||||
(base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Hue-Saturation", (base_type == RGB));
|
||||
SET_SENSITIVE ("/Image/Colors/Curves", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Levels", (base_type != INDEXED));
|
||||
SET_SENSITIVE ("/Image/Colors/Desaturate", (base_type == RGB));
|
||||
SET_SENSITIVE ("/Image/Alpha/Add Alpha Channel",
|
||||
!fs && !aux && lp && !lm && !alpha);
|
||||
SET_SENSITIVE ("/Image/Colors", lp);
|
||||
SET_SENSITIVE ("/Image/Channel Ops/Offset", lp);
|
||||
SET_SENSITIVE ("/Image/Histogram", lp);
|
||||
}
|
||||
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Select"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Cut"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Copy"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Paste"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Paste Into"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Clear"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Fill"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Stroke"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Cut Named"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Copy Named"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Edit/Paste Named"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Colors"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Channel Ops/Offset"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Image/Histogram"), lp);
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Filters"), lp);
|
||||
if (!gdisp)
|
||||
{
|
||||
SET_SENSITIVE ("/Layers/Stack", FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_SENSITIVE ("/Layers/Stack", TRUE);
|
||||
SET_SENSITIVE ("/Layers/Stack/Previous Layer",
|
||||
!fs && !aux && lp && lind > 0);
|
||||
SET_SENSITIVE ("/Layers/Stack/Next Layer",
|
||||
!fs && !aux && lp && lind < (lnum - 1));
|
||||
SET_SENSITIVE ("/Layers/Stack/Raise Layer",
|
||||
!fs && !aux && lp && alpha && lind > 0);
|
||||
SET_SENSITIVE ("/Layers/Stack/Lower Layer",
|
||||
!fs && !aux && lp && alpha && lind < (lnum - 1));
|
||||
SET_SENSITIVE ("/Layers/Stack/Layer to Top",
|
||||
!fs && !aux && lp && alpha && lind > 0);
|
||||
SET_SENSITIVE ("/Layers/Stack/Layer to Bottom",
|
||||
!fs && !aux && lp && alpha && lind < (lnum - 1));
|
||||
}
|
||||
|
||||
/* save selection to channel */
|
||||
menus_set_sensitive_locale ("<Image>", N_("/Select/Save To Channel"), !fs);
|
||||
SET_SENSITIVE ("/Layers/Anchor Layer", gdisp && fs && !aux && lp);
|
||||
SET_SENSITIVE ("/Layers/Merge Visible Layers", gdisp && !fs && !aux && lp);
|
||||
SET_SENSITIVE ("/Layers/Flatten Image", gdisp && !fs && !aux && lp);
|
||||
SET_SENSITIVE ("/Layers/Alpha To Selection", gdisp && !aux && lp && alpha);
|
||||
SET_SENSITIVE ("/Layers/Mask To Selection", gdisp && !aux && lm && lp);
|
||||
SET_SENSITIVE ("/Layers/Add Alpha Channel",
|
||||
gdisp && !fs && !aux && lp && !lm && !alpha);
|
||||
|
||||
menus_set_state_locale ("<Image>", N_("/View/Toggle Rulers"), GTK_WIDGET_VISIBLE (gdisp->origin) ? 1 : 0);
|
||||
menus_set_state_locale ("<Image>", N_("/View/Toggle Guides"), gdisp->draw_guides);
|
||||
menus_set_state_locale ("<Image>", N_("/View/Snap To Guides"), gdisp->snap_to_guides);
|
||||
menus_set_state_locale ("<Image>", N_("/View/Toggle Statusbar"), GTK_WIDGET_VISIBLE (gdisp->statusarea) ? 1 : 0);
|
||||
menus_set_state_locale ("<Image>", N_("/View/Dot for dot"), gdisp->dot_for_dot);
|
||||
SET_SENSITIVE ("/Filters", gdisp && lp);
|
||||
SET_SENSITIVE ("/Script-Fu", gdisp && lp);
|
||||
|
||||
#undef SET_STATE
|
||||
#undef SET_SENSITIVE
|
||||
|
||||
plug_in_set_menu_sensitivity (type);
|
||||
}
|
||||
|
@ -1682,59 +1720,7 @@ gdisplay_expose_full (GDisplay *gdisp)
|
|||
GDisplay *
|
||||
gdisplay_active ()
|
||||
{
|
||||
/* FIXME: this function may become useless once the GimpContext, which also
|
||||
* has an active display, is properly tested
|
||||
* TODO: ensure that gimp_context_get_display (gimp_context_get_user ())
|
||||
* _always_ return the correct display
|
||||
*
|
||||
* ideally, this function's body should be:
|
||||
* {
|
||||
* return gimp_context_get_display (gimp_context_get_user ());
|
||||
* }
|
||||
*/
|
||||
|
||||
GtkWidget *event_widget;
|
||||
GtkWidget *toplevel_widget;
|
||||
GdkEvent *event;
|
||||
GDisplay *gdisp = NULL;
|
||||
|
||||
/* If the popup shell is valid, then get the gdisplay associated
|
||||
* with that shell
|
||||
*/
|
||||
event = gtk_get_current_event ();
|
||||
event_widget = gtk_get_event_widget (event);
|
||||
if (event != NULL)
|
||||
gdk_event_free (event);
|
||||
|
||||
if (event_widget == NULL)
|
||||
return NULL;
|
||||
|
||||
toplevel_widget = gtk_widget_get_toplevel (event_widget);
|
||||
|
||||
if (display_ht)
|
||||
gdisp = g_hash_table_lookup (display_ht, toplevel_widget);
|
||||
|
||||
if (gdisp)
|
||||
return gdisp;
|
||||
|
||||
/* The following is insane, since the checking if the display is valid
|
||||
* should not be here - this will be corrected, if the active_image stuff
|
||||
* moves to GimpContext. */
|
||||
|
||||
gdisp = gimp_context_get_display (gimp_context_get_user ());
|
||||
|
||||
if (g_slist_index(display_list, gdisp) >= 0)
|
||||
return gdisp;
|
||||
|
||||
/* disabled, since tear-off menus may have pointers to gone displays...
|
||||
* if (popup_shell)
|
||||
* {
|
||||
* gdisp = gtk_object_get_user_data (GTK_OBJECT (popup_shell));
|
||||
* return gdisp;
|
||||
* }
|
||||
*/
|
||||
|
||||
return NULL;
|
||||
return gimp_context_get_display (gimp_context_get_user ());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1770,7 +1756,8 @@ gdisplay_update_title (GDisplay *gdisp)
|
|||
gdk_window_set_title (gdisp->shell->window, title);
|
||||
|
||||
/* update the statusbar */
|
||||
context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "title");
|
||||
context_id =
|
||||
gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "title");
|
||||
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), context_id);
|
||||
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), context_id, title);
|
||||
}
|
||||
|
|
|
@ -122,12 +122,12 @@ gdisplay_close_window (GDisplay *gdisp,
|
|||
*/
|
||||
if (!kill_it && (gdisp->gimage->ref_count == 1) &&
|
||||
(gdisp->gimage->dirty > 0) && confirm_on_close )
|
||||
gdisplay_close_warning_dialog (g_basename (gimage_filename (gdisp->gimage)), gdisp);
|
||||
{
|
||||
gdisplay_close_warning_dialog
|
||||
(g_basename (gimage_filename (gdisp->gimage)), gdisp);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If POPUP_SHELL references this shell, then reset it. */
|
||||
if (popup_shell == gdisp->shell)
|
||||
popup_shell = NULL;
|
||||
gtk_widget_destroy (gdisp->shell);
|
||||
}
|
||||
}
|
||||
|
@ -306,10 +306,6 @@ gdisplay_close_warning_callback (GtkWidget *w,
|
|||
mbox = (GtkWidget *) client_data;
|
||||
gdisp = (GDisplay *) gtk_object_get_user_data (GTK_OBJECT (mbox));
|
||||
|
||||
/* If POPUP_SHELL references this shell, then reset it. */
|
||||
if (popup_shell == gdisp->shell)
|
||||
popup_shell = NULL;
|
||||
|
||||
gtk_widget_destroy (gdisp->shell);
|
||||
gtk_widget_destroy (mbox);
|
||||
}
|
||||
|
|
|
@ -547,7 +547,8 @@ gimp_context_set_display (GimpContext *context,
|
|||
context->display = display;
|
||||
|
||||
/* set the image _before_ emitting the display_changed signal */
|
||||
gimp_context_set_image (orig, display ? display->gimage : NULL);
|
||||
if (display)
|
||||
gimp_context_set_image (orig, display);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (context),
|
||||
gimp_context_signals[DISPLAY_CHANGED],
|
||||
|
|
|
@ -1027,6 +1027,8 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
if (!tool_info[callback_action].init_func)
|
||||
{
|
||||
/* Activate the approriate widget */
|
||||
|
@ -1035,16 +1037,14 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
else
|
||||
{
|
||||
/* if the tool_info has an init_func */
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
gtk_widget_activate (tool_info[callback_action].tool_widget);
|
||||
|
||||
(* tool_info[callback_action].init_func) (gdisp);
|
||||
if (gdisp)
|
||||
(* tool_info[callback_action].init_func) (gdisp);
|
||||
}
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
if (gdisp)
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -146,12 +146,7 @@ file_new_create_image (NewImageValues *vals)
|
|||
|
||||
gdisplay = gdisplay_new (gimage, 0x0101);
|
||||
|
||||
/* Update L&C because the last automatic update at image creation
|
||||
* time happened when the new image had no layers at all
|
||||
*
|
||||
* TODO: make L&C aware of the image's "repaint" signal
|
||||
*/
|
||||
lc_dialog_flush ();
|
||||
gimp_context_set_display (gimp_context_get_user (), gdisplay);
|
||||
}
|
||||
|
||||
g_free (vals);
|
||||
|
|
|
@ -1027,6 +1027,8 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
if (!tool_info[callback_action].init_func)
|
||||
{
|
||||
/* Activate the approriate widget */
|
||||
|
@ -1035,16 +1037,14 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
else
|
||||
{
|
||||
/* if the tool_info has an init_func */
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
gtk_widget_activate (tool_info[callback_action].tool_widget);
|
||||
|
||||
(* tool_info[callback_action].init_func) (gdisp);
|
||||
if (gdisp)
|
||||
(* tool_info[callback_action].init_func) (gdisp);
|
||||
}
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
if (gdisp)
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -95,18 +95,11 @@ extern int num_tools;
|
|||
/* Widgets for each tool button--these are used from command.c to activate on
|
||||
* tool selection via both menus and keyboard accelerators.
|
||||
*/
|
||||
GtkWidget *tool_label;
|
||||
GtkTooltips *tool_tips;
|
||||
GtkWidget * tool_label;
|
||||
GtkTooltips * tool_tips;
|
||||
|
||||
/* The popup shell is a pointer to the gdisplay shell that posted the latest
|
||||
* popup menu. When this is null, and a command is invoked, then the
|
||||
* assumption is that the command was a result of a keyboard accelerator
|
||||
*/
|
||||
GtkWidget *popup_shell = NULL;
|
||||
|
||||
|
||||
static GdkColor colors[12];
|
||||
static GtkWidget *toolbox_shell = NULL;
|
||||
static GdkColor colors[12];
|
||||
static GtkWidget * toolbox_shell = NULL;
|
||||
|
||||
static void
|
||||
tools_select_update (GtkWidget *w,
|
||||
|
@ -133,7 +126,9 @@ tools_button_press (GtkWidget *w,
|
|||
}
|
||||
|
||||
static gint
|
||||
toolbox_delete (GtkWidget *w, GdkEvent *e, gpointer data)
|
||||
toolbox_delete (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
gpointer data)
|
||||
{
|
||||
app_exit (0);
|
||||
|
||||
|
@ -147,7 +142,9 @@ toolbox_destroy ()
|
|||
}
|
||||
|
||||
static gint
|
||||
toolbox_check_device (GtkWidget *w, GdkEvent *e, gpointer data)
|
||||
toolbox_check_device (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
gpointer data)
|
||||
{
|
||||
devices_check_change (e);
|
||||
|
||||
|
@ -163,8 +160,8 @@ gdisplay_destroy (GtkWidget *w,
|
|||
|
||||
static gint
|
||||
gdisplay_delete (GtkWidget *w,
|
||||
GdkEvent *e,
|
||||
GDisplay *gdisp)
|
||||
GdkEvent *e,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
gdisplay_close_window (gdisp, FALSE);
|
||||
|
||||
|
@ -274,9 +271,9 @@ create_color_area (GtkWidget *parent)
|
|||
gtk_widget_show (frame);
|
||||
}
|
||||
|
||||
|
||||
GdkPixmap *
|
||||
create_tool_pixmap (GtkWidget *parent, ToolType type)
|
||||
create_tool_pixmap (GtkWidget *parent,
|
||||
ToolType type)
|
||||
{
|
||||
/*
|
||||
* FIXME this really should be dones without using the #defined tool names
|
||||
|
@ -369,7 +366,6 @@ create_tools (GtkWidget *parent)
|
|||
gtk_widget_show (table);
|
||||
}
|
||||
|
||||
|
||||
static GdkPixmap *
|
||||
create_pixmap (GdkWindow *parent, GdkBitmap **mask,
|
||||
char **data, int width, int height)
|
||||
|
@ -582,7 +578,6 @@ toolbox_raise_callback (GtkWidget *widget,
|
|||
gdk_window_raise(toolbox_shell->window);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
create_display_shell (GDisplay* gdisp,
|
||||
int width,
|
||||
|
@ -860,7 +855,7 @@ static void double_query_box_ok_callback (GtkWidget *, gpointer);
|
|||
static void size_query_box_ok_callback (GtkWidget *, gpointer);
|
||||
|
||||
/* create a generic query box without any entry widget */
|
||||
QueryBox *
|
||||
static QueryBox *
|
||||
create_query_box (gchar *title,
|
||||
gchar *message,
|
||||
GtkObject *object,
|
||||
|
|
|
@ -22,15 +22,14 @@
|
|||
#include "gdisplayF.h"
|
||||
#include "libgimp/gimpunit.h"
|
||||
|
||||
/* typedefs */
|
||||
/* typedefs */
|
||||
typedef void (*QueryFunc) (GtkWidget *, gpointer, gpointer);
|
||||
|
||||
/* externed variables */
|
||||
extern GtkWidget *tool_widgets[];
|
||||
extern GtkWidget *popup_shell;
|
||||
extern GtkTooltips *tool_tips;
|
||||
/* externed variables */
|
||||
extern GtkWidget * tool_widgets[];
|
||||
extern GtkTooltips * tool_tips;
|
||||
|
||||
/* function declarations */
|
||||
/* function declarations */
|
||||
GtkWidget * create_pixmap_widget (GdkWindow *parent,
|
||||
char **data,
|
||||
int width,
|
||||
|
@ -51,15 +50,9 @@ void create_display_shell (GDisplay *gdisp,
|
|||
char *title,
|
||||
int type);
|
||||
|
||||
/* commented out because these functions are not in interface.c
|
||||
* is this a bug or did I miss something?? -- michael
|
||||
* void position_dialog (GtkWidget *, gpointer, gpointer);
|
||||
* void center_dialog (GtkWidget *, gpointer, gpointer);
|
||||
*/
|
||||
|
||||
/* some simple query dialogs
|
||||
* if object != NULL then the query boxes will connect their cancel callback
|
||||
* to the provided signal of this object
|
||||
/* some simple query dialogs
|
||||
* if object != NULL then the query boxes will connect their cancel callback
|
||||
* to the provided signal of this object
|
||||
*/
|
||||
GtkWidget * query_string_box (gchar *title,
|
||||
gchar *message,
|
||||
|
@ -101,7 +94,7 @@ GtkWidget * query_size_box (gchar *title,
|
|||
QueryFunc callback,
|
||||
gpointer data);
|
||||
|
||||
/* a simple message box */
|
||||
/* a simple message box */
|
||||
GtkWidget * message_box (char *message,
|
||||
GtkCallback callback,
|
||||
gpointer data);
|
||||
|
@ -109,4 +102,4 @@ GtkWidget * message_box (char *message,
|
|||
void tools_push_label (char *label);
|
||||
void tools_pop_label (void);
|
||||
|
||||
#endif /* INTERFACE_H */
|
||||
#endif /* __INTERFACE_H__ */
|
||||
|
|
|
@ -77,8 +77,15 @@ lc_dialog_create (GimpImage* gimage)
|
|||
gdk_window_raise (lc_dialog->shell->window);
|
||||
}
|
||||
|
||||
lc_dialog_update (gimage);
|
||||
lc_dialog_update_image_list ();
|
||||
if (gimage)
|
||||
{
|
||||
lc_dialog_update (gimage);
|
||||
lc_dialog_update_image_list ();
|
||||
}
|
||||
else
|
||||
{
|
||||
lc_dialog_update_image_list ();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue