diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2016-04-22 10:43:13 +0200 |
---|---|---|
committer | Rémi Verschelde <remi@verschelde.fr> | 2016-04-22 10:43:13 +0200 |
commit | 79df52b57e92c7f30ee8b01c55b7cc7d0a0b2215 (patch) | |
tree | 632a31a3552d217e3a6b8ab30c61c48e599082b6 /tools/editor | |
parent | c0ec7e933ac6b6419e564b276b49c8d9a6d03f30 (diff) | |
parent | d75856146cccd9547eb41ce64bca95cd71f6fb66 (diff) |
Merge pull request #4388 from kurikaesu/theme-editor-remove-class-items
Adds a remove class item option in the theme editor.
Diffstat (limited to 'tools/editor')
-rw-r--r-- | tools/editor/plugins/theme_editor_plugin.cpp | 64 | ||||
-rw-r--r-- | tools/editor/plugins/theme_editor_plugin.h | 1 |
2 files changed, 64 insertions, 1 deletions
diff --git a/tools/editor/plugins/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp index 938b8344ba..e792a2a9e2 100644 --- a/tools/editor/plugins/theme_editor_plugin.cpp +++ b/tools/editor/plugins/theme_editor_plugin.cpp @@ -398,7 +398,55 @@ void ThemeEditor::_dialog_cbk() { } - } break; + } break; + case POPUP_CLASS_REMOVE: { + StringName fromtype = type_edit->get_text(); + List<StringName> names; + + { + names.clear(); + Theme::get_default()->get_icon_list(fromtype,&names); + for(List<StringName>::Element *E=names.front();E;E=E->next()) { + theme->clear_icon(E->get(),fromtype); + + } + + } + { + names.clear(); + Theme::get_default()->get_stylebox_list(fromtype,&names); + for(List<StringName>::Element *E=names.front();E;E=E->next()) { + theme->clear_stylebox(E->get(),fromtype); + + } + + } + { + names.clear(); + Theme::get_default()->get_font_list(fromtype,&names); + for(List<StringName>::Element *E=names.front();E;E=E->next()) { + theme->clear_font(E->get(),fromtype); + + } + } + { + names.clear(); + Theme::get_default()->get_color_list(fromtype,&names); + for(List<StringName>::Element *E=names.front();E;E=E->next()) { + theme->clear_color(E->get(),fromtype); + + } + } + { + names.clear(); + Theme::get_default()->get_constant_list(fromtype,&names); + for(List<StringName>::Element *E=names.front();E;E=E->next()) { + theme->clear_constant(E->get(),fromtype); + + } + } + + }break; } } @@ -453,6 +501,19 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { base_theme=theme; + } else if (p_option==POPUP_CLASS_REMOVE) { + + add_del_dialog->set_title("Remove All Items"); + add_del_dialog->get_ok()->set_text("Remove All"); + add_del_dialog->popup_centered(Size2(240,85)); + + base_theme=Theme::get_default(); + + type_select->hide(); + name_select_label->hide(); + type_select_label->hide(); + name_edit->hide(); + name_menu->hide(); } popup_mode=p_option; @@ -538,6 +599,7 @@ ThemeEditor::ThemeEditor() { theme_menu->get_popup()->add_item("Add Item",POPUP_ADD); theme_menu->get_popup()->add_item("Add Class Items",POPUP_CLASS_ADD); theme_menu->get_popup()->add_item("Remove Item",POPUP_REMOVE); + theme_menu->get_popup()->add_item("Remove Class Items",POPUP_CLASS_REMOVE); theme_menu->get_popup()->add_separator(); theme_menu->get_popup()->add_item("Create Template",POPUP_CREATE_TEMPLATE); hb_menu->add_child(theme_menu); diff --git a/tools/editor/plugins/theme_editor_plugin.h b/tools/editor/plugins/theme_editor_plugin.h index 52c4aed839..49d5ae3096 100644 --- a/tools/editor/plugins/theme_editor_plugin.h +++ b/tools/editor/plugins/theme_editor_plugin.h @@ -67,6 +67,7 @@ class ThemeEditor : public Control { POPUP_ADD, POPUP_CLASS_ADD, POPUP_REMOVE, + POPUP_CLASS_REMOVE, POPUP_CREATE_TEMPLATE }; |