Make KIGFX::GRID_STYLE an enum class
This provides stronger typing to these values.
This commit is contained in:
parent
7ad30b7167
commit
ff3bfaf82b
|
@ -35,7 +35,7 @@ static const wxString GalGridStyleConfig( "GridStyle" );
|
|||
|
||||
GAL_DISPLAY_OPTIONS::GAL_DISPLAY_OPTIONS()
|
||||
: gl_antialiasing_mode( OPENGL_ANTIALIASING_MODE::NONE ),
|
||||
m_gridStyle( GRID_STYLE_DOTS )
|
||||
m_gridStyle( GRID_STYLE::DOTS )
|
||||
{}
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ void GAL_DISPLAY_OPTIONS::ReadConfig( wxConfigBase* aCfg, wxString aBaseName )
|
|||
|
||||
aCfg->Read( aBaseName + GalGridStyleConfig,
|
||||
reinterpret_cast<long*>( &m_gridStyle ),
|
||||
static_cast<long>( KIGFX::GRID_STYLE::GRID_STYLE_DOTS ) );
|
||||
static_cast<long>( KIGFX::GRID_STYLE::DOTS ) );
|
||||
|
||||
NotifyChanged();
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ GAL::GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
|
|||
SetGridDrawThreshold( 10 );
|
||||
SetCoarseGrid( 10 );
|
||||
SetGridLineWidth( 0.5 );
|
||||
gridStyle = GRID_STYLE_LINES;
|
||||
gridStyle = GRID_STYLE::LINES;
|
||||
|
||||
// Initialize the cursor shape
|
||||
SetCursorColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
|
||||
|
@ -202,7 +202,7 @@ void GAL::DrawGrid()
|
|||
// Draw the grid behind all other layers
|
||||
SetLayerDepth( depthRange.y * 0.75 );
|
||||
|
||||
if( gridStyle == GRID_STYLE_LINES )
|
||||
if( gridStyle == GRID_STYLE::LINES )
|
||||
{
|
||||
SetIsFill( false );
|
||||
SetIsStroke( true );
|
||||
|
|
|
@ -888,7 +888,7 @@ void OPENGL_GAL::DrawGrid()
|
|||
glDisable( GL_DEPTH_TEST );
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
|
||||
if( gridStyle == GRID_STYLE_DOTS )
|
||||
if( gridStyle == GRID_STYLE::DOTS )
|
||||
{
|
||||
glEnable( GL_STENCIL_TEST );
|
||||
glStencilFunc( GL_ALWAYS, 1, 1 );
|
||||
|
@ -918,7 +918,7 @@ void OPENGL_GAL::DrawGrid()
|
|||
}
|
||||
}
|
||||
|
||||
if( gridStyle == GRID_STYLE_DOTS )
|
||||
if( gridStyle == GRID_STYLE::DOTS )
|
||||
{
|
||||
glStencilFunc( GL_NOTEQUAL, 0, 1 );
|
||||
glColor4d( gridColor.r, gridColor.g, gridColor.b, 1.0 );
|
||||
|
@ -942,7 +942,7 @@ void OPENGL_GAL::DrawGrid()
|
|||
}
|
||||
}
|
||||
|
||||
if( gridStyle == GRID_STYLE_DOTS )
|
||||
if( gridStyle == GRID_STYLE::DOTS )
|
||||
glDisable( GL_STENCIL_TEST );
|
||||
|
||||
glEnable( GL_DEPTH_TEST );
|
||||
|
|
|
@ -32,12 +32,12 @@ class wxString;
|
|||
namespace KIGFX
|
||||
{
|
||||
/**
|
||||
* GridStyle: Type definition of the grid style
|
||||
* GRID_STYLE: Type definition of the grid style
|
||||
*/
|
||||
enum GRID_STYLE
|
||||
enum class GRID_STYLE
|
||||
{
|
||||
GRID_STYLE_LINES, ///< Use lines for the grid
|
||||
GRID_STYLE_DOTS ///< Use dots for the grid
|
||||
LINES, ///< Use lines for the grid
|
||||
DOTS ///< Use dots for the grid
|
||||
};
|
||||
|
||||
enum class OPENGL_ANTIALIASING_MODE : long
|
||||
|
|
|
@ -47,13 +47,13 @@
|
|||
static void setRadioFromGridStyle( wxRadioBox& aRBox,
|
||||
KIGFX::GRID_STYLE aStyle )
|
||||
{
|
||||
aRBox.SetSelection( aStyle != KIGFX::GRID_STYLE_DOTS );
|
||||
aRBox.SetSelection( aStyle != KIGFX::GRID_STYLE::DOTS );
|
||||
}
|
||||
|
||||
|
||||
static KIGFX::GRID_STYLE getGridStyleFromRadio( const wxRadioBox& aRBox )
|
||||
{
|
||||
return aRBox.GetSelection() == 0 ? KIGFX::GRID_STYLE_DOTS : KIGFX::GRID_STYLE_LINES;
|
||||
return aRBox.GetSelection() == 0 ? KIGFX::GRID_STYLE::DOTS : KIGFX::GRID_STYLE::LINES;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue