aboutsummaryrefslogtreecommitdiff
path: root/src/ui.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui.c')
-rw-r--r--src/ui.c59
1 files changed, 43 insertions, 16 deletions
diff --git a/src/ui.c b/src/ui.c
index 130c464..dd9c9fe 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -3,7 +3,9 @@
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
+#define SBDF_USESDL
#include "ui.h"
+#include "sbdf.h"
#include "cdraw.h"
#include "types.h"
#include "action.h"
@@ -295,12 +297,17 @@ ui_mousel_down(int x, int y)
x = x - fpan->geom.x - 8;
y = y - fpan->geom.y - 8;
y /= 22;
- if (x > 22) break;
if (y < 0 || y >= cur_canvas->layer_arr_cnt) break;
- cur_canvas->layers[cur_canvas->layer_arr_cnt-1-y]->visible ^= 1;
- canvas_refresh(cur_canvas);
- ui_redraw_panel(UI_PANELTYPE_TIMELINE);
- ui_redraw_panel(UI_PANELTYPE_CANVAS);
+ if (x <= 22) {
+ cur_canvas->layers[cur_canvas->layer_arr_cnt-1-y]->visible ^= 1;
+ canvas_refresh(cur_canvas);
+ ui_redraw_panel(UI_PANELTYPE_TIMELINE);
+ ui_redraw_panel(UI_PANELTYPE_CANVAS);
+ } else if (x <= 162) {
+ y = cur_canvas->layer_arr_cnt-y-1;
+ y -= (int)(cur_canvas->cur_layer);
+ user_layer_chng(&y);
+ }
break;
}
}
@@ -674,25 +681,45 @@ ui_panel_timeline_redraw(UIPanelTimeline *p)
SDL_RenderClear(ren);
if (cur_canvas != NULL) {
dest.x = 2;
- dest.w = dest.h = 20;
+ dest.h = 20;
+ dest.w = 162;
dest.y = (cur_canvas->layer_arr_cnt - 1 - cur_canvas->cur_layer) * 22 + 2;
SDL_SetRenderDrawColor(ren, INTTOCOLA(0x657392ff));
SDL_RenderFillRect(ren, &dest);
- SDL_SetRenderDrawColor(ren, 19, 19, 19, 255);
for (i = 0; i < cur_canvas->layer_arr_cnt; i++) {
- dest.y = (cur_canvas->layer_arr_cnt - 1 - i) * 22 + 2;
+ dest.y = 6 + (cur_canvas->layer_arr_cnt - 1 - i) * 22;
+ dest.x = 6;
+ dest.h = 24;
+ dest.w = 166;
+ SDL_RenderSetViewport(ren, &dest);
+ SDL_SetRenderDrawColor(ren, INTTOCOLA(0x131313ff));
+ SDL_RenderDrawLine(ren, 2, 0, 21, 0);
+ SDL_RenderDrawLine(ren, 2, 1, 21, 1);
+ SDL_RenderDrawLine(ren, 0, 2, 0, 21);
+ SDL_RenderDrawLine(ren, 1, 2, 1, 21);
+ SDL_RenderDrawLine(ren, 2, 22, 21, 22);
+ SDL_RenderDrawLine(ren, 2, 23, 21, 23);
+ SDL_RenderDrawLine(ren, 22, 2, 22, 21);
+ SDL_RenderDrawLine(ren, 23, 2, 23, 21);
+ SDL_RenderDrawLine(ren, 24, 0, 163, 0);
+ SDL_RenderDrawLine(ren, 24, 1, 163, 1);
+ SDL_RenderDrawLine(ren, 24, 22, 163, 22);
+ SDL_RenderDrawLine(ren, 24, 23, 163, 23);
+ SDL_RenderDrawLine(ren, 164, 2, 164, 21);
+ SDL_RenderDrawLine(ren, 165, 2, 165, 21);
+ SDL_SetRenderDrawColor(ren, INTTOCOLA(0x000000ff));
+ dest.y = dest.x = 2;
+ dest.w = dest.h = 20;
if (cur_canvas->layers[i]->visible)
SDL_RenderCopy(ren, main_ui->theme, &ui_timeline_rect[0], &dest);
else
SDL_RenderCopy(ren, main_ui->theme, &ui_timeline_rect[1], &dest);
- SDL_RenderDrawLine(ren, 2, i*22, 21, i*22);
- SDL_RenderDrawLine(ren, 2, i*22+1, 21, i*22+1);
- SDL_RenderDrawLine(ren, 0, i*22+2, 0, i*22+21);
- SDL_RenderDrawLine(ren, 1, i*22+2, 1, i*22+21);
- SDL_RenderDrawLine(ren, 2, i*22+22, 21, i*22+22);
- SDL_RenderDrawLine(ren, 2, i*22+23, 21, i*22+23);
- SDL_RenderDrawLine(ren, 22, i*22+2, 22, i*22+21);
- SDL_RenderDrawLine(ren, 23, i*22+2, 23, i*22+21);
+ dest.y = 6 + (cur_canvas->layer_arr_cnt - 1 - i) * 22;
+ dest.x = 30;
+ dest.w = 140;
+ dest.h = 24;
+ SDL_RenderSetViewport(ren, &dest);
+ SBDF_SDLPrint(ren, font, cur_canvas->layers[i]->name, 2, 5);
}
}
SDL_RenderSetViewport(ren, NULL);