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