c93bf5c3b1dac5d86cbf485fb1712e83b30fa3e9
[ardour.git] / gtk2_ardour / master_bus_ui.h
1 /*
2         Copyright (C) 2014 Waves Audio Ltd.
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 */
19
20 #ifndef __tracks_master_bus_ui_h__
21 #define __tracks_master_bus_ui_h__
22
23 #include <list>
24 #include <set>
25
26 #include <gtkmm/table.h>
27 #include <gtkmm/button.h>
28 #include <gtkmm/box.h>
29 #include <gtkmm/menu.h>
30 #include <gtkmm/menuitem.h>
31 #include <gtkmm/radiomenuitem.h>
32 #include <gtkmm/checkmenuitem.h>
33 #include <gtkmm/adjustment.h>
34
35 #include <gtkmm2ext/selector.h>
36 #include <gtkmm2ext/slider_controller.h>
37
38 #include "ardour/playlist.h"
39 #include "ardour/types.h"
40 #include "ardour/route_group.h"
41
42 #include "route_ui.h"
43 #include "enums.h"
44 #include "gain_meter.h"
45
46 class MasterBusUI : public Gtk::EventBox, public WavesUI
47 {
48 public:
49         MasterBusUI (ARDOUR::Session*, PublicEditor&);
50     void init(ARDOUR::Session* session);
51         virtual ~MasterBusUI ();
52
53     void fast_update ();
54         void set_route (boost::shared_ptr<ARDOUR::Route>);
55     void update_master_bus_selection();
56         static PBD::Signal1<void,MasterBusUI*> CatchDeletion;
57
58 private:
59         static int __meter_width;
60         float _max_peak;
61         float _peak_treshold;
62
63         void reset ();
64         void meter_configuration_changed (ARDOUR::ChanCount);
65         void reset_peak_display ();
66         void reset_route_peak_display (ARDOUR::Route* route);
67         void reset_group_peak_display (ARDOUR::RouteGroup* group);
68         void on_peak_display_button (WavesButton*);
69         void on_master_mute_button (WavesButton*);
70     void on_clear_solo_button (WavesButton*);
71         void on_global_rec_button (WavesButton*);
72     void on_output_connection_mode_changed ();
73     bool on_level_meter_button_press (GdkEventButton*);
74     bool on_master_event_box_button_release (GdkEventButton*);
75     
76     PBD::ScopedConnection _route_meter_connection;
77     
78     // MASTER staff
79     void connect_route_state_signals(ARDOUR::RouteList& tracks);
80     void update_master();
81     
82     // GLOBAL RECORD staff
83     PBD::ScopedConnectionList _route_state_connections;
84     PBD::ScopedConnectionList _session_connections;
85     
86     void record_state_changed ();
87     bool check_all_tracks_are_record_armed ();
88     
89     // MASTER MUTE staff
90     void route_mute_state_changed (void* );
91     bool check_all_tracks_are_muted();
92     
93     // CLEAR SOLO staff
94     void solo_blink (bool onoff);
95     bool exists_soloed_track();
96         
97         boost::shared_ptr<ARDOUR::Route> _route;
98     PBD::ScopedConnection _mode_connection;
99     PBD::ScopedConnection _output_mode_connection;
100
101         Gtk::Box& _level_meter_home;
102         LevelMeterHBox _level_meter;
103         WavesButton& _peak_display_button;
104         WavesButton& _master_mute_button;
105         WavesButton& _clear_solo_button;
106         WavesButton& _global_rec_button;
107     Gtk::EventBox& _no_peak_display_box;
108     Gtk::Image& _master_bus_multi_out_mode_icon;
109     Gtk::Container& _master_event_box;
110     
111     PublicEditor& _editor;
112     
113     bool _selected;
114     bool _ignore_mute_upadte;
115 };
116
117 #endif /* __tracks_master_bus_ui_h__ */
118