1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
#ifndef ATTRIBUTE_H__
#define ATTRIBUTE_H__
#include "Curve.h"
#include <vector>
namespace nvidia {
namespace CurveEditor {
class CurveEditorMainWindow;
enum CurveAttributeType
{
eSingleAttr,
eGroupAttr,
eColorAttr,
};
class CURVEEDITOR_EXPORT CurveAttributeBase
{
friend class CurveEditorMainWindow;
public:
std::string getName() const { return _name; }
CurveAttributeType getType() const { return _type; }
inline bool canMoveControlPointHorizontally() { return _canMoveControlPointHorizontally; }
inline bool canAddRemoveControlPoint() { return _canAddRemoveControlPoint; }
inline bool canChangeTangentType() { return _canChangeTangentType; }
protected:
CurveAttributeBase(const std::string& name, CurveAttributeType type, bool canMoveControlPointHorizontally = false, bool canAddRemoveControlPoint = false, bool canChangeTangentType = false)
: _name(name)
, _type(type)
, _canMoveControlPointHorizontally(canMoveControlPointHorizontally)
, _canAddRemoveControlPoint(canAddRemoveControlPoint)
, _canChangeTangentType(canChangeTangentType)
{
}
protected:
std::string _name;
CurveAttributeType _type;
bool _canMoveControlPointHorizontally;
bool _canAddRemoveControlPoint;
bool _canChangeTangentType;
};
class CURVEEDITOR_EXPORT CurveAttribute : public CurveAttributeBase
{
public:
CurveAttribute()
: CurveAttributeBase("", eSingleAttr)
{
}
CurveAttribute(const std::string& name, bool canMoveControlPointHorizontally = false, bool canAddRemoveControlPoint = false, bool canChangeTangentType = false)
: CurveAttributeBase(name, eSingleAttr, canMoveControlPointHorizontally, canAddRemoveControlPoint, canChangeTangentType)
{
}
CurveAttribute(const CurveAttribute& attr)
: CurveAttributeBase(attr._name, eSingleAttr)
{
}
~CurveAttribute()
{
}
QColor color;
Curve curve;
};
class CURVEEDITOR_EXPORT CurveAttributeGroup : public CurveAttributeBase
{
public:
CurveAttributeGroup(std::string name, bool canMoveControlPointHorizontally = false, bool canAddRemoveControlPoint = false, bool canChangeTangentType = false)
: CurveAttributeBase(name, eGroupAttr, canMoveControlPointHorizontally, canAddRemoveControlPoint, canChangeTangentType)
{
}
std::vector<CurveAttribute*> attributes;
};
class CURVEEDITOR_EXPORT ColorAttribute : public CurveAttributeBase
{
friend class CurveEditor;
public:
ColorAttribute()
: CurveAttributeBase("", eSingleAttr)
, useAlphaFromColor(false)
{
}
ColorAttribute(const std::string& name, bool canMoveControlPointHorizontally = false, bool canAddRemoveControlPoint = false, bool canChangeTangentType = false)
: CurveAttributeBase(name, eColorAttr, canMoveControlPointHorizontally, canAddRemoveControlPoint, canChangeTangentType)
, useAlphaFromColor(false)
{
}
ColorCurve colorCurve;
ColorCurve alphaCurve;
bool useAlphaFromColor;
};
} // namespace CurveEditor
} // namespace nvidia
#endif // ATTRIBUTE_H__
|