diff options
author | Peter Korsgaard <jacmet@sunsite.dk> | 2009-07-27 17:24:01 +0200 |
---|---|---|
committer | Peter Korsgaard <jacmet@sunsite.dk> | 2009-07-27 17:24:01 +0200 |
commit | 76dade1788965d0d31e57d080854dddb5e74783f (patch) | |
tree | e40baee34f71aa399937b864b77165e9fc628db2 /package/config/lxdialog | |
parent | 6fecd53e99591775a4117e9e1ba18043fda36b27 (diff) | |
parent | 6cd6353ff9c0ce93a63e43c4cb61188c6bc0b0f5 (diff) |
Merge branch 'kconfig-update' of git://git.busybox.net/~tpetazzoni/git/buildroot
Diffstat (limited to 'package/config/lxdialog')
-rw-r--r-- | package/config/lxdialog/check-lxdialog.sh | 20 | ||||
-rw-r--r-- | package/config/lxdialog/checklist.c | 7 | ||||
-rw-r--r-- | package/config/lxdialog/dialog.h | 11 | ||||
-rw-r--r-- | package/config/lxdialog/inputbox.c | 6 | ||||
-rw-r--r-- | package/config/lxdialog/menubox.c | 6 | ||||
-rw-r--r-- | package/config/lxdialog/textbox.c | 2 | ||||
-rw-r--r-- | package/config/lxdialog/util.c | 32 | ||||
-rw-r--r-- | package/config/lxdialog/yesno.c | 4 |
8 files changed, 54 insertions, 34 deletions
diff --git a/package/config/lxdialog/check-lxdialog.sh b/package/config/lxdialog/check-lxdialog.sh index 9681476b9..fcef0f59d 100644 --- a/package/config/lxdialog/check-lxdialog.sh +++ b/package/config/lxdialog/check-lxdialog.sh @@ -36,19 +36,23 @@ trap "rm -f $tmp" 0 1 2 3 15 # Check if we can link to ncurses check() { - echo "main() {}" | $cc -xc - -o $tmp 2> /dev/null + $cc -xc - -o $tmp 2>/dev/null <<'EOF' +#include CURSES_LOC +main() {} +EOF if [ $? != 0 ]; then - echo " *** Unable to find the ncurses libraries." 1>&2 - echo " *** make menuconfig require the ncurses libraries" 1>&2 - echo " *** " 1>&2 - echo " *** Install ncurses (ncurses-devel) and try again" 1>&2 - echo " *** " 1>&2 - exit 1 + echo " *** Unable to find the ncurses libraries or the" 1>&2 + echo " *** required header files." 1>&2 + echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2 + echo " *** " 1>&2 + echo " *** Install ncurses (ncurses-devel) and try again." 1>&2 + echo " *** " 1>&2 + exit 1 fi } usage() { - printf "Usage: $0 [-check compiler options|-header|-library]\n" + printf "Usage: $0 [-check compiler options|-ccflags|-ldflags compiler options]\n" } if [ $# -eq 0 ]; then diff --git a/package/config/lxdialog/checklist.c b/package/config/lxdialog/checklist.c index cf697080d..bcc6f19c3 100644 --- a/package/config/lxdialog/checklist.c +++ b/package/config/lxdialog/checklist.c @@ -41,7 +41,8 @@ static void print_item(WINDOW * win, int choice, int selected) wmove(win, choice, check_x); wattrset(win, selected ? dlg.check_selected.atr : dlg.check.atr); - wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' '); + if (!item_is_tag(':')) + wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' '); wattrset(win, selected ? dlg.tag_selected.atr : dlg.tag.atr); mvwaddch(win, choice, item_x, item_str()[0]); @@ -97,8 +98,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) int x = width / 2 - 11; int y = height - 2; - print_button(dialog, "Select", y, x, selected == 0); - print_button(dialog, " Help ", y, x + 14, selected == 1); + print_button(dialog, gettext("Select"), y, x, selected == 0); + print_button(dialog, gettext(" Help "), y, x + 14, selected == 1); wmove(dialog, y, x + 1 + 14 * selected); wrefresh(dialog); diff --git a/package/config/lxdialog/dialog.h b/package/config/lxdialog/dialog.h index 7e17eba75..b5211fce0 100644 --- a/package/config/lxdialog/dialog.h +++ b/package/config/lxdialog/dialog.h @@ -26,6 +26,12 @@ #include <string.h> #include <stdbool.h> +#ifndef KBUILD_NO_NLS +# include <libintl.h> +#else +# define gettext(Msgid) ((const char *) (Msgid)) +#endif + #ifdef __sun__ #define CURS_MACROS #endif @@ -187,10 +193,9 @@ int item_is_tag(char tag); int on_key_esc(WINDOW *win); int on_key_resize(void); -void init_dialog(const char *backtitle); +int init_dialog(const char *backtitle); void set_dialog_backtitle(const char *backtitle); -void reset_dialog(void); -void end_dialog(void); +void end_dialog(int x, int y); void attr_clear(WINDOW * win, int height, int width, chtype attr); void dialog_clear(void); void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x); diff --git a/package/config/lxdialog/inputbox.c b/package/config/lxdialog/inputbox.c index 05e72066b..616c60138 100644 --- a/package/config/lxdialog/inputbox.c +++ b/package/config/lxdialog/inputbox.c @@ -31,8 +31,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) int x = width / 2 - 11; int y = height - 2; - print_button(dialog, " Ok ", y, x, selected == 0); - print_button(dialog, " Help ", y, x + 14, selected == 1); + print_button(dialog, gettext(" Ok "), y, x, selected == 0); + print_button(dialog, gettext(" Help "), y, x + 14, selected == 1); wmove(dialog, y, x + 1 + 14 * selected); wrefresh(dialog); @@ -89,7 +89,7 @@ do_resize: box_y = y + 2; box_x = (width - box_width) / 2; draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2, - dlg.border.atr, dlg.dialog.atr); + dlg.dialog.atr, dlg.border.atr); print_buttons(dialog, height, width, 0); diff --git a/package/config/lxdialog/menubox.c b/package/config/lxdialog/menubox.c index 0d83159d9..fa9d633f2 100644 --- a/package/config/lxdialog/menubox.c +++ b/package/config/lxdialog/menubox.c @@ -157,9 +157,9 @@ static void print_buttons(WINDOW * win, int height, int width, int selected) int x = width / 2 - 16; int y = height - 2; - print_button(win, "Select", y, x, selected == 0); - print_button(win, " Exit ", y, x + 12, selected == 1); - print_button(win, " Help ", y, x + 24, selected == 2); + print_button(win, gettext("Select"), y, x, selected == 0); + print_button(win, gettext(" Exit "), y, x + 12, selected == 1); + print_button(win, gettext(" Help "), y, x + 24, selected == 2); wmove(win, y, x + 1 + 12 * selected); wrefresh(win); diff --git a/package/config/lxdialog/textbox.c b/package/config/lxdialog/textbox.c index fabfc1ad7..c704712d0 100644 --- a/package/config/lxdialog/textbox.c +++ b/package/config/lxdialog/textbox.c @@ -114,7 +114,7 @@ do_resize: print_title(dialog, title, width); - print_button(dialog, " Exit ", height - 2, width / 2 - 4, TRUE); + print_button(dialog, gettext(" Exit "), height - 2, width / 2 - 4, TRUE); wnoutrefresh(dialog); getyx(dialog, cur_y, cur_x); /* Save cursor position */ diff --git a/package/config/lxdialog/util.c b/package/config/lxdialog/util.c index a1bddefe7..86d95cca4 100644 --- a/package/config/lxdialog/util.c +++ b/package/config/lxdialog/util.c @@ -266,31 +266,41 @@ void dialog_clear(void) /* * Do some initialization for dialog */ -void init_dialog(const char *backtitle) +int init_dialog(const char *backtitle) { - dlg.backtitle = backtitle; - color_setup(getenv("MENUCONFIG_COLOR")); -} + int height, width; + + initscr(); /* Init curses */ + getmaxyx(stdscr, height, width); + if (height < 19 || width < 80) { + endwin(); + return -ERRDISPLAYTOOSMALL; + } -void set_dialog_backtitle(const char *backtitle) -{ dlg.backtitle = backtitle; -} + color_setup(getenv("MENUCONFIG_COLOR")); -void reset_dialog(void) -{ - initscr(); /* Init curses */ keypad(stdscr, TRUE); cbreak(); noecho(); dialog_clear(); + + return 0; +} + +void set_dialog_backtitle(const char *backtitle) +{ + dlg.backtitle = backtitle; } /* * End using dialog functions. */ -void end_dialog(void) +void end_dialog(int x, int y) { + /* move cursor back to original position */ + move(y, x); + refresh(); endwin(); } diff --git a/package/config/lxdialog/yesno.c b/package/config/lxdialog/yesno.c index ee0a04e3e..4e6e8090c 100644 --- a/package/config/lxdialog/yesno.c +++ b/package/config/lxdialog/yesno.c @@ -29,8 +29,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) int x = width / 2 - 10; int y = height - 2; - print_button(dialog, " Yes ", y, x, selected == 0); - print_button(dialog, " No ", y, x + 13, selected == 1); + print_button(dialog, gettext(" Yes "), y, x, selected == 0); + print_button(dialog, gettext(" No "), y, x + 13, selected == 1); wmove(dialog, y, x + 1 + 13 * selected); wrefresh(dialog); |