moved timeline playhead line to its own class

This commit is contained in:
itsmattkc
2019-08-02 10:24:49 +10:00
parent 54ec4a26f5
commit 2060490ac9
10 changed files with 152 additions and 59 deletions
@@ -0,0 +1,32 @@
#include "timelineviewrect.h"
TimelineViewRect::TimelineViewRect(QGraphicsItem* parent) :
QGraphicsRectItem(parent),
scale_(1.0)
{
}
void TimelineViewRect::SetTimebase(const rational &timebase)
{
timebase_ = timebase;
timebase_dbl_ = timebase_.ToDouble();
UpdateRect();
}
void TimelineViewRect::SetScale(const double &scale)
{
scale_ = scale;
UpdateRect();
}
bool TimelineViewRect::TimebaseIsValid()
{
return timebase_.denominator() != 0;
}
double TimelineViewRect::TimeToScreenCoord(const rational &time)
{
return time.ToDouble() / timebase_dbl_ * scale_;
}