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

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 KOPATHPOINTINSERTCOMMAND_H
0009 #define KOPATHPOINTINSERTCOMMAND_H
0010 
0011 #include <kundo2command.h>
0012 #include <QList>
0013 #include "KoPathPointData.h"
0014 #include "kritaflake_export.h"
0015 
0016 class KoPathPointInsertCommandPrivate;
0017 class KoPathPoint;
0018 
0019 /// The undo / redo command for inserting path points
0020 class KRITAFLAKE_EXPORT KoPathPointInsertCommand : public KUndo2Command
0021 {
0022 public:
0023     /**
0024      * Command to insert path points.
0025      *
0026      * This splits the segments at the given position by inserting new points.
0027      * The De Casteljau algorithm is used for calculating the position of the new
0028      * points.
0029      *
0030      * @param pointDataList describing the segments to split
0031      * @param insertPosition the position to insert at [0..1]
0032      * @param parent the parent command used for macro commands
0033      */
0034     KoPathPointInsertCommand(const QList<KoPathPointData> &pointDataList, qreal insertPosition, KUndo2Command *parent = 0);
0035     ~KoPathPointInsertCommand() override;
0036 
0037     /// redo the command
0038     void redo() override;
0039     /// revert the actions done in redo
0040     void undo() override;
0041 
0042     /// Returns list of inserted points
0043     QList<KoPathPoint*> insertedPoints() const;
0044 
0045 private:
0046     KoPathPointInsertCommandPrivate * const d;
0047 };
0048 
0049 #endif // KOPATHPOINTINSERTCOMMAND_H