diff options
author | Krow Savcik <krow@savcik.xyz> | 2024-02-06 22:56:21 +0200 |
---|---|---|
committer | Krow Savcik <krow@savcik.xyz> | 2024-02-06 22:56:21 +0200 |
commit | c918280fb5de6e6256cfd9a438b3578c04e3afc2 (patch) | |
tree | ba72e1464c487b61d4376647769c93cdbccf7a21 /src/ui.c | |
parent | 009a890482edfb2247da1d69b86f4d193699e3cb (diff) |
feautre: added undo/redo buttons
The change history is kept in a ring buffer of definite size 2000.
Diffstat (limited to 'src/ui.c')
-rw-r--r-- | src/ui.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -6,6 +6,7 @@ #include "ui.h" #include "cdraw.h" #include "types.h" +#include "action.h" #include "canvas.h" #include "tools.h" #include "debug.h" @@ -37,6 +38,8 @@ static const SDL_Rect ui_buttons_rect[] = { {56, 54, 28, 28}, /* Zoom out */ {84, 54, 28, 28}, /* Clown */ {56, 82, 28, 28}, /* Color Picker */ + {84, 82, 28, 28}, /* Undo */ + {84, 110, 28, 28}, /* Redo */ }; struct UIPanel { @@ -272,6 +275,12 @@ ui_mousel_down(int x, int y) break; case TOOL_TYPE_EMPTY: break; + case TOOL_TYPE_UNDO: + user_canvas_undo(NULL); + break; + case TOOL_TYPE_REDO: + user_canvas_redo(NULL); + break; default: tool_change(col); break; @@ -369,7 +378,7 @@ ui_focus_panel_change(int x, int y) if (main_ui->focus_panel != NULL) { switch (main_ui->focus_panel->type) { case UI_PANELTYPE_CANVAS: - is_drawing = 0; + canvas_mousel_up(cur_canvas); main_ui->focus_panel = u; ui_redraw_panel(UI_PANELTYPE_CANVAS); break; |