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 #include<cmath>
29 #include "qg_actionhandler.h"
30 
31 #include "rs_dialogfactory.h"
32 #include "rs_commandevent.h"
33 #include "rs_commands.h"
34 
35 #include "rs_actionblocksadd.h"
36 #include "rs_actionblocksattributes.h"
37 #include "rs_actionblockscreate.h"
38 #include "rs_actionblocksedit.h"
39 #include "rs_actionblockssave.h"
40 #include "rs_actionblocksexplode.h"
41 #include "rs_actionblocksfreezeall.h"
42 #include "rs_actionblocksinsert.h"
43 #include "rs_actionblocksremove.h"
44 #include "rs_actionblockstoggleview.h"
45 #include "rs_actiondimaligned.h"
46 #include "rs_actiondimangular.h"
47 #include "rs_actiondimdiametric.h"
48 #include "rs_actiondimleader.h"
49 #include "rs_actiondimlinear.h"
50 #include "rs_actiondimradial.h"
51 #include "rs_actiondrawarc.h"
52 #include "rs_actiondrawarc3p.h"
53 #include "rs_actiondrawarctangential.h"
54 #include "rs_actiondrawcircle.h"
55 #include "rs_actiondrawcircle2p.h"
56 #include "lc_actiondrawcircle2pr.h"
57 #include "rs_actiondrawcircle3p.h"
58 #include "rs_actiondrawcircletan1_2p.h"
59 #include "rs_actiondrawcircletan2_1p.h"
60 #include "rs_actiondrawcirclecr.h"
61 #include "rs_actiondrawcircleinscribe.h"
62 #include "rs_actiondrawcircletan2.h"
63 #include "rs_actiondrawcircletan3.h"
64 #include "rs_actiondrawellipseaxis.h"
65 #include "rs_actiondrawellipsefocipoint.h"
66 #include "rs_actiondrawellipse4points.h"
67 #include "rs_actiondrawellipsecenter3points.h"
68 #include "rs_actiondrawellipseinscribe.h"
69 #include "rs_actiondrawhatch.h"
70 #include "rs_actiondrawimage.h"
71 #include "rs_actiondrawline.h"
72 #include "rs_actiondrawlineangle.h"
73 #include "rs_actiondrawlinebisector.h"
74 #include "rs_actiondrawlinefree.h"
75 #include "rs_actiondrawlinehorvert.h"
76 #include "rs_actiondrawlineparallel.h"
77 #include "rs_actiondrawlineparallelthrough.h"
78 #include "rs_actiondrawlinepolygon.h"
79 #include "rs_actiondrawlinepolygon2.h"
80 #include "lc_actiondrawlinepolygon3.h"
81 #include "rs_actiondrawlinerectangle.h"
82 #include "rs_actiondrawlinerelangle.h"
83 #include "rs_actiondrawlineorthtan.h"
84 #include "rs_actiondrawlinetangent1.h"
85 #include "rs_actiondrawlinetangent2.h"
86 #include "rs_actiondrawmtext.h"
87 #include "rs_actiondrawpoint.h"
88 #include "rs_actiondrawspline.h"
89 #include "lc_actiondrawsplinepoints.h"
90 #include "rs_actiondrawtext.h"
91 #include "rs_actioneditcopy.h"
92 #include "rs_actioneditpaste.h"
93 #include "rs_actioneditundo.h"
94 #include "lc_actionfileexportmakercam.h"
95 #include "rs_actionfilenewtemplate.h"
96 #include "rs_actionfileopen.h"
97 #include "rs_actionfilesaveas.h"
98 #include "rs_actioninfoangle.h"
99 #include "rs_actioninfoarea.h"
100 #include "rs_actioninfodist.h"
101 #include "rs_actioninfodist2.h"
102 #include "rs_actioninfoinside.h"
103 #include "rs_actioninfototallength.h"
104 #include "rs_actionlayersadd.h"
105 #include "rs_actionlayersedit.h"
106 #include "rs_actionlayersfreezeall.h"
107 #include "rs_actionlayerslockall.h"
108 #include "rs_actionlayersremove.h"
109 #include "rs_actionlayerstogglelock.h"
110 #include "rs_actionlayerstoggleview.h"
111 #include "rs_actionlayerstoggleprint.h"
112 #include "lc_actionlayerstoggleconstruction.h"
113 #include "rs_actionlibraryinsert.h"
114 #include "rs_actionlockrelativezero.h"
115 #include "rs_actionmodifyattributes.h"
116 #include "rs_actionmodifybevel.h"
117 #include "rs_actionmodifycut.h"
118 #include "rs_actionmodifydelete.h"
119 #include "rs_actionmodifydeletefree.h"
120 #include "rs_actionmodifydeletequick.h"
121 #include "rs_actionmodifyentity.h"
122 #include "rs_actionmodifyexplodetext.h"
123 #include "rs_actionmodifymirror.h"
124 #include "rs_actionmodifymove.h"
125 #include "rs_actionmodifymoverotate.h"
126 #include "rs_actionmodifyrevertdirection.h"
127 #include "rs_actionmodifyrotate.h"
128 #include "rs_actionmodifyrotate2.h"
129 #include "rs_actionmodifyround.h"
130 #include "rs_actionmodifyoffset.h"
131 #include "rs_actionmodifyscale.h"
132 #include "rs_actionmodifystretch.h"
133 #include "rs_actionmodifytrim.h"
134 #include "rs_actionmodifytrimamount.h"
135 #include "rs_actionoptionsdrawing.h"
136 #include "rs_actionselect.h"
137 #include "rs_actionselectall.h"
138 #include "rs_actionselectcontour.h"
139 #include "rs_actionselectintersected.h"
140 #include "rs_actionselectinvert.h"
141 #include "rs_actionselectlayer.h"
142 #include "rs_actionselectsingle.h"
143 #include "rs_actionselectwindow.h"
144 #include "rs_actionsetrelativezero.h"
145 #include "rs_actionsetsnapmode.h"
146 #include "rs_actionsetsnaprestriction.h"
147 #include "rs_actionsnapintersectionmanual.h"
148 #include "rs_actiontoolregeneratedimensions.h"
149 #include "rs_actionzoomauto.h"
150 #include "rs_actionzoomin.h"
151 #include "rs_actionzoompan.h"
152 #include "rs_actionzoomprevious.h"
153 #include "rs_actionzoomredraw.h"
154 #include "rs_actionzoomwindow.h"
155 
156 #include "rs_actiondrawpolyline.h"
157 #include "rs_actionpolylineadd.h"
158 #include "rs_actionpolylineappend.h"
159 #include "rs_actionpolylinedel.h"
160 #include "rs_actionpolylinedelbetween.h"
161 #include "rs_actionpolylinetrim.h"
162 #include "rs_actionpolylineequidistant.h"
163 #include "rs_actionpolylinesegment.h"
164 #include "rs_selection.h"
165 #include "rs_actionorder.h"
166 
167 #include "qg_snaptoolbar.h"
168 #include "rs_debug.h"
169 #include "rs_layer.h"
170 #include "rs_settings.h"
171 
172 /**
173  * Constructor
174  */
QG_ActionHandler(QObject * parent)175 QG_ActionHandler::QG_ActionHandler(QObject* parent)
176     :QObject(parent)
177 {
178 	RS_DEBUG->print("QG_ActionHandler::QG_ActionHandler");
179     RS_DEBUG->print("QG_ActionHandler::QG_ActionHandler: OK");
180 }
181 
182 /**
183  * Kills all running selection actions. Called when a selection action
184   * is launched to reduce confusion.
185    */
killSelectActions()186 void QG_ActionHandler::killSelectActions() {
187 
188 	if (view) {
189         view->killSelectActions();
190     }
191 }
192 
killAllActions()193 void QG_ActionHandler::killAllActions() {
194 
195 	if (view) {
196 		view->killAllActions();
197 	}
198 }
199 
200 /**
201  * @return Current action or NULL.
202  */
getCurrentAction()203 RS_ActionInterface* QG_ActionHandler::getCurrentAction() {
204 
205 	if (view) {
206         return view->getCurrentAction();
207     } else {
208         return NULL;
209     }
210 }
211 
212 /**
213  * Sets current action.
214  *
215  * @return Pointer to the created action or NULL.
216  */
setCurrentAction(RS2::ActionType id)217 RS_ActionInterface* QG_ActionHandler::setCurrentAction(RS2::ActionType id) {
218     RS_DEBUG->print("QG_ActionHandler::setCurrentAction()");
219     RS_ActionInterface* a = NULL;
220 //    view->killAllActions();
221 
222     RS_DEBUG->print("QC_ActionHandler::setCurrentAction: "
223             "view = %p, document = %p", view, document);
224 
225     // only global options are allowed without a document:
226     if (view==NULL || document==NULL) {
227         RS_DEBUG->print(RS_Debug::D_WARNING,
228                 "QG_ActionHandler::setCurrentAction: graphic view or "
229                 "document is NULL");
230         return NULL;
231     }
232 
233     auto a_layer = document->getLayerList()->getActive();
234 
235     switch (id) {
236         //case RS2::ActionFileNew:
237         //    a = new RS_ActionFileNew(*document, *view);
238         //	break;
239     case RS2::ActionFileNewTemplate:
240         a = new RS_ActionFileNewTemplate(*document, *view);
241         break;
242         //case RS2::ActionFileSave:
243         //    a = new RS_ActionFileSave(*document, *view);
244         //	break;
245         //case RS2::ActionFileClose:
246         //    //a = new RS_ActionFileClose(*document, *view);
247         //	break;
248         //case RS2::ActionFileQuit:
249         //    //a = new RS_ActionFileQuit(*document, *view);
250         //	break;
251     case RS2::ActionFileOpen:
252         a = new RS_ActionFileOpen(*document, *view);
253         break;
254     case RS2::ActionFileSaveAs:
255         a = new RS_ActionFileSaveAs(*document, *view);
256         break;
257     case RS2::ActionFileExportMakerCam:
258 		a = new LC_ActionFileExportMakerCam(*document, *view);
259         break;
260 
261         // Editing actions:
262         //
263     case RS2::ActionEditKillAllActions:
264 		if (view) {
265             // DO we need to call some form of a 'clean' function?
266             view->killAllActions();
267 
268             RS_Selection s((RS_EntityContainer&)*document, view);
269             s.selectAll(false);
270             RS_DIALOGFACTORY->updateSelectionWidget(document->countSelected(),document->totalSelectedLength());
271         }
272         break;
273     case RS2::ActionEditUndo:
274         a = new RS_ActionEditUndo(true, *document, *view);
275         break;
276     case RS2::ActionEditRedo:
277         a = new RS_ActionEditUndo(false, *document, *view);
278         break;
279     case RS2::ActionEditCut:
280 		if(!document->countSelected()){
281 			a = new RS_ActionSelect(this, *document, *view, RS2::ActionEditCutNoSelect);
282 			break;
283 		}
284         // fall-through
285     case RS2::ActionEditCutNoSelect:
286         a = new RS_ActionEditCopy(false, *document, *view);
287         break;
288 	case RS2::ActionEditCopy:
289 		if(!document->countSelected()){
290 			a = new RS_ActionSelect(this, *document, *view, RS2::ActionEditCopyNoSelect);
291 			break;
292 		}
293         // fall-through
294     case RS2::ActionEditCopyNoSelect:
295         a = new RS_ActionEditCopy(true, *document, *view);
296         break;
297     case RS2::ActionEditPaste:
298         a = new RS_ActionEditPaste(*document, *view);
299         break;
300     case RS2::ActionOrderBottom:
301         orderType = RS2::ActionOrderBottom;
302         if(!document->countSelected()){
303             a = new RS_ActionSelect(this, *document, *view, RS2::ActionOrderNoSelect);
304         }
305         else {
306             a = new RS_ActionOrder(*document, *view, orderType);
307         }
308         break;
309     case RS2::ActionOrderLower:
310         orderType = RS2::ActionOrderLower;
311         a = new RS_ActionSelect(this, *document, *view, RS2::ActionOrderNoSelect);
312         break;
313     case RS2::ActionOrderRaise:
314         orderType = RS2::ActionOrderRaise;
315         a = new RS_ActionSelect(this, *document, *view, RS2::ActionOrderNoSelect);
316         break;
317     case RS2::ActionOrderTop:
318         orderType = RS2::ActionOrderTop;
319         if(!document->countSelected()){
320             a = new RS_ActionSelect(this, *document, *view, RS2::ActionOrderNoSelect);
321         }
322         else {
323             a = new RS_ActionOrder(*document, *view, orderType);
324         }
325         break;
326     case RS2::ActionOrderNoSelect:
327         a = new RS_ActionOrder(*document, *view, orderType);
328         break;
329 
330         // Selecting actions:
331         //
332     case RS2::ActionSelectSingle:
333 //        view->killSelectActions();
334         if(getCurrentAction()->rtti() != RS2::ActionSelectSingle) {
335             a = new RS_ActionSelectSingle(*document, *view,getCurrentAction());
336         }else{
337             a=NULL;
338         }
339         break;
340     case RS2::ActionSelectContour:
341         view->killSelectActions();
342         a = new RS_ActionSelectContour(*document, *view);
343         break;
344     case RS2::ActionSelectAll:
345         a = new RS_ActionSelectAll(*document, *view, true);
346         break;
347     case RS2::ActionDeselectAll:
348         a = new RS_ActionSelectAll(*document, *view, false);
349         break;
350     case RS2::ActionSelectWindow:
351         view->killSelectActions();
352         a = new RS_ActionSelectWindow(*document, *view, true);
353         break;
354     case RS2::ActionDeselectWindow:
355         view->killSelectActions();
356         a = new RS_ActionSelectWindow(*document, *view, false);
357         break;
358     case RS2::ActionSelectInvert:
359         a = new RS_ActionSelectInvert(*document, *view);
360         break;
361     case RS2::ActionSelectIntersected:
362         view->killSelectActions();
363         a = new RS_ActionSelectIntersected(*document, *view, true);
364         break;
365     case RS2::ActionDeselectIntersected:
366         view->killSelectActions();
367         a = new RS_ActionSelectIntersected(*document, *view, false);
368         break;
369     case RS2::ActionSelectLayer:
370         view->killSelectActions();
371         a = new RS_ActionSelectLayer(*document, *view);
372         break;
373 
374         // Tool actions:
375         //
376     case RS2::ActionToolRegenerateDimensions:
377         a = new RS_ActionToolRegenerateDimensions(*document, *view);
378         break;
379 
380         // Zooming actions:
381         //
382     case RS2::ActionZoomIn:
383         a = new RS_ActionZoomIn(*document, *view, RS2::In, RS2::Both);
384         break;
385     case RS2::ActionZoomOut:
386         a = new RS_ActionZoomIn(*document, *view, RS2::Out, RS2::Both);
387         break;
388     case RS2::ActionZoomAuto:
389         a = new RS_ActionZoomAuto(*document, *view);
390         break;
391     case RS2::ActionZoomWindow:
392         a = new RS_ActionZoomWindow(*document, *view);
393         break;
394     case RS2::ActionZoomPan:
395         a = new RS_ActionZoomPan(*document, *view);
396         break;
397     case RS2::ActionZoomPrevious:
398         a = new RS_ActionZoomPrevious(*document, *view);
399         break;
400     case RS2::ActionZoomRedraw:
401         a = new RS_ActionZoomRedraw(*document, *view);
402         break;
403 
404         // Drawing actions:
405         //
406     case RS2::ActionDrawPoint:
407         a = new RS_ActionDrawPoint(*document, *view);
408         break;
409     case RS2::ActionDrawLine:
410         a = new RS_ActionDrawLine(*document, *view);
411         break;
412     case RS2::ActionDrawLineAngle:
413         a = new RS_ActionDrawLineAngle(*document, *view, 0.0, false);
414         break;
415     case RS2::ActionDrawLineHorizontal:
416         a = new RS_ActionDrawLineAngle(*document, *view, 0.0, true,
417                                        RS2::ActionDrawLineHorizontal);
418         break;
419     case RS2::ActionDrawLineHorVert:
420         a = new RS_ActionDrawLineHorVert(*document, *view);
421         break;
422     case RS2::ActionDrawLineVertical:
423         a = new RS_ActionDrawLineAngle(*document, *view, M_PI_2, true,
424                                        RS2::ActionDrawLineVertical);
425         break;
426     case RS2::ActionDrawLineFree:
427         a = new RS_ActionDrawLineFree(*document, *view);
428         break;
429     case RS2::ActionDrawLineParallel:
430         a= new RS_ActionDrawLineParallel(*document, *view);
431         a->setActionType(id);
432         break;
433     case RS2::ActionDrawLineParallelThrough:
434         a = new RS_ActionDrawLineParallelThrough(*document, *view);
435         break;
436     case RS2::ActionDrawLineRectangle:
437         a = new RS_ActionDrawLineRectangle(*document, *view);
438         break;
439     case RS2::ActionDrawLineBisector:
440         a = new RS_ActionDrawLineBisector(*document, *view);
441         break;
442     case RS2::ActionDrawLineOrthTan:
443         a = new RS_ActionDrawLineOrthTan(*document, *view);
444         break;
445     case RS2::ActionDrawLineTangent1:
446         a = new RS_ActionDrawLineTangent1(*document, *view);
447         break;
448     case RS2::ActionDrawLineTangent2:
449         a = new RS_ActionDrawLineTangent2(*document, *view);
450         break;
451     case RS2::ActionDrawLineOrthogonal:
452         a = new RS_ActionDrawLineRelAngle(*document, *view, M_PI_2, true);
453         break;
454     case RS2::ActionDrawLineRelAngle:
455         a = new RS_ActionDrawLineRelAngle(*document, *view, M_PI_2, false);
456         break;
457     case RS2::ActionDrawPolyline:
458         a = new RS_ActionDrawPolyline(*document, *view);
459         break;
460     case RS2::ActionPolylineAdd:
461         a = new RS_ActionPolylineAdd(*document, *view);
462         break;
463     case RS2::ActionPolylineAppend:
464         a = new RS_ActionPolylineAppend(*document, *view);
465         break;
466     case RS2::ActionPolylineDel:
467         a = new RS_ActionPolylineDel(*document, *view);
468         break;
469     case RS2::ActionPolylineDelBetween:
470         a = new RS_ActionPolylineDelBetween(*document, *view);
471         break;
472     case RS2::ActionPolylineTrim:
473         a = new RS_ActionPolylineTrim(*document, *view);
474         break;
475     case RS2::ActionPolylineEquidistant:
476         a = new RS_ActionPolylineEquidistant(*document, *view);
477         break;
478     case RS2::ActionPolylineSegment:
479         a = new RS_ActionPolylineSegment(*document, *view);
480         break;
481     case RS2::ActionDrawLinePolygonCenCor:
482         a = new RS_ActionDrawLinePolygonCenCor(*document, *view);
483         break;
484     case RS2::ActionDrawLinePolygonCenTan:                      //20161223 added by txmy
485         a = new LC_ActionDrawLinePolygonCenTan(*document, *view);
486         break;
487     case RS2::ActionDrawLinePolygonCorCor:
488         a = new RS_ActionDrawLinePolygonCorCor(*document, *view);
489         break;
490     case RS2::ActionDrawCircle:
491         a = new RS_ActionDrawCircle(*document, *view);
492         break;
493     case RS2::ActionDrawCircleCR:
494         a = new RS_ActionDrawCircleCR(*document, *view);
495         break;
496     case RS2::ActionDrawCircle2P:
497         a = new RS_ActionDrawCircle2P(*document, *view);
498         break;
499     case RS2::ActionDrawCircle2PR:
500         a = new LC_ActionDrawCircle2PR(*document, *view);
501         break;
502     case RS2::ActionDrawCircle3P:
503         a = new RS_ActionDrawCircle3P(*document, *view);
504         break;
505     case RS2::ActionDrawCircleTan1_2P:
506         a = new RS_ActionDrawCircleTan1_2P(*document, *view);
507         break;
508     case RS2::ActionDrawCircleTan2_1P:
509         a = new RS_ActionDrawCircleTan2_1P(*document, *view);
510         break;
511     case RS2::ActionDrawCircleParallel:
512         a= new RS_ActionDrawLineParallel(*document, *view);
513         a->setActionType(id);
514         break;
515     case RS2::ActionDrawCircleInscribe:
516         a = new RS_ActionDrawCircleInscribe(*document, *view);
517         break;
518     case RS2::ActionDrawCircleTan2:
519         a = new RS_ActionDrawCircleTan2(*document, *view);
520         break;
521     case RS2::ActionDrawCircleTan3:
522         a = new RS_ActionDrawCircleTan3(*document, *view);
523         break;
524     case RS2::ActionDrawArc:
525         a = new RS_ActionDrawArc(*document, *view);
526         break;
527     case RS2::ActionDrawArc3P:
528         a = new RS_ActionDrawArc3P(*document, *view);
529         break;
530     case RS2::ActionDrawArcParallel:
531         a= new RS_ActionDrawLineParallel(*document, *view);
532         a->setActionType(id);
533         break;
534     case RS2::ActionDrawArcTangential:
535         a = new RS_ActionDrawArcTangential(*document, *view);
536         break;
537     case RS2::ActionDrawEllipseAxis:
538         a = new RS_ActionDrawEllipseAxis(*document, *view, false);
539         a->setActionType(id);
540         break;
541     case RS2::ActionDrawEllipseArcAxis:
542         a = new RS_ActionDrawEllipseAxis(*document, *view, true);
543         a->setActionType(id);
544         break;
545     case RS2::ActionDrawEllipseFociPoint:
546         a = new RS_ActionDrawEllipseFociPoint(*document, *view);
547         break;
548     case RS2::ActionDrawEllipse4Points:
549         a = new RS_ActionDrawEllipse4Points(*document, *view);
550         break;
551     case RS2::ActionDrawEllipseCenter3Points:
552         a = new RS_ActionDrawEllipseCenter3Points(*document, *view);
553         break;
554     case RS2::ActionDrawEllipseInscribe:
555         a = new RS_ActionDrawEllipseInscribe(*document, *view);
556         break;
557     case RS2::ActionDrawSpline:
558         a = new RS_ActionDrawSpline(*document, *view);
559         break;
560     case RS2::ActionDrawSplinePoints:
561         a = new LC_ActionDrawSplinePoints(*document, *view);
562         break;
563     case RS2::ActionDrawMText:
564         a = new RS_ActionDrawMText(*document, *view);
565         break;
566     case RS2::ActionDrawText:
567         a = new RS_ActionDrawText(*document, *view);
568         break;
569     case RS2::ActionDrawHatch:
570         if(!document->countSelected())
571         {
572             a = new RS_ActionSelect(this, *document, *view, RS2::ActionDrawHatchNoSelect);
573             break;
574         }
575         // fall-through
576 	case RS2::ActionDrawHatchNoSelect:
577 		a = new RS_ActionDrawHatch(*document, *view);
578         break;
579     case RS2::ActionDrawImage:
580         a = new RS_ActionDrawImage(*document, *view);
581         break;
582 
583         // Dimensioning actions:
584         //
585     case RS2::ActionDimAligned:
586         a = new RS_ActionDimAligned(*document, *view);
587         break;
588     case RS2::ActionDimLinear:
589         a = new RS_ActionDimLinear(*document, *view);
590         break;
591     case RS2::ActionDimLinearHor:
592         a = new RS_ActionDimLinear(*document, *view, 0.0, true, RS2::ActionDimLinearHor);
593         break;
594     case RS2::ActionDimLinearVer:
595         a = new RS_ActionDimLinear(*document, *view, M_PI_2, true, RS2::ActionDimLinearVer);
596         break;
597     case RS2::ActionDimRadial:
598         a = new RS_ActionDimRadial(*document, *view);
599         break;
600     case RS2::ActionDimDiametric:
601         a = new RS_ActionDimDiametric(*document, *view);
602         break;
603     case RS2::ActionDimAngular:
604         a = new RS_ActionDimAngular(*document, *view);
605         break;
606     case RS2::ActionDimLeader:
607         a = new RS_ActionDimLeader(*document, *view);
608         break;
609 
610         // Modifying actions:
611         //
612     case RS2::ActionModifyAttributes:
613 		if(!document->countSelected()){
614 			a = new RS_ActionSelect(this, *document, *view, RS2::ActionModifyAttributesNoSelect);
615 			break;
616 		}
617         // fall-through
618     case RS2::ActionModifyAttributesNoSelect:
619         a = new RS_ActionModifyAttributes(*document, *view);
620         break;
621     case RS2::ActionModifyDelete:
622         a = new RS_ActionSelect(this, *document, *view, RS2::ActionModifyDeleteNoSelect);
623         break;
624     case RS2::ActionModifyDeleteNoSelect:
625         a = new RS_ActionModifyDelete(*document, *view);
626         break;
627     case RS2::ActionModifyDeleteQuick:
628         a = new RS_ActionSelect(this, *document, *view, RS2::ActionModifyDeleteQuick);
629         break;
630     case RS2::ActionModifyDeleteFree:
631         a = new RS_ActionModifyDeleteFree(*document, *view);
632         break;
633     case RS2::ActionModifyMove:
634 		if(!document->countSelected()){
635 			a = new RS_ActionSelect(this, *document, *view, RS2::ActionModifyMoveNoSelect);
636 			break;
637 		}
638         // fall-through
639     case RS2::ActionModifyMoveNoSelect:
640         a = new RS_ActionModifyMove(*document, *view);
641         break;
642 	case RS2::ActionModifyRevertDirection:
643 		if(!document->countSelected()){
644 			a = new RS_ActionSelect(this, *document, *view, RS2::ActionModifyRevertDirectionNoSelect);
645 			break;
646 		}
647 		// fall-through
648 	case RS2::ActionModifyRevertDirectionNoSelect:
649 		a = new RS_ActionModifyRevertDirection(*document, *view);
650 		break;
651 	case RS2::ActionModifyRotate:
652 		if(!document->countSelected()){
653 			a = new RS_ActionSelect(this, *document, *view, RS2::ActionModifyRotateNoSelect);
654 			break;
655 		}
656         // fall-through
657     case RS2::ActionModifyRotateNoSelect:
658         a = new RS_ActionModifyRotate(*document, *view);
659         break;
660     case RS2::ActionModifyScale:
661 		if(!document->countSelected()){
662 			a = new RS_ActionSelect(this, *document, *view, RS2::ActionModifyScaleNoSelect);
663 			break;
664 		}
665         // fall-through
666     case RS2::ActionModifyScaleNoSelect:
667 		a = new RS_ActionModifyScale(*document, *view);
668 		break;
669     case RS2::ActionModifyMirror:
670 		if(!document->countSelected()){
671 			a = new RS_ActionSelect(this, *document, *view, RS2::ActionModifyMirrorNoSelect);
672 			break;
673 		}
674         // fall-through
675     case RS2::ActionModifyMirrorNoSelect:
676         a = new RS_ActionModifyMirror(*document, *view);
677         break;
678 	case RS2::ActionModifyMoveRotate:
679 		if(!document->countSelected()){
680 			a = new RS_ActionSelect(this, *document, *view, RS2::ActionModifyMoveRotateNoSelect);
681 			break;
682 		}
683         // fall-through
684     case RS2::ActionModifyMoveRotateNoSelect:
685         a = new RS_ActionModifyMoveRotate(*document, *view);
686         break;
687 	case RS2::ActionModifyRotate2:
688 		if(!document->countSelected()){
689 			a = new RS_ActionSelect(this, *document, *view, RS2::ActionModifyRotate2NoSelect);
690 			break;
691 		}
692         // fall-through
693     case RS2::ActionModifyRotate2NoSelect:
694         a = new RS_ActionModifyRotate2(*document, *view);
695 		break;
696 	case RS2::ActionModifyEntity:
697 		a = new RS_ActionModifyEntity(*document, *view);
698 		break;
699 	case RS2::ActionModifyTrim:
700         a = new RS_ActionModifyTrim(*document, *view, false);
701         a->setActionType(id);
702         break;
703     case RS2::ActionModifyTrim2:
704         a = new RS_ActionModifyTrim(*document, *view, true);
705         a->setActionType(id);
706         break;
707     case RS2::ActionModifyTrimAmount:
708         a = new RS_ActionModifyTrimAmount(*document, *view);
709         break;
710     case RS2::ActionModifyCut:
711         a = new RS_ActionModifyCut(*document, *view);
712         break;
713     case RS2::ActionModifyStretch:
714         a = new RS_ActionModifyStretch(*document, *view);
715         break;
716     case RS2::ActionModifyBevel:
717         a = new RS_ActionModifyBevel(*document, *view);
718         break;
719     case RS2::ActionModifyRound:
720         a = new RS_ActionModifyRound(*document, *view);
721         break;
722     case RS2::ActionModifyOffset:
723     {
724 		auto allowedOffsetTypes={RS2::EntityArc, RS2::EntityCircle, RS2::EntityLine, RS2::EntityPolyline};
725         if(!document->countSelected(true, allowedOffsetTypes)){
726             a = new RS_ActionSelect(this, *document, *view,RS2::ActionModifyOffsetNoSelect, allowedOffsetTypes);
727 			break;
728 		}
729 	}
730     // fall-through
731     case RS2::ActionModifyOffsetNoSelect:
732         a = new RS_ActionModifyOffset(*document, *view);
733 		break;
734 	case RS2::ActionModifyExplodeText:
735 		if(!document->countSelected(false, {RS2::EntityText, RS2::EntityMText})){
736 			a = new RS_ActionSelect(this, *document, *view, RS2::ActionModifyExplodeTextNoSelect);
737 			break;
738 		}
739         // fall-through
740     case RS2::ActionModifyExplodeTextNoSelect:
741         a = new RS_ActionModifyExplodeText(*document, *view);
742         break;
743 
744         // Snapping actions:
745         //
746     case RS2::ActionSnapFree:
747 //        a = new RS_ActionSetSnapMode(*document, *view, RS2::SnapFree);
748         slotSnapFree();
749         break;
750     case RS2::ActionSnapCenter:
751 //        a = new RS_ActionSetSnapMode(*document, *view, RS2::SnapCenter);
752         slotSnapCenter();
753         break;
754     case RS2::ActionSnapDist:
755         slotSnapDist();
756 //        a = new RS_ActionSetSnapMode(*document, *view, RS2::SnapDist);
757         break;
758     case RS2::ActionSnapEndpoint:
759         slotSnapEndpoint();
760 //        a = new RS_ActionSetSnapMode(*document, *view, RS2::SnapEndpoint);
761         break;
762     case RS2::ActionSnapGrid:
763         slotSnapGrid();
764 //        a = new RS_ActionSetSnapMode(*document, *view, RS2::SnapGrid);
765         break;
766     case RS2::ActionSnapIntersection:
767         slotSnapIntersection();
768 //        a = new RS_ActionSetSnapMode(*document, *view, RS2::SnapIntersection);
769         break;
770     case RS2::ActionSnapMiddle:
771         slotSnapMiddle();
772 //        a = new RS_ActionSetSnapMode(*document, *view, RS2::SnapMiddle);
773         break;
774     case RS2::ActionSnapOnEntity:
775         slotSnapOnEntity();
776 //        a = new RS_ActionSetSnapMode(*document, *view, RS2::SnapOnEntity);
777         break;
778 //    case RS2::ActionSnapIntersectionManual:
779 //        a = new RS_ActionSnapIntersectionManual(*document, *view);
780 //        break;
781 
782         // Snap restriction actions:
783         //
784     case RS2::ActionRestrictNothing:
785         slotRestrictNothing();
786 //        a = new RS_ActionSetSnapRestriction(*document, *view, RS2::RestrictNothing);
787         break;
788     case RS2::ActionRestrictOrthogonal:
789         slotRestrictOrthogonal();
790 //        a = new RS_ActionSetSnapRestriction(*document, *view, RS2::RestrictOrthogonal);
791         break;
792     case RS2::ActionRestrictHorizontal:
793         slotRestrictHorizontal();
794 //        a = new RS_ActionSetSnapRestriction(*document, *view, RS2::RestrictHorizontal);
795         break;
796     case RS2::ActionRestrictVertical:
797         slotRestrictVertical();
798 //        a = new RS_ActionSetSnapRestriction(*document, *view, RS2::RestrictVertical);
799         break;
800 
801         // Relative zero:
802         //
803     case RS2::ActionSetRelativeZero:
804         a = new RS_ActionSetRelativeZero(*document, *view);
805         break;
806     case RS2::ActionLockRelativeZero:
807         a = new RS_ActionLockRelativeZero(*document, *view, true);
808         break;
809     case RS2::ActionUnlockRelativeZero:
810         a = new RS_ActionLockRelativeZero(*document, *view, false);
811         break;
812 
813         // Info actions:
814         //
815     case RS2::ActionInfoInside:
816         a = new RS_ActionInfoInside(*document, *view);
817         break;
818     case RS2::ActionInfoDist:
819         a = new RS_ActionInfoDist(*document, *view);
820         break;
821     case RS2::ActionInfoDist2:
822         a = new RS_ActionInfoDist2(*document, *view);
823         break;
824     case RS2::ActionInfoAngle:
825         a = new RS_ActionInfoAngle(*document, *view);
826         break;
827 	case RS2::ActionInfoTotalLength:
828 		if(!document->countSelected()){
829 			a = new RS_ActionSelect(this, *document, *view, RS2::ActionInfoTotalLengthNoSelect);
830 			break;
831 		}
832         // fall-through
833     case RS2::ActionInfoTotalLengthNoSelect:
834         a = new RS_ActionInfoTotalLength(*document, *view);
835         break;
836     case RS2::ActionInfoArea:
837         a = new RS_ActionInfoArea(*document, *view);
838         break;
839 
840         // Layer actions:
841         //
842     case RS2::ActionLayersDefreezeAll:
843         a = new RS_ActionLayersFreezeAll(false, *document, *view);
844         break;
845     case RS2::ActionLayersFreezeAll:
846         a = new RS_ActionLayersFreezeAll(true, *document, *view);
847         break;
848     case RS2::ActionLayersUnlockAll:
849         a = new RS_ActionLayersLockAll(false, *document, *view);
850         break;
851     case RS2::ActionLayersLockAll:
852         a = new RS_ActionLayersLockAll(true, *document, *view);
853         break;
854     case RS2::ActionLayersAdd:
855         a = new RS_ActionLayersAdd(*document, *view);
856         break;
857     case RS2::ActionLayersRemove:
858         a = new RS_ActionLayersRemove(*document, *view);
859         break;
860     case RS2::ActionLayersEdit:
861         a = new RS_ActionLayersEdit(*document, *view);
862         break;
863     case RS2::ActionLayersToggleView:
864         a = new RS_ActionLayersToggleView(*document, *view, a_layer);
865         break;
866     case RS2::ActionLayersToggleLock:
867         a = new RS_ActionLayersToggleLock(*document, *view, a_layer);
868         break;
869     case RS2::ActionLayersTogglePrint:
870         a = new RS_ActionLayersTogglePrint(*document, *view, a_layer);
871         break;
872     case RS2::ActionLayersToggleConstruction:
873         a = new LC_ActionLayersToggleConstruction(*document, *view, a_layer);
874         break;
875         // Block actions:
876         //
877     case RS2::ActionBlocksDefreezeAll:
878         a = new RS_ActionBlocksFreezeAll(false, *document, *view);
879         break;
880     case RS2::ActionBlocksFreezeAll:
881         a = new RS_ActionBlocksFreezeAll(true, *document, *view);
882         break;
883     case RS2::ActionBlocksAdd:
884         a = new RS_ActionBlocksAdd(*document, *view);
885         break;
886     case RS2::ActionBlocksRemove:
887         a = new RS_ActionBlocksRemove(*document, *view);
888         break;
889     case RS2::ActionBlocksAttributes:
890         a = new RS_ActionBlocksAttributes(*document, *view);
891         break;
892     case RS2::ActionBlocksEdit:
893         a = new RS_ActionBlocksEdit(*document, *view);
894         break;
895     case RS2::ActionBlocksSave:
896         a = new RS_ActionBlocksSave(*document, *view);
897         break;
898     case RS2::ActionBlocksInsert:
899         a = new RS_ActionBlocksInsert(*document, *view);
900         break;
901     case RS2::ActionBlocksToggleView:
902         a = new RS_ActionBlocksToggleView(*document, *view);
903         break;
904     case RS2::ActionBlocksCreate:
905 		if(!document->countSelected()){
906 			a = new RS_ActionSelect(this, *document, *view, RS2::ActionBlocksCreateNoSelect);
907 			break;
908 		}
909         // fall-through
910     case RS2::ActionBlocksCreateNoSelect:
911         a = new RS_ActionBlocksCreate(*document, *view);
912         break;
913 	case RS2::ActionBlocksExplode:
914 		if(!document->countSelected(true, {RS2::EntityBlock})){
915 			a = new RS_ActionSelect(this, *document, *view, RS2::ActionBlocksExplodeNoSelect);
916 			break;
917 		}
918         // fall-through
919     case RS2::ActionBlocksExplodeNoSelect:
920         a = new RS_ActionBlocksExplode(*document, *view);
921         break;
922 
923 
924         // library browser:
925         //
926     case RS2::ActionLibraryInsert:
927         a = new RS_ActionLibraryInsert(*document, *view);
928         break;
929 
930         // options:
931         //
932         //case RS2::ActionOptionsGeneral:
933         //    a = new RS_ActionOptionsGeneral(*document, *view);
934         //	break;
935 
936     case RS2::ActionOptionsDrawing:
937         a = new RS_ActionOptionsDrawing(*document, *view);
938         break;
939     default:
940         RS_DEBUG->print(RS_Debug::D_WARNING,
941                         "QG_ActionHandler::setCurrentAction():"
942                         "No such action found.");
943         break;
944     }
945 
946 	if (a) {
947         view->setCurrentAction(a);
948     }
949 
950     RS_DEBUG->print("QG_ActionHandler::setCurrentAction(): OK");
951     return a;
952 }
953 
954 
955 
956 /**
957  * @return Available commands of the application or the current action.
958  */
getAvailableCommands()959 QStringList QG_ActionHandler::getAvailableCommands() {
960     RS_ActionInterface* currentAction = getCurrentAction();
961 
962 	if (currentAction) {
963         return currentAction->getAvailableCommands();
964     } else {
965         QStringList cmd;
966         cmd += "line";
967         cmd += "rectangle";
968         return cmd;
969     }
970 }
971 
972 //get snap mode from snap toolbar
getSnaps()973 RS_SnapMode QG_ActionHandler::getSnaps()
974 {
975 
976 	if (snap_toolbar) {
977         return snap_toolbar->getSnaps();
978     }
979     //return a free snap mode
980     return RS_SnapMode();
981 }
982 
983 
984 
985 /**
986  * Launches the command represented by the given keycode if possible.
987  *
988  * @return true: the command was recognized.
989  *         false: the command is not known and was probably intended for a
990  *            running action.
991  */
keycode(const QString & code)992 bool QG_ActionHandler::keycode(const QString& code) {
993     RS_DEBUG->print("QG_ActionHandler::keycode()");
994 
995     // pass keycode on to running action:
996     //RS_keycodeEvent e(cmd);
997 
998 	//if (view) {
999     //    view->keycodeEvent(&e);
1000     //}
1001 
1002     // if the current action can't deal with the keycode,
1003     //   it might be intended to launch a new keycode
1004     //if (!e.isAccepted()) {
1005     // keycode for new action:
1006     RS2::ActionType type = RS_COMMANDS->keycodeToAction(code);
1007     if (type!=RS2::ActionNone) {
1008         // some actions require special handling (GUI update):
1009         switch (type) {
1010         case RS2::ActionSnapFree:
1011             slotSnapFree();
1012             break;
1013         case RS2::ActionSnapCenter:
1014             slotSnapCenter();
1015             break;
1016         case RS2::ActionSnapDist:
1017             slotSnapDist();
1018             break;
1019         case RS2::ActionSnapEndpoint:
1020             slotSnapEndpoint();
1021             break;
1022         case RS2::ActionSnapGrid:
1023             slotSnapGrid();
1024             break;
1025         case RS2::ActionSnapIntersection:
1026             slotSnapIntersection();
1027             break;
1028         case RS2::ActionSnapMiddle:
1029             slotSnapMiddle();
1030             break;
1031         case RS2::ActionSnapOnEntity:
1032             slotSnapOnEntity();
1033             break;
1034         case RS2::ActionSnapIntersectionManual:
1035             slotSnapIntersectionManual();
1036             break;
1037 
1038         case RS2::ActionRestrictNothing:
1039             slotRestrictNothing();
1040             break;
1041         case RS2::ActionRestrictOrthogonal:
1042             slotRestrictOrthogonal();
1043             break;
1044         case RS2::ActionRestrictHorizontal:
1045             slotRestrictHorizontal();
1046             break;
1047         case RS2::ActionRestrictVertical:
1048             slotRestrictVertical();
1049             break;
1050 
1051         default:
1052             setCurrentAction(type);
1053             break;
1054         }
1055         return true;
1056     }
1057     //}
1058 
1059     return false;
1060 }
1061 
1062 /**
1063   * toggle snap modes when calling from command line
1064   **/
commandLineActions(RS2::ActionType type)1065 bool QG_ActionHandler::commandLineActions(RS2::ActionType type){
1066     RS_DEBUG->print("QG_ActionHandler::commandLineSnap()");
1067 
1068         // snap actions require special handling (GUI update)
1069     //more special handling of actions can be added here
1070         switch (type) {
1071         case RS2::ActionSnapCenter:
1072             slotSnapCenter();
1073             return true;
1074         case RS2::ActionSnapDist:
1075             slotSnapDist();
1076             return true;
1077         case RS2::ActionSnapEndpoint:
1078             slotSnapEndpoint();
1079             return true;
1080         case RS2::ActionSnapGrid:
1081             slotSnapGrid();
1082             return true;
1083         case RS2::ActionSnapIntersection:
1084             slotSnapIntersection();
1085             return true;
1086         case RS2::ActionSnapMiddle:
1087             slotSnapMiddle();
1088             return true;
1089         case RS2::ActionSnapOnEntity:
1090             slotSnapOnEntity();
1091             return true;
1092 
1093         case RS2::ActionRestrictNothing:
1094             slotRestrictNothing();
1095             return true;
1096         case RS2::ActionRestrictOrthogonal:
1097             slotRestrictOrthogonal();
1098             return true;
1099         case RS2::ActionRestrictHorizontal:
1100             slotRestrictHorizontal();
1101             return true;
1102         case RS2::ActionRestrictVertical:
1103             slotRestrictVertical();
1104             return true;
1105 
1106         default:
1107             return false;
1108         }
1109 
1110 }
1111 
1112 /**
1113  * Launches the given command if possible.
1114  *
1115  * @return true: the command was recognized.
1116  *         false: the command is not known and was probably intended for a
1117  *            running action.
1118  */
command(const QString & cmd)1119 bool QG_ActionHandler::command(const QString& cmd)
1120 {
1121     if (!view) return false;
1122 
1123     if (cmd.isEmpty())
1124     {
1125 		if (RS_SETTINGS->readNumEntry("/Keyboard/ToggleFreeSnapOnSpace", true))
1126 			slotSnapFree();
1127         return true;
1128     }
1129 
1130     RS_DEBUG->print("QG_ActionHandler::command: %s", cmd.toLatin1().data());
1131     QString c = cmd.toLower();
1132 
1133     if (c==tr("escape", "escape, go back from action steps"))
1134     {
1135         view->back();
1136         RS_DEBUG->print("QG_ActionHandler::command: back");
1137         return true;
1138     }
1139 
1140     // pass command on to running action:
1141     RS_CommandEvent e(cmd);
1142 
1143     RS_DEBUG->print("QG_ActionHandler::command: trigger command event in "
1144                     " graphic view");
1145     view->commandEvent(&e);
1146 
1147     // if the current action can't deal with the command,
1148     //   it might be intended to launch a new command
1149     //    std::cout<<"QG_ActionHandler::command(): e.isAccepted()="<<e.isAccepted()<<std::endl;
1150     if (!e.isAccepted()) {
1151 
1152         RS_DEBUG->print("QG_ActionHandler::command: convert cmd to action type");
1153         // command for new action:
1154         RS2::ActionType type = RS_COMMANDS->cmdToAction(cmd);
1155         if (type!=RS2::ActionNone) {
1156             RS_DEBUG->print("QG_ActionHandler::command: setting current action");
1157              //special handling, currently needed for snap actions
1158 			if (!commandLineActions(type)){
1159                 //not handled yet
1160                 setCurrentAction(type);
1161             }
1162             RS_DEBUG->print("QG_ActionHandler::command: current action set");
1163             return true;
1164         }
1165     }else{
1166         return true;
1167     }
1168 
1169     RS_DEBUG->print("QG_ActionHandler::command: current action not set");
1170     return false;
1171 }
1172 
1173 
1174 
1175 
1176 //void QG_ActionHandler::slotFileNew() {
1177 //	setCurrentAction(RS2::ActionFileNew);
1178 //}
1179 
slotFileNewTemplate()1180 void QG_ActionHandler::slotFileNewTemplate() {
1181     setCurrentAction(RS2::ActionFileNewTemplate);
1182 }
1183 
slotFileOpen()1184 void QG_ActionHandler::slotFileOpen() {
1185     setCurrentAction(RS2::ActionFileOpen);
1186 }
1187 /*
1188 void QG_ActionHandler::slotFileSave() {
1189         setCurrentAction(RS2::ActionFileSave);
1190 }
1191 */
1192 
slotFileSaveAs()1193 void QG_ActionHandler::slotFileSaveAs() {
1194     setCurrentAction(RS2::ActionFileSaveAs);
1195 }
1196 
1197 /*
1198 void QG_ActionHandler::slotFileClose() {
1199         setCurrentAction(RS2::ActionFileClose);
1200 }
1201 
1202 void QG_ActionHandler::slotFilePrint() {
1203         setCurrentAction(RS2::ActionFilePrint);
1204 }
1205 */
1206 
slotFileExportMakerCam()1207 void QG_ActionHandler::slotFileExportMakerCam() {
1208     setCurrentAction(RS2::ActionFileExportMakerCam);
1209 }
1210 
slotZoomIn()1211 void QG_ActionHandler::slotZoomIn() {
1212     setCurrentAction(RS2::ActionZoomIn);
1213 }
1214 
slotZoomOut()1215 void QG_ActionHandler::slotZoomOut() {
1216     setCurrentAction(RS2::ActionZoomOut);
1217 }
1218 
slotZoomAuto()1219 void QG_ActionHandler::slotZoomAuto() {
1220     setCurrentAction(RS2::ActionZoomAuto);
1221 }
1222 
slotZoomWindow()1223 void QG_ActionHandler::slotZoomWindow() {
1224     setCurrentAction(RS2::ActionZoomWindow);
1225 }
1226 
slotZoomPan()1227 void QG_ActionHandler::slotZoomPan() {
1228     setCurrentAction(RS2::ActionZoomPan);
1229 }
1230 
slotZoomPrevious()1231 void QG_ActionHandler::slotZoomPrevious() {
1232     setCurrentAction(RS2::ActionZoomPrevious);
1233 }
1234 
slotZoomRedraw()1235 void QG_ActionHandler::slotZoomRedraw() {
1236     setCurrentAction(RS2::ActionZoomRedraw);
1237 }
1238 
slotToolRegenerateDimensions()1239 void QG_ActionHandler::slotToolRegenerateDimensions() {
1240     setCurrentAction(RS2::ActionToolRegenerateDimensions);
1241 }
1242 
slotEditKillAllActions()1243 void QG_ActionHandler::slotEditKillAllActions() {
1244     setCurrentAction(RS2::ActionEditKillAllActions);
1245 }
slotEditUndo()1246 void QG_ActionHandler::slotEditUndo() {
1247 	//to avoid operation on deleted entities, Undo action invalid all suspended
1248 	//actions
1249 	killAllActions();
1250     setCurrentAction(RS2::ActionEditUndo);
1251 }
1252 
slotEditRedo()1253 void QG_ActionHandler::slotEditRedo() {
1254     setCurrentAction(RS2::ActionEditRedo);
1255 }
1256 
slotEditCut()1257 void QG_ActionHandler::slotEditCut() {
1258     setCurrentAction(RS2::ActionEditCut);
1259 }
1260 
slotEditCopy()1261 void QG_ActionHandler::slotEditCopy() {
1262     setCurrentAction(RS2::ActionEditCopy);
1263 }
1264 
slotEditPaste()1265 void QG_ActionHandler::slotEditPaste() {
1266     setCurrentAction(RS2::ActionEditPaste);
1267 }
1268 
slotOrderBottom()1269 void QG_ActionHandler::slotOrderBottom() {
1270     setCurrentAction(RS2::ActionOrderBottom);
1271 }
1272 
slotOrderLower()1273 void QG_ActionHandler::slotOrderLower() {
1274     setCurrentAction(RS2::ActionOrderLower);
1275 }
1276 
slotOrderRaise()1277 void QG_ActionHandler::slotOrderRaise() {
1278     setCurrentAction(RS2::ActionOrderRaise);
1279 }
1280 
slotOrderTop()1281 void QG_ActionHandler::slotOrderTop() {
1282     setCurrentAction(RS2::ActionOrderTop);
1283 }
1284 
slotSelectSingle()1285 void QG_ActionHandler::slotSelectSingle() {
1286     setCurrentAction(RS2::ActionSelectSingle);
1287 }
1288 
slotSelectContour()1289 void QG_ActionHandler::slotSelectContour() {
1290     setCurrentAction(RS2::ActionSelectContour);
1291 }
1292 
slotSelectWindow()1293 void QG_ActionHandler::slotSelectWindow() {
1294     setCurrentAction(RS2::ActionSelectWindow);
1295 }
1296 
slotDeselectWindow()1297 void QG_ActionHandler::slotDeselectWindow() {
1298     setCurrentAction(RS2::ActionDeselectWindow);
1299 }
1300 
slotSelectAll()1301 void QG_ActionHandler::slotSelectAll() {
1302     setCurrentAction(RS2::ActionSelectAll);
1303 }
1304 
slotDeselectAll()1305 void QG_ActionHandler::slotDeselectAll() {
1306     setCurrentAction(RS2::ActionDeselectAll);
1307 }
1308 
slotSelectInvert()1309 void QG_ActionHandler::slotSelectInvert() {
1310     setCurrentAction(RS2::ActionSelectInvert);
1311 }
1312 
slotSelectIntersected()1313 void QG_ActionHandler::slotSelectIntersected() {
1314     setCurrentAction(RS2::ActionSelectIntersected);
1315 }
1316 
slotDeselectIntersected()1317 void QG_ActionHandler::slotDeselectIntersected() {
1318     setCurrentAction(RS2::ActionDeselectIntersected);
1319 }
1320 
slotSelectLayer()1321 void QG_ActionHandler::slotSelectLayer() {
1322     setCurrentAction(RS2::ActionSelectLayer);
1323 }
1324 
slotDrawPoint()1325 void QG_ActionHandler::slotDrawPoint() {
1326         setCurrentAction(RS2::ActionDrawPoint);
1327 }
1328 
slotDrawLine()1329 void QG_ActionHandler::slotDrawLine() {
1330     setCurrentAction(RS2::ActionDrawLine);
1331 }
1332 
slotDrawLineAngle()1333 void QG_ActionHandler::slotDrawLineAngle() {
1334     setCurrentAction(RS2::ActionDrawLineAngle);
1335 }
1336 
slotDrawLineHorizontal()1337 void QG_ActionHandler::slotDrawLineHorizontal() {
1338     setCurrentAction(RS2::ActionDrawLineHorizontal);
1339 }
1340 
slotDrawLineHorVert()1341 void QG_ActionHandler::slotDrawLineHorVert() {
1342     setCurrentAction(RS2::ActionDrawLineHorVert);
1343 }
1344 
slotDrawLineVertical()1345 void QG_ActionHandler::slotDrawLineVertical() {
1346     setCurrentAction(RS2::ActionDrawLineVertical);
1347 }
1348 
slotDrawLineFree()1349 void QG_ActionHandler::slotDrawLineFree() {
1350     setCurrentAction(RS2::ActionDrawLineFree);
1351 }
1352 
slotDrawLineParallel()1353 void QG_ActionHandler::slotDrawLineParallel() {
1354     setCurrentAction(RS2::ActionDrawLineParallel);
1355 }
1356 
slotDrawLineParallelThrough()1357 void QG_ActionHandler::slotDrawLineParallelThrough() {
1358     setCurrentAction(RS2::ActionDrawLineParallelThrough);
1359 }
1360 
slotDrawLineRectangle()1361 void QG_ActionHandler::slotDrawLineRectangle() {
1362     setCurrentAction(RS2::ActionDrawLineRectangle);
1363 }
1364 
slotDrawLineBisector()1365 void QG_ActionHandler::slotDrawLineBisector() {
1366     setCurrentAction(RS2::ActionDrawLineBisector);
1367 }
1368 
slotDrawLineTangent1()1369 void QG_ActionHandler::slotDrawLineTangent1() {
1370     setCurrentAction(RS2::ActionDrawLineTangent1);
1371 }
1372 
slotDrawLineTangent2()1373 void QG_ActionHandler::slotDrawLineTangent2() {
1374     setCurrentAction(RS2::ActionDrawLineTangent2);
1375 }
1376 
slotDrawLineOrthTan()1377 void QG_ActionHandler::slotDrawLineOrthTan() {
1378     setCurrentAction(RS2::ActionDrawLineOrthTan);
1379 }
1380 
slotDrawLineOrthogonal()1381 void QG_ActionHandler::slotDrawLineOrthogonal() {
1382     setCurrentAction(RS2::ActionDrawLineOrthogonal);
1383 }
1384 
slotDrawLineRelAngle()1385 void QG_ActionHandler::slotDrawLineRelAngle() {
1386     setCurrentAction(RS2::ActionDrawLineRelAngle);
1387 }
1388 
slotDrawPolyline()1389 void QG_ActionHandler::slotDrawPolyline() {
1390     setCurrentAction(RS2::ActionDrawPolyline);
1391 }
1392 
slotPolylineAdd()1393 void QG_ActionHandler::slotPolylineAdd() {
1394     setCurrentAction(RS2::ActionPolylineAdd);
1395 }
1396 
slotPolylineAppend()1397 void QG_ActionHandler::slotPolylineAppend() {
1398     setCurrentAction(RS2::ActionPolylineAppend);
1399 }
1400 
slotPolylineDel()1401 void QG_ActionHandler::slotPolylineDel() {
1402     setCurrentAction(RS2::ActionPolylineDel);
1403 }
1404 
slotPolylineDelBetween()1405 void QG_ActionHandler::slotPolylineDelBetween() {
1406     setCurrentAction(RS2::ActionPolylineDelBetween);
1407 }
1408 
slotPolylineTrim()1409 void QG_ActionHandler::slotPolylineTrim() {
1410     setCurrentAction(RS2::ActionPolylineTrim);
1411 }
1412 
slotPolylineEquidistant()1413 void QG_ActionHandler::slotPolylineEquidistant() {
1414     setCurrentAction(RS2::ActionPolylineEquidistant);
1415 }
slotPolylineSegment()1416 void QG_ActionHandler::slotPolylineSegment() {
1417     setCurrentAction(RS2::ActionPolylineSegment);
1418 }
1419 
slotDrawLinePolygon()1420 void QG_ActionHandler::slotDrawLinePolygon() {
1421     setCurrentAction(RS2::ActionDrawLinePolygonCenCor);
1422 }
1423 
slotDrawLinePolygon3()1424 void QG_ActionHandler::slotDrawLinePolygon3() {           //20161223 added by txmy
1425     setCurrentAction(RS2::ActionDrawLinePolygonCenTan);
1426 }
1427 
slotDrawLinePolygon2()1428 void QG_ActionHandler::slotDrawLinePolygon2() {
1429     setCurrentAction(RS2::ActionDrawLinePolygonCorCor);
1430 }
1431 
slotDrawCircle()1432 void QG_ActionHandler::slotDrawCircle() {
1433     setCurrentAction(RS2::ActionDrawCircle);
1434 }
1435 
slotDrawCircleCR()1436 void QG_ActionHandler::slotDrawCircleCR() {
1437     setCurrentAction(RS2::ActionDrawCircleCR);
1438 }
1439 
slotDrawCircle2P()1440 void QG_ActionHandler::slotDrawCircle2P() {
1441     setCurrentAction(RS2::ActionDrawCircle2P);
1442 }
1443 
slotDrawCircle2PR()1444 void QG_ActionHandler::slotDrawCircle2PR() {
1445     setCurrentAction(RS2::ActionDrawCircle2PR);
1446 }
1447 
slotDrawCircle3P()1448 void QG_ActionHandler::slotDrawCircle3P() {
1449     setCurrentAction(RS2::ActionDrawCircle3P);
1450 }
1451 
slotDrawCircleTan1_2P()1452 void QG_ActionHandler::slotDrawCircleTan1_2P() {
1453     setCurrentAction(RS2::ActionDrawCircleTan1_2P);
1454 }
1455 
slotDrawCircleTan2_1P()1456 void QG_ActionHandler::slotDrawCircleTan2_1P() {
1457     setCurrentAction(RS2::ActionDrawCircleTan2_1P);
1458 }
1459 
slotDrawCircleParallel()1460 void QG_ActionHandler::slotDrawCircleParallel() {
1461     setCurrentAction(RS2::ActionDrawCircleParallel);
1462 }
1463 
slotDrawCircleInscribe()1464 void QG_ActionHandler::slotDrawCircleInscribe() {
1465     setCurrentAction(RS2::ActionDrawCircleInscribe);
1466 }
1467 
slotDrawCircleTan2()1468 void QG_ActionHandler::slotDrawCircleTan2() {
1469     setCurrentAction(RS2::ActionDrawCircleTan2);
1470 }
slotDrawCircleTan3()1471 void QG_ActionHandler::slotDrawCircleTan3() {
1472     setCurrentAction(RS2::ActionDrawCircleTan3);
1473 }
slotDrawArc()1474 void QG_ActionHandler::slotDrawArc() {
1475     setCurrentAction(RS2::ActionDrawArc);
1476 }
1477 
slotDrawArc3P()1478 void QG_ActionHandler::slotDrawArc3P() {
1479     setCurrentAction(RS2::ActionDrawArc3P);
1480 }
1481 
slotDrawArcParallel()1482 void QG_ActionHandler::slotDrawArcParallel() {
1483     setCurrentAction(RS2::ActionDrawArcParallel);
1484 }
1485 
slotDrawArcTangential()1486 void QG_ActionHandler::slotDrawArcTangential() {
1487     setCurrentAction(RS2::ActionDrawArcTangential);
1488 }
1489 
slotDrawEllipseAxis()1490 void QG_ActionHandler::slotDrawEllipseAxis() {
1491     setCurrentAction(RS2::ActionDrawEllipseAxis);
1492 }
1493 
slotDrawEllipseArcAxis()1494 void QG_ActionHandler::slotDrawEllipseArcAxis() {
1495     setCurrentAction(RS2::ActionDrawEllipseArcAxis);
1496 }
1497 
slotDrawEllipseFociPoint()1498 void QG_ActionHandler::slotDrawEllipseFociPoint() {
1499     setCurrentAction(RS2::ActionDrawEllipseFociPoint);
1500 }
slotDrawEllipse4Points()1501 void QG_ActionHandler::slotDrawEllipse4Points() {
1502     setCurrentAction(RS2::ActionDrawEllipse4Points);
1503 }
slotDrawEllipseCenter3Points()1504 void QG_ActionHandler::slotDrawEllipseCenter3Points() {
1505     setCurrentAction(RS2::ActionDrawEllipseCenter3Points);
1506 }
slotDrawEllipseInscribe()1507 void QG_ActionHandler::slotDrawEllipseInscribe() {
1508     setCurrentAction(RS2::ActionDrawEllipseInscribe);
1509 }
1510 
slotDrawSpline()1511 void QG_ActionHandler::slotDrawSpline() {
1512     setCurrentAction(RS2::ActionDrawSpline);
1513 }
1514 
slotDrawSplinePoints()1515 void QG_ActionHandler::slotDrawSplinePoints() {
1516     setCurrentAction(RS2::ActionDrawSplinePoints);
1517 }
1518 
slotDrawMText()1519 void QG_ActionHandler::slotDrawMText() {
1520     setCurrentAction(RS2::ActionDrawMText);
1521 }
1522 
slotDrawText()1523 void QG_ActionHandler::slotDrawText() {
1524     setCurrentAction(RS2::ActionDrawText);
1525 }
1526 
slotDrawHatch()1527 void QG_ActionHandler::slotDrawHatch() {
1528     setCurrentAction(RS2::ActionDrawHatch);
1529 }
1530 
slotDrawImage()1531 void QG_ActionHandler::slotDrawImage() {
1532     setCurrentAction(RS2::ActionDrawImage);
1533 }
1534 
slotDimAligned()1535 void QG_ActionHandler::slotDimAligned() {
1536     setCurrentAction(RS2::ActionDimAligned);
1537 }
1538 
slotDimLinear()1539 void QG_ActionHandler::slotDimLinear() {
1540     setCurrentAction(RS2::ActionDimLinear);
1541 }
1542 
slotDimLinearHor()1543 void QG_ActionHandler::slotDimLinearHor() {
1544     setCurrentAction(RS2::ActionDimLinearHor);
1545 }
1546 
slotDimLinearVer()1547 void QG_ActionHandler::slotDimLinearVer() {
1548     setCurrentAction(RS2::ActionDimLinearVer);
1549 }
1550 
slotDimRadial()1551 void QG_ActionHandler::slotDimRadial() {
1552     setCurrentAction(RS2::ActionDimRadial);
1553 }
1554 
slotDimDiametric()1555 void QG_ActionHandler::slotDimDiametric() {
1556     setCurrentAction(RS2::ActionDimDiametric);
1557 }
1558 
slotDimAngular()1559 void QG_ActionHandler::slotDimAngular() {
1560     setCurrentAction(RS2::ActionDimAngular);
1561 }
1562 
slotDimLeader()1563 void QG_ActionHandler::slotDimLeader() {
1564     setCurrentAction(RS2::ActionDimLeader);
1565 }
1566 
1567 
slotModifyAttributes()1568 void QG_ActionHandler::slotModifyAttributes() {
1569     setCurrentAction(RS2::ActionModifyAttributes);
1570 }
1571 
slotModifyDelete()1572 void QG_ActionHandler::slotModifyDelete() {
1573     setCurrentAction(RS2::ActionModifyDelete);
1574 }
1575 
slotModifyDeleteQuick()1576 void QG_ActionHandler::slotModifyDeleteQuick() {
1577     //setCurrentAction(RS2::ActionModifyDeleteQuick);
1578     setCurrentAction(RS2::ActionModifyDeleteNoSelect);
1579 }
1580 
slotModifyDeleteFree()1581 void QG_ActionHandler::slotModifyDeleteFree() {
1582     setCurrentAction(RS2::ActionModifyDeleteFree);
1583 }
1584 
slotModifyMove()1585 void QG_ActionHandler::slotModifyMove() {
1586     setCurrentAction(RS2::ActionModifyMove);
1587 }
1588 
slotModifyRevertDirection()1589 void QG_ActionHandler::slotModifyRevertDirection() {
1590 	setCurrentAction(RS2::ActionModifyRevertDirection);
1591 }
1592 
slotModifyRotate()1593 void QG_ActionHandler::slotModifyRotate() {
1594     setCurrentAction(RS2::ActionModifyRotate);
1595 }
1596 
slotModifyScale()1597 void QG_ActionHandler::slotModifyScale() {
1598     setCurrentAction(RS2::ActionModifyScale);
1599 }
1600 
slotModifyStretch()1601 void QG_ActionHandler::slotModifyStretch() {
1602     setCurrentAction(RS2::ActionModifyStretch);
1603 }
1604 
slotModifyBevel()1605 void QG_ActionHandler::slotModifyBevel() {
1606     setCurrentAction(RS2::ActionModifyBevel);
1607 }
1608 
slotModifyRound()1609 void QG_ActionHandler::slotModifyRound() {
1610     setCurrentAction(RS2::ActionModifyRound);
1611 }
slotModifyOffset()1612 void QG_ActionHandler::slotModifyOffset() {
1613     setCurrentAction(RS2::ActionModifyOffset);
1614 }
1615 
slotModifyMirror()1616 void QG_ActionHandler::slotModifyMirror() {
1617     setCurrentAction(RS2::ActionModifyMirror);
1618 }
1619 
slotModifyMoveRotate()1620 void QG_ActionHandler::slotModifyMoveRotate() {
1621     setCurrentAction(RS2::ActionModifyMoveRotate);
1622 }
1623 
slotModifyRotate2()1624 void QG_ActionHandler::slotModifyRotate2() {
1625     setCurrentAction(RS2::ActionModifyRotate2);
1626 }
1627 
slotModifyEntity()1628 void QG_ActionHandler::slotModifyEntity() {
1629     setCurrentAction(RS2::ActionModifyEntity);
1630 }
1631 
slotModifyTrim()1632 void QG_ActionHandler::slotModifyTrim() {
1633     setCurrentAction(RS2::ActionModifyTrim);
1634 }
1635 
slotModifyTrim2()1636 void QG_ActionHandler::slotModifyTrim2() {
1637     setCurrentAction(RS2::ActionModifyTrim2);
1638 }
1639 
slotModifyTrimAmount()1640 void QG_ActionHandler::slotModifyTrimAmount() {
1641     setCurrentAction(RS2::ActionModifyTrimAmount);
1642 }
1643 
slotModifyCut()1644 void QG_ActionHandler::slotModifyCut() {
1645     setCurrentAction(RS2::ActionModifyCut);
1646 }
1647 
slotModifyExplodeText()1648 void QG_ActionHandler::slotModifyExplodeText() {
1649     setCurrentAction(RS2::ActionModifyExplodeText);
1650 }
1651 
slotSetSnaps(RS_SnapMode const & s)1652 void QG_ActionHandler::slotSetSnaps(RS_SnapMode const& s) {
1653     RS_DEBUG->print("QG_ActionHandler::slotSetSnaps()");
1654 
1655 	if(snap_toolbar) {
1656     RS_DEBUG->print("QG_ActionHandler::slotSetSnaps(): set snapToolBar");
1657         snap_toolbar->setSnaps(s);
1658     }else{
1659     RS_DEBUG->print("QG_ActionHandler::slotSetSnaps(): snapToolBar is NULL");
1660     }
1661 	if(view) {
1662         view->setDefaultSnapMode(s);
1663     }
1664     RS_DEBUG->print("QG_ActionHandler::slotSetSnaps(): ok");
1665 }
1666 
slotSnapFree()1667 void QG_ActionHandler::slotSnapFree() {
1668 //    if ( snapFree == NULL) return;
1669 //    disableSnaps();
1670     RS_SnapMode s=getSnaps();
1671     s.snapFree = !s.snapFree;
1672     slotSetSnaps(s);
1673 }
1674 
slotSnapGrid()1675 void QG_ActionHandler::slotSnapGrid() {
1676 //    if(snapGrid==NULL) return;
1677     RS_SnapMode s=getSnaps();
1678     s.snapGrid = !s.snapGrid;
1679     slotSetSnaps(s);
1680 }
1681 
slotSnapEndpoint()1682 void QG_ActionHandler::slotSnapEndpoint() {
1683 //    if(snapEndpoint==NULL) return;
1684     RS_SnapMode s=getSnaps();
1685     s.snapEndpoint = !s.snapEndpoint;
1686 
1687     slotSetSnaps(s);
1688 }
1689 
slotSnapOnEntity()1690 void QG_ActionHandler::slotSnapOnEntity() {
1691 //    if(snapOnEntity==NULL) return;
1692     RS_SnapMode s=getSnaps();
1693     s.snapOnEntity = !s.snapOnEntity;
1694 
1695     slotSetSnaps(s);
1696 }
1697 
slotSnapCenter()1698 void QG_ActionHandler::slotSnapCenter() {
1699 //    std::cout<<" QG_ActionHandler::slotSnapCenter(): start"<<std::endl;
1700 //    if(snapCenter==NULL) return;
1701     RS_SnapMode s=getSnaps();
1702     s.snapCenter = !s.snapCenter;
1703     slotSetSnaps(s);
1704 }
1705 
slotSnapMiddle()1706 void QG_ActionHandler::slotSnapMiddle() {
1707     RS_SnapMode s=getSnaps();
1708     s.snapMiddle = !s.snapMiddle;
1709 
1710     slotSetSnaps(s);
1711 }
1712 
slotSnapDist()1713 void QG_ActionHandler::slotSnapDist() {
1714     RS_SnapMode s=getSnaps();
1715     s.snapDistance = !s.snapDistance;
1716 
1717     slotSetSnaps(s);
1718 }
1719 
slotSnapIntersection()1720 void QG_ActionHandler::slotSnapIntersection() {
1721     RS_SnapMode s=getSnaps();
1722     s.snapIntersection = !s.snapIntersection;
1723 
1724     slotSetSnaps(s);
1725 }
1726 
slotSnapIntersectionManual()1727 void QG_ActionHandler::slotSnapIntersectionManual() {
1728     //disableSnaps();
1729 	/*if (snapIntersectionManual) {
1730         snapIntersectionManual->setChecked(true);
1731 }*/
1732 	/*if (snapToolBar) {
1733         snapToolBar->setSnapMode(RS2::SnapIntersectionManual);
1734 }*/
1735     //setCurrentAction(RS2::ActionSnapIntersectionManual);
1736 }
1737 
disableSnaps()1738 void QG_ActionHandler::disableSnaps() {
1739 
1740     slotSetSnaps(RS_SnapMode());
1741 }
1742 
slotRestrictNothing()1743 void QG_ActionHandler::slotRestrictNothing() {
1744     RS_SnapMode s = getSnaps();
1745     s.restriction = RS2::RestrictNothing;
1746     slotSetSnaps(s);
1747 }
1748 
slotRestrictOrthogonal()1749 void QG_ActionHandler::slotRestrictOrthogonal() {
1750     RS_SnapMode s = getSnaps();
1751     s.restriction = RS2::RestrictOrthogonal;
1752     slotSetSnaps(s);
1753 }
1754 
slotRestrictHorizontal()1755 void QG_ActionHandler::slotRestrictHorizontal() {
1756     RS_SnapMode s = getSnaps();
1757     s.restriction = RS2::RestrictHorizontal;
1758     slotSetSnaps(s);
1759 }
1760 
slotRestrictVertical()1761 void QG_ActionHandler::slotRestrictVertical() {
1762     RS_SnapMode s = getSnaps();
1763     s.restriction = RS2::RestrictVertical;
1764     slotSetSnaps(s);
1765 }
1766 
1767 // find snap restriction from menu
getSnapRestriction()1768 RS2::SnapRestriction QG_ActionHandler::getSnapRestriction(){
1769     return getSnaps().restriction;
1770 }
1771 
disableRestrictions()1772 void QG_ActionHandler::disableRestrictions() {
1773     RS_SnapMode s=getSnaps();
1774     s.restriction= RS2::RestrictNothing;
1775     slotSetSnaps(s);
1776 }
1777 
slotSetRelativeZero()1778 void QG_ActionHandler::slotSetRelativeZero() {
1779     setCurrentAction(RS2::ActionSetRelativeZero);
1780 }
1781 
slotLockRelativeZero(bool on)1782 void QG_ActionHandler::slotLockRelativeZero(bool on)
1783 {
1784 	if (snap_toolbar) {
1785         snap_toolbar->setLockedRelativeZero(on);
1786     }
1787     if (on) {
1788         setCurrentAction(RS2::ActionLockRelativeZero);
1789     } else {
1790         setCurrentAction(RS2::ActionUnlockRelativeZero);
1791     }
1792 }
1793 
slotInfoInside()1794 void QG_ActionHandler::slotInfoInside() {
1795     setCurrentAction(RS2::ActionInfoInside);
1796 }
1797 
slotInfoDist()1798 void QG_ActionHandler::slotInfoDist() {
1799     setCurrentAction(RS2::ActionInfoDist);
1800 }
1801 
slotInfoDist2()1802 void QG_ActionHandler::slotInfoDist2() {
1803     setCurrentAction(RS2::ActionInfoDist2);
1804 }
1805 
slotInfoAngle()1806 void QG_ActionHandler::slotInfoAngle() {
1807     setCurrentAction(RS2::ActionInfoAngle);
1808 }
1809 
slotInfoTotalLength()1810 void QG_ActionHandler::slotInfoTotalLength() {
1811     setCurrentAction(RS2::ActionInfoTotalLength);
1812 }
1813 
slotInfoArea()1814 void QG_ActionHandler::slotInfoArea() {
1815     setCurrentAction(RS2::ActionInfoArea);
1816 }
1817 
slotLayersDefreezeAll()1818 void QG_ActionHandler::slotLayersDefreezeAll() {
1819     setCurrentAction(RS2::ActionLayersDefreezeAll);
1820 }
1821 
slotLayersFreezeAll()1822 void QG_ActionHandler::slotLayersFreezeAll() {
1823     setCurrentAction(RS2::ActionLayersFreezeAll);
1824 }
1825 
slotLayersUnlockAll()1826 void QG_ActionHandler::slotLayersUnlockAll() {
1827     setCurrentAction(RS2::ActionLayersUnlockAll);
1828 }
1829 
slotLayersLockAll()1830 void QG_ActionHandler::slotLayersLockAll() {
1831     setCurrentAction(RS2::ActionLayersLockAll);
1832 }
1833 
slotLayersAdd()1834 void QG_ActionHandler::slotLayersAdd() {
1835     setCurrentAction(RS2::ActionLayersAdd);
1836 }
1837 
slotLayersRemove()1838 void QG_ActionHandler::slotLayersRemove() {
1839     setCurrentAction(RS2::ActionLayersRemove);
1840 }
1841 
slotLayersEdit()1842 void QG_ActionHandler::slotLayersEdit() {
1843     setCurrentAction(RS2::ActionLayersEdit);
1844 }
1845 
slotLayersToggleView()1846 void QG_ActionHandler::slotLayersToggleView() {
1847     setCurrentAction(RS2::ActionLayersToggleView);
1848 }
1849 
slotLayersToggleLock()1850 void QG_ActionHandler::slotLayersToggleLock() {
1851     setCurrentAction(RS2::ActionLayersToggleLock);
1852 }
1853 
slotLayersTogglePrint()1854 void QG_ActionHandler::slotLayersTogglePrint() {
1855     setCurrentAction(RS2::ActionLayersTogglePrint);
1856 }
1857 
slotLayersToggleConstruction()1858 void QG_ActionHandler::slotLayersToggleConstruction() {
1859     setCurrentAction(RS2::ActionLayersToggleConstruction);
1860 }
1861 
1862 
slotBlocksDefreezeAll()1863 void QG_ActionHandler::slotBlocksDefreezeAll() {
1864     setCurrentAction(RS2::ActionBlocksDefreezeAll);
1865 }
1866 
slotBlocksFreezeAll()1867 void QG_ActionHandler::slotBlocksFreezeAll() {
1868     setCurrentAction(RS2::ActionBlocksFreezeAll);
1869 }
1870 
slotBlocksAdd()1871 void QG_ActionHandler::slotBlocksAdd() {
1872     setCurrentAction(RS2::ActionBlocksAdd);
1873 }
1874 
slotBlocksRemove()1875 void QG_ActionHandler::slotBlocksRemove() {
1876     setCurrentAction(RS2::ActionBlocksRemove);
1877 }
1878 
slotBlocksAttributes()1879 void QG_ActionHandler::slotBlocksAttributes() {
1880     setCurrentAction(RS2::ActionBlocksAttributes);
1881 }
1882 
slotBlocksEdit()1883 void QG_ActionHandler::slotBlocksEdit() {
1884     setCurrentAction(RS2::ActionBlocksEdit);
1885 }
1886 
slotBlocksSave()1887 void QG_ActionHandler::slotBlocksSave() {
1888     setCurrentAction(RS2::ActionBlocksSave);
1889 }
1890 
slotBlocksInsert()1891 void QG_ActionHandler::slotBlocksInsert() {
1892     setCurrentAction(RS2::ActionBlocksInsert);
1893 }
1894 
slotBlocksToggleView()1895 void QG_ActionHandler::slotBlocksToggleView() {
1896     setCurrentAction(RS2::ActionBlocksToggleView);
1897 }
1898 
slotBlocksCreate()1899 void QG_ActionHandler::slotBlocksCreate() {
1900     setCurrentAction(RS2::ActionBlocksCreate);
1901 }
1902 
slotBlocksExplode()1903 void QG_ActionHandler::slotBlocksExplode() {
1904     setCurrentAction(RS2::ActionBlocksExplode);
1905 }
1906 
1907 
slotOptionsDrawing()1908 void QG_ActionHandler::slotOptionsDrawing() {
1909     setCurrentAction(RS2::ActionOptionsDrawing);
1910 }
1911 
set_view(RS_GraphicView * gview)1912 void QG_ActionHandler::set_view(RS_GraphicView* gview)
1913 {
1914     view = gview;
1915 }
set_document(RS_Document * doc)1916 void QG_ActionHandler::set_document(RS_Document* doc)
1917 {
1918     document = doc;
1919 }
1920 
set_snap_toolbar(QG_SnapToolBar * snap_tb)1921 void QG_ActionHandler::set_snap_toolbar(QG_SnapToolBar* snap_tb)
1922 {
1923     snap_toolbar = snap_tb;
1924 }
1925 
toggleVisibility(RS_Layer * layer)1926 void QG_ActionHandler::toggleVisibility(RS_Layer* layer)
1927 {
1928     auto a = new RS_ActionLayersToggleView(*document, *view, layer);
1929     view->setCurrentAction(a);
1930 }
toggleLock(RS_Layer * layer)1931 void QG_ActionHandler::toggleLock(RS_Layer* layer)
1932 {
1933     auto a = new RS_ActionLayersToggleLock(*document, *view, layer);
1934     view->setCurrentAction(a);
1935 }
togglePrint(RS_Layer * layer)1936 void QG_ActionHandler::togglePrint(RS_Layer* layer)
1937 {
1938     auto a = new RS_ActionLayersTogglePrint(*document, *view, layer);
1939     view->setCurrentAction(a);
1940 }
toggleConstruction(RS_Layer * layer)1941 void QG_ActionHandler::toggleConstruction(RS_Layer* layer)
1942 {
1943     auto a = new LC_ActionLayersToggleConstruction(*document, *view, layer);
1944     view->setCurrentAction(a);
1945 }
1946 
1947 // EOF
1948 
1949