1 /**************************************************************************** 2 ** 3 ** This file is part of the LibreCAD project, a 2D CAD program 4 ** 5 ** Copyright (C) 2015 A. Stebich (librecad@mail.lordofbikes.de) 6 ** Copyright (C) 2010 R. van Twisk (librecad@rvt.dds.nl) 7 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. 8 ** 9 ** 10 ** This file may be distributed and/or modified under the terms of the 11 ** GNU General Public License version 2 as published by the Free Software 12 ** Foundation and appearing in the file gpl-2.0.txt included in the 13 ** packaging of this file. 14 ** 15 ** This program is distributed in the hope that it will be useful, 16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 ** GNU General Public License for more details. 19 ** 20 ** You should have received a copy of the GNU General Public License 21 ** along with this program; if not, write to the Free Software 22 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 23 ** 24 ** This copyright notice MUST APPEAR in all copies of the script! 25 ** 26 **********************************************************************/ 27 28 #ifndef QG_ACTIONHANDLER_H 29 #define QG_ACTIONHANDLER_H 30 31 #include "rs_actioninterface.h" 32 33 class QG_SnapToolBar; 34 class RS_Layer; 35 36 /** 37 * This class can trigger actions (from menus, buttons, ...). 38 */ 39 class QG_ActionHandler : public QObject { 40 Q_OBJECT 41 42 public: 43 QG_ActionHandler(QObject* parent); 44 virtual ~QG_ActionHandler() = default; 45 46 RS_ActionInterface* getCurrentAction(); 47 RS_ActionInterface* setCurrentAction(RS2::ActionType id); 48 49 /** 50 * Kills all running selection actions. Called when a selection action 51 * is launched to reduce confusion. 52 */ 53 void killSelectActions(); 54 /** 55 * @brief killAllActions kill all actions 56 */ 57 void killAllActions(); 58 59 bool keycode(const QString& code); 60 //special handling of actions issued from command line, currently used for snap actions 61 //return true if handled 62 bool commandLineActions(RS2::ActionType id); 63 bool command(const QString& cmd); 64 QStringList getAvailableCommands(); 65 RS_SnapMode getSnaps(); 66 RS2::SnapRestriction getSnapRestriction(); 67 void set_view(RS_GraphicView* graphic_view); 68 void set_document(RS_Document* document); 69 void set_snap_toolbar(QG_SnapToolBar* snap_toolbar); 70 71 public slots: 72 /*void slotFileNew();*/ 73 void slotFileNewTemplate(); 74 void slotFileOpen(); 75 /* 76 void slotFileOpen(const QString& fileName); 77 void slotFileSave(); 78 */ 79 void slotFileSaveAs(); 80 void slotFileExportMakerCam(); 81 /* 82 void slotFileClose(); 83 void slotFilePrint(); 84 */ 85 86 void slotZoomIn(); 87 void slotZoomOut(); 88 void slotZoomAuto(); 89 void slotZoomWindow(); 90 void slotZoomPan(); 91 void slotZoomPrevious(); 92 void slotZoomRedraw(); 93 94 void slotToolRegenerateDimensions(); 95 96 void slotEditKillAllActions(); 97 void slotEditUndo(); 98 void slotEditRedo(); 99 void slotEditCut(); 100 void slotEditCopy(); 101 void slotEditPaste(); 102 void slotOrderBottom(); 103 void slotOrderLower(); 104 void slotOrderRaise(); 105 void slotOrderTop(); 106 107 void slotSelectSingle(); 108 void slotSelectContour(); 109 void slotSelectWindow(); 110 void slotDeselectWindow(); 111 void slotSelectAll(); 112 void slotDeselectAll(); 113 void slotSelectInvert(); 114 void slotSelectIntersected(); 115 void slotDeselectIntersected(); 116 void slotSelectLayer(); 117 118 void slotDrawPoint(); 119 void slotDrawLine(); 120 void slotDrawLineAngle(); 121 void slotDrawLineHorizontal(); 122 void slotDrawLineVertical(); 123 void slotDrawLineFree(); 124 void slotDrawLineHorVert(); 125 void slotDrawLineParallel(); 126 void slotDrawLineParallelThrough(); 127 void slotDrawLineRectangle(); 128 void slotDrawLineBisector(); 129 void slotDrawLineTangent1(); 130 void slotDrawLineTangent2(); 131 void slotDrawLineOrthogonal(); 132 void slotDrawLineOrthTan(); 133 void slotDrawLineRelAngle(); 134 void slotDrawLinePolygon(); 135 void slotDrawLinePolygon2(); 136 void slotDrawLinePolygon3();//added by txmy 137 void slotDrawCircle(); 138 void slotDrawCircleCR(); 139 void slotDrawCircle2P(); 140 void slotDrawCircle2PR(); 141 void slotDrawCircle3P(); 142 void slotDrawCircleParallel(); 143 void slotDrawCircleInscribe(); 144 void slotDrawCircleTan2(); 145 void slotDrawCircleTan3(); 146 void slotDrawCircleTan1_2P(); 147 void slotDrawCircleTan2_1P(); 148 void slotDrawArc(); 149 void slotDrawArc3P(); 150 void slotDrawArcParallel(); 151 void slotDrawArcTangential(); 152 void slotDrawEllipseAxis(); 153 void slotDrawEllipseArcAxis(); 154 void slotDrawEllipseFociPoint(); 155 void slotDrawEllipse4Points(); 156 void slotDrawEllipseCenter3Points(); 157 void slotDrawEllipseInscribe(); 158 void slotDrawSpline(); 159 void slotDrawSplinePoints(); 160 void slotDrawMText(); 161 void slotDrawText(); 162 void slotDrawHatch(); 163 void slotDrawImage(); 164 void slotDrawPolyline(); 165 void slotPolylineAdd(); 166 void slotPolylineAppend(); 167 void slotPolylineDel(); 168 void slotPolylineDelBetween(); 169 void slotPolylineTrim(); 170 void slotPolylineEquidistant(); 171 void slotPolylineSegment(); 172 173 void slotDimAligned(); 174 void slotDimLinear(); 175 void slotDimLinearHor(); 176 void slotDimLinearVer(); 177 void slotDimRadial(); 178 void slotDimDiametric(); 179 void slotDimAngular(); 180 void slotDimLeader(); 181 182 void slotModifyAttributes(); 183 void slotModifyDelete(); 184 void slotModifyDeleteQuick(); 185 void slotModifyDeleteFree(); 186 void slotModifyMove(); 187 void slotModifyScale(); 188 void slotModifyRevertDirection(); 189 void slotModifyRotate(); 190 void slotModifyMirror(); 191 void slotModifyMoveRotate(); 192 void slotModifyRotate2(); 193 void slotModifyEntity(); 194 void slotModifyTrim(); 195 void slotModifyTrim2(); 196 void slotModifyTrimAmount(); 197 void slotModifyCut(); 198 void slotModifyStretch(); 199 void slotModifyBevel(); 200 void slotModifyRound(); 201 void slotModifyOffset(); 202 void slotModifyExplodeText(); 203 204 void slotSetSnaps(RS_SnapMode const& s); 205 void slotSnapFree(); 206 void slotSnapGrid(); 207 void slotSnapEndpoint(); 208 void slotSnapOnEntity(); 209 void slotSnapCenter(); 210 void slotSnapMiddle(); 211 void slotSnapDist(); 212 void slotSnapIntersection(); 213 void slotSnapIntersectionManual(); 214 215 void slotRestrictNothing(); 216 void slotRestrictOrthogonal(); 217 void slotRestrictHorizontal(); 218 void slotRestrictVertical(); 219 220 void disableSnaps(); 221 void disableRestrictions(); 222 223 void slotSetRelativeZero(); 224 void slotLockRelativeZero(bool on); 225 226 void slotInfoInside(); 227 void slotInfoDist(); 228 void slotInfoDist2(); 229 void slotInfoAngle(); 230 void slotInfoTotalLength(); 231 void slotInfoArea(); 232 233 void slotLayersDefreezeAll(); 234 void slotLayersFreezeAll(); 235 void slotLayersUnlockAll(); 236 void slotLayersLockAll(); 237 void slotLayersAdd(); 238 void slotLayersRemove(); 239 void slotLayersEdit(); 240 void slotLayersToggleView(); 241 void slotLayersToggleLock(); 242 void slotLayersTogglePrint(); 243 void slotLayersToggleConstruction(); 244 245 void slotBlocksDefreezeAll(); 246 void slotBlocksFreezeAll(); 247 void slotBlocksAdd(); 248 void slotBlocksRemove(); 249 void slotBlocksAttributes(); 250 void slotBlocksEdit(); 251 void slotBlocksSave(); 252 void slotBlocksInsert(); 253 void slotBlocksToggleView(); 254 void slotBlocksCreate(); 255 void slotBlocksExplode(); 256 void slotOptionsDrawing(); 257 258 void toggleVisibility(RS_Layer* layer); 259 void toggleLock(RS_Layer* layer); 260 void togglePrint(RS_Layer* layer); 261 void toggleConstruction(RS_Layer* layer); 262 private: 263 264 // Type of draw order selected command 265 RS2::ActionType orderType{RS2::ActionOrderTop}; 266 QG_SnapToolBar* snap_toolbar{nullptr}; 267 RS_GraphicView* view{nullptr}; 268 RS_Document* document{nullptr}; 269 }; 270 271 #endif 272 // EOF 273