Use shared_ptr for the TimeAxisView hierarchy.
[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 class EditorRoutes : public EditorComponent
21 {
22 public:
23         EditorRoutes (Editor *);
24
25         void connect_to_session (ARDOUR::Session *);
26
27         Gtk::Widget& widget () {
28                 return _scroller;
29         }
30
31         void move_selected_tracks (bool);
32         void show_track_in_display (TimeAxisViewPtr);
33         void suspend_redisplay () {
34                 _no_redisplay = true;
35         }
36         void resume_redisplay () {
37                 _no_redisplay = false;
38                 redisplay ();
39         }
40         void redisplay ();
41         void update_visibility ();
42         void routes_added (std::list<RouteTimeAxisViewPtr> routes);
43         void hide_track_in_display (TimeAxisViewPtr);
44         std::list<TimeAxisViewPtr> views () const;
45         void hide_all_tracks (bool);
46         void clear ();
47         void sync_order_keys (std::string const &);
48
49 private:
50
51         void initial_display ();
52         void on_tv_rec_enable_toggled (Glib::ustring const &);
53         void build_menu ();
54         void show_menu ();
55         void route_deleted (Gtk::TreeModel::Path const &);
56         void changed (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &);
57         void reordered (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &, int *);
58         bool button_press (GdkEventButton *);
59         void route_name_changed (boost::weak_ptr<ARDOUR::Route>);
60         void route_removed (TimeAxisViewPtr);
61         void handle_gui_changes (std::string const &, void *);
62         void update_rec_display ();
63         void set_all_tracks_visibility (bool);
64         void set_all_audio_visibility (int, bool);
65         void show_all_routes ();
66         void hide_all_routes ();
67         void show_all_audiotracks ();
68         void hide_all_audiotracks ();
69         void show_all_audiobus ();
70         void hide_all_audiobus ();
71         void display_drag_data_received (
72                 Glib::RefPtr<Gdk::DragContext> const &, gint, gint, Gtk::SelectionData const &, guint, guint
73                 );
74         void track_list_reorder (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const & iter, int* new_order);
75         bool selection_filter (Glib::RefPtr<Gtk::TreeModel> const &, Gtk::TreeModel::Path const &, bool);
76
77         struct ModelColumns : public Gtk::TreeModel::ColumnRecord {
78                 ModelColumns() { 
79                         add (text);
80                         add (visible);
81                         add (rec_enabled);
82                         add (is_track);
83                         add (tv);
84                         add (route);
85                 }
86                 Gtk::TreeModelColumn<Glib::ustring>  text;
87                 Gtk::TreeModelColumn<bool>           visible;
88                 Gtk::TreeModelColumn<bool>           rec_enabled;
89                 Gtk::TreeModelColumn<bool>           is_track;
90                 Gtk::TreeModelColumn<TimeAxisViewPtr> tv;
91                 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> >  route;
92         };
93
94         Gtk::ScrolledWindow _scroller;
95         Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > _display; 
96         Glib::RefPtr<Gtk::ListStore> _model;
97         ModelColumns _columns;
98         bool _ignore_reorder;
99         bool _no_redisplay;
100         bool _redisplay_does_not_sync_order_keys;
101         bool _redisplay_does_not_reset_order_keys;
102         Gtk::Menu* _menu;
103 };