Krita Source Code Documentation
Loading...
Searching...
No Matches
KoShapeReorderCommand.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2006 Thomas Zander <zander@kde.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef KOSHAPEREORDERCOMMAND_H
8#define KOSHAPEREORDERCOMMAND_H
9
10#include "kritaflake_export.h"
11
12#include <boost/operators.hpp>
13#include <kundo2command.h>
14#include <QList>
15
16class KoShape;
17class KoShapeManager;
19
21class KRITAFLAKE_EXPORT KoShapeReorderCommand : public KUndo2Command
22{
23public:
24 struct KRITAFLAKE_EXPORT IndexedShape : boost::less_than_comparable<IndexedShape> {
26 IndexedShape(KoShape *_shape);
27
28 bool operator<(const IndexedShape &rhs) const;
29
30 int zIndex = 0;
31 KoShape *shape = 0;
32 };
33
34
35public:
43 KoShapeReorderCommand(const QList<KoShape*> &shapes, QList<int> &newIndexes, KUndo2Command *parent = 0);
45 ~KoShapeReorderCommand() override;
46
54
64 static KoShapeReorderCommand *createCommand(const QList<KoShape*> &shapes, KoShapeManager *manager,
65 MoveShapeType move, KUndo2Command *parent = 0);
66
80 static KoShapeReorderCommand *mergeInShape(QList<KoShape*> shapes, KoShape *newShape,
81 KUndo2Command *parent = 0);
82
89 static
91 homogenizeZIndexes(QList<IndexedShape> shapes);
92
98 static
100 homogenizeZIndexesLazy(QList<IndexedShape> shapes);
101
106 static QList<IndexedShape> mergeDownShapes(QList<KoShape*> shapesBelow, QList<KoShape*> shapesAbove);
107
109 void redo() override;
111 void undo() override;
112
113private:
115};
116
117KRITAFLAKE_EXPORT QDebug operator<<(QDebug dbg, const KoShapeReorderCommand::IndexedShape &indexedShape);
118
119#endif
KRITAFLAKE_EXPORT QDebug operator<<(QDebug dbg, const KoShapeReorderCommand::IndexedShape &indexedShape)
bool operator<(KoSnapStrategy::SnapType lhs, KoSnapStrategy::SnapType rhs)
virtual void undo()
virtual void redo()
This command allows you to change the zIndex of a number of shapes.
KoShapeReorderCommandPrivate *const d
MoveShapeType
An enum for defining what kind of reordering to use.
@ RaiseShape
raise the selected shape to the level that it is above the shape that is on top of it.
@ LowerShape
Lower the selected shape to the level that it is below the shape that is below it.
@ BringToFront
Raise the selected shape to be on top of all shapes.