-#if 0
-#include "cadtoolbar.h"
-#include "qg_actionhandler.h"
-#include "rs_debug.h"
-
-CadToolBarSnap::CadToolBarSnap(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
- QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
-{
- ui.setupUi(this);
-}
-
-CadToolBarSnap::~CadToolBarSnap()
-{
-}
-
-//void CadToolBarSnap::mousePressEvent(QMouseEvent* e) {
-// if (e->button()==RightButton && cadToolBar!=NULL) {
-//cadToolBar->back();
-// e->accept();
-// }
-//}
-
-void CadToolBarSnap::contextMenuEvent(QContextMenuEvent * e)
-{
- e->accept();
-}
-
-void CadToolBarSnap::setCadToolBar(CadToolBar * tb)
-{
- cadToolBar = tb;
-
- if (tb!=NULL)
- {
- actionHandler = tb->getActionHandler();
- actionHandler->setCadToolBarSnap(this);
- }
- else
- RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarSnap::setCadToolBar(): No valid toolbar set.");
-}
-
-void CadToolBarSnap::snapFree()
-{
- if (actionHandler!=NULL)
- {
- disableSnaps();
- ui.bFree->setChecked(true);
- actionHandler->slotSnapFree();
- }
-}
-
-void CadToolBarSnap::snapGrid()
-{
- if (actionHandler!=NULL)
- {
- actionHandler->slotSnapGrid();
- disableSnaps();
- ui.bGrid->setChecked(true);
- }
-}
-
-void CadToolBarSnap::snapEndpoint() {
- if (actionHandler!=NULL) {
- actionHandler->slotSnapEndpoint();
- disableSnaps();
- ui.bEndpoint->setChecked(true);
- }
-}
-
-void CadToolBarSnap::snapOnEntity() {
- if (actionHandler!=NULL) {
- actionHandler->slotSnapOnEntity();
- disableSnaps();
- ui.bOnEntity->setChecked(true);
- }
-}
-
-void CadToolBarSnap::snapCenter() {
- if (actionHandler!=NULL) {
- actionHandler->slotSnapCenter();
- disableSnaps();
- ui.bCenter->setChecked(true);
- }
-}
-
-void CadToolBarSnap::snapMiddle() {
- if (actionHandler!=NULL) {
- actionHandler->slotSnapMiddle();
- disableSnaps();
- ui.bMiddle->setChecked(true);
- }
-}
-
-void CadToolBarSnap::snapDist() {
- if (actionHandler!=NULL) {
- actionHandler->slotSnapDist();
- disableSnaps();
- ui.bDist->setChecked(true);
- }
-}
-
-void CadToolBarSnap::snapIntersection() {
- if (actionHandler!=NULL) {
- actionHandler->slotSnapIntersection();
- disableSnaps();
- ui.bIntersection->setChecked(true);
- }
-}
-
-void CadToolBarSnap::snapIntersectionManual()
-{
- if (actionHandler!=NULL)
- {
- actionHandler->slotSnapIntersectionManual();
- //disableSnaps();
- //bIntersectionManual->setChecked(true);
- }
-}
-
-void CadToolBarSnap::restrictNothing()
-{
- if (actionHandler!=NULL)
- {
- actionHandler->slotRestrictNothing();
- disableRestrictions();
- ui.bResNothing->setChecked(true);
- }
-}
-
-void CadToolBarSnap::restrictOrthogonal()
-{
- if (actionHandler!=NULL)
- {
- actionHandler->slotRestrictOrthogonal();
- disableRestrictions();
- ui.bResOrthogonal->setChecked(true);
- }
-}
-
-void CadToolBarSnap::restrictHorizontal()
-{
- if (actionHandler!=NULL)
- {
- actionHandler->slotRestrictHorizontal();
- disableRestrictions();
- ui.bResHorizontal->setChecked(true);
- }
-}
-
-void CadToolBarSnap::restrictVertical()
-{
- if (actionHandler!=NULL)
- {
- actionHandler->slotRestrictVertical();
- disableRestrictions();
- ui.bResVertical->setChecked(true);
- }
-}
-
-void CadToolBarSnap::disableSnaps()
-{
- if (ui.bFree->isChecked())
- ui.bFree->setChecked(false);
-
- if (ui.bGrid->isChecked())
- ui.bGrid->setChecked(false);
-
- if (ui.bEndpoint->isChecked())
- ui.bEndpoint->setChecked(false);
-
- if (ui.bOnEntity->isChecked())
- ui.bOnEntity->setChecked(false);
-
- if (ui.bCenter->isChecked())
- ui.bCenter->setChecked(false);
-
- if (ui.bMiddle->isChecked())
- ui.bMiddle->setChecked(false);
-
- if (ui.bDist->isChecked())
- ui.bDist->setChecked(false);
-
- if (ui.bIntersection->isChecked())
- ui.bIntersection->setChecked(false);
-
- if (ui.bIntersectionManual->isChecked())
- ui.bIntersectionManual->setChecked(false);
-}
-
-void CadToolBarSnap::disableRestrictions()
-{
- if (ui.bResNothing->isChecked())
- ui.bResNothing->setChecked(false);
-
- if (ui.bResOrthogonal->isChecked())
- ui.bResOrthogonal->setChecked(false);
-
- if (ui.bResHorizontal->isChecked())
- ui.bResHorizontal->setChecked(false);
-
- if (ui.bResVertical->isChecked())
- ui.bResVertical->setChecked(false);
-}
-
-void CadToolBarSnap::setSnapMode(int sm)
-{
- switch (sm)
- {
- case RS2::SnapFree:
- ui.bFree->setChecked(true);
- break;
- case RS2::SnapEndpoint:
- ui.bEndpoint->setChecked(true);
- break;
- case RS2::SnapGrid:
- ui.bGrid->setChecked(true);
- break;
- case RS2::SnapOnEntity:
- ui.bOnEntity->setChecked(true);
- break;
- case RS2::SnapCenter:
- ui.bCenter->setChecked(true);
- break;
- case RS2::SnapMiddle:
- ui.bMiddle->setChecked(true);
- break;
- case RS2::SnapDist:
- ui.bDist->setChecked(true);
- break;
- case RS2::SnapIntersection:
- ui.bIntersection->setChecked(true);
- break;
- default:
- break;
- }
-}
-
-void CadToolBarSnap::setSnapRestriction(int sr)
-{
- switch (sr)
- {
- default:
- case RS2::RestrictNothing:
- ui.bResNothing->setChecked(true);
- break;
- case RS2::RestrictOrthogonal:
- ui.bResOrthogonal->setChecked(true);
- break;
- case RS2::RestrictHorizontal:
- ui.bResHorizontal->setChecked(true);
- break;
- case RS2::RestrictVertical:
- ui.bResVertical->setChecked(true);
- break;
- }
-}
-
-void CadToolBarSnap::setRelativeZero()
-{
- if (cadToolBar!=NULL && actionHandler!=NULL)
- actionHandler->slotSetRelativeZero();
-}
-
-void CadToolBarSnap::lockRelativeZero(bool on)
-{
- if (cadToolBar!=NULL && actionHandler!=NULL)
- actionHandler->slotLockRelativeZero(on);
-}
-
-void CadToolBarSnap::setLockRelativeZero(bool on)
-{
- ui.bLockRelZero->setChecked(on);
-}
-
-void CadToolBarSnap::back()
-{
- if (cadToolBar != NULL)
- cadToolBar->back();
-}
-#else