MCP: reverse operation of cursor up/down in zoom mode; more tracign for vpot
[ardour.git] / libs / surfaces / mackie / strip.h
1 #ifndef __ardour_mackie_control_protocol_strip_h__
2 #define __ardour_mackie_control_protocol_strip_h__
3
4 #include <string>
5 #include <iostream>
6
7 #include "pbd/property_basics.h"
8 #include "pbd/signals.h"
9
10 #include "control_group.h"
11 #include "types.h"
12 #include "midi_byte_array.h"
13
14 namespace ARDOUR {
15         class Route;
16 }
17
18 namespace Mackie {
19
20 class Control;
21 class Surface;
22 class Button;
23 class Pot;
24 class Fader;
25 class Meter;
26 class SurfacePort;
27
28 struct StripControlDefinition {
29     const char* name;
30     uint32_t base_id;
31     Control* (*factory)(Surface&, int index, const char* name, Group&);
32 };
33
34 struct GlobalControlDefinition {
35     const char* name;
36     uint32_t id;
37     Control* (*factory)(Surface&, int index, const char* name, Group&);
38     const char* group_name;
39 };
40
41 /**
42         This is the set of controls that make up a strip.
43 */
44 class Strip : public Group
45 {
46 public:
47         Strip (Surface&, const std::string & name, int index, StripControlDefinition* ctls);
48         ~Strip();
49
50         boost::shared_ptr<ARDOUR::Route> route() const { return _route; }
51
52         void add (Control & control);
53         int index() const { return _index; } // zero based
54         
55         void set_route (boost::shared_ptr<ARDOUR::Route>);
56
57         // call all signal handlers manually
58         void notify_all();
59
60         void handle_button (Button&, ButtonState bs);
61         void handle_fader (Fader&, float position);
62         void handle_pot (Pot&, float delta);
63
64         void periodic ();
65
66         MidiByteArray display (uint32_t line_number, const std::string&);
67         MidiByteArray blank_display (uint32_t line_number);
68         MidiByteArray zero ();
69
70         void lock_route ();
71         void unlock_route ();
72         
73 private:
74         Button* _solo;
75         Button* _recenable;
76         Button* _mute;
77         Button* _select;
78         Button* _vselect;
79         Button* _fader_touch;
80         Pot*    _vpot;
81         Fader*  _fader;
82         Meter*  _meter;
83         int     _index;
84         Surface* _surface;
85         bool     _route_locked;
86
87         boost::shared_ptr<ARDOUR::Route> _route;
88         PBD::ScopedConnectionList route_connections;
89
90         float _last_fader_position_written;
91         float _last_vpot_position_written;
92
93         void notify_solo_changed ();
94         void notify_mute_changed ();
95         void notify_record_enable_changed ();
96         void notify_gain_changed (bool force_update = true);
97         void notify_property_changed (const PBD::PropertyChange&);
98         void notify_panner_changed (bool force_update = true);
99         void notify_active_changed ();
100         void notify_route_deleted ();
101         
102         void update_automation ();
103         void update_meter ();
104
105 };
106
107 }
108
109 #endif /* __ardour_mackie_control_protocol_strip_h__ */