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;
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) {
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;
}
}
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)
_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),
}
}
-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),
}
}
-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)
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 {
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 {
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
return false;
}
- std::pair<nframes64_t, nframes64_t> extent () const;
-
private:
Operation _operation;