Initial import of gtk2_ardour.
[ardour.git] / gtk2_ardour / mixer_ui.h
1 /*
2     Copyright (C) 2000 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     $Id$
19 */
20
21 #ifndef __ardour_mixer_ui_h__
22 #define __ardour_mixer_ui_h__
23
24 #include <list>
25
26 #include <gtk--.h>
27
28 #include <ardour/ardour.h>
29 #include <ardour/stateful.h>
30 #include <ardour/io.h>
31
32 #include "keyboard_target.h"
33 #include "route_redirect_selection.h"
34 #include "enums.h"
35
36 namespace ARDOUR {
37         class Route;
38         class RouteGroup;
39         class Session;
40         class DiskStream;
41         class AudioEngine;
42 };
43
44 class MixerStrip;
45 class PluginSelector;
46
47 class Mixer_UI : public Gtk::Window, public KeyboardTarget
48 {
49   public:
50         Mixer_UI (ARDOUR::AudioEngine&);
51         ~Mixer_UI();
52
53         void connect_to_session (ARDOUR::Session *);
54         
55         PluginSelector&  plugin_selector() { return *_plugin_selector; }
56
57         void  set_strip_width (Width);
58         Width get_strip_width () const { return _strip_width; }
59
60         void unselect_strip_in_display (MixerStrip*);
61         void select_strip_in_display (MixerStrip*);
62
63         XMLNode& get_state (void);
64         int set_state (const XMLNode& );
65
66         void show_window ();
67
68         void ensure_float (Gtk::Window&);
69
70         RouteRedirectSelection& selection() { return _selection; }
71         
72   private:
73         ARDOUR::AudioEngine&     engine;
74         ARDOUR::Session         *session;
75         
76         Gtk::HBox                global_hpacker;
77         Gtk::VBox                global_vpacker;
78         Gtk::ScrolledWindow      scroller;
79         Gtk::EventBox            scroller_base;
80         Gtk::HBox                scroller_hpacker;
81         Gtk::VBox                mixer_scroller_vpacker;
82         Gtk::VBox                list_vpacker;
83         Gtk::CList               track_display_list;
84         Gtk::CList               group_list;
85         Gtk::Label               group_list_button_label;
86         Gtk::Button              group_list_button;
87         Gtk::ScrolledWindow      track_display_scroller;
88         Gtk::ScrolledWindow      group_list_scroller;
89         Gtk::VBox                group_list_vbox;
90         Gtk::Frame               track_display_frame;
91         Gtk::Frame               group_list_frame;
92         Gtk::VPaned              rhs_pane1;
93         Gtk::VPaned              rhs_pane2;
94         Gtk::HBox                strip_packer;
95         Gtk::HBox                out_packer;
96         Gtk::HPaned              list_hpane;
97
98         void pane_allocation_handler (GtkAllocation*, Gtk::Paned*);
99         
100         list<MixerStrip *> strips;
101
102         gint strip_scroller_button_release (GdkEventButton*);
103
104         void add_strip (ARDOUR::Route*);
105         void remove_strip (MixerStrip *);
106
107         void show_strip (MixerStrip *);
108         void hide_strip (MixerStrip *);
109
110         void hide_all_strips (bool with_select);
111         void unselect_all_strips();
112         void select_all_strips ();
113         void unselect_all_audiotrack_strips ();
114         void select_all_audiotrack_strips ();
115         void unselect_all_audiobus_strips ();
116         void select_all_audiobus_strips ();
117
118         void follow_strip_selection ();
119
120         gint start_updating ();
121         gint stop_updating ();
122
123         void disconnect_from_session ();
124         
125         SigC::Connection screen_update_connection;
126         void update_strips ();
127         SigC::Connection fast_screen_update_connection;
128         void fast_update_strips ();
129
130         void snapshot_display_selected (gint row, gint col, GdkEvent* ev);
131
132         void track_display_selected (gint row, gint col, GdkEvent *ev);
133         void track_display_unselected (gint row, gint col, GdkEvent *ev);
134         void queue_track_display_reordered (gint row, gint col);
135         gint track_display_reordered ();
136         void track_name_changed (MixerStrip *);
137
138         void group_selected (gint row, gint col, GdkEvent *ev);
139         void group_unselected (gint row, gint col, GdkEvent *ev);
140         gint group_list_button_press_event (GdkEventButton *);
141         void group_list_button_clicked();
142         void new_mix_group ();
143         void add_mix_group (ARDOUR::RouteGroup *);
144
145         Gtk::Menu *track_menu;
146         void track_column_click (gint);
147         void build_track_menu ();
148
149         PluginSelector    *_plugin_selector;
150
151         void strip_name_changed (void *src, MixerStrip *);
152
153         static GdkPixmap *check_pixmap;
154         static GdkBitmap *check_mask;
155         static GdkPixmap *empty_pixmap;
156         static GdkBitmap *empty_mask;
157
158         void group_flags_changed (void *src, ARDOUR::RouteGroup *);
159
160         /* snapshots */
161         
162         Gtk::CList          snapshot_display;
163         Gtk::ScrolledWindow snapshot_display_scroller;
164
165         void       redisplay_snapshots();
166         void       session_state_saved (string);
167
168         gint strip_button_release_event (GdkEventButton*, MixerStrip*);
169
170         RouteRedirectSelection _selection;
171
172         Width _strip_width;
173
174         static const int32_t default_width = -1;
175         static const int32_t default_height = 765;
176 };
177
178 #endif /* __ardour_mixer_ui_h__ */
179
180