Browse Source

Make KIGFX::GRID_STYLE an enum class

This provides stronger typing to these values.
pull/3/merge
John Beard 9 years ago
committed by Maciej Suminski
parent
commit
ff3bfaf82b
  1. 4
      common/gal/gal_display_options.cpp
  2. 4
      common/gal/graphics_abstraction_layer.cpp
  3. 6
      common/gal/opengl/opengl_gal.cpp
  4. 8
      include/gal/gal_display_options.h
  5. 4
      pcbnew/dialogs/dialog_display_options.cpp

4
common/gal/gal_display_options.cpp

@ -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();
}

4
common/gal/graphics_abstraction_layer.cpp

@ -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 );

6
common/gal/opengl/opengl_gal.cpp

@ -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 );

8
include/gal/gal_display_options.h

@ -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

4
pcbnew/dialogs/dialog_display_options.cpp

@ -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…
Cancel
Save