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