12#include <klocalizedstring.h>
22 : controller(c), paths(
p)
24 , combinedPathParent(0)
28 oldParents.append(path->parent());
32 if (isCombined && controller) {
55 , d(new
Private(controller, paths))
60 if (!
d->combinedPath) {
64 d->combinedPath = clone;
65 d->combinedPathParent = path->parent();
66 d->shapeStartSegmentIndex[path] = 0;
68 const int startSegmentIndex =
d->combinedPath->combine(path);
69 d->shapeStartSegmentIndex[path] = startSegmentIndex;
82 if (
d->paths.isEmpty())
return;
90 d->combinedPath->setParent(
d->combinedPathParent);
96 if (!
d->paths.size())
99 d->isCombined =
false;
102 d->combinedPath->setParent(0);
104 auto parentIt =
d->oldParents.begin();
106 p->setParent(*parentIt);
115 return d->combinedPath;
122 const int segmentOffset =
d->shapeStartSegmentIndex[pd.
pathShape];
QPair< int, int > KoPathPointIndex
The undo / redo command for combining two or more paths into one.
QHash< KoPathShape *, int > shapeStartSegmentIndex
~KoPathCombineCommand() override
void redo() override
redo the command
QList< KoPathShape * > paths
KoPathCombineCommand(KoShapeControllerBase *controller, const QList< KoPathShape * > &paths, KUndo2Command *parent=0)
KoPathShape * combinedPath
KoShapeContainer * combinedPathParent
KoPathPointData originalToCombined(KoPathPointData pd) const
QList< KoShapeContainer * > oldParents
void undo() override
revert the actions done in redo
KoShapeControllerBase * controller
Private(KoShapeControllerBase *c, const QList< KoPathShape * > &p)
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 position of a path point within a path shape.
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
#define KIS_ASSERT_RECOVER_BREAK(cond)
KUndo2MagicString kundo2_i18n(const char *text)