Changeset View
Changeset View
Standalone View
Standalone View
plugins/dockers/animation/timeline_frames_view.h
Context not available. | |||||
19 | #ifndef __TIMELINE_FRAMES_VIEW_H | 19 | #ifndef __TIMELINE_FRAMES_VIEW_H | ||
---|---|---|---|---|---|
20 | #define __TIMELINE_FRAMES_VIEW_H | 20 | #define __TIMELINE_FRAMES_VIEW_H | ||
21 | 21 | | |||
22 | | ||||
22 | #include <QScopedPointer> | 23 | #include <QScopedPointer> | ||
23 | #include <QTableView> | 24 | #include <QTableView> | ||
24 | #include "kis_action_manager.h" | 25 | #include "kis_action_manager.h" | ||
Context not available. | |||||
27 | class KisAction; | 28 | class KisAction; | ||
28 | class TimelineWidget; | 29 | class TimelineWidget; | ||
29 | 30 | | |||
31 | enum TimelineDirection : short | ||||
32 | { | ||||
33 | LEFT = -1, | ||||
34 | BEFORE = -1, | ||||
35 | | ||||
36 | RIGHT = 1, | ||||
37 | AFTER = 1 | ||||
38 | }; | ||||
39 | | ||||
40 | | ||||
30 | class KRITAANIMATIONDOCKER_EXPORT TimelineFramesView : public QTableView | 41 | class KRITAANIMATIONDOCKER_EXPORT TimelineFramesView : public QTableView | ||
31 | { | 42 | { | ||
32 | Q_OBJECT | 43 | Q_OBJECT | ||
44 | | ||||
33 | public: | 45 | public: | ||
34 | TimelineFramesView(QWidget *parent); | 46 | TimelineFramesView(QWidget *parent); | ||
35 | ~TimelineFramesView() override; | 47 | ~TimelineFramesView() override; | ||
Context not available. | |||||
40 | 52 | | |||
41 | void setShowInTimeline(KisAction *action); | 53 | void setShowInTimeline(KisAction *action); | ||
42 | 54 | | |||
43 | void setActionManager( KisActionManager * actionManager); | 55 | void setActionManager(KisActionManager *actionManager); | ||
44 | 56 | | |||
45 | public Q_SLOTS: | 57 | public Q_SLOTS: | ||
46 | void slotSelectionChanged(); | 58 | void slotSelectionChanged(); | ||
Context not available. | |||||
61 | void slotRemoveLayer(); | 73 | void slotRemoveLayer(); | ||
62 | void slotLayerContextMenuRequested(const QPoint &globalPos); | 74 | void slotLayerContextMenuRequested(const QPoint &globalPos); | ||
63 | 75 | | |||
64 | // New, Copy, Insert and Remove Frames | 76 | // New, Insert and Remove Frames | ||
65 | void slotNewFrame(); | 77 | void slotAddBlankFrame(); | ||
66 | void slotCopyFrame(); | 78 | void slotAddDuplicateFrame(); | ||
67 | | ||||
68 | void slotInsertKeyframesLeft(int count = 1, int timing = 1, bool forceEntireColumn = false); | | |||
69 | void slotInsertKeyframesRight(int count = 1, int timing = 1, bool forceEntireColumn = false); | | |||
70 | 79 | | |||
71 | void slotInsertKeyframesLeftCustom(); | 80 | void slotInsertKeyframeLeft() {insertKeyframes(-1, 1, TimelineDirection::LEFT, false);} | ||
72 | void slotInsertKeyframesRightCustom(); | 81 | void slotInsertKeyframeRight() {insertKeyframes(-1, 1, TimelineDirection::RIGHT, false);} | ||
73 | 82 | | |||
74 | void slotRemoveFrame(bool forceEntireColumn = false, bool needsOffset = false); | 83 | void slotInsertKeyframeColumnLeft() {insertKeyframes(-1, 1, TimelineDirection::LEFT, true);} | ||
75 | void slotRemoveFramesAndShift(bool forceEntireColumn = false); | 84 | void slotInsertKeyframeColumnRight() {insertKeyframes(-1, 1, TimelineDirection::RIGHT, true);} | ||
76 | 85 | | |||
77 | void slotInsertColumnsLeft(int count = 1, int timing = 1); | 86 | void slotInsertMultipleKeyframes() {insertMultipleKeyframes(false);} | ||
78 | void slotInsertColumnsLeftCustom(); | 87 | void slotInsertMultipleKeyframeColumns() {insertMultipleKeyframes(true);} | ||
79 | 88 | | |||
80 | void slotInsertColumnsRight(int count = 1, int timing = 1); | 89 | void slotRemoveSelectedFrames(bool entireColumn = false, bool needsOffset = false); | ||
81 | void slotInsertColumnsRightCustom(); | 90 | void slotRemoveSelectedFramesAndShift() {slotRemoveSelectedFrames(false, true);} | ||
82 | 91 | | |||
83 | void slotRemoveColumns(); | 92 | void slotRemoveSelectedColumns() {slotRemoveSelectedFrames(true);} | ||
84 | void slotRemoveColumnsAndShift(); | 93 | void slotRemoveSelectedColumnsAndShift() {slotRemoveSelectedFrames(true, true);} | ||
85 | 94 | | |||
86 | void slotInsertHoldFrames(int count = 1, bool forceEntireColumn = false); | 95 | void slotInsertHoldFrame() {insertOrRemoveHoldFrames(1);} | ||
87 | void slotRemoveHoldFrames(int count = 1, bool forceEntireColumn = false); | 96 | void slotRemoveHoldFrame() {insertOrRemoveHoldFrames(-1);} | ||
88 | 97 | | |||
89 | void slotInsertHoldFramesCustom(); | 98 | void slotInsertHoldFrameColumn() {insertOrRemoveHoldFrames(1,true);} | ||
90 | void slotRemoveHoldFramesCustom(); | 99 | void slotRemoveHoldFrameColumn() {insertOrRemoveHoldFrames(-1,true);} | ||
91 | 100 | | |||
92 | void slotInsertHoldColumns(int count = 1); | 101 | void slotInsertMultipleHoldFrames() {insertOrRemoveMultipleHoldFrames(true);} | ||
93 | void slotRemoveHoldColumns(int count = 1); | 102 | void slotRemoveMultipleHoldFrames() {insertOrRemoveMultipleHoldFrames(false);} | ||
94 | 103 | | |||
95 | void slotInsertHoldColumnsCustom(); | 104 | void slotInsertMultipleHoldFrameColumns() {insertOrRemoveMultipleHoldFrames(true, true);} | ||
96 | void slotRemoveHoldColumnsCustom(); | 105 | void slotRemoveMultipleHoldFrameColumns() {insertOrRemoveMultipleHoldFrames(false, true);} | ||
97 | 106 | | |||
98 | void slotMirrorFrames(bool forceEntireColumn = false); | 107 | void slotMirrorFrames(bool entireColumn = false); | ||
99 | void slotMirrorColumns(); | 108 | void slotMirrorColumns() {slotMirrorFrames(true);} | ||
100 | 109 | | |||
101 | // Copy-paste | 110 | // Copy-paste | ||
102 | void slotCopyFrames(bool forceEntireColumn = false); | 111 | void slotCopyFrames() {cutCopyImpl(false, true);} | ||
103 | void slotCutFrames(bool forceEntireColumn = false); | 112 | void slotCutFrames() {cutCopyImpl(false, false);} | ||
104 | void slotPasteFrames(bool forceEntireColumn = false); | 113 | | ||
114 | void slotCopyColumns() {cutCopyImpl(true, true);} | ||||
115 | void slotCutColumns() {cutCopyImpl(true, false);} | ||||
105 | 116 | | |||
106 | void slotCopyColumns(); | 117 | void slotPasteFrames(bool entireColumn = false); | ||
107 | void slotCutColumns(); | 118 | void slotPasteColumns() {slotPasteFrames(true);} | ||
108 | void slotPasteColumns(); | | |||
109 | 119 | | |||
110 | void slotReselectCurrentIndex(); | 120 | void slotReselectCurrentIndex(); | ||
111 | 121 | | |||
Context not available. | |||||
128 | 138 | | |||
129 | private: | 139 | private: | ||
130 | void setFramesPerSecond(int fps); | 140 | void setFramesPerSecond(int fps); | ||
141 | | ||||
131 | void calculateSelectionMetrics(int &minColumn, int &maxColumn, QSet<int> &rows) const; | 142 | void calculateSelectionMetrics(int &minColumn, int &maxColumn, QSet<int> &rows) const; | ||
132 | 143 | | |||
133 | void insertFramesImpl(int insertAtColumn, int count, int timing, QSet<int> rows, bool forceEntireColumn); | 144 | /* Insert new keyframes/columns. | ||
145 | * | ||||
146 | * count - Number of frames to add. If <0, use number of currently SELECTED frames. | ||||
147 | * timing - Animation timing of frames to be added (on 1s, 2s, 3s, etc.) | ||||
148 | * direction - Insert frames before (left) or after (right) selection scrubber. | ||||
149 | * entireColumn - Create frames on all layers (rows) instead of just the active layer? | ||||
150 | */ | ||||
151 | void insertKeyframes(int count = 1, int timing = 1, | ||||
152 | TimelineDirection direction = TimelineDirection::LEFT, bool entireColumn = false); | ||||
153 | void insertMultipleKeyframes(bool entireColumn = false); | ||||
154 | | ||||
155 | void insertOrRemoveHoldFrames(int count, bool entireColumn = false); | ||||
156 | void insertOrRemoveMultipleHoldFrames(bool insertion, bool entireColumn = false); | ||||
157 | | ||||
158 | void cutCopyImpl(bool entireColumn, bool copy); | ||||
134 | 159 | | |||
135 | void createFrameEditingMenuActions(QMenu *menu, bool addFrameCreationActions); | 160 | void createFrameEditingMenuActions(QMenu *menu, bool addFrameCreationActions); | ||
136 | 161 | | |||
137 | QModelIndexList calculateSelectionSpan(bool forceEntireColumn, bool editableOnly = true) const; | 162 | QModelIndexList calculateSelectionSpan(bool entireColumn, bool editableOnly = true) const; | ||
138 | void cutCopyImpl(bool forceEntireColumn, bool copy); | | |||
139 | 163 | | |||
140 | int defaultNumberOfFramesToAdd() const; | 164 | int defaultNumberOfFramesToAdd() const; | ||
141 | void setDefaultNumberOfFramesToAdd(int value) const; | 165 | void setDefaultNumberOfFramesToAdd(int value) const; | ||
Context not available. | |||||
163 | void mouseMoveEvent(QMouseEvent *e) override; | 187 | void mouseMoveEvent(QMouseEvent *e) override; | ||
164 | void mouseReleaseEvent(QMouseEvent *e) override; | 188 | void mouseReleaseEvent(QMouseEvent *e) override; | ||
165 | void wheelEvent(QWheelEvent *e) override; | 189 | void wheelEvent(QWheelEvent *e) override; | ||
166 | void rowsInserted(const QModelIndex& parent, int start, int end) override; | 190 | void rowsInserted(const QModelIndex &parent, int start, int end) override; | ||
167 | bool viewportEvent(QEvent *event) override; | 191 | bool viewportEvent(QEvent *event) override; | ||
168 | 192 | | |||
169 | private: | 193 | private: | ||
Context not available. |