From 6bd9ca4cd2bdb5dc6588718c0937073d7294a19b Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Mon, 10 Feb 2014 15:16:21 +0000 Subject: [PATCH] Mini editor filter fixes. Stopped flickering on toggle, and selection of other plugins is now disabled while the filter is active. --- src/gui/editor.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/editor.cpp b/src/gui/editor.cpp index d778002d..fce117dd 100644 --- a/src/gui/editor.cpp +++ b/src/gui/editor.cpp @@ -317,16 +317,15 @@ void MiniEditor::OnPluginSelect(wxListEvent& event) { void MiniEditor::OnFilterToggle(wxCommandEvent& event) { //First need to merge the base and edited plugin lists so that the right priority values get displayed. - list plugins; - for (list::const_iterator it = _basePlugins.begin(); it != _basePlugins.end(); ++it) { - plugins.push_back(*it); - } + list plugins(_basePlugins); for (list::const_iterator it = _editedPlugins.begin(); it != _editedPlugins.end(); ++it) { list::iterator pos = std::find(plugins.begin(), plugins.end(), *it); pos->MergeMetadata(*it); } + 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); @@ -353,6 +352,7 @@ 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) { @@ -373,6 +373,7 @@ void MiniEditor::OnFilterToggle(wxCommandEvent& event) { //Now re-select the current plugin in the list. pluginList->Select(pluginList->FindItem(-1, pluginText->GetLabelText())); + Thaw(); } void MiniEditor::OnRowSelect(wxListEvent& event) {