-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
78 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,60 @@ | ||
#include "drawingconstants.h" | ||
|
||
namespace Logicsim | ||
{ | ||
DrawingConstants::DrawingConstants() | ||
{ | ||
v_GATE_X_MARGIN = 20; | ||
v_GATE_Y_MARGIN = 5; | ||
v_CANVAS_WIDTH = 2250; | ||
v_CANVAS_HEIGHT = 2250; | ||
v_GRID_STEP = 150; | ||
v_NUMBER_OF_SQUARES_IN_ROW = v_CANVAS_WIDTH / v_GRID_STEP; | ||
v_NUMBER_OF_SQUARES_IN_COLUMN = v_CANVAS_HEIGHT / v_GRID_STEP; | ||
|
||
|
||
} | ||
DrawingConstants* DrawingConstants::instance = 0; | ||
DrawingConstants* DrawingConstants::Instance() | ||
{ | ||
if(instance == 0) instance = new DrawingConstants(); | ||
return instance; | ||
} | ||
|
||
int DrawingConstants::GATE_X_MARGIN() | ||
{ | ||
return v_GATE_X_MARGIN; | ||
} | ||
|
||
int DrawingConstants::GATE_Y_MARGIN() | ||
{ | ||
return v_GATE_Y_MARGIN; | ||
} | ||
|
||
int DrawingConstants::CANVAS_WIDTH() | ||
{ | ||
return v_CANVAS_WIDTH; | ||
} | ||
|
||
int DrawingConstants::CANVAS_HEIGHT() | ||
{ | ||
return v_CANVAS_HEIGHT; | ||
} | ||
|
||
int DrawingConstants::GRID_STEP() | ||
{ | ||
return v_GRID_STEP; | ||
} | ||
|
||
int DrawingConstants::NUMBER_OF_SQUARES_IN_ROW() | ||
{ | ||
return v_NUMBER_OF_SQUARES_IN_ROW; | ||
} | ||
|
||
int DrawingConstants::NUMBER_OF_SQUARES_IN_COLUMN() | ||
{ | ||
return v_NUMBER_OF_SQUARES_IN_COLUMN; | ||
} | ||
|
||
|
||
} //namespace LogicSim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,33 @@ | ||
#ifndef DRAWINGCONSTANTS_H | ||
#define DRAWINGCONSTANTS_H | ||
|
||
namespace Logicsim | ||
{ | ||
|
||
class DrawingConstants | ||
{ | ||
public: | ||
DrawingConstants* Instance(); | ||
int GATE_X_MARGIN(); | ||
int GATE_Y_MARGIN(); | ||
int CANVAS_WIDTH(); | ||
int CANVAS_HEIGHT(); | ||
int GRID_STEP(); | ||
int NUMBER_OF_SQUARES_IN_ROW(); | ||
int NUMBER_OF_SQUARES_IN_COLUMN(); | ||
|
||
private: | ||
static DrawingConstants* instance; | ||
DrawingConstants(); | ||
int v_GATE_X_MARGIN; | ||
int v_GATE_Y_MARGIN; | ||
int v_CANVAS_WIDTH; | ||
int v_CANVAS_HEIGHT; | ||
int v_GRID_STEP; | ||
int v_NUMBER_OF_SQUARES_IN_ROW; | ||
int v_NUMBER_OF_SQUARES_IN_COLUMN; | ||
|
||
signals: | ||
|
||
public slots: | ||
}; | ||
|
||
} //namespace LogicSim | ||
#endif // DRAWINGCONSTANTS_H |