From: dooglus Date: Mon, 14 Jan 2008 23:02:11 +0000 (+0000) Subject: When the user types in the History dialog, search for any text in the 'name' column... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=1745915d4d6e1100b381a64d4cfd595165dbf037;p=synfig.git When the user types in the History dialog, search for any text in the 'name' column that matches the text. Previously it was only searching for names matching at the beginning. git-svn-id: http://svn.voria.com/code@1366 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/gtkmm/dock_history.cpp b/synfig-studio/trunk/src/gtkmm/dock_history.cpp index d124cd1..9e9a5ba 100644 --- a/synfig-studio/trunk/src/gtkmm/dock_history.cpp +++ b/synfig-studio/trunk/src/gtkmm/dock_history.cpp @@ -228,6 +228,9 @@ Dock_History::create_action_tree() action_tree->append_column(*column); } + action_tree->set_enable_search(true); + action_tree->set_search_column(history_tree_model.name); + action_tree->set_search_equal_func(sigc::ptr_fun(&studio::HistoryTreeStore::search_func)); action_tree->set_rules_hint(); // action_tree->signal_row_activated().connect(sigc::mem_fun(*this,&Dock_History::on_row_activate)); diff --git a/synfig-studio/trunk/src/gtkmm/historytreestore.cpp b/synfig-studio/trunk/src/gtkmm/historytreestore.cpp index ad4fe57..b9573c8 100644 --- a/synfig-studio/trunk/src/gtkmm/historytreestore.cpp +++ b/synfig-studio/trunk/src/gtkmm/historytreestore.cpp @@ -215,3 +215,15 @@ HistoryTreeStore::on_action_status_changed(etl::handle&,int,const Glib::ustring& x,const Gtk::TreeModel::iterator& iter) +{ + const Model model; + + Glib::ustring substr(x.uppercase()); + Glib::ustring name((*iter)[model.name]); + name=name.uppercase(); + + return name.find(substr)==Glib::ustring::npos; +} diff --git a/synfig-studio/trunk/src/gtkmm/historytreestore.h b/synfig-studio/trunk/src/gtkmm/historytreestore.h index 4c4e23a..3674faf 100644 --- a/synfig-studio/trunk/src/gtkmm/historytreestore.h +++ b/synfig-studio/trunk/src/gtkmm/historytreestore.h @@ -136,6 +136,8 @@ public: void insert_action(Gtk::TreeRow row,etl::handle action, bool is_active=true, bool is_undo=true, bool is_redo=false); + static bool search_func(const Glib::RefPtr&,int,const Glib::ustring&,const TreeModel::iterator&); + /* -- ** -- P R O T E C T E D M E T H O D S ----------------------------------- */