diff options
author | Lars Henriksen <LarsHenriksen@get2net.dk> | 2017-11-20 10:22:11 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2017-11-23 08:56:06 +0100 |
commit | 97c3e7f95726533897c3e65a09ffd2cd02d7e187 (patch) | |
tree | 1df7aac9589f76116e23c4c635d5b5a0792e9f29 | |
parent | aca4e06c5fce9a98af4955f5a53d7ea3caf608a8 (diff) | |
download | calcurse-97c3e7f95726533897c3e65a09ffd2cd02d7e187.tar.gz calcurse-97c3e7f95726533897c3e65a09ffd2cd02d7e187.zip |
Function cleanup in custom.c
Remove two remnants: custom_color_theme_name() and custom_set_swsiz().
Make static and rename custom_confwin_init() into confwin_init().
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
-rw-r--r-- | src/calcurse.h | 3 | ||||
-rw-r--r-- | src/custom.c | 78 |
2 files changed, 39 insertions, 42 deletions
diff --git a/src/calcurse.h b/src/calcurse.h index 60ccebc..ca55e1f 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -762,9 +762,6 @@ void custom_remove_attr(WINDOW *, int); void custom_layout_config(void); void custom_sidebar_config(void); void custom_color_config(void); -void custom_color_theme_name(char *); -void custom_confwin_init(struct window *, const char *); -void custom_set_swsiz(struct scrollwin *); void custom_general_config(void); void custom_keys_config(void); void custom_config_main(void); diff --git a/src/custom.c b/src/custom.c index 52bdd5b..f528d32 100644 --- a/src/custom.c +++ b/src/custom.c @@ -93,6 +93,41 @@ void custom_remove_attr(WINDOW * win, int attr_num) wattroff(win, attr.nocolor[attr_num]); } +static void set_confwin_attr(struct window *cwin) +{ + cwin->h = (notify_bar())? row - 3 : row - 2; + cwin->w = col; + cwin->x = cwin->y = 0; +} + +/* + * Create a configuration window and initialize status and notification bar + * (useful in case of window resize). + */ +static void confwin_init(struct window *confwin, const char *label) +{ + if (confwin->p) { + erase_window_part(confwin->p, confwin->x, confwin->y, + confwin->x + confwin->w, + confwin->y + confwin->h); + delwin(confwin->p); + } + + wins_get_config(); + set_confwin_attr(confwin); + confwin->p = newwin(confwin->h, col, 0, 0); + box(confwin->p, 0, 0); + wins_show(confwin->p, label); + delwin(win[STA].p); + win[STA].p = + newwin(win[STA].h, win[STA].w, win[STA].y, win[STA].x); + keypad(win[STA].p, TRUE); + if (notify_bar()) { + notify_reinit_bar(); + notify_update_bar(); + } +} + static void layout_selection_bar(void) { static int bindings[] = { @@ -177,7 +212,7 @@ void custom_layout_config(void) const char *label = _("layout configuration"); conf_win.p = NULL; - custom_confwin_init(&conf_win, label); + confwin_init(&conf_win, label); cursor = mark = wins_layout() - 1; display_layout_config(&conf_win, mark, cursor); clear(); @@ -218,7 +253,7 @@ void custom_layout_config(void) } if (need_reset) - custom_confwin_init(&conf_win, label); + confwin_init(&conf_win, label); display_layout_config(&conf_win, mark, cursor); } @@ -270,41 +305,6 @@ void custom_sidebar_config(void) } } -static void set_confwin_attr(struct window *cwin) -{ - cwin->h = (notify_bar())? row - 3 : row - 2; - cwin->w = col; - cwin->x = cwin->y = 0; -} - -/* - * Create a configuration window and initialize status and notification bar - * (useful in case of window resize). - */ -void custom_confwin_init(struct window *confwin, const char *label) -{ - if (confwin->p) { - erase_window_part(confwin->p, confwin->x, confwin->y, - confwin->x + confwin->w, - confwin->y + confwin->h); - delwin(confwin->p); - } - - wins_get_config(); - set_confwin_attr(confwin); - confwin->p = newwin(confwin->h, col, 0, 0); - box(confwin->p, 0, 0); - wins_show(confwin->p, label); - delwin(win[STA].p); - win[STA].p = - newwin(win[STA].h, win[STA].w, win[STA].y, win[STA].x); - keypad(win[STA].p, TRUE); - if (notify_bar()) { - notify_reinit_bar(); - notify_update_bar(); - } -} - static void color_selection_bar(void) { static int bindings[] = { @@ -448,7 +448,7 @@ void custom_color_config(void) const char *label = _("color theme"); conf_win.p = 0; - custom_confwin_init(&conf_win, label); + confwin_init(&conf_win, label); mark_fore = NBUSERCOLORS; mark_back = SIZE - 1; cursor = 0; @@ -507,7 +507,7 @@ void custom_color_config(void) } if (need_reset) - custom_confwin_init(&conf_win, label); + confwin_init(&conf_win, label); display_color_config(&conf_win, &mark_fore, &mark_back, cursor, theme_changed); |