Fix my name :)
[ardour.git] / gtk2_ardour / automation_region_view.h
1 /*
2     Copyright (C) 2007 Paul Davis
3     Author: David Robillard
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #ifndef __gtk_ardour_automation_region_view_h__
21 #define __gtk_ardour_automation_region_view_h__
22
23 #include "ardour/types.h"
24
25 #include "region_view.h"
26 #include "automation_time_axis.h"
27 #include "automation_line.h"
28 #include "enums.h"
29 #include "canvas.h"
30
31 namespace ARDOUR {
32         class AutomationList;
33         class Parameter;
34 };
35
36 class TimeAxisView;
37
38 class AutomationRegionView : public RegionView
39 {
40 public:
41         AutomationRegionView(ArdourCanvas::Group*,
42                              AutomationTimeAxisView&,
43                              boost::shared_ptr<ARDOUR::Region>,
44                              const Evoral::Parameter& parameter,
45                              boost::shared_ptr<ARDOUR::AutomationList>,
46                              double initial_samples_per_unit,
47                              Gdk::Color const & basic_color);
48
49         ~AutomationRegionView() {}
50
51         void init (Gdk::Color const & basic_color, bool wfd);
52
53         inline AutomationTimeAxisView* automation_view() const
54                 { return dynamic_cast<AutomationTimeAxisView*>(&trackview); }
55
56         boost::shared_ptr<AutomationLine> line() { return _line; }
57
58         // We are a ghost.  Meta ghosts?  Crazy talk.
59         virtual GhostRegion* add_ghost(TimeAxisView&) { return NULL; }
60
61         void set_height (double);
62         void reset_width_dependent_items(double pixel_width);
63
64 protected:
65         void create_line(boost::shared_ptr<ARDOUR::AutomationList> list);
66         bool set_position(framepos_t pos, void* src, double* ignored);
67         void region_resized (const PBD::PropertyChange&);
68         bool canvas_event(GdkEvent* ev);
69         void add_automation_event (GdkEvent* event, framepos_t when, double y);
70         void entered (bool);
71         void exited();
72
73 private:
74         Evoral::Parameter                 _parameter;
75         boost::shared_ptr<AutomationLine> _line;
76 };
77
78 #endif /* __gtk_ardour_automation_region_view_h__ */