File indexing completed on 2024-06-09 04:20:43

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2006 Jan Hambrecht <jaham@gmx.net>
0003  * SPDX-FileCopyrightText: 2006, 2007 Thorsten Zachmann <zachmann@kde.org>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 #ifndef KOPATHCONTROLPOINTMOVECOMMAND_H
0009 #define KOPATHCONTROLPOINTMOVECOMMAND_H
0010 
0011 #include <kundo2command.h>
0012 #include <QPointF>
0013 #include "KoPathPointData.h"
0014 #include "KoPathPoint.h"
0015 #include "kritaflake_export.h"
0016 
0017 
0018 /// The undo / redo command for path point moving.
0019 class KRITAFLAKE_EXPORT KoPathControlPointMoveCommand : public KUndo2Command
0020 {
0021 public:
0022     /**
0023      * Command to move one control path point.
0024      * @param pointData the data of the point to move
0025      * @param offset the offset by which the point is moved in shape coordinates
0026      * @param pointType the type of the point to move
0027      * @param parent the parent command used for macro commands
0028      */
0029     KoPathControlPointMoveCommand(const KoPathPointData &pointData, const QPointF &offset,
0030             KoPathPoint::PointType pointType, KUndo2Command *parent = 0);
0031     /// redo the command
0032     void redo() override;
0033     /// revert the actions done in redo
0034     void undo() override;
0035 
0036     int id() const override;
0037     bool mergeWith(const KUndo2Command *command) override;
0038 
0039 private:
0040     KoPathPointData m_pointData;
0041     // the offset in shape coordinates
0042     QPointF m_offset;
0043     KoPathPoint::PointType m_pointType;
0044 };
0045 
0046 #endif // KOPATHCONTROLPOINTMOVECOMMAND_H