]> git.sesse.net Git - kdenlive/blob - src/beziercurve/beziersplinewidget.h
cddefef03e348c0c58ceade026f384956f98aaa6
[kdenlive] / src / beziercurve / beziersplinewidget.h
1 /***************************************************************************
2  *   Copyright (C) 2010 by Till Theato (root@ttill.de)                     *
3  *   This file is part of Kdenlive (www.kdenlive.org).                     *
4  *                                                                         *
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.                                   *
9  *                                                                         *
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.                          *
14  *                                                                         *
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  ***************************************************************************/
18
19 #ifndef BEZIERSPLINEWIDGET_H
20 #define BEZIERSPLINEWIDGET_H
21
22 #include "cubicbezierspline.h"
23 #include "beziersplineeditor.h"
24 #include "ui_bezierspline_ui.h"
25
26 #include <QtCore>
27 #include <QWidget>
28
29 class DragValue;
30
31 class BezierSplineWidget : public QWidget
32 {
33     Q_OBJECT
34     
35 public:
36     /** @brief Sets up the UI and sets the spline to @param spline. */
37     explicit BezierSplineWidget(const QString &spline, QWidget* parent = 0);
38
39     /** @brief Returns the current spline. */
40     QString spline();
41
42     /** The curvemodes refer to the usage of the spline.
43      * As this widget is currently only used for frei0r.curves the modes are the channels this filter accepts. */
44     enum CurveModes { ModeRed, ModeGreen, ModeBlue, ModeAlpha, ModeLuma, ModeRGB, ModeHue, ModeSaturation };
45
46     /** @brief Sets the mode to @param mode and updates the editors background pixmap if necessary. */
47     void setMode(CurveModes mode);
48
49 private slots:
50     /** @brief Sets the spinboxes for modifing the selected point to @param p. */
51     void slotUpdatePointEntries(const BPoint &p);
52
53     /** @brief Updates the spline if the current point's p was modified using the spinboxes.
54      * @param value (optional) not used, neccessary to be able to connect to DragValue's valueChanged.
55      * @param final (default = true) emit signal modified? */
56     void slotUpdatePointP(double value = 1, bool final = true);
57     /** @brief Updates the spline if the current point's h1 was modified using the spinboxes.
58      * @param value (optional) not used, neccessary to be able to connect to DragValue's valueChanged.
59      * @param final (default = true) emit signal modified? */
60     void slotUpdatePointH1(double value = 1, bool final = true);
61     /** @brief Updates the spline if the current point's h2 was modified using the spinboxes.
62      * @param value (optional) not used, neccessary to be able to connect to DragValue's valueChanged.
63      * @param final (default = true) emit signal modified? */
64     void slotUpdatePointH2(double value = 1, bool final = true);
65
66     /** @brief Increases the number of lines in the editor's grid. If there are already 8 lines the number is set to 0. */
67     void slotGridChange();
68     /** @brief Turns showing the background pixmap in the editor on/off. */
69     void slotShowPixmap(bool show = true);
70     /** @brief Resets the current spline. */
71     void slotResetSpline();
72     /** @brief Linkes the handles. This will always make them stay in one line through p. */
73     void slotSetHandlesLinked(bool linked);
74
75     void slotShowAllHandles(bool show);
76
77 private:
78     Ui::BezierSpline_UI m_ui;
79     DragValue *m_pX;
80     DragValue *m_pY;
81     DragValue *m_h1X;
82     DragValue *m_h1Y;
83     DragValue *m_h2X;
84     DragValue *m_h2Y;
85     BezierSplineEditor m_edit;
86     CurveModes m_mode;
87     bool m_showPixmap;
88
89 signals:
90     void modified();
91 };
92
93 #endif