Tilemap mode: Undo and Redo only refresh tilemap when image size changes. Lua scripts that change image size also refresh tilemap
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1877 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
4813314638
commit
dae1bc856b
@ -211,7 +211,6 @@ void Button_Undo(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
Undo();
|
||||
Tilemap_update();
|
||||
Set_palette(Main_palette);
|
||||
Compute_optimal_menu_colors(Main_palette);
|
||||
|
||||
@ -226,7 +225,6 @@ void Button_Redo(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
Redo();
|
||||
Tilemap_update();
|
||||
Set_palette(Main_palette);
|
||||
Compute_optimal_menu_colors(Main_palette);
|
||||
|
||||
|
||||
@ -46,6 +46,8 @@
|
||||
#include "filesel.h" // Read_list_of_drives()
|
||||
#include "realpath.h"
|
||||
#include "setup.h"
|
||||
#include "tiles.h"
|
||||
|
||||
|
||||
/// Lua scripts bound to shortcut keys.
|
||||
char * Bound_script[10];
|
||||
@ -1559,6 +1561,8 @@ void Run_script(const char *script_subdirectory, const char *script_filename)
|
||||
const char* message;
|
||||
byte old_cursor_shape=Cursor_shape;
|
||||
char buf[MAX_PATH_CHARACTERS];
|
||||
int original_image_width=Main_image_width;
|
||||
int original_image_height=Main_image_height;
|
||||
|
||||
// Some scripts are slow
|
||||
Cursor_shape=CURSOR_SHAPE_HOURGLASS;
|
||||
@ -1728,6 +1732,14 @@ void Run_script(const char *script_subdirectory, const char *script_filename)
|
||||
|
||||
Hide_cursor();
|
||||
Display_all_screen();
|
||||
|
||||
// Update tilemap if image size has changed
|
||||
if (original_image_width!=Main_image_width
|
||||
|| original_image_height!=Main_image_height)
|
||||
{
|
||||
Tilemap_update();
|
||||
}
|
||||
|
||||
// Update changed pen colors.
|
||||
if (Back_color!=Original_back_color || Fore_color!=Original_fore_color)
|
||||
{
|
||||
|
||||
11
src/pages.c
11
src/pages.c
@ -33,6 +33,7 @@
|
||||
#include "loadsave.h"
|
||||
#include "misc.h"
|
||||
#include "windows.h"
|
||||
#include "tiles.h"
|
||||
|
||||
// -- Layers data
|
||||
|
||||
@ -1155,6 +1156,9 @@ void Check_layers_limits()
|
||||
|
||||
void Undo(void)
|
||||
{
|
||||
int width = Main_image_width;
|
||||
int height = Main_image_height;
|
||||
|
||||
if (Last_backed_up_layers)
|
||||
{
|
||||
Free_page_of_a_list(Main_backups);
|
||||
@ -1180,10 +1184,15 @@ void Undo(void)
|
||||
Redraw_layered_image();
|
||||
End_of_modification();
|
||||
|
||||
if (width != Main_image_width || height != Main_image_height)
|
||||
Tilemap_update();
|
||||
}
|
||||
|
||||
void Redo(void)
|
||||
{
|
||||
int width = Main_image_width;
|
||||
int height = Main_image_height;
|
||||
|
||||
if (Last_backed_up_layers)
|
||||
{
|
||||
Free_page_of_a_list(Main_backups);
|
||||
@ -1208,6 +1217,8 @@ void Redo(void)
|
||||
Redraw_layered_image();
|
||||
End_of_modification();
|
||||
|
||||
if (width != Main_image_width || height != Main_image_height)
|
||||
Tilemap_update();
|
||||
}
|
||||
|
||||
void Free_current_page(void)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user