grid: Set grid to use integer pixels
Each dot is an integer number of pixels wide, so supporting 0.5 width steps no longer makes sense. We round up the existing settings to the nearest integer and only allow integers in the dialog. Fixes: lp:1816748 * https://bugs.launchpad.net/kicad/+bug/1816748
This commit is contained in:
parent
1be759c5c1
commit
30612ca62d
|
@ -51,7 +51,7 @@ GAL_DISPLAY_OPTIONS::GAL_DISPLAY_OPTIONS()
|
|||
: gl_antialiasing_mode( OPENGL_ANTIALIASING_MODE::NONE ),
|
||||
cairo_antialiasing_mode( CAIRO_ANTIALIASING_MODE::NONE ),
|
||||
m_gridStyle( GRID_STYLE::DOTS ),
|
||||
m_gridLineWidth( 0.5 ),
|
||||
m_gridLineWidth( 1.0 ),
|
||||
m_gridMinSpacing( 10.0 ),
|
||||
m_axesEnabled( false ),
|
||||
m_fullscreenCursor( false ),
|
||||
|
@ -67,7 +67,7 @@ void GAL_DISPLAY_OPTIONS::ReadConfig( wxConfigBase* aCfg, const wxString& aBaseN
|
|||
static_cast<long>( KIGFX::GRID_STYLE::DOTS ) );
|
||||
m_gridStyle = UTIL::GetValFromConfig( gridStyleConfigVals, readLong );
|
||||
|
||||
aCfg->Read( aBaseName + GalGridLineWidthConfig, &m_gridLineWidth, 0.5 );
|
||||
aCfg->Read( aBaseName + GalGridLineWidthConfig, &m_gridLineWidth, 1.0 );
|
||||
aCfg->Read( aBaseName + GalGridMaxDensityConfig, &m_gridMinSpacing, 10 );
|
||||
aCfg->Read( aBaseName + GalGridAxesEnabledConfig, &m_axesEnabled, false );
|
||||
aCfg->Read( aBaseName + GalFullscreenCursorConfig, &m_fullscreenCursor, false );
|
||||
|
|
|
@ -108,7 +108,7 @@ bool GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
|
|||
|
||||
if( options.m_gridLineWidth != gridLineWidth )
|
||||
{
|
||||
gridLineWidth = options.m_gridLineWidth ;
|
||||
gridLineWidth = std::floor( options.m_gridLineWidth + 0.5 );
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,9 +32,9 @@
|
|||
/*
|
||||
* Spin control parameters
|
||||
*/
|
||||
static const double gridThicknessMin = 0.5;
|
||||
static const double gridThicknessMin = 1.0;
|
||||
static const double gridThicknessMax = 10.0;
|
||||
static const double gridThicknessStep = 0.5;
|
||||
static const double gridThicknessStep = 1.0;
|
||||
|
||||
static const double gridMinSpacingMin = 5;
|
||||
static const double gridMinSpacingMax = 200;
|
||||
|
@ -134,7 +134,7 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
|
|||
|
||||
m_gridSizeIncrementer->SetStep( gridThicknessMin, gridThicknessMax,
|
||||
gridThicknessStep );
|
||||
m_gridSizeIncrementer->SetPrecision( 1 );
|
||||
m_gridSizeIncrementer->SetPrecision( 0 );
|
||||
|
||||
m_gridMinSpacingIncrementer = std::make_unique<SPIN_INCREMENTAL_TEXT_CTRL>(
|
||||
*m_gridMinSpacingSpinBtn, *m_gridMinSpacing );
|
||||
|
@ -214,7 +214,7 @@ bool GAL_OPTIONS_PANEL::TransferDataFromWindow()
|
|||
m_galOptions.m_gridStyle = UTIL::GetValFromConfig(
|
||||
gridStyleSelectMap, m_gridStyle->GetSelection() );
|
||||
|
||||
m_galOptions.m_gridLineWidth = m_gridSizeIncrementer->GetValue();
|
||||
m_galOptions.m_gridLineWidth = std::floor( m_gridSizeIncrementer->GetValue() + 0.5 );
|
||||
|
||||
m_galOptions.m_gridMinSpacing = m_gridMinSpacingIncrementer->GetValue();
|
||||
|
||||
|
|
Loading…
Reference in New Issue