From c918280fb5de6e6256cfd9a438b3578c04e3afc2 Mon Sep 17 00:00:00 2001 From: Krow Savcik Date: Tue, 6 Feb 2024 22:56:21 +0200 Subject: feautre: added undo/redo buttons The change history is kept in a ring buffer of definite size 2000. --- src/user.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/user.c') 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); +} -- cgit v1.2.3