aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Henriksen <LarsHenriksen@get2net.dk>2019-05-12 21:52:43 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2019-05-26 10:04:27 -0400
commit4db9677119f412fd38440e5591afbfb631a11b3d (patch)
tree9fc990ddf548db4635e78a16fdc373a609390095 /src
parentf9cf5fb0c1528c006697a23813be72f69458d53d (diff)
downloadcalcurse-4db9677119f412fd38440e5591afbfb631a11b3d.tar.gz
calcurse-4db9677119f412fd38440e5591afbfb631a11b3d.zip
Make separation of days conspicuous
... by adding a horizontal line from border to border above the day heading and turning the event separator into an empty line. The horizontal line is left out for the first day loaded. Also reduce the number of empty lines at the end of a day to at most one. A new configuration variable, header_line, turns the horizontal line on and off. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src')
-rw-r--r--src/calcurse.h6
-rw-r--r--src/config.c4
-rw-r--r--src/custom.c50
-rw-r--r--src/day.c2
-rw-r--r--src/ui-day.c26
-rw-r--r--src/vars.c6
6 files changed, 60 insertions, 34 deletions
diff --git a/src/calcurse.h b/src/calcurse.h
index f14b0bb..72a0fa6 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -283,7 +283,9 @@ struct conf {
unsigned compact_panels;
unsigned system_dialogs;
unsigned multiple_days;
- unsigned dayseparator;
+ unsigned header_line;
+ unsigned event_separator;
+ unsigned day_separator;
unsigned empty_appt_line;
const char *editor;
const char *pager;
@@ -423,7 +425,7 @@ enum day_item_type {
RECUR_APPT,
APPT,
EMPTY_SEPARATOR,
- DAY_SEPARATOR
+ END_SEPARATOR
};
/* Available item types. */
diff --git a/src/config.c b/src/config.c
index 1f61f62..ce595f9 100644
--- a/src/config.c
+++ b/src/config.c
@@ -94,7 +94,9 @@ static const struct confvar confmap[] = {
{"appearance.compactpanels", CONFIG_HANDLER_BOOL(conf.compact_panels)},
{"appearance.defaultpanel", config_parse_default_panel, config_serialize_default_panel, NULL},
{"appearance.layout", config_parse_layout, config_serialize_layout, NULL},
- {"appearance.dayseparator", CONFIG_HANDLER_UNSIGNED(conf.dayseparator)},
+ {"appearance.headerline", CONFIG_HANDLER_BOOL(conf.header_line)},
+ {"appearance.eventseparator", CONFIG_HANDLER_BOOL(conf.event_separator)},
+ {"appearance.dayseparator", CONFIG_HANDLER_BOOL(conf.day_separator)},
{"appearance.emptyline", CONFIG_HANDLER_BOOL(conf.empty_appt_line)},
{"appearance.notifybar", CONFIG_HANDLER_BOOL(nbar.show)},
{"appearance.sidebarwidth", config_parse_sidebar_width, config_serialize_sidebar_width, NULL},
diff --git a/src/custom.c b/src/custom.c
index b5890cd..52ecdcd 100644
--- a/src/custom.c
+++ b/src/custom.c
@@ -529,7 +529,9 @@ enum {
CAL_VIEW,
TODO_VIEW,
MULTIPLE_DAYS,
- DAYSEPARATOR,
+ HEADER_LINE,
+ EVENT_SEPARATOR,
+ DAY_SEPARATOR,
EMPTY_APPT_LINE,
AUTO_SAVE,
AUTO_GC,
@@ -556,6 +558,8 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d
"appearance.calendarview = ",
"appearance.todoview = ",
"general.multipledays = ",
+ "appearance.headerline = ",
+ "appearance.eventseparator = ",
"appearance.dayseparator = ",
"appearance.emptyline = ",
"general.autosave = ",
@@ -614,14 +618,23 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d
custom_remove_attr(win, ATTR_HIGHEST);
mvwaddstr(win, y + 1, XPOS, _("(preferred todo display)"));
break;
- case DAYSEPARATOR:
- custom_apply_attr(win, ATTR_HIGHEST);
- mvwprintw(win, y, XPOS + strlen(opt[DAYSEPARATOR]), "%d",
- conf.dayseparator);
- custom_remove_attr(win, ATTR_HIGHEST);
- mvwaddstr(win, y + 1, XPOS,
- _("(lines between days in the appointments "
- "panel)"));
+ case HEADER_LINE:
+ print_bool_option_incolor(win, conf.header_line, y,
+ XPOS + strlen(opt[HEADER_LINE]));
+ mvwaddstr(win, y + XPOS, 1,
+ _("(horizontal line above the day heading)"));
+ break;
+ case EVENT_SEPARATOR:
+ print_bool_option_incolor(win, conf.event_separator, y,
+ XPOS + strlen(opt[EVENT_SEPARATOR]));
+ mvwaddstr(win, y + XPOS, 1,
+ _("(empty line between events and appointments)"));
+ break;
+ case DAY_SEPARATOR:
+ print_bool_option_incolor(win, conf.day_separator, y,
+ XPOS + strlen(opt[DAY_SEPARATOR]));
+ mvwaddstr(win, y + XPOS, 1,
+ _("(each day ends with an empty line)"));
break;
case EMPTY_APPT_LINE:
print_bool_option_incolor(win, conf.empty_appt_line, y,
@@ -793,20 +806,23 @@ static void general_option_edit(int i)
ui_todo_set_view(conf.todo_view);
ui_todo_load_items();
break;
- case EMPTY_APPT_LINE:
- conf.empty_appt_line = !conf.empty_appt_line;
- break;
case MULTIPLE_DAYS:
if (conf.multiple_days == 21)
conf.multiple_days = 1;
else
conf.multiple_days++;
break;
- case DAYSEPARATOR:
- if (conf.dayseparator == 2)
- conf.dayseparator = 0;
- else
- conf.dayseparator++;
+ case HEADER_LINE:
+ conf.header_line = !conf.header_line;
+ break;
+ case EVENT_SEPARATOR:
+ conf.event_separator = !conf.event_separator;
+ break;
+ case DAY_SEPARATOR:
+ conf.day_separator = !conf.day_separator;
+ break;
+ case EMPTY_APPT_LINE:
+ conf.empty_appt_line = !conf.empty_appt_line;
break;
case HEADING_POS:
if (conf.heading_pos == RIGHT)
diff --git a/src/day.c b/src/day.c
index b454c85..b556481 100644
--- a/src/day.c
+++ b/src/day.c
@@ -464,7 +464,7 @@ day_store_items(time_t date, int include_captions, int n)
/* Empty line at end of day if appointments have one. */
if (apts == 0 && conf.empty_appt_line)
day_add_item(EMPTY_SEPARATOR, 0, ENDOFDAY(date), p);
- day_add_item(DAY_SEPARATOR, 0, ENDOFDAY(date), p);
+ day_add_item(END_SEPARATOR, 0, ENDOFDAY(date), p);
}
}
diff --git a/src/ui-day.c b/src/ui-day.c
index b959c07..82db4e5 100644
--- a/src/ui-day.c
+++ b/src/ui-day.c
@@ -103,7 +103,7 @@ static void daybegin(int dir)
sel--;
break;
case 1:
- while (day_get_item(sel)->type != DAY_SEPARATOR)
+ while (day_get_item(sel)->type != END_SEPARATOR)
sel++;
if (sel == lb_apt.item_count - 1) {
while (day_get_item(sel)->type != DAY_HEADING)
@@ -1087,7 +1087,7 @@ void ui_day_sel_dayend(void)
{
int sel = listbox_get_sel(&lb_apt);
- while (day_get_item(sel)->type != DAY_SEPARATOR)
+ while (day_get_item(sel)->type != END_SEPARATOR)
sel++;
while (lb_apt.type[sel] != LISTBOX_ROW_TEXT)
sel--;
@@ -1121,18 +1121,19 @@ void ui_day_draw(int n, WINDOW *win, int y, int hilt, void *cb_data)
day_display_item_date(item, win, !hilt, date, y, 1);
day_display_item(item, win, !hilt, width - 1, y + 1, 1);
} else if (item->type == DAY_HEADING) {
+ if (conf.header_line && n) {
+ wmove(win, y, 0);
+ whline(win, ACS_HLINE, width);
+ }
char *buf = fmt_day_heading(date);
utf8_chop(buf, width);
custom_apply_attr(win, ATTR_HIGHEST);
- mvwprintw(win, y,
+ mvwprintw(win, y + (conf.header_line && n),
conf.heading_pos == RIGHT ? width - utf8_strwidth(buf) - 1 :
conf.heading_pos == LEFT ? 1 :
(width - utf8_strwidth(buf)) / 2, "%s", buf);
custom_remove_attr(win, ATTR_HIGHEST);
mem_free(buf);
- } else if (item->type == EVNT_SEPARATOR) {
- wmove(win, y, 1);
- whline(win, 0, width - 2);
}
}
@@ -1143,7 +1144,7 @@ enum listbox_row_type ui_day_row_type(int n, void *cb_data)
if (item->type == DAY_HEADING ||
item->type == EVNT_SEPARATOR ||
item->type == EMPTY_SEPARATOR ||
- item->type == DAY_SEPARATOR)
+ item->type == END_SEPARATOR)
return LISTBOX_ROW_CAPTION;
else
return LISTBOX_ROW_TEXT;
@@ -1153,11 +1154,14 @@ int ui_day_height(int n, void *cb_data)
{
struct day_item *item = day_get_item(n);
- if (item->type == APPT ||
- item->type == RECUR_APPT)
+ if (item->type == DAY_HEADING)
+ return 1 + (conf.header_line && n);
+ else if (item->type == APPT || item->type == RECUR_APPT)
return conf.empty_appt_line ? 3 : 2;
- else if (item->type == DAY_SEPARATOR)
- return conf.dayseparator;
+ else if (item->type == EVNT_SEPARATOR)
+ return conf.event_separator;
+ else if (item->type == END_SEPARATOR)
+ return conf.day_separator;
else
return 1;
}
diff --git a/src/vars.c b/src/vars.c
index d3080eb..b81ab5f 100644
--- a/src/vars.c
+++ b/src/vars.c
@@ -122,9 +122,11 @@ void vars_init(void)
/* Variables for user configuration */
conf.cal_view = CAL_MONTH_VIEW;
conf.todo_view = TODO_HIDE_COMPLETED_VIEW;
- conf.empty_appt_line = 1;
conf.multiple_days = 7;
- conf.dayseparator = 2;
+ conf.header_line = 1;
+ conf.event_separator = 1;
+ conf.day_separator = 1;
+ conf.empty_appt_line = 1;
conf.confirm_quit = 1;
conf.confirm_delete = 1;
conf.auto_save = 1;