Mercurial > hg > soniczoomios
diff grid.h @ 24:a4908ad8c78e
Top and bottom toolbars. Intro page.
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Fri, 01 Feb 2013 11:16:56 +0000 |
parents | e44dc6f7f12e |
children | 94df2cd72d7b |
line wrap: on
line diff
--- a/grid.h Fri Jan 25 17:42:47 2013 +0000 +++ b/grid.h Fri Feb 01 11:16:56 2013 +0000 @@ -18,8 +18,38 @@ class Preset; class Grid { + +public: + bool snapped; + + + Grid(); + ~Grid(); + void init(); + void move(TwoVector moveP); // shift view by pixels + void zoom(float factor); + + + void snapCheck(); + void shiftCentreToSnapped(); + void draw(); // draw lines + + void update(); // change according to zoom + + vector<int> getParams(); + TwoVector getCoord(); + void setMinZoom(); + void setMaxZoom(); + + vector<int> calculateParamsFromCoord(TwoVector coord) const; + TwoVector calculateCoordFromParams(vector<int> params) const; + TwoVector coordToPixel(TwoVector coord); + + // the inverse stuff + void setParams(vector<int>); + private: - double scale; // surface units per pixel + double scale; // surface units per pixel GUI const double maxValue; // width of entire space const double minValue; // smallest zoom @@ -29,15 +59,14 @@ - TwoVector topLeft; // top left corner of view, surface coords + TwoVector topLeft; // top left corner of view, surface coords GUI TwoVector bottomRight; TwoVector size; // size of view, surface coords TwoVector pixSize; // size of view pixels (ie screen size!) + TwoVector centre; - - TwoVector snapCentre; - TwoVector snapDist; // number of pixels to snap to + TwoVector snapDist; // number of pixels to snap to GUI Preset * closestPreset; // pointer to the currently selected (snapped to ) preset.. NULL if none. bool maxZoom, minZoom; @@ -73,31 +102,7 @@ void setCoord(TwoVector coord); void drawCrossHairs(); -public: - Grid(); - ~Grid(); - void init(); - void move(TwoVector moveP); // shift view by pixels - void zoom(float factor); - bool snapped; - - void snapCheck(); - void shiftCentreToSnapped(); - void draw(); // draw lines - - void update(); // change according to zoom - - vector<int> calculateParamsFromCoord(TwoVector coord) const; - TwoVector calculateCoordFromParams(vector<int> params) const; - TwoVector coordToPixel(TwoVector coord); - vector<int> getParams(); - TwoVector getCoord(); - void setMinZoom(); - void setMaxZoom(); - - // the inverse stuff - void setParams(vector<int>);