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) 2001-2003 RibbonSoft. All rights reserved. 7 ** 8 ** 9 ** This file may be distributed and/or modified under the terms of the 10 ** GNU General Public License version 2 as published by the Free Software 11 ** Foundation and appearing in the file gpl-2.0.txt included in the 12 ** packaging of this file. 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 ** This copyright notice MUST APPEAR in all copies of the script! 24 ** 25 **********************************************************************/ 26 27 #ifndef RS_ACTIONLIBRARYINSERT_H 28 #define RS_ACTIONLIBRARYINSERT_H 29 30 #include "rs_previewactioninterface.h" 31 32 #include "rs_graphic.h" 33 #include "rs_creation.h" 34 35 /** 36 * This action class can handle user events for inserting library items 37 * (or any other DXF files) into the current drawing (as block/insert). 38 * 39 * @author Andrew Mustun 40 */ 41 class RS_ActionLibraryInsert : public RS_PreviewActionInterface { 42 Q_OBJECT 43 /** 44 * Action States. 45 */ 46 enum Status { 47 SetTargetPoint, /**< Setting the reference point. */ 48 SetAngle, /**< Setting angle in the command line. */ 49 SetFactor /**< Setting factor in the command line. */ 50 //SetColumns, /**< Setting columns in the command line. */ 51 //SetRows, /**< Setting rows in the command line. */ 52 //SetColumnSpacing, /**< Setting column spacing in the command line. */ 53 //SetRowSpacing /**< Setting row spacing in the command line. */ 54 }; 55 56 public: 57 RS_ActionLibraryInsert(RS_EntityContainer& container, 58 RS_GraphicView& graphicView); 59 ~RS_ActionLibraryInsert() override; 60 61 static QAction* createGUIAction(RS2::ActionType /*type*/, QObject* /*parent*/); 62 63 void init(int status=0) override; 64 65 void reset(); 66 67 void trigger() override; 68 69 void mouseMoveEvent(QMouseEvent* e) override; 70 void mouseReleaseEvent(QMouseEvent* e) override; 71 72 void coordinateEvent(RS_CoordinateEvent* e) override; 73 void commandEvent(RS_CommandEvent* e) override; 74 QStringList getAvailableCommands() override; 75 76 void showOptions() override; 77 void hideOptions() override; 78 79 void updateMouseButtonHints() override; 80 void updateMouseCursor() override; 81 82 void setFile(const QString& file); 83 84 double getAngle() const; 85 86 void setAngle(double a); 87 88 double getFactor() const; 89 90 void setFactor(double f); 91 92 /*int getColumns() { 93 return data.cols; 94 } 95 96 void setColumns(int c) { 97 data.cols = c; 98 } 99 100 int getRows() { 101 return data.rows; 102 } 103 104 void setRows(int r) { 105 data.rows = r; 106 } 107 108 double getColumnSpacing() { 109 return data.spacing.x; 110 } 111 112 void setColumnSpacing(double cs) { 113 data.spacing.x = cs; 114 } 115 116 double getRowSpacing() { 117 return data.spacing.y; 118 } 119 120 void setRowSpacing(double rs) { 121 data.spacing.y = rs; 122 }*/ 123 124 protected: 125 //RS_Block* block; 126 //RS_InsertData data; 127 struct Points; 128 std::unique_ptr<Points> pPoints; 129 130 /** Last status before entering option. */ 131 Status lastStatus; 132 }; 133 134 #endif 135