X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Frs_snapper.h;h=575bd7badfe72890408385943bcf1e396873a563;hb=d774c2655ba2c3657a565f325411144452392277;hp=baceae4dd893aba95259034c76de263c2b179379;hpb=16ce54abf01ca3032e42a5bb11a4afcf9014dcca;p=architektonas diff --git a/src/base/rs_snapper.h b/src/base/rs_snapper.h index baceae4..575bd7b 100644 --- a/src/base/rs_snapper.h +++ b/src/base/rs_snapper.h @@ -2,14 +2,13 @@ #define RS_SNAPPER_H #include - #include "rs.h" -#include "rs_entitycontainer.h" -#include "rs_coordinateevent.h" +#include "vector.h" class RS_Entity; -class RS_GraphicView; -class Vector; +class RS_EntityContainer; +class GraphicView; +class PaintInterface; /** * This class is used for snapping functions in a graphic view. @@ -24,12 +23,15 @@ class Vector; class RS_Snapper { public: - RS_Snapper(RS_EntityContainer & container, RS_GraphicView & graphicView); + 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); @@ -50,8 +52,6 @@ class RS_Snapper 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); @@ -63,12 +63,41 @@ class RS_Snapper void drawSnapper(); void deleteSnapper(); +/* +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; - RS_GraphicView * graphicView; + GraphicView * graphicView; RS_Entity * keyEntity; Vector snapCoord; Vector snapSpot;