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/openuri.h"
|
||||
#include "pbd/strsplit.h"
|
||||
#include "pbd/unwind.h"
|
||||
|
||||
#include "ardour/filesystem_paths.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
|
||||
if (owner.filter_string.empty () || !(*iter)[columns.bindable]) {
|
||||
if (owner.filter_string.empty ()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// search name
|
||||
std::string name = (*iter)[columns.name];
|
||||
boost::to_lower (name);
|
||||
if (name.find (owner.filter_string) != std::string::npos) {
|
||||
return true;
|
||||
if (!(*iter)[columns.bindable]) {
|
||||
|
||||
for (auto const & c : iter->children()) {
|
||||
if (visible_func (c)) {
|
||||
TreeModel::Path p (data_model->get_path (iter));
|
||||
view.expand_row (p, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// search binding
|
||||
std::string binding = (*iter)[columns.binding];
|
||||
boost::to_lower (binding);
|
||||
if (binding.find (owner.filter_string) != std::string::npos) {
|
||||
return true;
|
||||
if (owner.filter_string.find ("k:") == string::npos) {
|
||||
// search name
|
||||
std::string name = (*iter)[columns.name];
|
||||
boost::to_lower (name);
|
||||
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;
|
||||
|
@ -90,7 +90,7 @@ private:
|
||||
std::string name;
|
||||
Gtkmm2ext::Bindings* bindings;
|
||||
Gtk::ScrolledWindow scroller;
|
||||
Gtk::TreeView view;
|
||||
mutable Gtk::TreeView view;
|
||||
Glib::RefPtr<Gtk::TreeStore> data_model;
|
||||
Glib::RefPtr<Gtk::TreeModelFilter> filter;
|
||||
Glib::RefPtr<Gtk::TreeModelSort> sorted_filter;
|
||||
|
Loading…
Reference in New Issue
Block a user