Merging from trunk
[ardour.git] / gtk2_ardour / editor.h
index 3e080415c06ed82987fef850fb5e59ed8b2cb799..e517b1eaf1c9231d6123c2f3aeccc7414b005f32 100644 (file)
@@ -45,7 +45,6 @@
 #include <ardour/tempo.h>
 #include <ardour/location.h>
 #include <ardour/region.h>
-#include <ardour/externalsource.h>
 
 #include "audio_clock.h"
 #include "gtk-custom-ruler.h"
@@ -53,6 +52,7 @@
 #include "public_editor.h"
 #include "editing.h"
 #include "enums.h"
+#include "editor_items.h"
 #include "region_selection.h"
 #include "canvas.h"
 #include "draginfo.h"
@@ -66,9 +66,8 @@ namespace LinuxAudioSystems {
 }
 
 namespace ARDOUR {
-       class DiskStream;
+       class AudioDiskstream;
        class RouteGroup;
-       class Source;
        class Playlist;
        class Region;
        class Location;
@@ -295,7 +294,7 @@ class Editor : public PublicEditor
        void toggle_waveforms_while_recording ();
        void toggle_measure_visibility ();
 
-       void set_meter_falloff (float);
+       void set_meter_falloff (int);
        void set_meter_hold (int32_t);
 
        /* xfades */
@@ -347,56 +346,6 @@ class Editor : public PublicEditor
 
        PlaylistSelector* _playlist_selector;
 
-       enum ItemType {
-               RegionItem,
-               StreamItem,
-               PlayheadCursorItem,
-               EditCursorItem,
-               MarkerItem,
-               MarkerBarItem,
-               RangeMarkerBarItem,
-               TransportMarkerBarItem,
-               SelectionItem,
-               GainControlPointItem,
-               GainLineItem,
-               GainAutomationControlPointItem,
-               GainAutomationLineItem,
-               PanAutomationControlPointItem,
-               PanAutomationLineItem,
-               RedirectAutomationControlPointItem,
-               RedirectAutomationLineItem,
-               MeterMarkerItem,
-               TempoMarkerItem,
-               MeterBarItem,
-               TempoBarItem,
-               AudioRegionViewNameHighlight,
-               AudioRegionViewName,
-               StartSelectionTrimItem,
-               EndSelectionTrimItem,
-               AutomationTrackItem,
-               FadeInItem,
-               FadeInHandleItem,
-               FadeOutItem,
-               FadeOutHandleItem,
-
-               /* <CMT Additions> */
-               MarkerViewItem,
-               MarkerTimeAxisItem,
-               MarkerViewHandleStartItem,
-               MarkerViewHandleEndItem,
-               ImageFrameItem,
-               ImageFrameTimeAxisItem,
-               ImageFrameHandleStartItem,
-               ImageFrameHandleEndItem,
-               /* </CMT Additions> */
-
-               CrossfadeViewItem,
-               
-               /* don't remove this */
-
-               NoItem
-       };
-
        void          set_frames_per_unit (double);
        void          frames_per_unit_modified ();
 
@@ -462,6 +411,7 @@ class Editor : public PublicEditor
        CrossfadeView*     clicked_crossfadeview;
        ControlPoint*      clicked_control_point;
 
+       void get_relevant_audio_tracks (AudioTimeAxisView& base, std::set<AudioTimeAxisView*>& relevant_tracks);
        void mapover_audio_tracks (sigc::slot<void,AudioTimeAxisView&,uint32_t> sl);
 
        /* functions to be passed to mapover_audio_tracks(), possibly with sigc::bind()-supplied arguments */
@@ -473,10 +423,15 @@ class Editor : public PublicEditor
 
        /* end */
 
+       void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
+       bool button_release_can_deselect;
+
        void catch_vanishing_audio_regionview (AudioRegionView *);
-       void set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false);
-       void set_selected_track_from_click (Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false);
-       void set_selected_regionview_from_click (Selection::Operation op = Selection::Set, bool no_track_remove=false);
+
+       bool set_selected_control_point_from_click (bool press, Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false);
+       bool set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false);
+       bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
+
        void set_selected_regionview_from_region_list (ARDOUR::Region& region, Selection::Operation op = Selection::Set);
        bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, ARDOUR::Region*);
        void collect_new_region_view (AudioRegionView *);
@@ -700,6 +655,7 @@ class Editor : public PublicEditor
 
        double canvas_width;
        double canvas_height;
+       jack_nframes_t last_canvas_frame;
 
        bool track_canvas_map_handler (GdkEventAny*);
        bool time_canvas_map_handler (GdkEventAny*);
@@ -860,7 +816,7 @@ class Editor : public PublicEditor
        bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
        bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
        bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
-       bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
+       bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
        bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
        bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
        
@@ -870,9 +826,7 @@ class Editor : public PublicEditor
 
        int ensure_cursor (jack_nframes_t* pos);
 
-       void fake_handle_new_audio_region (ARDOUR::AudioRegion *);
        void handle_new_audio_region (ARDOUR::AudioRegion *);
-       void fake_handle_audio_region_removed (ARDOUR::AudioRegion *);
        void handle_audio_region_removed (ARDOUR::AudioRegion *);
        void add_audio_region_to_region_display (ARDOUR::AudioRegion *);
        void region_hidden (ARDOUR::Region*);
@@ -891,6 +845,7 @@ class Editor : public PublicEditor
 
        /* EDITING OPERATIONS */
        
+       void reset_point_selection ();
        void toggle_region_mute ();
        void toggle_region_opaque ();
        void raise_region ();
@@ -1086,6 +1041,7 @@ class Editor : public PublicEditor
 
        void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
        bool end_grab (ArdourCanvas::Item*, GdkEvent*);
+       void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
 
        Gtk::Menu fade_context_menu;
        void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
@@ -1215,7 +1171,6 @@ class Editor : public PublicEditor
        void kbd_do_brush (GdkEvent*);
        void kbd_do_audition (GdkEvent*);
 
-       void fake_handle_new_duration ();
        void handle_new_duration ();
        void initialize_canvas ();
        void reset_scrolling_region (Gtk::Allocation* alloc = 0);
@@ -1659,7 +1614,7 @@ class Editor : public PublicEditor
        /* visual history */
 
        UndoHistory visual_history;
-       UndoCommand current_visual_command;
+       UndoTransaction current_visual_command;
 
        void begin_reversible_visual_command (const string & cmd_name);
        void commit_reversible_visual_command ();
@@ -1719,9 +1674,8 @@ class Editor : public PublicEditor
            Gtk::ProgressBar      progress_bar;
            Gtk::ToggleButton     quick_button;
            Gtk::ToggleButton     antialias_button;
-           Gtk::Button           cancel_button;
-           Gtk::Button           action_button;
-           Gtk::HBox             lower_button_box;
+           Gtk::Button*          cancel_button;
+           Gtk::Button*          action_button;
            Gtk::HBox             upper_button_box;
            Gtk::VBox             packer;
            int                   status;