1 // qg_actionfactory.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/21/2010 Added this text. :-)
15 #include "qg_actionfactory.h"
17 #include "rs_actionblockscreate.h"
18 #include "rs_actionblocksfreezeall.h"
19 #include "rs_actionblocksadd.h"
20 #include "rs_actionblocksremove.h"
21 #include "rs_actionblocksattributes.h"
22 #include "rs_actionblocksedit.h"
23 #include "rs_actionblocksinsert.h"
24 #include "rs_actionblockstoggleview.h"
25 #include "rs_actionblocksexplode.h"
26 #include "rs_actiondimaligned.h"
27 #include "rs_actiondimangular.h"
28 #include "rs_actiondimdiametric.h"
29 #include "rs_actiondimleader.h"
30 #include "rs_actiondimlinear.h"
31 #include "rs_actiondimradial.h"
32 #include "rs_actiondrawarc.h"
33 #include "rs_actiondrawarc3p.h"
34 #include "rs_actiondrawcircle.h"
35 #include "rs_actiondrawcircle2p.h"
36 #include "rs_actiondrawcircle3p.h"
37 #include "rs_actiondrawcirclecr.h"
38 #include "rs_actiondrawellipseaxis.h"
39 #include "rs_actiondrawhatch.h"
40 #include "rs_actiondrawimage.h"
41 #include "rs_actiondrawline.h"
42 #include "rs_actiondrawlineangle.h"
43 #include "rs_actiondrawlinebisector.h"
44 #include "rs_actiondrawlinefree.h"
45 #include "rs_actiondrawlinehorvert.h"
46 #include "rs_actiondrawlineparallel.h"
47 #include "rs_actiondrawlineparallelthrough.h"
48 #include "rs_actiondrawlinepolygon.h"
49 #include "rs_actiondrawlinepolygon2.h"
50 #include "rs_actiondrawlinerectangle.h"
51 #include "rs_actiondrawlinerelangle.h"
52 #include "rs_actiondrawlinetangent1.h"
53 #include "rs_actiondrawlinetangent2.h"
54 #include "rs_actiondrawpoint.h"
55 #include "rs_actiondrawspline.h"
56 #include "rs_actiondrawtext.h"
57 #include "rs_actioneditcopy.h"
58 #include "rs_actioneditpaste.h"
59 #include "rs_actioneditundo.h"
60 #include "rs_actionfilenew.h"
61 #include "rs_actionfileopen.h"
62 #include "rs_actionfilesave.h"
63 #include "rs_actionfilesaveas.h"
64 #include "rs_actioninfoangle.h"
65 #include "rs_actioninfodist.h"
66 #include "rs_actioninfodist2.h"
67 #include "rs_actioninfoinside.h"
68 #include "rs_actioninfototallength.h"
69 #include "rs_actionlayersadd.h"
70 #include "rs_actionlayersedit.h"
71 #include "rs_actionlayersfreezeall.h"
72 #include "rs_actionlayersremove.h"
73 #include "rs_actionlayerstogglelock.h"
74 #include "rs_actionlayerstoggleview.h"
75 #include "rs_actionlockrelativezero.h"
76 #include "rs_actionmodifyattributes.h"
77 #include "rs_actionmodifybevel.h"
78 #include "rs_actionmodifymirror.h"
79 #include "rs_actionmodifycut.h"
80 #include "rs_actionmodifydelete.h"
81 #include "rs_actionmodifydeletefree.h"
82 #include "rs_actionmodifydeletequick.h"
83 #include "rs_actionmodifyentity.h"
84 #include "rs_actionmodifymove.h"
85 #include "rs_actionmodifymoverotate.h"
86 #include "rs_actionmodifyrotate.h"
87 #include "rs_actionmodifyround.h"
88 #include "rs_actionmodifyscale.h"
89 #include "rs_actionmodifystretch.h"
90 #include "rs_actionmodifytrim.h"
91 #include "rs_actionmodifytrimamount.h"
92 #include "rs_actionmodifyexplodetext.h"
93 #include "rs_actionoptionsdrawing.h"
94 #include "rs_actionprintpreview.h"
95 #include "rs_actionselectall.h"
96 #include "rs_actionselectintersected.h"
97 #include "rs_actionselectinvert.h"
98 #include "rs_actionselectlayer.h"
99 #include "rs_actionselectsingle.h"
100 #include "rs_actionselectcontour.h"
101 #include "rs_actionselectwindow.h"
102 #include "rs_actionsetrelativezero.h"
103 #include "rs_actionsnapintersectionmanual.h"
104 #include "rs_actiontoolregeneratedimensions.h"
105 #include "rs_actionzoomauto.h"
106 #include "rs_actionzoomprevious.h"
107 #include "rs_actionzoomin.h"
108 #include "rs_actionzoompan.h"
109 #include "rs_actionzoomredraw.h"
110 #include "rs_actionzoomwindow.h"
113 #include "rs_actiondrawpolyline.h"
114 #include "rs_actionpolylineadd.h"
115 #include "rs_actionpolylinedel.h"
116 #include "rs_actionpolylinedelbetween.h"
117 #include "rs_actionpolylinetrim.h"
121 #include "rs_actioncamexportauto.h"
122 #include "rs_actioncamreorder.h"
128 * @param ah Action handler which provides the slots.
129 * @param w Widget through which the events come in.
131 QG_ActionFactory::QG_ActionFactory(QG_ActionHandler * ah, QWidget * w)
140 QG_ActionFactory::~QG_ActionFactory()
145 * Creates a new action object and links it to the appropriate slot(s).
147 * @param id ID of the action to create (see rs.h).
148 * @param obj Object which the action will connect its signal to.
150 * @return Pointer to the action object or NULL if the action is unknown.
152 QAction * QG_ActionFactory::createAction(RS2::ActionType id, QObject * obj)
154 // assert that action handler is not invalid:
155 if (actionHandler == NULL)
157 RS_DEBUG->print(RS_Debug::D_WARNING, "QG_ActionFactory::createAction: "
158 "No valid action handler available to create action. id: %d", id);
162 QWidget * mw = widget;
163 QAction * action = NULL;
168 RS_DEBUG->print(RS_Debug::D_WARNING, "QG_ActionFactory::createAction: "
169 "No valid main window available to create action. id: %d ", id);
173 // create requested action
178 case RS2::ActionFileNew:
179 action = RS_ActionFileNew::createGUIAction(id, mw);
180 connect(action, SIGNAL(activated()), obj, SLOT(slotFileNew()));
183 case RS2::ActionFileOpen:
184 action = RS_ActionFileOpen::createGUIAction(id, mw);
185 connect(action, SIGNAL(activated()), obj, SLOT(slotFileOpen()));
188 case RS2::ActionFileSave:
189 action = RS_ActionFileSave::createGUIAction(id, mw);
190 connect(action, SIGNAL(activated()), obj, SLOT(slotFileSave()));
193 case RS2::ActionFileSaveAs:
194 action = RS_ActionFileSaveAs::createGUIAction(id, mw);
195 connect(action, SIGNAL(activated()), obj, SLOT(slotFileSaveAs()));
198 case RS2::ActionFileExport:
199 action = new QAction(tr("&Export..."), mw);
200 // action = new QAction(tr("Export Drawing"), tr("&Export..."),
202 action->setStatusTip(tr("Exports the current drawing as bitmap"));
203 connect(action, SIGNAL(activated()), obj, SLOT(slotFileExport()));
206 case RS2::ActionFileClose:
207 action = new QAction(QIcon(":/res/fileclose.png"), tr("&Close"), mw);
208 action->setShortcut(Qt::CTRL + Qt::Key_W);
209 // action = new QAction(tr("Close Drawing"), qPixmapFromMimeSource("fileclose.png"), tr("&Close"),
210 // Qt::CTRL+Qt::Key_W, mw);
211 action->setStatusTip(tr("Closes the current drawing"));
212 connect(action, SIGNAL(activated()), obj, SLOT(slotFileClose()));
215 case RS2::ActionFilePrint:
216 action = new QAction(QIcon(":/res/fileprint.png"), tr("&Print..."), mw);
217 action->setShortcut(Qt::CTRL + Qt::Key_P);
218 // icon = qPixmapFromMimeSource("fileprint.png");
219 // action = new QAction(tr("Print Drawing"), icon, tr("&Print..."),
220 // Qt::CTRL+Qt::Key_P, mw);
221 action->setStatusTip(tr("Prints out the current drawing"));
222 connect(action, SIGNAL(activated()), obj, SLOT(slotFilePrint()));
225 case RS2::ActionFilePrintPreview:
226 action = RS_ActionPrintPreview::createGUIAction(id, mw);
227 // action->setToggleAction(true);
228 action->setCheckable(true);
229 connect(action, SIGNAL(toggled(bool)), obj, SLOT(slotFilePrintPreview(bool)));
232 case RS2::ActionFileQuit:
233 action = new QAction(QIcon(":/res/exit.png"), tr("&Quit"), mw);
234 action->setShortcut(Qt::CTRL + Qt::Key_Q);
235 // action = new QAction(tr("Quit"), qPixmapFromMimeSource("exit.png"),
237 // Qt::CTRL+Qt::Key_Q, mw);
238 action->setStatusTip(tr("Quits the application"));
239 connect(action, SIGNAL(activated()), obj, SLOT(slotFileQuit()));
244 case RS2::ActionViewGrid:
245 action = new QAction(QIcon(":/res/viewgrid.png"), tr("&Grid"), mw);
246 action->setCheckable(true);
247 // icon = qPixmapFromMimeSource("viewgrid.png");
248 // action = new QAction(tr("Grid"), icon, tr("&Grid"),
250 action->setStatusTip(tr("Enables/disables the grid"));
251 connect(action, SIGNAL(toggled(bool)), obj, SLOT(slotViewGrid(bool)));
253 case RS2::ActionViewDraft:
254 action = new QAction(QIcon(":/res/viewdraft.png"), tr("&Draft"), mw);
255 action->setCheckable(true);
256 // icon = qPixmapFromMimeSource("viewdraft.png");
257 // action = new QAction(tr("Draft"), icon, tr("&Draft"),
259 action->setStatusTip(tr("Enables/disables the draft mode"));
260 connect(action, SIGNAL(toggled(bool)), obj, SLOT(slotViewDraft(bool)));
262 case RS2::ActionViewStatusBar:
263 //NOTE: This works!!! shortcut combo is displayed on the right side!!!
264 action = new QAction(tr("&Statusbar") + QString("\tsb"), mw);
265 action->setCheckable(true);
266 // action = new QAction(tr("Statusbar"), tr("&Statusbar"),
268 action->setStatusTip(tr("Enables/disables the statusbar"));
269 connect(action, SIGNAL(toggled(bool)), obj, SLOT(slotViewStatusBar(bool)));
272 case RS2::ActionViewLayerList:
273 action = new QAction(tr("Layer List"), tr("&Layer List"),
275 action->setStatusTip(tr("Enables/disables the layerlist"));
276 connect(action, SIGNAL(toggled(bool)),
277 obj, SLOT(slotViewLayerList(bool)));
280 case RS2::ActionViewBlockList:
281 action = new QAction(tr("Block List"), tr("&Block List"),
283 action->setStatusTip(tr("Enables/disables the blocklist"));
284 connect(action, SIGNAL(toggled(bool)),
285 obj, SLOT(slotViewBlockList(bool)));
288 case RS2::ActionViewCommandLine:
289 action = new QAction(tr("Command Widget"), tr("&Command Widget"),
291 action->setStatusTip(tr("Enables/disables the command widget"));
292 connect(action, SIGNAL(toggled(bool)),
293 obj, SLOT(slotViewCommandLine(bool)));
296 case RS2::ActionViewOptionToolbar:
297 action = new QAction(tr("Option Toolbar"), tr("&Option Toolbar"),
299 action->setStatusTip(tr("Enables/disables the option toolbar"));
300 connect(action, SIGNAL(toggled(bool)),
301 obj, SLOT(slotViewOptionToolbar(bool)));
307 case RS2::ActionToolRegenerateDimensions:
308 action = RS_ActionToolRegenerateDimensions::createGUIAction(id, mw);
309 connect(action, SIGNAL(activated()), obj, SLOT(slotToolRegenerateDimensions()));
314 case RS2::ActionZoomIn:
315 action = RS_ActionZoomIn::createGUIAction(id, mw);
316 connect(action, SIGNAL(activated()), obj, SLOT(slotZoomIn()));
319 case RS2::ActionZoomOut:
320 action = RS_ActionZoomIn::createGUIAction(id, mw);
321 connect(action, SIGNAL(activated()), obj, SLOT(slotZoomOut()));
324 case RS2::ActionZoomAuto:
325 action = RS_ActionZoomAuto::createGUIAction(id, mw);
326 connect(action, SIGNAL(activated()), obj, SLOT(slotZoomAuto()));
329 case RS2::ActionZoomWindow:
330 action = RS_ActionZoomWindow::createGUIAction(id, mw);
331 connect(action, SIGNAL(activated()), obj, SLOT(slotZoomWindow()));
334 case RS2::ActionZoomPan:
335 action = RS_ActionZoomPan::createGUIAction(id, mw);
336 connect(action, SIGNAL(activated()), obj, SLOT(slotZoomPan()));
339 case RS2::ActionZoomPrevious:
340 action = RS_ActionZoomPrevious::createGUIAction(id, mw);
341 connect(action, SIGNAL(activated()), obj, SLOT(slotZoomPrevious()));
344 case RS2::ActionZoomRedraw:
345 action = RS_ActionZoomRedraw::createGUIAction(id, mw);
346 connect(action, SIGNAL(activated()), obj, SLOT(slotZoomRedraw()));
351 case RS2::ActionEditUndo:
352 action = RS_ActionEditUndo::createGUIAction(id, mw);
353 connect(action, SIGNAL(activated()), obj, SLOT(slotEditUndo()));
356 case RS2::ActionEditRedo:
357 action = RS_ActionEditUndo::createGUIAction(id, mw);
358 connect(action, SIGNAL(activated()), obj, SLOT(slotEditRedo()));
361 case RS2::ActionEditCut:
362 action = RS_ActionEditCopy::createGUIAction(id, mw);
363 connect(action, SIGNAL(activated()), obj, SLOT(slotEditCut()));
366 case RS2::ActionEditCopy:
367 action = RS_ActionEditCopy::createGUIAction(id, mw);
368 connect(action, SIGNAL(activated()), obj, SLOT(slotEditCopy()));
371 case RS2::ActionEditPaste:
372 action = RS_ActionEditPaste::createGUIAction(id, mw);
373 connect(action, SIGNAL(activated()), obj, SLOT(slotEditPaste()));
376 // Selecting actions:
378 case RS2::ActionSelectSingle:
379 action = RS_ActionSelectSingle::createGUIAction(id, mw);
380 connect(action, SIGNAL(activated()), obj, SLOT(slotSelectSingle()));
383 case RS2::ActionSelectWindow:
384 action = RS_ActionSelectWindow::createGUIAction(id, mw);
385 connect(action, SIGNAL(activated()), obj, SLOT(slotSelectWindow()));
388 case RS2::ActionDeselectWindow:
389 action = RS_ActionSelectWindow::createGUIAction(id, mw);
390 connect(action, SIGNAL(activated()), obj, SLOT(slotDeselectWindow()));
393 case RS2::ActionSelectContour:
394 action = RS_ActionSelectContour::createGUIAction(id, mw);
395 connect(action, SIGNAL(activated()), obj, SLOT(slotSelectContour()));
398 case RS2::ActionSelectAll:
399 action = RS_ActionSelectAll::createGUIAction(id, mw);
400 connect(action, SIGNAL(activated()), obj, SLOT(slotSelectAll()));
403 case RS2::ActionDeselectAll:
404 action = RS_ActionSelectAll::createGUIAction(id, mw);
405 connect(action, SIGNAL(activated()), obj, SLOT(slotDeselectAll()));
408 case RS2::ActionSelectInvert:
409 action = RS_ActionSelectInvert::createGUIAction(id, mw);
410 connect(action, SIGNAL(activated()), obj, SLOT(slotSelectInvert()));
413 case RS2::ActionSelectIntersected:
414 action = RS_ActionSelectIntersected::createGUIAction(id, mw);
415 connect(action, SIGNAL(activated()), obj, SLOT(slotSelectIntersected()));
418 case RS2::ActionDeselectIntersected:
419 action = RS_ActionSelectIntersected::createGUIAction(id, mw);
420 connect(action, SIGNAL(activated()), obj, SLOT(slotDeselectIntersected()));
423 case RS2::ActionSelectLayer:
424 action = RS_ActionSelectLayer::createGUIAction(id, mw);
425 connect(action, SIGNAL(activated()), obj, SLOT(slotSelectLayer()));
430 case RS2::ActionDrawPoint:
431 action = RS_ActionDrawPoint::createGUIAction(id, mw);
432 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawPoint()));
435 case RS2::ActionDrawLine:
436 action = RS_ActionDrawLine::createGUIAction(id, mw);
437 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawLine()));
440 case RS2::ActionDrawLineAngle:
441 action = RS_ActionDrawLineAngle::createGUIAction(id, mw);
442 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawLineAngle()));
445 case RS2::ActionDrawLineHorizontal:
446 action = RS_ActionDrawLineAngle::createGUIAction(id, mw);
447 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawLineHorizontal()));
450 case RS2::ActionDrawLineHorVert:
451 action = RS_ActionDrawLineHorVert::createGUIAction(id, mw);
452 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawLineHorVert()));
455 case RS2::ActionDrawLineVertical:
456 action = RS_ActionDrawLineAngle::createGUIAction(id, mw);
457 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawLineVertical()));
460 case RS2::ActionDrawLineFree:
461 action = RS_ActionDrawLineFree::createGUIAction(id, mw);
462 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawLineFree()));
465 case RS2::ActionDrawLineParallel:
466 action = RS_ActionDrawLineParallel::createGUIAction(id, mw);
467 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawLineParallel()));
470 case RS2::ActionDrawLineParallelThrough:
471 action = RS_ActionDrawLineParallelThrough::createGUIAction(id, mw);
472 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawLineParallelThrough()));
475 case RS2::ActionDrawLineRectangle:
476 action = RS_ActionDrawLineRectangle::createGUIAction(id, mw);
477 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawLineRectangle()));
480 case RS2::ActionDrawLineBisector:
481 action = RS_ActionDrawLineBisector::createGUIAction(id, mw);
482 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawLineBisector()));
485 case RS2::ActionDrawLineTangent1:
486 action = RS_ActionDrawLineTangent1::createGUIAction(id, mw);
487 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawLineTangent1()));
490 case RS2::ActionDrawLineTangent2:
491 action = RS_ActionDrawLineTangent2::createGUIAction(id, mw);
492 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawLineTangent2()));
495 case RS2::ActionDrawLineOrthogonal:
496 action = RS_ActionDrawLineRelAngle::createGUIAction(id, mw);
497 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawLineOrthogonal()));
500 case RS2::ActionDrawLineRelAngle:
501 action = RS_ActionDrawLineRelAngle::createGUIAction(id, mw);
503 action = new QAction(tr("Relative angle"), tr("R&elative angle"),
505 action->setStatusTip(tr("Draw line with relative angle"));
507 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawLineRelAngle()));
511 case RS2::ActionDrawPolyline:
512 action = RS_ActionDrawPolyline::createGUIAction(id, mw);
513 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawPolyline()));
517 case RS2::ActionDrawLinePolygon:
518 action = RS_ActionDrawLinePolygon::createGUIAction(id, mw);
519 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawLinePolygon()));
522 case RS2::ActionDrawLinePolygon2:
523 action = RS_ActionDrawLinePolygon::createGUIAction(id, mw);
524 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawLinePolygon2()));
527 case RS2::ActionDrawCircle:
528 action = RS_ActionDrawCircle::createGUIAction(id, mw);
529 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawCircle()));
532 case RS2::ActionDrawCircleCR:
533 action = RS_ActionDrawCircleCR::createGUIAction(id, mw);
535 action = new QAction(tr("Circle: Center, Radius"),
536 tr("Center, &Radius"),
538 action->setStatusTip(tr("Draw circles with center and radius"));
540 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawCircleCR()));
543 case RS2::ActionDrawCircle2P:
544 action = RS_ActionDrawCircle2P::createGUIAction(id, mw);
545 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawCircle2P()));
548 case RS2::ActionDrawCircle3P:
549 action = RS_ActionDrawCircle3P::createGUIAction(id, mw);
550 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawCircle3P()));
553 case RS2::ActionDrawCircleParallel:
554 action = RS_ActionDrawLineParallel::createGUIAction(id, mw);
555 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawCircleParallel()));
558 case RS2::ActionDrawArc:
559 action = RS_ActionDrawArc::createGUIAction(id, mw);
560 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawArc()));
563 case RS2::ActionDrawArc3P:
564 action = RS_ActionDrawArc3P::createGUIAction(id, mw);
565 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawArc3P()));
568 case RS2::ActionDrawArcParallel:
569 action = RS_ActionDrawLineParallel::createGUIAction(id, mw);
570 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawArcParallel()));
573 case RS2::ActionDrawEllipseAxis:
574 action = RS_ActionDrawEllipseAxis::createGUIAction(id, mw);
575 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawEllipseAxis()));
578 case RS2::ActionDrawEllipseArcAxis:
579 action = RS_ActionDrawEllipseAxis::createGUIAction(id, mw);
580 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawEllipseArcAxis()));
583 case RS2::ActionDrawSpline:
584 action = RS_ActionDrawSpline::createGUIAction(id, mw);
585 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawSpline()));
589 case RS2::ActionPolylineAdd:
590 action = RS_ActionPolylineAdd::createGUIAction(id, mw);
591 connect(action, SIGNAL(activated()), obj, SLOT(slotPolylineAdd()));
594 case RS2::ActionPolylineDel:
595 action = RS_ActionPolylineDel::createGUIAction(id, mw);
596 connect(action, SIGNAL(activated()), obj, SLOT(slotPolylineDel()));
599 case RS2::ActionPolylineDelBetween:
600 action = RS_ActionPolylineDelBetween::createGUIAction(id, mw);
601 connect(action, SIGNAL(activated()), obj, SLOT(slotPolylineDelBetween()));
604 case RS2::ActionPolylineTrim:
605 action = RS_ActionPolylineTrim::createGUIAction(id, mw);
606 connect(action, SIGNAL(activated()), obj, SLOT(slotPolylineTrim()));
610 case RS2::ActionDrawText:
611 action = RS_ActionDrawText::createGUIAction(id, mw);
612 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawText()));
615 case RS2::ActionDrawHatch:
616 action = RS_ActionDrawHatch::createGUIAction(id, mw);
617 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawHatch()));
620 case RS2::ActionDrawImage:
621 action = RS_ActionDrawImage::createGUIAction(id, mw);
622 connect(action, SIGNAL(activated()), obj, SLOT(slotDrawImage()));
625 // Dimensioning actions:
627 case RS2::ActionDimAligned:
628 action = RS_ActionDimAligned::createGUIAction(id, mw);
629 connect(action, SIGNAL(activated()), obj, SLOT(slotDimAligned()));
632 case RS2::ActionDimLinear:
633 action = RS_ActionDimLinear::createGUIAction(id, mw);
634 connect(action, SIGNAL(activated()), obj, SLOT(slotDimLinear()));
637 case RS2::ActionDimLinearHor:
638 action = RS_ActionDimLinear::createGUIAction(id, mw);
639 connect(action, SIGNAL(activated()), obj, SLOT(slotDimLinearHor()));
642 case RS2::ActionDimLinearVer:
643 action = RS_ActionDimLinear::createGUIAction(id, mw);
644 connect(action, SIGNAL(activated()), obj, SLOT(slotDimLinearVer()));
647 case RS2::ActionDimRadial:
648 action = RS_ActionDimRadial::createGUIAction(id, mw);
649 connect(action, SIGNAL(activated()), obj, SLOT(slotDimRadial()));
652 case RS2::ActionDimDiametric:
653 action = RS_ActionDimDiametric::createGUIAction(id, mw);
654 connect(action, SIGNAL(activated()), obj, SLOT(slotDimDiametric()));
657 case RS2::ActionDimAngular:
658 action = RS_ActionDimAngular::createGUIAction(id, mw);
659 connect(action, SIGNAL(activated()), obj, SLOT(slotDimAngular()));
662 case RS2::ActionDimLeader:
663 action = RS_ActionDimLeader::createGUIAction(id, mw);
664 connect(action, SIGNAL(activated()), obj, SLOT(slotDimLeader()));
667 // Modifying actions:
669 case RS2::ActionModifyAttributes:
670 action = RS_ActionModifyAttributes::createGUIAction(id, mw);
671 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyAttributes()));
673 case RS2::ActionModifyDelete:
674 action = RS_ActionModifyDelete::createGUIAction(id, mw);
675 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyDelete()));
678 case RS2::ActionModifyDeleteQuick:
679 action = RS_ActionModifyDeleteQuick::createGUIAction(id, mw);
680 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyDeleteQuick()));
683 case RS2::ActionModifyDeleteFree:
684 action = RS_ActionModifyDeleteFree::createGUIAction(id, mw);
685 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyDeleteFree()));
688 case RS2::ActionModifyMove:
689 action = RS_ActionModifyMove::createGUIAction(id, mw);
691 action = new QAction(tr("Move"), tr("&Move"),
693 action->setStatusTip(tr("Move Entities"));
695 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyMove()));
698 case RS2::ActionModifyRotate:
699 action = RS_ActionModifyRotate::createGUIAction(id, mw);
700 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyRotate()));
703 case RS2::ActionModifyScale:
704 action = RS_ActionModifyScale::createGUIAction(id, mw);
705 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyScale()));
708 case RS2::ActionModifyMirror:
709 action = RS_ActionModifyMirror::createGUIAction(id, mw);
710 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyMirror()));
713 case RS2::ActionModifyMoveRotate:
714 action = RS_ActionModifyMoveRotate::createGUIAction(id, mw);
715 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyMoveRotate()));
718 case RS2::ActionModifyRotate2:
719 action = RS_ActionModifyRotate::createGUIAction(id, mw);
720 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyRotate2()));
723 case RS2::ActionModifyEntity:
724 action = RS_ActionModifyEntity::createGUIAction(id, mw);
725 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyEntity()));
728 case RS2::ActionModifyTrim:
729 action = RS_ActionModifyTrim::createGUIAction(id, mw);
730 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyTrim()));
733 case RS2::ActionModifyTrim2:
734 action = RS_ActionModifyTrim::createGUIAction(id, mw);
735 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyTrim2()));
738 case RS2::ActionModifyTrimAmount:
739 action = RS_ActionModifyTrimAmount::createGUIAction(id, mw);
740 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyTrimAmount()));
743 case RS2::ActionModifyCut:
744 action = RS_ActionModifyCut::createGUIAction(id, mw);
745 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyCut()));
748 case RS2::ActionModifyStretch:
749 action = RS_ActionModifyStretch::createGUIAction(id, mw);
750 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyStretch()));
753 case RS2::ActionModifyBevel:
754 action = RS_ActionModifyBevel::createGUIAction(id, mw);
755 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyBevel()));
758 case RS2::ActionModifyRound:
759 action = RS_ActionModifyRound::createGUIAction(id, mw);
760 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyRound()));
763 case RS2::ActionModifyExplodeText:
764 action = RS_ActionModifyExplodeText::createGUIAction(id, mw);
765 connect(action, SIGNAL(activated()), obj, SLOT(slotModifyExplodeText()));
770 case RS2::ActionSnapFree:
771 action = new QAction(tr("&Free"), mw);
772 action->setChecked(true);
773 // action = new QAction(tr("Free"), tr("&Free"), 0, mw, 0, true);
774 action->setStatusTip(tr("Free positioning"));
775 actionHandler->setActionSnapFree(action);
776 connect(action, SIGNAL(activated()), obj, SLOT(slotSnapFree()));
779 case RS2::ActionSnapGrid:
780 action = new QAction(tr("&Grid"), mw);
781 action->setChecked(true);
782 // action = new QAction(tr("Grid"), tr("&Grid"), 0, mw, "snapGrid", true);
783 action->setStatusTip(tr("Grid positioning"));
784 actionHandler->setActionSnapGrid(action);
785 connect(action, SIGNAL(activated()), obj, SLOT(slotSnapGrid()));
788 case RS2::ActionSnapEndpoint:
789 action = new QAction(tr("&Endpoints"), mw);
790 action->setChecked(true);
791 // action = new QAction(tr("Endpoints"), tr("&Endpoints"), 0, mw, 0, true);
792 action->setStatusTip(tr("Snap to endpoints"));
793 actionHandler->setActionSnapEndpoint(action);
794 connect(action, SIGNAL(activated()), obj, SLOT(slotSnapEndpoint()));
797 case RS2::ActionSnapOnEntity:
798 action = new QAction(tr("&On Entity"), mw);
799 action->setChecked(true);
800 // action = new QAction(tr("On Entity"), tr("&On Entity"), 0, mw, 0, true);
801 action->setStatusTip(tr("Snap to nearest point on entity"));
802 actionHandler->setActionSnapOnEntity(action);
803 connect(action, SIGNAL(activated()), obj, SLOT(slotSnapOnEntity()));
806 case RS2::ActionSnapCenter:
807 action = new QAction(tr("&Center"), mw);
808 action->setChecked(true);
809 // action = new QAction(tr("Center"), tr("&Center"), 0, mw, 0, true);
810 action->setStatusTip(tr("Snap to centers"));
811 actionHandler->setActionSnapCenter(action);
812 connect(action, SIGNAL(activated()), obj, SLOT(slotSnapCenter()));
815 case RS2::ActionSnapMiddle:
816 action = new QAction(tr("&Middle"), mw);
817 action->setChecked(true);
818 // action = new QAction(tr("Middle"), tr("&Middle"), 0, mw, 0, true);
819 action->setStatusTip(tr("Snap to middle points"));
820 actionHandler->setActionSnapMiddle(action);
821 connect(action, SIGNAL(activated()), obj, SLOT(slotSnapMiddle()));
824 case RS2::ActionSnapDist:
825 action = new QAction(tr("&Distance from Endpoint"), mw);
826 action->setChecked(true);
827 // action = new QAction(tr("Distance from Endpoint"), tr("&Distance from Endpoint"), 0, mw, 0, true);
828 action->setStatusTip(tr("Snap to points with a given distance to an endpoint"));
829 actionHandler->setActionSnapDist(action);
830 connect(action, SIGNAL(activated()), obj, SLOT(slotSnapDist()));
833 case RS2::ActionSnapIntersection:
834 action = new QAction(tr("&Intersection"), mw);
835 action->setChecked(true);
836 // action = new QAction(tr("Intersection"), tr("&Intersection"), 0, mw, 0, true);
837 action->setStatusTip(tr("Snap to intersection points"));
838 actionHandler->setActionSnapIntersection(action);
839 connect(action, SIGNAL(activated()), obj, SLOT(slotSnapIntersection()));
842 case RS2::ActionSnapIntersectionManual:
843 action = RS_ActionSnapIntersectionManual::createGUIAction(id, mw);
844 actionHandler->setActionSnapIntersectionManual(action);
845 connect(action, SIGNAL(activated()), obj, SLOT(slotSnapIntersectionManual()));
848 // Snap restriction actions:
850 case RS2::ActionRestrictNothing:
851 action = new QAction(tr("Restrict &Nothing"), mw);
852 action->setChecked(true);
853 // action = new QAction(tr("Restrict Nothing"), tr("Restrict &Nothing"), 0, mw, 0, true);
854 action->setStatusTip(tr("No snap restriction"));
855 actionHandler->setActionRestrictNothing(action);
856 connect(action, SIGNAL(activated()), obj, SLOT(slotRestrictNothing()));
859 case RS2::ActionRestrictOrthogonal:
860 action = new QAction(tr("Restrict &Orthogonally"), mw);
861 action->setChecked(true);
862 // action = new QAction(tr("Restrict Orthogonally"), tr("Restrict &Orthogonally"), 0, mw, 0, true);
863 action->setStatusTip(tr("Restrict snapping orthogonally"));
864 actionHandler->setActionRestrictOrthogonal(action);
865 connect(action, SIGNAL(activated()), obj, SLOT(slotRestrictOrthogonal()));
868 case RS2::ActionRestrictHorizontal:
869 action = new QAction(tr("Restrict &Horizontally"), mw);
870 action->setChecked(true);
871 // action = new QAction(tr("Restrict Horizontally"), tr("Restrict &Horizontally"), 0, mw, 0, true);
872 action->setStatusTip(tr("Restrict snapping horizontally"));
873 actionHandler->setActionRestrictHorizontal(action);
874 connect(action, SIGNAL(activated()), obj, SLOT(slotRestrictHorizontal()));
877 case RS2::ActionRestrictVertical:
878 action = new QAction(tr("Restrict &Vertically"), mw);
879 action->setChecked(true);
880 // action = new QAction(tr("Restrict Vertically"), tr("Restrict &Vertically"), 0, mw, 0, true);
881 action->setStatusTip(tr("Restrict snapping vertically"));
882 actionHandler->setActionRestrictVertical(action);
883 connect(action, SIGNAL(activated()), obj, SLOT(slotRestrictVertical()));
886 // Relative zero point
888 case RS2::ActionSetRelativeZero:
889 action = RS_ActionSetRelativeZero::createGUIAction(id, mw);
890 connect(action, SIGNAL(activated()), obj, SLOT(slotSetRelativeZero()));
892 case RS2::ActionLockRelativeZero:
893 action = RS_ActionLockRelativeZero::createGUIAction(id, mw);
894 actionHandler->setActionLockRelativeZero(action);
895 connect(action, SIGNAL(toggled(bool)), obj, SLOT(slotLockRelativeZero(bool)));
900 case RS2::ActionInfoInside:
901 action = RS_ActionInfoInside::createGUIAction(id, mw);
902 connect(action, SIGNAL(activated()), obj, SLOT(slotInfoInside()));
905 case RS2::ActionInfoDist:
906 action = RS_ActionInfoDist::createGUIAction(id, mw);
907 connect(action, SIGNAL(activated()), obj, SLOT(slotInfoDist()));
910 case RS2::ActionInfoDist2:
911 action = RS_ActionInfoDist2::createGUIAction(id, mw);
912 connect(action, SIGNAL(activated()), obj, SLOT(slotInfoDist2()));
915 case RS2::ActionInfoAngle:
916 action = RS_ActionInfoAngle::createGUIAction(id, mw);
917 connect(action, SIGNAL(activated()), obj, SLOT(slotInfoAngle()));
920 case RS2::ActionInfoTotalLength:
921 action = RS_ActionInfoTotalLength::createGUIAction(id, mw);
922 connect(action, SIGNAL(activated()), obj, SLOT(slotInfoTotalLength()));
927 case RS2::ActionLayersDefreezeAll:
928 action = RS_ActionLayersFreezeAll::createGUIAction(id, mw);
929 connect(action, SIGNAL(activated()), obj, SLOT(slotLayersDefreezeAll()));
931 case RS2::ActionLayersFreezeAll:
932 action = RS_ActionLayersFreezeAll::createGUIAction(id, mw);
933 connect(action, SIGNAL(activated()), obj, SLOT(slotLayersFreezeAll()));
935 case RS2::ActionLayersAdd:
936 action = RS_ActionLayersAdd::createGUIAction(id, mw);
937 connect(action, SIGNAL(activated()), obj, SLOT(slotLayersAdd()));
940 case RS2::ActionLayersRemove:
941 action = RS_ActionLayersRemove::createGUIAction(id, mw);
942 connect(action, SIGNAL(activated()), obj, SLOT(slotLayersRemove()));
945 case RS2::ActionLayersEdit:
946 action = RS_ActionLayersEdit::createGUIAction(id, mw);
947 connect(action, SIGNAL(activated()), obj, SLOT(slotLayersEdit()));
950 case RS2::ActionLayersToggleLock:
951 action = RS_ActionLayersToggleLock::createGUIAction(id, mw);
952 connect(action, SIGNAL(activated()), obj, SLOT(slotLayersToggleView()));
955 case RS2::ActionLayersToggleView:
956 action = RS_ActionLayersToggleView::createGUIAction(id, mw);
957 connect(action, SIGNAL(activated()), obj, SLOT(slotLayersToggleView()));
962 case RS2::ActionBlocksDefreezeAll:
963 action = RS_ActionBlocksFreezeAll::createGUIAction(id, mw);
964 connect(action, SIGNAL(activated()), obj, SLOT(slotBlocksDefreezeAll()));
966 case RS2::ActionBlocksFreezeAll:
967 action = RS_ActionBlocksFreezeAll::createGUIAction(id, mw);
968 connect(action, SIGNAL(activated()), obj, SLOT(slotBlocksFreezeAll()));
970 case RS2::ActionBlocksAdd:
971 action = RS_ActionBlocksAdd::createGUIAction(id, mw);
972 connect(action, SIGNAL(activated()), obj, SLOT(slotBlocksAdd()));
974 case RS2::ActionBlocksRemove:
975 action = RS_ActionBlocksRemove::createGUIAction(id, mw);
976 connect(action, SIGNAL(activated()), obj, SLOT(slotBlocksRemove()));
978 case RS2::ActionBlocksAttributes:
979 action = RS_ActionBlocksAttributes::createGUIAction(id, mw);
980 connect(action, SIGNAL(activated()), obj, SLOT(slotBlocksAttributes()));
982 case RS2::ActionBlocksEdit:
983 action = RS_ActionBlocksEdit::createGUIAction(id, mw);
984 connect(action, SIGNAL(activated()), obj, SLOT(slotBlocksEdit()));
986 case RS2::ActionBlocksInsert:
987 action = RS_ActionBlocksInsert::createGUIAction(id, mw);
988 connect(action, SIGNAL(activated()), obj, SLOT(slotBlocksInsert()));
990 case RS2::ActionBlocksToggleView:
991 action = RS_ActionBlocksToggleView::createGUIAction(id, mw);
992 connect(action, SIGNAL(activated()), obj, SLOT(slotBlocksToggleView()));
994 case RS2::ActionBlocksCreate:
995 action = RS_ActionBlocksCreate::createGUIAction(id, mw);
996 connect(action, SIGNAL(activated()), obj, SLOT(slotBlocksCreate()));
998 case RS2::ActionBlocksExplode:
999 action = RS_ActionBlocksExplode::createGUIAction(id, mw);
1000 connect(action, SIGNAL(activated()), obj, SLOT(slotBlocksExplode()));
1005 case RS2::ActionOptionsGeneral:
1006 action = new QAction(QIcon(":/res/configure.png"),
1010 tr("&Application Preferences..."),
1013 // action = new QAction(tr("Application"), qPixmapFromMimeSource("configure.png"),
1015 // tr("&Preferences"),
1017 // tr("&Application Preferences..."),
1020 action->setStatusTip(tr("General Application Preferences"));
1021 connect(action, SIGNAL(activated()), obj, SLOT(slotOptionsGeneral()));
1024 case RS2::ActionOptionsDrawing:
1025 action = RS_ActionOptionsDrawing::createGUIAction(id, mw);
1026 connect(action, SIGNAL(activated()), obj, SLOT(slotOptionsDrawing()));
1029 // Scripting actions:
1031 case RS2::ActionScriptOpenIDE:
1032 action = new QAction(tr("&Open IDE"), mw);
1033 // action = new QAction(tr("Open IDE"), tr("&Open IDE"), 0, mw);
1034 action->setStatusTip(tr("Opens the integrated development environment for scripting"));
1035 connect(action, SIGNAL(activated()), obj, SLOT(slotScriptOpenIDE()));
1038 case RS2::ActionScriptRun:
1039 action = new QAction(tr("&Run Script..."), mw);
1040 // action = new QAction(tr("Run Script.."), tr("&Run Script.."), 0, mw);
1041 action->setStatusTip(tr("Runs a script"));
1042 connect(action, SIGNAL(activated()), obj, SLOT(slotScriptRun()));
1048 case RS2::ActionCamExportAuto:
1049 action = RS_ActionCamExportAuto::createGUIAction(id, mw);
1050 connect(action, SIGNAL(activated()), obj, SLOT(slotCamExportAuto()));
1053 case RS2::ActionCamReorder:
1054 action = RS_ActionCamReorder::createGUIAction(id, mw);
1055 connect(action, SIGNAL(activated()), obj, SLOT(slotCamReorder()));
1060 RS_DEBUG->print(RS_Debug::D_WARNING, "No action %d defined", id);