X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fwidgets%2Fqg_actionhandler.cpp;h=58ee599f99ebccc89ce22bcf044aa32e7b818f3c;hb=c5e595b3156fdf5f93ab6a1032dcc77e859ac6fa;hp=d0d6210f0244af98adce32e4e94a25d21eb0ef2a;hpb=27d4a138d23453e93a833e9347444b828a971cb4;p=architektonas diff --git a/src/widgets/qg_actionhandler.cpp b/src/widgets/qg_actionhandler.cpp index d0d6210..58ee599 100644 --- a/src/widgets/qg_actionhandler.cpp +++ b/src/widgets/qg_actionhandler.cpp @@ -176,7 +176,7 @@ void QG_ActionHandler::killSelectActions() { GraphicView * gv = mainWindow->getGraphicView(); - if (gv != NULL) + if (gv) gv->killSelectActions(); } @@ -206,7 +206,7 @@ RS_ActionInterface * QG_ActionHandler::setCurrentAction(RS_ActionInterface * act return NULL; } - if (action != NULL) + if (action) gv->setCurrentAction(action); return action; @@ -778,7 +778,7 @@ RS_ActionInterface * QG_ActionHandler::setCurrentAction(RS2::ActionType id) break; } - if (a != NULL) + if (a) gv->setCurrentAction(a); RS_DEBUG->print("QG_ActionHandler::setCurrentAction(): OK"); @@ -793,7 +793,7 @@ QStringList QG_ActionHandler::getAvailableCommands() { RS_ActionInterface * currentAction = getCurrentAction(); - if (currentAction != NULL) + if (currentAction) return currentAction->getAvailableCommands(); else { @@ -819,7 +819,7 @@ bool QG_ActionHandler::keycode(const QString & code) //RS_keycodeEvent e(cmd); //GraphicView* gv = mainWindow->getGraphicView(); - //if (gv!=NULL) { + //if (gv) { // gv->keycodeEvent(&e); //} @@ -901,7 +901,7 @@ bool QG_ActionHandler::command(const QString & cmd) { GraphicView * gv = mainWindow->getGraphicView(); - if (gv != NULL) + if (gv) gv->back(); RS_DEBUG->print("QG_ActionHandler::command: back"); @@ -913,7 +913,7 @@ bool QG_ActionHandler::command(const QString & cmd) GraphicView * gv = mainWindow->getGraphicView(); - if (gv != NULL) + if (gv) { RS_DEBUG->print("QG_ActionHandler::command: trigger command event in graphic view"); gv->commandEvent(&e); @@ -1418,12 +1418,12 @@ void QG_ActionHandler::slotSnapFree() { disableSnaps(); - if (snapFree != NULL) + if (snapFree) snapFree->setChecked(true); - - if (cadToolBarSnap != NULL) +#if 0 + if (cadToolBarSnap) cadToolBarSnap->setSnapMode(RS2::SnapFree); - +#endif setCurrentAction(RS2::ActionSnapFree); } @@ -1431,12 +1431,13 @@ void QG_ActionHandler::slotSnapGrid() { disableSnaps(); - if (snapGrid != NULL) + if (snapGrid) snapGrid->setChecked(true); - if (cadToolBarSnap != NULL) +#if 0 + if (cadToolBarSnap) cadToolBarSnap->setSnapMode(RS2::SnapGrid); - +#endif setCurrentAction(RS2::ActionSnapGrid); } @@ -1444,26 +1445,25 @@ void QG_ActionHandler::slotSnapEndpoint() { disableSnaps(); - if (snapEndpoint != NULL) + if (snapEndpoint) snapEndpoint->setChecked(true); - if (cadToolBarSnap != NULL) +#if 0 + if (cadToolBarSnap) cadToolBarSnap->setSnapMode(RS2::SnapEndpoint); - +#endif setCurrentAction(RS2::ActionSnapEndpoint); } void QG_ActionHandler::slotSnapOnEntity() { disableSnaps(); - if (snapOnEntity!=NULL) { + if (snapOnEntity) snapOnEntity->setChecked(true); - } -//#if QT_VERSION>=0x030000 - if (cadToolBarSnap!=NULL) { +#if 0 + if (cadToolBarSnap) cadToolBarSnap->setSnapMode(RS2::SnapOnEntity); - } -//#endif +#endif setCurrentAction(RS2::ActionSnapOnEntity); } @@ -1471,13 +1471,13 @@ void QG_ActionHandler::slotSnapCenter() { disableSnaps(); - if (snapCenter != NULL) + if (snapCenter) snapCenter->setChecked(true); -//#if QT_VERSION>=0x030000 - if (cadToolBarSnap != NULL) +#if 0 + if (cadToolBarSnap) cadToolBarSnap->setSnapMode(RS2::SnapCenter); -//#endif +#endif setCurrentAction(RS2::ActionSnapCenter); } @@ -1486,13 +1486,13 @@ void QG_ActionHandler::slotSnapMiddle() { disableSnaps(); - if (snapMiddle != NULL) + if (snapMiddle) snapMiddle->setChecked(true); -//#if QT_VERSION>=0x030000 - if (cadToolBarSnap != NULL) +#if 0 + if (cadToolBarSnap) cadToolBarSnap->setSnapMode(RS2::SnapMiddle); -//#endif +#endif setCurrentAction(RS2::ActionSnapMiddle); } @@ -1501,13 +1501,13 @@ void QG_ActionHandler::slotSnapDist() { disableSnaps(); - if (snapDist != NULL) + if (snapDist) snapDist->setChecked(true); -//#if QT_VERSION>=0x030000 - if (cadToolBarSnap != NULL) +#if 0 + if (cadToolBarSnap) cadToolBarSnap->setSnapMode(RS2::SnapDist); -//#endif +#endif setCurrentAction(RS2::ActionSnapDist); } @@ -1516,13 +1516,13 @@ void QG_ActionHandler::slotSnapIntersection() { disableSnaps(); - if (snapIntersection != NULL) + if (snapIntersection) snapIntersection->setChecked(true); -//#if QT_VERSION>=0x030000 - if (cadToolBarSnap != NULL) +#if 0 + if (cadToolBarSnap) cadToolBarSnap->setSnapMode(RS2::SnapIntersection); -//#endif +#endif setCurrentAction(RS2::ActionSnapIntersection); } @@ -1530,10 +1530,10 @@ void QG_ActionHandler::slotSnapIntersection() void QG_ActionHandler::slotSnapIntersectionManual() { //disableSnaps(); - /*if (snapIntersectionManual!=NULL) { + /*if (snapIntersectionManual) { snapIntersectionManual->setChecked(true); }*/ - /*if (cadToolBarSnap!=NULL) { + /*if (cadToolBarSnap) { cadToolBarSnap->setSnapMode(RS2::SnapIntersectionManual); }*/ setCurrentAction(RS2::ActionSnapIntersectionManual); @@ -1541,47 +1541,50 @@ void QG_ActionHandler::slotSnapIntersectionManual() void QG_ActionHandler::disableSnaps() { - if (snapFree != NULL) + if (snapFree) snapFree->setChecked(false); - if (snapGrid != NULL) + if (snapGrid) snapGrid->setChecked(false); - if (snapEndpoint != NULL) + if (snapEndpoint) snapEndpoint->setChecked(false); - if (snapOnEntity != NULL) + if (snapOnEntity) snapOnEntity->setChecked(false); - if (snapCenter != NULL) + if (snapCenter) snapCenter->setChecked(false); - if (snapMiddle != NULL) + if (snapMiddle) snapMiddle->setChecked(false); - if (snapDist != NULL) + if (snapDist) snapDist->setChecked(false); - if (snapIntersection != NULL) + if (snapIntersection) snapIntersection->setChecked(false); - if (snapIntersectionManual != NULL) + if (snapIntersectionManual) snapIntersectionManual->setChecked(false); - if (cadToolBarSnap != NULL) +#if 0 + if (cadToolBarSnap) cadToolBarSnap->disableSnaps(); +#endif } void QG_ActionHandler::slotRestrictNothing() { disableRestrictions(); - if (restrictNothing != NULL) + if (restrictNothing) restrictNothing->setChecked(true); - if (cadToolBarSnap != NULL) +#if 0 + if (cadToolBarSnap) cadToolBarSnap->setSnapRestriction(RS2::RestrictNothing); - +#endif setCurrentAction(RS2::ActionRestrictNothing); } @@ -1589,12 +1592,13 @@ void QG_ActionHandler::slotRestrictOrthogonal() { disableRestrictions(); - if (restrictOrthogonal != NULL) + if (restrictOrthogonal) restrictOrthogonal->setChecked(true); - if (cadToolBarSnap != NULL) +#if 0 + if (cadToolBarSnap) cadToolBarSnap->setSnapRestriction(RS2::RestrictOrthogonal); - +#endif setCurrentAction(RS2::ActionRestrictOrthogonal); } @@ -1602,11 +1606,13 @@ void QG_ActionHandler::slotRestrictHorizontal() { disableRestrictions(); - if (restrictHorizontal != NULL) + if (restrictHorizontal) restrictHorizontal->setChecked(true); - if (cadToolBarSnap != NULL) +#if 0 + if (cadToolBarSnap) cadToolBarSnap->setSnapRestriction(RS2::RestrictHorizontal); +#endif setCurrentAction(RS2::ActionRestrictHorizontal); } @@ -1615,31 +1621,34 @@ void QG_ActionHandler::slotRestrictVertical() { disableRestrictions(); - if (restrictVertical != NULL) + if (restrictVertical) restrictVertical->setChecked(true); - if (cadToolBarSnap != NULL) +#if 0 + if (cadToolBarSnap) cadToolBarSnap->setSnapRestriction(RS2::RestrictVertical); - +#endif setCurrentAction(RS2::ActionRestrictVertical); } void QG_ActionHandler::disableRestrictions() { - if (restrictNothing != NULL) + if (restrictNothing) restrictNothing->setChecked(false); - if (restrictOrthogonal != NULL) + if (restrictOrthogonal) restrictOrthogonal->setChecked(false); - if (restrictHorizontal != NULL) + if (restrictHorizontal) restrictHorizontal->setChecked(false); - if (restrictVertical != NULL) + if (restrictVertical) restrictVertical->setChecked(false); - if (cadToolBarSnap != NULL) +#if 0 + if (cadToolBarSnap) cadToolBarSnap->disableRestrictions(); +#endif } /** @@ -1648,35 +1657,35 @@ void QG_ActionHandler::disableRestrictions() */ void QG_ActionHandler::updateSnapMode() { - if (snapFree != NULL && snapFree->isChecked()) + if (snapFree && snapFree->isChecked()) slotSnapFree(); - else if (snapGrid != NULL && snapGrid->isChecked()) + else if (snapGrid && snapGrid->isChecked()) slotSnapGrid(); - else if (snapEndpoint != NULL && snapEndpoint->isChecked()) + else if (snapEndpoint && snapEndpoint->isChecked()) slotSnapEndpoint(); - else if (snapOnEntity != NULL && snapOnEntity->isChecked()) + else if (snapOnEntity && snapOnEntity->isChecked()) slotSnapOnEntity(); - else if (snapCenter != NULL && snapCenter->isChecked()) + else if (snapCenter && snapCenter->isChecked()) slotSnapCenter(); - else if (snapMiddle != NULL && snapMiddle->isChecked()) + else if (snapMiddle && snapMiddle->isChecked()) slotSnapMiddle(); - else if (snapDist != NULL && snapDist->isChecked()) + else if (snapDist && snapDist->isChecked()) slotSnapDist(); - else if (snapIntersection != NULL && snapIntersection->isChecked()) + else if (snapIntersection && snapIntersection->isChecked()) slotSnapIntersection(); // snap restricitons: - if (restrictNothing != NULL && restrictNothing->isChecked()) + if (restrictNothing && restrictNothing->isChecked()) slotRestrictNothing(); - else if (restrictOrthogonal != NULL && restrictOrthogonal->isChecked()) + else if (restrictOrthogonal && restrictOrthogonal->isChecked()) slotRestrictOrthogonal(); - else if (restrictHorizontal != NULL && restrictHorizontal->isChecked()) + else if (restrictHorizontal && restrictHorizontal->isChecked()) slotRestrictHorizontal(); - else if (restrictVertical != NULL && restrictVertical->isChecked()) + else if (restrictVertical && restrictVertical->isChecked()) slotRestrictVertical(); // lock of relative zero: - if (lockRelativeZero != NULL) + if (lockRelativeZero) slotLockRelativeZero(lockRelativeZero->isChecked()); } @@ -1687,7 +1696,7 @@ void QG_ActionHandler::slotSetRelativeZero() void QG_ActionHandler::slotLockRelativeZero(bool on) { - if (lockRelativeZero != NULL) + if (lockRelativeZero) lockRelativeZero->setChecked(on); if (on) @@ -1695,8 +1704,10 @@ void QG_ActionHandler::slotLockRelativeZero(bool on) else setCurrentAction(RS2::ActionUnlockRelativeZero); - if (cadToolBarSnap != NULL) +#if 0 + if (cadToolBarSnap) cadToolBarSnap->setLockRelativeZero(on); +#endif } void QG_ActionHandler::slotInfoInside() @@ -1838,7 +1849,7 @@ void QG_ActionHandler::slotCamReorder() void QG_ActionHandler::slotFocusNormal() { //QG_GraphicView* gv = mainWindow->getGraphicView(); - //if (gv!=NULL) { + //if (gv) { //gv->setFocus(); mainWindow->setFocus2(); //}