]> Shamusworld >> Repos - architektonas/blobdiff - src/mainapp/graphicview.h
In the middle of major refactoring...
[architektonas] / src / mainapp / graphicview.h
index 96e16260a9f4156bc34f15bda47de4db4ec075ce..6e2ec159156379b4b7a8ff0afb81335eb5c98036 100644 (file)
@@ -4,20 +4,20 @@
 #include <QtGui>
 #include "rs.h"
 #include "rs_color.h"
+#include "rs_preview.h"
+#include "rs_snapper.h"
 #include "vector.h"
 
+class ActionInterface;
+class RS_CommandEvent;
 class Drawing;
 class PaintInterface;
-class RS_EntityContainer;
-class RS_ActionInterface;
 class RS_Entity;
-class RS_LineTypePattern;
-class RS_CommandEvent;
-class Vector;
-class RS_Preview;
+class RS_EntityContainer;
+class RS_EventHandler;
 class RS_Grid;
+class RS_LineTypePattern;
 class RS_Pen;
-class RS_EventHandler;
 
 class GraphicView
 {
@@ -49,10 +49,6 @@ class GraphicView
                /** 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();
@@ -89,10 +85,10 @@ class GraphicView
                void freezeZoom(bool freeze);
                bool isZoomFrozen();
 
-               void setDefaultAction(RS_ActionInterface * action);
-               RS_ActionInterface *  getDefaultAction();
-               void setCurrentAction(RS_ActionInterface * action);
-               RS_ActionInterface * getCurrentAction();
+               void setDefaultAction(ActionInterface * action);
+               ActionInterface *  getDefaultAction();
+               void setCurrentAction(ActionInterface * action);
+               ActionInterface * getCurrentAction();
 
                void killSelectActions();
                void killAllActions();
@@ -198,13 +194,6 @@ class GraphicView
                void setSimulationRapid(bool r);
                bool getSimulationRapid();
 
-               //this is here because of crappy braindead infrastructure
-               void SetPreviewMode(bool mode = true);
-               void SetPreviewEntity(RS_Preview *);
-               void SetPreviewOffset(Vector);
-               void SetSnapperDraw(bool);
-               void SetSnapperVars(Vector snapSpot, Vector snapCoord, bool showCrosshairs);
-
        protected:
                RS_EntityContainer * container;
                RS_EventHandler * eventHandler;
@@ -282,27 +271,40 @@ class GraphicView
                //! Last position (for rapid move)
                Vector simulationLast;
 
-       protected:
-               // crap to make painting with update() possible
-               RS_Preview * previewEntity;
-               bool previewMode;
-               Vector previewOffset;
-               bool snapperDraw;
-               Vector snapSpot1;
-               Vector snapCoord1;
-               bool showCrosshairs1;
+       public://for now
+               // We use this here instead of deriving ActionInterface from it because
+               // this makes more sense.
+               RS_Snapper snapper;
+               RS_Preview preview;
 
 //QG
+       protected:
+               int lastWidth;
+               int lastHeight;
+               //! Horizontal scrollbar.
+               QScrollBar * hScrollBar;
+               //! Vertical scrollbar.
+               QScrollBar * vScrollBar;
+               //! 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;
 
-
-//QC
+//QC was merged with QG
 };
 
 #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
 
@@ -315,21 +317,10 @@ class QG_GraphicView: public QWidget, public RS_GraphicView, //public Q3FilePrev
                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);
@@ -347,53 +338,8 @@ class QG_GraphicView: public QWidget, public RS_GraphicView, //public Q3FilePrev
                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();
-
-       private:
-               //RS_Document* document;
 };
 #endif