|
|
@@ -115,7 +115,6 @@ void tns_render(tns_t *tns, win_t *win) { |
|
|
|
} |
|
|
|
|
|
|
|
tns_highlight(tns, win, -1); |
|
|
|
win_draw(win); |
|
|
|
} |
|
|
|
|
|
|
|
void tns_highlight(tns_t *tns, win_t *win, int old) { |
|
|
@@ -132,4 +131,42 @@ void tns_highlight(tns_t *tns, win_t *win, int old) { |
|
|
|
t = &tns->thumbs[tns->sel]; |
|
|
|
win_draw_rect(win, t->x - 2, t->y - 2, t->w + 4, t->h + 4, True); |
|
|
|
} |
|
|
|
|
|
|
|
win_draw(win); |
|
|
|
} |
|
|
|
|
|
|
|
void tns_move_selection(tns_t *tns, win_t *win, movedir_t dir) { |
|
|
|
int sel; |
|
|
|
|
|
|
|
if (!tns || !win) |
|
|
|
return; |
|
|
|
|
|
|
|
sel = tns->sel; |
|
|
|
|
|
|
|
switch (dir) { |
|
|
|
case MOVE_LEFT: |
|
|
|
if (sel % tns->cols > 0) { |
|
|
|
--tns->sel; |
|
|
|
tns_highlight(tns, win, sel); |
|
|
|
} |
|
|
|
break; |
|
|
|
case MOVE_RIGHT: |
|
|
|
if (sel % tns->cols < tns->cols - 1 && sel < tns->cnt - 1) { |
|
|
|
++tns->sel; |
|
|
|
tns_highlight(tns, win, sel); |
|
|
|
} |
|
|
|
break; |
|
|
|
case MOVE_UP: |
|
|
|
if (sel / tns->cols > 0) { |
|
|
|
tns->sel -= tns->cols; |
|
|
|
tns_highlight(tns, win, sel); |
|
|
|
} |
|
|
|
break; |
|
|
|
case MOVE_DOWN: |
|
|
|
if (sel / tns->cols < tns->rows - 1 && sel + tns->cols < tns->cnt) { |
|
|
|
tns->sel += tns->cols; |
|
|
|
tns_highlight(tns, win, sel); |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
} |