From e15acbb00da289387fa50d42aea0cd805c77e22c Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 10 Sep 2017 16:21:56 +0200 Subject: [PATCH] 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. --- .../3d_cache/dialogs/panel_prev_model.cpp | 2 +- common/class_colors_design_settings.cpp | 111 ++++++++++++------ cvpcb/class_DisplayFootprintsFrame.cpp | 4 +- cvpcb/cvpcb.cpp | 3 - gerbview/gerbview.cpp | 4 - gerbview/gerbview_frame.cpp | 3 + include/class_colors_design_settings.h | 12 +- include/core/settings.h | 20 +++- include/layers_id_colors_and_visibility.h | 2 +- pcbnew/basepcbframe.cpp | 3 +- pcbnew/footprint_preview_panel.cpp | 2 +- pcbnew/modeditoptions.cpp | 38 +++--- pcbnew/module_editor_frame.h | 5 +- pcbnew/moduleframe.cpp | 7 ++ pcbnew/modview_frame.cpp | 1 + pcbnew/pcb_general_settings.cpp | 23 ++-- pcbnew/pcb_general_settings.h | 24 ++-- 17 files changed, 165 insertions(+), 99 deletions(-) diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp b/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp index 2588edee82..44282e3a23 100644 --- a/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp +++ b/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp @@ -55,7 +55,7 @@ PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, S3D_CACHE* aCacheManager, m_dummyBoard->SetColorsSettings( aColors ); else { - static COLORS_DESIGN_SETTINGS defaultColors; + static COLORS_DESIGN_SETTINGS defaultColors( FRAME_PCB_DISPLAY3D ); m_dummyBoard->SetColorsSettings( &defaultColors ); } diff --git a/common/class_colors_design_settings.cpp b/common/class_colors_design_settings.cpp index 22cb8119b1..1f9e03261b 100644 --- a/common/class_colors_design_settings.cpp +++ b/common/class_colors_design_settings.cpp @@ -2,7 +2,7 @@ * 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 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 * modify it under the terms of the GNU General Public License @@ -35,11 +35,12 @@ * 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. * these values are superseded by config reading */ static const EDA_COLOR_T default_layer_color[] = { + // Copper layers RED, YELLOW, LIGHTMAGENTA, LIGHTRED, CYAN, GREEN, BLUE, DARKGRAY, MAGENTA, LIGHTGRAY, MAGENTA, RED, @@ -50,17 +51,20 @@ static const EDA_COLOR_T default_layer_color[] = { MAGENTA, LIGHTGRAY, MAGENTA, RED, BROWN, LIGHTGRAY, BLUE, GREEN, - BLUE, MAGENTA, - LIGHTCYAN, RED, - MAGENTA, CYAN, - BROWN, MAGENTA, - LIGHTGRAY, - BLUE, - GREEN, YELLOW, - YELLOW, - LIGHTMAGENTA, - YELLOW, - DARKGRAY + // tech layers + BLUE, MAGENTA, // B_Adhes, F_Adhes + LIGHTCYAN, RED, // B_Paste, F_Paste + MAGENTA, CYAN, // B_SilkS, F_SilkS + BROWN, MAGENTA, // B_Mask, F_Mask + + // user layers + LIGHTGRAY, BLUE, GREEN, YELLOW, // Dwgs_User, Cmts_User, Eco1_User, Eco2_User + + // Special layers + 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 ) { 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_AUX_ITEMS ] = WHITE; m_LayersColors[ LAYER_WORKSHEET ] = DARKRED; + m_LayersColors[ LAYER_GRID ] = DARKGRAY; setupConfigParams(); } @@ -161,31 +168,65 @@ void COLORS_DESIGN_SETTINGS::SetAllColorsAs( COLOR4D aColor ) void COLORS_DESIGN_SETTINGS::setupConfigParams() { wxASSERT( DIM( m_LayersColors ) >= PCB_LAYER_ID_COUNT ); - for( int i = 0; i +// Colors for layers and items +COLORS_DESIGN_SETTINGS g_ColorsSettings( FRAME_CVPCB_DISPLAY ); + BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME ) EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow ) @@ -78,7 +81,6 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRA // Give an icon wxIcon icon; - icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) ); SetIcon( icon ); diff --git a/cvpcb/cvpcb.cpp b/cvpcb/cvpcb.cpp index f87aa23d1f..6c4b2d29c4 100644 --- a/cvpcb/cvpcb.cpp +++ b/cvpcb/cvpcb.cpp @@ -44,9 +44,6 @@ #include -// Colors for layers and items -COLORS_DESIGN_SETTINGS g_ColorsSettings; - // Constant string definitions for CvPcb const wxString EquFileExtension( wxT( "equ" ) ); diff --git a/gerbview/gerbview.cpp b/gerbview/gerbview.cpp index 6d183351bc..eb7248dae1 100644 --- a/gerbview/gerbview.cpp +++ b/gerbview/gerbview.cpp @@ -35,10 +35,6 @@ #include #include -// Colors for layers and items -COLORS_DESIGN_SETTINGS g_ColorsSettings; - - const wxChar* g_GerberPageSizeList[] = { 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 diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 418d43fd7e..fbb6698652 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -57,6 +57,9 @@ static const wxString cfgShowNegativeObjects( wxT( "ShowNegativeObjectsOpt" ) 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 ): EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GERBVIEW_FRAME_NAME ) diff --git a/include/class_colors_design_settings.h b/include/class_colors_design_settings.h index 5b5b823b24..4d4dbdb71c 100644 --- a/include/class_colors_design_settings.h +++ b/include/class_colors_design_settings.h @@ -2,7 +2,7 @@ * 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 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 * modify it under the terms of the GNU General Public License @@ -37,23 +37,22 @@ using KIGFX::COLOR4D; class wxConfigBase; class wxString; +#include class PARAM_CFG_ARRAY; /** * 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 { public: - // Color options for screen display of the Printed Board and schematic: - - // Common to Eeschema, Pcbnew, GerbView + // Color options for screen display of the Printed Board or schematic: COLOR4D m_LayersColors[LAYER_ID_COUNT]; ///< Layer colors (tracks and graphic items) public: - COLORS_DESIGN_SETTINGS(); + COLORS_DESIGN_SETTINGS( FRAME_T aFrameType ); ~COLORS_DESIGN_SETTINGS() override {} @@ -96,6 +95,7 @@ public: void SetAllColorsAs( COLOR4D aColor ); private: + FRAME_T m_frameType; void setupConfigParams(); diff --git a/include/core/settings.h b/include/core/settings.h index 2988181242..7afcbed8ce 100644 --- a/include/core/settings.h +++ b/include/core/settings.h @@ -44,11 +44,21 @@ class 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; } + /** @return the current prefix + */ + const wxString& GetConfigPrefix() + { + return m_prefix; + } + virtual void Load( wxConfigBase *aConfig ); virtual void Save( wxConfigBase *aConfig ); @@ -82,22 +92,22 @@ class SETTINGS 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 ) { - 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 ) { - 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 ) { - m_params.push_back ( new PARAM_CFG_SETCOLOR ( name, aPtr, aDefaultValue ) ); + m_params.push_back ( new PARAM_CFG_SETCOLOR ( m_prefix+name, aPtr, aDefaultValue ) ); } diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index a3ee7f36d8..26404fec1d 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -195,7 +195,7 @@ enum GAL_LAYER_ID: int LAYER_GP_OVERLAY, ///< general purpose overlay LAYER_PCB_BACKGROUND, ///< PCB background color 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 /// There can be at most 32 layers above here. diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index d68da9b851..7c0cb0304f 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -98,7 +98,8 @@ END_EVENT_TABLE() PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType, const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize, 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; diff --git a/pcbnew/footprint_preview_panel.cpp b/pcbnew/footprint_preview_panel.cpp index cd51c1b673..753e7be4c8 100644 --- a/pcbnew/footprint_preview_panel.cpp +++ b/pcbnew/footprint_preview_panel.cpp @@ -259,7 +259,7 @@ FOOTPRINT_PREVIEW_PANEL::FOOTPRINT_PREVIEW_PANEL( EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas m_dummyBoard = std::make_unique(); - m_colorsSettings = std::make_unique(); + m_colorsSettings = std::make_unique( FRAME_PCB_FOOTPRINT_PREVIEW ); UseColorScheme( m_colorsSettings.get() ); SyncLayersVisibility( &*m_dummyBoard ); diff --git a/pcbnew/modeditoptions.cpp b/pcbnew/modeditoptions.cpp index ac06b7f6a6..1deb71dfd9 100644 --- a/pcbnew/modeditoptions.cpp +++ b/pcbnew/modeditoptions.cpp @@ -87,65 +87,65 @@ PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings() BOARD_DESIGN_SETTINGS& settings = GetDesignSettings(); // Update everything - m_configSettings.clear(); // boost::ptr_vector destroys the pointers inside + m_configParams.clear(); // boost::ptr_vector destroys the pointers inside // 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 ) ); - 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 ) ); - 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 ) ); - 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 ) ); - 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 ) ); - 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 ) ); - 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**" ) ) ); // 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, Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ), Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ), 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, Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ), Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ), 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, Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ), Millimeter2iu(0.01), Millimeter2iu( 100.0 ), 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, Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ), Millimeter2iu( 0.01 ), Millimeter2iu( 20.0 ), 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" ), &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" ), &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, 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( "" ) ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, + m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorValueDefaultVisibility" ), &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, int( F_Fab ), int( F_SilkS ), int( F_Fab ) ) ); - return m_configSettings; + return m_configParams; } diff --git a/pcbnew/module_editor_frame.h b/pcbnew/module_editor_frame.h index 7e69919c21..1b4d49061a 100644 --- a/pcbnew/module_editor_frame.h +++ b/pcbnew/module_editor_frame.h @@ -474,9 +474,10 @@ protected: /// protected so only friend PCB::IFACE::CreateWindow() can act as sole factory. 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 diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 974dc296d6..41b6b14b6f 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -264,7 +264,10 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); 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() ); + SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) ); GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax ); GetScreen()->SetCurItem( NULL ); @@ -498,6 +501,8 @@ void FOOTPRINT_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) PCB_BASE_FRAME::LoadSettings( aCfg ); wxConfigLoadSetups( aCfg, GetConfigurationSettings() ); + m_configSettings.Load( aCfg ); // mainly, load the color config + // Ensure some params are valid BOARD_DESIGN_SETTINGS& settings = GetDesignSettings(); @@ -513,6 +518,8 @@ void FOOTPRINT_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) void FOOTPRINT_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg ) { + m_configSettings.Save( aCfg ); + PCB_BASE_FRAME::SaveSettings( aCfg ); wxConfigSaveSetups( aCfg, GetConfigurationSettings() ); } diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp index 77cab7733d..3d9d598089 100644 --- a/pcbnew/modview_frame.cpp +++ b/pcbnew/modview_frame.cpp @@ -555,6 +555,7 @@ void FOOTPRINT_VIEWER_FRAME::ExportSelectedFootprint( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::LoadSettings( wxConfigBase* aCfg ) { EDA_DRAW_FRAME::LoadSettings( aCfg ); + m_configSettings.Load( aCfg ); // mainly, load the color config } diff --git a/pcbnew/pcb_general_settings.cpp b/pcbnew/pcb_general_settings.cpp index 7e8ea532a6..16511e93c9 100644 --- a/pcbnew/pcb_general_settings.cpp +++ b/pcbnew/pcb_general_settings.cpp @@ -23,16 +23,21 @@ #include -PCB_GENERAL_SETTINGS::PCB_GENERAL_SETTINGS() +PCB_GENERAL_SETTINGS::PCB_GENERAL_SETTINGS( FRAME_T aFrameType ) + : m_colorsSettings( aFrameType ) { - Add( "LegacyDRCOn", &m_legacyDrcOn, true ); - Add( "LegacyAutoDeleteOldTrack", &m_legacyAutoDeleteOldTrack, true ); - Add( "LegacyUse45DegreeTracks",&m_legacyUse45DegreeTracks, true); - Add( "LegacyUseTwoSegmentTracks", &m_legacyUseTwoSegmentTracks, true); - Add( "Use45DegreeGraphicSegments", &m_use45DegreeGraphicSegments, false); - Add( "MagneticPads", reinterpret_cast( &m_magneticPads ), CAPTURE_CURSOR_IN_TRACK_TOOL ); - Add( "MagneticTracks", reinterpret_cast( &m_magneticTracks ), CAPTURE_CURSOR_IN_TRACK_TOOL ); - Add( "EditActionChangesTrackWidth", &m_editActionChangesTrackWidth, false ); + m_frameType = aFrameType; + + if( m_frameType == FRAME_PCB ) + { + Add( "LegacyAutoDeleteOldTrack", &m_legacyAutoDeleteOldTrack, true ); + Add( "LegacyUse45DegreeTracks",&m_legacyUse45DegreeTracks, true); + Add( "LegacyUseTwoSegmentTracks", &m_legacyUseTwoSegmentTracks, true); + Add( "Use45DegreeGraphicSegments", &m_use45DegreeGraphicSegments, false); + Add( "MagneticPads", reinterpret_cast( &m_magneticPads ), CAPTURE_CURSOR_IN_TRACK_TOOL ); + Add( "MagneticTracks", reinterpret_cast( &m_magneticTracks ), CAPTURE_CURSOR_IN_TRACK_TOOL ); + Add( "EditActionChangesTrackWidth", &m_editActionChangesTrackWidth, false ); + } } void PCB_GENERAL_SETTINGS::Load( wxConfigBase* aCfg ) diff --git a/pcbnew/pcb_general_settings.h b/pcbnew/pcb_general_settings.h index db3a2b8f92..b0c72edc1b 100644 --- a/pcbnew/pcb_general_settings.h +++ b/pcbnew/pcb_general_settings.h @@ -39,7 +39,7 @@ enum MAGNETIC_PAD_OPTION_VALUES class PCB_GENERAL_SETTINGS : public SETTINGS { public: - PCB_GENERAL_SETTINGS(); + PCB_GENERAL_SETTINGS( FRAME_T aFrameType ); void Load ( wxConfigBase* aCfg ) override; void Save( wxConfigBase* aCfg ) override; @@ -51,18 +51,20 @@ public: return m_colorsSettings; } - bool m_legacyDrcOn = true; - 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; + FRAME_T m_frameType; - bool m_editActionChangesTrackWidth = false; - bool m_showFilterDialogAfterEachSelection = false; + bool m_legacyDrcOn = true; // Not stored, always true when starting pcbnew, + // 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; - MAGNETIC_PAD_OPTION_VALUES m_magneticTracks = CAPTURE_CURSOR_IN_TRACK_TOOL; + bool m_editActionChangesTrackWidth = false; + + MAGNETIC_PAD_OPTION_VALUES m_magneticPads = CAPTURE_CURSOR_IN_TRACK_TOOL; + MAGNETIC_PAD_OPTION_VALUES m_magneticTracks = CAPTURE_CURSOR_IN_TRACK_TOOL; }; #endif