Backend changes for first day of week

Previously only Sunday and Monday were allowed for the first day of the
week, and was internally treated as a binary variable.

This patch changes the backend so all days are accepted, a future patch
will allow users to actually select other days.

Addresses GitHub feature request #321.

Signed-off-by: Morgan Seltzer <MorganSeltzer000@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Morgan Seltzer
2021-06-07 17:13:23 -04:00
committed by Lukas Fleischer
parent 61ed5f835c
commit e3fc73e0c7
6 changed files with 82 additions and 81 deletions

View File

@@ -626,6 +626,42 @@ long min2sec(unsigned minutes)
return minutes * MININSEC;
}
int modify_wday(int wday, int shift)
{
return (WEEKINDAYS + wday + shift) % WEEKINDAYS;
}
/* returns char* representing a wday, used for internal functions */
char *get_wday_default_string(int wday)
{
switch(wday) {
case MONDAY:
return "Monday";
break;
case TUESDAY:
return "Tuesday";
break;
case WEDNESDAY:
return "Wednesday";
break;
case THURSDAY:
return "Thursday";
break;
case FRIDAY:
return "Friday";
break;
case SATURDAY:
return "Saturday";
break;
case SUNDAY:
return "Sunday";
break;
default:
return "Sunday";
break;
}
}
/*
* Display a scroll bar when there are so many items that they
* can not be displayed inside the corresponding panel.