1 /**************************************************************************** 2 ** 3 ** This file is part of the LibreCAD project, a 2D CAD program 4 ** 5 ** Copyright (C) 2010 R. van Twisk (librecad@rvt.dds.nl) 6 ** Copyright (C) 2014 Dongxu Li (dongxuli2011@gmail.com) 7 ** Copyright (C) 2014 Pavel Krejcir (pavel@pamsoft.cz) 8 9 This program is free software; you can redistribute it and/or 10 modify it under the terms of the GNU General Public License 11 as published by the Free Software Foundation; either version 2 12 of the License, or (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, write to the Free Software 21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 22 **********************************************************************/ 23 24 #ifndef LC_ACTIONDRAWSPLINEPOINTS_H 25 #define LC_ACTIONDRAWSPLINEPOINTS_H 26 27 #include "rs_previewactioninterface.h" 28 #include "rs_actiondrawspline.h" 29 30 /** 31 * This action class can handle user events to draw splines through points. 32 * 33 * @author Pavel Krejcir 34 */ 35 class LC_ActionDrawSplinePoints : public RS_ActionDrawSpline 36 { 37 Q_OBJECT 38 public: 39 /** 40 * Action States. 41 */ 42 enum Status 43 { 44 SetStartPoint, /**< Setting the startpoint. */ 45 SetNextPoint /**< Setting the next point. */ 46 }; 47 48 LC_ActionDrawSplinePoints(RS_EntityContainer& container, 49 RS_GraphicView& graphicView); 50 ~LC_ActionDrawSplinePoints() override; 51 52 void reset(); 53 54 void init(int status = 0) override; 55 void trigger() override; 56 57 void mouseMoveEvent(QMouseEvent* e) override; 58 void mouseReleaseEvent(QMouseEvent* e) override; 59 60 void coordinateEvent(RS_CoordinateEvent* e) override; 61 void commandEvent(RS_CommandEvent* e) override; 62 QStringList getAvailableCommands() override; 63 64 void showOptions() override; 65 void hideOptions() override; 66 67 void updateMouseButtonHints() override; 68 void updateMouseCursor() override; 69 70 void setClosed(bool c) override; 71 bool isClosed() override; 72 void undo() override; 73 //using degree=2 only setDegree(int)74 void setDegree(int /*deg*/) override{} 75 76 private: 77 void redo(); 78 79 struct Points; 80 std::unique_ptr<Points> pPoints; 81 82 }; 83 84 #endif 85 86