]> Shamusworld >> Repos - architektonas/blobdiff - src/actions/actiondrawline.cpp
Bugfixes related to removing Snapper class.
[architektonas] / src / actions / actiondrawline.cpp
index a0be6db85b6a1812c2b6164fc4d61e61173e1c61..8bc0bb13401dca28548f90df534bed0bca53addf 100644 (file)
@@ -29,12 +29,8 @@ ActionDrawLine::ActionDrawLine(EntityContainer & container, GraphicView & graphi
 {
        DEBUG->print("ActionDrawLine::ActionDrawLine");
        reset();
-       //hm.
-//     graphicView.snapper.SetContainer(&container);
-//     graphicView.snapper.SetGraphicView(&graphicView);
-//     graphicView.snapper.SetVisible();
-//     graphicView.preview.SetVisible();
        DEBUG->print("ActionDrawLine::ActionDrawLine: OK");
+//printf("ActionDrawLine(): preview is%s visible, snapper is%s visible...\n", (graphicView.preview.Visible() ? "" : " NOT"), (graphicView.snapper.Visible() ? "" : " NOT"));
 }
 
 ActionDrawLine::~ActionDrawLine()
@@ -97,7 +93,8 @@ void ActionDrawLine::mouseMoveEvent(QMouseEvent * e)
        DEBUG->print("ActionDrawLine::mouseMoveEvent begin");
 
        DEBUG->print("ActionDrawLine::mouseMoveEvent: snap point");
-       Vector mouse = graphicView->snapper.snapPoint(e);
+//     Vector mouse = graphicView->snapper.snapPoint(e);
+       Vector mouse = graphicView->SnapPoint(e);
        DEBUG->print("ActionDrawLine::mouseMoveEvent: snap point: OK");
 
        if (getStatus() == SetEndpoint && data.startpoint.valid)
@@ -125,6 +122,10 @@ void ActionDrawLine::mouseMoveEvent(QMouseEvent * e)
 #endif
        }
 
+//OK, snapper & preview are set as NOT visible... why???
+//becuz other things are created in the meantime which turn this stuff off, treating
+//it like it isn't a shared resource which it is...
+//printf("ActionDrawLine::mouseMoveEvent(): preview is%s visible, snapper is%s visible...\n", (graphicView->preview.Visible() ? "" : " NOT"), (graphicView->snapper.Visible() ? "" : " NOT"));
        //hm. [ok, this works. :-D]
        graphicView->redraw();
        DEBUG->print("ActionDrawLine::mouseMoveEvent end");
@@ -134,23 +135,19 @@ void ActionDrawLine::mouseReleaseEvent(QMouseEvent * e)
 {
        if (e->button() == Qt::LeftButton)
        {
-               Vector ce(graphicView->snapper.snapPoint(e));
+//             Vector ce(graphicView->snapper.snapPoint(e));
+               Vector ce(graphicView->SnapPoint(e));
                coordinateEvent(&ce);
        }
        else if (e->button() == Qt::RightButton)
        {
-//             if (getStatus() == 0)
-//             {
-//                     graphicView->snapper.SetVisible(false);
-//                     graphicView->preview.SetVisible(false);
-//             }
-
                init(getStatus() - 1);
        }
 
        //hm. [Seems to work OK.]
-       graphicView->preview.clear();                           // Remove entities from container
-       graphicView->redraw();
+       //shouldn't need this...
+//     graphicView->preview.clear();                           // Remove entities from container
+//     graphicView->redraw();
 }
 
 void ActionDrawLine::coordinateEvent(Vector * e)