X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Ftime_selection.cc;h=a0f33e8c99fd0db7aabe36275e8d3799a46e03f7;hb=d1f45e9b3d6a7e272e5563cc50175dfb6d904361;hp=185c7e1eeadf06112e8009df0814b16c48f18dcd;hpb=04c7158a415e9daa76a60a296891217eb0fb6c0c;p=ardour.git diff --git a/gtk2_ardour/time_selection.cc b/gtk2_ardour/time_selection.cc index 185c7e1eea..a0f33e8c99 100644 --- a/gtk2_ardour/time_selection.cc +++ b/gtk2_ardour/time_selection.cc @@ -20,7 +20,7 @@ #include #include "pbd/error.h" -#include "ardour/ardour.h" +#include "ardour/types.h" #include "time_selection.h" @@ -55,9 +55,9 @@ TimeSelection::consolidate () continue; } - if ((*a).coverage ((*b).start, (*b).end) != OverlapNone) { - (*a).start = std::min ((*a).start, (*b).start); - (*a).end = std::max ((*a).end, (*b).end); + if (a->coverage (b->start, b->end) != Evoral::OverlapNone) { + a->start = std::min (a->start, b->start); + a->end = std::max (a->end, b->end); erase (b); changed = true; goto restart; @@ -68,14 +68,14 @@ TimeSelection::consolidate () return changed; } -nframes_t +framepos_t TimeSelection::start () { if (empty()) { return 0; } - nframes_t first = max_frames; + framepos_t first = max_framepos; for (std::list::iterator i = begin(); i != end(); ++i) { if ((*i).start < first) { @@ -85,10 +85,10 @@ TimeSelection::start () return first; } -nframes_t +framepos_t TimeSelection::end_frame () { - nframes_t last = 0; + framepos_t last = 0; /* XXX make this work like RegionSelection: no linear search needed */ @@ -100,8 +100,12 @@ TimeSelection::end_frame () return last; } -nframes_t +framecnt_t TimeSelection::length() { + if (empty()) { + return 0; + } + return end_frame() - start() + 1; }