Lua: detect that the layer has changed and update layer buttons

fixes bug #42
http://pulkomandy.tk/projects/GrafX2/ticket/42
This commit is contained in:
Thomas Bernard 2018-12-07 20:42:41 +01:00 committed by Adrien Destugues
parent ab8c75306e
commit 307912681c

View File

@ -1956,7 +1956,6 @@ int L_SelectLayer(lua_State* L)
Update_depth_buffer(); // Only need the depth buffer Update_depth_buffer(); // Only need the depth buffer
} }
} }
// Todo: mark the layer menu bar as 'needs to be refreshed'
return 0; return 0;
} }
@ -2326,6 +2325,7 @@ void Run_script(const char *script_subdirectory, const char *script_filename)
char buf[MAX_PATH_CHARACTERS]; char buf[MAX_PATH_CHARACTERS];
int original_image_width=Main.image_width; int original_image_width=Main.image_width;
int original_image_height=Main.image_height; int original_image_height=Main.image_height;
int original_current_layer = Main.current_layer;
// Some scripts are slow // Some scripts are slow
Cursor_shape=CURSOR_SHAPE_HOURGLASS; Cursor_shape=CURSOR_SHAPE_HOURGLASS;
@ -2519,6 +2519,8 @@ void Run_script(const char *script_subdirectory, const char *script_filename)
Hide_cursor(); Hide_cursor();
Display_all_screen(); Display_all_screen();
if (original_current_layer != Main.current_layer)
Display_layerbar(); // current layer has changed, buttons need to be updated
// Update tilemap if image size has changed // Update tilemap if image size has changed
if (original_image_width!=Main.image_width if (original_image_width!=Main.image_width