diff options
Diffstat (limited to 'src/ui.c')
-rw-r--r-- | src/ui.c | 47 |
1 files changed, 41 insertions, 6 deletions
@@ -303,15 +303,19 @@ ui_mousel_down(int x, int y) y -= 1; if (y < 0 || y >= cur_canvas->layer_arr_cnt) break; if (x <= 22) { - cur_canvas->layers[cur_canvas->layer_arr_cnt-1-y]->visible ^= 1; + 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) { + } else if (x <= 162 + cur_canvas->frame_arr_cnt*22) { y = cur_canvas->layer_arr_cnt-y-1; canvas_change_layer(cur_canvas, y); ui_redraw_panel(UI_PANELTYPE_TIMELINE); } + x = (x - 162) / 22; + if (x < 0 || x >= cur_canvas->frame_arr_cnt) break; + canvas_change_frame(cur_canvas, x); + ui_redraw_panel(UI_PANELTYPE_TIMELINE); break; } } @@ -713,10 +717,21 @@ ui_panel_timeline_redraw(UIPanelTimeline *p) SDL_RenderClear(ren); if (cur_canvas != NULL) { /* Draw selected */ + SDL_SetRenderDrawColor(ren, INTTOCOLA(0x92a1b9ff)); dest.x = 2; + dest.h = 24; + dest.y = (cur_canvas->layer_arr_cnt - cur_canvas->cur_layer) * 22; + dest.w = 162 + 22 * cur_canvas->frame_arr_cnt; + SDL_RenderFillRect(ren, &dest); + dest.x = 164 + cur_canvas->cur_frame * 22; + dest.y = 2; + dest.h = (cur_canvas->layer_arr_cnt + 1) * 22 - 2; + dest.w = 24; + SDL_RenderFillRect(ren, &dest); + dest.x = 166 + cur_canvas->cur_frame * 22; + dest.y = (cur_canvas->layer_arr_cnt - cur_canvas->cur_layer) * 22 + 2; dest.h = 20; - dest.w = 162; - dest.y = (cur_canvas->layer_arr_cnt - 1 - cur_canvas->cur_layer) * 22 + 24; + dest.w = 20; SDL_SetRenderDrawColor(ren, INTTOCOLA(0x657392ff)); SDL_RenderFillRect(ren, &dest); @@ -745,7 +760,7 @@ ui_panel_timeline_redraw(UIPanelTimeline *p) SDL_SetRenderDrawColor(ren, INTTOCOLA(0x000000ff)); dest.y = dest.x = 2; dest.w = dest.h = 20; - if (cur_canvas->layers[i]->visible) + 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); @@ -754,7 +769,7 @@ ui_panel_timeline_redraw(UIPanelTimeline *p) dest.w = 140; dest.h = 24; SDL_RenderSetViewport(ren, &dest); - SBDF_SDLPrint(ren, font, cur_canvas->layers[i]->name, 2, 17); + SBDF_SDLPrint(ren, font, cur_canvas->layers[i].name, 2, 17); } /* Draw Frame row */ @@ -796,6 +811,26 @@ ui_panel_timeline_redraw(UIPanelTimeline *p) SBDF_SDLPrint(ren, font, text, j, 17); } + + /* Draw cell table */ + SDL_SetRenderDrawColor(ren, INTTOCOLA(0x131313ff)); + for (i = 0; i < cur_canvas->layer_arr_cnt; i++) { + for (j = 0; j < cur_canvas->frame_arr_cnt; j++) { + dest.y = 28 + i * 22; + dest.x = 170 + j * 22; + dest.h = 24; + dest.w = 24; + SDL_RenderSetViewport(ren, &dest); + 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_RenderSetViewport(ren, NULL); ui_panel_draw_frame(&p->head); |