completed zoom tool
This commit is contained in:
@@ -40,6 +40,7 @@ TimelinePanel::TimelinePanel(QWidget *parent) :
|
|||||||
layout->addWidget(view_);
|
layout->addWidget(view_);
|
||||||
|
|
||||||
connect(view_->horizontalScrollBar(), SIGNAL(valueChanged(int)), ruler_, SLOT(SetScroll(int)));
|
connect(view_->horizontalScrollBar(), SIGNAL(valueChanged(int)), ruler_, SLOT(SetScroll(int)));
|
||||||
|
connect(view_, SIGNAL(UserSetScale(double)), this, SLOT(SetScale(double)));
|
||||||
connect(ruler_, SIGNAL(TimeChanged(const int64_t&)), view_, SLOT(SetTime(const int64_t&)));
|
connect(ruler_, SIGNAL(TimeChanged(const int64_t&)), view_, SLOT(SetTime(const int64_t&)));
|
||||||
|
|
||||||
// FIXME: Magic number
|
// FIXME: Magic number
|
||||||
|
|||||||
@@ -49,13 +49,14 @@ signals:
|
|||||||
private:
|
private:
|
||||||
void Retranslate();
|
void Retranslate();
|
||||||
|
|
||||||
void SetScale(double scale);
|
|
||||||
|
|
||||||
TimelineView* view_;
|
TimelineView* view_;
|
||||||
|
|
||||||
TimeRuler* ruler_;
|
TimeRuler* ruler_;
|
||||||
|
|
||||||
double scale_;
|
double scale_;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void SetScale(double scale);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TIMELINE_PANEL_H
|
#endif // TIMELINE_PANEL_H
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ signals:
|
|||||||
void RequestReplaceBlock(Block* old, Block* replace, int track);
|
void RequestReplaceBlock(Block* old, Block* replace, int track);
|
||||||
void RequestSplitAtTime(rational time, int track);
|
void RequestSplitAtTime(rational time, int track);
|
||||||
|
|
||||||
|
void UserSetScale(double scale);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void mousePressEvent(QMouseEvent *event) override;
|
virtual void mousePressEvent(QMouseEvent *event) override;
|
||||||
virtual void mouseMoveEvent(QMouseEvent *event) override;
|
virtual void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ void TimelineView::ZoomTool::MouseRelease(QMouseEvent *event)
|
|||||||
{
|
{
|
||||||
if (event->modifiers() & Qt::AltModifier) {
|
if (event->modifiers() & Qt::AltModifier) {
|
||||||
// Zoom out if the user clicks while holding Alt
|
// Zoom out if the user clicks while holding Alt
|
||||||
parent()->SetScale(parent()->scale_ * 0.5);
|
emit parent()->UserSetScale(parent()->scale_ * 0.5);
|
||||||
} else {
|
} else {
|
||||||
// Otherwise zoom in
|
// Otherwise zoom in
|
||||||
parent()->SetScale(parent()->scale_ * 2);
|
emit parent()->UserSetScale(parent()->scale_ * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user