This one's for oofus: optionally show solo mute status (FEATURE FREEZE my ass!)
[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 <pbd/xml++.h>
27 #include <ardour/ardour.h>
28 #include <ardour/route.h>
29 #include <ardour/track.h>
30
31 #include "axis_view.h"
32
33 namespace ARDOUR {
34         class AudioTrack;
35 }
36
37 namespace Gtk {
38         class Menu;
39         class CheckMenuItem;
40         class Widget;
41 }
42
43 class BindableToggleButton;
44
45 class RouteUI : public virtual AxisView
46 {
47   public:
48         RouteUI(boost::shared_ptr<ARDOUR::Route>, ARDOUR::Session&, const char*, const char*, const char*);
49         virtual ~RouteUI();
50
51         bool is_track() const;
52         bool is_audio_track() const;
53
54         boost::shared_ptr<ARDOUR::Route> route() const { return _route; }
55         
56         // FIXME: make these return shared_ptr
57         ARDOUR::Track*      track() const;
58         ARDOUR::AudioTrack* audio_track() const;
59         
60         boost::shared_ptr<ARDOUR::Diskstream> get_diskstream() const;
61
62         string name() const;
63
64         // protected: XXX sigh this should be here
65
66         boost::shared_ptr<ARDOUR::Route> _route;
67         
68         void set_color (const Gdk::Color & c);
69         bool choose_color ();
70
71         bool ignore_toggle;
72         bool wait_for_release;
73
74         BindableToggleButton* mute_button;
75         BindableToggleButton* solo_button;
76         BindableToggleButton* rec_enable_button;
77         
78         virtual string solo_button_name () const { return "SoloButton"; }
79         virtual string safe_solo_button_name () const { return "SafeSoloButton"; }
80         
81         Gtk::Menu* mute_menu;
82         Gtk::Menu* solo_menu;
83         Gtk::Menu* remote_control_menu;
84
85         XMLNode *xml_node;
86         void ensure_xml_node ();
87
88         XMLNode* get_child_xml_node (const string & childname);
89         
90         bool mute_press(GdkEventButton*);
91         bool mute_release(GdkEventButton*);
92         bool solo_press(GdkEventButton*);
93         bool solo_release(GdkEventButton*);
94         bool rec_enable_press(GdkEventButton*);
95         bool rec_enable_release(GdkEventButton*);
96
97         void solo_changed(void*);
98         void solo_changed_so_update_mute ();
99         void mute_changed(void*);
100         virtual void redirects_changed (void *) {}
101         void route_rec_enable_changed();
102         void session_rec_enable_changed();
103
104         void build_solo_menu (void);
105         void build_remote_control_menu (void);
106         void refresh_remote_control_menu ();
107
108         void solo_safe_toggle (void*, Gtk::CheckMenuItem*);
109         void toggle_solo_safe (Gtk::CheckMenuItem*);
110
111         void toggle_mute_menu(ARDOUR::mute_type, Gtk::CheckMenuItem*);
112         void pre_fader_toggle(void*, Gtk::CheckMenuItem*);
113         void post_fader_toggle(void*, Gtk::CheckMenuItem*);
114         void control_outs_toggle(void*, Gtk::CheckMenuItem*);
115         void main_outs_toggle(void*, Gtk::CheckMenuItem*);
116
117         void build_mute_menu(void);
118         void init_mute_menu(ARDOUR::mute_type, Gtk::CheckMenuItem*);
119         
120         void set_mix_group_solo(boost::shared_ptr<ARDOUR::Route>, bool);
121         void set_mix_group_mute(boost::shared_ptr<ARDOUR::Route>, bool);
122         void set_mix_group_rec_enable(boost::shared_ptr<ARDOUR::Route>, bool);
123
124         int  set_color_from_route ();
125
126         sigc::connection blink_connection;
127
128         void rec_enable_button_blink (bool onoff, ARDOUR::AudioDiskstream *, Gtk::Widget *w);
129         
130         void remove_this_route ();
131         static gint idle_remove_this_route (RouteUI *);
132
133         void route_rename();
134         
135         virtual void name_changed (void *src);
136         void route_removed ();
137
138         Gtk::CheckMenuItem *route_active_menu_item;
139         void toggle_route_active ();
140         virtual void route_active_changed ();
141
142         Gtk::CheckMenuItem *polarity_menu_item;
143         void toggle_polarity ();
144         virtual void polarity_changed ();
145
146         void disconnect_input ();
147         void disconnect_output ();
148
149         void update_rec_display ();
150         void update_mute_display ();
151
152         bool was_solo_safe;
153         void update_solo_display ();
154
155         virtual void map_frozen ();
156
157         void set_remote_control_id (uint32_t id, Gtk::CheckMenuItem* item);
158
159         void reversibly_apply_route_boolean (string name, void (ARDOUR::Route::*func)(bool, void*), bool, void *);
160         void reversibly_apply_audio_track_boolean (string name, void (ARDOUR::AudioTrack::*func)(bool, void*), bool, void *);
161 };
162
163 #endif /* __ardour_route_ui__ */