change: change code style to Linux style except indent.
This commit is contained in:
@@ -20,33 +20,36 @@
|
||||
|
||||
#include "draggable.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
DraggableGizmo::DraggableGizmo(QObject *parent)
|
||||
: NodeGizmo{parent},
|
||||
drag_value_behavior_(kAbsolute)
|
||||
: NodeGizmo{ parent }
|
||||
, drag_value_behavior_(kAbsolute)
|
||||
{
|
||||
}
|
||||
|
||||
void DraggableGizmo::DragStart(const NodeValueRow &row, double abs_x, double abs_y, const rational &time)
|
||||
void DraggableGizmo::DragStart(const NodeValueRow &row, double abs_x,
|
||||
double abs_y, const rational &time)
|
||||
{
|
||||
for (int i=0; i<draggers_.size(); i++) {
|
||||
draggers_[i].Start(inputs_[i], time);
|
||||
}
|
||||
for (int i = 0; i < draggers_.size(); i++) {
|
||||
draggers_[i].Start(inputs_[i], time);
|
||||
}
|
||||
|
||||
emit HandleStart(row, abs_x, abs_y, time);
|
||||
emit HandleStart(row, abs_x, abs_y, time);
|
||||
}
|
||||
|
||||
void DraggableGizmo::DragMove(double x, double y, const Qt::KeyboardModifiers &modifiers)
|
||||
void DraggableGizmo::DragMove(double x, double y,
|
||||
const Qt::KeyboardModifiers &modifiers)
|
||||
{
|
||||
emit HandleMovement(x, y, modifiers);
|
||||
emit HandleMovement(x, y, modifiers);
|
||||
}
|
||||
|
||||
void DraggableGizmo::DragEnd(MultiUndoCommand *command)
|
||||
{
|
||||
for (int i=0; i<draggers_.size(); i++) {
|
||||
draggers_[i].End(command);
|
||||
}
|
||||
for (int i = 0; i < draggers_.size(); i++) {
|
||||
draggers_[i].End(command);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+42
-34
@@ -25,58 +25,66 @@
|
||||
#include "node/inputdragger.h"
|
||||
#include "undo/undocommand.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class DraggableGizmo : public NodeGizmo
|
||||
namespace olive
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
class DraggableGizmo : public NodeGizmo {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/// Changes what the X/Y coordinates emitted from HandleMovement specify
|
||||
enum DragValueBehavior {
|
||||
/// X/Y will be the exact mouse coordinates (in sequence pixels)
|
||||
kAbsolute,
|
||||
/// Changes what the X/Y coordinates emitted from HandleMovement specify
|
||||
enum DragValueBehavior {
|
||||
/// X/Y will be the exact mouse coordinates (in sequence pixels)
|
||||
kAbsolute,
|
||||
|
||||
/// X/Y will be the movement since the last time HandleMovement was called
|
||||
kDeltaFromPrevious,
|
||||
/// X/Y will be the movement since the last time HandleMovement was called
|
||||
kDeltaFromPrevious,
|
||||
|
||||
/// X/Y will be the movement from the start of the drag
|
||||
kDeltaFromStart
|
||||
};
|
||||
/// X/Y will be the movement from the start of the drag
|
||||
kDeltaFromStart
|
||||
};
|
||||
|
||||
explicit DraggableGizmo(QObject *parent = nullptr);
|
||||
explicit DraggableGizmo(QObject *parent = nullptr);
|
||||
|
||||
void DragStart(const NodeValueRow &row, double abs_x, double abs_y, const olive::core::rational &time);
|
||||
void DragStart(const NodeValueRow &row, double abs_x, double abs_y,
|
||||
const olive::core::rational &time);
|
||||
|
||||
void DragMove(double x, double y, const Qt::KeyboardModifiers &modifiers);
|
||||
void DragMove(double x, double y, const Qt::KeyboardModifiers &modifiers);
|
||||
|
||||
void DragEnd(olive::MultiUndoCommand *command);
|
||||
void DragEnd(olive::MultiUndoCommand *command);
|
||||
|
||||
void AddInput(const NodeKeyframeTrackReference &input)
|
||||
{
|
||||
inputs_.append(input);
|
||||
draggers_.append(NodeInputDragger());
|
||||
}
|
||||
void AddInput(const NodeKeyframeTrackReference &input)
|
||||
{
|
||||
inputs_.append(input);
|
||||
draggers_.append(NodeInputDragger());
|
||||
}
|
||||
|
||||
QVector<NodeInputDragger> &GetDraggers()
|
||||
{
|
||||
return draggers_;
|
||||
}
|
||||
QVector<NodeInputDragger> &GetDraggers()
|
||||
{
|
||||
return draggers_;
|
||||
}
|
||||
|
||||
DragValueBehavior GetDragValueBehavior() const { return drag_value_behavior_; }
|
||||
void SetDragValueBehavior(DragValueBehavior d) { drag_value_behavior_ = d; }
|
||||
DragValueBehavior GetDragValueBehavior() const
|
||||
{
|
||||
return drag_value_behavior_;
|
||||
}
|
||||
void SetDragValueBehavior(DragValueBehavior d)
|
||||
{
|
||||
drag_value_behavior_ = d;
|
||||
}
|
||||
|
||||
signals:
|
||||
void HandleStart(const olive::NodeValueRow &row, double x, double y, const olive::core::rational &time);
|
||||
void HandleStart(const olive::NodeValueRow &row, double x, double y,
|
||||
const olive::core::rational &time);
|
||||
|
||||
void HandleMovement(double x, double y, const Qt::KeyboardModifiers &modifiers);
|
||||
void HandleMovement(double x, double y,
|
||||
const Qt::KeyboardModifiers &modifiers);
|
||||
|
||||
private:
|
||||
QVector<NodeKeyframeTrackReference> inputs_;
|
||||
QVector<NodeKeyframeTrackReference> inputs_;
|
||||
|
||||
QVector<NodeInputDragger> draggers_;
|
||||
|
||||
DragValueBehavior drag_value_behavior_;
|
||||
QVector<NodeInputDragger> draggers_;
|
||||
|
||||
DragValueBehavior drag_value_behavior_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -20,17 +20,18 @@
|
||||
|
||||
#include "gizmo.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
NodeGizmo::NodeGizmo(QObject *parent) :
|
||||
visible_(true)
|
||||
namespace olive
|
||||
{
|
||||
setParent(parent);
|
||||
|
||||
NodeGizmo::NodeGizmo(QObject *parent)
|
||||
: visible_(true)
|
||||
{
|
||||
setParent(parent);
|
||||
}
|
||||
|
||||
NodeGizmo::~NodeGizmo()
|
||||
{
|
||||
setParent(nullptr);
|
||||
setParent(nullptr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+27
-14
@@ -26,30 +26,43 @@
|
||||
|
||||
#include "node/globals.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class NodeGizmo : public QObject
|
||||
namespace olive
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
class NodeGizmo : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit NodeGizmo(QObject *parent = nullptr);
|
||||
virtual ~NodeGizmo() override;
|
||||
explicit NodeGizmo(QObject *parent = nullptr);
|
||||
virtual ~NodeGizmo() override;
|
||||
|
||||
virtual void Draw(QPainter *p) const {}
|
||||
virtual void Draw(QPainter *p) const
|
||||
{
|
||||
}
|
||||
|
||||
const NodeGlobals &GetGlobals() const { return globals_; }
|
||||
void SetGlobals(const NodeGlobals &globals) { globals_ = globals; }
|
||||
const NodeGlobals &GetGlobals() const
|
||||
{
|
||||
return globals_;
|
||||
}
|
||||
void SetGlobals(const NodeGlobals &globals)
|
||||
{
|
||||
globals_ = globals;
|
||||
}
|
||||
|
||||
bool IsVisible() const { return visible_; }
|
||||
void SetVisible(bool e) { visible_ = e; }
|
||||
bool IsVisible() const
|
||||
{
|
||||
return visible_;
|
||||
}
|
||||
void SetVisible(bool e)
|
||||
{
|
||||
visible_ = e;
|
||||
}
|
||||
|
||||
signals:
|
||||
|
||||
private:
|
||||
NodeGlobals globals_;
|
||||
|
||||
bool visible_;
|
||||
NodeGlobals globals_;
|
||||
|
||||
bool visible_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+14
-13
@@ -20,26 +20,27 @@
|
||||
|
||||
#include "line.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
LineGizmo::LineGizmo(QObject *parent) :
|
||||
NodeGizmo(parent)
|
||||
LineGizmo::LineGizmo(QObject *parent)
|
||||
: NodeGizmo(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void LineGizmo::Draw(QPainter *p) const
|
||||
{
|
||||
// Draw transposed black
|
||||
QLineF transposed = p->transform().map(line_);
|
||||
transposed.translate(1, 1);
|
||||
transposed = p->transform().inverted().map(transposed);
|
||||
p->setPen(QPen(Qt::black, 0));
|
||||
p->drawLine(transposed);
|
||||
// Draw transposed black
|
||||
QLineF transposed = p->transform().map(line_);
|
||||
transposed.translate(1, 1);
|
||||
transposed = p->transform().inverted().map(transposed);
|
||||
p->setPen(QPen(Qt::black, 0));
|
||||
p->drawLine(transposed);
|
||||
|
||||
// Draw normal white polygon
|
||||
p->setPen(QPen(Qt::white, 0));
|
||||
p->setBrush(Qt::NoBrush);
|
||||
p->drawLine(line_);
|
||||
// Draw normal white polygon
|
||||
p->setPen(QPen(Qt::white, 0));
|
||||
p->setBrush(Qt::NoBrush);
|
||||
p->drawLine(line_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+15
-10
@@ -25,22 +25,27 @@
|
||||
|
||||
#include "gizmo.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class LineGizmo : public NodeGizmo
|
||||
namespace olive
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
class LineGizmo : public NodeGizmo {
|
||||
Q_OBJECT
|
||||
public:
|
||||
LineGizmo(QObject *parent = nullptr);
|
||||
LineGizmo(QObject *parent = nullptr);
|
||||
|
||||
const QLineF &GetLine() const { return line_; }
|
||||
void SetLine(const QLineF &line) { line_ = line; }
|
||||
const QLineF &GetLine() const
|
||||
{
|
||||
return line_;
|
||||
}
|
||||
void SetLine(const QLineF &line)
|
||||
{
|
||||
line_ = line;
|
||||
}
|
||||
|
||||
virtual void Draw(QPainter *p) const override;
|
||||
virtual void Draw(QPainter *p) const override;
|
||||
|
||||
private:
|
||||
QLineF line_;
|
||||
|
||||
QLineF line_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+14
-14
@@ -20,27 +20,27 @@
|
||||
|
||||
#include "path.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
PathGizmo::PathGizmo(QObject *parent) :
|
||||
DraggableGizmo{parent}
|
||||
namespace olive
|
||||
{
|
||||
|
||||
PathGizmo::PathGizmo(QObject *parent)
|
||||
: DraggableGizmo{ parent }
|
||||
{
|
||||
}
|
||||
|
||||
void PathGizmo::Draw(QPainter *p) const
|
||||
{
|
||||
// Draw transposed black
|
||||
QPainterPath transposed = p->transform().map(path_);
|
||||
transposed.translate(1, 1);
|
||||
transposed = p->transform().inverted().map(transposed);
|
||||
p->setPen(QPen(Qt::black, 0));
|
||||
p->drawPath(transposed);
|
||||
// Draw transposed black
|
||||
QPainterPath transposed = p->transform().map(path_);
|
||||
transposed.translate(1, 1);
|
||||
transposed = p->transform().inverted().map(transposed);
|
||||
p->setPen(QPen(Qt::black, 0));
|
||||
p->drawPath(transposed);
|
||||
|
||||
// Draw normal white polygon
|
||||
p->setPen(QPen(Qt::white, 0));
|
||||
p->setBrush(Qt::NoBrush);
|
||||
p->drawPath(path_);
|
||||
// Draw normal white polygon
|
||||
p->setPen(QPen(Qt::white, 0));
|
||||
p->setBrush(Qt::NoBrush);
|
||||
p->drawPath(path_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+15
-10
@@ -25,22 +25,27 @@
|
||||
|
||||
#include "draggable.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class PathGizmo : public DraggableGizmo
|
||||
namespace olive
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
class PathGizmo : public DraggableGizmo {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PathGizmo(QObject *parent = nullptr);
|
||||
explicit PathGizmo(QObject *parent = nullptr);
|
||||
|
||||
const QPainterPath &GetPath() const { return path_; }
|
||||
void SetPath(const QPainterPath &path) { path_ = path; }
|
||||
const QPainterPath &GetPath() const
|
||||
{
|
||||
return path_;
|
||||
}
|
||||
void SetPath(const QPainterPath &path)
|
||||
{
|
||||
path_ = path;
|
||||
}
|
||||
|
||||
virtual void Draw(QPainter *p) const override;
|
||||
virtual void Draw(QPainter *p) const override;
|
||||
|
||||
private:
|
||||
QPainterPath path_;
|
||||
|
||||
QPainterPath path_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+50
-50
@@ -22,87 +22,87 @@
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
PointGizmo::PointGizmo(const Shape &shape, bool smaller, QObject *parent) :
|
||||
DraggableGizmo{parent},
|
||||
shape_(shape),
|
||||
smaller_(smaller)
|
||||
PointGizmo::PointGizmo(const Shape &shape, bool smaller, QObject *parent)
|
||||
: DraggableGizmo{ parent }
|
||||
, shape_(shape)
|
||||
, smaller_(smaller)
|
||||
{
|
||||
}
|
||||
|
||||
PointGizmo::PointGizmo(const Shape &shape, QObject *parent) :
|
||||
PointGizmo(shape, false, parent)
|
||||
PointGizmo::PointGizmo(const Shape &shape, QObject *parent)
|
||||
: PointGizmo(shape, false, parent)
|
||||
{
|
||||
}
|
||||
|
||||
PointGizmo::PointGizmo(QObject *parent) :
|
||||
PointGizmo(kSquare, parent)
|
||||
PointGizmo::PointGizmo(QObject *parent)
|
||||
: PointGizmo(kSquare, parent)
|
||||
{
|
||||
}
|
||||
|
||||
void PointGizmo::Draw(QPainter *p) const
|
||||
{
|
||||
QRectF rect = GetDrawingRect(p->transform(), GetStandardRadius());
|
||||
QRectF rect = GetDrawingRect(p->transform(), GetStandardRadius());
|
||||
|
||||
if (shape_ != kAnchorPoint) {
|
||||
p->setPen(QPen(Qt::black, 0));
|
||||
p->setBrush(Qt::white);
|
||||
}
|
||||
if (shape_ != kAnchorPoint) {
|
||||
p->setPen(QPen(Qt::black, 0));
|
||||
p->setBrush(Qt::white);
|
||||
}
|
||||
|
||||
switch (shape_) {
|
||||
case kSquare:
|
||||
p->drawRect(rect);
|
||||
break;
|
||||
case kCircle:
|
||||
p->drawEllipse(rect);
|
||||
break;
|
||||
case kAnchorPoint:
|
||||
p->setPen(QPen(Qt::white, 0));
|
||||
p->setBrush(Qt::NoBrush);
|
||||
switch (shape_) {
|
||||
case kSquare:
|
||||
p->drawRect(rect);
|
||||
break;
|
||||
case kCircle:
|
||||
p->drawEllipse(rect);
|
||||
break;
|
||||
case kAnchorPoint:
|
||||
p->setPen(QPen(Qt::white, 0));
|
||||
p->setBrush(Qt::NoBrush);
|
||||
|
||||
p->drawEllipse(rect);
|
||||
p->drawLines({QPointF(rect.left(), rect.center().y()),
|
||||
QPointF(rect.right(), rect.center().y()),
|
||||
QPointF(rect.center().x(), rect.top()),
|
||||
QPointF(rect.center().x(), rect.bottom())});
|
||||
break;
|
||||
}
|
||||
p->drawEllipse(rect);
|
||||
p->drawLines({ QPointF(rect.left(), rect.center().y()),
|
||||
QPointF(rect.right(), rect.center().y()),
|
||||
QPointF(rect.center().x(), rect.top()),
|
||||
QPointF(rect.center().x(), rect.bottom()) });
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QRectF PointGizmo::GetClickingRect(const QTransform &t) const
|
||||
{
|
||||
return GetDrawingRect(t, GetStandardRadius());
|
||||
return GetDrawingRect(t, GetStandardRadius());
|
||||
}
|
||||
|
||||
double PointGizmo::GetStandardRadius()
|
||||
{
|
||||
return QFontMetrics(qApp->font()).height() * 0.25;
|
||||
return QFontMetrics(qApp->font()).height() * 0.25;
|
||||
}
|
||||
|
||||
QRectF PointGizmo::GetDrawingRect(const QTransform &transform, double radius) const
|
||||
QRectF PointGizmo::GetDrawingRect(const QTransform &transform,
|
||||
double radius) const
|
||||
{
|
||||
QRectF r(0,0, radius, radius);
|
||||
QRectF r(0, 0, radius, radius);
|
||||
|
||||
r = transform.inverted().mapRect(r);
|
||||
r = transform.inverted().mapRect(r);
|
||||
|
||||
double width = r.width();
|
||||
double height = r.height();
|
||||
double width = r.width();
|
||||
double height = r.height();
|
||||
|
||||
if (shape_ == kAnchorPoint) {
|
||||
width *= 2;
|
||||
height *= 2;
|
||||
}
|
||||
if (shape_ == kAnchorPoint) {
|
||||
width *= 2;
|
||||
height *= 2;
|
||||
}
|
||||
|
||||
if (smaller_) {
|
||||
width *= 0.5;
|
||||
height *= 0.5;
|
||||
}
|
||||
if (smaller_) {
|
||||
width *= 0.5;
|
||||
height *= 0.5;
|
||||
}
|
||||
|
||||
return QRectF(point_.x() - width,
|
||||
point_.y() - height,
|
||||
2*width,
|
||||
2*height);
|
||||
return QRectF(point_.x() - width, point_.y() - height, 2 * width,
|
||||
2 * height);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+40
-26
@@ -25,46 +25,60 @@
|
||||
|
||||
#include "draggable.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class PointGizmo : public DraggableGizmo
|
||||
namespace olive
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
class PointGizmo : public DraggableGizmo {
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Shape {
|
||||
kSquare,
|
||||
kCircle,
|
||||
kAnchorPoint
|
||||
};
|
||||
enum Shape { kSquare, kCircle, kAnchorPoint };
|
||||
|
||||
explicit PointGizmo(const Shape &shape, bool smaller, QObject *parent = nullptr);
|
||||
explicit PointGizmo(const Shape &shape, QObject *parent = nullptr);
|
||||
explicit PointGizmo(QObject *parent = nullptr);
|
||||
explicit PointGizmo(const Shape &shape, bool smaller,
|
||||
QObject *parent = nullptr);
|
||||
explicit PointGizmo(const Shape &shape, QObject *parent = nullptr);
|
||||
explicit PointGizmo(QObject *parent = nullptr);
|
||||
|
||||
const Shape &GetShape() const { return shape_; }
|
||||
void SetShape(const Shape &s) { shape_ = s; }
|
||||
const Shape &GetShape() const
|
||||
{
|
||||
return shape_;
|
||||
}
|
||||
void SetShape(const Shape &s)
|
||||
{
|
||||
shape_ = s;
|
||||
}
|
||||
|
||||
const QPointF &GetPoint() const { return point_; }
|
||||
void SetPoint(const QPointF &pt) { point_ = pt; }
|
||||
const QPointF &GetPoint() const
|
||||
{
|
||||
return point_;
|
||||
}
|
||||
void SetPoint(const QPointF &pt)
|
||||
{
|
||||
point_ = pt;
|
||||
}
|
||||
|
||||
bool GetSmaller() const { return smaller_; }
|
||||
void SetSmaller(bool e) { smaller_ = e; }
|
||||
bool GetSmaller() const
|
||||
{
|
||||
return smaller_;
|
||||
}
|
||||
void SetSmaller(bool e)
|
||||
{
|
||||
smaller_ = e;
|
||||
}
|
||||
|
||||
virtual void Draw(QPainter *p) const override;
|
||||
virtual void Draw(QPainter *p) const override;
|
||||
|
||||
QRectF GetClickingRect(const QTransform &t) const;
|
||||
QRectF GetClickingRect(const QTransform &t) const;
|
||||
|
||||
private:
|
||||
static double GetStandardRadius();
|
||||
static double GetStandardRadius();
|
||||
|
||||
QRectF GetDrawingRect(const QTransform &transform, double radius) const;
|
||||
QRectF GetDrawingRect(const QTransform &transform, double radius) const;
|
||||
|
||||
Shape shape_;
|
||||
Shape shape_;
|
||||
|
||||
QPointF point_;
|
||||
|
||||
bool smaller_;
|
||||
QPointF point_;
|
||||
|
||||
bool smaller_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+13
-12
@@ -20,26 +20,27 @@
|
||||
|
||||
#include "polygon.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
PolygonGizmo::PolygonGizmo(QObject *parent)
|
||||
: DraggableGizmo{parent}
|
||||
: DraggableGizmo{ parent }
|
||||
{
|
||||
}
|
||||
|
||||
void PolygonGizmo::Draw(QPainter *p) const
|
||||
{
|
||||
// Draw transposed black
|
||||
QPolygonF transposed = p->transform().map(polygon_);
|
||||
transposed.translate(1, 1);
|
||||
transposed = p->transform().inverted().map(transposed);
|
||||
p->setPen(QPen(Qt::black, 0));
|
||||
p->drawPolyline(transposed);
|
||||
// Draw transposed black
|
||||
QPolygonF transposed = p->transform().map(polygon_);
|
||||
transposed.translate(1, 1);
|
||||
transposed = p->transform().inverted().map(transposed);
|
||||
p->setPen(QPen(Qt::black, 0));
|
||||
p->drawPolyline(transposed);
|
||||
|
||||
// Draw normal white polygon
|
||||
p->setPen(QPen(Qt::white, 0));
|
||||
p->setBrush(Qt::NoBrush);
|
||||
p->drawPolyline(polygon_);
|
||||
// Draw normal white polygon
|
||||
p->setPen(QPen(Qt::white, 0));
|
||||
p->setBrush(Qt::NoBrush);
|
||||
p->drawPolyline(polygon_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+15
-10
@@ -25,22 +25,27 @@
|
||||
|
||||
#include "draggable.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class PolygonGizmo : public DraggableGizmo
|
||||
namespace olive
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
class PolygonGizmo : public DraggableGizmo {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PolygonGizmo(QObject *parent = nullptr);
|
||||
explicit PolygonGizmo(QObject *parent = nullptr);
|
||||
|
||||
const QPolygonF &GetPolygon() const { return polygon_; }
|
||||
void SetPolygon(const QPolygonF &polygon) { polygon_ = polygon; }
|
||||
const QPolygonF &GetPolygon() const
|
||||
{
|
||||
return polygon_;
|
||||
}
|
||||
void SetPolygon(const QPolygonF &polygon)
|
||||
{
|
||||
polygon_ = polygon;
|
||||
}
|
||||
|
||||
virtual void Draw(QPainter *p) const override;
|
||||
virtual void Draw(QPainter *p) const override;
|
||||
|
||||
private:
|
||||
QPolygonF polygon_;
|
||||
|
||||
QPolygonF polygon_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
|
||||
#include "screen.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
ScreenGizmo::ScreenGizmo(QObject *parent)
|
||||
: DraggableGizmo{parent}
|
||||
namespace olive
|
||||
{
|
||||
|
||||
ScreenGizmo::ScreenGizmo(QObject *parent)
|
||||
: DraggableGizmo{ parent }
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,14 +23,13 @@
|
||||
|
||||
#include "draggable.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class ScreenGizmo : public DraggableGizmo
|
||||
namespace olive
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ScreenGizmo(QObject *parent = nullptr);
|
||||
|
||||
class ScreenGizmo : public DraggableGizmo {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ScreenGizmo(QObject *parent = nullptr);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+15
-14
@@ -23,34 +23,35 @@
|
||||
#include "core.h"
|
||||
#include "undo/undocommand.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
TextGizmo::TextGizmo(QObject *parent)
|
||||
: NodeGizmo{parent},
|
||||
valign_(Qt::AlignTop)
|
||||
namespace olive
|
||||
{
|
||||
|
||||
TextGizmo::TextGizmo(QObject *parent)
|
||||
: NodeGizmo{ parent }
|
||||
, valign_(Qt::AlignTop)
|
||||
{
|
||||
}
|
||||
|
||||
void TextGizmo::SetRect(const QRectF &r)
|
||||
{
|
||||
rect_ = r;
|
||||
emit RectChanged(rect_);
|
||||
rect_ = r;
|
||||
emit RectChanged(rect_);
|
||||
}
|
||||
|
||||
void TextGizmo::UpdateInputHtml(const QString &s, const rational &time)
|
||||
{
|
||||
if (input_.IsValid()) {
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
Node::SetValueAtTime(input_.input(), time, s, input_.track(), command, true);
|
||||
Core::instance()->undo_stack()->push(command, tr("Edit Text"));
|
||||
}
|
||||
if (input_.IsValid()) {
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
Node::SetValueAtTime(input_.input(), time, s, input_.track(), command,
|
||||
true);
|
||||
Core::instance()->undo_stack()->push(command, tr("Edit Text"));
|
||||
}
|
||||
}
|
||||
|
||||
void TextGizmo::SetVerticalAlignment(Qt::Alignment va)
|
||||
{
|
||||
valign_ = va;
|
||||
emit VerticalAlignmentChanged(valign_);
|
||||
valign_ = va;
|
||||
emit VerticalAlignmentChanged(valign_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+36
-22
@@ -24,42 +24,56 @@
|
||||
#include "gizmo.h"
|
||||
#include "node/param.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class TextGizmo : public NodeGizmo
|
||||
namespace olive
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
class TextGizmo : public NodeGizmo {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TextGizmo(QObject *parent = nullptr);
|
||||
explicit TextGizmo(QObject *parent = nullptr);
|
||||
|
||||
const QRectF &GetRect() const { return rect_; }
|
||||
void SetRect(const QRectF &r);
|
||||
const QRectF &GetRect() const
|
||||
{
|
||||
return rect_;
|
||||
}
|
||||
void SetRect(const QRectF &r);
|
||||
|
||||
const QString &GetHtml() const { return text_; }
|
||||
void SetHtml(const QString &t) { text_ = t; }
|
||||
const QString &GetHtml() const
|
||||
{
|
||||
return text_;
|
||||
}
|
||||
void SetHtml(const QString &t)
|
||||
{
|
||||
text_ = t;
|
||||
}
|
||||
|
||||
void SetInput(const NodeKeyframeTrackReference &input) { input_ = input; }
|
||||
void SetInput(const NodeKeyframeTrackReference &input)
|
||||
{
|
||||
input_ = input;
|
||||
}
|
||||
|
||||
void UpdateInputHtml(const QString &s, const rational &time);
|
||||
void UpdateInputHtml(const QString &s, const rational &time);
|
||||
|
||||
Qt::Alignment GetVerticalAlignment() const { return valign_; }
|
||||
void SetVerticalAlignment(Qt::Alignment va);
|
||||
Qt::Alignment GetVerticalAlignment() const
|
||||
{
|
||||
return valign_;
|
||||
}
|
||||
void SetVerticalAlignment(Qt::Alignment va);
|
||||
|
||||
signals:
|
||||
void Activated();
|
||||
void Deactivated();
|
||||
void VerticalAlignmentChanged(Qt::Alignment va);
|
||||
void RectChanged(const QRectF &r);
|
||||
void Activated();
|
||||
void Deactivated();
|
||||
void VerticalAlignmentChanged(Qt::Alignment va);
|
||||
void RectChanged(const QRectF &r);
|
||||
|
||||
private:
|
||||
QRectF rect_;
|
||||
QRectF rect_;
|
||||
|
||||
QString text_;
|
||||
QString text_;
|
||||
|
||||
NodeKeyframeTrackReference input_;
|
||||
|
||||
Qt::Alignment valign_;
|
||||
NodeKeyframeTrackReference input_;
|
||||
|
||||
Qt::Alignment valign_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user