Working layer bar. Champagne!
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1193 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
353f5dbbd2
commit
883653480b
6
const.h
6
const.h
@ -431,12 +431,6 @@ enum SPECIAL_ACTIONS
|
||||
SPECIAL_LAYER7_TOGGLE,
|
||||
SPECIAL_LAYER8_SELECT,
|
||||
SPECIAL_LAYER8_TOGGLE,
|
||||
SPECIAL_LAYER_ADD,
|
||||
SPECIAL_LAYER_DELETE,
|
||||
SPECIAL_LAYER_MERGE,
|
||||
SPECIAL_LAYER_SWAP_UP,
|
||||
SPECIAL_LAYER_SWAP_DOWN,
|
||||
SPECIAL_LAYER_MENU,
|
||||
NB_SPECIAL_SHORTCUTS ///< Number of special shortcuts
|
||||
};
|
||||
|
||||
|
||||
114
engine.c
114
engine.c
@ -39,6 +39,7 @@
|
||||
#include "input.h"
|
||||
#include "engine.h"
|
||||
#include "pages.h"
|
||||
#include "layers.h"
|
||||
|
||||
|
||||
// we need this as global
|
||||
@ -1066,119 +1067,6 @@ void Main_handler(void)
|
||||
Layer_activate((key_index-SPECIAL_LAYER1_TOGGLE)/2, RIGHT_SIDE);
|
||||
action++;
|
||||
break;
|
||||
case SPECIAL_LAYER_ADD:
|
||||
// Backup with unchanged layers
|
||||
Backup_layers(0);
|
||||
if (!Add_layer(Main_backups,Main_current_layer+1))
|
||||
{
|
||||
Update_depth_buffer();
|
||||
Hide_cursor();
|
||||
Display_all_screen();
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
}
|
||||
action++;
|
||||
break;
|
||||
case SPECIAL_LAYER_DELETE:
|
||||
// Backup with unchanged layers
|
||||
Backup_layers(0);
|
||||
if (!Delete_layer(Main_backups,Main_current_layer))
|
||||
{
|
||||
Update_screen_targets();
|
||||
Redraw_layered_image();
|
||||
Hide_cursor();
|
||||
Display_all_screen();
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
}
|
||||
action++;
|
||||
break;
|
||||
case SPECIAL_LAYER_MERGE:
|
||||
if (Main_current_layer>0)
|
||||
{
|
||||
// Backup layer below the current
|
||||
Backup_layers(1<<(Main_current_layer-1));
|
||||
|
||||
Merge_layer();
|
||||
|
||||
Update_screen_targets();
|
||||
Redraw_layered_image();
|
||||
Hide_cursor();
|
||||
Display_all_screen();
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
}
|
||||
action++;
|
||||
break;
|
||||
case SPECIAL_LAYER_SWAP_UP:
|
||||
if (Main_current_layer < (Main_backups->Pages->Nb_layers-1))
|
||||
{
|
||||
byte * tmp;
|
||||
dword layer_flags;
|
||||
|
||||
// Backup with unchanged layers
|
||||
Backup_layers(0);
|
||||
|
||||
// swap
|
||||
tmp = Main_backups->Pages->Image[Main_current_layer];
|
||||
Main_backups->Pages->Image[Main_current_layer] = Main_backups->Pages->Image[Main_current_layer+1];
|
||||
Main_backups->Pages->Image[Main_current_layer+1] = tmp;
|
||||
|
||||
// Swap visibility indicators
|
||||
layer_flags = (Main_layers_visible >> Main_current_layer) & 3;
|
||||
// Only needed if they are different.
|
||||
if (layer_flags == 1 || layer_flags == 2)
|
||||
{
|
||||
// One is on, the other is off. Negating them will
|
||||
// perform the swap.
|
||||
Main_layers_visible ^= (3 << Main_current_layer);
|
||||
}
|
||||
Main_current_layer++;
|
||||
|
||||
Update_screen_targets();
|
||||
Redraw_layered_image();
|
||||
Hide_cursor();
|
||||
Display_all_screen();
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
}
|
||||
action++;
|
||||
break;
|
||||
|
||||
case SPECIAL_LAYER_SWAP_DOWN:
|
||||
if (Main_current_layer > 0)
|
||||
{
|
||||
byte * tmp;
|
||||
dword layer_flags;
|
||||
|
||||
// Backup with unchanged layers
|
||||
Backup_layers(0);
|
||||
|
||||
// swap
|
||||
tmp = Main_backups->Pages->Image[Main_current_layer];
|
||||
Main_backups->Pages->Image[Main_current_layer] = Main_backups->Pages->Image[Main_current_layer-1];
|
||||
Main_backups->Pages->Image[Main_current_layer-1] = tmp;
|
||||
|
||||
// Swap visibility indicators
|
||||
layer_flags = (Main_layers_visible >> (Main_current_layer-1)) & 3;
|
||||
// Only needed if they are different.
|
||||
if (layer_flags == 1 || layer_flags == 2)
|
||||
{
|
||||
// Only needed if they are different.
|
||||
// One is on, the other is off. Negating them will
|
||||
// perform the swap.
|
||||
Main_layers_visible ^= (3 << (Main_current_layer-1));
|
||||
}
|
||||
Main_current_layer--;
|
||||
Update_screen_targets();
|
||||
Redraw_layered_image();
|
||||
Hide_cursor();
|
||||
Display_all_screen();
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
}
|
||||
action++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // End of special keys
|
||||
|
||||
50
helpfile.h
50
helpfile.h
@ -287,12 +287,13 @@ static const T_Help_table helptable_help[] =
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("LAYERS")
|
||||
HELP_TEXT ("")
|
||||
HELP_LINK (" Menu : %s", SPECIAL_LAYER_MENU)
|
||||
HELP_LINK (" Add new : %s", SPECIAL_LAYER_ADD)
|
||||
HELP_LINK (" Delete : %s", SPECIAL_LAYER_DELETE)
|
||||
HELP_LINK (" Merge : %s", SPECIAL_LAYER_MERGE)
|
||||
HELP_LINK (" Move up : %s", SPECIAL_LAYER_SWAP_UP)
|
||||
HELP_LINK (" Move down : %s", SPECIAL_LAYER_SWAP_DOWN)
|
||||
HELP_LINK (" Menu : %s", 0x100+BUTTON_LAYER_MENU)
|
||||
HELP_LINK (" Add new : %s", 0x100+BUTTON_LAYER_ADD)
|
||||
HELP_LINK (" Delete : %s", 0x100+BUTTON_LAYER_REMOVE)
|
||||
HELP_LINK (" Merge : %s", 0x100+BUTTON_LAYER_MERGE)
|
||||
HELP_LINK (" Move up : %s", 0x100+BUTTON_LAYER_UP)
|
||||
HELP_LINK (" Move down : %s", 0x100+BUTTON_LAYER_DOWN)
|
||||
//HELP_LINK (" Set transp: %s", 0x100+BUTTON_LAYER_COLOR)
|
||||
HELP_TEXT (" Select :")
|
||||
HELP_LINK (" 1 : %s", SPECIAL_LAYER1_SELECT)
|
||||
HELP_LINK (" 2 : %s", SPECIAL_LAYER2_SELECT)
|
||||
@ -2487,6 +2488,8 @@ static const T_Help_table helptable_layermenu[] =
|
||||
|
||||
HELP_TITLE("LAYERS MENU")
|
||||
HELP_TEXT ("")
|
||||
HELP_LINK ("(Key:%s)",0x100+BUTTON_LAYER_MENU)
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("* Not implemented yet! *")
|
||||
|
||||
};
|
||||
@ -2495,7 +2498,8 @@ static const T_Help_table helptable_layertrans[] =
|
||||
|
||||
HELP_TITLE("LAYERS TRANSPARENCY")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("* Not implemented yet! *")
|
||||
HELP_TEXT ("The current Background color becomes the")
|
||||
HELP_TEXT ("color considered transparent for the layers.")
|
||||
|
||||
};
|
||||
static const T_Help_table helptable_layermerge[] =
|
||||
@ -2503,15 +2507,24 @@ static const T_Help_table helptable_layermerge[] =
|
||||
|
||||
HELP_TITLE("LAYERS MERGE")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("Merge layer with the one below")
|
||||
|
||||
HELP_LINK ("(Key:%s)",0x100+BUTTON_LAYER_MERGE)
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("Merges the current layer with the one below")
|
||||
HELP_TEXT ("it, and sets the resulting layer as current")
|
||||
HELP_TEXT ("one for editing.")
|
||||
HELP_TEXT ("This function has no effect if you're")
|
||||
HELP_TEXT ("editing the lowest layer.")
|
||||
};
|
||||
static const T_Help_table helptable_layeradd[] =
|
||||
{
|
||||
|
||||
HELP_TITLE("ADD LAYER")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("Add a new layer above the current one")
|
||||
HELP_LINK ("(Key:%s)",0x100+BUTTON_LAYER_ADD)
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("Add a new layer above the current one,")
|
||||
HELP_TEXT ("and selects this new (empty) layer for")
|
||||
HELP_TEXT ("editing.")
|
||||
|
||||
};
|
||||
static const T_Help_table helptable_layerdel[] =
|
||||
@ -2519,7 +2532,9 @@ static const T_Help_table helptable_layerdel[] =
|
||||
|
||||
HELP_TITLE("DROP LAYER")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("Drop the current layer")
|
||||
HELP_LINK ("(Key:%s)",0x100+BUTTON_LAYER_REMOVE)
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("Deletes the current layer.")
|
||||
|
||||
};
|
||||
static const T_Help_table helptable_layerup[] =
|
||||
@ -2527,7 +2542,11 @@ static const T_Help_table helptable_layerup[] =
|
||||
|
||||
HELP_TITLE("MOVE LAYER UP")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("Move current layer above the next one")
|
||||
HELP_LINK ("(Key:%s)",0x100+BUTTON_LAYER_UP)
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("Swaps the current layer with the one")
|
||||
HELP_TEXT ("above it. This has no effect if this")
|
||||
HELP_TEXT ("layer is already on top.")
|
||||
|
||||
};
|
||||
static const T_Help_table helptable_layerdown[] =
|
||||
@ -2535,8 +2554,11 @@ static const T_Help_table helptable_layerdown[] =
|
||||
|
||||
HELP_TITLE("MOVE LAYER DOWN")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("Move the current layer below the previous one")
|
||||
|
||||
HELP_LINK ("(Key:%s)",0x100+BUTTON_LAYER_DOWN)
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT ("Swaps the current layer with the one")
|
||||
HELP_TEXT ("below it. This has no effect if this")
|
||||
HELP_TEXT ("layer is already on the bottom.")
|
||||
};
|
||||
static const T_Help_table helptable_layerselect[] =
|
||||
{
|
||||
|
||||
12
hotkeys.c
12
hotkeys.c
@ -1656,10 +1656,10 @@ word Ordering[NB_SHORTCUTS]=
|
||||
SPECIAL_LAYER7_TOGGLE,
|
||||
SPECIAL_LAYER8_SELECT,
|
||||
SPECIAL_LAYER8_TOGGLE,
|
||||
SPECIAL_LAYER_ADD,
|
||||
SPECIAL_LAYER_DELETE,
|
||||
SPECIAL_LAYER_MERGE,
|
||||
SPECIAL_LAYER_SWAP_UP,
|
||||
SPECIAL_LAYER_SWAP_DOWN,
|
||||
SPECIAL_LAYER_MENU,
|
||||
0x100+BUTTON_LAYER_ADD,
|
||||
0x100+BUTTON_LAYER_REMOVE,
|
||||
0x100+BUTTON_LAYER_MERGE,
|
||||
0x100+BUTTON_LAYER_UP,
|
||||
0x100+BUTTON_LAYER_DOWN,
|
||||
0x100+BUTTON_LAYER_MENU,
|
||||
};
|
||||
|
||||
2
init.c
2
init.c
@ -1313,7 +1313,7 @@ void Init_buttons(void)
|
||||
142,0,
|
||||
13,9, // Will be updated according to actual number of layers
|
||||
BUTTON_SHAPE_NO_FRAME,
|
||||
Button_Layer_select, Button_Layer_select,
|
||||
Button_Layer_select, Button_Layer_toggle,
|
||||
Do_nothing,
|
||||
FAMILY_INSTANT);
|
||||
// Status bar
|
||||
|
||||
256
layers.c
256
layers.c
@ -26,107 +26,132 @@
|
||||
#include "engine.h"
|
||||
#include "pages.h"
|
||||
|
||||
void Layer_activate(short layer, short side)
|
||||
{
|
||||
word old_layers;
|
||||
|
||||
if (layer >= Main_backups->Pages->Nb_layers)
|
||||
return;
|
||||
|
||||
// Keep a copy of which layers were visible
|
||||
old_layers = Main_layers_visible;
|
||||
|
||||
#ifndef NOLAYERS
|
||||
|
||||
if (side == RIGHT_SIDE)
|
||||
{
|
||||
// Right-click on current layer
|
||||
if (Main_current_layer == layer)
|
||||
{
|
||||
if (Main_layers_visible == (dword)(1<<layer))
|
||||
{
|
||||
// Set all layers visible
|
||||
Main_layers_visible = 0xFFFFFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set only this one visible
|
||||
Main_layers_visible = 1<<layer;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Right-click on an other layer : toggle its visibility
|
||||
Main_layers_visible ^= 1<<layer;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Left-click on any layer
|
||||
Main_current_layer = layer;
|
||||
Main_layers_visible |= 1<<layer;
|
||||
}
|
||||
#else
|
||||
// Handler for limited layers support: only allow one visible at a time
|
||||
if (side == LEFT_SIDE)
|
||||
{
|
||||
Main_current_layer = layer;
|
||||
Main_layers_visible = 1<<layer;
|
||||
|
||||
Update_screen_targets();
|
||||
}
|
||||
#endif
|
||||
|
||||
Hide_cursor();
|
||||
if (Main_layers_visible != old_layers)
|
||||
Redraw_layered_image();
|
||||
else
|
||||
Update_depth_buffer(); // Only need the depth buffer
|
||||
//Download_infos_page_main(Main_backups->Pages);
|
||||
//Download_infos_backup(Main_backups);
|
||||
Display_all_screen();
|
||||
Display_layerbar();
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
void Button_Layer_add(void)
|
||||
{
|
||||
// Backup with unchanged layers
|
||||
Backup_layers(0);
|
||||
if (!Add_layer(Main_backups,Main_current_layer+1))
|
||||
Hide_cursor();
|
||||
|
||||
if (Main_backups->Pages->Nb_layers < 32)
|
||||
{
|
||||
Update_depth_buffer();
|
||||
Hide_cursor();
|
||||
Display_all_screen();
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
// Backup with unchanged layers
|
||||
Backup_layers(0);
|
||||
if (!Add_layer(Main_backups,Main_current_layer+1))
|
||||
{
|
||||
Update_depth_buffer();
|
||||
Display_all_screen();
|
||||
Display_layerbar();
|
||||
End_of_modification();
|
||||
}
|
||||
}
|
||||
|
||||
Hide_cursor();
|
||||
Unselect_button(BUTTON_LAYER_ADD);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
void Button_Layer_remove(void)
|
||||
{
|
||||
// Backup with unchanged layers
|
||||
Backup_layers(0);
|
||||
if (!Delete_layer(Main_backups,Main_current_layer))
|
||||
{
|
||||
Update_screen_targets();
|
||||
Redraw_layered_image();
|
||||
Hide_cursor();
|
||||
Display_all_screen();
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
}
|
||||
|
||||
Hide_cursor();
|
||||
|
||||
if (Main_backups->Pages->Nb_layers > 1)
|
||||
{
|
||||
// Backup with unchanged layers
|
||||
Backup_layers(0);
|
||||
if (!Delete_layer(Main_backups,Main_current_layer))
|
||||
{
|
||||
Update_screen_targets();
|
||||
Redraw_layered_image();
|
||||
|
||||
Display_all_screen();
|
||||
Display_layerbar();
|
||||
End_of_modification();
|
||||
}
|
||||
}
|
||||
Unselect_button(BUTTON_LAYER_REMOVE);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
void Button_Layer_select(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
Unselect_button(BUTTON_LAYER_SELECT);
|
||||
Display_cursor();
|
||||
word 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;
|
||||
|
||||
Layer_activate(layer, LEFT_SIDE);
|
||||
}
|
||||
|
||||
/*
|
||||
void Button_Layer_1(void)
|
||||
void Button_Layer_toggle(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
Unselect_button(BUTTON_LAYER_1);
|
||||
Display_cursor();
|
||||
word 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;
|
||||
|
||||
Layer_activate(layer, RIGHT_SIDE);
|
||||
}
|
||||
|
||||
void Button_Layer_2(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
Unselect_button(BUTTON_LAYER_2);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
void Button_Layer_3(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
Unselect_button(BUTTON_LAYER_3);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
void Button_Layer_4(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
Unselect_button(BUTTON_LAYER_4);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
void Button_Layer_5(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
Unselect_button(BUTTON_LAYER_5);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
void Button_Layer_6(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
Unselect_button(BUTTON_LAYER_6);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
void Button_Layer_7(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
Unselect_button(BUTTON_LAYER_7);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
void Button_Layer_8(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
Unselect_button(BUTTON_LAYER_8);
|
||||
Display_cursor();
|
||||
}
|
||||
*/
|
||||
void Button_Layer_menu(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
@ -136,25 +161,27 @@ void Button_Layer_menu(void)
|
||||
|
||||
void Button_Layer_color(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
|
||||
if (Main_backups->Pages->Transparent_color != Back_color)
|
||||
{
|
||||
Backup_layers(-1);
|
||||
Main_backups->Pages->Transparent_color = Back_color;
|
||||
|
||||
Redraw_layered_image();
|
||||
Hide_cursor();
|
||||
Display_all_screen();
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
}
|
||||
|
||||
Hide_cursor();
|
||||
Unselect_button(BUTTON_LAYER_COLOR);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
void Button_Layer_merge(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
|
||||
if (Main_current_layer>0)
|
||||
{
|
||||
// Backup layer below the current
|
||||
@ -164,58 +191,58 @@ void Button_Layer_merge(void)
|
||||
|
||||
Update_screen_targets();
|
||||
Redraw_layered_image();
|
||||
Hide_cursor();
|
||||
Display_all_screen();
|
||||
Display_cursor();
|
||||
Display_layerbar();
|
||||
End_of_modification();
|
||||
}
|
||||
|
||||
Hide_cursor();
|
||||
Unselect_button(BUTTON_LAYER_MERGE);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
void Button_Layer_up(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
|
||||
if (Main_current_layer < (Main_backups->Pages->Nb_layers-1))
|
||||
{
|
||||
byte * tmp;
|
||||
dword layer_flags;
|
||||
|
||||
// Backup with unchanged layers
|
||||
Backup_layers(0);
|
||||
|
||||
// swap
|
||||
tmp = Main_backups->Pages->Image[Main_current_layer];
|
||||
Main_backups->Pages->Image[Main_current_layer] = Main_backups->Pages->Image[Main_current_layer+1];
|
||||
Main_backups->Pages->Image[Main_current_layer+1] = tmp;
|
||||
|
||||
// Swap visibility indicators
|
||||
layer_flags = (Main_layers_visible >> Main_current_layer) & 3;
|
||||
// Only needed if they are different.
|
||||
if (layer_flags == 1 || layer_flags == 2)
|
||||
{
|
||||
// One is on, the other is off. Negating them will
|
||||
// perform the swap.
|
||||
Main_layers_visible ^= (3 << Main_current_layer);
|
||||
}
|
||||
Main_current_layer++;
|
||||
|
||||
Update_screen_targets();
|
||||
Redraw_layered_image();
|
||||
Hide_cursor();
|
||||
Display_all_screen();
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
byte * tmp;
|
||||
dword layer_flags;
|
||||
|
||||
// Backup with unchanged layers
|
||||
Backup_layers(0);
|
||||
|
||||
// swap
|
||||
tmp = Main_backups->Pages->Image[Main_current_layer];
|
||||
Main_backups->Pages->Image[Main_current_layer] = Main_backups->Pages->Image[Main_current_layer+1];
|
||||
Main_backups->Pages->Image[Main_current_layer+1] = tmp;
|
||||
|
||||
// Swap visibility indicators
|
||||
layer_flags = (Main_layers_visible >> Main_current_layer) & 3;
|
||||
// Only needed if they are different.
|
||||
if (layer_flags == 1 || layer_flags == 2)
|
||||
{
|
||||
// One is on, the other is off. Negating them will
|
||||
// perform the swap.
|
||||
Main_layers_visible ^= (3 << Main_current_layer);
|
||||
}
|
||||
Main_current_layer++;
|
||||
|
||||
Update_screen_targets();
|
||||
Redraw_layered_image();
|
||||
Display_all_screen();
|
||||
Display_layerbar();
|
||||
End_of_modification();
|
||||
}
|
||||
|
||||
Hide_cursor();
|
||||
Unselect_button(BUTTON_LAYER_UP);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
void Button_Layer_down(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
|
||||
if (Main_current_layer > 0)
|
||||
{
|
||||
byte * tmp;
|
||||
@ -242,12 +269,11 @@ void Button_Layer_down(void)
|
||||
Main_current_layer--;
|
||||
Update_screen_targets();
|
||||
Redraw_layered_image();
|
||||
Hide_cursor();
|
||||
Display_layerbar();
|
||||
Display_all_screen();
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
}
|
||||
Hide_cursor();
|
||||
|
||||
Unselect_button(BUTTON_LAYER_DOWN);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
13
layers.h
13
layers.h
@ -22,20 +22,13 @@
|
||||
|
||||
void Button_Layer_add(void);
|
||||
void Button_Layer_remove(void);
|
||||
/*
|
||||
void Button_Layer_1(void);
|
||||
void Button_Layer_2(void);
|
||||
void Button_Layer_3(void);
|
||||
void Button_Layer_4(void);
|
||||
void Button_Layer_5(void);
|
||||
void Button_Layer_6(void);
|
||||
void Button_Layer_7(void);
|
||||
void Button_Layer_8(void);
|
||||
*/
|
||||
void Button_Layer_menu(void);
|
||||
void Button_Layer_color(void);
|
||||
void Button_Layer_merge(void);
|
||||
void Button_Layer_up(void);
|
||||
void Button_Layer_down(void);
|
||||
void Button_Layer_select(void);
|
||||
void Button_Layer_toggle(void);
|
||||
void Layer_activate(short layer, short side);
|
||||
|
||||
|
||||
|
||||
61
special.c
61
special.c
@ -469,65 +469,4 @@ void Transparency_set(byte amount)
|
||||
Compute_colorize_table();
|
||||
}
|
||||
|
||||
void Layer_activate(short layer, short side)
|
||||
{
|
||||
word old_layers;
|
||||
|
||||
if (layer >= Main_backups->Pages->Nb_layers)
|
||||
return;
|
||||
|
||||
// Keep a copy of which layers were visible
|
||||
old_layers = Main_layers_visible;
|
||||
|
||||
#ifndef NOLAYERS
|
||||
|
||||
if (side == RIGHT_SIDE)
|
||||
{
|
||||
// Right-click on current layer
|
||||
if (Main_current_layer == layer)
|
||||
{
|
||||
if (Main_layers_visible == (dword)(1<<layer))
|
||||
{
|
||||
// Set all layers visible
|
||||
Main_layers_visible = 0xFFFFFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set only this one visible
|
||||
Main_layers_visible = 1<<layer;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Right-click on an other layer : toggle its visibility
|
||||
Main_layers_visible ^= 1<<layer;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Left-click on any layer
|
||||
Main_current_layer = layer;
|
||||
Main_layers_visible |= 1<<layer;
|
||||
}
|
||||
#else
|
||||
// Handler for limited layers support: only allow one visible at a time
|
||||
if (side == LEFT_SIDE)
|
||||
{
|
||||
Main_current_layer = layer;
|
||||
Main_layers_visible = 1<<layer;
|
||||
|
||||
Update_screen_targets();
|
||||
}
|
||||
#endif
|
||||
|
||||
Hide_cursor();
|
||||
if (Main_layers_visible != old_layers)
|
||||
Redraw_layered_image();
|
||||
else
|
||||
Update_depth_buffer(); // Only need the depth buffer
|
||||
//Download_infos_page_main(Main_backups->Pages);
|
||||
//Download_infos_backup(Main_backups);
|
||||
Display_all_screen();
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
|
||||
48
windows.c
48
windows.c
@ -39,6 +39,9 @@
|
||||
#include "readline.h"
|
||||
#include "sdlscreen.h"
|
||||
|
||||
/// Width of one layer button, in pixels before scaling
|
||||
word Layer_button_width = 1;
|
||||
|
||||
// L'encapsulation tente une percée...ou un dernier combat.
|
||||
|
||||
// Nombre de cellules réel dans la palette du menu
|
||||
@ -420,6 +423,18 @@ int Pick_color_in_palette()
|
||||
return color;
|
||||
}
|
||||
|
||||
/// Draws a solid textured area, to the right of a toolbar.
|
||||
void Draw_bar_remainder(word current_menu, word x_off, word y_off)
|
||||
{
|
||||
word y_pos;
|
||||
word x_pos;
|
||||
|
||||
for (y_pos=0;y_pos<Menu_bars[current_menu].Height;y_pos++)
|
||||
for (x_pos=x_off;x_pos<Screen_width/Menu_factor_X;x_pos++)
|
||||
Pixel_in_menu(x_pos, y_pos + y_off, Menu_bars[current_menu].Skin[y_pos * Menu_bars[current_menu].Skin_width + Menu_bars[current_menu].Skin_width - 2 + (x_pos&1)]);
|
||||
}
|
||||
|
||||
|
||||
/// Display / update the layer menubar
|
||||
void Display_layerbar(void)
|
||||
{
|
||||
@ -446,6 +461,9 @@ void Display_layerbar(void)
|
||||
// Don't display all buttons if not enough room
|
||||
if (horiz_space/button_width < button_number)
|
||||
button_number = horiz_space/button_width;
|
||||
// Only 16 icons at the moment
|
||||
if (button_number > 16)
|
||||
button_number = 16;
|
||||
|
||||
// Enlarge the buttons themselves if there's enough room
|
||||
while (button_number*(button_width+2) < horiz_space && repeats < 20)
|
||||
@ -494,8 +512,22 @@ void Display_layerbar(void)
|
||||
// Next button
|
||||
x_off+=button_width;
|
||||
}
|
||||
// Texture any remaining space to the right.
|
||||
// This overwrites any junk like deleted buttons.
|
||||
Draw_bar_remainder(MENUBAR_LAYERS, x_off, y_off);
|
||||
|
||||
// Update the active area of the layers pseudo-button
|
||||
Buttons_Pool[BUTTON_LAYER_SELECT].Width = button_number * button_width;
|
||||
|
||||
// Required to determine which layer button is clicked
|
||||
Layer_button_width = button_width;
|
||||
|
||||
// A screen refresh required by some callers
|
||||
Update_rect(
|
||||
Menu_bars[MENUBAR_LAYERS].Skin_width,
|
||||
Menu_Y+y_off*Menu_factor_Y,
|
||||
horiz_space*Menu_factor_X,
|
||||
Menu_bars[MENUBAR_LAYERS].Height*Menu_factor_Y);
|
||||
}
|
||||
|
||||
|
||||
@ -520,14 +552,18 @@ void Display_menu(void)
|
||||
for (x_pos=0;x_pos<Menu_bars[current_menu].Skin_width;x_pos++)
|
||||
Pixel_in_menu(x_pos, y_pos + y_off, Menu_bars[current_menu].Skin[y_pos * Menu_bars[current_menu].Skin_width + x_pos]);
|
||||
|
||||
// If some area is remaining to the right, texture it with a copy of
|
||||
// the last two columns
|
||||
for (y_pos=0;y_pos<Menu_bars[current_menu].Height;y_pos++)
|
||||
for (x_pos=Menu_bars[current_menu].Skin_width;x_pos<Screen_width/Menu_factor_X;x_pos++)
|
||||
Pixel_in_menu(x_pos, y_pos + y_off, Menu_bars[current_menu].Skin[y_pos * Menu_bars[current_menu].Skin_width + Menu_bars[current_menu].Skin_width - 2 + (x_pos&1)]);
|
||||
|
||||
if (current_menu == MENUBAR_LAYERS)
|
||||
{
|
||||
// The layerbar has its own display, for the whole length.
|
||||
Display_layerbar();
|
||||
}
|
||||
else
|
||||
{
|
||||
// If some area is remaining to the right, texture it with a copy of
|
||||
// the last two columns
|
||||
Draw_bar_remainder(current_menu, Menu_bars[current_menu].Skin_width, y_off);
|
||||
}
|
||||
|
||||
// Next bar
|
||||
y_off += Menu_bars[current_menu].Height;
|
||||
}
|
||||
|
||||
@ -56,6 +56,7 @@ void Set_back_color(byte color);
|
||||
void Frame_menu_color(byte id);
|
||||
void Display_menu_palette(void);
|
||||
void Display_menu(void);
|
||||
void Display_layerbar(void);
|
||||
void Reposition_palette(void);
|
||||
void Change_palette_cells(void);
|
||||
int Pick_color_in_palette(void);
|
||||
@ -102,4 +103,7 @@ void Vertical_XOR_line_zoom(short x_pos, short y_pos, short height);
|
||||
|
||||
void Change_magnifier_factor(byte factor_index);
|
||||
|
||||
/// Width of one layer button, in pixels before scaling
|
||||
extern word Layer_button_width;
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user