use new syntax for connecting to backend signals that enforces explicit connection...
[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
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 hide_track_in_display (TimeAxisView &);
53         std::list<TimeAxisView*> views () const;
54         void hide_all_tracks (bool);
55         void clear ();
56         void sync_order_keys (std::string const &);
57
58 private:
59
60         void initial_display ();
61         void on_tv_rec_enable_toggled (Glib::ustring const &);
62         void on_tv_mute_enable_toggled (Glib::ustring const &);
63         void on_tv_solo_enable_toggled (Glib::ustring const &);
64         void on_tv_solo_isolate_toggled (Glib::ustring const &);
65         void build_menu ();
66         void show_menu ();
67         void route_deleted (Gtk::TreeModel::Path const &);
68         void visible_changed (Glib::ustring const &);
69         void reordered (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &, int *);
70         bool button_press (GdkEventButton *);
71         void route_name_changed (boost::weak_ptr<ARDOUR::Route>);
72         void route_removed (TimeAxisView *);
73         void handle_gui_changes (std::string const &, void *);
74         void update_rec_display ();
75         void update_mute_display ();
76         void update_solo_display ();
77         void update_solo_isolate_display ();
78         void set_all_tracks_visibility (bool);
79         void set_all_audio_visibility (int, bool);
80         void show_all_routes ();
81         void hide_all_routes ();
82         void show_all_audiotracks ();
83         void hide_all_audiotracks ();
84         void show_all_audiobus ();
85         void hide_all_audiobus ();
86         void show_tracks_with_regions_at_playhead ();
87         
88         void display_drag_data_received (
89                 Glib::RefPtr<Gdk::DragContext> const &, gint, gint, Gtk::SelectionData const &, guint, guint
90                 );
91         
92         void track_list_reorder (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const & iter, int* new_order);
93         bool selection_filter (Glib::RefPtr<Gtk::TreeModel> const &, Gtk::TreeModel::Path const &, bool);
94         void name_edit (Glib::ustring const &, Glib::ustring const &);
95         void solo_changed_so_update_mute ();
96
97         struct ModelColumns : public Gtk::TreeModel::ColumnRecord {
98                 ModelColumns() {
99                         add (text);
100                         add (visible);
101                         add (rec_enabled);
102                         add (mute_state);
103                         add (solo_state);
104                         add (solo_isolate_state);
105                         add (is_track);
106                         add (tv);
107                         add (route);
108                         add (name_editable);
109                 }
110                 
111                 Gtk::TreeModelColumn<Glib::ustring>  text;
112                 Gtk::TreeModelColumn<bool>           visible;
113                 Gtk::TreeModelColumn<bool>           rec_enabled;
114                 Gtk::TreeModelColumn<uint32_t>       mute_state;
115                 Gtk::TreeModelColumn<uint32_t>       solo_state;
116                 Gtk::TreeModelColumn<uint32_t>       solo_isolate_state;
117                 Gtk::TreeModelColumn<bool>           is_track;
118                 Gtk::TreeModelColumn<TimeAxisView*>  tv;
119                 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> >  route;
120                 Gtk::TreeModelColumn<bool>           name_editable;
121         };
122
123         Gtk::ScrolledWindow _scroller;
124         Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > _display;
125         Glib::RefPtr<Gtk::ListStore> _model;
126         ModelColumns _columns;
127         
128         bool _ignore_reorder;
129         bool _no_redisplay;
130         bool _redisplay_does_not_sync_order_keys;
131         bool _redisplay_does_not_reset_order_keys;
132         
133         Gtk::Menu* _menu;
134 };
135
136 #endif /* __ardour_gtk_editor_route_h__ */