libs/flake
KoPathPointTypeCommand.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 * Copyright (C) 2006,2008 Jan Hambrecht <jaham@gmx.net> 00003 * Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KOPATHPOINTTYPECOMMAND_H 00022 #define KOPATHPOINTTYPECOMMAND_H 00023 00024 #include <QUndoCommand> 00025 #include <QList> 00026 #include "KoPathBaseCommand.h" 00027 //#include "KoPathShape.h" 00028 #include "KoPathPoint.h" 00029 #include "KoPathPointData.h" 00030 #include "flake_export.h" 00031 00033 class FLAKE_TEST_EXPORT KoPathPointTypeCommand : public KoPathBaseCommand 00034 { 00035 public: 00037 enum PointType { 00038 Corner, 00039 Smooth, 00040 Symmetric, 00041 Line, 00042 Curve 00043 }; 00050 KoPathPointTypeCommand(const QList<KoPathPointData> & pointDataList, PointType pointType, QUndoCommand *parent = 0); 00051 ~KoPathPointTypeCommand(); 00052 00054 void redo(); 00056 void undo(); 00057 00058 private: 00059 // used for storing the data for undo 00060 struct PointData { 00061 PointData(const KoPathPointData pointData) 00062 : m_pointData(pointData) {} 00063 KoPathPointData m_pointData; 00064 // old control points in document coordinates 00065 QPointF m_oldControlPoint1; 00066 QPointF m_oldControlPoint2; 00067 KoPathPoint::KoPointProperties m_oldProperties; 00068 bool m_hadControlPoint1; 00069 bool m_hadControlPoint2; 00070 }; 00071 00072 bool appendPointData(KoPathPointData data); 00073 void undoChanges(const QList<PointData> &data); 00074 00075 PointType m_pointType; 00076 QList<PointData> m_oldPointData; 00077 QList<PointData> m_additionalPointData; 00078 }; 00079 00080 #endif // KOPATHPOINTTYPECOMMAND_H
