Krita Source Code Documentation
Loading...
Searching...
No Matches
KoShapeShearCommand.cpp
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 * SPDX-FileCopyrightText: 2006 Jan Hambrecht <jaham@gmx.net>
4 *
5 * SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7
9#include "KoShape.h"
10
11#include <klocalizedstring.h>
12
22
23KoShapeShearCommand::KoShapeShearCommand(const QList<KoShape*> &shapes, const QList<qreal> &previousShearXs, const QList<qreal> &previousShearYs, const QList<qreal> &newShearXs, const QList<qreal> &newShearYs, KUndo2Command *parent)
24 : KUndo2Command(parent),
26{
27 d->shapes = shapes;
28 d->previousShearXs = previousShearXs;
29 d->previousShearYs = previousShearYs;
30 d->newShearXs = newShearXs;
31 d->newShearYs = newShearYs;
32
33 Q_ASSERT(d->shapes.count() == d->previousShearXs.count());
34 Q_ASSERT(d->shapes.count() == d->previousShearYs.count());
35 Q_ASSERT(d->shapes.count() == d->newShearXs.count());
36 Q_ASSERT(d->shapes.count() == d->newShearYs.count());
37
38 setText(kundo2_i18n("Shear shapes"));
39}
40
45
47{
49 for (int i = 0; i < d->shapes.count(); i++) {
50 d->shapes.at(i)->update();
51 d->shapes.at(i)->shear(d->newShearXs.at(i), d->newShearYs.at(i));
52 d->shapes.at(i)->update();
53 }
54}
55
57{
59 for (int i = 0; i < d->shapes.count(); i++) {
60 d->shapes.at(i)->update();
61 d->shapes.at(i)->shear(d->previousShearXs.at(i), d->previousShearYs.at(i));
62 d->shapes.at(i)->update();
63 }
64}
virtual void undo()
void setText(const KUndo2MagicString &text)
virtual void redo()
KoShapeShearCommand(const QList< KoShape * > &shapes, const QList< qreal > &previousShearXs, const QList< qreal > &previousShearYs, const QList< qreal > &newShearXs, const QList< qreal > &newShearYs, KUndo2Command *parent=0)
void undo() override
revert the actions done in redo
KoShapeShearCommandPrivate *const d
void redo() override
redo the command
KUndo2MagicString kundo2_i18n(const char *text)