for (int i = 0; i <= max; ++i) {
point = m_spline.points().at(i);
if (i == m_currentPointIndex) {
+ // selected point: fill p and handles
p.setBrush(QBrush(QColor(Qt::red), Qt::SolidPattern));
+ // connect p and handles with lines
if (i != 0)
p.drawLine(QLineF(point.h1.x() * wWidth, wHeight - point.h1.y() * wHeight, point.p.x() * wWidth, wHeight - point.p.y() * wHeight));
if (i != max)
void slotZoomOut();
protected:
- //void keyPressEvent(QKeyEvent *event);
void paintEvent(QPaintEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent * event);
BPoint m_grabPOriginal;
BPoint m_grabPNext;
BPoint m_grabPPrevious;
- //QPointF m_draggedAwayPoint;
- //int m_draggedAwayPointIndex;
- //inline void drawGrid(QPainter &p, int width, int height);
int nearestPointInRange(QPointF p, int wWidth, int wHeight, point_types *sel);
signals:
m_edit.setSpline(s);
connect(&m_edit, SIGNAL(modified()), this, SIGNAL(modified()));
- connect(&m_edit, SIGNAL(currentPoint(const BPoint&)), this, SLOT(slotUpdatePoint(const BPoint&)));
+ connect(&m_edit, SIGNAL(currentPoint(const BPoint&)), this, SLOT(slotUpdatePointEntries(const BPoint&)));
connect(m_ui.spinPX, SIGNAL(editingFinished()), this, SLOT(slotUpdatePointP()));
connect(m_ui.spinPY, SIGNAL(editingFinished()), this, SLOT(slotUpdatePointP()));
{
m_showPixmap = show;
KdenliveSettings::setBezier_showpixmap(show);
- if (show && m_mode != ModeAlpha && m_mode != ModeRGB)
- m_edit.setPixmap(QPixmap::fromImage(ColorTools::rgbCurvePlane(m_edit.size(), (ColorTools::ColorsRGB)((int)(m_mode)))));
+ if (show && (m_mode == ModeRed || m_mode == ModeGreen || m_mode == ModeBlue || m_mode == ModeLuma ))
+ m_edit.setPixmap(QPixmap::fromImage(ColorTools::rgbCurvePlane(m_edit.size(), (ColorTools::ColorsRGB)((int)(m_mode == ModeLuma ? int(m_mode) - 1 : m_mode)))));
else
m_edit.setPixmap(QPixmap());
}
-void BezierSplineWidget::slotUpdatePoint(const BPoint &p)
+void BezierSplineWidget::slotUpdatePointEntries(const BPoint &p)
{
blockSignals(true);
if (p == BPoint()) {
Q_OBJECT
public:
+ /** @brief Sets up the UI and sets the spline to @param spline. */
BezierSplineWidget(const QString &spline, QWidget* parent = 0);
+ /** @brief Returns the current spline. */
QString spline();
- enum CurveModes { ModeRed, ModeGreen, ModeBlue, ModeAlpha, ModeLuma, ModeRGB/*, ModeSaturation*/ };
+ /** The curvemodes refer to the usage of the spline.
+ * As this widget is currently only used for frei0r.curves the modes are the channels this filter accepts. */
+ enum CurveModes { ModeRed, ModeGreen, ModeBlue, ModeAlpha, ModeLuma, ModeRGB, ModeHue, ModeSaturation };
+
+ /** @brief Sets the mode to @param mode and updates the editors background pixmap if necessary. */
void setMode(CurveModes mode);
private slots:
- void slotUpdatePoint(const BPoint &p);
+ /** @brief Sets the spinboxes for modifing the selected point to @param p. */
+ void slotUpdatePointEntries(const BPoint &p);
+ /** @brief Updates the editor and thus the spline if the current point's p was modified using the spinboxes. */
void slotUpdatePointP();
+ /** @brief Updates the editor and thus the spline if the current point's h1 was modified using the spinboxes. */
void slotUpdatePointH1();
+ /** @brief Updates the editor and thus the spline if the current point's h2 was modified using the spinboxes. */
void slotUpdatePointH2();
+ /** @brief Increases the number of lines in the editor's grid. If there are already 8 lines the number is set to 0. */
void slotGridChange();
+ /** @brief Turns showing the background pixmap in the editor on/off. */
void slotShowPixmap(bool show = true);
+ /** @brief Resets the current spline. */
void slotResetSpline();
+ /** @brief Linkes the handles. This will always make them stay in one line through p. */
void slotSetHandlesLinked(bool linked);
private:
/** handle 2 */
QPointF h2;
- /** handles are locked to achieve a natural locking spline => PH1 = -r*PH2 ; a line can be drawn through h1, p, h2 */
+ /** handles are linked to achieve a natural locking spline => PH1 = -r*PH2 ; a line can be drawn through h1, p, h2 */
bool handlesLinked;
};