File indexing completed on 2025-02-02 04:14:51
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 KOSUBPATHJOINCOMMAND_H 0009 #define KOSUBPATHJOINCOMMAND_H 0010 0011 #include <kundo2command.h> 0012 #include <QPointF> 0013 #include "KoPathPoint.h" 0014 #include "KoPathPointData.h" 0015 #include <boost/optional.hpp> 0016 0017 /// The undo / redo command for joining two subpath end points 0018 class KoSubpathJoinCommand : public KUndo2Command 0019 { 0020 public: 0021 /** 0022 * Command to join two subpath end points. 0023 * 0024 * The points have to be from the same path shape. 0025 * 0026 * @param pointData1 the data of the first point to join 0027 * @param pointData2 the data of the second point to join 0028 * @param parent the parent command used for macro commands 0029 */ 0030 KoSubpathJoinCommand(const KoPathPointData &pointData1, const KoPathPointData &pointData2, KUndo2Command *parent = 0); 0031 ~KoSubpathJoinCommand() override; 0032 0033 /// redo the command 0034 void redo() override; 0035 /// revert the actions done in redo 0036 void undo() override; 0037 0038 private: 0039 bool closeSubpathMode() const; 0040 0041 private: 0042 KoPathPointData m_pointData1; 0043 KoPathPointData m_pointData2; 0044 KoPathPointIndex m_splitIndex; 0045 0046 // the control points have to be stored in shape coordinates 0047 boost::optional<QPointF> m_savedControlPoint1; 0048 boost::optional<QPointF> m_savedControlPoint2; 0049 0050 KoPathPoint::PointProperties m_oldProperties1; 0051 KoPathPoint::PointProperties m_oldProperties2; 0052 enum Reverse { 0053 ReverseFirst = 1, 0054 ReverseSecond = 2 0055 }; 0056 int m_reverse; 0057 }; 0058 0059 #endif // KOSUBPATHJOINCOMMAND_H