Fix crashing bug when you click a layer button, hold it, and release past the edges of the layer buttons. Fix a display bug when layer bar is hidden and you use the shortcut actions.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1202 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-11-15 22:34:27 +00:00
parent e2f4ed00f1
commit 951600da1e
3 changed files with 19 additions and 4 deletions

View File

@ -69,7 +69,7 @@ char * Menu_tooltip[NB_BUTTONS]=
"Layerbar / Hide menu ",
"Layers manager ",
"Select transparent color",
"Get/Set transparent col.",
"Merge layer ",
"Add layer ",
"Drop layer ",

View File

@ -134,20 +134,32 @@ void Button_Layer_remove(void)
void Button_Layer_select(void)
{
word layer;
short layer;
// Determine which button is clicked according to mouse position
layer = (Mouse_X/Menu_factor_X - Menu_bars[MENUBAR_LAYERS].Skin_width)
/ Layer_button_width;
// Safety required because the mouse cursor can have slided outside button.
if (layer < 0)
layer=0;
else if (layer > Main_backups->Pages->Nb_layers-1)
layer=Main_backups->Pages->Nb_layers-1;
Layer_activate(layer, LEFT_SIDE);
}
void Button_Layer_toggle(void)
{
word layer;
short layer;
// Determine which button is clicked according to mouse position
layer = (Mouse_X/Menu_factor_X - Menu_bars[MENUBAR_LAYERS].Skin_width)
/ Layer_button_width;
// Safety required because the mouse cursor can have slided outside button.
if (layer < 0)
layer=0;
else if (layer > Main_backups->Pages->Nb_layers-1)
layer=Main_backups->Pages->Nb_layers-1;
Layer_activate(layer, RIGHT_SIDE);
}

View File

@ -460,6 +460,9 @@ void Display_layerbar(void)
word current_button;
word repeats=1;
if (! Menu_bars[MENUBAR_LAYERS].Visible)
return;
// Find top
for (current_menu = MENUBAR_COUNT - 1; current_menu > MENUBAR_LAYERS; current_menu --)
{