1 /****************************************************************************
2 **
3 ** This file is part of the LibreCAD project, a 2D CAD program
4 **
5 ** Copyright (C) 2017 A. Stebich (librecad@mail.lordofbikes.de)
6 ** Copyright (C) 2017 taoxumuye (tfy.hi@163.com)
7 ** Copyright (C) 2010 R. van Twisk (librecad@rvt.dds.nl)
8 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
9 **
10 **
11 ** This file may be distributed and/or modified under the terms of the
12 ** GNU General Public License version 2 as published by the Free Software
13 ** Foundation and appearing in the file gpl-2.0.txt included in the
14 ** packaging of this file.
15 **
16 ** This program is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 ** GNU General Public License for more details.
20 **
21 ** You should have received a copy of the GNU General Public License
22 ** along with this program; if not, write to the Free Software
23 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
24 **
25 ** This copyright notice MUST APPEAR in all copies of the script!
26 **
27 **********************************************************************/
28 
29 #ifndef LC_ACTIONDRAWLINEPOLYGON3_H
30 #define LC_ACTIONDRAWLINEPOLYGON3_H
31 
32 
33 #include "rs_previewactioninterface.h"
34 
35 
36 /**
37  * This action class can handle user events to draw polygons.
38  *
39  */
40 class LC_ActionDrawLinePolygonCenTan : public RS_PreviewActionInterface {
41     Q_OBJECT
42     enum Status {
43         SetCenter,    /**< Setting center. */
44         SetTangent,    /**< Setting tangent. */
45         SetNumber     /**< Setting number in the command line. */
46     };
47 
48 public:
49     LC_ActionDrawLinePolygonCenTan(RS_EntityContainer& container,
50                               RS_GraphicView& graphicView);
51     ~LC_ActionDrawLinePolygonCenTan() override;
52 
53     void trigger() override;
54 
55     void mouseMoveEvent(QMouseEvent* e) override;
56     void mouseReleaseEvent(QMouseEvent* e) override;
57     void updateMouseButtonHints() override;
58 
59     void coordinateEvent(RS_CoordinateEvent* e) override;
60     void commandEvent(RS_CommandEvent* e) override;
61         QStringList getAvailableCommands() override;
62 
63     void hideOptions() override;
64     void showOptions() override;
65 
66     void updateMouseCursor() override;
67 
getNumber()68     int getNumber() const{
69         return number;
70     }
71 
setNumber(int n)72     void setNumber(int n) {
73         number = n;
74     }
75 
76 private:
77     struct Points;
78     std::unique_ptr<Points> pPoints;
79     /** Number of edges. */
80     int number;
81     /** Last status before entering text. */
82     Status lastStatus;
83 };
84 
85 #endif // LC_ACTIONDRAWLINEPOLYGON3_H
86