Krolyxon
Commit f0f6644

Branches

Refs →

nsxivf0f6644

Replaced -T flag with -tt; default thumbnail size

Author
Bert
Date
2011-02-20 00:28 +0100
Parent
a309012
Commit
f0f6644fae8673378936a15781ce96e55f66bec4

+12 −20

4 files changed

  1. M config.h +2 −1
  2. M main.c +0 −6
  3. M options.c +4 −6
  4. M thumbs.c +6 −7
M config.h View
@@ -22,4 +22,5 @@ static const float zoom_levels[] = {
2222 100.0, 150.0, 200.0, 400.0, 800.0
2323 };
2424
25−#define THUMB_SIZE 50
25+/* default dimension of thumbnails (width == height): */
26+#define THUMB_SIZE 60
M main.c View
@@ -411,12 +411,6 @@ void on_keypress(XKeyEvent *kev) {
411411 case XK_Right:
412412 changed = tns_move_selection(&tns, &win, TNS_RIGHT);
413413 break;
414−
415− /* scroll */
416− case XK_bracketleft:
417− break;
418− case XK_bracketright:
419− break;
420414 }
421415 }
422416
M options.c View
@@ -31,7 +31,7 @@ options_t _options;
3131 const options_t *options = (const options_t*) &_options;
3232
3333 void print_usage() {
34− printf("usage: sxiv [-dFfhpqrsTtvZ] [-g GEOMETRY] [-z ZOOM] FILES...\n");
34+ printf("usage: sxiv [-dFfhpqrstvZ] [-g GEOMETRY] [-z ZOOM] FILES...\n");
3535 }
3636
3737 void print_version() {
@@ -54,7 +54,7 @@ void parse_options(int argc, char **argv) {
5454 _options.quiet = 0;
5555 _options.recursive = 0;
5656
57− while ((opt = getopt(argc, argv, "dFfg:hpqrsTtvZz:")) != -1) {
57+ while ((opt = getopt(argc, argv, "dFfg:hpqrstvZz:")) != -1) {
5858 switch (opt) {
5959 case '?':
6060 print_usage();
@@ -86,11 +86,9 @@ void parse_options(int argc, char **argv) {
8686 case 's':
8787 _options.scalemode = SCALE_FIT;
8888 break;
89− case 'T':
90− _options.thumbnails = 2;
91− break;
9289 case 't':
93− _options.thumbnails = MAX(_options.thumbnails, 1);
90+ if (_options.thumbnails < 2)
91+ ++_options.thumbnails;
9492 break;
9593 case 'v':
9694 print_version();
M thumbs.c View
@@ -218,18 +218,17 @@ int tns_scroll(tns_t *tns, tnsdir_t dir) {
218218
219219 old = tns->first;
220220
221− if (dir == TNS_DOWN && tns->first + tns->cols * tns->rows < tns->cnt)
221+ if (dir == TNS_DOWN && tns->first + tns->cols * tns->rows < tns->cnt) {
222222 tns->first += tns->cols;
223− else if (dir == TNS_UP && tns->first >= tns->cols)
223+ tns_check_view(tns, True);
224+ tns->dirty = 1;
225+ } else if (dir == TNS_UP && tns->first >= tns->cols) {
224226 tns->first -= tns->cols;
225−
226− if (tns->first != old) {
227227 tns_check_view(tns, True);
228228 tns->dirty = 1;
229− return 1;
230− } else {
231− return 0;
232229 }
230+
231+ return tns->first != old;
233232 }
234233
235234 int tns_translate(tns_t *tns, int x, int y) {