2 #include "rs_previewactioninterface.h"
7 * Sets the entity container on which the action class inherited
8 * from this interface operates.
10 RS_PreviewActionInterface::RS_PreviewActionInterface(const char * name,
11 RS_EntityContainer & container, RS_GraphicView & graphicView):
12 RS_ActionInterface(name, container, graphicView)
14 RS_DEBUG->print("RS_PreviewActionInterface::RS_PreviewActionInterface: Setting up action with preview: \"%s\"", name);
16 // preview is linked to the container for getting access to
17 // document settings / dictionary variables
18 preview = new RS_Preview(&container);
21 RS_DEBUG->print("RS_PreviewActionInterface::RS_PreviewActionInterface: Setting up action with preview: \"%s\": OK", name);
25 RS_PreviewActionInterface::~RS_PreviewActionInterface()
30 void RS_PreviewActionInterface::init(int status)
32 RS_ActionInterface::init(status);
37 void RS_PreviewActionInterface::finish()
39 RS_ActionInterface::finish();
44 void RS_PreviewActionInterface::suspend()
46 RS_ActionInterface::suspend();
51 void RS_PreviewActionInterface::resume()
53 RS_ActionInterface::resume();
57 void RS_PreviewActionInterface::trigger()
59 RS_ActionInterface::trigger();
65 * Clears the preview by removing all entities in it.
67 void RS_PreviewActionInterface::clearPreview()
73 * Draws the preview on the screen.
75 void RS_PreviewActionInterface::drawPreview()
82 * Deletes the preview from the screen.
84 void RS_PreviewActionInterface::deletePreview()
90 //#include "qg_graphicview.h"
92 * Draws / deletes the current preview.
94 void RS_PreviewActionInterface::xorPreview()
96 #warning "!!! xorPreview() not working AT ALL !!!"
98 if (!preview->isEmpty())
100 RS_Painter * painter = graphicView->createDirectPainter();
101 painter->setPreviewMode();
102 painter->setOffset(offset);
103 graphicView->drawEntity(preview, false);
104 graphicView->destroyPainter();
109 // OK, we need a new approach here--direct painting is NOT acceptable anymore!
110 // So, something like this:
112 In graphicView->drawEntity(preview, false); we set the pointer to an entity
113 in the GV. We set a flag telling paintEvent that this is a preview, and then
114 call update() in the view. *That* should do it...
116 //This doesn't work, causes the thing to crash...
117 //Now it works, just need to upgrade the rendering paths so that they aren't all
118 //fucked up like QCad was...
120 if (!preview->isEmpty())
122 graphicView->SetPreviewMode();
123 graphicView->SetPreviewEntity(preview);
124 graphicView->SetPreviewOffset(offset);
125 graphicView->redraw();