tweak shortcut window so that the tree is expanded to actually show search results
This commit is contained in:
parent
febc345414
commit
40a0ad2299
@ -47,6 +47,7 @@
|
|||||||
#include "pbd/error.h"
|
#include "pbd/error.h"
|
||||||
#include "pbd/openuri.h"
|
#include "pbd/openuri.h"
|
||||||
#include "pbd/strsplit.h"
|
#include "pbd/strsplit.h"
|
||||||
|
#include "pbd/unwind.h"
|
||||||
|
|
||||||
#include "ardour/filesystem_paths.h"
|
#include "ardour/filesystem_paths.h"
|
||||||
#include "ardour/profile.h"
|
#include "ardour/profile.h"
|
||||||
@ -492,22 +493,38 @@ KeyEditor::Tab::visible_func(const Gtk::TreeModel::const_iterator& iter) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// never filter when search string is empty or item is a category
|
// never filter when search string is empty or item is a category
|
||||||
if (owner.filter_string.empty () || !(*iter)[columns.bindable]) {
|
if (owner.filter_string.empty ()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// search name
|
if (!(*iter)[columns.bindable]) {
|
||||||
std::string name = (*iter)[columns.name];
|
|
||||||
boost::to_lower (name);
|
for (auto const & c : iter->children()) {
|
||||||
if (name.find (owner.filter_string) != std::string::npos) {
|
if (visible_func (c)) {
|
||||||
return true;
|
TreeModel::Path p (data_model->get_path (iter));
|
||||||
|
view.expand_row (p, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// search binding
|
if (owner.filter_string.find ("k:") == string::npos) {
|
||||||
std::string binding = (*iter)[columns.binding];
|
// search name
|
||||||
boost::to_lower (binding);
|
std::string name = (*iter)[columns.name];
|
||||||
if (binding.find (owner.filter_string) != std::string::npos) {
|
boost::to_lower (name);
|
||||||
return true;
|
if (name.find (owner.filter_string) != std::string::npos) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
string s = owner.filter_string.substr (2);
|
||||||
|
// search binding
|
||||||
|
std::string binding = (*iter)[columns.binding];
|
||||||
|
boost::to_lower (binding);
|
||||||
|
if (binding.find (s) != std::string::npos) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -90,7 +90,7 @@ private:
|
|||||||
std::string name;
|
std::string name;
|
||||||
Gtkmm2ext::Bindings* bindings;
|
Gtkmm2ext::Bindings* bindings;
|
||||||
Gtk::ScrolledWindow scroller;
|
Gtk::ScrolledWindow scroller;
|
||||||
Gtk::TreeView view;
|
mutable Gtk::TreeView view;
|
||||||
Glib::RefPtr<Gtk::TreeStore> data_model;
|
Glib::RefPtr<Gtk::TreeStore> data_model;
|
||||||
Glib::RefPtr<Gtk::TreeModelFilter> filter;
|
Glib::RefPtr<Gtk::TreeModelFilter> filter;
|
||||||
Glib::RefPtr<Gtk::TreeModelSort> sorted_filter;
|
Glib::RefPtr<Gtk::TreeModelSort> sorted_filter;
|
||||||
|
Loading…
Reference in New Issue
Block a user