Grid line/point size & density settings

This commit is contained in:
John Beard 2017-02-20 10:52:43 +01:00 committed by Maciej Suminski
commit 6164b9be2a
27 changed files with 1738 additions and 405 deletions

View File

@ -230,6 +230,7 @@ set( COMMON_SRCS
gr_basic.cpp
hotkeys_basic.cpp
html_messagebox.cpp
incremental_text_ctrl.cpp
kiface_i.cpp
kiway.cpp
kiway_express.cpp

View File

@ -39,7 +39,10 @@
using namespace KIGFX;
BASIC_GAL basic_gal;
KIGFX::GAL_DISPLAY_OPTIONS basic_displayOptions;
// the basic GAL doesn't get an external display option object
BASIC_GAL basic_gal( basic_displayOptions );
const VECTOR2D BASIC_GAL::transform( const VECTOR2D& aPoint ) const
{

View File

@ -51,6 +51,7 @@
#include <view/view.h>
#include <view/view_controls.h>
#include <gal/graphics_abstraction_layer.h>
#include <gal/gal_display_options.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
@ -127,7 +128,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
const wxString& aTitle,
const wxPoint& aPos, const wxSize& aSize,
long aStyle, const wxString & aFrameName ) :
KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName )
KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
m_galDisplayOptions( std::make_unique<KIGFX::GAL_DISPLAY_OPTIONS>() )
{
m_file_checker = NULL;
@ -711,7 +713,7 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry,
long( DEFAULT_MAX_UNDO_ITEMS ) );
m_galDisplayOptions.ReadConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
m_galDisplayOptions->ReadConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
}
@ -729,7 +731,7 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
if( GetScreen() )
aCfg->Write( baseCfgName + MaxUndoItemsEntry, long( GetScreen()->GetMaxUndoItems() ) );
m_galDisplayOptions.WriteConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
m_galDisplayOptions->WriteConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
}

View File

@ -114,15 +114,12 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
Connect( m_onShowTimer.GetId(), wxEVT_TIMER,
wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onShowTimer ), NULL, this );
m_onShowTimer.Start( 10 );
LoadGalSettings();
}
EDA_DRAW_PANEL_GAL::~EDA_DRAW_PANEL_GAL()
{
StopDrawing();
SaveGalSettings();
assert( !m_drawing );
@ -353,7 +350,7 @@ bool EDA_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
break;
case GAL_TYPE_CAIRO:
new_gal = new KIGFX::CAIRO_GAL( this, this, this );
new_gal = new KIGFX::CAIRO_GAL( m_options, this, this, this );
break;
default:
@ -363,19 +360,21 @@ bool EDA_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
case GAL_TYPE_NONE:
// KIGFX::GAL is a stub - it actually does cannot display anything,
// but prevents code relying on GAL canvas existence from crashing
new_gal = new KIGFX::GAL();
new_gal = new KIGFX::GAL( m_options );
break;
}
}
catch( std::runtime_error& err )
{
new_gal = new KIGFX::GAL();
new_gal = new KIGFX::GAL( m_options );
aGalType = GAL_TYPE_NONE;
DisplayError( m_parent, wxString( err.what() ) );
result = false;
}
SaveGalSettings();
// trigger update of the gal options in case they differ
// from the defaults
m_options.NotifyChanged();
assert( new_gal );
delete m_gal;
@ -391,49 +390,11 @@ bool EDA_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
m_view->SetGAL( m_gal );
m_backend = aGalType;
LoadGalSettings();
return result;
}
bool EDA_DRAW_PANEL_GAL::SaveGalSettings()
{
if( !m_edaFrame || !m_gal )
return false;
wxConfigBase* cfg = Kiface().KifaceSettings();
wxString baseCfgName = m_edaFrame->GetName();
if( !cfg )
return false;
if( !cfg->Write( baseCfgName + GRID_STYLE_CFG, (long) GetGAL()->GetGridStyle() ) )
return false;
return true;
}
bool EDA_DRAW_PANEL_GAL::LoadGalSettings()
{
if( !m_edaFrame || !m_gal )
return false;
wxConfigBase* cfg = Kiface().KifaceSettings();
wxString baseCfgName = m_edaFrame->GetName();
if( !cfg )
return false;
long gridStyle;
cfg->Read( baseCfgName + GRID_STYLE_CFG, &gridStyle, (long) KIGFX::GRID_STYLE::GRID_STYLE_DOTS );
GetGAL()->SetGridStyle( (KIGFX::GRID_STYLE) gridStyle );
return true;
}
void EDA_DRAW_PANEL_GAL::onEvent( wxEvent& aEvent )
{
if( m_lostFocus )
@ -497,6 +458,3 @@ void EDA_DRAW_PANEL_GAL::onShowTimer( wxTimerEvent& aEvent )
OnShow();
}
}
const wxChar EDA_DRAW_PANEL_GAL::GRID_STYLE_CFG[] = wxT( "GridStyle" );

View File

@ -42,8 +42,10 @@ using namespace KIGFX;
CAIRO_GAL::CAIRO_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
CAIRO_GAL::CAIRO_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions,
wxWindow* aParent, wxEvtHandler* aMouseListener,
wxEvtHandler* aPaintListener, const wxString& aName ) :
GAL( aDisplayOptions ),
wxWindow( aParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxEXPAND, aName )
{
parentWindow = aParent;
@ -103,6 +105,20 @@ CAIRO_GAL::~CAIRO_GAL()
}
bool CAIRO_GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
{
bool refresh = false;
if( super::updatedGalDisplayOptions( aOptions ) )
{
Refresh();
refresh = true;
}
return refresh;
}
void CAIRO_GAL::BeginDrawing()
{
initSurface();

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2016 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 2016-2017 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -24,20 +24,59 @@
#include <gal/gal_display_options.h>
#include <wx/config.h>
#include <config_map.h>
using namespace KIGFX;
static const wxString GalGLAntialiasingKeyword( wxT( "OpenGLAntialiasingMode" ) );
/*
* Config option strings
*/
static const wxString GalGLAntialiasingKeyword( "OpenGLAntialiasingMode" );
static const wxString GalGridStyleConfig( "GridStyle" );
static const wxString GalGridLineWidthConfig( "GridLineWidth" );
static const wxString GalGridMaxDensityConfig( "GridMaxDensity" );
static const UTIL::CFG_MAP<KIGFX::OPENGL_ANTIALIASING_MODE> aaModeConfigVals =
{
{ KIGFX::OPENGL_ANTIALIASING_MODE::NONE, 0 },
{ KIGFX::OPENGL_ANTIALIASING_MODE::SUBSAMPLE_HIGH, 1 },
{ KIGFX::OPENGL_ANTIALIASING_MODE::SUBSAMPLE_ULTRA, 2 },
{ KIGFX::OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X2, 3 },
{ KIGFX::OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X4, 4 },
};
static const UTIL::CFG_MAP<KIGFX::GRID_STYLE> gridStyleConfigVals =
{
{ KIGFX::GRID_STYLE::DOTS, 0 },
{ KIGFX::GRID_STYLE::LINES, 1 },
};
GAL_DISPLAY_OPTIONS::GAL_DISPLAY_OPTIONS()
: gl_antialiasing_mode( OPENGL_ANTIALIASING_MODE::NONE )
: gl_antialiasing_mode( OPENGL_ANTIALIASING_MODE::NONE ),
m_gridStyle( GRID_STYLE::DOTS )
{}
void GAL_DISPLAY_OPTIONS::ReadConfig( wxConfigBase* aCfg, wxString aBaseName )
{
aCfg->Read( aBaseName + GalGLAntialiasingKeyword,
reinterpret_cast<long*>(&gl_antialiasing_mode),
(long)KIGFX::OPENGL_ANTIALIASING_MODE::NONE );
long readLong; // Temp value buffer
aCfg->Read( aBaseName + GalGLAntialiasingKeyword, &readLong,
static_cast<long>( KIGFX::OPENGL_ANTIALIASING_MODE::NONE ) );
gl_antialiasing_mode = UTIL::GetValFromConfig( aaModeConfigVals, readLong );
aCfg->Read( aBaseName + GalGridStyleConfig, &readLong,
static_cast<long>( KIGFX::GRID_STYLE::DOTS ) );
m_gridStyle = UTIL::GetValFromConfig( gridStyleConfigVals, readLong );
aCfg->Read( aBaseName + GalGridLineWidthConfig,
&m_gridLineWidth, 0.5 );
aCfg->Read( aBaseName + GalGridMaxDensityConfig,
&m_gridMinSpacing, 10 );
NotifyChanged();
}
@ -46,7 +85,16 @@ void GAL_DISPLAY_OPTIONS::ReadConfig( wxConfigBase* aCfg, wxString aBaseName )
void GAL_DISPLAY_OPTIONS::WriteConfig( wxConfigBase* aCfg, wxString aBaseName )
{
aCfg->Write( aBaseName + GalGLAntialiasingKeyword,
static_cast<long>(gl_antialiasing_mode) );
UTIL::GetConfigForVal( aaModeConfigVals, gl_antialiasing_mode ) );
aCfg->Write( aBaseName + GalGridStyleConfig,
UTIL::GetConfigForVal( gridStyleConfigVals, m_gridStyle ) );
aCfg->Write( aBaseName + GalGridLineWidthConfig,
m_gridLineWidth );
aCfg->Write( aBaseName + GalGridMaxDensityConfig,
m_gridMinSpacing );
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2012 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 2012-2017 Kicad Developers, see change_log.txt for contributors.
*
* Graphics Abstraction Layer (GAL) - base class
*
@ -37,7 +37,8 @@ using namespace KIGFX;
const double GAL::METRIC_UNIT_LENGTH = 1e9;
GAL::GAL() :
GAL::GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
options( aDisplayOptions ),
strokeFont( this )
{
// Set the default values for the internal variables
@ -57,10 +58,10 @@ GAL::GAL() :
// Set grid defaults
SetGridVisibility( true );
SetGridStyle( GRID_STYLE_LINES );
SetGridDrawThreshold( 10 );
SetCoarseGrid( 10 );
SetGridLineWidth( 0.5 );
gridLineWidth = 0.5;
gridStyle = GRID_STYLE::LINES;
gridMinSpacing = 10;
// Initialize the cursor shape
SetCursorColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
@ -68,6 +69,9 @@ GAL::GAL() :
SetCursorEnabled( false );
strokeFont.LoadNewStrokeFont( newstroke_font, newstroke_font_bufsize );
// subscribe for settings updates
observerLink = options.Subscribe( this );
}
@ -75,6 +79,41 @@ GAL::~GAL()
{
}
void GAL::OnGalDisplayOptionsChanged( const GAL_DISPLAY_OPTIONS& aOptions )
{
// defer to the child class first
updatedGalDisplayOptions( aOptions );
// there is no refresh to do at this level
}
bool GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
{
bool refresh = false;
if( options.m_gridStyle != gridStyle )
{
gridStyle = options.m_gridStyle ;
refresh = true;
}
if( options.m_gridLineWidth != gridLineWidth )
{
gridLineWidth = options.m_gridLineWidth ;
refresh = true;
}
if( options.m_gridMinSpacing != gridMinSpacing )
{
gridMinSpacing = options.m_gridMinSpacing;
refresh = true;
}
// tell the derived class if the base class needs an update or not
return refresh;
}
void GAL::SetTextAttributes( const EDA_TEXT* aText )
{
@ -124,6 +163,14 @@ void GAL::ComputeWorldScreenMatrix()
}
double GAL::computeMinGridSpacing() const
{
// just return the current value. This could be cleverer and take
// into account other settings in future
return gridMinSpacing;
}
void GAL::DrawGrid()
{
if( !gridVisibility )
@ -137,15 +184,20 @@ void GAL::DrawGrid()
VECTOR2D worldStartPoint = screenWorldMatrix * VECTOR2D( 0.0, 0.0 );
VECTOR2D worldEndPoint = screenWorldMatrix * VECTOR2D( screenSize );
const double gridThreshold = computeMinGridSpacing();
int gridScreenSizeDense = KiROUND( gridSize.x * worldScale );
int gridScreenSizeCoarse = KiROUND( gridSize.x * static_cast<double>( gridTick ) * worldScale );
// Compute the line marker or point radius of the grid
double marker = 2.0 * gridLineWidth / worldScale;
// Note: generic grids can't handle sub-pixel lines without
// either losing fine/course distinction or having some dots
// fail to render
double marker = std::max( 1.0, gridLineWidth ) / worldScale;
double doubleMarker = 2.0 * marker;
// Check if the grid would not be too dense
if( std::max( gridScreenSizeDense, gridScreenSizeCoarse ) > gridDrawThreshold )
if( std::max( gridScreenSizeDense, gridScreenSizeCoarse ) > gridThreshold )
{
// Compute grid variables
int gridStartX = KiROUND( worldStartPoint.x / gridSize.x );
@ -175,7 +227,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 );
@ -186,13 +238,13 @@ void GAL::DrawGrid()
// Vertical lines
for( int j = gridStartY; j != gridEndY; j += dirY )
{
if( j % gridTick == 0 && gridScreenSizeDense > gridDrawThreshold )
if( j % gridTick == 0 && gridScreenSizeDense > gridThreshold )
SetLineWidth( doubleMarker );
else
SetLineWidth( marker );
if( ( j % gridTick == 0 && gridScreenSizeCoarse > gridDrawThreshold )
|| gridScreenSizeDense > gridDrawThreshold )
if( ( j % gridTick == 0 && gridScreenSizeCoarse > gridThreshold )
|| gridScreenSizeDense > gridThreshold )
{
drawGridLine( VECTOR2D( gridStartX * gridSize.x, j * gridSize.y + gridOrigin.y ),
VECTOR2D( gridEndX * gridSize.x, j * gridSize.y + gridOrigin.y ) );
@ -202,13 +254,13 @@ void GAL::DrawGrid()
// Horizontal lines
for( int i = gridStartX; i != gridEndX; i += dirX )
{
if( i % gridTick == 0 && gridScreenSizeDense > gridDrawThreshold )
if( i % gridTick == 0 && gridScreenSizeDense > gridThreshold )
SetLineWidth( doubleMarker );
else
SetLineWidth( marker );
if( ( i % gridTick == 0 && gridScreenSizeCoarse > gridDrawThreshold )
|| gridScreenSizeDense > gridDrawThreshold )
if( ( i % gridTick == 0 && gridScreenSizeCoarse > gridThreshold )
|| gridScreenSizeDense > gridThreshold )
{
drawGridLine( VECTOR2D( i * gridSize.x + gridOrigin.x, gridStartY * gridSize.y ),
VECTOR2D( i * gridSize.x + gridOrigin.x, gridEndY * gridSize.y ) );
@ -224,21 +276,21 @@ void GAL::DrawGrid()
for( int j = gridStartY; j != gridEndY; j += dirY )
{
if( j % gridTick == 0 && gridScreenSizeDense > gridDrawThreshold )
if( j % gridTick == 0 && gridScreenSizeDense > gridThreshold )
tickY = true;
else
tickY = false;
for( int i = gridStartX; i != gridEndX; i += dirX )
{
if( i % gridTick == 0 && gridScreenSizeDense > gridDrawThreshold )
if( i % gridTick == 0 && gridScreenSizeDense > gridThreshold )
tickX = true;
else
tickX = false;
if( tickX || tickY || gridScreenSizeDense > gridDrawThreshold )
if( tickX || tickY || gridScreenSizeDense > gridThreshold )
{
double radius = ( tickX && tickY ) ? doubleMarker : marker;
double radius = ( ( tickX && tickY ) ? doubleMarker : marker ) / 2.0;
DrawRectangle( VECTOR2D( i * gridSize.x - radius + gridOrigin.x,
j * gridSize.y - radius + gridOrigin.y ),
VECTOR2D( i * gridSize.x + radius + gridOrigin.x,

View File

@ -66,9 +66,10 @@ SHADER* OPENGL_GAL::shader = NULL;
OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
wxEvtHandler* aMouseListener, wxEvtHandler* aPaintListener,
const wxString& aName ) :
GAL( aDisplayOptions ),
wxGLCanvas( aParent, wxID_ANY, (int*) glAttributes, wxDefaultPosition, wxDefaultSize,
wxEXPAND, aName ),
options( aDisplayOptions ), mouseListener( aMouseListener ), paintListener( aPaintListener )
mouseListener( aMouseListener ), paintListener( aPaintListener )
{
if( glMainContext == NULL )
{
@ -101,8 +102,6 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
SetViewWantsBestResolution( true );
#endif
observerLink = options.Subscribe( this );
// Connecting the event handlers
Connect( wxEVT_PAINT, wxPaintEventHandler( OPENGL_GAL::onPaint ) );
@ -182,18 +181,27 @@ OPENGL_GAL::~OPENGL_GAL()
GL_CONTEXT_MANAGER::Get().DestroyCtx( glMainContext );
glMainContext = NULL;
}
}
void OPENGL_GAL::OnGalDisplayOptionsChanged( const GAL_DISPLAY_OPTIONS& aDisplayOptions )
bool OPENGL_GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
{
bool refresh = false;
if( options.gl_antialiasing_mode != compositor->GetAntialiasingMode() )
{
compositor->SetAntialiasingMode( options.gl_antialiasing_mode );
isFramebufferInitialized = false;
Refresh();
refresh = true;
}
if( super::updatedGalDisplayOptions( aOptions ) || refresh )
{
Refresh();
refresh = true;
}
return refresh;
}
@ -840,8 +848,14 @@ void OPENGL_GAL::DrawGrid()
int gridScreenSizeDense = KiROUND( gridSize.x * worldScale );
int gridScreenSizeCoarse = KiROUND( gridSize.x * static_cast<double>( gridTick ) * worldScale );
// sub-pixel lines all render the same
double minorLineWidth = std::max( 1.0, gridLineWidth );
double majorLineWidth = minorLineWidth * 2.0;
const double gridThreshold = computeMinGridSpacing();
// Check if the grid would not be too dense
if( std::max( gridScreenSizeDense, gridScreenSizeCoarse ) < gridDrawThreshold )
if( std::max( gridScreenSizeDense, gridScreenSizeCoarse ) < gridThreshold )
return;
SetTarget( TARGET_NONCACHED );
@ -880,7 +894,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 );
@ -895,13 +909,13 @@ void OPENGL_GAL::DrawGrid()
// Vertical lines
for( int j = gridStartY; j != gridEndY; j += dirY )
{
if( j % gridTick == 0 && gridScreenSizeDense > gridDrawThreshold )
glLineWidth( 2.0 );
if( j % gridTick == 0 && gridScreenSizeDense > gridThreshold )
glLineWidth( majorLineWidth );
else
glLineWidth( 1.0 );
glLineWidth( minorLineWidth );
if( ( j % gridTick == 0 && gridScreenSizeCoarse > gridDrawThreshold )
|| gridScreenSizeDense > gridDrawThreshold )
if( ( j % gridTick == 0 && gridScreenSizeCoarse > gridThreshold )
|| gridScreenSizeDense > gridThreshold )
{
glBegin( GL_LINES );
glVertex2d( gridStartX * gridSize.x, j * gridSize.y + gridOrigin.y );
@ -910,7 +924,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 );
@ -919,13 +933,13 @@ void OPENGL_GAL::DrawGrid()
// Horizontal lines
for( int i = gridStartX; i != gridEndX; i += dirX )
{
if( i % gridTick == 0 && gridScreenSizeDense > gridDrawThreshold )
glLineWidth( 2.0 );
if( i % gridTick == 0 && gridScreenSizeDense > gridThreshold )
glLineWidth( majorLineWidth );
else
glLineWidth( 1.0 );
glLineWidth( minorLineWidth );
if( ( i % gridTick == 0 && gridScreenSizeCoarse > gridDrawThreshold )
|| gridScreenSizeDense > gridDrawThreshold )
if( ( i % gridTick == 0 && gridScreenSizeCoarse > gridThreshold )
|| gridScreenSizeDense > gridThreshold )
{
glBegin( GL_LINES );
glVertex2d( i * gridSize.x + gridOrigin.x, gridStartY * gridSize.y );
@ -934,7 +948,7 @@ void OPENGL_GAL::DrawGrid()
}
}
if( gridStyle == GRID_STYLE_DOTS )
if( gridStyle == GRID_STYLE::DOTS )
glDisable( GL_STENCIL_TEST );
glEnable( GL_DEPTH_TEST );

View File

@ -0,0 +1,184 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <incremental_text_ctrl.h>
/**
* Check that a string looks like a floating point number that can
* be dealt with.
*/
static bool validateFloatField( const wxString& aStr )
{
// Skip empty fields
if( aStr.size() == 0 )
return false;
// a single . or , doesn't count as number, although valid in a float
if( aStr.size() == 1 )
{
if( (aStr.compare( "." ) == 0) ||
(aStr.compare( "," ) == 0) )
return false;
}
return true;
}
INCREMENTAL_TEXT_CTRL::INCREMENTAL_TEXT_CTRL() :
m_minVal( 0.0 ),
m_maxVal( 1.0 ),
m_currentValue( 0.0 ),
m_precision( 4 )
{}
void INCREMENTAL_TEXT_CTRL::SetStep( double aMin, double aMax,
STEP_FUNCTION aStepFunc )
{
wxASSERT( aMin <= aMax );
m_minVal = std::min( aMin, aMax );
m_maxVal = std::max( aMin, aMax );
m_stepFunc = aStepFunc;
// finally, clamp the current value and re-display
updateTextValue();
}
void INCREMENTAL_TEXT_CTRL::updateTextValue()
{
if( m_currentValue > m_maxVal )
m_currentValue = m_maxVal;
if( m_currentValue < m_minVal )
m_currentValue = m_minVal;
wxString fmt = wxString::Format( "%%.%df", m_precision );
setTextCtrl( wxString::Format( fmt, m_currentValue ) );
}
void INCREMENTAL_TEXT_CTRL::incrementCtrlBy( double aInc )
{
const wxString txt = getCtrlText();
if( !validateFloatField( txt ) )
return;
txt.ToDouble( &m_currentValue );
m_currentValue += aInc;
updateTextValue();
}
void INCREMENTAL_TEXT_CTRL::incrementCtrl( bool aUp )
{
incrementCtrlBy( m_stepFunc( aUp, m_currentValue ) );
}
void INCREMENTAL_TEXT_CTRL::SetPrecision( int aPrecision )
{
m_precision = aPrecision;
}
void INCREMENTAL_TEXT_CTRL::SetValue( double aValue )
{
m_currentValue = aValue;
updateTextValue();
}
double INCREMENTAL_TEXT_CTRL::GetValue()
{
// sanitise before handing the value - if the user did something
// like close a window with outstanding text changes, we need
// to clamp the value and re-interpret the text
incrementCtrlBy( 0.0 );
return m_currentValue;
}
SPIN_INCREMENTAL_TEXT_CTRL::SPIN_INCREMENTAL_TEXT_CTRL( wxSpinButton& aSpinBtn,
wxTextCtrl& aTextCtrl ):
m_spinBtn( aSpinBtn ),
m_textCtrl( aTextCtrl )
{
// set always enabled, otherwise it's very hard to keep in sync
aSpinBtn.SetRange( -INT_MAX, INT_MAX );
auto spinUpHandler = [this] ( wxSpinEvent& event )
{
incrementCtrl( true );
};
// spin up/down if a single step of the field
auto spinDownHandler = [this] ( wxSpinEvent& event )
{
incrementCtrl( false );
};
auto mouseWheelHandler = [this] ( wxMouseEvent& aEvent )
{
incrementCtrl( aEvent.GetWheelRotation() >= 0 );
};
aSpinBtn.Bind( wxEVT_SPIN_UP, spinUpHandler );
aSpinBtn.Bind( wxEVT_SPIN_DOWN, spinDownHandler );
m_textCtrl.Bind( wxEVT_MOUSEWHEEL, mouseWheelHandler );
m_textCtrl.Bind( wxEVT_KILL_FOCUS, &SPIN_INCREMENTAL_TEXT_CTRL::onFocusLoss, this );
}
SPIN_INCREMENTAL_TEXT_CTRL::~SPIN_INCREMENTAL_TEXT_CTRL()
{
// this must be unbound, as kill focus can arrive after the
// text control is gone
m_textCtrl.Unbind( wxEVT_KILL_FOCUS, &SPIN_INCREMENTAL_TEXT_CTRL::onFocusLoss, this );
}
void SPIN_INCREMENTAL_TEXT_CTRL::onFocusLoss( wxFocusEvent& aEvent )
{
// re-read the input and sanitize any user changes
incrementCtrlBy( 0.0 );
}
void SPIN_INCREMENTAL_TEXT_CTRL::setTextCtrl( const wxString& val )
{
m_textCtrl.SetValue( val );
}
wxString SPIN_INCREMENTAL_TEXT_CTRL::getCtrlText() const
{
return m_textCtrl.GetValue();
}

View File

@ -64,7 +64,8 @@ private:
std::stack <TRANSFORM_PRM> m_transformHistory;
public:
BASIC_GAL()
BASIC_GAL( KIGFX::GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
GAL( aDisplayOptions )
{
m_DC = NULL;
m_Color = RED;

View File

@ -177,18 +177,6 @@ public:
return m_edaFrame;
}
/**
* Function SaveGalSettings()
* Stores GAL related settings in the configuration storage.
*/
virtual bool SaveGalSettings();
/**
* Function LoadGalSettings()
* Loads GAL related settings from the configuration storage.
*/
virtual bool LoadGalSettings();
/**
* Function OnShow()
* Called when the window is shown for the first time.
@ -252,9 +240,6 @@ protected:
/// Flag to indicate that focus should be regained on the next mouse event. It is a workaround
/// for cases when the panel loses keyboard focus, so it does not react to hotkeys anymore.
bool m_lostFocus;
/// Grid style setting string
static const wxChar GRID_STYLE_CFG[];
};
#endif

116
include/config_map.h Normal file
View File

@ -0,0 +1,116 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef CONFIG_MAP__H_
#define CONFIG_MAP__H_
#include <map>
namespace UTIL
{
/**
* A config value table is a list of native values (usually enums)
* to a different set of values, for example, the values used to
* represent the enum in a config file, or the index used to represent
* it in a selection list.
*
* It can be important to decouple from the internal representation,
* especially in the case of persistent config files, as adding,
* removing or modifying the order of items internally can easily
* result in configs being read incorrectly, and, even if otherwise
* carefully managed, results in obsolete values being kept in enums
* as placeholders.
*
* The first item in the list is used default if no matching value is
* found during lookup.
*/
template<typename T>
using CFG_MAP = std::vector<std::pair<T, long> >;
/**
* The "native" type of a CFG_MAP: probably an enum type
*/
template<typename MAP>
using CFG_NATIVE_VAL = typename MAP::value_type::first_type;
/**
* Get the mapped config value (the one to write to file, or use in
* an index) from the given native (probably enum) value.
*
* The default (first item) is returned if the value is not found
* in the list.
*
* @param aMap the value-config mapping table
* @param aVal the value to look up
*/
template<typename MAP>
static long GetConfigForVal( const MAP& aMap, CFG_NATIVE_VAL<MAP> aVal )
{
// default is first entry
long aConf = aMap[0].second;
for( const auto& mapping : aMap )
{
if( mapping.first == aVal )
{
aConf = mapping.second;
break;
}
}
return aConf;
}
/**
* Get the native value corresponding to the config value
* (read from file or UI, probably) and find it in the mapping table.
*
* The default item is returned if the mapping fails.
*
* @param aMap the value-config mapping table
* @param aVal the config value to look up
*/
template<typename MAP>
static CFG_NATIVE_VAL<MAP> GetValFromConfig(
const MAP& aMap, long aConf )
{
// default is first entry
CFG_NATIVE_VAL<MAP> aVal = aMap[0].first;
for( const auto& mapping : aMap )
{
if( mapping.second == aConf )
{
aVal = mapping.first;
break;
}
}
return aVal;
}
}
#endif /* CONFIG_MAP__H_ */

View File

@ -29,11 +29,15 @@
#include <wxstruct.h>
#include <kiway_player.h>
#include <climits>
#include <gal/gal_display_options.h>
class wxSingleInstanceChecker;
class EDA_HOTKEY;
namespace KIGFX
{
class GAL_DISPLAY_OPTIONS;
}
#define DEFAULT_MAX_UNDO_ITEMS 0
#define ABS_MAX_UNDO_ITEMS (INT_MAX / 2)
@ -57,7 +61,9 @@ class EDA_DRAW_FRAME : public KIWAY_PLAYER
bool m_galCanvasActive; ///< whether to use new GAL engine
EDA_DRAW_PANEL_GAL* m_galCanvas;
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions;
///< GAL display options - this is the frame's interface to setting GAL display options
std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> m_galDisplayOptions;
protected:
@ -819,7 +825,7 @@ public:
* Function GetGalDisplayOptions
* Returns a reference to the gal rendering options used by GAL for rendering.
*/
KIGFX::GAL_DISPLAY_OPTIONS& GetGalDisplayOptions() { return m_galDisplayOptions; }
KIGFX::GAL_DISPLAY_OPTIONS& GetGalDisplayOptions() { return *m_galDisplayOptions; }
DECLARE_EVENT_TABLE()
};

View File

@ -81,7 +81,8 @@ public:
*
* @param aName is the name of this window for use by wxWindow::FindWindowByName()
*/
CAIRO_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener = NULL,
CAIRO_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions,
wxWindow* aParent, wxEvtHandler* aMouseListener = NULL,
wxEvtHandler* aPaintListener = NULL, const wxString& aName = wxT( "CairoCanvas" ) );
virtual ~CAIRO_GAL();
@ -352,6 +353,9 @@ private:
int wxBufferWidth;
///> Cairo-specific update handlers
bool updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions ) override;
void flushPath();
// Methods
void storePath(); ///< Store the actual path

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2016 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 2017 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -29,23 +29,35 @@
class wxConfigBase;
class wxString;
namespace KIGFX {
namespace KIGFX
{
/**
* GRID_STYLE: Type definition of the grid style
*/
enum class GRID_STYLE
{
LINES, ///< Use lines for the grid
DOTS ///< Use dots for the grid
};
enum class OPENGL_ANTIALIASING_MODE
{
NONE,
SUBSAMPLE_HIGH,
SUBSAMPLE_ULTRA,
SUPERSAMPLING_X2,
SUPERSAMPLING_X4,
};
class GAL_DISPLAY_OPTIONS;
enum class OPENGL_ANTIALIASING_MODE : long
{
NONE = 0,
SUBSAMPLE_HIGH = 1,
SUBSAMPLE_ULTRA = 2,
SUPERSAMPLING_X2 = 3,
SUPERSAMPLING_X4 = 4
};
class GAL_DISPLAY_OPTIONS_OBSERVER
{
public:
virtual void OnGalDisplayOptionsChanged( const GAL_DISPLAY_OPTIONS& ) = 0;
protected:
// Observer lifetimes aren't handled by base class pointer
virtual ~GAL_DISPLAY_OPTIONS_OBSERVER() {}
};
class GAL_DISPLAY_OPTIONS : public UTIL::OBSERVABLE<GAL_DISPLAY_OPTIONS_OBSERVER>
@ -53,12 +65,21 @@ namespace KIGFX {
public:
GAL_DISPLAY_OPTIONS();
OPENGL_ANTIALIASING_MODE gl_antialiasing_mode;
void ReadConfig ( wxConfigBase* aCfg, wxString aBaseName );
void WriteConfig( wxConfigBase* aCfg, wxString aBaseName );
void NotifyChanged();
OPENGL_ANTIALIASING_MODE gl_antialiasing_mode;
///> The grid style to draw the grid in
KIGFX::GRID_STYLE m_gridStyle;
///> Thickness to render grid lines/dots
double m_gridLineWidth;
///> Minimum pixel distance between displayed grid lines
double m_gridMinSpacing;
};
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2016 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 2016-2017 Kicad Developers, see change_log.txt for contributors.
*
* Graphics Abstraction Layer (GAL) - base class
*
@ -36,6 +36,7 @@
#include <gal/color4d.h>
#include <gal/definitions.h>
#include <gal/stroke_font.h>
#include <gal/gal_display_options.h>
#include <newstroke_font.h>
class SHAPE_LINE_CHAIN;
@ -43,15 +44,6 @@ class SHAPE_POLY_SET;
namespace KIGFX
{
/**
* GridStyle: Type definition of the grid style
*/
enum GRID_STYLE
{
GRID_STYLE_LINES, ///< Use lines for the grid
GRID_STYLE_DOTS ///< Use dots for the grid
};
/**
* @brief Class GAL is the abstract interface for drawing on a 2D-surface.
@ -63,11 +55,11 @@ enum GRID_STYLE
* for drawing purposes these are transformed to screen units with this layer. So zooming is handled here as well.
*
*/
class GAL
class GAL: GAL_DISPLAY_OPTIONS_OBSERVER
{
public:
// Constructor / Destructor
GAL();
GAL( GAL_DISPLAY_OPTIONS& aOptions );
virtual ~GAL();
/// @brief Returns the initalization status for the canvas.
@ -774,16 +766,6 @@ public:
(long) gridOrigin.y % (long) gridSize.y );
}
/**
* @brief Set the threshold for grid drawing.
*
* @param aThreshold is the minimum grid cell size (in pixels) for which the grid is drawn.
*/
inline void SetGridDrawThreshold( int aThreshold )
{
gridDrawThreshold = aThreshold;
}
/**
* @brief Set the grid size.
*
@ -837,16 +819,6 @@ public:
return gridLineWidth;
}
/**
* @brief Set the grid line width.
*
* @param aGridLineWidth is the rid line width.
*/
inline void SetGridLineWidth( double aGridLineWidth )
{
gridLineWidth = aGridLineWidth;
}
///> @brief Draw the grid
virtual void DrawGrid();
@ -859,24 +831,6 @@ public:
*/
VECTOR2D GetGridPoint( const VECTOR2D& aPoint ) const;
/**
* @brief Change the grid display style.
*
* @param aGridStyle is the new style for grid.
*/
virtual void SetGridStyle( GRID_STYLE aGridStyle )
{
gridStyle = aGridStyle;
}
/**
* @brief Returns the current grid drawing style.
*/
virtual GRID_STYLE GetGridStyle() const
{
return gridStyle;
}
/**
* @brief Compute the point position in world coordinates from given screen coordinates.
*
@ -975,6 +929,10 @@ public:
static const double METRIC_UNIT_LENGTH;
protected:
GAL_DISPLAY_OPTIONS& options;
UTIL::LINK observerLink;
std::stack<double> depthStack; ///< Stored depth values
VECTOR2I screenSize; ///< Screen size in screen coordinates
@ -1010,7 +968,7 @@ protected:
COLOR4D gridColor; ///< Color of the grid
int gridTick; ///< Every tick line gets the double width
double gridLineWidth; ///< Line width of the grid
int gridDrawThreshold; ///< Minimum screen size of the grid (pixels)
int gridMinSpacing; ///< Minimum screen size of the grid (pixels)
///< below which the grid is not drawn
// Cursor settings
@ -1028,6 +986,13 @@ protected:
worldScale = screenDPI * worldUnitLength * zoomFactor;
}
/**
* @brief compute minimum grid spacing from the grid settings
*
* @return the minimum spacing to use for drawing the grid
*/
double computeMinGridSpacing() const;
/**
* @brief Draw a grid line (usually a simplified line function).
*
@ -1043,6 +1008,25 @@ protected:
/// Depth level on which the grid is drawn
static const int GRID_DEPTH;
// ---------------
// Settings observer interface
// ---------------
/**
* Handler for observer settings changes
*/
void OnGalDisplayOptionsChanged( const GAL_DISPLAY_OPTIONS& aOptions ) override;
/**
* Function updatedGalDisplayOptions
*
* @brief handler for updated display options. Derived classes
* should call up to this to set base-class methods.
*
* @return true if the new settings changed something. Derived classes
* can use this information to refresh themselves
*/
virtual bool updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions );
private:
struct TEXT_PROPERTIES
{

View File

@ -62,7 +62,7 @@ class SHADER;
* and quads. The purpose is to provide a fast graphics interface, that takes advantage of modern
* graphics card GPUs. All methods here benefit thus from the hardware acceleration.
*/
class OPENGL_GAL : public GAL, public wxGLCanvas, GAL_DISPLAY_OPTIONS_OBSERVER
class OPENGL_GAL : public GAL, public wxGLCanvas
{
public:
/**
@ -99,8 +99,6 @@ public:
return IsShownOnScreen();
}
void OnGalDisplayOptionsChanged( const GAL_DISPLAY_OPTIONS& ) override;
// ---------------
// Drawing methods
// ---------------
@ -282,9 +280,6 @@ private:
/// Super class definition
typedef GAL super;
GAL_DISPLAY_OPTIONS& options;
UTIL::LINK observerLink;
static const int CIRCLE_POINTS = 64; ///< The number of points for circle approximation
static const int CURVE_POINTS = 32; ///< The number of points for curve approximation
@ -322,6 +317,9 @@ private:
///< when the window is visible
bool isGrouping; ///< Was a group started?
///< Update handler for OpenGL settings
bool updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions ) override;
// Polygon tesselation
/// The tessellator
GLUtesselator* tesselator;

View File

@ -0,0 +1,188 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef INCREMENTAL_TEXT_CTRL__H_
#define INCREMENTAL_TEXT_CTRL__H_
#include <wx/wx.h>
#include <wx/spinbutt.h>
#include <functional>
/**
* Class that governs a textual control holding a number that can
* be incremented/decremented according to some scheme (often just
* a constant step).
*/
class INCREMENTAL_TEXT_CTRL
{
public:
/**
* A callable object type that can be used to provide a step
* value. Client can provide one of these to use for implementing
* non-linear stepping, or stepping based on external parameters,
* such as unit selection.
*
* @param aUp true if the next step is upwards
* @param aCurrVal the current value of the control
*/
using STEP_FUNCTION = std::function<double(bool aUp, double aCurrVal)>;
INCREMENTAL_TEXT_CTRL();
virtual ~INCREMENTAL_TEXT_CTRL() {}
/**
* Set the value of the text control, but obey the limits
* currently set.
*
* @param aValue the control value to set
*/
void SetValue( double aValue );
/**
* Get the current value of the control
*/
double GetValue();
/**
* Function SetStep()
*
* Set the stepping parameters of the control. The range is
* enforced by not allowing the scroll to exceed it, and on
* loss of focus, the control is also clamped to the range.
*
* @param aMin the minium value allowed
* @param aMax the maximum value allows
* @param aNewfunc the step function used to calculate the next step
*/
void SetStep( double aMin, double aMax, STEP_FUNCTION aNewFunc );
/**
* Function SetStep()
*
* Shortcut method to set step parameters when the step is constant
*
* @param aMin the minium value allowed
* @param aMax the maximum value allows
* @param aStep the constant step size
*/
void SetStep( double aMin, double aMax, double aStep )
{
SetStep( aMin, aMax,
[aStep] ( bool aUp, double aCurrent ) { return aUp ? aStep : -aStep; } );
}
/**
* Set the number of decimal places to display
*/
void SetPrecision( int aPrecision );
protected:
/**
* Increment the control by the given amount
*/
void incrementCtrlBy( double aInc);
/**
* Single increment up or down by one step
*/
void incrementCtrl( bool aUp );
/**
* Update the text control value with the current value,
* clamping to limits as needed
*/
void updateTextValue();
/*
* Implementation-specific interfaces
*/
/**
* Set the text control string value after an increment.
*/
virtual void setTextCtrl( const wxString& aVal ) = 0;
/**
* @return the current string value of the text control
*/
virtual wxString getCtrlText() const = 0;
private:
double m_minVal;
double m_maxVal;
///< Current value of the control
double m_currentValue;
///< Precision to display
int m_precision;
///< The function used to determine the step
STEP_FUNCTION m_stepFunc;
};
/**
* Class SPIN_INCREMENTING_TEXT_CTRL
*
* An incrementable text control, with WX spin buttons for clickable
* control.
*/
class SPIN_INCREMENTAL_TEXT_CTRL: public INCREMENTAL_TEXT_CTRL
{
public:
/**
* Constructor
*
* @param aSpinBtn the spin button to control the value
* @param aTextCtrl the text control that will display the value
*/
SPIN_INCREMENTAL_TEXT_CTRL( wxSpinButton& aSpinBtn,
wxTextCtrl& aTextCtrl );
~SPIN_INCREMENTAL_TEXT_CTRL();
protected:
///> @copydoc INCREMENTAL_TEXT_CTRL::setTextCtrl()
void setTextCtrl( const wxString& val ) override;
///> @copydoc INCREMENTAL_TEXT_CTRL::getCtrlText()
wxString getCtrlText() const override;
private:
void onFocusLoss( wxFocusEvent& aEvent );
wxSpinButton& m_spinBtn;
wxTextCtrl& m_textCtrl;
};
#endif /* INCREMENTAL_TEXT_CTRL__H_ */

View File

@ -32,6 +32,8 @@
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <pcbstruct.h>
#include <incremental_text_ctrl.h>
#include <config_map.h>
#include <pcbnew_id.h>
@ -41,6 +43,45 @@
#include <class_draw_panel_gal.h>
#include <view/view.h>
#include <pcb_painter.h>
#include <gal/gal_display_options.h>
/*
* Spin control parameters
*/
static const double gridThicknessMin = 0.5;
static const double gridThicknessMax = 10.0;
static const double gridThicknessStep = 0.5;
static const double gridMinSpacingMin = 5;
static const double gridMinSpacingMax = 200;
static const double gridMinSpacingStep = 5;
static const UTIL::CFG_MAP<KIGFX::GRID_STYLE> gridStyleSelectMap =
{
{ KIGFX::GRID_STYLE::DOTS, 0 }, // Default
{ KIGFX::GRID_STYLE::LINES, 1 },
};
static const UTIL::CFG_MAP<TRACE_CLEARANCE_DISPLAY_MODE_T> traceClearanceSelectMap =
{
{ SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS, 2 }, // Default
{ DO_NOT_SHOW_CLEARANCE, 0 },
{ SHOW_CLEARANCE_NEW_TRACKS, 1 },
{ SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS, 3 },
{ SHOW_CLEARANCE_ALWAYS, 4 },
};
static const UTIL::CFG_MAP<KIGFX::OPENGL_ANTIALIASING_MODE> aaModeSelectMap =
{
{ KIGFX::OPENGL_ANTIALIASING_MODE::NONE, 0 }, // Default
{ KIGFX::OPENGL_ANTIALIASING_MODE::SUBSAMPLE_HIGH, 1 },
{ KIGFX::OPENGL_ANTIALIASING_MODE::SUBSAMPLE_ULTRA, 2 },
{ KIGFX::OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X2, 3 },
{ KIGFX::OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X4, 4 },
};
void PCB_EDIT_FRAME::InstallDisplayOptionsDialog( wxCommandEvent& aEvent )
@ -55,44 +96,41 @@ DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( PCB_EDIT_FRAME* parent ) :
{
m_Parent = parent;
// bind the spin button and text box
m_gridSizeIncrementer = std::make_unique<SPIN_INCREMENTAL_TEXT_CTRL>(
*m_gridLineWidthSpinBtn, *m_gridLineWidth );
m_gridSizeIncrementer->SetStep( gridThicknessMin, gridThicknessMax,
gridThicknessStep );
m_gridSizeIncrementer->SetPrecision( 1 );
m_gridMinSpacingIncrementer = std::make_unique<SPIN_INCREMENTAL_TEXT_CTRL>(
*m_gridMinSpacingSpinBtn, *m_gridMinSpacing );
m_gridMinSpacingIncrementer->SetStep( gridMinSpacingMin, gridMinSpacingMax,
gridMinSpacingStep );
m_gridMinSpacingIncrementer->SetPrecision( 0 ); // restrict to ints
// load settings into controls
init();
m_sdbSizerOK->SetDefault();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}
void DIALOG_DISPLAY_OPTIONS::init()
{
SetFocus();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();
KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = m_Parent->GetGalDisplayOptions();
const DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();
const KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = m_Parent->GetGalDisplayOptions();
m_OptDisplayTracks->SetValue( displ_opts->m_DisplayPcbTrackFill == SKETCH );
switch ( displ_opts->m_ShowTrackClearanceMode )
{
case DO_NOT_SHOW_CLEARANCE:
m_OptDisplayTracksClearance->SetSelection( 0 );
break;
case SHOW_CLEARANCE_NEW_TRACKS:
m_OptDisplayTracksClearance->SetSelection( 1 );
break;
case SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS:
m_OptDisplayTracksClearance->SetSelection( 3 );
break;
default:
case SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS:
m_OptDisplayTracksClearance->SetSelection( 2 );
break;
case SHOW_CLEARANCE_ALWAYS:
m_OptDisplayTracksClearance->SetSelection( 4 );
break;
}
m_OptDisplayTracksClearance->SetSelection( UTIL::GetConfigForVal(
traceClearanceSelectMap, displ_opts->m_ShowTrackClearanceMode ) );
m_OptDisplayPads->SetValue( displ_opts->m_DisplayPadFill == SKETCH );
m_OptDisplayVias->SetValue( displ_opts->m_DisplayViaFill == SKETCH );
@ -107,29 +145,15 @@ void DIALOG_DISPLAY_OPTIONS::init()
m_OptDisplayDrawings->SetValue( displ_opts->m_DisplayDrawItemsFill == SKETCH );
m_ShowNetNamesOption->SetSelection( displ_opts->m_DisplayNetNamesMode );
switch( gal_opts.gl_antialiasing_mode )
{
case KIGFX::OPENGL_ANTIALIASING_MODE::NONE:
m_choiceAntialiasing->Select( 0 );
break;
m_choiceAntialiasing->SetSelection( UTIL::GetConfigForVal(
aaModeSelectMap, gal_opts.gl_antialiasing_mode ) );
case KIGFX::OPENGL_ANTIALIASING_MODE::SUBSAMPLE_HIGH:
m_choiceAntialiasing->Select( 1 );
break;
m_gridStyle->SetSelection( UTIL::GetConfigForVal(
gridStyleSelectMap, gal_opts.m_gridStyle ) );
case KIGFX::OPENGL_ANTIALIASING_MODE::SUBSAMPLE_ULTRA:
m_choiceAntialiasing->Select( 2 );
break;
case KIGFX::OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X2:
m_choiceAntialiasing->Select( 3 );
break;
case KIGFX::OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X4:
m_choiceAntialiasing->Select( 4 );
break;
}
m_gridSizeIncrementer->SetValue( gal_opts.m_gridLineWidth );
m_gridMinSpacingIncrementer->SetValue( gal_opts.m_gridMinSpacing );
}
@ -139,9 +163,10 @@ void DIALOG_DISPLAY_OPTIONS::OnCancelClick( wxCommandEvent& event )
}
/* Update variables with new options
*/
void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event)
/*
* Update variables with new options
*/
void DIALOG_DISPLAY_OPTIONS::OnOkClick( wxCommandEvent& event )
{
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();
KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = m_Parent->GetGalDisplayOptions();
@ -150,28 +175,8 @@ void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event)
displ_opts->m_DisplayPcbTrackFill = not m_OptDisplayTracks->GetValue();
switch ( m_OptDisplayTracksClearance->GetSelection() )
{
case 0:
displ_opts->m_ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
break;
case 1:
displ_opts->m_ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS;
break;
case 2:
displ_opts->m_ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
break;
case 3:
displ_opts->m_ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS;
break;
case 4:
displ_opts->m_ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
break;
}
displ_opts->m_ShowTrackClearanceMode = UTIL::GetValFromConfig(
traceClearanceSelectMap, m_OptDisplayTracksClearance->GetSelection() );
displ_opts->m_DisplayModTextFill = not m_OptDisplayModTexts->GetValue();
displ_opts->m_DisplayModEdgeFill = not m_OptDisplayModOutlines->GetValue();
@ -183,34 +188,21 @@ void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event)
displ_opts->m_DisplayPadNum = m_OptDisplayPadNumber->GetValue();
m_Parent->SetElementVisibility( PCB_VISIBLE(NO_CONNECTS_VISIBLE),
m_Parent->SetElementVisibility( PCB_VISIBLE( NO_CONNECTS_VISIBLE ),
m_OptDisplayPadNoConn->GetValue() );
displ_opts->m_DisplayDrawItemsFill = not m_OptDisplayDrawings->GetValue();
displ_opts->m_DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection();
switch( m_choiceAntialiasing->GetSelection() )
{
case 0:
gal_opts.gl_antialiasing_mode = KIGFX::OPENGL_ANTIALIASING_MODE::NONE;
break;
gal_opts.gl_antialiasing_mode = UTIL::GetValFromConfig(
aaModeSelectMap, m_choiceAntialiasing->GetSelection() );
case 1:
gal_opts.gl_antialiasing_mode = KIGFX::OPENGL_ANTIALIASING_MODE::SUBSAMPLE_HIGH;
break;
gal_opts.m_gridStyle = UTIL::GetValFromConfig(
gridStyleSelectMap, m_gridStyle->GetSelection() );
case 2:
gal_opts.gl_antialiasing_mode = KIGFX::OPENGL_ANTIALIASING_MODE::SUBSAMPLE_ULTRA;
break;
gal_opts.m_gridLineWidth = m_gridSizeIncrementer->GetValue();
case 3:
gal_opts.gl_antialiasing_mode = KIGFX::OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X2;
break;
case 4:
gal_opts.gl_antialiasing_mode = KIGFX::OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X4;
break;
}
gal_opts.m_gridMinSpacing = m_gridMinSpacingIncrementer->GetValue();
gal_opts.NotifyChanged();
@ -221,6 +213,7 @@ void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event)
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
settings->LoadDisplayOptions( displ_opts );
view->RecacheAllItems();
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
m_Parent->GetCanvas()->Refresh();

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -27,16 +27,21 @@
*/
#include <dialog_display_options_base.h>
class INCREMENTAL_TEXT_CTRL;
class DIALOG_DISPLAY_OPTIONS : public DIALOG_DISPLAY_OPTIONS_BASE
{
private:
PCB_EDIT_FRAME* m_Parent;
std::unique_ptr<INCREMENTAL_TEXT_CTRL> m_gridSizeIncrementer;
std::unique_ptr<INCREMENTAL_TEXT_CTRL> m_gridMinSpacingIncrementer;
void init();
public:
DIALOG_DISPLAY_OPTIONS( PCB_EDIT_FRAME* parent );
~DIALOG_DISPLAY_OPTIONS( ) { };
~DIALOG_DISPLAY_OPTIONS() {};
void OnOkClick( wxCommandEvent& event ) override;
void OnCancelClick( wxCommandEvent& event ) override;
};

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 15 2016)
// C++ code generated with wxFormBuilder (version Jan 9 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -32,7 +32,7 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
sSketchModeSizer->Add( m_OptDisplayVias, 0, wxALL, 5 );
sLeftSizer->Add( sSketchModeSizer, 0, wxEXPAND|wxALL, 5 );
sLeftSizer->Add( sSketchModeSizer, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sOpenGLRenderingSizer;
sOpenGLRenderingSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("OpenGL Rendering:") ), wxVERTICAL );
@ -44,7 +44,56 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
sOpenGLRenderingSizer->Add( m_choiceAntialiasing, 0, wxALL|wxEXPAND, 5 );
sLeftSizer->Add( sOpenGLRenderingSizer, 1, wxEXPAND, 5 );
sLeftSizer->Add( sOpenGLRenderingSizer, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sGridSettings;
sGridSettings = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Grid Display (OpenGL && Cairo)") ), wxVERTICAL );
wxString m_gridStyleChoices[] = { _("Dots"), _("Lines") };
int m_gridStyleNChoices = sizeof( m_gridStyleChoices ) / sizeof( wxString );
m_gridStyle = new wxRadioBox( sGridSettings->GetStaticBox(), wxID_ANY, _("Grid Style"), wxDefaultPosition, wxDefaultSize, m_gridStyleNChoices, m_gridStyleChoices, 1, wxRA_SPECIFY_COLS );
m_gridStyle->SetSelection( 0 );
sGridSettings->Add( m_gridStyle, 0, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* sGridSettingsGrid;
sGridSettingsGrid = new wxFlexGridSizer( 0, 4, 0, 0 );
sGridSettingsGrid->AddGrowableCol( 1 );
sGridSettingsGrid->SetFlexibleDirection( wxBOTH );
sGridSettingsGrid->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
l_gridLineWidth = new wxStaticText( sGridSettings->GetStaticBox(), wxID_ANY, _("Grid thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
l_gridLineWidth->Wrap( -1 );
sGridSettingsGrid->Add( l_gridLineWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_gridLineWidth = new wxTextCtrl( sGridSettings->GetStaticBox(), wxID_ANY, _("0.5"), wxDefaultPosition, wxDefaultSize, 0 );
sGridSettingsGrid->Add( m_gridLineWidth, 0, wxEXPAND, 5 );
m_gridLineWidthSpinBtn = new wxSpinButton( sGridSettings->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS );
sGridSettingsGrid->Add( m_gridLineWidthSpinBtn, 0, wxALL, 0 );
l_gridLineWidthUnits = new wxStaticText( sGridSettings->GetStaticBox(), wxID_ANY, _("px"), wxDefaultPosition, wxDefaultSize, 0 );
l_gridLineWidthUnits->Wrap( -1 );
sGridSettingsGrid->Add( l_gridLineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
l_gridMinSpacing = new wxStaticText( sGridSettings->GetStaticBox(), wxID_ANY, _("Min grid spacing:"), wxDefaultPosition, wxDefaultSize, 0 );
l_gridMinSpacing->Wrap( -1 );
sGridSettingsGrid->Add( l_gridMinSpacing, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_gridMinSpacing = new wxTextCtrl( sGridSettings->GetStaticBox(), wxID_ANY, _("10"), wxDefaultPosition, wxDefaultSize, 0 );
sGridSettingsGrid->Add( m_gridMinSpacing, 0, wxEXPAND, 5 );
m_gridMinSpacingSpinBtn = new wxSpinButton( sGridSettings->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS );
sGridSettingsGrid->Add( m_gridMinSpacingSpinBtn, 0, wxALL, 0 );
l_gridMinSpacingUnits = new wxStaticText( sGridSettings->GetStaticBox(), wxID_ANY, _("px"), wxDefaultPosition, wxDefaultSize, 0 );
l_gridMinSpacingUnits->Wrap( -1 );
sGridSettingsGrid->Add( l_gridMinSpacingUnits, 0, wxALL, 5 );
sGridSettings->Add( sGridSettingsGrid, 1, wxALL|wxEXPAND, 5 );
sLeftSizer->Add( sGridSettings, 1, wxALL|wxEXPAND, 5 );
bupperSizer->Add( sLeftSizer, 1, wxEXPAND, 5 );

View File

@ -113,7 +113,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
@ -304,8 +304,8 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">OpenGL Rendering:</property>
@ -405,6 +405,811 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Grid Display (OpenGL &amp;&amp; Cairo)</property>
<property name="minimum_size"></property>
<property name="name">sGridSettings</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;Dots&quot; &quot;Lines&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Grid Style</property>
<property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_gridStyle</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">4</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">sGridSettingsGrid</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Grid thickness:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">l_gridLineWidth</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_gridLineWidth</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0.5</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">0</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxSpinButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_gridLineWidthSpinBtn</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxSP_ARROW_KEYS</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnSpin"></event>
<event name="OnSpinDown"></event>
<event name="OnSpinUp"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">px</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">l_gridLineWidthUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Min grid spacing:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">l_gridMinSpacing</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_gridMinSpacing</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">10</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">0</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxSpinButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_gridMinSpacingSpinBtn</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxSP_ARROW_KEYS</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnSpin"></event>
<event name="OnSpinDown"></event>
<event name="OnSpinUp"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">px</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">l_gridMinSpacingUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 15 2016)
// C++ code generated with wxFormBuilder (version Jan 9 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -24,6 +24,9 @@ class DIALOG_SHIM;
#include <wx/statbox.h>
#include <wx/choice.h>
#include <wx/radiobox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/spinbutt.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
@ -46,6 +49,15 @@ class DIALOG_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM
wxCheckBox* m_OptDisplayTracks;
wxCheckBox* m_OptDisplayVias;
wxChoice* m_choiceAntialiasing;
wxRadioBox* m_gridStyle;
wxStaticText* l_gridLineWidth;
wxTextCtrl* m_gridLineWidth;
wxSpinButton* m_gridLineWidthSpinBtn;
wxStaticText* l_gridLineWidthUnits;
wxStaticText* l_gridMinSpacing;
wxTextCtrl* m_gridMinSpacing;
wxSpinButton* m_gridMinSpacingSpinBtn;
wxStaticText* l_gridMinSpacingUnits;
wxRadioBox* m_ShowNetNamesOption;
wxRadioBox* m_OptDisplayTracksClearance;
wxCheckBox* m_OptDisplayModOutlines;

View File

@ -83,9 +83,6 @@ private:
void setGridForFastSwitching( const wxArrayString& aGrids, int aGrid1, int aGrid2 );
void getGridForFastSwitching( int& aGrid1, int& aGrid2 );
void setGridStyle( KIGFX::GRID_STYLE aStyle );
KIGFX::GRID_STYLE getGridStyle() const;
};
@ -162,9 +159,6 @@ bool DIALOG_SET_GRID::TransferDataFromWindow()
mgr->ProcessEvent( gridOriginUpdate );
}
m_parent->GetGalCanvas()->GetGAL()->SetGridStyle( getGridStyle() );
m_parent->GetCanvas()->Refresh();
return wxDialog::TransferDataFromWindow();
}
@ -175,7 +169,6 @@ bool DIALOG_SET_GRID::TransferDataToWindow()
setGridSize( m_parent->m_UserGridSize );
setGridOrigin( m_parent->GetGridOrigin() );
setGridForFastSwitching( m_fast_grid_opts, m_parent->m_FastGrid1, m_parent->m_FastGrid2 );
setGridStyle( m_parent->GetGalCanvas()->GetGAL()->GetGridStyle() );
return wxDialog::TransferDataToWindow();
}
@ -292,18 +285,6 @@ void DIALOG_SET_GRID::getGridForFastSwitching( int& aGrid1, int& aGrid2 )
}
void DIALOG_SET_GRID::setGridStyle( KIGFX::GRID_STYLE aStyle )
{
m_Style->SetSelection( aStyle != KIGFX::GRID_STYLE_DOTS );
}
KIGFX::GRID_STYLE DIALOG_SET_GRID::getGridStyle() const
{
return m_Style->GetSelection() == 0 ? KIGFX::GRID_STYLE_DOTS : KIGFX::GRID_STYLE_LINES;
}
void DIALOG_SET_GRID::OnResetGridOrgClick( wxCommandEvent& event )
{
setGridOrigin( wxPoint( 0, 0 ) );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version May 21 2016)
// C++ code generated with wxFormBuilder (version Jan 9 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -129,12 +129,6 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con
bUpperSizer->Add( bSizer4, 1, wxEXPAND, 5 );
wxString m_StyleChoices[] = { _("Dots"), _("Lines") };
int m_StyleNChoices = sizeof( m_StyleChoices ) / sizeof( wxString );
m_Style = new wxRadioBox( this, wxID_ANY, _("Style (OpenGL && Cairo)"), wxDefaultPosition, wxDefaultSize, m_StyleNChoices, m_StyleChoices, 1, wxRA_SPECIFY_COLS );
m_Style->SetSelection( 0 );
bUpperSizer->Add( m_Style, 0, wxALL|wxEXPAND, 5 );
bSizerMain->Add( bUpperSizer, 1, wxEXPAND, 5 );

View File

@ -1394,6 +1394,8 @@
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCombobox"></event>
<event name="OnComboboxCloseup"></event>
<event name="OnComboboxDropdown"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@ -1568,6 +1570,8 @@
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCombobox"></event>
<event name="OnComboboxCloseup"></event>
<event name="OnComboboxDropdown"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@ -1600,96 +1604,6 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;Dots&quot; &quot;Lines&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Style (OpenGL &amp;&amp; Cairo)</property>
<property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_Style</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version May 21 2016)
// C++ code generated with wxFormBuilder (version Jan 9 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -55,7 +55,6 @@ class DIALOG_SET_GRID_BASE : public DIALOG_SHIM
wxComboBox* m_comboBoxGrid1;
wxStaticText* m_staticTextGrid2;
wxComboBox* m_comboBoxGrid2;
wxRadioBox* m_Style;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;