updates for C++17
This commit is contained in:
@@ -163,14 +163,24 @@ public:
|
||||
initial_drag_item_ = initial_item;
|
||||
|
||||
dragging_.resize(selected_.size());
|
||||
snap_points_.resize(selected_.size()*2);
|
||||
|
||||
if constexpr (std::is_same_v<T, TimelineMarker>) {
|
||||
snap_points_.resize(selected_.size()*2);
|
||||
} else {
|
||||
snap_points_.resize(selected_.size());
|
||||
}
|
||||
|
||||
for (size_t i=0; i<selected_.size(); i++) {
|
||||
T *obj = selected_.at(i);
|
||||
|
||||
dragging_[i] = obj->time();
|
||||
|
||||
snap_points_[i] = obj->time();
|
||||
snap_points_[i+selected_.size()] = obj->time_range().out();
|
||||
if constexpr (std::is_same_v<T, TimelineMarker>) {
|
||||
dragging_[i] = obj->time().in();
|
||||
snap_points_[i] = obj->time().in();
|
||||
snap_points_[i+selected_.size()] = obj->time().out();
|
||||
} else {
|
||||
dragging_[i] = obj->time();
|
||||
snap_points_[i] = obj->time();
|
||||
}
|
||||
}
|
||||
|
||||
drag_mouse_start_ = view_->mapToScene(event->pos());
|
||||
@@ -258,7 +268,15 @@ public:
|
||||
}
|
||||
|
||||
// Show information about this keyframe
|
||||
QString tip = Timecode::time_to_timecode(initial_drag_item_->time(), timebase_,
|
||||
rational display_time;
|
||||
|
||||
if constexpr (std::is_same_v<T, TimelineMarker>) {
|
||||
display_time = initial_drag_item_->time().in();
|
||||
} else {
|
||||
display_time = initial_drag_item_->time();
|
||||
}
|
||||
|
||||
QString tip = Timecode::time_to_timecode(display_time, timebase_,
|
||||
Core::instance()->GetTimecodeDisplay(), false);
|
||||
|
||||
if (!tip_format.isEmpty()) {
|
||||
@@ -274,7 +292,13 @@ public:
|
||||
QToolTip::hideText();
|
||||
|
||||
for (size_t i=0; i<selected_.size(); i++) {
|
||||
command->add_child(new SetTimeCommand(selected_.at(i), selected_.at(i)->time(), dragging_.at(i)));
|
||||
rational current;
|
||||
if constexpr (std::is_same_v<T, TimelineMarker>) {
|
||||
current = selected_.at(i)->time().in();
|
||||
} else {
|
||||
current = selected_.at(i)->time();
|
||||
}
|
||||
command->add_child(new SetTimeCommand(selected_.at(i), current, dragging_.at(i)));
|
||||
}
|
||||
|
||||
dragging_.clear();
|
||||
|
||||
@@ -346,10 +346,10 @@ void TimeBasedWidget::GoToPrevCut()
|
||||
|
||||
rational closest_cut = 0;
|
||||
|
||||
foreach (Track* track, sequence->GetTracks()) {
|
||||
for (Track* track : sequence->GetTracks()) {
|
||||
rational this_track_closest_cut = 0;
|
||||
|
||||
foreach (Block* block, track->Blocks()) {
|
||||
for (Block* block : track->Blocks()) {
|
||||
if (block->out() < GetTime()) {
|
||||
this_track_closest_cut = block->out();
|
||||
} else {
|
||||
@@ -754,7 +754,7 @@ bool TimeBasedWidget::SnapPoint(const std::vector<rational> &start_times, ration
|
||||
for (auto jt=markers->cbegin(); jt!=markers->cend(); jt++) {
|
||||
TimelineMarker *marker = *jt;
|
||||
|
||||
TimeRange marker_range = marker->time_range() + clip->in() - clip->media_in();
|
||||
TimeRange marker_range = marker->time() + clip->in() - clip->media_in();
|
||||
|
||||
qreal marker_in_screen = TimeToScene(marker_range.in());
|
||||
qreal marker_out_screen = TimeToScene(marker_range.out());
|
||||
@@ -777,12 +777,12 @@ bool TimeBasedWidget::SnapPoint(const std::vector<rational> &start_times, ration
|
||||
continue;
|
||||
}
|
||||
|
||||
qreal marker_pos = TimeToScene(m->time_range().in());
|
||||
AttemptSnap(potential_snaps, screen_pt, marker_pos, start_times, m->time_range().in());
|
||||
qreal marker_pos = TimeToScene(m->time().in());
|
||||
AttemptSnap(potential_snaps, screen_pt, marker_pos, start_times, m->time().in());
|
||||
|
||||
if (m->time_range().in() != m->time_range().out()) {
|
||||
marker_pos = TimeToScene(m->time_range().out());
|
||||
AttemptSnap(potential_snaps, screen_pt, marker_pos, start_times, m->time_range().out());
|
||||
if (m->time().in() != m->time().out()) {
|
||||
marker_pos = TimeToScene(m->time().out());
|
||||
AttemptSnap(potential_snaps, screen_pt, marker_pos, start_times, m->time().out());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user