From d20f9a5d2e5b9903f7412cdec9e1bf28a94d02da Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Tue, 5 Sep 2017 09:29:17 +0200 Subject: Make the day heading position configurable The date at the top of the appointments list may be positioned either to the left, in the middle or to the right. Default is to the right. Can be configured from the general options menu. Signed-off-by: Lars Henriksen Signed-off-by: Lukas Fleischer --- src/custom.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/custom.c') diff --git a/src/custom.c b/src/custom.c index 1826156..4d02b4f 100644 --- a/src/custom.c +++ b/src/custom.c @@ -528,6 +528,7 @@ enum { FIRST_DAY_OF_WEEK, OUTPUT_DATE_FMT, INPUT_DATE_FMT, + HEADING_POS, DAY_HEADING_FMT, NB_OPTIONS }; @@ -549,9 +550,11 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d "general.firstdayofweek = ", "format.outputdate = ", "format.inputdate = ", + "appearance.headingposition = ", "format.dayheading = " }; const char *panel; + const char *position; if (hilt) custom_apply_attr(win, ATTR_HIGHEST); @@ -653,6 +656,19 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d datefmt_str[0], datefmt_str[1], datefmt_str[2], datefmt_str[3]); break; + case HEADING_POS: + if (conf.heading_pos == LEFT) + position = _("to the left"); + else if (conf.heading_pos == CENTER) + position = _("in the middle"); + else + position = _("to the right"); + custom_apply_attr(win, ATTR_HIGHEST); + mvwaddstr(win, y, XPOS + strlen(opt[HEADING_POS]), position); + custom_remove_attr(win, ATTR_HIGHEST); + mvwaddstr(win, y + 1, XPOS, + _("(position of the heading in the appointments panel)")); + break; case DAY_HEADING_FMT: custom_apply_attr(win, ATTR_HIGHEST); mvwaddstr(win, y, XPOS + strlen(opt[DAY_HEADING_FMT]), @@ -674,7 +690,7 @@ static enum listbox_row_type general_option_row_type(int i, void *cb_data) static int general_option_height(int i, void *cb_data) { - if (i == 11) + if (i == INPUT_DATE_FMT) return 4; else return 3; @@ -704,6 +720,12 @@ static void general_option_edit(int i) else conf.default_panel++; break; + case HEADING_POS: + if (conf.heading_pos == RIGHT) + conf.heading_pos = LEFT; + else + conf.heading_pos++; + break; case AUTO_SAVE: conf.auto_save = !conf.auto_save; break; -- cgit v1.2.3-54-g00ecf