svn path=/trunk/kdenlive/; revision=5479
BPoint BezierSplineEditor::getCurrentPoint()
{
if (m_currentPointIndex >= 0)
BPoint BezierSplineEditor::getCurrentPoint()
{
if (m_currentPointIndex >= 0)
- return m_spline.points()[m_currentPointIndex];
+ return m_spline.getPoint(m_currentPointIndex);
if (m_currentPointIndex >= 0) {
m_spline.setPoint(m_currentPointIndex, p);
// during validation the point might have changed
if (m_currentPointIndex >= 0) {
m_spline.setPoint(m_currentPointIndex, p);
// during validation the point might have changed
- emit currentPoint(m_spline.points()[m_currentPointIndex]);
+ emit currentPoint(m_spline.getPoint(m_currentPointIndex));
emit modified();
update();
}
emit modified();
update();
}
--m_currentPointIndex;
update();
if (m_currentPointIndex >= 0)
--m_currentPointIndex;
update();
if (m_currentPointIndex >= 0)
- emit currentPoint(m_spline.points()[m_currentPointIndex]);
+ emit currentPoint(m_spline.getPoint(m_currentPointIndex));
else
emit currentPoint(BPoint());
emit modified();
else
emit currentPoint(BPoint());
emit modified();
m_currentPointType = selectedPoint;
}
m_currentPointType = selectedPoint;
}
- BPoint point = m_spline.points()[m_currentPointIndex];
+ BPoint point = m_spline.getPoint(m_currentPointIndex);
m_grabPOriginal = point;
if (m_currentPointIndex > 0)
m_grabPOriginal = point;
if (m_currentPointIndex > 0)
- m_grabPPrevious = m_spline.points()[m_currentPointIndex - 1];
+ m_grabPPrevious = m_spline.getPoint(m_currentPointIndex - 1);
if (m_currentPointIndex < m_spline.points().count() - 1)
if (m_currentPointIndex < m_spline.points().count() - 1)
- m_grabPNext = m_spline.points()[m_currentPointIndex + 1];
+ m_grabPNext = m_spline.getPoint(m_currentPointIndex + 1);
m_grabOffsetX = point[(int)m_currentPointType].x() - x;
m_grabOffsetY = point[(int)m_currentPointType].y() - y;
m_grabOffsetX = point[(int)m_currentPointType].x() - x;
m_grabOffsetY = point[(int)m_currentPointType].y() - y;
double leftX = 0.;
double rightX = 1.;
double leftX = 0.;
double rightX = 1.;
- BPoint point = m_spline.points()[m_currentPointIndex];
+ BPoint point = m_spline.getPoint(m_currentPointIndex);
switch (m_currentPointType) {
case PTypeH1:
rightX = point.p.x();
if (m_currentPointIndex == 0)
leftX = -4;
else
switch (m_currentPointType) {
case PTypeH1:
rightX = point.p.x();
if (m_currentPointIndex == 0)
leftX = -4;
else
- leftX = m_spline.points()[m_currentPointIndex - 1].p.x();
+ leftX = m_spline.getPoint(m_currentPointIndex - 1).p.x();
x = qBound(leftX, x, rightX);
point.setH1(QPointF(x, y));
x = qBound(leftX, x, rightX);
point.setH1(QPointF(x, y));
if (m_currentPointIndex == m_spline.points().count() - 1)
rightX = 5;
else
if (m_currentPointIndex == m_spline.points().count() - 1)
rightX = 5;
else
- rightX = m_spline.points()[m_currentPointIndex + 1].p.x();
+ rightX = m_spline.getPoint(m_currentPointIndex + 1).p.x();
x = qBound(leftX, x, rightX);
point.setH2(QPointF(x, y));
x = qBound(leftX, x, rightX);
point.setH2(QPointF(x, y));
m_spline.setPoint(index, m_grabPPrevious);
m_grabPNext = m_grabPPrevious;
if (m_currentPointIndex > 0)
m_spline.setPoint(index, m_grabPPrevious);
m_grabPNext = m_grabPPrevious;
if (m_currentPointIndex > 0)
- m_grabPPrevious = m_spline.points()[m_currentPointIndex - 1];
+ m_grabPPrevious = m_spline.getPoint(m_currentPointIndex - 1);
} else {
m_spline.setPoint(index, m_grabPNext);
m_grabPPrevious = m_grabPNext;
if (m_currentPointIndex < m_spline.points().count() - 1)
} else {
m_spline.setPoint(index, m_grabPNext);
m_grabPPrevious = m_grabPNext;
if (m_currentPointIndex < m_spline.points().count() - 1)
- m_grabPNext = m_spline.points()[m_currentPointIndex + 1];
+ m_grabPNext = m_spline.getPoint(m_currentPointIndex + 1);
+void BezierSplineEditor::mouseDoubleClickEvent(QMouseEvent* event)
+{
+ if (m_currentPointIndex >= 0) {
+ BPoint p = m_spline.getPoint(m_currentPointIndex);
+ p.handlesLinked = !p.handlesLinked;
+ m_spline.setPoint(m_currentPointIndex, p);
+ emit currentPoint(p);
+ }
+}
+
void BezierSplineEditor::leaveEvent(QEvent* event)
{
QWidget::leaveEvent(event);
void BezierSplineEditor::leaveEvent(QEvent* event)
{
QWidget::leaveEvent(event);
if (nearestIndex >= 0 && (nearestIndex == m_currentPointIndex || selectedPoint == PTypeP || m_showAllHandles)) {
// a point was found and it is not a hidden handle
if (nearestIndex >= 0 && (nearestIndex == m_currentPointIndex || selectedPoint == PTypeP || m_showAllHandles)) {
// a point was found and it is not a hidden handle
- BPoint point = m_spline.points()[nearestIndex];
+ BPoint point = m_spline.getPoint(nearestIndex);
if (qAbs(p.x() - point[(int)selectedPoint].x()) * wWidth < 5 && qAbs(p.y() - point[(int)selectedPoint].y()) * wHeight < 5) {
*sel = selectedPoint;
return nearestIndex;
if (qAbs(p.x() - point[(int)selectedPoint].x()) * wWidth < 5 && qAbs(p.y() - point[(int)selectedPoint].y()) * wHeight < 5) {
*sel = selectedPoint;
return nearestIndex;
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent * event);
void mouseMoveEvent(QMouseEvent * event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent * event);
void mouseMoveEvent(QMouseEvent * event);
+ void mouseDoubleClickEvent(QMouseEvent *event);
void leaveEvent(QEvent *event);
void resizeEvent(QResizeEvent *event);
void leaveEvent(QEvent *event);
void resizeEvent(QResizeEvent *event);