Add a KeyframeTreeStore::description_sorter() to go with the time_sorter().
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sun, 27 Jan 2008 10:13:32 +0000 (10:13 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sun, 27 Jan 2008 10:13:32 +0000 (10:13 +0000)
git-svn-id: http://svn.voria.com/code@1504 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/gtkmm/keyframetreestore.cpp
synfig-studio/trunk/src/gtkmm/keyframetreestore.h

index 99264b9..ddcd764 100644 (file)
@@ -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)
 {
index 75caf83..2101820 100644 (file)
@@ -196,6 +196,7 @@ public:
        static Glib::RefPtr<KeyframeTreeStore> create(etl::loose_handle<synfigapp::CanvasInterface> 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