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>
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.
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.
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.
22 #ifndef __ardour_gtk_editor_route_h__
23 #define __ardour_gtk_editor_route_h__
25 #include <gtkmm/liststore.h>
26 #include <gtkmm/scrolledwindow.h>
27 #include <gtkmm/treemodel.h>
28 #include <gtkmm/treestore.h>
30 #include "pbd/signals.h"
31 #include "gtkmm2ext/widget_state.h"
33 #include "editor_component.h"
35 class VCATimeAxisView;
37 class EditorRoutes : public EditorComponent, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
40 EditorRoutes (Editor *);
43 void set_session (ARDOUR::Session *);
45 Gtk::Widget& widget () {
49 void move_selected_tracks (bool);
50 void show_track_in_display (TimeAxisView &);
53 void suspend_redisplay () {
56 _redisplay_on_resume = false;
60 void resume_redisplay () {
61 _no_redisplay = false;
62 if (_redisplay_on_resume) {
68 void update_visibility ();
69 void time_axis_views_added (std::list<TimeAxisView*>);
70 void route_removed (TimeAxisView *);
71 void hide_track_in_display (TimeAxisView &);
72 std::list<TimeAxisView*> views () const;
73 void hide_all_tracks (bool);
75 void sync_presentation_info_from_treeview ();
76 void sync_treeview_from_presentation_info (PBD::PropertyChange const &);
79 void initial_display ();
80 void redisplay_real ();
81 void on_input_active_changed (std::string const &);
82 void on_tv_rec_enable_changed (std::string const &);
83 void on_tv_rec_safe_toggled (std::string const &);
84 void on_tv_mute_enable_toggled (std::string const &);
85 void on_tv_solo_enable_toggled (std::string const &);
86 void on_tv_solo_isolate_toggled (std::string const &);
87 void on_tv_solo_safe_toggled (std::string const &);
89 void presentation_info_changed (PBD::PropertyChange const &);
90 void row_deleted (Gtk::TreeModel::Path const &);
91 void visible_changed (std::string const &);
92 void active_changed (std::string const &);
93 void reordered (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &, int *);
94 bool button_press (GdkEventButton *);
95 void route_property_changed (const PBD::PropertyChange&, boost::weak_ptr<ARDOUR::Stripable>);
96 void handle_gui_changes (std::string const &, void *);
97 bool idle_update_mute_rec_solo_etc ();
98 void update_rec_display ();
99 void update_mute_display ();
100 void update_solo_display ();
101 void update_solo_isolate_display ();
102 void update_solo_safe_display ();
103 void update_input_active_display ();
104 void update_active_display ();
105 void set_all_tracks_visibility (bool);
106 void set_all_audio_midi_visibility (int, bool);
107 void show_all_routes ();
108 void hide_all_routes ();
109 void show_all_audiotracks ();
110 void hide_all_audiotracks ();
111 void show_all_audiobus ();
112 void hide_all_audiobus ();
113 void show_all_miditracks ();
114 void hide_all_miditracks ();
115 void show_tracks_with_regions_at_playhead ();
116 void selection_changed ();
118 int plugin_setup (boost::shared_ptr<ARDOUR::Route>, boost::shared_ptr<ARDOUR::PluginInsert>, ARDOUR::Route::PluginSetupOptions);
120 void name_edit (std::string const &, std::string const &);
121 void solo_changed_so_update_mute ();
123 struct ModelColumns : public Gtk::TreeModel::ColumnRecord {
132 add (solo_lock_iso_visible);
133 add (solo_isolate_state);
134 add (solo_safe_state);
139 add (is_input_active);
145 Gtk::TreeModelColumn<std::string> text;
146 Gtk::TreeModelColumn<bool> visible;
147 Gtk::TreeModelColumn<uint32_t> rec_state;
148 Gtk::TreeModelColumn<uint32_t> rec_safe;
149 Gtk::TreeModelColumn<uint32_t> mute_state;
150 Gtk::TreeModelColumn<uint32_t> solo_state;
151 /** true if the solo buttons are visible for this route, otherwise false */
152 Gtk::TreeModelColumn<bool> solo_visible;
153 Gtk::TreeModelColumn<bool> solo_lock_iso_visible;
154 Gtk::TreeModelColumn<uint32_t> solo_isolate_state;
155 Gtk::TreeModelColumn<uint32_t> solo_safe_state;
156 Gtk::TreeModelColumn<bool> is_track;
157 Gtk::TreeModelColumn<TimeAxisView*> tv;
158 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Stripable> > stripable;
159 Gtk::TreeModelColumn<bool> name_editable;
160 Gtk::TreeModelColumn<bool> is_input_active;
161 Gtk::TreeModelColumn<bool> is_midi;
162 Gtk::TreeModelColumn<bool> no_vca; // activatable
163 Gtk::TreeModelColumn<bool> active;
166 Gtk::ScrolledWindow _scroller;
167 Gtk::TreeView _display;
168 Glib::RefPtr<Gtk::ListStore> _model;
169 ModelColumns _columns;
174 bool _ignore_reorder;
175 bool _ignore_selection_change;
178 bool _route_deletion_in_progress;
179 bool _redisplay_on_resume;
180 volatile gint _redisplay_active;
181 volatile gint _queue_tv_update;
184 Gtk::Widget* old_focus;
185 Gtk::CellEditable* name_editable;
187 bool key_press (GdkEventKey* ev);
188 bool focus_in (GdkEventFocus*);
189 bool focus_out (GdkEventFocus*);
190 bool enter_notify (GdkEventCrossing*);
191 bool leave_notify (GdkEventCrossing*);
192 void name_edit_started (Gtk::CellEditable*, const Glib::ustring&);
194 bool get_relevant_routes (boost::shared_ptr<ARDOUR::RouteList> rl);
197 #endif /* __ardour_gtk_editor_route_h__ */