push2: tweak layout APIs etc.
[ardour.git] / libs / surfaces / push2 / mix.h
1 /*
2     Copyright (C) 2016 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
19 #ifndef __ardour_push2_mix_layout_h__
20 #define __ardour_push2_mix_layout_h__
21
22 #include "layout.h"
23 #include "push2.h"
24
25 namespace ARDOUR {
26         class Stripable;
27 }
28
29 namespace ArdourCanvas {
30         class Rectangle;
31         class Text;
32         class Line;
33 }
34
35 namespace ArdourSurface {
36
37 class Push2Knob;
38 class LevelMeter;
39
40 class MixLayout : public Push2Layout
41 {
42    public:
43         MixLayout (Push2& p, ARDOUR::Session&, std::string const &);
44         ~MixLayout ();
45
46         void render (ArdourCanvas::Rect const &, Cairo::RefPtr<Cairo::Context>) const;
47         void show ();
48
49         void button_upper (uint32_t n);
50         void button_lower (uint32_t n);
51         void button_down ();
52         void button_up ();
53         void button_left ();
54         void button_right ();
55         void button_select_press ();
56         void button_select_release ();
57         void button_solo ();
58         void button_mute ();
59
60         void strip_vpot (int, int);
61         void strip_vpot_touch (int, bool);
62
63         void update_meters ();
64
65   private:
66         ArdourCanvas::Rectangle* bg;
67         ArdourCanvas::Line* upper_line;
68         std::vector<ArdourCanvas::Text*> upper_text;
69         std::vector<ArdourCanvas::Text*> lower_text;
70         std::vector<ArdourCanvas::Rectangle*> upper_backgrounds;
71         std::vector<ArdourCanvas::Rectangle*> lower_backgrounds;
72
73         struct GainMeter : public ArdourCanvas::Container {
74                 GainMeter (Item* parent, Push2&);
75
76                 Push2Knob* knob;
77                 LevelMeter* meter;
78         };
79
80         GainMeter* gain_meter[8];
81
82         /* stripables */
83
84         int32_t bank_start;
85         PBD::ScopedConnectionList stripable_connections;
86         boost::shared_ptr<ARDOUR::Stripable> stripable[8];
87
88         PBD::ScopedConnectionList session_connections;
89         void stripables_added ();
90
91         void stripable_property_change (PBD::PropertyChange const& what_changed, uint32_t which);
92
93         void switch_bank (uint32_t base);
94
95         enum VPotMode {
96                 Volume,
97                 PanAzimuth,
98                 PanWidth,
99                 Send1, Send2, Send3, Send4, Send5
100         };
101
102         Push2::Button* mode_button;
103         VPotMode vpot_mode;
104         void show_vpot_mode ();
105
106         void solo_changed (uint32_t n);
107         void mute_changed (uint32_t n);
108         void solo_mute_changed (uint32_t n);
109         void show_selection (uint32_t n);
110         void hide_selection (uint32_t n);
111 };
112
113 } /* namespace */
114
115 #endif /* __ardour_push2_layout_h__ */