continuing fixes to get this shibboleth to compile
[ardour.git] / gtk2_ardour / route_ui.h
1 /*
2     Copyright (C) 2002 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_route_ui__
22 #define __ardour_route_ui__
23
24 #include <list>
25
26 #include <gtkmm.h>
27 #include <pbd/xml++.h>
28 #include <ardour/ardour.h>
29 #include <ardour/route.h>
30
31 #include "axis_view.h"
32
33 namespace Gtkmm2ext {
34         class BindableToggleButton;
35 }
36
37 namespace ARDOUR {
38         class AudioTrack;
39 }
40
41 class RouteUI : public virtual AxisView
42 {
43   public:
44         RouteUI(ARDOUR::Route&, ARDOUR::Session&, const char*, const char*, const char*);
45         virtual ~RouteUI();
46
47         bool is_audio_track() const;
48         ARDOUR::DiskStream* get_diskstream() const;
49
50         ARDOUR::Route& route() const { return _route; }
51         ARDOUR::AudioTrack* audio_track() const;
52
53         string name() const;
54         
55         ARDOUR::Route& _route;
56         
57         void set_color (Gdk::Color c);
58         bool choose_color ();
59
60         bool ignore_toggle;
61         bool wait_for_release;
62
63         Gtkmm2ext::BindableToggleButton * mute_button;
64         Gtkmm2ext::BindableToggleButton * solo_button;
65         Gtkmm2ext::BindableToggleButton * rec_enable_button;
66         
67         virtual string solo_button_name () const { return "SoloButton"; }
68         virtual string safe_solo_button_name () const { return "SafeSoloButton"; }
69         
70         Gtk::Menu* mute_menu;
71         Gtk::Menu* solo_menu;
72
73         XMLNode *xml_node;
74         void ensure_xml_node ();
75
76         XMLNode* get_child_xml_node (std::string childname);
77         
78         gint mute_press(GdkEventButton*);
79         gint mute_release(GdkEventButton*);
80         gint solo_press(GdkEventButton*);
81         gint solo_release(GdkEventButton*);
82         gint rec_enable_press(GdkEventButton*);
83
84         void solo_changed(void*);
85         void mute_changed(void*);
86         void route_rec_enable_changed(void*);
87         void session_rec_enable_changed();
88
89         void build_solo_menu (void);
90
91         void solo_safe_toggle (void*, Gtk::CheckMenuItem*);
92         void toggle_solo_safe (Gtk::CheckMenuItem*);
93
94         void toggle_mute_menu(ARDOUR::mute_type, Gtk::CheckMenuItem*);
95         void pre_fader_toggle(void*, Gtk::CheckMenuItem*);
96         void post_fader_toggle(void*, Gtk::CheckMenuItem*);
97         void control_outs_toggle(void*, Gtk::CheckMenuItem*);
98         void main_outs_toggle(void*, Gtk::CheckMenuItem*);
99
100         void build_mute_menu(void);
101         void init_mute_menu(ARDOUR::mute_type, Gtk::CheckMenuItem*);
102         
103         void set_mix_group_solo(ARDOUR::Route&, bool);
104         void set_mix_group_mute(ARDOUR::Route&, bool);
105         void set_mix_group_rec_enable(ARDOUR::Route&, bool);
106
107         int  set_color_from_route ();
108
109         sigc::connection blink_connection;
110
111         void rec_enable_button_blink (bool onoff, ARDOUR::DiskStream *, Gtk::Widget *w);
112         
113         void remove_this_route ();
114         static gint idle_remove_this_route (RouteUI *);
115
116         void route_rename();
117         
118         virtual void name_changed (void *src);
119         void route_removed ();
120
121         static gint okay_gplusplus_cannot_do_complex_templates (RouteUI *rui);
122
123         Gtk::CheckMenuItem *route_active_menu_item;
124         void toggle_route_active ();
125         virtual void route_active_changed ();
126
127         void disconnect_input ();
128         void disconnect_output ();
129
130         void update_rec_display ();
131         void update_mute_display ();
132         void update_solo_display ();
133         virtual void map_frozen ();
134
135         void reversibly_apply_route_boolean (string name, void (ARDOUR::Route::*func)(bool, void*), bool, void *);
136         void reversibly_apply_audio_track_boolean (string name, void (ARDOUR::AudioTrack::*func)(bool, void*), bool, void *);
137 };
138
139 #endif /* __ardour_route_ui__ */