diff options
author | Krow Savcik <krow@savcik.xyz> | 2024-02-13 12:00:11 +0200 |
---|---|---|
committer | Krow Savcik <krow@savcik.xyz> | 2024-02-13 12:00:11 +0200 |
commit | 8b8e1cab080dfea106bebe9d4eeecf5812182e94 (patch) | |
tree | 1ced4cdeecf7b49db78f69b6f65f334221bdac13 /src/user.c | |
parent | 67abc25311d9dc7d12b28d07aaa37fcaf9b5fee5 (diff) |
feature: add basic layer support
Diffstat (limited to 'src/user.c')
-rw-r--r-- | src/user.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -83,6 +83,7 @@ user_canvas_open(const Arg *x) if (cur_canvas == NULL) puts("Error opening file"); ui_redraw_panel(UI_PANELTYPE_CANVAS); + ui_redraw_panel(UI_PANELTYPE_TIMELINE); } void @@ -123,6 +124,7 @@ user_canvas_create_new(const Arg *x) cur_canvas = canvas_init(w, h, ren); ui_redraw_panel(UI_PANELTYPE_CANVAS); + ui_redraw_panel(UI_PANELTYPE_TIMELINE); } void @@ -144,6 +146,7 @@ user_canvas_import_png(const Arg *x) if (cur_canvas == NULL) puts("Error opening file"); ui_redraw_panel(UI_PANELTYPE_CANVAS); + ui_redraw_panel(UI_PANELTYPE_TIMELINE); } void @@ -165,20 +168,25 @@ void user_testing_layer_add(const Arg *x) { /* TODO: temp function */ - canvas_add_layer(cur_canvas, -1); + if (cur_canvas == NULL) return; + canvas_add_layer(cur_canvas, -1); fprintf(stdout, "%s:%u: added layer\n", __FILE__, __LINE__); - cur_canvas->cur_layer = cur_canvas->layer_arr_cnt-1; + cur_canvas->cur_layer = cur_canvas->layer_arr_cnt-1; + ui_redraw_panel(UI_PANELTYPE_CANVAS); + ui_redraw_panel(UI_PANELTYPE_TIMELINE); } void user_layer_chng(const Arg *x) { + if (cur_canvas == NULL) return; cur_canvas->cur_layer += (unsigned int)cur_canvas->layer_arr_cnt; - cur_canvas->cur_layer += x->i; + cur_canvas->cur_layer += (x->i % cur_canvas->layer_arr_cnt); cur_canvas->cur_layer %= cur_canvas->layer_arr_cnt; fprintf(stdout, "%s:%u: changed to layer %u\n", __FILE__, __LINE__, cur_canvas->cur_layer); - ui_redraw_panel(UI_PANELTYPE_CANVAS); + ui_redraw_panel(UI_PANELTYPE_CANVAS); + ui_redraw_panel(UI_PANELTYPE_TIMELINE); } void |