fixed last references to track as an integer

This commit is contained in:
itsmattkc
2019-04-03 23:59:36 +11:00
parent f3178ff071
commit 673bcc0bf7
7 changed files with 31 additions and 11 deletions
+1 -1
View File
@@ -418,7 +418,7 @@ void SpeedDialog::accept() {
if (i > 0 && !qFuzzyCompare(cached_speed, c->speed().value)) {
can_change_all = false;
}
if (c->track() < 0) {
if (c->type() == Track::kTypeVideo) {
if (qIsNaN(cached_fr)) {
cached_fr = c->media_frame_rate();
} else if (!qFuzzyCompare(cached_fr, c->media_frame_rate())) {
+6 -2
View File
@@ -90,7 +90,7 @@ Timeline::Timeline(QWidget *parent) :
headers->viewer = panel_sequence_viewer;
video_area->SetAlignment(olive::timeline::kAlignmentBottom);
//video_area->SetAlignment(olive::timeline::kAlignmentBottom);
tool_buttons.append(toolArrowButton);
tool_buttons.append(toolEditButton);
@@ -993,8 +993,11 @@ void Timeline::setup_ui() {
timeline_area_layout->setSpacing(0);
timeline_area_layout->setContentsMargins(0, 0, 0, 0);
QHBoxLayout* timeline_header_layout = new QHBoxLayout();
timeline_header_layout->addSpacing(olive::timeline::kTimelineLabelFixedWidth);
headers = new TimelineHeader();
timeline_area_layout->addWidget(headers);
timeline_header_layout->addWidget(headers);
timeline_area_layout->addLayout(timeline_header_layout);
editAreas = new QWidget();
QHBoxLayout* editAreaLayout = new QHBoxLayout(editAreas);
@@ -1063,4 +1066,5 @@ void olive::timeline::MultiplyTrackSizesByDPI()
kTrackDefaultHeight *= QApplication::desktop()->devicePixelRatio();
kTrackMinHeight *= QApplication::desktop()->devicePixelRatio();
kTrackHeightIncrement *= QApplication::desktop()->devicePixelRatio();
kTimelineLabelFixedWidth *= QApplication::desktop()->devicePixelRatio();
}
+2 -2
View File
@@ -370,7 +370,7 @@ GLuint olive::rendering::compose_sequence(ComposeSequenceParams &params) {
if (got_mutex && c->IsOpen()) {
// if clip is a video clip
if (c->track() < 0) {
if (c->type() == Track::kTypeVideo) {
// textureID variable contains texture to be drawn on screen at the end
GLuint textureID = 0;
@@ -750,7 +750,7 @@ GLuint olive::rendering::compose_sequence(ComposeSequenceParams &params) {
// == END FINAL DRAW ON SEQUENCE BUFFER ==
}
}
} else {
} else if (c->type() == Track::kTypeAudio) {
if (c->media() != nullptr && c->media()->get_type() == MEDIA_TYPE_SEQUENCE) {
params.nests.append(c);
compose_sequence(params);
+1 -1
View File
@@ -721,7 +721,7 @@ bool Clip::Retrieve()
bool Clip::UsesCacher()
{
return track() >= 0 || (media() != nullptr && media()->get_type() == MEDIA_TYPE_FOOTAGE);
return type() == Track::kTypeAudio || (media() != nullptr && media()->get_type() == MEDIA_TYPE_FOOTAGE);
}
ClipSpeed::ClipSpeed() :
+2
View File
@@ -24,6 +24,8 @@ namespace olive {
extern int kTrackDefaultHeight;
extern int kTrackMinHeight;
extern int kTrackHeightIncrement;
extern int kTimelineLabelFixedWidth;
}
}
+3 -1
View File
@@ -1,5 +1,7 @@
#include "timelinearea.h"
int olive::timeline::kTimelineLabelFixedWidth = 200;
TimelineArea::TimelineArea(Timeline* timeline) :
timeline_(timeline),
track_list_(nullptr),
@@ -11,7 +13,7 @@ TimelineArea::TimelineArea(Timeline* timeline) :
// LABELS
QWidget* label_container = new QWidget();
label_container->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
label_container->setFixedWidth(olive::timeline::kTimelineLabelFixedWidth);
label_container_layout_ = new QVBoxLayout(label_container);
label_container_layout_->setMargin(0);
label_container_layout_->setSpacing(0);
+16 -4
View File
@@ -536,6 +536,8 @@ void TimelineView::dropEvent(QDropEvent* event) {
ParentTimeline()->ghosts.clear();
ParentTimeline()->importing = false;
olive::undo_stack.push(ca);
setFocus();
@@ -1914,7 +1916,10 @@ void TimelineView::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
} else if (g.old_track->type() == ParentTimeline()->drag_track_start->type()) {
g.track += track_diff;
if (mouse_track != nullptr) {
g.track = g.track->track_list()->TrackAt(mouse_track->Index());
}
//g.track += track_diff;
}
} else if (effective_tool == olive::timeline::TIMELINE_TOOL_TRANSITION) {
@@ -3310,11 +3315,18 @@ void TimelineView::resizeEvent(QResizeEvent *) {
// **************************************
Track *TimelineView::getTrackFromScreenPoint(int y) {
if (y < 0 || y > height()) {
return nullptr;
}
y += scroll;
int heights = 0;
for (int i=0;i<track_list_->TrackCount();i++) {
//for (int i=0;i<track_list_->TrackCount();i++) {
int i = 0;
while (true) {
int new_heights = heights + 1;
new_heights += track_list_->TrackAt(i)->height();
@@ -3324,9 +3336,9 @@ Track *TimelineView::getTrackFromScreenPoint(int y) {
}
heights = new_heights;
}
return nullptr;
i++;
}
}
int TimelineView::getScreenPointFromTrack(Track *track) {