Improve group support in timeline
[dashstudio.git] / src / components / timeline / timelinewidget.h
blob8b2f91469cf0bd4ffec617cf72025c704775622f
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 * @author Jorge Cuadrado <kuadrosxx@gmail.com>
38 class TimeLineWidget : public QSplitter
40 Q_OBJECT;
41 public:
42 enum Action {
43 InsertFrame = 0,
44 RemoveFrame,
45 MoveFrameUp,
46 MoveFrameDown,
47 LockFrame,
48 RenameFrame,
49 ChangeFrameVisibility,
50 ExpandFrame,
52 InsertLayer,
53 RemoveLayer,
54 MoveLayerUp,
55 MoveLayerDown,
56 LockLayer,
57 RenameLayer,
58 ChangeLayerVisibility,
60 InsertScene,
61 RemoveScene,
62 MoveSceneUp,
63 MoveSceneDown,
64 LockScene,
65 RenameScene
68 struct Event
70 int scene;
71 int layer;
72 int frame;
73 Action action;
74 QVariant data;
78 TimeLineWidget(QWidget * parent = 0);
79 ~TimeLineWidget();
81 int scene();
82 int layer();
83 int frame();
85 public slots:
86 void insertScene(int position, const QString &name);
87 void removeScene(int position);
88 void renameScene(int position, const QString &name);
89 void moveScene(int from, int to);
90 void setScene(int position);
91 void closeAllScenes();
93 void insertLayer(int scenePos, int position, const QString &name);
94 void insertAudioLayer(int scenePos, int position, const QString &name, int startFrame = 0);
95 void removeLayer(int scenePos, int position);
96 void renameLayer(int scenePos, int layerPos, const QString &name);
98 void setLayerVisibility(int scenePos, int position, bool isVisible);
99 void setLayerLocked(int scenePos, int position, bool locked);
100 void moveLayer(int scenePos, int from, int to);
101 void setLayer(int scenePos, int position);
103 void insertFrame(int scenePos, int layerPos, int position, const QString &name);
104 void removeFrame(int scenePos, int layerPos, int position);
105 void renameFrame(int scenePos, int layerPos, int position, const QString &name);
106 void moveFrame(int scenePos, int layerPos, int from, int to);
107 void setFrame(int scenePos, int layerPos, int position);
108 void setFrameVisibility(int scenePos, int layerPos, int position, bool isVisible);
109 void setFrameLocked(int scenePos, int layerPos, int position, bool locked);
110 void groupFrames(int scenePos, int layerPos, int from, int to);
111 void expandFrame(int scenePos, int layerPos, int position, int size);
112 void destroyGroupFrames(int scenePos, int layerPos, int position, int size);
114 void playScene();
116 signals:
117 void frameSelected(int scenePos, int layerPos, int framePos);
118 void postEvent(const TimeLineWidget::Event & event);
120 private slots:
121 void onItemClicked(QTreeWidgetItem *item, int column);
122 void onItemChanged(QTreeWidgetItem *, int);
123 void onFrameSelected(int layerPosition, int framePosition);
124 void onLayerSelected(int layerPosition);
125 void onLayerRenamed(int layerPosition, const QString &newName);
126 void onLayerLocked(int layerPosition, bool locked);
127 void onLayerVisibilityChanged(int layerPosition, bool isVisible);
128 void onButtonClicked(int action);
130 void onRequestInsertFrame(int layerPosition, int framePosition);
131 void onRequestRemoveFrame(int layerPosition, int framePosition);
132 void onRequestLockFrame(int layerPosition, int framePosition, bool locked);
133 void onRequestChangeFrameVisibility(int layerPosition, int framePosition, bool visibility);
134 void onRequestExpandFrame(int layerPosition, int framePosition, int size);
136 void nextFrame();
138 private:
139 LayerManager *layerManager(int sceneIndex);
140 FramesTable *framesTable(int sceneIndex);
142 private:
143 void setupButtons();
145 private:
146 struct Private;
147 Private *const d;
154 #endif