b4d434610dc1913cc78d1769b6e3a8ea9736455c
[ardour.git] / gtk2_ardour / automation_time_axis.h
1 #ifndef __ardour_gtk_automation_time_axis_h__
2 #define __ardour_gtk_automation_time_axis_h__
3
4 #include <vector>
5 #include <list>
6 #include <string>
7 #include <ardour/types.h>
8
9 #include "canvas.h"
10 #include "time_axis_view.h"
11 #include "simplerect.h"
12
13 using std::vector;
14 using std::list;
15 using std::string;
16
17 namespace ARDOUR {
18         class Session;
19         class Route;
20 }
21
22 class PublicEditor;
23 class TimeSelection;
24 class AudioRegionSelection;
25 class PointSelection;
26 class AutomationLine;
27 class GhostRegion;
28 class Selection;
29 class Selectable;
30
31 class AutomationTimeAxisView : public TimeAxisView {
32   public:
33         AutomationTimeAxisView (ARDOUR::Session&,
34                                 ARDOUR::Route&,
35                                 PublicEditor&,
36                                 TimeAxisView& parent,
37                                 ArdourCanvas::Canvas& canvas,
38                                 const string & name, /* translatable */
39                                 const string & state_name, /* not translatable */
40                                 const string & plug_name = "");
41
42         ~AutomationTimeAxisView();
43         
44         virtual void set_height (TimeAxisView::TrackHeight);
45         void set_samples_per_unit (double);
46         std::string name() const { return _name; }
47
48         virtual void add_automation_event (ArdourCanvas::Item *item, GdkEvent *event, jack_nframes_t, double) = 0;
49
50         virtual void clear_lines ();
51         virtual void add_line (AutomationLine&);
52
53         vector<AutomationLine*> lines;
54
55         void set_selected_points (PointSelection&);
56         void get_selectables (jack_nframes_t start, jack_nframes_t end, double top, double bot, list<Selectable *>&);
57         void get_inverted_selectables (Selection&, list<Selectable*>& results);
58
59         void show_timestretch (jack_nframes_t start, jack_nframes_t end) {}
60         void hide_timestretch () {}
61
62         /* editing operations */
63         
64         bool cut_copy_clear (Selection&, Editing::CutCopyOp);
65         bool cut_copy_clear_objects (PointSelection&, Editing::CutCopyOp);
66         bool paste (jack_nframes_t, float times, Selection&, size_t nth);
67         void reset_objects (PointSelection&);
68
69         void add_ghost (GhostRegion*);
70         void remove_ghost (GhostRegion*);
71
72         void show_all_control_points ();
73         void hide_all_but_selected_control_points ();
74         void set_state (const XMLNode&);
75         XMLNode* get_state_node ();
76
77   protected:
78         ARDOUR::Route& route;
79         ArdourCanvas::SimpleRect* base_rect;
80         string _name;
81         string _state_name;
82         bool    in_destructor;
83
84         Gtk::Button        hide_button;
85         Gtk::Button        height_button;
86         Gtk::Button        clear_button;
87         Gtk::Button        auto_button; 
88         Gtk::Menu*         automation_menu;
89         Gtk::Label*        plugname;
90         bool               plugname_packed;
91
92         Gtk::CheckMenuItem*     auto_off_item;
93         Gtk::CheckMenuItem*     auto_play_item;
94         Gtk::CheckMenuItem*     auto_touch_item;
95         Gtk::CheckMenuItem*     auto_write_item;
96
97         void clear_clicked ();
98         void height_clicked ();
99         void hide_clicked ();
100         void auto_clicked ();
101
102         virtual void build_display_menu ();
103
104         list<GhostRegion*> ghosts;
105
106         bool cut_copy_clear_one (AutomationLine&, Selection&, Editing::CutCopyOp);
107         bool cut_copy_clear_objects_one (AutomationLine&, PointSelection&, Editing::CutCopyOp);
108         bool paste_one (AutomationLine&, jack_nframes_t, float times, Selection&, size_t nth);
109         void reset_objects_one (AutomationLine&, PointSelection&);
110
111         virtual void set_automation_state (ARDOUR::AutoState) = 0;
112         bool ignore_state_request;
113
114         void automation_state_changed ();
115         sigc::connection automation_connection;
116
117         void entered ();
118         void exited ();
119 };
120
121 #endif /* __ardour_gtk_automation_time_axis_h__ */