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...
217 What you'd do then is have the form of the thing worked ahead of time and the function
218 itself would create the gv & doc. So for the EditUndo, we'd have:
219 FunctionCreateAction(bool);
220 FunctionCreateAction(void);
222 Well... The problem is the action, they're all different...
226 * Sets current action.
228 * @return Pointer to the created action or NULL.
230 RS_ActionInterface * QG_ActionHandler::setCurrentAction(RS2::ActionType id)
232 RS_DEBUG->print("QG_ActionHandler::setCurrentAction()");
234 RS_GraphicView * gv = mainWindow->getGraphicView();
235 RS_Document * doc = mainWindow->getDocument();
236 RS_ActionInterface * a = NULL;
238 // only global options are allowed without a document:
239 if (gv == NULL || doc == NULL)
241 RS_DEBUG->print(RS_Debug::D_WARNING,
242 "QG_ActionHandler::setCurrentAction: graphic view or document is NULL");
248 //case RS2::ActionFileNew:
249 // a = new RS_ActionFileNew(*doc, *gv);
251 //case RS2::ActionFileSave:
252 // a = new RS_ActionFileSave(*doc, *gv);
254 //case RS2::ActionFileClose:
255 // //a = new RS_ActionFileClose(*doc, *gv);
257 //case RS2::ActionFileQuit:
258 // //a = new RS_ActionFileQuit(*doc, *gv);
260 case RS2::ActionFileOpen:
261 a = new RS_ActionFileOpen(*doc, *gv);
263 case RS2::ActionFileSaveAs:
264 a = new RS_ActionFileSaveAs(*doc, *gv);
269 case RS2::ActionEditUndo:
270 a = new RS_ActionEditUndo(true, *doc, *gv);
272 case RS2::ActionEditRedo:
273 a = new RS_ActionEditUndo(false, *doc, *gv);
275 case RS2::ActionEditCut:
276 a = new RS_ActionSelect(*doc, *gv, RS2::ActionEditCutNoSelect);
278 case RS2::ActionEditCutNoSelect:
279 a = new RS_ActionEditCopy(false, *doc, *gv);
281 case RS2::ActionEditCopy:
282 a = new RS_ActionSelect(*doc, *gv, RS2::ActionEditCopyNoSelect);
284 case RS2::ActionEditCopyNoSelect:
285 a = new RS_ActionEditCopy(true, *doc, *gv);
287 case RS2::ActionEditPaste:
288 a = new RS_ActionEditPaste(*doc, *gv);
291 // Selecting actions:
293 case RS2::ActionSelectSingle:
294 gv->killSelectActions();
295 a = new RS_ActionSelectSingle(*doc, *gv);
297 case RS2::ActionSelectContour:
298 gv->killSelectActions();
299 a = new RS_ActionSelectContour(*doc, *gv);
301 case RS2::ActionSelectAll:
302 a = new RS_ActionSelectAll(*doc, *gv, true);
304 case RS2::ActionDeselectAll:
305 a = new RS_ActionSelectAll(*doc, *gv, false);
307 case RS2::ActionSelectWindow:
308 gv->killSelectActions();
309 a = new RS_ActionSelectWindow(*doc, *gv, true);
311 case RS2::ActionDeselectWindow:
312 gv->killSelectActions();
313 a = new RS_ActionSelectWindow(*doc, *gv, false);
315 case RS2::ActionSelectInvert:
316 a = new RS_ActionSelectInvert(*doc, *gv);
318 case RS2::ActionSelectIntersected:
319 gv->killSelectActions();
320 a = new RS_ActionSelectIntersected(*doc, *gv, true);
322 case RS2::ActionDeselectIntersected:
323 gv->killSelectActions();
324 a = new RS_ActionSelectIntersected(*doc, *gv, false);
326 case RS2::ActionSelectLayer:
327 gv->killSelectActions();
328 a = new RS_ActionSelectLayer(*doc, *gv);
333 case RS2::ActionToolRegenerateDimensions:
334 a = new RS_ActionToolRegenerateDimensions(*doc, *gv);
339 case RS2::ActionZoomIn:
340 a = new RS_ActionZoomIn(*doc, *gv, RS2::In, RS2::Both);
342 case RS2::ActionZoomOut:
343 a = new RS_ActionZoomIn(*doc, *gv, RS2::Out, RS2::Both);
345 case RS2::ActionZoomAuto:
346 a = new RS_ActionZoomAuto(*doc, *gv);
348 case RS2::ActionZoomWindow:
349 a = new RS_ActionZoomWindow(*doc, *gv);
351 case RS2::ActionZoomPan:
352 a = new RS_ActionZoomPan(*doc, *gv);
354 case RS2::ActionZoomPrevious:
355 a = new RS_ActionZoomPrevious(*doc, *gv);
357 case RS2::ActionZoomRedraw:
358 a = new RS_ActionZoomRedraw(*doc, *gv);
363 case RS2::ActionDrawPoint:
364 a = new RS_ActionDrawPoint(*doc, *gv);
366 case RS2::ActionDrawLine:
367 a = new RS_ActionDrawLine(*doc, *gv);
369 case RS2::ActionDrawLineAngle:
370 a = new RS_ActionDrawLineAngle(*doc, *gv, 0.0, false);
372 case RS2::ActionDrawLineHorizontal:
373 a = new RS_ActionDrawLineAngle(*doc, *gv, 0.0, true);
375 case RS2::ActionDrawLineHorVert:
376 a = new RS_ActionDrawLineHorVert(*doc, *gv);
378 case RS2::ActionDrawLineVertical:
379 a = new RS_ActionDrawLineAngle(*doc, *gv, M_PI/2.0, true);
381 case RS2::ActionDrawLineFree:
382 a = new RS_ActionDrawLineFree(*doc, *gv);
384 case RS2::ActionDrawLineParallel:
385 a = new RS_ActionDrawLineParallel(*doc, *gv);
387 case RS2::ActionDrawLineParallelThrough:
388 a = new RS_ActionDrawLineParallelThrough(*doc, *gv);
390 case RS2::ActionDrawLineRectangle:
391 a = new RS_ActionDrawLineRectangle(*doc, *gv);
393 case RS2::ActionDrawLineBisector:
394 a = new RS_ActionDrawLineBisector(*doc, *gv);
396 case RS2::ActionDrawLineTangent1:
397 a = new RS_ActionDrawLineTangent1(*doc, *gv);
399 case RS2::ActionDrawLineTangent2:
400 a = new RS_ActionDrawLineTangent2(*doc, *gv);
402 case RS2::ActionDrawLineOrthogonal:
403 a = new RS_ActionDrawLineRelAngle(*doc, *gv, M_PI / 2.0, true);
405 case RS2::ActionDrawLineRelAngle:
406 a = new RS_ActionDrawLineRelAngle(*doc, *gv, M_PI / 2.0, false);
408 #warning "!!! Need to add polyline functionality !!!"
410 case RS2::ActionDrawPolyline:
411 a = new RS_ActionDrawPolyline(*doc, *gv);
413 case RS2::ActionPolylineAdd:
414 a = new RS_ActionPolylineAdd(*doc, *gv);
416 case RS2::ActionPolylineAppend:
417 a = new RS_ActionPolylineAppend(*doc, *gv);
419 case RS2::ActionPolylineDel:
420 a = new RS_ActionPolylineDel(*doc, *gv);
422 case RS2::ActionPolylineDelBetween:
423 a = new RS_ActionPolylineDelBetween(*doc, *gv);
425 case RS2::ActionPolylineTrim:
426 a = new RS_ActionPolylineTrim(*doc, *gv);
429 case RS2::ActionDrawLinePolygon:
430 a = new RS_ActionDrawLinePolygon(*doc, *gv);
432 case RS2::ActionDrawLinePolygon2:
433 a = new RS_ActionDrawLinePolygon2(*doc, *gv);
435 case RS2::ActionDrawCircle:
436 a = new RS_ActionDrawCircle(*doc, *gv);
438 case RS2::ActionDrawCircleCR:
439 a = new RS_ActionDrawCircleCR(*doc, *gv);
441 case RS2::ActionDrawCircle2P:
442 a = new RS_ActionDrawCircle2P(*doc, *gv);
444 case RS2::ActionDrawCircle3P:
445 a = new RS_ActionDrawCircle3P(*doc, *gv);
447 case RS2::ActionDrawCircleParallel:
448 a = new RS_ActionDrawLineParallel(*doc, *gv);
450 case RS2::ActionDrawArc:
451 a = new RS_ActionDrawArc(*doc, *gv);
453 case RS2::ActionDrawArc3P:
454 a = new RS_ActionDrawArc3P(*doc, *gv);
456 case RS2::ActionDrawArcParallel:
457 a = new RS_ActionDrawLineParallel(*doc, *gv);
459 case RS2::ActionDrawArcTangential:
460 a = new RS_ActionDrawArcTangential(*doc, *gv);
462 case RS2::ActionDrawEllipseAxis:
463 a = new RS_ActionDrawEllipseAxis(*doc, *gv, false);
465 case RS2::ActionDrawEllipseArcAxis:
466 a = new RS_ActionDrawEllipseAxis(*doc, *gv, true);
468 case RS2::ActionDrawSpline:
469 a = new RS_ActionDrawSpline(*doc, *gv);
471 case RS2::ActionDrawText:
472 a = new RS_ActionDrawText(*doc, *gv);
474 case RS2::ActionDrawHatch:
475 a = new RS_ActionSelect(*doc, *gv, RS2::ActionDrawHatchNoSelect);
477 case RS2::ActionDrawHatchNoSelect:
478 a = new RS_ActionDrawHatch(*doc, *gv);
480 case RS2::ActionDrawImage:
481 a = new RS_ActionDrawImage(*doc, *gv);
484 // Dimensioning actions:
486 case RS2::ActionDimAligned:
487 a = new RS_ActionDimAligned(*doc, *gv);
489 case RS2::ActionDimLinear:
490 a = new RS_ActionDimLinear(*doc, *gv);
492 case RS2::ActionDimLinearHor:
493 a = new RS_ActionDimLinear(*doc, *gv, 0.0, true);
495 case RS2::ActionDimLinearVer:
496 a = new RS_ActionDimLinear(*doc, *gv, M_PI/2.0, true);
498 case RS2::ActionDimRadial:
499 a = new RS_ActionDimRadial(*doc, *gv);
501 case RS2::ActionDimDiametric:
502 a = new RS_ActionDimDiametric(*doc, *gv);
504 case RS2::ActionDimAngular:
505 a = new RS_ActionDimAngular(*doc, *gv);
507 case RS2::ActionDimLeader:
508 a = new RS_ActionDimLeader(*doc, *gv);
511 // Modifying actions:
513 case RS2::ActionModifyAttributes:
514 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyAttributesNoSelect);
516 case RS2::ActionModifyAttributesNoSelect:
517 a = new RS_ActionModifyAttributes(*doc, *gv);
519 case RS2::ActionModifyDelete:
520 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyDeleteNoSelect);
522 case RS2::ActionModifyDeleteNoSelect:
523 a = new RS_ActionModifyDelete(*doc, *gv);
525 case RS2::ActionModifyDeleteQuick:
526 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyDeleteQuick);
528 case RS2::ActionModifyDeleteFree:
529 a = new RS_ActionModifyDeleteFree(*doc, *gv);
531 case RS2::ActionModifyMove:
532 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyMoveNoSelect);
534 case RS2::ActionModifyMoveNoSelect:
535 a = new RS_ActionModifyMove(*doc, *gv);
537 case RS2::ActionModifyRotate:
538 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyRotateNoSelect);
540 case RS2::ActionModifyRotateNoSelect:
541 a = new RS_ActionModifyRotate(*doc, *gv);
543 case RS2::ActionModifyScale:
544 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyScaleNoSelect);
546 case RS2::ActionModifyScaleNoSelect:
547 a = new RS_ActionModifyScale(*doc, *gv);
549 case RS2::ActionModifyMirror:
550 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyMirrorNoSelect);
552 case RS2::ActionModifyMirrorNoSelect:
553 a = new RS_ActionModifyMirror(*doc, *gv);
555 case RS2::ActionModifyMoveRotate:
556 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyMoveRotateNoSelect);
558 case RS2::ActionModifyMoveRotateNoSelect:
559 a = new RS_ActionModifyMoveRotate(*doc, *gv);
561 case RS2::ActionModifyRotate2:
562 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyRotate2NoSelect);
564 case RS2::ActionModifyRotate2NoSelect:
565 a = new RS_ActionModifyRotate2(*doc, *gv);
567 case RS2::ActionModifyEntity:
568 a = new RS_ActionModifyEntity(*doc, *gv);
570 case RS2::ActionModifyTrim:
571 a = new RS_ActionModifyTrim(*doc, *gv, false);
573 case RS2::ActionModifyTrim2:
574 a = new RS_ActionModifyTrim(*doc, *gv, true);
576 case RS2::ActionModifyTrimAmount:
577 a = new RS_ActionModifyTrimAmount(*doc, *gv);
579 case RS2::ActionModifyCut:
580 a = new RS_ActionModifyCut(*doc, *gv);
582 case RS2::ActionModifyStretch:
583 a = new RS_ActionModifyStretch(*doc, *gv);
585 case RS2::ActionModifyBevel:
586 a = new RS_ActionModifyBevel(*doc, *gv);
588 case RS2::ActionModifyRound:
589 a = new RS_ActionModifyRound(*doc, *gv);
591 case RS2::ActionModifyExplodeText:
592 a = new RS_ActionSelect(*doc, *gv, RS2::ActionModifyExplodeTextNoSelect);
594 case RS2::ActionModifyExplodeTextNoSelect:
595 a = new RS_ActionModifyExplodeText(*doc, *gv);
600 case RS2::ActionSnapFree:
601 a = new RS_ActionSetSnapMode(*doc, *gv, RS2::SnapFree);
603 case RS2::ActionSnapGrid:
604 a = new RS_ActionSetSnapMode(*doc, *gv, RS2::SnapGrid);
606 case RS2::ActionSnapEndpoint:
607 a = new RS_ActionSetSnapMode(*doc, *gv, RS2::SnapEndpoint);
609 case RS2::ActionSnapOnEntity:
610 a = new RS_ActionSetSnapMode(*doc, *gv, RS2::SnapOnEntity);
612 case RS2::ActionSnapCenter:
613 a = new RS_ActionSetSnapMode(*doc, *gv, RS2::SnapCenter);
615 case RS2::ActionSnapMiddle:
616 a = new RS_ActionSetSnapMode(*doc, *gv, RS2::SnapMiddle);
618 case RS2::ActionSnapDist:
619 a = new RS_ActionSetSnapMode(*doc, *gv, RS2::SnapDist);
621 case RS2::ActionSnapIntersection:
622 a = new RS_ActionSetSnapMode(*doc, *gv, RS2::SnapIntersection);
624 case RS2::ActionSnapIntersectionManual:
625 a = new RS_ActionSnapIntersectionManual(*doc, *gv);
628 // Snap restriction actions:
630 case RS2::ActionRestrictNothing:
631 a = new RS_ActionSetSnapRestriction(*doc, *gv, RS2::RestrictNothing);
633 case RS2::ActionRestrictOrthogonal:
634 a = new RS_ActionSetSnapRestriction(*doc, *gv,
635 RS2::RestrictOrthogonal);
637 case RS2::ActionRestrictHorizontal:
638 a = new RS_ActionSetSnapRestriction(*doc, *gv,
639 RS2::RestrictHorizontal);
641 case RS2::ActionRestrictVertical:
642 a = new RS_ActionSetSnapRestriction(*doc, *gv,
643 RS2::RestrictVertical);
648 case RS2::ActionSetRelativeZero:
649 a = new RS_ActionSetRelativeZero(*doc, *gv);
651 case RS2::ActionLockRelativeZero:
652 a = new RS_ActionLockRelativeZero(*doc, *gv, true);
654 case RS2::ActionUnlockRelativeZero:
655 a = new RS_ActionLockRelativeZero(*doc, *gv, false);
660 case RS2::ActionInfoInside:
661 a = new RS_ActionInfoInside(*doc, *gv);
663 case RS2::ActionInfoDist:
664 a = new RS_ActionInfoDist(*doc, *gv);
666 case RS2::ActionInfoDist2:
667 a = new RS_ActionInfoDist2(*doc, *gv);
669 case RS2::ActionInfoAngle:
670 a = new RS_ActionInfoAngle(*doc, *gv);
672 case RS2::ActionInfoTotalLength:
673 a = new RS_ActionSelect(*doc, *gv, RS2::ActionInfoTotalLengthNoSelect);
675 case RS2::ActionInfoTotalLengthNoSelect:
676 a = new RS_ActionInfoTotalLength(*doc, *gv);
678 case RS2::ActionInfoArea:
679 a = new RS_ActionInfoArea(*doc, *gv);
684 case RS2::ActionLayersDefreezeAll:
685 a = new RS_ActionLayersFreezeAll(false, *doc, *gv);
687 case RS2::ActionLayersFreezeAll:
688 a = new RS_ActionLayersFreezeAll(true, *doc, *gv);
690 case RS2::ActionLayersAdd:
691 a = new RS_ActionLayersAdd(*doc, *gv);
693 case RS2::ActionLayersRemove:
694 a = new RS_ActionLayersRemove(*doc, *gv);
696 case RS2::ActionLayersEdit:
697 a = new RS_ActionLayersEdit(*doc, *gv);
699 case RS2::ActionLayersToggleView:
700 a = new RS_ActionLayersToggleView(*doc, *gv);
702 case RS2::ActionLayersToggleLock:
703 a = new RS_ActionLayersToggleLock(*doc, *gv);
708 case RS2::ActionBlocksDefreezeAll:
709 a = new RS_ActionBlocksFreezeAll(false, *doc, *gv);
711 case RS2::ActionBlocksFreezeAll:
712 a = new RS_ActionBlocksFreezeAll(true, *doc, *gv);
714 case RS2::ActionBlocksAdd:
715 a = new RS_ActionBlocksAdd(*doc, *gv);
717 case RS2::ActionBlocksRemove:
718 a = new RS_ActionBlocksRemove(*doc, *gv);
720 case RS2::ActionBlocksAttributes:
721 a = new RS_ActionBlocksAttributes(*doc, *gv);
723 case RS2::ActionBlocksEdit:
724 a = new RS_ActionBlocksEdit(*doc, *gv);
726 case RS2::ActionBlocksInsert:
727 a = new RS_ActionBlocksInsert(*doc, *gv);
729 case RS2::ActionBlocksToggleView:
730 a = new RS_ActionBlocksToggleView(*doc, *gv);
732 case RS2::ActionBlocksCreate:
733 a = new RS_ActionSelect(*doc, *gv, RS2::ActionBlocksCreateNoSelect);
735 case RS2::ActionBlocksCreateNoSelect:
736 a = new RS_ActionBlocksCreate(*doc, *gv);
738 case RS2::ActionBlocksExplode:
739 a = new RS_ActionSelect(*doc, *gv, RS2::ActionBlocksExplodeNoSelect);
741 case RS2::ActionBlocksExplodeNoSelect:
742 a = new RS_ActionBlocksExplode(*doc, *gv);
748 case RS2::ActionLibraryInsert:
749 a = new RS_ActionLibraryInsert(*doc, *gv);
754 //case RS2::ActionOptionsGeneral:
755 // a = new RS_ActionOptionsGeneral(*doc, *gv);
758 case RS2::ActionOptionsDrawing:
759 a = new RS_ActionOptionsDrawing(*doc, *gv);
765 case RS2::ActionCamExportAuto:
766 a = new RS_ActionCamExportAuto(*doc, *gv);
768 case RS2::ActionCamReorder:
769 a = new RS_ActionCamReorder(*doc, *gv);
774 RS_DEBUG->print(RS_Debug::D_WARNING,
775 "QG_ActionHandler::setCurrentAction(): No such action found.");
780 gv->setCurrentAction(a);
782 RS_DEBUG->print("QG_ActionHandler::setCurrentAction(): OK");
788 * @return Available commands of the application or the current action.
790 QStringList QG_ActionHandler::getAvailableCommands()
792 RS_ActionInterface * currentAction = getCurrentAction();
794 if (currentAction != NULL)
795 return currentAction->getAvailableCommands();
806 * Launches the command represented by the given keycode if possible.
808 * @return true: the command was recognized.
809 * false: the command is not known and was probably intended for a
812 bool QG_ActionHandler::keycode(const QString & code)
814 QString c = code.toLower();
816 // pass keycode on to running action:
817 //RS_keycodeEvent e(cmd);
819 //RS_GraphicView* gv = mainWindow->getGraphicView();
821 // gv->keycodeEvent(&e);
824 // if the current action can't deal with the keycode,
825 // it might be intended to launch a new keycode
826 //if (!e.isAccepted()) {
827 // keycode for new action:
828 RS2::ActionType type = RS_COMMANDS->keycodeToAction(code);
829 if (type != RS2::ActionNone)
831 // some actions require special handling (GUI update):
834 case RS2::ActionSnapFree:
837 case RS2::ActionSnapGrid:
840 case RS2::ActionSnapEndpoint:
843 case RS2::ActionSnapOnEntity:
846 case RS2::ActionSnapCenter:
849 case RS2::ActionSnapMiddle:
852 case RS2::ActionSnapDist:
855 case RS2::ActionSnapIntersection:
856 slotSnapIntersection();
858 case RS2::ActionSnapIntersectionManual:
859 slotSnapIntersectionManual();
862 case RS2::ActionRestrictNothing:
863 slotRestrictNothing();
865 case RS2::ActionRestrictOrthogonal:
866 slotRestrictOrthogonal();
868 case RS2::ActionRestrictHorizontal:
869 slotRestrictHorizontal();
871 case RS2::ActionRestrictVertical:
872 slotRestrictVertical();
876 setCurrentAction(type);
887 * Launches the given command if possible.
889 * @return true: the command was recognized.
890 * false: the command is not known and was probably intended for a
893 bool QG_ActionHandler::command(const QString & cmd)
895 RS_DEBUG->print("QG_ActionHandler::command: %s", cmd.toLatin1().data());
896 QString c = cmd.toLower();
900 RS_GraphicView * gv = mainWindow->getGraphicView();
905 RS_DEBUG->print("QG_ActionHandler::command: back");
909 // pass command on to running action:
910 RS_CommandEvent e(cmd);
912 RS_GraphicView * gv = mainWindow->getGraphicView();
916 RS_DEBUG->print("QG_ActionHandler::command: trigger command event in graphic view");
917 gv->commandEvent(&e);
920 // if the current action can't deal with the command,
921 // it might be intended to launch a new command
924 RS_DEBUG->print("QG_ActionHandler::command: convert cmd to action type");
925 // command for new action:
926 RS2::ActionType type = RS_COMMANDS->cmdToAction(cmd);
928 if (type != RS2::ActionNone)
930 RS_DEBUG->print("QG_ActionHandler::command: setting current action");
931 setCurrentAction(type);
932 RS_DEBUG->print("QG_ActionHandler::command: current action set");
937 RS_DEBUG->print("QG_ActionHandler::command: current action not set");
941 //void QG_ActionHandler::slotFileNew() {
942 // setCurrentAction(RS2::ActionFileNew);
945 void QG_ActionHandler::slotFileOpen()
947 setCurrentAction(RS2::ActionFileOpen);
950 void QG_ActionHandler::slotFileSave() {
951 setCurrentAction(RS2::ActionFileSave);
955 void QG_ActionHandler::slotFileSaveAs()
957 setCurrentAction(RS2::ActionFileSaveAs);
961 void QG_ActionHandler::slotFileClose()
963 setCurrentAction(RS2::ActionFileClose);
966 void QG_ActionHandler::slotFilePrint()
968 setCurrentAction(RS2::ActionFilePrint);
972 void QG_ActionHandler::slotZoomIn()
974 setCurrentAction(RS2::ActionZoomIn);
977 void QG_ActionHandler::slotZoomOut()
979 setCurrentAction(RS2::ActionZoomOut);
982 void QG_ActionHandler::slotZoomAuto()
984 setCurrentAction(RS2::ActionZoomAuto);
987 void QG_ActionHandler::slotZoomWindow()
989 setCurrentAction(RS2::ActionZoomWindow);
992 void QG_ActionHandler::slotZoomPan()
994 setCurrentAction(RS2::ActionZoomPan);
997 void QG_ActionHandler::slotZoomPrevious()
999 setCurrentAction(RS2::ActionZoomPrevious);
1002 void QG_ActionHandler::slotZoomRedraw()
1004 setCurrentAction(RS2::ActionZoomRedraw);
1007 void QG_ActionHandler::slotToolRegenerateDimensions()
1009 setCurrentAction(RS2::ActionToolRegenerateDimensions);
1012 void QG_ActionHandler::slotEditUndo()
1014 setCurrentAction(RS2::ActionEditUndo);
1017 void QG_ActionHandler::slotEditRedo()
1019 setCurrentAction(RS2::ActionEditRedo);
1022 void QG_ActionHandler::slotEditCut()
1024 setCurrentAction(RS2::ActionEditCut);
1027 void QG_ActionHandler::slotEditCopy()
1029 setCurrentAction(RS2::ActionEditCopy);
1032 void QG_ActionHandler::slotEditPaste()
1034 setCurrentAction(RS2::ActionEditPaste);
1037 void QG_ActionHandler::slotSelectSingle()
1039 setCurrentAction(RS2::ActionSelectSingle);
1042 void QG_ActionHandler::slotSelectContour()
1044 setCurrentAction(RS2::ActionSelectContour);
1047 void QG_ActionHandler::slotSelectWindow()
1049 setCurrentAction(RS2::ActionSelectWindow);
1052 void QG_ActionHandler::slotDeselectWindow()
1054 setCurrentAction(RS2::ActionDeselectWindow);
1057 void QG_ActionHandler::slotSelectAll()
1059 setCurrentAction(RS2::ActionSelectAll);
1062 void QG_ActionHandler::slotDeselectAll()
1064 setCurrentAction(RS2::ActionDeselectAll);
1067 void QG_ActionHandler::slotSelectInvert()
1069 setCurrentAction(RS2::ActionSelectInvert);
1072 void QG_ActionHandler::slotSelectIntersected()
1074 setCurrentAction(RS2::ActionSelectIntersected);
1077 void QG_ActionHandler::slotDeselectIntersected()
1079 setCurrentAction(RS2::ActionDeselectIntersected);
1082 void QG_ActionHandler::slotSelectLayer()
1084 setCurrentAction(RS2::ActionSelectLayer);
1087 void QG_ActionHandler::slotDrawPoint()
1089 setCurrentAction(RS2::ActionDrawPoint);
1092 void QG_ActionHandler::slotDrawLine()
1094 setCurrentAction(RS2::ActionDrawLine);
1097 void QG_ActionHandler::slotDrawLineAngle()
1099 setCurrentAction(RS2::ActionDrawLineAngle);
1102 void QG_ActionHandler::slotDrawLineHorizontal()
1104 setCurrentAction(RS2::ActionDrawLineHorizontal);
1107 void QG_ActionHandler::slotDrawLineHorVert()
1109 setCurrentAction(RS2::ActionDrawLineHorVert);
1112 void QG_ActionHandler::slotDrawLineVertical()
1114 setCurrentAction(RS2::ActionDrawLineVertical);
1117 void QG_ActionHandler::slotDrawLineFree()
1119 setCurrentAction(RS2::ActionDrawLineFree);
1122 void QG_ActionHandler::slotDrawLineParallel()
1124 setCurrentAction(RS2::ActionDrawLineParallel);
1127 void QG_ActionHandler::slotDrawLineParallelThrough()
1129 setCurrentAction(RS2::ActionDrawLineParallelThrough);
1132 void QG_ActionHandler::slotDrawLineRectangle()
1134 setCurrentAction(RS2::ActionDrawLineRectangle);
1137 void QG_ActionHandler::slotDrawLineBisector()
1139 setCurrentAction(RS2::ActionDrawLineBisector);
1142 void QG_ActionHandler::slotDrawLineTangent1()
1144 setCurrentAction(RS2::ActionDrawLineTangent1);
1147 void QG_ActionHandler::slotDrawLineTangent2()
1149 setCurrentAction(RS2::ActionDrawLineTangent2);
1152 void QG_ActionHandler::slotDrawLineOrthogonal()
1154 setCurrentAction(RS2::ActionDrawLineOrthogonal);
1157 void QG_ActionHandler::slotDrawLineRelAngle()
1159 setCurrentAction(RS2::ActionDrawLineRelAngle);
1162 void QG_ActionHandler::slotDrawPolyline()
1164 setCurrentAction(RS2::ActionDrawPolyline);
1167 void QG_ActionHandler::slotPolylineAdd()
1169 setCurrentAction(RS2::ActionPolylineAdd);
1172 void QG_ActionHandler::slotPolylineAppend()
1174 setCurrentAction(RS2::ActionPolylineAppend);
1177 void QG_ActionHandler::slotPolylineDel()
1179 setCurrentAction(RS2::ActionPolylineDel);
1182 void QG_ActionHandler::slotPolylineDelBetween()
1184 setCurrentAction(RS2::ActionPolylineDelBetween);
1187 void QG_ActionHandler::slotPolylineTrim()
1189 setCurrentAction(RS2::ActionPolylineTrim);
1192 void QG_ActionHandler::slotDrawLinePolygon()
1194 setCurrentAction(RS2::ActionDrawLinePolygon);
1197 void QG_ActionHandler::slotDrawLinePolygon2()
1199 setCurrentAction(RS2::ActionDrawLinePolygon2);
1202 void QG_ActionHandler::slotDrawCircle()
1204 setCurrentAction(RS2::ActionDrawCircle);
1207 void QG_ActionHandler::slotDrawCircleCR()
1209 setCurrentAction(RS2::ActionDrawCircleCR);
1212 void QG_ActionHandler::slotDrawCircle2P()
1214 setCurrentAction(RS2::ActionDrawCircle2P);
1217 void QG_ActionHandler::slotDrawCircle3P()
1219 setCurrentAction(RS2::ActionDrawCircle3P);
1222 void QG_ActionHandler::slotDrawCircleParallel()
1224 setCurrentAction(RS2::ActionDrawCircleParallel);
1227 void QG_ActionHandler::slotDrawArc()
1229 setCurrentAction(RS2::ActionDrawArc);
1232 void QG_ActionHandler::slotDrawArc3P()
1234 setCurrentAction(RS2::ActionDrawArc3P);
1237 void QG_ActionHandler::slotDrawArcParallel()
1239 setCurrentAction(RS2::ActionDrawArcParallel);
1242 void QG_ActionHandler::slotDrawArcTangential()
1244 setCurrentAction(RS2::ActionDrawArcTangential);
1247 void QG_ActionHandler::slotDrawEllipseAxis()
1249 setCurrentAction(RS2::ActionDrawEllipseAxis);
1252 void QG_ActionHandler::slotDrawEllipseArcAxis()
1254 setCurrentAction(RS2::ActionDrawEllipseArcAxis);
1257 void QG_ActionHandler::slotDrawSpline()
1259 setCurrentAction(RS2::ActionDrawSpline);
1262 void QG_ActionHandler::slotDrawText()
1264 setCurrentAction(RS2::ActionDrawText);
1267 void QG_ActionHandler::slotDrawHatch()
1269 setCurrentAction(RS2::ActionDrawHatch);
1272 void QG_ActionHandler::slotDrawImage()
1274 setCurrentAction(RS2::ActionDrawImage);
1277 void QG_ActionHandler::slotDimAligned()
1279 setCurrentAction(RS2::ActionDimAligned);
1282 void QG_ActionHandler::slotDimLinear()
1284 setCurrentAction(RS2::ActionDimLinear);
1287 void QG_ActionHandler::slotDimLinearHor()
1289 setCurrentAction(RS2::ActionDimLinearHor);
1292 void QG_ActionHandler::slotDimLinearVer()
1294 setCurrentAction(RS2::ActionDimLinearVer);
1297 void QG_ActionHandler::slotDimRadial()
1299 setCurrentAction(RS2::ActionDimRadial);
1302 void QG_ActionHandler::slotDimDiametric()
1304 setCurrentAction(RS2::ActionDimDiametric);
1307 void QG_ActionHandler::slotDimAngular()
1309 setCurrentAction(RS2::ActionDimAngular);
1312 void QG_ActionHandler::slotDimLeader()
1314 setCurrentAction(RS2::ActionDimLeader);
1318 void QG_ActionHandler::slotModifyAttributes()
1320 setCurrentAction(RS2::ActionModifyAttributes);
1323 void QG_ActionHandler::slotModifyDelete()
1325 setCurrentAction(RS2::ActionModifyDelete);
1328 void QG_ActionHandler::slotModifyDeleteQuick()
1330 //setCurrentAction(RS2::ActionModifyDeleteQuick);
1331 setCurrentAction(RS2::ActionModifyDeleteNoSelect);
1334 void QG_ActionHandler::slotModifyDeleteFree()
1336 setCurrentAction(RS2::ActionModifyDeleteFree);
1339 void QG_ActionHandler::slotModifyMove()
1341 setCurrentAction(RS2::ActionModifyMove);
1344 void QG_ActionHandler::slotModifyRotate()
1346 setCurrentAction(RS2::ActionModifyRotate);
1349 void QG_ActionHandler::slotModifyScale()
1351 setCurrentAction(RS2::ActionModifyScale);
1354 void QG_ActionHandler::slotModifyStretch()
1356 setCurrentAction(RS2::ActionModifyStretch);
1359 void QG_ActionHandler::slotModifyBevel()
1361 setCurrentAction(RS2::ActionModifyBevel);
1364 void QG_ActionHandler::slotModifyRound()
1366 setCurrentAction(RS2::ActionModifyRound);
1369 void QG_ActionHandler::slotModifyMirror()
1371 setCurrentAction(RS2::ActionModifyMirror);
1374 void QG_ActionHandler::slotModifyMoveRotate()
1376 setCurrentAction(RS2::ActionModifyMoveRotate);
1379 void QG_ActionHandler::slotModifyRotate2()
1381 setCurrentAction(RS2::ActionModifyRotate2);
1384 void QG_ActionHandler::slotModifyEntity()
1386 setCurrentAction(RS2::ActionModifyEntity);
1389 void QG_ActionHandler::slotModifyTrim()
1391 setCurrentAction(RS2::ActionModifyTrim);
1394 void QG_ActionHandler::slotModifyTrim2()
1396 setCurrentAction(RS2::ActionModifyTrim2);
1399 void QG_ActionHandler::slotModifyTrimAmount()
1401 setCurrentAction(RS2::ActionModifyTrimAmount);
1404 void QG_ActionHandler::slotModifyCut()
1406 setCurrentAction(RS2::ActionModifyCut);
1409 void QG_ActionHandler::slotModifyExplodeText()
1411 setCurrentAction(RS2::ActionModifyExplodeText);
1415 void QG_ActionHandler::slotSnapFree()
1419 if (snapFree != NULL)
1420 snapFree->setChecked(true);
1422 if (cadToolBarSnap != NULL)
1423 cadToolBarSnap->setSnapMode(RS2::SnapFree);
1425 setCurrentAction(RS2::ActionSnapFree);
1428 void QG_ActionHandler::slotSnapGrid()
1432 if (snapGrid != NULL)
1433 snapGrid->setChecked(true);
1435 if (cadToolBarSnap != NULL)
1436 cadToolBarSnap->setSnapMode(RS2::SnapGrid);
1438 setCurrentAction(RS2::ActionSnapGrid);
1441 void QG_ActionHandler::slotSnapEndpoint()
1445 if (snapEndpoint != NULL)
1446 snapEndpoint->setChecked(true);
1448 if (cadToolBarSnap != NULL)
1449 cadToolBarSnap->setSnapMode(RS2::SnapEndpoint);
1451 setCurrentAction(RS2::ActionSnapEndpoint);
1454 void QG_ActionHandler::slotSnapOnEntity()
1457 if (snapOnEntity!=NULL) {
1458 snapOnEntity->setChecked(true);
1460 //#if QT_VERSION>=0x030000
1461 if (cadToolBarSnap!=NULL) {
1462 cadToolBarSnap->setSnapMode(RS2::SnapOnEntity);
1465 setCurrentAction(RS2::ActionSnapOnEntity);
1468 void QG_ActionHandler::slotSnapCenter()
1472 if (snapCenter != NULL)
1473 snapCenter->setChecked(true);
1475 //#if QT_VERSION>=0x030000
1476 if (cadToolBarSnap != NULL)
1477 cadToolBarSnap->setSnapMode(RS2::SnapCenter);
1480 setCurrentAction(RS2::ActionSnapCenter);
1483 void QG_ActionHandler::slotSnapMiddle()
1487 if (snapMiddle != NULL)
1488 snapMiddle->setChecked(true);
1490 //#if QT_VERSION>=0x030000
1491 if (cadToolBarSnap != NULL)
1492 cadToolBarSnap->setSnapMode(RS2::SnapMiddle);
1495 setCurrentAction(RS2::ActionSnapMiddle);
1498 void QG_ActionHandler::slotSnapDist()
1502 if (snapDist != NULL)
1503 snapDist->setChecked(true);
1505 //#if QT_VERSION>=0x030000
1506 if (cadToolBarSnap != NULL)
1507 cadToolBarSnap->setSnapMode(RS2::SnapDist);
1510 setCurrentAction(RS2::ActionSnapDist);
1513 void QG_ActionHandler::slotSnapIntersection()
1517 if (snapIntersection != NULL)
1518 snapIntersection->setChecked(true);
1520 //#if QT_VERSION>=0x030000
1521 if (cadToolBarSnap != NULL)
1522 cadToolBarSnap->setSnapMode(RS2::SnapIntersection);
1525 setCurrentAction(RS2::ActionSnapIntersection);
1528 void QG_ActionHandler::slotSnapIntersectionManual()
1531 /*if (snapIntersectionManual!=NULL) {
1532 snapIntersectionManual->setChecked(true);
1534 /*if (cadToolBarSnap!=NULL) {
1535 cadToolBarSnap->setSnapMode(RS2::SnapIntersectionManual);
1537 setCurrentAction(RS2::ActionSnapIntersectionManual);
1540 void QG_ActionHandler::disableSnaps()
1542 if (snapFree != NULL)
1543 snapFree->setChecked(false);
1545 if (snapGrid != NULL)
1546 snapGrid->setChecked(false);
1548 if (snapEndpoint != NULL)
1549 snapEndpoint->setChecked(false);
1551 if (snapOnEntity != NULL)
1552 snapOnEntity->setChecked(false);
1554 if (snapCenter != NULL)
1555 snapCenter->setChecked(false);
1557 if (snapMiddle != NULL)
1558 snapMiddle->setChecked(false);
1560 if (snapDist != NULL)
1561 snapDist->setChecked(false);
1563 if (snapIntersection != NULL)
1564 snapIntersection->setChecked(false);
1566 if (snapIntersectionManual != NULL)
1567 snapIntersectionManual->setChecked(false);
1569 if (cadToolBarSnap != NULL)
1570 cadToolBarSnap->disableSnaps();
1573 void QG_ActionHandler::slotRestrictNothing()
1575 disableRestrictions();
1577 if (restrictNothing != NULL)
1578 restrictNothing->setChecked(true);
1580 if (cadToolBarSnap != NULL)
1581 cadToolBarSnap->setSnapRestriction(RS2::RestrictNothing);
1583 setCurrentAction(RS2::ActionRestrictNothing);
1586 void QG_ActionHandler::slotRestrictOrthogonal()
1588 disableRestrictions();
1590 if (restrictOrthogonal != NULL)
1591 restrictOrthogonal->setChecked(true);
1593 if (cadToolBarSnap != NULL)
1594 cadToolBarSnap->setSnapRestriction(RS2::RestrictOrthogonal);
1596 setCurrentAction(RS2::ActionRestrictOrthogonal);
1599 void QG_ActionHandler::slotRestrictHorizontal()
1601 disableRestrictions();
1603 if (restrictHorizontal != NULL)
1604 restrictHorizontal->setChecked(true);
1606 if (cadToolBarSnap != NULL)
1607 cadToolBarSnap->setSnapRestriction(RS2::RestrictHorizontal);
1609 setCurrentAction(RS2::ActionRestrictHorizontal);
1612 void QG_ActionHandler::slotRestrictVertical()
1614 disableRestrictions();
1616 if (restrictVertical != NULL)
1617 restrictVertical->setChecked(true);
1619 if (cadToolBarSnap != NULL)
1620 cadToolBarSnap->setSnapRestriction(RS2::RestrictVertical);
1622 setCurrentAction(RS2::ActionRestrictVertical);
1625 void QG_ActionHandler::disableRestrictions()
1627 if (restrictNothing != NULL)
1628 restrictNothing->setChecked(false);
1630 if (restrictOrthogonal != NULL)
1631 restrictOrthogonal->setChecked(false);
1633 if (restrictHorizontal != NULL)
1634 restrictHorizontal->setChecked(false);
1636 if (restrictVertical != NULL)
1637 restrictVertical->setChecked(false);
1639 if (cadToolBarSnap != NULL)
1640 cadToolBarSnap->disableRestrictions();
1644 * Updates the snap mode for the current document from the selected menu.
1645 * Used after the active window changed.
1647 void QG_ActionHandler::updateSnapMode()
1649 if (snapFree != NULL && snapFree->isChecked())
1651 else if (snapGrid != NULL && snapGrid->isChecked())
1653 else if (snapEndpoint != NULL && snapEndpoint->isChecked())
1655 else if (snapOnEntity != NULL && snapOnEntity->isChecked())
1657 else if (snapCenter != NULL && snapCenter->isChecked())
1659 else if (snapMiddle != NULL && snapMiddle->isChecked())
1661 else if (snapDist != NULL && snapDist->isChecked())
1663 else if (snapIntersection != NULL && snapIntersection->isChecked())
1664 slotSnapIntersection();
1666 // snap restricitons:
1667 if (restrictNothing != NULL && restrictNothing->isChecked())
1668 slotRestrictNothing();
1669 else if (restrictOrthogonal != NULL && restrictOrthogonal->isChecked())
1670 slotRestrictOrthogonal();
1671 else if (restrictHorizontal != NULL && restrictHorizontal->isChecked())
1672 slotRestrictHorizontal();
1673 else if (restrictVertical != NULL && restrictVertical->isChecked())
1674 slotRestrictVertical();
1676 // lock of relative zero:
1677 if (lockRelativeZero != NULL)
1678 slotLockRelativeZero(lockRelativeZero->isChecked());
1681 void QG_ActionHandler::slotSetRelativeZero()
1683 setCurrentAction(RS2::ActionSetRelativeZero);
1686 void QG_ActionHandler::slotLockRelativeZero(bool on)
1688 if (lockRelativeZero != NULL)
1689 lockRelativeZero->setChecked(on);
1692 setCurrentAction(RS2::ActionLockRelativeZero);
1694 setCurrentAction(RS2::ActionUnlockRelativeZero);
1696 if (cadToolBarSnap != NULL)
1697 cadToolBarSnap->setLockRelativeZero(on);
1700 void QG_ActionHandler::slotInfoInside()
1702 setCurrentAction(RS2::ActionInfoInside);
1705 void QG_ActionHandler::slotInfoDist()
1707 setCurrentAction(RS2::ActionInfoDist);
1710 void QG_ActionHandler::slotInfoDist2()
1712 setCurrentAction(RS2::ActionInfoDist2);
1715 void QG_ActionHandler::slotInfoAngle()
1717 setCurrentAction(RS2::ActionInfoAngle);
1720 void QG_ActionHandler::slotInfoTotalLength()
1722 setCurrentAction(RS2::ActionInfoTotalLength);
1725 void QG_ActionHandler::slotInfoArea()
1727 setCurrentAction(RS2::ActionInfoArea);
1730 void QG_ActionHandler::slotLayersDefreezeAll()
1732 setCurrentAction(RS2::ActionLayersDefreezeAll);
1735 void QG_ActionHandler::slotLayersFreezeAll()
1737 setCurrentAction(RS2::ActionLayersFreezeAll);
1740 void QG_ActionHandler::slotLayersAdd()
1742 setCurrentAction(RS2::ActionLayersAdd);
1745 void QG_ActionHandler::slotLayersRemove()
1747 setCurrentAction(RS2::ActionLayersRemove);
1750 void QG_ActionHandler::slotLayersEdit()
1752 setCurrentAction(RS2::ActionLayersEdit);
1755 void QG_ActionHandler::slotLayersToggleView()
1757 setCurrentAction(RS2::ActionLayersToggleView);
1760 void QG_ActionHandler::slotLayersToggleLock()
1762 setCurrentAction(RS2::ActionLayersToggleLock);
1766 void QG_ActionHandler::slotBlocksDefreezeAll()
1768 setCurrentAction(RS2::ActionBlocksDefreezeAll);
1771 void QG_ActionHandler::slotBlocksFreezeAll()
1773 setCurrentAction(RS2::ActionBlocksFreezeAll);
1776 void QG_ActionHandler::slotBlocksAdd()
1778 setCurrentAction(RS2::ActionBlocksAdd);
1781 void QG_ActionHandler::slotBlocksRemove()
1783 setCurrentAction(RS2::ActionBlocksRemove);
1786 void QG_ActionHandler::slotBlocksAttributes()
1788 setCurrentAction(RS2::ActionBlocksAttributes);
1791 void QG_ActionHandler::slotBlocksEdit()
1793 setCurrentAction(RS2::ActionBlocksEdit);
1796 void QG_ActionHandler::slotBlocksInsert()
1798 setCurrentAction(RS2::ActionBlocksInsert);
1801 void QG_ActionHandler::slotBlocksToggleView()
1803 setCurrentAction(RS2::ActionBlocksToggleView);
1806 void QG_ActionHandler::slotBlocksCreate()
1808 setCurrentAction(RS2::ActionBlocksCreate);
1811 void QG_ActionHandler::slotBlocksExplode()
1813 setCurrentAction(RS2::ActionBlocksExplode);
1817 void QG_ActionHandler::slotOptionsDrawing()
1819 setCurrentAction(RS2::ActionOptionsDrawing);
1822 void QG_ActionHandler::slotCamExportAuto()
1825 setCurrentAction(RS2::ActionCamExportAuto);
1829 void QG_ActionHandler::slotCamReorder()
1832 setCurrentAction(RS2::ActionCamReorder);
1836 void QG_ActionHandler::slotFocusNormal()
1838 //QG_GraphicView* gv = mainWindow->getGraphicView();
1841 mainWindow->setFocus2();
1845 void QG_ActionHandler::setActionSnapFree(QAction * a)
1850 void QG_ActionHandler::setActionSnapGrid(QAction * a)
1855 void QG_ActionHandler::setActionSnapEndpoint(QAction * a)
1860 void QG_ActionHandler::setActionSnapOnEntity(QAction * a)
1865 void QG_ActionHandler::setActionSnapCenter(QAction * a)
1870 void QG_ActionHandler::setActionSnapMiddle(QAction * a)
1875 void QG_ActionHandler::setActionSnapDist(QAction * a)
1880 void QG_ActionHandler::setActionSnapIntersection(QAction * a)
1882 snapIntersection = a;
1885 void QG_ActionHandler::setActionSnapIntersectionManual(QAction * a)
1887 snapIntersectionManual = a;
1890 void QG_ActionHandler::setActionRestrictNothing(QAction * a)
1892 restrictNothing = a;
1895 void QG_ActionHandler::setActionRestrictOrthogonal(QAction * a)
1897 restrictOrthogonal = a;
1900 void QG_ActionHandler::setActionRestrictHorizontal(QAction * a)
1902 restrictHorizontal = a;
1905 void QG_ActionHandler::setActionRestrictVertical(QAction * a)
1907 restrictVertical = a;
1910 void QG_ActionHandler::setActionLockRelativeZero(QAction * a)
1912 lockRelativeZero = a;
1916 * Creates link to snap tool bar so we can update the button
1917 * state if the snapping action changes.
1919 void QG_ActionHandler::setCadToolBarSnap(CadToolBarSnap * tb)
1921 cadToolBarSnap = tb;