1 #pragma once
2
3 /* greebo: The interface of the grid system
4 *
5 * Use these methods to set/get the grid size of the xyviews
6 */
7
8 #include "generic/constant.h"
9 #include "signal/signalfwd.h"
10
11 enum GridSize {
12 GRID_0125 = -3,
13 GRID_025 = -2,
14 GRID_05 = -1,
15 GRID_1 = 0,
16 GRID_2 = 1,
17 GRID_4 = 2,
18 GRID_8 = 3,
19 GRID_16 = 4,
20 GRID_32 = 5,
21 GRID_64 = 6,
22 GRID_128 = 7,
23 GRID_256 = 8
24 };
25
26 // grid renderings
27 enum GridLook {
28 GRIDLOOK_LINES,
29 GRIDLOOK_DOTLINES,
30 GRIDLOOK_MOREDOTLINES,
31 GRIDLOOK_CROSSES,
32 GRIDLOOK_DOTS,
33 GRIDLOOK_BIGDOTS,
34 GRIDLOOK_SQUARES
35 };
36
37 class IGridManager
38 {
39 public:
40 INTEGER_CONSTANT(Version, 1);
41 STRING_CONSTANT(Name, "grid");
42
~IGridManager()43 virtual ~IGridManager() {}
44
45 virtual void setGridSize(GridSize gridSize) = 0;
46 virtual float getGridSize() const = 0;
47
48 virtual int getGridPower() const = 0;
49
50 virtual void gridDown() = 0;
51 virtual void gridUp() = 0;
52
53 virtual GridLook getMajorLook() const = 0;
54 virtual GridLook getMinorLook() const = 0;
55
56 virtual void addGridChangeCallback(const SignalHandler& handler) = 0;
57
58 virtual void gridChangeNotify() = 0;
59 }; // class IGridManager
60
61 // Module definitions
62
63 #include "modulesystem.h"
64
65 template<typename Type>
66 class GlobalModule;
67 typedef GlobalModule<IGridManager> GlobalGridModule;
68
69 template<typename Type>
70 class GlobalModuleRef;
71 typedef GlobalModuleRef<IGridManager> GlobalGridModuleRef;
72
73 // This is the accessor for the grid module
GlobalGrid()74 inline IGridManager& GlobalGrid() {
75 return GlobalGridModule::getTable();
76 }
77