1 // qg_actionhandler.cpp
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // (C) 2010 Underground Software
8 // JLH = James L. Hammons <jlhamm@acm.org>
11 // --- ---------- -----------------------------------------------------------
12 // JLH 05/10/2010 Added this text. :-)
15 #include "qg_actionhandler.h"
18 #include "rs_actionblocksadd.h"
19 #include "rs_actionblocksattributes.h"
20 #include "rs_actionblockscreate.h"
21 #include "rs_actionblocksedit.h"
22 #include "rs_actionblocksexplode.h"
23 #include "rs_actionblocksfreezeall.h"
24 #include "rs_actionblocksinsert.h"
25 #include "rs_actionblocksremove.h"
26 #include "rs_actionblockstoggleview.h"
27 #include "rs_actiondimaligned.h"
28 #include "rs_actiondimangular.h"
29 #include "rs_actiondimdiametric.h"
30 #include "rs_actiondimleader.h"
31 #include "rs_actiondimlinear.h"
32 #include "rs_actiondimradial.h"
33 #include "rs_actiondrawarc.h"
34 #include "rs_actiondrawarc3p.h"
35 #include "rs_actiondrawarctangential.h"
36 #include "rs_actiondrawcircle.h"
37 #include "rs_actiondrawcircle2p.h"
38 #include "rs_actiondrawcircle3p.h"
39 #include "rs_actiondrawcirclecr.h"
40 #include "rs_actiondrawellipseaxis.h"
41 #include "rs_actiondrawhatch.h"
42 #include "rs_actiondrawimage.h"
43 #include "rs_actiondrawline.h"
44 #include "rs_actiondrawlineangle.h"
45 #include "rs_actiondrawlinebisector.h"
46 #include "rs_actiondrawlinefree.h"
47 #include "rs_actiondrawlinehorvert.h"
48 #include "rs_actiondrawlineparallel.h"
49 #include "rs_actiondrawlineparallelthrough.h"
50 #include "rs_actiondrawlinepolygon.h"
51 #include "rs_actiondrawlinepolygon2.h"
52 #include "rs_actiondrawlinerectangle.h"
53 #include "rs_actiondrawlinerelangle.h"
54 #include "rs_actiondrawlinetangent1.h"
55 #include "rs_actiondrawlinetangent2.h"
56 #include "rs_actiondrawpoint.h"
57 #include "rs_actiondrawspline.h"
58 #include "rs_actiondrawtext.h"
59 #include "rs_actioneditcopy.h"
60 #include "rs_actioneditpaste.h"
61 #include "rs_actioneditundo.h"
62 #include "rs_actionfileopen.h"
63 #include "rs_actionfilesaveas.h"
64 #include "rs_actioninfoangle.h"
65 #include "rs_actioninfoarea.h"
66 #include "rs_actioninfodist.h"
67 #include "rs_actioninfodist2.h"
68 #include "rs_actioninfoinside.h"
69 #include "rs_actioninfototallength.h"
70 #include "rs_actionlayersadd.h"
71 #include "rs_actionlayersedit.h"
72 #include "rs_actionlayersfreezeall.h"
73 #include "rs_actionlayersremove.h"
74 #include "rs_actionlayerstogglelock.h"
75 #include "rs_actionlayerstoggleview.h"
76 #include "rs_actionlibraryinsert.h"
77 #include "rs_actionlockrelativezero.h"
78 #include "rs_actionmodifyattributes.h"
79 #include "rs_actionmodifybevel.h"
80 #include "rs_actionmodifycut.h"
81 #include "rs_actionmodifydelete.h"
82 #include "rs_actionmodifydeletefree.h"
83 #include "rs_actionmodifydeletequick.h"
84 #include "rs_actionmodifyentity.h"
85 #include "rs_actionmodifyexplodetext.h"
86 #include "rs_actionmodifymirror.h"
87 #include "rs_actionmodifymove.h"
88 #include "rs_actionmodifymoverotate.h"
89 #include "rs_actionmodifyrotate.h"
90 #include "rs_actionmodifyrotate2.h"
91 #include "rs_actionmodifyround.h"
92 #include "rs_actionmodifyscale.h"
93 #include "rs_actionmodifystretch.h"
94 #include "rs_actionmodifytrim.h"
95 #include "rs_actionmodifytrimamount.h"
96 #include "rs_actionoptionsdrawing.h"
97 #include "rs_actionselect.h"
98 #include "rs_actionselectall.h"
99 #include "rs_actionselectcontour.h"
100 #include "rs_actionselectintersected.h"
101 #include "rs_actionselectinvert.h"
102 #include "rs_actionselectlayer.h"
103 #include "rs_actionselectsingle.h"
104 #include "rs_actionselectwindow.h"
105 #include "rs_actionsetrelativezero.h"
106 #include "rs_actionsetsnapmode.h"
107 #include "rs_actionsetsnaprestriction.h"
108 #include "rs_actionsnapintersectionmanual.h"
109 #include "rs_actiontoolregeneratedimensions.h"
110 #include "rs_actionzoomauto.h"
111 #include "rs_actionzoomin.h"
112 #include "rs_actionzoompan.h"
113 #include "rs_actionzoomprevious.h"
114 #include "rs_actionzoomredraw.h"
115 #include "rs_actionzoomwindow.h"
117 #warning "!!! Need to add polyline functionality !!!"
119 #include "rs_actiondrawpolyline.h"
120 #include "rs_actionpolylineadd.h"
121 #include "rs_actionpolylineappend.h"
122 #include "rs_actionpolylinedel.h"
123 #include "rs_actionpolylinedelbetween.h"
124 #include "rs_actionpolylinetrim.h"
128 #include "rs_actioncamexportauto.h"
129 #include "rs_actioncamreorder.h"
132 #include "qg_mainwindowinterface.h"
133 #include "cadtoolbarsnap.h"
138 QG_ActionHandler::QG_ActionHandler(QG_MainWindowInterface * mw)
140 RS_DEBUG->print("QG_ActionHandler::QG_ActionHandler");
151 restrictNothing = NULL;
152 restrictOrthogonal = NULL;
153 restrictHorizontal = NULL;
154 restrictVertical = NULL;
156 lockRelativeZero = NULL;
157 RS_DEBUG->print("QG_ActionHandler::QG_ActionHandler: OK");
163 QG_ActionHandler::~QG_ActionHandler()
165 RS_DEBUG->print("QG_ActionHandler::~QG_ActionHandler");
166 RS_DEBUG->print("QG_ActionHandler::~QG_ActionHandler: OK");
170 * Kills all running selection actions. Called when a selection action
171 * is launched to reduce confusion.
173 void QG_ActionHandler::killSelectActions()
175 RS_GraphicView * gv = mainWindow->getGraphicView();
178 gv->killSelectActions();
182 * @return Current action or NULL.
184 RS_ActionInterface * QG_ActionHandler::getCurrentAction()
186 RS_GraphicView * gv = mainWindow->getGraphicView();
189 return gv->getCurrentAction();
195 Instead of the following giant switch statement, you could something like the following:
196 RS_ActionInterface * QG_ActionHandler::setCurrentAction(RS_ActionInterface * action)
198 RS_GraphicView * gv = mainWindow->getGraphicView();
199 RS_Document * doc = mainWindow->getDocument();
201 // only global options are allowed without a document:
202 if (gv == NULL || doc == NULL)
208 gv->setCurrentAction(action);
212 Then you'd call it with:
213 a = new RS_ActionEditUndo(true, *doc, *gv);
215 Hmmm.... We need gv & doc *before* we call this...
220 * Sets current action.
222 * @return Pointer to the created action or NULL.
224 RS_ActionInterface * QG_ActionHandler::setCurrentAction(RS2::ActionType id)
226 RS_DEBUG->print("QG_ActionHandler::setCurrentAction()");
228 RS_GraphicView * gv = mainWindow->getGraphicView();
229 RS_Document * doc = mainWindow->getDocument();
230 RS_ActionInterface * a = NULL;
232 // only global options are allowed without a document:
233 if (gv == NULL || doc == NULL)
235 RS_DEBUG->print(RS_Debug::D_WARNING,
236 "QG_ActionHandler::setCurrentAction: graphic view or document is NULL");
242 //case RS2::ActionFileNew:
243 // a = new RS_ActionFileNew(*doc, *gv);
245 //case RS2::ActionFileSave:
246 // a = new RS_ActionFileSave(*doc, *gv);
248 //case RS2::ActionFileClose:
249 // //a = new RS_ActionFileClose(*doc, *gv);
251 //case RS2::ActionFileQuit:
252 // //a = new RS_ActionFileQuit(*doc, *gv);
254 case RS2::ActionFileOpen:
255 a = new RS_ActionFileOpen(*doc, *gv);
257 case RS2::ActionFileSaveAs:
258 a = new RS_ActionFileSaveAs(*doc, *gv);
263 case RS2::ActionEditUndo:
264 a = new RS_ActionEditUndo(true, *doc, *gv);
266 case RS2::ActionEditRedo:
267 a = new RS_ActionEditUndo(false, *doc, *gv);
269 case RS2::ActionEditCut:
270 a = new RS_ActionSelect(*doc, *gv, RS2::ActionEditCutNoSelect);
272 case RS2::ActionEditCutNoSelect:
273 a = new RS_ActionEditCopy(false, *doc, *gv);
275 case RS2::ActionEditCopy:
276 a = new RS_ActionSelect(*doc, *gv, RS2::ActionEditCopyNoSelect);
278 case RS2::ActionEditCopyNoSelect:
279 a = new RS_ActionEditCopy(true, *doc, *gv);
281 case RS2::ActionEditPaste:
282 a = new RS_ActionEditPaste(*doc, *gv);
285 // Selecting actions:
287 case RS2::ActionSelectSingle:
288 gv->killSelectActions();
289 a = new RS_ActionSelectSingle(*doc, *gv);
291 case RS2::ActionSelectContour:
292 gv->killSelectActions();
293 a = new RS_ActionSelectContour(*doc, *gv);
295 case RS2::ActionSelectAll:
296 a = new RS_ActionSelectAll(*doc, *gv, true);
298 case RS2::ActionDeselectAll:
299 a = new RS_ActionSelectAll(*doc, *gv, false);
301 case RS2::ActionSelectWindow:
302 gv->killSelectActions();
303 a = new RS_ActionSelectWindow(*doc, *gv, true);
305 case RS2::ActionDeselectWindow:
306 gv->killSelectActions();
307 a = new RS_ActionSelectWindow(*doc, *gv, false);
309 case RS2::ActionSelectInvert:
310 a = new RS_ActionSelectInvert(*doc, *gv);
312 case RS2::ActionSelectIntersected:
313 gv->killSelectActions();
314 a = new RS_ActionSelectIntersected(*doc, *gv, true);
316 case RS2::ActionDeselectIntersected:
317 gv->killSelectActions();
318 a = new RS_ActionSelectIntersected(*doc, *gv, false);
320 case RS2::ActionSelectLayer:
321 gv->killSelectActions();
322 a = new RS_ActionSelectLayer(*doc, *gv);
327 case RS2::ActionToolRegenerateDimensions:
328 a = new RS_ActionToolRegenerateDimensions(*doc, *gv);
333 case RS2::ActionZoomIn:
334 a = new RS_ActionZoomIn(*doc, *gv, RS2::In, RS2::Both);
336 case RS2::ActionZoomOut:
337 a = new RS_ActionZoomIn(*doc, *gv, RS2::Out, RS2::Both);
339 case RS2::ActionZoomAuto:
340 a = new RS_ActionZoomAuto(*doc, *gv);
342 case RS2::ActionZoomWindow:
343 a = new RS_ActionZoomWindow(*doc, *gv);
345 case RS2::ActionZoomPan:
346 a = new RS_ActionZoomPan(*doc, *gv);
348 case RS2::ActionZoomPrevious:
349 a = new RS_ActionZoomPrevious(*doc, *gv);
351 case RS2::ActionZoomRedraw:
352 a = new RS_ActionZoomRedraw(*doc, *gv);
357 case RS2::ActionDrawPoint:
358 a = new RS_ActionDrawPoint(*doc, *gv);
360 case RS2::ActionDrawLine:
361 a = new RS_ActionDrawLine(*doc, *gv);
363 case RS2::ActionDrawLineAngle:
364 a = new RS_ActionDrawLineAngle(*doc, *gv, 0.0, false);
366 case RS2::ActionDrawLineHorizontal:
367 a = new RS_ActionDrawLineAngle(*doc, *gv, 0.0, true);
369 case RS2::ActionDrawLineHorVert:
370 a = new RS_ActionDrawLineHorVert(*doc, *gv);
372 case RS2::ActionDrawLineVertical:
373 a = new RS_ActionDrawLineAngle(*doc, *gv, M_PI/2.0, true);
375 case RS2::ActionDrawLineFree:
376 a = new RS_ActionDrawLineFree(*doc, *gv);
378 case RS2::ActionDrawLineParallel:
379 a = new RS_ActionDrawLineParallel(*doc, *gv);
381 case RS2::ActionDrawLineParallelThrough:
382 a = new RS_ActionDrawLineParallelThrough(*doc, *gv);
384 case RS2::ActionDrawLineRectangle:
385 a = new RS_ActionDrawLineRectangle(*doc, *gv);
387 case RS2::ActionDrawLineBisector:
388 a = new RS_ActionDrawLineBisector(*doc, *gv);
390 case RS2::ActionDrawLineTangent1:
391 a = new RS_ActionDrawLineTangent1(*doc, *gv);
393 case RS2::ActionDrawLineTangent2:
394 a = new RS_ActionDrawLineTangent2(*doc, *gv);
396 case RS2::ActionDrawLineOrthogonal:
397 a = new RS_ActionDrawLineRelAngle(*doc, *gv, M_PI / 2.0, true);
399 case RS2::ActionDrawLineRelAngle:
400 a = new RS_ActionDrawLineRelAngle(*doc, *gv, M_PI / 2.0, false);
402 #warning "!!! Need to add polyline functionality !!!"
404 case RS2::ActionDrawPolyline:
405 a = new RS_ActionDrawPolyline(*doc, *gv);
407 case RS2::ActionPolylineAdd:
408 a = new RS_ActionPolylineAdd(*doc, *gv);
410 case RS2::ActionPolylineAppend:
411 a = new RS_ActionPolylineAppend(*doc, *gv);
413 case RS2::ActionPolylineDel:
414 a = new RS_ActionPolylineDel(*doc, *gv);
416 case RS2::ActionPolylineDelBetween:
417 a = new RS_ActionPolylineDelBetween(*doc, *gv);
419 case RS2::ActionPolylineTrim:
420 a = new RS_ActionPolylineTrim(*doc, *gv);
423 case RS2::ActionDrawLinePolygon:
424 a = new RS_ActionDrawLinePolygon(*doc, *gv);
426 case RS2::ActionDrawLinePolygon2:
427 a = new RS_ActionDrawLinePolygon2(*doc, *gv);
429 case RS2::ActionDrawCircle:
430 a = new RS_ActionDrawCircle(*doc, *gv);
432 case RS2::ActionDrawCircleCR:
433 a = new RS_ActionDrawCircleCR(*doc, *gv);
435 case RS2::ActionDrawCircle2P:
436 a = new RS_ActionDrawCircle2P(*doc, *gv);
438 case RS2::ActionDrawCircle3P:
439 a = new RS_ActionDrawCircle3P(*doc, *gv);
441 case RS2::ActionDrawCircleParallel:
442 a = new RS_ActionDrawLineParallel(*doc, *gv);
444 case RS2::ActionDrawArc:
445 a = new RS_ActionDrawArc(*doc, *gv);
447 case RS2::ActionDrawArc3P:
448 a = new RS_ActionDrawArc3P(*doc, *gv);
450 case RS2::ActionDrawArcParallel:
451 a = new RS_ActionDrawLineParallel(*doc, *gv);
453 case RS2::ActionDrawArcTangential:
454 a = new RS_ActionDrawArcTangential(*doc, *gv);
456 case RS2::ActionDrawEllipseAxis:
457 a = new RS_ActionDrawEllipseAxis(*doc, *gv, false);
459 case RS2::ActionDrawEllipseArcAxis:
460 a = new RS_ActionDrawEllipseAxis(*doc, *gv, true);
462 case RS2::ActionDrawSpline:
463 a = new RS_ActionDrawSpline(*doc, *gv);
465 case RS2::ActionDrawText:
466 a = new RS_ActionDrawText(*doc, *gv);
468 case RS2::ActionDrawHatch:
469 a = new RS_ActionSelect(*doc, *gv, RS2::ActionDrawHatchNoSelect);
471 case RS2::ActionDrawHatchNoSelect:
472 a = new RS_ActionDrawHatch(*doc, *gv);
474 case RS2::ActionDrawImage:
475 a = new RS_ActionDrawImage(*doc, *gv);
478 // Dimensioning actions:
480 case RS2::ActionDimAligned:
481 a = new RS_ActionDimAligned(*doc, *gv);
483 case RS2::ActionDimLinear:
484 a = new RS_ActionDimLinear(*doc, *gv);
486 case RS2::ActionDimLinearHor:
487 a = new RS_ActionDimLinear(*doc, *gv, 0.0, true);
489 case RS2::ActionDimLinearVer:
490 a = new RS_ActionDimLinear(*doc, *gv, M_PI/2.0, true);
492 case RS2::ActionDimRadial:
493 a = new RS_ActionDimRadial(*doc, *gv);
495 case RS2::ActionDimDiametric:
496 a = new RS_ActionDimDiametric(*doc, *gv);
498 case RS2::ActionDimAngular:
499 a = new RS_ActionDimAngular(*doc, *gv);
501 case RS2::ActionDimLeader:
502 a = new RS_ActionDimLeader(*doc, *gv);
505 // Modifying actions:
507 case RS2::ActionModifyAttributes:
508 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyAttributesNoSelect);
510 case RS2::ActionModifyAttributesNoSelect:
511 a = new RS_ActionModifyAttributes(*doc, *gv);
513 case RS2::ActionModifyDelete:
514 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyDeleteNoSelect);
516 case RS2::ActionModifyDeleteNoSelect:
517 a = new RS_ActionModifyDelete(*doc, *gv);
519 case RS2::ActionModifyDeleteQuick:
520 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyDeleteQuick);
522 case RS2::ActionModifyDeleteFree:
523 a = new RS_ActionModifyDeleteFree(*doc, *gv);
525 case RS2::ActionModifyMove:
526 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyMoveNoSelect);
528 case RS2::ActionModifyMoveNoSelect:
529 a = new RS_ActionModifyMove(*doc, *gv);
531 case RS2::ActionModifyRotate:
532 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyRotateNoSelect);
534 case RS2::ActionModifyRotateNoSelect:
535 a = new RS_ActionModifyRotate(*doc, *gv);
537 case RS2::ActionModifyScale:
538 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyScaleNoSelect);
540 case RS2::ActionModifyScaleNoSelect:
541 a = new RS_ActionModifyScale(*doc, *gv);
543 case RS2::ActionModifyMirror:
544 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyMirrorNoSelect);
546 case RS2::ActionModifyMirrorNoSelect:
547 a = new RS_ActionModifyMirror(*doc, *gv);
549 case RS2::ActionModifyMoveRotate:
550 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyMoveRotateNoSelect);
552 case RS2::ActionModifyMoveRotateNoSelect:
553 a = new RS_ActionModifyMoveRotate(*doc, *gv);
555 case RS2::ActionModifyRotate2:
556 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyRotate2NoSelect);
558 case RS2::ActionModifyRotate2NoSelect:
559 a = new RS_ActionModifyRotate2(*doc, *gv);
561 case RS2::ActionModifyEntity:
562 a = new RS_ActionModifyEntity(*doc, *gv);
564 case RS2::ActionModifyTrim:
565 a = new RS_ActionModifyTrim(*doc, *gv, false);
567 case RS2::ActionModifyTrim2:
568 a = new RS_ActionModifyTrim(*doc, *gv, true);
570 case RS2::ActionModifyTrimAmount:
571 a = new RS_ActionModifyTrimAmount(*doc, *gv);
573 case RS2::ActionModifyCut:
574 a = new RS_ActionModifyCut(*doc, *gv);
576 case RS2::ActionModifyStretch:
577 a = new RS_ActionModifyStretch(*doc, *gv);
579 case RS2::ActionModifyBevel:
580 a = new RS_ActionModifyBevel(*doc, *gv);
582 case RS2::ActionModifyRound:
583 a = new RS_ActionModifyRound(*doc, *gv);
585 case RS2::ActionModifyExplodeText:
586 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyExplodeTextNoSelect);
588 case RS2::ActionModifyExplodeTextNoSelect:
589 a = new RS_ActionModifyExplodeText(*doc, *gv);
594 case RS2::ActionSnapFree:
595 a = new RS_ActionSetSnapMode(*doc, *gv, RS2::SnapFree);
597 case RS2::ActionSnapGrid:
598 a = new RS_ActionSetSnapMode(*doc, *gv, RS2::SnapGrid);
600 case RS2::ActionSnapEndpoint:
601 a = new RS_ActionSetSnapMode(*doc, *gv, RS2::SnapEndpoint);
603 case RS2::ActionSnapOnEntity:
604 a = new RS_ActionSetSnapMode(*doc, *gv, RS2::SnapOnEntity);
606 case RS2::ActionSnapCenter:
607 a = new RS_ActionSetSnapMode(*doc, *gv, RS2::SnapCenter);
609 case RS2::ActionSnapMiddle:
610 a = new RS_ActionSetSnapMode(*doc, *gv, RS2::SnapMiddle);
612 case RS2::ActionSnapDist:
613 a = new RS_ActionSetSnapMode(*doc, *gv, RS2::SnapDist);
615 case RS2::ActionSnapIntersection:
616 a = new RS_ActionSetSnapMode(*doc, *gv, RS2::SnapIntersection);
618 case RS2::ActionSnapIntersectionManual:
619 a = new RS_ActionSnapIntersectionManual(*doc, *gv);
622 // Snap restriction actions:
624 case RS2::ActionRestrictNothing:
625 a = new RS_ActionSetSnapRestriction(*doc, *gv, RS2::RestrictNothing);
627 case RS2::ActionRestrictOrthogonal:
628 a = new RS_ActionSetSnapRestriction(*doc, *gv,
629 RS2::RestrictOrthogonal);
631 case RS2::ActionRestrictHorizontal:
632 a = new RS_ActionSetSnapRestriction(*doc, *gv,
633 RS2::RestrictHorizontal);
635 case RS2::ActionRestrictVertical:
636 a = new RS_ActionSetSnapRestriction(*doc, *gv,
637 RS2::RestrictVertical);
642 case RS2::ActionSetRelativeZero:
643 a = new RS_ActionSetRelativeZero(*doc, *gv);
645 case RS2::ActionLockRelativeZero:
646 a = new RS_ActionLockRelativeZero(*doc, *gv, true);
648 case RS2::ActionUnlockRelativeZero:
649 a = new RS_ActionLockRelativeZero(*doc, *gv, false);
654 case RS2::ActionInfoInside:
655 a = new RS_ActionInfoInside(*doc, *gv);
657 case RS2::ActionInfoDist:
658 a = new RS_ActionInfoDist(*doc, *gv);
660 case RS2::ActionInfoDist2:
661 a = new RS_ActionInfoDist2(*doc, *gv);
663 case RS2::ActionInfoAngle:
664 a = new RS_ActionInfoAngle(*doc, *gv);
666 case RS2::ActionInfoTotalLength:
667 a = new RS_ActionSelect(*doc, *gv, RS2::ActionInfoTotalLengthNoSelect);
669 case RS2::ActionInfoTotalLengthNoSelect:
670 a = new RS_ActionInfoTotalLength(*doc, *gv);
672 case RS2::ActionInfoArea:
673 a = new RS_ActionInfoArea(*doc, *gv);
678 case RS2::ActionLayersDefreezeAll:
679 a = new RS_ActionLayersFreezeAll(false, *doc, *gv);
681 case RS2::ActionLayersFreezeAll:
682 a = new RS_ActionLayersFreezeAll(true, *doc, *gv);
684 case RS2::ActionLayersAdd:
685 a = new RS_ActionLayersAdd(*doc, *gv);
687 case RS2::ActionLayersRemove:
688 a = new RS_ActionLayersRemove(*doc, *gv);
690 case RS2::ActionLayersEdit:
691 a = new RS_ActionLayersEdit(*doc, *gv);
693 case RS2::ActionLayersToggleView:
694 a = new RS_ActionLayersToggleView(*doc, *gv);
696 case RS2::ActionLayersToggleLock:
697 a = new RS_ActionLayersToggleLock(*doc, *gv);
702 case RS2::ActionBlocksDefreezeAll:
703 a = new RS_ActionBlocksFreezeAll(false, *doc, *gv);
705 case RS2::ActionBlocksFreezeAll:
706 a = new RS_ActionBlocksFreezeAll(true, *doc, *gv);
708 case RS2::ActionBlocksAdd:
709 a = new RS_ActionBlocksAdd(*doc, *gv);
711 case RS2::ActionBlocksRemove:
712 a = new RS_ActionBlocksRemove(*doc, *gv);
714 case RS2::ActionBlocksAttributes:
715 a = new RS_ActionBlocksAttributes(*doc, *gv);
717 case RS2::ActionBlocksEdit:
718 a = new RS_ActionBlocksEdit(*doc, *gv);
720 case RS2::ActionBlocksInsert:
721 a = new RS_ActionBlocksInsert(*doc, *gv);
723 case RS2::ActionBlocksToggleView:
724 a = new RS_ActionBlocksToggleView(*doc, *gv);
726 case RS2::ActionBlocksCreate:
727 a = new RS_ActionSelect(*doc, *gv, RS2::ActionBlocksCreateNoSelect);
729 case RS2::ActionBlocksCreateNoSelect:
730 a = new RS_ActionBlocksCreate(*doc, *gv);
732 case RS2::ActionBlocksExplode:
733 a = new RS_ActionSelect(*doc, *gv, RS2::ActionBlocksExplodeNoSelect);
735 case RS2::ActionBlocksExplodeNoSelect:
736 a = new RS_ActionBlocksExplode(*doc, *gv);
742 case RS2::ActionLibraryInsert:
743 a = new RS_ActionLibraryInsert(*doc, *gv);
748 //case RS2::ActionOptionsGeneral:
749 // a = new RS_ActionOptionsGeneral(*doc, *gv);
752 case RS2::ActionOptionsDrawing:
753 a = new RS_ActionOptionsDrawing(*doc, *gv);
759 case RS2::ActionCamExportAuto:
760 a = new RS_ActionCamExportAuto(*doc, *gv);
762 case RS2::ActionCamReorder:
763 a = new RS_ActionCamReorder(*doc, *gv);
768 RS_DEBUG->print(RS_Debug::D_WARNING,
769 "QG_ActionHandler::setCurrentAction(): No such action found.");
774 gv->setCurrentAction(a);
776 RS_DEBUG->print("QG_ActionHandler::setCurrentAction(): OK");
782 * @return Available commands of the application or the current action.
784 QStringList QG_ActionHandler::getAvailableCommands()
786 RS_ActionInterface * currentAction = getCurrentAction();
788 if (currentAction != NULL)
789 return currentAction->getAvailableCommands();
800 * Launches the command represented by the given keycode if possible.
802 * @return true: the command was recognized.
803 * false: the command is not known and was probably intended for a
806 bool QG_ActionHandler::keycode(const QString & code)
808 QString c = code.toLower();
810 // pass keycode on to running action:
811 //RS_keycodeEvent e(cmd);
813 //RS_GraphicView* gv = mainWindow->getGraphicView();
815 // gv->keycodeEvent(&e);
818 // if the current action can't deal with the keycode,
819 // it might be intended to launch a new keycode
820 //if (!e.isAccepted()) {
821 // keycode for new action:
822 RS2::ActionType type = RS_COMMANDS->keycodeToAction(code);
823 if (type != RS2::ActionNone)
825 // some actions require special handling (GUI update):
828 case RS2::ActionSnapFree:
831 case RS2::ActionSnapGrid:
834 case RS2::ActionSnapEndpoint:
837 case RS2::ActionSnapOnEntity:
840 case RS2::ActionSnapCenter:
843 case RS2::ActionSnapMiddle:
846 case RS2::ActionSnapDist:
849 case RS2::ActionSnapIntersection:
850 slotSnapIntersection();
852 case RS2::ActionSnapIntersectionManual:
853 slotSnapIntersectionManual();
856 case RS2::ActionRestrictNothing:
857 slotRestrictNothing();
859 case RS2::ActionRestrictOrthogonal:
860 slotRestrictOrthogonal();
862 case RS2::ActionRestrictHorizontal:
863 slotRestrictHorizontal();
865 case RS2::ActionRestrictVertical:
866 slotRestrictVertical();
870 setCurrentAction(type);
881 * Launches the given command if possible.
883 * @return true: the command was recognized.
884 * false: the command is not known and was probably intended for a
887 bool QG_ActionHandler::command(const QString & cmd)
889 RS_DEBUG->print("QG_ActionHandler::command: %s", cmd.toLatin1().data());
890 QString c = cmd.toLower();
894 RS_GraphicView * gv = mainWindow->getGraphicView();
899 RS_DEBUG->print("QG_ActionHandler::command: back");
903 // pass command on to running action:
904 RS_CommandEvent e(cmd);
906 RS_GraphicView * gv = mainWindow->getGraphicView();
910 RS_DEBUG->print("QG_ActionHandler::command: trigger command event in graphic view");
911 gv->commandEvent(&e);
914 // if the current action can't deal with the command,
915 // it might be intended to launch a new command
918 RS_DEBUG->print("QG_ActionHandler::command: convert cmd to action type");
919 // command for new action:
920 RS2::ActionType type = RS_COMMANDS->cmdToAction(cmd);
922 if (type != RS2::ActionNone)
924 RS_DEBUG->print("QG_ActionHandler::command: setting current action");
925 setCurrentAction(type);
926 RS_DEBUG->print("QG_ActionHandler::command: current action set");
931 RS_DEBUG->print("QG_ActionHandler::command: current action not set");
935 //void QG_ActionHandler::slotFileNew() {
936 // setCurrentAction(RS2::ActionFileNew);
939 void QG_ActionHandler::slotFileOpen()
941 setCurrentAction(RS2::ActionFileOpen);
944 void QG_ActionHandler::slotFileSave() {
945 setCurrentAction(RS2::ActionFileSave);
949 void QG_ActionHandler::slotFileSaveAs()
951 setCurrentAction(RS2::ActionFileSaveAs);
955 void QG_ActionHandler::slotFileClose()
957 setCurrentAction(RS2::ActionFileClose);
960 void QG_ActionHandler::slotFilePrint()
962 setCurrentAction(RS2::ActionFilePrint);
966 void QG_ActionHandler::slotZoomIn()
968 setCurrentAction(RS2::ActionZoomIn);
971 void QG_ActionHandler::slotZoomOut()
973 setCurrentAction(RS2::ActionZoomOut);
976 void QG_ActionHandler::slotZoomAuto()
978 setCurrentAction(RS2::ActionZoomAuto);
981 void QG_ActionHandler::slotZoomWindow()
983 setCurrentAction(RS2::ActionZoomWindow);
986 void QG_ActionHandler::slotZoomPan()
988 setCurrentAction(RS2::ActionZoomPan);
991 void QG_ActionHandler::slotZoomPrevious()
993 setCurrentAction(RS2::ActionZoomPrevious);
996 void QG_ActionHandler::slotZoomRedraw()
998 setCurrentAction(RS2::ActionZoomRedraw);
1001 void QG_ActionHandler::slotToolRegenerateDimensions()
1003 setCurrentAction(RS2::ActionToolRegenerateDimensions);
1006 void QG_ActionHandler::slotEditUndo()
1008 setCurrentAction(RS2::ActionEditUndo);
1011 void QG_ActionHandler::slotEditRedo()
1013 setCurrentAction(RS2::ActionEditRedo);
1016 void QG_ActionHandler::slotEditCut()
1018 setCurrentAction(RS2::ActionEditCut);
1021 void QG_ActionHandler::slotEditCopy()
1023 setCurrentAction(RS2::ActionEditCopy);
1026 void QG_ActionHandler::slotEditPaste()
1028 setCurrentAction(RS2::ActionEditPaste);
1031 void QG_ActionHandler::slotSelectSingle()
1033 setCurrentAction(RS2::ActionSelectSingle);
1036 void QG_ActionHandler::slotSelectContour()
1038 setCurrentAction(RS2::ActionSelectContour);
1041 void QG_ActionHandler::slotSelectWindow()
1043 setCurrentAction(RS2::ActionSelectWindow);
1046 void QG_ActionHandler::slotDeselectWindow()
1048 setCurrentAction(RS2::ActionDeselectWindow);
1051 void QG_ActionHandler::slotSelectAll()
1053 setCurrentAction(RS2::ActionSelectAll);
1056 void QG_ActionHandler::slotDeselectAll()
1058 setCurrentAction(RS2::ActionDeselectAll);
1061 void QG_ActionHandler::slotSelectInvert()
1063 setCurrentAction(RS2::ActionSelectInvert);
1066 void QG_ActionHandler::slotSelectIntersected()
1068 setCurrentAction(RS2::ActionSelectIntersected);
1071 void QG_ActionHandler::slotDeselectIntersected()
1073 setCurrentAction(RS2::ActionDeselectIntersected);
1076 void QG_ActionHandler::slotSelectLayer()
1078 setCurrentAction(RS2::ActionSelectLayer);
1081 void QG_ActionHandler::slotDrawPoint()
1083 setCurrentAction(RS2::ActionDrawPoint);
1086 void QG_ActionHandler::slotDrawLine()
1088 setCurrentAction(RS2::ActionDrawLine);
1091 void QG_ActionHandler::slotDrawLineAngle()
1093 setCurrentAction(RS2::ActionDrawLineAngle);
1096 void QG_ActionHandler::slotDrawLineHorizontal()
1098 setCurrentAction(RS2::ActionDrawLineHorizontal);
1101 void QG_ActionHandler::slotDrawLineHorVert()
1103 setCurrentAction(RS2::ActionDrawLineHorVert);
1106 void QG_ActionHandler::slotDrawLineVertical()
1108 setCurrentAction(RS2::ActionDrawLineVertical);
1111 void QG_ActionHandler::slotDrawLineFree()
1113 setCurrentAction(RS2::ActionDrawLineFree);
1116 void QG_ActionHandler::slotDrawLineParallel()
1118 setCurrentAction(RS2::ActionDrawLineParallel);
1121 void QG_ActionHandler::slotDrawLineParallelThrough()
1123 setCurrentAction(RS2::ActionDrawLineParallelThrough);
1126 void QG_ActionHandler::slotDrawLineRectangle()
1128 setCurrentAction(RS2::ActionDrawLineRectangle);
1131 void QG_ActionHandler::slotDrawLineBisector()
1133 setCurrentAction(RS2::ActionDrawLineBisector);
1136 void QG_ActionHandler::slotDrawLineTangent1()
1138 setCurrentAction(RS2::ActionDrawLineTangent1);
1141 void QG_ActionHandler::slotDrawLineTangent2()
1143 setCurrentAction(RS2::ActionDrawLineTangent2);
1146 void QG_ActionHandler::slotDrawLineOrthogonal()
1148 setCurrentAction(RS2::ActionDrawLineOrthogonal);
1151 void QG_ActionHandler::slotDrawLineRelAngle()
1153 setCurrentAction(RS2::ActionDrawLineRelAngle);
1156 void QG_ActionHandler::slotDrawPolyline()
1158 setCurrentAction(RS2::ActionDrawPolyline);
1161 void QG_ActionHandler::slotPolylineAdd()
1163 setCurrentAction(RS2::ActionPolylineAdd);
1166 void QG_ActionHandler::slotPolylineAppend()
1168 setCurrentAction(RS2::ActionPolylineAppend);
1171 void QG_ActionHandler::slotPolylineDel()
1173 setCurrentAction(RS2::ActionPolylineDel);
1176 void QG_ActionHandler::slotPolylineDelBetween()
1178 setCurrentAction(RS2::ActionPolylineDelBetween);
1181 void QG_ActionHandler::slotPolylineTrim()
1183 setCurrentAction(RS2::ActionPolylineTrim);
1186 void QG_ActionHandler::slotDrawLinePolygon()
1188 setCurrentAction(RS2::ActionDrawLinePolygon);
1191 void QG_ActionHandler::slotDrawLinePolygon2()
1193 setCurrentAction(RS2::ActionDrawLinePolygon2);
1196 void QG_ActionHandler::slotDrawCircle()
1198 setCurrentAction(RS2::ActionDrawCircle);
1201 void QG_ActionHandler::slotDrawCircleCR()
1203 setCurrentAction(RS2::ActionDrawCircleCR);
1206 void QG_ActionHandler::slotDrawCircle2P()
1208 setCurrentAction(RS2::ActionDrawCircle2P);
1211 void QG_ActionHandler::slotDrawCircle3P()
1213 setCurrentAction(RS2::ActionDrawCircle3P);
1216 void QG_ActionHandler::slotDrawCircleParallel()
1218 setCurrentAction(RS2::ActionDrawCircleParallel);
1221 void QG_ActionHandler::slotDrawArc()
1223 setCurrentAction(RS2::ActionDrawArc);
1226 void QG_ActionHandler::slotDrawArc3P()
1228 setCurrentAction(RS2::ActionDrawArc3P);
1231 void QG_ActionHandler::slotDrawArcParallel()
1233 setCurrentAction(RS2::ActionDrawArcParallel);
1236 void QG_ActionHandler::slotDrawArcTangential()
1238 setCurrentAction(RS2::ActionDrawArcTangential);
1241 void QG_ActionHandler::slotDrawEllipseAxis()
1243 setCurrentAction(RS2::ActionDrawEllipseAxis);
1246 void QG_ActionHandler::slotDrawEllipseArcAxis()
1248 setCurrentAction(RS2::ActionDrawEllipseArcAxis);
1251 void QG_ActionHandler::slotDrawSpline()
1253 setCurrentAction(RS2::ActionDrawSpline);
1256 void QG_ActionHandler::slotDrawText()
1258 setCurrentAction(RS2::ActionDrawText);
1261 void QG_ActionHandler::slotDrawHatch()
1263 setCurrentAction(RS2::ActionDrawHatch);
1266 void QG_ActionHandler::slotDrawImage()
1268 setCurrentAction(RS2::ActionDrawImage);
1271 void QG_ActionHandler::slotDimAligned()
1273 setCurrentAction(RS2::ActionDimAligned);
1276 void QG_ActionHandler::slotDimLinear()
1278 setCurrentAction(RS2::ActionDimLinear);
1281 void QG_ActionHandler::slotDimLinearHor()
1283 setCurrentAction(RS2::ActionDimLinearHor);
1286 void QG_ActionHandler::slotDimLinearVer()
1288 setCurrentAction(RS2::ActionDimLinearVer);
1291 void QG_ActionHandler::slotDimRadial()
1293 setCurrentAction(RS2::ActionDimRadial);
1296 void QG_ActionHandler::slotDimDiametric()
1298 setCurrentAction(RS2::ActionDimDiametric);
1301 void QG_ActionHandler::slotDimAngular()
1303 setCurrentAction(RS2::ActionDimAngular);
1306 void QG_ActionHandler::slotDimLeader()
1308 setCurrentAction(RS2::ActionDimLeader);
1312 void QG_ActionHandler::slotModifyAttributes()
1314 setCurrentAction(RS2::ActionModifyAttributes);
1317 void QG_ActionHandler::slotModifyDelete()
1319 setCurrentAction(RS2::ActionModifyDelete);
1322 void QG_ActionHandler::slotModifyDeleteQuick()
1324 //setCurrentAction(RS2::ActionModifyDeleteQuick);
1325 setCurrentAction(RS2::ActionModifyDeleteNoSelect);
1328 void QG_ActionHandler::slotModifyDeleteFree()
1330 setCurrentAction(RS2::ActionModifyDeleteFree);
1333 void QG_ActionHandler::slotModifyMove()
1335 setCurrentAction(RS2::ActionModifyMove);
1338 void QG_ActionHandler::slotModifyRotate()
1340 setCurrentAction(RS2::ActionModifyRotate);
1343 void QG_ActionHandler::slotModifyScale()
1345 setCurrentAction(RS2::ActionModifyScale);
1348 void QG_ActionHandler::slotModifyStretch()
1350 setCurrentAction(RS2::ActionModifyStretch);
1353 void QG_ActionHandler::slotModifyBevel()
1355 setCurrentAction(RS2::ActionModifyBevel);
1358 void QG_ActionHandler::slotModifyRound()
1360 setCurrentAction(RS2::ActionModifyRound);
1363 void QG_ActionHandler::slotModifyMirror()
1365 setCurrentAction(RS2::ActionModifyMirror);
1368 void QG_ActionHandler::slotModifyMoveRotate()
1370 setCurrentAction(RS2::ActionModifyMoveRotate);
1373 void QG_ActionHandler::slotModifyRotate2()
1375 setCurrentAction(RS2::ActionModifyRotate2);
1378 void QG_ActionHandler::slotModifyEntity()
1380 setCurrentAction(RS2::ActionModifyEntity);
1383 void QG_ActionHandler::slotModifyTrim()
1385 setCurrentAction(RS2::ActionModifyTrim);
1388 void QG_ActionHandler::slotModifyTrim2()
1390 setCurrentAction(RS2::ActionModifyTrim2);
1393 void QG_ActionHandler::slotModifyTrimAmount()
1395 setCurrentAction(RS2::ActionModifyTrimAmount);
1398 void QG_ActionHandler::slotModifyCut()
1400 setCurrentAction(RS2::ActionModifyCut);
1403 void QG_ActionHandler::slotModifyExplodeText()
1405 setCurrentAction(RS2::ActionModifyExplodeText);
1409 void QG_ActionHandler::slotSnapFree()
1413 if (snapFree != NULL)
1414 snapFree->setChecked(true);
1416 if (cadToolBarSnap != NULL)
1417 cadToolBarSnap->setSnapMode(RS2::SnapFree);
1419 setCurrentAction(RS2::ActionSnapFree);
1422 void QG_ActionHandler::slotSnapGrid()
1426 if (snapGrid != NULL)
1427 snapGrid->setChecked(true);
1429 if (cadToolBarSnap != NULL)
1430 cadToolBarSnap->setSnapMode(RS2::SnapGrid);
1432 setCurrentAction(RS2::ActionSnapGrid);
1435 void QG_ActionHandler::slotSnapEndpoint()
1439 if (snapEndpoint != NULL)
1440 snapEndpoint->setChecked(true);
1442 if (cadToolBarSnap != NULL)
1443 cadToolBarSnap->setSnapMode(RS2::SnapEndpoint);
1445 setCurrentAction(RS2::ActionSnapEndpoint);
1448 void QG_ActionHandler::slotSnapOnEntity()
1451 if (snapOnEntity!=NULL) {
1452 snapOnEntity->setChecked(true);
1454 //#if QT_VERSION>=0x030000
1455 if (cadToolBarSnap!=NULL) {
1456 cadToolBarSnap->setSnapMode(RS2::SnapOnEntity);
1459 setCurrentAction(RS2::ActionSnapOnEntity);
1462 void QG_ActionHandler::slotSnapCenter()
1466 if (snapCenter != NULL)
1467 snapCenter->setChecked(true);
1469 //#if QT_VERSION>=0x030000
1470 if (cadToolBarSnap != NULL)
1471 cadToolBarSnap->setSnapMode(RS2::SnapCenter);
1474 setCurrentAction(RS2::ActionSnapCenter);
1477 void QG_ActionHandler::slotSnapMiddle()
1481 if (snapMiddle != NULL)
1482 snapMiddle->setChecked(true);
1484 //#if QT_VERSION>=0x030000
1485 if (cadToolBarSnap != NULL)
1486 cadToolBarSnap->setSnapMode(RS2::SnapMiddle);
1489 setCurrentAction(RS2::ActionSnapMiddle);
1492 void QG_ActionHandler::slotSnapDist()
1496 if (snapDist != NULL)
1497 snapDist->setChecked(true);
1499 //#if QT_VERSION>=0x030000
1500 if (cadToolBarSnap != NULL)
1501 cadToolBarSnap->setSnapMode(RS2::SnapDist);
1504 setCurrentAction(RS2::ActionSnapDist);
1507 void QG_ActionHandler::slotSnapIntersection()
1511 if (snapIntersection != NULL)
1512 snapIntersection->setChecked(true);
1514 //#if QT_VERSION>=0x030000
1515 if (cadToolBarSnap != NULL)
1516 cadToolBarSnap->setSnapMode(RS2::SnapIntersection);
1519 setCurrentAction(RS2::ActionSnapIntersection);
1522 void QG_ActionHandler::slotSnapIntersectionManual()
1525 /*if (snapIntersectionManual!=NULL) {
1526 snapIntersectionManual->setChecked(true);
1528 /*if (cadToolBarSnap!=NULL) {
1529 cadToolBarSnap->setSnapMode(RS2::SnapIntersectionManual);
1531 setCurrentAction(RS2::ActionSnapIntersectionManual);
1534 void QG_ActionHandler::disableSnaps()
1536 if (snapFree != NULL)
1537 snapFree->setChecked(false);
1539 if (snapGrid != NULL)
1540 snapGrid->setChecked(false);
1542 if (snapEndpoint != NULL)
1543 snapEndpoint->setChecked(false);
1545 if (snapOnEntity != NULL)
1546 snapOnEntity->setChecked(false);
1548 if (snapCenter != NULL)
1549 snapCenter->setChecked(false);
1551 if (snapMiddle != NULL)
1552 snapMiddle->setChecked(false);
1554 if (snapDist != NULL)
1555 snapDist->setChecked(false);
1557 if (snapIntersection != NULL)
1558 snapIntersection->setChecked(false);
1560 if (snapIntersectionManual != NULL)
1561 snapIntersectionManual->setChecked(false);
1563 if (cadToolBarSnap != NULL)
1564 cadToolBarSnap->disableSnaps();
1567 void QG_ActionHandler::slotRestrictNothing()
1569 disableRestrictions();
1571 if (restrictNothing != NULL)
1572 restrictNothing->setChecked(true);
1574 if (cadToolBarSnap != NULL)
1575 cadToolBarSnap->setSnapRestriction(RS2::RestrictNothing);
1577 setCurrentAction(RS2::ActionRestrictNothing);
1580 void QG_ActionHandler::slotRestrictOrthogonal()
1582 disableRestrictions();
1584 if (restrictOrthogonal != NULL)
1585 restrictOrthogonal->setChecked(true);
1587 if (cadToolBarSnap != NULL)
1588 cadToolBarSnap->setSnapRestriction(RS2::RestrictOrthogonal);
1590 setCurrentAction(RS2::ActionRestrictOrthogonal);
1593 void QG_ActionHandler::slotRestrictHorizontal()
1595 disableRestrictions();
1597 if (restrictHorizontal != NULL)
1598 restrictHorizontal->setChecked(true);
1600 if (cadToolBarSnap != NULL)
1601 cadToolBarSnap->setSnapRestriction(RS2::RestrictHorizontal);
1603 setCurrentAction(RS2::ActionRestrictHorizontal);
1606 void QG_ActionHandler::slotRestrictVertical()
1608 disableRestrictions();
1610 if (restrictVertical != NULL)
1611 restrictVertical->setChecked(true);
1613 if (cadToolBarSnap != NULL)
1614 cadToolBarSnap->setSnapRestriction(RS2::RestrictVertical);
1616 setCurrentAction(RS2::ActionRestrictVertical);
1619 void QG_ActionHandler::disableRestrictions()
1621 if (restrictNothing != NULL)
1622 restrictNothing->setChecked(false);
1624 if (restrictOrthogonal != NULL)
1625 restrictOrthogonal->setChecked(false);
1627 if (restrictHorizontal != NULL)
1628 restrictHorizontal->setChecked(false);
1630 if (restrictVertical != NULL)
1631 restrictVertical->setChecked(false);
1633 if (cadToolBarSnap != NULL)
1634 cadToolBarSnap->disableRestrictions();
1638 * Updates the snap mode for the current document from the selected menu.
1639 * Used after the active window changed.
1641 void QG_ActionHandler::updateSnapMode()
1643 if (snapFree != NULL && snapFree->isChecked())
1645 else if (snapGrid != NULL && snapGrid->isChecked())
1647 else if (snapEndpoint != NULL && snapEndpoint->isChecked())
1649 else if (snapOnEntity != NULL && snapOnEntity->isChecked())
1651 else if (snapCenter != NULL && snapCenter->isChecked())
1653 else if (snapMiddle != NULL && snapMiddle->isChecked())
1655 else if (snapDist != NULL && snapDist->isChecked())
1657 else if (snapIntersection != NULL && snapIntersection->isChecked())
1658 slotSnapIntersection();
1660 // snap restricitons:
1661 if (restrictNothing != NULL && restrictNothing->isChecked())
1662 slotRestrictNothing();
1663 else if (restrictOrthogonal != NULL && restrictOrthogonal->isChecked())
1664 slotRestrictOrthogonal();
1665 else if (restrictHorizontal != NULL && restrictHorizontal->isChecked())
1666 slotRestrictHorizontal();
1667 else if (restrictVertical != NULL && restrictVertical->isChecked())
1668 slotRestrictVertical();
1670 // lock of relative zero:
1671 if (lockRelativeZero != NULL)
1672 slotLockRelativeZero(lockRelativeZero->isChecked());
1675 void QG_ActionHandler::slotSetRelativeZero()
1677 setCurrentAction(RS2::ActionSetRelativeZero);
1680 void QG_ActionHandler::slotLockRelativeZero(bool on)
1682 if (lockRelativeZero != NULL)
1683 lockRelativeZero->setChecked(on);
1686 setCurrentAction(RS2::ActionLockRelativeZero);
1688 setCurrentAction(RS2::ActionUnlockRelativeZero);
1690 if (cadToolBarSnap != NULL)
1691 cadToolBarSnap->setLockRelativeZero(on);
1694 void QG_ActionHandler::slotInfoInside()
1696 setCurrentAction(RS2::ActionInfoInside);
1699 void QG_ActionHandler::slotInfoDist()
1701 setCurrentAction(RS2::ActionInfoDist);
1704 void QG_ActionHandler::slotInfoDist2()
1706 setCurrentAction(RS2::ActionInfoDist2);
1709 void QG_ActionHandler::slotInfoAngle()
1711 setCurrentAction(RS2::ActionInfoAngle);
1714 void QG_ActionHandler::slotInfoTotalLength()
1716 setCurrentAction(RS2::ActionInfoTotalLength);
1719 void QG_ActionHandler::slotInfoArea()
1721 setCurrentAction(RS2::ActionInfoArea);
1724 void QG_ActionHandler::slotLayersDefreezeAll()
1726 setCurrentAction(RS2::ActionLayersDefreezeAll);
1729 void QG_ActionHandler::slotLayersFreezeAll()
1731 setCurrentAction(RS2::ActionLayersFreezeAll);
1734 void QG_ActionHandler::slotLayersAdd()
1736 setCurrentAction(RS2::ActionLayersAdd);
1739 void QG_ActionHandler::slotLayersRemove()
1741 setCurrentAction(RS2::ActionLayersRemove);
1744 void QG_ActionHandler::slotLayersEdit()
1746 setCurrentAction(RS2::ActionLayersEdit);
1749 void QG_ActionHandler::slotLayersToggleView()
1751 setCurrentAction(RS2::ActionLayersToggleView);
1754 void QG_ActionHandler::slotLayersToggleLock()
1756 setCurrentAction(RS2::ActionLayersToggleLock);
1760 void QG_ActionHandler::slotBlocksDefreezeAll()
1762 setCurrentAction(RS2::ActionBlocksDefreezeAll);
1765 void QG_ActionHandler::slotBlocksFreezeAll()
1767 setCurrentAction(RS2::ActionBlocksFreezeAll);
1770 void QG_ActionHandler::slotBlocksAdd()
1772 setCurrentAction(RS2::ActionBlocksAdd);
1775 void QG_ActionHandler::slotBlocksRemove()
1777 setCurrentAction(RS2::ActionBlocksRemove);
1780 void QG_ActionHandler::slotBlocksAttributes()
1782 setCurrentAction(RS2::ActionBlocksAttributes);
1785 void QG_ActionHandler::slotBlocksEdit()
1787 setCurrentAction(RS2::ActionBlocksEdit);
1790 void QG_ActionHandler::slotBlocksInsert()
1792 setCurrentAction(RS2::ActionBlocksInsert);
1795 void QG_ActionHandler::slotBlocksToggleView()
1797 setCurrentAction(RS2::ActionBlocksToggleView);
1800 void QG_ActionHandler::slotBlocksCreate()
1802 setCurrentAction(RS2::ActionBlocksCreate);
1805 void QG_ActionHandler::slotBlocksExplode()
1807 setCurrentAction(RS2::ActionBlocksExplode);
1811 void QG_ActionHandler::slotOptionsDrawing()
1813 setCurrentAction(RS2::ActionOptionsDrawing);
1816 void QG_ActionHandler::slotCamExportAuto()
1819 setCurrentAction(RS2::ActionCamExportAuto);
1823 void QG_ActionHandler::slotCamReorder()
1826 setCurrentAction(RS2::ActionCamReorder);
1830 void QG_ActionHandler::slotFocusNormal()
1832 //QG_GraphicView* gv = mainWindow->getGraphicView();
1835 mainWindow->setFocus2();
1839 void QG_ActionHandler::setActionSnapFree(QAction * a)
1844 void QG_ActionHandler::setActionSnapGrid(QAction * a)
1849 void QG_ActionHandler::setActionSnapEndpoint(QAction * a)
1854 void QG_ActionHandler::setActionSnapOnEntity(QAction * a)
1859 void QG_ActionHandler::setActionSnapCenter(QAction * a)
1864 void QG_ActionHandler::setActionSnapMiddle(QAction * a)
1869 void QG_ActionHandler::setActionSnapDist(QAction * a)
1874 void QG_ActionHandler::setActionSnapIntersection(QAction * a)
1876 snapIntersection = a;
1879 void QG_ActionHandler::setActionSnapIntersectionManual(QAction * a)
1881 snapIntersectionManual = a;
1884 void QG_ActionHandler::setActionRestrictNothing(QAction * a)
1886 restrictNothing = a;
1889 void QG_ActionHandler::setActionRestrictOrthogonal(QAction * a)
1891 restrictOrthogonal = a;
1894 void QG_ActionHandler::setActionRestrictHorizontal(QAction * a)
1896 restrictHorizontal = a;
1899 void QG_ActionHandler::setActionRestrictVertical(QAction * a)
1901 restrictVertical = a;
1904 void QG_ActionHandler::setActionLockRelativeZero(QAction * a)
1906 lockRelativeZero = a;
1910 * Creates link to snap tool bar so we can update the button
1911 * state if the snapping action changes.
1913 void QG_ActionHandler::setCadToolBarSnap(CadToolBarSnap * tb)
1915 cadToolBarSnap = tb;