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:
@@ -46,9 +46,9 @@ TimelineAndTrackView::TimelineAndTrackView(Qt::Alignment vertical_alignment,
|
||||
splitter_->addWidget(view_);
|
||||
|
||||
connect(view_->verticalScrollBar(), &QScrollBar::valueChanged, this,
|
||||
&TimelineAndTrackView::ViewValueChanged);
|
||||
&TimelineAndTrackView::view_value_changed);
|
||||
connect(track_view_->verticalScrollBar(), &QScrollBar::valueChanged, this,
|
||||
&TimelineAndTrackView::TracksValueChanged);
|
||||
&TimelineAndTrackView::tracks_value_changed);
|
||||
|
||||
splitter_->setSizes({ 1, width() });
|
||||
}
|
||||
@@ -68,13 +68,13 @@ TrackView *TimelineAndTrackView::track_view() const
|
||||
return track_view_;
|
||||
}
|
||||
|
||||
void TimelineAndTrackView::ViewValueChanged(int v)
|
||||
void TimelineAndTrackView::view_value_changed(int v)
|
||||
{
|
||||
track_view_->verticalScrollBar()->setValue(
|
||||
v - view_->verticalScrollBar()->minimum());
|
||||
}
|
||||
|
||||
void TimelineAndTrackView::TracksValueChanged(int v)
|
||||
void TimelineAndTrackView::tracks_value_changed(int v)
|
||||
{
|
||||
view_->verticalScrollBar()->setValue(view_->verticalScrollBar()->minimum() +
|
||||
v);
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMELINEANDTRACKVIEW_H
|
||||
#define TIMELINEANDTRACKVIEW_H
|
||||
#ifndef OAK_TIMELINEANDTRACKVIEW_H
|
||||
#define OAK_TIMELINEANDTRACKVIEW_H
|
||||
|
||||
#include <QSplitter>
|
||||
#include <QWidget>
|
||||
@@ -50,11 +50,11 @@ private:
|
||||
TrackView *track_view_;
|
||||
|
||||
private slots:
|
||||
void ViewValueChanged(int v);
|
||||
void view_value_changed(int v);
|
||||
|
||||
void TracksValueChanged(int v);
|
||||
void tracks_value_changed(int v);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TIMELINEANDTRACKVIEW_H
|
||||
#endif // OAK_TIMELINEANDTRACKVIEW_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMELINEWIDGET_H
|
||||
#define TIMELINEWIDGET_H
|
||||
#ifndef OAK_TIMELINEWIDGET_H
|
||||
#define OAK_TIMELINEWIDGET_H
|
||||
|
||||
#include <QScrollBar>
|
||||
#include <QRubberBand>
|
||||
@@ -53,103 +53,103 @@ public:
|
||||
|
||||
virtual ~TimelineWidget() override;
|
||||
|
||||
void Clear();
|
||||
void clear();
|
||||
|
||||
void SelectAll();
|
||||
void select_all();
|
||||
|
||||
void DeselectAll();
|
||||
void deselect_all();
|
||||
|
||||
void RippleToIn();
|
||||
void ripple_to_in();
|
||||
|
||||
void RippleToOut();
|
||||
void ripple_to_out();
|
||||
|
||||
void EditToIn();
|
||||
void edit_to_in();
|
||||
|
||||
void EditToOut();
|
||||
void edit_to_out();
|
||||
|
||||
void SplitAtPlayhead();
|
||||
void split_at_playhead();
|
||||
|
||||
void DeleteSelected(bool ripple = false);
|
||||
|
||||
void IncreaseTrackHeight();
|
||||
void increase_track_height();
|
||||
|
||||
void DecreaseTrackHeight();
|
||||
void decrease_track_height();
|
||||
|
||||
void InsertFootageAtPlayhead(const QVector<ViewerOutput *> &footage);
|
||||
void insert_footage_at_playhead(const QVector<ViewerOutput *> &footage);
|
||||
|
||||
void OverwriteFootageAtPlayhead(const QVector<ViewerOutput *> &footage);
|
||||
void overwrite_footage_at_playhead(const QVector<ViewerOutput *> &footage);
|
||||
|
||||
void ToggleLinksOnSelected();
|
||||
void toggle_links_on_selected();
|
||||
|
||||
void AddDefaultTransitionsToSelected();
|
||||
void add_default_transitions_to_selected();
|
||||
|
||||
virtual bool CopySelected(bool cut) override;
|
||||
virtual bool copy_selected(bool cut) override;
|
||||
|
||||
virtual bool Paste() override;
|
||||
virtual bool paste() override;
|
||||
|
||||
void PasteInsert();
|
||||
void paste_insert();
|
||||
|
||||
void DeleteInToOut(bool ripple);
|
||||
void delete_in_to_out(bool ripple);
|
||||
|
||||
void ToggleSelectedEnabled();
|
||||
void toggle_selected_enabled();
|
||||
|
||||
void SetColorLabel(int index);
|
||||
void set_color_label(int index);
|
||||
|
||||
void NudgeLeft();
|
||||
void nudge_left();
|
||||
|
||||
void NudgeRight();
|
||||
void nudge_right();
|
||||
|
||||
void MoveInToPlayhead();
|
||||
void move_in_to_playhead();
|
||||
|
||||
void MoveOutToPlayhead();
|
||||
void move_out_to_playhead();
|
||||
|
||||
void ShowSpeedDurationDialogForSelectedClips();
|
||||
void show_speed_duration_dialog_for_selected_clips();
|
||||
|
||||
void SynchronizeSelectedClipsBySourceTime();
|
||||
void synchronize_selected_clips_by_source_time();
|
||||
|
||||
void SynchronizeSelectedClipsByWaveform();
|
||||
void synchronize_selected_clips_by_waveform();
|
||||
|
||||
void SynchronizeSelectedClipsByWaveformWithSpeed();
|
||||
void synchronize_selected_clips_by_waveform_with_speed();
|
||||
|
||||
void GenerateProxiesForSelectedClips();
|
||||
void generate_proxies_for_selected_clips();
|
||||
|
||||
void SetSelectedClipsProxyEnabled(bool enabled);
|
||||
void set_selected_clips_proxy_enabled(bool enabled);
|
||||
|
||||
void RevealProxyForSelectedClips();
|
||||
void reveal_proxy_for_selected_clips();
|
||||
|
||||
void DeleteProxiesForSelectedClips();
|
||||
void delete_proxies_for_selected_clips();
|
||||
|
||||
void ShowProxyDialogForSelectedClips();
|
||||
void show_proxy_dialog_for_selected_clips();
|
||||
|
||||
void RecordingCallback(const QString &filename, const TimeRange &time,
|
||||
void recording_callback(const QString &filename, const TimeRange &time,
|
||||
const Track::Reference &track);
|
||||
|
||||
void EnableRecordingOverlay(const TimelineCoordinate &coord);
|
||||
void enable_recording_overlay(const TimelineCoordinate &coord);
|
||||
|
||||
void DisableRecordingOverlay();
|
||||
void disable_recording_overlay();
|
||||
|
||||
void AddTentativeSubtitleTrack();
|
||||
void add_tentative_subtitle_track();
|
||||
|
||||
void NestSelectedClips();
|
||||
void nest_selected_clips();
|
||||
|
||||
/**
|
||||
* @brief Timelines should always be connected to sequences
|
||||
*/
|
||||
Sequence *sequence() const
|
||||
{
|
||||
return static_cast<Sequence *>(GetConnectedNode());
|
||||
return static_cast<Sequence *>(get_connected_node());
|
||||
}
|
||||
|
||||
const QVector<Block *> &GetSelectedBlocks() const
|
||||
const QVector<Block *> &get_selected_blocks() const
|
||||
{
|
||||
return selected_blocks_;
|
||||
}
|
||||
|
||||
QByteArray SaveSplitterState() const;
|
||||
QByteArray save_splitter_state() const;
|
||||
|
||||
void RestoreSplitterState(const QByteArray &state);
|
||||
void restore_splitter_state(const QByteArray &state);
|
||||
|
||||
static void ReplaceBlocksWithGaps(const QVector<Block *> &blocks,
|
||||
static void replace_blocks_with_gaps(const QVector<Block *> &blocks,
|
||||
bool remove_from_graph,
|
||||
MultiUndoCommand *command,
|
||||
bool handle_transitions = true);
|
||||
@@ -160,65 +160,65 @@ public:
|
||||
* Requires a float-based scene position. If you have a screen position, use GetScenePos() first to convert it to a
|
||||
* scene position
|
||||
*/
|
||||
Block *GetItemAtScenePos(const TimelineCoordinate &coord);
|
||||
Block *get_item_at_scene_pos(const TimelineCoordinate &coord);
|
||||
|
||||
void AddSelection(const TimeRange &time, const Track::Reference &track);
|
||||
void AddSelection(Block *item);
|
||||
void add_selection(const TimeRange &time, const Track::Reference &track);
|
||||
void add_selection(Block *item);
|
||||
|
||||
void RemoveSelection(const TimeRange &time, const Track::Reference &track);
|
||||
void RemoveSelection(Block *item);
|
||||
void remove_selection(const TimeRange &time, const Track::Reference &track);
|
||||
void remove_selection(Block *item);
|
||||
|
||||
const TimelineWidgetSelections &GetSelections() const
|
||||
const TimelineWidgetSelections &get_selections() const
|
||||
{
|
||||
return selections_;
|
||||
}
|
||||
|
||||
void SetSelections(const TimelineWidgetSelections &s,
|
||||
void set_selections(const TimelineWidgetSelections &s,
|
||||
bool process_block_changes);
|
||||
|
||||
Track *GetTrackFromReference(const Track::Reference &ref) const;
|
||||
Track *get_track_from_reference(const Track::Reference &ref) const;
|
||||
|
||||
void SetViewBeamCursor(const TimelineCoordinate &coord);
|
||||
void SetViewTransitionOverlay(ClipBlock *out, ClipBlock *in);
|
||||
void set_view_beam_cursor(const TimelineCoordinate &coord);
|
||||
void set_view_transition_overlay(ClipBlock *out, ClipBlock *in);
|
||||
|
||||
const QVector<TimelineViewGhostItem *> &GetGhostItems() const
|
||||
const QVector<TimelineViewGhostItem *> &get_ghost_items() const
|
||||
{
|
||||
return ghost_items_;
|
||||
}
|
||||
|
||||
void InsertGapsAt(const rational &time, const rational &length,
|
||||
void insert_gaps_at(const Rational &time, const Rational &length,
|
||||
MultiUndoCommand *command);
|
||||
|
||||
void StartRubberBandSelect(const QPoint &global_cursor_start);
|
||||
void MoveRubberBandSelect(bool enable_selecting, bool select_links);
|
||||
void EndRubberBandSelect();
|
||||
void start_rubber_band_select(const QPoint &global_cursor_start);
|
||||
void move_rubber_band_select(bool enable_selecting, bool select_links);
|
||||
void end_rubber_band_select();
|
||||
|
||||
int GetTrackY(const Track::Reference &ref);
|
||||
int GetTrackHeight(const Track::Reference &ref);
|
||||
int get_track_y(const Track::Reference &ref);
|
||||
int get_track_height(const Track::Reference &ref);
|
||||
|
||||
void AddGhost(TimelineViewGhostItem *ghost);
|
||||
void add_ghost(TimelineViewGhostItem *ghost);
|
||||
|
||||
void ClearGhosts();
|
||||
void clear_ghosts();
|
||||
|
||||
bool HasGhosts() const
|
||||
bool has_ghosts() const
|
||||
{
|
||||
return !ghost_items_.isEmpty();
|
||||
}
|
||||
|
||||
bool IsBlockSelected(Block *b) const
|
||||
bool is_block_selected(Block *b) const
|
||||
{
|
||||
return selected_blocks_.contains(b);
|
||||
}
|
||||
|
||||
void SetBlockLinksSelected(ClipBlock *block, bool selected);
|
||||
void set_block_links_selected(ClipBlock *block, bool selected);
|
||||
|
||||
void QueueScroll(int value);
|
||||
void queue_scroll(int value);
|
||||
|
||||
TimelineView *GetFirstTimelineView();
|
||||
TimelineView *get_first_timeline_view();
|
||||
|
||||
rational GetTimebaseForTrackType(Track::Type type);
|
||||
Rational get_timebase_for_track_type(Track::Type type);
|
||||
|
||||
const QRect &GetRubberBandGeometry() const;
|
||||
const QRect &get_rubber_band_geometry() const;
|
||||
|
||||
/**
|
||||
* @brief Track blocks that have newly been selected (this is preferred over emitting BlocksSelected directly)
|
||||
@@ -236,25 +236,25 @@ public:
|
||||
* this is preferable and should only be set to FALSE if the list is guaranteed not to contain
|
||||
* already selected blocks (and therefore filtering can be skipped to save time).
|
||||
*/
|
||||
void SignalSelectedBlocks(QVector<Block *> selected_blocks,
|
||||
void signal_selected_blocks(QVector<Block *> selected_blocks,
|
||||
bool filter = true);
|
||||
|
||||
/**
|
||||
* @brief Track blocks that have been newly deselected
|
||||
*/
|
||||
void SignalDeselectedBlocks(const QVector<Block *> &deselected_blocks);
|
||||
void signal_deselected_blocks(const QVector<Block *> &deselected_blocks);
|
||||
|
||||
/**
|
||||
* @brief Convenience function to deselect all blocks and signal them
|
||||
*/
|
||||
void SignalDeselectedAllBlocks();
|
||||
void signal_deselected_all_blocks();
|
||||
|
||||
void Refresh()
|
||||
void refresh()
|
||||
{
|
||||
UpdateViewports();
|
||||
update_viewports();
|
||||
}
|
||||
|
||||
MultiUndoCommand *TakeSubtitleSectionCommand()
|
||||
MultiUndoCommand *take_subtitle_section_command()
|
||||
{
|
||||
// Copy pointer
|
||||
MultiUndoCommand *c = subtitle_show_command_;
|
||||
@@ -280,7 +280,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual Project *GetRelevantProject() const override
|
||||
virtual Project *get_relevant_project() const override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@@ -288,12 +288,12 @@ public:
|
||||
protected:
|
||||
virtual void redo() override
|
||||
{
|
||||
timeline_->SetSelections(now_, process_block_changes_);
|
||||
timeline_->set_selections(now_, process_block_changes_);
|
||||
}
|
||||
|
||||
virtual void undo() override
|
||||
{
|
||||
timeline_->SetSelections(old_, process_block_changes_);
|
||||
timeline_->set_selections(old_, process_block_changes_);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -304,30 +304,30 @@ public:
|
||||
};
|
||||
|
||||
public slots:
|
||||
void ClearTentativeSubtitleTrack();
|
||||
void clear_tentative_subtitle_track();
|
||||
|
||||
void RenameSelectedBlocks();
|
||||
void rename_selected_blocks();
|
||||
|
||||
signals:
|
||||
void BlockSelectionChanged(const QVector<Block *> &selected_blocks);
|
||||
void block_selection_changed(const QVector<Block *> &selected_blocks);
|
||||
|
||||
void RequestCaptureStart(const TimeRange &time,
|
||||
void request_capture_start(const TimeRange &time,
|
||||
const Track::Reference &track);
|
||||
|
||||
void RevealViewerInFootageViewer(ViewerOutput *r, const TimeRange &range);
|
||||
void RevealViewerInProject(ViewerOutput *r);
|
||||
void reveal_viewer_in_footage_viewer(ViewerOutput *r, const TimeRange &range);
|
||||
void reveal_viewer_in_project(ViewerOutput *r);
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
virtual void TimeChangedEvent(const rational &) override;
|
||||
virtual void TimebaseChangedEvent(const rational &) override;
|
||||
virtual void TimeChangedEvent(const Rational &) override;
|
||||
virtual void TimebaseChangedEvent(const Rational &) override;
|
||||
virtual void ScaleChangedEvent(const double &) override;
|
||||
|
||||
virtual void ConnectNodeEvent(ViewerOutput *n) override;
|
||||
virtual void DisconnectNodeEvent(ViewerOutput *n) override;
|
||||
|
||||
virtual const QVector<Block *> *GetSnapBlocks() const override
|
||||
virtual const QVector<Block *> *get_snap_blocks() const override
|
||||
{
|
||||
return &added_blocks_;
|
||||
}
|
||||
@@ -336,23 +336,23 @@ protected slots:
|
||||
virtual void SendCatchUpScrollEvent() override;
|
||||
|
||||
private:
|
||||
QVector<Timeline::EditToInfo> GetEditToInfo(const rational &playhead_time,
|
||||
QVector<Timeline::EditToInfo> get_edit_to_info(const Rational &playhead_time,
|
||||
Timeline::MovementMode mode);
|
||||
|
||||
void RippleTo(Timeline::MovementMode mode);
|
||||
void ripple_to(Timeline::MovementMode mode);
|
||||
|
||||
void EditTo(Timeline::MovementMode mode);
|
||||
void edit_to(Timeline::MovementMode mode);
|
||||
|
||||
void UpdateViewports(const Track::Type &type = Track::kNone);
|
||||
void update_viewports(const Track::Type &type = Track::k_none);
|
||||
|
||||
bool PasteInternal(bool insert);
|
||||
bool paste_internal(bool insert);
|
||||
|
||||
void SynchronizeSelectedClipsByWaveformInternal(bool allow_speed);
|
||||
void synchronize_selected_clips_by_waveform_internal(bool allow_speed);
|
||||
|
||||
TimelineAndTrackView *AddTimelineAndTrackView(Qt::Alignment alignment);
|
||||
TimelineAndTrackView *add_timeline_and_track_view(Qt::Alignment alignment);
|
||||
|
||||
QHash<Node *, Node *>
|
||||
GenerateExistingPasteMap(const ProjectSerializer::Result &r);
|
||||
generate_existing_paste_map(const ProjectSerializer::Result &r);
|
||||
|
||||
QRubberBand rubberband_;
|
||||
QVector<QPointF> rubberband_scene_pos_;
|
||||
@@ -363,7 +363,7 @@ private:
|
||||
|
||||
TimelineWidgetSelections selections_;
|
||||
|
||||
TimelineTool *GetActiveTool();
|
||||
TimelineTool *get_active_tool();
|
||||
|
||||
QVector<TimelineTool *> tools_;
|
||||
|
||||
@@ -400,7 +400,7 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
virtual Project *GetRelevantProject() const override
|
||||
virtual Project *get_relevant_project() const override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@@ -415,78 +415,78 @@ private:
|
||||
QList<int> old_sizes_;
|
||||
};
|
||||
|
||||
void CenterOn(qreal scene_pos);
|
||||
void center_on(qreal scene_pos);
|
||||
|
||||
void UpdateViewTimebases();
|
||||
void update_view_timebases();
|
||||
|
||||
void NudgeInternal(rational amount);
|
||||
void nudge_internal(Rational amount);
|
||||
|
||||
void MoveToPlayheadInternal(bool out);
|
||||
void move_to_playhead_internal(bool out);
|
||||
|
||||
private slots:
|
||||
void ViewMousePressed(TimelineViewMouseEvent *event);
|
||||
void ViewMouseMoved(TimelineViewMouseEvent *event);
|
||||
void ViewMouseReleased(TimelineViewMouseEvent *event);
|
||||
void ViewMouseDoubleClicked(TimelineViewMouseEvent *event);
|
||||
void view_mouse_pressed(TimelineViewMouseEvent *event);
|
||||
void view_mouse_moved(TimelineViewMouseEvent *event);
|
||||
void view_mouse_released(TimelineViewMouseEvent *event);
|
||||
void view_mouse_double_clicked(TimelineViewMouseEvent *event);
|
||||
|
||||
void ViewDragEntered(TimelineViewMouseEvent *event);
|
||||
void ViewDragMoved(TimelineViewMouseEvent *event);
|
||||
void ViewDragLeft(QDragLeaveEvent *event);
|
||||
void ViewDragDropped(TimelineViewMouseEvent *event);
|
||||
void view_drag_entered(TimelineViewMouseEvent *event);
|
||||
void view_drag_moved(TimelineViewMouseEvent *event);
|
||||
void view_drag_left(QDragLeaveEvent *event);
|
||||
void view_drag_dropped(TimelineViewMouseEvent *event);
|
||||
|
||||
void AddBlock(Block *block);
|
||||
void RemoveBlock(Block *blocks);
|
||||
void add_block(Block *block);
|
||||
void remove_block(Block *blocks);
|
||||
|
||||
void AddTrack(Track *track);
|
||||
void RemoveTrack(Track *track);
|
||||
void TrackUpdated();
|
||||
void add_track(Track *track);
|
||||
void remove_track(Track *track);
|
||||
void track_updated();
|
||||
|
||||
void BlockUpdated();
|
||||
void block_updated();
|
||||
|
||||
void UpdateHorizontalSplitters();
|
||||
void update_horizontal_splitters();
|
||||
|
||||
void UpdateTimecodeWidthFromSplitters(QSplitter *s);
|
||||
void update_timecode_width_from_splitters(QSplitter *s);
|
||||
|
||||
void ShowContextMenu();
|
||||
void show_context_menu();
|
||||
|
||||
void DeferredScrollAction();
|
||||
|
||||
void ShowSequenceDialog();
|
||||
void show_sequence_dialog();
|
||||
|
||||
void SetUseAudioTimeUnits(bool use);
|
||||
void set_use_audio_time_units(bool use);
|
||||
|
||||
void ToolChanged();
|
||||
void tool_changed();
|
||||
|
||||
void AddableObjectChanged();
|
||||
void addable_object_changed();
|
||||
|
||||
void SetViewWaveformsEnabled(bool e);
|
||||
void set_view_waveforms_enabled(bool e);
|
||||
|
||||
void SetViewThumbnailsEnabled(QAction *action);
|
||||
void set_view_thumbnails_enabled(QAction *action);
|
||||
|
||||
void FrameRateChanged();
|
||||
void frame_rate_changed();
|
||||
|
||||
void SampleRateChanged();
|
||||
void sample_rate_changed();
|
||||
|
||||
void TrackIndexChanged(int old, int now);
|
||||
void track_index_changed(int old, int now);
|
||||
|
||||
void SignalBlockSelectionChange();
|
||||
void signal_block_selection_change();
|
||||
|
||||
void RevealInFootageViewer();
|
||||
void RevealInProject();
|
||||
void reveal_in_footage_viewer();
|
||||
void reveal_in_project();
|
||||
|
||||
void TrackAboutToBeDeleted(Track *track);
|
||||
void track_about_to_be_deleted(Track *track);
|
||||
|
||||
void SetSelectedClipsAutocaching(bool e);
|
||||
void set_selected_clips_autocaching(bool e);
|
||||
|
||||
void CacheClips();
|
||||
void CacheClipsInOut();
|
||||
void CacheDiscard();
|
||||
void cache_clips();
|
||||
void cache_clips_in_out();
|
||||
void cache_discard();
|
||||
|
||||
void MulticamEnabledTriggered(bool e);
|
||||
void multicam_enabled_triggered(bool e);
|
||||
|
||||
void ForceUpdateRubberBand();
|
||||
void force_update_rubber_band();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TIMELINEWIDGET_H
|
||||
#endif // OAK_TIMELINEWIDGET_H
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
namespace olive
|
||||
{
|
||||
|
||||
void TimelineWidgetSelections::ShiftTime(const rational &diff)
|
||||
void TimelineWidgetSelections::shift_time(const Rational &diff)
|
||||
{
|
||||
for (auto it = this->begin(); it != this->end(); it++) {
|
||||
it.value().shift(diff);
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineWidgetSelections::ShiftTracks(Track::Type type, int diff)
|
||||
void TimelineWidgetSelections::shift_tracks(Track::Type type, int diff)
|
||||
{
|
||||
TimelineWidgetSelections cached_selections;
|
||||
|
||||
@@ -57,21 +57,21 @@ void TimelineWidgetSelections::ShiftTracks(Track::Type type, int diff)
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineWidgetSelections::TrimIn(const rational &diff)
|
||||
void TimelineWidgetSelections::trim_in(const Rational &diff)
|
||||
{
|
||||
for (auto it = this->begin(); it != this->end(); it++) {
|
||||
it.value().trim_in(diff);
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineWidgetSelections::TrimOut(const rational &diff)
|
||||
void TimelineWidgetSelections::trim_out(const Rational &diff)
|
||||
{
|
||||
for (auto it = this->begin(); it != this->end(); it++) {
|
||||
it.value().trim_out(diff);
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineWidgetSelections::Subtract(
|
||||
void TimelineWidgetSelections::subtract(
|
||||
const TimelineWidgetSelections &selections)
|
||||
{
|
||||
for (auto it = selections.cbegin(); it != selections.cend(); it++) {
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMELINEWIDGETSELECTIONS_H
|
||||
#define TIMELINEWIDGETSELECTIONS_H
|
||||
#ifndef OAK_TIMELINEWIDGETSELECTIONS_H
|
||||
#define OAK_TIMELINEWIDGETSELECTIONS_H
|
||||
|
||||
#include <QHash>
|
||||
|
||||
@@ -33,25 +33,25 @@ class TimelineWidgetSelections : public QHash<Track::Reference, TimeRangeList> {
|
||||
public:
|
||||
TimelineWidgetSelections() = default;
|
||||
|
||||
void ShiftTime(const rational &diff);
|
||||
void shift_time(const Rational &diff);
|
||||
|
||||
void ShiftTracks(Track::Type type, int diff);
|
||||
void shift_tracks(Track::Type type, int diff);
|
||||
|
||||
void TrimIn(const rational &diff);
|
||||
void trim_in(const Rational &diff);
|
||||
|
||||
void TrimOut(const rational &diff);
|
||||
void trim_out(const Rational &diff);
|
||||
|
||||
void Subtract(const TimelineWidgetSelections &selections);
|
||||
void subtract(const TimelineWidgetSelections &selections);
|
||||
|
||||
TimelineWidgetSelections
|
||||
Subtracted(const TimelineWidgetSelections &selections) const
|
||||
subtracted(const TimelineWidgetSelections &selections) const
|
||||
{
|
||||
TimelineWidgetSelections copy = *this;
|
||||
copy.Subtract(selections);
|
||||
copy.subtract(selections);
|
||||
return copy;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TIMELINEWIDGETSELECTIONS_H
|
||||
#endif // OAK_TIMELINEWIDGETSELECTIONS_H
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
namespace olive
|
||||
{
|
||||
|
||||
namespace TimelineWaveformSync
|
||||
namespace timeline_waveform_sync
|
||||
{
|
||||
|
||||
bool GetWaveformSyncClip(Block *block, WaveformSyncClip *out)
|
||||
bool get_waveform_sync_clip(Block *block, WaveformSyncClip *out)
|
||||
{
|
||||
ClipBlock *clip = dynamic_cast<ClipBlock *>(block);
|
||||
if (!clip || !clip->waveform()) {
|
||||
@@ -45,7 +45,7 @@ bool GetWaveformSyncClip(Block *block, WaveformSyncClip *out)
|
||||
}
|
||||
|
||||
const AudioWaveformCache *waveform = clip->waveform();
|
||||
if (waveform->GetParameters().sample_rate() <= 0) {
|
||||
if (waveform->get_parameters().sample_rate() <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ bool GetWaveformSyncClip(Block *block, WaveformSyncClip *out)
|
||||
// validated makes the menu item stay disabled for long clips and gives
|
||||
// the appearance that "nothing happens" when the user tries to sync.
|
||||
const TimeRangeList validated_ranges =
|
||||
waveform->GetValidatedRanges().Intersects(media_range);
|
||||
waveform->get_validated_ranges().intersects(media_range);
|
||||
if (validated_ranges.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -62,24 +62,24 @@ bool GetWaveformSyncClip(Block *block, WaveformSyncClip *out)
|
||||
out->clip = clip;
|
||||
out->waveform = waveform;
|
||||
out->media_range = media_range;
|
||||
out->sample_rate = waveform->GetParameters().sample_rate();
|
||||
out->sample_rate = waveform->get_parameters().sample_rate();
|
||||
return true;
|
||||
}
|
||||
|
||||
QVector<WaveformSyncClip>
|
||||
GetSelectedWaveformSyncClips(const QVector<Block *> &blocks)
|
||||
get_selected_waveform_sync_clips(const QVector<Block *> &blocks)
|
||||
{
|
||||
QVector<WaveformSyncClip> clips;
|
||||
for (Block *block : blocks) {
|
||||
WaveformSyncClip sync_clip;
|
||||
if (GetWaveformSyncClip(block, &sync_clip)) {
|
||||
if (get_waveform_sync_clip(block, &sync_clip)) {
|
||||
clips.append(sync_clip);
|
||||
}
|
||||
}
|
||||
return clips;
|
||||
}
|
||||
|
||||
QVector<double> ExtractWaveformCacheEnvelope(const WaveformSyncClip &clip,
|
||||
QVector<double> extract_waveform_cache_envelope(const WaveformSyncClip &clip,
|
||||
int sample_rate,
|
||||
size_t window_samples,
|
||||
QVector<bool> *valid_mask)
|
||||
@@ -93,7 +93,7 @@ QVector<double> ExtractWaveformCacheEnvelope(const WaveformSyncClip &clip,
|
||||
valid_mask->clear();
|
||||
}
|
||||
|
||||
const rational window_time(static_cast<int>(window_samples), sample_rate);
|
||||
const Rational window_time(static_cast<int>(window_samples), sample_rate);
|
||||
|
||||
// Only trust regions that have actually been validated. Unvalidated cache
|
||||
// returns zero samples, which both drags the correlation score down and
|
||||
@@ -102,11 +102,11 @@ QVector<double> ExtractWaveformCacheEnvelope(const WaveformSyncClip &clip,
|
||||
// absolute timeline, while the validity mask lets the correlation skip
|
||||
// those placeholders entirely.
|
||||
const TimeRangeList validated_ranges =
|
||||
clip.waveform->GetValidatedRanges().Intersects(clip.media_range);
|
||||
clip.waveform->get_validated_ranges().intersects(clip.media_range);
|
||||
|
||||
for (rational t = clip.media_range.in(); t < clip.media_range.out();
|
||||
for (Rational t = clip.media_range.in(); t < clip.media_range.out();
|
||||
t += window_time) {
|
||||
const rational length = qMin(window_time, clip.media_range.out() - t);
|
||||
const Rational length = qMin(window_time, clip.media_range.out() - t);
|
||||
const TimeRange window(t, t + length);
|
||||
|
||||
const bool window_valid = validated_ranges.contains(window);
|
||||
@@ -114,7 +114,7 @@ QVector<double> ExtractWaveformCacheEnvelope(const WaveformSyncClip &clip,
|
||||
double peak = 0.0;
|
||||
if (window_valid) {
|
||||
const AudioVisualWaveform::Sample summary =
|
||||
clip.waveform->GetSummaryFromTime(t, length);
|
||||
clip.waveform->get_summary_from_time(t, length);
|
||||
|
||||
for (const AudioVisualWaveform::SamplePerChannel &channel :
|
||||
summary) {
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMELINEWIDGETWAVEFORMSYNC_H
|
||||
#define TIMELINEWIDGETWAVEFORMSYNC_H
|
||||
#ifndef OAK_TIMELINEWIDGETWAVEFORMSYNC_H
|
||||
#define OAK_TIMELINEWIDGETWAVEFORMSYNC_H
|
||||
|
||||
#include <QVector>
|
||||
|
||||
@@ -49,7 +49,7 @@ struct WaveformSyncClip {
|
||||
*
|
||||
* Kept in a separate unit so they can be exercised directly by unit tests.
|
||||
*/
|
||||
namespace TimelineWaveformSync
|
||||
namespace timeline_waveform_sync
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -59,13 +59,13 @@ namespace TimelineWaveformSync
|
||||
* has been validated in the waveform cache. Previously the whole range had to
|
||||
* be validated, which made the context-menu action unavailable for long clips.
|
||||
*/
|
||||
bool GetWaveformSyncClip(Block *block, WaveformSyncClip *out);
|
||||
bool get_waveform_sync_clip(Block *block, WaveformSyncClip *out);
|
||||
|
||||
/**
|
||||
* @brief Return all selected blocks that can be synchronized by waveform.
|
||||
*/
|
||||
QVector<WaveformSyncClip>
|
||||
GetSelectedWaveformSyncClips(const QVector<Block *> &blocks);
|
||||
get_selected_waveform_sync_clips(const QVector<Block *> &blocks);
|
||||
|
||||
/**
|
||||
* @brief Extract a peak envelope from the validated regions of a waveform cache.
|
||||
@@ -76,7 +76,7 @@ GetSelectedWaveformSyncClips(const QVector<Block *> &blocks);
|
||||
* actually cached, allowing the correlation to skip uncached regions instead
|
||||
* of treating them as silence.
|
||||
*/
|
||||
QVector<double> ExtractWaveformCacheEnvelope(const WaveformSyncClip &clip,
|
||||
QVector<double> extract_waveform_cache_envelope(const WaveformSyncClip &clip,
|
||||
int sample_rate,
|
||||
size_t window_samples,
|
||||
QVector<bool> *valid_mask = nullptr);
|
||||
@@ -85,4 +85,4 @@ QVector<double> ExtractWaveformCacheEnvelope(const WaveformSyncClip &clip,
|
||||
|
||||
} // namespace olive
|
||||
|
||||
#endif // TIMELINEWIDGETWAVEFORMSYNC_H
|
||||
#endif // OAK_TIMELINEWIDGETWAVEFORMSYNC_H
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -51,7 +51,7 @@ TrackView::TrackView(Qt::Alignment vertical_alignment, QWidget *parent)
|
||||
layout->addStretch();
|
||||
|
||||
connect(verticalScrollBar(), &QScrollBar::rangeChanged, this,
|
||||
&TrackView::ScrollbarRangeChanged);
|
||||
&TrackView::scrollbar_range_changed);
|
||||
last_scrollbar_max_ = verticalScrollBar()->maximum();
|
||||
}
|
||||
|
||||
@@ -63,51 +63,51 @@ TrackView::TrackView(Qt::Alignment vertical_alignment, QWidget *parent)
|
||||
layout->addStretch();
|
||||
}
|
||||
|
||||
connect(splitter_, &TrackViewSplitter::TrackHeightChanged, this,
|
||||
&TrackView::TrackHeightChanged);
|
||||
connect(splitter_, &TrackViewSplitter::track_height_changed, this,
|
||||
&TrackView::track_height_changed);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
}
|
||||
|
||||
void TrackView::ConnectTrackList(TrackList *list)
|
||||
void TrackView::connect_track_list(TrackList *list)
|
||||
{
|
||||
if (list_ != nullptr) {
|
||||
// Remove tracks
|
||||
for (int i = 0; i < list_->GetTrackCount(); i++) {
|
||||
splitter_->Remove(0);
|
||||
for (int i = 0; i < list_->get_track_count(); i++) {
|
||||
splitter_->remove(0);
|
||||
}
|
||||
|
||||
disconnect(list_, &TrackList::TrackAdded, this,
|
||||
&TrackView::InsertTrack);
|
||||
disconnect(list_, &TrackList::TrackRemoved, this,
|
||||
&TrackView::RemoveTrack);
|
||||
disconnect(list_, &TrackList::track_added, this,
|
||||
&TrackView::insert_track);
|
||||
disconnect(list_, &TrackList::track_removed, this,
|
||||
&TrackView::remove_track);
|
||||
}
|
||||
|
||||
list_ = list;
|
||||
|
||||
if (list_ != nullptr) {
|
||||
foreach (Track *track, list_->GetTracks()) {
|
||||
InsertTrack(track);
|
||||
foreach (Track *track, list_->get_tracks()) {
|
||||
insert_track(track);
|
||||
}
|
||||
|
||||
connect(list_, &TrackList::TrackAdded, this, &TrackView::InsertTrack);
|
||||
connect(list_, &TrackList::TrackRemoved, this, &TrackView::RemoveTrack);
|
||||
connect(list_, &TrackList::track_added, this, &TrackView::insert_track);
|
||||
connect(list_, &TrackList::track_removed, this, &TrackView::remove_track);
|
||||
}
|
||||
}
|
||||
|
||||
void TrackView::DisconnectTrackList()
|
||||
void TrackView::disconnect_track_list()
|
||||
{
|
||||
ConnectTrackList(nullptr);
|
||||
connect_track_list(nullptr);
|
||||
}
|
||||
|
||||
void TrackView::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
QScrollArea::resizeEvent(e);
|
||||
|
||||
splitter_->SetSpacerHeight(height() / 2);
|
||||
splitter_->set_spacer_height(height() / 2);
|
||||
}
|
||||
|
||||
void TrackView::ScrollbarRangeChanged(int, int max)
|
||||
void TrackView::scrollbar_range_changed(int, int max)
|
||||
{
|
||||
if (max != last_scrollbar_max_) {
|
||||
int ba_val = last_scrollbar_max_ - verticalScrollBar()->value();
|
||||
@@ -120,24 +120,24 @@ void TrackView::ScrollbarRangeChanged(int, int max)
|
||||
}
|
||||
}
|
||||
|
||||
void TrackView::TrackHeightChanged(int index, int height)
|
||||
void TrackView::track_height_changed(int index, int height)
|
||||
{
|
||||
list_->GetTrackAt(index)->SetTrackHeightInPixels(height);
|
||||
list_->get_track_at(index)->set_track_height_in_pixels(height);
|
||||
}
|
||||
|
||||
void TrackView::InsertTrack(Track *track)
|
||||
void TrackView::insert_track(Track *track)
|
||||
{
|
||||
TrackViewItem *tvi = new TrackViewItem(track);
|
||||
|
||||
connect(tvi, &TrackViewItem::AboutToDeleteTrack, this,
|
||||
&TrackView::AboutToDeleteTrack);
|
||||
connect(tvi, &TrackViewItem::about_to_delete_track, this,
|
||||
&TrackView::about_to_delete_track);
|
||||
|
||||
splitter_->Insert(track->Index(), track->GetTrackHeightInPixels(), tvi);
|
||||
splitter_->insert(track->index(), track->get_track_height_in_pixels(), tvi);
|
||||
}
|
||||
|
||||
void TrackView::RemoveTrack(Track *track)
|
||||
void TrackView::remove_track(Track *track)
|
||||
{
|
||||
splitter_->Remove(track->Index());
|
||||
splitter_->remove(track->index());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TRACKVIEW_H
|
||||
#define TRACKVIEW_H
|
||||
#ifndef OAK_TRACKVIEW_H
|
||||
#define OAK_TRACKVIEW_H
|
||||
|
||||
#include <QScrollArea>
|
||||
#include <QSplitter>
|
||||
@@ -38,11 +38,11 @@ public:
|
||||
TrackView(Qt::Alignment vertical_alignment = Qt::AlignTop,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
void ConnectTrackList(TrackList *list);
|
||||
void DisconnectTrackList();
|
||||
void connect_track_list(TrackList *list);
|
||||
void disconnect_track_list();
|
||||
|
||||
signals:
|
||||
void AboutToDeleteTrack(Track *track);
|
||||
void about_to_delete_track(Track *track);
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QResizeEvent *e) override;
|
||||
@@ -57,15 +57,15 @@ private:
|
||||
int last_scrollbar_max_;
|
||||
|
||||
private slots:
|
||||
void ScrollbarRangeChanged(int min, int max);
|
||||
void scrollbar_range_changed(int min, int max);
|
||||
|
||||
void TrackHeightChanged(int index, int height);
|
||||
void track_height_changed(int index, int height);
|
||||
|
||||
void InsertTrack(Track *track);
|
||||
void insert_track(Track *track);
|
||||
|
||||
void RemoveTrack(Track *track);
|
||||
void remove_track(Track *track);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TRACKVIEW_H
|
||||
#endif // OAK_TRACKVIEW_H
|
||||
|
||||
@@ -48,49 +48,49 @@ TrackViewItem::TrackViewItem(Track *track, QWidget *parent)
|
||||
layout->addWidget(stack_);
|
||||
|
||||
label_ = new ClickableLabel();
|
||||
connect(label_, &ClickableLabel::MouseDoubleClicked, this,
|
||||
&TrackViewItem::LabelClicked);
|
||||
connect(track_, &Track::LabelChanged, this, &TrackViewItem::UpdateLabel);
|
||||
connect(track_, &Track::IndexChanged, this, &TrackViewItem::UpdateLabel);
|
||||
UpdateLabel();
|
||||
connect(label_, &ClickableLabel::mouse_double_clicked, this,
|
||||
&TrackViewItem::label_clicked);
|
||||
connect(track_, &Track::label_changed, this, &TrackViewItem::update_label);
|
||||
connect(track_, &Track::index_changed, this, &TrackViewItem::update_label);
|
||||
update_label();
|
||||
stack_->addWidget(label_);
|
||||
|
||||
line_edit_ = new FocusableLineEdit();
|
||||
connect(line_edit_, &FocusableLineEdit::Confirmed, this,
|
||||
&TrackViewItem::LineEditConfirmed);
|
||||
connect(line_edit_, &FocusableLineEdit::Cancelled, this,
|
||||
&TrackViewItem::LineEditCancelled);
|
||||
connect(line_edit_, &FocusableLineEdit::confirmed, this,
|
||||
&TrackViewItem::line_edit_confirmed);
|
||||
connect(line_edit_, &FocusableLineEdit::cancelled, this,
|
||||
&TrackViewItem::line_edit_cancelled);
|
||||
stack_->addWidget(line_edit_);
|
||||
|
||||
mute_button_ = CreateMSLButton(Qt::red);
|
||||
mute_button_->setChecked(track->IsMuted());
|
||||
UpdateMuteButton(track->IsMuted());
|
||||
connect(mute_button_, &QPushButton::toggled, track_, &Track::SetMuted);
|
||||
mute_button_ = create_msl_button(Qt::red);
|
||||
mute_button_->setChecked(track->is_muted());
|
||||
update_mute_button(track->is_muted());
|
||||
connect(mute_button_, &QPushButton::toggled, track_, &Track::set_muted);
|
||||
connect(mute_button_, &QPushButton::toggled, this,
|
||||
&TrackViewItem::UpdateMuteButton);
|
||||
&TrackViewItem::update_mute_button);
|
||||
layout->addWidget(mute_button_);
|
||||
|
||||
/*solo_button_ = CreateMSLButton(tr("S"), Qt::yellow);
|
||||
layout->addWidget(solo_button_);*/
|
||||
|
||||
lock_button_ = CreateMSLButton(Qt::gray);
|
||||
lock_button_->setChecked(track->IsLocked());
|
||||
UpdateLockButton(track->IsLocked());
|
||||
connect(lock_button_, &QPushButton::toggled, track_, &Track::SetLocked);
|
||||
lock_button_ = create_msl_button(Qt::gray);
|
||||
lock_button_->setChecked(track->is_locked());
|
||||
update_lock_button(track->is_locked());
|
||||
connect(lock_button_, &QPushButton::toggled, track_, &Track::set_locked);
|
||||
connect(lock_button_, &QPushButton::toggled, this,
|
||||
&TrackViewItem::UpdateLockButton);
|
||||
&TrackViewItem::update_lock_button);
|
||||
layout->addWidget(lock_button_);
|
||||
|
||||
setMinimumHeight(mute_button_->height());
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
connect(track, &Track::MutedChanged, mute_button_,
|
||||
connect(track, &Track::muted_changed, mute_button_,
|
||||
&QPushButton::setChecked);
|
||||
connect(this, &QWidget::customContextMenuRequested, this,
|
||||
&TrackViewItem::ShowContextMenu);
|
||||
&TrackViewItem::show_context_menu);
|
||||
}
|
||||
|
||||
QPushButton *TrackViewItem::CreateMSLButton(const QColor &checked_color) const
|
||||
QPushButton *TrackViewItem::create_msl_button(const QColor &checked_color) const
|
||||
{
|
||||
QPushButton *button = new QPushButton();
|
||||
button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||
@@ -106,26 +106,26 @@ QPushButton *TrackViewItem::CreateMSLButton(const QColor &checked_color) const
|
||||
return button;
|
||||
}
|
||||
|
||||
void TrackViewItem::LabelClicked()
|
||||
void TrackViewItem::label_clicked()
|
||||
{
|
||||
stack_->setCurrentWidget(line_edit_);
|
||||
line_edit_->setFocus();
|
||||
line_edit_->selectAll();
|
||||
}
|
||||
|
||||
void TrackViewItem::LineEditConfirmed()
|
||||
void TrackViewItem::line_edit_confirmed()
|
||||
{
|
||||
line_edit_->blockSignals(true);
|
||||
|
||||
track_->SetLabel(line_edit_->text());
|
||||
UpdateLabel();
|
||||
track_->set_label(line_edit_->text());
|
||||
update_label();
|
||||
|
||||
stack_->setCurrentWidget(label_);
|
||||
|
||||
line_edit_->blockSignals(false);
|
||||
}
|
||||
|
||||
void TrackViewItem::LineEditCancelled()
|
||||
void TrackViewItem::line_edit_cancelled()
|
||||
{
|
||||
line_edit_->blockSignals(true);
|
||||
|
||||
@@ -134,46 +134,46 @@ void TrackViewItem::LineEditCancelled()
|
||||
line_edit_->blockSignals(false);
|
||||
}
|
||||
|
||||
void TrackViewItem::UpdateLabel()
|
||||
void TrackViewItem::update_label()
|
||||
{
|
||||
label_->setText(track_->GetLabelOrName());
|
||||
label_->setText(track_->get_label_or_name());
|
||||
}
|
||||
|
||||
void TrackViewItem::ShowContextMenu(const QPoint &p)
|
||||
void TrackViewItem::show_context_menu(const QPoint &p)
|
||||
{
|
||||
Menu m(this);
|
||||
|
||||
QAction *delete_action = m.addAction(tr("&Delete"));
|
||||
connect(delete_action, &QAction::triggered, this,
|
||||
&TrackViewItem::DeleteTrack, Qt::QueuedConnection);
|
||||
&TrackViewItem::delete_track, Qt::QueuedConnection);
|
||||
|
||||
m.addSeparator();
|
||||
|
||||
QAction *delete_unused_action = m.addAction(tr("Delete All &Empty"));
|
||||
connect(delete_unused_action, &QAction::triggered, this,
|
||||
&TrackViewItem::DeleteAllEmptyTracks, Qt::QueuedConnection);
|
||||
&TrackViewItem::delete_all_empty_tracks, Qt::QueuedConnection);
|
||||
|
||||
m.exec(mapToGlobal(p));
|
||||
}
|
||||
|
||||
void TrackViewItem::DeleteTrack()
|
||||
void TrackViewItem::delete_track()
|
||||
{
|
||||
emit AboutToDeleteTrack(track_);
|
||||
emit about_to_delete_track(track_);
|
||||
Core::instance()->undo_stack()->push(
|
||||
new TimelineRemoveTrackCommand(track_),
|
||||
tr("Deleted Track \"%1\"").arg(track_->GetLabelOrName()));
|
||||
tr("Deleted Track \"%1\"").arg(track_->get_label_or_name()));
|
||||
}
|
||||
|
||||
void TrackViewItem::DeleteAllEmptyTracks()
|
||||
void TrackViewItem::delete_all_empty_tracks()
|
||||
{
|
||||
Sequence *sequence = track_->sequence();
|
||||
QVector<Track *> tracks_to_remove;
|
||||
QStringList track_names_to_remove;
|
||||
|
||||
foreach (Track *t, sequence->GetTracks()) {
|
||||
if (t->Blocks().isEmpty()) {
|
||||
foreach (Track *t, sequence->get_tracks()) {
|
||||
if (t->blocks().isEmpty()) {
|
||||
tracks_to_remove.append(t);
|
||||
track_names_to_remove.append(t->GetLabelOrName());
|
||||
track_names_to_remove.append(t->get_label_or_name());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,14 +196,14 @@ void TrackViewItem::DeleteAllEmptyTracks()
|
||||
}
|
||||
}
|
||||
|
||||
void TrackViewItem::UpdateMuteButton(bool e)
|
||||
void TrackViewItem::update_mute_button(bool e)
|
||||
{
|
||||
mute_button_->setIcon(e ? icon::EyeClosed : icon::EyeOpened);
|
||||
mute_button_->setIcon(e ? icon::eye_closed : icon::eye_opened);
|
||||
}
|
||||
|
||||
void TrackViewItem::UpdateLockButton(bool e)
|
||||
void TrackViewItem::update_lock_button(bool e)
|
||||
{
|
||||
lock_button_->setIcon(e ? icon::LockClosed : icon::LockOpened);
|
||||
lock_button_->setIcon(e ? icon::lock_closed : icon::lock_opened);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TRACKVIEWITEM_H
|
||||
#define TRACKVIEWITEM_H
|
||||
#ifndef OAK_TRACKVIEWITEM_H
|
||||
#define OAK_TRACKVIEWITEM_H
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QStackedWidget>
|
||||
@@ -40,10 +40,10 @@ public:
|
||||
TrackViewItem(Track *track, QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void AboutToDeleteTrack(Track *track);
|
||||
void about_to_delete_track(Track *track);
|
||||
|
||||
private:
|
||||
QPushButton *CreateMSLButton(const QColor &checked_color) const;
|
||||
QPushButton *create_msl_button(const QColor &checked_color) const;
|
||||
|
||||
QStackedWidget *stack_;
|
||||
|
||||
@@ -57,25 +57,25 @@ private:
|
||||
Track *track_;
|
||||
|
||||
private slots:
|
||||
void LabelClicked();
|
||||
void label_clicked();
|
||||
|
||||
void LineEditConfirmed();
|
||||
void line_edit_confirmed();
|
||||
|
||||
void LineEditCancelled();
|
||||
void line_edit_cancelled();
|
||||
|
||||
void UpdateLabel();
|
||||
void update_label();
|
||||
|
||||
void ShowContextMenu(const QPoint &p);
|
||||
void show_context_menu(const QPoint &p);
|
||||
|
||||
void DeleteTrack();
|
||||
void delete_track();
|
||||
|
||||
void DeleteAllEmptyTracks();
|
||||
void delete_all_empty_tracks();
|
||||
|
||||
void UpdateMuteButton(bool e);
|
||||
void update_mute_button(bool e);
|
||||
|
||||
void UpdateLockButton(bool e);
|
||||
void update_lock_button(bool e);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TRACKVIEWITEM_H
|
||||
#endif // OAK_TRACKVIEWITEM_H
|
||||
|
||||
@@ -46,7 +46,7 @@ TrackViewSplitter::TrackViewSplitter(Qt::Alignment vertical_alignment,
|
||||
setFixedHeight(initial_height);
|
||||
}
|
||||
|
||||
void TrackViewSplitter::HandleReceiver(TrackViewSplitterHandle *h, int diff)
|
||||
void TrackViewSplitter::handle_receiver(TrackViewSplitterHandle *h, int diff)
|
||||
{
|
||||
int ele_id = -1;
|
||||
|
||||
@@ -72,18 +72,18 @@ void TrackViewSplitter::HandleReceiver(TrackViewSplitterHandle *h, int diff)
|
||||
int new_ele_sz = old_ele_sz + diff;
|
||||
|
||||
// Limit by track minimum height
|
||||
new_ele_sz = qMax(new_ele_sz, Track::GetMinimumTrackHeightInPixels());
|
||||
new_ele_sz = qMax(new_ele_sz, Track::get_minimum_track_height_in_pixels());
|
||||
|
||||
if (alignment_ == Qt::AlignBottom) {
|
||||
ele_id = count() - ele_id - 1;
|
||||
}
|
||||
|
||||
SetTrackHeight(ele_id, new_ele_sz);
|
||||
set_track_height(ele_id, new_ele_sz);
|
||||
|
||||
emit TrackHeightChanged(ele_id, new_ele_sz);
|
||||
emit track_height_changed(ele_id, new_ele_sz);
|
||||
}
|
||||
|
||||
void TrackViewSplitter::SetTrackHeight(int index, int h)
|
||||
void TrackViewSplitter::set_track_height(int index, int h)
|
||||
{
|
||||
QList<int> element_sizes = sizes();
|
||||
|
||||
@@ -103,7 +103,7 @@ void TrackViewSplitter::SetTrackHeight(int index, int h)
|
||||
setFixedHeight(height() + diff);
|
||||
}
|
||||
|
||||
void TrackViewSplitter::SetHeightWithSizes(QList<int> sizes)
|
||||
void TrackViewSplitter::set_height_with_sizes(QList<int> sizes)
|
||||
{
|
||||
int start_height = 0;
|
||||
|
||||
@@ -125,7 +125,7 @@ void TrackViewSplitter::SetHeightWithSizes(QList<int> sizes)
|
||||
setSizes(sizes);
|
||||
}
|
||||
|
||||
void TrackViewSplitter::Insert(int index, int height, QWidget *item)
|
||||
void TrackViewSplitter::insert(int index, int height, QWidget *item)
|
||||
{
|
||||
QList<int> sz = sizes();
|
||||
|
||||
@@ -136,10 +136,10 @@ void TrackViewSplitter::Insert(int index, int height, QWidget *item)
|
||||
sz.insert(index, height);
|
||||
insertWidget(index, item);
|
||||
|
||||
SetHeightWithSizes(sz);
|
||||
set_height_with_sizes(sz);
|
||||
}
|
||||
|
||||
void TrackViewSplitter::Remove(int index)
|
||||
void TrackViewSplitter::remove(int index)
|
||||
{
|
||||
QList<int> sz = sizes();
|
||||
|
||||
@@ -150,13 +150,13 @@ void TrackViewSplitter::Remove(int index)
|
||||
sz.removeAt(index);
|
||||
delete widget(index);
|
||||
|
||||
SetHeightWithSizes(sz);
|
||||
set_height_with_sizes(sz);
|
||||
}
|
||||
|
||||
void TrackViewSplitter::SetSpacerHeight(int height)
|
||||
void TrackViewSplitter::set_spacer_height(int height)
|
||||
{
|
||||
spacer_height_ = height;
|
||||
SetHeightWithSizes(sizes());
|
||||
set_height_with_sizes(sizes());
|
||||
}
|
||||
|
||||
QSplitterHandle *TrackViewSplitter::createHandle()
|
||||
@@ -178,7 +178,7 @@ void TrackViewSplitterHandle::mousePressEvent(QMouseEvent *)
|
||||
void TrackViewSplitterHandle::mouseMoveEvent(QMouseEvent *)
|
||||
{
|
||||
if (dragging_) {
|
||||
static_cast<TrackViewSplitter *>(parent())->HandleReceiver(
|
||||
static_cast<TrackViewSplitter *>(parent())->handle_receiver(
|
||||
this, QCursor::pos().y() - drag_y_);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TRACKVIEWSPLITTER_H
|
||||
#define TRACKVIEWSPLITTER_H
|
||||
#ifndef OAK_TRACKVIEWSPLITTER_H
|
||||
#define OAK_TRACKVIEWSPLITTER_H
|
||||
|
||||
#include <QSplitter>
|
||||
|
||||
@@ -53,20 +53,20 @@ public:
|
||||
TrackViewSplitter(Qt::Alignment vertical_alignment,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
void HandleReceiver(TrackViewSplitterHandle *h, int diff);
|
||||
void handle_receiver(TrackViewSplitterHandle *h, int diff);
|
||||
|
||||
void SetHeightWithSizes(QList<int> sizes);
|
||||
void set_height_with_sizes(QList<int> sizes);
|
||||
|
||||
void Insert(int index, int height, QWidget *item);
|
||||
void Remove(int index);
|
||||
void insert(int index, int height, QWidget *item);
|
||||
void remove(int index);
|
||||
|
||||
void SetSpacerHeight(int height);
|
||||
void set_spacer_height(int height);
|
||||
|
||||
public slots:
|
||||
void SetTrackHeight(int index, int h);
|
||||
void set_track_height(int index, int h);
|
||||
|
||||
signals:
|
||||
void TrackHeightChanged(int index, int height);
|
||||
void track_height_changed(int index, int height);
|
||||
|
||||
protected:
|
||||
virtual QSplitterHandle *createHandle() override;
|
||||
@@ -79,4 +79,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // TRACKVIEWSPLITTER_H
|
||||
#endif // OAK_TRACKVIEWSPLITTER_H
|
||||
|
||||
@@ -59,7 +59,7 @@ TimelineView::TimelineView(Qt::Alignment vertical_alignment, QWidget *parent)
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
viewport()->setMouseTracking(true);
|
||||
|
||||
SetIsTimelineAxes(true);
|
||||
set_is_timeline_axes(true);
|
||||
}
|
||||
|
||||
void TimelineView::mousePressEvent(QMouseEvent *event)
|
||||
@@ -69,89 +69,89 @@ void TimelineView::mousePressEvent(QMouseEvent *event)
|
||||
for (auto it = clip_marker_rects_.cbegin(); it != clip_marker_rects_.cend();
|
||||
it++) {
|
||||
if (it.value().contains(scene_pos)) {
|
||||
GetViewerNode()->SetPlayhead(it.key()->time().in());
|
||||
get_viewer_node()->set_playhead(it.key()->time().in());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TimelineViewMouseEvent timeline_event = CreateMouseEvent(event);
|
||||
|
||||
if (HandPress(event) ||
|
||||
(!GetItemAtScenePos(timeline_event.GetFrame(),
|
||||
timeline_event.GetTrack().index()) &&
|
||||
Core::instance()->tool() != Tool::kAdd && PlayheadPress(event))) {
|
||||
if (hand_press(event) ||
|
||||
(!get_item_at_scene_pos(timeline_event.get_frame(),
|
||||
timeline_event.get_track().index()) &&
|
||||
Core::instance()->tool() != Tool::k_add && playhead_press(event))) {
|
||||
// Let the parent handle this
|
||||
return;
|
||||
}
|
||||
|
||||
if (dragMode() != GetDefaultDragMode()) {
|
||||
if (dragMode() != get_default_drag_mode()) {
|
||||
// Use default behavior when hand dragging for instance
|
||||
super::mousePressEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
emit MousePressed(&timeline_event);
|
||||
emit mouse_pressed(&timeline_event);
|
||||
}
|
||||
|
||||
void TimelineView::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
TimelineViewMouseEvent timeline_event = CreateMouseEvent(event);
|
||||
|
||||
if (HandMove(event) || PlayheadMove(event)) {
|
||||
if (hand_move(event) || playhead_move(event)) {
|
||||
// Let the parent handle this
|
||||
return;
|
||||
}
|
||||
|
||||
if (dragMode() != GetDefaultDragMode()) {
|
||||
if (dragMode() != get_default_drag_mode()) {
|
||||
super::mouseMoveEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
if (event->buttons() == Qt::NoButton) {
|
||||
Block *b = GetItemAtScenePos(timeline_event.GetFrame(),
|
||||
timeline_event.GetTrack().index());
|
||||
Block *b = get_item_at_scene_pos(timeline_event.get_frame(),
|
||||
timeline_event.get_track().index());
|
||||
if (b) {
|
||||
setToolTip(
|
||||
tr("In: %1\nOut: %2\nDuration: %3")
|
||||
.arg(QString::fromStdString(Timecode::time_to_timecode(
|
||||
b->in(), timebase(),
|
||||
Core::instance()->GetTimecodeDisplay())),
|
||||
Core::instance()->get_timecode_display())),
|
||||
QString::fromStdString(Timecode::time_to_timecode(
|
||||
b->out(), timebase(),
|
||||
Core::instance()->GetTimecodeDisplay())),
|
||||
Core::instance()->get_timecode_display())),
|
||||
QString::fromStdString(Timecode::time_to_timecode(
|
||||
b->length(), timebase(),
|
||||
Core::instance()->GetTimecodeDisplay()))));
|
||||
Core::instance()->get_timecode_display()))));
|
||||
} else {
|
||||
setToolTip(QString());
|
||||
}
|
||||
}
|
||||
|
||||
emit MouseMoved(&timeline_event);
|
||||
emit mouse_moved(&timeline_event);
|
||||
}
|
||||
|
||||
void TimelineView::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (HandRelease(event) || PlayheadRelease(event)) {
|
||||
if (hand_release(event) || playhead_release(event)) {
|
||||
// Let the parent handle this
|
||||
return;
|
||||
}
|
||||
|
||||
if (dragMode() != GetDefaultDragMode()) {
|
||||
if (dragMode() != get_default_drag_mode()) {
|
||||
super::mouseReleaseEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
TimelineViewMouseEvent timeline_event = CreateMouseEvent(event);
|
||||
|
||||
emit MouseReleased(&timeline_event);
|
||||
emit mouse_released(&timeline_event);
|
||||
}
|
||||
|
||||
void TimelineView::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
TimelineViewMouseEvent timeline_event = CreateMouseEvent(event);
|
||||
|
||||
emit MouseDoubleClicked(&timeline_event);
|
||||
emit mouse_double_clicked(&timeline_event);
|
||||
}
|
||||
|
||||
void TimelineView::dragEnterEvent(QDragEnterEvent *event)
|
||||
@@ -159,10 +159,10 @@ void TimelineView::dragEnterEvent(QDragEnterEvent *event)
|
||||
TimelineViewMouseEvent timeline_event = CreateMouseEvent(
|
||||
event->pos(), Qt::NoButton, event->keyboardModifiers());
|
||||
|
||||
timeline_event.SetMimeData(event->mimeData());
|
||||
timeline_event.set_mime_data(event->mimeData());
|
||||
timeline_event.SetEvent(event);
|
||||
|
||||
emit DragEntered(&timeline_event);
|
||||
emit drag_entered(&timeline_event);
|
||||
}
|
||||
|
||||
void TimelineView::dragMoveEvent(QDragMoveEvent *event)
|
||||
@@ -170,15 +170,15 @@ void TimelineView::dragMoveEvent(QDragMoveEvent *event)
|
||||
TimelineViewMouseEvent timeline_event = CreateMouseEvent(
|
||||
event->pos(), Qt::NoButton, event->keyboardModifiers());
|
||||
|
||||
timeline_event.SetMimeData(event->mimeData());
|
||||
timeline_event.set_mime_data(event->mimeData());
|
||||
timeline_event.SetEvent(event);
|
||||
|
||||
emit DragMoved(&timeline_event);
|
||||
emit drag_moved(&timeline_event);
|
||||
}
|
||||
|
||||
void TimelineView::dragLeaveEvent(QDragLeaveEvent *event)
|
||||
{
|
||||
emit DragLeft(event);
|
||||
emit drag_left(event);
|
||||
}
|
||||
|
||||
void TimelineView::dropEvent(QDropEvent *event)
|
||||
@@ -186,10 +186,10 @@ void TimelineView::dropEvent(QDropEvent *event)
|
||||
TimelineViewMouseEvent timeline_event = CreateMouseEvent(
|
||||
event->pos(), Qt::NoButton, event->keyboardModifiers());
|
||||
|
||||
timeline_event.SetMimeData(event->mimeData());
|
||||
timeline_event.set_mime_data(event->mimeData());
|
||||
timeline_event.SetEvent(event);
|
||||
|
||||
emit DragDropped(&timeline_event);
|
||||
emit drag_dropped(&timeline_event);
|
||||
}
|
||||
|
||||
void TimelineView::drawBackground(QPainter *painter, const QRectF &rect)
|
||||
@@ -202,8 +202,8 @@ void TimelineView::drawBackground(QPainter *painter, const QRectF &rect)
|
||||
|
||||
int line_y = 0;
|
||||
|
||||
foreach (Track *track, connected_track_list_->GetTracks()) {
|
||||
line_y += track->GetTrackHeightInPixels();
|
||||
foreach (Track *track, connected_track_list_->get_tracks()) {
|
||||
line_y += track->get_track_height_in_pixels();
|
||||
|
||||
// One px gap between tracks
|
||||
line_y++;
|
||||
@@ -228,7 +228,7 @@ void TimelineView::drawForeground(QPainter *painter, const QRectF &rect)
|
||||
}
|
||||
|
||||
// Draw block backgrounds
|
||||
DrawBlocks(painter, false);
|
||||
draw_blocks(painter, false);
|
||||
|
||||
// Draw selections
|
||||
if (selections_ && !selections_->isEmpty()) {
|
||||
@@ -240,43 +240,43 @@ void TimelineView::drawForeground(QPainter *painter, const QRectF &rect)
|
||||
int track_index = it.key().index();
|
||||
|
||||
foreach (const TimeRange &range, it.value()) {
|
||||
painter->drawRect(TimeToScene(range.in()),
|
||||
GetTrackY(track_index),
|
||||
TimeToScene(range.length()),
|
||||
GetTrackHeight(track_index));
|
||||
painter->drawRect(time_to_scene(range.in()),
|
||||
get_track_y(track_index),
|
||||
time_to_scene(range.length()),
|
||||
get_track_height(track_index));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw block foregrounds
|
||||
DrawBlocks(painter, true);
|
||||
draw_blocks(painter, true);
|
||||
|
||||
// Draw ghosts
|
||||
if (ghosts_ && !ghosts_->isEmpty()) {
|
||||
foreach (TimelineViewGhostItem *ghost, (*ghosts_)) {
|
||||
if (ghost->GetTrack().type() == connected_track_list_->type() &&
|
||||
!ghost->IsInvisible()) {
|
||||
int track_index = ghost->GetAdjustedTrack().index();
|
||||
if (ghost->get_track().type() == connected_track_list_->type() &&
|
||||
!ghost->is_invisible()) {
|
||||
int track_index = ghost->get_adjusted_track().index();
|
||||
|
||||
Block *attached = QtUtils::ValueToPtr<Block>(
|
||||
ghost->GetData(TimelineViewGhostItem::kAttachedBlock));
|
||||
Block *attached = QtUtils::value_to_ptr<Block>(
|
||||
ghost->get_data(TimelineViewGhostItem::k_attached_block));
|
||||
|
||||
if (attached &&
|
||||
OLIVE_CONFIG("ShowClipWhileDragging").toBool()) {
|
||||
int adj_track = ghost->GetAdjustedTrack().index();
|
||||
qreal track_top = GetTrackY(adj_track);
|
||||
qreal track_height = GetTrackHeight(adj_track);
|
||||
OAK_CONFIG("ShowClipWhileDragging").toBool()) {
|
||||
int adj_track = ghost->get_adjusted_track().index();
|
||||
qreal track_top = get_track_y(adj_track);
|
||||
qreal track_height = get_track_height(adj_track);
|
||||
|
||||
qreal old_opacity = painter->opacity();
|
||||
painter->setOpacity(0.5);
|
||||
|
||||
rational in = ghost->GetAdjustedIn(),
|
||||
out = ghost->GetAdjustedOut(),
|
||||
media_in = ghost->GetAdjustedMediaIn();
|
||||
DrawBlock(painter, false, attached, track_top, track_height,
|
||||
Rational in = ghost->get_adjusted_in(),
|
||||
out = ghost->get_adjusted_out(),
|
||||
media_in = ghost->get_adjusted_media_in();
|
||||
draw_block(painter, false, attached, track_top, track_height,
|
||||
in, out, media_in);
|
||||
DrawBlock(painter, true, attached, track_top, track_height,
|
||||
draw_block(painter, true, attached, track_top, track_height,
|
||||
in, out, media_in);
|
||||
|
||||
painter->setOpacity(old_opacity);
|
||||
@@ -285,37 +285,37 @@ void TimelineView::drawForeground(QPainter *painter, const QRectF &rect)
|
||||
painter->setPen(QPen(Qt::yellow, 2));
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
|
||||
painter->drawRect(TimeToScene(ghost->GetAdjustedIn()),
|
||||
GetTrackY(track_index),
|
||||
TimeToScene(ghost->GetAdjustedLength()),
|
||||
GetTrackHeight(track_index));
|
||||
painter->drawRect(time_to_scene(ghost->get_adjusted_in()),
|
||||
get_track_y(track_index),
|
||||
time_to_scene(ghost->get_adjusted_length()),
|
||||
get_track_height(track_index));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw beam cursor
|
||||
if (show_beam_cursor_ &&
|
||||
cursor_coord_.GetTrack().type() == connected_track_list_->type()) {
|
||||
cursor_coord_.get_track().type() == connected_track_list_->type()) {
|
||||
painter->setPen(Qt::gray);
|
||||
|
||||
double cursor_x = TimeToScene(cursor_coord_.GetFrame());
|
||||
int track_index = cursor_coord_.GetTrack().index();
|
||||
int track_y = GetTrackY(track_index);
|
||||
double cursor_x = time_to_scene(cursor_coord_.get_frame());
|
||||
int track_index = cursor_coord_.get_track().index();
|
||||
int track_y = get_track_y(track_index);
|
||||
|
||||
painter->drawLine(cursor_x, track_y, cursor_x,
|
||||
track_y + GetTrackHeight(track_index));
|
||||
track_y + get_track_height(track_index));
|
||||
}
|
||||
|
||||
// Draw recording overlay
|
||||
if (recording_overlay_ &&
|
||||
recording_coord_.GetTrack().type() == connected_track_list_->type()) {
|
||||
recording_coord_.get_track().type() == connected_track_list_->type()) {
|
||||
painter->setPen(QPen(Qt::red, 2));
|
||||
painter->setBrush(QColor(255, 128, 128));
|
||||
|
||||
int x = TimeToScene(recording_coord_.GetFrame());
|
||||
painter->drawRect(x, GetTrackY(recording_coord_.GetTrack().index()),
|
||||
TimeToScene(GetViewerNode()->GetPlayhead()) - x,
|
||||
GetTrackHeight(recording_coord_.GetTrack().index()));
|
||||
int x = time_to_scene(recording_coord_.get_frame());
|
||||
painter->drawRect(x, get_track_y(recording_coord_.get_track().index()),
|
||||
time_to_scene(get_viewer_node()->get_playhead()) - x,
|
||||
get_track_height(recording_coord_.get_track().index()));
|
||||
}
|
||||
|
||||
// Draw standard TimelineViewBase things (such as playhead)
|
||||
@@ -325,19 +325,19 @@ void TimelineView::drawForeground(QPainter *painter, const QRectF &rect)
|
||||
void TimelineView::ToolChangedEvent(Tool::Item tool)
|
||||
{
|
||||
switch (tool) {
|
||||
case Tool::kRazor:
|
||||
case Tool::k_razor:
|
||||
setCursor(Qt::SplitHCursor);
|
||||
break;
|
||||
case Tool::kEdit:
|
||||
case Tool::k_edit:
|
||||
setCursor(Qt::IBeamCursor);
|
||||
break;
|
||||
case Tool::kAdd:
|
||||
case Tool::kTransition:
|
||||
case Tool::kZoom:
|
||||
case Tool::kRecord:
|
||||
case Tool::k_add:
|
||||
case Tool::k_transition:
|
||||
case Tool::k_zoom:
|
||||
case Tool::k_record:
|
||||
setCursor(Qt::CrossCursor);
|
||||
break;
|
||||
case Tool::kTrackSelect:
|
||||
case Tool::k_track_select:
|
||||
setCursor(Qt::SizeHorCursor); // FIXME: Not the ideal cursor
|
||||
break;
|
||||
default:
|
||||
@@ -355,32 +355,32 @@ void TimelineView::SceneRectUpdateEvent(QRectF &rect)
|
||||
{
|
||||
if (alignment() & Qt::AlignTop) {
|
||||
rect.setTop(0);
|
||||
rect.setBottom(GetHeightOfAllTracks() + height() / 2);
|
||||
rect.setBottom(get_height_of_all_tracks() + height() / 2);
|
||||
} else if (alignment() & Qt::AlignBottom) {
|
||||
rect.setBottom(0);
|
||||
rect.setTop(GetHeightOfAllTracks() - height() / 2);
|
||||
rect.setTop(get_height_of_all_tracks() - height() / 2);
|
||||
}
|
||||
}
|
||||
|
||||
Track::Type TimelineView::ConnectedTrackType()
|
||||
Track::Type TimelineView::connected_track_type()
|
||||
{
|
||||
if (connected_track_list_) {
|
||||
return connected_track_list_->type();
|
||||
}
|
||||
|
||||
return Track::kNone;
|
||||
return Track::k_none;
|
||||
}
|
||||
|
||||
TimelineCoordinate TimelineView::ScreenToCoordinate(const QPoint &pt)
|
||||
TimelineCoordinate TimelineView::screen_to_coordinate(const QPoint &pt)
|
||||
{
|
||||
return SceneToCoordinate(mapToScene(pt));
|
||||
return scene_to_coordinate(mapToScene(pt));
|
||||
}
|
||||
|
||||
TimelineCoordinate TimelineView::SceneToCoordinate(const QPointF &pt)
|
||||
TimelineCoordinate TimelineView::scene_to_coordinate(const QPointF &pt)
|
||||
{
|
||||
return TimelineCoordinate(SceneToTime(pt.x()),
|
||||
Track::Reference(ConnectedTrackType(),
|
||||
SceneToTrack(pt.y())));
|
||||
return TimelineCoordinate(scene_to_time(pt.x()),
|
||||
Track::Reference(connected_track_type(),
|
||||
scene_to_track(pt.y())));
|
||||
}
|
||||
|
||||
TimelineViewMouseEvent TimelineView::CreateMouseEvent(QMouseEvent *event)
|
||||
@@ -394,26 +394,26 @@ TimelineView::CreateMouseEvent(const QPoint &pos, Qt::MouseButton button,
|
||||
{
|
||||
QPointF scene_pt = mapToScene(pos);
|
||||
|
||||
return TimelineViewMouseEvent(scene_pt, pos, GetScale(), timebase(),
|
||||
Track::Reference(ConnectedTrackType(),
|
||||
SceneToTrack(scene_pt.y())),
|
||||
return TimelineViewMouseEvent(scene_pt, pos, get_scale(), timebase(),
|
||||
Track::Reference(connected_track_type(),
|
||||
scene_to_track(scene_pt.y())),
|
||||
button, modifiers);
|
||||
}
|
||||
|
||||
void TimelineView::DrawBlocks(QPainter *painter, bool foreground)
|
||||
void TimelineView::draw_blocks(QPainter *painter, bool foreground)
|
||||
{
|
||||
rational start_time = SceneToTime(GetTimelineLeftBound());
|
||||
rational end_time = SceneToTime(GetTimelineRightBound());
|
||||
Rational start_time = scene_to_time(get_timeline_left_bound());
|
||||
Rational end_time = scene_to_time(get_timeline_right_bound());
|
||||
|
||||
foreach (Track *track, connected_track_list_->GetTracks()) {
|
||||
foreach (Track *track, connected_track_list_->get_tracks()) {
|
||||
// Get first visible block in this track
|
||||
Block *block = track->NearestBlockBeforeOrAt(start_time);
|
||||
Block *block = track->nearest_block_before_or_at(start_time);
|
||||
|
||||
qreal track_top = GetTrackY(track->Index());
|
||||
qreal track_height = GetTrackHeight(track->Index());
|
||||
qreal track_top = get_track_y(track->index());
|
||||
qreal track_height = get_track_height(track->index());
|
||||
|
||||
while (block) {
|
||||
DrawBlock(painter, foreground, block, track_top, track_height);
|
||||
draw_block(painter, foreground, block, track_top, track_height);
|
||||
|
||||
if (block->out() >= end_time) {
|
||||
// Rest of the clips are offscreen, can break loop now
|
||||
@@ -425,28 +425,28 @@ void TimelineView::DrawBlocks(QPainter *painter, bool foreground)
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineView::DrawBlock(QPainter *painter, bool foreground, Block *block,
|
||||
void TimelineView::draw_block(QPainter *painter, bool foreground, Block *block,
|
||||
qreal block_top, qreal block_height,
|
||||
const rational &in, const rational &out,
|
||||
const rational &media_in)
|
||||
const Rational &in, const Rational &out,
|
||||
const Rational &media_in)
|
||||
{
|
||||
if (dynamic_cast<ClipBlock *>(block) ||
|
||||
dynamic_cast<TransitionBlock *>(block)) {
|
||||
qreal block_in = TimeToScene(in);
|
||||
qreal block_in = time_to_scene(in);
|
||||
|
||||
qreal block_left = qMax(GetTimelineLeftBound(), block_in);
|
||||
qreal block_right = qMin(GetTimelineRightBound(), TimeToScene(out)) - 1;
|
||||
qreal block_left = qMax(get_timeline_left_bound(), block_in);
|
||||
qreal block_right = qMin(get_timeline_right_bound(), time_to_scene(out)) - 1;
|
||||
|
||||
QRectF r(block_left, block_top, block_right - block_left, block_height);
|
||||
|
||||
QColor shadow_color = block->is_enabled() ?
|
||||
QtUtils::toQColor(block->color()).darker() :
|
||||
QtUtils::to_q_color(block->color()).darker() :
|
||||
QColor(Qt::darkGray).darker();
|
||||
|
||||
const qreal MINIMUM_RECT_WIDTH = 2;
|
||||
const qreal MINIMUM_DETAIL_WIDTH = 8;
|
||||
const qreal minimum_rect_width = 2;
|
||||
const qreal minimum_detail_width = 8;
|
||||
|
||||
if (r.width() <= MINIMUM_RECT_WIDTH) {
|
||||
if (r.width() <= minimum_rect_width) {
|
||||
if (!foreground) {
|
||||
// Just draw a green background
|
||||
// Width is likely fractional, so we ceil it and add 1 to ensure the entire width of the
|
||||
@@ -465,22 +465,22 @@ void TimelineView::DrawBlock(QPainter *painter, bool foreground, Block *block,
|
||||
if (foreground) {
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
|
||||
if (r.width() > MINIMUM_DETAIL_WIDTH) {
|
||||
QString using_label = block->GetLabelOrName();
|
||||
if (r.width() > minimum_detail_width) {
|
||||
QString using_label = block->get_label_or_name();
|
||||
|
||||
QRectF text_rect = r.adjusted(text_padding, text_padding,
|
||||
-text_padding, -text_padding);
|
||||
painter->setPen(
|
||||
block->is_enabled() ?
|
||||
ColorCoding::GetUISelectorColor(block->color()) :
|
||||
ColorCoding::get_ui_selector_color(block->color()) :
|
||||
Qt::lightGray);
|
||||
painter->drawText(text_rect, Qt::AlignLeft | Qt::AlignTop,
|
||||
using_label);
|
||||
|
||||
if (block->HasLinks()) {
|
||||
if (block->has_links()) {
|
||||
int text_width =
|
||||
qMin(qRound(text_rect.width()),
|
||||
QtUtils::QFontMetricsWidth(fm, using_label));
|
||||
QtUtils::q_font_metrics_width(fm, using_label));
|
||||
|
||||
int underline_y = text_rect.y() + text_height;
|
||||
|
||||
@@ -511,14 +511,14 @@ void TimelineView::DrawBlock(QPainter *painter, bool foreground, Block *block,
|
||||
Qt::gray);
|
||||
painter->drawRect(r);
|
||||
|
||||
if (r.width() > MINIMUM_DETAIL_WIDTH) {
|
||||
if (r.width() > minimum_detail_width) {
|
||||
if (ClipBlock *clip = dynamic_cast<ClipBlock *>(block)) {
|
||||
QRect preview_rect = r.toRect();
|
||||
|
||||
// Draw clip thumbnails
|
||||
if (clip->GetTrackType() == Track::kVideo &&
|
||||
OLIVE_CONFIG("TimelineThumbnailMode").toInt() !=
|
||||
Timeline::kThumbnailOff) {
|
||||
if (clip->get_track_type() == Track::k_video &&
|
||||
OAK_CONFIG("TimelineThumbnailMode").toInt() !=
|
||||
Timeline::k_thumbnail_off) {
|
||||
// Start thumbnails underneath clip name
|
||||
preview_rect.adjust(0, text_total_height, 0, 0);
|
||||
|
||||
@@ -530,12 +530,12 @@ void TimelineView::DrawBlock(QPainter *painter, bool foreground, Block *block,
|
||||
QPainter::SmoothPixmapTransform);
|
||||
painter->setClipRect(preview_rect);
|
||||
|
||||
if (OLIVE_CONFIG("TimelineThumbnailMode") ==
|
||||
Timeline::kThumbnailOn) {
|
||||
if (OAK_CONFIG("TimelineThumbnailMode") ==
|
||||
Timeline::k_thumbnail_on) {
|
||||
Sequence *s = clip->track()->sequence();
|
||||
int width = s->GetVideoParams().width();
|
||||
int width = s->get_video_params().width();
|
||||
int height =
|
||||
s->GetVideoParams().height();
|
||||
s->get_video_params().height();
|
||||
int start;
|
||||
if (height >
|
||||
0) { // Prevent divide by zero/invalid params
|
||||
@@ -555,27 +555,27 @@ void TimelineView::DrawBlock(QPainter *painter, bool foreground, Block *block,
|
||||
for (int i = start;
|
||||
i < preview_rect.right();
|
||||
i += thumb_rect.width() + 1) {
|
||||
rational time_here =
|
||||
SceneToTime(
|
||||
i - block_in, GetScale(),
|
||||
Rational time_here =
|
||||
scene_to_time(
|
||||
i - block_in, get_scale(),
|
||||
connected_track_list_
|
||||
->parent()
|
||||
->GetVideoParams()
|
||||
->get_video_params()
|
||||
.frame_rate_as_time_base()) +
|
||||
media_in;
|
||||
DrawThumbnail(painter, thumbs,
|
||||
draw_thumbnail(painter, thumbs,
|
||||
time_here, i,
|
||||
preview_rect,
|
||||
&thumb_rect);
|
||||
}
|
||||
|
||||
} else {
|
||||
rational time =
|
||||
Rational time =
|
||||
clip->media_range().in();
|
||||
time = Timecode::snap_time_to_timebase(
|
||||
time, thumbs->GetTimebase(),
|
||||
Timecode::kFloor);
|
||||
DrawThumbnail(painter, thumbs, time,
|
||||
time, thumbs->get_timebase(),
|
||||
Timecode::k_floor);
|
||||
draw_thumbnail(painter, thumbs, time,
|
||||
block_left, preview_rect,
|
||||
&thumb_rect);
|
||||
}
|
||||
@@ -586,58 +586,58 @@ void TimelineView::DrawBlock(QPainter *painter, bool foreground, Block *block,
|
||||
}
|
||||
|
||||
// Draw waveform
|
||||
if (clip->GetTrackType() == Track::kAudio &&
|
||||
OLIVE_CONFIG("TimelineWaveformMode").toInt() ==
|
||||
Timeline::kWaveformsEnabled) {
|
||||
if (clip->get_track_type() == Track::k_audio &&
|
||||
OAK_CONFIG("TimelineWaveformMode").toInt() ==
|
||||
Timeline::k_waveforms_enabled) {
|
||||
if (const AudioWaveformCache *wave =
|
||||
clip->waveform()) {
|
||||
rational waveform_start =
|
||||
SceneToTime(
|
||||
block_left - block_in, GetScale(),
|
||||
Rational waveform_start =
|
||||
scene_to_time(
|
||||
block_left - block_in, get_scale(),
|
||||
connected_track_list_->parent()
|
||||
->GetAudioParams()
|
||||
->get_audio_params()
|
||||
.sample_rate_as_time_base()) +
|
||||
media_in;
|
||||
painter->setPen(shadow_color);
|
||||
|
||||
wave->Draw(painter, preview_rect,
|
||||
this->GetScale(), waveform_start);
|
||||
this->get_scale(), waveform_start);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw zebra stripes and markers
|
||||
if (clip->connected_viewer()) {
|
||||
if (!clip->connected_viewer()->GetLength().isNull()) {
|
||||
if (!clip->connected_viewer()->get_length().isNull()) {
|
||||
painter->setPen(shadow_color);
|
||||
|
||||
if (clip->media_in() < 0) {
|
||||
qreal zebra_right = TimeToScene(
|
||||
qreal zebra_right = time_to_scene(
|
||||
clip->in() - clip->media_in());
|
||||
|
||||
switch (clip->loop_mode()) {
|
||||
case LoopMode::kLoopModeOff:
|
||||
case LoopMode::k_loop_mode_off:
|
||||
// Draw stripes for sections of clip < 0
|
||||
if (zebra_right >
|
||||
GetTimelineLeftBound()) {
|
||||
DrawZebraStripes(
|
||||
get_timeline_left_bound()) {
|
||||
draw_zebra_stripes(
|
||||
painter,
|
||||
QRectF(block_left, block_top,
|
||||
zebra_right - block_left,
|
||||
block_height));
|
||||
}
|
||||
break;
|
||||
case LoopMode::kLoopModeLoop:
|
||||
case LoopMode::k_loop_mode_loop:
|
||||
for (qreal i = zebra_right;
|
||||
i > block_left;
|
||||
i -= TimeToScene(
|
||||
i -= time_to_scene(
|
||||
clip->connected_viewer()
|
||||
->GetLength())) {
|
||||
->get_length())) {
|
||||
painter->drawLine(i, block_top, i,
|
||||
block_top +
|
||||
block_height);
|
||||
}
|
||||
break;
|
||||
case LoopMode::kLoopModeClamp:
|
||||
case LoopMode::k_loop_mode_clamp:
|
||||
painter->drawLine(
|
||||
zebra_right, block_top, zebra_right,
|
||||
block_top + block_height);
|
||||
@@ -646,35 +646,35 @@ void TimelineView::DrawBlock(QPainter *painter, bool foreground, Block *block,
|
||||
}
|
||||
|
||||
if (clip->length() + clip->media_in() >
|
||||
clip->connected_viewer()->GetLength()) {
|
||||
qreal zebra_left = TimeToScene(
|
||||
clip->connected_viewer()->get_length()) {
|
||||
qreal zebra_left = time_to_scene(
|
||||
clip->out() -
|
||||
(clip->media_in() + clip->length() -
|
||||
clip->connected_viewer()->GetLength()));
|
||||
clip->connected_viewer()->get_length()));
|
||||
switch (clip->loop_mode()) {
|
||||
case LoopMode::kLoopModeOff:
|
||||
case LoopMode::k_loop_mode_off:
|
||||
// Draw stripes for sections for clip > clip length
|
||||
if (zebra_left <
|
||||
GetTimelineRightBound()) {
|
||||
DrawZebraStripes(
|
||||
get_timeline_right_bound()) {
|
||||
draw_zebra_stripes(
|
||||
painter,
|
||||
QRectF(zebra_left, block_top,
|
||||
block_right - zebra_left,
|
||||
block_height));
|
||||
}
|
||||
break;
|
||||
case LoopMode::kLoopModeLoop:
|
||||
case LoopMode::k_loop_mode_loop:
|
||||
for (qreal i = zebra_left;
|
||||
i < block_right;
|
||||
i += TimeToScene(
|
||||
i += time_to_scene(
|
||||
clip->connected_viewer()
|
||||
->GetLength())) {
|
||||
->get_length())) {
|
||||
painter->drawLine(i, block_top, i,
|
||||
block_top +
|
||||
block_height);
|
||||
}
|
||||
break;
|
||||
case LoopMode::kLoopModeClamp:
|
||||
case LoopMode::k_loop_mode_clamp:
|
||||
painter->drawLine(
|
||||
zebra_left, block_top, zebra_left,
|
||||
block_top + block_height);
|
||||
@@ -684,7 +684,7 @@ void TimelineView::DrawBlock(QPainter *painter, bool foreground, Block *block,
|
||||
}
|
||||
|
||||
TimelineMarkerList *marker_list =
|
||||
clip->connected_viewer()->GetMarkers();
|
||||
clip->connected_viewer()->get_markers();
|
||||
if (!marker_list->empty()) {
|
||||
clip_marker_rects_.clear();
|
||||
|
||||
@@ -697,14 +697,14 @@ void TimelineView::DrawBlock(QPainter *painter, bool foreground, Block *block,
|
||||
marker->time().out() <=
|
||||
clip->media_in() + clip->length()) {
|
||||
QPoint marker_pt(
|
||||
TimeToScene(clip->in() -
|
||||
time_to_scene(clip->in() -
|
||||
clip->media_in() +
|
||||
marker->time().in()),
|
||||
block_top + block_height);
|
||||
painter->setClipRect(r);
|
||||
QRect marker_rect =
|
||||
marker->Draw(painter, marker_pt, -1,
|
||||
GetScale(), false);
|
||||
marker->draw(painter, marker_pt, -1,
|
||||
get_scale(), false);
|
||||
clip_marker_rects_.insert(marker,
|
||||
marker_rect);
|
||||
painter->setClipping(false);
|
||||
@@ -715,17 +715,17 @@ void TimelineView::DrawBlock(QPainter *painter, bool foreground, Block *block,
|
||||
|
||||
if (const FrameHashCache *cache =
|
||||
clip->connected_video_cache()) {
|
||||
if (cache->HasValidatedRanges()) {
|
||||
if (cache->has_validated_ranges()) {
|
||||
QRect cache_rect =
|
||||
r.adjusted(
|
||||
0,
|
||||
r.height() -
|
||||
PlaybackCache::
|
||||
GetCacheIndicatorHeight(),
|
||||
get_cache_indicator_height(),
|
||||
0, 0)
|
||||
.toRect();
|
||||
cache->Draw(painter, clip->media_in(),
|
||||
GetScale(), cache_rect);
|
||||
cache->draw(painter, clip->media_in(),
|
||||
get_scale(), cache_rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -752,7 +752,7 @@ void TimelineView::DrawBlock(QPainter *painter, bool foreground, Block *block,
|
||||
QRectF transition_overlay_rect = r;
|
||||
|
||||
qreal transition_overlay_width =
|
||||
TimeToScene(block->length()) * 0.5;
|
||||
time_to_scene(block->length()) * 0.5;
|
||||
if (transition_overlay_out_ && transition_overlay_in_) {
|
||||
// This is a dual transition, use the smallest width
|
||||
Block *other_block =
|
||||
@@ -761,7 +761,7 @@ void TimelineView::DrawBlock(QPainter *painter, bool foreground, Block *block,
|
||||
transition_overlay_out_;
|
||||
|
||||
qreal other_width =
|
||||
TimeToScene(other_block->length()) * 0.5;
|
||||
time_to_scene(other_block->length()) * 0.5;
|
||||
|
||||
transition_overlay_width =
|
||||
qMin(transition_overlay_width, other_width);
|
||||
@@ -788,7 +788,7 @@ void TimelineView::DrawBlock(QPainter *painter, bool foreground, Block *block,
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineView::DrawZebraStripes(QPainter *painter, const QRectF &r)
|
||||
void TimelineView::draw_zebra_stripes(QPainter *painter, const QRectF &r)
|
||||
{
|
||||
int zebra_interval = fontMetrics().height();
|
||||
|
||||
@@ -810,36 +810,36 @@ void TimelineView::DrawZebraStripes(QPainter *painter, const QRectF &r)
|
||||
painter->setClipping(false);
|
||||
}
|
||||
|
||||
int TimelineView::GetHeightOfAllTracks() const
|
||||
int TimelineView::get_height_of_all_tracks() const
|
||||
{
|
||||
if (connected_track_list_) {
|
||||
if (alignment() & Qt::AlignTop) {
|
||||
return GetTrackY(connected_track_list_->GetTrackCount());
|
||||
return get_track_y(connected_track_list_->get_track_count());
|
||||
} else {
|
||||
return GetTrackY(connected_track_list_->GetTrackCount() - 1);
|
||||
return get_track_y(connected_track_list_->get_track_count() - 1);
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
qreal TimelineView::GetTimelineLeftBound() const
|
||||
qreal TimelineView::get_timeline_left_bound() const
|
||||
{
|
||||
return horizontalScrollBar()->value();
|
||||
}
|
||||
|
||||
qreal TimelineView::GetTimelineRightBound() const
|
||||
qreal TimelineView::get_timeline_right_bound() const
|
||||
{
|
||||
return GetTimelineLeftBound() + viewport()->width();
|
||||
return get_timeline_left_bound() + viewport()->width();
|
||||
}
|
||||
|
||||
void TimelineView::DrawThumbnail(QPainter *painter,
|
||||
void TimelineView::draw_thumbnail(QPainter *painter,
|
||||
const FrameHashCache *thumbs,
|
||||
const rational &time, int x,
|
||||
const Rational &time, int x,
|
||||
const QRect &preview_rect,
|
||||
QRect *thumb_rect) const
|
||||
{
|
||||
QString thumbnail = thumbs->GetValidCacheFilename(time);
|
||||
QString thumbnail = thumbs->get_valid_cache_filename(time);
|
||||
|
||||
if (!thumbnail.isEmpty()) {
|
||||
QImage img;
|
||||
@@ -852,9 +852,9 @@ void TimelineView::DrawThumbnail(QPainter *painter,
|
||||
}
|
||||
}
|
||||
|
||||
int TimelineView::GetTrackY(int track_index) const
|
||||
int TimelineView::get_track_y(int track_index) const
|
||||
{
|
||||
if (!connected_track_list_ || !connected_track_list_->GetTrackCount()) {
|
||||
if (!connected_track_list_ || !connected_track_list_->get_track_count()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -865,7 +865,7 @@ int TimelineView::GetTrackY(int track_index) const
|
||||
}
|
||||
|
||||
for (int i = 0; i < track_index; i++) {
|
||||
y += GetTrackHeight(i);
|
||||
y += get_track_height(i);
|
||||
|
||||
// One px line between each track
|
||||
y++;
|
||||
@@ -878,69 +878,69 @@ int TimelineView::GetTrackY(int track_index) const
|
||||
return y;
|
||||
}
|
||||
|
||||
int TimelineView::GetTrackHeight(int track_index) const
|
||||
int TimelineView::get_track_height(int track_index) const
|
||||
{
|
||||
if (!connected_track_list_ || connected_track_list_->GetTrackCount() == 0) {
|
||||
if (!connected_track_list_ || connected_track_list_->get_track_count() == 0) {
|
||||
// Handle null or empty track list
|
||||
return Track::GetDefaultTrackHeightInPixels();
|
||||
return Track::get_default_track_height_in_pixels();
|
||||
}
|
||||
|
||||
if (track_index >= connected_track_list_->GetTrackCount()) {
|
||||
if (track_index >= connected_track_list_->get_track_count()) {
|
||||
// Handle new track at the end of the list
|
||||
return connected_track_list_
|
||||
->GetTrackAt(connected_track_list_->GetTrackCount() - 1)
|
||||
->GetTrackHeightInPixels();
|
||||
->get_track_at(connected_track_list_->get_track_count() - 1)
|
||||
->get_track_height_in_pixels();
|
||||
}
|
||||
|
||||
if (track_index < 0) {
|
||||
// Handle new track at the beginning of the list
|
||||
return connected_track_list_->GetTrackAt(0)->GetTrackHeightInPixels();
|
||||
return connected_track_list_->get_track_at(0)->get_track_height_in_pixels();
|
||||
}
|
||||
|
||||
// Track definitely exists, return its actual height
|
||||
return connected_track_list_->GetTrackAt(track_index)
|
||||
->GetTrackHeightInPixels();
|
||||
return connected_track_list_->get_track_at(track_index)
|
||||
->get_track_height_in_pixels();
|
||||
}
|
||||
|
||||
QPoint TimelineView::GetScrollCoordinates() const
|
||||
QPoint TimelineView::get_scroll_coordinates() const
|
||||
{
|
||||
return QPoint(horizontalScrollBar()->value(), verticalScrollBar()->value());
|
||||
}
|
||||
|
||||
void TimelineView::SetScrollCoordinates(const QPoint &pt)
|
||||
void TimelineView::set_scroll_coordinates(const QPoint &pt)
|
||||
{
|
||||
horizontalScrollBar()->setValue(pt.x());
|
||||
verticalScrollBar()->setValue(pt.y());
|
||||
}
|
||||
|
||||
void TimelineView::ConnectTrackList(TrackList *list)
|
||||
void TimelineView::connect_track_list(TrackList *list)
|
||||
{
|
||||
if (connected_track_list_) {
|
||||
disconnect(connected_track_list_, &TrackList::TrackListChanged, this,
|
||||
&TimelineView::TrackListChanged);
|
||||
disconnect(connected_track_list_, &TrackList::TrackHeightChanged, this,
|
||||
&TimelineView::TrackListChanged);
|
||||
disconnect(connected_track_list_, &TrackList::track_list_changed, this,
|
||||
&TimelineView::track_list_changed);
|
||||
disconnect(connected_track_list_, &TrackList::track_height_changed, this,
|
||||
&TimelineView::track_list_changed);
|
||||
}
|
||||
|
||||
connected_track_list_ = list;
|
||||
|
||||
if (connected_track_list_) {
|
||||
connect(connected_track_list_, &TrackList::TrackListChanged, this,
|
||||
&TimelineView::TrackListChanged);
|
||||
connect(connected_track_list_, &TrackList::TrackHeightChanged, this,
|
||||
&TimelineView::TrackListChanged);
|
||||
connect(connected_track_list_, &TrackList::track_list_changed, this,
|
||||
&TimelineView::track_list_changed);
|
||||
connect(connected_track_list_, &TrackList::track_height_changed, this,
|
||||
&TimelineView::track_list_changed);
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineView::SetBeamCursor(const TimelineCoordinate &coord)
|
||||
void TimelineView::set_beam_cursor(const TimelineCoordinate &coord)
|
||||
{
|
||||
if (!connected_track_list_) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool update_required =
|
||||
coord.GetTrack().type() == connected_track_list_->type() ||
|
||||
cursor_coord_.GetTrack().type() == connected_track_list_->type();
|
||||
coord.get_track().type() == connected_track_list_->type() ||
|
||||
cursor_coord_.get_track().type() == connected_track_list_->type();
|
||||
|
||||
show_beam_cursor_ = true;
|
||||
cursor_coord_ = coord;
|
||||
@@ -950,10 +950,10 @@ void TimelineView::SetBeamCursor(const TimelineCoordinate &coord)
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineView::SetTransitionOverlay(ClipBlock *out, ClipBlock *in)
|
||||
void TimelineView::set_transition_overlay(ClipBlock *out, ClipBlock *in)
|
||||
{
|
||||
if (transition_overlay_out_ != out || transition_overlay_in_ != in) {
|
||||
Track::Type type = Track::kNone;
|
||||
Track::Type type = Track::k_none;
|
||||
|
||||
if (out) {
|
||||
type = out->track()->type();
|
||||
@@ -973,20 +973,20 @@ void TimelineView::SetTransitionOverlay(ClipBlock *out, ClipBlock *in)
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineView::EnableRecordingOverlay(const TimelineCoordinate &coord)
|
||||
void TimelineView::enable_recording_overlay(const TimelineCoordinate &coord)
|
||||
{
|
||||
recording_overlay_ = true;
|
||||
recording_coord_ = coord;
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
void TimelineView::DisableRecordingOverlay()
|
||||
void TimelineView::disable_recording_overlay()
|
||||
{
|
||||
recording_overlay_ = false;
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
int TimelineView::SceneToTrack(double y)
|
||||
int TimelineView::scene_to_track(double y)
|
||||
{
|
||||
int track = -1;
|
||||
int heights = 0;
|
||||
@@ -997,20 +997,20 @@ int TimelineView::SceneToTrack(double y)
|
||||
|
||||
do {
|
||||
track++;
|
||||
heights += GetTrackHeight(track);
|
||||
heights += get_track_height(track);
|
||||
} while (y > heights);
|
||||
|
||||
return track;
|
||||
}
|
||||
|
||||
Block *TimelineView::GetItemAtScenePos(const rational &time,
|
||||
Block *TimelineView::get_item_at_scene_pos(const Rational &time,
|
||||
int track_index) const
|
||||
{
|
||||
if (connected_track_list_) {
|
||||
Track *track = connected_track_list_->GetTrackAt(track_index);
|
||||
Track *track = connected_track_list_->get_track_at(track_index);
|
||||
|
||||
if (track) {
|
||||
foreach (Block *b, track->Blocks()) {
|
||||
foreach (Block *b, track->blocks()) {
|
||||
if (b->in() <= time && b->out() > time) {
|
||||
return b;
|
||||
}
|
||||
@@ -1021,22 +1021,22 @@ Block *TimelineView::GetItemAtScenePos(const rational &time,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QVector<Block *> TimelineView::GetItemsAtSceneRect(const QRectF &rect) const
|
||||
QVector<Block *> TimelineView::get_items_at_scene_rect(const QRectF &rect) const
|
||||
{
|
||||
QVector<Block *> list;
|
||||
|
||||
if (connected_track_list_) {
|
||||
rational start = this->SceneToTime(rect.left());
|
||||
rational end = this->SceneToTime(rect.right());
|
||||
Rational start = this->scene_to_time(rect.left());
|
||||
Rational end = this->scene_to_time(rect.right());
|
||||
|
||||
for (int i = 0; i < connected_track_list_->GetTrackCount(); i++) {
|
||||
Track *track = connected_track_list_->GetTrackAt(i);
|
||||
int track_top = GetTrackY(i);
|
||||
int track_bottom = track_top + GetTrackHeight(i);
|
||||
for (int i = 0; i < connected_track_list_->get_track_count(); i++) {
|
||||
Track *track = connected_track_list_->get_track_at(i);
|
||||
int track_top = get_track_y(i);
|
||||
int track_bottom = track_top + get_track_height(i);
|
||||
|
||||
if (track) {
|
||||
if (!(track_bottom < rect.top() || track_top > rect.bottom())) {
|
||||
Block *b = track->NearestBlockBeforeOrAt(start);
|
||||
Block *b = track->nearest_block_before_or_at(start);
|
||||
while (b && b->in() < end) {
|
||||
list.append(b);
|
||||
b = b->next();
|
||||
@@ -1049,9 +1049,9 @@ QVector<Block *> TimelineView::GetItemsAtSceneRect(const QRectF &rect) const
|
||||
return list;
|
||||
}
|
||||
|
||||
void TimelineView::TrackListChanged()
|
||||
void TimelineView::track_list_changed()
|
||||
{
|
||||
UpdateSceneRect();
|
||||
update_scene_rect();
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMELINEVIEW_H
|
||||
#define TIMELINEVIEW_H
|
||||
#ifndef OAK_TIMELINEVIEW_H
|
||||
#define OAK_TIMELINEVIEW_H
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QDragEnterEvent>
|
||||
@@ -47,45 +47,45 @@ public:
|
||||
TimelineView(Qt::Alignment vertical_alignment = Qt::AlignTop,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
int GetTrackY(int track_index) const;
|
||||
int GetTrackHeight(int track_index) const;
|
||||
int get_track_y(int track_index) const;
|
||||
int get_track_height(int track_index) const;
|
||||
|
||||
QPoint GetScrollCoordinates() const;
|
||||
void SetScrollCoordinates(const QPoint &pt);
|
||||
QPoint get_scroll_coordinates() const;
|
||||
void set_scroll_coordinates(const QPoint &pt);
|
||||
|
||||
void ConnectTrackList(TrackList *list);
|
||||
void connect_track_list(TrackList *list);
|
||||
|
||||
void SetBeamCursor(const TimelineCoordinate &coord);
|
||||
void SetTransitionOverlay(ClipBlock *out, ClipBlock *in);
|
||||
void EnableRecordingOverlay(const TimelineCoordinate &coord);
|
||||
void DisableRecordingOverlay();
|
||||
void set_beam_cursor(const TimelineCoordinate &coord);
|
||||
void set_transition_overlay(ClipBlock *out, ClipBlock *in);
|
||||
void enable_recording_overlay(const TimelineCoordinate &coord);
|
||||
void disable_recording_overlay();
|
||||
|
||||
void SetSelectionList(QHash<Track::Reference, TimeRangeList> *s)
|
||||
void set_selection_list(QHash<Track::Reference, TimeRangeList> *s)
|
||||
{
|
||||
selections_ = s;
|
||||
}
|
||||
|
||||
void SetGhostList(QVector<TimelineViewGhostItem *> *ghosts)
|
||||
void set_ghost_list(QVector<TimelineViewGhostItem *> *ghosts)
|
||||
{
|
||||
ghosts_ = ghosts;
|
||||
}
|
||||
|
||||
int SceneToTrack(double y);
|
||||
int scene_to_track(double y);
|
||||
|
||||
Block *GetItemAtScenePos(const rational &time, int track_index) const;
|
||||
Block *get_item_at_scene_pos(const Rational &time, int track_index) const;
|
||||
|
||||
QVector<Block *> GetItemsAtSceneRect(const QRectF &rect) const;
|
||||
QVector<Block *> get_items_at_scene_rect(const QRectF &rect) const;
|
||||
|
||||
signals:
|
||||
void MousePressed(TimelineViewMouseEvent *event);
|
||||
void MouseMoved(TimelineViewMouseEvent *event);
|
||||
void MouseReleased(TimelineViewMouseEvent *event);
|
||||
void MouseDoubleClicked(TimelineViewMouseEvent *event);
|
||||
void mouse_pressed(TimelineViewMouseEvent *event);
|
||||
void mouse_moved(TimelineViewMouseEvent *event);
|
||||
void mouse_released(TimelineViewMouseEvent *event);
|
||||
void mouse_double_clicked(TimelineViewMouseEvent *event);
|
||||
|
||||
void DragEntered(TimelineViewMouseEvent *event);
|
||||
void DragMoved(TimelineViewMouseEvent *event);
|
||||
void DragLeft(QDragLeaveEvent *event);
|
||||
void DragDropped(TimelineViewMouseEvent *event);
|
||||
void drag_entered(TimelineViewMouseEvent *event);
|
||||
void drag_moved(TimelineViewMouseEvent *event);
|
||||
void drag_left(QDragLeaveEvent *event);
|
||||
void drag_dropped(TimelineViewMouseEvent *event);
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent *event) override;
|
||||
@@ -106,41 +106,41 @@ protected:
|
||||
virtual void SceneRectUpdateEvent(QRectF &rect) override;
|
||||
|
||||
private:
|
||||
Track::Type ConnectedTrackType();
|
||||
Track::Type connected_track_type();
|
||||
|
||||
TimelineCoordinate ScreenToCoordinate(const QPoint &pt);
|
||||
TimelineCoordinate SceneToCoordinate(const QPointF &pt);
|
||||
TimelineCoordinate screen_to_coordinate(const QPoint &pt);
|
||||
TimelineCoordinate scene_to_coordinate(const QPointF &pt);
|
||||
|
||||
TimelineViewMouseEvent CreateMouseEvent(QMouseEvent *event);
|
||||
TimelineViewMouseEvent CreateMouseEvent(const QPoint &pos,
|
||||
Qt::MouseButton button,
|
||||
Qt::KeyboardModifiers modifiers);
|
||||
|
||||
void DrawBlocks(QPainter *painter, bool foreground);
|
||||
void draw_blocks(QPainter *painter, bool foreground);
|
||||
|
||||
void DrawBlock(QPainter *painter, bool foreground, Block *block, qreal top,
|
||||
qreal height, const rational &in, const rational &out,
|
||||
const rational &media_in);
|
||||
void DrawBlock(QPainter *painter, bool foreground, Block *block, qreal top,
|
||||
void draw_block(QPainter *painter, bool foreground, Block *block, qreal top,
|
||||
qreal height, const Rational &in, const Rational &out,
|
||||
const Rational &media_in);
|
||||
void draw_block(QPainter *painter, bool foreground, Block *block, qreal top,
|
||||
qreal height)
|
||||
{
|
||||
ClipBlock *cb = dynamic_cast<ClipBlock *>(block);
|
||||
return DrawBlock(painter, foreground, block, top, height, block->in(),
|
||||
return draw_block(painter, foreground, block, top, height, block->in(),
|
||||
block->out(), cb ? cb->media_in() : 0);
|
||||
}
|
||||
|
||||
void DrawZebraStripes(QPainter *painter, const QRectF &r);
|
||||
void draw_zebra_stripes(QPainter *painter, const QRectF &r);
|
||||
|
||||
int GetHeightOfAllTracks() const;
|
||||
int get_height_of_all_tracks() const;
|
||||
|
||||
void UpdatePlayheadRect();
|
||||
void update_playhead_rect();
|
||||
|
||||
qreal GetTimelineLeftBound() const;
|
||||
qreal get_timeline_left_bound() const;
|
||||
|
||||
qreal GetTimelineRightBound() const;
|
||||
qreal get_timeline_right_bound() const;
|
||||
|
||||
void DrawThumbnail(QPainter *painter, const FrameHashCache *thumbs,
|
||||
const rational &time, int x, const QRect &preview_rect,
|
||||
void draw_thumbnail(QPainter *painter, const FrameHashCache *thumbs,
|
||||
const Rational &time, int x, const QRect &preview_rect,
|
||||
QRect *thumb_rect) const;
|
||||
|
||||
QHash<Track::Reference, TimeRangeList> *selections_;
|
||||
@@ -162,9 +162,9 @@ private:
|
||||
TimelineCoordinate recording_coord_;
|
||||
|
||||
private slots:
|
||||
void TrackListChanged();
|
||||
void track_list_changed();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TIMELINEVIEW_H
|
||||
#endif // OAK_TIMELINEVIEW_H
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMELINEVIEWGHOSTITEM_H
|
||||
#define TIMELINEVIEWGHOSTITEM_H
|
||||
#ifndef OAK_TIMELINEVIEWGHOSTITEM_H
|
||||
#define OAK_TIMELINEVIEWGHOSTITEM_H
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
@@ -38,12 +38,12 @@ namespace olive
|
||||
class TimelineViewGhostItem {
|
||||
public:
|
||||
enum DataType {
|
||||
kAttachedBlock,
|
||||
kReferenceBlock,
|
||||
kAttachedFootage,
|
||||
kGhostIsSliding,
|
||||
kTrimIsARollEdit,
|
||||
kTrimShouldBeIgnored
|
||||
k_attached_block,
|
||||
k_reference_block,
|
||||
k_attached_footage,
|
||||
k_ghost_is_sliding,
|
||||
k_trim_is_a_roll_edit,
|
||||
k_trim_should_be_ignored
|
||||
};
|
||||
|
||||
struct AttachedFootage {
|
||||
@@ -53,24 +53,24 @@ public:
|
||||
|
||||
TimelineViewGhostItem()
|
||||
: track_adj_(0)
|
||||
, mode_(Timeline::kNone)
|
||||
, mode_(Timeline::k_none)
|
||||
, can_have_zero_length_(true)
|
||||
, can_move_tracks_(true)
|
||||
, invisible_(false)
|
||||
{
|
||||
}
|
||||
|
||||
static TimelineViewGhostItem *FromBlock(Block *block)
|
||||
static TimelineViewGhostItem *from_block(Block *block)
|
||||
{
|
||||
TimelineViewGhostItem *ghost = new TimelineViewGhostItem();
|
||||
|
||||
ghost->SetIn(block->in());
|
||||
ghost->SetOut(block->out());
|
||||
ghost->set_in(block->in());
|
||||
ghost->set_out(block->out());
|
||||
if (dynamic_cast<ClipBlock *>(block)) {
|
||||
ghost->SetMediaIn(static_cast<ClipBlock *>(block)->media_in());
|
||||
ghost->set_media_in(static_cast<ClipBlock *>(block)->media_in());
|
||||
}
|
||||
ghost->SetTrack(block->track()->ToReference());
|
||||
ghost->SetData(kAttachedBlock, QtUtils::PtrToValue(block));
|
||||
ghost->set_track(block->track()->to_reference());
|
||||
ghost->set_data(k_attached_block, QtUtils::ptr_to_value(block));
|
||||
|
||||
if (dynamic_cast<ClipBlock *>(block)) {
|
||||
ghost->can_have_zero_length_ = false;
|
||||
@@ -81,176 +81,176 @@ public:
|
||||
return ghost;
|
||||
}
|
||||
|
||||
bool CanHaveZeroLength() const
|
||||
bool can_have_zero_length() const
|
||||
{
|
||||
return can_have_zero_length_;
|
||||
}
|
||||
|
||||
bool GetCanMoveTracks() const
|
||||
bool get_can_move_tracks() const
|
||||
{
|
||||
return can_move_tracks_;
|
||||
}
|
||||
|
||||
void SetCanMoveTracks(bool e)
|
||||
void set_can_move_tracks(bool e)
|
||||
{
|
||||
can_move_tracks_ = e;
|
||||
}
|
||||
|
||||
const rational &GetIn() const
|
||||
const Rational &get_in() const
|
||||
{
|
||||
return in_;
|
||||
}
|
||||
|
||||
const rational &GetOut() const
|
||||
const Rational &get_out() const
|
||||
{
|
||||
return out_;
|
||||
}
|
||||
|
||||
const rational &GetMediaIn() const
|
||||
const Rational &get_media_in() const
|
||||
{
|
||||
return media_in_;
|
||||
}
|
||||
|
||||
rational GetLength() const
|
||||
Rational get_length() const
|
||||
{
|
||||
return out_ - in_;
|
||||
}
|
||||
|
||||
rational GetAdjustedLength() const
|
||||
Rational get_adjusted_length() const
|
||||
{
|
||||
return GetAdjustedOut() - GetAdjustedIn();
|
||||
return get_adjusted_out() - get_adjusted_in();
|
||||
}
|
||||
|
||||
void SetIn(const rational &in)
|
||||
void set_in(const Rational &in)
|
||||
{
|
||||
in_ = in;
|
||||
}
|
||||
|
||||
void SetOut(const rational &out)
|
||||
void set_out(const Rational &out)
|
||||
{
|
||||
out_ = out;
|
||||
}
|
||||
|
||||
void SetMediaIn(const rational &media_in)
|
||||
void set_media_in(const Rational &media_in)
|
||||
{
|
||||
media_in_ = media_in;
|
||||
}
|
||||
|
||||
void SetInAdjustment(const rational &in_adj)
|
||||
void set_in_adjustment(const Rational &in_adj)
|
||||
{
|
||||
in_adj_ = in_adj;
|
||||
}
|
||||
|
||||
void SetOutAdjustment(const rational &out_adj)
|
||||
void set_out_adjustment(const Rational &out_adj)
|
||||
{
|
||||
out_adj_ = out_adj;
|
||||
}
|
||||
|
||||
void SetTrackAdjustment(const int &track_adj)
|
||||
void set_track_adjustment(const int &track_adj)
|
||||
{
|
||||
track_adj_ = track_adj;
|
||||
}
|
||||
|
||||
void SetMediaInAdjustment(const rational &media_in_adj)
|
||||
void set_media_in_adjustment(const Rational &media_in_adj)
|
||||
{
|
||||
media_in_adj_ = media_in_adj;
|
||||
}
|
||||
|
||||
const rational &GetInAdjustment() const
|
||||
const Rational &get_in_adjustment() const
|
||||
{
|
||||
return in_adj_;
|
||||
}
|
||||
|
||||
const rational &GetOutAdjustment() const
|
||||
const Rational &get_out_adjustment() const
|
||||
{
|
||||
return out_adj_;
|
||||
}
|
||||
|
||||
const rational &GetMediaInAdjustment() const
|
||||
const Rational &get_media_in_adjustment() const
|
||||
{
|
||||
return media_in_adj_;
|
||||
}
|
||||
|
||||
const int &GetTrackAdjustment() const
|
||||
const int &get_track_adjustment() const
|
||||
{
|
||||
return track_adj_;
|
||||
}
|
||||
|
||||
rational GetAdjustedIn() const
|
||||
Rational get_adjusted_in() const
|
||||
{
|
||||
return in_ + in_adj_;
|
||||
}
|
||||
|
||||
rational GetAdjustedOut() const
|
||||
Rational get_adjusted_out() const
|
||||
{
|
||||
return out_ + out_adj_;
|
||||
}
|
||||
|
||||
rational GetAdjustedMediaIn() const
|
||||
Rational get_adjusted_media_in() const
|
||||
{
|
||||
return media_in_ + media_in_adj_;
|
||||
}
|
||||
|
||||
Track::Reference GetAdjustedTrack() const
|
||||
Track::Reference get_adjusted_track() const
|
||||
{
|
||||
return Track::Reference(track_.type(), track_.index() + track_adj_);
|
||||
}
|
||||
|
||||
const Timeline::MovementMode &GetMode() const
|
||||
const Timeline::MovementMode &get_mode() const
|
||||
{
|
||||
return mode_;
|
||||
}
|
||||
|
||||
void SetMode(const Timeline::MovementMode &mode)
|
||||
void set_mode(const Timeline::MovementMode &mode)
|
||||
{
|
||||
mode_ = mode;
|
||||
}
|
||||
|
||||
bool HasBeenAdjusted() const
|
||||
bool has_been_adjusted() const
|
||||
{
|
||||
return GetInAdjustment() != 0 || GetOutAdjustment() != 0 ||
|
||||
GetMediaInAdjustment() != 0 || GetTrackAdjustment() != 0;
|
||||
return get_in_adjustment() != 0 || get_out_adjustment() != 0 ||
|
||||
get_media_in_adjustment() != 0 || get_track_adjustment() != 0;
|
||||
}
|
||||
|
||||
QVariant GetData(int key) const
|
||||
QVariant get_data(int key) const
|
||||
{
|
||||
return data_.value(key);
|
||||
}
|
||||
|
||||
void SetData(int key, const QVariant &value)
|
||||
void set_data(int key, const QVariant &value)
|
||||
{
|
||||
data_.insert(key, value);
|
||||
}
|
||||
|
||||
const Track::Reference &GetTrack() const
|
||||
const Track::Reference &get_track() const
|
||||
{
|
||||
return track_;
|
||||
}
|
||||
|
||||
void SetTrack(const Track::Reference &track)
|
||||
void set_track(const Track::Reference &track)
|
||||
{
|
||||
track_ = track;
|
||||
}
|
||||
|
||||
bool IsInvisible() const
|
||||
bool is_invisible() const
|
||||
{
|
||||
return invisible_;
|
||||
}
|
||||
|
||||
void SetInvisible(bool e)
|
||||
void set_invisible(bool e)
|
||||
{
|
||||
invisible_ = e;
|
||||
}
|
||||
|
||||
protected:
|
||||
private:
|
||||
rational in_;
|
||||
rational out_;
|
||||
rational media_in_;
|
||||
Rational in_;
|
||||
Rational out_;
|
||||
Rational media_in_;
|
||||
|
||||
rational in_adj_;
|
||||
rational out_adj_;
|
||||
rational media_in_adj_;
|
||||
Rational in_adj_;
|
||||
Rational out_adj_;
|
||||
Rational media_in_adj_;
|
||||
|
||||
int track_adj_;
|
||||
|
||||
@@ -270,4 +270,4 @@ private:
|
||||
|
||||
Q_DECLARE_METATYPE(olive::TimelineViewGhostItem::AttachedFootage)
|
||||
|
||||
#endif // TIMELINEVIEWGHOSTITEM_H
|
||||
#endif // OAK_TIMELINEVIEWGHOSTITEM_H
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMELINEVIEWMOUSEEVENT_H
|
||||
#define TIMELINEVIEWMOUSEEVENT_H
|
||||
#ifndef OAK_TIMELINEVIEWMOUSEEVENT_H
|
||||
#define OAK_TIMELINEVIEWMOUSEEVENT_H
|
||||
|
||||
#include <QEvent>
|
||||
#include <QMimeData>
|
||||
@@ -37,7 +37,7 @@ class TimelineViewMouseEvent {
|
||||
public:
|
||||
TimelineViewMouseEvent(
|
||||
const QPointF &scene_pos, const QPoint &screen_pos,
|
||||
const double &scale_x, const rational &timebase,
|
||||
const double &scale_x, const Rational &timebase,
|
||||
const Track::Reference &track, const Qt::MouseButton &button,
|
||||
const Qt::KeyboardModifiers &modifiers = Qt::NoModifier)
|
||||
: scene_pos_(scene_pos)
|
||||
@@ -53,12 +53,12 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
TimelineCoordinate GetCoordinates(bool round_time = false) const
|
||||
TimelineCoordinate get_coordinates(bool round_time = false) const
|
||||
{
|
||||
return TimelineCoordinate(GetFrame(round_time), track_);
|
||||
return TimelineCoordinate(get_frame(round_time), track_);
|
||||
}
|
||||
|
||||
const Qt::KeyboardModifiers &GetModifiers() const
|
||||
const Qt::KeyboardModifiers &get_modifiers() const
|
||||
{
|
||||
return modifiers_;
|
||||
}
|
||||
@@ -72,23 +72,23 @@ public:
|
||||
* always to the left of the cursor. The former behavior is better for clicking between frames (e.g. razor tool) and
|
||||
* the latter is better for clicking directly on frames (e.g. pointer tool).
|
||||
*/
|
||||
rational GetFrame(bool round = false) const
|
||||
Rational get_frame(bool round = false) const
|
||||
{
|
||||
return TimeScaledObject::SceneToTime(GetSceneX(), scale_x_, timebase_,
|
||||
return TimeScaledObject::scene_to_time(get_scene_x(), scale_x_, timebase_,
|
||||
round);
|
||||
}
|
||||
|
||||
const Track::Reference &GetTrack() const
|
||||
const Track::Reference &get_track() const
|
||||
{
|
||||
return track_;
|
||||
}
|
||||
|
||||
const QMimeData *GetMimeData()
|
||||
const QMimeData *get_mime_data()
|
||||
{
|
||||
return mime_data_;
|
||||
}
|
||||
|
||||
void SetMimeData(const QMimeData *data)
|
||||
void set_mime_data(const QMimeData *data)
|
||||
{
|
||||
mime_data_ = data;
|
||||
}
|
||||
@@ -98,21 +98,21 @@ public:
|
||||
source_event_ = event;
|
||||
}
|
||||
|
||||
qreal GetSceneX() const
|
||||
qreal get_scene_x() const
|
||||
{
|
||||
return scene_pos_.x();
|
||||
}
|
||||
|
||||
const QPointF &GetScenePos() const
|
||||
const QPointF &get_scene_pos() const
|
||||
{
|
||||
return scene_pos_;
|
||||
}
|
||||
const QPoint &GetScreenPos() const
|
||||
const QPoint &get_screen_pos() const
|
||||
{
|
||||
return screen_pos_;
|
||||
}
|
||||
|
||||
const Qt::MouseButton &GetButton() const
|
||||
const Qt::MouseButton &get_button() const
|
||||
{
|
||||
return button_;
|
||||
}
|
||||
@@ -129,11 +129,11 @@ public:
|
||||
source_event_->ignore();
|
||||
}
|
||||
|
||||
bool GetBypassImportBuffer() const
|
||||
bool get_bypass_import_buffer() const
|
||||
{
|
||||
return bypass_import_buffer_;
|
||||
}
|
||||
void SetBypassImportBuffer(bool e)
|
||||
void set_bypass_import_buffer(bool e)
|
||||
{
|
||||
bypass_import_buffer_ = e;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ private:
|
||||
QPointF scene_pos_;
|
||||
QPoint screen_pos_;
|
||||
double scale_x_;
|
||||
rational timebase_;
|
||||
Rational timebase_;
|
||||
|
||||
Track::Reference track_;
|
||||
|
||||
@@ -159,4 +159,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // TIMELINEVIEWMOUSEEVENT_H
|
||||
#endif // OAK_TIMELINEVIEWMOUSEEVENT_H
|
||||
|
||||
Reference in New Issue
Block a user