Ardour  9.0-pre0-582-g084a23a80d
ui_knob.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
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 along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef _ardour_maschine2_knob_h_
20 #define _ardour_maschine2_knob_h_
21 
22 #include <memory>
23 
24 #include <sigc++/trackable.h>
25 
26 #include <cairomm/refptr.h>
27 
28 #include "pbd/signals.h"
29 
30 #include "canvas/container.h"
31 
32 namespace ArdourCanvas {
33  class Text;
34 }
35 
36 namespace ARDOUR {
37  class AutomationControl;
38 }
39 
40 namespace Cairo {
41  class Context;
42  class Region;
43 }
44 
45 namespace ArdourSurface {
46 
47 class Maschine2;
48 class M2EncoderInterface;
49 
50 class Maschine2Knob : public sigc::trackable, public ArdourCanvas::Container
51 {
52  public:
54  virtual ~Maschine2Knob ();
55 
56  void set_controllable (std::shared_ptr<ARDOUR::AutomationControl>);
58  std::shared_ptr<ARDOUR::AutomationControl> controllable() const { return _controllable; }
59 
60  void render (ArdourCanvas::Rect const &, Cairo::RefPtr<Cairo::Context>) const;
61  void compute_bounding_box() const;
62 
63  protected:
65  void encoder_changed (int);
66 
69 
70  std::shared_ptr<ARDOUR::AutomationControl> _controllable;
72 
73  private:
75 
76  float _radius;
77  float _val; // current value [0..1]
78  float _normal; // default value, arc
79 
81 };
82 
83 } // namespace
84 
85 #endif
std::shared_ptr< ARDOUR::AutomationControl > _controllable
Definition: ui_knob.h:70
M2EncoderInterface * _ctrl
Definition: ui_knob.h:71
PBD::ScopedConnection watch_connection
Definition: ui_knob.h:67
std::shared_ptr< ARDOUR::AutomationControl > controllable() const
Definition: ui_knob.h:58
Maschine2Knob(PBD::EventLoop *, ArdourCanvas::Item *)
PBD::EventLoop * _eventloop
Definition: ui_knob.h:74
void set_control(M2EncoderInterface *)
ArdourCanvas::Text * text
Definition: ui_knob.h:80
PBD::ScopedConnection encoder_connection
Definition: ui_knob.h:68
void set_controllable(std::shared_ptr< ARDOUR::AutomationControl >)
void render(ArdourCanvas::Rect const &, Cairo::RefPtr< Cairo::Context >) const