Fp editor and board editor have now a separate color setup.

fp viewer uses the default colors, because it has no color setup dialog.
class_colors_design_settings: remove not used members.
Fix issue in modedit: the color config was never read.
This commit is contained in:
jean-pierre charras 2017-09-10 16:21:56 +02:00
parent 8c7175b00d
commit e15acbb00d
17 changed files with 165 additions and 99 deletions

View File

@ -55,7 +55,7 @@ PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, S3D_CACHE* aCacheManager,
m_dummyBoard->SetColorsSettings( aColors ); m_dummyBoard->SetColorsSettings( aColors );
else else
{ {
static COLORS_DESIGN_SETTINGS defaultColors; static COLORS_DESIGN_SETTINGS defaultColors( FRAME_PCB_DISPLAY3D );
m_dummyBoard->SetColorsSettings( &defaultColors ); m_dummyBoard->SetColorsSettings( &defaultColors );
} }

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2014 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -35,11 +35,12 @@
* in Eeschema, Pcbnew and GerbView * in Eeschema, Pcbnew and GerbView
*/ */
/* Initial colors values: optimized for Pcbnew 64 layers. /* Initial colors values: optimized for Pcbnew up to 64 layers.
* The table is not actually used by Eeschema. * The table is not actually used by Eeschema.
* these values are superseded by config reading * these values are superseded by config reading
*/ */
static const EDA_COLOR_T default_layer_color[] = { static const EDA_COLOR_T default_layer_color[] = {
// Copper layers
RED, YELLOW, LIGHTMAGENTA, LIGHTRED, RED, YELLOW, LIGHTMAGENTA, LIGHTRED,
CYAN, GREEN, BLUE, DARKGRAY, CYAN, GREEN, BLUE, DARKGRAY,
MAGENTA, LIGHTGRAY, MAGENTA, RED, MAGENTA, LIGHTGRAY, MAGENTA, RED,
@ -50,17 +51,20 @@ static const EDA_COLOR_T default_layer_color[] = {
MAGENTA, LIGHTGRAY, MAGENTA, RED, MAGENTA, LIGHTGRAY, MAGENTA, RED,
BROWN, LIGHTGRAY, BLUE, GREEN, BROWN, LIGHTGRAY, BLUE, GREEN,
BLUE, MAGENTA, // tech layers
LIGHTCYAN, RED, BLUE, MAGENTA, // B_Adhes, F_Adhes
MAGENTA, CYAN, LIGHTCYAN, RED, // B_Paste, F_Paste
BROWN, MAGENTA, MAGENTA, CYAN, // B_SilkS, F_SilkS
LIGHTGRAY, BROWN, MAGENTA, // B_Mask, F_Mask
BLUE,
GREEN, YELLOW, // user layers
YELLOW, LIGHTGRAY, BLUE, GREEN, YELLOW, // Dwgs_User, Cmts_User, Eco1_User, Eco2_User
LIGHTMAGENTA,
YELLOW, // Special layers
DARKGRAY YELLOW, // Edge_Cuts
LIGHTMAGENTA, // Margin
DARKGRAY, LIGHTGRAY, // B_CrtYd, F_CrtYd,
BLUE, DARKGRAY // B_Fab, F_Fab
}; };
@ -86,8 +90,10 @@ static const EDA_COLOR_T default_items_color[] = {
}; };
COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS() COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS( FRAME_T aFrameType )
{ {
m_frameType = aFrameType;
for( unsigned src = 0, dst = 0; dst < DIM( m_LayersColors ); ++dst ) for( unsigned src = 0, dst = 0; dst < DIM( m_LayersColors ); ++dst )
{ {
m_LayersColors[dst] = COLOR4D( default_layer_color[src++] ); m_LayersColors[dst] = COLOR4D( default_layer_color[src++] );
@ -105,6 +111,7 @@ COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS()
m_LayersColors[ LAYER_CURSOR ] = WHITE; m_LayersColors[ LAYER_CURSOR ] = WHITE;
m_LayersColors[ LAYER_AUX_ITEMS ] = WHITE; m_LayersColors[ LAYER_AUX_ITEMS ] = WHITE;
m_LayersColors[ LAYER_WORKSHEET ] = DARKRED; m_LayersColors[ LAYER_WORKSHEET ] = DARKRED;
m_LayersColors[ LAYER_GRID ] = DARKGRAY;
setupConfigParams(); setupConfigParams();
} }
@ -161,31 +168,65 @@ void COLORS_DESIGN_SETTINGS::SetAllColorsAs( COLOR4D aColor )
void COLORS_DESIGN_SETTINGS::setupConfigParams() void COLORS_DESIGN_SETTINGS::setupConfigParams()
{ {
wxASSERT( DIM( m_LayersColors ) >= PCB_LAYER_ID_COUNT ); wxASSERT( DIM( m_LayersColors ) >= PCB_LAYER_ID_COUNT );
for( int i = 0; i<PCB_LAYER_ID_COUNT; ++i )
{
wxString vn = wxString::Format(
wxT( "Color4DPCBLayer_%s" ),
LSET::Name( PCB_LAYER_ID( i ) ) );
Add( vn, LOC_COLOR(i), m_LayersColors[i] ); wxString currprefix = GetConfigPrefix();
switch( m_frameType )
{
case FRAME_PCB: break; // no prefix
case FRAME_PCB_MODULE_EDITOR:
SetConfigPrefix( "ModEdit" );
break;
case FRAME_PCB_MODULE_VIEWER:
case FRAME_PCB_MODULE_VIEWER_MODAL:
case FRAME_PCB_FOOTPRINT_WIZARD_MODAL:
case FRAME_PCB_FOOTPRINT_PREVIEW:
SetConfigPrefix( "fpview_" );
break;
case FRAME_PCB_DISPLAY3D:
SetConfigPrefix( "fp3d_" );
break;
default:
break;
} }
Add( wxT( "Color4DTxtFrontEx" ), ITEM_COLOR( LAYER_MOD_TEXT_FR ), LIGHTGRAY );
Add( wxT( "Color4DTxtBackEx" ), ITEM_COLOR( LAYER_MOD_TEXT_BK ), BLUE );
Add( wxT( "Color4DTxtInvisEx" ), ITEM_COLOR( LAYER_MOD_TEXT_INVISIBLE ), DARKGRAY );
Add( wxT( "Color4DPadBackEx" ), ITEM_COLOR( LAYER_PAD_BK ), GREEN );
Add( wxT( "Color4DAnchorEx" ), ITEM_COLOR( LAYER_ANCHOR ), BLUE );
Add( wxT( "Color4DPadFrontEx" ), ITEM_COLOR( LAYER_PAD_FR ), RED );
Add( wxT( "Color4DViaThruEx" ), ITEM_COLOR( LAYER_VIA_THROUGH ), LIGHTGRAY );
Add( wxT( "Color4DViaBBlindEx" ), ITEM_COLOR( LAYER_VIA_BBLIND ), BROWN );
Add( wxT( "Color4DViaMicroEx" ), ITEM_COLOR( LAYER_VIA_MICROVIA ), CYAN );
Add( wxT( "Color4DNonPlatedEx" ), ITEM_COLOR( LAYER_NON_PLATED ), YELLOW );
Add( wxT( "Color4DRatsEx" ), ITEM_COLOR( LAYER_RATSNEST ), WHITE );
Add( wxT( "Color4DPCBBackground" ), ITEM_COLOR( LAYER_PCB_BACKGROUND ), BLACK );
Add( wxT( "Color4DPCBCursor" ), ITEM_COLOR( LAYER_CURSOR ), WHITE );
Add( wxT( "Color4DAuxItems" ), ITEM_COLOR( LAYER_AUX_ITEMS ), WHITE );
Add( wxT( "Color4DWorksheet" ), ITEM_COLOR( LAYER_WORKSHEET ), DARKRED );
wxString fmt( "Color4DPCBLayer_%s" );
for( int i = 0; i < PCB_LAYER_ID_COUNT; ++i )
{
wxString cfgkey = wxString::Format( fmt, LSET::Name( PCB_LAYER_ID( i ) ) );
Add( cfgkey, LOC_COLOR(i), m_LayersColors[i] );
}
Add( "Color4DTxtFrontEx", ITEM_COLOR( LAYER_MOD_TEXT_FR ), LIGHTGRAY );
Add( "Color4DTxtBackEx", ITEM_COLOR( LAYER_MOD_TEXT_BK ), BLUE );
Add( "Color4DTxtInvisEx", ITEM_COLOR( LAYER_MOD_TEXT_INVISIBLE ), DARKGRAY );
Add( "Color4DPadBackEx", ITEM_COLOR( LAYER_PAD_BK ), GREEN );
Add( "Color4DAnchorEx", ITEM_COLOR( LAYER_ANCHOR ), BLUE );
Add( "Color4DPadFrontEx", ITEM_COLOR( LAYER_PAD_FR ), RED );
Add( "Color4DNonPlatedEx", ITEM_COLOR( LAYER_NON_PLATED ), YELLOW );
Add( "Color4DPCBBackground", ITEM_COLOR( LAYER_PCB_BACKGROUND ), BLACK );
Add( "Color4DPCBCursor", ITEM_COLOR( LAYER_CURSOR ), WHITE );
Add( "Color4DAuxItems", ITEM_COLOR( LAYER_AUX_ITEMS ), WHITE );
Add( "Color4DWorksheet", ITEM_COLOR( LAYER_WORKSHEET ), DARKRED );
Add( "Color4DGrid", ITEM_COLOR( LAYER_GRID ), DARKGRAY );
// Add prms only relevant in board editor
if( m_frameType == FRAME_PCB )
{
Add( "Color4DViaThruEx", ITEM_COLOR( LAYER_VIA_THROUGH ), LIGHTGRAY );
Add( "Color4DViaBBlindEx", ITEM_COLOR( LAYER_VIA_BBLIND ), BROWN );
Add( "Color4DViaMicroEx", ITEM_COLOR( LAYER_VIA_MICROVIA ), CYAN );
Add( "Color4DRatsEx", ITEM_COLOR( LAYER_RATSNEST ), WHITE );
}
SetConfigPrefix( currprefix );
} }
void COLORS_DESIGN_SETTINGS::Load( wxConfigBase *aConfig ) void COLORS_DESIGN_SETTINGS::Load( wxConfigBase *aConfig )

View File

@ -50,6 +50,9 @@
#include <3d_viewer/eda_3d_viewer.h> #include <3d_viewer/eda_3d_viewer.h>
// Colors for layers and items
COLORS_DESIGN_SETTINGS g_ColorsSettings( FRAME_CVPCB_DISPLAY );
BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME ) BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow ) EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow )
@ -78,7 +81,6 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRA
// Give an icon // Give an icon
wxIcon icon; wxIcon icon;
icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) ); icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) );
SetIcon( icon ); SetIcon( icon );

View File

@ -44,9 +44,6 @@
#include <wx/snglinst.h> #include <wx/snglinst.h>
// Colors for layers and items
COLORS_DESIGN_SETTINGS g_ColorsSettings;
// Constant string definitions for CvPcb // Constant string definitions for CvPcb
const wxString EquFileExtension( wxT( "equ" ) ); const wxString EquFileExtension( wxT( "equ" ) );

View File

@ -35,10 +35,6 @@
#include <hotkeys.h> #include <hotkeys.h>
#include <gerbview_frame.h> #include <gerbview_frame.h>
// Colors for layers and items
COLORS_DESIGN_SETTINGS g_ColorsSettings;
const wxChar* g_GerberPageSizeList[] = { const wxChar* g_GerberPageSizeList[] = {
wxT( "GERBER" ), // index 0: full size page selection, and do not show page limits wxT( "GERBER" ), // index 0: full size page selection, and do not show page limits
wxT( "GERBER" ), // index 1: full size page selection, and show page limits wxT( "GERBER" ), // index 1: full size page selection, and show page limits

View File

@ -57,6 +57,9 @@ static const wxString cfgShowNegativeObjects( wxT( "ShowNegativeObjectsOpt" )
static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) ); static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) );
// Colors for layers and items
COLORS_DESIGN_SETTINGS g_ColorsSettings( FRAME_GERBER );
GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ): GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ), EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ),
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GERBVIEW_FRAME_NAME ) wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GERBVIEW_FRAME_NAME )

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2016 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -37,23 +37,22 @@ using KIGFX::COLOR4D;
class wxConfigBase; class wxConfigBase;
class wxString; class wxString;
#include <frame_type.h>
class PARAM_CFG_ARRAY; class PARAM_CFG_ARRAY;
/** /**
* Class COLORS_DESIGN_SETTINGS * Class COLORS_DESIGN_SETTINGS
* is a list of color settings for designs in Eeschema, Pcbnew and GerbView * is a list of color settings for designs in Pcbnew
*/ */
class COLORS_DESIGN_SETTINGS : public SETTINGS class COLORS_DESIGN_SETTINGS : public SETTINGS
{ {
public: public:
// Color options for screen display of the Printed Board and schematic: // Color options for screen display of the Printed Board or schematic:
// Common to Eeschema, Pcbnew, GerbView
COLOR4D m_LayersColors[LAYER_ID_COUNT]; ///< Layer colors (tracks and graphic items) COLOR4D m_LayersColors[LAYER_ID_COUNT]; ///< Layer colors (tracks and graphic items)
public: public:
COLORS_DESIGN_SETTINGS(); COLORS_DESIGN_SETTINGS( FRAME_T aFrameType );
~COLORS_DESIGN_SETTINGS() override ~COLORS_DESIGN_SETTINGS() override
{} {}
@ -96,6 +95,7 @@ public:
void SetAllColorsAs( COLOR4D aColor ); void SetAllColorsAs( COLOR4D aColor );
private: private:
FRAME_T m_frameType;
void setupConfigParams(); void setupConfigParams();

View File

@ -44,11 +44,21 @@ class SETTINGS
virtual ~SETTINGS() virtual ~SETTINGS()
{} {}
void SetConfigPrefix ( const wxString& aPrefix ) /** Set a prefix that will be prepent to the keywords when adding a setting in list
* @param aPrefix is the string to prepend to the keywords
*/
void SetConfigPrefix( const wxString& aPrefix )
{ {
m_prefix = aPrefix; m_prefix = aPrefix;
} }
/** @return the current prefix
*/
const wxString& GetConfigPrefix()
{
return m_prefix;
}
virtual void Load( wxConfigBase *aConfig ); virtual void Load( wxConfigBase *aConfig );
virtual void Save( wxConfigBase *aConfig ); virtual void Save( wxConfigBase *aConfig );
@ -82,22 +92,22 @@ class SETTINGS
void Add ( const wxString& name, int* aPtr, int aDefaultValue ) void Add ( const wxString& name, int* aPtr, int aDefaultValue )
{ {
m_params.push_back ( new PARAM_CFG_INT ( name, aPtr, aDefaultValue ) ); m_params.push_back ( new PARAM_CFG_INT ( m_prefix+name, aPtr, aDefaultValue ) );
} }
void Add ( const wxString& name, bool* aPtr, bool aDefaultValue ) void Add ( const wxString& name, bool* aPtr, bool aDefaultValue )
{ {
m_params.push_back ( new PARAM_CFG_BOOL ( name, aPtr, aDefaultValue ) ); m_params.push_back ( new PARAM_CFG_BOOL ( m_prefix+name, aPtr, aDefaultValue ) );
} }
void Add ( const wxString& name, KIGFX::COLOR4D* aPtr, KIGFX::COLOR4D aDefaultValue ) void Add ( const wxString& name, KIGFX::COLOR4D* aPtr, KIGFX::COLOR4D aDefaultValue )
{ {
m_params.push_back ( new PARAM_CFG_SETCOLOR ( name, aPtr, aDefaultValue ) ); m_params.push_back ( new PARAM_CFG_SETCOLOR ( m_prefix+name, aPtr, aDefaultValue ) );
} }
void Add ( const wxString& name, KIGFX::COLOR4D* aPtr, EDA_COLOR_T aDefaultValue ) void Add ( const wxString& name, KIGFX::COLOR4D* aPtr, EDA_COLOR_T aDefaultValue )
{ {
m_params.push_back ( new PARAM_CFG_SETCOLOR ( name, aPtr, aDefaultValue ) ); m_params.push_back ( new PARAM_CFG_SETCOLOR ( m_prefix+name, aPtr, aDefaultValue ) );
} }

View File

@ -195,7 +195,7 @@ enum GAL_LAYER_ID: int
LAYER_GP_OVERLAY, ///< general purpose overlay LAYER_GP_OVERLAY, ///< general purpose overlay
LAYER_PCB_BACKGROUND, ///< PCB background color LAYER_PCB_BACKGROUND, ///< PCB background color
LAYER_CURSOR, ///< PCB cursor LAYER_CURSOR, ///< PCB cursor
LAYER_AUX_ITEMS, ///< Auxillary items (guides, rulre, etc) LAYER_AUX_ITEMS, ///< Auxillary items (guides, rule, etc)
/// This is the end of the layers used for visibility bitmasks in Pcbnew /// This is the end of the layers used for visibility bitmasks in Pcbnew
/// There can be at most 32 layers above here. /// There can be at most 32 layers above here.

View File

@ -98,7 +98,8 @@ END_EVENT_TABLE()
PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType, PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize, const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
long aStyle, const wxString & aFrameName ) : long aStyle, const wxString & aFrameName ) :
EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ) EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
m_configSettings( aFrameType )
{ {
m_Pcb = NULL; m_Pcb = NULL;

View File

@ -259,7 +259,7 @@ FOOTPRINT_PREVIEW_PANEL::FOOTPRINT_PREVIEW_PANEL(
EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas
m_dummyBoard = std::make_unique<BOARD>(); m_dummyBoard = std::make_unique<BOARD>();
m_colorsSettings = std::make_unique<COLORS_DESIGN_SETTINGS>(); m_colorsSettings = std::make_unique<COLORS_DESIGN_SETTINGS>( FRAME_PCB_FOOTPRINT_PREVIEW );
UseColorScheme( m_colorsSettings.get() ); UseColorScheme( m_colorsSettings.get() );
SyncLayersVisibility( &*m_dummyBoard ); SyncLayersVisibility( &*m_dummyBoard );

View File

@ -87,65 +87,65 @@ PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings()
BOARD_DESIGN_SETTINGS& settings = GetDesignSettings(); BOARD_DESIGN_SETTINGS& settings = GetDesignSettings();
// Update everything // Update everything
m_configSettings.clear(); // boost::ptr_vector destroys the pointers inside m_configParams.clear(); // boost::ptr_vector destroys the pointers inside
// Display options: // Display options:
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorUnits" ), m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorUnits" ),
(int*)&g_UserUnit, MILLIMETRES ) ); (int*)&g_UserUnit, MILLIMETRES ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ), m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ),
&displ_opts->m_DisplayPolarCood, false ) ); &displ_opts->m_DisplayPolarCood, false ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ), m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ),
&displ_opts->m_DisplayPadFill, true ) ); &displ_opts->m_DisplayPadFill, true ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorGraphicLinesDisplayMode" ), m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorGraphicLinesDisplayMode" ),
&displ_opts->m_DisplayModEdgeFill, FILLED ) ); &displ_opts->m_DisplayModEdgeFill, FILLED ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ), m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
&displ_opts->m_DisplayModTextFill, FILLED ) ); &displ_opts->m_DisplayModTextFill, FILLED ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ), m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
&displ_opts->m_DisplayModTextFill, FILLED ) ); &displ_opts->m_DisplayModTextFill, FILLED ) );
m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorTextsRefDefaultText" ), m_configParams.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorTextsRefDefaultText" ),
&settings.m_RefDefaultText, wxT( "REF**" ) ) ); &settings.m_RefDefaultText, wxT( "REF**" ) ) );
// design settings // design settings
m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorGrlineWidth" ), m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorGrlineWidth" ),
&settings.m_ModuleSegmentWidth, &settings.m_ModuleSegmentWidth,
Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ), Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ),
Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ), Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
NULL, 1/IU_PER_MM ) ); NULL, 1/IU_PER_MM ) );
m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeH" ), m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeH" ),
&settings.m_ModuleTextSize.x, &settings.m_ModuleTextSize.x,
Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ), Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ),
Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ), Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
NULL, 1/IU_PER_MM ) ); NULL, 1/IU_PER_MM ) );
m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeV" ), m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeV" ),
&settings.m_ModuleTextSize.y, &settings.m_ModuleTextSize.y,
Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ), Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ),
Millimeter2iu(0.01), Millimeter2iu( 100.0 ), Millimeter2iu(0.01), Millimeter2iu( 100.0 ),
NULL, 1/IU_PER_MM ) ); NULL, 1/IU_PER_MM ) );
m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultThickness" ), m_configParams.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultThickness" ),
&settings.m_ModuleTextWidth, &settings.m_ModuleTextWidth,
Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ), Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ),
Millimeter2iu( 0.01 ), Millimeter2iu( 20.0 ), Millimeter2iu( 0.01 ), Millimeter2iu( 20.0 ),
NULL, 1/IU_PER_MM ) ); NULL, 1/IU_PER_MM ) );
m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, m_configParams.push_back( new PARAM_CFG_WXSTRING( true,
wxT( "FpEditorRefDefaultText" ), wxT( "FpEditorRefDefaultText" ),
&settings.m_RefDefaultText, wxT( "REF**" ) ) ); &settings.m_RefDefaultText, wxT( "REF**" ) ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, m_configParams.push_back( new PARAM_CFG_BOOL( true,
wxT( "FpEditorRefDefaultVisibility" ), wxT( "FpEditorRefDefaultVisibility" ),
&settings.m_RefDefaultVisibility, true ) ); &settings.m_RefDefaultVisibility, true ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorRefDefaultLayer" ), m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorRefDefaultLayer" ),
&settings.m_RefDefaultlayer, &settings.m_RefDefaultlayer,
int( F_SilkS ), int( F_SilkS ), int( F_Fab ) ) ); int( F_SilkS ), int( F_SilkS ), int( F_Fab ) ) );
m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorValueDefaultText" ), m_configParams.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorValueDefaultText" ),
&settings.m_ValueDefaultText, wxT( "" ) ) ); &settings.m_ValueDefaultText, wxT( "" ) ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, m_configParams.push_back( new PARAM_CFG_BOOL( true,
wxT( "FpEditorValueDefaultVisibility" ), wxT( "FpEditorValueDefaultVisibility" ),
&settings.m_ValueDefaultVisibility, true ) ); &settings.m_ValueDefaultVisibility, true ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorValueDefaultLayer" ), m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorValueDefaultLayer" ),
&settings.m_ValueDefaultlayer, &settings.m_ValueDefaultlayer,
int( F_Fab ), int( F_SilkS ), int( F_Fab ) ) ); int( F_Fab ), int( F_SilkS ), int( F_Fab ) ) );
return m_configSettings; return m_configParams;
} }

View File

@ -474,9 +474,10 @@ protected:
/// protected so only friend PCB::IFACE::CreateWindow() can act as sole factory. /// protected so only friend PCB::IFACE::CreateWindow() can act as sole factory.
FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ); FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
PCB_LAYER_WIDGET* m_Layers; PCB_LAYER_WIDGET* m_Layers; ///< the layer manager
PARAM_CFG_ARRAY m_configSettings; ///< List of footprint editor configuration settings. /// List of footprint editor configuration parameters.
PARAM_CFG_ARRAY m_configParams;
/** /**
* Function UpdateTitle * Function UpdateTitle

View File

@ -264,7 +264,10 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), font.GetPointSize(), true ); m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), font.GetPointSize(), true );
// LoadSettings() *after* creating m_LayersManager, because LoadSettings()
// initialize parameters in m_LayersManager
LoadSettings( config() ); LoadSettings( config() );
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) ); SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax ); GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
@ -498,6 +501,8 @@ void FOOTPRINT_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
PCB_BASE_FRAME::LoadSettings( aCfg ); PCB_BASE_FRAME::LoadSettings( aCfg );
wxConfigLoadSetups( aCfg, GetConfigurationSettings() ); wxConfigLoadSetups( aCfg, GetConfigurationSettings() );
m_configSettings.Load( aCfg ); // mainly, load the color config
// Ensure some params are valid // Ensure some params are valid
BOARD_DESIGN_SETTINGS& settings = GetDesignSettings(); BOARD_DESIGN_SETTINGS& settings = GetDesignSettings();
@ -513,6 +518,8 @@ void FOOTPRINT_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
void FOOTPRINT_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg ) void FOOTPRINT_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg )
{ {
m_configSettings.Save( aCfg );
PCB_BASE_FRAME::SaveSettings( aCfg ); PCB_BASE_FRAME::SaveSettings( aCfg );
wxConfigSaveSetups( aCfg, GetConfigurationSettings() ); wxConfigSaveSetups( aCfg, GetConfigurationSettings() );
} }

View File

@ -555,6 +555,7 @@ void FOOTPRINT_VIEWER_FRAME::ExportSelectedFootprint( wxCommandEvent& event )
void FOOTPRINT_VIEWER_FRAME::LoadSettings( wxConfigBase* aCfg ) void FOOTPRINT_VIEWER_FRAME::LoadSettings( wxConfigBase* aCfg )
{ {
EDA_DRAW_FRAME::LoadSettings( aCfg ); EDA_DRAW_FRAME::LoadSettings( aCfg );
m_configSettings.Load( aCfg ); // mainly, load the color config
} }

View File

@ -23,16 +23,21 @@
#include <pcb_general_settings.h> #include <pcb_general_settings.h>
PCB_GENERAL_SETTINGS::PCB_GENERAL_SETTINGS() PCB_GENERAL_SETTINGS::PCB_GENERAL_SETTINGS( FRAME_T aFrameType )
: m_colorsSettings( aFrameType )
{ {
Add( "LegacyDRCOn", &m_legacyDrcOn, true ); m_frameType = aFrameType;
Add( "LegacyAutoDeleteOldTrack", &m_legacyAutoDeleteOldTrack, true );
Add( "LegacyUse45DegreeTracks",&m_legacyUse45DegreeTracks, true); if( m_frameType == FRAME_PCB )
Add( "LegacyUseTwoSegmentTracks", &m_legacyUseTwoSegmentTracks, true); {
Add( "Use45DegreeGraphicSegments", &m_use45DegreeGraphicSegments, false); Add( "LegacyAutoDeleteOldTrack", &m_legacyAutoDeleteOldTrack, true );
Add( "MagneticPads", reinterpret_cast<int*>( &m_magneticPads ), CAPTURE_CURSOR_IN_TRACK_TOOL ); Add( "LegacyUse45DegreeTracks",&m_legacyUse45DegreeTracks, true);
Add( "MagneticTracks", reinterpret_cast<int*>( &m_magneticTracks ), CAPTURE_CURSOR_IN_TRACK_TOOL ); Add( "LegacyUseTwoSegmentTracks", &m_legacyUseTwoSegmentTracks, true);
Add( "EditActionChangesTrackWidth", &m_editActionChangesTrackWidth, false ); Add( "Use45DegreeGraphicSegments", &m_use45DegreeGraphicSegments, false);
Add( "MagneticPads", reinterpret_cast<int*>( &m_magneticPads ), CAPTURE_CURSOR_IN_TRACK_TOOL );
Add( "MagneticTracks", reinterpret_cast<int*>( &m_magneticTracks ), CAPTURE_CURSOR_IN_TRACK_TOOL );
Add( "EditActionChangesTrackWidth", &m_editActionChangesTrackWidth, false );
}
} }
void PCB_GENERAL_SETTINGS::Load( wxConfigBase* aCfg ) void PCB_GENERAL_SETTINGS::Load( wxConfigBase* aCfg )

View File

@ -39,7 +39,7 @@ enum MAGNETIC_PAD_OPTION_VALUES
class PCB_GENERAL_SETTINGS : public SETTINGS class PCB_GENERAL_SETTINGS : public SETTINGS
{ {
public: public:
PCB_GENERAL_SETTINGS(); PCB_GENERAL_SETTINGS( FRAME_T aFrameType );
void Load ( wxConfigBase* aCfg ) override; void Load ( wxConfigBase* aCfg ) override;
void Save( wxConfigBase* aCfg ) override; void Save( wxConfigBase* aCfg ) override;
@ -51,18 +51,20 @@ public:
return m_colorsSettings; return m_colorsSettings;
} }
bool m_legacyDrcOn = true; FRAME_T m_frameType;
bool m_legacyAutoDeleteOldTrack = true;
bool m_legacyAlternateTrackPosture = false;
bool m_legacyUse45DegreeTracks = true; // True to allow horiz, vert. and 45deg only tracks
bool m_use45DegreeGraphicSegments = false; // True to allow horiz, vert. and 45deg only graphic segments
bool m_legacyUseTwoSegmentTracks = true;
bool m_editActionChangesTrackWidth = false; bool m_legacyDrcOn = true; // Not stored, always true when starting pcbnew,
bool m_showFilterDialogAfterEachSelection = false; // false only on request during routing, and
// always for temporary use
bool m_legacyAutoDeleteOldTrack = true;
bool m_legacyUse45DegreeTracks = true; // True to allow horiz, vert. and 45deg only tracks
bool m_use45DegreeGraphicSegments = false; // True to allow horiz, vert. and 45deg only graphic segments
bool m_legacyUseTwoSegmentTracks = true;
MAGNETIC_PAD_OPTION_VALUES m_magneticPads = CAPTURE_CURSOR_IN_TRACK_TOOL; bool m_editActionChangesTrackWidth = false;
MAGNETIC_PAD_OPTION_VALUES m_magneticTracks = CAPTURE_CURSOR_IN_TRACK_TOOL;
MAGNETIC_PAD_OPTION_VALUES m_magneticPads = CAPTURE_CURSOR_IN_TRACK_TOOL;
MAGNETIC_PAD_OPTION_VALUES m_magneticTracks = CAPTURE_CURSOR_IN_TRACK_TOOL;
}; };
#endif #endif