Krita Source Code Documentation
Loading...
Searching...
No Matches
KoPathTool.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2006-2012 Jan Hambrecht <jaham@gmx.net>
3 * SPDX-FileCopyrightText: 2006, 2007 Thorsten Zachmann <zachmann@kde.org>
4 * SPDX-FileCopyrightText: 2007, 2010 Thomas Zander <zander@kde.org>
5 * SPDX-FileCopyrightText: 2007 Boudewijn Rempt <boud@valdyas.org>
6 *
7 * SPDX-License-Identifier: LGPL-2.0-or-later
8 */
9
10#include "KoPathTool.h"
11#include "KoCanvasBase.h"
14#include "KoParameterShape.h"
15#include "KoPathPoint.h"
18#include "KoPathShape_p.h"
19#include "KoPathToolHandle.h"
20#include "KoPointerEvent.h"
22#include "KoSelection.h"
23#include "KoShapeController.h"
24#include "KoShapeGroup.h"
25#include "KoShapeManager.h"
26#include "KoSnapGuide.h"
27#include "KoToolBase_p.h"
28#include "KoToolManager.h"
29#include "KoViewConverter.h"
39#include "kis_action_registry.h"
40#include "kis_command_utils.h"
41#include "kis_pointer_utils.h"
43#include <KoShapeStrokeModel.h>
48#include <text/KoSvgTextShape.h>
49
50#include <KoIcon.h>
51
52#include <QMenu>
53#include <QAction>
54#include <FlakeDebug.h>
55#include <klocalizedstring.h>
56#include <QPainter>
57#include <QPainterPath>
58#include <QBitmap>
59#include <QTabWidget>
60
61#include <math.h>
62
63// helper function to calculate the squared distance between two points
64qreal squaredDistance(const QPointF& p1, const QPointF &p2)
65{
66 qreal dx = p1.x()-p2.x();
67 qreal dy = p1.y()-p2.y();
68 return dx*dx + dy*dy;
69}
70
73 : path(0), segmentStart(0), positionOnSegment(0)
74 {
75 }
76
77 bool isValid() {
78 return path && segmentStart;
79 }
80
84};
85
87 : KoToolBase(canvas)
88 , m_pointSelection(this)
89{
90 m_actionPathPointCorner = action("pathpoint-corner");
91 m_actionPathPointSmooth = action("pathpoint-smooth");
92 m_actionPathPointSymmetric = action("pathpoint-symmetric");
93 m_actionCurvePoint = action("pathpoint-curve");
94 m_actionLinePoint = action("pathpoint-line");
95 m_actionLineSegment = action("pathsegment-line");
96 m_actionCurveSegment = action("pathsegment-curve");
97 m_actionAddPoint = action("pathpoint-insert");
98 m_actionRemovePoint = action("pathpoint-remove");
99 m_actionBreakPoint = action("path-break-point");
100 m_actionBreakSegment = action("path-break-segment");
101 m_actionBreakSelection = action("path-break-selection");
102 m_actionJoinSegment = action("pathpoint-join");
103 m_actionMergePoints = action("pathpoint-merge");
104 m_actionConvertToPath = action("convert-to-path");
105
106 m_contextMenu.reset(new QMenu());
107
108 m_selectCursor = QCursor(QIcon(":/cursor-needle.svg").pixmap(32), 0, 0);
109 m_moveCursor = QCursor(QIcon(":/cursor-needle-move.svg").pixmap(32), 0, 0);
110
112}
113
117
119{
121
122 PathToolOptionWidget * toolOptions = new PathToolOptionWidget(this);
123 connect(this, SIGNAL(typeChanged(int)), toolOptions, SLOT(setSelectionType(int)));
124 connect(this, SIGNAL(singleShapeChanged(KoPathShape*)), toolOptions, SLOT(setCurrentShape(KoPathShape*)));
125 connect(toolOptions, SIGNAL(sigRequestUpdateActions()), this, SLOT(updateActions()));
127 toolOptions->setWindowTitle(i18n("Edit Shape"));
128 list.append(toolOptions);
129
130 return list;
131}
132
142
144{
145 Q_D(KoToolBase);
148
149 KUndo2Command *initialConversionCommand = createPointToCurveCommand(selectedPoints);
150
151 // conversion should happen before the c-tor
152 // of KoPathPointTypeCommand is executed!
153 if (initialConversionCommand) {
154 initialConversionCommand->redo();
155 }
156
157 KUndo2Command *command =
158 new KoPathPointTypeCommand(selectedPoints, type);
159
160 if (initialConversionCommand) {
161 using namespace KisCommandUtils;
162 CompositeCommand *parent = new CompositeCommand();
163 parent->setText(command->text());
164 parent->addCommand(new SkipFirstRedoWrapper(initialConversionCommand));
165 parent->addCommand(command);
166 command = parent;
167 }
168
169 d->canvas->addCommand(command);
170 }
171}
172
174{
175 Q_D(KoToolBase);
177 if (segments.size() == 1) {
178 qreal positionInSegment = 0.5;
179 if (m_activeSegment && m_activeSegment->isValid()) {
180 positionInSegment = m_activeSegment->positionOnSegment;
181 }
182
183 KoPathPointInsertCommand *cmd = new KoPathPointInsertCommand(segments, positionInSegment);
184 d->canvas->addCommand(cmd);
185
186 // TODO: this construction is dangerous. The canvas can remove the command right after
187 // it has been added to it!
189 foreach (KoPathPoint * p, cmd->insertedPoints()) {
190 m_pointSelection.add(p, false);
191 }
192 }
193}
194
196{
197 Q_D(KoToolBase);
198 if (m_pointSelection.size() > 0) {
200 PointHandle *pointHandle = dynamic_cast<PointHandle*>(m_activeHandle.data());
201 if (pointHandle && m_pointSelection.contains(pointHandle->activePoint())) {
202 m_activeHandle.reset();
203 }
205 d->canvas->addCommand(cmd);
206 }
207}
208
210{
211 Q_D(KoToolBase);
214 QList<KoPathPointData> pointToChange;
215
216 QList<KoPathPointData>::const_iterator it(selectedPoints.constBegin());
217 for (; it != selectedPoints.constEnd(); ++it) {
218 KoPathPoint *point = it->pathShape->pointByIndex(it->pointIndex);
219 if (point && (point->activeControlPoint1() || point->activeControlPoint2()))
220 pointToChange.append(*it);
221 }
222
223 if (! pointToChange.isEmpty()) {
224 d->canvas->addCommand(new KoPathPointTypeCommand(pointToChange, KoPathPointTypeCommand::Line));
225 }
226 }
227}
228
230{
231 Q_D(KoToolBase);
234
235 KUndo2Command *command = createPointToCurveCommand(selectedPoints);
236
237 if (command) {
238 d->canvas->addCommand(command);
239 }
240 }
241}
242
244{
245 KUndo2Command *command = 0;
246 QList<KoPathPointData> pointToChange;
247
248 QList<KoPathPointData>::const_iterator it(points.constBegin());
249 for (; it != points.constEnd(); ++it) {
250 KoPathPoint *point = it->pathShape->pointByIndex(it->pointIndex);
251 if (point && (! point->activeControlPoint1() || ! point->activeControlPoint2()))
252 pointToChange.append(*it);
253 }
254
255 if (!pointToChange.isEmpty()) {
256 command = new KoPathPointTypeCommand(pointToChange, KoPathPointTypeCommand::Curve);
257 }
258
259 return command;
260}
261
263{
264 Q_D(KoToolBase);
265 if (m_pointSelection.size() > 1) {
267 if (segments.size() > 0) {
268 d->canvas->addCommand(new KoPathSegmentTypeCommand(segments, KoPathSegmentTypeCommand::Line));
269 }
270 }
271}
272
274{
275 Q_D(KoToolBase);
276 if (m_pointSelection.size() > 1) {
278 if (segments.size() > 0) {
279 d->canvas->addCommand(new KoPathSegmentTypeCommand(segments, KoPathSegmentTypeCommand::Curve));
280 }
281 }
282}
283
285{
286 Q_D(KoToolBase);
287
289
290 QList<KoParameterShape*> parameterShapes;
291
292 Q_FOREACH (KoShape *shape, m_pointSelection.selectedShapes()) {
293 KoParameterShape * parametric = dynamic_cast<KoParameterShape*>(shape);
294 if (parametric && parametric->isParametricShape()) {
295 parameterShapes.append(parametric);
296 }
297 }
298
299 if (!parameterShapes.isEmpty()) {
300 d->canvas->addCommand(new KoParameterToPathCommand(parameterShapes));
301 }
302
303 QList<KoSvgTextShape*> textShapes;
304 Q_FOREACH (KoShape *shape, selection->selectedEditableShapes()) {
305 if (KoSvgTextShape *text = dynamic_cast<KoSvgTextShape*>(shape)) {
306 textShapes.append(text);
307 }
308 }
309
310 if (!textShapes.isEmpty()) {
311 KUndo2Command *cmd = new KUndo2Command(kundo2_i18n("Convert to Path")); // TODO: reuse the text from KoParameterToPathCommand
312 const QList<KoShape*> oldSelectedShapes = implicitCastList<KoShape*>(textShapes);
313
314
315 new KoKeepShapesSelectedCommand(oldSelectedShapes, {}, canvas()->selectedShapesProxy(),
317
318 QList<KoShape*> newSelectedShapes;
319 Q_FOREACH (KoSvgTextShape *shape, textShapes) {
320 KoShape *outlineShape = shape->textOutline();
321
322 KoShapeContainer *parent = shape->parent();
323 canvas()->shapeController()->addShapeDirect(outlineShape, parent, cmd);
324
325 newSelectedShapes << outlineShape;
326 }
327
328 canvas()->shapeController()->removeShapes(oldSelectedShapes, cmd);
329
330 new KoKeepShapesSelectedCommand({}, newSelectedShapes, canvas()->selectedShapesProxy(),
332
333 canvas()->addCommand(cmd);
334 }
335
337}
338
339namespace {
340bool checkCanJoinToPoints(const KoPathPointData & pd1, const KoPathPointData & pd2)
341{
342 const KoPathPointIndex & index1 = pd1.pointIndex;
343 const KoPathPointIndex & index2 = pd2.pointIndex;
344
345 KoPathShape *path1 = pd1.pathShape;
346 KoPathShape *path2 = pd2.pathShape;
347
348 // check if subpaths are already closed
349 if (path1->isClosedSubpath(index1.first) || path2->isClosedSubpath(index2.first))
350 return false;
351
352 // check if first point is an endpoint
353 if (index1.second != 0 && index1.second != path1->subpathPointCount(index1.first)-1)
354 return false;
355
356 // check if second point is an endpoint
357 if (index2.second != 0 && index2.second != path2->subpathPointCount(index2.first)-1)
358 return false;
359
360 return true;
361}
362}
363
365{
366 Q_D(KoToolBase);
367
368 if (m_pointSelection.size() != 2)
369 return;
370
372 if (pointData.size() != 2) return;
373
374 const KoPathPointData & pd1 = pointData.at(0);
375 const KoPathPointData & pd2 = pointData.at(1);
376
377 if (!checkCanJoinToPoints(pd1, pd2)) {
378 return;
379 }
380
382
383 KUndo2Command *cmd = 0;
384
385 if (doJoin) {
386 cmd = new KoMultiPathPointJoinCommand(pd1, pd2, d->canvas->shapeController()->documentBase(), d->canvas->shapeManager()->selection());
387 } else {
388 cmd = new KoMultiPathPointMergeCommand(pd1, pd2, d->canvas->shapeController()->documentBase(), d->canvas->shapeManager()->selection());
389 }
390 d->canvas->addCommand(cmd);
391}
392
394{
395 mergePointsImpl(true);
396}
397
399{
400 mergePointsImpl(false);
401}
402
404{
405 Q_D(KoToolBase);
408 }
409}
410
412{
413 Q_D(KoToolBase);
414
415 if (m_pointSelection.objectCount() == 1 && m_pointSelection.size() == 2) {
417 if (segments.size() == 1) {
418 d->canvas->addCommand(new KoPathSegmentBreakCommand(segments.at(0)));
419 }
420 } else if (m_pointSelection.hasSelection()) {
422 }
423}
424
426{
427 Q_D(KoToolBase);
428 // only try to break a segment when 2 points of the same object are selected
429 if (m_pointSelection.objectCount() == 1 && m_pointSelection.size() == 2) {
431 if (segments.size() == 1) {
432 d->canvas->addCommand(new KoPathSegmentBreakCommand(segments.at(0)));
433 }
434 }
435}
436
437void KoPathTool::paint(QPainter &painter, const KoViewConverter &converter)
438{
439 Q_D(KoToolBase);
440
441 Q_FOREACH (KoPathShape *shape, m_pointSelection.selectedShapes()) {
445
446 KoParameterShape * parameterShape = dynamic_cast<KoParameterShape*>(shape);
447 if (parameterShape && parameterShape->isParametricShape()) {
448 parameterShape->paintHandles(helper);
449 } else {
450 shape->paintPoints(helper);
451 }
452
453 if (!shape->stroke() || !shape->stroke()->isVisible()) {
455 helper.drawPath(shape->outline());
456 }
457 }
458
459 if (m_currentStrategy) {
460 painter.save();
461 m_currentStrategy->paint(painter, converter);
462 painter.restore();
463 }
464
465 m_pointSelection.paint(painter, converter, handleRadius());
466
467 if (m_activeHandle) {
469 m_activeHandle->paint(painter, converter, handleRadius(), decorationThickness());
470 } else {
471 m_activeHandle.reset();
472 }
473 } else if (m_activeSegment && m_activeSegment->isValid()) {
474
475 KoPathShape *shape = m_activeSegment->path;
476
477 // if the stroke is invisible, then we already painted the outline of the shape!
478 if (shape->stroke() && shape->stroke()->isVisible()) {
479 KoPathPointIndex index = shape->pathPointIndex(m_activeSegment->segmentStart);
480 KoPathSegment segment = shape->segmentByIndex(index).toCubic();
481
483
487
488 QPainterPath path;
489 path.moveTo(segment.first()->point());
490 path.cubicTo(segment.first()->controlPoint2(),
491 segment.second()->controlPoint1(),
492 segment.second()->point());
493
494 helper.drawPath(path);
495 }
496 }
497
498
499
500 if (m_currentStrategy) {
501 painter.save();
502 painter.setTransform(converter.documentToView(), true);
503 d->canvas->snapGuide()->paint(painter, converter);
504 painter.restore();
505 }
506}
507
509{
510 const_cast<KoPathToolSelection&>(m_pointSelection).update();
511
512 QRectF newDecorationsRect;
513
514 Q_FOREACH (KoShape *shape, m_pointSelection.selectedShapes()) {
515 newDecorationsRect |= kisGrowRect(shape->boundingRect(), handleDocRadius());
516 }
517
518 Q_FOREACH(const KoPathPoint *point, m_pointSelection.selectedPoints()) {
519 newDecorationsRect |= kisGrowRect(point->boundingRect(false), handleDocRadius());
520 }
521
522 if (m_activeHandle) {
523 newDecorationsRect |= kisGrowRect(m_activeHandle->boundingRect(), handleDocRadius());
524 }
525
526 if (m_activeSegment) {
527 KoPathPointIndex index = m_activeSegment->path->pathPointIndex(m_activeSegment->segmentStart);
528 KoPathSegment segment = m_activeSegment->path->segmentByIndex(index);
529
530 QRectF rect = segment.boundingRect();
531 rect = m_activeSegment->path->shapeToDocument(rect);
532
533 newDecorationsRect |= kisGrowRect(rect, handleDocRadius());
534 }
535
536 return newDecorationsRect;
537}
538
544
546{
547 // we are moving if we hit a point and use the left mouse button
548 if (m_activeHandle) {
549 m_currentStrategy.reset(m_activeHandle->handleMousePress(event));
550 } else {
551 if (event->button() & Qt::LeftButton) {
552
553 // check if we hit a path segment
554 if (m_activeSegment && m_activeSegment->isValid()) {
555
556 KoPathShape *shape = m_activeSegment->path;
557 KoPathPointIndex index = shape->pathPointIndex(m_activeSegment->segmentStart);
558 KoPathSegment segment = shape->segmentByIndex(index);
559
560 m_pointSelection.add(segment.first(), !(event->modifiers() & Qt::ShiftModifier));
561 m_pointSelection.add(segment.second(), false);
562
563 KoPathPointData data(shape, index);
564 m_currentStrategy.reset(new KoPathSegmentChangeStrategy(this, event->point, data, m_activeSegment->positionOnSegment));
565 } else {
566
567 KoShapeManager *shapeManager = canvas()->shapeManager();
568 KoSelection *selection = shapeManager->selection();
569 KoShape *shape = shapeManager->shapeAt(event->point, KoFlake::ShapeOnTop);
570
571 if (shape && !selection->isSelected(shape)) {
572
573 if (!(event->modifiers() & Qt::ShiftModifier)) {
574 selection->deselectAll();
575 }
576
577 selection->select(shape);
578 } else {
581 }
582 }
583 }
584 }
585}
586
588{
589 if (event->button() & Qt::RightButton)
590 return;
591
592 if (m_currentStrategy) {
593 m_lastPoint = event->point;
594 m_currentStrategy->handleMouseMove(event->point, event->modifiers());
595
597
598 return;
599 }
600
601 if (m_activeSegment) {
602 m_activeSegment.reset();
604 }
605
606 Q_FOREACH (KoPathShape *shape, m_pointSelection.selectedShapes()) {
607 QRectF roi = shape->documentToShape(handleGrabRect(event->point));
608 KoParameterShape * parameterShape = dynamic_cast<KoParameterShape*>(shape);
609 if (parameterShape && parameterShape->isParametricShape()) {
610 int handleId = parameterShape->handleIdAt(roi);
611 if (handleId != -1) {
613 Q_EMIT statusTextChanged(i18n("Drag to move handle."));
614
615 m_activeHandle.reset(new ParameterHandle(this, parameterShape, handleId));
617 return;
618 }
619 } else {
620 QList<KoPathPoint*> points = shape->pointsAt(roi, true);
621 if (! points.empty()) {
622 // find the nearest control point from all points within the roi
623 KoPathPoint * bestPoint = 0;
625 qreal minDistance = HUGE_VAL;
626 Q_FOREACH (KoPathPoint *p, points) {
627 // the node point must be hit if the point is not selected yet
628 if (! m_pointSelection.contains(p) && ! roi.contains(p->point()))
629 continue;
630
631 // check for the control points first as otherwise it is no longer
632 // possible to change the control points when they are the same as the point
633 if (p->activeControlPoint1() && roi.contains(p->controlPoint1())) {
634 qreal dist = squaredDistance(roi.center(), p->controlPoint1());
635 if (dist < minDistance) {
636 bestPoint = p;
637 bestPointType = KoPathPoint::ControlPoint1;
638 minDistance = dist;
639 }
640 }
641
642 if (p->activeControlPoint2() && roi.contains(p->controlPoint2())) {
643 qreal dist = squaredDistance(roi.center(), p->controlPoint2());
644 if (dist < minDistance) {
645 bestPoint = p;
646 bestPointType = KoPathPoint::ControlPoint2;
647 minDistance = dist;
648 }
649 }
650
651 // check the node point at last
652 qreal dist = squaredDistance(roi.center(), p->point());
653 if (dist < minDistance) {
654 bestPoint = p;
655 bestPointType = KoPathPoint::Node;
656 minDistance = dist;
657 }
658 }
659
660 if (! bestPoint) {
662 return;
663 }
664
666 if (bestPointType == KoPathPoint::Node)
667 Q_EMIT statusTextChanged(i18n("Drag to move point. Shift click to change point type."));
668 else
669 Q_EMIT statusTextChanged(i18n("Drag to move control point."));
670
671 PointHandle *prev = dynamic_cast<PointHandle*>(m_activeHandle.data());
672 if (prev && prev->activePoint() == bestPoint && prev->activePointType() == bestPointType)
673 return; // no change;
674
675 m_activeHandle.reset(new PointHandle(this, bestPoint, bestPointType));
677 return;
678 }
679 }
680 }
681
683
684 if (m_activeHandle) {
685 m_activeHandle.reset();
687 }
688
689 PathSegment *hoveredSegment = segmentAtPoint(event->point);
690 if(hoveredSegment) {
691 useCursor(Qt::PointingHandCursor);
692 Q_EMIT statusTextChanged(i18n("Drag to change curve directly. Double click to insert new path point."));
693 m_activeSegment.reset(hoveredSegment);
695 } else {
696 uint selectedPointCount = m_pointSelection.size();
697 if (selectedPointCount == 0)
698 Q_EMIT statusTextChanged(QString());
699 else {
700 if (!m_actionBreakSelection->shortcut().isEmpty()) {
701 if (selectedPointCount == 1)
702 Q_EMIT statusTextChanged(i18nc("%1 is a shortcut to be pressed", "Press %1 to break path at selected point.", m_actionBreakSelection->shortcut().toString()));
703 else
704 Q_EMIT statusTextChanged(i18nc("%1 is a shortcut to be pressed", "Press %1 to break path at selected segments.", m_actionBreakSelection->shortcut().toString()));
705 } else {
706 Q_EMIT statusTextChanged(QString());
707 }
708 }
709 }
710}
711
713{
714 Q_D(KoToolBase);
715 if (m_currentStrategy) {
716 const bool hadNoSelection = !m_pointSelection.hasSelection();
717 m_currentStrategy->finishInteraction(event->modifiers());
718 KUndo2Command *command = m_currentStrategy->createCommand();
719 if (command)
720 d->canvas->addCommand(command);
721 if (hadNoSelection && dynamic_cast<KoPathPointRubberSelectStrategy*>(m_currentStrategy.data())
723 // the click didn't do anything at all. Allow it to be used by others.
724 event->ignore();
725 }
726 m_currentStrategy.reset();
728 }
729}
730
731void KoPathTool::keyPressEvent(QKeyEvent *event)
732{
733 if (m_currentStrategy) {
734 switch (event->key()) {
735 case Qt::Key_Control:
736 case Qt::Key_Alt:
737 case Qt::Key_Shift:
738 case Qt::Key_Meta:
739 if (! event->isAutoRepeat()) {
740 m_currentStrategy->handleMouseMove(m_lastPoint, event->modifiers());
741 }
742 break;
743 case Qt::Key_Escape:
744 m_currentStrategy->cancelInteraction();
745 m_currentStrategy.reset();
746 break;
747 default:
748 event->ignore();
749 return;
750 }
751 } else {
752 switch (event->key()) {
753#ifndef NDEBUG
754// case Qt::Key_D:
755// if (m_pointSelection.objectCount() == 1) {
756// QList<KoPathPointData> selectedPoints = m_pointSelection.selectedPointsData();
757// KoPathShapePrivate *p = static_cast<KoPathShapePrivate*>(selectedPoints[0].pathShape->priv());
758// p->debugPath();
759// }
760// break;
761#endif
762 default:
763 event->ignore();
764 return;
765 }
766 }
767 event->accept();
768}
769
770void KoPathTool::keyReleaseEvent(QKeyEvent *event)
771{
772 if (m_currentStrategy) {
773 switch (event->key()) {
774 case Qt::Key_Control:
775 case Qt::Key_Alt:
776 case Qt::Key_Shift:
777 case Qt::Key_Meta:
778 if (! event->isAutoRepeat()) {
779 m_currentStrategy->handleMouseMove(m_lastPoint, Qt::NoModifier);
780 }
781 break;
782 default:
783 break;
784 }
785 }
786 event->accept();
787}
788
790{
791 Q_D(KoToolBase);
792 // check if we are doing something else at the moment
793 if (m_currentStrategy) return;
794
795 if (!m_activeHandle && m_activeSegment && m_activeSegment->isValid()) {
796 QList<KoPathPointData> segments;
797 segments.append(
799 m_activeSegment->path->pathPointIndex(m_activeSegment->segmentStart)));
800
801 KoPathPointInsertCommand *cmd = new KoPathPointInsertCommand(segments, m_activeSegment->positionOnSegment);
802 d->canvas->addCommand(cmd);
803
805 foreach (KoPathPoint * p, cmd->insertedPoints()) {
806 m_pointSelection.add(p, false);
807 }
809 } else if (!m_activeHandle && !m_activeSegment) {
811 }
812}
813
815{
816 // the max allowed distance from a segment
817 const QRectF grabRoi = handleGrabRect(point);
818 const qreal distanceThreshold = 0.5 * KisAlgebra2D::maxDimension(grabRoi);
819
820 QScopedPointer<PathSegment> segment(new PathSegment);
821
822 Q_FOREACH (KoPathShape *shape, m_pointSelection.selectedShapes()) {
823 KoParameterShape * parameterShape = dynamic_cast<KoParameterShape*>(shape);
824 if (parameterShape && parameterShape->isParametricShape())
825 continue;
826
827 // convert document point to shape coordinates
828 const QPointF p = shape->documentToShape(point);
829 // our region of interest, i.e. a region around our mouse position
830 const QRectF roi = shape->documentToShape(grabRoi);
831
832 qreal minDistance = std::numeric_limits<qreal>::max();
833
834 // check all segments of this shape which intersect the region of interest
835 const QList<KoPathSegment> segments = shape->segmentsAt(roi);
836
837 foreach (const KoPathSegment &s, segments) {
838 const qreal nearestPointParam = s.nearestPoint(p);
839 const QPointF nearestPoint = s.pointAt(nearestPointParam);
840 const qreal distance = kisDistance(p, nearestPoint);
841
842 // are we within the allowed distance ?
843 if (distance > distanceThreshold)
844 continue;
845 // are we closer to the last closest point ?
846 if (distance < minDistance) {
847 segment->path = shape;
848 segment->segmentStart = s.first();
849 segment->positionOnSegment = nearestPointParam;
850 }
851 }
852 }
853
854 if (!segment->isValid()) {
855 segment.reset();
856 }
857
858 return segment.take();
859}
860
861void KoPathTool::activate(const QSet<KoShape*> &shapes)
862{
863 KoToolBase::activate(shapes);
864
865 Q_D(KoToolBase);
866
867 d->canvas->snapGuide()->reset();
868
870 m_canvasConnections.addConnection(d->canvas->selectedShapesProxy(), SIGNAL(selectionChanged()), this, SLOT(slotSelectionChanged()));
871 m_canvasConnections.addConnection(d->canvas->selectedShapesProxy(), SIGNAL(selectionContentChanged()), this, SLOT(updateActions()));
872
873 m_canvasConnections.addConnection(d->canvas->selectedShapesProxy(), SIGNAL(selectionChanged()), this, SLOT(repaintDecorations()));
874 m_canvasConnections.addConnection(d->canvas->selectedShapesProxy(), SIGNAL(selectionContentChanged()), this, SLOT(repaintDecorations()));
876 initializeWithShapes(QList<KoShape*>(shapes.begin(), shapes.end()));
877 connect(m_actionCurvePoint, SIGNAL(triggered()), this, SLOT(pointToCurve()), Qt::UniqueConnection);
878 connect(m_actionLinePoint, SIGNAL(triggered()), this, SLOT(pointToLine()), Qt::UniqueConnection);
879 connect(m_actionLineSegment, SIGNAL(triggered()), this, SLOT(segmentToLine()), Qt::UniqueConnection);
880 connect(m_actionCurveSegment, SIGNAL(triggered()), this, SLOT(segmentToCurve()), Qt::UniqueConnection);
881 connect(m_actionAddPoint, SIGNAL(triggered()), this, SLOT(insertPoints()), Qt::UniqueConnection);
882 connect(m_actionRemovePoint, SIGNAL(triggered()), this, SLOT(removePoints()), Qt::UniqueConnection);
883 connect(m_actionBreakPoint, SIGNAL(triggered()), this, SLOT(breakAtPoint()), Qt::UniqueConnection);
884 connect(m_actionBreakSegment, SIGNAL(triggered()), this, SLOT(breakAtSegment()), Qt::UniqueConnection);
885 connect(m_actionBreakSelection, SIGNAL(triggered()), this, SLOT(breakAtSelection()), Qt::UniqueConnection);
886 connect(m_actionJoinSegment, SIGNAL(triggered()), this, SLOT(joinPoints()), Qt::UniqueConnection);
887 connect(m_actionMergePoints, SIGNAL(triggered()), this, SLOT(mergePoints()), Qt::UniqueConnection);
888 connect(m_actionConvertToPath, SIGNAL(triggered()), this, SLOT(convertToPath()), Qt::UniqueConnection);
889 connect(m_actionPathPointCorner, SIGNAL(triggered()), this, SLOT(pointTypeChangedCorner()), Qt::UniqueConnection);
890 connect(m_actionPathPointSmooth, SIGNAL(triggered()), this, SLOT(pointTypeChangedSmooth()), Qt::UniqueConnection);
891 connect(m_actionPathPointSymmetric, SIGNAL(triggered()), this, SLOT(pointTypeChangedSymmetric()), Qt::UniqueConnection);
892 connect(&m_pointSelection, SIGNAL(selectionChanged()), this, SLOT(pointSelectionChanged()), Qt::UniqueConnection);
893
894}
895
897{
898 Q_D(KoToolBase);
899 QList<KoShape*> shapes =
900 d->canvas->selectedShapesProxy()->selection()->selectedEditableShapesAndDelegates();
901
902 initializeWithShapes(shapes);
903}
904
906{
907 Q_UNUSED(shape);
908
909 // active handle and selection might have already become invalid, so just
910 // delete them without dereferencing anything...
911
912 m_activeHandle.reset();
913 m_activeSegment.reset();
914}
915
922
924{
925 QList<KoPathShape*> selectedShapes;
926 Q_FOREACH (KoShape *shape, shapes) {
927 KoPathShape *pathShape = dynamic_cast<KoPathShape*>(shape);
928
929 if (pathShape && pathShape->isShapeEditable()) {
930 selectedShapes.append(pathShape);
931 }
932 }
933
934 if (selectedShapes != m_pointSelection.selectedShapes()) {
936 m_pointSelection.setSelectedShapes(selectedShapes);
938 }
939
942}
943
945{
946 PathToolOptionWidget::Types type;
948 Q_FOREACH (KoPathShape *shape, selectedShapes) {
949 KoParameterShape * parameterShape = dynamic_cast<KoParameterShape*>(shape);
950 type |= parameterShape && parameterShape->isParametricShape() ?
952 }
953
954 Q_EMIT singleShapeChanged(selectedShapes.size() == 1 ? selectedShapes.first() : 0);
955 Q_EMIT typeChanged(type);
956}
957
959{
961
962 bool canBreakAtPoint = false;
963
964 bool hasNonSmoothPoints = false;
965 bool hasNonSymmetricPoints = false;
966 bool hasNonSplitPoints = false;
967
968 bool hasNonLinePoints = false;
969 bool hasNonCurvePoints = false;
970
971 bool canJoinSubpaths = false;
972
973 if (!pointData.isEmpty()) {
974 Q_FOREACH (const KoPathPointData &pd, pointData) {
975 const int subpathIndex = pd.pointIndex.first;
976 const int pointIndex = pd.pointIndex.second;
977
978 canBreakAtPoint |= pd.pathShape->isClosedSubpath(subpathIndex) ||
979 (pointIndex > 0 && pointIndex < pd.pathShape->subpathPointCount(subpathIndex) - 1);
980
982
983 hasNonSmoothPoints |= !(point->properties() & KoPathPoint::IsSmooth);
984 hasNonSymmetricPoints |= !(point->properties() & KoPathPoint::IsSymmetric);
985 hasNonSplitPoints |=
988
989 hasNonLinePoints |= point->activeControlPoint1() || point->activeControlPoint2();
990 hasNonCurvePoints |= !point->activeControlPoint1() && !point->activeControlPoint2();
991 }
992
993 if (pointData.size() == 2) {
994 const KoPathPointData & pd1 = pointData.at(0);
995 const KoPathPointData & pd2 = pointData.at(1);
996
997 canJoinSubpaths = checkCanJoinToPoints(pd1, pd2);
998 }
999 }
1000
1001 m_actionPathPointCorner->setEnabled(hasNonSplitPoints);
1002 m_actionPathPointSmooth->setEnabled(hasNonSmoothPoints);
1003 m_actionPathPointSymmetric->setEnabled(hasNonSymmetricPoints);
1004
1005 m_actionRemovePoint->setEnabled(!pointData.isEmpty());
1006
1007 m_actionBreakPoint->setEnabled(canBreakAtPoint);
1008
1009 m_actionCurvePoint->setEnabled(hasNonCurvePoints);
1010 m_actionLinePoint->setEnabled(hasNonLinePoints);
1011
1012 m_actionJoinSegment->setEnabled(canJoinSubpaths);
1013 m_actionMergePoints->setEnabled(canJoinSubpaths);
1014
1016
1017
1018 bool canSplitAtSegment = false;
1019 bool canConvertSegmentToLine = false;
1020 bool canConvertSegmentToCurve= false;
1021
1022 if (!segments.isEmpty()) {
1023
1024 canSplitAtSegment = segments.size() == 1;
1025
1026 bool hasLines = false;
1027 bool hasCurves = false;
1028
1029 Q_FOREACH (const KoPathPointData &pd, segments) {
1031 hasLines |= segment.degree() == 1;
1032 hasCurves |= segment.degree() > 1;
1033 }
1034
1035 canConvertSegmentToLine = !segments.isEmpty() && hasCurves;
1036 canConvertSegmentToCurve= !segments.isEmpty() && hasLines;
1037 }
1038
1039 m_actionAddPoint->setEnabled(canSplitAtSegment);
1040
1041 m_actionLineSegment->setEnabled(canConvertSegmentToLine);
1042 m_actionCurveSegment->setEnabled(canConvertSegmentToCurve);
1043
1044 m_actionBreakSegment->setEnabled(canSplitAtSegment);
1045 m_actionBreakSelection->setEnabled(canSplitAtSegment | canBreakAtPoint);
1046
1048 bool haveConvertibleShapes = false;
1049 Q_FOREACH (KoShape *shape, selection->selectedEditableShapes()) {
1050 KoParameterShape * parameterShape = dynamic_cast<KoParameterShape*>(shape);
1051 KoSvgTextShape *textShape = dynamic_cast<KoSvgTextShape*>(shape);
1052 if (textShape ||
1053 (parameterShape && parameterShape->isParametricShape())) {
1054
1055 haveConvertibleShapes = true;
1056 break;
1057 }
1058 }
1059 m_actionConvertToPath->setEnabled(haveConvertibleShapes);
1060}
1061
1063{
1064 Q_D(KoToolBase);
1065
1070 m_activeHandle.reset();
1071 m_activeSegment.reset();
1072 m_currentStrategy.reset();
1073 d->canvas->snapGuide()->reset();
1074
1075 disconnect(m_actionCurvePoint, 0, this, 0);
1076 disconnect(m_actionLinePoint, 0, this, 0);
1077 disconnect(m_actionLineSegment, 0, this, 0);
1078 disconnect(m_actionCurveSegment, 0, this, 0);
1079 disconnect(m_actionAddPoint, 0, this, 0);
1080 disconnect(m_actionRemovePoint, 0, this, 0);
1081 disconnect(m_actionBreakPoint, 0, this, 0);
1082 disconnect(m_actionBreakSegment, 0, this, 0);
1083 disconnect(m_actionBreakSelection, 0, this, 0);
1084 disconnect(m_actionJoinSegment, 0, this, 0);
1085 disconnect(m_actionMergePoints, 0, this, 0);
1086 disconnect(m_actionConvertToPath, 0, this, 0);
1087 disconnect(m_actionPathPointCorner, 0, this, 0);
1088 disconnect(m_actionPathPointSmooth, 0, this, 0);
1089 disconnect(m_actionPathPointSymmetric, 0, this, 0);
1090 disconnect(&m_pointSelection, 0, this, 0);
1091
1093}
1094
1095void KoPathTool::canvasResourceChanged(int key, const QVariant & /*res*/)
1096{
1099 }
1100}
1101
1103{
1104 Q_D(KoToolBase);
1105 updateActions();
1106 d->canvas->snapGuide()->setIgnoredPathPoints(QList<KoPathPoint*>(m_pointSelection.selectedPoints().begin(), m_pointSelection.selectedPoints().end()));
1108}
1109
1110namespace {
1111void addActionsGroupIfEnabled(QMenu *menu, QAction *a1, QAction *a2)
1112{
1113 if (a1->isEnabled() || a2->isEnabled()) {
1114 menu->addAction(a1);
1115 menu->addAction(a2);
1116 menu->addSeparator();
1117 }
1118}
1119
1120void addActionsGroupIfEnabled(QMenu *menu, QAction *a1, QAction *a2, QAction *a3)
1121{
1122 if (a1->isEnabled() || a2->isEnabled()) {
1123 menu->addAction(a1);
1124 menu->addAction(a2);
1125 menu->addAction(a3);
1126 menu->addSeparator();
1127 }
1128}
1129}
1130
1132{
1133 if (m_activeHandle) {
1134 m_activeHandle->trySelectHandle();
1135 }
1136
1137 if (m_activeSegment && m_activeSegment->isValid()) {
1138 KoPathShape *shape = m_activeSegment->path;
1139 KoPathSegment segment = shape->segmentByIndex(shape->pathPointIndex(m_activeSegment->segmentStart));
1140
1141 m_pointSelection.add(segment.first(), true);
1142 m_pointSelection.add(segment.second(), false);
1143 }
1144
1145 if (m_contextMenu) {
1146 m_contextMenu->clear();
1147
1148 addActionsGroupIfEnabled(m_contextMenu.data(),
1152
1153 addActionsGroupIfEnabled(m_contextMenu.data(),
1156
1157 addActionsGroupIfEnabled(m_contextMenu.data(),
1160
1161 addActionsGroupIfEnabled(m_contextMenu.data(),
1164
1165 addActionsGroupIfEnabled(m_contextMenu.data(),
1168
1169 addActionsGroupIfEnabled(m_contextMenu.data(),
1172
1174
1175 m_contextMenu->addSeparator();
1176 }
1177
1178 return m_contextMenu.data();
1179}
1180
1185
1190
1192{
1193 // noop!
1194}
1195
1200
1202{
1203 // noop!
1204}
1205
1210
1212{
1215 return true;
1216}
1217
const Params2D p
QPointF p2
QPointF p1
qreal distance(const QPointF &p1, const QPointF &p2)
unsigned int uint
QPair< int, int > KoPathPointIndex
Definition KoPathShape.h:28
qreal squaredDistance(const QPointF &p1, const QPointF &p2)
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
KUndo2MagicString text() const
virtual void redo()
The KisHandlePainterHelper class is a special helper for painting handles around objects....
void drawPath(const QPainterPath &path)
void setHandleStyle(const KisHandleStyle &style)
static KisHandleStyle & secondarySelection()
static KisHandleStyle & primarySelection()
void addConnection(Sender sender, Signal signal, Receiver receiver, Method method, Qt::ConnectionType type=Qt::AutoConnection)
QPointer< KoShapeController > shapeController
virtual KoShapeManager * shapeManager() const =0
virtual void addCommand(KUndo2Command *command)=0
virtual KoSelectedShapesProxy * selectedShapesProxy() const =0
selectedShapesProxy() is a special interface for keeping a persistent connections to selectionChanged...
void paintHandles(KisHandlePainterHelper &handlesHelper)
Paint the handles.
bool isParametricShape() const
Check if object is a parametric shape.
int handleIdAt(const QRectF &rect) const
Get the id of the handle within the given rect.
The undo / redo command for changing a KoParameterShape into a KoPathShape.
Command to break a subpath at points.
Describe a KoPathPoint by a KoPathShape and its indices.
KoPathPointIndex pointIndex
position of the point in the path shape
KoPathShape * pathShape
path shape the path point belongs too
The undo / redo command for inserting path points.
QList< KoPathPoint * > insertedPoints() const
Returns list of inserted points.
static KUndo2Command * createCommand(const QList< KoPathPointData > &pointDataList, KoShapeController *shapeController, KUndo2Command *parent=0)
Create command for removing points from path shapes.
Strategy to rubber select points of a path shape.
The undo / redo command for changing the path point type.
PointType
The type of the point.
A KoPathPoint represents a point in a path.
PointProperties properties
QRectF boundingRect(bool active=true) const
Get the bounding rect of the point.
QPointF point
QPointF controlPoint1
@ IsSmooth
it is smooth, both control points on a line through the point
Definition KoPathPoint.h:41
@ IsSymmetric
it is symmetric, like smooth but control points have same distance to point
Definition KoPathPoint.h:42
PointType
the type for identifying part of a KoPathPoint
Definition KoPathPoint.h:47
@ ControlPoint2
the second control point
Definition KoPathPoint.h:51
@ ControlPoint1
the first control point
Definition KoPathPoint.h:50
@ Node
the node point
Definition KoPathPoint.h:49
bool activeControlPoint1
bool activeControlPoint2
QPointF controlPoint2
The undo / redo command for breaking a subpath by removing the segment.
Strategy for deforming a segment of a path shape.
The undo / redo command for changing segments to curves/lines.
A KoPathSegment consist of two neighboring KoPathPoints.
KoPathPoint * first
int degree() const
Returns the degree of the segment: 1 = line, 2 = quadratic, 3 = cubic, -1 = invalid.
QPointF pointAt(qreal t) const
Returns point at given t.
qreal nearestPoint(const QPointF &point) const
KoPathPoint * second
bool isValid() const
Returns if segment is valid, e.g. has two valid points.
QRectF boundingRect() const
Returns the axis aligned tight bounding rect.
KoPathSegment toCubic() const
Returns cubic bezier curve segment of this segment.
The position of a path point within a path shape.
Definition KoPathShape.h:63
int subpathPointCount(int subpathIndex) const
Returns the number of points in a subpath.
bool isClosedSubpath(int subpathIndex) const
Checks if a subpath is closed.
QList< KoPathPoint * > pointsAt(const QRectF &rect, const bool useControlPoints=false) const
Returns the path points within the given rectangle.
QList< KoPathSegment > segmentsAt(const QRectF &rect) const
Returns the list of path segments within the given rectangle.
QPainterPath outline() const override
reimplemented
KoPathSegment segmentByIndex(const KoPathPointIndex &pointIndex) const
Returns the segment specified by a path point index.
virtual void paintPoints(KisHandlePainterHelper &handlesHelper)
KoPathPointIndex pathPointIndex(const KoPathPoint *point) const
Returns the path point index of a given path point.
KoPathPoint * pointByIndex(const KoPathPointIndex &pointIndex) const
Returns the path point specified by a path point index.
Handle the selection of points.
int objectCount() const
Get the number of path objects in the selection.
void paint(QPainter &painter, const KoViewConverter &converter, qreal handleRadius)
Draw the selected points.
const QSet< KoPathPoint * > & selectedPoints() const
Get all selected points.
bool contains(KoPathPoint *point)
Check if a point is in the selection.
bool hasSelection() override
reimplemented from KoToolSelection
int size() const
Get the number of path points in the selection.
QList< KoPathPointData > selectedPointsData() const
Get the point data of all selected points.
void clear()
Clear the selection.
QList< KoPathShape * > selectedShapes() const
Returns list of selected shapes.
void add(KoPathPoint *point, bool clear)
Add a point to the selection.
void setSelectedShapes(const QList< KoPathShape * > shapes)
Sets list of selected shapes.
QList< KoPathPointData > selectedSegmentsData() const
Get the point data of all selected segments.
void canvasResourceChanged(int key, const QVariant &res) override
void mousePressEvent(KoPointerEvent *event) override
QAction * m_actionJoinSegment
Definition KoPathTool.h:138
QScopedPointer< KoInteractionStrategy > m_currentStrategy
the rubber selection strategy
Definition KoPathTool.h:124
void updateActions()
void mouseMoveEvent(KoPointerEvent *event) override
QCursor m_selectCursor
Definition KoPathTool.h:114
QAction * m_actionCurvePoint
Definition KoPathTool.h:129
void pointTypeChangedSmooth()
QAction * m_actionLinePoint
Definition KoPathTool.h:130
void activate(const QSet< KoShape * > &shapes) override
QAction * m_actionRemovePoint
Definition KoPathTool.h:134
KoPathToolSelection m_pointSelection
the point selection
Definition KoPathTool.h:113
void updateOptionsWidget()
QAction * m_actionLineSegment
Definition KoPathTool.h:131
void breakAtSelection()
QRectF decorationsRect() const override
QScopedPointer< QMenu > m_contextMenu
Definition KoPathTool.h:142
QMenu * popupActionsMenu() override
void requestStrokeCancellation() override
void requestStrokeEnd() override
void segmentToCurve()
void keyPressEvent(QKeyEvent *event) override
QAction * m_actionPathPointSymmetric
Definition KoPathTool.h:128
QScopedPointer< PathSegment > m_activeSegment
Definition KoPathTool.h:119
QAction * m_actionBreakSegment
Definition KoPathTool.h:136
void breakAtPoint()
~KoPathTool() override
void pointToLine()
void convertToPath()
void deselect() override
deselect the tool should clear the selection if it has one.
QAction * m_actionAddPoint
Definition KoPathTool.h:133
void joinPoints()
void singleShapeChanged(KoPathShape *path)
KUndo2Command * createPointToCurveCommand(const QList< KoPathPointData > &points)
PathSegment * segmentAtPoint(const QPointF &point)
KisSignalAutoConnectionsStore m_canvasConnections
Definition KoPathTool.h:143
bool selectAll() override
selectAll select all data the tool can select.
QAction * m_actionPathPointSmooth
Definition KoPathTool.h:127
void pointSelectionChanged()
void segmentToLine()
void pointToCurve()
QPointF m_lastPoint
needed for interaction strategy
Definition KoPathTool.h:118
QAction * m_actionCurveSegment
Definition KoPathTool.h:132
void pointTypeChangedCorner()
void slotSelectionChanged()
void mouseDoubleClickEvent(KoPointerEvent *event) override
QCursor m_moveCursor
Definition KoPathTool.h:141
void mouseReleaseEvent(KoPointerEvent *event) override
void breakAtSegment()
KoToolSelection * selection() override
QList< QPointer< QWidget > > createOptionWidgets() override
reimplemented
void clearActivePointSelectionReferences()
void explicitUserStrokeEndRequest() override
explicitUserStrokeEndRequest is called by the input manager when the user presses Enter key or any eq...
KoPathTool(KoCanvasBase *canvas)
void pointTypeChangedSymmetric()
void deactivate() override
void mergePointsImpl(bool doJoin)
void removePoints()
void initializeWithShapes(const QList< KoShape * > shapes)
void pointTypeChanged(KoPathPointTypeCommand::PointType type)
QAction * m_actionMergePoints
Definition KoPathTool.h:139
QScopedPointer< KoPathToolHandle > m_activeHandle
the currently active handle
Definition KoPathTool.h:117
void keyReleaseEvent(QKeyEvent *event) override
void deleteSelection() override
void mergePoints()
KoShapeFillResourceConnector m_shapeFillResourceConnector
Definition KoPathTool.h:144
void notifyPathPointsChanged(KoPathShape *shape)
void requestUndoDuringStroke() override
void paint(QPainter &painter, const KoViewConverter &converter) override
QAction * m_actionBreakPoint
Definition KoPathTool.h:135
QAction * m_actionConvertToPath
Definition KoPathTool.h:140
void repaintDecorations() override
QAction * m_actionPathPointCorner
Definition KoPathTool.h:126
void insertPoints()
void typeChanged(int types)
QAction * m_actionBreakSelection
Definition KoPathTool.h:137
Qt::MouseButton button() const
return button pressed (see QMouseEvent::button());
Qt::KeyboardModifiers modifiers() const
QPointF point
The point in document coordinates.
virtual KoSelection * selection()=0
KoShape * shapeAt(const QPointF &position, KoFlake::ShapeSelection selection=KoFlake::ShapeOnTop, bool omitHiddenShapes=true)
KoSelection * selection
virtual bool isShapeEditable(bool recursive=true) const
checks recursively if the shape or one of its parents is not visible or locked
Definition KoShape.cpp:1165
virtual KoShapeStrokeModelSP stroke() const
Definition KoShape.cpp:1067
QPointF documentToShape(const QPointF &point) const
Transforms point from document coordinates to shape coordinates.
Definition KoShape.cpp:1211
virtual QRectF boundingRect() const
Get the bounding box of the shape.
Definition KoShape.cpp:335
KoShapeContainer * parent() const
Definition KoShape.cpp:1039
static KisHandlePainterHelper createHandlePainterHelperView(QPainter *painter, KoShape *shape, const KoViewConverter &converter, qreal handleRadius=0.0, int decorationThickness=1)
Definition KoShape.cpp:1177
KoShape * textOutline() const
textOutline This turns the text object into non-text KoShape(s) to the best of its abilities.
qreal handleDocRadius() const
KoCanvasBase * canvas() const
Returns the canvas the tool is working on.
void selectionChanged(bool hasSelection)
void statusTextChanged(const QString &statusText)
virtual void repaintDecorations()
int handleRadius() const
Convenience function to get the current handle radius.
void useCursor(const QCursor &cursor)
virtual void activate(const QSet< KoShape * > &shapes)
QRectF handleGrabRect(const QPointF &position) const
virtual void deactivate()
QAction * action(const QString &name) const
int decorationThickness() const
decorationThickness The minimum thickness for tool decoration lines, this is derived from the screen ...
void switchToolRequested(const QString &id)
static KoToolManager * instance()
Return the toolmanager singleton.
virtual QPointF documentToView(const QPointF &documentPoint) const
KoPathPoint * activePoint() const
KoPathPoint::PointType activePointType() const
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
#define KIS_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:75
qreal kisDistance(const QPointF &pt1, const QPointF &pt2)
Definition kis_global.h:190
T kisGrowRect(const T &rect, U offset)
Definition kis_global.h:186
KUndo2MagicString kundo2_i18n(const char *text)
auto maxDimension(Size size) -> decltype(size.width())
@ DecorationThickness
Integer, the thickness of single px decorations, will be adjusted by HiDPI settings....
@ HandleRadius
The handle radius used for drawing handles of any kind.
@ ShapeOnTop
return the shape highest z-ordering, regardless of selection.
Definition KoFlake.h:74
KoPathPoint * segmentStart