Fly my pretties!
[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 "time_axis_view.h"
10
11 using std::vector;
12 using std::list;
13 using std::string;
14
15 namespace ARDOUR {
16         class Session;
17         class Route;
18 }
19
20 namespace Gtk {
21         class Widget;
22 }
23
24 class PublicEditor;
25 class TimeSelection;
26 class AudioRegionSelection;
27 class PointSelection;
28 class AutomationLine;
29 class GhostRegion;
30 class Selection;
31 class Selectable;
32
33 class AutomationTimeAxisView : public TimeAxisView {
34   public:
35         AutomationTimeAxisView (ARDOUR::Session&,
36                                 ARDOUR::Route&,
37                                 PublicEditor&,
38                                 TimeAxisView& parent,
39                                 Gtk::Widget* parent,
40                                 std::string name, /* translatable */
41                                 std::string state_name, /* not translatable */
42                                 std::string plug_name = "");
43
44         ~AutomationTimeAxisView();
45         
46         void set_height (TimeAxisView::TrackHeight);
47         void set_samples_per_unit (double);
48         std::string name() const { return _name; }
49
50         virtual void add_automation_event (GtkCanvasItem *item, GdkEvent *event, jack_nframes_t, double) = 0;
51
52         void clear_lines ();
53         void add_line (AutomationLine&);
54
55         vector<AutomationLine*> lines;
56
57         void set_selected_points (PointSelection&);
58         void get_selectables (jack_nframes_t start, jack_nframes_t end, double top, double bot, list<Selectable *>&);
59         void get_inverted_selectables (Selection&, list<Selectable*>& results);
60
61         void show_timestretch (jack_nframes_t start, jack_nframes_t end) {}
62         void hide_timestretch () {}
63
64         /* editing operations */
65         
66         bool cut_copy_clear (Selection&, Editing::CutCopyOp);
67         bool cut_copy_clear_objects (PointSelection&, Editing::CutCopyOp);
68         bool paste (jack_nframes_t, float times, Selection&, size_t nth);
69
70         void add_ghost (GhostRegion*);
71         void remove_ghost (GhostRegion*);
72
73         void show_all_control_points ();
74         void hide_all_but_selected_control_points ();
75         void set_state (const XMLNode&);
76         XMLNode* get_state_node ();
77
78   protected:
79         ARDOUR::Route& route;
80         GtkCanvasItem* base_rect;
81         string _name;
82         string _state_name;
83         bool    in_destructor;
84
85         Gtk::Button        hide_button;
86         Gtk::Button        height_button;
87         Gtk::Button        clear_button;
88         Gtk::Button        auto_button; 
89         Gtk::Menu*         automation_menu;
90         Gtk::Label*        plugname;
91         bool               plugname_packed;
92
93         Gtk::CheckMenuItem*     auto_off_item;
94         Gtk::CheckMenuItem*     auto_play_item;
95         Gtk::CheckMenuItem*     auto_touch_item;
96         Gtk::CheckMenuItem*     auto_write_item;
97
98         void clear_clicked ();
99         void height_clicked ();
100         void hide_clicked ();
101         void auto_clicked ();
102
103         virtual void build_display_menu ();
104
105         list<GhostRegion*> ghosts;
106
107         bool cut_copy_clear_one (AutomationLine&, Selection&, Editing::CutCopyOp);
108         bool cut_copy_clear_objects_one (AutomationLine&, PointSelection&, Editing::CutCopyOp);
109         bool paste_one (AutomationLine&, jack_nframes_t, float times, Selection&, size_t nth);
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__ */