mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
allow StringCompletion to match anywhere
This commit is contained in:
parent
23c7d564e2
commit
4eb9285659
2 changed files with 18 additions and 1 deletions
|
|
@ -38,6 +38,8 @@ class LIBGTKMM2EXT_API StringCompletion : public Gtk::EntryCompletion
|
||||||
void delete_string (Glib::ustring str);
|
void delete_string (Glib::ustring str);
|
||||||
void insert_vector (std::vector<Glib::ustring> strVector, bool norepeat = true);
|
void insert_vector (std::vector<Glib::ustring> strVector, bool norepeat = true);
|
||||||
|
|
||||||
|
void set_match_anywhere ();
|
||||||
|
|
||||||
static Glib::RefPtr<StringCompletion> create();
|
static Glib::RefPtr<StringCompletion> create();
|
||||||
static Glib::RefPtr<StringCompletion> create (std::vector<Glib::ustring> strVector, bool norepeat = true);
|
static Glib::RefPtr<StringCompletion> create (std::vector<Glib::ustring> strVector, bool norepeat = true);
|
||||||
|
|
||||||
|
|
@ -57,6 +59,8 @@ class LIBGTKMM2EXT_API StringCompletion : public Gtk::EntryCompletion
|
||||||
CompletionRecord m_completionRecord;
|
CompletionRecord m_completionRecord;
|
||||||
bool _delete_string (const Gtk::TreeModel::iterator &iter, const Glib::ustring &str);
|
bool _delete_string (const Gtk::TreeModel::iterator &iter, const Glib::ustring &str);
|
||||||
bool _string_exists (const Glib::ustring &str);
|
bool _string_exists (const Glib::ustring &str);
|
||||||
|
bool match_anywhere (Glib::ustring const & str, Gtk::TreeModel::const_iterator const & iter);
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,3 +105,16 @@ StringCompletion::insert_vector (std::vector<Glib::ustring> strVector, bool nore
|
||||||
this->add_string (s, norepeat);
|
this->add_string (s, norepeat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
StringCompletion::match_anywhere (Glib::ustring const & str, Gtk::TreeModel::const_iterator const & iter)
|
||||||
|
{
|
||||||
|
Glib::ustring r = Gtk::TreeModel::Row (*iter)[m_completionRecord.col_text];
|
||||||
|
return r.find (str) != Glib::ustring::npos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
StringCompletion::set_match_anywhere ()
|
||||||
|
{
|
||||||
|
set_match_func (sigc::mem_fun (this, &StringCompletion::match_anywhere));
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue