]> Shamusworld >> Repos - architektonas/blobdiff - src/mainapp/graphicview.h
Refactoring: Moved RS_GraphicView to GraphicView.
[architektonas] / src / mainapp / graphicview.h
similarity index 72%
rename from src/base/rs_graphicview.h
rename to src/mainapp/graphicview.h
index dafc78e17e214407ce653422e0d62dea3cdb5de6..96e16260a9f4156bc34f15bda47de4db4ec075ce 100644 (file)
@@ -1,34 +1,29 @@
-#ifndef RS_GRAPHICVIEW_H
-#define RS_GRAPHICVIEW_H
+#ifndef __GRAPHICVIEW_H__
+#define __GRAPHICVIEW_H__
 
-#include <stdarg.h>
-#include <QtCore>
+#include <QtGui>
 #include "rs.h"
-#include "rs_blocklist.h"
 #include "rs_color.h"
-#include "rs_linetypepattern.h"
-#include "rs_commandevent.h"
-#include "rs_entitycontainer.h"
+#include "vector.h"
 
+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_Grid;
+class RS_Pen;
 class RS_EventHandler;
-class RS_Preview;
-class PaintInterface;
 
-/**
- * This class is a common GUI interface for the graphic viewer
- * widget which has to be implementet by real GUI classes such
- * as the Qt graphical view.
- *
- * Note that this is just an interface used as a slot to
- * communicate with the qcadlib from a GUI level.
- */
-class RS_GraphicView
+class GraphicView
 {
        public:
-               RS_GraphicView();
-               virtual ~RS_GraphicView();
+               GraphicView();
+               ~GraphicView();
 
                void cleanUp();
 
@@ -47,6 +42,7 @@ class RS_GraphicView
                /** This virtual method must be overwritten to redraw
                the widget. */
                virtual void redraw() = 0;
+
                /** This virtual method must be overwritten and is then
                called whenever the view changed */
                virtual void adjustOffsetControls();
@@ -58,25 +54,6 @@ class RS_GraphicView
                 */
                virtual void setPainter(PaintInterface * p);
 
-// We're removing this crap...
-#if 0
-               /** This virtual method must be overwritten and must return
-               the painter device for the buffer of this widget */
-//             virtual PaintInterface * createPainter() = 0;
-               /**
-                * This virtual method must be overwritten and must return
-                *  the direct painter device for this widget
-                */
-//             virtual PaintInterface * createDirectPainter() = 0;
-               /**
-                * This virtual method must be overwritten and must destroy
-                * the painter device and point 'painter' to NULL. If the painter
-                * is static during the whole life of the application, it might
-                * just do nothing.
-                */
-//             virtual void destroyPainter() = 0;
-#endif
-
                virtual void setBackground(const RS_Color & bg);
                RS_Color getBackground();
                RS_Color getForeground();
@@ -235,7 +212,6 @@ class RS_GraphicView
                int mx;   //!< Last known mouse cursor position
                int my;   //!< Last known mouse cursor position
 
-       //    RS_Painter * painter;
                PaintInterface * painter;
                /** background color (any color) */
                RS_Color background;
@@ -275,7 +251,6 @@ class RS_GraphicView
        private:
                int updateEnabled;
                bool zoomFrozen;
-               //bool gridVisible;
                bool draftMode;
 
                Vector factor;
@@ -297,7 +272,6 @@ class RS_GraphicView
                bool printPreview;
                //! Active when printing only:
                bool printing;
-               //int drawRecursion;
 
                //! Simulation speed in percentage
                int simulationSpeed;
@@ -317,6 +291,109 @@ class RS_GraphicView
                Vector snapSpot1;
                Vector snapCoord1;
                bool showCrosshairs1;
+
+//QG
+
+
+//QC
+};
+
+#endif // __GRAPHICVIEW_H__
+
+#if 0
+class QG_GraphicView: public QWidget, public RS_GraphicView, //public Q3FilePreview,
+       public RS_LayerListListener, public RS_BlockListListener
+{
+       Q_OBJECT
+
+       public:
+               QG_GraphicView(QWidget * parent = 0, const char * name = 0, Qt::WindowFlags f = 0);
+               virtual ~QG_GraphicView();
+
+               virtual int getWidth();
+               virtual int getHeight();
+               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);
+               virtual void mouseReleaseEvent(QMouseEvent * e);
+               virtual void mouseMoveEvent(QMouseEvent * e);
+               virtual void tabletEvent(QTabletEvent * e);
+               virtual void leaveEvent(QEvent *);
+               virtual void enterEvent(QEvent *);
+               virtual void focusInEvent(QFocusEvent *);
+               virtual void focusOutEvent(QFocusEvent *);
+               virtual void wheelEvent(QWheelEvent * e);
+               virtual void keyPressEvent(QKeyEvent * e);
+               virtual void keyReleaseEvent(QKeyEvent * 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();
 
+       private:
+               //RS_Document* document;
+};
 #endif