Frapper  1.0a
CurveEditorGraphicsView.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of FRAPPER
4 research.animationsinstitut.de
5 sourceforge.net/projects/frapper
6 
7 Copyright (c) 2008-2009 Filmakademie Baden-Wuerttemberg, Institute of Animation
8 
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free Software
11 Foundation; version 2.1 of the License.
12 
13 This program is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License along with
18 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20 http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
21 -----------------------------------------------------------------------------
22 */
23 
34 
35 #ifndef CURVEEDITORGRAPHICSVIEW_H
36 #define CURVEEDITORGRAPHICSVIEW_H
37 
38 #include "FrapperPrerequisites.h"
39 #include "BaseGraphicsView.h"
40 #include "ParameterGroup.h"
41 #include "NumberParameter.h"
42 #include "TimelineGraphicsItem.h"
43 #include <QtGui/QGraphicsView>
44 #include <QtGui/QPen>
45 #include <QtGui/QPainter>
46 #include <QtGui/QpainterPath>
47 #include <QtCore/QPointF>
48 #include <QtGui/QTreeWidget>
49 
50 
51 namespace Frapper {
52 
71 
72 class KeyGraphicsItem;
73 
74 class FRAPPER_GUI_EXPORT CurveEditorGraphicsView : public BaseGraphicsView
75 {
76 
77  Q_OBJECT
78 
79 public: // constructors and destructors
80 
87  CurveEditorGraphicsView ( QWidget *parent = 0, Qt::WindowFlags flags = 0 );
88 
96  virtual ~CurveEditorGraphicsView ();
97 
98 public: // functions
99 
106  void showCurves ( QList<QTreeWidgetItem *> *selectedItems );
107 
111  virtual void buildScene ();
112 
118  void setCurrentFrame ( const int pos );
119 
120 
121 public slots: //
122 
126  void homeView ();
127 
132  void frameAll ();
133 
138  void frameSelected ();
139 
145  void toggleShowEnabledOnly( bool enabled );
146 
147 signals:
151  void drag();
152 
153 protected: // event handlers
154 
155  //virtual void paintEvent (QPaintEvent *event);
156 
164  inline void drawCurves ( AbstractParameter *parameter );
165 
166 
172  virtual void mouseMoveEvent ( QMouseEvent * event );
173 
174 
181  virtual void resizeEvent ( QResizeEvent *event );
182 
190  virtual void drawBackground (QPainter *painter, const QRectF &rect);
191 
192 protected: // functions
198  virtual void wheelEvent ( QWheelEvent *event );
199 
200 private: // functions
206  void scaleSceneItems ( const float value );
207 
208 private: // data
209 
214 
219 
223  QBrush m_pointBrush;
224 
228  QSizeF m_pointSize;
229 
233  QList<NumberParameter *> m_numberParametersToDraw;
234 
239 
244 
249 
253  float m_maxValue;
254 
259 
261 };
262 
263 } // end namespace Frapper
264 
265 #endif