2 Copyright (C) 2009 Paul Davis
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
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_gtk_editor_route_h__
21 #define __ardour_gtk_editor_route_h__
23 #include <gtkmm/liststore.h>
24 #include <gtkmm/scrolledwindow.h>
25 #include <gtkmm/treemodel.h>
26 #include <gtkmm/treestore.h>
28 #include "pbd/signals.h"
29 #include "gtkmm2ext/widget_state.h"
31 #include "editor_component.h"
33 class VCATimeAxisView;
35 class EditorRoutes : public EditorComponent, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
38 EditorRoutes (Editor *);
40 void set_session (ARDOUR::Session *);
42 Gtk::Widget& widget () {
46 void move_selected_tracks (bool);
47 void show_track_in_display (TimeAxisView &);
50 void suspend_redisplay () {
53 _redisplay_on_resume = false;
57 void resume_redisplay () {
58 _no_redisplay = false;
59 if (_redisplay_on_resume) {
65 void update_visibility ();
66 void time_axis_views_added (std::list<TimeAxisView*>);
67 void route_removed (TimeAxisView *);
68 void hide_track_in_display (TimeAxisView &);
69 std::list<TimeAxisView*> views () const;
70 void hide_all_tracks (bool);
72 void sync_presentation_info_from_treeview ();
73 void sync_treeview_from_presentation_info (PBD::PropertyChange const &);
76 void initial_display ();
77 void redisplay_real ();
78 void on_input_active_changed (std::string const &);
79 void on_tv_rec_enable_changed (std::string const &);
80 void on_tv_rec_safe_toggled (std::string const &);
81 void on_tv_mute_enable_toggled (std::string const &);
82 void on_tv_solo_enable_toggled (std::string const &);
83 void on_tv_solo_isolate_toggled (std::string const &);
84 void on_tv_solo_safe_toggled (std::string const &);
86 void presentation_info_changed (PBD::PropertyChange const &);
87 void row_deleted (Gtk::TreeModel::Path const &);
88 void visible_changed (std::string const &);
89 void active_changed (std::string const &);
90 void reordered (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &, int *);
91 bool button_press (GdkEventButton *);
92 void route_property_changed (const PBD::PropertyChange&, boost::weak_ptr<ARDOUR::Stripable>);
93 void handle_gui_changes (std::string const &, void *);
94 bool idle_update_mute_rec_solo_etc ();
95 void update_rec_display ();
96 void update_mute_display ();
97 void update_solo_display ();
98 void update_solo_isolate_display ();
99 void update_solo_safe_display ();
100 void update_input_active_display ();
101 void update_active_display ();
102 void set_all_tracks_visibility (bool);
103 void set_all_audio_midi_visibility (int, bool);
104 void show_all_routes ();
105 void hide_all_routes ();
106 void show_all_audiotracks ();
107 void hide_all_audiotracks ();
108 void show_all_audiobus ();
109 void hide_all_audiobus ();
110 void show_all_miditracks ();
111 void hide_all_miditracks ();
112 void show_tracks_with_regions_at_playhead ();
113 void selection_changed ();
115 int plugin_setup (boost::shared_ptr<ARDOUR::Route>, boost::shared_ptr<ARDOUR::PluginInsert>, ARDOUR::Route::PluginSetupOptions);
117 bool selection_filter (Glib::RefPtr<Gtk::TreeModel> const &, Gtk::TreeModel::Path const &, bool);
118 void name_edit (std::string const &, std::string const &);
119 void solo_changed_so_update_mute ();
121 struct ModelColumns : public Gtk::TreeModel::ColumnRecord {
130 add (solo_lock_iso_visible);
131 add (solo_isolate_state);
132 add (solo_safe_state);
137 add (is_input_active);
143 Gtk::TreeModelColumn<std::string> text;
144 Gtk::TreeModelColumn<bool> visible;
145 Gtk::TreeModelColumn<uint32_t> rec_state;
146 Gtk::TreeModelColumn<uint32_t> rec_safe;
147 Gtk::TreeModelColumn<uint32_t> mute_state;
148 Gtk::TreeModelColumn<uint32_t> solo_state;
149 /** true if the solo buttons are visible for this route, otherwise false */
150 Gtk::TreeModelColumn<bool> solo_visible;
151 Gtk::TreeModelColumn<bool> solo_lock_iso_visible;
152 Gtk::TreeModelColumn<uint32_t> solo_isolate_state;
153 Gtk::TreeModelColumn<uint32_t> solo_safe_state;
154 Gtk::TreeModelColumn<bool> is_track;
155 Gtk::TreeModelColumn<TimeAxisView*> tv;
156 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Stripable> > stripable;
157 Gtk::TreeModelColumn<bool> name_editable;
158 Gtk::TreeModelColumn<bool> is_input_active;
159 Gtk::TreeModelColumn<bool> is_midi;
160 Gtk::TreeModelColumn<bool> no_vca; // activatable
161 Gtk::TreeModelColumn<bool> active;
164 Gtk::ScrolledWindow _scroller;
165 Gtk::TreeView _display;
166 Glib::RefPtr<Gtk::ListStore> _model;
167 ModelColumns _columns;
172 bool _ignore_reorder;
173 bool _ignore_selection_change;
176 bool _route_deletion_in_progress;
177 bool _redisplay_on_resume;
178 volatile gint _redisplay_active;
179 volatile gint _queue_tv_update;
182 Gtk::Widget* old_focus;
183 Gtk::CellEditable* name_editable;
185 bool key_press (GdkEventKey* ev);
186 bool focus_in (GdkEventFocus*);
187 bool focus_out (GdkEventFocus*);
188 bool enter_notify (GdkEventCrossing*);
189 bool leave_notify (GdkEventCrossing*);
190 void name_edit_started (Gtk::CellEditable*, const Glib::ustring&);
192 bool get_relevant_routes (boost::shared_ptr<ARDOUR::RouteList> rl);
195 #endif /* __ardour_gtk_editor_route_h__ */