X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Frs_snapper.h;h=52bd4f791de78ceb8d6c07a8c25e9d66f1548983;hb=97d3cdae07ec9788cf80e7905abfdb5d67a7747c;hp=30e4a0cd0d55d0bef05efcf36cc7fcbc42093c03;hpb=27d4a138d23453e93a833e9347444b828a971cb4;p=architektonas diff --git a/src/base/rs_snapper.h b/src/base/rs_snapper.h index 30e4a0c..52bd4f7 100644 --- a/src/base/rs_snapper.h +++ b/src/base/rs_snapper.h @@ -8,6 +8,7 @@ class RS_Entity; class RS_EntityContainer; class GraphicView; +class PaintInterface; /** * This class is used for snapping functions in a graphic view. @@ -23,14 +24,19 @@ class RS_Snapper { public: RS_Snapper(RS_EntityContainer & container, GraphicView & graphicView); + RS_Snapper(); virtual ~RS_Snapper(); void init(); void finish(); + void SetContainer(RS_EntityContainer *); + void SetGraphicView(GraphicView *); RS_Entity * getKeyEntity(); void setSnapMode(RS2::SnapMode snapMode); void setSnapRestriction(RS2::SnapRestriction snapRes); + RS2::SnapMode getSnapMode(void); + RS2::SnapRestriction getSnapRestriction(void); void setSnapRange(int r); Vector snapPoint(QMouseEvent * e); @@ -42,14 +48,11 @@ class RS_Snapper Vector snapMiddle(Vector coord); Vector snapDist(Vector coord); Vector snapIntersection(Vector coord); - //Vector snapDirect(Vector coord, bool abs); Vector restrictOrthogonal(Vector coord); Vector restrictHorizontal(Vector coord); Vector restrictVertical(Vector coord); - //RS_Entity* catchLeafEntity(const Vector& pos); - //RS_Entity* catchLeafEntity(QMouseEvent* e); RS_Entity * catchEntity(const Vector & pos, RS2::ResolveLevel level = RS2::ResolveNone); RS_Entity * catchEntity(QMouseEvent * e, RS2::ResolveLevel level = RS2::ResolveNone); @@ -58,11 +61,40 @@ class RS_Snapper virtual void hideOptions(); virtual void showOptions(); - void drawSnapper(); - void deleteSnapper(); +// void drawSnapper(); +// void deleteSnapper(); - private: - void xorSnapper(); +/* +How should we handle this? All rendering goes through the GraphicView (QG_GraphicView to be +precise, soon to be merged in) as it should. So shouldn't we control the snapper through +that class as well? Unfortunately, all actions derive from this class... + +Should they? + +Not 100% sure. It does seem to make more sense to have them be a part of the GraphicView, +since snapping is a function of the grid and the entities contained in the view. (This would +also hold for the preview as well.) + +On to the interface: + +For allowing the crosshairs to be drawn, we'd have +void ShowSnapper(void) + +and +void HideSnapper(void) + +to hide it. Maybe +void SetSnapperCoords(Vector, Vector) + +for setting the coordinates? +*/ + public://for now + void SetVisible(bool visibility = true); + bool Visible(void); + void Draw(GraphicView *, PaintInterface *); + +// private: +// void xorSnapper(); protected: RS_EntityContainer * container;