2 * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef __gtk2_ardour_stripable_treemodel_h__
20 #define __gtk2_ardour_stripable_treemodel_h__
24 #include <boost/shared_ptr.hpp>
25 #include <boost/weak_ptr.hpp>
28 #include <gtkmm/treemodel.h>
36 class AxisViewProvider;
37 class StripableSorter;
39 class StripableTreeModel : public Gtk::TreeModel, public Glib::Object
42 StripableTreeModel (AxisViewProvider&);
43 virtual ~StripableTreeModel();
46 static Glib::RefPtr<StripableTreeModel> create (AxisViewProvider&);
47 void set_session (ARDOUR::Session&);
50 Gtk::TreeModelFlags get_flags_vfunc() const;
51 int get_n_columns_vfunc() const;
52 GType get_column_type_vfunc(int index) const;
53 void get_value_vfunc(const TreeModel::iterator& iter, int column, Glib::ValueBase& value) const;
54 bool iter_next_vfunc(const iterator& iter, iterator& iter_next) const;
55 bool iter_children_vfunc(const iterator& parent, iterator& iter) const;
56 bool iter_has_child_vfunc(const iterator& iter) const;
57 int iter_n_children_vfunc(const iterator& iter) const;
58 int iter_n_root_children_vfunc() const;
59 bool iter_nth_child_vfunc(const iterator& parent, int n, iterator& iter) const;
60 bool iter_nth_root_child_vfunc(int n, iterator& iter) const;
61 bool iter_parent_vfunc(const iterator& child, iterator& iter) const;
62 Path get_path_vfunc(const iterator& iter) const;
63 bool get_iter_vfunc(const Path& path, iterator& iter) const;
64 bool iter_is_valid(const iterator& iter) const;
67 typedef Gtk::TreeModelColumn<std::string> StringColumn;
68 typedef Gtk::TreeModelColumn<bool> BoolColumn;
69 typedef Gtk::TreeModelColumn<uint32_t> UnsignedColumn;
70 typedef Gtk::TreeModelColumn<AxisView*> AVColumn;
71 typedef Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Stripable> > StripableColumn;
73 struct Columns : public Gtk::TreeModel::ColumnRecord
83 add (solo_isolate_state);
84 add (solo_safe_state);
89 add (is_input_active);
96 UnsignedColumn rec_state;
97 UnsignedColumn rec_safe;
98 UnsignedColumn mute_state;
99 UnsignedColumn solo_state;
100 /** true if the solo buttons are visible for this route, otherwise false */
101 BoolColumn solo_visible;
102 UnsignedColumn solo_isolate_state;
103 UnsignedColumn solo_safe_state;
106 StripableColumn stripable;
107 BoolColumn name_editable;
108 BoolColumn is_input_active;
116 ARDOUR::Session* _session;
117 AxisViewProvider& axis_view_provider;
121 void text_value (boost::shared_ptr<ARDOUR::Stripable> stripable, Glib::ValueBase& value) const;
125 Glue (boost::shared_ptr<ARDOUR::Stripable>);
127 boost::weak_ptr<ARDOUR::Stripable> stripable;
130 typedef std::set<Glue*> GlueList;
131 mutable GlueList glue_list;
132 void remember_glue_item (Glue*) const;
135 #endif /* __gtk2_ardour_stripable_treemodel_h__ */