change: change code style to Linux style except indent.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -32,129 +32,136 @@
|
||||
#include "timelineviewghostitem.h"
|
||||
#include "widget/timebased/timebasedview.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief A widget for viewing and interacting Sequences
|
||||
*
|
||||
* This widget primarily exposes users to viewing and modifying Block nodes, usually through a TimelineOutput node.
|
||||
*/
|
||||
class TimelineView : public TimeBasedView
|
||||
{
|
||||
Q_OBJECT
|
||||
class TimelineView : public TimeBasedView {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TimelineView(Qt::Alignment vertical_alignment = Qt::AlignTop,
|
||||
QWidget* parent = nullptr);
|
||||
TimelineView(Qt::Alignment vertical_alignment = Qt::AlignTop,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
int GetTrackY(int track_index) const;
|
||||
int GetTrackHeight(int track_index) const;
|
||||
int GetTrackY(int track_index) const;
|
||||
int GetTrackHeight(int track_index) const;
|
||||
|
||||
QPoint GetScrollCoordinates() const;
|
||||
void SetScrollCoordinates(const QPoint& pt);
|
||||
QPoint GetScrollCoordinates() const;
|
||||
void SetScrollCoordinates(const QPoint &pt);
|
||||
|
||||
void ConnectTrackList(TrackList* list);
|
||||
void ConnectTrackList(TrackList *list);
|
||||
|
||||
void SetBeamCursor(const TimelineCoordinate& coord);
|
||||
void SetTransitionOverlay(ClipBlock *out, ClipBlock *in);
|
||||
void EnableRecordingOverlay(const TimelineCoordinate &coord);
|
||||
void DisableRecordingOverlay();
|
||||
void SetBeamCursor(const TimelineCoordinate &coord);
|
||||
void SetTransitionOverlay(ClipBlock *out, ClipBlock *in);
|
||||
void EnableRecordingOverlay(const TimelineCoordinate &coord);
|
||||
void DisableRecordingOverlay();
|
||||
|
||||
void SetSelectionList(QHash<Track::Reference, TimeRangeList>* s)
|
||||
{
|
||||
selections_ = s;
|
||||
}
|
||||
void SetSelectionList(QHash<Track::Reference, TimeRangeList> *s)
|
||||
{
|
||||
selections_ = s;
|
||||
}
|
||||
|
||||
void SetGhostList(QVector<TimelineViewGhostItem*>* ghosts)
|
||||
{
|
||||
ghosts_ = ghosts;
|
||||
}
|
||||
void SetGhostList(QVector<TimelineViewGhostItem *> *ghosts)
|
||||
{
|
||||
ghosts_ = ghosts;
|
||||
}
|
||||
|
||||
int SceneToTrack(double y);
|
||||
int SceneToTrack(double y);
|
||||
|
||||
Block* GetItemAtScenePos(const rational& time, int track_index) const;
|
||||
Block *GetItemAtScenePos(const rational &time, int track_index) const;
|
||||
|
||||
QVector<Block*> GetItemsAtSceneRect(const QRectF &rect) const;
|
||||
QVector<Block *> GetItemsAtSceneRect(const QRectF &rect) const;
|
||||
|
||||
signals:
|
||||
void MousePressed(TimelineViewMouseEvent* event);
|
||||
void MouseMoved(TimelineViewMouseEvent* event);
|
||||
void MouseReleased(TimelineViewMouseEvent* event);
|
||||
void MouseDoubleClicked(TimelineViewMouseEvent* event);
|
||||
void MousePressed(TimelineViewMouseEvent *event);
|
||||
void MouseMoved(TimelineViewMouseEvent *event);
|
||||
void MouseReleased(TimelineViewMouseEvent *event);
|
||||
void MouseDoubleClicked(TimelineViewMouseEvent *event);
|
||||
|
||||
void DragEntered(TimelineViewMouseEvent* event);
|
||||
void DragMoved(TimelineViewMouseEvent* event);
|
||||
void DragLeft(QDragLeaveEvent* event);
|
||||
void DragDropped(TimelineViewMouseEvent* event);
|
||||
void DragEntered(TimelineViewMouseEvent *event);
|
||||
void DragMoved(TimelineViewMouseEvent *event);
|
||||
void DragLeft(QDragLeaveEvent *event);
|
||||
void DragDropped(TimelineViewMouseEvent *event);
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent *event) override;
|
||||
virtual void mouseMoveEvent(QMouseEvent *event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
virtual void mousePressEvent(QMouseEvent *event) override;
|
||||
virtual void mouseMoveEvent(QMouseEvent *event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
|
||||
virtual void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
virtual void dragMoveEvent(QDragMoveEvent *event) override;
|
||||
virtual void dragLeaveEvent(QDragLeaveEvent *event) override;
|
||||
virtual void dropEvent(QDropEvent *event) override;
|
||||
virtual void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
virtual void dragMoveEvent(QDragMoveEvent *event) override;
|
||||
virtual void dragLeaveEvent(QDragLeaveEvent *event) override;
|
||||
virtual void dropEvent(QDropEvent *event) override;
|
||||
|
||||
virtual void drawBackground(QPainter *painter, const QRectF &rect) override;
|
||||
virtual void drawForeground(QPainter *painter, const QRectF &rect) override;
|
||||
virtual void drawBackground(QPainter *painter, const QRectF &rect) override;
|
||||
virtual void drawForeground(QPainter *painter, const QRectF &rect) override;
|
||||
|
||||
virtual void ToolChangedEvent(Tool::Item tool) override;
|
||||
virtual void ToolChangedEvent(Tool::Item tool) override;
|
||||
|
||||
virtual void SceneRectUpdateEvent(QRectF& rect) override;
|
||||
virtual void SceneRectUpdateEvent(QRectF &rect) override;
|
||||
|
||||
private:
|
||||
Track::Type ConnectedTrackType();
|
||||
Track::Type ConnectedTrackType();
|
||||
|
||||
TimelineCoordinate ScreenToCoordinate(const QPoint& pt);
|
||||
TimelineCoordinate SceneToCoordinate(const QPointF& pt);
|
||||
TimelineCoordinate ScreenToCoordinate(const QPoint &pt);
|
||||
TimelineCoordinate SceneToCoordinate(const QPointF &pt);
|
||||
|
||||
TimelineViewMouseEvent CreateMouseEvent(QMouseEvent* event);
|
||||
TimelineViewMouseEvent CreateMouseEvent(const QPoint &pos, Qt::MouseButton button, Qt::KeyboardModifiers modifiers);
|
||||
TimelineViewMouseEvent CreateMouseEvent(QMouseEvent *event);
|
||||
TimelineViewMouseEvent CreateMouseEvent(const QPoint &pos,
|
||||
Qt::MouseButton button,
|
||||
Qt::KeyboardModifiers modifiers);
|
||||
|
||||
void DrawBlocks(QPainter* painter, bool foreground);
|
||||
void DrawBlocks(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, qreal height)
|
||||
{
|
||||
ClipBlock *cb = dynamic_cast<ClipBlock*>(block);
|
||||
return DrawBlock(painter, foreground, block, top, height, block->in(), block->out(), cb ? cb->media_in() : 0);
|
||||
}
|
||||
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,
|
||||
qreal height)
|
||||
{
|
||||
ClipBlock *cb = dynamic_cast<ClipBlock *>(block);
|
||||
return DrawBlock(painter, foreground, block, top, height, block->in(),
|
||||
block->out(), cb ? cb->media_in() : 0);
|
||||
}
|
||||
|
||||
void DrawZebraStripes(QPainter *painter, const QRectF &r);
|
||||
void DrawZebraStripes(QPainter *painter, const QRectF &r);
|
||||
|
||||
int GetHeightOfAllTracks() const;
|
||||
int GetHeightOfAllTracks() const;
|
||||
|
||||
void UpdatePlayheadRect();
|
||||
void UpdatePlayheadRect();
|
||||
|
||||
qreal GetTimelineLeftBound() const;
|
||||
qreal GetTimelineLeftBound() const;
|
||||
|
||||
qreal GetTimelineRightBound() const;
|
||||
qreal GetTimelineRightBound() const;
|
||||
|
||||
void DrawThumbnail(QPainter *painter, const FrameHashCache *thumbs, const rational &time, int x, const QRect &preview_rect, QRect *thumb_rect) const;
|
||||
void DrawThumbnail(QPainter *painter, const FrameHashCache *thumbs,
|
||||
const rational &time, int x, const QRect &preview_rect,
|
||||
QRect *thumb_rect) const;
|
||||
|
||||
QHash<Track::Reference, TimeRangeList>* selections_;
|
||||
QHash<Track::Reference, TimeRangeList> *selections_;
|
||||
|
||||
QVector<TimelineViewGhostItem*>* ghosts_;
|
||||
QVector<TimelineViewGhostItem *> *ghosts_;
|
||||
|
||||
bool show_beam_cursor_;
|
||||
bool show_beam_cursor_;
|
||||
|
||||
TimelineCoordinate cursor_coord_;
|
||||
TimelineCoordinate cursor_coord_;
|
||||
|
||||
TrackList* connected_track_list_;
|
||||
TrackList *connected_track_list_;
|
||||
|
||||
ClipBlock *transition_overlay_out_;
|
||||
ClipBlock *transition_overlay_in_;
|
||||
ClipBlock *transition_overlay_out_;
|
||||
ClipBlock *transition_overlay_in_;
|
||||
|
||||
QMap<TimelineMarker*, QRectF> clip_marker_rects_;
|
||||
QMap<TimelineMarker *, QRectF> clip_marker_rects_;
|
||||
|
||||
bool recording_overlay_;
|
||||
TimelineCoordinate recording_coord_;
|
||||
bool recording_overlay_;
|
||||
TimelineCoordinate recording_coord_;
|
||||
|
||||
private slots:
|
||||
void TrackListChanged();
|
||||
|
||||
void TrackListChanged();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -29,244 +29,240 @@
|
||||
#include "node/project/footage/footage.h"
|
||||
#include "timeline/timelinecommon.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
/**
|
||||
* @brief A graphical representation of changes the user is making before they apply it
|
||||
*/
|
||||
class TimelineViewGhostItem
|
||||
{
|
||||
class TimelineViewGhostItem {
|
||||
public:
|
||||
enum DataType {
|
||||
kAttachedBlock,
|
||||
kReferenceBlock,
|
||||
kAttachedFootage,
|
||||
kGhostIsSliding,
|
||||
kTrimIsARollEdit,
|
||||
kTrimShouldBeIgnored
|
||||
};
|
||||
enum DataType {
|
||||
kAttachedBlock,
|
||||
kReferenceBlock,
|
||||
kAttachedFootage,
|
||||
kGhostIsSliding,
|
||||
kTrimIsARollEdit,
|
||||
kTrimShouldBeIgnored
|
||||
};
|
||||
|
||||
struct AttachedFootage {
|
||||
ViewerOutput* footage;
|
||||
QString output;
|
||||
};
|
||||
struct AttachedFootage {
|
||||
ViewerOutput *footage;
|
||||
QString output;
|
||||
};
|
||||
|
||||
TimelineViewGhostItem() :
|
||||
track_adj_(0),
|
||||
mode_(Timeline::kNone),
|
||||
can_have_zero_length_(true),
|
||||
can_move_tracks_(true),
|
||||
invisible_(false)
|
||||
{
|
||||
}
|
||||
TimelineViewGhostItem()
|
||||
: track_adj_(0)
|
||||
, mode_(Timeline::kNone)
|
||||
, can_have_zero_length_(true)
|
||||
, can_move_tracks_(true)
|
||||
, invisible_(false)
|
||||
{
|
||||
}
|
||||
|
||||
static TimelineViewGhostItem* FromBlock(Block *block)
|
||||
{
|
||||
TimelineViewGhostItem* ghost = new TimelineViewGhostItem();
|
||||
static TimelineViewGhostItem *FromBlock(Block *block)
|
||||
{
|
||||
TimelineViewGhostItem *ghost = new TimelineViewGhostItem();
|
||||
|
||||
ghost->SetIn(block->in());
|
||||
ghost->SetOut(block->out());
|
||||
if (dynamic_cast<ClipBlock*>(block)) {
|
||||
ghost->SetMediaIn(static_cast<ClipBlock*>(block)->media_in());
|
||||
}
|
||||
ghost->SetTrack(block->track()->ToReference());
|
||||
ghost->SetData(kAttachedBlock, QtUtils::PtrToValue(block));
|
||||
ghost->SetIn(block->in());
|
||||
ghost->SetOut(block->out());
|
||||
if (dynamic_cast<ClipBlock *>(block)) {
|
||||
ghost->SetMediaIn(static_cast<ClipBlock *>(block)->media_in());
|
||||
}
|
||||
ghost->SetTrack(block->track()->ToReference());
|
||||
ghost->SetData(kAttachedBlock, QtUtils::PtrToValue(block));
|
||||
|
||||
if (dynamic_cast<ClipBlock*>(block)) {
|
||||
ghost->can_have_zero_length_ = false;
|
||||
} else if (dynamic_cast<TransitionBlock*>(block)) {
|
||||
ghost->can_have_zero_length_ = false;
|
||||
}
|
||||
if (dynamic_cast<ClipBlock *>(block)) {
|
||||
ghost->can_have_zero_length_ = false;
|
||||
} else if (dynamic_cast<TransitionBlock *>(block)) {
|
||||
ghost->can_have_zero_length_ = false;
|
||||
}
|
||||
|
||||
return ghost;
|
||||
}
|
||||
return ghost;
|
||||
}
|
||||
|
||||
bool CanHaveZeroLength() const
|
||||
{
|
||||
return can_have_zero_length_;
|
||||
}
|
||||
bool CanHaveZeroLength() const
|
||||
{
|
||||
return can_have_zero_length_;
|
||||
}
|
||||
|
||||
bool GetCanMoveTracks() const
|
||||
{
|
||||
return can_move_tracks_;
|
||||
}
|
||||
bool GetCanMoveTracks() const
|
||||
{
|
||||
return can_move_tracks_;
|
||||
}
|
||||
|
||||
void SetCanMoveTracks(bool e)
|
||||
{
|
||||
can_move_tracks_ = e;
|
||||
}
|
||||
void SetCanMoveTracks(bool e)
|
||||
{
|
||||
can_move_tracks_ = e;
|
||||
}
|
||||
|
||||
const rational& GetIn() const
|
||||
{
|
||||
return in_;
|
||||
}
|
||||
const rational &GetIn() const
|
||||
{
|
||||
return in_;
|
||||
}
|
||||
|
||||
const rational& GetOut() const
|
||||
{
|
||||
return out_;
|
||||
}
|
||||
const rational &GetOut() const
|
||||
{
|
||||
return out_;
|
||||
}
|
||||
|
||||
const rational& GetMediaIn() const
|
||||
{
|
||||
return media_in_;
|
||||
}
|
||||
const rational &GetMediaIn() const
|
||||
{
|
||||
return media_in_;
|
||||
}
|
||||
|
||||
rational GetLength() const
|
||||
{
|
||||
return out_ - in_;
|
||||
}
|
||||
rational GetLength() const
|
||||
{
|
||||
return out_ - in_;
|
||||
}
|
||||
|
||||
rational GetAdjustedLength() const
|
||||
{
|
||||
return GetAdjustedOut() - GetAdjustedIn();
|
||||
}
|
||||
rational GetAdjustedLength() const
|
||||
{
|
||||
return GetAdjustedOut() - GetAdjustedIn();
|
||||
}
|
||||
|
||||
void SetIn(const rational& in)
|
||||
{
|
||||
in_ = in;
|
||||
}
|
||||
void SetIn(const rational &in)
|
||||
{
|
||||
in_ = in;
|
||||
}
|
||||
|
||||
void SetOut(const rational& out)
|
||||
{
|
||||
out_ = out;
|
||||
}
|
||||
void SetOut(const rational &out)
|
||||
{
|
||||
out_ = out;
|
||||
}
|
||||
|
||||
void SetMediaIn(const rational& media_in)
|
||||
{
|
||||
media_in_ = media_in;
|
||||
}
|
||||
void SetMediaIn(const rational &media_in)
|
||||
{
|
||||
media_in_ = media_in;
|
||||
}
|
||||
|
||||
void SetInAdjustment(const rational& in_adj)
|
||||
{
|
||||
in_adj_ = in_adj;
|
||||
}
|
||||
void SetInAdjustment(const rational &in_adj)
|
||||
{
|
||||
in_adj_ = in_adj;
|
||||
}
|
||||
|
||||
void SetOutAdjustment(const rational& out_adj)
|
||||
{
|
||||
out_adj_ = out_adj;
|
||||
}
|
||||
void SetOutAdjustment(const rational &out_adj)
|
||||
{
|
||||
out_adj_ = out_adj;
|
||||
}
|
||||
|
||||
void SetTrackAdjustment(const int& track_adj)
|
||||
{
|
||||
track_adj_ = track_adj;
|
||||
}
|
||||
void SetTrackAdjustment(const int &track_adj)
|
||||
{
|
||||
track_adj_ = track_adj;
|
||||
}
|
||||
|
||||
void SetMediaInAdjustment(const rational& media_in_adj)
|
||||
{
|
||||
media_in_adj_ = media_in_adj;
|
||||
}
|
||||
void SetMediaInAdjustment(const rational &media_in_adj)
|
||||
{
|
||||
media_in_adj_ = media_in_adj;
|
||||
}
|
||||
|
||||
const rational& GetInAdjustment() const
|
||||
{
|
||||
return in_adj_;
|
||||
}
|
||||
const rational &GetInAdjustment() const
|
||||
{
|
||||
return in_adj_;
|
||||
}
|
||||
|
||||
const rational& GetOutAdjustment() const
|
||||
{
|
||||
return out_adj_;
|
||||
}
|
||||
const rational &GetOutAdjustment() const
|
||||
{
|
||||
return out_adj_;
|
||||
}
|
||||
|
||||
const rational& GetMediaInAdjustment() const
|
||||
{
|
||||
return media_in_adj_;
|
||||
}
|
||||
const rational &GetMediaInAdjustment() const
|
||||
{
|
||||
return media_in_adj_;
|
||||
}
|
||||
|
||||
const int& GetTrackAdjustment() const
|
||||
{
|
||||
return track_adj_;
|
||||
}
|
||||
const int &GetTrackAdjustment() const
|
||||
{
|
||||
return track_adj_;
|
||||
}
|
||||
|
||||
rational GetAdjustedIn() const
|
||||
{
|
||||
return in_ + in_adj_;
|
||||
}
|
||||
rational GetAdjustedIn() const
|
||||
{
|
||||
return in_ + in_adj_;
|
||||
}
|
||||
|
||||
rational GetAdjustedOut() const
|
||||
{
|
||||
return out_ + out_adj_;
|
||||
}
|
||||
rational GetAdjustedOut() const
|
||||
{
|
||||
return out_ + out_adj_;
|
||||
}
|
||||
|
||||
rational GetAdjustedMediaIn() const
|
||||
{
|
||||
return media_in_ + media_in_adj_;
|
||||
}
|
||||
rational GetAdjustedMediaIn() const
|
||||
{
|
||||
return media_in_ + media_in_adj_;
|
||||
}
|
||||
|
||||
Track::Reference GetAdjustedTrack() const
|
||||
{
|
||||
return Track::Reference(track_.type(), track_.index() + track_adj_);
|
||||
}
|
||||
Track::Reference GetAdjustedTrack() const
|
||||
{
|
||||
return Track::Reference(track_.type(), track_.index() + track_adj_);
|
||||
}
|
||||
|
||||
const Timeline::MovementMode& GetMode() const
|
||||
{
|
||||
return mode_;
|
||||
}
|
||||
const Timeline::MovementMode &GetMode() const
|
||||
{
|
||||
return mode_;
|
||||
}
|
||||
|
||||
void SetMode(const Timeline::MovementMode& mode)
|
||||
{
|
||||
mode_ = mode;
|
||||
}
|
||||
void SetMode(const Timeline::MovementMode &mode)
|
||||
{
|
||||
mode_ = mode;
|
||||
}
|
||||
|
||||
bool HasBeenAdjusted() const
|
||||
{
|
||||
return GetInAdjustment() != 0
|
||||
|| GetOutAdjustment() != 0
|
||||
|| GetMediaInAdjustment() != 0
|
||||
|| GetTrackAdjustment() != 0;
|
||||
}
|
||||
bool HasBeenAdjusted() const
|
||||
{
|
||||
return GetInAdjustment() != 0 || GetOutAdjustment() != 0 ||
|
||||
GetMediaInAdjustment() != 0 || GetTrackAdjustment() != 0;
|
||||
}
|
||||
|
||||
QVariant GetData(int key) const
|
||||
{
|
||||
return data_.value(key);
|
||||
}
|
||||
QVariant GetData(int key) const
|
||||
{
|
||||
return data_.value(key);
|
||||
}
|
||||
|
||||
void SetData(int key, const QVariant& value)
|
||||
{
|
||||
data_.insert(key, value);
|
||||
}
|
||||
void SetData(int key, const QVariant &value)
|
||||
{
|
||||
data_.insert(key, value);
|
||||
}
|
||||
|
||||
const Track::Reference& GetTrack() const
|
||||
{
|
||||
return track_;
|
||||
}
|
||||
const Track::Reference &GetTrack() const
|
||||
{
|
||||
return track_;
|
||||
}
|
||||
|
||||
void SetTrack(const Track::Reference& track)
|
||||
{
|
||||
track_ = track;
|
||||
}
|
||||
void SetTrack(const Track::Reference &track)
|
||||
{
|
||||
track_ = track;
|
||||
}
|
||||
|
||||
bool IsInvisible() const
|
||||
{
|
||||
return invisible_;
|
||||
}
|
||||
bool IsInvisible() const
|
||||
{
|
||||
return invisible_;
|
||||
}
|
||||
|
||||
void SetInvisible(bool e)
|
||||
{
|
||||
invisible_ = e;
|
||||
}
|
||||
void SetInvisible(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_;
|
||||
int track_adj_;
|
||||
|
||||
Timeline::MovementMode mode_;
|
||||
Timeline::MovementMode mode_;
|
||||
|
||||
bool can_have_zero_length_;
|
||||
bool can_move_tracks_;
|
||||
bool can_have_zero_length_;
|
||||
bool can_move_tracks_;
|
||||
|
||||
Track::Reference track_;
|
||||
Track::Reference track_;
|
||||
|
||||
QHash<int, QVariant> data_;
|
||||
|
||||
bool invisible_;
|
||||
QHash<int, QVariant> data_;
|
||||
|
||||
bool invisible_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -29,42 +29,40 @@
|
||||
#include "timeline/timelinecoordinate.h"
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class TimelineViewMouseEvent
|
||||
namespace olive
|
||||
{
|
||||
|
||||
class TimelineViewMouseEvent {
|
||||
public:
|
||||
TimelineViewMouseEvent(const QPointF& scene_pos,
|
||||
const QPoint &screen_pos,
|
||||
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),
|
||||
screen_pos_(screen_pos),
|
||||
scale_x_(scale_x),
|
||||
timebase_(timebase),
|
||||
track_(track),
|
||||
button_(button),
|
||||
modifiers_(modifiers),
|
||||
source_event_(nullptr),
|
||||
mime_data_(nullptr),
|
||||
bypass_import_buffer_(false)
|
||||
{
|
||||
}
|
||||
TimelineViewMouseEvent(
|
||||
const QPointF &scene_pos, const QPoint &screen_pos,
|
||||
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)
|
||||
, screen_pos_(screen_pos)
|
||||
, scale_x_(scale_x)
|
||||
, timebase_(timebase)
|
||||
, track_(track)
|
||||
, button_(button)
|
||||
, modifiers_(modifiers)
|
||||
, source_event_(nullptr)
|
||||
, mime_data_(nullptr)
|
||||
, bypass_import_buffer_(false)
|
||||
{
|
||||
}
|
||||
|
||||
TimelineCoordinate GetCoordinates(bool round_time = false) const
|
||||
{
|
||||
return TimelineCoordinate(GetFrame(round_time), track_);
|
||||
}
|
||||
TimelineCoordinate GetCoordinates(bool round_time = false) const
|
||||
{
|
||||
return TimelineCoordinate(GetFrame(round_time), track_);
|
||||
}
|
||||
|
||||
const Qt::KeyboardModifiers& GetModifiers() const
|
||||
{
|
||||
return modifiers_;
|
||||
}
|
||||
const Qt::KeyboardModifiers &GetModifiers() const
|
||||
{
|
||||
return modifiers_;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Gets the time at this cursor point
|
||||
*
|
||||
* @param round
|
||||
@@ -73,77 +71,89 @@ 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
|
||||
{
|
||||
return TimeScaledObject::SceneToTime(GetSceneX(), scale_x_, timebase_, round);
|
||||
}
|
||||
rational GetFrame(bool round = false) const
|
||||
{
|
||||
return TimeScaledObject::SceneToTime(GetSceneX(), scale_x_, timebase_,
|
||||
round);
|
||||
}
|
||||
|
||||
const Track::Reference& GetTrack() const
|
||||
{
|
||||
return track_;
|
||||
}
|
||||
const Track::Reference &GetTrack() const
|
||||
{
|
||||
return track_;
|
||||
}
|
||||
|
||||
const QMimeData *GetMimeData()
|
||||
{
|
||||
return mime_data_;
|
||||
}
|
||||
const QMimeData *GetMimeData()
|
||||
{
|
||||
return mime_data_;
|
||||
}
|
||||
|
||||
void SetMimeData(const QMimeData *data)
|
||||
{
|
||||
mime_data_ = data;
|
||||
}
|
||||
void SetMimeData(const QMimeData *data)
|
||||
{
|
||||
mime_data_ = data;
|
||||
}
|
||||
|
||||
void SetEvent(QEvent* event)
|
||||
{
|
||||
source_event_ = event;
|
||||
}
|
||||
void SetEvent(QEvent *event)
|
||||
{
|
||||
source_event_ = event;
|
||||
}
|
||||
|
||||
qreal GetSceneX() const
|
||||
{
|
||||
return scene_pos_.x();
|
||||
}
|
||||
qreal GetSceneX() const
|
||||
{
|
||||
return scene_pos_.x();
|
||||
}
|
||||
|
||||
const QPointF &GetScenePos() const { return scene_pos_; }
|
||||
const QPoint &GetScreenPos() const { return screen_pos_; }
|
||||
const QPointF &GetScenePos() const
|
||||
{
|
||||
return scene_pos_;
|
||||
}
|
||||
const QPoint &GetScreenPos() const
|
||||
{
|
||||
return screen_pos_;
|
||||
}
|
||||
|
||||
const Qt::MouseButton& GetButton() const
|
||||
{
|
||||
return button_;
|
||||
}
|
||||
const Qt::MouseButton &GetButton() const
|
||||
{
|
||||
return button_;
|
||||
}
|
||||
|
||||
void accept()
|
||||
{
|
||||
if (source_event_ != nullptr)
|
||||
source_event_->accept();
|
||||
}
|
||||
void accept()
|
||||
{
|
||||
if (source_event_ != nullptr)
|
||||
source_event_->accept();
|
||||
}
|
||||
|
||||
void ignore()
|
||||
{
|
||||
if (source_event_ != nullptr)
|
||||
source_event_->ignore();
|
||||
}
|
||||
void ignore()
|
||||
{
|
||||
if (source_event_ != nullptr)
|
||||
source_event_->ignore();
|
||||
}
|
||||
|
||||
bool GetBypassImportBuffer() const { return bypass_import_buffer_; }
|
||||
void SetBypassImportBuffer(bool e) { bypass_import_buffer_ = e; }
|
||||
bool GetBypassImportBuffer() const
|
||||
{
|
||||
return bypass_import_buffer_;
|
||||
}
|
||||
void SetBypassImportBuffer(bool e)
|
||||
{
|
||||
bypass_import_buffer_ = e;
|
||||
}
|
||||
|
||||
private:
|
||||
QPointF scene_pos_;
|
||||
QPoint screen_pos_;
|
||||
double scale_x_;
|
||||
rational timebase_;
|
||||
QPointF scene_pos_;
|
||||
QPoint screen_pos_;
|
||||
double scale_x_;
|
||||
rational timebase_;
|
||||
|
||||
Track::Reference track_;
|
||||
Track::Reference track_;
|
||||
|
||||
Qt::MouseButton button_;
|
||||
Qt::MouseButton button_;
|
||||
|
||||
Qt::KeyboardModifiers modifiers_;
|
||||
Qt::KeyboardModifiers modifiers_;
|
||||
|
||||
QEvent* source_event_;
|
||||
QEvent *source_event_;
|
||||
|
||||
const QMimeData* mime_data_;
|
||||
|
||||
bool bypass_import_buffer_;
|
||||
const QMimeData *mime_data_;
|
||||
|
||||
bool bypass_import_buffer_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user