aboutsummaryrefslogtreecommitdiff
path: root/src/user.c
diff options
context:
space:
mode:
authorKrow Savcik <krow@savcik.xyz>2024-02-06 22:56:21 +0200
committerKrow Savcik <krow@savcik.xyz>2024-02-06 22:56:21 +0200
commitc918280fb5de6e6256cfd9a438b3578c04e3afc2 (patch)
treeba72e1464c487b61d4376647769c93cdbccf7a21 /src/user.c
parent009a890482edfb2247da1d69b86f4d193699e3cb (diff)
feautre: added undo/redo buttons
The change history is kept in a ring buffer of definite size 2000.
Diffstat (limited to 'src/user.c')
-rw-r--r--src/user.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/user.c b/src/user.c
index 0261c65..927e852 100644
--- a/src/user.c
+++ b/src/user.c
@@ -12,6 +12,7 @@
#include "cdraw.h"
#include "types.h"
#include "tools.h"
+#include "action.h"
#include "canvas.h"
#include "palette.h"
@@ -242,3 +243,19 @@ choose_file_path(const char *prompt, char *input)
if (ft != stdin) pclose(ft);
}
+
+void
+user_canvas_undo(const Arg *x)
+{
+ if (cur_canvas == NULL) return;
+ action_undo(cur_canvas);
+ ui_redraw_panel(UI_PANELTYPE_CANVAS);
+}
+
+void
+user_canvas_redo(const Arg *x)
+{
+ if (cur_canvas == NULL) return;
+ action_redo(cur_canvas);
+ ui_redraw_panel(UI_PANELTYPE_CANVAS);
+}