2019-08-02 17:26:43 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2017 Robin Gareus <robin@gareus.org>
|
2017-02-05 09:51:00 -05:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
2019-08-02 17:26:43 -04:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2017-02-05 09:51:00 -05:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2019-08-02 17:26:43 -04:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2017-02-05 09:51:00 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __gtk2_ardour_stripable_treemodel_h__
|
|
|
|
#define __gtk2_ardour_stripable_treemodel_h__
|
|
|
|
|
2023-02-16 12:59:41 -05:00
|
|
|
#include <cstdint>
|
|
|
|
#include <memory>
|
2017-02-05 09:51:00 -05:00
|
|
|
#include <set>
|
|
|
|
|
2017-07-16 21:48:18 -04:00
|
|
|
#include <gtkmm/treemodel.h>
|
2017-02-05 09:51:00 -05:00
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
class Session;
|
|
|
|
class Stripable;
|
|
|
|
}
|
|
|
|
|
|
|
|
class AxisView;
|
|
|
|
class AxisViewProvider;
|
|
|
|
class StripableSorter;
|
|
|
|
|
|
|
|
class StripableTreeModel : public Gtk::TreeModel, public Glib::Object
|
|
|
|
{
|
2017-07-01 15:11:14 -04:00
|
|
|
protected:
|
2017-02-05 09:51:00 -05:00
|
|
|
StripableTreeModel (AxisViewProvider&);
|
|
|
|
virtual ~StripableTreeModel();
|
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
public:
|
2017-02-05 09:51:00 -05:00
|
|
|
static Glib::RefPtr<StripableTreeModel> create (AxisViewProvider&);
|
|
|
|
void set_session (ARDOUR::Session&);
|
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
protected:
|
2017-02-05 09:51:00 -05:00
|
|
|
Gtk::TreeModelFlags get_flags_vfunc() const;
|
|
|
|
int get_n_columns_vfunc() const;
|
|
|
|
GType get_column_type_vfunc(int index) const;
|
|
|
|
void get_value_vfunc(const TreeModel::iterator& iter, int column, Glib::ValueBase& value) const;
|
|
|
|
bool iter_next_vfunc(const iterator& iter, iterator& iter_next) const;
|
|
|
|
bool iter_children_vfunc(const iterator& parent, iterator& iter) const;
|
|
|
|
bool iter_has_child_vfunc(const iterator& iter) const;
|
|
|
|
int iter_n_children_vfunc(const iterator& iter) const;
|
|
|
|
int iter_n_root_children_vfunc() const;
|
|
|
|
bool iter_nth_child_vfunc(const iterator& parent, int n, iterator& iter) const;
|
|
|
|
bool iter_nth_root_child_vfunc(int n, iterator& iter) const;
|
|
|
|
bool iter_parent_vfunc(const iterator& child, iterator& iter) const;
|
|
|
|
Path get_path_vfunc(const iterator& iter) const;
|
|
|
|
bool get_iter_vfunc(const Path& path, iterator& iter) const;
|
|
|
|
bool iter_is_valid(const iterator& iter) const;
|
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
public:
|
2017-02-05 09:51:00 -05:00
|
|
|
typedef Gtk::TreeModelColumn<std::string> StringColumn;
|
|
|
|
typedef Gtk::TreeModelColumn<bool> BoolColumn;
|
|
|
|
typedef Gtk::TreeModelColumn<uint32_t> UnsignedColumn;
|
|
|
|
typedef Gtk::TreeModelColumn<AxisView*> AVColumn;
|
2023-02-16 18:33:28 -05:00
|
|
|
typedef Gtk::TreeModelColumn<std::shared_ptr<ARDOUR::Stripable> > StripableColumn;
|
2017-02-05 09:51:00 -05:00
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
struct Columns : public Gtk::TreeModel::ColumnRecord
|
|
|
|
{
|
2017-02-05 09:51:00 -05:00
|
|
|
Columns () {
|
|
|
|
add (text);
|
|
|
|
add (visible);
|
|
|
|
add (rec_state);
|
|
|
|
add (rec_safe);
|
|
|
|
add (mute_state);
|
|
|
|
add (solo_state);
|
|
|
|
add (solo_visible);
|
|
|
|
add (solo_isolate_state);
|
|
|
|
add (solo_safe_state);
|
|
|
|
add (is_track);
|
|
|
|
add (av);
|
|
|
|
add (stripable);
|
|
|
|
add (name_editable);
|
|
|
|
add (is_input_active);
|
|
|
|
add (is_midi);
|
|
|
|
add (active);
|
|
|
|
}
|
|
|
|
|
|
|
|
StringColumn text;
|
|
|
|
BoolColumn visible;
|
|
|
|
UnsignedColumn rec_state;
|
|
|
|
UnsignedColumn rec_safe;
|
|
|
|
UnsignedColumn mute_state;
|
|
|
|
UnsignedColumn solo_state;
|
|
|
|
/** true if the solo buttons are visible for this route, otherwise false */
|
|
|
|
BoolColumn solo_visible;
|
|
|
|
UnsignedColumn solo_isolate_state;
|
|
|
|
UnsignedColumn solo_safe_state;
|
|
|
|
BoolColumn is_track;
|
|
|
|
AVColumn av;
|
|
|
|
StripableColumn stripable;
|
|
|
|
BoolColumn name_editable;
|
|
|
|
BoolColumn is_input_active;
|
|
|
|
BoolColumn is_midi;
|
|
|
|
BoolColumn active;
|
|
|
|
};
|
|
|
|
|
|
|
|
Columns columns;
|
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
private:
|
2017-02-05 09:51:00 -05:00
|
|
|
ARDOUR::Session* _session;
|
|
|
|
AxisViewProvider& axis_view_provider;
|
|
|
|
|
|
|
|
int n_columns;
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
void text_value (std::shared_ptr<ARDOUR::Stripable> stripable, Glib::ValueBase& value) const;
|
2017-02-05 09:51:00 -05:00
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
struct Glue
|
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
Glue (std::shared_ptr<ARDOUR::Stripable>);
|
2017-02-05 09:51:00 -05:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::weak_ptr<ARDOUR::Stripable> stripable;
|
2017-02-05 09:51:00 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::set<Glue*> GlueList;
|
|
|
|
mutable GlueList glue_list;
|
|
|
|
void remember_glue_item (Glue*) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __gtk2_ardour_stripable_treemodel_h__ */
|