From 0ad6ff74df54c58afeca5b755054667728c53c1e Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Thu, 17 Jul 2014 21:16:33 +0200 Subject: keys.c: Merge keydef and binding_labels Signed-off-by: Lukas Fleischer --- src/keys.c | 151 +++++++++++++++++++++---------------------------------------- 1 file changed, 51 insertions(+), 100 deletions(-) (limited to 'src/keys.c') diff --git a/src/keys.c b/src/keys.c index 0895472..bf44d10 100644 --- a/src/keys.c +++ b/src/keys.c @@ -44,111 +44,62 @@ struct keydef_s { const char *label; const char *binding; + const char *sb_label; }; static llist_t keys[NBKEYS]; static enum key actions[MAXKEYVAL]; -static struct keydef_s keydef[NBKEYS] = { - {"generic-cancel", "ESC"}, - {"generic-select", "SPC"}, - {"generic-credits", "@"}, - {"generic-help", "?"}, - {"generic-quit", "q Q"}, - {"generic-save", "s S C-s"}, - {"generic-reload", "R"}, - {"generic-copy", "c"}, - {"generic-paste", "p C-v"}, - {"generic-change-view", "TAB"}, - {"generic-import", "i I"}, - {"generic-export", "x X"}, - {"generic-goto", "g G"}, - {"generic-other-cmd", "o O"}, - {"generic-config-menu", "C"}, - {"generic-redraw", "C-r"}, - {"generic-add-appt", "C-a"}, - {"generic-add-todo", "C-t"}, - {"generic-prev-day", "T C-h"}, - {"generic-next-day", "t C-l"}, - {"generic-prev-week", "W C-k"}, - {"generic-next-week", "w 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"}, - {"generic-command", ":"}, - - {"move-right", "l L RGT"}, - {"move-left", "h H LFT"}, - {"move-down", "j J DWN"}, - {"move-up", "k K UP"}, - {"start-of-week", "0"}, - {"end-of-week", "$"}, - {"add-item", "a A"}, - {"del-item", "d D"}, - {"edit-item", "e E"}, - {"view-item", "v V"}, - {"pipe-item", "|"}, - {"flag-item", "!"}, - {"repeat", "r"}, - {"edit-note", "n N"}, - {"view-note", ">"}, - {"raise-priority", "+"}, - {"lower-priority", "-"}, -}; - #define gettext_noop(s) s -static const char *binding_labels[] = { - gettext_noop("Cancel"), - gettext_noop("Select"), - gettext_noop("Credits"), - gettext_noop("Help"), - gettext_noop("Quit"), - gettext_noop("Save"), - gettext_noop("Reload"), - gettext_noop("Copy"), - gettext_noop("Paste"), - gettext_noop("Chg Win"), - gettext_noop("Import"), - gettext_noop("Export"), - gettext_noop("Go to"), - gettext_noop("OtherCmd"), - gettext_noop("Config"), - gettext_noop("Redraw"), - gettext_noop("Add Appt"), - gettext_noop("Add Todo"), - gettext_noop("-1 Day"), - gettext_noop("+1 Day"), - gettext_noop("-1 Week"), - gettext_noop("+1 Week"), - gettext_noop("-1 Month"), - gettext_noop("+1 Month"), - gettext_noop("-1 Year"), - gettext_noop("+1 Year"), - gettext_noop("Nxt View"), - gettext_noop("Prv View"), - gettext_noop("Today"), - gettext_noop("Command"), - gettext_noop("Right"), - gettext_noop("Left"), - gettext_noop("Down"), - gettext_noop("Up"), - gettext_noop("beg Week"), - gettext_noop("end Week"), - gettext_noop("Add Item"), - gettext_noop("Del Item"), - gettext_noop("Edit Itm"), - gettext_noop("View"), - gettext_noop("Pipe"), - gettext_noop("Flag Itm"), - gettext_noop("Repeat"), - gettext_noop("EditNote"), - gettext_noop("ViewNote"), - gettext_noop("Prio.+"), - gettext_noop("Prio.-") +static struct keydef_s keydef[NBKEYS] = { + { "generic-cancel", "ESC", gettext_noop("Cancel") }, + { "generic-select", "SPC", gettext_noop("Select") }, + { "generic-credits", "@", gettext_noop("Credits") }, + { "generic-help", "?", gettext_noop("Help") }, + { "generic-quit", "q Q", gettext_noop("Quit") }, + { "generic-save", "s S C-s", gettext_noop("Save") }, + { "generic-reload", "R", gettext_noop("Reload") }, + { "generic-copy", "c", gettext_noop("Copy") }, + { "generic-paste", "p C-v", gettext_noop("Paste") }, + { "generic-change-view", "TAB", gettext_noop("Chg Win") }, + { "generic-import", "i I", gettext_noop("Import") }, + { "generic-export", "x X", gettext_noop("Export") }, + { "generic-goto", "g G", gettext_noop("Go to") }, + { "generic-other-cmd", "o O", gettext_noop("OtherCmd") }, + { "generic-config-menu", "C", gettext_noop("Config") }, + { "generic-redraw", "C-r", gettext_noop("Redraw") }, + { "generic-add-appt", "C-a", gettext_noop("Add Appt") }, + { "generic-add-todo", "C-t", gettext_noop("Add Todo") }, + { "generic-prev-day", "T C-h", gettext_noop("-1 Day") }, + { "generic-next-day", "t C-l", gettext_noop("+1 Day") }, + { "generic-prev-week", "W C-k", gettext_noop("-1 Week") }, + { "generic-next-week", "w C-j", gettext_noop("+1 Week") }, + { "generic-prev-month", "M", gettext_noop("-1 Month") }, + { "generic-next-month", "m", gettext_noop("+1 Month") }, + { "generic-prev-year", "Y", gettext_noop("-1 Year") }, + { "generic-next-year", "y", gettext_noop("+1 Year") }, + { "generic-scroll-down", "C-n", gettext_noop("Nxt View") }, + { "generic-scroll-up", "C-p", gettext_noop("Prv View") }, + { "generic-goto-today", "C-g", gettext_noop("Today") }, + { "generic-command", ":", gettext_noop("Command") }, + + { "move-right", "l L RGT", gettext_noop("Right") }, + { "move-left", "h H LFT", gettext_noop("Left") }, + { "move-down", "j J DWN", gettext_noop("Down") }, + { "move-up", "k K UP", gettext_noop("Up") }, + { "start-of-week", "0", gettext_noop("beg Week") }, + { "end-of-week", "$", gettext_noop("end Week") }, + { "add-item", "a A", gettext_noop("Add Item") }, + { "del-item", "d D", gettext_noop("Del Item") }, + { "edit-item", "e E", gettext_noop("Edit Itm") }, + { "view-item", "v V", gettext_noop("View") }, + { "pipe-item", "|", gettext_noop("Pipe") }, + { "flag-item", "!", gettext_noop("Flag Itm") }, + { "repeat", "r", gettext_noop("Repeat") }, + { "edit-note", "n N", gettext_noop("EditNote") }, + { "view-note", ">", gettext_noop("ViewNote") }, + { "raise-priority", "+", gettext_noop("Prio.+") }, + { "lower-priority", "-", gettext_noop("Prio.-") } }; static void dump_intro(FILE * fd) @@ -499,7 +450,7 @@ keys_display_bindings_bar(WINDOW * win, int *bindings, int count, mvwaddstr(win, key_pos_y, key_pos_x, fmtkey); custom_remove_attr(win, ATTR_HIGHEST); mvwaddstr(win, label_pos_y, label_pos_x, - gettext(binding_labels[binding_key])); + gettext(keydef[binding_key].sb_label)); } wnoutrefresh(win); } -- cgit v1.2.3-54-g00ecf