Fix thinkos in cubasish theme
[ardour.git] / gtk2_ardour / editor_drag.h
index 184d1111a5b71ef629232271a6d22ee83fed4d42..f4a76cb599a16426fea4eafb183de4e2ec6ad448 100644 (file)
@@ -1,21 +1,27 @@
 /*
-    Copyright (C) 2009 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
+ * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
+ * Copyright (C) 2009-2015 David Robillard <d@drobilla.net>
+ * Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2013-2014 Colin Fletcher <colin.m.fletcher@googlemail.com>
+ * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2015-2017 Nick Mainsbridge <mainsbridge@gmail.com>
+ * Copyright (C) 2015-2018 Ben Loftis <ben@harrisonconsoles.com>
+ * Copyright (C) 2016 Tim Mayberry <mojofunk@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
 
 #ifndef __gtk2_ardour_editor_drag_h_
 #define __gtk2_ardour_editor_drag_h_
@@ -114,6 +120,9 @@ public:
                return _current_pointer_sample;
        }
 
+       /** return drag-motion displays video-frame of drag-location */
+       bool preview_video () const;
+
 private:
        Editor* _editor;
        std::list<Drag*> _drags;
@@ -183,6 +192,10 @@ public:
                return true;
        }
 
+       bool preview_video () const {
+               return _preview_video;
+       }
+
        /** @return minimum number of samples (in x) and pixels (in y) that should be considered a movement */
        virtual std::pair<ARDOUR::samplecnt_t, int> move_threshold () const {
                return std::make_pair (1, 1);
@@ -211,6 +224,12 @@ public:
                _pointer_sample_offset = 0;
        }
 
+       /** Set up the _video_sample_offset - relative to _current_pointer_sample */
+       virtual void setup_video_sample_offset () {
+               _video_sample_offset = 0;
+               _preview_video = false;
+       }
+
 protected:
 
        double grab_x () const {
@@ -255,12 +274,15 @@ protected:
        void show_verbose_cursor_time (samplepos_t);
        void show_verbose_cursor_duration (samplepos_t, samplepos_t, double xoffset = 0);
        void show_verbose_cursor_text (std::string const &);
+       void show_view_preview (samplepos_t);
 
        Editor* _editor; ///< our editor
        DragManager* _drags;
        ArdourCanvas::Item* _item; ///< our item
        /** Offset from the mouse's position for the drag to the start of the thing that is being dragged */
        ARDOUR::samplecnt_t _pointer_sample_offset;
+       ARDOUR::samplecnt_t _video_sample_offset;
+       bool _preview_video;
        bool _x_constrained; ///< true if x motion is constrained, otherwise false
        bool _y_constrained; ///< true if y motion is constrained, otherwise false
        bool _was_rolling; ///< true if the session was rolling before the drag started, otherwise false
@@ -283,7 +305,7 @@ private:
         *  samplepos. used for relative snap.
         */
        samplepos_t _snap_delta;
-       double     _snap_delta_music;
+       double      _snap_delta_music;
        CursorContext::Handle _cursor_ctx; ///< cursor change context
        bool _constraint_pressed; ///< if the keyboard indicated constraint modifier was pressed on start_grab()
 };
@@ -335,6 +357,8 @@ protected:
        int _visible_y_high;
        uint32_t _ntracks;
 
+       void setup_video_sample_offset ();
+
        friend class DraggingView;
 
 private:
@@ -486,8 +510,8 @@ protected:
        bool y_movement_allowed (int delta_track, double delta_layer, int skip_invisible = 0) const;
 
 private:
-       TimeAxisView *prev_tav;         // where regions were most recently dragged from
-       TimeAxisView *orig_tav;         // where drag started
+       TimeAxisView *prev_tav; // where regions were most recently dragged from
+       TimeAxisView *orig_tav; // where drag started
        ARDOUR::samplecnt_t prev_amount;
        ARDOUR::samplepos_t prev_position;
        ARDOUR::samplecnt_t selection_length;
@@ -636,7 +660,7 @@ private:
        }
 
        MidiRegionView* _region_view;
-       samplepos_t      _last_pos;
+       samplepos_t     _last_pos;
        double          _y;
 
 };
@@ -973,6 +997,7 @@ public:
        }
 
        void setup_pointer_sample_offset ();
+       void setup_video_sample_offset ();
 
 private:
        void update_item (ARDOUR::Location *);
@@ -1244,7 +1269,7 @@ class AutomationRangeDrag : public Drag
 {
 public:
        AutomationRangeDrag (Editor *, AutomationTimeAxisView *, std::list<ARDOUR::AudioRange> const &);
-       AutomationRangeDrag (Editor *, std::list<RegionView*> const &, std::list<ARDOUR::AudioRange> const &, double y_origin);
+       AutomationRangeDrag (Editor *, std::list<RegionView*> const &, std::list<ARDOUR::AudioRange> const &, double y_origin, double y_height);
 
        void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
        void motion (GdkEvent *, bool);
@@ -1257,7 +1282,7 @@ public:
 
 private:
        void setup (std::list<boost::shared_ptr<AutomationLine> > const &);
-       double y_fraction (boost::shared_ptr<AutomationLine>, double global_y_position) const;
+       double y_fraction (double global_y_position) const;
        double value (boost::shared_ptr<ARDOUR::AutomationList> list, double x) const;
 
        std::list<ARDOUR::AudioRange> _ranges;
@@ -1268,11 +1293,11 @@ private:
                std::list<ControlPoint*> points; ///< points to drag on the line
                std::pair<ARDOUR::samplepos_t, ARDOUR::samplepos_t> range; ///< the range of all points on the line, in session samples
                XMLNode* state; ///< the XML state node before the drag
-               double original_fraction; ///< initial y-fraction before the drag
        };
 
        std::list<Line> _lines;
        double          _y_origin;
+       double          _y_height;
        bool            _nothing_to_drag;
        bool            _integral;
 };