Remove solo buttons from the master route in the route list (#4486).
[ardour.git] / gtk2_ardour / editor_routes.h
1 /*
2     Copyright (C) 2009 Paul Davis
3
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.
8
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.
13
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.
17
18 */
19
20 #ifndef __ardour_gtk_editor_route_h__
21 #define __ardour_gtk_editor_route_h__
22
23 #include "pbd/signals.h"
24 #include "gtkmm2ext/widget_state.h"
25 #include "editor_component.h"
26
27 class EditorRoutes : public EditorComponent, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
28 {
29 public:
30         EditorRoutes (Editor *);
31
32         void set_session (ARDOUR::Session *);
33
34         Gtk::Widget& widget () {
35                 return _scroller;
36         }
37
38         void move_selected_tracks (bool);
39         void show_track_in_display (TimeAxisView &);
40
41         void suspend_redisplay () {
42                 _no_redisplay = true;
43         }
44
45         void resume_redisplay () {
46                 _no_redisplay = false;
47                 redisplay ();
48         }
49
50         void redisplay ();
51         void update_visibility ();
52         void routes_added (std::list<RouteTimeAxisView*> routes);
53         void route_removed (TimeAxisView *);
54         void hide_track_in_display (TimeAxisView &);
55         std::list<TimeAxisView*> views () const;
56         void hide_all_tracks (bool);
57         void clear ();
58         void sync_order_keys (std::string const &);
59
60 private:
61
62         void initial_display ();
63         void on_input_active_changed (std::string const &);
64         void on_tv_rec_enable_changed (std::string const &);
65         void on_tv_mute_enable_toggled (std::string const &);
66         void on_tv_solo_enable_toggled (std::string const &);
67         void on_tv_solo_isolate_toggled (std::string const &);
68         void on_tv_solo_safe_toggled (std::string const &);
69         void build_menu ();
70         void show_menu ();
71         void route_deleted (Gtk::TreeModel::Path const &);
72         void visible_changed (std::string const &);
73         void active_changed (std::string const &);
74         void reordered (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &, int *);
75         bool button_press (GdkEventButton *);
76         void route_property_changed (const PBD::PropertyChange&, boost::weak_ptr<ARDOUR::Route>);
77         void handle_gui_changes (std::string const &, void *);
78         void update_rec_display ();
79         void update_mute_display ();
80         void update_solo_display (bool);
81         void update_solo_isolate_display ();
82         void update_solo_safe_display ();
83         void update_input_active_display ();
84         void update_active_display ();
85         void set_all_tracks_visibility (bool);
86         void set_all_audio_midi_visibility (int, bool);
87         void show_all_routes ();
88         void hide_all_routes ();
89         void show_all_audiotracks ();
90         void hide_all_audiotracks ();
91         void show_all_audiobus ();
92         void hide_all_audiobus ();
93         void show_all_miditracks ();
94         void hide_all_miditracks ();
95         void show_tracks_with_regions_at_playhead ();
96
97         void display_drag_data_received (
98                 Glib::RefPtr<Gdk::DragContext> const &, gint, gint, Gtk::SelectionData const &, guint, guint
99                 );
100
101         void track_list_reorder (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const & iter, int* new_order);
102         bool selection_filter (Glib::RefPtr<Gtk::TreeModel> const &, Gtk::TreeModel::Path const &, bool);
103         void name_edit (std::string const &, std::string const &);
104         void solo_changed_so_update_mute ();
105
106         struct ModelColumns : public Gtk::TreeModel::ColumnRecord {
107                 ModelColumns() {
108                         add (text);
109                         add (visible);
110                         add (rec_state);
111                         add (mute_state);
112                         add (solo_state);
113                         add (solo_visible);
114                         add (solo_isolate_state);
115                         add (solo_safe_state);
116                         add (is_track);
117                         add (tv);
118                         add (route);
119                         add (name_editable);
120                         add (is_input_active);
121                         add (is_midi);
122                         add (active);
123                 }
124
125                 Gtk::TreeModelColumn<std::string>    text;
126                 Gtk::TreeModelColumn<bool>           visible;
127                 Gtk::TreeModelColumn<uint32_t>       rec_state;
128                 Gtk::TreeModelColumn<uint32_t>       mute_state;
129                 Gtk::TreeModelColumn<uint32_t>       solo_state;
130                 /** true if the solo buttons are visible for this route, otherwise false */
131                 Gtk::TreeModelColumn<bool>           solo_visible;
132                 Gtk::TreeModelColumn<uint32_t>       solo_isolate_state;
133                 Gtk::TreeModelColumn<uint32_t>       solo_safe_state;
134                 Gtk::TreeModelColumn<bool>           is_track;
135                 Gtk::TreeModelColumn<TimeAxisView*>  tv;
136                 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> >  route;
137                 Gtk::TreeModelColumn<bool>           name_editable;
138                 Gtk::TreeModelColumn<bool>           is_input_active;
139                 Gtk::TreeModelColumn<bool>           is_midi;
140                 Gtk::TreeModelColumn<bool>           active;
141         };
142
143         Gtk::ScrolledWindow _scroller;
144         Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > _display;
145         Glib::RefPtr<Gtk::ListStore> _model;
146         ModelColumns _columns;
147         int _name_column;
148         int _visible_column;
149         int _active_column;
150
151         bool _ignore_reorder;
152         bool _no_redisplay;
153         bool _redisplay_does_not_sync_order_keys;
154         bool _redisplay_does_not_reset_order_keys;
155
156         Gtk::Menu* _menu;
157         Gtk::Widget* old_focus;
158         uint32_t selection_countdown;
159         Gtk::CellEditable* name_editable;
160
161         bool key_press (GdkEventKey* ev);
162         bool focus_in (GdkEventFocus*);
163         bool focus_out (GdkEventFocus*);
164         bool enter_notify (GdkEventCrossing*);
165         bool leave_notify (GdkEventCrossing*);
166         void name_edit_started (Gtk::CellEditable*, const Glib::ustring&);
167
168         bool get_relevant_routes (boost::shared_ptr<ARDOUR::RouteList> rl);
169 };
170
171 #endif /* __ardour_gtk_editor_route_h__ */