Tweak group tabs class hierarchy and offer the same menu in both editor and mixer...
[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 "editor_component.h"
25
26 class EditorRoutes : public EditorComponent, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
27 {
28 public:
29         EditorRoutes (Editor *);
30
31         void set_session (ARDOUR::Session *);
32
33         Gtk::Widget& widget () {
34                 return _scroller;
35         }
36
37         void move_selected_tracks (bool);
38         void show_track_in_display (TimeAxisView &);
39         
40         void suspend_redisplay () {
41                 _no_redisplay = true;
42         }
43         
44         void resume_redisplay () {
45                 _no_redisplay = false;
46                 redisplay ();
47         }
48         
49         void redisplay ();
50         void update_visibility ();
51         void routes_added (std::list<RouteTimeAxisView*> routes);
52         void route_removed (TimeAxisView *);
53         void hide_track_in_display (TimeAxisView &);
54         std::list<TimeAxisView*> views () const;
55         void hide_all_tracks (bool);
56         void clear ();
57         void sync_order_keys (std::string const &);
58
59 private:
60
61         void initial_display ();
62         void on_tv_rec_enable_toggled (Glib::ustring const &);
63         void on_tv_mute_enable_toggled (Glib::ustring const &);
64         void on_tv_solo_enable_toggled (Glib::ustring const &);
65         void on_tv_solo_isolate_toggled (Glib::ustring const &);
66         void on_tv_solo_safe_toggled (Glib::ustring const &);
67         void build_menu ();
68         void show_menu ();
69         void route_deleted (Gtk::TreeModel::Path const &);
70         void visible_changed (Glib::ustring const &);
71         void reordered (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &, int *);
72         bool button_press (GdkEventButton *);
73         void route_property_changed (const PBD::PropertyChange&, boost::weak_ptr<ARDOUR::Route>);
74         void handle_gui_changes (std::string const &, void *);
75         void update_rec_display ();
76         void update_mute_display ();
77         void update_solo_display (bool);
78         void update_solo_isolate_display ();
79         void update_solo_safe_display ();
80         void set_all_tracks_visibility (bool);
81         void set_all_audio_midi_visibility (int, bool);
82         void show_all_routes ();
83         void hide_all_routes ();
84         void show_all_audiotracks ();
85         void hide_all_audiotracks ();
86         void show_all_audiobus ();
87         void hide_all_audiobus ();
88         void show_all_miditracks ();
89         void hide_all_miditracks ();
90         void show_tracks_with_regions_at_playhead ();
91         
92         void display_drag_data_received (
93                 Glib::RefPtr<Gdk::DragContext> const &, gint, gint, Gtk::SelectionData const &, guint, guint
94                 );
95         
96         void track_list_reorder (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const & iter, int* new_order);
97         bool selection_filter (Glib::RefPtr<Gtk::TreeModel> const &, Gtk::TreeModel::Path const &, bool);
98         void name_edit (Glib::ustring const &, Glib::ustring const &);
99         void solo_changed_so_update_mute ();
100
101         struct ModelColumns : public Gtk::TreeModel::ColumnRecord {
102                 ModelColumns() {
103                         add (text);
104                         add (visible);
105                         add (rec_enabled);
106                         add (mute_state);
107                         add (solo_state);
108                         add (solo_isolate_state);
109                         add (solo_safe_state);
110                         add (is_track);
111                         add (tv);
112                         add (route);
113                         add (name_editable);
114                 }
115                 
116                 Gtk::TreeModelColumn<Glib::ustring>  text;
117                 Gtk::TreeModelColumn<bool>           visible;
118                 Gtk::TreeModelColumn<bool>           rec_enabled;
119                 Gtk::TreeModelColumn<uint32_t>       mute_state;
120                 Gtk::TreeModelColumn<uint32_t>       solo_state;
121                 Gtk::TreeModelColumn<uint32_t>       solo_isolate_state;
122                 Gtk::TreeModelColumn<uint32_t>       solo_safe_state;
123                 Gtk::TreeModelColumn<bool>           is_track;
124                 Gtk::TreeModelColumn<TimeAxisView*>  tv;
125                 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> >  route;
126                 Gtk::TreeModelColumn<bool>           name_editable;
127         };
128
129         Gtk::ScrolledWindow _scroller;
130         Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > _display;
131         Glib::RefPtr<Gtk::ListStore> _model;
132         ModelColumns _columns;
133         
134         bool _ignore_reorder;
135         bool _no_redisplay;
136         bool _redisplay_does_not_sync_order_keys;
137         bool _redisplay_does_not_reset_order_keys;
138         
139         Gtk::Menu* _menu;
140 };
141
142 #endif /* __ardour_gtk_editor_route_h__ */