Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Make thumbnail selection border configurable #82

Closed
wants to merge 1 commit into from

2 participants

@baskerville

Aesthetic preferences regarding the width and paddings of the thumbnail selection border might change from one individual to the other.

Therefore we ought to make those quantities configurable.

@baskerville baskerville Make thumbnail selection border configurable
Provides additional constants in `config.def.h` to configure the width,
outer padding and inner padding of the thumbnail selection border.
8f99fd0
@muennich
Owner

No wo ought not. I think there's a limit for the amount of customization sxiv has to offer, and these things are definitely not among the needed ones.

BTW, you've only substituted the hard-coded constant values with symbolic ones. There are dozens of combinations for which the result will not match the user's expectations.

@muennich muennich closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 5, 2013
  1. @baskerville

    Make thumbnail selection border configurable

    baskerville authored
    Provides additional constants in `config.def.h` to configure the width,
    outer padding and inner padding of the thumbnail selection border.
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 7 deletions.
  1. +7 −2 config.def.h
  2. +6 −5 thumbs.c
View
9 config.def.h
@@ -49,8 +49,13 @@ enum {
#endif
#ifdef _THUMBS_CONFIG
-/* default dimension of thumbnails (width == height): */
-enum { THUMB_SIZE = 60 };
+/* default settings for thumbnails: */
+enum {
+ THUMB_SIZE = 60, /* dimension of thumbnails (width == height) */
+ THUMB_BW = 2, /* thumbnail selection border width */
+ THUMB_BOP = 2, /* thumbnail selection border outer padding */
+ THUMB_BIP = 1 /* thumbnail selection border inner padding */
+};
#endif
#ifdef _MAPPINGS_CONFIG
View
11 thumbs.c
@@ -31,7 +31,7 @@
#include "util.h"
#include "config.h"
-static const int thumb_dim = THUMB_SIZE + 10;
+static const int thumb_dim = THUMB_SIZE + 2 * (THUMB_BOP + THUMB_BW + THUMB_BIP);
static const char * const CACHE_DIR = ".sxiv/cache";
static char *cache_dir = NULL;
@@ -348,8 +348,8 @@ void tns_render(tns_t *tns)
}
r = cnt % tns->cols ? 1 : 0;
- tns->x = x = (win->w - MIN(cnt, tns->cols) * thumb_dim) / 2 + 5;
- tns->y = y = (win->h - (cnt / tns->cols + r) * thumb_dim) / 2 + 5;
+ tns->x = x = (win->w - MIN(cnt, tns->cols) * thumb_dim) / 2 + THUMB_BOP + THUMB_BW + THUMB_BIP;
+ tns->y = y = (win->h - (cnt / tns->cols + r) * thumb_dim) / 2 + THUMB_BOP + THUMB_BW + THUMB_BIP;
for (i = 0; i < cnt; i++) {
t = &tns->thumbs[tns->first + i];
@@ -397,8 +397,9 @@ void tns_highlight(tns_t *tns, int n, bool hl)
x = t->x - (THUMB_SIZE - t->w) / 2;
y = t->y - (THUMB_SIZE - t->h) / 2;
- win_draw_rect(win, win->pm, x - 3, y - 3, THUMB_SIZE + 6, THUMB_SIZE + 6,
- false, 2, col);
+ win_draw_rect(win, win->pm, x - THUMB_BW - THUMB_BIP, y - THUMB_BW - THUMB_BIP,
+ THUMB_SIZE + 2 * (THUMB_BW + THUMB_BIP), THUMB_SIZE + 2 * (THUMB_BW + THUMB_BIP),
+ false, THUMB_BW, col);
}
}
Something went wrong with that request. Please try again.