graphicView.snapper.SetContainer(&container);
graphicView.snapper.SetGraphicView(&graphicView);
graphicView.snapper.SetVisible();
+ graphicView.preview.SetVisible();
RS_DEBUG->print("RS_ActionDrawLine::RS_ActionDrawLine: OK");
}
void RS_ActionDrawLine::trigger()
{
+#if 0
RS_PreviewActionInterface::trigger(); // XOR off screen, delete entities in container
+#else
+ graphicView->preview.clear();
+// graphicView->redraw();
+#endif
RS_Line * line = new RS_Line(container, data);
line->setLayerToActive();
document->endUndoCycle();
}
-// deleteSnapper(); // XOR off of screen
-// graphicView->moveRelativeZero(Vector(0.0, 0.0));
-//This is unnecessary, because we added this to the container...
-//#warning "!!! Here's the trouble... Trying to draw direct !!!"
-// graphicView->drawEntity(line);
graphicView->moveRelativeZero(line->getEndpoint());
-// drawSnapper(); // XOR on screen
+ //hm. [OK, it just moves the relative zero tho. Overkill. And remove preview, so OK.]
+ graphicView->redraw();
RS_DEBUG->print("RS_ActionDrawLine::trigger(): line added: %d", line->getId());
}
RS_DEBUG->print("RS_ActionDrawLine::mouseMoveEvent begin");
RS_DEBUG->print("RS_ActionDrawLine::mouseMoveEvent: snap point");
-//This used to draw the snapper, but now that's defunct... so, !!! FIX !!!
-// Vector mouse = snapPoint(e);
Vector mouse = graphicView->snapper.snapPoint(e);
RS_DEBUG->print("RS_ActionDrawLine::mouseMoveEvent: snap point: OK");
if (getStatus() == SetEndpoint && data.startpoint.valid)
{
RS_DEBUG->print("RS_ActionDrawLine::mouseMoveEvent: update preview");
+#if 0
//not needed, but without this, it doesn't draw... strange...
//obviously we haven't gotten our rendering path correct...
// deletePreview(); // XOR off of screen
RS_DEBUG->print("RS_ActionDrawLine::mouseMoveEvent: draw preview");
// drawPreview(); // XOR on screen
xorPreview(); // XOR on screen
+#else
+ // This is lame. Creating a new Line every time the endpoint moves.
+ // Surely we can alter the line entity inside the preview, no?
+ graphicView->preview.clear(); // Remove entities from the container
+ RS_Line * line = new RS_Line(&(graphicView->preview), RS_LineData(data.startpoint, mouse));
+//wha? Even THIS doesn't work!!! It was the container...
+// line->setPen(RS_Pen(RS_Color(60, 255, 60), RS2::Width00, RS2::SolidLine));
+ graphicView->preview.addEntity(line);
+#endif
}
- //hm.
+ //hm. [ok, this works. :-D]
graphicView->redraw();
RS_DEBUG->print("RS_ActionDrawLine::mouseMoveEvent end");
}
}
else if (e->button() == Qt::RightButton)
{
+ if (getStatus() == 0)
+ {
+ graphicView->snapper.SetVisible(false);
+ graphicView->preview.SetVisible(false);
+ }
+
+#if 0
deletePreview(); // XOR off of screen
clearPreview(); // Remove entities from the container
-// deleteSnapper(); // XOR off of screen
+#else
+#endif
init(getStatus() - 1);
}
+
+ //hm. [Seems to work OK.]
+ graphicView->preview.clear(); // Remove entities from container
+ graphicView->redraw();
}
void RS_ActionDrawLine::coordinateEvent(Vector * e)
if (history.count() > 1)
{
history.removeLast();
- deletePreview(); // XOR off of screen
- clearPreview(); // Delete entities in container
+// deletePreview(); // XOR off of screen
+// clearPreview(); // Delete entities in container
graphicView->setCurrentAction(new RS_ActionEditUndo(true, *container, *graphicView));
data.startpoint = *history.last();
graphicView->moveRelativeZero(data.startpoint);
+graphicView->preview.clear();
+graphicView->redraw();
}
else
RS_DIALOGFACTORY->commandMessage(tr("Cannot undo: Not enough entities defined yet."));
}
}
+#define SCROLL_DELTA 4
void RS_ActionZoomPan::mouseMoveEvent(QMouseEvent * e)
{
x2 = e->x();
y2 = e->y();
//This is where we see if the delta was big enough to warrant a redraw...
- if (getStatus() == 1 && (abs(x2 - x1) > 7 || abs(y2 - y1) > 7))
+//Dunno if this is needed anymore, the Qt rendering pipeline should be able to
+//hang with this...
+// if (getStatus() == 1 && (abs(x2 - x1) > 7 || abs(y2 - y1) > 7))
+ if (getStatus() == 1 && (abs(x2 - x1) > SCROLL_DELTA || abs(y2 - y1) > SCROLL_DELTA))
trigger();
}
*/
//printf("RS_EntityContainer::addEntity(): entity=%08X\n", entity);
- if (entity == NULL)
+ if (!entity)
return;
if (entity->rtti() == RS2::EntityImage || entity->rtti() == RS2::EntityHatch)
}
else
{
- if (defaultAction != NULL)
+ if (defaultAction)
defaultAction->mouseReleaseEvent(e);
else
e->ignore();
*/
void RS_EventHandler::mouseMoveEvent(QMouseEvent * e)
{
- if (actionIndex >= 0 && currentActions[actionIndex] != NULL
+ if (actionIndex >= 0 && currentActions[actionIndex]
&& !currentActions[actionIndex]->isFinished())
{
currentActions[actionIndex]->mouseMoveEvent(e);
}
else
{
- if (defaultAction!=NULL)
+ if (defaultAction)
{
defaultAction->mouseMoveEvent(e);
e->accept();
}
else
{
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->commandMessage("Expression Syntax Error");
}
// send command event directly to current action:
if (!e->isAccepted())
{
- if (actionIndex >= 0 && currentActions[actionIndex] != NULL
+ if (actionIndex >= 0 && currentActions[actionIndex]
&& !currentActions[actionIndex]->isFinished())
{
currentActions[actionIndex]->commandEvent(e);
}
else
{
- if (defaultAction != NULL)
+ if (defaultAction)
defaultAction->commandEvent(e);
}
}
{
RS_DEBUG->print("RS_EventHandler::setCurrentAction");
- if (action == NULL)
+ if (!action)
return;
// Predecessor of the new action or NULL:
RS_ActionInterface * predecessor = NULL;
// Suspend current action:
- if (actionIndex >= 0 && currentActions[actionIndex] != NULL
+ if (actionIndex >= 0 && currentActions[actionIndex]
&& !currentActions[actionIndex]->isFinished())
{
predecessor = currentActions[actionIndex];
}
else
{
- if (defaultAction != NULL)
+ if (defaultAction)
{
predecessor = defaultAction;
predecessor->suspend();
*/
bool RS_EventHandler::hasAction()
{
- if (actionIndex != -1 || defaultAction != NULL)
+ if (actionIndex != -1 || defaultAction)
return true;
return false;
void RS_Line::draw(PaintInterface * painter, GraphicView * view, double patternOffset)
{
- if (painter == NULL || view == NULL)
+ if (!painter || !view)
//{
//printf("RS_Line::draw(): Bailing out!!! painter=%08X, view=%08X\n", painter, view);
return;
RS_LineTypePattern * pat = (isSelected() ? &patternSelected : view->getPattern(getPen().getLineType()));
#endif
- if (pat == NULL)
+ if (!pat)
{
//printf("RS_Line::draw(): Pattern == NULL!\n");
RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Line::draw: Invalid line pattern");
#include "rs_entitycontainer.h"
#include "graphicview.h"
#include "rs_information.h"
+#include "paintintf.h"
#include "settings.h"
/**
* Constructor.
*/
-RS_Preview::RS_Preview(RS_EntityContainer * parent): RS_EntityContainer(parent)
+RS_Preview::RS_Preview(RS_EntityContainer * parent): RS_EntityContainer(parent),
+ visible(false)
{
settings.beginGroup("Appearance");
maxEntities = settings.value("MaxPreview", 100).toInt();
}
/**
-* Clones the given entity and adds the clone to the preview.
-*/
-void RS_Preview::addCloneOf(RS_Entity* entity)
+ * Clones the given entity and adds the clone to the preview.
+ */
+void RS_Preview::addCloneOf(RS_Entity * entity)
{
- if (entity == NULL)
+ if (!entity)
return;
RS_Entity * clone = entity->clone();
}
/**
-* Adds all entities from 'container' to the preview (unselected).
-*/
+ * Adds all entities from 'container' to the preview (unselected).
+ */
void RS_Preview::addAllFrom(RS_EntityContainer & container)
{
int c = 0;
}
/**
-* Adds all selected entities from 'container' to the preview (unselected).
-*/
+ * Adds all selected entities from 'container' to the preview (unselected).
+ */
void RS_Preview::addSelectionFrom(RS_EntityContainer & container)
{
int c = 0;
}
/**
-* Adds all entities in the given range and those which have endpoints
-* in the given range to the preview.
-*/
+ * Adds all entities in the given range and those which have endpoints in the
+ * given range to the preview.
+ */
void RS_Preview::addStretchablesFrom(RS_EntityContainer & container, const Vector & v1,
const Vector & v2)
{
}
}
}
+
+void RS_Preview::SetOffset(Vector v)
+{
+ offset = v;
+}
+
+Vector RS_Preview::Offset(void)
+{
+ return offset;
+}
+
+void RS_Preview::SetVisible(bool visibility/*= true*/)
+{
+ visible = visibility;
+}
+
+bool RS_Preview::Visible(void)
+{
+ return visible;
+}
+
+void RS_Preview::Draw(GraphicView * view, PaintInterface * painter)
+{
+ if (isEmpty())
+ return;
+
+// painter->setPreviewMode();
+ painter->setOffset(offset);
+ view->drawEntity(this, false);
+ painter->setOffset(Vector(0, 0));
+}
#define RS_PREVIEW_H
#include "rs_entitycontainer.h"
+#include "vector.h"
class RS_Entity;
+class PaintInterface;
/**
* This class supports previewing. The RS_Snapper class uses
virtual void addStretchablesFrom(RS_EntityContainer & container,
const Vector & v1, const Vector & v2);
+ void SetOffset(Vector);
+ Vector Offset(void);
+ void SetVisible(bool visibility = true);
+ bool Visible(void);
+ void Draw(GraphicView *, PaintInterface *);
+
private:
int maxEntities;
+ bool visible;
+ Vector offset;
};
#endif
*/
void RS_PreviewActionInterface::xorPreview()
{
+#warning "!!! RS_PreviewActionInterface::xorPreview() is DEPRECATED !!!"
//not true anymore..
//#warning "!!! xorPreview() not working AT ALL !!!"
#if 0
protected:
/**
- * Preview that holds the entities to be previewed.
- */
+ * Preview that holds the entities to be previewed.
+ */
RS_Preview * preview;
/**
- * Keeps track of the drawings in XOR mode.
- */
+ * Keeps track of the drawings in XOR mode.
+ */
bool visible;
/**
- * Current offset of the preview.
- */
+ * Current offset of the preview.
+ */
Vector offset;
};
finished = true;
}
+//bleh
void RS_Snapper::SetContainer(RS_EntityContainer * c)
{
container = c;
Vector RS_Snapper::snapPoint(QMouseEvent * e)
{
RS_DEBUG->print("RS_Snapper::snapPoint");
-
-//meh deleteSnapper();
snapSpot = Vector(false);
if (!e)
break;
}
- // handle snap restrictions that can be activated in addition
- // to the ones above:
+ // Handle snap restrictions that can be activated in addition to the ones above:
switch (snapRes)
{
case RS2::RestrictOrthogonal:
break;
}
-//#warning "!!! THIS IS WHERE THE SNAPPER IS BEING DRAWN... !!!"
-// drawSnapper();
-
if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->updateCoordinateWidget(snapCoord, snapCoord - graphicView->getRelativeZero());
Vector RS_Snapper::restrictHorizontal(Vector coord)
{
Vector rz = graphicView->getRelativeZero();
-// Vector ret = Vector(coord.x, rz.y);
-// return ret;
+
return Vector(coord.x, rz.y);
}
Vector RS_Snapper::restrictVertical(Vector coord)
{
Vector rz = graphicView->getRelativeZero();
-// Vector ret = Vector(rz.x, coord.y);
-// return ret;
+
return Vector(rz.x, coord.y);
}
*/
void RS_Snapper::xorSnapper()
{
+#warning "!!! RS_Snapper::xorSnapper() is DEPRECATED !!!"
//Not completely true...
//#warning "!!! xorSnapper() not working AT ALL !!!"
#if 0
graphicView->destroyPainter();
visible = !visible;
}
-#else
+//#else
if (finished || !snapSpot.valid || !graphicView)
return;
void RS_Snapper::SetVisible(bool visibility/*= true*/)
{
-// graphicView->SetSnapperDraw(visibility);
visible = visibility;
}
bool RS_Snapper::Visible(void)
{
-// graphicView->SetSnapperDraw(visibility);
return visible;
}
void RS_Snapper::Draw(GraphicView * view, PaintInterface * painter)
{
-//printf("RS_Snapper::Draw()...");
if (finished || !snapSpot.valid)
return;
-//printf("{D}\n");
-
-//meh painter->setPreviewMode();
//hm, I don't like graphicView kicking around in here, especially since it now
//lives inside GraphicView... How to !!! FIX !!!?
if (snapCoord.valid)
{
// snap point
+ painter->setPen(RS_Pen(RS_Color(0, 127, 255), RS2::Width00, RS2::DashLine));
painter->drawCircle(view->toGui(snapCoord), 4);
- // crosshairs:
+ // crosshairs
if (showCrosshairs)
{
painter->setPen(RS_Pen(RS_Color(0, 255, 255), RS2::Width00, RS2::DashLine));
* Constructor.
*/
GraphicView::GraphicView(): background(), foreground(), previewMode(false),
- previewOffset(Vector(0, 0)), snapperDraw(false)
+ previewOffset(Vector(0, 0))//, snapperDraw(false)
{
drawingMode = RS2::ModeFull;
printing = false;
GraphicView::~GraphicView()
{
//delete eventHandler;
- if (painter != NULL)
+ if (painter)
delete painter;
delete grid;
*/
Drawing * GraphicView::getGraphic()
{
- if (container != NULL && container->rtti() == RS2::EntityGraphic)
- return (Drawing*)container;
- else
- return NULL;
+ if (container && container->rtti() == RS2::EntityGraphic)
+ return (Drawing *)container;
+
+ return NULL;
}
/**
{
}
+#if 0
/**
* Sets an external painter device.
*/
{
painter = p;
}
+#endif
/**
* Sets the background color. Note that applying the background
if (drawingMode == RS2::ModePreview /*|| draftMode==true*/)
return;
- // set color of entity
- if (painter && !painter->isPreviewMode())
- {
- // Getting pen from entity (or layer)
- RS_Pen pen = e->getPen(true);
-
- int w = pen.getWidth();
+ if (!painter || painter->isPreviewMode())
+ return;
- if (w < 0)
- w = 0;
+ // set color of entity
+ // Getting pen from entity (or layer)
+ RS_Pen pen = e->getPen(true);
- // scale pen width:
- if (!draftMode)
- {
- double uf = 1.0; // unit factor
- double wf = 1.0; // width factor
- Drawing * graphic = container->getGraphic();
+ int w = pen.getWidth();
- if (graphic != NULL)
- {
- uf = RS_Units::convert(1.0, RS2::Millimeter, graphic->getUnit());
+ if (w < 0)
+ w = 0;
- if ((isPrinting() || isPrintPreview()) && graphic->getPaperScale() > 1.0e-6)
- wf = 1.0 / graphic->getPaperScale();
- }
+ // scale pen width:
+ if (!draftMode)
+ {
+ double uf = 1.0; // unit factor
+ double wf = 1.0; // width factor
+ Drawing * graphic = container->getGraphic();
- pen.setScreenWidth(toGuiDX(w / 100.0 * uf * wf));
- }
- else
+ if (graphic)
{
- //pen.setWidth(RS2::Width00);
- pen.setScreenWidth(0);
- }
+ uf = RS_Units::convert(1.0, RS2::Millimeter, graphic->getUnit());
- // prevent drawing with 1-width which is slow:
- if (RS_Math::round(pen.getScreenWidth()) == 1)
- pen.setScreenWidth(0.0);
+ if ((isPrinting() || isPrintPreview()) && graphic->getPaperScale() > 1.0e-6)
+ wf = 1.0 / graphic->getPaperScale();
+ }
- // prevent background color on background drawing:
- if (pen.getColor().stripFlags() == background.stripFlags())
- pen.setColor(foreground);
+ pen.setScreenWidth(toGuiDX(w / 100.0 * uf * wf));
+ }
+ else
+ {
+ //pen.setWidth(RS2::Width00);
+ pen.setScreenWidth(0);
+ }
- // this entity is selected:
- if (e->isSelected())
- {
- pen.setLineType(RS2::DotLine);
- //pen.setColor(RS_Color(0xa5,0x47,0x47));
- pen.setColor(selectedColor);
- }
+ // prevent drawing with 1-width which is slow:
+ if (RS_Math::round(pen.getScreenWidth()) == 1)
+ pen.setScreenWidth(0.0);
- // this entity is highlighted:
- if (e->isHighlighted())
- {
- //pen.setColor(RS_Color(0x73, 0x93, 0x73));
- pen.setColor(highlightedColor);
- }
+ // prevent background color on background drawing:
+ if (pen.getColor().stripFlags() == background.stripFlags())
+ pen.setColor(foreground);
- // deleting not drawing:
- if (getDeleteMode())
- pen.setColor(background);
+ // this entity is selected:
+ if (e->isSelected())
+ {
+ pen.setLineType(RS2::DotLine);
+ //pen.setColor(RS_Color(0xa5,0x47,0x47));
+ pen.setColor(selectedColor);
+ }
- painter->setPen(pen);
+ // this entity is highlighted:
+ if (e->isHighlighted())
+ {
+ //pen.setColor(RS_Color(0x73, 0x93, 0x73));
+ pen.setColor(highlightedColor);
}
+
+ // deleting not drawing:
+ if (getDeleteMode())
+ pen.setColor(background);
+
+ painter->setPen(pen);
}
/**
* Draws an entity.
* The painter must be initialized and all the attributes (pen) must be set.
*/
-void GraphicView::drawEntityPlain(RS_Entity * e, double patternOffset)
+void GraphicView::drawEntityPlain(RS_Entity * e, double patternOffset/*= 0.0*/)
{
//Problems can still occur here when passing in a deleted object... It won't be
//NULL, but it will cause a segfault here...
//OK, the above sets the snap mode in the snapper that's derived from
//the RS_ActionInterface and RS_Snapper. So the following should fix
- //us up, hm notwithstanding.
+ //us up, hm notwithstanding. [and it does. :-)]
//hm.
snapper.setSnapMode(sm);
}
previewOffset = o;
}
+//Don't need this no more...
+#if 0
void GraphicView::SetSnapperDraw(bool mode)
{
snapperDraw = mode;
snapCoord1 = snapCoord;
showCrosshairs1 = showCrosshairs;
}
+#endif
#include <QtGui>
#include "rs.h"
#include "rs_color.h"
+#include "rs_preview.h"
#include "rs_snapper.h"
#include "vector.h"
/** This virtual method must be overwritten and is then
called whenever the view changed */
virtual void adjustZoomControls();
- /**
- * Sets an external painter device.
- */
- virtual void setPainter(PaintInterface * p);
virtual void setBackground(const RS_Color & bg);
RS_Color getBackground();
void SetPreviewMode(bool mode = true);
void SetPreviewEntity(RS_Preview *);
void SetPreviewOffset(Vector);
- void SetSnapperDraw(bool);
- void SetSnapperVars(Vector snapSpot, Vector snapCoord, bool showCrosshairs);
+//We can remove this now...
+// void SetSnapperDraw(bool);
+// void SetSnapperVars(Vector snapSpot, Vector snapCoord, bool showCrosshairs);
protected:
RS_EntityContainer * container;
// We use this here instead of deriving ActionInterface from it because
// this makes more sense.
RS_Snapper snapper;
+ RS_Preview preview;
protected:
// crap to make painting with update() possible
RS_Preview * previewEntity;
bool previewMode;
Vector previewOffset;
- bool snapperDraw;
- Vector snapSpot1;
- Vector snapCoord1;
- bool showCrosshairs1;
+// bool snapperDraw;
+// Vector snapSpot1;
+// Vector snapCoord1;
+// bool showCrosshairs1;
//QG
protected:
#endif // __GRAPHICVIEW_H__
#if 0
-class QG_GraphicView: public QWidget, public RS_GraphicView, //public Q3FilePreview,
- public RS_LayerListListener, public RS_BlockListListener
+class QG_GraphicView: public QWidget, public RS_GraphicView
{
Q_OBJECT
virtual void redraw();
virtual void adjustOffsetControls();
virtual void adjustZoomControls();
-// virtual RS_Painter * createPainter();
-// virtual RS_Painter * createDirectPainter();
-#warning "!!! Need to scrub out all instances of createPainter and createDirectPainter !!!"
-// virtual PaintInterface * createPainter();
-// virtual PaintInterface * createDirectPainter();
-// virtual void destroyPainter();
virtual void setBackground(const RS_Color & bg);
virtual void setMouseCursor(RS2::CursorType c);
virtual void updateGridStatusWidget(const QString & text);
- // Methods from RS_LayerListListener Interface:
- virtual void layerEdited(RS_Layer *);
- virtual void layerRemoved(RS_Layer *);
- virtual void layerToggled(RS_Layer *);
-
protected:
virtual void emulateMouseMoveEvent();
virtual void mousePressEvent(QMouseEvent * e);
void paintEvent(QPaintEvent *);
virtual void resizeEvent(QResizeEvent * e);
-#warning "!!! File preview needs porting to Qt4 !!!"
-// void previewUrl(const Q3Url &u);
-
private slots:
void slotHScrolled(int value);
void slotVScrolled(int value);
-
- private:
-#warning "!!! Double buffering is not necessary anymore !!!"
- //! Buffer for double-buffering
- QPixmap * buffer;
-// int refCount;
-
- protected:
- int lastWidth;
- int lastHeight;
- //! Horizontal scrollbar.
- QG_ScrollBar * hScrollBar;
- //! Vertical scrollbar.
- QG_ScrollBar * vScrollBar;
- //! Layout used to fit in the view and the scrollbars.
- QGridLayout * layout;
- //! Label for grid spacing.
- QLabel * gridStatus;
- //! CAD mouse cursor
- QCursor * curCad;
- //! Delete mouse cursor
- QCursor * curDel;
- //! Select mouse cursor
- QCursor * curSelect;
- //! Magnifying glass mouse cursor
- QCursor * curMagnifier;
- //! Hand mouse cursor
- QCursor * curHand;
-};
-#endif
-
-#if 0
-class QC_GraphicView: public QG_GraphicView
-{
- public:
- QC_GraphicView(RS_Document * doc, QWidget * parent = 0);
- virtual ~QC_GraphicView();
-
- virtual void drawIt();
};
#endif
RS_DEBUG->print("QG_GraphicView::adjustOffsetControls() begin");
- if (container == NULL || hScrollBar == NULL || vScrollBar == NULL)
+ if (!container || !hScrollBar || !vScrollBar)
return;
disableUpdate();
}
#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);
// 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;