Working layer bar. Champagne!

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1193 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud
2009-11-15 19:24:04 +00:00
parent 353f5dbbd2
commit 883653480b
10 changed files with 234 additions and 332 deletions

114
engine.c
View File

@@ -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