]> Shamusworld >> Repos - architektonas/blobdiff - src/widgets/qg_graphicview.cpp
Fixed preview rendering for ActionDrawLine...
[architektonas] / src / widgets / qg_graphicview.cpp
index 57c826758de613121b8ccf96edab7a95310f6724..b6d66dd9b499b133e67a6d4288d043c5d59a00d5 100644 (file)
@@ -659,7 +659,7 @@ void QG_GraphicView::adjustOffsetControls()
 
        RS_DEBUG->print("QG_GraphicView::adjustOffsetControls() begin");
 
-       if (container == NULL || hScrollBar == NULL || vScrollBar == NULL)
+       if (!container || !hScrollBar || !vScrollBar)
                return;
 
        disableUpdate();
@@ -880,13 +880,13 @@ What's needed:
        }
 #endif
 
-#if 1
 //Note that we do drawIt() regardless here because paintEvent() clears the background
 //*unless* we create the window with a specific style. Depending on our draw code, we
 //just may go that way...
        drawIt();
 //Need some logic here to do drawing in preview mode, since it'll be calling
 //update now instead of trying to do a direct draw...
+#if 0
        if (previewMode)
        {
 //hrm.         painter->setCompositionMode(QPainter::CompositionMode_Xor);
@@ -897,48 +897,40 @@ What's needed:
                // We'll set previewMode to false here, just because we can
                previewMode = false;
        }
-#endif
-
-       if (snapper.Visible())
-               snapper.Draw(this, painter);
-#if 0
-       if (snapperDraw)
-//     if (false)
+#else
+       if (preview.Visible())
        {
-               snapperDraw = false;
-
-               if (snapCoord1.valid)
+               RS_Pen oldPen = painter->getPen();
+               //ick. doesn't work...
+//             pntr.setCompositionMode(QPainter::CompositionMode_Xor);
+               // One of these has GOT to work... (but NEITHER do...!)
+               // It's because this is the pen for the container, not the entities INSIDE...
+               // How do we fix that??? [by drawing the container ourselves, that's how. :-/]
+               painter->setPen(RS_Pen(RS_Color(60, 255, 80), RS2::Width00, RS2::SolidLine));
+//             preview.setPen(RS_Pen(RS_Color(60, 255, 60), RS2::Width00, RS2::SolidLine));
+               painter->setOffset(preview.Offset());
+//This is green, but in the upper left hand corner...
+//painter->drawLine(Vector(15, 15), Vector(15, -15));
+//painter->drawLine(Vector(15, -15), Vector(-15, -15));
+//painter->drawLine(Vector(-15, -15), Vector(-15, 15));
+//painter->drawLine(Vector(-15, 15), Vector(15, 15));
+//             drawEntityPlain(&preview);
+               for(RS_Entity * e=preview.firstEntity(RS2::ResolveNone); e!=NULL;
+                       e = preview.nextEntity(RS2::ResolveNone))
                {
-                       // snap point
-//This is causing segfaults in the Qt::Painter code...
-//*This* is causing the segfault!
-//Actually, it looks like buggy painting code in PaintInterface()...
-                       painter->drawCircle(toGui(snapCoord1), 4);
-
-       #if 1
-                       // crosshairs:
-                       if (showCrosshairs1 == true)
-                       {
-                               painter->setPen(RS_Pen(RS_Color(0, 255, 255), RS2::Width00, RS2::DashLine));
-                               painter->drawLine(Vector(0, toGuiY(snapCoord1.y)),
-                                       Vector(getWidth(), toGuiY(snapCoord1.y)));
-                               painter->drawLine(Vector(toGuiX(snapCoord1.x), 0),
-                                       Vector(toGuiX(snapCoord1.x), getHeight()));
-                       }
-       #endif
-               }
-       #if 1
-               if (snapCoord1.valid && snapCoord1 != snapSpot1)
-               {
-                       painter->drawLine(toGui(snapSpot1) + Vector(-5, 0), toGui(snapSpot1) + Vector(-1, 4));
-                       painter->drawLine(toGui(snapSpot1) + Vector(0, 5), toGui(snapSpot1) + Vector(4, 1));
-                       painter->drawLine(toGui(snapSpot1) + Vector(5, 0), toGui(snapSpot1) + Vector(1, -4));
-                       painter->drawLine(toGui(snapSpot1) + Vector(0, -5), toGui(snapSpot1) + Vector(-4, -1));
+//                     e->setPen(RS_Pen(RS_Color(60, 255, 80), RS2::Width00, RS2::SolidLine));
+                       drawEntityPlain(e);
                }
-       #endif
+               //ick
+//             pntr.setCompositionMode(QPainter::CompositionMode_Source);
+               painter->setOffset(Vector(0, 0));
+               painter->setPen(oldPen);
        }
 #endif
 
+       if (snapper.Visible())
+               snapper.Draw(this, painter);
+
        delete painter;
        painter = NULL;