style: unify identifier naming per updated conventions
Automated with clang-tidy readability-identifier-naming (config added to .clang-tidy) plus scripted passes, per the updated rules now documented in CONTRIBUTING.md: - types (class/struct/enum/alias/template params): PascalCase - functions, variables, members: snake_case (incl. rational -> Rational) - private/protected members: trailing underscore; static member variables likewise (instance_, available_themes_) - constants and enum values: snake_case (kLinear -> k_linear, F32P -> f32p); ALL_CAPS reserved for macros - macros: OAK_ prefix (OLIVE_ADD_TEST/OLIVE_ASSERT/OLIVE_CONFIG -> OAK_ADD_TEST/OAK_ASSERT/OAK_CONFIG, GL_PREAMBLE -> OAK_GL_PREAMBLE, include guards -> OAK_*) - file names: all lowercase (Current/Plugin/OliveHost/OliveClip/ OlivePluginInstance -> current/plugin/olivehost/oliveclip/ oliveplugininstance) - getters share the member name sans underscore, setters set_foo() - Qt and third-party (OpenFX) virtual overrides and framework callbacks keep their original names (exempt in .clang-tidy) Manual follow-ups required where automation could not reach: - string-based QMetaObject/SIGNAL/SLOT references updated to renamed methods (AddTask, CreatedFile, DeleteSpecificFile, moveSelectionUp, ...) - macro bodies referencing renamed methods (OLIVE_CONFIG, NODE_DEFAULT_DESTRUCTOR, MANAGEDDISPLAYWIDGET_*) - self-shadowing locals renamed where signals/methods became same-named (size_changed, worker_count, selected_items, import param, filters) - third_party OFX member/namespace usages restored (OFX::Host::*, _created, _clipPrefsDirty, createInstance, clearPersistentMessage) - STL protocol aliases restored (const_iterator) with .clang-tidy ignore rules; qHash overloads restored Full build and test suite pass: ctest 4/4, ~1960 gtest cases green.
This commit is contained in:
@@ -39,112 +39,112 @@ AddTool::AddTool(TimelineWidget *parent)
|
||||
{
|
||||
}
|
||||
|
||||
void AddTool::MousePress(TimelineViewMouseEvent *event)
|
||||
void AddTool::mouse_press(TimelineViewMouseEvent *event)
|
||||
{
|
||||
const Track::Reference &track = event->GetTrack();
|
||||
const Track::Reference &track = event->get_track();
|
||||
|
||||
// Check if track is locked
|
||||
Track *t = parent()->GetTrackFromReference(track);
|
||||
if (t && t->IsLocked()) {
|
||||
Track *t = parent()->get_track_from_reference(track);
|
||||
if (t && t->is_locked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Track::Type add_type = Track::kNone;
|
||||
Track::Type add_type = Track::k_none;
|
||||
|
||||
switch (Core::instance()->GetSelectedAddableObject()) {
|
||||
case Tool::kAddableBars:
|
||||
case Tool::kAddableSolid:
|
||||
case Tool::kAddableTitle:
|
||||
case Tool::kAddableShape:
|
||||
add_type = Track::kVideo;
|
||||
switch (Core::instance()->get_selected_addable_object()) {
|
||||
case Tool::k_addable_bars:
|
||||
case Tool::k_addable_solid:
|
||||
case Tool::k_addable_title:
|
||||
case Tool::k_addable_shape:
|
||||
add_type = Track::k_video;
|
||||
break;
|
||||
case Tool::kAddableTone:
|
||||
add_type = Track::kAudio;
|
||||
case Tool::k_addable_tone:
|
||||
add_type = Track::k_audio;
|
||||
break;
|
||||
case Tool::kAddableSubtitle:
|
||||
add_type = Track::kSubtitle;
|
||||
case Tool::k_addable_subtitle:
|
||||
add_type = Track::k_subtitle;
|
||||
break;
|
||||
case Tool::kAddableEmpty:
|
||||
case Tool::k_addable_empty:
|
||||
// Leave as "none", which means this block can be placed on any track
|
||||
break;
|
||||
case Tool::kAddableCount:
|
||||
case Tool::k_addable_count:
|
||||
// Return so we do nothing
|
||||
return;
|
||||
}
|
||||
|
||||
if (add_type == Track::kNone || add_type == track.type()) {
|
||||
if (add_type == Track::k_none || add_type == track.type()) {
|
||||
drag_start_point_ =
|
||||
ValidatedCoordinate(event->GetCoordinates(true)).GetFrame();
|
||||
validated_coordinate(event->get_coordinates(true)).get_frame();
|
||||
|
||||
ghost_ = new TimelineViewGhostItem();
|
||||
ghost_->SetIn(drag_start_point_);
|
||||
ghost_->SetOut(drag_start_point_);
|
||||
ghost_->SetTrack(track);
|
||||
parent()->AddGhost(ghost_);
|
||||
ghost_->set_in(drag_start_point_);
|
||||
ghost_->set_out(drag_start_point_);
|
||||
ghost_->set_track(track);
|
||||
parent()->add_ghost(ghost_);
|
||||
|
||||
snap_points_.push_back(drag_start_point_);
|
||||
}
|
||||
}
|
||||
|
||||
void AddTool::MouseMove(TimelineViewMouseEvent *event)
|
||||
void AddTool::mouse_move(TimelineViewMouseEvent *event)
|
||||
{
|
||||
if (!ghost_) {
|
||||
return;
|
||||
}
|
||||
|
||||
MouseMoveInternal(event->GetFrame(),
|
||||
event->GetModifiers() & Qt::AltModifier);
|
||||
mouse_move_internal(event->get_frame(),
|
||||
event->get_modifiers() & Qt::AltModifier);
|
||||
}
|
||||
|
||||
void AddTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
void AddTool::mouse_release(TimelineViewMouseEvent *event)
|
||||
{
|
||||
if (ghost_) {
|
||||
if (!ghost_->GetAdjustedLength().isNull()) {
|
||||
if (!ghost_->get_adjusted_length().isNull()) {
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
|
||||
if (MultiUndoCommand *subtitle_section_command =
|
||||
parent()->TakeSubtitleSectionCommand()) {
|
||||
parent()->take_subtitle_section_command()) {
|
||||
command->add_child(subtitle_section_command);
|
||||
}
|
||||
|
||||
Sequence *s = parent()->sequence();
|
||||
|
||||
QRectF r;
|
||||
if (Core::instance()->GetSelectedAddableObject() ==
|
||||
Tool::kAddableTitle) {
|
||||
VideoParams svp = s->GetVideoParams();
|
||||
if (Core::instance()->get_selected_addable_object() ==
|
||||
Tool::k_addable_title) {
|
||||
VideoParams svp = s->get_video_params();
|
||||
r = QRectF(0, 0, svp.width(), svp.height());
|
||||
r.adjust(svp.width() / 10, svp.height() / 10, -svp.width() / 10,
|
||||
-svp.height() / 10);
|
||||
}
|
||||
|
||||
CreateAddableClip(command, s, ghost_->GetTrack(),
|
||||
ghost_->GetAdjustedIn(),
|
||||
ghost_->GetAdjustedLength(), r);
|
||||
create_addable_clip(command, s, ghost_->get_track(),
|
||||
ghost_->get_adjusted_in(),
|
||||
ghost_->get_adjusted_length(), r);
|
||||
|
||||
Core::instance()->undo_stack()->push(
|
||||
command, qApp->translate("AddTool", "Added Clip"));
|
||||
}
|
||||
|
||||
parent()->ClearGhosts();
|
||||
parent()->clear_ghosts();
|
||||
snap_points_.clear();
|
||||
ghost_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Node *AddTool::CreateAddableClip(MultiUndoCommand *command, Sequence *sequence,
|
||||
Node *AddTool::create_addable_clip(MultiUndoCommand *command, Sequence *sequence,
|
||||
const Track::Reference &track,
|
||||
const rational &in, const rational &length,
|
||||
const Rational &in, const Rational &length,
|
||||
const QRectF &rect)
|
||||
{
|
||||
ClipBlock *clip;
|
||||
if (Core::instance()->GetSelectedAddableObject() ==
|
||||
Tool::kAddableSubtitle) {
|
||||
if (Core::instance()->get_selected_addable_object() ==
|
||||
Tool::k_addable_subtitle) {
|
||||
clip = new SubtitleBlock();
|
||||
} else {
|
||||
clip = new ClipBlock();
|
||||
clip->SetLabel(olive::Tool::GetAddableObjectName(
|
||||
Core::instance()->GetSelectedAddableObject()));
|
||||
clip->set_label(olive::Tool::get_addable_object_name(
|
||||
Core::instance()->get_selected_addable_object()));
|
||||
}
|
||||
clip->set_length_and_media_out(length);
|
||||
|
||||
@@ -157,45 +157,45 @@ Node *AddTool::CreateAddableClip(MultiUndoCommand *command, Sequence *sequence,
|
||||
|
||||
Node *node_to_add = nullptr;
|
||||
|
||||
switch (Core::instance()->GetSelectedAddableObject()) {
|
||||
case Tool::kAddableEmpty:
|
||||
switch (Core::instance()->get_selected_addable_object()) {
|
||||
case Tool::k_addable_empty:
|
||||
// Empty, nothing to be done
|
||||
break;
|
||||
case Tool::kAddableSolid:
|
||||
case Tool::k_addable_solid:
|
||||
node_to_add = new SolidGenerator();
|
||||
break;
|
||||
case Tool::kAddableShape:
|
||||
case Tool::k_addable_shape:
|
||||
node_to_add = new ShapeNode();
|
||||
break;
|
||||
case Tool::kAddableTitle:
|
||||
case Tool::k_addable_title:
|
||||
node_to_add = new TextGeneratorV3();
|
||||
break;
|
||||
case Tool::kAddableBars:
|
||||
case Tool::kAddableTone:
|
||||
case Tool::k_addable_bars:
|
||||
case Tool::k_addable_tone:
|
||||
// Not implemented yet
|
||||
qWarning() << "Unimplemented add object:"
|
||||
<< Core::instance()->GetSelectedAddableObject();
|
||||
<< Core::instance()->get_selected_addable_object();
|
||||
break;
|
||||
case Tool::kAddableSubtitle:
|
||||
case Tool::k_addable_subtitle:
|
||||
// The block itself is the node we want
|
||||
break;
|
||||
case Tool::kAddableCount:
|
||||
case Tool::k_addable_count:
|
||||
// Invalid value, do nothing
|
||||
break;
|
||||
}
|
||||
|
||||
if (node_to_add) {
|
||||
QPointF extra_node_offset(kDefaultDistanceFromOutput, 0);
|
||||
QPointF extra_node_offset(k_default_distance_from_output, 0);
|
||||
command->add_child(new NodeAddCommand(graph, node_to_add));
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
node_to_add, NodeInput(clip, ClipBlock::kBufferIn)));
|
||||
node_to_add, NodeInput(clip, ClipBlock::k_buffer_in)));
|
||||
command->add_child(
|
||||
new NodeSetPositionCommand(node_to_add, clip, extra_node_offset));
|
||||
|
||||
if (!rect.isNull()) {
|
||||
if (ShapeNodeBase *shape =
|
||||
dynamic_cast<ShapeNodeBase *>(node_to_add)) {
|
||||
shape->SetRect(rect, sequence->GetVideoParams(), command);
|
||||
shape->set_rect(rect, sequence->get_video_params(), command);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -203,22 +203,22 @@ Node *AddTool::CreateAddableClip(MultiUndoCommand *command, Sequence *sequence,
|
||||
return node_to_add;
|
||||
}
|
||||
|
||||
void AddTool::MouseMoveInternal(const rational &cursor_frame, bool outwards)
|
||||
void AddTool::mouse_move_internal(const Rational &cursor_frame, bool outwards)
|
||||
{
|
||||
// Calculate movement
|
||||
rational movement = cursor_frame - drag_start_point_;
|
||||
Rational movement = cursor_frame - drag_start_point_;
|
||||
|
||||
// Validation: Ensure in point never goes below 0
|
||||
if (movement < -ghost_->GetIn() ||
|
||||
(outwards && -movement < -ghost_->GetIn())) {
|
||||
movement = -ghost_->GetIn();
|
||||
if (movement < -ghost_->get_in() ||
|
||||
(outwards && -movement < -ghost_->get_in())) {
|
||||
movement = -ghost_->get_in();
|
||||
}
|
||||
|
||||
// Snap movement
|
||||
bool snapped;
|
||||
|
||||
if (Core::instance()->snapping()) {
|
||||
snapped = parent()->SnapPoint(snap_points_, &movement);
|
||||
snapped = parent()->snap_point(snap_points_, &movement);
|
||||
} else {
|
||||
snapped = false;
|
||||
}
|
||||
@@ -227,20 +227,20 @@ void AddTool::MouseMoveInternal(const rational &cursor_frame, bool outwards)
|
||||
if (!snapped && outwards) {
|
||||
// Snap backwards too
|
||||
movement = -movement;
|
||||
parent()->SnapPoint(snap_points_, &movement);
|
||||
parent()->snap_point(snap_points_, &movement);
|
||||
// We don't need to un-neg here because outwards means all future processing will be done both pos and neg
|
||||
}
|
||||
|
||||
// Make adjustment
|
||||
if (!movement) {
|
||||
ghost_->SetInAdjustment(0);
|
||||
ghost_->SetOutAdjustment(0);
|
||||
ghost_->set_in_adjustment(0);
|
||||
ghost_->set_out_adjustment(0);
|
||||
} else if (movement > 0) {
|
||||
ghost_->SetInAdjustment(outwards ? -movement : 0);
|
||||
ghost_->SetOutAdjustment(movement);
|
||||
ghost_->set_in_adjustment(outwards ? -movement : 0);
|
||||
ghost_->set_out_adjustment(movement);
|
||||
} else if (movement < 0) {
|
||||
ghost_->SetInAdjustment(movement);
|
||||
ghost_->SetOutAdjustment(outwards ? -movement : 0);
|
||||
ghost_->set_in_adjustment(movement);
|
||||
ghost_->set_out_adjustment(outwards ? -movement : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef ADDTIMELINETOOL_H
|
||||
#define ADDTIMELINETOOL_H
|
||||
#ifndef OAK_ADDTIMELINETOOL_H
|
||||
#define OAK_ADDTIMELINETOOL_H
|
||||
|
||||
#include "beam.h"
|
||||
|
||||
@@ -31,24 +31,24 @@ class AddTool : public BeamTool {
|
||||
public:
|
||||
AddTool(TimelineWidget *parent);
|
||||
|
||||
virtual void MousePress(TimelineViewMouseEvent *event) override;
|
||||
virtual void MouseMove(TimelineViewMouseEvent *event) override;
|
||||
virtual void MouseRelease(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_press(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_move(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_release(TimelineViewMouseEvent *event) override;
|
||||
|
||||
static Node *CreateAddableClip(MultiUndoCommand *command,
|
||||
static Node *create_addable_clip(MultiUndoCommand *command,
|
||||
Sequence *sequence,
|
||||
const Track::Reference &track,
|
||||
const rational &in, const rational &length,
|
||||
const Rational &in, const Rational &length,
|
||||
const QRectF &rect = QRectF());
|
||||
|
||||
protected:
|
||||
void MouseMoveInternal(const rational &cursor_frame, bool outwards);
|
||||
void mouse_move_internal(const Rational &cursor_frame, bool outwards);
|
||||
|
||||
TimelineViewGhostItem *ghost_;
|
||||
|
||||
rational drag_start_point_;
|
||||
Rational drag_start_point_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // ADDTIMELINETOOL_H
|
||||
#endif // OAK_ADDTIMELINETOOL_H
|
||||
|
||||
@@ -30,19 +30,19 @@ BeamTool::BeamTool(TimelineWidget *parent)
|
||||
{
|
||||
}
|
||||
|
||||
void BeamTool::HoverMove(TimelineViewMouseEvent *event)
|
||||
void BeamTool::hover_move(TimelineViewMouseEvent *event)
|
||||
{
|
||||
parent()->SetViewBeamCursor(
|
||||
ValidatedCoordinate(event->GetCoordinates(true)));
|
||||
parent()->set_view_beam_cursor(
|
||||
validated_coordinate(event->get_coordinates(true)));
|
||||
}
|
||||
|
||||
TimelineCoordinate BeamTool::ValidatedCoordinate(TimelineCoordinate coord)
|
||||
TimelineCoordinate BeamTool::validated_coordinate(TimelineCoordinate coord)
|
||||
{
|
||||
if (Core::instance()->snapping()) {
|
||||
rational movement;
|
||||
parent()->SnapPoint({ coord.GetFrame() }, &movement);
|
||||
Rational movement;
|
||||
parent()->snap_point({ coord.get_frame() }, &movement);
|
||||
if (!movement.isNull()) {
|
||||
coord.SetFrame(coord.GetFrame() + movement);
|
||||
coord.set_frame(coord.get_frame() + movement);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef BEAMTIMELINETOOL_H
|
||||
#define BEAMTIMELINETOOL_H
|
||||
#ifndef OAK_BEAMTIMELINETOOL_H
|
||||
#define OAK_BEAMTIMELINETOOL_H
|
||||
|
||||
#include "tool.h"
|
||||
|
||||
@@ -31,12 +31,12 @@ class BeamTool : public TimelineTool {
|
||||
public:
|
||||
BeamTool(TimelineWidget *parent);
|
||||
|
||||
virtual void HoverMove(TimelineViewMouseEvent *event) override;
|
||||
virtual void hover_move(TimelineViewMouseEvent *event) override;
|
||||
|
||||
protected:
|
||||
TimelineCoordinate ValidatedCoordinate(TimelineCoordinate coord);
|
||||
TimelineCoordinate validated_coordinate(TimelineCoordinate coord);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // BEAMTIMELINETOOL_H
|
||||
#endif // OAK_BEAMTIMELINETOOL_H
|
||||
|
||||
@@ -30,42 +30,42 @@ EditTool::EditTool(TimelineWidget *parent)
|
||||
{
|
||||
}
|
||||
|
||||
void EditTool::MousePress(TimelineViewMouseEvent *event)
|
||||
void EditTool::mouse_press(TimelineViewMouseEvent *event)
|
||||
{
|
||||
if (!(event->GetModifiers() & Qt::ShiftModifier)) {
|
||||
parent()->DeselectAll();
|
||||
if (!(event->get_modifiers() & Qt::ShiftModifier)) {
|
||||
parent()->deselect_all();
|
||||
}
|
||||
}
|
||||
|
||||
void EditTool::MouseMove(TimelineViewMouseEvent *event)
|
||||
void EditTool::mouse_move(TimelineViewMouseEvent *event)
|
||||
{
|
||||
if (dragging_) {
|
||||
rational end_frame = event->GetFrame(true);
|
||||
Rational end_frame = event->get_frame(true);
|
||||
|
||||
if (Core::instance()->snapping()) {
|
||||
rational movement;
|
||||
parent()->SnapPoint({ end_frame }, &movement);
|
||||
Rational movement;
|
||||
parent()->snap_point({ end_frame }, &movement);
|
||||
if (!movement.isNull()) {
|
||||
end_frame += movement;
|
||||
}
|
||||
}
|
||||
|
||||
parent()->SetSelections(start_selections_, false);
|
||||
parent()->AddSelection(TimeRange(start_coord_.GetFrame(), end_frame),
|
||||
start_coord_.GetTrack());
|
||||
parent()->set_selections(start_selections_, false);
|
||||
parent()->add_selection(TimeRange(start_coord_.get_frame(), end_frame),
|
||||
start_coord_.get_track());
|
||||
} else {
|
||||
start_selections_ = parent()->GetSelections();
|
||||
start_selections_ = parent()->get_selections();
|
||||
|
||||
dragging_ = true;
|
||||
|
||||
start_coord_ = event->GetCoordinates(true);
|
||||
start_coord_ = event->get_coordinates(true);
|
||||
|
||||
// Snap if we're snapping
|
||||
if (Core::instance()->snapping()) {
|
||||
rational movement;
|
||||
parent()->SnapPoint({ start_coord_.GetFrame() }, &movement);
|
||||
Rational movement;
|
||||
parent()->snap_point({ start_coord_.get_frame() }, &movement);
|
||||
if (!movement.isNull()) {
|
||||
start_coord_.SetFrame(start_coord_.GetFrame() + movement);
|
||||
start_coord_.set_frame(start_coord_.get_frame() + movement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,21 +73,21 @@ void EditTool::MouseMove(TimelineViewMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void EditTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
void EditTool::mouse_release(TimelineViewMouseEvent *event)
|
||||
{
|
||||
auto current_sel = parent()->GetSelections();
|
||||
parent()->SetSelections(start_selections_, false);
|
||||
parent()->SetSelections(current_sel, true);
|
||||
auto current_sel = parent()->get_selections();
|
||||
parent()->set_selections(start_selections_, false);
|
||||
parent()->set_selections(current_sel, true);
|
||||
|
||||
dragging_ = false;
|
||||
}
|
||||
|
||||
void EditTool::MouseDoubleClick(TimelineViewMouseEvent *event)
|
||||
void EditTool::mouse_double_click(TimelineViewMouseEvent *event)
|
||||
{
|
||||
Block *item = parent()->GetItemAtScenePos(event->GetCoordinates());
|
||||
Block *item = parent()->get_item_at_scene_pos(event->get_coordinates());
|
||||
|
||||
if (item && !item->track()->IsLocked()) {
|
||||
parent()->AddSelection(item);
|
||||
if (item && !item->track()->is_locked()) {
|
||||
parent()->add_selection(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef EDITTIMELINETOOL_H
|
||||
#define EDITTIMELINETOOL_H
|
||||
#ifndef OAK_EDITTIMELINETOOL_H
|
||||
#define OAK_EDITTIMELINETOOL_H
|
||||
|
||||
#include "beam.h"
|
||||
#include "tool.h"
|
||||
@@ -33,10 +33,10 @@ class EditTool : public BeamTool {
|
||||
public:
|
||||
EditTool(TimelineWidget *parent);
|
||||
|
||||
virtual void MousePress(TimelineViewMouseEvent *event) override;
|
||||
virtual void MouseMove(TimelineViewMouseEvent *event) override;
|
||||
virtual void MouseRelease(TimelineViewMouseEvent *event) override;
|
||||
virtual void MouseDoubleClick(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_press(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_move(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_release(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_double_click(TimelineViewMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
TimelineWidgetSelections start_selections_;
|
||||
@@ -46,4 +46,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // EDITTIMELINETOOL_H
|
||||
#endif // OAK_EDITTIMELINETOOL_H
|
||||
|
||||
@@ -49,18 +49,18 @@ ImportTool::ImportTool(TimelineWidget *parent)
|
||||
{
|
||||
// Calculate width used for importing to give ghosts a slight lead-in so the ghosts aren't right on the cursor
|
||||
import_pre_buffer_ =
|
||||
QtUtils::QFontMetricsWidth(parent->fontMetrics(), "HHHHHHHH");
|
||||
QtUtils::q_font_metrics_width(parent->fontMetrics(), "HHHHHHHH");
|
||||
}
|
||||
|
||||
void ImportTool::DragEnter(TimelineViewMouseEvent *event)
|
||||
void ImportTool::drag_enter(TimelineViewMouseEvent *event)
|
||||
{
|
||||
QStringList mime_formats = event->GetMimeData()->formats();
|
||||
QStringList mime_formats = event->get_mime_data()->formats();
|
||||
|
||||
// Listen for MIME data from a ProjectViewModel
|
||||
if (mime_formats.contains(Project::kItemMimeType)) {
|
||||
if (mime_formats.contains(Project::k_item_mime_type)) {
|
||||
// Data is drag/drop data from a ProjectViewModel
|
||||
QByteArray model_data =
|
||||
event->GetMimeData()->data(Project::kItemMimeType);
|
||||
event->get_mime_data()->data(Project::k_item_mime_type);
|
||||
|
||||
// Use QDataStream to deserialize the data
|
||||
QDataStream stream(&model_data, QIODevice::ReadOnly);
|
||||
@@ -70,7 +70,7 @@ void ImportTool::DragEnter(TimelineViewMouseEvent *event)
|
||||
QVector<Track::Reference> enabled_streams;
|
||||
|
||||
// Set drag start position
|
||||
drag_start_ = event->GetCoordinates();
|
||||
drag_start_ = event->get_coordinates();
|
||||
|
||||
snap_points_.clear();
|
||||
|
||||
@@ -83,28 +83,28 @@ void ImportTool::DragEnter(TimelineViewMouseEvent *event)
|
||||
// Check if Item is Footage
|
||||
ViewerOutput *f = dynamic_cast<ViewerOutput *>(item);
|
||||
|
||||
if (f && f->GetTotalStreamCount()) {
|
||||
if (f && f->get_total_stream_count()) {
|
||||
// If the Item is Footage, we can create a Ghost from it
|
||||
dragged_footage_.append({ f, enabled_streams });
|
||||
}
|
||||
}
|
||||
|
||||
// Create a reasonable amount of space to inset the cursor by when importing
|
||||
ghost_offset_ = drag_start_.GetFrame();
|
||||
ghost_offset_ = drag_start_.get_frame();
|
||||
|
||||
if (!event->GetBypassImportBuffer()) {
|
||||
ghost_offset_ -= parent()->SceneToTime(import_pre_buffer_);
|
||||
if (!event->get_bypass_import_buffer()) {
|
||||
ghost_offset_ -= parent()->scene_to_time(import_pre_buffer_);
|
||||
}
|
||||
|
||||
PrepGhosts(ghost_offset_, drag_start_.GetTrack().index());
|
||||
prep_ghosts(ghost_offset_, drag_start_.get_track().index());
|
||||
|
||||
if (parent()->HasGhosts() || !parent()->GetConnectedNode()) {
|
||||
if (parent()->has_ghosts() || !parent()->get_connected_node()) {
|
||||
// We only clear the tentative track if the mimedata is about to be destroyed (i.e. the drag
|
||||
// is cancelled). If we do this in DragLeave, it leads to undesirable behavior if the cursor
|
||||
// is going between views (subtitle track rapidly appearing and disappearing)
|
||||
QObject::connect(event->GetMimeData(), &QObject::destroyed,
|
||||
QObject::connect(event->get_mime_data(), &QObject::destroyed,
|
||||
parent(),
|
||||
&TimelineWidget::ClearTentativeSubtitleTrack);
|
||||
&TimelineWidget::clear_tentative_subtitle_track);
|
||||
|
||||
event->accept();
|
||||
} else {
|
||||
@@ -116,11 +116,11 @@ void ImportTool::DragEnter(TimelineViewMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void ImportTool::DragMove(TimelineViewMouseEvent *event)
|
||||
void ImportTool::drag_move(TimelineViewMouseEvent *event)
|
||||
{
|
||||
if (!dragged_footage_.isEmpty()) {
|
||||
if (parent()->HasGhosts()) {
|
||||
rational time_movement = event->GetFrame() - drag_start_.GetFrame();
|
||||
if (parent()->has_ghosts()) {
|
||||
Rational time_movement = event->get_frame() - drag_start_.get_frame();
|
||||
|
||||
// Keep ghost offset no lower than 0
|
||||
if (ghost_offset_ + time_movement < 0) {
|
||||
@@ -128,39 +128,39 @@ void ImportTool::DragMove(TimelineViewMouseEvent *event)
|
||||
}
|
||||
|
||||
int track_movement =
|
||||
event->GetTrack().index() - drag_start_.GetTrack().index();
|
||||
event->get_track().index() - drag_start_.get_track().index();
|
||||
|
||||
time_movement = ValidateTimeMovement(time_movement);
|
||||
track_movement = ValidateTrackMovement(track_movement,
|
||||
parent()->GetGhostItems());
|
||||
time_movement = validate_time_movement(time_movement);
|
||||
track_movement = validate_track_movement(track_movement,
|
||||
parent()->get_ghost_items());
|
||||
|
||||
// If snapping is enabled, check for snap points
|
||||
if (Core::instance()->snapping()) {
|
||||
parent()->SnapPoint(snap_points_, &time_movement);
|
||||
parent()->snap_point(snap_points_, &time_movement);
|
||||
|
||||
time_movement = ValidateTimeMovement(time_movement);
|
||||
track_movement = ValidateTrackMovement(
|
||||
track_movement, parent()->GetGhostItems());
|
||||
time_movement = validate_time_movement(time_movement);
|
||||
track_movement = validate_track_movement(
|
||||
track_movement, parent()->get_ghost_items());
|
||||
}
|
||||
|
||||
rational earliest_ghost = RATIONAL_MAX;
|
||||
Rational earliest_ghost = RATIONAL_MAX;
|
||||
|
||||
// Move ghosts to the mouse cursor
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->GetGhostItems()) {
|
||||
ghost->SetInAdjustment(time_movement);
|
||||
ghost->SetOutAdjustment(time_movement);
|
||||
ghost->SetTrackAdjustment(track_movement);
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->get_ghost_items()) {
|
||||
ghost->set_in_adjustment(time_movement);
|
||||
ghost->set_out_adjustment(time_movement);
|
||||
ghost->set_track_adjustment(track_movement);
|
||||
|
||||
earliest_ghost = qMin(earliest_ghost, ghost->GetAdjustedIn());
|
||||
earliest_ghost = qMin(earliest_ghost, ghost->get_adjusted_in());
|
||||
}
|
||||
|
||||
// Generate tooltip (showing earliest in point of imported clip)
|
||||
rational tooltip_timebase =
|
||||
parent()->GetTimebaseForTrackType(event->GetTrack().type());
|
||||
Rational tooltip_timebase =
|
||||
parent()->get_timebase_for_track_type(event->get_track().type());
|
||||
QString tooltip_text =
|
||||
QString::fromStdString(Timecode::time_to_timecode(
|
||||
earliest_ghost, tooltip_timebase,
|
||||
Core::instance()->GetTimecodeDisplay()));
|
||||
Core::instance()->get_timecode_display()));
|
||||
|
||||
// Force tooltip to update (otherwise the tooltip won't move as written in the documentation, and could get in the way
|
||||
// of the cursor)
|
||||
@@ -174,10 +174,10 @@ void ImportTool::DragMove(TimelineViewMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void ImportTool::DragLeave(QDragLeaveEvent *event)
|
||||
void ImportTool::drag_leave(QDragLeaveEvent *event)
|
||||
{
|
||||
if (!dragged_footage_.isEmpty()) {
|
||||
parent()->ClearGhosts();
|
||||
parent()->clear_ghosts();
|
||||
dragged_footage_.clear();
|
||||
|
||||
event->accept();
|
||||
@@ -186,11 +186,11 @@ void ImportTool::DragLeave(QDragLeaveEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void ImportTool::DragDrop(TimelineViewMouseEvent *event)
|
||||
void ImportTool::drag_drop(TimelineViewMouseEvent *event)
|
||||
{
|
||||
if (!dragged_footage_.isEmpty()) {
|
||||
auto command = new MultiUndoCommand();
|
||||
DropGhosts(event->GetModifiers() & Qt::ControlModifier, command);
|
||||
drop_ghosts(event->get_modifiers() & Qt::ControlModifier, command);
|
||||
Core::instance()->undo_stack()->push(
|
||||
command,
|
||||
qApp->translate("ImportTool", "Dropped Footage Into Sequence"));
|
||||
@@ -201,22 +201,22 @@ void ImportTool::DragDrop(TimelineViewMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void ImportTool::PlaceAt(const QVector<ViewerOutput *> &footage,
|
||||
const rational &start, bool insert,
|
||||
void ImportTool::place_at(const QVector<ViewerOutput *> &footage,
|
||||
const Rational &start, bool insert,
|
||||
MultiUndoCommand *command, int track_offset,
|
||||
bool jump_to_end)
|
||||
{
|
||||
DraggedFootageData refs;
|
||||
|
||||
foreach (ViewerOutput *f, footage) {
|
||||
refs.append({ f, f->GetEnabledStreamsAsReferences() });
|
||||
refs.append({ f, f->get_enabled_streams_as_references() });
|
||||
}
|
||||
|
||||
PlaceAt(refs, start, insert, command, track_offset, jump_to_end);
|
||||
place_at(refs, start, insert, command, track_offset, jump_to_end);
|
||||
}
|
||||
|
||||
void ImportTool::PlaceAt(const DraggedFootageData &footage,
|
||||
const rational &start, bool insert,
|
||||
void ImportTool::place_at(const DraggedFootageData &footage,
|
||||
const Rational &start, bool insert,
|
||||
MultiUndoCommand *command, int track_offset,
|
||||
bool jump_to_end)
|
||||
{
|
||||
@@ -226,60 +226,60 @@ void ImportTool::PlaceAt(const DraggedFootageData &footage,
|
||||
return;
|
||||
}
|
||||
|
||||
PrepGhosts(start, track_offset);
|
||||
prep_ghosts(start, track_offset);
|
||||
|
||||
rational max(0);
|
||||
Rational max(0);
|
||||
if (jump_to_end) {
|
||||
for (TimelineViewGhostItem *ghost : parent()->GetGhostItems()) {
|
||||
max = std::max(max, ghost->GetAdjustedOut());
|
||||
for (TimelineViewGhostItem *ghost : parent()->get_ghost_items()) {
|
||||
max = std::max(max, ghost->get_adjusted_out());
|
||||
}
|
||||
}
|
||||
|
||||
DropGhosts(insert, command);
|
||||
drop_ghosts(insert, command);
|
||||
|
||||
if (jump_to_end) {
|
||||
this->sequence()->SetPlayhead(max);
|
||||
this->sequence()->set_playhead(max);
|
||||
}
|
||||
}
|
||||
|
||||
void ImportTool::FootageToGhosts(rational ghost_start,
|
||||
void ImportTool::footage_to_ghosts(Rational ghost_start,
|
||||
const DraggedFootageData &sorted,
|
||||
const rational &dest_tb,
|
||||
const Rational &dest_tb,
|
||||
const int &track_start)
|
||||
{
|
||||
for (auto it = sorted.cbegin(); it != sorted.cend(); it++) {
|
||||
ViewerOutput *footage = it->first;
|
||||
|
||||
if (footage == sequence() ||
|
||||
(sequence() && footage->InputsFrom(sequence(), true))) {
|
||||
(sequence() && footage->inputs_from(sequence(), true))) {
|
||||
// Prevent cyclical dependency
|
||||
continue;
|
||||
}
|
||||
|
||||
// Each stream is offset by one track per track "type", we keep track of them in this vector
|
||||
QVector<int> track_offsets(Track::kCount);
|
||||
QVector<int> track_offsets(Track::k_count);
|
||||
track_offsets.fill(track_start);
|
||||
|
||||
rational footage_duration;
|
||||
rational ghost_in;
|
||||
Rational footage_duration;
|
||||
Rational ghost_in;
|
||||
|
||||
TimelineWorkArea *wk = footage->GetWorkArea();
|
||||
TimelineWorkArea *wk = footage->get_work_area();
|
||||
if (wk->enabled()) {
|
||||
footage_duration = wk->length();
|
||||
ghost_in = wk->in();
|
||||
} else {
|
||||
footage_duration = footage->GetLength();
|
||||
footage_duration = footage->get_length();
|
||||
|
||||
if (footage_duration.isNull()) {
|
||||
// Fallback to still length if legngth was 0
|
||||
footage_duration =
|
||||
OLIVE_CONFIG("DefaultStillLength").value<rational>();
|
||||
OAK_CONFIG("DefaultStillLength").value<Rational>();
|
||||
}
|
||||
}
|
||||
|
||||
// Snap footage duration to timebase
|
||||
rational snap_mvmt =
|
||||
SnapMovementToTimebase(footage_duration, 0, dest_tb);
|
||||
Rational snap_mvmt =
|
||||
snap_movement_to_timebase(footage_duration, 0, dest_tb);
|
||||
if (!snap_mvmt.isNull()) {
|
||||
footage_duration += snap_mvmt;
|
||||
}
|
||||
@@ -290,8 +290,8 @@ void ImportTool::FootageToGhosts(rational ghost_start,
|
||||
Track::Reference dest_track(track_type,
|
||||
track_offsets.at(track_type));
|
||||
|
||||
if (track_type == Track::kVideo || track_type == Track::kAudio) {
|
||||
auto ghost = CreateGhost(
|
||||
if (track_type == Track::k_video || track_type == Track::k_audio) {
|
||||
auto ghost = create_ghost(
|
||||
TimeRange(ghost_start, ghost_start + footage_duration),
|
||||
ghost_in, dest_track);
|
||||
|
||||
@@ -299,21 +299,21 @@ void ImportTool::FootageToGhosts(rational ghost_start,
|
||||
track_offsets[track_type]++;
|
||||
|
||||
TimelineViewGhostItem::AttachedFootage af = { it->first,
|
||||
ref.ToString() };
|
||||
ghost->SetData(TimelineViewGhostItem::kAttachedFootage,
|
||||
ref.to_string() };
|
||||
ghost->set_data(TimelineViewGhostItem::k_attached_footage,
|
||||
QVariant::fromValue(af));
|
||||
} else if (track_type == Track::kSubtitle) {
|
||||
SubtitleParams sp = footage->GetSubtitleParams(ref.index());
|
||||
} else if (track_type == Track::k_subtitle) {
|
||||
SubtitleParams sp = footage->get_subtitle_params(ref.index());
|
||||
|
||||
for (const Subtitle &sub : sp) {
|
||||
auto ghost =
|
||||
CreateGhost(sub.time() + ghost_start, 0, dest_track);
|
||||
create_ghost(sub.time() + ghost_start, 0, dest_track);
|
||||
|
||||
ghost->SetData(TimelineViewGhostItem::kAttachedFootage,
|
||||
ghost->set_data(TimelineViewGhostItem::k_attached_footage,
|
||||
QVariant::fromValue(sub));
|
||||
}
|
||||
|
||||
parent()->AddTentativeSubtitleTrack();
|
||||
parent()->add_tentative_subtitle_track();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,21 +322,21 @@ void ImportTool::FootageToGhosts(rational ghost_start,
|
||||
}
|
||||
}
|
||||
|
||||
void ImportTool::PrepGhosts(const rational &frame, const int &track_index)
|
||||
void ImportTool::prep_ghosts(const Rational &frame, const int &track_index)
|
||||
{
|
||||
if (parent()->GetConnectedNode()) {
|
||||
FootageToGhosts(
|
||||
if (parent()->get_connected_node()) {
|
||||
footage_to_ghosts(
|
||||
frame, dragged_footage_,
|
||||
parent()->GetConnectedNode()->GetVideoParams().time_base(),
|
||||
parent()->get_connected_node()->get_video_params().time_base(),
|
||||
track_index);
|
||||
}
|
||||
}
|
||||
|
||||
void ImportTool::DropGhosts(bool insert, MultiUndoCommand *parent_command)
|
||||
void ImportTool::drop_ghosts(bool insert, MultiUndoCommand *parent_command)
|
||||
{
|
||||
auto command = new MultiUndoCommand();
|
||||
|
||||
if (MultiUndoCommand *c = parent()->TakeSubtitleSectionCommand()) {
|
||||
if (MultiUndoCommand *c = parent()->take_subtitle_section_command()) {
|
||||
command->add_child(c);
|
||||
}
|
||||
|
||||
@@ -351,9 +351,9 @@ void ImportTool::DropGhosts(bool insert, MultiUndoCommand *parent_command)
|
||||
|
||||
DropWithoutSequenceBehavior behavior =
|
||||
static_cast<DropWithoutSequenceBehavior>(
|
||||
OLIVE_CONFIG("DropWithoutSequenceBehavior").toInt());
|
||||
OAK_CONFIG("DropWithoutSequenceBehavior").toInt());
|
||||
|
||||
if (behavior == kDWSAsk) {
|
||||
if (behavior == k_dws_ask) {
|
||||
QCheckBox *dont_ask_again_box = new QCheckBox(
|
||||
QCoreApplication::translate("ImportTool",
|
||||
"Don't ask me again"));
|
||||
@@ -382,24 +382,24 @@ void ImportTool::DropGhosts(bool insert, MultiUndoCommand *parent_command)
|
||||
mbox.exec();
|
||||
|
||||
if (mbox.clickedButton() == auto_params_btn) {
|
||||
behavior = kDWSAuto;
|
||||
behavior = k_dws_auto;
|
||||
} else if (mbox.clickedButton() == manual_params_btn) {
|
||||
behavior = kDWSManual;
|
||||
behavior = k_dws_manual;
|
||||
} else {
|
||||
behavior = kDWSDisable;
|
||||
behavior = k_dws_disable;
|
||||
}
|
||||
|
||||
if (behavior != kDWSDisable && dont_ask_again_box->isChecked()) {
|
||||
OLIVE_CONFIG("DropWithoutSequenceBehavior") = behavior;
|
||||
if (behavior != k_dws_disable && dont_ask_again_box->isChecked()) {
|
||||
OAK_CONFIG("DropWithoutSequenceBehavior") = behavior;
|
||||
}
|
||||
}
|
||||
|
||||
if (behavior != kDWSDisable) {
|
||||
Project *active_project = Core::instance()->GetActiveProject();
|
||||
if (behavior != k_dws_disable) {
|
||||
Project *active_project = Core::instance()->get_active_project();
|
||||
|
||||
if (active_project) {
|
||||
Sequence *new_sequence =
|
||||
Core::instance()->CreateNewSequenceForProject(
|
||||
Core::instance()->create_new_sequence_for_project(
|
||||
active_project);
|
||||
|
||||
new_sequence->set_default_parameters();
|
||||
@@ -420,10 +420,10 @@ void ImportTool::DropGhosts(bool insert, MultiUndoCommand *parent_command)
|
||||
new_sequence->set_parameters_from_footage(footage_only);
|
||||
|
||||
// If the user selected manual, show them a dialog with parameters
|
||||
if (behavior == kDWSManual) {
|
||||
SequenceDialog sd(new_sequence, SequenceDialog::kNew,
|
||||
if (behavior == k_dws_manual) {
|
||||
SequenceDialog sd(new_sequence, SequenceDialog::k_new,
|
||||
parent());
|
||||
sd.SetUndoable(false);
|
||||
sd.set_undoable(false);
|
||||
|
||||
if (sd.exec() != QDialog::Accepted) {
|
||||
sequence_is_valid = false;
|
||||
@@ -431,23 +431,23 @@ void ImportTool::DropGhosts(bool insert, MultiUndoCommand *parent_command)
|
||||
}
|
||||
|
||||
if (sequence_is_valid) {
|
||||
dst_graph = Core::instance()->GetActiveProject();
|
||||
dst_graph = Core::instance()->get_active_project();
|
||||
|
||||
command->add_child(
|
||||
new NodeAddCommand(dst_graph, new_sequence));
|
||||
command->add_child(new FolderAddChild(
|
||||
Core::instance()->GetSelectedFolderInActiveProject(),
|
||||
Core::instance()->get_selected_folder_in_active_project(),
|
||||
new_sequence));
|
||||
command->add_child(new NodeSetPositionCommand(
|
||||
new_sequence, new_sequence, QPointF(0, 0)));
|
||||
new_sequence->add_default_nodes(command);
|
||||
|
||||
FootageToGhosts(0, dragged_footage_,
|
||||
new_sequence->GetVideoParams().time_base(),
|
||||
footage_to_ghosts(0, dragged_footage_,
|
||||
new_sequence->get_video_params().time_base(),
|
||||
0);
|
||||
|
||||
if (MultiUndoCommand *c =
|
||||
parent()->TakeSubtitleSectionCommand()) {
|
||||
parent()->take_subtitle_section_command()) {
|
||||
command->add_child(c);
|
||||
}
|
||||
|
||||
@@ -467,33 +467,33 @@ void ImportTool::DropGhosts(bool insert, MultiUndoCommand *parent_command)
|
||||
std::list<ClipBlock *> imported_clips;
|
||||
|
||||
if (dst_graph) {
|
||||
QVector<Block *> block_items(parent()->GetGhostItems().size());
|
||||
QVector<Block *> block_items(parent()->get_ghost_items().size());
|
||||
|
||||
// Check if we're inserting (only valid if we're not creating this sequence ourselves)
|
||||
if (insert && !open_sequence) {
|
||||
InsertGapsAtGhostDestination(command);
|
||||
insert_gaps_at_ghost_destination(command);
|
||||
}
|
||||
|
||||
for (int i = 0; i < parent()->GetGhostItems().size(); i++) {
|
||||
TimelineViewGhostItem *ghost = parent()->GetGhostItems().at(i);
|
||||
for (int i = 0; i < parent()->get_ghost_items().size(); i++) {
|
||||
TimelineViewGhostItem *ghost = parent()->get_ghost_items().at(i);
|
||||
Block *block = nullptr;
|
||||
|
||||
Track::Type track_type = ghost->GetAdjustedTrack().type();
|
||||
if (track_type == Track::kVideo || track_type == Track::kAudio) {
|
||||
Track::Type track_type = ghost->get_adjusted_track().type();
|
||||
if (track_type == Track::k_video || track_type == Track::k_audio) {
|
||||
TimelineViewGhostItem::AttachedFootage footage_stream =
|
||||
ghost->GetData(TimelineViewGhostItem::kAttachedFootage)
|
||||
ghost->get_data(TimelineViewGhostItem::k_attached_footage)
|
||||
.value<TimelineViewGhostItem::AttachedFootage>();
|
||||
|
||||
ClipBlock *clip = new ClipBlock();
|
||||
block = clip;
|
||||
clip->set_media_in(ghost->GetMediaIn());
|
||||
clip->set_media_in(ghost->get_media_in());
|
||||
command->add_child(new NodeAddCommand(dst_graph, clip));
|
||||
|
||||
// Position clip in its own context
|
||||
command->add_child(
|
||||
new NodeSetPositionCommand(clip, clip, QPointF(0, 0)));
|
||||
|
||||
int dep_pos = kDefaultDistanceFromOutput;
|
||||
int dep_pos = k_default_distance_from_output;
|
||||
|
||||
// Position footage in its context
|
||||
command->add_child(new NodeSetPositionCommand(
|
||||
@@ -502,43 +502,43 @@ void ImportTool::DropGhosts(bool insert, MultiUndoCommand *parent_command)
|
||||
dep_pos++;
|
||||
|
||||
switch (
|
||||
Track::Reference::TypeFromString(footage_stream.output)) {
|
||||
case Track::kVideo: {
|
||||
Track::Reference::type_from_string(footage_stream.output)) {
|
||||
case Track::k_video: {
|
||||
TransformDistortNode *transform =
|
||||
new TransformDistortNode();
|
||||
command->add_child(
|
||||
new NodeAddCommand(dst_graph, transform));
|
||||
|
||||
command->add_child(new NodeSetValueHintCommand(
|
||||
transform, TransformDistortNode::kTextureInput, -1,
|
||||
Node::ValueHint({ NodeValue::kTexture },
|
||||
transform, TransformDistortNode::k_texture_input, -1,
|
||||
Node::ValueHint({ NodeValue::k_texture },
|
||||
footage_stream.output)));
|
||||
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
footage_stream.footage,
|
||||
NodeInput(transform,
|
||||
TransformDistortNode::kTextureInput)));
|
||||
TransformDistortNode::k_texture_input)));
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
transform, NodeInput(clip, ClipBlock::kBufferIn)));
|
||||
transform, NodeInput(clip, ClipBlock::k_buffer_in)));
|
||||
command->add_child(new NodeSetPositionCommand(
|
||||
transform, clip, QPointF(dep_pos, 0)));
|
||||
break;
|
||||
}
|
||||
case Track::kAudio: {
|
||||
case Track::k_audio: {
|
||||
VolumeNode *volume_node = new VolumeNode();
|
||||
command->add_child(
|
||||
new NodeAddCommand(dst_graph, volume_node));
|
||||
|
||||
command->add_child(new NodeSetValueHintCommand(
|
||||
volume_node, VolumeNode::kSamplesInput, -1,
|
||||
Node::ValueHint({ NodeValue::kSamples },
|
||||
volume_node, VolumeNode::k_samples_input, -1,
|
||||
Node::ValueHint({ NodeValue::k_samples },
|
||||
footage_stream.output)));
|
||||
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
footage_stream.footage,
|
||||
NodeInput(volume_node, VolumeNode::kSamplesInput)));
|
||||
NodeInput(volume_node, VolumeNode::k_samples_input)));
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
volume_node, NodeInput(clip, ClipBlock::kBufferIn)));
|
||||
volume_node, NodeInput(clip, ClipBlock::k_buffer_in)));
|
||||
command->add_child(new NodeSetPositionCommand(
|
||||
volume_node, clip, QPointF(dep_pos, 0)));
|
||||
break;
|
||||
@@ -551,23 +551,23 @@ void ImportTool::DropGhosts(bool insert, MultiUndoCommand *parent_command)
|
||||
for (int j = 0; j < i; j++) {
|
||||
TimelineViewGhostItem::AttachedFootage footage_compare =
|
||||
parent()
|
||||
->GetGhostItems()
|
||||
->get_ghost_items()
|
||||
.at(j)
|
||||
->GetData(TimelineViewGhostItem::kAttachedFootage)
|
||||
->get_data(TimelineViewGhostItem::k_attached_footage)
|
||||
.value<TimelineViewGhostItem::AttachedFootage>();
|
||||
|
||||
if (footage_compare.footage == footage_stream.footage) {
|
||||
Block::Link(block_items.at(j), clip);
|
||||
Block::link(block_items.at(j), clip);
|
||||
}
|
||||
}
|
||||
|
||||
imported_clips.push_back(clip);
|
||||
} else if (track_type == Track::kSubtitle) {
|
||||
} else if (track_type == Track::k_subtitle) {
|
||||
Subtitle src =
|
||||
ghost->GetData(TimelineViewGhostItem::kAttachedFootage)
|
||||
ghost->get_data(TimelineViewGhostItem::k_attached_footage)
|
||||
.value<Subtitle>();
|
||||
SubtitleBlock *sub = new SubtitleBlock();
|
||||
sub->SetText(src.text());
|
||||
sub->set_text(src.text());
|
||||
block = sub;
|
||||
|
||||
command->add_child(new NodeAddCommand(dst_graph, sub));
|
||||
@@ -575,12 +575,12 @@ void ImportTool::DropGhosts(bool insert, MultiUndoCommand *parent_command)
|
||||
new NodeSetPositionCommand(sub, sub, QPointF(0, 0)));
|
||||
}
|
||||
|
||||
block->set_length_and_media_out(ghost->GetLength());
|
||||
block->set_length_and_media_out(ghost->get_length());
|
||||
|
||||
command->add_child(new TrackPlaceBlockCommand(
|
||||
sequence->track_list(ghost->GetAdjustedTrack().type()),
|
||||
ghost->GetAdjustedTrack().index(), block,
|
||||
ghost->GetAdjustedIn()));
|
||||
sequence->track_list(ghost->get_adjusted_track().type()),
|
||||
ghost->get_adjusted_track().index(), block,
|
||||
ghost->get_adjusted_in()));
|
||||
|
||||
block_items.replace(i, block);
|
||||
}
|
||||
@@ -596,31 +596,31 @@ void ImportTool::DropGhosts(bool insert, MultiUndoCommand *parent_command)
|
||||
parent_command->add_child(command);
|
||||
|
||||
while (!imported_clips.empty()) {
|
||||
imported_clips.front()->RequestInvalidatedFromConnected();
|
||||
imported_clips.front()->request_invalidated_from_connected();
|
||||
imported_clips.pop_front();
|
||||
}
|
||||
|
||||
parent()->ClearGhosts();
|
||||
parent()->clear_ghosts();
|
||||
dragged_footage_.clear();
|
||||
}
|
||||
|
||||
TimelineViewGhostItem *ImportTool::CreateGhost(const TimeRange &range,
|
||||
const rational &media_in,
|
||||
TimelineViewGhostItem *ImportTool::create_ghost(const TimeRange &range,
|
||||
const Rational &media_in,
|
||||
const Track::Reference &track)
|
||||
{
|
||||
TimelineViewGhostItem *ghost = new TimelineViewGhostItem();
|
||||
|
||||
ghost->SetIn(range.in());
|
||||
ghost->SetOut(range.out());
|
||||
ghost->SetMediaIn(media_in);
|
||||
ghost->SetTrack(track);
|
||||
ghost->set_in(range.in());
|
||||
ghost->set_out(range.out());
|
||||
ghost->set_media_in(media_in);
|
||||
ghost->set_track(track);
|
||||
|
||||
snap_points_.push_back(ghost->GetIn());
|
||||
snap_points_.push_back(ghost->GetOut());
|
||||
snap_points_.push_back(ghost->get_in());
|
||||
snap_points_.push_back(ghost->get_out());
|
||||
|
||||
ghost->SetMode(Timeline::kMove);
|
||||
ghost->set_mode(Timeline::k_move);
|
||||
|
||||
parent()->AddGhost(ghost);
|
||||
parent()->add_ghost(ghost);
|
||||
|
||||
return ghost;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef IMPORTTIMELINETOOL_H
|
||||
#define IMPORTTIMELINETOOL_H
|
||||
#ifndef OAK_IMPORTTIMELINETOOL_H
|
||||
#define OAK_IMPORTTIMELINETOOL_H
|
||||
|
||||
#include "tool.h"
|
||||
|
||||
@@ -31,48 +31,48 @@ class ImportTool : public TimelineTool {
|
||||
public:
|
||||
ImportTool(TimelineWidget *parent);
|
||||
|
||||
virtual void DragEnter(TimelineViewMouseEvent *event) override;
|
||||
virtual void DragMove(TimelineViewMouseEvent *event) override;
|
||||
virtual void DragLeave(QDragLeaveEvent *event) override;
|
||||
virtual void DragDrop(TimelineViewMouseEvent *event) override;
|
||||
virtual void drag_enter(TimelineViewMouseEvent *event) override;
|
||||
virtual void drag_move(TimelineViewMouseEvent *event) override;
|
||||
virtual void drag_leave(QDragLeaveEvent *event) override;
|
||||
virtual void drag_drop(TimelineViewMouseEvent *event) override;
|
||||
|
||||
using DraggedFootageData =
|
||||
QVector<QPair<ViewerOutput *, QVector<Track::Reference>>>;
|
||||
|
||||
void PlaceAt(const QVector<ViewerOutput *> &footage, const rational &start,
|
||||
void place_at(const QVector<ViewerOutput *> &footage, const Rational &start,
|
||||
bool insert, MultiUndoCommand *command, int track_offset = 0,
|
||||
bool jump_to_end = false);
|
||||
void PlaceAt(const DraggedFootageData &footage, const rational &start,
|
||||
void place_at(const DraggedFootageData &footage, const Rational &start,
|
||||
bool insert, MultiUndoCommand *command, int track_offset = 0,
|
||||
bool jump_to_end = false);
|
||||
|
||||
enum DropWithoutSequenceBehavior {
|
||||
kDWSAsk,
|
||||
kDWSAuto,
|
||||
kDWSManual,
|
||||
kDWSDisable
|
||||
k_dws_ask,
|
||||
k_dws_auto,
|
||||
k_dws_manual,
|
||||
k_dws_disable
|
||||
};
|
||||
|
||||
private:
|
||||
void FootageToGhosts(rational ghost_start,
|
||||
void footage_to_ghosts(Rational ghost_start,
|
||||
const DraggedFootageData &footage,
|
||||
const rational &dest_tb, const int &track_start);
|
||||
const Rational &dest_tb, const int &track_start);
|
||||
|
||||
void PrepGhosts(const rational &frame, const int &track_index);
|
||||
void prep_ghosts(const Rational &frame, const int &track_index);
|
||||
|
||||
void DropGhosts(bool insert, MultiUndoCommand *parent_command);
|
||||
void drop_ghosts(bool insert, MultiUndoCommand *parent_command);
|
||||
|
||||
TimelineViewGhostItem *CreateGhost(const TimeRange &range,
|
||||
const rational &media_in,
|
||||
TimelineViewGhostItem *create_ghost(const TimeRange &range,
|
||||
const Rational &media_in,
|
||||
const Track::Reference &track);
|
||||
|
||||
DraggedFootageData dragged_footage_;
|
||||
|
||||
int import_pre_buffer_;
|
||||
|
||||
rational ghost_offset_;
|
||||
Rational ghost_offset_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // IMPORTTIMELINETOOL_H
|
||||
#endif // OAK_IMPORTTIMELINETOOL_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef POINTERTIMELINETOOL_H
|
||||
#define POINTERTIMELINETOOL_H
|
||||
#ifndef OAK_POINTERTIMELINETOOL_H
|
||||
#define OAK_POINTERTIMELINETOOL_H
|
||||
|
||||
#include "tool.h"
|
||||
|
||||
@@ -31,27 +31,27 @@ class PointerTool : public TimelineTool {
|
||||
public:
|
||||
PointerTool(TimelineWidget *parent);
|
||||
|
||||
virtual void MousePress(TimelineViewMouseEvent *event) override;
|
||||
virtual void MouseMove(TimelineViewMouseEvent *event) override;
|
||||
virtual void MouseRelease(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_press(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_move(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_release(TimelineViewMouseEvent *event) override;
|
||||
|
||||
virtual void HoverMove(TimelineViewMouseEvent *event) override;
|
||||
virtual void hover_move(TimelineViewMouseEvent *event) override;
|
||||
|
||||
protected:
|
||||
virtual void FinishDrag(TimelineViewMouseEvent *event);
|
||||
virtual void finish_drag(TimelineViewMouseEvent *event);
|
||||
|
||||
virtual void InitiateDrag(Block *clicked_item,
|
||||
virtual void initiate_drag(Block *clicked_item,
|
||||
Timeline::MovementMode trim_mode,
|
||||
Qt::KeyboardModifiers modifiers);
|
||||
|
||||
TimelineViewGhostItem *GetExistingGhostFromBlock(Block *block);
|
||||
TimelineViewGhostItem *get_existing_ghost_from_block(Block *block);
|
||||
|
||||
TimelineViewGhostItem *AddGhostFromBlock(Block *block,
|
||||
TimelineViewGhostItem *add_ghost_from_block(Block *block,
|
||||
Timeline::MovementMode mode,
|
||||
bool check_if_exists = false);
|
||||
|
||||
TimelineViewGhostItem *AddGhostFromNull(const rational &in,
|
||||
const rational &out,
|
||||
TimelineViewGhostItem *add_ghost_from_null(const Rational &in,
|
||||
const Rational &out,
|
||||
const Track::Reference &track,
|
||||
Timeline::MovementMode mode);
|
||||
|
||||
@@ -61,7 +61,7 @@ protected:
|
||||
* Assumes ghost->data() is a Block. Ensures no Ghost's in point becomes a negative timecode. Also ensures no
|
||||
* Ghost's length becomes 0 or negative.
|
||||
*/
|
||||
rational ValidateInTrimming(rational movement);
|
||||
Rational validate_in_trimming(Rational movement);
|
||||
|
||||
/**
|
||||
* @brief Validates Ghosts that are getting their out points trimmed
|
||||
@@ -69,11 +69,11 @@ protected:
|
||||
* Assumes ghost->data() is a Block. Ensures no Ghost's in point becomes a negative timecode. Also ensures no
|
||||
* Ghost's length becomes 0 or negative.
|
||||
*/
|
||||
rational ValidateOutTrimming(rational movement);
|
||||
Rational validate_out_trimming(Rational movement);
|
||||
|
||||
virtual void ProcessDrag(const TimelineCoordinate &mouse_pos);
|
||||
virtual void process_drag(const TimelineCoordinate &mouse_pos);
|
||||
|
||||
void InitiateDragInternal(Block *clicked_item,
|
||||
void initiate_drag_internal(Block *clicked_item,
|
||||
Timeline::MovementMode trim_mode,
|
||||
Qt::KeyboardModifiers modifiers,
|
||||
bool dont_roll_trims, bool allow_nongap_rolling,
|
||||
@@ -88,46 +88,46 @@ protected:
|
||||
drag_movement_mode_ = d;
|
||||
}
|
||||
|
||||
static bool CanTransitionMove(TransitionBlock *transit,
|
||||
static bool can_transition_move(TransitionBlock *transit,
|
||||
const QVector<Block *> &clips);
|
||||
|
||||
void SetMovementAllowed(bool e)
|
||||
void set_movement_allowed(bool e)
|
||||
{
|
||||
movement_allowed_ = e;
|
||||
}
|
||||
|
||||
void SetTrimmingAllowed(bool e)
|
||||
void set_trimming_allowed(bool e)
|
||||
{
|
||||
trimming_allowed_ = e;
|
||||
}
|
||||
|
||||
void SetTrackMovementAllowed(bool e)
|
||||
void set_track_movement_allowed(bool e)
|
||||
{
|
||||
track_movement_allowed_ = e;
|
||||
}
|
||||
|
||||
void SetGapTrimmingAllowed(bool e)
|
||||
void set_gap_trimming_allowed(bool e)
|
||||
{
|
||||
gap_trimming_allowed_ = e;
|
||||
}
|
||||
|
||||
void SetClickedItem(Block *b)
|
||||
void set_clicked_item(Block *b)
|
||||
{
|
||||
clicked_item_ = b;
|
||||
}
|
||||
|
||||
private:
|
||||
Timeline::MovementMode IsCursorInTrimHandle(Block *block, qreal cursor_x);
|
||||
Timeline::MovementMode is_cursor_in_trim_handle(Block *block, qreal cursor_x);
|
||||
|
||||
void AddGhostInternal(TimelineViewGhostItem *ghost,
|
||||
void add_ghost_internal(TimelineViewGhostItem *ghost,
|
||||
Timeline::MovementMode mode);
|
||||
|
||||
bool IsClipTrimmable(Block *clip, const QVector<Block *> &items,
|
||||
bool is_clip_trimmable(Block *clip, const QVector<Block *> &items,
|
||||
const Timeline::MovementMode &mode);
|
||||
|
||||
void ProcessGhostsForSliding();
|
||||
void process_ghosts_for_sliding();
|
||||
|
||||
void ProcessGhostsForRolling();
|
||||
void process_ghosts_for_rolling();
|
||||
|
||||
bool movement_allowed_;
|
||||
bool trimming_allowed_;
|
||||
@@ -146,4 +146,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // POINTERTIMELINETOOL_H
|
||||
#endif // OAK_POINTERTIMELINETOOL_H
|
||||
|
||||
@@ -33,45 +33,45 @@ RazorTool::RazorTool(TimelineWidget *parent)
|
||||
{
|
||||
}
|
||||
|
||||
void RazorTool::MousePress(TimelineViewMouseEvent *event)
|
||||
void RazorTool::mouse_press(TimelineViewMouseEvent *event)
|
||||
{
|
||||
split_tracks_.clear();
|
||||
|
||||
MouseMove(event);
|
||||
mouse_move(event);
|
||||
}
|
||||
|
||||
void RazorTool::MouseMove(TimelineViewMouseEvent *event)
|
||||
void RazorTool::mouse_move(TimelineViewMouseEvent *event)
|
||||
{
|
||||
if (!dragging_) {
|
||||
drag_start_ = ValidatedCoordinate(event->GetCoordinates(true));
|
||||
drag_start_ = validated_coordinate(event->get_coordinates(true));
|
||||
dragging_ = true;
|
||||
}
|
||||
|
||||
// Split at the current cursor track
|
||||
Track::Reference split_track = event->GetTrack();
|
||||
Track::Reference split_track = event->get_track();
|
||||
|
||||
if (!split_tracks_.contains(split_track)) {
|
||||
split_tracks_.append(split_track);
|
||||
}
|
||||
}
|
||||
|
||||
void RazorTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
void RazorTool::mouse_release(TimelineViewMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
||||
// Always split at the same time
|
||||
rational split_time = drag_start_.GetFrame();
|
||||
Rational split_time = drag_start_.get_frame();
|
||||
|
||||
QVector<Block *> blocks_to_split;
|
||||
|
||||
foreach (const Track::Reference &track_ref, split_tracks_) {
|
||||
Track *track = parent()->GetTrackFromReference(track_ref);
|
||||
Track *track = parent()->get_track_from_reference(track_ref);
|
||||
|
||||
if (track == nullptr || track->IsLocked()) {
|
||||
if (track == nullptr || track->is_locked()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Block *block_at_time = track->NearestBlockBefore(split_time);
|
||||
Block *block_at_time = track->nearest_block_before(split_time);
|
||||
|
||||
// Ensure there's a valid block here
|
||||
ClipBlock *clip_at_time;
|
||||
@@ -81,7 +81,7 @@ void RazorTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
blocks_to_split.append(block_at_time);
|
||||
|
||||
// Add links if no alt is held
|
||||
if (!(event->GetModifiers() & Qt::AltModifier)) {
|
||||
if (!(event->get_modifiers() & Qt::AltModifier)) {
|
||||
foreach (Block *link, clip_at_time->block_links()) {
|
||||
if (!blocks_to_split.contains(link)) {
|
||||
blocks_to_split.append(link);
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef RAZORTIMELINETOOL_H
|
||||
#define RAZORTIMELINETOOL_H
|
||||
#ifndef OAK_RAZORTIMELINETOOL_H
|
||||
#define OAK_RAZORTIMELINETOOL_H
|
||||
|
||||
#include "beam.h"
|
||||
|
||||
@@ -31,9 +31,9 @@ class RazorTool : public BeamTool {
|
||||
public:
|
||||
RazorTool(TimelineWidget *parent);
|
||||
|
||||
virtual void MousePress(TimelineViewMouseEvent *event) override;
|
||||
virtual void MouseMove(TimelineViewMouseEvent *event) override;
|
||||
virtual void MouseRelease(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_press(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_move(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_release(TimelineViewMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
QVector<Track::Reference> split_tracks_;
|
||||
@@ -41,4 +41,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // RAZORTIMELINETOOL_H
|
||||
#endif // OAK_RAZORTIMELINETOOL_H
|
||||
|
||||
@@ -29,78 +29,78 @@ RecordTool::RecordTool(TimelineWidget *parent)
|
||||
{
|
||||
}
|
||||
|
||||
void RecordTool::MousePress(TimelineViewMouseEvent *event)
|
||||
void RecordTool::mouse_press(TimelineViewMouseEvent *event)
|
||||
{
|
||||
const Track::Reference &track = event->GetTrack();
|
||||
const Track::Reference &track = event->get_track();
|
||||
|
||||
// Check if track is locked
|
||||
Track *t = parent()->GetTrackFromReference(track);
|
||||
if (t && t->IsLocked()) {
|
||||
Track *t = parent()->get_track_from_reference(track);
|
||||
if (t && t->is_locked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (t && t->type() != Track::kAudio) {
|
||||
if (t && t->type() != Track::k_audio) {
|
||||
// We only support audio tracks here
|
||||
return;
|
||||
}
|
||||
|
||||
drag_start_point_ =
|
||||
ValidatedCoordinate(event->GetCoordinates(true)).GetFrame();
|
||||
validated_coordinate(event->get_coordinates(true)).get_frame();
|
||||
|
||||
ghost_ = new TimelineViewGhostItem();
|
||||
ghost_->SetIn(drag_start_point_);
|
||||
ghost_->SetOut(drag_start_point_);
|
||||
ghost_->SetTrack(track);
|
||||
parent()->AddGhost(ghost_);
|
||||
ghost_->set_in(drag_start_point_);
|
||||
ghost_->set_out(drag_start_point_);
|
||||
ghost_->set_track(track);
|
||||
parent()->add_ghost(ghost_);
|
||||
|
||||
snap_points_.push_back(drag_start_point_);
|
||||
}
|
||||
|
||||
void RecordTool::MouseMove(TimelineViewMouseEvent *event)
|
||||
void RecordTool::mouse_move(TimelineViewMouseEvent *event)
|
||||
{
|
||||
if (!ghost_) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate movement
|
||||
rational movement = event->GetFrame() - drag_start_point_;
|
||||
Rational movement = event->get_frame() - drag_start_point_;
|
||||
|
||||
// Validation: Ensure in point never goes below 0
|
||||
if (movement < -ghost_->GetIn()) {
|
||||
movement = -ghost_->GetIn();
|
||||
if (movement < -ghost_->get_in()) {
|
||||
movement = -ghost_->get_in();
|
||||
}
|
||||
|
||||
// Snap movement
|
||||
bool snapped;
|
||||
|
||||
if (Core::instance()->snapping()) {
|
||||
snapped = parent()->SnapPoint(snap_points_, &movement);
|
||||
snapped = parent()->snap_point(snap_points_, &movement);
|
||||
} else {
|
||||
snapped = false;
|
||||
}
|
||||
|
||||
// Make adjustment
|
||||
if (!movement) {
|
||||
ghost_->SetInAdjustment(0);
|
||||
ghost_->SetOutAdjustment(0);
|
||||
ghost_->set_in_adjustment(0);
|
||||
ghost_->set_out_adjustment(0);
|
||||
} else if (movement > 0) {
|
||||
ghost_->SetInAdjustment(0);
|
||||
ghost_->SetOutAdjustment(movement);
|
||||
ghost_->set_in_adjustment(0);
|
||||
ghost_->set_out_adjustment(movement);
|
||||
} else if (movement < 0) {
|
||||
ghost_->SetInAdjustment(movement);
|
||||
ghost_->SetOutAdjustment(0);
|
||||
ghost_->set_in_adjustment(movement);
|
||||
ghost_->set_out_adjustment(0);
|
||||
}
|
||||
|
||||
Q_UNUSED(snapped)
|
||||
}
|
||||
|
||||
void RecordTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
void RecordTool::mouse_release(TimelineViewMouseEvent *event)
|
||||
{
|
||||
if (ghost_) {
|
||||
emit parent() -> RequestCaptureStart(
|
||||
TimeRange(ghost_->GetAdjustedIn(), ghost_->GetAdjustedOut()),
|
||||
ghost_->GetTrack());
|
||||
parent()->ClearGhosts();
|
||||
emit parent() -> request_capture_start(
|
||||
TimeRange(ghost_->get_adjusted_in(), ghost_->get_adjusted_out()),
|
||||
ghost_->get_track());
|
||||
parent()->clear_ghosts();
|
||||
snap_points_.clear();
|
||||
ghost_ = nullptr;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef RECORDTIMELINETOOL_H
|
||||
#define RECORDTIMELINETOOL_H
|
||||
#ifndef OAK_RECORDTIMELINETOOL_H
|
||||
#define OAK_RECORDTIMELINETOOL_H
|
||||
|
||||
#include "beam.h"
|
||||
|
||||
@@ -31,16 +31,16 @@ class RecordTool : public BeamTool {
|
||||
public:
|
||||
RecordTool(TimelineWidget *parent);
|
||||
|
||||
virtual void MousePress(TimelineViewMouseEvent *event) override;
|
||||
virtual void MouseMove(TimelineViewMouseEvent *event) override;
|
||||
virtual void MouseRelease(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_press(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_move(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_release(TimelineViewMouseEvent *event) override;
|
||||
|
||||
protected:
|
||||
void MouseMoveInternal(const rational &cursor_frame, bool outwards);
|
||||
void mouse_move_internal(const Rational &cursor_frame, bool outwards);
|
||||
|
||||
TimelineViewGhostItem *ghost_;
|
||||
|
||||
rational drag_start_point_;
|
||||
Rational drag_start_point_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -31,46 +31,46 @@ namespace olive
|
||||
RippleTool::RippleTool(TimelineWidget *parent)
|
||||
: PointerTool(parent)
|
||||
{
|
||||
SetMovementAllowed(false);
|
||||
SetGapTrimmingAllowed(true);
|
||||
set_movement_allowed(false);
|
||||
set_gap_trimming_allowed(true);
|
||||
}
|
||||
|
||||
void RippleTool::InitiateDrag(Block *clicked_item,
|
||||
void RippleTool::initiate_drag(Block *clicked_item,
|
||||
Timeline::MovementMode trim_mode,
|
||||
Qt::KeyboardModifiers modifiers)
|
||||
{
|
||||
InitiateDragInternal(clicked_item, trim_mode, modifiers, true, true, false);
|
||||
initiate_drag_internal(clicked_item, trim_mode, modifiers, true, true, false);
|
||||
|
||||
if (!parent()->HasGhosts()) {
|
||||
if (!parent()->has_ghosts()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Find the earliest ripple
|
||||
rational earliest_ripple = RATIONAL_MAX;
|
||||
Rational earliest_ripple = RATIONAL_MAX;
|
||||
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->GetGhostItems()) {
|
||||
rational ghost_ripple_point;
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->get_ghost_items()) {
|
||||
Rational ghost_ripple_point;
|
||||
|
||||
if (trim_mode == Timeline::kTrimIn) {
|
||||
ghost_ripple_point = ghost->GetIn();
|
||||
if (trim_mode == Timeline::k_trim_in) {
|
||||
ghost_ripple_point = ghost->get_in();
|
||||
} else {
|
||||
ghost_ripple_point = ghost->GetOut();
|
||||
ghost_ripple_point = ghost->get_out();
|
||||
}
|
||||
|
||||
earliest_ripple = qMin(earliest_ripple, ghost_ripple_point);
|
||||
}
|
||||
|
||||
// For each track that does NOT have a ghost, we need to make one for Gaps
|
||||
foreach (Track *track, sequence()->GetTracks()) {
|
||||
if (track->IsLocked()) {
|
||||
foreach (Track *track, sequence()->get_tracks()) {
|
||||
if (track->is_locked()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Determine if we've already created a ghost on this track
|
||||
bool ghost_on_this_track_exists = false;
|
||||
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->GetGhostItems()) {
|
||||
if (parent()->GetTrackFromReference(ghost->GetTrack()) == track) {
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->get_ghost_items()) {
|
||||
if (parent()->get_track_from_reference(ghost->get_track()) == track) {
|
||||
ghost_on_this_track_exists = true;
|
||||
break;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ void RippleTool::InitiateDrag(Block *clicked_item,
|
||||
if (!ghost_on_this_track_exists) {
|
||||
// Find the block that starts just after or at the ripple point
|
||||
Block *block_after_ripple =
|
||||
track->NearestBlockAfterOrAt(earliest_ripple);
|
||||
track->nearest_block_after_or_at(earliest_ripple);
|
||||
|
||||
// Exception for out-transitions, do not create a gap between them
|
||||
if (block_after_ripple) {
|
||||
@@ -98,7 +98,7 @@ void RippleTool::InitiateDrag(Block *clicked_item,
|
||||
|
||||
if (dynamic_cast<GapBlock *>(block_after_ripple)) {
|
||||
// If this Block is already a Gap, ghost it now
|
||||
ghost = AddGhostFromBlock(block_after_ripple, trim_mode);
|
||||
ghost = add_ghost_from_block(block_after_ripple, trim_mode);
|
||||
} else {
|
||||
// Well we need to ripple SOMETHING, it'll either be the previous block if it's a gap
|
||||
// or we'll have to create a new gap ourselves
|
||||
@@ -106,15 +106,15 @@ void RippleTool::InitiateDrag(Block *clicked_item,
|
||||
|
||||
if (dynamic_cast<GapBlock *>(previous)) {
|
||||
// Previous is a gap, that'll make a fine substitute
|
||||
ghost = AddGhostFromBlock(previous, trim_mode);
|
||||
ghost = add_ghost_from_block(previous, trim_mode);
|
||||
} else {
|
||||
// Previous is not a gap, we'll have to insert one there ourselves
|
||||
ghost = AddGhostFromNull(block_after_ripple->in(),
|
||||
ghost = add_ghost_from_null(block_after_ripple->in(),
|
||||
block_after_ripple->in(),
|
||||
track->ToReference(),
|
||||
track->to_reference(),
|
||||
trim_mode);
|
||||
ghost->SetData(TimelineViewGhostItem::kReferenceBlock,
|
||||
QtUtils::PtrToValue(block_after_ripple));
|
||||
ghost->set_data(TimelineViewGhostItem::k_reference_block,
|
||||
QtUtils::ptr_to_value(block_after_ripple));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,31 +122,31 @@ void RippleTool::InitiateDrag(Block *clicked_item,
|
||||
}
|
||||
}
|
||||
|
||||
void RippleTool::FinishDrag(TimelineViewMouseEvent *event)
|
||||
void RippleTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
||||
if (parent()->HasGhosts()) {
|
||||
if (parent()->has_ghosts()) {
|
||||
QVector<QHash<Track *, TrackListRippleToolCommand::RippleInfo>>
|
||||
info_list(Track::kCount);
|
||||
info_list(Track::k_count);
|
||||
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->GetGhostItems()) {
|
||||
if (!ghost->HasBeenAdjusted()) {
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->get_ghost_items()) {
|
||||
if (!ghost->has_been_adjusted()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Track *track = parent()->GetTrackFromReference(ghost->GetTrack());
|
||||
Track *track = parent()->get_track_from_reference(ghost->get_track());
|
||||
|
||||
TrackListRippleToolCommand::RippleInfo info;
|
||||
Block *b = QtUtils::ValueToPtr<Block>(
|
||||
ghost->GetData(TimelineViewGhostItem::kAttachedBlock));
|
||||
Block *b = QtUtils::value_to_ptr<Block>(
|
||||
ghost->get_data(TimelineViewGhostItem::k_attached_block));
|
||||
|
||||
if (b) {
|
||||
info.block = b;
|
||||
info.append_gap = false;
|
||||
} else {
|
||||
info.block = QtUtils::ValueToPtr<Block>(
|
||||
ghost->GetData(TimelineViewGhostItem::kReferenceBlock));
|
||||
info.block = QtUtils::value_to_ptr<Block>(
|
||||
ghost->get_data(TimelineViewGhostItem::k_reference_block));
|
||||
info.append_gap = true;
|
||||
}
|
||||
|
||||
@@ -155,12 +155,12 @@ void RippleTool::FinishDrag(TimelineViewMouseEvent *event)
|
||||
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
|
||||
rational movement;
|
||||
Rational movement;
|
||||
|
||||
if (drag_movement_mode() == Timeline::kTrimOut) {
|
||||
movement = parent()->GetGhostItems().first()->GetOutAdjustment();
|
||||
if (drag_movement_mode() == Timeline::k_trim_out) {
|
||||
movement = parent()->get_ghost_items().first()->get_out_adjustment();
|
||||
} else {
|
||||
movement = parent()->GetGhostItems().first()->GetInAdjustment();
|
||||
movement = parent()->get_ghost_items().first()->get_in_adjustment();
|
||||
}
|
||||
|
||||
for (int i = 0; i < info_list.size(); i++) {
|
||||
@@ -172,16 +172,16 @@ void RippleTool::FinishDrag(TimelineViewMouseEvent *event)
|
||||
}
|
||||
|
||||
if (command->child_count() > 0) {
|
||||
TimelineWidgetSelections new_sel = parent()->GetSelections();
|
||||
TimelineWidgetSelections new_sel = parent()->get_selections();
|
||||
TimelineViewGhostItem *reference_ghost =
|
||||
parent()->GetGhostItems().first();
|
||||
if (drag_movement_mode() == Timeline::kTrimIn) {
|
||||
new_sel.TrimOut(-reference_ghost->GetInAdjustment());
|
||||
parent()->get_ghost_items().first();
|
||||
if (drag_movement_mode() == Timeline::k_trim_in) {
|
||||
new_sel.trim_out(-reference_ghost->get_in_adjustment());
|
||||
} else {
|
||||
new_sel.TrimOut(reference_ghost->GetOutAdjustment());
|
||||
new_sel.trim_out(reference_ghost->get_out_adjustment());
|
||||
}
|
||||
command->add_child(new TimelineWidget::SetSelectionsCommand(
|
||||
parent(), new_sel, parent()->GetSelections(), false));
|
||||
parent(), new_sel, parent()->get_selections(), false));
|
||||
|
||||
Core::instance()->undo_stack()->push(
|
||||
command, qApp->translate("RippleTool", "Rippled Clips"));
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef RIPPLETIMELINETOOL_H
|
||||
#define RIPPLETIMELINETOOL_H
|
||||
#ifndef OAK_RIPPLETIMELINETOOL_H
|
||||
#define OAK_RIPPLETIMELINETOOL_H
|
||||
|
||||
#include "pointer.h"
|
||||
|
||||
@@ -32,13 +32,13 @@ public:
|
||||
RippleTool(TimelineWidget *parent);
|
||||
|
||||
protected:
|
||||
virtual void FinishDrag(TimelineViewMouseEvent *event) override;
|
||||
virtual void finish_drag(TimelineViewMouseEvent *event) override;
|
||||
|
||||
virtual void InitiateDrag(Block *clicked_item,
|
||||
virtual void initiate_drag(Block *clicked_item,
|
||||
Timeline::MovementMode trim_mode,
|
||||
Qt::KeyboardModifiers modifiers) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // RIPPLETIMELINETOOL_H
|
||||
#endif // OAK_RIPPLETIMELINETOOL_H
|
||||
|
||||
@@ -31,15 +31,15 @@ namespace olive
|
||||
RollingTool::RollingTool(TimelineWidget *parent)
|
||||
: PointerTool(parent)
|
||||
{
|
||||
SetMovementAllowed(false);
|
||||
SetGapTrimmingAllowed(true);
|
||||
set_movement_allowed(false);
|
||||
set_gap_trimming_allowed(true);
|
||||
}
|
||||
|
||||
void RollingTool::InitiateDrag(Block *clicked_item,
|
||||
void RollingTool::initiate_drag(Block *clicked_item,
|
||||
Timeline::MovementMode trim_mode,
|
||||
Qt::KeyboardModifiers modifiers)
|
||||
{
|
||||
InitiateDragInternal(clicked_item, trim_mode, modifiers, false, true,
|
||||
initiate_drag_internal(clicked_item, trim_mode, modifiers, false, true,
|
||||
false);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef ROLLINGTIMELINETOOL_H
|
||||
#define ROLLINGTIMELINETOOL_H
|
||||
#ifndef OAK_ROLLINGTIMELINETOOL_H
|
||||
#define OAK_ROLLINGTIMELINETOOL_H
|
||||
|
||||
#include "pointer.h"
|
||||
|
||||
@@ -32,11 +32,11 @@ public:
|
||||
RollingTool(TimelineWidget *parent);
|
||||
|
||||
protected:
|
||||
virtual void InitiateDrag(Block *clicked_item,
|
||||
virtual void initiate_drag(Block *clicked_item,
|
||||
Timeline::MovementMode trim_mode,
|
||||
Qt::KeyboardModifiers modifiers) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // ROLLINGTIMELINETOOL_H
|
||||
#endif // OAK_ROLLINGTIMELINETOOL_H
|
||||
|
||||
@@ -31,16 +31,16 @@ namespace olive
|
||||
SlideTool::SlideTool(TimelineWidget *parent)
|
||||
: PointerTool(parent)
|
||||
{
|
||||
SetTrimmingAllowed(false);
|
||||
SetTrackMovementAllowed(false);
|
||||
SetGapTrimmingAllowed(true);
|
||||
set_trimming_allowed(false);
|
||||
set_track_movement_allowed(false);
|
||||
set_gap_trimming_allowed(true);
|
||||
}
|
||||
|
||||
void SlideTool::InitiateDrag(Block *clicked_item,
|
||||
void SlideTool::initiate_drag(Block *clicked_item,
|
||||
Timeline::MovementMode trim_mode,
|
||||
Qt::KeyboardModifiers modifiers)
|
||||
{
|
||||
InitiateDragInternal(clicked_item, trim_mode, modifiers, false, true, true);
|
||||
initiate_drag_internal(clicked_item, trim_mode, modifiers, false, true, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef SLIDETIMELINETOOL_H
|
||||
#define SLIDETIMELINETOOL_H
|
||||
#ifndef OAK_SLIDETIMELINETOOL_H
|
||||
#define OAK_SLIDETIMELINETOOL_H
|
||||
|
||||
#include "pointer.h"
|
||||
|
||||
@@ -32,11 +32,11 @@ public:
|
||||
SlideTool(TimelineWidget *parent);
|
||||
|
||||
protected:
|
||||
virtual void InitiateDrag(Block *clicked_item,
|
||||
virtual void initiate_drag(Block *clicked_item,
|
||||
Timeline::MovementMode trim_mode,
|
||||
Qt::KeyboardModifiers modifiers) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // SLIDETIMELINETOOL_H
|
||||
#endif // OAK_SLIDETIMELINETOOL_H
|
||||
|
||||
@@ -33,60 +33,60 @@ namespace olive
|
||||
SlipTool::SlipTool(TimelineWidget *parent)
|
||||
: PointerTool(parent)
|
||||
{
|
||||
SetTrimmingAllowed(false);
|
||||
SetTrackMovementAllowed(false);
|
||||
set_trimming_allowed(false);
|
||||
set_track_movement_allowed(false);
|
||||
}
|
||||
|
||||
void SlipTool::ProcessDrag(const TimelineCoordinate &mouse_pos)
|
||||
void SlipTool::process_drag(const TimelineCoordinate &mouse_pos)
|
||||
{
|
||||
// Determine frame movement
|
||||
rational time_movement = drag_start_.GetFrame() - mouse_pos.GetFrame();
|
||||
Rational time_movement = drag_start_.get_frame() - mouse_pos.get_frame();
|
||||
|
||||
// Validate slip (enforce all ghosts moving in legal ways)
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->GetGhostItems()) {
|
||||
if (ghost->GetMediaIn() + time_movement < 0) {
|
||||
time_movement = -ghost->GetMediaIn();
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->get_ghost_items()) {
|
||||
if (ghost->get_media_in() + time_movement < 0) {
|
||||
time_movement = -ghost->get_media_in();
|
||||
}
|
||||
}
|
||||
|
||||
// Perform slip
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->GetGhostItems()) {
|
||||
ghost->SetMediaInAdjustment(time_movement);
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->get_ghost_items()) {
|
||||
ghost->set_media_in_adjustment(time_movement);
|
||||
}
|
||||
|
||||
// Generate tooltip and force it to to update (otherwise the tooltip won't move as written in the
|
||||
// documentation, and could get in the way of the cursor)
|
||||
rational tooltip_timebase =
|
||||
parent()->GetTimebaseForTrackType(drag_start_.GetTrack().type());
|
||||
Rational tooltip_timebase =
|
||||
parent()->get_timebase_for_track_type(drag_start_.get_track().type());
|
||||
QToolTip::hideText();
|
||||
QToolTip::showText(QCursor::pos(),
|
||||
QString::fromStdString(Timecode::time_to_timecode(
|
||||
time_movement, tooltip_timebase,
|
||||
Core::instance()->GetTimecodeDisplay(), true)),
|
||||
Core::instance()->get_timecode_display(), true)),
|
||||
parent());
|
||||
}
|
||||
|
||||
void SlipTool::FinishDrag(TimelineViewMouseEvent *event)
|
||||
void SlipTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
|
||||
// Find earliest point to ripple around
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->GetGhostItems()) {
|
||||
Block *b = QtUtils::ValueToPtr<Block>(
|
||||
ghost->GetData(TimelineViewGhostItem::kAttachedBlock));
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->get_ghost_items()) {
|
||||
Block *b = QtUtils::value_to_ptr<Block>(
|
||||
ghost->get_data(TimelineViewGhostItem::k_attached_block));
|
||||
|
||||
ClipBlock *cb = dynamic_cast<ClipBlock *>(b);
|
||||
if (cb) {
|
||||
command->add_child(
|
||||
new BlockSetMediaInCommand(cb, ghost->GetAdjustedMediaIn()));
|
||||
new BlockSetMediaInCommand(cb, ghost->get_adjusted_media_in()));
|
||||
}
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->push(
|
||||
command, qApp->translate("SlipTool", "Slipped %1 Clip(s)")
|
||||
.arg(parent()->GetGhostItems().size()));
|
||||
.arg(parent()->get_ghost_items().size()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef SLIPTIMELINETOOL_H
|
||||
#define SLIPTIMELINETOOL_H
|
||||
#ifndef OAK_SLIPTIMELINETOOL_H
|
||||
#define OAK_SLIPTIMELINETOOL_H
|
||||
|
||||
#include "pointer.h"
|
||||
|
||||
@@ -32,10 +32,10 @@ public:
|
||||
SlipTool(TimelineWidget *parent);
|
||||
|
||||
protected:
|
||||
virtual void ProcessDrag(const TimelineCoordinate &mouse_pos) override;
|
||||
virtual void FinishDrag(TimelineViewMouseEvent *event) override;
|
||||
virtual void process_drag(const TimelineCoordinate &mouse_pos) override;
|
||||
virtual void finish_drag(TimelineViewMouseEvent *event) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // SLIPTIMELINETOOL_H
|
||||
#endif // OAK_SLIPTIMELINETOOL_H
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
namespace olive
|
||||
{
|
||||
|
||||
const int TimelineTool::kDefaultDistanceFromOutput = -4;
|
||||
const int TimelineTool::k_default_distance_from_output = -4;
|
||||
|
||||
TimelineTool::TimelineTool(TimelineWidget *parent)
|
||||
: dragging_(false)
|
||||
@@ -49,25 +49,25 @@ Sequence *TimelineTool::sequence()
|
||||
}
|
||||
|
||||
Timeline::MovementMode
|
||||
TimelineTool::FlipTrimMode(const Timeline::MovementMode &trim_mode)
|
||||
TimelineTool::flip_trim_mode(const Timeline::MovementMode &trim_mode)
|
||||
{
|
||||
if (trim_mode == Timeline::kTrimIn) {
|
||||
return Timeline::kTrimOut;
|
||||
if (trim_mode == Timeline::k_trim_in) {
|
||||
return Timeline::k_trim_out;
|
||||
}
|
||||
|
||||
if (trim_mode == Timeline::kTrimOut) {
|
||||
return Timeline::kTrimIn;
|
||||
if (trim_mode == Timeline::k_trim_out) {
|
||||
return Timeline::k_trim_in;
|
||||
}
|
||||
|
||||
return trim_mode;
|
||||
}
|
||||
|
||||
rational TimelineTool::SnapMovementToTimebase(const rational &start,
|
||||
rational movement,
|
||||
const rational &timebase)
|
||||
Rational TimelineTool::snap_movement_to_timebase(const Rational &start,
|
||||
Rational movement,
|
||||
const Rational &timebase)
|
||||
{
|
||||
rational proposed_position = start + movement;
|
||||
rational snapped =
|
||||
Rational proposed_position = start + movement;
|
||||
Rational snapped =
|
||||
Timecode::snap_time_to_timebase(proposed_position, timebase);
|
||||
|
||||
if (proposed_position != snapped) {
|
||||
@@ -77,23 +77,23 @@ rational TimelineTool::SnapMovementToTimebase(const rational &start,
|
||||
return movement;
|
||||
}
|
||||
|
||||
rational TimelineTool::ValidateTimeMovement(rational movement)
|
||||
Rational TimelineTool::validate_time_movement(Rational movement)
|
||||
{
|
||||
bool first_ghost = true;
|
||||
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->GetGhostItems()) {
|
||||
if (ghost->GetMode() != Timeline::kMove) {
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->get_ghost_items()) {
|
||||
if (ghost->get_mode() != Timeline::k_move) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Prevents any ghosts from going below 0:00:00 time
|
||||
if (ghost->GetIn() + movement < 0) {
|
||||
movement = -ghost->GetIn();
|
||||
if (ghost->get_in() + movement < 0) {
|
||||
movement = -ghost->get_in();
|
||||
} else if (first_ghost) {
|
||||
// Ensure ghost is snapped to a grid
|
||||
movement = SnapMovementToTimebase(
|
||||
ghost->GetIn(), movement,
|
||||
parent()->GetTimebaseForTrackType(ghost->GetTrack().type()));
|
||||
movement = snap_movement_to_timebase(
|
||||
ghost->get_in(), movement,
|
||||
parent()->get_timebase_for_track_type(ghost->get_track().type()));
|
||||
|
||||
first_ghost = false;
|
||||
}
|
||||
@@ -102,35 +102,35 @@ rational TimelineTool::ValidateTimeMovement(rational movement)
|
||||
return movement;
|
||||
}
|
||||
|
||||
int TimelineTool::ValidateTrackMovement(
|
||||
int TimelineTool::validate_track_movement(
|
||||
int movement, const QVector<TimelineViewGhostItem *> &ghosts)
|
||||
{
|
||||
foreach (TimelineViewGhostItem *ghost, ghosts) {
|
||||
if (ghost->GetMode() != Timeline::kMove) {
|
||||
if (ghost->get_mode() != Timeline::k_move) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ghost->GetCanMoveTracks()) {
|
||||
if (!ghost->get_can_move_tracks()) {
|
||||
return 0;
|
||||
|
||||
} else if (ghost->GetTrack().index() + movement < 0) {
|
||||
} else if (ghost->get_track().index() + movement < 0) {
|
||||
// Prevents any ghosts from going to a non-existent negative track
|
||||
movement = -ghost->GetTrack().index();
|
||||
movement = -ghost->get_track().index();
|
||||
}
|
||||
}
|
||||
|
||||
return movement;
|
||||
}
|
||||
|
||||
void TimelineTool::GetGhostData(rational *earliest_point,
|
||||
rational *latest_point)
|
||||
void TimelineTool::get_ghost_data(Rational *earliest_point,
|
||||
Rational *latest_point)
|
||||
{
|
||||
rational ep = RATIONAL_MAX;
|
||||
rational lp = RATIONAL_MIN;
|
||||
Rational ep = RATIONAL_MAX;
|
||||
Rational lp = RATIONAL_MIN;
|
||||
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->GetGhostItems()) {
|
||||
ep = qMin(ep, ghost->GetAdjustedIn());
|
||||
lp = qMax(lp, ghost->GetAdjustedOut());
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->get_ghost_items()) {
|
||||
ep = qMin(ep, ghost->get_adjusted_in());
|
||||
lp = qMax(lp, ghost->get_adjusted_out());
|
||||
}
|
||||
|
||||
if (earliest_point) {
|
||||
@@ -142,13 +142,13 @@ void TimelineTool::GetGhostData(rational *earliest_point,
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineTool::InsertGapsAtGhostDestination(olive::MultiUndoCommand *command)
|
||||
void TimelineTool::insert_gaps_at_ghost_destination(olive::MultiUndoCommand *command)
|
||||
{
|
||||
rational earliest_point, latest_point;
|
||||
Rational earliest_point, latest_point;
|
||||
|
||||
GetGhostData(&earliest_point, &latest_point);
|
||||
get_ghost_data(&earliest_point, &latest_point);
|
||||
|
||||
parent()->InsertGapsAt(earliest_point, latest_point - earliest_point,
|
||||
parent()->insert_gaps_at(earliest_point, latest_point - earliest_point,
|
||||
command);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMELINETOOL_H
|
||||
#define TIMELINETOOL_H
|
||||
#ifndef OAK_TIMELINETOOL_H
|
||||
#define OAK_TIMELINETOOL_H
|
||||
|
||||
#include <QDragLeaveEvent>
|
||||
|
||||
@@ -37,33 +37,33 @@ public:
|
||||
TimelineTool(TimelineWidget *parent);
|
||||
virtual ~TimelineTool();
|
||||
|
||||
virtual void MousePress(TimelineViewMouseEvent *)
|
||||
virtual void mouse_press(TimelineViewMouseEvent *)
|
||||
{
|
||||
}
|
||||
virtual void MouseMove(TimelineViewMouseEvent *)
|
||||
virtual void mouse_move(TimelineViewMouseEvent *)
|
||||
{
|
||||
}
|
||||
virtual void MouseRelease(TimelineViewMouseEvent *)
|
||||
virtual void mouse_release(TimelineViewMouseEvent *)
|
||||
{
|
||||
}
|
||||
virtual void MouseDoubleClick(TimelineViewMouseEvent *)
|
||||
virtual void mouse_double_click(TimelineViewMouseEvent *)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void HoverMove(TimelineViewMouseEvent *)
|
||||
virtual void hover_move(TimelineViewMouseEvent *)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void DragEnter(TimelineViewMouseEvent *)
|
||||
virtual void drag_enter(TimelineViewMouseEvent *)
|
||||
{
|
||||
}
|
||||
virtual void DragMove(TimelineViewMouseEvent *)
|
||||
virtual void drag_move(TimelineViewMouseEvent *)
|
||||
{
|
||||
}
|
||||
virtual void DragLeave(QDragLeaveEvent *)
|
||||
virtual void drag_leave(QDragLeaveEvent *)
|
||||
{
|
||||
}
|
||||
virtual void DragDrop(TimelineViewMouseEvent *)
|
||||
virtual void drag_drop(TimelineViewMouseEvent *)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -72,11 +72,11 @@ public:
|
||||
Sequence *sequence();
|
||||
|
||||
static Timeline::MovementMode
|
||||
FlipTrimMode(const Timeline::MovementMode &trim_mode);
|
||||
flip_trim_mode(const Timeline::MovementMode &trim_mode);
|
||||
|
||||
static rational SnapMovementToTimebase(const rational &start,
|
||||
rational movement,
|
||||
const rational &timebase);
|
||||
static Rational snap_movement_to_timebase(const Rational &start,
|
||||
Rational movement,
|
||||
const Rational &timebase);
|
||||
|
||||
protected:
|
||||
/**
|
||||
@@ -85,27 +85,27 @@ protected:
|
||||
* Validation is the process of ensuring that whatever movements the user is making are "valid" and "legal". This
|
||||
* function's validation ensures that no Ghost's in point ends up in a negative timecode.
|
||||
*/
|
||||
rational ValidateTimeMovement(rational movement);
|
||||
Rational validate_time_movement(Rational movement);
|
||||
|
||||
/**
|
||||
* @brief Validates Ghosts that are moving vertically (track-based)
|
||||
*
|
||||
* This function's validation ensures that no Ghost's track ends up in a negative (non-existent) track.
|
||||
*/
|
||||
int ValidateTrackMovement(int movement,
|
||||
int validate_track_movement(int movement,
|
||||
const QVector<TimelineViewGhostItem *> &ghosts);
|
||||
|
||||
void GetGhostData(rational *earliest_point, rational *latest_point);
|
||||
void get_ghost_data(Rational *earliest_point, Rational *latest_point);
|
||||
|
||||
void InsertGapsAtGhostDestination(MultiUndoCommand *command);
|
||||
void insert_gaps_at_ghost_destination(MultiUndoCommand *command);
|
||||
|
||||
std::vector<rational> snap_points_;
|
||||
std::vector<Rational> snap_points_;
|
||||
|
||||
bool dragging_;
|
||||
|
||||
TimelineCoordinate drag_start_;
|
||||
|
||||
static const int kDefaultDistanceFromOutput;
|
||||
static const int k_default_distance_from_output;
|
||||
|
||||
private:
|
||||
TimelineWidget *parent_;
|
||||
@@ -113,4 +113,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // TIMELINETOOL_H
|
||||
#endif // OAK_TIMELINETOOL_H
|
||||
|
||||
@@ -33,60 +33,60 @@ TrackSelectTool::TrackSelectTool(TimelineWidget *parent)
|
||||
{
|
||||
}
|
||||
|
||||
void TrackSelectTool::MousePress(TimelineViewMouseEvent *event)
|
||||
void TrackSelectTool::mouse_press(TimelineViewMouseEvent *event)
|
||||
{
|
||||
QVector<Block *> blocks;
|
||||
bool forward = !(event->GetModifiers() & Qt::ControlModifier);
|
||||
bool forward = !(event->get_modifiers() & Qt::ControlModifier);
|
||||
|
||||
parent()->DeselectAll();
|
||||
parent()->deselect_all();
|
||||
|
||||
if (event->GetModifiers() & Qt::ShiftModifier) {
|
||||
if (event->get_modifiers() & Qt::ShiftModifier) {
|
||||
// Track only
|
||||
Track *track = parent()->GetTrackFromReference(event->GetTrack());
|
||||
Track *track = parent()->get_track_from_reference(event->get_track());
|
||||
if (track) {
|
||||
SelectBlocksOnTrack(track, event, &blocks, forward);
|
||||
select_blocks_on_track(track, event, &blocks, forward);
|
||||
}
|
||||
} else {
|
||||
// All tracks
|
||||
foreach (Track *track, parent()->sequence()->GetTracks()) {
|
||||
SelectBlocksOnTrack(track, event, &blocks, forward);
|
||||
foreach (Track *track, parent()->sequence()->get_tracks()) {
|
||||
select_blocks_on_track(track, event, &blocks, forward);
|
||||
}
|
||||
}
|
||||
|
||||
if (!blocks.isEmpty()) {
|
||||
parent()->SignalSelectedBlocks(blocks);
|
||||
set_drag_movement_mode(Timeline::kMove);
|
||||
SetClickedItem(blocks.first());
|
||||
drag_start_ = event->GetCoordinates();
|
||||
parent()->signal_selected_blocks(blocks);
|
||||
set_drag_movement_mode(Timeline::k_move);
|
||||
set_clicked_item(blocks.first());
|
||||
drag_start_ = event->get_coordinates();
|
||||
} else {
|
||||
set_drag_movement_mode(Timeline::kNone);
|
||||
set_drag_movement_mode(Timeline::k_none);
|
||||
}
|
||||
}
|
||||
|
||||
void TrackSelectTool::SelectBlocksOnTrack(Track *track,
|
||||
void TrackSelectTool::select_blocks_on_track(Track *track,
|
||||
TimelineViewMouseEvent *event,
|
||||
QVector<Block *> *blocks,
|
||||
bool forward)
|
||||
{
|
||||
Block *b = track->NearestBlockBeforeOrAt(event->GetFrame());
|
||||
Block *b = track->nearest_block_before_or_at(event->get_frame());
|
||||
|
||||
if (!b && !track->Blocks().isEmpty() && !forward) {
|
||||
if (!b && !track->blocks().isEmpty() && !forward) {
|
||||
// Fallback to first or last block in track
|
||||
b = track->Blocks().last();
|
||||
b = track->blocks().last();
|
||||
}
|
||||
|
||||
while (b) {
|
||||
if (!dynamic_cast<GapBlock *>(b)) {
|
||||
if (!blocks->contains(b)) {
|
||||
parent()->AddSelection(b);
|
||||
parent()->add_selection(b);
|
||||
blocks->append(b);
|
||||
}
|
||||
|
||||
if (!(event->GetModifiers() & Qt::AltModifier)) {
|
||||
if (!(event->get_modifiers() & Qt::AltModifier)) {
|
||||
if (ClipBlock *clip = dynamic_cast<ClipBlock *>(b)) {
|
||||
foreach (Block *link, clip->block_links()) {
|
||||
if (!blocks->contains(link)) {
|
||||
parent()->AddSelection(link);
|
||||
parent()->add_selection(link);
|
||||
blocks->append(link);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TRACKSELECTTOOL_H
|
||||
#define TRACKSELECTTOOL_H
|
||||
#ifndef OAK_TRACKSELECTTOOL_H
|
||||
#define OAK_TRACKSELECTTOOL_H
|
||||
|
||||
#include "pointer.h"
|
||||
|
||||
@@ -31,13 +31,13 @@ class TrackSelectTool : public PointerTool {
|
||||
public:
|
||||
TrackSelectTool(TimelineWidget *parent);
|
||||
|
||||
virtual void MousePress(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_press(TimelineViewMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
void SelectBlocksOnTrack(Track *track, TimelineViewMouseEvent *event,
|
||||
void select_blocks_on_track(Track *track, TimelineViewMouseEvent *event,
|
||||
QVector<Block *> *blocks, bool forward);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TRACKSELECTTOOL_H
|
||||
#endif // OAK_TRACKSELECTTOOL_H
|
||||
|
||||
@@ -36,139 +36,139 @@ TransitionTool::TransitionTool(TimelineWidget *parent)
|
||||
{
|
||||
}
|
||||
|
||||
void TransitionTool::HoverMove(TimelineViewMouseEvent *event)
|
||||
void TransitionTool::hover_move(TimelineViewMouseEvent *event)
|
||||
{
|
||||
ClipBlock *primary = nullptr;
|
||||
ClipBlock *secondary = nullptr;
|
||||
Timeline::MovementMode trim_mode = Timeline::kNone;
|
||||
rational transition_start_point;
|
||||
Timeline::MovementMode trim_mode = Timeline::k_none;
|
||||
Rational transition_start_point;
|
||||
|
||||
GetBlocksAtCoord(event->GetCoordinates(), &primary, &secondary, &trim_mode,
|
||||
get_blocks_at_coord(event->get_coordinates(), &primary, &secondary, &trim_mode,
|
||||
&transition_start_point);
|
||||
|
||||
if (trim_mode == Timeline::kTrimIn) {
|
||||
if (trim_mode == Timeline::k_trim_in) {
|
||||
std::swap(primary, secondary);
|
||||
}
|
||||
|
||||
parent()->SetViewTransitionOverlay(primary, secondary);
|
||||
parent()->set_view_transition_overlay(primary, secondary);
|
||||
}
|
||||
|
||||
void TransitionTool::MousePress(TimelineViewMouseEvent *event)
|
||||
void TransitionTool::mouse_press(TimelineViewMouseEvent *event)
|
||||
{
|
||||
ClipBlock *primary, *secondary;
|
||||
Timeline::MovementMode trim_mode;
|
||||
rational transition_start_point;
|
||||
if (!GetBlocksAtCoord(event->GetCoordinates(), &primary, &secondary,
|
||||
Rational transition_start_point;
|
||||
if (!get_blocks_at_coord(event->get_coordinates(), &primary, &secondary,
|
||||
&trim_mode, &transition_start_point)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create ghost
|
||||
ghost_ = new TimelineViewGhostItem();
|
||||
ghost_->SetTrack(event->GetTrack());
|
||||
ghost_->SetIn(transition_start_point);
|
||||
ghost_->SetOut(transition_start_point);
|
||||
ghost_->SetMode(trim_mode);
|
||||
ghost_->SetData(TimelineViewGhostItem::kAttachedBlock,
|
||||
QtUtils::PtrToValue(primary));
|
||||
ghost_->set_track(event->get_track());
|
||||
ghost_->set_in(transition_start_point);
|
||||
ghost_->set_out(transition_start_point);
|
||||
ghost_->set_mode(trim_mode);
|
||||
ghost_->set_data(TimelineViewGhostItem::k_attached_block,
|
||||
QtUtils::ptr_to_value(primary));
|
||||
|
||||
dual_transition_ = (secondary);
|
||||
if (secondary)
|
||||
ghost_->SetData(TimelineViewGhostItem::kReferenceBlock,
|
||||
QtUtils::PtrToValue(secondary));
|
||||
ghost_->set_data(TimelineViewGhostItem::k_reference_block,
|
||||
QtUtils::ptr_to_value(secondary));
|
||||
|
||||
parent()->AddGhost(ghost_);
|
||||
parent()->add_ghost(ghost_);
|
||||
|
||||
snap_points_.push_back(transition_start_point);
|
||||
|
||||
// Set the drag start point
|
||||
drag_start_point_ = event->GetFrame();
|
||||
drag_start_point_ = event->get_frame();
|
||||
}
|
||||
|
||||
void TransitionTool::MouseMove(TimelineViewMouseEvent *event)
|
||||
void TransitionTool::mouse_move(TimelineViewMouseEvent *event)
|
||||
{
|
||||
if (!ghost_) {
|
||||
return;
|
||||
}
|
||||
|
||||
MouseMoveInternal(event->GetFrame(), dual_transition_);
|
||||
mouse_move_internal(event->get_frame(), dual_transition_);
|
||||
}
|
||||
|
||||
void TransitionTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
void TransitionTool::mouse_release(TimelineViewMouseEvent *event)
|
||||
{
|
||||
const Track::Reference &track = ghost_->GetTrack();
|
||||
const Track::Reference &track = ghost_->get_track();
|
||||
|
||||
if (ghost_) {
|
||||
if (!ghost_->GetAdjustedLength().isNull()) {
|
||||
if (!ghost_->get_adjusted_length().isNull()) {
|
||||
TransitionBlock *transition;
|
||||
|
||||
if (Core::instance()->GetSelectedTransition().isEmpty()) {
|
||||
if (Core::instance()->get_selected_transition().isEmpty()) {
|
||||
// Fallback if the user hasn't selected one yet
|
||||
transition = new CrossDissolveTransition();
|
||||
} else {
|
||||
transition =
|
||||
static_cast<TransitionBlock *>(NodeFactory::CreateFromID(
|
||||
Core::instance()->GetSelectedTransition()));
|
||||
static_cast<TransitionBlock *>(NodeFactory::create_from_id(
|
||||
Core::instance()->get_selected_transition()));
|
||||
}
|
||||
|
||||
// Set transition length
|
||||
rational len = ghost_->GetAdjustedLength();
|
||||
Rational len = ghost_->get_adjusted_length();
|
||||
transition->set_length_and_media_out(len);
|
||||
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
|
||||
// Place transition in place
|
||||
command->add_child(new NodeAddCommand(
|
||||
parent()->GetConnectedNode()->parent(), transition));
|
||||
parent()->get_connected_node()->parent(), transition));
|
||||
|
||||
command->add_child(new NodeSetPositionCommand(
|
||||
transition, transition, QPointF(0, 0)));
|
||||
|
||||
command->add_child(new TrackPlaceBlockCommand(
|
||||
sequence()->track_list(track.type()), track.index(), transition,
|
||||
ghost_->GetAdjustedIn()));
|
||||
ghost_->get_adjusted_in()));
|
||||
|
||||
if (dual_transition_) {
|
||||
// Block mouse is hovering over
|
||||
Block *active_block = QtUtils::ValueToPtr<Block>(
|
||||
ghost_->GetData(TimelineViewGhostItem::kAttachedBlock));
|
||||
Block *active_block = QtUtils::value_to_ptr<Block>(
|
||||
ghost_->get_data(TimelineViewGhostItem::k_attached_block));
|
||||
|
||||
// Block mouse is next to
|
||||
Block *friend_block = QtUtils::ValueToPtr<Block>(
|
||||
ghost_->GetData(TimelineViewGhostItem::kReferenceBlock));
|
||||
Block *friend_block = QtUtils::value_to_ptr<Block>(
|
||||
ghost_->get_data(TimelineViewGhostItem::k_reference_block));
|
||||
|
||||
// Use ghost mode to determine which block is which
|
||||
Block *out_block = (ghost_->GetMode() == Timeline::kTrimIn) ?
|
||||
Block *out_block = (ghost_->get_mode() == Timeline::k_trim_in) ?
|
||||
friend_block :
|
||||
active_block;
|
||||
Block *in_block = (ghost_->GetMode() == Timeline::kTrimIn) ?
|
||||
Block *in_block = (ghost_->get_mode() == Timeline::k_trim_in) ?
|
||||
active_block :
|
||||
friend_block;
|
||||
|
||||
// Connect block to transition
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
out_block,
|
||||
NodeInput(transition, TransitionBlock::kOutBlockInput)));
|
||||
NodeInput(transition, TransitionBlock::k_out_block_input)));
|
||||
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
in_block,
|
||||
NodeInput(transition, TransitionBlock::kInBlockInput)));
|
||||
NodeInput(transition, TransitionBlock::k_in_block_input)));
|
||||
|
||||
command->add_child(new NodeSetPositionCommand(
|
||||
out_block, transition, QPointF(-1, -0.5)));
|
||||
command->add_child(new NodeSetPositionCommand(
|
||||
in_block, transition, QPointF(-1, 0.5)));
|
||||
} else {
|
||||
Block *block_to_transition = QtUtils::ValueToPtr<Block>(
|
||||
ghost_->GetData(TimelineViewGhostItem::kAttachedBlock));
|
||||
Block *block_to_transition = QtUtils::value_to_ptr<Block>(
|
||||
ghost_->get_data(TimelineViewGhostItem::k_attached_block));
|
||||
QString transition_input_to_connect;
|
||||
|
||||
if (ghost_->GetMode() == Timeline::kTrimIn) {
|
||||
if (ghost_->get_mode() == Timeline::k_trim_in) {
|
||||
transition_input_to_connect =
|
||||
TransitionBlock::kInBlockInput;
|
||||
TransitionBlock::k_in_block_input;
|
||||
} else {
|
||||
transition_input_to_connect =
|
||||
TransitionBlock::kOutBlockInput;
|
||||
TransitionBlock::k_out_block_input;
|
||||
}
|
||||
|
||||
// Connect block to transition
|
||||
@@ -184,38 +184,38 @@ void TransitionTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
command,
|
||||
qApp->translate("TransitionTool", "Created Transition"));
|
||||
|
||||
parent()->SetViewTransitionOverlay(nullptr, nullptr);
|
||||
parent()->set_view_transition_overlay(nullptr, nullptr);
|
||||
}
|
||||
|
||||
parent()->ClearGhosts();
|
||||
parent()->clear_ghosts();
|
||||
snap_points_.clear();
|
||||
ghost_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool TransitionTool::GetBlocksAtCoord(const TimelineCoordinate &coord,
|
||||
bool TransitionTool::get_blocks_at_coord(const TimelineCoordinate &coord,
|
||||
ClipBlock **primary,
|
||||
ClipBlock **secondary,
|
||||
Timeline::MovementMode *ptrim_mode,
|
||||
rational *start_point)
|
||||
Rational *start_point)
|
||||
{
|
||||
const Track::Reference &track = coord.GetTrack();
|
||||
Track *t = parent()->GetTrackFromReference(track);
|
||||
rational cursor_frame = coord.GetFrame();
|
||||
const Track::Reference &track = coord.get_track();
|
||||
Track *t = parent()->get_track_from_reference(track);
|
||||
Rational cursor_frame = coord.get_frame();
|
||||
|
||||
if (!t || t->IsLocked()) {
|
||||
if (!t || t->is_locked()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Block *block_at_time = t->NearestBlockBeforeOrAt(coord.GetFrame());
|
||||
Block *block_at_time = t->nearest_block_before_or_at(coord.get_frame());
|
||||
if (!dynamic_cast<ClipBlock *>(block_at_time)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Determine which side of the clip the transition belongs to
|
||||
rational transition_start_point;
|
||||
Rational transition_start_point;
|
||||
Timeline::MovementMode trim_mode;
|
||||
rational tenth_point = block_at_time->length() / 10;
|
||||
Rational tenth_point = block_at_time->length() / 10;
|
||||
Block *other_block = nullptr;
|
||||
if (cursor_frame < (block_at_time->in() + block_at_time->length() / 2)) {
|
||||
if (static_cast<ClipBlock *>(block_at_time)->in_transition()) {
|
||||
@@ -230,7 +230,7 @@ bool TransitionTool::GetBlocksAtCoord(const TimelineCoordinate &coord,
|
||||
}
|
||||
|
||||
transition_start_point = block_at_time->in();
|
||||
trim_mode = Timeline::kTrimIn;
|
||||
trim_mode = Timeline::k_trim_in;
|
||||
|
||||
if (cursor_frame < (block_at_time->in() + tenth_point) && adjacent) {
|
||||
other_block = adjacent;
|
||||
@@ -247,7 +247,7 @@ bool TransitionTool::GetBlocksAtCoord(const TimelineCoordinate &coord,
|
||||
}
|
||||
|
||||
transition_start_point = block_at_time->out();
|
||||
trim_mode = Timeline::kTrimOut;
|
||||
trim_mode = Timeline::k_trim_out;
|
||||
|
||||
if (cursor_frame > block_at_time->out() - tenth_point && adjacent) {
|
||||
other_block = block_at_time->next();
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TRANSITIONTIMELINETOOL_H
|
||||
#define TRANSITIONTIMELINETOOL_H
|
||||
#ifndef OAK_TRANSITIONTIMELINETOOL_H
|
||||
#define OAK_TRANSITIONTIMELINETOOL_H
|
||||
|
||||
#include "add.h"
|
||||
|
||||
@@ -31,21 +31,21 @@ class TransitionTool : public AddTool {
|
||||
public:
|
||||
TransitionTool(TimelineWidget *parent);
|
||||
|
||||
virtual void HoverMove(TimelineViewMouseEvent *event) override;
|
||||
virtual void hover_move(TimelineViewMouseEvent *event) override;
|
||||
|
||||
virtual void MousePress(TimelineViewMouseEvent *event) override;
|
||||
virtual void MouseMove(TimelineViewMouseEvent *event) override;
|
||||
virtual void MouseRelease(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_press(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_move(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_release(TimelineViewMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
bool GetBlocksAtCoord(const TimelineCoordinate &coord, ClipBlock **primary,
|
||||
bool get_blocks_at_coord(const TimelineCoordinate &coord, ClipBlock **primary,
|
||||
ClipBlock **secondary,
|
||||
Timeline::MovementMode *trim_mode,
|
||||
rational *start_point);
|
||||
Rational *start_point);
|
||||
|
||||
bool dual_transition_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TRANSITIONTIMELINETOOL_H
|
||||
#endif // OAK_TRANSITIONTIMELINETOOL_H
|
||||
|
||||
@@ -30,37 +30,37 @@ ZoomTool::ZoomTool(TimelineWidget *parent)
|
||||
{
|
||||
}
|
||||
|
||||
void ZoomTool::MousePress(TimelineViewMouseEvent *event)
|
||||
void ZoomTool::mouse_press(TimelineViewMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
||||
drag_global_start_ = QCursor::pos();
|
||||
}
|
||||
|
||||
void ZoomTool::MouseMove(TimelineViewMouseEvent *event)
|
||||
void ZoomTool::mouse_move(TimelineViewMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
||||
if (!dragging_) {
|
||||
parent()->StartRubberBandSelect(drag_global_start_);
|
||||
parent()->start_rubber_band_select(drag_global_start_);
|
||||
|
||||
dragging_ = true;
|
||||
}
|
||||
|
||||
parent()->MoveRubberBandSelect(false, false);
|
||||
parent()->move_rubber_band_select(false, false);
|
||||
}
|
||||
|
||||
void ZoomTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
void ZoomTool::mouse_release(TimelineViewMouseEvent *event)
|
||||
{
|
||||
int scroll_value;
|
||||
|
||||
if (dragging_) {
|
||||
// Zoom into the rubberband selection
|
||||
QRect screen_coords = parent()->GetRubberBandGeometry();
|
||||
QRect screen_coords = parent()->get_rubber_band_geometry();
|
||||
|
||||
parent()->EndRubberBandSelect();
|
||||
parent()->end_rubber_band_select();
|
||||
|
||||
TimelineView *reference_view = parent()->GetFirstTimelineView();
|
||||
TimelineView *reference_view = parent()->get_first_timeline_view();
|
||||
QPointF scene_topleft = reference_view->mapToScene(
|
||||
reference_view->mapFrom(parent(), screen_coords.topLeft()));
|
||||
QPointF scene_bottomright = reference_view->mapToScene(
|
||||
@@ -70,24 +70,24 @@ void ZoomTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
double scene_right = scene_bottomright.x();
|
||||
|
||||
// Normalize scale to 1.0 scale
|
||||
double scene_width = (scene_right - scene_left) / parent()->GetScale();
|
||||
double scene_width = (scene_right - scene_left) / parent()->get_scale();
|
||||
|
||||
double new_scale =
|
||||
qMin(parent()->GetFirstTimelineView()->GetMaximumScale(),
|
||||
qMin(parent()->get_first_timeline_view()->get_maximum_scale(),
|
||||
static_cast<double>(reference_view->viewport()->width()) /
|
||||
scene_width);
|
||||
|
||||
parent()->SetScale(new_scale);
|
||||
|
||||
scroll_value =
|
||||
qMax(0, qRound(scene_left / parent()->GetScale() * new_scale));
|
||||
qMax(0, qRound(scene_left / parent()->get_scale() * new_scale));
|
||||
|
||||
dragging_ = false;
|
||||
} else {
|
||||
// Simple zoom in/out at the cursor position
|
||||
double scale = parent()->GetScale();
|
||||
double scale = parent()->get_scale();
|
||||
|
||||
if (event->GetModifiers() & Qt::AltModifier) {
|
||||
if (event->get_modifiers() & Qt::AltModifier) {
|
||||
// Zoom out if the user clicks while holding Alt
|
||||
scale *= 0.5;
|
||||
} else {
|
||||
@@ -98,15 +98,15 @@ void ZoomTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
parent()->SetScale(scale);
|
||||
|
||||
// Adjust scroll location for new scale
|
||||
double frame_x = event->GetFrame().toDouble() * scale;
|
||||
double frame_x = event->get_frame().to_double() * scale;
|
||||
|
||||
scroll_value = qMax(
|
||||
0,
|
||||
qRound(frame_x -
|
||||
parent()->GetFirstTimelineView()->viewport()->width() / 2));
|
||||
parent()->get_first_timeline_view()->viewport()->width() / 2));
|
||||
}
|
||||
|
||||
parent()->QueueScroll(scroll_value);
|
||||
parent()->queue_scroll(scroll_value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef ZOOMTIMELINETOOL_H
|
||||
#define ZOOMTIMELINETOOL_H
|
||||
#ifndef OAK_ZOOMTIMELINETOOL_H
|
||||
#define OAK_ZOOMTIMELINETOOL_H
|
||||
|
||||
#include "tool.h"
|
||||
|
||||
@@ -31,9 +31,9 @@ class ZoomTool : public TimelineTool {
|
||||
public:
|
||||
ZoomTool(TimelineWidget *parent);
|
||||
|
||||
virtual void MousePress(TimelineViewMouseEvent *event) override;
|
||||
virtual void MouseMove(TimelineViewMouseEvent *event) override;
|
||||
virtual void MouseRelease(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_press(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_move(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_release(TimelineViewMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
QPoint drag_global_start_;
|
||||
@@ -41,4 +41,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // ZOOMTIMELINETOOL_H
|
||||
#endif // OAK_ZOOMTIMELINETOOL_H
|
||||
|
||||
Reference in New Issue
Block a user