diff options
Diffstat (limited to 'scripts/kconfig/gconf.c')
| -rw-r--r-- | scripts/kconfig/gconf.c | 113 |
1 files changed, 37 insertions, 76 deletions
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index 65464366fe38..bef10411837f 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c | |||
| @@ -30,13 +30,16 @@ enum { | |||
| 30 | SINGLE_VIEW, SPLIT_VIEW, FULL_VIEW | 30 | SINGLE_VIEW, SPLIT_VIEW, FULL_VIEW |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | enum { | ||
| 34 | OPT_NORMAL, OPT_ALL, OPT_PROMPT | ||
| 35 | }; | ||
| 36 | |||
| 33 | static gint view_mode = FULL_VIEW; | 37 | static gint view_mode = FULL_VIEW; |
| 34 | static gboolean show_name = TRUE; | 38 | static gboolean show_name = TRUE; |
| 35 | static gboolean show_range = TRUE; | 39 | static gboolean show_range = TRUE; |
| 36 | static gboolean show_value = TRUE; | 40 | static gboolean show_value = TRUE; |
| 37 | static gboolean show_all = FALSE; | ||
| 38 | static gboolean show_debug = FALSE; | ||
| 39 | static gboolean resizeable = FALSE; | 41 | static gboolean resizeable = FALSE; |
| 42 | static int opt_mode = OPT_NORMAL; | ||
| 40 | 43 | ||
| 41 | GtkWidget *main_wnd = NULL; | 44 | GtkWidget *main_wnd = NULL; |
| 42 | GtkWidget *tree1_w = NULL; // left frame | 45 | GtkWidget *tree1_w = NULL; // left frame |
| @@ -76,36 +79,7 @@ static void conf_changed(void); | |||
| 76 | 79 | ||
| 77 | /* Helping/Debugging Functions */ | 80 | /* Helping/Debugging Functions */ |
| 78 | 81 | ||
| 79 | 82 | const char *dbg_sym_flags(int val) | |
| 80 | const char *dbg_print_stype(int val) | ||
| 81 | { | ||
| 82 | static char buf[256]; | ||
| 83 | |||
| 84 | bzero(buf, 256); | ||
| 85 | |||
| 86 | if (val == S_UNKNOWN) | ||
| 87 | strcpy(buf, "unknown"); | ||
| 88 | if (val == S_BOOLEAN) | ||
| 89 | strcpy(buf, "boolean"); | ||
| 90 | if (val == S_TRISTATE) | ||
| 91 | strcpy(buf, "tristate"); | ||
| 92 | if (val == S_INT) | ||
| 93 | strcpy(buf, "int"); | ||
| 94 | if (val == S_HEX) | ||
| 95 | strcpy(buf, "hex"); | ||
| 96 | if (val == S_STRING) | ||
| 97 | strcpy(buf, "string"); | ||
| 98 | if (val == S_OTHER) | ||
| 99 | strcpy(buf, "other"); | ||
| 100 | |||
| 101 | #ifdef DEBUG | ||
| 102 | printf("%s", buf); | ||
| 103 | #endif | ||
| 104 | |||
| 105 | return buf; | ||
| 106 | } | ||
| 107 | |||
| 108 | const char *dbg_print_flags(int val) | ||
| 109 | { | 83 | { |
| 110 | static char buf[256]; | 84 | static char buf[256]; |
| 111 | 85 | ||
| @@ -131,40 +105,10 @@ const char *dbg_print_flags(int val) | |||
| 131 | strcat(buf, "auto/"); | 105 | strcat(buf, "auto/"); |
| 132 | 106 | ||
| 133 | buf[strlen(buf) - 1] = '\0'; | 107 | buf[strlen(buf) - 1] = '\0'; |
| 134 | #ifdef DEBUG | ||
| 135 | printf("%s", buf); | ||
| 136 | #endif | ||
| 137 | |||
| 138 | return buf; | ||
| 139 | } | ||
| 140 | |||
| 141 | const char *dbg_print_ptype(int val) | ||
| 142 | { | ||
| 143 | static char buf[256]; | ||
| 144 | |||
| 145 | bzero(buf, 256); | ||
| 146 | |||
| 147 | if (val == P_UNKNOWN) | ||
| 148 | strcpy(buf, "unknown"); | ||
| 149 | if (val == P_PROMPT) | ||
| 150 | strcpy(buf, "prompt"); | ||
| 151 | if (val == P_COMMENT) | ||
| 152 | strcpy(buf, "comment"); | ||
| 153 | if (val == P_MENU) | ||
| 154 | strcpy(buf, "menu"); | ||
| 155 | if (val == P_DEFAULT) | ||
| 156 | strcpy(buf, "default"); | ||
| 157 | if (val == P_CHOICE) | ||
| 158 | strcpy(buf, "choice"); | ||
| 159 | |||
| 160 | #ifdef DEBUG | ||
| 161 | printf("%s", buf); | ||
| 162 | #endif | ||
| 163 | 108 | ||
| 164 | return buf; | 109 | return buf; |
| 165 | } | 110 | } |
| 166 | 111 | ||
| 167 | |||
| 168 | void replace_button_icon(GladeXML * xml, GdkDrawable * window, | 112 | void replace_button_icon(GladeXML * xml, GdkDrawable * window, |
| 169 | GtkStyle * style, gchar * btn_name, gchar ** xpm) | 113 | GtkStyle * style, gchar * btn_name, gchar ** xpm) |
| 170 | { | 114 | { |
| @@ -697,20 +641,29 @@ void on_show_data1_activate(GtkMenuItem * menuitem, gpointer user_data) | |||
| 697 | 641 | ||
| 698 | 642 | ||
| 699 | void | 643 | void |
| 700 | on_show_all_options1_activate(GtkMenuItem * menuitem, gpointer user_data) | 644 | on_set_option_mode1_activate(GtkMenuItem *menuitem, gpointer user_data) |
| 701 | { | 645 | { |
| 702 | show_all = GTK_CHECK_MENU_ITEM(menuitem)->active; | 646 | opt_mode = OPT_NORMAL; |
| 647 | gtk_tree_store_clear(tree2); | ||
| 648 | display_tree(&rootmenu); /* instead of update_tree to speed-up */ | ||
| 649 | } | ||
| 650 | |||
| 703 | 651 | ||
| 652 | void | ||
| 653 | on_set_option_mode2_activate(GtkMenuItem *menuitem, gpointer user_data) | ||
| 654 | { | ||
| 655 | opt_mode = OPT_ALL; | ||
| 704 | gtk_tree_store_clear(tree2); | 656 | gtk_tree_store_clear(tree2); |
| 705 | display_tree(&rootmenu); // instead of update_tree to speed-up | 657 | display_tree(&rootmenu); /* instead of update_tree to speed-up */ |
| 706 | } | 658 | } |
| 707 | 659 | ||
| 708 | 660 | ||
| 709 | void | 661 | void |
| 710 | on_show_debug_info1_activate(GtkMenuItem * menuitem, gpointer user_data) | 662 | on_set_option_mode3_activate(GtkMenuItem *menuitem, gpointer user_data) |
| 711 | { | 663 | { |
| 712 | show_debug = GTK_CHECK_MENU_ITEM(menuitem)->active; | 664 | opt_mode = OPT_PROMPT; |
| 713 | update_tree(&rootmenu, NULL); | 665 | gtk_tree_store_clear(tree2); |
| 666 | display_tree(&rootmenu); /* instead of update_tree to speed-up */ | ||
| 714 | } | 667 | } |
| 715 | 668 | ||
| 716 | 669 | ||
| @@ -1163,7 +1116,10 @@ static gchar **fill_row(struct menu *menu) | |||
| 1163 | g_strdup_printf("%s %s", _(menu_get_prompt(menu)), | 1116 | g_strdup_printf("%s %s", _(menu_get_prompt(menu)), |
| 1164 | sym && sym_has_value(sym) ? "(NEW)" : ""); | 1117 | sym && sym_has_value(sym) ? "(NEW)" : ""); |
| 1165 | 1118 | ||
| 1166 | if (show_all && !menu_is_visible(menu)) | 1119 | if (opt_mode == OPT_ALL && !menu_is_visible(menu)) |
| 1120 | row[COL_COLOR] = g_strdup("DarkGray"); | ||
| 1121 | else if (opt_mode == OPT_PROMPT && | ||
| 1122 | menu_has_prompt(menu) && !menu_is_visible(menu)) | ||
| 1167 | row[COL_COLOR] = g_strdup("DarkGray"); | 1123 | row[COL_COLOR] = g_strdup("DarkGray"); |
| 1168 | else | 1124 | else |
| 1169 | row[COL_COLOR] = g_strdup("Black"); | 1125 | row[COL_COLOR] = g_strdup("Black"); |
| @@ -1386,16 +1342,19 @@ static void update_tree(struct menu *src, GtkTreeIter * dst) | |||
| 1386 | menu2 ? menu_get_prompt(menu2) : "nil"); | 1342 | menu2 ? menu_get_prompt(menu2) : "nil"); |
| 1387 | #endif | 1343 | #endif |
| 1388 | 1344 | ||
| 1389 | if (!menu_is_visible(child1) && !show_all) { // remove node | 1345 | if ((opt_mode == OPT_NORMAL && !menu_is_visible(child1)) || |
| 1346 | (opt_mode == OPT_PROMPT && !menu_has_prompt(child1))) { | ||
| 1347 | |||
| 1348 | /* remove node */ | ||
| 1390 | if (gtktree_iter_find_node(dst, menu1) != NULL) { | 1349 | if (gtktree_iter_find_node(dst, menu1) != NULL) { |
| 1391 | memcpy(&tmp, child2, sizeof(GtkTreeIter)); | 1350 | memcpy(&tmp, child2, sizeof(GtkTreeIter)); |
| 1392 | valid = gtk_tree_model_iter_next(model2, | 1351 | valid = gtk_tree_model_iter_next(model2, |
| 1393 | child2); | 1352 | child2); |
| 1394 | gtk_tree_store_remove(tree2, &tmp); | 1353 | gtk_tree_store_remove(tree2, &tmp); |
| 1395 | if (!valid) | 1354 | if (!valid) |
| 1396 | return; // next parent | 1355 | return; /* next parent */ |
| 1397 | else | 1356 | else |
| 1398 | goto reparse; // next child | 1357 | goto reparse; /* next child */ |
| 1399 | } else | 1358 | } else |
| 1400 | continue; | 1359 | continue; |
| 1401 | } | 1360 | } |
| @@ -1464,17 +1423,19 @@ static void display_tree(struct menu *menu) | |||
| 1464 | && (tree == tree2)) | 1423 | && (tree == tree2)) |
| 1465 | continue; | 1424 | continue; |
| 1466 | 1425 | ||
| 1467 | if (menu_is_visible(child) || show_all) | 1426 | if ((opt_mode == OPT_NORMAL && menu_is_visible(child)) || |
| 1427 | (opt_mode == OPT_PROMPT && menu_has_prompt(child)) || | ||
| 1428 | (opt_mode == OPT_ALL)) | ||
| 1468 | place_node(child, fill_row(child)); | 1429 | place_node(child, fill_row(child)); |
| 1469 | #ifdef DEBUG | 1430 | #ifdef DEBUG |
| 1470 | printf("%*c%s: ", indent, ' ', menu_get_prompt(child)); | 1431 | printf("%*c%s: ", indent, ' ', menu_get_prompt(child)); |
| 1471 | printf("%s", child->flags & MENU_ROOT ? "rootmenu | " : ""); | 1432 | printf("%s", child->flags & MENU_ROOT ? "rootmenu | " : ""); |
| 1472 | dbg_print_ptype(ptype); | 1433 | printf("%s", prop_get_type_name(ptype)); |
| 1473 | printf(" | "); | 1434 | printf(" | "); |
| 1474 | if (sym) { | 1435 | if (sym) { |
| 1475 | dbg_print_stype(sym->type); | 1436 | printf("%s", sym_type_name(sym->type)); |
| 1476 | printf(" | "); | 1437 | printf(" | "); |
| 1477 | dbg_print_flags(sym->flags); | 1438 | printf("%s", dbg_sym_flags(sym->flags)); |
| 1478 | printf("\n"); | 1439 | printf("\n"); |
| 1479 | } else | 1440 | } else |
| 1480 | printf("\n"); | 1441 | printf("\n"); |
