Implemented copy, cut and paste frame
[dashstudio.git] / src / components / timeline / framestable.h
blobca38437255bac1bfb08b038e1b609366d1aa5f3e
1 /***************************************************************************
2 * Copyright (C) 2005 by David Cuadrado *
3 * krawek@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 COMPONENTSLAYERTABLE_H
22 #define COMPONENTSLAYERTABLE_H
24 #include <QTableWidget>
25 #include <QTableWidgetItem>
26 #include <QHash>
28 class QMenu;
30 namespace Dash {
31 namespace Component {
33 class FramesTable;
34 class FramesTableItemDelegate;
36 class FramesTableItem : public QTableWidgetItem
38 public:
39 enum Attributes
41 IsUsed = Qt::UserRole,
42 IsLocked,
43 IsVisible,
44 IsSound,
45 IsClone,
46 InGroupPosition
50 enum InGroupPositionType
52 None = 0,
53 Begin,
54 Intermediate,
55 End
58 FramesTableItem();
59 virtual ~FramesTableItem();
61 bool isUsed();
62 bool isLocked();
63 bool isVisible();
64 bool isSound();
65 bool isClone();
66 InGroupPositionType inGroupPosition();
69 class TLRuler;
71 /**
72 * @~spanish
73 * @brief Esta clase provee de una interfaz gráfica para la visualización y gestión del estado de los frames del proyecto,
74 * @author David Cuadrado <krawek@gmail.com>
76 class FramesTable : public QTableWidget
78 Q_OBJECT;
80 friend class FramesTableItemDelegate;
82 public:
83 FramesTable(QWidget *parent = 0);
84 ~FramesTable();
86 bool isSoundLayer(int row);
88 public slots:
89 // Layers
91 void insertLayer(int layerPos, const QString &name);
92 void insertSoundLayer(int layerPos, const QString &name);
94 void removeCurrentLayer();
95 void removeLayer(int pos);
96 void moveLayer(int pos, int newPos);
98 int lastFrameByLayer(int layerPos);
100 // Frames
101 void addFrame(int layerPos, const QString &name);
102 void insertFrame(int layerPos, int framePos, const QString &name);
103 void setCurrentFrame(FramesTableItem *);
104 void setCurrentLayer(int layerPos);
105 void selectFrame(int index);
107 void setAttribute(int row, int col, FramesTableItem::Attributes att, bool value);
109 void removeFrame(int layerPos, int position);
110 void moveFrame(int layerPos, int from, int to);
112 void lockFrame(int layerPosition, int position, bool locked);
114 void setFrameVisibility(int layerPosition, int position, bool isVisible);
116 void setItemSize(int w, int h);
118 void expandFrame(int layerPosition, int position, int size );
120 void groupFrames(int layerPosition, int from, int to );
121 void destroyGroupFrames(int layerPos, int position, int size);
124 private:
125 void setup();
127 protected:
128 void fixSize();
129 void mousePressEvent ( QMouseEvent * event );
131 private slots:
132 void emitFrameSelected(int col);
133 void onItemSelectionChanged();
135 void onCellDoubleClicked(int row, int column);
136 void onMenuActionTriggered(QAction * action);
138 signals:
139 void frameSelected(int layerPos, int framePos);
140 void layerSelected(int layerPos);
141 void requestInsertFrame(int layerPos, int framePos);
142 void requestRemoveFrame(int layerPos, int framePos);
144 void requestCopyFrame(int layerPos, int framePos);
145 void requestPasteFrame(int layerPos, int framePos);
146 void requestCutFrame(int layerPos, int framePos);
148 void requestChangeFrameVisibility(int layerPos, int framePos, bool isVisible);
149 void requestLockFrame(int layerPos, int framePos, bool locked);
150 void requestExpandFrame(int layerPos, int framePos, int size);
152 private:
153 struct Private;
154 Private *const d;
160 #endif