2 Copyright (C) 2002 Paul Davis
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.
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.
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.
20 #ifndef __ardour_route_ui__
21 #define __ardour_route_ui__
25 #include <pbd/xml++.h>
26 #include <ardour/ardour.h>
27 #include <ardour/route.h>
28 #include <ardour/track.h>
30 #include "axis_view.h"
42 class BindableToggleButton
;
44 class RouteUI
: public virtual AxisView
47 RouteUI(ARDOUR::Session
&, const char*, const char*, const char*);
48 RouteUI(boost::shared_ptr
<ARDOUR::Route
>, ARDOUR::Session
&, const char*, const char*, const char*);
52 virtual void set_route (boost::shared_ptr
<ARDOUR::Route
>);
53 void set_button_names (const char*, const char*, const char*);
55 bool is_track() const;
56 bool is_audio_track() const;
58 boost::shared_ptr
<ARDOUR::Route
> route() const { return _route
; }
59 boost::shared_ptr
<ARDOUR::Track
> track() const;
60 boost::shared_ptr
<ARDOUR::AudioTrack
> audio_track() const;
61 boost::shared_ptr
<ARDOUR::Diskstream
> get_diskstream() const;
65 // protected: XXX sigh this should be here
67 boost::shared_ptr
<ARDOUR::Route
> _route
;
69 void set_color (const Gdk::Color
& c
);
73 bool wait_for_release
;
74 bool multiple_mute_change
;
75 bool multiple_solo_change
;
77 BindableToggleButton
* mute_button
;
78 BindableToggleButton
* solo_button
;
79 BindableToggleButton
* rec_enable_button
;
81 virtual string
solo_button_name () const { return "SoloButton"; }
82 virtual string
safe_solo_button_name () const { return "SafeSoloButton"; }
86 Gtk::Menu
* remote_control_menu
;
89 void ensure_xml_node ();
91 XMLNode
* get_child_xml_node (const string
& childname
);
93 void save_as_template ();
95 bool mute_press(GdkEventButton
*);
96 bool mute_release(GdkEventButton
*);
97 bool solo_press(GdkEventButton
*);
98 bool solo_release(GdkEventButton
*);
99 bool rec_enable_press(GdkEventButton
*);
100 bool rec_enable_release(GdkEventButton
*);
102 void solo_changed(void*);
103 void solo_changed_so_update_mute ();
104 void mute_changed(void*);
105 virtual void redirects_changed (void *) {}
106 void route_rec_enable_changed();
107 void session_rec_enable_changed();
109 void build_solo_menu (void);
110 void build_remote_control_menu (void);
111 void refresh_remote_control_menu ();
113 void solo_safe_toggle (void*, Gtk::CheckMenuItem
*);
114 void toggle_solo_safe (Gtk::CheckMenuItem
*);
116 void toggle_mute_menu(ARDOUR::mute_type
, Gtk::CheckMenuItem
*);
117 void pre_fader_toggle(void*, Gtk::CheckMenuItem
*);
118 void post_fader_toggle(void*, Gtk::CheckMenuItem
*);
119 void control_outs_toggle(void*, Gtk::CheckMenuItem
*);
120 void main_outs_toggle(void*, Gtk::CheckMenuItem
*);
122 void build_mute_menu(void);
123 void init_mute_menu(ARDOUR::mute_type
, Gtk::CheckMenuItem
*);
125 void set_mix_group_solo(boost::shared_ptr
<ARDOUR::Route
>, bool);
126 void set_mix_group_mute(boost::shared_ptr
<ARDOUR::Route
>, bool);
127 void set_mix_group_rec_enable(boost::shared_ptr
<ARDOUR::Route
>, bool);
129 int set_color_from_route ();
131 void remove_this_route ();
132 static gint
idle_remove_this_route (RouteUI
*);
136 virtual void name_changed (void *src
);
137 void route_removed ();
139 Gtk::CheckMenuItem
*route_active_menu_item
;
140 void toggle_route_active ();
141 virtual void route_active_changed ();
143 Gtk::CheckMenuItem
*polarity_menu_item
;
144 void toggle_polarity ();
145 virtual void polarity_changed ();
147 Gtk::CheckMenuItem
*denormal_menu_item
;
148 void toggle_denormal_protection();
149 virtual void denormal_protection_changed ();
151 void disconnect_input ();
152 void disconnect_output ();
154 virtual void update_rec_display ();
155 void update_mute_display ();
158 void update_solo_display ();
160 virtual void map_frozen ();
162 void set_remote_control_id (uint32_t id
, Gtk::CheckMenuItem
* item
);
164 void reversibly_apply_route_boolean (string name
, void (ARDOUR::Route::*func
)(bool, void*), bool, void *);
165 void reversibly_apply_audio_track_boolean (string name
, void (ARDOUR::AudioTrack::*func
)(bool, void*), bool, void *);
168 std::vector
<sigc::connection
> connections
;
178 void save_template (const std::string
&);
181 #endif /* __ardour_route_ui__ */