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++
1.3 KB
Raw Blame
/*
 * SPDX-FileCopyrightText: 2023 Alvin Wong <[email protected]>
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#ifndef SVG_INLINE_SIZE_CHANGE_COMMAND_H
#define SVG_INLINE_SIZE_CHANGE_COMMAND_H

#include <kundo2command.h>

class KoSvgTextShape;

class SvgInlineSizeChangeCommand : public KUndo2Command
{
public:
    SvgInlineSizeChangeCommand(KoSvgTextShape *shape, double inlineSize, KUndo2Command *parent = nullptr);
    SvgInlineSizeChangeCommand(KoSvgTextShape *shape,
                               double inlineSize,
                               double oldInlineSize,
                               int anchor,
                               int oldAnchor,
                               QPointF newPos,
                               QPointF oldPos,
                               KUndo2Command *parent = nullptr);
    ~SvgInlineSizeChangeCommand() override = default;

    void redo() override;
    void undo() override;

    int id() const override;
    bool mergeWith(const KUndo2Command *other) override;

private:
    void applyInlineSize(double inlineSize, int anchor, QPointF pos, bool undo = false);

private:
    KoSvgTextShape *m_shape;
    double m_inlineSize;
    double m_oldInlineSize;
    int m_anchor;
    int m_oldAnchor;
    QPointF m_originalPos;
    QPointF m_movePos;
};

#endif /* SVG_INLINE_SIZE_CHANGE_COMMAND_H */