Re-work main right-click context menu to operate on the selection, and remove some...
[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/actiongroup.h>
30 #include <jack/types.h>
31 #include <sigc++/signal.h>
32
33 #include <pbd/statefuldestructible.h> 
34
35 #include "editing.h"
36 #include "canvas.h"
37 #include "selection.h"
38
39 namespace ARDOUR {
40         class Session;
41         class AudioExportSpecification;
42         class Region;
43         class Playlist;
44         class RouteGroup;
45 }
46
47 namespace Gtk {
48         class Container;
49         class Menu;
50 }
51
52 class Editor;
53 class TimeAxisViewItem;
54 class TimeAxisView;
55 class PluginUIWindow;
56 class PluginSelector;
57 class PlaylistSelector;
58 class XMLNode;
59 class Selection;
60 class AutomationLine;
61 class ControlPoint;
62 class SelectionRect;
63 class CrossfadeView;
64 class RouteTimeAxisView;
65 class RegionView;
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 list<TimeAxisView *> 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 void set_snap_to (Editing::SnapType) = 0;
88         virtual void set_snap_mode (Editing::SnapMode) = 0;
89         virtual void set_snap_threshold (double) = 0;
90         virtual void undo (uint32_t n = 1) = 0;
91         virtual void redo (uint32_t n = 1) = 0;
92         virtual void set_mouse_mode (Editing::MouseMode, bool force = false) = 0;
93         virtual void step_mouse_mode (bool next) = 0;
94         virtual Editing::MouseMode current_mouse_mode () const = 0;
95         virtual void add_imageframe_time_axis(const std::string & track_name, void*)  = 0;
96         virtual void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*)  = 0;
97         virtual void connect_to_image_compositor()  = 0;
98         virtual void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item)  = 0;
99         virtual TimeAxisView* get_named_time_axis(const std::string & name)  = 0;
100         virtual void consider_auditioning (boost::shared_ptr<ARDOUR::Region>) = 0;
101         virtual void set_show_waveforms (bool yn) = 0;
102         virtual bool show_waveforms() const = 0;
103         virtual void set_show_waveforms_recording (bool yn) = 0;
104         virtual bool show_waveforms_recording() const = 0;
105         virtual void new_region_from_selection () = 0;
106         virtual void separate_region_from_selection () = 0;
107         virtual void toggle_playback (bool with_abort) = 0;
108         virtual void transition_to_rolling (bool fwd) = 0;
109         virtual nframes_t unit_to_frame (double unit) = 0;
110         virtual double frame_to_unit (nframes_t frame) = 0;
111         virtual double frame_to_unit (double frame) = 0;
112         virtual nframes_t pixel_to_frame (double pixel) = 0;
113         virtual gulong frame_to_pixel (nframes_t frame) = 0;
114         virtual Selection& get_selection() const = 0;
115         virtual Selection& get_cut_buffer() const = 0;
116         virtual bool extend_selection_to_track (TimeAxisView&) = 0;
117         virtual void play_selection () = 0;
118         virtual void set_show_measures (bool yn) = 0;
119         virtual bool show_measures () const = 0;
120         virtual void export_session() = 0;
121         virtual void export_selection() = 0;
122         virtual void export_range_markers() = 0;
123         virtual void register_actions() = 0;
124         virtual void add_toplevel_controls (Gtk::Container&) = 0;
125         virtual void      set_zoom_focus (Editing::ZoomFocus) = 0;
126         virtual Editing::ZoomFocus get_zoom_focus () const = 0;
127         virtual gdouble   get_current_zoom () = 0;
128         virtual PlaylistSelector& playlist_selector() const = 0;
129         virtual void route_name_changed (TimeAxisView *) = 0;
130         virtual void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>) = 0;
131         virtual void new_playlists () = 0;
132         virtual void copy_playlists () = 0;
133         virtual void clear_playlists () = 0;
134         virtual void select_all_tracks () = 0;
135         virtual bool set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove = false) = 0;
136         virtual void set_selected_mixer_strip (TimeAxisView&) = 0;
137         virtual void hide_track_in_display (TimeAxisView& tv) = 0;
138         virtual void show_track_in_display (TimeAxisView& tv) = 0;
139         virtual void set_follow_playhead (bool yn) = 0;
140         virtual void toggle_follow_playhead () = 0;
141         virtual bool follow_playhead() const = 0;
142         virtual bool dragging_playhead() const = 0;
143         virtual void ensure_float (Gtk::Window&) = 0;
144         virtual void show_window () = 0;
145         virtual TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0) = 0;
146         virtual nframes_t leftmost_position() const = 0;
147         virtual nframes_t current_page_frames() const = 0;
148         virtual void temporal_zoom_step (bool coarser) = 0;
149         virtual void scroll_tracks_down_line () = 0;
150         virtual void scroll_tracks_up_line () = 0;
151         virtual bool new_regionviews_display_gain () = 0;
152         virtual void prepare_for_cleanup () = 0;
153         virtual void reset_x_origin (nframes_t frame) = 0;
154         virtual void remove_last_capture () = 0;
155         virtual void maximise_editing_space() = 0;
156         virtual void restore_editing_space() = 0;
157         virtual nframes_t edit_cursor_position(bool sync) = 0;
158
159         sigc::signal<void> ZoomFocusChanged;
160         sigc::signal<void> ZoomChanged;
161         sigc::signal<void> Resized;
162         sigc::signal<void> Realized;
163         sigc::signal<void,nframes_t> UpdateAllTransportClocks;
164
165         Glib::RefPtr<Gtk::ActionGroup> editor_actions;
166
167         virtual void reset_focus() = 0;
168
169         virtual bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*) = 0;
170         virtual bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*) = 0;
171         virtual bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*) = 0;
172         virtual bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*) = 0;
173         virtual bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*) = 0;
174         virtual bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*) = 0;
175         virtual bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*) = 0;
176         virtual bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*) = 0;
177         virtual bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*) = 0;
178         virtual bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*) = 0;
179         virtual bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*) = 0;
180         virtual bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*) = 0;
181         virtual bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*) = 0;
182         virtual bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*) = 0;
183         virtual bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*) = 0;
184         virtual bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*) = 0;
185         virtual bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*) = 0;
186         virtual bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*) = 0;
187         virtual bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) = 0;
188
189         virtual bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
190         virtual bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
191         virtual bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
192         virtual bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
193         virtual bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
194
195         virtual bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0;
196         virtual bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*) = 0;
197         virtual bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0;
198         virtual bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0;
199         virtual bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*) = 0;
200         virtual bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0;
201         virtual bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0;
202         virtual bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0;
203
204         static PublicEditor* _instance;
205
206         friend class PluginUIWindow;
207 };
208
209 #endif // __gtk_ardour_public_editor_h__