mirror of https://github.com/GNOME/gimp.git
pass an additional "Gimp" pointer to
2002-03-20 Michael Natterer <mitch@gimp.org> * app/display/gimpdisplayshell.[ch]: pass an additional "Gimp" pointer to gimp_display_shell_set_menu_sensitivity() so we can correctly set the state of some items even without a display. Set the sensitivity of much more items. Never set submenus insensitive so the user can always browse the whole menu (according to the GNOME HIG). * app/image_map.c * app/display/gimpdisplay.c * app/gui/gui.c: changed accordingly. * app/gui/view-commands.[ch]: added a callback for the display filters dialog because display releted dialogs are going to be handled different soon. * app/gui/menus.c: use the new callback.
This commit is contained in:
parent
ed3db7585c
commit
e302aeb17d
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
|||
2002-03-20 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/display/gimpdisplayshell.[ch]: pass an additional "Gimp"
|
||||
pointer to gimp_display_shell_set_menu_sensitivity() so we can
|
||||
correctly set the state of some items even without a display.
|
||||
Set the sensitivity of much more items. Never set submenus
|
||||
insensitive so the user can always browse the whole menu
|
||||
(according to the GNOME HIG).
|
||||
|
||||
* app/image_map.c
|
||||
* app/display/gimpdisplay.c
|
||||
* app/gui/gui.c: changed accordingly.
|
||||
|
||||
* app/gui/view-commands.[ch]: added a callback for the display
|
||||
filters dialog because display releted dialogs are going to
|
||||
be handled different soon.
|
||||
|
||||
* app/gui/menus.c: use the new callback.
|
||||
|
||||
2002-03-20 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/core-enums.[ch]: registered GimpConvertDitherType and
|
||||
|
|
|
@ -34,6 +34,9 @@
|
|||
#include "display/gimpdisplayshell-scale.h"
|
||||
#include "display/gimpdisplayshell-selection.h"
|
||||
|
||||
#include "widgets/gimpdialogfactory.h"
|
||||
|
||||
#include "dialogs.h"
|
||||
#include "info-dialog.h"
|
||||
#include "info-window.h"
|
||||
#include "view-commands.h"
|
||||
|
@ -124,8 +127,8 @@ view_info_window_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
void
|
||||
view_nav_window_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
view_navigation_window_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpDisplayShell *shell;
|
||||
|
@ -146,6 +149,20 @@ view_nav_window_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_display_filters_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpDisplayShell *shell;
|
||||
return_if_no_display (gdisp, data);
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
gimp_dialog_factory_dialog_new (global_dialog_factory,
|
||||
"gimp:display-filters-dialog", -1);
|
||||
}
|
||||
|
||||
void
|
||||
view_toggle_selection_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
|
|
@ -33,7 +33,9 @@ void view_dot_for_dot_cmd_callback (GtkWidget *widget,
|
|||
gpointer data);
|
||||
void view_info_window_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_nav_window_cmd_callback (GtkWidget *widget,
|
||||
void view_navigation_window_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_display_filters_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_toggle_selection_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
|
|
@ -94,7 +94,8 @@ image_map_create (GimpDisplay *gdisp,
|
|||
* to avert any unintented undo interaction through the UI
|
||||
*/
|
||||
gimp_image_undo_freeze (image_map->gdisp->gimage);
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (image_map->gdisp->shell));
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (image_map->gdisp->shell),
|
||||
image_map->gdisp->gimage->gimp);
|
||||
|
||||
return image_map;
|
||||
}
|
||||
|
@ -245,7 +246,8 @@ image_map_commit (ImageMap *image_map)
|
|||
x1, y1, x2, y2, image_map->undo_tiles, FALSE);
|
||||
}
|
||||
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (image_map->gdisp->shell));
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (image_map->gdisp->shell),
|
||||
image_map->gdisp->gimage->gimp);
|
||||
g_free (image_map);
|
||||
}
|
||||
|
||||
|
@ -297,7 +299,8 @@ image_map_clear (ImageMap *image_map)
|
|||
g_message ("image depth change, unable to restore original image");
|
||||
tile_manager_destroy (image_map->undo_tiles);
|
||||
gimp_image_undo_thaw (image_map->gdisp->gimage);
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (image_map->gdisp->shell));
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (image_map->gdisp->shell),
|
||||
image_map->gdisp->gimage->gimp);
|
||||
g_free (image_map);
|
||||
return;
|
||||
}
|
||||
|
@ -322,7 +325,8 @@ image_map_abort (ImageMap *image_map)
|
|||
|
||||
image_map_clear (image_map);
|
||||
gimp_image_undo_thaw (image_map->gdisp->gimage);
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (image_map->gdisp->shell));
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (image_map->gdisp->shell),
|
||||
image_map->gdisp->gimage->gimp);
|
||||
g_free (image_map);
|
||||
}
|
||||
|
||||
|
|
|
@ -571,7 +571,8 @@ gimp_display_flush_whenever (GimpDisplay *gdisp,
|
|||
if (! now && gimp_context_get_display (gimp_get_user_context
|
||||
(gdisp->gimage->gimp)) == gdisp)
|
||||
{
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (gdisp->shell));
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (gdisp->shell),
|
||||
gdisp->gimage->gimp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -571,7 +571,8 @@ gimp_display_flush_whenever (GimpDisplay *gdisp,
|
|||
if (! now && gimp_context_get_display (gimp_get_user_context
|
||||
(gdisp->gimage->gimp)) == gdisp)
|
||||
{
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (gdisp->shell));
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (gdisp->shell),
|
||||
gdisp->gimage->gimp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -825,36 +825,47 @@ gimp_display_shell_untransform_coords (GimpDisplayShell *shell,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell)
|
||||
gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell,
|
||||
Gimp *gimp)
|
||||
{
|
||||
GimpDisplay *gdisp = NULL;
|
||||
GimpImage *gimage = NULL;
|
||||
GimpImageBaseType base_type = 0;
|
||||
GimpImageType type = -1;
|
||||
GimpDrawable *drawable = NULL;
|
||||
GimpLayer *layer = NULL;
|
||||
GimpRGB fg;
|
||||
GimpRGB bg;
|
||||
gboolean fs = FALSE;
|
||||
gboolean aux = FALSE;
|
||||
gboolean lm = FALSE;
|
||||
gboolean lp = FALSE;
|
||||
gboolean sel = FALSE;
|
||||
gboolean alpha = FALSE;
|
||||
gint lind = -1;
|
||||
gint lnum = -1;
|
||||
GtkItemFactory *item_factory;
|
||||
GimpDisplay *gdisp = NULL;
|
||||
GimpImage *gimage = NULL;
|
||||
GimpImageType type = -1;
|
||||
GimpDrawable *drawable = NULL;
|
||||
GimpLayer *layer = NULL;
|
||||
GimpRGB fg;
|
||||
GimpRGB bg;
|
||||
gboolean is_rgb = FALSE;
|
||||
gboolean is_gray = FALSE;
|
||||
gboolean is_indexed = FALSE;
|
||||
gboolean fs = FALSE;
|
||||
gboolean aux = FALSE;
|
||||
gboolean lm = FALSE;
|
||||
gboolean lp = FALSE;
|
||||
gboolean sel = FALSE;
|
||||
gboolean alpha = FALSE;
|
||||
gint lind = -1;
|
||||
gint lnum = -1;
|
||||
|
||||
g_return_if_fail (! shell || GIMP_IS_DISPLAY_SHELL (shell));
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
if (shell)
|
||||
gdisp = shell->gdisp;
|
||||
|
||||
if (gdisp)
|
||||
{
|
||||
GimpImageBaseType base_type;
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
base_type = gimp_image_base_type (gimage);
|
||||
|
||||
is_rgb = (base_type == GIMP_RGB);
|
||||
is_gray = (base_type == GIMP_GRAY);
|
||||
is_indexed = (base_type == GIMP_INDEXED);
|
||||
|
||||
fs = (gimp_image_floating_sel (gimage) != NULL);
|
||||
aux = (gimp_image_get_active_channel (gimage) != NULL);
|
||||
lp = ! gimp_image_is_empty (gimage);
|
||||
|
@ -878,162 +889,186 @@ gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell)
|
|||
lnum = gimp_container_num_children (gimage->layers);
|
||||
}
|
||||
|
||||
gimp_context_get_foreground (gimp_get_user_context (gdisp->gimage->gimp),
|
||||
&fg);
|
||||
gimp_context_get_background (gimp_get_user_context (gdisp->gimage->gimp),
|
||||
&bg);
|
||||
|
||||
}
|
||||
|
||||
gimp_context_get_foreground (gimp_get_user_context (gimp), &fg);
|
||||
gimp_context_get_background (gimp_get_user_context (gimp), &bg);
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
|
||||
|
||||
#define SET_ACTIVE(menu,condition) \
|
||||
gimp_menu_item_set_active ("<Image>/" menu, (condition) != 0)
|
||||
gimp_item_factory_set_active (item_factory, menu, (condition) != 0)
|
||||
#define SET_LABEL(menu,label) \
|
||||
gimp_menu_item_set_label ("<Image>/" menu, (label))
|
||||
gimp_item_factory_set_label (item_factory, menu, (label))
|
||||
#define SET_SENSITIVE(menu,condition) \
|
||||
gimp_menu_item_set_sensitive ("<Image>/" menu, (condition) != 0)
|
||||
gimp_item_factory_set_sensitive (item_factory, menu, (condition) != 0)
|
||||
|
||||
SET_SENSITIVE ("File/Save", gdisp && drawable);
|
||||
SET_SENSITIVE ("File/Save as...", gdisp && drawable);
|
||||
SET_SENSITIVE ("File/Save a Copy as...", gdisp && drawable);
|
||||
SET_SENSITIVE ("File/Revert...", gdisp && GIMP_OBJECT (gimage)->name);
|
||||
SET_SENSITIVE ("File/Close", gdisp);
|
||||
/* File */
|
||||
|
||||
SET_SENSITIVE ("Edit", gdisp);
|
||||
SET_SENSITIVE ("Edit/Buffer", gdisp);
|
||||
if (gdisp)
|
||||
{
|
||||
gchar *undo_name = NULL;
|
||||
gchar *redo_name = NULL;
|
||||
SET_SENSITIVE ("/File/Save", gdisp && drawable);
|
||||
SET_SENSITIVE ("/File/Save as...", gdisp && drawable);
|
||||
SET_SENSITIVE ("/File/Save a Copy as...", gdisp && drawable);
|
||||
SET_SENSITIVE ("/File/Revert...", gdisp && GIMP_OBJECT (gimage)->name);
|
||||
SET_SENSITIVE ("/File/Close", gdisp);
|
||||
|
||||
if (gimp_image_undo_is_enabled (gimage))
|
||||
{
|
||||
undo_name = (gchar *) undo_get_undo_name (gimage);
|
||||
redo_name = (gchar *) undo_get_redo_name (gimage);
|
||||
}
|
||||
/* Edit */
|
||||
|
||||
if (undo_name)
|
||||
undo_name = g_strdup_printf (_("Undo %s"), gettext (undo_name));
|
||||
{
|
||||
gchar *undo_name = NULL;
|
||||
gchar *redo_name = NULL;
|
||||
|
||||
if (redo_name)
|
||||
redo_name = g_strdup_printf (_("Redo %s"), gettext (redo_name));
|
||||
if (gdisp && gimp_image_undo_is_enabled (gimage))
|
||||
{
|
||||
undo_name = (gchar *) undo_get_undo_name (gimage);
|
||||
redo_name = (gchar *) undo_get_redo_name (gimage);
|
||||
}
|
||||
|
||||
SET_LABEL ("Edit/Undo", undo_name ? undo_name : _("Undo"));
|
||||
SET_LABEL ("Edit/Redo", redo_name ? redo_name : _("Redo"));
|
||||
if (undo_name)
|
||||
undo_name = g_strdup_printf (_("Undo %s"), gettext (undo_name));
|
||||
|
||||
SET_SENSITIVE ("Edit/Undo", undo_name);
|
||||
SET_SENSITIVE ("Edit/Redo", redo_name);
|
||||
if (redo_name)
|
||||
redo_name = g_strdup_printf (_("Redo %s"), gettext (redo_name));
|
||||
|
||||
g_free (undo_name);
|
||||
g_free (redo_name);
|
||||
SET_LABEL ("/Edit/Undo", undo_name ? undo_name : _("Undo"));
|
||||
SET_LABEL ("/Edit/Redo", redo_name ? redo_name : _("Redo"));
|
||||
|
||||
SET_SENSITIVE ("Edit/Cut", lp);
|
||||
SET_SENSITIVE ("Edit/Copy", lp);
|
||||
SET_SENSITIVE ("Edit/Buffer/Cut Named...", lp);
|
||||
SET_SENSITIVE ("Edit/Buffer/Copy Named...", lp);
|
||||
SET_SENSITIVE ("Edit/Clear", lp);
|
||||
SET_SENSITIVE ("Edit/Fill with FG Color", lp);
|
||||
SET_SENSITIVE ("Edit/Fill with BG Color", lp);
|
||||
SET_SENSITIVE ("Edit/Stroke", lp);
|
||||
}
|
||||
SET_SENSITIVE ("/Edit/Undo", undo_name);
|
||||
SET_SENSITIVE ("/Edit/Redo", redo_name);
|
||||
|
||||
SET_SENSITIVE ("Select", gdisp && lp);
|
||||
SET_SENSITIVE ("Select/Save to Channel", !fs);
|
||||
g_free (undo_name);
|
||||
g_free (redo_name);
|
||||
}
|
||||
|
||||
SET_SENSITIVE ("View", gdisp);
|
||||
SET_SENSITIVE ("View/Zoom", gdisp);
|
||||
if (gdisp)
|
||||
{
|
||||
SET_ACTIVE ("View/Toggle Selection", ! shell->select->hidden);
|
||||
SET_ACTIVE ("View/Toggle Layer Boundary", ! shell->select->layer_hidden);
|
||||
SET_ACTIVE ("View/Toggle Rulers",
|
||||
GTK_WIDGET_VISIBLE (shell->origin) ? 1 : 0);
|
||||
SET_ACTIVE ("View/Toggle Guides", gdisp->draw_guides);
|
||||
SET_ACTIVE ("View/Snap to Guides", gdisp->snap_to_guides);
|
||||
SET_ACTIVE ("View/Toggle Statusbar",
|
||||
GTK_WIDGET_VISIBLE (shell->statusbar) ? 1 : 0);
|
||||
SET_ACTIVE ("View/Dot for Dot", gdisp->dot_for_dot);
|
||||
}
|
||||
SET_SENSITIVE ("/Edit/Cut", lp);
|
||||
SET_SENSITIVE ("/Edit/Copy", lp);
|
||||
SET_SENSITIVE ("/Edit/Paste", gdisp && gimp->global_buffer);
|
||||
SET_SENSITIVE ("/Edit/Paste Into", gdisp && gimp->global_buffer);
|
||||
SET_SENSITIVE ("/Edit/Paste as New", gimp->global_buffer);
|
||||
SET_SENSITIVE ("/Edit/Buffer/Cut Named...", lp);
|
||||
SET_SENSITIVE ("/Edit/Buffer/Copy Named...", lp);
|
||||
SET_SENSITIVE ("/Edit/Buffer/Paste Named...", lp);
|
||||
SET_SENSITIVE ("/Edit/Clear", lp);
|
||||
SET_SENSITIVE ("/Edit/Fill with FG Color", lp);
|
||||
SET_SENSITIVE ("/Edit/Fill with BG Color", lp);
|
||||
SET_SENSITIVE ("/Edit/Stroke", lp && sel);
|
||||
|
||||
SET_SENSITIVE ("Image", gdisp);
|
||||
/* Select */
|
||||
|
||||
SET_SENSITIVE ("Image/Mode", gdisp);
|
||||
if (gdisp)
|
||||
{
|
||||
SET_SENSITIVE ("Image/Mode/RGB", (base_type != GIMP_RGB));
|
||||
SET_SENSITIVE ("Image/Mode/Grayscale", (base_type != GIMP_GRAY));
|
||||
SET_SENSITIVE ("Image/Mode/Indexed...", (base_type != GIMP_INDEXED));
|
||||
}
|
||||
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 ("Image/Crop Image", gdisp && sel);
|
||||
SET_SENSITIVE ("Image/Merge Visible Layers...", gdisp && !fs && !aux && lp);
|
||||
SET_SENSITIVE ("Image/Flatten Image", gdisp && !fs && !aux && lp);
|
||||
/* View */
|
||||
|
||||
SET_SENSITIVE ("Layer/Stack", gdisp);
|
||||
if (gdisp)
|
||||
{
|
||||
SET_SENSITIVE ("Layer/Stack/Previous Layer",
|
||||
!fs && !aux && lp && lind > 0);
|
||||
SET_SENSITIVE ("Layer/Stack/Next Layer",
|
||||
!fs && !aux && lp && lind < (lnum - 1));
|
||||
SET_SENSITIVE ("Layer/Stack/Raise Layer",
|
||||
!fs && !aux && lp && alpha && lind > 0);
|
||||
SET_SENSITIVE ("Layer/Stack/Lower Layer",
|
||||
!fs && !aux && lp && alpha && lind < (lnum - 1));
|
||||
SET_SENSITIVE ("Layer/Stack/Layer to Top",
|
||||
!fs && !aux && lp && alpha && lind > 0);
|
||||
SET_SENSITIVE ("Layer/Stack/Layer to Bottom",
|
||||
!fs && !aux && lp && alpha && lind < (lnum - 1));
|
||||
}
|
||||
SET_SENSITIVE ("/View/Zoom In", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom Out", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom to Fit Window", gdisp);
|
||||
|
||||
SET_SENSITIVE ("Layer/New Layer...", gdisp);
|
||||
SET_SENSITIVE ("Layer/Duplicate Layer", gdisp && !fs && !aux && lp);
|
||||
SET_SENSITIVE ("Layer/Anchor Layer", gdisp && fs && !aux && lp);
|
||||
SET_SENSITIVE ("Layer/Merge Down", gdisp && !fs && !aux && lp);
|
||||
SET_SENSITIVE ("Layer/Delete Layer", gdisp && !aux && lp);
|
||||
SET_SENSITIVE ("/View/Zoom/16:1", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom/8:1", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom/4:1", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom/2:1", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom/1:1", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom/1:2", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom/1:4", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom/1:8", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom/1:16", gdisp);
|
||||
|
||||
SET_SENSITIVE ("Layer/Layer Boundary Size...", gdisp && !aux && lp);
|
||||
SET_SENSITIVE ("Layer/Layer to Imagesize", gdisp && !aux && lp);
|
||||
SET_SENSITIVE ("Layer/Scale Layer...", gdisp && !aux && lp);
|
||||
SET_SENSITIVE ("/View/Dot for Dot", gdisp);
|
||||
SET_ACTIVE ("/View/Dot for Dot", gdisp && gdisp->dot_for_dot);
|
||||
|
||||
SET_SENSITIVE ("Layer/Transform/Offset...", lp);
|
||||
SET_SENSITIVE ("/View/Info Window...", gdisp);
|
||||
SET_SENSITIVE ("/View/Navigation Window...", gdisp);
|
||||
SET_SENSITIVE ("/View/Display Filters...", gdisp);
|
||||
|
||||
SET_SENSITIVE ("Layer/Colors", gdisp);
|
||||
SET_SENSITIVE ("Layer/Colors/Auto", gdisp);
|
||||
SET_SENSITIVE ("/View/Toggle Selection", gdisp);
|
||||
SET_ACTIVE ("/View/Toggle Selection", gdisp && ! shell->select->hidden);
|
||||
SET_SENSITIVE ("/View/Toggle Layer Boundary", gdisp);
|
||||
SET_ACTIVE ("/View/Toggle Layer Boundary", gdisp && ! shell->select->layer_hidden);
|
||||
|
||||
if (gdisp)
|
||||
{
|
||||
SET_SENSITIVE ("Layer/Colors", lp);
|
||||
SET_SENSITIVE ("Layer/Colors/Color Balance...", (base_type == GIMP_RGB));
|
||||
SET_SENSITIVE ("Layer/Colors/Hue-Saturation...", (base_type == GIMP_RGB));
|
||||
SET_SENSITIVE ("Layer/Colors/Brightness-Contrast...", (base_type != GIMP_INDEXED));
|
||||
SET_SENSITIVE ("Layer/Colors/Threshold...", (base_type != GIMP_INDEXED));
|
||||
SET_SENSITIVE ("Layer/Colors/Levels...", (base_type != GIMP_INDEXED));
|
||||
SET_SENSITIVE ("Layer/Colors/Curves...", (base_type != GIMP_INDEXED));
|
||||
SET_SENSITIVE ("Layer/Colors/Desaturate", (base_type == GIMP_RGB));
|
||||
SET_SENSITIVE ("Layer/Colors/Posterize...", (base_type != GIMP_INDEXED));
|
||||
SET_SENSITIVE ("Layer/Colors/Invert", (base_type != GIMP_INDEXED));
|
||||
SET_SENSITIVE ("Layer/Colors/Auto/Equalize", (base_type != GIMP_INDEXED));
|
||||
SET_SENSITIVE ("/View/Toggle Guides", gdisp);
|
||||
SET_ACTIVE ("/View/Toggle Guides", gdisp && gdisp->draw_guides);
|
||||
SET_SENSITIVE ("/View/Snap to Guides", gdisp);
|
||||
SET_ACTIVE ("/View/Snap to Guides", gdisp && gdisp->snap_to_guides);
|
||||
|
||||
SET_SENSITIVE ("Layer/Colors/Histogram...", lp);
|
||||
}
|
||||
SET_SENSITIVE ("/View/Toggle Rulers", gdisp);
|
||||
SET_ACTIVE ("/View/Toggle Rulers",
|
||||
gdisp && GTK_WIDGET_VISIBLE (shell->origin) ? 1 : 0);
|
||||
|
||||
SET_SENSITIVE ("Layer/Mask/Add Layer Mask...",
|
||||
gdisp && !aux && !lm && lp && alpha && (base_type != GIMP_INDEXED));
|
||||
SET_SENSITIVE ("Layer/Mask/Apply Layer Mask",
|
||||
gdisp && !aux && lm && lp);
|
||||
SET_SENSITIVE ("Layer/Mask/Delete Layer Mask",
|
||||
gdisp && !aux && lm && lp);
|
||||
SET_SENSITIVE ("Layer/Mask/Mask to Selection",
|
||||
gdisp && !aux && lm && lp);
|
||||
SET_SENSITIVE ("/View/Toggle Statusbar", gdisp);
|
||||
SET_ACTIVE ("/View/Toggle Statusbar",
|
||||
gdisp && GTK_WIDGET_VISIBLE (shell->statusbar) ? 1 : 0);
|
||||
|
||||
SET_SENSITIVE ("Layer/Alpha/Alpha to Selection",
|
||||
gdisp && !aux && lp && alpha);
|
||||
SET_SENSITIVE ("Layer/Alpha/Add Alpha Channel",
|
||||
gdisp && !fs && !aux && lp && !lm && !alpha);
|
||||
SET_SENSITIVE ("/View/New View", gdisp);
|
||||
SET_SENSITIVE ("/View/Shrink Wrap", gdisp);
|
||||
|
||||
SET_SENSITIVE ("Filters", gdisp && lp);
|
||||
/* Image */
|
||||
|
||||
SET_SENSITIVE ("Script-Fu", gdisp && lp);
|
||||
SET_SENSITIVE ("/Image/Mode/RGB", gdisp && ! is_rgb);
|
||||
SET_SENSITIVE ("/Image/Mode/Grayscale", gdisp && ! is_gray);
|
||||
SET_SENSITIVE ("/Image/Mode/Indexed...", gdisp && ! is_indexed);
|
||||
|
||||
SET_SENSITIVE ("/Image/Canvas Size...", gdisp);
|
||||
SET_SENSITIVE ("/Image/Scale Image...", gdisp);
|
||||
SET_SENSITIVE ("/Image/Crop Image", gdisp && sel);
|
||||
SET_SENSITIVE ("/Image/Duplicate", gdisp);
|
||||
SET_SENSITIVE ("/Image/Merge Visible Layers...", gdisp && !fs && !aux && lp);
|
||||
SET_SENSITIVE ("/Image/Flatten Image", gdisp && !fs && !aux && lp);
|
||||
SET_SENSITIVE ("/Image/Undo History...", gdisp);
|
||||
|
||||
/* Layer */
|
||||
|
||||
SET_SENSITIVE ("/Layer/Stack/Previous Layer",
|
||||
lp && !fs && !aux && lind > 0);
|
||||
SET_SENSITIVE ("/Layer/Stack/Next Layer",
|
||||
lp && !fs && !aux && lind < (lnum - 1));
|
||||
SET_SENSITIVE ("/Layer/Stack/Raise Layer",
|
||||
lp && !fs && !aux && alpha && lind > 0);
|
||||
SET_SENSITIVE ("/Layer/Stack/Lower Layer",
|
||||
lp && !fs && !aux && alpha && lind < (lnum - 1));
|
||||
SET_SENSITIVE ("/Layer/Stack/Layer to Top",
|
||||
lp && !fs && !aux && alpha && lind > 0);
|
||||
SET_SENSITIVE ("/Layer/Stack/Layer to Bottom",
|
||||
lp && !fs && !aux && alpha && lind < (lnum - 1));
|
||||
|
||||
SET_SENSITIVE ("/Layer/New Layer...", gdisp);
|
||||
SET_SENSITIVE ("/Layer/Duplicate Layer", lp && !fs && !aux);
|
||||
SET_SENSITIVE ("/Layer/Anchor Layer", lp && fs && !aux);
|
||||
SET_SENSITIVE ("/Layer/Merge Down", lp && !fs && !aux);
|
||||
SET_SENSITIVE ("/Layer/Delete Layer", lp && !aux);
|
||||
|
||||
SET_SENSITIVE ("/Layer/Layer Boundary Size...", lp && !aux);
|
||||
SET_SENSITIVE ("/Layer/Layer to Imagesize", lp && !aux);
|
||||
SET_SENSITIVE ("/Layer/Scale Layer...", lp && !aux);
|
||||
|
||||
SET_SENSITIVE ("/Layer/Transform/Offset...", lp);
|
||||
|
||||
SET_SENSITIVE ("/Layer/Colors/Color Balance...", lp && is_rgb);
|
||||
SET_SENSITIVE ("/Layer/Colors/Hue-Saturation...", lp && is_rgb);
|
||||
SET_SENSITIVE ("/Layer/Colors/Brightness-Contrast...", lp && ! is_indexed);
|
||||
SET_SENSITIVE ("/Layer/Colors/Threshold...", lp && ! is_indexed);
|
||||
SET_SENSITIVE ("/Layer/Colors/Levels...", lp && ! is_indexed);
|
||||
SET_SENSITIVE ("/Layer/Colors/Curves...", lp && ! is_indexed);
|
||||
SET_SENSITIVE ("/Layer/Colors/Desaturate", lp && is_rgb);
|
||||
SET_SENSITIVE ("/Layer/Colors/Posterize...", lp && ! is_indexed);
|
||||
SET_SENSITIVE ("/Layer/Colors/Invert", lp && ! is_indexed);
|
||||
SET_SENSITIVE ("/Layer/Colors/Auto/Equalize", lp && ! is_indexed);
|
||||
SET_SENSITIVE ("/Layer/Colors/Histogram...", lp);
|
||||
|
||||
SET_SENSITIVE ("/Layer/Mask/Add Layer Mask...", lp && !aux && !lm && alpha && ! is_indexed);
|
||||
SET_SENSITIVE ("/Layer/Mask/Apply Layer Mask", lp && !aux && lm);
|
||||
SET_SENSITIVE ("/Layer/Mask/Delete Layer Mask", lp && !aux && lm);
|
||||
SET_SENSITIVE ("/Layer/Mask/Mask to Selection", lp && !aux && lm);
|
||||
|
||||
SET_SENSITIVE ("/Layer/Alpha/Alpha to Selection", lp && !aux && alpha);
|
||||
SET_SENSITIVE ("/Layer/Alpha/Add Alpha Channel", lp && !aux && !fs && !lm && !alpha);
|
||||
|
||||
#undef SET_ACTIVE
|
||||
#undef SET_LABEL
|
||||
|
|
|
@ -128,7 +128,8 @@ void gimp_display_shell_untransform_coords (GimpDisplayShell *shell,
|
|||
GimpCoords *display_coords,
|
||||
GimpCoords *image_coords);
|
||||
|
||||
void gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell);
|
||||
void gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell,
|
||||
Gimp *gimp);
|
||||
|
||||
GimpGuide * gimp_display_shell_find_guide (GimpDisplayShell *shell,
|
||||
gdouble x,
|
||||
|
|
|
@ -825,36 +825,47 @@ gimp_display_shell_untransform_coords (GimpDisplayShell *shell,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell)
|
||||
gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell,
|
||||
Gimp *gimp)
|
||||
{
|
||||
GimpDisplay *gdisp = NULL;
|
||||
GimpImage *gimage = NULL;
|
||||
GimpImageBaseType base_type = 0;
|
||||
GimpImageType type = -1;
|
||||
GimpDrawable *drawable = NULL;
|
||||
GimpLayer *layer = NULL;
|
||||
GimpRGB fg;
|
||||
GimpRGB bg;
|
||||
gboolean fs = FALSE;
|
||||
gboolean aux = FALSE;
|
||||
gboolean lm = FALSE;
|
||||
gboolean lp = FALSE;
|
||||
gboolean sel = FALSE;
|
||||
gboolean alpha = FALSE;
|
||||
gint lind = -1;
|
||||
gint lnum = -1;
|
||||
GtkItemFactory *item_factory;
|
||||
GimpDisplay *gdisp = NULL;
|
||||
GimpImage *gimage = NULL;
|
||||
GimpImageType type = -1;
|
||||
GimpDrawable *drawable = NULL;
|
||||
GimpLayer *layer = NULL;
|
||||
GimpRGB fg;
|
||||
GimpRGB bg;
|
||||
gboolean is_rgb = FALSE;
|
||||
gboolean is_gray = FALSE;
|
||||
gboolean is_indexed = FALSE;
|
||||
gboolean fs = FALSE;
|
||||
gboolean aux = FALSE;
|
||||
gboolean lm = FALSE;
|
||||
gboolean lp = FALSE;
|
||||
gboolean sel = FALSE;
|
||||
gboolean alpha = FALSE;
|
||||
gint lind = -1;
|
||||
gint lnum = -1;
|
||||
|
||||
g_return_if_fail (! shell || GIMP_IS_DISPLAY_SHELL (shell));
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
if (shell)
|
||||
gdisp = shell->gdisp;
|
||||
|
||||
if (gdisp)
|
||||
{
|
||||
GimpImageBaseType base_type;
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
base_type = gimp_image_base_type (gimage);
|
||||
|
||||
is_rgb = (base_type == GIMP_RGB);
|
||||
is_gray = (base_type == GIMP_GRAY);
|
||||
is_indexed = (base_type == GIMP_INDEXED);
|
||||
|
||||
fs = (gimp_image_floating_sel (gimage) != NULL);
|
||||
aux = (gimp_image_get_active_channel (gimage) != NULL);
|
||||
lp = ! gimp_image_is_empty (gimage);
|
||||
|
@ -878,162 +889,186 @@ gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell)
|
|||
lnum = gimp_container_num_children (gimage->layers);
|
||||
}
|
||||
|
||||
gimp_context_get_foreground (gimp_get_user_context (gdisp->gimage->gimp),
|
||||
&fg);
|
||||
gimp_context_get_background (gimp_get_user_context (gdisp->gimage->gimp),
|
||||
&bg);
|
||||
|
||||
}
|
||||
|
||||
gimp_context_get_foreground (gimp_get_user_context (gimp), &fg);
|
||||
gimp_context_get_background (gimp_get_user_context (gimp), &bg);
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
|
||||
|
||||
#define SET_ACTIVE(menu,condition) \
|
||||
gimp_menu_item_set_active ("<Image>/" menu, (condition) != 0)
|
||||
gimp_item_factory_set_active (item_factory, menu, (condition) != 0)
|
||||
#define SET_LABEL(menu,label) \
|
||||
gimp_menu_item_set_label ("<Image>/" menu, (label))
|
||||
gimp_item_factory_set_label (item_factory, menu, (label))
|
||||
#define SET_SENSITIVE(menu,condition) \
|
||||
gimp_menu_item_set_sensitive ("<Image>/" menu, (condition) != 0)
|
||||
gimp_item_factory_set_sensitive (item_factory, menu, (condition) != 0)
|
||||
|
||||
SET_SENSITIVE ("File/Save", gdisp && drawable);
|
||||
SET_SENSITIVE ("File/Save as...", gdisp && drawable);
|
||||
SET_SENSITIVE ("File/Save a Copy as...", gdisp && drawable);
|
||||
SET_SENSITIVE ("File/Revert...", gdisp && GIMP_OBJECT (gimage)->name);
|
||||
SET_SENSITIVE ("File/Close", gdisp);
|
||||
/* File */
|
||||
|
||||
SET_SENSITIVE ("Edit", gdisp);
|
||||
SET_SENSITIVE ("Edit/Buffer", gdisp);
|
||||
if (gdisp)
|
||||
{
|
||||
gchar *undo_name = NULL;
|
||||
gchar *redo_name = NULL;
|
||||
SET_SENSITIVE ("/File/Save", gdisp && drawable);
|
||||
SET_SENSITIVE ("/File/Save as...", gdisp && drawable);
|
||||
SET_SENSITIVE ("/File/Save a Copy as...", gdisp && drawable);
|
||||
SET_SENSITIVE ("/File/Revert...", gdisp && GIMP_OBJECT (gimage)->name);
|
||||
SET_SENSITIVE ("/File/Close", gdisp);
|
||||
|
||||
if (gimp_image_undo_is_enabled (gimage))
|
||||
{
|
||||
undo_name = (gchar *) undo_get_undo_name (gimage);
|
||||
redo_name = (gchar *) undo_get_redo_name (gimage);
|
||||
}
|
||||
/* Edit */
|
||||
|
||||
if (undo_name)
|
||||
undo_name = g_strdup_printf (_("Undo %s"), gettext (undo_name));
|
||||
{
|
||||
gchar *undo_name = NULL;
|
||||
gchar *redo_name = NULL;
|
||||
|
||||
if (redo_name)
|
||||
redo_name = g_strdup_printf (_("Redo %s"), gettext (redo_name));
|
||||
if (gdisp && gimp_image_undo_is_enabled (gimage))
|
||||
{
|
||||
undo_name = (gchar *) undo_get_undo_name (gimage);
|
||||
redo_name = (gchar *) undo_get_redo_name (gimage);
|
||||
}
|
||||
|
||||
SET_LABEL ("Edit/Undo", undo_name ? undo_name : _("Undo"));
|
||||
SET_LABEL ("Edit/Redo", redo_name ? redo_name : _("Redo"));
|
||||
if (undo_name)
|
||||
undo_name = g_strdup_printf (_("Undo %s"), gettext (undo_name));
|
||||
|
||||
SET_SENSITIVE ("Edit/Undo", undo_name);
|
||||
SET_SENSITIVE ("Edit/Redo", redo_name);
|
||||
if (redo_name)
|
||||
redo_name = g_strdup_printf (_("Redo %s"), gettext (redo_name));
|
||||
|
||||
g_free (undo_name);
|
||||
g_free (redo_name);
|
||||
SET_LABEL ("/Edit/Undo", undo_name ? undo_name : _("Undo"));
|
||||
SET_LABEL ("/Edit/Redo", redo_name ? redo_name : _("Redo"));
|
||||
|
||||
SET_SENSITIVE ("Edit/Cut", lp);
|
||||
SET_SENSITIVE ("Edit/Copy", lp);
|
||||
SET_SENSITIVE ("Edit/Buffer/Cut Named...", lp);
|
||||
SET_SENSITIVE ("Edit/Buffer/Copy Named...", lp);
|
||||
SET_SENSITIVE ("Edit/Clear", lp);
|
||||
SET_SENSITIVE ("Edit/Fill with FG Color", lp);
|
||||
SET_SENSITIVE ("Edit/Fill with BG Color", lp);
|
||||
SET_SENSITIVE ("Edit/Stroke", lp);
|
||||
}
|
||||
SET_SENSITIVE ("/Edit/Undo", undo_name);
|
||||
SET_SENSITIVE ("/Edit/Redo", redo_name);
|
||||
|
||||
SET_SENSITIVE ("Select", gdisp && lp);
|
||||
SET_SENSITIVE ("Select/Save to Channel", !fs);
|
||||
g_free (undo_name);
|
||||
g_free (redo_name);
|
||||
}
|
||||
|
||||
SET_SENSITIVE ("View", gdisp);
|
||||
SET_SENSITIVE ("View/Zoom", gdisp);
|
||||
if (gdisp)
|
||||
{
|
||||
SET_ACTIVE ("View/Toggle Selection", ! shell->select->hidden);
|
||||
SET_ACTIVE ("View/Toggle Layer Boundary", ! shell->select->layer_hidden);
|
||||
SET_ACTIVE ("View/Toggle Rulers",
|
||||
GTK_WIDGET_VISIBLE (shell->origin) ? 1 : 0);
|
||||
SET_ACTIVE ("View/Toggle Guides", gdisp->draw_guides);
|
||||
SET_ACTIVE ("View/Snap to Guides", gdisp->snap_to_guides);
|
||||
SET_ACTIVE ("View/Toggle Statusbar",
|
||||
GTK_WIDGET_VISIBLE (shell->statusbar) ? 1 : 0);
|
||||
SET_ACTIVE ("View/Dot for Dot", gdisp->dot_for_dot);
|
||||
}
|
||||
SET_SENSITIVE ("/Edit/Cut", lp);
|
||||
SET_SENSITIVE ("/Edit/Copy", lp);
|
||||
SET_SENSITIVE ("/Edit/Paste", gdisp && gimp->global_buffer);
|
||||
SET_SENSITIVE ("/Edit/Paste Into", gdisp && gimp->global_buffer);
|
||||
SET_SENSITIVE ("/Edit/Paste as New", gimp->global_buffer);
|
||||
SET_SENSITIVE ("/Edit/Buffer/Cut Named...", lp);
|
||||
SET_SENSITIVE ("/Edit/Buffer/Copy Named...", lp);
|
||||
SET_SENSITIVE ("/Edit/Buffer/Paste Named...", lp);
|
||||
SET_SENSITIVE ("/Edit/Clear", lp);
|
||||
SET_SENSITIVE ("/Edit/Fill with FG Color", lp);
|
||||
SET_SENSITIVE ("/Edit/Fill with BG Color", lp);
|
||||
SET_SENSITIVE ("/Edit/Stroke", lp && sel);
|
||||
|
||||
SET_SENSITIVE ("Image", gdisp);
|
||||
/* Select */
|
||||
|
||||
SET_SENSITIVE ("Image/Mode", gdisp);
|
||||
if (gdisp)
|
||||
{
|
||||
SET_SENSITIVE ("Image/Mode/RGB", (base_type != GIMP_RGB));
|
||||
SET_SENSITIVE ("Image/Mode/Grayscale", (base_type != GIMP_GRAY));
|
||||
SET_SENSITIVE ("Image/Mode/Indexed...", (base_type != GIMP_INDEXED));
|
||||
}
|
||||
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 ("Image/Crop Image", gdisp && sel);
|
||||
SET_SENSITIVE ("Image/Merge Visible Layers...", gdisp && !fs && !aux && lp);
|
||||
SET_SENSITIVE ("Image/Flatten Image", gdisp && !fs && !aux && lp);
|
||||
/* View */
|
||||
|
||||
SET_SENSITIVE ("Layer/Stack", gdisp);
|
||||
if (gdisp)
|
||||
{
|
||||
SET_SENSITIVE ("Layer/Stack/Previous Layer",
|
||||
!fs && !aux && lp && lind > 0);
|
||||
SET_SENSITIVE ("Layer/Stack/Next Layer",
|
||||
!fs && !aux && lp && lind < (lnum - 1));
|
||||
SET_SENSITIVE ("Layer/Stack/Raise Layer",
|
||||
!fs && !aux && lp && alpha && lind > 0);
|
||||
SET_SENSITIVE ("Layer/Stack/Lower Layer",
|
||||
!fs && !aux && lp && alpha && lind < (lnum - 1));
|
||||
SET_SENSITIVE ("Layer/Stack/Layer to Top",
|
||||
!fs && !aux && lp && alpha && lind > 0);
|
||||
SET_SENSITIVE ("Layer/Stack/Layer to Bottom",
|
||||
!fs && !aux && lp && alpha && lind < (lnum - 1));
|
||||
}
|
||||
SET_SENSITIVE ("/View/Zoom In", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom Out", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom to Fit Window", gdisp);
|
||||
|
||||
SET_SENSITIVE ("Layer/New Layer...", gdisp);
|
||||
SET_SENSITIVE ("Layer/Duplicate Layer", gdisp && !fs && !aux && lp);
|
||||
SET_SENSITIVE ("Layer/Anchor Layer", gdisp && fs && !aux && lp);
|
||||
SET_SENSITIVE ("Layer/Merge Down", gdisp && !fs && !aux && lp);
|
||||
SET_SENSITIVE ("Layer/Delete Layer", gdisp && !aux && lp);
|
||||
SET_SENSITIVE ("/View/Zoom/16:1", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom/8:1", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom/4:1", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom/2:1", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom/1:1", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom/1:2", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom/1:4", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom/1:8", gdisp);
|
||||
SET_SENSITIVE ("/View/Zoom/1:16", gdisp);
|
||||
|
||||
SET_SENSITIVE ("Layer/Layer Boundary Size...", gdisp && !aux && lp);
|
||||
SET_SENSITIVE ("Layer/Layer to Imagesize", gdisp && !aux && lp);
|
||||
SET_SENSITIVE ("Layer/Scale Layer...", gdisp && !aux && lp);
|
||||
SET_SENSITIVE ("/View/Dot for Dot", gdisp);
|
||||
SET_ACTIVE ("/View/Dot for Dot", gdisp && gdisp->dot_for_dot);
|
||||
|
||||
SET_SENSITIVE ("Layer/Transform/Offset...", lp);
|
||||
SET_SENSITIVE ("/View/Info Window...", gdisp);
|
||||
SET_SENSITIVE ("/View/Navigation Window...", gdisp);
|
||||
SET_SENSITIVE ("/View/Display Filters...", gdisp);
|
||||
|
||||
SET_SENSITIVE ("Layer/Colors", gdisp);
|
||||
SET_SENSITIVE ("Layer/Colors/Auto", gdisp);
|
||||
SET_SENSITIVE ("/View/Toggle Selection", gdisp);
|
||||
SET_ACTIVE ("/View/Toggle Selection", gdisp && ! shell->select->hidden);
|
||||
SET_SENSITIVE ("/View/Toggle Layer Boundary", gdisp);
|
||||
SET_ACTIVE ("/View/Toggle Layer Boundary", gdisp && ! shell->select->layer_hidden);
|
||||
|
||||
if (gdisp)
|
||||
{
|
||||
SET_SENSITIVE ("Layer/Colors", lp);
|
||||
SET_SENSITIVE ("Layer/Colors/Color Balance...", (base_type == GIMP_RGB));
|
||||
SET_SENSITIVE ("Layer/Colors/Hue-Saturation...", (base_type == GIMP_RGB));
|
||||
SET_SENSITIVE ("Layer/Colors/Brightness-Contrast...", (base_type != GIMP_INDEXED));
|
||||
SET_SENSITIVE ("Layer/Colors/Threshold...", (base_type != GIMP_INDEXED));
|
||||
SET_SENSITIVE ("Layer/Colors/Levels...", (base_type != GIMP_INDEXED));
|
||||
SET_SENSITIVE ("Layer/Colors/Curves...", (base_type != GIMP_INDEXED));
|
||||
SET_SENSITIVE ("Layer/Colors/Desaturate", (base_type == GIMP_RGB));
|
||||
SET_SENSITIVE ("Layer/Colors/Posterize...", (base_type != GIMP_INDEXED));
|
||||
SET_SENSITIVE ("Layer/Colors/Invert", (base_type != GIMP_INDEXED));
|
||||
SET_SENSITIVE ("Layer/Colors/Auto/Equalize", (base_type != GIMP_INDEXED));
|
||||
SET_SENSITIVE ("/View/Toggle Guides", gdisp);
|
||||
SET_ACTIVE ("/View/Toggle Guides", gdisp && gdisp->draw_guides);
|
||||
SET_SENSITIVE ("/View/Snap to Guides", gdisp);
|
||||
SET_ACTIVE ("/View/Snap to Guides", gdisp && gdisp->snap_to_guides);
|
||||
|
||||
SET_SENSITIVE ("Layer/Colors/Histogram...", lp);
|
||||
}
|
||||
SET_SENSITIVE ("/View/Toggle Rulers", gdisp);
|
||||
SET_ACTIVE ("/View/Toggle Rulers",
|
||||
gdisp && GTK_WIDGET_VISIBLE (shell->origin) ? 1 : 0);
|
||||
|
||||
SET_SENSITIVE ("Layer/Mask/Add Layer Mask...",
|
||||
gdisp && !aux && !lm && lp && alpha && (base_type != GIMP_INDEXED));
|
||||
SET_SENSITIVE ("Layer/Mask/Apply Layer Mask",
|
||||
gdisp && !aux && lm && lp);
|
||||
SET_SENSITIVE ("Layer/Mask/Delete Layer Mask",
|
||||
gdisp && !aux && lm && lp);
|
||||
SET_SENSITIVE ("Layer/Mask/Mask to Selection",
|
||||
gdisp && !aux && lm && lp);
|
||||
SET_SENSITIVE ("/View/Toggle Statusbar", gdisp);
|
||||
SET_ACTIVE ("/View/Toggle Statusbar",
|
||||
gdisp && GTK_WIDGET_VISIBLE (shell->statusbar) ? 1 : 0);
|
||||
|
||||
SET_SENSITIVE ("Layer/Alpha/Alpha to Selection",
|
||||
gdisp && !aux && lp && alpha);
|
||||
SET_SENSITIVE ("Layer/Alpha/Add Alpha Channel",
|
||||
gdisp && !fs && !aux && lp && !lm && !alpha);
|
||||
SET_SENSITIVE ("/View/New View", gdisp);
|
||||
SET_SENSITIVE ("/View/Shrink Wrap", gdisp);
|
||||
|
||||
SET_SENSITIVE ("Filters", gdisp && lp);
|
||||
/* Image */
|
||||
|
||||
SET_SENSITIVE ("Script-Fu", gdisp && lp);
|
||||
SET_SENSITIVE ("/Image/Mode/RGB", gdisp && ! is_rgb);
|
||||
SET_SENSITIVE ("/Image/Mode/Grayscale", gdisp && ! is_gray);
|
||||
SET_SENSITIVE ("/Image/Mode/Indexed...", gdisp && ! is_indexed);
|
||||
|
||||
SET_SENSITIVE ("/Image/Canvas Size...", gdisp);
|
||||
SET_SENSITIVE ("/Image/Scale Image...", gdisp);
|
||||
SET_SENSITIVE ("/Image/Crop Image", gdisp && sel);
|
||||
SET_SENSITIVE ("/Image/Duplicate", gdisp);
|
||||
SET_SENSITIVE ("/Image/Merge Visible Layers...", gdisp && !fs && !aux && lp);
|
||||
SET_SENSITIVE ("/Image/Flatten Image", gdisp && !fs && !aux && lp);
|
||||
SET_SENSITIVE ("/Image/Undo History...", gdisp);
|
||||
|
||||
/* Layer */
|
||||
|
||||
SET_SENSITIVE ("/Layer/Stack/Previous Layer",
|
||||
lp && !fs && !aux && lind > 0);
|
||||
SET_SENSITIVE ("/Layer/Stack/Next Layer",
|
||||
lp && !fs && !aux && lind < (lnum - 1));
|
||||
SET_SENSITIVE ("/Layer/Stack/Raise Layer",
|
||||
lp && !fs && !aux && alpha && lind > 0);
|
||||
SET_SENSITIVE ("/Layer/Stack/Lower Layer",
|
||||
lp && !fs && !aux && alpha && lind < (lnum - 1));
|
||||
SET_SENSITIVE ("/Layer/Stack/Layer to Top",
|
||||
lp && !fs && !aux && alpha && lind > 0);
|
||||
SET_SENSITIVE ("/Layer/Stack/Layer to Bottom",
|
||||
lp && !fs && !aux && alpha && lind < (lnum - 1));
|
||||
|
||||
SET_SENSITIVE ("/Layer/New Layer...", gdisp);
|
||||
SET_SENSITIVE ("/Layer/Duplicate Layer", lp && !fs && !aux);
|
||||
SET_SENSITIVE ("/Layer/Anchor Layer", lp && fs && !aux);
|
||||
SET_SENSITIVE ("/Layer/Merge Down", lp && !fs && !aux);
|
||||
SET_SENSITIVE ("/Layer/Delete Layer", lp && !aux);
|
||||
|
||||
SET_SENSITIVE ("/Layer/Layer Boundary Size...", lp && !aux);
|
||||
SET_SENSITIVE ("/Layer/Layer to Imagesize", lp && !aux);
|
||||
SET_SENSITIVE ("/Layer/Scale Layer...", lp && !aux);
|
||||
|
||||
SET_SENSITIVE ("/Layer/Transform/Offset...", lp);
|
||||
|
||||
SET_SENSITIVE ("/Layer/Colors/Color Balance...", lp && is_rgb);
|
||||
SET_SENSITIVE ("/Layer/Colors/Hue-Saturation...", lp && is_rgb);
|
||||
SET_SENSITIVE ("/Layer/Colors/Brightness-Contrast...", lp && ! is_indexed);
|
||||
SET_SENSITIVE ("/Layer/Colors/Threshold...", lp && ! is_indexed);
|
||||
SET_SENSITIVE ("/Layer/Colors/Levels...", lp && ! is_indexed);
|
||||
SET_SENSITIVE ("/Layer/Colors/Curves...", lp && ! is_indexed);
|
||||
SET_SENSITIVE ("/Layer/Colors/Desaturate", lp && is_rgb);
|
||||
SET_SENSITIVE ("/Layer/Colors/Posterize...", lp && ! is_indexed);
|
||||
SET_SENSITIVE ("/Layer/Colors/Invert", lp && ! is_indexed);
|
||||
SET_SENSITIVE ("/Layer/Colors/Auto/Equalize", lp && ! is_indexed);
|
||||
SET_SENSITIVE ("/Layer/Colors/Histogram...", lp);
|
||||
|
||||
SET_SENSITIVE ("/Layer/Mask/Add Layer Mask...", lp && !aux && !lm && alpha && ! is_indexed);
|
||||
SET_SENSITIVE ("/Layer/Mask/Apply Layer Mask", lp && !aux && lm);
|
||||
SET_SENSITIVE ("/Layer/Mask/Delete Layer Mask", lp && !aux && lm);
|
||||
SET_SENSITIVE ("/Layer/Mask/Mask to Selection", lp && !aux && lm);
|
||||
|
||||
SET_SENSITIVE ("/Layer/Alpha/Alpha to Selection", lp && !aux && alpha);
|
||||
SET_SENSITIVE ("/Layer/Alpha/Add Alpha Channel", lp && !aux && !fs && !lm && !alpha);
|
||||
|
||||
#undef SET_ACTIVE
|
||||
#undef SET_LABEL
|
||||
|
|
|
@ -128,7 +128,8 @@ void gimp_display_shell_untransform_coords (GimpDisplayShell *shell,
|
|||
GimpCoords *display_coords,
|
||||
GimpCoords *image_coords);
|
||||
|
||||
void gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell);
|
||||
void gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell,
|
||||
Gimp *gimp);
|
||||
|
||||
GimpGuide * gimp_display_shell_find_guide (GimpDisplayShell *shell,
|
||||
gdouble x,
|
||||
|
|
|
@ -85,7 +85,7 @@ static void gui_really_quit_callback (GtkWidget *button,
|
|||
|
||||
static void gui_display_changed (GimpContext *context,
|
||||
GimpDisplay *display,
|
||||
gpointer data);
|
||||
Gimp *gimp);
|
||||
static void gui_image_disconnect (GimpImage *gimage,
|
||||
gpointer data);
|
||||
|
||||
|
@ -343,10 +343,14 @@ gui_get_screen_resolution (gdouble *xres,
|
|||
void
|
||||
gui_really_quit_dialog (GCallback quit_func)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkItemFactory *item_factory;
|
||||
GtkWidget *dialog;
|
||||
|
||||
gimp_menu_item_set_sensitive ("<Toolbox>/File/Quit", FALSE);
|
||||
gimp_menu_item_set_sensitive ("<Image>/File/Quit", FALSE);
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Toolbox>"));
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Quit", FALSE);
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Quit", FALSE);
|
||||
|
||||
dialog = gimp_query_boolean_box (_("Quit The GIMP?"),
|
||||
gimp_standard_help_func,
|
||||
|
@ -524,8 +528,13 @@ gui_really_quit_callback (GtkWidget *button,
|
|||
}
|
||||
else
|
||||
{
|
||||
gimp_menu_item_set_sensitive ("<Toolbox>/File/Quit", TRUE);
|
||||
gimp_menu_item_set_sensitive ("<Image>/File/Quit", TRUE);
|
||||
GtkItemFactory *item_factory;
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Toolbox>"));
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Quit", TRUE);
|
||||
|
||||
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
|
||||
gimp_item_factory_set_sensitive (item_factory, "/File/Quit", TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -535,16 +544,14 @@ gui_really_quit_callback (GtkWidget *button,
|
|||
static void
|
||||
gui_display_changed (GimpContext *context,
|
||||
GimpDisplay *display,
|
||||
gpointer data)
|
||||
Gimp *gimp)
|
||||
{
|
||||
Gimp *gimp;
|
||||
|
||||
gimp = (Gimp *) data;
|
||||
GimpDisplayShell *shell = NULL;
|
||||
|
||||
if (display)
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (display->shell));
|
||||
else
|
||||
gimp_display_shell_set_menu_sensitivity (NULL);
|
||||
shell = GIMP_DISPLAY_SHELL (display->shell);
|
||||
|
||||
gimp_display_shell_set_menu_sensitivity (shell, gimp);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -536,14 +536,14 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
"<StockItem>", GTK_STOCK_HELP },
|
||||
NULL,
|
||||
"view/dialogs/info_window.html", NULL },
|
||||
{ { N_("/View/Nav. Window..."), "<control><shift>N",
|
||||
view_nav_window_cmd_callback, 0,
|
||||
{ { N_("/View/Navigation Window..."), "<control><shift>N",
|
||||
view_navigation_window_cmd_callback, 0,
|
||||
"<StockItem>", GIMP_STOCK_TOOL_MOVE },
|
||||
NULL,
|
||||
"view/dialogs/navigation_window.html", NULL },
|
||||
{ { N_("/View/Display Filters..."), NULL,
|
||||
dialogs_create_toplevel_cmd_callback, 0 },
|
||||
"gimp:display-filters-dialog",
|
||||
view_display_filters_cmd_callback, 0 },
|
||||
NULL,
|
||||
"dialogs/display_filters/display_filters.html", NULL },
|
||||
|
||||
SEPARATOR ("/View/---"),
|
||||
|
|
|
@ -34,6 +34,9 @@
|
|||
#include "display/gimpdisplayshell-scale.h"
|
||||
#include "display/gimpdisplayshell-selection.h"
|
||||
|
||||
#include "widgets/gimpdialogfactory.h"
|
||||
|
||||
#include "dialogs.h"
|
||||
#include "info-dialog.h"
|
||||
#include "info-window.h"
|
||||
#include "view-commands.h"
|
||||
|
@ -124,8 +127,8 @@ view_info_window_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
void
|
||||
view_nav_window_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
view_navigation_window_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpDisplayShell *shell;
|
||||
|
@ -146,6 +149,20 @@ view_nav_window_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_display_filters_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpDisplayShell *shell;
|
||||
return_if_no_display (gdisp, data);
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
gimp_dialog_factory_dialog_new (global_dialog_factory,
|
||||
"gimp:display-filters-dialog", -1);
|
||||
}
|
||||
|
||||
void
|
||||
view_toggle_selection_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
|
|
@ -33,7 +33,9 @@ void view_dot_for_dot_cmd_callback (GtkWidget *widget,
|
|||
gpointer data);
|
||||
void view_info_window_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_nav_window_cmd_callback (GtkWidget *widget,
|
||||
void view_navigation_window_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_display_filters_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_toggle_selection_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
|
|
@ -94,7 +94,8 @@ image_map_create (GimpDisplay *gdisp,
|
|||
* to avert any unintented undo interaction through the UI
|
||||
*/
|
||||
gimp_image_undo_freeze (image_map->gdisp->gimage);
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (image_map->gdisp->shell));
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (image_map->gdisp->shell),
|
||||
image_map->gdisp->gimage->gimp);
|
||||
|
||||
return image_map;
|
||||
}
|
||||
|
@ -245,7 +246,8 @@ image_map_commit (ImageMap *image_map)
|
|||
x1, y1, x2, y2, image_map->undo_tiles, FALSE);
|
||||
}
|
||||
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (image_map->gdisp->shell));
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (image_map->gdisp->shell),
|
||||
image_map->gdisp->gimage->gimp);
|
||||
g_free (image_map);
|
||||
}
|
||||
|
||||
|
@ -297,7 +299,8 @@ image_map_clear (ImageMap *image_map)
|
|||
g_message ("image depth change, unable to restore original image");
|
||||
tile_manager_destroy (image_map->undo_tiles);
|
||||
gimp_image_undo_thaw (image_map->gdisp->gimage);
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (image_map->gdisp->shell));
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (image_map->gdisp->shell),
|
||||
image_map->gdisp->gimage->gimp);
|
||||
g_free (image_map);
|
||||
return;
|
||||
}
|
||||
|
@ -322,7 +325,8 @@ image_map_abort (ImageMap *image_map)
|
|||
|
||||
image_map_clear (image_map);
|
||||
gimp_image_undo_thaw (image_map->gdisp->gimage);
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (image_map->gdisp->shell));
|
||||
gimp_display_shell_set_menu_sensitivity (GIMP_DISPLAY_SHELL (image_map->gdisp->shell),
|
||||
image_map->gdisp->gimage->gimp);
|
||||
g_free (image_map);
|
||||
}
|
||||
|
||||
|
|
|
@ -536,14 +536,14 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
"<StockItem>", GTK_STOCK_HELP },
|
||||
NULL,
|
||||
"view/dialogs/info_window.html", NULL },
|
||||
{ { N_("/View/Nav. Window..."), "<control><shift>N",
|
||||
view_nav_window_cmd_callback, 0,
|
||||
{ { N_("/View/Navigation Window..."), "<control><shift>N",
|
||||
view_navigation_window_cmd_callback, 0,
|
||||
"<StockItem>", GIMP_STOCK_TOOL_MOVE },
|
||||
NULL,
|
||||
"view/dialogs/navigation_window.html", NULL },
|
||||
{ { N_("/View/Display Filters..."), NULL,
|
||||
dialogs_create_toplevel_cmd_callback, 0 },
|
||||
"gimp:display-filters-dialog",
|
||||
view_display_filters_cmd_callback, 0 },
|
||||
NULL,
|
||||
"dialogs/display_filters/display_filters.html", NULL },
|
||||
|
||||
SEPARATOR ("/View/---"),
|
||||
|
|
Loading…
Reference in New Issue