Ardour  8.7-15-gadf511264b
route_list_base.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
3  * Copyright (C) 2009-2011 David Robillard <d@drobilla.net>
4  * Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com>
5  * Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 
22 #ifndef _ardour_gtk_route_list_base_h_
23 #define _ardour_gtk_route_list_base_h_
24 
25 #include <set>
26 
27 #include <gtkmm/liststore.h>
28 #include <gtkmm/scrolledwindow.h>
29 #include <gtkmm/treemodel.h>
30 #include <gtkmm/treestore.h>
31 #include <gtkmm/treeview.h>
32 
33 #include "pbd/properties.h"
34 #include "pbd/signals.h"
35 
36 #include "ardour/route.h"
37 #include "ardour/session_handle.h"
38 #include "ardour/types.h"
39 
41 
42 class TimeAxisView;
43 
45 {
46 public:
49 
51 
53  {
54  return _scroller;
55  }
56 
57  void clear ();
58 
59 protected:
60  void add_name_column ();
64  void append_col_mute ();
65  void append_col_solo ();
66 
67  void setup_col (Gtk::TreeViewColumn*, const char*, const char*, bool require_mod_to_edit = false);
68 
69  template <class T, class U>
70  Gtk::TreeViewColumn* append_toggle (Gtk::TreeModelColumn<T> const& col_state, Gtk::TreeModelColumn<U> const& col_viz, sigc::slot<void, std::string> cb)
71  {
72  Gtk::TreeViewColumn* tvc = manage (new Gtk::TreeViewColumn ("", col_state));
73  tvc->set_fixed_width (30);
75  tvc->set_expand (false);
77 
78  Gtk::CellRendererToggle* tc = dynamic_cast<Gtk::CellRendererToggle*> (tvc->get_first_cell ());
79  tc->property_activatable () = true;
80  tc->property_radio () = false;
81  tc->signal_toggled ().connect (cb);
82 
83  tvc->add_attribute (tc->property_visible (), col_viz);
84 
85  _display.append_column (*tvc);
86  no_select_columns.insert (tvc);
87  return tvc;
88  }
89 
90  template <class T, class U>
91  Gtkmm2ext::CellRendererPixbufMulti* append_cell (const char* lbl, const char* tip, Gtk::TreeModelColumn<T> const& col_state, Gtk::TreeModelColumn<U> const& col_viz, sigc::slot<void, std::string> cb)
92  {
95 
97  cell->signal_changed ().connect (cb);
98 
99  tvc = manage (new Gtk::TreeViewColumn (lbl, *cell));
100  tvc->add_attribute (cell->property_state (), col_state);
101  tvc->add_attribute (cell->property_visible (), col_viz);
104  tvc->set_expand (false);
105  tvc->set_fixed_width (24);
106 
107  setup_col (tvc, lbl, tip);
108  _display.append_column (*tvc);
109  no_select_columns.insert (tvc);
110  return cell;
111  }
112 
113  void on_tv_input_active_changed (std::string const&);
114  void on_tv_rec_enable_changed (std::string const&);
115  void on_tv_rec_safe_toggled (std::string const&);
116  void on_tv_mute_enable_toggled (std::string const&);
117  void on_tv_solo_enable_toggled (std::string const&);
118  void on_tv_solo_isolate_toggled (std::string const&);
119  void on_tv_solo_safe_toggled (std::string const&);
120  void on_tv_visible_changed (std::string const&);
121  void on_tv_trigger_changed (std::string const&);
122  void on_tv_active_changed (std::string const&);
123 
126  {
127  add (text);
128  add (visible);
129  add (trigger);
130  add (rec_state);
131  add (rec_safe);
132  add (mute_state);
133  add (solo_state);
134  add (solo_visible);
138  add (is_track);
139  add (stripable);
140  add (name_editable);
142  add (is_midi);
143  add (activatable);
144  add (active);
145  add (noop_true);
146  }
147 
155  Gtk::TreeModelColumn<bool> solo_visible; // true if the solo buttons are visible for this route, otherwise false
167  };
168 
171 
172 private:
173 
174  void redisplay ();
178 
182  void remove_strip (std::weak_ptr<ARDOUR::Stripable>);
183 
187 
190  void build_menu ();
193 
197 
198  void route_property_changed (const PBD::PropertyChange&, std::weak_ptr<ARDOUR::Stripable>);
200 
201  void name_edit (std::string const&, std::string const&);
202 
203  bool select_function (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool);
204 
205  bool key_press (GdkEventKey* ev);
210  void name_edit_started (Gtk::CellEditable*, const Glib::ustring&);
211 
212  bool get_relevant_routes (std::shared_ptr<ARDOUR::RouteList> rl);
213 
215  Glib::RefPtr<Gtk::ListStore> _model;
216 
220 
221  std::set<Gtk::TreeViewColumn*> no_select_columns;
222 
229 
230  sigc::connection _idle_update_connection;
232 };
233 
234 #endif /* _ardour_gtk_route_list_base_h_ */
Glib::SignalProxy1< void, const Glib::ustring & > signal_toggled()
Glib::PropertyProxy< bool > property_radio()
Glib::PropertyProxy< bool > property_activatable()
Glib::PropertyProxy< bool > property_visible()
void add(TreeModelColumnBase &column)
void set_alignment(float xalign)
void add_attribute(CellRenderer &cell_renderer, const Glib::ustring &attribute, int column)
void set_expand(bool expand=true)
void set_sizing(TreeViewColumnSizing type)
CellRenderer * get_first_cell()
void set_fixed_width(int fixed_width)
int append_column(TreeViewColumn &column)
Glib::PropertyProxy< uint32_t > property_state()
void queue_idle_update()
void on_tv_rec_enable_changed(std::string const &)
void on_tv_solo_enable_toggled(std::string const &)
bool button_release(GdkEventButton *)
void append_col_rec_enable()
bool button_press(GdkEventButton *)
void on_tv_active_changed(std::string const &)
bool select_function(const Glib::RefPtr< Gtk::TreeModel > &model, const Gtk::TreeModel::Path &path, bool)
bool focus_out(GdkEventFocus *)
bool key_press(GdkEventKey *ev)
void name_edit(std::string const &, std::string const &)
bool enter_notify(GdkEventCrossing *)
Gtk::Menu * _menu
void on_tv_mute_enable_toggled(std::string const &)
void on_tv_input_active_changed(std::string const &)
void set_all_audio_midi_visibility(int, bool)
void show_tracks_with_regions_at_playhead()
void append_col_solo()
void on_tv_trigger_changed(std::string const &)
void build_menu()
bool _column_does_not_select
void redisplay()
Gtk::TreeView _display
void setup_col(Gtk::TreeViewColumn *, const char *, const char *, bool require_mod_to_edit=false)
void add_routes(ARDOUR::RouteList &)
bool _ignore_visibility_change
std::set< Gtk::TreeViewColumn * > no_select_columns
bool leave_notify(GdkEventCrossing *)
void selection_changed()
void remove_strip(std::weak_ptr< ARDOUR::Stripable >)
void on_tv_solo_safe_toggled(std::string const &)
void update_input_active_display()
sigc::connection _idle_update_connection
void append_col_mute()
PBD::ScopedConnectionList _stripable_connections
void append_col_input_active()
void presentation_info_changed(PBD::PropertyChange const &)
void add_name_column()
Gtk::ScrolledWindow _scroller
bool _route_deletion_in_progress
void sync_presentation_info_from_treeview()
void on_tv_solo_isolate_toggled(std::string const &)
void reordered(Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &, int *)
bool focus_in(GdkEventFocus *)
Glib::RefPtr< Gtk::ListStore > _model
void initial_display()
void route_property_changed(const PBD::PropertyChange &, std::weak_ptr< ARDOUR::Stripable >)
void sync_treeview_from_presentation_info(PBD::PropertyChange const &)
Gtk::TreeViewColumn * append_toggle(Gtk::TreeModelColumn< T > const &col_state, Gtk::TreeModelColumn< U > const &col_viz, sigc::slot< void, std::string > cb)
void append_col_rec_safe()
ModelColumns _columns
void on_tv_rec_safe_toggled(std::string const &)
bool get_relevant_routes(std::shared_ptr< ARDOUR::RouteList > rl)
void add_masters(ARDOUR::VCAList &)
Gtkmm2ext::CellRendererPixbufMulti * append_cell(const char *lbl, const char *tip, Gtk::TreeModelColumn< T > const &col_state, Gtk::TreeModelColumn< U > const &col_viz, sigc::slot< void, std::string > cb)
bool _ignore_selection_change
bool idle_update_mute_rec_solo_etc()
void on_tv_visible_changed(std::string const &)
Gtk::Widget * old_focus
Gtk::CellEditable * name_editable
void row_deleted(Gtk::TreeModel::Path const &)
void name_edit_started(Gtk::CellEditable *, const Glib::ustring &)
void add_stripables(ARDOUR::StripableList &)
Gtk::Widget & widget()
void set_session(ARDOUR::Session *)
@ TREE_VIEW_COLUMN_FIXED
std::list< std::shared_ptr< Stripable > > StripableList
std::list< std::shared_ptr< VCA > > VCAList
std::list< std::shared_ptr< Route > > RouteList
T * manage(T *obj)
Definition: object.h:58
Gtk::TreeModelColumn< bool > active
Gtk::TreeModelColumn< bool > trigger
Gtk::TreeModelColumn< bool > is_input_active
Gtk::TreeModelColumn< bool > is_midi
Gtk::TreeModelColumn< uint32_t > mute_state
Gtk::TreeModelColumn< uint32_t > solo_isolate_state
Gtk::TreeModelColumn< bool > solo_visible
Gtk::TreeModelColumn< uint32_t > solo_state
Gtk::TreeModelColumn< bool > is_track
Gtk::TreeModelColumn< std::shared_ptr< ARDOUR::Stripable > > stripable
Gtk::TreeModelColumn< uint32_t > solo_safe_state
Gtk::TreeModelColumn< bool > activatable
Gtk::TreeModelColumn< bool > noop_true
Gtk::TreeModelColumn< bool > solo_lock_iso_visible
Gtk::TreeModelColumn< uint32_t > rec_state
Gtk::TreeModelColumn< std::string > text
Gtk::TreeModelColumn< bool > name_editable
Gtk::TreeModelColumn< uint32_t > rec_safe
Gtk::TreeModelColumn< bool > visible