summaryrefslogtreecommitdiff
path: root/src/custom.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2014-07-18 10:25:54 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2014-07-18 10:26:36 +0200
commit919a40f5612b5b2ce91284de337da17d6161edad (patch)
treee2ddbcd01c49256bb0eec615635d1a9c1366eff7 /src/custom.c
parent035faa883b980a8b7ec13794d7e02e95cfdc663b (diff)
downloadcalcurse-919a40f5612b5b2ce91284de337da17d6161edad.zip
Use wins_set_bindings() for the configuration menu
Make use of the general key binding context switching implementation for the configuration main menu. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/custom.c')
-rw-r--r--src/custom.c59
1 files changed, 25 insertions, 34 deletions
diff --git a/src/custom.c b/src/custom.c
index f4cbfab..08daa44 100644
--- a/src/custom.c
+++ b/src/custom.c
@@ -93,35 +93,6 @@ void custom_remove_attr(WINDOW * win, int attr_num)
wattroff(win, attr.nocolor[attr_num]);
}
-/* Draws the configuration bar */
-void custom_config_bar(void)
-{
- const int SMLSPC = 2;
- const int SPC = 15;
-
- custom_apply_attr(win[STA].p, ATTR_HIGHEST);
- mvwaddstr(win[STA].p, 0, 2, "Q");
- mvwaddstr(win[STA].p, 1, 2, "G");
- mvwaddstr(win[STA].p, 0, 2 + SPC, "L");
- mvwaddstr(win[STA].p, 1, 2 + SPC, "S");
- mvwaddstr(win[STA].p, 0, 2 + 2 * SPC, "C");
- mvwaddstr(win[STA].p, 1, 2 + 2 * SPC, "N");
- mvwaddstr(win[STA].p, 0, 2 + 3 * SPC, "K");
- custom_remove_attr(win[STA].p, ATTR_HIGHEST);
-
- mvwaddstr(win[STA].p, 0, 2 + SMLSPC, _("Exit"));
- mvwaddstr(win[STA].p, 1, 2 + SMLSPC, _("General"));
- mvwaddstr(win[STA].p, 0, 2 + SPC + SMLSPC, _("Layout"));
- mvwaddstr(win[STA].p, 1, 2 + SPC + SMLSPC, _("Sidebar"));
- mvwaddstr(win[STA].p, 0, 2 + 2 * SPC + SMLSPC, _("Color"));
- mvwaddstr(win[STA].p, 1, 2 + 2 * SPC + SMLSPC, _("Notify"));
- mvwaddstr(win[STA].p, 0, 2 + 3 * SPC + SMLSPC, _("Keys"));
-
- wnoutrefresh(win[STA].p);
- wmove(win[STA].p, 0, 0);
- wins_doupdate();
-}
-
static void layout_selection_bar(void)
{
static int bindings[] = {
@@ -1036,13 +1007,27 @@ void custom_keys_config(void)
void custom_config_main(void)
{
+ static int bindings[] = {
+ KEY_GENERIC_QUIT, KEY_CONFIGMENU_GENERAL,
+ KEY_CONFIGMENU_LAYOUT, KEY_CONFIGMENU_SIDEBAR,
+ KEY_CONFIGMENU_COLOR, KEY_CONFIGMENU_NOTIFY,
+ KEY_CONFIGMENU_KEYS
+ };
const char *no_color_support =
_("Sorry, colors are not supported by your terminal\n"
"(Press [ENTER] to continue)");
int ch;
int old_layout;
- custom_config_bar();
+ wins_set_bindings(bindings, ARRAY_SIZE(bindings));
+ wins_update_border(FLAG_ALL);
+ wins_update_panels(FLAG_ALL);
+ wins_status_bar();
+ if (notify_bar())
+ notify_update_bar();
+ wmove(win[STA].p, 0, 0);
+ wins_doupdate();
+
while ((ch = wgetch(win[KEY].p)) != 'q') {
switch (ch) {
case 'C':
@@ -1081,10 +1066,16 @@ void custom_config_main(void)
custom_sidebar_config();
break;
default:
- continue;
+ break;
}
- wins_update(FLAG_ALL);
- wins_erase_status_bar();
- custom_config_bar();
+
+ wins_set_bindings(bindings, ARRAY_SIZE(bindings));
+ wins_update_border(FLAG_ALL);
+ wins_update_panels(FLAG_ALL);
+ wins_status_bar();
+ if (notify_bar())
+ notify_update_bar();
+ wmove(win[STA].p, 0, 0);
+ wins_doupdate();
}
}