Remove my attempts to autoscroll based on dragged region edges (rather than just...
authorCarl Hetherington <carl@carlh.net>
Sun, 7 Feb 2010 03:23:20 +0000 (03:23 +0000)
committerCarl Hetherington <carl@carlh.net>
Sun, 7 Feb 2010 03:23:20 +0000 (03:23 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6645 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor_canvas.cc
gtk2_ardour/editor_drag.cc
gtk2_ardour/editor_drag.h

index 031e58bf615e415d273449ea9717472c44eddd1e..510b7e019f5a59c77f35dbb1cdeb6025c73ceb11 100644 (file)
@@ -548,7 +548,6 @@ void
 Editor::maybe_autoscroll (GdkEventMotion* event, bool allow_vert)
 {
        nframes64_t rightmost_frame = leftmost_frame + current_page_frames();
-       pair<nframes64_t, nframes64_t> frames = _drags->extent ();
        bool startit = false;
 
        autoscroll_y = 0;
@@ -561,19 +560,16 @@ Editor::maybe_autoscroll (GdkEventMotion* event, bool allow_vert)
                startit = true;
        }
 
-       if (frames.second > rightmost_frame) {
-
+       if (_drags->current_pointer_frame() > rightmost_frame) {
                if (rightmost_frame < max_frames) {
                        autoscroll_x = 1;
                        startit = true;
                }
-
-       } else if (frames.first < leftmost_frame) {
+       } else if (_drags->current_pointer_frame() < leftmost_frame) {
                if (leftmost_frame > 0) {
                        autoscroll_x = -1;
                        startit = true;
                }
-
        }
 
        if (!allow_vertical_scroll) {
@@ -609,12 +605,10 @@ Editor::autoscroll_canvas ()
 
        if (autoscroll_x_distance != 0) {
 
-               pair<nframes64_t, nframes64_t> const e = _drags->extent ();
-               
                if (autoscroll_x > 0) {
-                       autoscroll_x_distance = (e.second - (leftmost_frame + current_page_frames())) / 3;
+                       autoscroll_x_distance = (_drags->current_pointer_frame() - (leftmost_frame + current_page_frames())) / 3;
                } else if (autoscroll_x < 0) {
-                       autoscroll_x_distance = (leftmost_frame - e.first) / 3;
+                       autoscroll_x_distance = (leftmost_frame - _drags->current_pointer_frame()) / 3;
 
                }
        }
index 8f59b9e699a40592986ee9a501b3fe99183f3e51..0739e91bb1b756c8ec7b3e50340492e35eda1a6d 100644 (file)
@@ -170,27 +170,6 @@ DragManager::have_item (ArdourCanvas::Item* i) const
        return j != _drags.end ();
 }
 
-pair<nframes64_t, nframes64_t>
-DragManager::extent () const
-{
-       if (_drags.empty()) {
-               return make_pair (0, 0);
-       }
-
-       list<Drag*>::const_iterator i = _drags.begin ();
-       pair<nframes64_t, nframes64_t> e = (*i)->extent ();
-       ++i;
-
-       while (i != _drags.end()) {
-               pair<nframes64_t, nframes64_t> const t = (*i)->extent ();
-               e.first = min (e.first, t.first);
-               e.second = max (e.second, t.second);
-               ++i;
-       }
-
-       return e;
-}
-
 Drag::Drag (Editor* e, ArdourCanvas::Item* i) 
        : _editor (e)
        , _item (i)
@@ -358,13 +337,6 @@ Drag::break_drag ()
        _editor->hide_verbose_canvas_cursor ();
 }
 
-pair<nframes64_t, nframes64_t>
-Drag::extent () const
-{
-       nframes64_t const f = adjusted_current_frame (0);
-       return make_pair (f, f);
-}
-
 RegionDrag::RegionDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<RegionView*> const & v)
        : Drag (e, i),
          _primary (p),
@@ -381,14 +353,6 @@ RegionDrag::region_going_away (RegionView* v)
        }
 }
 
-pair<nframes64_t, nframes64_t>
-RegionDrag::extent () const
-{
-       nframes64_t const f = adjusted_current_frame (0);
-       return make_pair (f, f + _primary->region()->length ());
-}
-
-
 RegionMotionDrag::RegionMotionDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<RegionView*> const & v, bool b)
        : RegionDrag (e, i, p, v),
          _dest_trackview (0),
@@ -1893,37 +1857,6 @@ TrimDrag::aborted ()
        }
 }
 
-pair<nframes64_t, nframes64_t>
-TrimDrag::extent () const
-{
-       /* we only want to autoscroll to keep the most `outward' region edge on-screen,
-          not the whole region(s) that is/are being trimmed.
-       */
-
-       nframes64_t f = 0;
-
-       switch (_operation) {
-       case StartTrim:
-               f = INT64_MAX;
-               for (list<RegionView*>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
-                       f = min (f, (nframes64_t) (*i)->region()->position());
-               }
-               break; 
-       case ContentsTrim:
-               f = adjusted_current_frame (0);
-               break;
-       case EndTrim:
-               f = 0;
-               for (list<RegionView*>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
-                       f = max (f, (nframes64_t) (*i)->region()->position() + (*i)->region()->length());
-               }
-               break;
-       }
-               
-       return make_pair (f, f);
-}
-
-
 MeterMarkerDrag::MeterMarkerDrag (Editor* e, ArdourCanvas::Item* i, bool c)
        : Drag (e, i),
          _copy (c)
index 119bcc34b1e18fe3a8c8a1449597f0855bfaa665..fb66a2c74665a86baa060312665c670d504310eb 100644 (file)
@@ -56,7 +56,6 @@ public:
        void start_grab (GdkEvent *);
        bool end_grab (GdkEvent *);
        bool have_item (ArdourCanvas::Item *) const;
-       std::pair<nframes64_t, nframes64_t> extent () const;
 
        /** @return true if an end drag or break_drag is in progress */
        bool ending () const {
@@ -165,11 +164,6 @@ public:
                return true;
        }
 
-       /** @return current x extent of the thing being dragged; ie
-        *  a pair of (leftmost_position, rightmost_position)
-        */
-       virtual std::pair<nframes64_t, nframes64_t> extent () const;
-
 protected:
 
        double grab_x () const {
@@ -224,8 +218,6 @@ public:
        RegionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
        virtual ~RegionDrag () {}
 
-       virtual std::pair<nframes64_t, nframes64_t> extent () const;
-
 protected:
 
        RegionView* _primary; ///< the view that was clicked on (or whatever) to start the drag
@@ -412,8 +404,6 @@ public:
                return false;
        }
 
-       std::pair<nframes64_t, nframes64_t> extent () const;
-
 private:
 
        Operation _operation;