just use show() and hide() to manage control point visibility in automation lines
[ardour.git] / gtk2_ardour / control_point.h
1 /*
2     Copyright (C) 2002-2007 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
20 #ifndef __ardour_control_point_h__
21 #define __ardour_control_point_h__
22
23 #include <sys/types.h>
24 #include <gdk/gdkevents.h>
25
26 #include "ardour/automation_list.h"
27
28 #include "selectable.h"
29
30 class AutomationLine;
31 class ControlPoint;
32 class PointSelection;
33 class TimeAxisView;
34 class AutomationTimeAxisView;
35 class Selectable;
36 class Selection;
37
38 namespace ArdourCanvas {
39         class Rectangle;
40         class Diamond;
41 }
42
43 class ControlPoint : public Selectable
44 {
45   public:
46         ControlPoint (AutomationLine& al);
47         ControlPoint (const ControlPoint&, bool dummy_arg_to_force_special_copy_constructor);
48         virtual ~ControlPoint ();
49
50         enum ShapeType {
51                 Full,
52                 Start,
53                 End
54         };
55
56         void move_to (double x, double y, ShapeType);
57         void reset (double x, double y, ARDOUR::AutomationList::iterator, uint32_t, ShapeType);
58         double get_x() const { return _x; }
59         double get_y() const { return _y; }
60
61         void hide ();
62         void show ();
63         bool visible () const;
64
65         double size () const {
66                 return _size;
67         }
68
69         void set_size (double);
70         void set_color ();
71
72         bool     can_slide() const          { return _can_slide; }
73         void     set_can_slide(bool yn)     { _can_slide = yn; }
74         uint32_t view_index() const         { return _view_index; }
75         void     set_view_index(uint32_t i) { _view_index = i; }
76
77         void i2w (double &, double &) const;
78
79         ARDOUR::AutomationList::iterator model() const { return _model; }
80         AutomationLine&                  line()  const { return _line; }
81
82         static PBD::Signal1<void, ControlPoint *> CatchDeletion;
83         
84   private:
85         ArdourCanvas::Rectangle*        _item;
86         AutomationLine&                  _line;
87         ARDOUR::AutomationList::iterator _model;
88         uint32_t                         _view_index;
89         bool                             _can_slide;
90         double                           _x;
91         double                           _y;
92         double                           _size;
93         ShapeType                        _shape;
94
95         virtual bool event_handler (GdkEvent*);
96
97 };
98
99
100 #endif /* __ardour_control_point_h__ */
101