summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/calcurse.c24
-rw-r--r--src/calcurse.h10
-rw-r--r--src/calendar.c12
-rw-r--r--src/help.c16
-rw-r--r--src/keys.c17
-rw-r--r--src/wins.c13
6 files changed, 88 insertions, 4 deletions
diff --git a/src/calcurse.c b/src/calcurse.c
index e80e9dc..09baab5 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -460,6 +460,30 @@ int main(int argc, char **argv)
}
break;
+ case KEY_GENERIC_PREV_MONTH:
+ calendar_move(MONTH_PREV, count);
+ inday = do_storage(1);
+ wins_update(FLAG_CAL | FLAG_APP);
+ break;
+
+ case KEY_GENERIC_NEXT_MONTH:
+ calendar_move(MONTH_NEXT, count);
+ inday = do_storage(1);
+ wins_update(FLAG_CAL | FLAG_APP);
+ break;
+
+ case KEY_GENERIC_PREV_YEAR:
+ calendar_move(YEAR_PREV, count);
+ inday = do_storage(1);
+ wins_update(FLAG_CAL | FLAG_APP);
+ break;
+
+ case KEY_GENERIC_NEXT_YEAR:
+ calendar_move(YEAR_NEXT, count);
+ inday = do_storage(1);
+ wins_update(FLAG_CAL | FLAG_APP);
+ break;
+
case KEY_START_OF_WEEK:
if (wins_slctd() == CAL) {
calendar_move(WEEK_START, count);
diff --git a/src/calcurse.h b/src/calcurse.h
index ec6335f..9f01f48 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -403,6 +403,10 @@ enum key {
KEY_GENERIC_NEXT_DAY,
KEY_GENERIC_PREV_WEEK,
KEY_GENERIC_NEXT_WEEK,
+ KEY_GENERIC_PREV_MONTH,
+ KEY_GENERIC_NEXT_MONTH,
+ KEY_GENERIC_PREV_YEAR,
+ KEY_GENERIC_NEXT_YEAR,
KEY_GENERIC_SCROLL_DOWN,
KEY_GENERIC_SCROLL_UP,
KEY_GENERIC_GOTO_TODAY,
@@ -539,7 +543,11 @@ enum move {
WEEK_PREV,
WEEK_NEXT,
WEEK_START,
- WEEK_END
+ WEEK_END,
+ MONTH_PREV,
+ MONTH_NEXT,
+ YEAR_PREV,
+ YEAR_NEXT
};
/* Available color pairs. */
diff --git a/src/calendar.c b/src/calendar.c
index dbac9c7..a157caa 100644
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -626,6 +626,18 @@ void calendar_move(enum move move, int count)
case WEEK_NEXT:
ret = date_change(&t, 0, count * WEEKINDAYS);
break;
+ case MONTH_PREV:
+ ret = date_change(&t, -count, 0);
+ break;
+ case MONTH_NEXT:
+ ret = date_change(&t, count, 0);
+ break;
+ case YEAR_PREV:
+ ret = date_change(&t, -count * YEARINMONTHS, 0);
+ break;
+ case YEAR_NEXT:
+ ret = date_change(&t, count * YEARINMONTHS, 0);
+ break;
case WEEK_START:
/* Normalize struct tm to get week day number. */
mktime(&t);
diff --git a/src/help.c b/src/help.c
index 2cae3cc..c61a4e0 100644
--- a/src/help.c
+++ b/src/help.c
@@ -120,6 +120,10 @@ help_write_pad(struct window *win, char *title, char *text, enum key action)
case KEY_GENERIC_NEXT_DAY:
case KEY_GENERIC_PREV_WEEK:
case KEY_GENERIC_NEXT_WEEK:
+ case KEY_GENERIC_PREV_MONTH:
+ case KEY_GENERIC_NEXT_MONTH:
+ case KEY_GENERIC_PREV_YEAR:
+ case KEY_GENERIC_NEXT_YEAR:
case KEY_GENERIC_GOTO_TODAY:
case KEY_GENERIC_CREDITS:
case KEY_GENERIC_CUT:
@@ -216,6 +220,10 @@ static int wanted_page(int ch)
case KEY_GENERIC_NEXT_DAY:
case KEY_GENERIC_PREV_WEEK:
case KEY_GENERIC_NEXT_WEEK:
+ case KEY_GENERIC_PREV_MONTH:
+ case KEY_GENERIC_NEXT_MONTH:
+ case KEY_GENERIC_PREV_YEAR:
+ case KEY_GENERIC_NEXT_YEAR:
case KEY_GENERIC_GOTO_TODAY:
page = HELP_GENERAL;
break;
@@ -694,6 +702,10 @@ void help_screen(void)
" '%s' : +1 Day -> move to next day\n"
" '%s' : -1 Week -> move to previous week\n"
" '%s' : +1 Week -> move to next week\n"
+ " '%s' : -1 Month -> move to previous month\n"
+ " '%s' : +1 Month -> move to next month\n"
+ " '%s' : -1 Year -> move to previous year\n"
+ " '%s' : +1 Year -> move to next year\n"
" '%s' : Goto today -> move to current day\n"
"\nThe '%s' and '%s' keys are used to scroll text upward or downward\n"
"when inside specific screens such the help screens for example.\n"
@@ -706,6 +718,10 @@ void help_screen(void)
keys_action_firstkey(KEY_GENERIC_NEXT_DAY),
keys_action_firstkey(KEY_GENERIC_PREV_WEEK),
keys_action_firstkey(KEY_GENERIC_NEXT_WEEK),
+ keys_action_firstkey(KEY_GENERIC_PREV_MONTH),
+ keys_action_firstkey(KEY_GENERIC_NEXT_MONTH),
+ keys_action_firstkey(KEY_GENERIC_PREV_YEAR),
+ keys_action_firstkey(KEY_GENERIC_NEXT_YEAR),
keys_action_firstkey(KEY_GENERIC_GOTO_TODAY),
keys_action_firstkey(KEY_GENERIC_SCROLL_UP),
keys_action_firstkey(KEY_GENERIC_SCROLL_DOWN));
diff --git a/src/keys.c b/src/keys.c
index 6e6b194..f670f9a 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -71,6 +71,10 @@ static struct keydef_s keydef[NBKEYS] = {
{"generic-next-day", "C-l"},
{"generic-prev-week", "C-k"},
{"generic-next-week", "C-j"},
+ {"generic-prev-month", "M"},
+ {"generic-next-month", "m"},
+ {"generic-prev-year", "Y"},
+ {"generic-next-year", "y"},
{"generic-scroll-down", "C-n"},
{"generic-scroll-up", "C-p"},
{"generic-goto-today", "C-g"},
@@ -466,6 +470,19 @@ void keys_popup_info(enum key key)
info[KEY_GENERIC_NEXT_WEEK] =
_
("Move to next week in calendar, whichever panel is currently selected.");
+ info[KEY_GENERIC_PREV_MONTH] =
+ _("Move to previous month in calendar, whichever panel is currently "
+ "selected");
+ info[KEY_GENERIC_NEXT_MONTH] =
+ _
+ ("Move to next month in calendar, whichever panel is currently "
+ "selected.");
+ info[KEY_GENERIC_PREV_YEAR] =
+ _("Move to previous year in calendar, whichever panel is currently "
+ "selected");
+ info[KEY_GENERIC_NEXT_YEAR] =
+ _
+ ("Move to next year in calendar, whichever panel is currently selected.");
info[KEY_GENERIC_SCROLL_DOWN] =
_
("Scroll window down (e.g. when displaying text inside a popup window).");
diff --git a/src/wins.c b/src/wins.c
index 7d2f8a2..d518377 100644
--- a/src/wins.c
+++ b/src/wins.c
@@ -601,6 +601,10 @@ void wins_status_bar(void)
struct binding gnday = { _("+1 Day"), KEY_GENERIC_NEXT_DAY };
struct binding gpweek = { _("-1 Week"), KEY_GENERIC_PREV_WEEK };
struct binding gnweek = { _("+1 Week"), KEY_GENERIC_NEXT_WEEK };
+ struct binding gpmonth = { _("-1 Month"), KEY_GENERIC_PREV_MONTH };
+ struct binding gnmonth = { _("+1 Month"), KEY_GENERIC_NEXT_MONTH };
+ struct binding gpyear = { _("-1 Year"), KEY_GENERIC_PREV_YEAR };
+ struct binding gnyear = { _("+1 Year"), KEY_GENERIC_NEXT_YEAR };
struct binding today = { _("Today"), KEY_GENERIC_GOTO_TODAY };
struct binding nview = { _("Nxt View"), KEY_GENERIC_SCROLL_DOWN };
struct binding pview = { _("Prv View"), KEY_GENERIC_SCROLL_UP };
@@ -626,19 +630,22 @@ void wins_status_bar(void)
struct binding *bindings_cal[] = {
&help, &quit, &save, &chgvu, &nview, &pview, &up, &down, &left, &right,
&togo, &import, &export, &weekb, &weeke, &appt, &todo, &gpday, &gnday,
- &gpweek, &gnweek, &draw, &today, &conf
+ &gpweek, &gnweek, &gpmonth, &gnmonth, &gpyear, &gnyear, &draw, &today,
+ &conf
};
struct binding *bindings_apoint[] = {
&help, &quit, &save, &chgvu, &import, &export, &add, &del, &edit, &view,
&pipe, &draw, &rept, &flag, &enote, &vnote, &up, &down, &gpday, &gnday,
- &gpweek, &gnweek, &togo, &today, &conf, &appt, &todo, &cut, &paste
+ &gpweek, &gnweek, &gpmonth, &gnmonth, &gpyear, &gnyear, &togo, &today,
+ &conf, &appt, &todo, &cut, &paste
};
struct binding *bindings_todo[] = {
&help, &quit, &save, &chgvu, &import, &export, &add, &del, &edit, &view,
&pipe, &flag, &rprio, &lprio, &enote, &vnote, &up, &down, &gpday, &gnday,
- &gpweek, &gnweek, &togo, &today, &conf, &appt, &todo, &draw
+ &gpweek, &gnweek, &gpmonth, &gnmonth, &gpyear, &gnyear, &togo, &today,
+ &conf, &appt, &todo, &draw
};
enum win active_panel = wins_slctd();