Hey, attached a fix to remove object slicing issues.
I'm sorry that my other patch is delaying, I switched over to git and need to get going again (running into a few kicad crashes due to msvc-debug libraries being very thorough).
Michael
>From 326cf3de948b4def16542ffda3f930a0ee618088 Mon Sep 17 00:00:00 2001 From: decimad <michste...@gmail.com> Date: Sat, 2 Jul 2016 15:56:56 +0200 Subject: [PATCH] fix object slicing bug introduced by the clone semantics of boost::ptr_vector (substitute by vector of unique_ptr) --- common/config_params.cpp | 46 ++++++++++++------------- cvpcb/cfg.cpp | 6 ++-- eeschema/class_library.cpp | 4 +-- eeschema/eeschema.cpp | 4 +-- eeschema/eeschema_config.cpp | 32 +++++++++--------- gerbview/gerbview_config.cpp | 14 ++++---- include/config_params.h | 9 ++--- include/project.h | 8 +++-- pagelayout_editor/pl_editor_config.cpp | 3 +- pcbnew/class_board_design_settings.cpp | 24 ++++++------- pcbnew/class_pad.cpp | 8 ++--- pcbnew/modeditoptions.cpp | 36 ++++++++++---------- pcbnew/pcbnew_config.cpp | 62 +++++++++++++++++----------------- 13 files changed, 129 insertions(+), 127 deletions(-) diff --git a/common/config_params.cpp b/common/config_params.cpp index 9737e8e..c1603d9 100644 --- a/common/config_params.cpp +++ b/common/config_params.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.char...@gipsa-lab.inpg.com * Copyright (C) 2008-2011 Wayne Stambaugh <stambau...@verizon.net> - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * 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 @@ -43,17 +43,17 @@ void wxConfigLoadParams( wxConfigBase* aCfg, { wxASSERT( aCfg ); - for( const PARAM_CFG_BASE& param : aList ) + for( const std::unique_ptr< PARAM_CFG_BASE >& param : aList ) { - if( !!param.m_Group ) - aCfg->SetPath( param.m_Group ); + if( !!param->m_Group ) + aCfg->SetPath( param->m_Group ); else aCfg->SetPath( aGroup ); - if( param.m_Setup ) + if( param->m_Setup ) continue; - param.ReadParam( aCfg ); + param->ReadParam( aCfg ); } } @@ -62,12 +62,12 @@ void wxConfigLoadSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList ) { wxASSERT( aCfg ); - for( const PARAM_CFG_BASE& param : aList ) + for( const std::unique_ptr< PARAM_CFG_BASE >& param : aList ) { - if( !param.m_Setup ) + if( !param->m_Setup ) continue; - param.ReadParam( aCfg ); + param->ReadParam( aCfg ); } } @@ -77,24 +77,24 @@ void wxConfigSaveParams( wxConfigBase* aCfg, { wxASSERT( aCfg ); - for( const PARAM_CFG_BASE& param : aList ) + for( const std::unique_ptr< PARAM_CFG_BASE >& param : aList ) { - if( !!param.m_Group ) - aCfg->SetPath( param.m_Group ); + if( !!param->m_Group ) + aCfg->SetPath( param->m_Group ); else aCfg->SetPath( aGroup ); - if( param.m_Setup ) + if( param->m_Setup ) continue; - if( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data + if( param->m_Type == PARAM_COMMAND_ERASE ) // Erase all data { - if( !!param.m_Ident ) - aCfg->DeleteGroup( param.m_Ident ); + if( !!param->m_Ident ) + aCfg->DeleteGroup( param->m_Ident ); } else { - param.SaveParam( aCfg ); + param->SaveParam( aCfg ); } } } @@ -104,19 +104,19 @@ void wxConfigSaveSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList ) { wxASSERT( aCfg ); - for( const PARAM_CFG_BASE& param : aList ) + for( const std::unique_ptr< PARAM_CFG_BASE >& param : aList ) { - if( !param.m_Setup ) + if( !param->m_Setup ) continue; - if( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data + if( param->m_Type == PARAM_COMMAND_ERASE ) // Erase all data { - if( !!param.m_Ident ) - aCfg->DeleteGroup( param.m_Ident ); + if( !!param->m_Ident ) + aCfg->DeleteGroup( param->m_Ident ); } else { - param.SaveParam( aCfg ); + param->SaveParam( aCfg ); } } } diff --git a/cvpcb/cfg.cpp b/cvpcb/cfg.cpp index fe80064..e57a93a 100644 --- a/cvpcb/cfg.cpp +++ b/cvpcb/cfg.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * 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 @@ -47,9 +47,9 @@ PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters() if( !m_projectFileParams.empty() ) return m_projectFileParams; - m_projectFileParams.push_back( new PARAM_CFG_BASE( GROUP_PCB_LIBS, PARAM_COMMAND_ERASE ) ); + m_projectFileParams.emplace_back( new PARAM_CFG_BASE( GROUP_PCB_LIBS, PARAM_COMMAND_ERASE ) ); - m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( + m_projectFileParams.emplace_back( new PARAM_CFG_LIBNAME_LIST( wxT( "EquName" ), &m_EquFilesNames, GROUP_CVP_EQU ) ); return m_projectFileParams; diff --git a/eeschema/class_library.cpp b/eeschema/class_library.cpp index 5e27a6e..64c5edd 100644 --- a/eeschema/class_library.cpp +++ b/eeschema/class_library.cpp @@ -1033,10 +1033,10 @@ void PART_LIBS::LibNamesAndPaths( PROJECT* aProject, bool doSave, PARAM_CFG_ARRAY ca; if( aPaths ) - ca.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ), aPaths ) ); + ca.emplace_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ), aPaths ) ); if( aNames ) - ca.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ), aNames, GROUP_SCH_LIBS ) ); + ca.emplace_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ), aNames, GROUP_SCH_LIBS ) ); if( doSave ) { diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index 1c77039..539e740 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.char...@gipsa-lab.inpg.com * Copyright (C) 2008-2011 Wayne Stambaugh <stambau...@verizon.net> - * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2004-2016 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 @@ -175,7 +175,7 @@ static PARAM_CFG_ARRAY& cfg_params() // eeschema KIFACE comes in. #define CLR(x, y, z)\ - ca.push_back( new PARAM_CFG_SETCOLOR( true, wxT( x ), &s_layerColor[y], z ) ); + ca.emplace_back( new PARAM_CFG_SETCOLOR( true, wxT( x ), &s_layerColor[y], z ) ); CLR( "ColorWireEx", LAYER_WIRE, GREEN ) CLR( "ColorBusEx", LAYER_BUS, BLUE ) diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index eb2ed23..a41a7ed 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -396,16 +396,16 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParametersList() if( !m_projectFileParams.empty() ) return m_projectFileParams; - m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ), + m_projectFileParams.emplace_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ), &BASE_SCREEN::m_PageLayoutDescrFileName ) ); - m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "PlotDirectoryName" ), + m_projectFileParams.emplace_back( new PARAM_CFG_FILENAME( wxT( "PlotDirectoryName" ), &m_plotDirectoryName ) ); - m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "SubpartIdSeparator" ), + m_projectFileParams.emplace_back( new PARAM_CFG_INT( wxT( "SubpartIdSeparator" ), LIB_PART::SubpartIdSeparatorPtr(), 0, 0, 126 ) ); - m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "SubpartFirstId" ), + m_projectFileParams.emplace_back( new PARAM_CFG_INT( wxT( "SubpartFirstId" ), LIB_PART::SubpartFirstIdPtr(), 'A', '1', 'z' ) ); @@ -417,18 +417,18 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParametersList() GROUP_SCH_LIBS ) ); */ - m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( wxT( "NetFmtName" ), + m_projectFileParams.emplace_back( new PARAM_CFG_WXSTRING( wxT( "NetFmtName" ), &m_netListFormat) ); - m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "SpiceForceRefPrefix" ), + m_projectFileParams.emplace_back( new PARAM_CFG_BOOL( wxT( "SpiceForceRefPrefix" ), &m_spiceNetlistAddReferencePrefix, false ) ); - m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "SpiceUseNetNumbers" ), + m_projectFileParams.emplace_back( new PARAM_CFG_BOOL( wxT( "SpiceUseNetNumbers" ), &m_spiceNetlistUseNetcodeAsNetname, false ) ); - m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "LabSize" ), + m_projectFileParams.emplace_back( new PARAM_CFG_INT( wxT( "LabSize" ), &s_defaultTextSize, DEFAULT_SIZE_TEXT, 5, 1000 ) ); - m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_TestSimilarLabels" ), + m_projectFileParams.emplace_back( new PARAM_CFG_BOOL( wxT( "ERC_TestSimilarLabels" ), &DIALOG_ERC::m_TestSimilarLabels, true ) ); return m_projectFileParams; @@ -546,27 +546,27 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings() if( !m_configSettings.empty() ) return m_configSettings; - m_configSettings.push_back( new PARAM_CFG_BOOL( true, ShowPageLimitsEntry, + m_configSettings.emplace_back( new PARAM_CFG_BOOL( true, ShowPageLimitsEntry, &m_showPageLimits, true ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, UnitsEntry, + m_configSettings.emplace_back( new PARAM_CFG_INT( true, UnitsEntry, (int*)&g_UserUnit, MILLIMETRES ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, PrintMonochromeEntry, + m_configSettings.emplace_back( new PARAM_CFG_BOOL( true, PrintMonochromeEntry, &m_printMonochrome, true ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, PrintSheetRefEntry, + m_configSettings.emplace_back( new PARAM_CFG_BOOL( true, PrintSheetRefEntry, &m_printSheetReference, true ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, RepeatStepXEntry, + m_configSettings.emplace_back( new PARAM_CFG_INT( true, RepeatStepXEntry, &m_repeatStep.x, DEFAULT_REPEAT_OFFSET_X, -REPEAT_OFFSET_MAX, REPEAT_OFFSET_MAX ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, RepeatStepYEntry, + m_configSettings.emplace_back( new PARAM_CFG_INT( true, RepeatStepYEntry, &m_repeatStep.y, DEFAULT_REPEAT_OFFSET_Y, -REPEAT_OFFSET_MAX, REPEAT_OFFSET_MAX ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, RepeatLabelIncrementEntry, + m_configSettings.emplace_back( new PARAM_CFG_INT( true, RepeatLabelIncrementEntry, &m_repeatDeltaLabel, DEFAULT_REPEAT_LABEL_INC, -10, +10 ) ); return m_configSettings; diff --git a/gerbview/gerbview_config.cpp b/gerbview/gerbview_config.cpp index 7d35e06..0eeaf1c 100644 --- a/gerbview/gerbview_config.cpp +++ b/gerbview/gerbview_config.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.char...@gipsa-lab.inpg.com * Copyright (C) 2009 Wayne Stambaugh <stambau...@verizon.net> - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * 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 @@ -82,22 +82,22 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings() if( !m_configSettings.empty() ) return m_configSettings; - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ), + m_configSettings.emplace_back( new PARAM_CFG_INT( true, wxT( "Units" ), (int*) &g_UserUnit, 0, 0, 1 ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ), + m_configSettings.emplace_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ), &m_displayMode, 2, 0, 2 ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, + m_configSettings.emplace_back( new PARAM_CFG_SETCOLOR( true, wxT( "DCodeColorEx" ), &g_ColorsSettings.m_ItemsColors[ DCODES_VISIBLE], WHITE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, + m_configSettings.emplace_back( new PARAM_CFG_SETCOLOR( true, wxT( "NegativeObjectsColorEx" ), &g_ColorsSettings.m_ItemsColors[ NEGATIVE_OBJECTS_VISIBLE], DARKGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, + m_configSettings.emplace_back( new PARAM_CFG_BOOL( true, wxT( "DisplayPolarCoordinates" ), &m_DisplayOptions.m_DisplayPolarCood, false ) ); @@ -139,7 +139,7 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings() PARAM_CFG_SETCOLOR* prm_entry = new PARAM_CFG_SETCOLOR( true, keys[i], prm, color_default[i] ); - m_configSettings.push_back( prm_entry ); + m_configSettings.emplace_back( prm_entry ); } return m_configSettings; diff --git a/include/config_params.h b/include/config_params.h index 0425e94..2fac909 100644 --- a/include/config_params.h +++ b/include/config_params.h @@ -3,7 +3,7 @@ * * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.char...@gipsa-lab.inpg.com * Copyright (C) 2008-2011 Wayne Stambaugh <stambau...@verizon.net> - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * 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 @@ -33,9 +33,9 @@ #include <wx/confbase.h> #include <wx/fileconf.h> -#include <boost/ptr_container/ptr_vector.hpp> #include <colors.h> #include <limits> +#include <memory> /// Names of sub sections where to store project info in *.pro project config files #define GROUP_PCB wxT( "/pcbnew" ) /// parameters for Pcbnew/Modedit @@ -301,10 +301,7 @@ public: /** A list of parameters type */ -//typedef boost::ptr_vector<PARAM_CFG_BASE> PARAM_CFG_ARRAY; -class PARAM_CFG_ARRAY : public boost::ptr_vector<PARAM_CFG_BASE> -{ -}; +using PARAM_CFG_ARRAY = std::vector< std::unique_ptr< PARAM_CFG_BASE > >; /** diff --git a/include/project.h b/include/project.h index e3fd292..abb0f8c 100644 --- a/include/project.h +++ b/include/project.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2014-2016 KiCad Developers, see CHANGELOG.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 @@ -25,6 +25,7 @@ #define PROJECT_H_ #include <vector> +#include <memory> #include <wx/string.h> #include <wx/filename.h> @@ -34,7 +35,10 @@ class wxConfigBase; -class PARAM_CFG_ARRAY; + +class PARAM_CFG_BASE; +using PARAM_CFG_ARRAY = std::vector< std::unique_ptr< PARAM_CFG_BASE > >; + class FP_LIB_TABLE; class PART_LIBS; class SEARCH_STACK; diff --git a/pagelayout_editor/pl_editor_config.cpp b/pagelayout_editor/pl_editor_config.cpp index d3cfca9..3e094f5 100644 --- a/pagelayout_editor/pl_editor_config.cpp +++ b/pagelayout_editor/pl_editor_config.cpp @@ -8,6 +8,7 @@ * * Copyright (C) 2013 CERN * @author Jean-Pierre Charras, jp.charras at wanadoo.fr + * 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 @@ -97,7 +98,7 @@ PARAM_CFG_ARRAY& PL_EDITOR_FRAME::GetConfigurationSettings() if( !m_configSettings.empty() ) return m_configSettings; - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ), + m_configSettings.emplace_back( new PARAM_CFG_INT( true, wxT( "Units" ), (int*) &g_UserUnit, 0, 0, 1 ) ); return m_configSettings; diff --git a/pcbnew/class_board_design_settings.cpp b/pcbnew/class_board_design_settings.cpp index d53a208..7afc32f 100644 --- a/pcbnew/class_board_design_settings.cpp +++ b/pcbnew/class_board_design_settings.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * 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 @@ -117,60 +117,60 @@ void BOARD_DESIGN_SETTINGS::AppendConfigs( PARAM_CFG_ARRAY* aResult ) { m_Pad_Master.AppendConfigs( aResult ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextSizeV" ), + aResult->emplace_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextSizeV" ), &m_PcbTextSize.y, Millimeter2iu( DEFAULT_TEXT_PCB_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextSizeH" ), + aResult->emplace_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextSizeH" ), &m_PcbTextSize.x, Millimeter2iu( DEFAULT_TEXT_PCB_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextThickness" ), + aResult->emplace_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextThickness" ), &m_PcbTextWidth, Millimeter2iu(DEFAULT_TEXT_PCB_THICKNESS ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleTextSizeV" ), + aResult->emplace_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleTextSizeV" ), &m_ModuleTextSize.y, DEFAULT_TEXT_MODULE_SIZE, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleTextSizeH" ), + aResult->emplace_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleTextSizeH" ), &m_ModuleTextSize.x, DEFAULT_TEXT_MODULE_SIZE, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleTextSizeThickness" ), + aResult->emplace_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleTextSizeThickness" ), &m_ModuleTextWidth, Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ), 1, TEXTS_MAX_WIDTH, NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderMaskClearance" ), + aResult->emplace_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderMaskClearance" ), &m_SolderMaskMargin, Millimeter2iu( DEFAULT_SOLDERMASK_CLEARANCE ), 0, Millimeter2iu( 1.0 ), NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderMaskMinWidth" ), + aResult->emplace_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderMaskMinWidth" ), &m_SolderMaskMinWidth, Millimeter2iu( DEFAULT_SOLDERMASK_MIN_WIDTH ), 0, Millimeter2iu( 0.5 ), NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "DrawSegmentWidth" ), + aResult->emplace_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "DrawSegmentWidth" ), &m_DrawSegmentWidth, Millimeter2iu( DEFAULT_GRAPHIC_THICKNESS ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "BoardOutlineThickness" ), + aResult->emplace_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "BoardOutlineThickness" ), &m_EdgeSegmentWidth, Millimeter2iu( DEFAULT_PCB_EDGE_THICKNESS ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleOutlineThickness" ), + aResult->emplace_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleOutlineThickness" ), &m_ModuleSegmentWidth, Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index a5129cc..8aa7dc2 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -328,25 +328,25 @@ void D_PAD::AppendConfigs( PARAM_CFG_ARRAY* aResult ) // Parameters stored in config are only significant parameters // for a template. // So not all parameters are stored, just few. - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadDrill" ), + aResult->emplace_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadDrill" ), &m_Drill.x, Millimeter2iu( 0.6 ), Millimeter2iu( 0.1 ), Millimeter2iu( 10.0 ), NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadDrillOvalY" ), + aResult->emplace_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadDrillOvalY" ), &m_Drill.y, Millimeter2iu( 0.6 ), Millimeter2iu( 0.1 ), Millimeter2iu( 10.0 ), NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadSizeH" ), + aResult->emplace_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadSizeH" ), &m_Size.x, Millimeter2iu( 1.4 ), Millimeter2iu( 0.1 ), Millimeter2iu( 20.0 ), NULL, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadSizeV" ), + aResult->emplace_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadSizeV" ), &m_Size.y, Millimeter2iu( 1.4 ), Millimeter2iu( 0.1 ), Millimeter2iu( 20.0 ), diff --git a/pcbnew/modeditoptions.cpp b/pcbnew/modeditoptions.cpp index ac06b7f..cec3aec 100644 --- a/pcbnew/modeditoptions.cpp +++ b/pcbnew/modeditoptions.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <d...@softplc.com> * Copyright (C) 2015 Wayne Stambaugh <stambau...@verizon.net> - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * 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 @@ -90,59 +90,59 @@ PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings() m_configSettings.clear(); // boost::ptr_vector destroys the pointers inside // Display options: - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorUnits" ), + m_configSettings.emplace_back( new PARAM_CFG_INT( true, wxT( "FpEditorUnits" ), (int*)&g_UserUnit, MILLIMETRES ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ), + m_configSettings.emplace_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_configSettings.emplace_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_configSettings.emplace_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_configSettings.emplace_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_configSettings.emplace_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_configSettings.emplace_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_configSettings.emplace_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_configSettings.emplace_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_configSettings.emplace_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_configSettings.emplace_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_configSettings.emplace_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorRefDefaultText" ), &settings.m_RefDefaultText, wxT( "REF**" ) ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, + m_configSettings.emplace_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorRefDefaultVisibility" ), &settings.m_RefDefaultVisibility, true ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorRefDefaultLayer" ), + m_configSettings.emplace_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_configSettings.emplace_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorValueDefaultText" ), &settings.m_ValueDefaultText, wxT( "" ) ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, + m_configSettings.emplace_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorValueDefaultVisibility" ), &settings.m_ValueDefaultVisibility, true ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorValueDefaultLayer" ), + m_configSettings.emplace_back( new PARAM_CFG_INT( true, wxT( "FpEditorValueDefaultLayer" ), &settings.m_ValueDefaultlayer, int( F_Fab ), int( F_SilkS ), int( F_Fab ) ) ); diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 9385e6d..364e5b6 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -311,10 +311,10 @@ PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters() // This one cannot be cached because some settings are going to/from the BOARD, // so pointers into that cannot be saved for long. - pca.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ), + pca.emplace_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ), &BASE_SCREEN::m_PageLayoutDescrFileName ) ); - pca.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ), &m_lastNetListRead ) ); + pca.emplace_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ), &m_lastNetListRead ) ); GetBoard()->GetDesignSettings().AppendConfigs( &pca ); @@ -331,34 +331,34 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() COLORS_DESIGN_SETTINGS cds; // constructor fills this with sensible colors // Units used in dialogs and toolbars - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ), + m_configSettings.emplace_back( new PARAM_CFG_INT( true, wxT( "Units" ), (int*)&g_UserUnit, MILLIMETRES ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayPolarCoords" ), + m_configSettings.emplace_back( new PARAM_CFG_BOOL( true, wxT( "DisplayPolarCoords" ), &displ_opts->m_DisplayPolarCood, false ) ); // Display options and modes: - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ShowNetNamesMode" ), + m_configSettings.emplace_back( new PARAM_CFG_INT( true, wxT( "ShowNetNamesMode" ), &displ_opts->m_DisplayNetNamesMode, 3, 0, 3 ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayTrackFilled" ), + m_configSettings.emplace_back( new PARAM_CFG_BOOL( true, wxT( "DisplayTrackFilled" ), &displ_opts->m_DisplayPcbTrackFill, true ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "TrackDisplayClearance" ), + m_configSettings.emplace_back( new PARAM_CFG_INT( true, wxT( "TrackDisplayClearance" ), (int*) &displ_opts->m_ShowTrackClearanceMode, SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadFill" ), + m_configSettings.emplace_back( new PARAM_CFG_BOOL( true, wxT( "PadFill" ), &displ_opts->m_DisplayPadFill, true ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ViaFill" ), + m_configSettings.emplace_back( new PARAM_CFG_BOOL( true, wxT( "ViaFill" ), &displ_opts->m_DisplayViaFill, true ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadAffG" ), + m_configSettings.emplace_back( new PARAM_CFG_BOOL( true, wxT( "PadAffG" ), &displ_opts->m_DisplayPadIsol, true ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadSNum" ), + m_configSettings.emplace_back( new PARAM_CFG_BOOL( true, wxT( "PadSNum" ), &displ_opts->m_DisplayPadNum, true ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ModAffC" ), + m_configSettings.emplace_back( new PARAM_CFG_BOOL( true, wxT( "ModAffC" ), &displ_opts->m_DisplayModEdgeFill, FILLED ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ModAffT" ), + m_configSettings.emplace_back( new PARAM_CFG_BOOL( true, wxT( "ModAffT" ), &displ_opts->m_DisplayModTextFill, FILLED ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PcbAffT" ), + m_configSettings.emplace_back( new PARAM_CFG_BOOL( true, wxT( "PcbAffT" ), &displ_opts->m_DisplayDrawItemsFill, FILLED ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PcbShowZonesMode" ), + m_configSettings.emplace_back( new PARAM_CFG_INT( true, wxT( "PcbShowZonesMode" ), &displ_opts->m_DisplayZonesMode, 0, 0, 2 ) ); // layer colors: @@ -369,49 +369,49 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() wxT( "ColorPCBLayer_%s" ), LSET::Name( LAYER_ID( i ) ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, vn, LOC_COLOR( i ), cds.m_LayersColors[i] ) ); + m_configSettings.emplace_back( new PARAM_CFG_SETCOLOR( true, vn, LOC_COLOR( i ), cds.m_LayersColors[i] ) ); } - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtFrontEx" ), + m_configSettings.emplace_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtFrontEx" ), ITEM_COLOR( MOD_TEXT_FR_VISIBLE ), LIGHTGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtBackEx" ), + m_configSettings.emplace_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtBackEx" ), ITEM_COLOR( MOD_TEXT_BK_VISIBLE ), BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtInvisEx" ), + m_configSettings.emplace_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtInvisEx" ), ITEM_COLOR( MOD_TEXT_INVISIBLE ), DARKGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorAnchorEx" ), + m_configSettings.emplace_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorAnchorEx" ), ITEM_COLOR( ANCHOR_VISIBLE ), BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPadBackEx" ), + m_configSettings.emplace_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPadBackEx" ), ITEM_COLOR( PAD_BK_VISIBLE ), GREEN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPadFrontEx" ), + m_configSettings.emplace_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPadFrontEx" ), ITEM_COLOR( PAD_FR_VISIBLE ), RED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaThruEx" ), + m_configSettings.emplace_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaThruEx" ), ITEM_COLOR( VIA_THROUGH_VISIBLE ), LIGHTGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaBBlindEx" ), + m_configSettings.emplace_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaBBlindEx" ), ITEM_COLOR( VIA_BBLIND_VISIBLE ), BROWN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaMicroEx" ), + m_configSettings.emplace_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaMicroEx" ), ITEM_COLOR( VIA_MICROVIA_VISIBLE ), CYAN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNonPlatedEx" ), + m_configSettings.emplace_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNonPlatedEx" ), ITEM_COLOR( NON_PLATED_VISIBLE ), YELLOW ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorRatsEx" ), + m_configSettings.emplace_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorRatsEx" ), ITEM_COLOR( RATSNEST_VISIBLE ), WHITE ) ); // Miscellaneous: - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "RotationAngle" ), &m_rotationAngle, + m_configSettings.emplace_back( new PARAM_CFG_INT( true, wxT( "RotationAngle" ), &m_rotationAngle, 900, 1, 900 ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "MaxLnkS" ), + m_configSettings.emplace_back( new PARAM_CFG_INT( true, wxT( "MaxLnkS" ), &displ_opts->m_MaxLinksShowed, 3, 0, 15 ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "TwoSegT" ), + m_configSettings.emplace_back( new PARAM_CFG_BOOL( true, wxT( "TwoSegT" ), &g_TwoSegmentTrackBuild, true ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "SegmPcb45Only" ) + m_configSettings.emplace_back( new PARAM_CFG_BOOL( true, wxT( "SegmPcb45Only" ) , &g_Segments_45_Only, true ) ); } -- 2.9.0.windows.1
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp