timebasedwidget: rewrote scroll catchup code

Code is much better. Less hacky queuing, implements cooldowns to improve navigation, and introduces a framework so that subclasses can make use of catchup/cooldown code too with any scrollbar they want
This commit is contained in:
itsmattkc
2022-07-15 10:59:51 -07:00
parent 4b8febd10d
commit e4fd2d5d2c
11 changed files with 103 additions and 20 deletions
+18
View File
@@ -150,6 +150,14 @@ protected:
void PassWheelEventsToScrollBar(QObject* object);
void SetCatchUpScrollValue(QScrollBar *b, int v, int maximum);
void SetCatchUpScrollValue(int v);
void StopCatchUpScrollTimer(QScrollBar *b);
void StopCatchUpScrollTimer()
{
StopCatchUpScrollTimer(scrollbar_);
}
virtual const QVector<Block*> *GetSnapBlocks() const { return nullptr; }
virtual const QVector<KeyframeViewInputConnection*> *GetSnapKeyframes() const { return nullptr; }
virtual const std::vector<NodeKeyframe*> *GetSnapIgnoreKeyframes() const { return nullptr; }
@@ -228,6 +236,14 @@ private:
TimelineWorkArea *workarea_;
TimelineMarkerList *markers_;
QTimer *catchup_scroll_timer_;
struct CatchUpScrollData {
qint64 last_forced = 0;
int maximum;
int value;
};
QMap<QScrollBar*, CatchUpScrollData> catchup_scroll_values_;
private slots:
void UpdateMaximumScroll();
@@ -247,6 +263,8 @@ private slots:
void CatchUpScrollToPoint(int point);
void CatchUpTimerTimeout();
void AutoUpdateTimebase();
void ConnectedNodeRemovedFromGraph();