Skip to content

Commit

Permalink
Refactor and format GridManager code
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Mar 31, 2017
1 parent 05517be commit 5b7e8e5
Show file tree
Hide file tree
Showing 8 changed files with 361 additions and 269 deletions.
18 changes: 10 additions & 8 deletions include/igrid.h
@@ -1,5 +1,4 @@
#ifndef IGRID_H_
#define IGRID_H_
#pragma once

/* greebo: The interface of the grid system
*
Expand All @@ -9,7 +8,8 @@
#include "imodule.h"
#include <sigc++/signal.h>

enum GridSize {
enum GridSize
{
GRID_0125 = -3,
GRID_025 = -2,
GRID_05 = -1,
Expand All @@ -26,7 +26,8 @@ enum GridSize {


// grid renderings
enum GridLook {
enum GridLook
{
GRIDLOOK_LINES,
GRIDLOOK_DOTLINES,
GRIDLOOK_MOREDOTLINES,
Expand All @@ -36,12 +37,14 @@ enum GridLook {
GRIDLOOK_SQUARES,
};

const std::string MODULE_GRID("Grid");
const char* const MODULE_GRID("Grid");

class IGridManager :
public RegisterableModule
{
public:
virtual ~IGridManager() {}

virtual void setGridSize(GridSize gridSize) = 0;
virtual float getGridSize() const = 0;

Expand All @@ -59,7 +62,8 @@ class IGridManager :
}; // class IGridManager

// This is the accessor for the grid module
inline IGridManager& GlobalGrid() {
inline IGridManager& GlobalGrid()
{
// Cache the reference locally
static IGridManager& _grid(
*std::static_pointer_cast<IGridManager>(
Expand All @@ -68,5 +72,3 @@ inline IGridManager& GlobalGrid() {
);
return _grid;
}

#endif /*IGRID_H_*/
1 change: 1 addition & 0 deletions radiant/Makefile.am
Expand Up @@ -85,6 +85,7 @@ darkradiant_SOURCES = main.cpp \
ui/overlay/OverlayDialog.cpp \
ui/overlay/Overlay.cpp \
ui/splash/Splash.cpp \
ui/grid/GridManager.cpp \
ui/mru/MRUMenuItem.cpp \
ui/mru/MRU.cpp \
ui/layers/LayerControl.cpp \
Expand Down
259 changes: 0 additions & 259 deletions radiant/ui/grid/Grid.cpp

This file was deleted.

6 changes: 6 additions & 0 deletions radiant/ui/grid/GridItem.h
Expand Up @@ -2,8 +2,12 @@

#include "igrid.h"

namespace ui
{

class GridItem
{
private:
// The grid size this item is representing
GridSize _gridSize;

Expand All @@ -29,3 +33,5 @@ class GridItem
}

}; // class GridItem

}

0 comments on commit 5b7e8e5

Please sign in to comment.