fix pathscanner / stl_vector related memory leaks
[ardour.git] / gtk2_ardour / editor.h
index daa417543bb17ad42968d0bd8827ce451286bf1b..9e78181dcf5b1973e6ab68326e747f5cc86c0202 100644 (file)
@@ -23,6 +23,7 @@
 #include <list>
 #include <map>
 #include <set>
+#include <stack>
 #include <string>
 #include <sys/time.h>
 #include <cmath>
@@ -47,8 +48,8 @@
 #include "ardour/types.h"
 
 #include "canvas/fwd.h"
+#include "canvas/ruler.h"
 
-#include "gtk-custom-ruler.h"
 #include "ardour_button.h"
 #include "ardour_dialog.h"
 #include "ardour_dropdown.h"
@@ -422,6 +423,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        Gdk::Cursor* get_canvas_cursor () const { return current_canvas_cursor; }
        void set_canvas_cursor (Gdk::Cursor*, bool save=false);
+       
+       void push_canvas_cursor (Gdk::Cursor*);
+       void pop_canvas_cursor ();
+
        void set_current_trimmable (boost::shared_ptr<ARDOUR::Trimmable>);
        void set_current_movable (boost::shared_ptr<ARDOUR::Movable>);
 
@@ -455,6 +460,13 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
         void override_visible_track_count ();
 
+       /* Ruler metrics methods */
+
+       void metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>&, gdouble, gdouble, gint);
+       void metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>&, gdouble, gdouble, gint);
+       void metric_get_samples (std::vector<ArdourCanvas::Ruler::Mark>&, gdouble, gdouble, gint);
+       void metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>&, gdouble, gdouble, gint);
+
   protected:
        void map_transport_state ();
        void map_position_change (framepos_t);
@@ -689,6 +701,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Gtk::VBox           global_vpacker;
        Gtk::VBox           vpacker;
 
+       std::stack<Gdk::Cursor*> _cursor_stack;
        Gdk::Cursor*          current_canvas_cursor;
        Gdk::Cursor* which_grabber_cursor ();
        void set_canvas_cursor ();
@@ -702,12 +715,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        VerboseCursor* _verbose_cursor;
 
        void parameter_changed (std::string);
+       void ui_parameter_changed (std::string);
 
        bool track_canvas_motion (GdkEvent*);
 
-       Gtk::EventBox             time_canvas_event_box;
        Gtk::EventBox             time_bars_event_box;
-       Gtk::EventBox             ruler_label_event_box;
+       Gtk::VBox                 time_bars_vbox;
 
        ArdourCanvas::Pixbuf     *logo_item;
 #if 0    
@@ -744,14 +757,16 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        /* The group containing all trackviews. */
        ArdourCanvas::Group* _trackview_group;
 
-       /* The group used for region motion.  Sits on top of _trackview_group */
-       ArdourCanvas::Group* _region_motion_group;
+       /* The group holding things (mostly regions) while dragging so they
+        * are on top of everything else
+        */
+       ArdourCanvas::Group* _drag_motion_group;
 
         /* a rect that sits at the bottom of all tracks to act as a drag-no-drop/clickable
         * target area.
         */
-        ArdourCanvas::Rectangle* _canvas_bottom_rect;
-        bool canvas_bottom_rect_event (GdkEvent* event);
+        ArdourCanvas::Rectangle* _canvas_drop_zone;
+        bool canvas_drop_zone_event (GdkEvent* event);
 
        enum RulerType {
                ruler_metric_timecode = 0,
@@ -768,7 +783,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
                ruler_video_timeline = 10,
        };
 
-       static GtkCustomMetric ruler_metrics[4];
        Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
        Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
        Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
@@ -781,11 +795,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
        bool                            no_ruler_shown_update;
 
-       bool ruler_button_press (GdkEventButton*);
-       bool ruler_button_release (GdkEventButton*);
-       bool ruler_mouse_motion (GdkEventMotion*);
-       bool ruler_scroll (GdkEventScroll* event);
-
        Gtk::Widget * ruler_grabbed_widget;
 
        void initialize_rulers ();
@@ -803,11 +812,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void store_ruler_visibility ();
        void restore_ruler_visibility ();
 
-       static gint _metric_get_timecode (GtkCustomRulerMark **, gdouble, gdouble, gint);
-       static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
-       static gint _metric_get_samples (GtkCustomRulerMark **, gdouble, gdouble, gint);
-       static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
-
        enum MinsecRulerScale {
                minsec_show_seconds,
                minsec_show_minutes,
@@ -861,21 +865,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
                                      ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin,
                                      ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end);
 
-       gint metric_get_timecode (GtkCustomRulerMark **, gdouble, gdouble, gint);
-       gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
-       gint metric_get_samples (GtkCustomRulerMark **, gdouble, gdouble, gint);
-       gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
-
-       Gtk::Widget        *_ruler_separator;
-       GtkWidget          *_timecode_ruler;
-       GtkWidget          *_bbt_ruler;
-       GtkWidget          *_samples_ruler;
-       GtkWidget          *_minsec_ruler;
-       Gtk::Widget        *timecode_ruler;
-       Gtk::Widget        *bbt_ruler;
-       Gtk::Widget        *samples_ruler;
-       Gtk::Widget        *minsec_ruler;
-       static Editor      *ruler_editor;
+       ArdourCanvas::Ruler* timecode_ruler;
+       ArdourCanvas::Ruler* bbt_ruler;
+       ArdourCanvas::Ruler* samples_ruler;
+       ArdourCanvas::Ruler* minsec_ruler;
 
        static const double timebar_height;
        guint32 visible_timebars;
@@ -923,8 +916,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void export_video (bool range = false);
        void toggle_region_video_lock ();
 
-       Gtk::VBox          time_bars_vbox;
-
        friend class EditorCursor;
 
        EditorCursor*        playhead_cursor;
@@ -997,9 +988,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Gtk::Menu *edit_controls_left_menu;
        Gtk::Menu *edit_controls_right_menu;
 
-       Gtk::VBox           ruler_label_vbox;
        Gtk::VBox           track_canvas_vbox;
-       Gtk::VBox           time_canvas_vbox;
        Gtk::VBox           edit_controls_vbox;
        Gtk::HBox           edit_controls_hbox;
 
@@ -1052,7 +1041,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        /* track views */
        TrackViewList track_views;
-       std::pair<TimeAxisView*, double> trackview_by_y_position (double);
+       std::pair<TimeAxisView*, double> trackview_by_y_position (double, bool trackview_relative_offset = true);
        RouteTimeAxisView* axis_view_from_route (boost::shared_ptr<ARDOUR::Route>) const;
 
        TrackViewList get_tracks_for_range_action () const;
@@ -1400,6 +1389,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        /* Canvas event handlers */
 
+       bool canvas_scroll_event (GdkEventScroll* event, bool from_canvas);
        bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
        bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
        bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
@@ -1424,6 +1414,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*);
        bool canvas_note_event (GdkEvent* event, ArdourCanvas::Item *);
 
+       bool canvas_ruler_event (GdkEvent* event, ArdourCanvas::Item *, ItemType);
        bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
        bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
        bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
@@ -1456,7 +1447,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
        bool track_canvas_scroll (GdkEventScroll* event);
 
-       bool track_canvas_scroll_event (GdkEventScroll* event);
        bool track_canvas_button_press_event (GdkEventButton* event);
        bool track_canvas_button_release_event (GdkEventButton* event);
        bool track_canvas_motion_notify_event (GdkEventMotion* event);