Correctly set the sensitivity of the up/down buttons taking into account if

the next layer has an alhpa channel.


--Sven
This commit is contained in:
Sven Neumann 1999-06-08 09:14:09 +00:00
parent 93452ea4d6
commit dbdecb1f77
3 changed files with 82 additions and 44 deletions

View File

@ -1,3 +1,9 @@
Tue Jun 8 10:56:42 MEST 1999 Sven Neumann <sven@gimp.org>
* app/layers_dialog.c: Traverse the layers stack to know if there's
a prev/next layer. That way we know if the next layer has an alpha
channel and set the sensitivity of the up/down buttons correctly.
Tue Jun 8 01:12:31 MEST 1999 Sven Neumann <sven@gimp.org>
* app/flip_tool.c: Only install the tool cursor if we are inside a

View File

@ -873,14 +873,16 @@ layers_dialog_preview_extents ()
static void
layers_dialog_set_menu_sensitivity ()
{
gint fs; /* floating sel */
gint ac; /* active channel */
gint lm; /* layer mask */
gint gimage; /* is there a gimage */
gint lp; /* layers present */
gint alpha; /* alpha channel present */
gint lind; /* layer index */
gint lnum; /* number of layers */
gint fs; /* floating sel */
gint ac; /* active channel */
gint lm; /* layer mask */
gint gimage; /* is there a gimage */
gint lp; /* layers present */
gint alpha; /* alpha channel present */
gint next_alpha;
GSList *list;
GSList *next;
GSList *prev;
Layer *layer;
lp = FALSE;
@ -901,34 +903,48 @@ layers_dialog_set_menu_sensitivity ()
if (gimage)
lp = (layersD->gimage->layers != NULL);
lind = -1;
lnum = -1;
if (lp)
list = layersD->gimage->layers;
prev = NULL;
next = NULL;
while (list)
{
lind = gimage_get_layer_index (layersD->gimage,
layersD->gimage->active_layer);
lnum = g_slist_length (layersD->gimage->layers);
layer = (Layer *)list->data;
if (layer == (layersD->active_layer))
{
next = g_slist_next (list);
break;
}
prev = list;
list = g_slist_next (list);
}
if (next)
{
layer = (Layer *)next->data;
next_alpha = layer_has_alpha (layer);
}
else
next_alpha = FALSE;
menus_set_sensitive_locale ("<Layers>", N_("/Stack/Previous Layer"),
fs && ac && gimage && lp && lind > 0);
fs && ac && gimage && lp && prev);
menus_set_sensitive_locale ("<Layers>", N_("/Stack/Next Layer"),
fs && ac && gimage && lp && lind < (lnum - 1));
fs && ac && gimage && lp && next);
menus_set_sensitive_locale ("<Layers>", N_("/Stack/Raise Layer"),
fs && ac && gimage && lp && alpha && lind > 0);
fs && ac && gimage && lp && alpha && prev);
gtk_widget_set_sensitive (layers_ops_buttons[1].widget,
fs && ac && gimage && lp && alpha && lind > 0);
fs && ac && gimage && lp && alpha && prev);
menus_set_sensitive_locale ("<Layers>", N_("/Stack/Lower Layer"),
fs && ac && gimage && lp && lind < (lnum - 1));
fs && ac && gimage && lp && next && next_alpha);
gtk_widget_set_sensitive (layers_ops_buttons[2].widget,
fs && ac && gimage && lp && lind < (lnum - 1));
fs && ac && gimage && lp && next && next_alpha);
menus_set_sensitive_locale ("<Layers>", N_("/Stack/Layer to Top"),
fs && ac && gimage && lp && alpha && lind > 0);
fs && ac && gimage && lp && alpha && prev);
menus_set_sensitive_locale ("<Layers>", N_("/Stack/Layer to Bottom"),
fs && ac && gimage && lp && lind < (lnum - 1));
fs && ac && gimage && lp && next && next_alpha);
menus_set_sensitive_locale ("<Layers>", N_("/New Layer"), gimage);
gtk_widget_set_sensitive (layers_ops_buttons[0].widget, gimage);

View File

@ -873,14 +873,16 @@ layers_dialog_preview_extents ()
static void
layers_dialog_set_menu_sensitivity ()
{
gint fs; /* floating sel */
gint ac; /* active channel */
gint lm; /* layer mask */
gint gimage; /* is there a gimage */
gint lp; /* layers present */
gint alpha; /* alpha channel present */
gint lind; /* layer index */
gint lnum; /* number of layers */
gint fs; /* floating sel */
gint ac; /* active channel */
gint lm; /* layer mask */
gint gimage; /* is there a gimage */
gint lp; /* layers present */
gint alpha; /* alpha channel present */
gint next_alpha;
GSList *list;
GSList *next;
GSList *prev;
Layer *layer;
lp = FALSE;
@ -901,34 +903,48 @@ layers_dialog_set_menu_sensitivity ()
if (gimage)
lp = (layersD->gimage->layers != NULL);
lind = -1;
lnum = -1;
if (lp)
list = layersD->gimage->layers;
prev = NULL;
next = NULL;
while (list)
{
lind = gimage_get_layer_index (layersD->gimage,
layersD->gimage->active_layer);
lnum = g_slist_length (layersD->gimage->layers);
layer = (Layer *)list->data;
if (layer == (layersD->active_layer))
{
next = g_slist_next (list);
break;
}
prev = list;
list = g_slist_next (list);
}
if (next)
{
layer = (Layer *)next->data;
next_alpha = layer_has_alpha (layer);
}
else
next_alpha = FALSE;
menus_set_sensitive_locale ("<Layers>", N_("/Stack/Previous Layer"),
fs && ac && gimage && lp && lind > 0);
fs && ac && gimage && lp && prev);
menus_set_sensitive_locale ("<Layers>", N_("/Stack/Next Layer"),
fs && ac && gimage && lp && lind < (lnum - 1));
fs && ac && gimage && lp && next);
menus_set_sensitive_locale ("<Layers>", N_("/Stack/Raise Layer"),
fs && ac && gimage && lp && alpha && lind > 0);
fs && ac && gimage && lp && alpha && prev);
gtk_widget_set_sensitive (layers_ops_buttons[1].widget,
fs && ac && gimage && lp && alpha && lind > 0);
fs && ac && gimage && lp && alpha && prev);
menus_set_sensitive_locale ("<Layers>", N_("/Stack/Lower Layer"),
fs && ac && gimage && lp && lind < (lnum - 1));
fs && ac && gimage && lp && next && next_alpha);
gtk_widget_set_sensitive (layers_ops_buttons[2].widget,
fs && ac && gimage && lp && lind < (lnum - 1));
fs && ac && gimage && lp && next && next_alpha);
menus_set_sensitive_locale ("<Layers>", N_("/Stack/Layer to Top"),
fs && ac && gimage && lp && alpha && lind > 0);
fs && ac && gimage && lp && alpha && prev);
menus_set_sensitive_locale ("<Layers>", N_("/Stack/Layer to Bottom"),
fs && ac && gimage && lp && lind < (lnum - 1));
fs && ac && gimage && lp && next && next_alpha);
menus_set_sensitive_locale ("<Layers>", N_("/New Layer"), gimage);
gtk_widget_set_sensitive (layers_ops_buttons[0].widget, gimage);