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.
21 #ifndef __ardour_route_ui__
22 #define __ardour_route_ui__
26 #include <pbd/xml++.h>
27 #include <ardour/ardour.h>
28 #include <ardour/route.h>
29 #include <ardour/track.h>
31 #include "axis_view.h"
44 class BindableToggleButton;
46 class RouteUI : public virtual AxisView
49 RouteUI(ARDOUR::Route&, ARDOUR::Session&, const char*, const char*, const char*);
52 ARDOUR::Route& route() const { return _route; }
54 bool is_track() const;
55 bool is_audio_track() const;
56 bool is_midi_track() const;
58 ARDOUR::Track* track() const;
59 ARDOUR::AudioTrack* audio_track() const;
60 ARDOUR::MidiTrack* midi_track() const;
62 ARDOUR::Diskstream* get_diskstream() const;
66 ARDOUR::Route& _route;
68 void set_color (const Gdk::Color & c);
72 bool wait_for_release;
74 BindableToggleButton* mute_button;
75 BindableToggleButton* solo_button;
76 BindableToggleButton* rec_enable_button;
78 virtual string solo_button_name () const { return "SoloButton"; }
79 virtual string safe_solo_button_name () const { return "SafeSoloButton"; }
83 Gtk::Menu* remote_control_menu;
86 void ensure_xml_node ();
88 XMLNode* get_child_xml_node (const string & childname);
90 gint mute_press(GdkEventButton*);
91 gint mute_release(GdkEventButton*);
92 gint solo_press(GdkEventButton*);
93 gint solo_release(GdkEventButton*);
94 gint rec_enable_press(GdkEventButton*);
96 void solo_changed(void*);
97 void mute_changed(void*);
98 void route_rec_enable_changed(void*);
99 void session_rec_enable_changed();
101 void build_solo_menu (void);
102 void build_remote_control_menu (void);
103 void refresh_remote_control_menu ();
105 void solo_safe_toggle (void*, Gtk::CheckMenuItem*);
106 void toggle_solo_safe (Gtk::CheckMenuItem*);
108 void toggle_mute_menu(ARDOUR::mute_type, Gtk::CheckMenuItem*);
109 void pre_fader_toggle(void*, Gtk::CheckMenuItem*);
110 void post_fader_toggle(void*, Gtk::CheckMenuItem*);
111 void control_outs_toggle(void*, Gtk::CheckMenuItem*);
112 void main_outs_toggle(void*, Gtk::CheckMenuItem*);
114 void build_mute_menu(void);
115 void init_mute_menu(ARDOUR::mute_type, Gtk::CheckMenuItem*);
117 void set_mix_group_solo(ARDOUR::Route&, bool);
118 void set_mix_group_mute(ARDOUR::Route&, bool);
119 void set_mix_group_rec_enable(ARDOUR::Route&, bool);
121 int set_color_from_route ();
123 sigc::connection blink_connection;
125 void rec_enable_button_blink (bool onoff, ARDOUR::AudioDiskstream *, Gtk::Widget *w);
127 void remove_this_route ();
128 static gint idle_remove_this_route (RouteUI *);
132 virtual void name_changed (void *src);
133 void route_removed ();
135 Gtk::CheckMenuItem *route_active_menu_item;
136 void toggle_route_active ();
137 virtual void route_active_changed ();
139 Gtk::CheckMenuItem *polarity_menu_item;
140 void toggle_polarity ();
141 virtual void polarity_changed ();
143 void disconnect_input ();
144 void disconnect_output ();
146 void update_rec_display ();
147 void update_mute_display ();
148 void update_solo_display ();
149 virtual void map_frozen ();
151 void set_remote_control_id (uint32_t id, Gtk::CheckMenuItem* item);
153 void reversibly_apply_route_boolean (string name, void (ARDOUR::Route::*func)(bool, void*), bool, void *);
154 void reversibly_apply_audio_track_boolean (string name, void (ARDOUR::AudioTrack::*func)(bool, void*), bool, void *);
157 #endif /* __ardour_route_ui__ */