X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmainapp%2Fgraphicview.h;h=cb684c060aef93b3f75ed173c92a1f2134c1dff6;hb=bfd926cd5fd98e95b8b172fabd5340c9b1957e01;hp=90e30b21208b64b3eb30105e0e3ccbb17504c06b;hpb=dd17716b803ab2aa4163b905904a078f9fa5ae02;p=architektonas diff --git a/src/mainapp/graphicview.h b/src/mainapp/graphicview.h index 90e30b2..cb684c0 100644 --- a/src/mainapp/graphicview.h +++ b/src/mainapp/graphicview.h @@ -2,22 +2,22 @@ #define __GRAPHICVIEW_H__ #include -#include "rs.h" -#include "rs_color.h" -#include "rs_preview.h" -#include "rs_snapper.h" +#include "enums.h" +#include "color.h" +#include "preview.h" +#include "snapper.h" #include "vector.h" class ActionInterface; -class RS_CommandEvent; +class CommandEvent; class Drawing; class PaintInterface; -class RS_Entity; -class RS_EntityContainer; -class RS_EventHandler; -class RS_Grid; -class RS_LineTypePattern; -class RS_Pen; +class Entity; +class EntityContainer; +class EventHandler; +class Grid; +class LineTypePattern; +class Pen; class GraphicView { @@ -50,16 +50,16 @@ class GraphicView called whenever the view changed */ virtual void adjustZoomControls(); - virtual void setBackground(const RS_Color & bg); - RS_Color getBackground(); - RS_Color getForeground(); - void setGridColor(const RS_Color & c); - void setMetaGridColor(const RS_Color & c); - void setSelectedColor(const RS_Color & c); - void setHighlightedColor(const RS_Color & c); + virtual void setBackground(const Color & bg); + Color getBackground(); + Color getForeground(); + void setGridColor(const Color & c); + void setMetaGridColor(const Color & c); + void setSelectedColor(const Color & c); + void setHighlightedColor(const Color & c); virtual void setMouseCursor(RS2::CursorType /*c*/); - void setContainer(RS_EntityContainer * container); - RS_EntityContainer * getContainer(); + void setContainer(EntityContainer * container); + EntityContainer * getContainer(); void setFactor(double f); void setFactorX(double f); void setFactorY(double f); @@ -111,7 +111,7 @@ class GraphicView void mouseEnterEvent(); void keyPressEvent(QKeyEvent * e); void keyReleaseEvent(QKeyEvent * e); - void commandEvent(RS_CommandEvent * e); + void commandEvent(CommandEvent * e); void enableCoordinateInput(); void disableCoordinateInput(); @@ -134,18 +134,18 @@ class GraphicView virtual void drawWindow(Vector v1, Vector v2); virtual void drawIt(); - virtual void drawEntity(RS_Entity * e, double patternOffset = 0.0, bool db = false); - virtual void drawEntityPlain(RS_Entity * e, double patternOffset = 0.0); - virtual void setPenForEntity(RS_Entity * e); + virtual void drawEntity(Entity * e, double patternOffset = 0.0, bool db = false); + virtual void drawEntityPlain(Entity * e, double patternOffset = 0.0); + virtual void setPenForEntity(Entity * e); void simulateIt(); - void simulateEntity(RS_Entity * e, const RS_Pen & pen); - void drawLineSmooth(const Vector & p1, const Vector & p2, const RS_Pen & pen); + void simulateEntity(Entity * e, const Pen & pen); + void drawLineSmooth(const Vector & p1, const Vector & p2, const Pen & pen); void drawArcSmooth(const Vector & center, double radius, - double a1, double a2, bool rev, const RS_Pen & pen); + double a1, double a2, bool rev, const Pen & pen); void simulationDelay(bool step = false); - virtual RS_LineTypePattern * getPattern(RS2::LineType t); + virtual LineTypePattern * getPattern(RS2::LineType t); virtual void drawAbsoluteZero(); virtual void drawRelativeZero(); @@ -153,7 +153,7 @@ class GraphicView virtual void drawGrid(); virtual void drawMetaGrid(); virtual void updateGrid(); - RS_Grid * getGrid(); + Grid * getGrid(); virtual void updateGridStatusWidget(const QString & /*text*/); void setDefaultSnapMode(RS2::SnapMode sm); @@ -195,7 +195,7 @@ Having this class derive from that one *might* make sense... *Maybe*. Not sure. void setRelativeZero(const Vector & pos); void moveRelativeZero(const Vector & pos); - RS_EventHandler * getEventHandler(); + EventHandler * getEventHandler(); void setPrintPreview(bool pv); bool isPrintPreview(); void setPrinting(bool p); @@ -207,19 +207,28 @@ Having this class derive from that one *might* make sense... *Maybe*. Not sure. void setSimulationRapid(bool r); bool getSimulationRapid(); + Entity * CatchEntity(const Vector &, RS2::ResolveLevel level = RS2::ResolveNone); + Entity * CatchEntity(QMouseEvent *, RS2::ResolveLevel level = RS2::ResolveNone); + Entity * GetSnapperEntity(void); + Vector SnapPoint(QMouseEvent *); + Vector SnapGrid(Vector); + void DrawSnapper(PaintInterface *); + void SetSnapperVisible(bool visibility = true); + bool SnapperVisible(void); + protected: - RS_EntityContainer * container; - RS_EventHandler * eventHandler; + EntityContainer * container; + EventHandler * eventHandler; int mx; //!< Last known mouse cursor position int my; //!< Last known mouse cursor position PaintInterface * painter; - RS_Color background; //! background color (any color) - RS_Color foreground; //! foreground color (black or white) - RS_Color gridColor; //! grid color - RS_Color metaGridColor; //! meta grid color - RS_Color selectedColor; //! selected color - RS_Color highlightedColor; //! highlighted color - RS_Grid * grid; //! Grid + Color background; //! background color (any color) + Color foreground; //! foreground color (black or white) + Color gridColor; //! grid color + Color metaGridColor; //! meta grid color + Color selectedColor; //! selected color + Color highlightedColor; //! highlighted color + Grid * grid; //! Grid /** * Current default snap mode for this graphic view. Used for new * actions. @@ -231,13 +240,19 @@ Having this class derive from that one *might* make sense... *Maybe*. Not sure. */ RS2::SnapRestriction defaultSnapRes; RS2::DrawingMode drawingMode; - /** * Delete mode. If true, all drawing actions will delete in background color * instead. */ bool deleteMode; bool simulationRunning; //! If true, the simulation is currectly running + double snapDistance; //! Manually set snap distance + Entity * snapEntity; //! Entity to snap to (if any) + Vector snapSpot; + Vector snapCoord; + bool snapperVisible; //! Snapper visibility + int snapRange; + bool showCrosshairs; //! Snapper crosshair visibility private: int updateEnabled; @@ -265,8 +280,9 @@ Having this class derive from that one *might* make sense... *Maybe*. Not sure. public://for now // We use this here instead of deriving ActionInterface from it because // this makes more sense. - RS_Snapper snapper; - RS_Preview preview; +// Snapper snapper; +//yer next + Preview preview; //QG protected: @@ -300,7 +316,7 @@ class QG_GraphicView: public QWidget, public RS_GraphicView virtual void redraw(); virtual void adjustOffsetControls(); virtual void adjustZoomControls(); - virtual void setBackground(const RS_Color & bg); + virtual void setBackground(const Color & bg); virtual void setMouseCursor(RS2::CursorType c); virtual void updateGridStatusWidget(const QString & text);