Mercurial > hg > soniczoomios
comparison 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 |
comparison
equal
deleted
inserted
replaced
23:dae6d77657a0 | 24:a4908ad8c78e |
---|---|
16 #include "presetManager.h" | 16 #include "presetManager.h" |
17 using namespace std; | 17 using namespace std; |
18 class Preset; | 18 class Preset; |
19 | 19 |
20 class Grid { | 20 class Grid { |
21 | |
22 public: | |
23 bool snapped; | |
24 | |
25 | |
26 Grid(); | |
27 ~Grid(); | |
28 void init(); | |
29 void move(TwoVector moveP); // shift view by pixels | |
30 void zoom(float factor); | |
31 | |
32 | |
33 void snapCheck(); | |
34 void shiftCentreToSnapped(); | |
35 void draw(); // draw lines | |
36 | |
37 void update(); // change according to zoom | |
38 | |
39 vector<int> getParams(); | |
40 TwoVector getCoord(); | |
41 void setMinZoom(); | |
42 void setMaxZoom(); | |
43 | |
44 vector<int> calculateParamsFromCoord(TwoVector coord) const; | |
45 TwoVector calculateCoordFromParams(vector<int> params) const; | |
46 TwoVector coordToPixel(TwoVector coord); | |
47 | |
48 // the inverse stuff | |
49 void setParams(vector<int>); | |
50 | |
21 private: | 51 private: |
22 double scale; // surface units per pixel | 52 double scale; // surface units per pixel GUI |
23 | 53 |
24 const double maxValue; // width of entire space | 54 const double maxValue; // width of entire space |
25 const double minValue; // smallest zoom | 55 const double minValue; // smallest zoom |
26 const int paramsPerDim; // no of parameters per dimension ( | 56 const int paramsPerDim; // no of parameters per dimension ( |
27 int codeLength; // the 1d size of the code, determines max extent of single tile, related to params per dim | 57 int codeLength; // the 1d size of the code, determines max extent of single tile, related to params per dim |
28 const int paramBitDepth; // number of bits for the parameter control data - i.e. always 7 for midi CC | 58 const int paramBitDepth; // number of bits for the parameter control data - i.e. always 7 for midi CC |
29 | 59 |
30 | 60 |
31 | 61 |
32 TwoVector topLeft; // top left corner of view, surface coords | 62 TwoVector topLeft; // top left corner of view, surface coords GUI |
33 TwoVector bottomRight; | 63 TwoVector bottomRight; |
34 TwoVector size; // size of view, surface coords | 64 TwoVector size; // size of view, surface coords |
35 TwoVector pixSize; // size of view pixels (ie screen size!) | 65 TwoVector pixSize; // size of view pixels (ie screen size!) |
66 | |
36 TwoVector centre; | 67 TwoVector centre; |
37 | |
38 | |
39 TwoVector snapCentre; | 68 TwoVector snapCentre; |
40 TwoVector snapDist; // number of pixels to snap to | 69 TwoVector snapDist; // number of pixels to snap to GUI |
41 Preset * closestPreset; // pointer to the currently selected (snapped to ) preset.. NULL if none. | 70 Preset * closestPreset; // pointer to the currently selected (snapped to ) preset.. NULL if none. |
42 | 71 |
43 bool maxZoom, minZoom; | 72 bool maxZoom, minZoom; |
44 int cubeWidth; // side of hypercube. 2 for binary coding. | 73 int cubeWidth; // side of hypercube. 2 for binary coding. |
45 | 74 |
71 void drawPresets(); | 100 void drawPresets(); |
72 | 101 |
73 void setCoord(TwoVector coord); | 102 void setCoord(TwoVector coord); |
74 void drawCrossHairs(); | 103 void drawCrossHairs(); |
75 | 104 |
76 public: | |
77 | 105 |
78 Grid(); | |
79 ~Grid(); | |
80 void init(); | |
81 void move(TwoVector moveP); // shift view by pixels | |
82 void zoom(float factor); | |
83 bool snapped; | |
84 | |
85 void snapCheck(); | |
86 void shiftCentreToSnapped(); | |
87 void draw(); // draw lines | |
88 | |
89 void update(); // change according to zoom | |
90 | |
91 vector<int> calculateParamsFromCoord(TwoVector coord) const; | |
92 TwoVector calculateCoordFromParams(vector<int> params) const; | |
93 TwoVector coordToPixel(TwoVector coord); | |
94 vector<int> getParams(); | |
95 TwoVector getCoord(); | |
96 void setMinZoom(); | |
97 void setMaxZoom(); | |
98 | |
99 // the inverse stuff | |
100 void setParams(vector<int>); | |
101 | 106 |
102 | 107 |
103 | 108 |
104 | 109 |
105 }; | 110 }; |