From: dooglus Date: Sun, 27 Jan 2008 10:13:32 +0000 (+0000) Subject: Add a KeyframeTreeStore::description_sorter() to go with the time_sorter(). X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=9a4da9a595ff61b8f1a365b9d5791808c8124ef4;p=synfig.git Add a KeyframeTreeStore::description_sorter() to go with the time_sorter(). git-svn-id: http://svn.voria.com/code@1504 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/gtkmm/keyframetreestore.cpp b/synfig-studio/trunk/src/gtkmm/keyframetreestore.cpp index 99264b9..ddcd764 100644 --- a/synfig-studio/trunk/src/gtkmm/keyframetreestore.cpp +++ b/synfig-studio/trunk/src/gtkmm/keyframetreestore.cpp @@ -308,6 +308,20 @@ KeyframeTreeStore::time_sorter(const Gtk::TreeModel::iterator &rhs,const Gtk::Tr return 0; } +int +KeyframeTreeStore::description_sorter(const Gtk::TreeModel::iterator &rhs,const Gtk::TreeModel::iterator &lhs) +{ + const Model model; + + _keyframe_iterator *rhs_iter(static_cast<_keyframe_iterator*>(rhs->gobj()->user_data)); + _keyframe_iterator *lhs_iter(static_cast<_keyframe_iterator*>(lhs->gobj()->user_data)); + + int comp = rhs_iter->iter->get_description().compare(lhs_iter->iter->get_description()); + if (comp > 0) return 1; + if (comp < 0) return -1; + return 0; +} + void KeyframeTreeStore::set_value_impl(const Gtk::TreeModel::iterator& row, int column, const Glib::ValueBase& value) { diff --git a/synfig-studio/trunk/src/gtkmm/keyframetreestore.h b/synfig-studio/trunk/src/gtkmm/keyframetreestore.h index 75caf83..2101820 100644 --- a/synfig-studio/trunk/src/gtkmm/keyframetreestore.h +++ b/synfig-studio/trunk/src/gtkmm/keyframetreestore.h @@ -196,6 +196,7 @@ public: static Glib::RefPtr create(etl::loose_handle canvas_interface_); static int time_sorter(const Gtk::TreeModel::iterator &rhs,const Gtk::TreeModel::iterator &lhs); + static int description_sorter(const Gtk::TreeModel::iterator &rhs,const Gtk::TreeModel::iterator &lhs); }; // END of class KeyframeTreeStore