forked from MaurycyLiebner/enve
-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathboxsinglewidget.h
More file actions
175 lines (147 loc) · 5.21 KB
/
Copy pathboxsinglewidget.h
File metadata and controls
175 lines (147 loc) · 5.21 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/*
#
# Friction - https://friction.graphics
#
# Copyright (c) Ole-André Rodlie and contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# See 'README.md' for more information.
#
*/
// Fork of enve - Copyright (C) 2016-2020 Maurycy Liebner
#ifndef BOXSINGLEWIDGET_H
#define BOXSINGLEWIDGET_H
#include "GUI/boxeslistactionbutton.h"
#include "optimalscrollarena/singlewidget.h"
#include <QLabel>
#include <QHBoxLayout>
#include <QPushButton>
#include <QMimeData>
#include <QComboBox>
#include "skia/skiaincludes.h"
#include "smartPointers/ememory.h"
#include "framerange.h"
#include "Animators/SmartPath/smartpathanimator.h"
#include "../ui/enterevent.h"
class QrealAnimatorValueSlider;
class TimelineMovable;
class Key;
class BoxTargetWidget;
class BoolPropertyWidget;
class ComboBoxProperty;
class ColorAnimator;
class ColorAnimatorButton;
class BoxScroller;
class eComboBox;
class BoxSingleWidget : public SingleWidget {
public:
explicit BoxSingleWidget(BoxScroller * const parent);
void setTargetAbstraction(SWT_Abstraction *abs);
static QPixmap* VISIBLE_ICON;
static QPixmap* INVISIBLE_ICON;
static QPixmap* BOX_CHILDREN_VISIBLE_ICON;
static QPixmap* BOX_CHILDREN_HIDDEN_ICON;
static QPixmap* ANIMATOR_CHILDREN_VISIBLE_ICON;
static QPixmap* ANIMATOR_CHILDREN_HIDDEN_ICON;
static QPixmap* LOCKED_ICON;
static QPixmap* UNLOCKED_ICON;
static QPixmap* MUTED_ICON;
static QPixmap* UNMUTED_ICON;
static QPixmap* ANIMATOR_RECORDING_ICON;
static QPixmap* ANIMATOR_NOT_RECORDING_ICON;
static QPixmap* ANIMATOR_DESCENDANT_RECORDING_ICON;
static QPixmap* C_ICON;
static QPixmap* G_ICON;
static QPixmap* CG_ICON;
static QPixmap* GRAPH_PROPERTY_ICON;
static QPixmap* PROMOTE_TO_LAYER_ICON;
static bool sStaticPixmapsLoaded;
static void loadStaticPixmaps(int iconSize);
static void clearStaticPixmaps();
void prp_drawTimelineControls(QPainter * const p,
const qreal pixelsPerFrame,
const FrameRange &viewedFrames);
Key *getKeyAtPos(const int pressX,
const qreal pixelsPerFrame,
const int minViewedFrame);
void getKeysInRect(const QRectF &selectionRect,
const qreal pixelsPerFrame,
QList<Key *> &listKeys);
TimelineMovable *getRectangleMovableAtPos(
const int pressX,
const qreal pixelsPerFrame,
const int minViewedFrame);
void setSelected(const bool selected) {
mSelected = selected;
update();
}
protected:
bool mSelected = false;
void mousePressEvent(QMouseEvent *e);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void enterEvent(QtEnterEvent *);
void leaveEvent(QEvent *);
#ifdef Q_OS_MAC
void keyPressEvent(QKeyEvent *event);
#endif
void paintEvent(QPaintEvent *);
void mouseDoubleClickEvent(QMouseEvent *e);
void resizeEvent(QResizeEvent *);
bool mBlendModeVisible = false;
bool mPathBlendModeVisible = false;
bool mFillTypeVisible = false;
void updatePathCompositionBoxVisible();
void updateCompositionBoxVisible();
void updateFillTypeBoxVisible();
void clearAndHideValueAnimators();
void updateValueSlidersForQPointFAnimator();
private:
ContainerBox *getPromoteTargetGroup();
void clearSelected() { setSelected(false); }
void switchContentVisibleAction();
void switchRecordingAction();
void switchBoxLockedAction();
void switchBoxVisibleAction();
void setCompositionMode(const int id);
void setPathCompositionMode(const int id);
void setFillType(const int id);
ColorAnimator* getColorTarget() const;
void setComboProperty(ComboBoxProperty * const combo);
void handlePropertySelectedChanged(const Property *prop);
BoxScroller* const mParent;
bool mDragPressPos = false;
QPoint mDragStartPos;
bool mHover = false;
PixmapActionButton *mRecordButton;
PixmapActionButton *mContentButton;
PixmapActionButton *mVisibleButton;
PixmapActionButton *mLockedButton;
PixmapActionButton *mHwSupportButton;
ColorAnimatorButton *mColorButton;
BoxTargetWidget *mBoxTargetWidget;
QWidget *mFillWidget;
BoolPropertyWidget *mCheckBox;
QHBoxLayout *mMainLayout;
QrealAnimatorValueSlider *mValueSlider;
QrealAnimatorValueSlider *mSecondValueSlider;
PixmapActionButton *mPromoteToLayerButton;
eComboBox *mPropertyComboBox;
eComboBox *mBlendModeCombo;
eComboBox *mPathBlendModeCombo;
eComboBox *mFillTypeCombo;
ConnContext mTargetConn;
};
#endif // BOXSINGLEWIDGET_H