From 98e5a1579e7d34fe3803240750a1c48efcd9cb15 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 24 Jul 2006 21:40:46 +0200 Subject: kconfig/lxdialog: refactor color support Clean up and refactor color support. All color support are now in util.c including color definitions. In the process introduced a global variable named 'dlg' which is used all over to set color - thats the reason why all files are changed. Signed-off-by: Sam Ravnborg --- scripts/kconfig/lxdialog/textbox.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'scripts/kconfig/lxdialog/textbox.c') diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c index 77848bb8e07..336793b0395 100644 --- a/scripts/kconfig/lxdialog/textbox.c +++ b/scripts/kconfig/lxdialog/textbox.c @@ -87,20 +87,21 @@ int dialog_textbox(const char *title, const char *file, int height, int width) /* Create window for text region, used for scrolling text */ text = subwin(dialog, height - 4, width - 2, y + 1, x + 1); - wattrset(text, dialog_attr); - wbkgdset(text, dialog_attr & A_COLOR); + wattrset(text, dlg.dialog.atr); + wbkgdset(text, dlg.dialog.atr & A_COLOR); keypad(text, TRUE); /* register the new window, along with its borders */ - draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); + draw_box(dialog, 0, 0, height, width, + dlg.dialog.atr, dlg.border.atr); - wattrset(dialog, border_attr); + wattrset(dialog, dlg.border.atr); mvwaddch(dialog, height - 3, 0, ACS_LTEE); for (i = 0; i < width - 2; i++) waddch(dialog, ACS_HLINE); - wattrset(dialog, dialog_attr); - wbkgdset(dialog, dialog_attr & A_COLOR); + wattrset(dialog, dlg.dialog.atr); + wbkgdset(dialog, dlg.dialog.atr & A_COLOR); waddch(dialog, ACS_RTEE); print_title(dialog, title, width); @@ -110,7 +111,7 @@ int dialog_textbox(const char *title, const char *file, int height, int width) getyx(dialog, cur_y, cur_x); /* Save cursor position */ /* Print first page of text */ - attr_clear(text, height - 4, width - 2, dialog_attr); + attr_clear(text, height - 4, width - 2, dlg.dialog.atr); print_page(text, height - 4, width - 2); print_position(dialog, height, width); wmove(dialog, cur_y, cur_x); /* Restore cursor position */ @@ -524,8 +525,8 @@ static void print_position(WINDOW * win, int height, int width) fprintf(stderr, "\nError moving file pointer in print_position().\n"); exit(-1); } - wattrset(win, position_indicator_attr); - wbkgdset(win, position_indicator_attr & A_COLOR); + wattrset(win, dlg.position_indicator.atr); + wbkgdset(win, dlg.position_indicator.atr & A_COLOR); percent = !file_size ? 100 : ((fpos - bytes_read + page - buf) * 100) / file_size; wmove(win, height - 3, width - 9); -- cgit v1.2.3-70-g09d2