Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Remove KoSvgChangeTextContoursCommand.

Wolthera van Hövell tot Westerflierc15673c169c0
diff --git a/libs/flake/CMakeLists.txt b/libs/flake/CMakeLists.txt
index 62ce790ec0..282df049af 100644
--- a/libs/flake/CMakeLists.txt
+++ b/libs/flake/CMakeLists.txt
@@ -172,7 +172,6 @@ set(kritaflake_SRCS
commands/KoShapePaintOrderCommand.cpp
commands/KoShapeMergeTextPropertiesCommand.cpp
commands/KoSvgConvertTextTypeCommand.cpp
- commands/KoSvgChangeTextContoursCommand.cpp
commands/KoSvgTextAddRemoveShapeCommands.cpp
commands/KoSvgTextReorderShapeInsideCommand.cpp
commands/KoSvgTextFlipShapeContourTypeCommand.cpp
diff --git a/libs/flake/commands/KoSvgChangeTextContoursCommand.cpp b/libs/flake/commands/KoSvgChangeTextContoursCommand.cpp
deleted file mode 100644
index dd4f9b6e33..0000000000
--- a/libs/flake/commands/KoSvgChangeTextContoursCommand.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2025 Wolthera van Hövell tot Westerflier <[email protected]>
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-#include <KoShape.h>
-#include <KoSvgTextShape.h>
-
-#include "KoSvgChangeTextContoursCommand.h"
-
-struct KoSvgChangeTextContoursCommand::Private {
- Private(KoSvgTextShape *_text, QList<KoShape*> _shapes, bool _inside)
- : textShape(_text)
- , newShapes(_shapes)
- , memento(textShape->getMemento())
- , inside(_inside)
- {
- oldShapes = inside? textShape->shapesInside(): textShape->shapesSubtract();
- }
- ~Private()
- {
-
- }
- KoSvgTextShape *textShape;
- QList<KoShape*> oldShapes;
- QList<KoShape*> newShapes;
- KoSvgTextShapeMementoSP memento;
- bool inside;
-};
-
-KoSvgChangeTextContoursCommand::KoSvgChangeTextContoursCommand(KoSvgTextShape *textShape, QList<KoShape*> shapes, bool inside, KUndo2Command *parent)
- : KUndo2Command(parent)
- , d(new Private(textShape, shapes, inside))
-{
- setText(kundo2_i18n("Change Text Contours"));
-}
-
-KoSvgChangeTextContoursCommand::~KoSvgChangeTextContoursCommand()
-{
-
-}
-
-void KoSvgChangeTextContoursCommand::redo()
-{
- QRectF updateRect = d->textShape->boundingRect();
- if (d->inside) {
- d->textShape->setShapesInside(d->newShapes);
- } else {
- d->textShape->setShapesSubtract(d->newShapes);
- }
- updateRect |= d->textShape->boundingRect();
- d->textShape->updateAbsolute(updateRect);
-}
-
-void KoSvgChangeTextContoursCommand::undo()
-{
- QRectF updateRect = d->textShape->boundingRect();
- if (d->inside) {
- d->textShape->setShapesInside(d->oldShapes);
- } else {
- d->textShape->setShapesSubtract(d->oldShapes);
- }
- d->textShape->setMemento(d->memento);
- updateRect |= d->textShape->boundingRect();
- d->textShape->updateAbsolute(updateRect);
-}
diff --git a/libs/flake/commands/KoSvgChangeTextContoursCommand.h b/libs/flake/commands/KoSvgChangeTextContoursCommand.h
deleted file mode 100644
index b01896b81b..0000000000
--- a/libs/flake/commands/KoSvgChangeTextContoursCommand.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2025 Wolthera van Hövell tot Westerflier <[email protected]>
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-#ifndef KOSVGCHANGETEXTCONTOURSCOMMAND_H
-#define KOSVGCHANGETEXTCONTOURSCOMMAND_H
-
-#include <kundo2command.h>
-#include <kritaflake_export.h>
-
-class KoSvgTextShape;
-class KoShape;
-
-/**
- * @brief The KoSvgChangeTextContoursCommand class
- * This replaces the given shapes on the text shape.
- *
- * bool inside indicates whether it will set on shapesInside or shapesSubtract.
- */
-
-class KRITAFLAKE_EXPORT KoSvgChangeTextContoursCommand : public KUndo2Command
-{
-public:
- KoSvgChangeTextContoursCommand(KoSvgTextShape *textShape, QList<KoShape*> shapes, bool inside, KUndo2Command *parent = nullptr);
- ~KoSvgChangeTextContoursCommand();
-
- void redo() override;
- void undo() override;
-private:
- struct Private;
- QScopedPointer<Private> d;
-};
-
-#endif // KOSVGCHANGETEXTCONTOURSCOMMAND_H
diff --git a/libs/flake/tests/TestSvgTextShape.cpp b/libs/flake/tests/TestSvgTextShape.cpp
index c5b4b2b6b0..252e6e7ebc 100644
--- a/libs/flake/tests/TestSvgTextShape.cpp
+++ b/libs/flake/tests/TestSvgTextShape.cpp
@@ -22,7 +22,6 @@
#include "KoShapePainter.h"
#include <KoShapeStroke.h>
-#include <commands/KoSvgChangeTextContoursCommand.h>
#include <commands/KoSvgTextAddRemoveShapeCommands.h>
#include <commands/KoSvgTextFlipShapeContourTypeCommand.h>
#include <commands/KoSvgTextReorderShapeInsideCommand.h>
diff --git a/plugins/tools/svgtexttool/SvgCreateTextStrategy.cpp b/plugins/tools/svgtexttool/SvgCreateTextStrategy.cpp
index 05b6d02fb4..82d9b0b636 100644
--- a/plugins/tools/svgtexttool/SvgCreateTextStrategy.cpp
+++ b/plugins/tools/svgtexttool/SvgCreateTextStrategy.cpp
@@ -21,7 +21,7 @@
#include "KoSnapGuide.h"
#include "commands/KoKeepShapesSelectedCommand.h"
#include "commands/KoShapeMoveCommand.h"
-#include "KoSvgChangeTextContoursCommand.h"
+#include "commands/KoSvgTextAddRemoveShapeCommands.h"
#include "kis_global.h"
#include "kundo2command.h"
@@ -145,15 +145,7 @@ KUndo2Command *SvgCreateTextStrategy::createCommand()
if (m_flowShape) {
textShape->setPosition(m_flowShape->absolutePosition(KoFlake::TopLeft));
- QList<QPointF> pos {m_flowShape->absolutePosition(KoFlake::TopLeft)};
- QList<QPointF> newPos {QPointF()};
- QList<KoShape*> shapes{m_flowShape};
- new KoShapeMoveCommand(shapes, pos, newPos, KoFlake::TopLeft, parentCommand);
- if (m_flowShape->parent()) {
- // text is not a shape container, but we do need to remove the shape from the canvas properly.
- tool->canvas()->shapeController()->removeShape(m_flowShape, parentCommand);
- }
- new KoSvgChangeTextContoursCommand(textShape, shapes, true, parentCommand);
+ new KoSvgTextAddShapeCommand(textShape, m_flowShape, true, parentCommand);
}
new KoKeepShapesSelectedCommand({}, {textShape}, tool->canvas()->selectedShapesProxy(), true, parentCommand);