Highlight days with non-recurrent items
Use a different color for days with non-recurrent items in the calendar panel. This makes it possible to easily spot days that actually contain appointments. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
parent
b6f95b380f
commit
203ac0aa61
27
src/day.c
27
src/day.c
@ -507,13 +507,26 @@ void day_popup_item(struct day_item *day)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Need to know if there is an item for the current selected day inside
|
* Check whether there is an item on a given day.
|
||||||
* calendar. This is used to put the correct colors inside calendar panel.
|
*
|
||||||
|
* Returns 2 if the selected day contains a regular event or appointment.
|
||||||
|
* Returns 1 if the selected day does not contain a regular event or
|
||||||
|
* appointment but an occurrence of a recurrent item. Returns 0 otherwise.
|
||||||
*/
|
*/
|
||||||
int day_check_if_item(struct date day)
|
int day_check_if_item(struct date day)
|
||||||
{
|
{
|
||||||
const time_t t = date2sec(day, 0, 0);
|
const time_t t = date2sec(day, 0, 0);
|
||||||
|
|
||||||
|
if (LLIST_FIND_FIRST(&eventlist, (time_t *)&t, event_inday))
|
||||||
|
return 2;
|
||||||
|
|
||||||
|
LLIST_TS_LOCK(&alist_p);
|
||||||
|
if (LLIST_TS_FIND_FIRST(&alist_p, (time_t *)&t, apoint_inday)) {
|
||||||
|
LLIST_TS_UNLOCK(&alist_p);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
LLIST_TS_UNLOCK(&alist_p);
|
||||||
|
|
||||||
if (LLIST_FIND_FIRST(&recur_elist, (time_t *)&t, recur_event_inday))
|
if (LLIST_FIND_FIRST(&recur_elist, (time_t *)&t, recur_event_inday))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -525,16 +538,6 @@ int day_check_if_item(struct date day)
|
|||||||
}
|
}
|
||||||
LLIST_TS_UNLOCK(&recur_alist_p);
|
LLIST_TS_UNLOCK(&recur_alist_p);
|
||||||
|
|
||||||
if (LLIST_FIND_FIRST(&eventlist, (time_t *)&t, event_inday))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
LLIST_TS_LOCK(&alist_p);
|
|
||||||
if (LLIST_TS_FIND_FIRST(&alist_p, (time_t *)&t, apoint_inday)) {
|
|
||||||
LLIST_TS_UNLOCK(&alist_p);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
LLIST_TS_UNLOCK(&alist_p);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,12 +471,18 @@ draw_monthly_view(struct scrollwin *sw, struct date *current_day,
|
|||||||
ofs_x + day_1_sav + 4 * c_day + 1, "%2d",
|
ofs_x + day_1_sav + 4 * c_day + 1, "%2d",
|
||||||
c_day);
|
c_day);
|
||||||
custom_remove_attr(sw->inner, ATTR_HIGHEST);
|
custom_remove_attr(sw->inner, ATTR_HIGHEST);
|
||||||
} else if (item_this_day) {
|
} else if (item_this_day == 1) {
|
||||||
custom_apply_attr(sw->inner, ATTR_LOW);
|
custom_apply_attr(sw->inner, ATTR_LOW);
|
||||||
mvwprintw(sw->inner, ofs_y + 1,
|
mvwprintw(sw->inner, ofs_y + 1,
|
||||||
ofs_x + day_1_sav + 4 * c_day + 1, "%2d",
|
ofs_x + day_1_sav + 4 * c_day + 1, "%2d",
|
||||||
c_day);
|
c_day);
|
||||||
custom_remove_attr(sw->inner, ATTR_LOW);
|
custom_remove_attr(sw->inner, ATTR_LOW);
|
||||||
|
} else if (item_this_day == 2) {
|
||||||
|
custom_apply_attr(sw->inner, ATTR_TRUE);
|
||||||
|
mvwprintw(sw->inner, ofs_y + 1,
|
||||||
|
ofs_x + day_1_sav + 4 * c_day + 1, "%2d",
|
||||||
|
c_day);
|
||||||
|
custom_remove_attr(sw->inner, ATTR_TRUE);
|
||||||
} else {
|
} else {
|
||||||
/* otherwise, print normal days in black */
|
/* otherwise, print normal days in black */
|
||||||
mvwprintw(sw->inner, ofs_y + 1,
|
mvwprintw(sw->inner, ofs_y + 1,
|
||||||
@ -531,8 +537,10 @@ draw_weekly_view(struct scrollwin *sw, struct date *current_day,
|
|||||||
attr = ATTR_LOWEST; /* today, but not selected */
|
attr = ATTR_LOWEST; /* today, but not selected */
|
||||||
else if (t.tm_mday == slctd_day.dd)
|
else if (t.tm_mday == slctd_day.dd)
|
||||||
attr = ATTR_HIGHEST; /* selected day */
|
attr = ATTR_HIGHEST; /* selected day */
|
||||||
else if (item_this_day)
|
else if (item_this_day == 1)
|
||||||
attr = ATTR_LOW;
|
attr = ATTR_LOW;
|
||||||
|
else if (item_this_day == 2)
|
||||||
|
attr = ATTR_TRUE;
|
||||||
else
|
else
|
||||||
attr = 0;
|
attr = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user