diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index 4ecac015b294234ba548f0e8d2bef2dfe036e56a..3ebdf602cc39d8102e0bf6ebdecc1c037a4ddb33 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@ -97,7 +97,7 @@ struct symbol { #define SYMBOL_HASHMASK 0xff enum prop_type { - P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_ROOTMENU, P_DEFAULT, P_CHOICE + P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE }; struct property { @@ -137,6 +137,7 @@ struct menu { }; #define MENU_CHANGED 0x0001 +#define MENU_ROOT 0x0002 #ifndef SWIG diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index fb25b6f028ccfd5714cfa33af34ffd2d0273c7e0..127d41adf2a943f4a050e03ea71f52b36119e771 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c @@ -164,8 +164,6 @@ const char *dbg_print_ptype(int val) strcpy(buf, "comment"); if (val == P_MENU) strcpy(buf, "menu"); - if (val == P_ROOTMENU) - strcpy(buf, "rootmenu"); if (val == P_DEFAULT) strcpy(buf, "default"); if (val == P_CHOICE) @@ -798,7 +796,7 @@ void on_back_pressed(GtkButton * button, gpointer user_data) current = current->parent; ptype = current->prompt ? current->prompt->type : P_UNKNOWN; - if ((ptype != P_ROOTMENU) && (ptype != P_MENU)) + if (ptype != P_MENU) current = current->parent; display_tree_part(); @@ -836,6 +834,8 @@ void on_split_clicked(GtkButton * button, gpointer user_data) gtk_widget_show(tree1_w); gtk_window_get_default_size(GTK_WINDOW(main_wnd), &w, &h); gtk_paned_set_position(GTK_PANED(hpaned), w / 2); + if (tree2) + gtk_tree_store_clear(tree2); display_list(); } @@ -922,8 +922,10 @@ static void change_sym_value(struct menu *menu, gint col) config_changed = TRUE; if (view_mode == FULL_VIEW) update_tree(&rootmenu, NULL); - else if (view_mode == SPLIT_VIEW) + else if (view_mode == SPLIT_VIEW) { update_tree(current, NULL); + display_list(); + } else if (view_mode == SINGLE_VIEW) display_tree_part(); //fixme: keep exp/coll break; @@ -949,8 +951,10 @@ static void toggle_sym_value(struct menu *menu) sym_set_tristate_value(menu->sym, newval); if (view_mode == FULL_VIEW) update_tree(&rootmenu, NULL); - else if (view_mode == SPLIT_VIEW) + else if (view_mode == SPLIT_VIEW) { update_tree(current, NULL); + display_list(); + } else if (view_mode == SINGLE_VIEW) display_tree_part(); //fixme: keep exp/coll } @@ -1035,8 +1039,7 @@ on_treeview2_button_press_event(GtkWidget * widget, enum prop_type ptype; ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; - if (((ptype == P_MENU) || (ptype == P_ROOTMENU)) && - (view_mode == SINGLE_VIEW) && (col == COL_OPTION)) { + if (ptype == P_MENU && view_mode != FULL_VIEW && col == COL_OPTION) { // goes down into menu current = menu; display_tree_part(); @@ -1192,7 +1195,6 @@ static gchar **fill_row(struct menu *menu) ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; switch (ptype) { case P_MENU: - case P_ROOTMENU: row[COL_PIXBUF] = (gchar *) xpm_menu; if (view_mode != FULL_VIEW) row[COL_PIXVIS] = GINT_TO_POINTER(TRUE); @@ -1477,11 +1479,11 @@ static void display_tree(struct menu *menu) if (sym) sym->flags &= ~SYMBOL_CHANGED; - if ((view_mode == SPLIT_VIEW) && (ptype != P_ROOTMENU) && + if ((view_mode == SPLIT_VIEW) && !(child->flags & MENU_ROOT) && (tree == tree1)) continue; - if ((view_mode == SPLIT_VIEW) && (ptype == P_ROOTMENU) && + if ((view_mode == SPLIT_VIEW) && (child->flags & MENU_ROOT) && (tree == tree2)) continue; @@ -1503,7 +1505,7 @@ static void display_tree(struct menu *menu) && (tree == tree2)) continue; - if (((menu != &rootmenu) && (ptype != P_ROOTMENU)) || + if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT)) || (view_mode == FULL_VIEW) || (view_mode == SPLIT_VIEW)) { indent++; @@ -1525,8 +1527,6 @@ static void display_tree_part(void) /* Display the list in the left frame (split view) */ static void display_list(void) { - if (tree2) - gtk_tree_store_clear(tree2); if (tree1) gtk_tree_store_clear(tree1); @@ -1542,7 +1542,7 @@ static void fixup_rootmenu(struct menu *menu) if (!menu->prompt || menu->prompt->type != P_MENU) return; - menu->prompt->type = P_ROOTMENU; + menu->flags |= MENU_ROOT; for (child = menu->list; child; child = child->next) fixup_rootmenu(child); } diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 13eafefb16923cd25f0c08c150b6c1f21d5698b8..0a4e0eb6580c3606f5c70c90f0ee98b5459f9906 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -283,7 +283,7 @@ struct menu *menu_get_parent_menu(struct menu *menu) for (; menu != &rootmenu; menu = menu->parent) { type = menu->prompt ? menu->prompt->type : 0; - if (type == P_MENU || type == P_ROOTMENU) + if (type == P_MENU) break; } return menu; diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index df1577f4b6d729d70dd93174a98b06b1af4ecf9b..2798dd60b5265bbee6ac9f5454b1a4c4fd8a89a8 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -65,11 +65,11 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu) switch (mode) { case menuMode: - if (type != P_ROOTMENU) + if (!(child->flags & MENU_ROOT)) goto hide; break; case symbolMode: - if (type == P_ROOTMENU) + if (child->flags & MENU_ROOT) goto hide; break; default: @@ -83,8 +83,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu) else item->testUpdateMenu(visible); - if (mode == fullMode || mode == menuMode || - (type != P_MENU && type != P_ROOTMENU)) + if (mode == fullMode || mode == menuMode || type != P_MENU) updateMenuList(item, child); else updateMenuList(item, 0); @@ -140,7 +139,6 @@ void ConfigItem::updateMenu(void) if (prop) switch (prop->type) { case P_MENU: - case P_ROOTMENU: if (list->mode == singleMode || list->mode == symbolMode) { /* a menuconfig entry is displayed differently * depending whether it's at the view root or a child. @@ -172,6 +170,7 @@ void ConfigItem::updateMenu(void) char ch; if (!sym_is_changable(sym) && !list->showAll) { + setPixmap(promptColIdx, 0); setText(noColIdx, 0); setText(modColIdx, 0); setText(yesColIdx, 0); @@ -288,7 +287,7 @@ void ConfigItem::init(void) ConfigItem::~ConfigItem(void) { if (menu) { - ConfigItem** ip = &(ConfigItem*)menu->data; + ConfigItem** ip = (ConfigItem**)&menu->data; for (; *ip; ip = &(*ip)->nextItem) { if (*ip == this) { *ip = nextItem; @@ -333,7 +332,7 @@ ConfigList::ConfigList(ConfigView* p, ConfigMainWindow* cv) updateAll(false), symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), - menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), + menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), showAll(false), showName(false), showRange(false), showData(false), rootEntry(0) { @@ -392,7 +391,7 @@ void ConfigList::updateSelection(void) if (!menu) return; type = menu->prompt ? menu->prompt->type : P_UNKNOWN; - if (mode == menuMode && (type == P_MENU || type == P_ROOTMENU)) + if (mode == menuMode && type == P_MENU) emit menuSelected(menu); } @@ -403,7 +402,8 @@ void ConfigList::updateList(ConfigItem* item) if (!rootEntry) goto update; - if ((mode == singleMode || mode == symbolMode) && rootEntry != &rootmenu) { + if (rootEntry != &rootmenu && (mode == singleMode || + (mode == symbolMode && rootEntry->parent != &rootmenu))) { item = firstChild(); if (!item) item = new ConfigItem(this, 0, true); @@ -507,7 +507,7 @@ void ConfigList::setRootMenu(struct menu *menu) if (rootEntry == menu) return; type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN; - if (type != P_MENU && type != P_ROOTMENU) + if (type != P_MENU) return; updateMenuList(this, 0); rootEntry = menu; @@ -518,13 +518,12 @@ void ConfigList::setRootMenu(struct menu *menu) void ConfigList::setParentMenu(void) { ConfigItem* item; - struct menu *oldroot, *newroot; + struct menu *oldroot; oldroot = rootEntry; - newroot = menu_get_parent_menu(oldroot); - if (newroot == oldroot) + if (rootEntry == &rootmenu) return; - setRootMenu(newroot); + setRootMenu(menu_get_parent_menu(rootEntry->parent)); QListViewItemIterator it(this); for (; (item = (ConfigItem*)it.current()); it++) { @@ -566,7 +565,8 @@ void ConfigList::keyPressEvent(QKeyEvent* ev) if (!menu) break; type = menu->prompt ? menu->prompt->type : P_UNKNOWN; - if ((type == P_MENU || type == P_ROOTMENU) && mode != fullMode) { + if (type == P_MENU && rootEntry != menu && + mode != fullMode && mode != menuMode) { emit menuSelected(menu); break; } @@ -601,6 +601,7 @@ void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e) QPoint p(contentsToViewport(e->pos())); ConfigItem* item = (ConfigItem*)itemAt(p); struct menu *menu; + enum prop_type ptype; const QPixmap* pm; int idx, x; @@ -617,14 +618,17 @@ void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e) int off = header()->sectionPos(0) + itemMargin() + treeStepSize() * (item->depth() + (rootIsDecorated() ? 1 : 0)); if (x >= off && x < off + pm->width()) { - if (item->goParent) + if (item->goParent) { emit parentSelected(); - else if (!menu) break; - else if (menu->sym) - changeValue(item); - else + } else if (!menu) + break; + ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; + if (ptype == P_MENU && rootEntry != menu && + mode != fullMode && mode != menuMode) emit menuSelected(menu); + else + changeValue(item); } } break; @@ -671,8 +675,7 @@ void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e) if (!menu) goto skip; ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; - if ((ptype == P_ROOTMENU || ptype == P_MENU) && - (mode == singleMode || mode == symbolMode)) + if (ptype == P_MENU && (mode == singleMode || mode == symbolMode)) emit menuSelected(menu); else if (menu->sym) changeValue(item); @@ -880,7 +883,6 @@ ConfigMainWindow::ConfigMainWindow(void) connect(menuList, SIGNAL(gotFocus(void)), SLOT(listFocusChanged(void))); - //showFullView(); showSplitView(); } @@ -1133,6 +1135,8 @@ void ConfigMainWindow::setShowName(bool b) return; configList->showName = b; configList->reinit(); + menuList->showName = b; + menuList->reinit(); } void ConfigMainWindow::setShowRange(bool b) @@ -1141,6 +1145,8 @@ void ConfigMainWindow::setShowRange(bool b) return; configList->showRange = b; configList->reinit(); + menuList->showRange = b; + menuList->reinit(); } void ConfigMainWindow::setShowData(bool b) @@ -1149,6 +1155,8 @@ void ConfigMainWindow::setShowData(bool b) return; configList->showData = b; configList->reinit(); + menuList->showData = b; + menuList->reinit(); } /* @@ -1206,12 +1214,25 @@ void ConfigMainWindow::showAbout(void) void fixup_rootmenu(struct menu *menu) { struct menu *child; + static int menu_cnt = 0; - if (!menu->prompt || menu->prompt->type != P_MENU) - return; - menu->prompt->type = P_ROOTMENU; - for (child = menu->list; child; child = child->next) - fixup_rootmenu(child); + menu->flags |= MENU_ROOT; + for (child = menu->list; child; child = child->next) { + if (child->prompt && child->prompt->type == P_MENU) { + menu_cnt++; + fixup_rootmenu(child); + menu_cnt--; + } else if (!menu_cnt) + fixup_rootmenu(child); + } +} + +static const char *progname; + +static void usage(void) +{ + printf("%s <config>\n", progname); + exit(0); } int main(int ac, char** av) @@ -1223,23 +1244,23 @@ int main(int ac, char** av) kconfig_load(); #endif + progname = av[0]; configApp = new QApplication(ac, av); #if QT_VERSION >= 300 configSettings = new QSettings; #endif if (ac > 1 && av[1][0] == '-') { switch (av[1][1]) { - case 'a': - //showAll = 1; - break; case 'h': case '?': - printf("%s <config>\n", av[0]); - exit(0); + usage(); } name = av[2]; } else name = av[1]; + if (!name) + usage(); + conf_parse(name); fixup_rootmenu(&rootmenu); conf_read(NULL); diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 6ed5a0ceb90f48ec1321b6f393d1d577f2dcd8fe..c548884b4bca12d22faea6ecef23a36b5028d709 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -108,7 +108,7 @@ public slots: QPixmap symbolYesPix, symbolModPix, symbolNoPix; QPixmap choiceYesPix, choiceNoPix; - QPixmap menuPix, menuInvPix, menuBackPix; + QPixmap menuPix, menuInvPix, menuBackPix, voidPix; bool showAll, showName, showRange, showData; enum listMode mode; diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index a971c4d52c99dd2ea15b02e4668b3b600dd7893c..b10c7c4550881bac65c57ea6a1802c07526b6b4c 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -616,8 +616,6 @@ const char *prop_get_type_name(enum prop_type type) return "comment"; case P_MENU: return "menu"; - case P_ROOTMENU: - return "rootmenu"; case P_DEFAULT: return "default"; case P_CHOICE: