+
+ // search binding
+ std::string binding = (*iter)[columns.binding];
+ boost::to_lower (binding);
+ if (binding.find (owner.filter_string) != std::string::npos) {
+ return true;
+ }
+
+ return false;
+}
+
+TreeModel::iterator
+KeyEditor::Tab::find_action_path (TreeModel::const_iterator begin, TreeModel::const_iterator end, const std::string& action_path) const
+{
+ if (!begin) {
+ return end;
+ }
+
+ for (TreeModel::iterator it = begin; it != end; ++it) {
+ if (it->children()) {
+ TreeModel::iterator jt = find_action_path (it->children().begin(), it->children().end(), action_path);
+ if (jt != it->children().end()) {
+ return jt;
+ }
+ }
+ const std::string& path = (*it)[columns.path];
+ if (action_path.compare(path) == 0) {
+ return it;
+ }
+ }
+ return end;
+}
+
+void
+KeyEditor::reset ()
+{
+ Keyboard::the_keyboard().reset_bindings ();
+ refresh ();
+}
+
+void
+KeyEditor::refresh ()
+{
+ for (Tabs::iterator t = tabs.begin(); t != tabs.end(); ++t) {
+ (*t)->view.get_selection()->unselect_all ();
+ (*t)->populate ();
+ }
+}
+
+KeyEditor::Tab*
+KeyEditor::current_tab ()
+{
+ return dynamic_cast<Tab*> (notebook.get_nth_page (notebook.get_current_page()));
+}
+
+void
+KeyEditor::search_string_updated (const std::string& filter)
+{
+ filter_string = boost::to_lower_copy(filter);
+ KeyEditor::Tab* tab = current_tab ();
+ if (tab) {
+ tab->filter->refilter ();
+ }
+}
+
+void
+KeyEditor::print () const
+{
+ stringstream sstr;
+ Bindings::save_all_bindings_as_html (sstr);
+
+ if (sstr.str().empty()) {
+ return;
+ }
+
+
+ gchar* file_name;
+ GError *err = NULL;
+ gint fd;
+
+ if ((fd = g_file_open_tmp ("akprintXXXXXX.html", &file_name, &err)) < 0) {
+ if (err) {
+ error << string_compose (_("Could not open temporary file to print bindings (%1)"), err->message) << endmsg;
+ g_error_free (err);
+ }
+ return;
+ }
+
+#ifdef PLATFORM_WINDOWS
+ ::close (fd);
+#endif
+
+ err = NULL;
+
+ if (!g_file_set_contents (file_name, sstr.str().c_str(), sstr.str().size(), &err)) {
+#ifndef PLATFORM_WINDOWS
+ ::close (fd);
+#endif
+ g_unlink (file_name);
+ if (err) {
+ error << string_compose (_("Could not save bindings to file (%1)"), err->message) << endmsg;
+ g_error_free (err);
+ }
+ return;
+ }
+
+#ifndef PLATFORM_WINDOWS
+ ::close (fd);
+#endif
+
+ PBD::open_uri (string_compose ("file:///%1", file_name));