add note onset detection to the ferret, c/o the aubio-based Onset VAMP plugin (REQUIR...
[ardour.git] / gtk2_ardour / public_editor.h
1 /*
2     Copyright (C) 2000-2007 Paul Davis 
3
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.
8
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.
13
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.
17
18 */
19
20 #ifndef __gtk_ardour_public_editor_h__
21 #define __gtk_ardour_public_editor_h__
22
23 #include <map>
24
25 #include <string>
26 #include <glib.h>
27 #include <gdk/gdktypes.h>
28 #include <gtkmm/window.h>
29 #include <gtkmm/box.h>
30 #include <gtkmm/actiongroup.h>
31 #include <jack/types.h>
32 #include <sigc++/signal.h>
33
34 #include <pbd/statefuldestructible.h> 
35
36 #include "editing.h"
37 #include "canvas.h"
38 #include "selection.h"
39
40 namespace ARDOUR {
41         class Session;
42         class AudioExportSpecification;
43         class Region;
44         class Playlist;
45         class RouteGroup;
46 }
47
48 namespace Gtk {
49         class Container;
50         class Menu;
51 }
52
53 class Editor;
54 class TimeAxisViewItem;
55 class TimeAxisView;
56 class PluginUIWindow;
57 class PluginSelector;
58 class PlaylistSelector;
59 class XMLNode;
60 class Selection;
61 class AutomationLine;
62 class ControlPoint;
63 class SelectionRect;
64 class CrossfadeView;
65 class RouteTimeAxisView;
66 class AudioRegionView;
67 class TempoMarker;
68 class MeterMarker;
69 class Marker;
70 class AutomationTimeAxisView;
71 class MarkerTimeAxis;
72 class ImageFrameView;
73 class ImageFrameTimeAxis;
74 class MarkerView;
75
76 class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway {
77   public:
78         PublicEditor();
79         virtual ~PublicEditor();
80
81         typedef TrackSelection TrackViewList;
82
83         static PublicEditor& instance() { return *_instance; }
84
85         virtual void             connect_to_session (ARDOUR::Session*) = 0;
86         virtual ARDOUR::Session* current_session() const = 0;
87         virtual bool have_idled() const = 0;
88         virtual void first_idle() = 0;
89         virtual void set_snap_to (Editing::SnapType) = 0;
90         virtual void set_snap_mode (Editing::SnapMode) = 0;
91         virtual void set_snap_threshold (double) = 0;
92         virtual void undo (uint32_t n = 1) = 0;
93         virtual void redo (uint32_t n = 1) = 0;
94         virtual void set_mouse_mode (Editing::MouseMode, bool force = false) = 0;
95         virtual void step_mouse_mode (bool next) = 0;
96         virtual Editing::MouseMode current_mouse_mode () = 0;
97         virtual void add_imageframe_time_axis(const std::string & track_name, void*)  = 0;
98         virtual void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*)  = 0;
99         virtual void connect_to_image_compositor()  = 0;
100         virtual void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item)  = 0;
101         virtual TimeAxisView* get_named_time_axis(const std::string & name)  = 0;
102         virtual void consider_auditioning (boost::shared_ptr<ARDOUR::Region>) = 0;
103         virtual void set_show_waveforms (bool yn) = 0;
104         virtual bool show_waveforms() const = 0;
105         virtual void set_show_waveforms_recording (bool yn) = 0;
106         virtual bool show_waveforms_recording() const = 0;
107         virtual void new_region_from_selection () = 0;
108         virtual void separate_region_from_selection () = 0;
109         virtual void toggle_playback (bool with_abort) = 0;
110         virtual void transition_to_rolling (bool fwd) = 0;
111         virtual nframes_t unit_to_frame (double unit) const = 0;
112         virtual double frame_to_unit (nframes_t frame) const = 0;
113         virtual double frame_to_unit (double frame) const = 0;
114         virtual nframes64_t pixel_to_frame (double pixel) const = 0;
115         virtual gulong frame_to_pixel (nframes64_t frame) const = 0;
116         virtual Selection& get_selection() const = 0;
117         virtual Selection& get_cut_buffer() const = 0;
118         virtual bool extend_selection_to_track (TimeAxisView&) = 0;
119         virtual void play_selection () = 0;
120         virtual void set_show_measures (bool yn) = 0;
121         virtual bool show_measures () const = 0;
122         virtual void export_session() = 0;
123         virtual void export_selection() = 0;
124         virtual void export_range_markers() = 0;
125         virtual void register_actions() = 0;
126         virtual void add_toplevel_controls (Gtk::Container&) = 0;
127         virtual Gtk::HBox& get_status_bar_packer()  = 0;
128         virtual void      set_zoom_focus (Editing::ZoomFocus) = 0;
129         virtual Editing::ZoomFocus get_zoom_focus () const = 0;
130         virtual gdouble   get_current_zoom () const = 0;
131         virtual PlaylistSelector& playlist_selector() const = 0;
132         virtual void route_name_changed (TimeAxisView *) = 0;
133         virtual void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>) = 0;
134         virtual void new_playlists (TimeAxisView*) = 0;
135         virtual void copy_playlists (TimeAxisView*) = 0;
136         virtual void clear_playlists (TimeAxisView*) = 0;
137         virtual void select_all_tracks () = 0;
138         virtual void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove = false) = 0;
139         virtual void set_selected_mixer_strip (TimeAxisView&) = 0;
140         virtual void hide_track_in_display (TimeAxisView& tv, bool temporary = false) = 0;
141         virtual void show_track_in_display (TimeAxisView& tv) = 0;
142         virtual void set_follow_playhead (bool yn) = 0;
143         virtual void toggle_follow_playhead () = 0;
144         virtual bool follow_playhead() const = 0;
145         virtual bool dragging_playhead() const = 0;
146         virtual void ensure_float (Gtk::Window&) = 0;
147         virtual void show_window () = 0;
148         virtual TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0) = 0;
149         virtual nframes_t leftmost_position() const = 0;
150         virtual nframes_t current_page_frames() const = 0;
151         virtual void temporal_zoom_step (bool coarser) = 0;
152         virtual void scroll_tracks_down_line () = 0;
153         virtual void scroll_tracks_up_line () = 0;
154         virtual bool new_regionviews_display_gain () = 0;
155         virtual void prepare_for_cleanup () = 0;
156         virtual void reset_x_origin (nframes_t frame) = 0;
157         virtual void remove_last_capture () = 0;
158         virtual void maximise_editing_space() = 0;
159         virtual void restore_editing_space() = 0;
160         virtual nframes64_t get_preferred_edit_position (bool ignore_playhead = false) = 0;
161         virtual void toggle_meter_updating() = 0;
162         virtual void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret) = 0;
163         virtual void mouse_add_new_marker (nframes_t where, bool is_cd=false, bool is_xrun=false) = 0;
164         virtual void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>) = 0;
165
166         sigc::signal<void> ZoomFocusChanged;
167         sigc::signal<void> ZoomChanged;
168         sigc::signal<void> Resized;
169         sigc::signal<void> Realized;
170         sigc::signal<void> GoingAway;
171         sigc::signal<void,nframes_t> UpdateAllTransportClocks;
172
173         Glib::RefPtr<Gtk::ActionGroup> editor_actions;
174
175         virtual void reset_focus() = 0;
176
177         virtual bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*) = 0;
178         virtual bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*) = 0;
179         virtual bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*) = 0;
180         virtual bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*) = 0;
181         virtual bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*) = 0;
182         virtual bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*) = 0;
183         virtual bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*) = 0;
184         virtual bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*) = 0;
185         virtual bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*) = 0;
186         virtual bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*) = 0;
187         virtual bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*) = 0;
188         virtual bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*) = 0;
189         virtual bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*) = 0;
190         virtual bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*) = 0;
191         virtual bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*) = 0;
192         virtual bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*) = 0;
193         virtual bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*) = 0;
194         virtual bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*) = 0;
195         virtual bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) = 0;
196
197         virtual bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
198         virtual bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
199         virtual bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
200         virtual bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
201         virtual bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
202
203         virtual bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0;
204         virtual bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*) = 0;
205         virtual bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0;
206         virtual bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0;
207         virtual bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*) = 0;
208         virtual bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0;
209         virtual bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0;
210         virtual bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0;
211
212         static const int window_border_width;
213         static const int container_border_width;
214         static const int vertical_spacing;
215         static const int horizontal_spacing;
216         
217         static PublicEditor* _instance;
218
219         friend class PluginUIWindow;
220 };
221
222 #endif // __gtk_ardour_public_editor_h__