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/canvas.h | |
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/canvas.h')
-rw-r--r-- | src/canvas.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/canvas.h b/src/canvas.h index 104f130..bc96ab9 100644 --- a/src/canvas.h +++ b/src/canvas.h @@ -1,5 +1,10 @@ +/* Should include action.h before it */ + +/* TODO: move to config.h */ +#define HISTLENGTH 2000 + struct Layer { - unsigned int *pix; + unsigned int *pix; }; struct Canvas { @@ -10,8 +15,11 @@ struct Canvas { struct Layer **layers; int x, y; void *back, *pres, *half_pres; - void *temp_pix; + struct action_pixcol *temp_pix; + int temp_cnt; uint *pres_pix; + Action history[HISTLENGTH]; + int hist_s, hist_e, hist_i, hist_isend; }; typedef struct Layer Layer; @@ -38,3 +46,5 @@ void canvas_move_y(Canvas *, long int); void canvas_refresh(Canvas *); unsigned char canvas_save(Canvas *, const char *, short int); unsigned char canvas_export_png(Canvas *, const char *, void *); +void action_undo(Canvas *); +void action_redo(Canvas *); |