void BezierSplineEditor::setSpline(const CubicBezierSpline& spline)
{
- // TODO: cleanup
- m_spline.fromString(spline.toString());
+ int precision = m_spline.getPrecision();
+ m_spline = spline;
+ m_spline.setPrecision(precision);
+ m_currentPointIndex = -1;
+ m_mode = ModeNormal;
+ emit modified();
+ update();
}
BPoint BezierSplineEditor::getCurrentPoint()
void BezierSplineEditor::resizeEvent(QResizeEvent* event)
{
- m_spline.setPrecision(width());
+ m_spline.setPrecision(width() > height() ? width() : height());
m_pixmapIsDirty = true;
QWidget::resizeEvent(event);
}
m_ui.buttonZoomOut->setIcon(KIcon("zoom-out"));
m_ui.buttonGridChange->setIcon(KIcon("view-grid"));
m_ui.buttonShowPixmap->setIcon(QIcon(QPixmap::fromImage(ColorTools::rgbCurvePlane(QSize(16, 16), ColorTools::COL_Luma, 0.8))));
+ m_ui.buttonResetSpline->setIcon(KIcon("view-refresh"));
m_ui.widgetPoint->setEnabled(false);
CubicBezierSpline s;
connect(m_ui.buttonZoomOut, SIGNAL(clicked()), &m_edit, SLOT(slotZoomOut()));
connect(m_ui.buttonGridChange, SIGNAL(clicked()), this, SLOT(slotGridChange()));
connect(m_ui.buttonShowPixmap, SIGNAL(toggled(bool)), this, SLOT(slotShowPixmap(bool)));
+ connect(m_ui.buttonResetSpline, SIGNAL(clicked()), this, SLOT(slotResetSpline()));
m_edit.setGridLines(KdenliveSettings::bezier_gridlines());
m_ui.buttonShowPixmap->setChecked(KdenliveSettings::bezier_showpixmap());
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 == ModeLuma ? 3 : m_mode)), 0.8)));
+ m_edit.setPixmap(QPixmap::fromImage(ColorTools::rgbCurvePlane(m_edit.size(), (ColorTools::ColorsRGB)((int)(m_mode)))));
else
m_edit.setPixmap(QPixmap());
}
emit modified();
}
+void BezierSplineWidget::slotResetSpline()
+{
+ m_edit.setSpline(CubicBezierSpline());
+}
+
#include "beziersplinewidget.moc"
QString spline();
- enum CurveModes { ModeRed, ModeGreen, ModeBlue, ModeAlpha, ModeLuma, ModeRGB };
+ enum CurveModes { ModeRed, ModeGreen, ModeBlue, ModeAlpha, ModeLuma, ModeRGB/*, ModeSaturation*/ };
void setMode(CurveModes mode);
private slots:
void slotUpdateSpline();
void slotGridChange();
void slotShowPixmap(bool show = true);
+ void slotResetSpline();
private:
Ui::BezierSpline_UI m_ui;
{
m_precision = spline.m_precision;
m_points = spline.m_points;
+ m_validSpline = false;
return *this;
}
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="1" column="0" colspan="6">
+ <item row="1" column="0" colspan="7">
<widget class="QWidget" name="widgetPoint" native="true">
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
</layout>
</widget>
</item>
- <item row="2" column="0">
+ <item row="2" column="1">
<widget class="QToolButton" name="buttonShowPixmap">
<property name="toolTip">
<string>Show background indicating changes caused by modifying the curve.</string>
</property>
</widget>
</item>
- <item row="2" column="3">
+ <item row="2" column="4">
<widget class="QToolButton" name="buttonZoomIn">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
- <item row="2" column="4">
+ <item row="2" column="5">
<widget class="QToolButton" name="buttonZoomOut">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
- <item row="2" column="1">
+ <item row="2" column="2">
<widget class="QToolButton" name="buttonGridChange">
<property name="toolTip">
<string>Increases the number of lines in the grid.<br />After 8 lines it will begin from 0 again.</string>
</property>
</widget>
</item>
- <item row="2" column="5">
+ <item row="2" column="6">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</spacer>
</item>
+ <item row="2" column="0">
+ <widget class="QToolButton" name="buttonResetSpline">
+ <property name="toolTip">
+ <string>Reset the selected spline</string>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<resources/>