Skip to contentSkip to conversation

Pull request for branch yem-kconfig-for-next

GIT PULL New Yann E. MORIN 2 participants 5 messages Jan 15, 2013 – Jan 24, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello Michal, All!

These are the kconfig patches I've queued for 3.9.

There are a few more on the list, but they need rework first (the vi- and readline-like-keys series).

The following changes since commit 87727d453b4677a21312712c8a4bb5dcd81a1ebe:

menuconfig:inputbox: support navigate input position (2012-12-25 23:42:37 +0100)

are available in the git repository at:
git://gitorious.org/linux-kconfig/linux-kconfig.git yem-kconfig-for-next

Roland Eggner (1):
nconf: function keys line, change background color for better readability

Wang YanQing (2):
menuconfig: Add Save/Load buttons
menuconfig: Get rid of the top-level entries for "Load an Alternate/Save an Alternate"

 scripts/kconfig/lxdialog/menubox.c |   20 +++++++++-------
 scripts/kconfig/mconf.c            |   44 ++++++++++++++++++++---------------
 scripts/kconfig/nconf.gui.c        |    2 +-
 3 files changed, 37 insertions(+), 29 deletions(-)

Regards,
Yann E. MORIN

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH 1/3 menuconfig: Add Save/Load buttons

From: Wang YanQing <[email protected]>

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

---
 scripts/kconfig/lxdialog/menubox.c |   20 +++++++++++---------
 scripts/kconfig/mconf.c            |   30 +++++++++++++++++++++++++-----
 2 files changed, 36 insertions(+), 14 deletions(-)
scripts/kconfig/lxdialog/menubox.c +11 -9
index 1d60473..48d382e 100644
@@ -26,7 +26,7 @@
  *
  *    *)  A bugfix for the Page-Down problem
  *
- *    *)  Formerly when I used Page Down and Page Up, the cursor would be set 
+ *    *)  Formerly when I used Page Down and Page Up, the cursor would be set
  *        to the first position in the menu box.  Now lxdialog is a bit
  *        smarter and works more like other menu systems (just have a look at
  *        it).
@@ -154,12 +154,14 @@ static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x,
  */
 static void print_buttons(WINDOW * win, int height, int width, int selected)
 {
-	int x = width / 2 - 16;
+	int x = width / 2 - 28;
 	int y = height - 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);
+	print_button(win, gettext(" Save "), y, x + 36, selected == 3);
+	print_button(win, gettext(" Load "), y, x + 48, selected == 4);
 
 	wmove(win, y, x + 1 + 12 * selected);
 	wrefresh(win);
@@ -372,7 +374,7 @@ do_resize:
 		case TAB:
 		case KEY_RIGHT:
 			button = ((key == KEY_LEFT ? --button : ++button) < 0)
-			    ? 2 : (button > 2 ? 0 : button);
+			    ? 4 : (button > 4 ? 0 : button);
 
 			print_buttons(dialog, height, width, button);
 			wrefresh(menu);
@@ -399,17 +401,17 @@ do_resize:
 				return 2;
 			case 's':
 			case 'y':
-				return 3;
+				return 5;
 			case 'n':
-				return 4;
+				return 6;
 			case 'm':
-				return 5;
+				return 7;
 			case ' ':
-				return 6;
+				return 8;
 			case '/':
-				return 7;
+				return 9;
 			case 'z':
-				return 8;
+				return 10;
 			case '\n':
 				return button;
 			}
scripts/kconfig/mconf.c +25 -5
index 5f29618..88e8068 100644
@@ -280,6 +280,7 @@ static struct menu *current_menu;
 static int child_count;
 static int single_menu_mode;
 static int show_all_options;
+static int save_and_exit;
 
 static void conf(struct menu *menu, struct menu *active_menu);
 static void conf_choice(struct menu *menu);
@@ -657,6 +658,12 @@ static void conf(struct menu *menu, struct menu *active_menu)
 				show_helptext(_("README"), _(mconf_readme));
 			break;
 		case 3:
+			conf_save();
+			break;
+		case 4:
+			conf_load();
+			break;
+		case 5:
 			if (item_is_tag('t')) {
 				if (sym_set_tristate_value(sym, yes))
 					break;
@@ -664,24 +671,24 @@ static void conf(struct menu *menu, struct menu *active_menu)
 					show_textbox(NULL, setmod_text, 6, 74);
 			}
 			break;
-		case 4:
+		case 6:
 			if (item_is_tag('t'))
 				sym_set_tristate_value(sym, no);
 			break;
-		case 5:
+		case 7:
 			if (item_is_tag('t'))
 				sym_set_tristate_value(sym, mod);
 			break;
-		case 6:
+		case 8:
 			if (item_is_tag('t'))
 				sym_toggle_tristate_value(sym);
 			else if (item_is_tag('m'))
 				conf(submenu, NULL);
 			break;
-		case 7:
+		case 9:
 			search_conf();
 			break;
-		case 8:
+		case 10:
 			show_all_options = !show_all_options;
 			break;
 		}
@@ -708,6 +715,17 @@ static void show_helptext(const char *title, const char *text)
 	show_textbox(title, text, 0, 0);
 }
 
+static void conf_message_callback(const char *fmt, va_list ap)
+{
+	char buf[PATH_MAX+1];
+
+	vsnprintf(buf, sizeof(buf), fmt, ap);
+	if (save_and_exit)
+		printf("%s", buf);
+	else
+		show_textbox(NULL, buf, 6, 60);
+}
+
 static void show_help(struct menu *menu)
 {
 	struct gstr help = str_new();
@@ -876,6 +894,7 @@ static int handle_exit(void)
 {
 	int res;
 
+	save_and_exit = 1;
 	dialog_clear();
 	if (conf_get_changed())
 		res = dialog_yesno(NULL,
@@ -947,6 +966,7 @@ int main(int ac, char **av)
 	}
 
 	set_config_filename(conf_get_configname());
+	conf_set_message_callback(conf_message_callback);
 	do {
 		conf(&rootmenu, NULL);
 		res = handle_exit();
Signature · 1 line
1.7.2.5
#2 lore raw

PATCH 2/3 menuconfig: Get rid of the top-level entries for "Load an Alternate/Save an Alternate"

In reply to Yann E. MORIN

From: Wang YanQing <[email protected]>

Now we have Load/Save buttons to do the Load/Save in the convenient place, so we can drop the top-level entries.

---
 scripts/kconfig/mconf.c |   14 --------------
 1 files changed, 0 insertions(+), 14 deletions(-)
scripts/kconfig/mconf.c +0 -14
index 88e8068..680135e 100644
@@ -599,14 +599,6 @@ static void conf(struct menu *menu, struct menu *active_menu)
 		build_conf(menu);
 		if (!child_count)
 			break;
-		if (menu == &rootmenu) {
-			item_make("--- ");
-			item_set_tag(':');
-			item_make(_("    Load an Alternate Configuration File"));
-			item_set_tag('L');
-			item_make(_("    Save an Alternate Configuration File"));
-			item_set_tag('S');
-		}
 		dialog_clear();
 		res = dialog_menu(prompt ? _(prompt) : _("Main Menu"),
 				  _(menu_instructions),
@@ -643,12 +635,6 @@ static void conf(struct menu *menu, struct menu *active_menu)
 			case 's':
 				conf_string(submenu);
 				break;
-			case 'L':
-				conf_load();
-				break;
-			case 'S':
-				conf_save();
-				break;
 			}
 			break;
 		case 2:
Signature · 1 line
1.7.2.5
#3 lore raw

PATCH 3/3 nconf: function keys line, change background color for better readability

In reply to Yann E. MORIN

From: Roland Eggner <[email protected]>

Quoted 1 line

From: Roland Eggner <[email protected]>

• In function keys line descriptions black on darkblue are almost impossible to read. Change colors to black on brown.

---
 scripts/kconfig/nconf.gui.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
scripts/kconfig/nconf.gui.c +1 -1
index 379003c..9f8c44e 100644
@@ -48,7 +48,7 @@ static void set_normal_colors(void)
 	init_pair(INPUT_FIELD, -1, -1);
 
 	init_pair(FUNCTION_HIGHLIGHT, -1, -1);
-	init_pair(FUNCTION_TEXT, COLOR_BLUE, -1);
+	init_pair(FUNCTION_TEXT, COLOR_YELLOW, -1);
 }
 
 /* available attributes:
Signature · 1 line
1.7.2.5