sequence encapsulation
This commit is contained in:
+2
-2
@@ -933,8 +933,8 @@ void MainWindow::Retranslate()
|
||||
debug_log_->setText(tr("Debug Log"));
|
||||
about_action_->setText(tr("&About..."));
|
||||
|
||||
panel_sequence_viewer->set_panel_name(QCoreApplication::translate("Viewer", "Sequence Viewer"));
|
||||
panel_footage_viewer->set_panel_name(QCoreApplication::translate("Viewer", "Media Viewer"));
|
||||
panel_sequence_viewer->set_panel_name(QCoreApplication::translate("Viewer", "Sequence Viewer: %1"));
|
||||
panel_footage_viewer->set_panel_name(QCoreApplication::translate("Viewer", "Media Viewer: %1"));
|
||||
|
||||
// the recommended changeEvent() and event() methods of propagating language change messages provided mixed results
|
||||
// (i.e. different panels failed to translate in different sessions), so we translate them manually here
|
||||
|
||||
+6
-6
@@ -9,7 +9,7 @@ int olive::timeline::kTimelineLabelFixedWidth = 200;
|
||||
|
||||
TimelineArea::TimelineArea(Timeline* timeline, olive::timeline::Alignment alignment) :
|
||||
timeline_(timeline),
|
||||
track_list_(nullptr),
|
||||
sequence_(nullptr),
|
||||
alignment_(alignment)
|
||||
{
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
@@ -157,17 +157,18 @@ void TimelineArea::wheelEvent(QWheelEvent *event)
|
||||
|
||||
void TimelineArea::RefreshLabels()
|
||||
{
|
||||
if (track_list_ == nullptr) {
|
||||
if (sequence_ == nullptr) {
|
||||
|
||||
labels_.clear();
|
||||
|
||||
} else {
|
||||
|
||||
/* FIXME
|
||||
labels_.resize(track_list_->TrackCount());
|
||||
QVector<Track*> track_list = sequence_->GetTrackList(type_);
|
||||
|
||||
labels_.resize(track_list.size());
|
||||
for (int i=0;i<labels_.size();i++) {
|
||||
labels_[i] = std::make_shared<TimelineLabel>();
|
||||
labels_[i]->SetTrack(track_list_->TrackAt(i));
|
||||
labels_[i]->SetTrack(track_list.at(i));
|
||||
labels_[i]->SetAlignment(alignment_);
|
||||
|
||||
switch (alignment_) {
|
||||
@@ -181,7 +182,6 @@ void TimelineArea::RefreshLabels()
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ protected:
|
||||
virtual void resizeEvent(QResizeEvent *event) override;
|
||||
private:
|
||||
Timeline* timeline_;
|
||||
Sequence* track_list_;
|
||||
Sequence* sequence_;
|
||||
olive::TrackType type_;
|
||||
TimelineView* view_;
|
||||
QVector<TimelineLabelPtr> labels_;
|
||||
|
||||
@@ -357,7 +357,7 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
|
||||
QPainter p(this);
|
||||
int yoff = get_marker_offset();
|
||||
|
||||
double interval = viewer->seq->frame_rate;
|
||||
double interval = viewer->seq->frame_rate();
|
||||
int textWidth = 0;
|
||||
int lastTextBoundary = INT_MIN;
|
||||
|
||||
@@ -389,7 +389,7 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
|
||||
// draw text
|
||||
bool draw_text = false;
|
||||
if (text_enabled && lineX-textWidth > lastTextBoundary) {
|
||||
timecode = frame_to_timecode(frame + in_visible, olive::config.timecode_view, viewer->seq->frame_rate);
|
||||
timecode = frame_to_timecode(frame + in_visible, olive::config.timecode_view, viewer->seq->frame_rate());
|
||||
fullTextWidth = fm.width(timecode);
|
||||
textWidth = fullTextWidth>>1;
|
||||
|
||||
|
||||
+6
-6
@@ -209,9 +209,9 @@ void TimelineView::tooltip_timer_timeout() {
|
||||
QToolTip::showText(QCursor::pos(),
|
||||
tr("%1\nStart: %2\nEnd: %3\nDuration: %4").arg(
|
||||
tooltip_clip->name(),
|
||||
frame_to_timecode(tooltip_clip->timeline_in(), olive::config.timecode_view, sequence()->frame_rate),
|
||||
frame_to_timecode(tooltip_clip->timeline_out(), olive::config.timecode_view, sequence()->frame_rate),
|
||||
frame_to_timecode(tooltip_clip->length(), olive::config.timecode_view, sequence()->frame_rate)
|
||||
frame_to_timecode(tooltip_clip->timeline_in(), olive::config.timecode_view, sequence()->frame_rate()),
|
||||
frame_to_timecode(tooltip_clip->timeline_out(), olive::config.timecode_view, sequence()->frame_rate()),
|
||||
frame_to_timecode(tooltip_clip->length(), olive::config.timecode_view, sequence()->frame_rate())
|
||||
));
|
||||
}
|
||||
|
||||
@@ -1987,9 +1987,9 @@ void TimelineView::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
*/
|
||||
|
||||
if (ParentTimeline()->importing) {
|
||||
QToolTip::showText(mapToGlobal(mouse_pos), frame_to_timecode(earliest_in_point, olive::config.timecode_view, sequence()->frame_rate));
|
||||
QToolTip::showText(mapToGlobal(mouse_pos), frame_to_timecode(earliest_in_point, olive::config.timecode_view, sequence()->frame_rate()));
|
||||
} else {
|
||||
QString tip = ((frame_diff < 0) ? "-" : "+") + frame_to_timecode(qAbs(frame_diff), olive::config.timecode_view, sequence()->frame_rate);
|
||||
QString tip = ((frame_diff < 0) ? "-" : "+") + frame_to_timecode(qAbs(frame_diff), olive::config.timecode_view, sequence()->frame_rate());
|
||||
|
||||
if (ParentTimeline()->trim_target != nullptr) {
|
||||
// find which clip is being moved
|
||||
@@ -2009,7 +2009,7 @@ void TimelineView::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
} else {
|
||||
len += frame_diff;
|
||||
}
|
||||
tip += frame_to_timecode(len, olive::config.timecode_view, sequence()->frame_rate);
|
||||
tip += frame_to_timecode(len, olive::config.timecode_view, sequence()->frame_rate());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+45
-45
@@ -88,65 +88,65 @@ void ViewerContainer::adjust() {
|
||||
horizontal_scrollbar->setVisible(false);
|
||||
vertical_scrollbar->setVisible(false);
|
||||
|
||||
int zoomed_width = qRound(double(viewer->seq->width)*zoom);
|
||||
int zoomed_height = qRound(double(viewer->seq->height)*zoom);
|
||||
int zoomed_width = qRound(double(viewer->seq->width())*zoom);
|
||||
int zoomed_height = qRound(double(viewer->seq->height())*zoom);
|
||||
|
||||
if (fit || zoomed_width > width() || zoomed_height > height()) {
|
||||
// if the zoom size is greater than or equal to the available area, only use the available area
|
||||
if (fit || zoomed_width > width() || zoomed_height > height()) {
|
||||
// if the zoom size is greater than or equal to the available area, only use the available area
|
||||
|
||||
double aspect_ratio = double(viewer->seq->width)/double(viewer->seq->height);
|
||||
double aspect_ratio = double(viewer->seq->width())/double(viewer->seq->height());
|
||||
|
||||
int widget_x = 0;
|
||||
int widget_y = 0;
|
||||
int widget_width = width();
|
||||
int widget_height = height();
|
||||
int widget_x = 0;
|
||||
int widget_y = 0;
|
||||
int widget_width = width();
|
||||
int widget_height = height();
|
||||
|
||||
if (!fit) {
|
||||
widget_width -= vertical_scrollbar->sizeHint().width();
|
||||
widget_height -= horizontal_scrollbar->sizeHint().height();
|
||||
}
|
||||
if (!fit) {
|
||||
widget_width -= vertical_scrollbar->sizeHint().width();
|
||||
widget_height -= horizontal_scrollbar->sizeHint().height();
|
||||
}
|
||||
|
||||
double widget_ar = double(widget_width) / double(widget_height);
|
||||
double widget_ar = double(widget_width) / double(widget_height);
|
||||
|
||||
bool widget_is_wider_than_sequence = widget_ar > aspect_ratio;
|
||||
bool widget_is_wider_than_sequence = widget_ar > aspect_ratio;
|
||||
|
||||
if (widget_is_wider_than_sequence) {
|
||||
widget_width = widget_height * aspect_ratio;
|
||||
widget_x = (width() / 2) - (widget_width / 2);
|
||||
} else {
|
||||
widget_height = widget_width / aspect_ratio;
|
||||
widget_y = (height() / 2) - (widget_height / 2);
|
||||
}
|
||||
if (widget_is_wider_than_sequence) {
|
||||
widget_width = widget_height * aspect_ratio;
|
||||
widget_x = (width() / 2) - (widget_width / 2);
|
||||
} else {
|
||||
widget_height = widget_width / aspect_ratio;
|
||||
widget_y = (height() / 2) - (widget_height / 2);
|
||||
}
|
||||
|
||||
child->move(widget_x, widget_y);
|
||||
child->resize(widget_width, widget_height);
|
||||
child->move(widget_x, widget_y);
|
||||
child->resize(widget_width, widget_height);
|
||||
|
||||
if (fit) {
|
||||
zoom = double(widget_width) / double(viewer->seq->width);
|
||||
} else if (zoomed_width > width() || zoomed_height > height()) {
|
||||
horizontal_scrollbar->setVisible(true);
|
||||
vertical_scrollbar->setVisible(true);
|
||||
if (fit) {
|
||||
zoom = double(widget_width) / double(viewer->seq->width());
|
||||
} else if (zoomed_width > width() || zoomed_height > height()) {
|
||||
horizontal_scrollbar->setVisible(true);
|
||||
vertical_scrollbar->setVisible(true);
|
||||
|
||||
horizontal_scrollbar->setMaximum(zoomed_width - width());
|
||||
vertical_scrollbar->setMaximum(zoomed_height - height());
|
||||
horizontal_scrollbar->setMaximum(zoomed_width - width());
|
||||
vertical_scrollbar->setMaximum(zoomed_height - height());
|
||||
|
||||
horizontal_scrollbar->setValue(horizontal_scrollbar->maximum()/2);
|
||||
vertical_scrollbar->setValue(vertical_scrollbar->maximum()/2);
|
||||
horizontal_scrollbar->setValue(horizontal_scrollbar->maximum()/2);
|
||||
vertical_scrollbar->setValue(vertical_scrollbar->maximum()/2);
|
||||
|
||||
adjust_scrollbars();
|
||||
}
|
||||
} else {
|
||||
// if the zoom size is smaller than the available area, scale the surface down
|
||||
adjust_scrollbars();
|
||||
}
|
||||
} else {
|
||||
// if the zoom size is smaller than the available area, scale the surface down
|
||||
|
||||
int zoomed_x = 0;
|
||||
int zoomed_y = 0;
|
||||
int zoomed_x = 0;
|
||||
int zoomed_y = 0;
|
||||
|
||||
if (zoomed_width < width()) zoomed_x = (width()>>1)-(zoomed_width>>1);
|
||||
if (zoomed_height < height()) zoomed_y = (height()>>1)-(zoomed_height>>1);
|
||||
if (zoomed_width < width()) zoomed_x = (width()>>1)-(zoomed_width>>1);
|
||||
if (zoomed_height < height()) zoomed_y = (height()>>1)-(zoomed_height>>1);
|
||||
|
||||
child->move(zoomed_x, zoomed_y);
|
||||
child->resize(zoomed_width, zoomed_height);
|
||||
}
|
||||
child->move(zoomed_x, zoomed_y);
|
||||
child->resize(zoomed_width, zoomed_height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,5 +170,5 @@ void ViewerContainer::scroll_changed() {
|
||||
child->set_scroll(
|
||||
double(horizontal_scrollbar->value())/double(horizontal_scrollbar->maximum()),
|
||||
double(vertical_scrollbar->value())/double(vertical_scrollbar->maximum())
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
+9
-9
@@ -266,7 +266,7 @@ QMatrix4x4 ViewerWidget::get_matrix()
|
||||
{
|
||||
QMatrix4x4 matrix;
|
||||
|
||||
double zoom_factor = container->zoom/(double(width())/double(viewer->seq->width));
|
||||
double zoom_factor = container->zoom/(double(width())/double(viewer->seq->width()));
|
||||
|
||||
if (zoom_factor > 1.0) {
|
||||
double zoom_size = (zoom_factor*2.0) - 2.0;
|
||||
@@ -298,7 +298,7 @@ void ViewerWidget::context_destroy() {
|
||||
|
||||
EffectGizmo* ViewerWidget::get_gizmo_from_mouse(int x, int y) {
|
||||
if (gizmos != nullptr) {
|
||||
double multiplier = double(viewer->seq->width) / double(width());
|
||||
double multiplier = double(viewer->seq->width()) / double(width());
|
||||
QPoint mouse_pos(qRound(x*multiplier), qRound((height()-y)*multiplier));
|
||||
int dot_size = 2 * qRound(GIZMO_DOT_SIZE * multiplier);
|
||||
int target_size = 2 * qRound(GIZMO_TARGET_SIZE * multiplier);
|
||||
@@ -335,7 +335,7 @@ EffectGizmo* ViewerWidget::get_gizmo_from_mouse(int x, int y) {
|
||||
|
||||
void ViewerWidget::move_gizmos(QMouseEvent *event, bool done) {
|
||||
if (selected_gizmo != nullptr) {
|
||||
double multiplier = double(viewer->seq->width) / double(width());
|
||||
double multiplier = double(viewer->seq->width()) / double(width());
|
||||
|
||||
int x_movement = qRound((event->pos().x() - drag_start_x)*multiplier);
|
||||
int y_movement = qRound((event->pos().y() - drag_start_y)*multiplier);
|
||||
@@ -555,13 +555,13 @@ void ViewerWidget::draw_gizmos() {
|
||||
|
||||
pipeline_->bind();
|
||||
|
||||
double zoom_factor = container->zoom/(double(width())/double(viewer->seq->width));
|
||||
double zoom_factor = container->zoom/(double(width())/double(viewer->seq->width()));
|
||||
|
||||
QMatrix4x4 matrix;
|
||||
matrix.ortho(0, viewer->seq->width, 0, viewer->seq->height, -1, 1);
|
||||
matrix.ortho(0, viewer->seq->width(), 0, viewer->seq->height(), -1, 1);
|
||||
matrix.scale(zoom_factor, zoom_factor);
|
||||
matrix.translate(-(viewer->seq->width-(width()/container->zoom))*x_scroll,
|
||||
-((viewer->seq->height-(height()/container->zoom))*(1.0-y_scroll)));
|
||||
matrix.translate(-(viewer->seq->width()-(width()/container->zoom))*x_scroll,
|
||||
-((viewer->seq->height()-(height()/container->zoom))*(1.0-y_scroll)));
|
||||
|
||||
// Set transformation matrix
|
||||
pipeline_->setUniformValue("mvp_matrix", matrix);
|
||||
@@ -571,7 +571,7 @@ void ViewerWidget::draw_gizmos() {
|
||||
pipeline_->setUniformValue("color_only_color", QColor(255, 255, 255, 255));
|
||||
|
||||
// Set up constants for gizmo sizes
|
||||
float size_diff = float(viewer->seq->width) / float(width());
|
||||
float size_diff = float(viewer->seq->width()) / float(width());
|
||||
float dot_size = GIZMO_DOT_SIZE * size_diff;
|
||||
float target_size = GIZMO_TARGET_SIZE * size_diff;
|
||||
|
||||
@@ -761,7 +761,7 @@ void ViewerWidget::paintGL() {
|
||||
}
|
||||
|
||||
if (window->isVisible()) {
|
||||
window->set_texture(tex, double(viewer->seq->width)/double(viewer->seq->height), tex_lock);
|
||||
window->set_texture(tex, double(viewer->seq->width())/double(viewer->seq->height()), tex_lock);
|
||||
}
|
||||
|
||||
tex_lock->unlock();
|
||||
|
||||
Reference in New Issue
Block a user