fix keyboard event handling for host-provided plugin GUIs
[ardour2.git] / gtk2_ardour / automation_time_axis.h
bloba92dc445f405ea51073ad74fb0b9d601b7260270
1 /*
2 Copyright (C) 2000-2007 Paul Davis
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.
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.
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.
20 #ifndef __ardour_gtk_automation_time_axis_h__
21 #define __ardour_gtk_automation_time_axis_h__
23 #include <vector>
24 #include <list>
25 #include <string>
27 #include <boost/shared_ptr.hpp>
29 #include <ardour/types.h>
31 #include "canvas.h"
32 #include "time_axis_view.h"
33 #include "simplerect.h"
35 using std::vector;
36 using std::list;
37 using std::string;
39 namespace ARDOUR {
40 class Session;
41 class Route;
44 class PublicEditor;
45 class TimeSelection;
46 class RegionSelection;
47 class PointSelection;
48 class AutomationLine;
49 class GhostRegion;
50 class Selection;
51 class Selectable;
53 class AutomationTimeAxisView : public TimeAxisView {
54 public:
55 AutomationTimeAxisView (ARDOUR::Session&,
56 boost::shared_ptr<ARDOUR::Route>,
57 PublicEditor&,
58 TimeAxisView& parent,
59 ArdourCanvas::Canvas& canvas,
60 const string & name, /* translatable */
61 const string & state_name, /* not translatable */
62 const string & plug_name = "");
64 ~AutomationTimeAxisView();
66 virtual void set_height (uint32_t);
67 void set_samples_per_unit (double);
68 std::string name() const { return _name; }
70 virtual void add_automation_event (ArdourCanvas::Item *item, GdkEvent *event, nframes_t, double) = 0;
72 virtual void clear_lines ();
73 virtual void add_line (AutomationLine&);
75 vector<AutomationLine*> lines;
77 void set_selected_points (PointSelection&);
78 void get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable *>&);
79 void get_inverted_selectables (Selection&, list<Selectable*>& results);
81 void show_timestretch (nframes_t start, nframes_t end) {}
82 void hide_timestretch () {}
84 /* editing operations */
86 bool cut_copy_clear (Selection&, Editing::CutCopyOp);
87 bool cut_copy_clear_objects (PointSelection&, Editing::CutCopyOp);
88 bool paste (nframes_t, float times, Selection&, size_t nth);
89 void reset_objects (PointSelection&);
91 void add_ghost (GhostRegion*);
92 void remove_ghost (GhostRegion*);
94 void show_all_control_points ();
95 void hide_all_but_selected_control_points ();
96 int set_state (const XMLNode&);
97 XMLNode* get_state_node ();
99 protected:
100 boost::shared_ptr<ARDOUR::Route> route;
101 ArdourCanvas::SimpleRect* base_rect;
102 string _name;
103 string _state_name;
104 bool in_destructor;
106 bool first_call_to_set_height;
108 Gtk::Button hide_button;
109 Gtk::Button clear_button;
110 Gtk::Button auto_button;
111 Gtk::Menu* automation_menu;
112 Gtk::Label* plugname;
113 bool plugname_packed;
115 Gtk::CheckMenuItem* auto_off_item;
116 Gtk::CheckMenuItem* auto_play_item;
117 Gtk::CheckMenuItem* auto_touch_item;
118 Gtk::CheckMenuItem* auto_write_item;
120 void clear_clicked ();
121 void hide_clicked ();
122 void auto_clicked ();
124 virtual void build_display_menu ();
126 list<GhostRegion*> ghosts;
128 bool cut_copy_clear_one (AutomationLine&, Selection&, Editing::CutCopyOp);
129 bool cut_copy_clear_objects_one (AutomationLine&, PointSelection&, Editing::CutCopyOp);
130 bool paste_one (AutomationLine&, nframes_t, float times, Selection&, size_t nth);
131 void reset_objects_one (AutomationLine&, PointSelection&);
133 virtual void set_automation_state (ARDOUR::AutoState) = 0;
134 bool ignore_state_request;
136 void automation_state_changed ();
137 sigc::connection automation_connection;
139 void entered ();
140 void exited ();
142 void set_colors ();
143 void color_handler ();
145 static Pango::FontDescription* name_font;
146 static bool have_name_font;
149 #endif /* __ardour_gtk_automation_time_axis_h__ */