Mark selected day in the appointments panel in multiple days mode

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lars Henriksen 2019-05-28 20:55:06 +02:00 committed by Lukas Fleischer
parent 7e0274bc08
commit 0edc2e8637
2 changed files with 5 additions and 4 deletions

View File

@ -52,7 +52,7 @@ static struct attribute attr;
* Define window attributes (for both color and non-color terminals): * Define window attributes (for both color and non-color terminals):
* ATTR_HIGHEST are for window titles * ATTR_HIGHEST are for window titles
* ATTR_HIGH are for month and days names * ATTR_HIGH are for month and days names
* ATTR_MIDDLE are for the selected day inside calendar panel * ATTR_MIDDLE are for the selected day inside calendar and appointments panel
* ATTR_LOW are for days inside calendar panel which contains an event * ATTR_LOW are for days inside calendar panel which contains an event
* ATTR_LOWEST are for current day inside calendar panel * ATTR_LOWEST are for current day inside calendar panel
*/ */

View File

@ -1112,7 +1112,7 @@ void ui_day_draw(int n, WINDOW *win, int y, int hilt, void *cb_data)
struct day_item *item = day_get_item(n); struct day_item *item = day_get_item(n);
/* The item order always indicates the date. */ /* The item order always indicates the date. */
time_t date = update_time_in_date(item->order, 0, 0); time_t date = update_time_in_date(item->order, 0, 0);
int width = lb_apt.sw.w - 2; int width = lb_apt.sw.w - 2, is_slctd;
hilt = hilt && (wins_slctd() == APP); hilt = hilt && (wins_slctd() == APP);
if (item->type == EVNT || item->type == RECUR_EVNT) { if (item->type == EVNT || item->type == RECUR_EVNT) {
@ -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_date(item, win, !hilt, date, y, 1);
day_display_item(item, win, !hilt, width - 1, y + 1, 1); day_display_item(item, win, !hilt, width - 1, y + 1, 1);
} else if (item->type == DAY_HEADING) { } else if (item->type == DAY_HEADING) {
is_slctd = conf.multiple_days && (date == get_slctd_day());
if (conf.header_line && n) { if (conf.header_line && n) {
wmove(win, y, 0); wmove(win, y, 0);
whline(win, ACS_HLINE, width); whline(win, ACS_HLINE, width);
} }
char *buf = fmt_day_heading(date); char *buf = fmt_day_heading(date);
utf8_chop(buf, width); utf8_chop(buf, width);
custom_apply_attr(win, ATTR_HIGHEST); custom_apply_attr(win, is_slctd ? ATTR_MIDDLE : ATTR_HIGHEST);
mvwprintw(win, y + (conf.header_line && n), mvwprintw(win, y + (conf.header_line && n),
conf.heading_pos == RIGHT ? width - utf8_strwidth(buf) - 1 : conf.heading_pos == RIGHT ? width - utf8_strwidth(buf) - 1 :
conf.heading_pos == LEFT ? 1 : conf.heading_pos == LEFT ? 1 :
(width - utf8_strwidth(buf)) / 2, "%s", buf); (width - utf8_strwidth(buf)) / 2, "%s", buf);
custom_remove_attr(win, ATTR_HIGHEST); custom_remove_attr(win, is_slctd ? ATTR_MIDDLE : ATTR_HIGHEST);
mem_free(buf); mem_free(buf);
} }
} }