Working layer bar. Champagne!
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1193 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
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
|
||||
|
||||
Reference in New Issue
Block a user