diff options
author | Sam Ravnborg <sam@mars.ravnborg.org> | 2006-07-24 15:40:46 -0400 |
---|---|---|
committer | Sam Ravnborg <sam@neptun.ravnborg.org> | 2006-09-30 05:19:19 -0400 |
commit | 98e5a1579e7d34fe3803240750a1c48efcd9cb15 (patch) | |
tree | 433f6b354eb0bb6fa01f325237f9f4651bf5ac9f /scripts/kconfig/lxdialog/inputbox.c | |
parent | bf603625660b1742004bf86432ce3c210d14d4fd (diff) |
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 <sam@ravnborg.org>
Diffstat (limited to 'scripts/kconfig/lxdialog/inputbox.c')
-rw-r--r-- | scripts/kconfig/lxdialog/inputbox.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c index 779503726b0a..f75b51f8e636 100644 --- a/scripts/kconfig/lxdialog/inputbox.c +++ b/scripts/kconfig/lxdialog/inputbox.c | |||
@@ -58,17 +58,18 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width | |||
58 | dialog = newwin(height, width, y, x); | 58 | dialog = newwin(height, width, y, x); |
59 | keypad(dialog, TRUE); | 59 | keypad(dialog, TRUE); |
60 | 60 | ||
61 | draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); | 61 | draw_box(dialog, 0, 0, height, width, |
62 | wattrset(dialog, border_attr); | 62 | dlg.dialog.atr, dlg.border.atr); |
63 | wattrset(dialog, dlg.border.atr); | ||
63 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); | 64 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); |
64 | for (i = 0; i < width - 2; i++) | 65 | for (i = 0; i < width - 2; i++) |
65 | waddch(dialog, ACS_HLINE); | 66 | waddch(dialog, ACS_HLINE); |
66 | wattrset(dialog, dialog_attr); | 67 | wattrset(dialog, dlg.dialog.atr); |
67 | waddch(dialog, ACS_RTEE); | 68 | waddch(dialog, ACS_RTEE); |
68 | 69 | ||
69 | print_title(dialog, title, width); | 70 | print_title(dialog, title, width); |
70 | 71 | ||
71 | wattrset(dialog, dialog_attr); | 72 | wattrset(dialog, dlg.dialog.atr); |
72 | print_autowrap(dialog, prompt, width - 2, 1, 3); | 73 | print_autowrap(dialog, prompt, width - 2, 1, 3); |
73 | 74 | ||
74 | /* Draw the input field box */ | 75 | /* Draw the input field box */ |
@@ -76,13 +77,14 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width | |||
76 | getyx(dialog, y, x); | 77 | getyx(dialog, y, x); |
77 | box_y = y + 2; | 78 | box_y = y + 2; |
78 | box_x = (width - box_width) / 2; | 79 | box_x = (width - box_width) / 2; |
79 | draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2, border_attr, dialog_attr); | 80 | draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2, |
81 | dlg.border.atr, dlg.dialog.atr); | ||
80 | 82 | ||
81 | print_buttons(dialog, height, width, 0); | 83 | print_buttons(dialog, height, width, 0); |
82 | 84 | ||
83 | /* Set up the initial value */ | 85 | /* Set up the initial value */ |
84 | wmove(dialog, box_y, box_x); | 86 | wmove(dialog, box_y, box_x); |
85 | wattrset(dialog, inputbox_attr); | 87 | wattrset(dialog, dlg.inputbox.atr); |
86 | 88 | ||
87 | if (!init) | 89 | if (!init) |
88 | instr[0] = '\0'; | 90 | instr[0] = '\0'; |
@@ -120,7 +122,7 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width | |||
120 | case KEY_BACKSPACE: | 122 | case KEY_BACKSPACE: |
121 | case 127: | 123 | case 127: |
122 | if (input_x || scroll) { | 124 | if (input_x || scroll) { |
123 | wattrset(dialog, inputbox_attr); | 125 | wattrset(dialog, dlg.inputbox.atr); |
124 | if (!input_x) { | 126 | if (!input_x) { |
125 | scroll = scroll < box_width - 1 ? 0 : scroll - (box_width - 1); | 127 | scroll = scroll < box_width - 1 ? 0 : scroll - (box_width - 1); |
126 | wmove(dialog, box_y, box_x); | 128 | wmove(dialog, box_y, box_x); |
@@ -140,7 +142,7 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width | |||
140 | default: | 142 | default: |
141 | if (key < 0x100 && isprint(key)) { | 143 | if (key < 0x100 && isprint(key)) { |
142 | if (scroll + input_x < MAX_LEN) { | 144 | if (scroll + input_x < MAX_LEN) { |
143 | wattrset(dialog, inputbox_attr); | 145 | wattrset(dialog, dlg.inputbox.atr); |
144 | instr[scroll + input_x] = key; | 146 | instr[scroll + input_x] = key; |
145 | instr[scroll + input_x + 1] = '\0'; | 147 | instr[scroll + input_x + 1] = '\0'; |
146 | if (input_x == box_width - 1) { | 148 | if (input_x == box_width - 1) { |