Implemented copy, cut and paste frame
[dashstudio.git] / src / components / timeline / timelinewidget.h
blob64441ff9c8ae86de98bd2804e19412c0e0bf7bc2
1 /***************************************************************************
2 * Copyright (C) 2007 by Jorge Cuadrado *
3 * kuadrosxx@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef COMPONENTTIMELINEWIDGET_H
22 #define COMPONENTTIMELINEWIDGET_H
24 #include <QSplitter>
25 #include <QVariant>
27 class QTreeWidgetItem;
29 namespace Dash {
30 namespace Component {
32 class LayerManager;
33 class FramesTable;
35 /**
36 * @brief Esta clase representa la interfaz gráfica del componente "TimeLine".
37 * @author Jorge Cuadrado <kuadrosxx@gmail.com>
39 class TimeLineWidget : public QSplitter
41 Q_OBJECT;
42 public:
43 enum Action {
44 InsertFrame = 0,
45 RemoveFrame,
46 CopyFrame,
47 PasteFrame,
48 CutFrame,
49 MoveFrameUp,
50 MoveFrameDown,
51 LockFrame,
52 RenameFrame,
53 ChangeFrameVisibility,
54 ExpandFrame,
56 InsertLayer,
57 RemoveLayer,
58 MoveLayerUp,
59 MoveLayerDown,
60 LockLayer,
61 RenameLayer,
62 ChangeLayerVisibility,
64 InsertScene,
65 RemoveScene,
66 MoveSceneUp,
67 MoveSceneDown,
68 LockScene,
69 RenameScene
72 struct Event
74 int scene;
75 int layer;
76 int frame;
77 Action action;
78 QVariant data;
81 TimeLineWidget(QWidget * parent = 0);
82 ~TimeLineWidget();
84 int scene();
85 int layer();
86 int frame();
88 public slots:
89 void insertScene(int position, const QString &name);
90 void removeScene(int position);
91 void renameScene(int position, const QString &name);
92 void moveScene(int from, int to);
93 void setScene(int position);
94 void closeAllScenes();
96 void insertLayer(int scenePos, int position, const QString &name);
97 void insertAudioLayer(int scenePos, int position, const QString &name, int startFrame = 0);
98 void removeLayer(int scenePos, int position);
99 void renameLayer(int scenePos, int layerPos, const QString &name);
101 void setLayerVisibility(int scenePos, int position, bool isVisible);
102 void setLayerLocked(int scenePos, int position, bool locked);
103 void moveLayer(int scenePos, int from, int to);
104 void setLayer(int scenePos, int position);
106 void insertFrame(int scenePos, int layerPos, int position, const QString &name);
107 void removeFrame(int scenePos, int layerPos, int position);
108 void renameFrame(int scenePos, int layerPos, int position, const QString &name);
109 void moveFrame(int scenePos, int layerPos, int from, int to);
110 void setFrame(int scenePos, int layerPos, int position);
111 void setFrameVisibility(int scenePos, int layerPos, int position, bool isVisible);
112 void setFrameLocked(int scenePos, int layerPos, int position, bool locked);
113 void groupFrames(int scenePos, int layerPos, int from, int to);
114 void expandFrame(int scenePos, int layerPos, int position, int size);
115 void destroyGroupFrames(int scenePos, int layerPos, int position, int size);
117 void playScene();
119 private slots:
120 void onItemClicked(QTreeWidgetItem *item, int column);
121 void onItemChanged(QTreeWidgetItem *, int);
122 void onFrameSelected(int layerPosition, int framePosition);
123 void onLayerSelected(int layerPosition);
124 void onLayerRenamed(int layerPosition, const QString &newName);
125 void onLayerLocked(int layerPosition, bool locked);
126 void onLayerVisibilityChanged(int layerPosition, bool isVisible);
127 void onButtonClicked(int action);
129 void onRequestInsertFrame(int layerPosition, int framePosition);
130 void onRequestRemoveFrame(int layerPosition, int framePosition);
132 void onRequestCopyFrame(int layerPosition, int framePosition);
133 void onRequestPasteFrame(int layerPosition, int framePosition);
134 void onRequestCutFrame(int layerPosition, int framePosition);
136 void onRequestLockFrame(int layerPosition, int framePosition, bool locked);
137 void onRequestChangeFrameVisibility(int layerPosition, int framePosition, bool visibility);
138 void onRequestExpandFrame(int layerPosition, int framePosition, int size);
140 void nextFrame();
142 private:
143 LayerManager *layerManager(int sceneIndex);
144 FramesTable *framesTable(int sceneIndex);
146 private:
147 void setupButtons();
149 signals:
150 void frameSelected(int scenePos, int layerPos, int framePos);
151 void postEvent(const TimeLineWidget::Event & event);
153 private:
154 struct Private;
155 Private *const d;
162 #endif