1 /***************************************************************************
2 * Copyright (C) 2010 by Till Theato (root@ttill.de) *
3 * This file is part of Kdenlive (www.kdenlive.org). *
5 * Kdenlive 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. *
10 * Kdenlive 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. *
15 * You should have received a copy of the GNU General Public License *
16 * along with Kdenlive. If not, see <http://www.gnu.org/licenses/>. *
17 ***************************************************************************/
19 #ifndef BEZIERSPLINEEDITOR_H
20 #define BEZIERSPLINEEDITOR_H
22 #include "cubicbezierspline.h"
27 class BezierSplineEditor : public QWidget
32 BezierSplineEditor(QWidget* parent = 0);
33 virtual ~BezierSplineEditor();
35 CubicBezierSpline spline();
36 void setSpline(const CubicBezierSpline &spline);
38 BPoint getCurrentPoint();
39 void updateCurrentPoint(const BPoint &p);
42 void setGridLines(int lines);
44 void setPixmap(const QPixmap &pixmap);
51 //void keyPressEvent(QKeyEvent *event);
52 void paintEvent(QPaintEvent *event);
53 void mousePressEvent(QMouseEvent *event);
54 void mouseReleaseEvent(QMouseEvent * event);
55 void mouseMoveEvent(QMouseEvent * event);
56 void leaveEvent(QEvent *event);
57 void resizeEvent(QResizeEvent *event);
60 CubicBezierSpline m_spline;
61 enum modes { ModeDrag, ModeNormal };
62 enum point_types { PTypeH1, PTypeP, PTypeH2 };
67 QPixmap *m_pixmapCache;
70 int m_currentPointIndex;
71 point_types m_currentPointType;
74 BPoint m_grabPOriginal;
76 BPoint m_grabPPrevious;
77 //QPointF m_draggedAwayPoint;
78 //int m_draggedAwayPointIndex;
80 //inline void drawGrid(QPainter &p, int width, int height);
81 int nearestPointInRange(QPointF p, int wWidth, int wHeight, point_types *sel);
85 void currentPoint(const BPoint &p);