diff options
Diffstat (limited to 'colitur-mu.c')
| -rw-r--r-- | colitur-mu.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/colitur-mu.c b/colitur-mu.c index d76152d..1907274 100644 --- a/colitur-mu.c +++ b/colitur-mu.c @@ -95,12 +95,17 @@ static void reload(void) result looks like a layout bug rather than a height bug. */ static void frame(mu_Context *ctx, int W, int H) { - enum { RH = 24 }; + /* Column widths in CHARACTERS, not pixels. Hardcoded pixel widths are + silently wrong the moment config.h names a different font size: at + Terminus 20 a 110px "date" column truncates an ISO date. Row height + likewise follows the font. */ + int ch = mux_text_width(NULL, "0", 1); + int RH = mux_text_height(NULL) + 10; if (!mu_begin_window_ex(ctx, "colitur", mu_rect(0, 0, W, H), MU_OPT_NOTITLE | MU_OPT_NORESIZE | MU_OPT_NOCLOSE)) return; - int wy[] = { 120, 40, 40, 90, -1 }; + int wy[] = { 11*ch, 3*ch, 3*ch, 7*ch, -1 }; mu_layout_row(ctx, 5, wy, RH); mu_label(ctx, "Year"); if (mu_button(ctx, "-")) { year--; reload(); } @@ -109,7 +114,7 @@ static void frame(mu_Context *ctx, int W, int H) mu_label(ctx, y); mu_label(ctx, ""); - int w4[] = { 120, 90, 90, -1 }; + int w4[] = { 11*ch, 9*ch, 9*ch, -1 }; struct { const char *cap; const char **opts; int *idx; } sets[] = { { "Language", langs, &lang_i }, { "Book names", books, &book_i }, @@ -133,13 +138,13 @@ static void frame(mu_Context *ctx, int W, int H) mu_layout_row(ctx, 1, w1, RH); mu_label(ctx, status); - int listh = H - 7 * RH - 90; + int listh = H - 7 * RH - 4 * RH; if (listh < 100) listh = 100; mu_layout_row(ctx, 1, w1, listh); mu_begin_panel(ctx, "days"); - int wrow[] = { 110, 100, 330, -1 }; + int wrow[] = { 11*ch, 11*ch, 34*ch, -1 }; for (int i = 0; i < nrows; i++) { - mu_layout_row(ctx, 4, wrow, 22); + mu_layout_row(ctx, 4, wrow, RH - 2); if (mu_button(ctx, rows[i].f[0])) sel = i; mu_label(ctx, rows[i].f[9]); mu_label(ctx, rows[i].f[6]); |
