diff options
author | Wang YanQing <udknight@gmail.com> | 2012-12-18 20:50:58 -0500 |
---|---|---|
committer | Yann E. MORIN <yann.morin.1998@free.fr> | 2013-01-15 18:00:34 -0500 |
commit | 6364fd0cb1e4c7f72b974613e0cf5744ae4d2cb2 (patch) | |
tree | 82ddce27af13bb046b75b89470bb505908affb2b /scripts/kconfig/lxdialog | |
parent | 87727d453b4677a21312712c8a4bb5dcd81a1ebe (diff) |
menuconfig: Add Save/Load buttons
If menuconfig have Save/Load button like alternative
.config editors, xconfig, nconfig, etc.We will have
a obvious benefit when use menuconfig just like
when we use others, we can Save/Load our .config quickly
and conveniently.
This patch add the Save/Load button for menuconfig.
[remove trailing space while at it for below line:
"*) Formerly when I used Page Down and Page Up, the cursor would be set"
]
Changes:
V1-V2:
1:use PATH_MAX instead of hard code suggested by Yann E. MORIN
2:drop the spurious empty-line removal suggested by Yann E. MORIN
V2-V3:
1:ajust buttons position well centered reported by Yann E. MORIN
Signed-off-by: Wang YanQing <udknight@gmail.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Diffstat (limited to 'scripts/kconfig/lxdialog')
-rw-r--r-- | scripts/kconfig/lxdialog/menubox.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c index 1d604738fa13..48d382e7e374 100644 --- a/scripts/kconfig/lxdialog/menubox.c +++ b/scripts/kconfig/lxdialog/menubox.c | |||
@@ -26,7 +26,7 @@ | |||
26 | * | 26 | * |
27 | * *) A bugfix for the Page-Down problem | 27 | * *) A bugfix for the Page-Down problem |
28 | * | 28 | * |
29 | * *) Formerly when I used Page Down and Page Up, the cursor would be set | 29 | * *) Formerly when I used Page Down and Page Up, the cursor would be set |
30 | * to the first position in the menu box. Now lxdialog is a bit | 30 | * to the first position in the menu box. Now lxdialog is a bit |
31 | * smarter and works more like other menu systems (just have a look at | 31 | * smarter and works more like other menu systems (just have a look at |
32 | * it). | 32 | * it). |
@@ -154,12 +154,14 @@ static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x, | |||
154 | */ | 154 | */ |
155 | static void print_buttons(WINDOW * win, int height, int width, int selected) | 155 | static void print_buttons(WINDOW * win, int height, int width, int selected) |
156 | { | 156 | { |
157 | int x = width / 2 - 16; | 157 | int x = width / 2 - 28; |
158 | int y = height - 2; | 158 | int y = height - 2; |
159 | 159 | ||
160 | print_button(win, gettext("Select"), y, x, selected == 0); | 160 | print_button(win, gettext("Select"), y, x, selected == 0); |
161 | print_button(win, gettext(" Exit "), y, x + 12, selected == 1); | 161 | print_button(win, gettext(" Exit "), y, x + 12, selected == 1); |
162 | print_button(win, gettext(" Help "), y, x + 24, selected == 2); | 162 | print_button(win, gettext(" Help "), y, x + 24, selected == 2); |
163 | print_button(win, gettext(" Save "), y, x + 36, selected == 3); | ||
164 | print_button(win, gettext(" Load "), y, x + 48, selected == 4); | ||
163 | 165 | ||
164 | wmove(win, y, x + 1 + 12 * selected); | 166 | wmove(win, y, x + 1 + 12 * selected); |
165 | wrefresh(win); | 167 | wrefresh(win); |
@@ -372,7 +374,7 @@ do_resize: | |||
372 | case TAB: | 374 | case TAB: |
373 | case KEY_RIGHT: | 375 | case KEY_RIGHT: |
374 | button = ((key == KEY_LEFT ? --button : ++button) < 0) | 376 | button = ((key == KEY_LEFT ? --button : ++button) < 0) |
375 | ? 2 : (button > 2 ? 0 : button); | 377 | ? 4 : (button > 4 ? 0 : button); |
376 | 378 | ||
377 | print_buttons(dialog, height, width, button); | 379 | print_buttons(dialog, height, width, button); |
378 | wrefresh(menu); | 380 | wrefresh(menu); |
@@ -399,17 +401,17 @@ do_resize: | |||
399 | return 2; | 401 | return 2; |
400 | case 's': | 402 | case 's': |
401 | case 'y': | 403 | case 'y': |
402 | return 3; | 404 | return 5; |
403 | case 'n': | 405 | case 'n': |
404 | return 4; | 406 | return 6; |
405 | case 'm': | 407 | case 'm': |
406 | return 5; | 408 | return 7; |
407 | case ' ': | 409 | case ' ': |
408 | return 6; | 410 | return 8; |
409 | case '/': | 411 | case '/': |
410 | return 7; | 412 | return 9; |
411 | case 'z': | 413 | case 'z': |
412 | return 8; | 414 | return 10; |
413 | case '\n': | 415 | case '\n': |
414 | return button; | 416 | return button; |
415 | } | 417 | } |