]> Shamusworld >> Repos - architektonas/blobdiff - src/base/grid.cpp
In the middle of chasing down MDI not activating bug, renaming of Graphic to
[architektonas] / src / base / grid.cpp
index 163a12bdb9b0071e1f4f810ca38f9332b78eb9e0..bfb9cc8fdb1879365cc87cc7e872ba6f8fe43e50 100644 (file)
@@ -56,7 +56,7 @@ void Grid::update()
        if (!graphicView->isGridOn())
                return;
 
-       Drawing * graphic = graphicView->getGraphic();
+       Drawing * drawing = graphicView->GetDrawing();
 
        // auto scale grid?
        settings.beginGroup("Appearance");
@@ -67,8 +67,8 @@ void Grid::update()
        // get grid setting
        Vector userGrid;
 
-       if (graphic != NULL)
-               userGrid = graphic->getVariableVector("$GRIDUNIT", Vector(-1.0, -1.0));
+       if (drawing != NULL)
+               userGrid = drawing->getVariableVector("$GRIDUNIT", Vector(-1.0, -1.0));
 
        // delete old grid:
        if (pt != NULL)
@@ -99,10 +99,10 @@ void Grid::update()
        RS2::Unit unit = RS2::None;
        RS2::LinearFormat format = RS2::Decimal;
 
-       if (graphic != NULL)
+       if (drawing != NULL)
        {
-               unit = graphic->getUnit();
-               format = graphic->getLinearFormat();
+               unit = drawing->getUnit();
+               format = drawing->getLinearFormat();
        }
 
        Vector gridWidth;
@@ -310,16 +310,12 @@ void Grid::update()
                && graphicView->toGuiDY(gridWidth.y) > 2)
        {
                // find grid boundaries
-               double left = (int)(graphicView->toGraphX(0) / gridWidth.x)
-                       * gridWidth.x;
+               double left = (int)(graphicView->toGraphX(0) / gridWidth.x) * gridWidth.x;
                double right = (int)(graphicView->toGraphX(graphicView->getWidth())
                        / gridWidth.x) * gridWidth.x;
-               double top = (int)(graphicView->toGraphY(0)
+               double top = (int)(graphicView->toGraphY(0) / gridWidth.y) * gridWidth.y;
+               double bottom = (int)(graphicView->toGraphY(graphicView->getHeight())
                        / gridWidth.y) * gridWidth.y;
-               double bottom =
-                       (int)(graphicView->toGraphY(graphicView->getHeight())
-                       / gridWidth.y) * gridWidth.y;
-
 
                left -= gridWidth.x;
                right += gridWidth.x;