From 8603ab002ab29f10c022ae6ab08b0c87ea8ded53 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Mon, 10 Feb 2014 15:58:57 +0000 Subject: [PATCH] Mini editor filter improvements. Now doesn't fight with the plugin addition toggle. Also now displays only those plugins that the selected plugin can validly load after, and displays plugins that have a BSA that may contain conflicting resources, if the selected plugin has a BSA. --- src/gui/editor.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/gui/editor.cpp b/src/gui/editor.cpp index 8f8f313c..ccf9175d 100644 --- a/src/gui/editor.cpp +++ b/src/gui/editor.cpp @@ -323,18 +323,27 @@ void MiniEditor::OnFilterToggle(wxCommandEvent& event) { pos->MergeMetadata(*it); } + //Disable list selection. + if (event.IsChecked() || addBtn->GetValue()) + Unbind(wxEVT_LIST_ITEM_SELECTED, &MiniEditor::OnPluginSelect, this, LIST_Plugins); + else + Bind(wxEVT_LIST_ITEM_SELECTED, &MiniEditor::OnPluginSelect, this, LIST_Plugins); + Freeze(); if (event.IsChecked()) { - Unbind(wxEVT_LIST_ITEM_SELECTED, &MiniEditor::OnPluginSelect, this, LIST_Plugins); boss::Plugin plugin(string(pluginText->GetLabelText().ToUTF8())); list::const_iterator pos = std::find(plugins.begin(), plugins.end(), plugin); if (pos != plugins.end()) { pluginList->DeleteAllItems(); + bool loadsBSA = pos->LoadsBSA(_game); + int i = 0; for (list::const_iterator it = plugins.begin(); it != plugins.end(); ++it) { - if (pos->DoFormIDsOverlap(*it)) { + //Want to filter to show only those the selected plugin can load after validly, and which also either conflict with it, + //or which load a BSA (if the selected plugin loads a BSA). + if (!it->MustLoadAfter(*pos) && (pos->DoFormIDsOverlap(*it) || (loadsBSA && it->LoadsBSA(_game)))) { pluginList->InsertItem(i, FromUTF8(it->Name())); pluginList->SetItem(i, 1, FromUTF8(boss::IntToString(it->Priority()))); if (it->FormIDs().empty()) { @@ -352,7 +361,6 @@ void MiniEditor::OnFilterToggle(wxCommandEvent& event) { } } else { - Bind(wxEVT_LIST_ITEM_SELECTED, &MiniEditor::OnPluginSelect, this, LIST_Plugins); pluginList->DeleteAllItems(); int i = 0; for (list::const_iterator it = plugins.begin(); it != plugins.end(); ++it) { @@ -403,7 +411,7 @@ void MiniEditor::OnRowSelect(wxListEvent& event) { void MiniEditor::OnAddRowToggle(wxCommandEvent& event) { //This exists because drag 'n' drop selects plugins when they're clicked on, and we //don't want them being loaded. - if (event.IsChecked()) + if (event.IsChecked() || filterCheckbox->IsChecked()) Unbind(wxEVT_LIST_ITEM_SELECTED, &MiniEditor::OnPluginSelect, this, LIST_Plugins); else Bind(wxEVT_LIST_ITEM_SELECTED, &MiniEditor::OnPluginSelect, this, LIST_Plugins);