remove silly buffer stats output; apply MIDI control patch (#2655) from dhess; switch...
[ardour2.git] / gtk2_ardour / public_editor.h
blob690c0a235b74eef3da7d9f17d6cd8f154cd06989
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 __gtk_ardour_public_editor_h__
21 #define __gtk_ardour_public_editor_h__
23 #include <map>
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>
34 #include <pbd/statefuldestructible.h>
36 #include "editing.h"
37 #include "canvas.h"
38 #include "selection.h"
40 namespace ARDOUR {
41 class Session;
42 class AudioExportSpecification;
43 class Region;
44 class Playlist;
45 class RouteGroup;
48 namespace Gtk {
49 class Container;
50 class Menu;
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;
76 class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway {
77 public:
78 PublicEditor();
79 virtual ~PublicEditor();
81 typedef TrackSelection TrackViewList;
83 static PublicEditor& instance() { return *_instance; }
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;
98 /* CMT */
99 virtual void connect_to_image_compositor() = 0;
100 virtual void add_imageframe_time_axis(const std::string & track_name, void*) = 0;
101 virtual void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) = 0;
102 virtual void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) = 0;
103 virtual TimeAxisView* get_named_time_axis(const std::string & name) = 0;
105 virtual void consider_auditioning (boost::shared_ptr<ARDOUR::Region>) = 0;
106 virtual void set_show_waveforms (bool yn) = 0;
107 virtual bool show_waveforms() const = 0;
108 virtual void set_show_waveforms_recording (bool yn) = 0;
109 virtual bool show_waveforms_recording() const = 0;
110 virtual void new_region_from_selection () = 0;
111 virtual void separate_region_from_selection () = 0;
112 virtual void transition_to_rolling (bool fwd) = 0;
113 virtual nframes64_t unit_to_frame (double unit) const = 0;
114 // XXX remove me when libardour goes nframes64_t
115 double frame_to_unit (nframes_t frame) const {
116 return frame_to_unit ((nframes64_t) frame);
118 virtual double frame_to_unit (nframes64_t frame) const = 0;
119 virtual double frame_to_unit (double frame) const = 0;
120 virtual nframes64_t pixel_to_frame (double pixel) const = 0;
121 virtual gulong frame_to_pixel (nframes64_t frame) const = 0;
122 virtual Selection& get_selection() const = 0;
123 virtual Selection& get_cut_buffer() const = 0;
124 virtual bool extend_selection_to_track (TimeAxisView&) = 0;
125 virtual void play_selection () = 0;
126 virtual void set_show_measures (bool yn) = 0;
127 virtual bool show_measures () const = 0;
128 virtual void export_session() = 0;
129 virtual void export_selection() = 0;
130 virtual void export_range_markers() = 0;
131 virtual void register_actions() = 0;
132 virtual void add_toplevel_controls (Gtk::Container&) = 0;
133 virtual Gtk::HBox& get_status_bar_packer() = 0;
134 virtual void set_zoom_focus (Editing::ZoomFocus) = 0;
135 virtual Editing::ZoomFocus get_zoom_focus () const = 0;
136 virtual gdouble get_current_zoom () const = 0;
137 virtual PlaylistSelector& playlist_selector() const = 0;
138 virtual void route_name_changed (TimeAxisView *) = 0;
139 virtual void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>) = 0;
140 virtual void new_playlists (TimeAxisView*) = 0;
141 virtual void copy_playlists (TimeAxisView*) = 0;
142 virtual void clear_playlists (TimeAxisView*) = 0;
143 virtual void select_all_tracks () = 0;
144 virtual void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove = false) = 0;
145 virtual void set_selected_mixer_strip (TimeAxisView&) = 0;
146 virtual void hide_track_in_display (TimeAxisView& tv, bool temporary = false) = 0;
147 virtual void show_track_in_display (TimeAxisView& tv) = 0;
148 virtual void set_stationary_playhead (bool yn) = 0;
149 virtual void toggle_stationary_playhead () = 0;
150 virtual bool stationary_playhead() const = 0;
151 virtual void set_follow_playhead (bool yn) = 0;
152 virtual void toggle_follow_playhead () = 0;
153 virtual bool follow_playhead() const = 0;
154 virtual bool dragging_playhead() const = 0;
155 virtual double get_physical_screen_width() const = 0;
156 virtual void ensure_float (Gtk::Window&) = 0;
157 virtual void show_window () = 0;
158 virtual TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0) = 0;
159 virtual nframes64_t leftmost_position() const = 0;
160 virtual nframes64_t current_page_frames() const = 0;
161 virtual void temporal_zoom_step (bool coarser) = 0;
162 virtual void scroll_tracks_down_line () = 0;
163 virtual void scroll_tracks_up_line () = 0;
164 virtual bool new_regionviews_display_gain () = 0;
165 virtual void prepare_for_cleanup () = 0;
166 virtual void finish_cleanup () = 0;
167 virtual void reset_x_origin (nframes64_t frame) = 0;
168 virtual void remove_last_capture () = 0;
169 virtual void maximise_editing_space() = 0;
170 virtual void restore_editing_space() = 0;
171 virtual nframes64_t get_preferred_edit_position (bool ignore_playhead = false) = 0;
172 virtual void toggle_meter_updating() = 0;
173 virtual void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret) = 0;
174 virtual void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false) = 0;
175 virtual void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>) = 0;
176 virtual void add_to_idle_resize (TimeAxisView*,uint32_t) = 0;
178 sigc::signal<void> ZoomFocusChanged;
179 sigc::signal<void> ZoomChanged;
180 sigc::signal<void> Resized;
181 sigc::signal<void> Realized;
182 sigc::signal<void> GoingAway;
183 sigc::signal<void,nframes64_t> UpdateAllTransportClocks;
185 Glib::RefPtr<Gtk::ActionGroup> editor_actions;
187 virtual void reset_focus() = 0;
189 virtual bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*) = 0;
190 virtual bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*) = 0;
191 virtual bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*) = 0;
192 virtual bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*) = 0;
193 virtual bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*) = 0;
194 virtual bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*) = 0;
195 virtual bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*) = 0;
196 virtual bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*) = 0;
197 virtual bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*) = 0;
198 virtual bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*) = 0;
199 virtual bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*) = 0;
200 virtual bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*) = 0;
201 virtual bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*) = 0;
202 virtual bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*) = 0;
203 virtual bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*) = 0;
204 virtual bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*) = 0;
205 virtual bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*) = 0;
206 virtual bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*) = 0;
207 virtual bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) = 0;
209 virtual bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
210 virtual bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
211 virtual bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
212 virtual bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
213 virtual bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
215 virtual bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0;
216 virtual bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*) = 0;
217 virtual bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0;
218 virtual bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0;
219 virtual bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*) = 0;
220 virtual bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0;
221 virtual bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0;
222 virtual bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0;
224 static const int window_border_width;
225 static const int container_border_width;
226 static const int vertical_spacing;
227 static const int horizontal_spacing;
229 virtual gdouble get_trackview_group_vertical_offset () const = 0;
230 virtual gdouble get_canvas_timebars_vsize () const = 0;
231 virtual ArdourCanvas::Group* get_background_group () const = 0;
232 virtual ArdourCanvas::Group* get_trackview_group () const = 0;
234 static PublicEditor* _instance;
236 friend bool relay_key_press (GdkEventKey* ev, Gtk::Window* win);
239 #endif // __gtk_ardour_public_editor_h__