]> Shamusworld >> Repos - architektonas/blobdiff - src/actions/actiondefault.cpp
Removed Snapper class; still refactoring Snapper/Preview...
[architektonas] / src / actions / actiondefault.cpp
index 801a0512774e77d12c673ee47d742ebf79672bfe..74e77ddb45eb81cd9a4620ff75fa6fa87c5e662a 100644 (file)
@@ -34,9 +34,6 @@ ActionDefault::ActionDefault(EntityContainer & container,
        ActionInterface("Default", container, graphicView)
 {
        DEBUG->print("ActionDefault::ActionDefault");
-       //hm.
-//     graphicView.snapper.SetVisible();
-//     graphicView.preview.SetVisible();
        DEBUG->print("ActionDefault::ActionDefault: OK");
 }
 
@@ -55,8 +52,10 @@ void ActionDefault::init(int status /*= 0*/)
 
        ActionInterface::init(status);
        v1 = v2 = Vector(false);
-       graphicView->snapper.setSnapMode(RS2::SnapFree);
-       graphicView->snapper.setSnapRestriction(RS2::RestrictNothing);
+//     graphicView->snapper.setSnapMode(RS2::SnapFree);
+//     graphicView->snapper.setSnapRestriction(RS2::RestrictNothing);
+       graphicView->setDefaultSnapMode(RS2::SnapFree);
+       graphicView->setSnapRestriction(RS2::RestrictNothing);
        restrBak = RS2::RestrictNothing;
        DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
 
@@ -72,22 +71,24 @@ void ActionDefault::keyPressEvent(QKeyEvent * e)
 {
        if (e->key() == Qt::Key_Shift)
        {
-               restrBak = graphicView->snapper.getSnapRestriction();
-               graphicView->snapper.setSnapRestriction(RS2::RestrictOrthogonal);
+//             restrBak = graphicView->snapper.getSnapRestriction();
+//             graphicView->snapper.setSnapRestriction(RS2::RestrictOrthogonal);
+               restrBak = graphicView->getSnapRestriction();
+               graphicView->setSnapRestriction(RS2::RestrictOrthogonal);
        }
 }
 
 void ActionDefault::keyReleaseEvent(QKeyEvent * e)
 {
        if (e->key() == Qt::Key_Shift)
-               graphicView->snapper.setSnapRestriction(restrBak);
+//             graphicView->snapper.setSnapRestriction(restrBak);
+               graphicView->setSnapRestriction(restrBak);
 }
 
 void ActionDefault::mouseMoveEvent(QMouseEvent * e)
 {
        Vector mouse = graphicView->toGraph(Vector(e->x(), e->y()));
        Vector relMouse = mouse - graphicView->getRelativeZero();
-
        DIALOGFACTORY->updateCoordinateWidget(mouse, relMouse);
 
        switch (getStatus())
@@ -111,7 +112,8 @@ void ActionDefault::mouseMoveEvent(QMouseEvent * e)
                        else
                        {
                                // test for an entity to drag:
-                               Entity * en = graphicView->snapper.catchEntity(v1);
+//                             Entity * en = graphicView->snapper.catchEntity(v1);
+                               Entity * en = graphicView->CatchEntity(v1);
 
                                if (en && en->isSelected())
                                {
@@ -138,7 +140,8 @@ void ActionDefault::mouseMoveEvent(QMouseEvent * e)
                graphicView->preview.clear();
                graphicView->preview.addSelectionFrom(*container);
                graphicView->preview.moveRef(v1, v2 -v1);
-               graphicView->snapper.SetVisible();
+//             graphicView->snapper.SetVisible();
+               graphicView->SetSnapperVisible();
                graphicView->preview.SetVisible();
                graphicView->redraw();
                break;
@@ -153,7 +156,8 @@ void ActionDefault::mouseMoveEvent(QMouseEvent * e)
                graphicView->preview.clear();
                graphicView->preview.addSelectionFrom(*container);
                graphicView->preview.move(v2 -v1);
-               graphicView->snapper.SetVisible();
+//             graphicView->snapper.SetVisible();
+               graphicView->SetSnapperVisible();
                graphicView->preview.SetVisible();
                graphicView->redraw();
                break;
@@ -211,7 +215,7 @@ void ActionDefault::mousePressEvent(QMouseEvent * e)
                        DIALOGFACTORY->updateSelectionWidget(container->countSelected());
                        DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
                }
-               break;
+                       break;
 
                case MovingRef:
                {
@@ -228,7 +232,7 @@ void ActionDefault::mousePressEvent(QMouseEvent * e)
                        DIALOGFACTORY->updateSelectionWidget(container->countSelected());
                        DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
                }
-               break;
+                       break;
 
                default:
                        break;
@@ -249,7 +253,8 @@ void ActionDefault::mouseReleaseEvent(QMouseEvent * e)
                case Dragging:
                {
                        // select single entity:
-                       Entity * en = graphicView->snapper.catchEntity(e);
+//                     Entity * en = graphicView->snapper.catchEntity(e);
+                       Entity * en = graphicView->CatchEntity(e);
 
                        if (en)
                        {
@@ -259,9 +264,7 @@ void ActionDefault::mouseReleaseEvent(QMouseEvent * e)
 
                                Selection s(*container, graphicView);
                                s.selectSingle(en);
-
                                DIALOGFACTORY->updateSelectionWidget(container->countSelected());
-
                                e->accept();
                                setStatus(Neutral);
                        }
@@ -293,7 +296,8 @@ void ActionDefault::mouseReleaseEvent(QMouseEvent * e)
 
                default:
                        // Was either moving entity or point, so clear that shiatsu
-                       graphicView->snapper.SetVisible(false);
+//                     graphicView->snapper.SetVisible(false);
+                       graphicView->SetSnapperVisible(false);
                        graphicView->preview.SetVisible(false);
                        graphicView->redraw();
                        break;
@@ -315,7 +319,8 @@ void ActionDefault::mouseReleaseEvent(QMouseEvent * e)
                        break;
 
                default:
-                       graphicView->snapper.SetVisible(false);
+//                     graphicView->snapper.SetVisible(false);
+                       graphicView->SetSnapperVisible(false);
                        graphicView->preview.SetVisible(false);
                        DIALOGFACTORY->requestPreviousMenu();
                        e->accept();