From 7bb9551801954ba7feacf36b65b98c8a289126b7 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 11 Jan 2020 00:04:01 +0000 Subject: [PATCH] Handle boost exceptions. (From Coverity scan.) --- common/advanced_config.cpp | 48 ++---- eeschema/class_library.cpp | 15 +- eeschema/eeschema_config.cpp | 103 +++++++----- eeschema/sch_text.cpp | 44 ++--- gerbview/gerbview_config.cpp | 47 +++--- include/advanced_config.h | 15 -- pcbnew/board_design_settings.cpp | 267 ++++++++++++++++--------------- pcbnew/class_pad.cpp | 47 +++--- pcbnew/pcb_general_settings.cpp | 49 +++--- 9 files changed, 316 insertions(+), 319 deletions(-) diff --git a/common/advanced_config.cpp b/common/advanced_config.cpp index f1bf844586..3dba9c6fac 100644 --- a/common/advanced_config.cpp +++ b/common/advanced_config.cpp @@ -80,13 +80,6 @@ static const wxChar UsePinFunction[] = wxT( "UsePinFunction" ); */ static const wxChar RealtimeConnectivity[] = wxT( "RealtimeConnectivity" ); -/** - * Allow legacy canvas to be shown in GTK3. Legacy canvas is generally pretty - * broken, but this avoids code in an ifdef where it could become broken - * on other platforms - */ -static const wxChar AllowLegacyCanvasInGtk3[] = wxT( "AllowLegacyCanvasInGtk3" ); - /** * Configure the coroutine stack size in bytes. This should be allocated in multiples of * the system page size (n*4096 is generally safe) @@ -172,7 +165,6 @@ ADVANCED_CFG::ADVANCED_CFG() // then the values will remain as set here. m_EnableUsePadProperty = false; m_EnableUsePinFunction = false; - m_allowLegacyCanvasInGtk3 = false; m_realTimeConnectivity = true; m_coroutineStackSize = AC_STACK::default_stack; @@ -208,21 +200,25 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg ) { PARAM_CFG_ARRAY configParams; - configParams.push_back( - new PARAM_CFG_BOOL( true, AC_KEYS::UsePadProperty, &m_EnableUsePadProperty, false ) ); + try + { + configParams.push_back( + new PARAM_CFG_BOOL( true, AC_KEYS::UsePadProperty, &m_EnableUsePadProperty, false ) ); - configParams.push_back( - new PARAM_CFG_BOOL( true, AC_KEYS::UsePinFunction, &m_EnableUsePinFunction, false ) ); + configParams.push_back( + new PARAM_CFG_BOOL( true, AC_KEYS::UsePinFunction, &m_EnableUsePinFunction, false ) ); - configParams.push_back( new PARAM_CFG_BOOL( - true, AC_KEYS::AllowLegacyCanvasInGtk3, &m_allowLegacyCanvasInGtk3, false ) ); + configParams.push_back( + new PARAM_CFG_BOOL( true, AC_KEYS::RealtimeConnectivity, &m_realTimeConnectivity, false ) ); - configParams.push_back( - new PARAM_CFG_BOOL( true, AC_KEYS::RealtimeConnectivity, &m_realTimeConnectivity, false ) ); - - configParams.push_back( - new PARAM_CFG_INT( true, AC_KEYS::CoroutineStackSize, &m_coroutineStackSize, - AC_STACK::default_stack, AC_STACK::min_stack, AC_STACK::max_stack ) ); + configParams.push_back( + new PARAM_CFG_INT( true, AC_KEYS::CoroutineStackSize, &m_coroutineStackSize, + AC_STACK::default_stack, AC_STACK::min_stack, AC_STACK::max_stack ) ); + } + catch( boost::bad_pointer& ) + { + // Out of memory? Ship's going down anyway.... + } wxConfigLoadSetups( &aCfg, configParams ); @@ -230,15 +226,3 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg ) } -bool ADVANCED_CFG::AllowLegacyCanvas() const -{ - // default is to allow - bool allow = true; - - // on GTK3, check the config -#ifdef __WXGTK3__ - allow = m_allowLegacyCanvasInGtk3; -#endif - - return allow; -} diff --git a/eeschema/class_library.cpp b/eeschema/class_library.cpp index 676c89d370..548a23c78f 100644 --- a/eeschema/class_library.cpp +++ b/eeschema/class_library.cpp @@ -430,11 +430,18 @@ void PART_LIBS::LibNamesAndPaths( PROJECT* aProject, bool doSave, PARAM_CFG_ARRAY ca; - if( aPaths ) - ca.push_back( new PARAM_CFG_FILENAME( "LibDir", aPaths ) ); + try + { + if( aPaths ) + ca.push_back( new PARAM_CFG_FILENAME( "LibDir", aPaths ) ); - if( aNames ) - ca.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ), aNames, GROUP_SCH_LIBS ) ); + if( aNames ) + ca.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ), aNames, GROUP_SCH_LIBS ) ); + } + catch( boost::bad_pointer& ) + { + // Out of memory? Ship's going down anyway.... + } if( doSave ) { diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index de549af706..acb994c304 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -187,45 +187,52 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters() if( !m_projectFileParams.empty() ) return m_projectFileParams; - m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ), - &BASE_SCREEN::m_PageLayoutDescrFileName ) ); + try + { + m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ), + &BASE_SCREEN::m_PageLayoutDescrFileName ) ); - m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "PlotDirectoryName" ), - &m_plotDirectoryName ) ); + m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "PlotDirectoryName" ), + &m_plotDirectoryName ) ); - m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "SubpartIdSeparator" ), - LIB_PART::SubpartIdSeparatorPtr(), 0, 0, 126 ) ); - m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "SubpartFirstId" ), - LIB_PART::SubpartFirstIdPtr(), 'A', '1', 'z' ) ); + m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "SubpartIdSeparator" ), + LIB_PART::SubpartIdSeparatorPtr(), 0, 0, 126 ) ); + m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "SubpartFirstId" ), + LIB_PART::SubpartFirstIdPtr(), 'A', '1', 'z' ) ); - m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( wxT( "NetFmtName" ), - &m_netListFormat) ); - m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "SpiceAjustPassiveValues" ), - &m_spiceAjustPassiveValues, false ) ); + m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( wxT( "NetFmtName" ), + &m_netListFormat) ); + m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "SpiceAjustPassiveValues" ), + &m_spiceAjustPassiveValues, false ) ); - m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "LabSize" ), - &s_defaultTextSize, DEFAULT_SIZE_TEXT, 5, 1000 ) ); + m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "LabSize" ), + &s_defaultTextSize, DEFAULT_SIZE_TEXT, 5, 1000 ) ); - m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_WriteFile" ), - &m_ercSettings.write_erc_file, false ) ); + m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_WriteFile" ), + &m_ercSettings.write_erc_file, false ) ); - m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_TestSimilarLabels" ), - &m_ercSettings.check_similar_labels, true ) ); + m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_TestSimilarLabels" ), + &m_ercSettings.check_similar_labels, true ) ); - m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckUniqueGlobalLabels" ), - &m_ercSettings.check_unique_global_labels, true ) ); + m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckUniqueGlobalLabels" ), + &m_ercSettings.check_unique_global_labels, true ) ); - m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckBusDriverConflicts" ), - &m_ercSettings.check_bus_driver_conflicts, true ) ); + m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckBusDriverConflicts" ), + &m_ercSettings.check_bus_driver_conflicts, true ) ); - m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckBusEntryConflicts" ), - &m_ercSettings.check_bus_entry_conflicts, true ) ); + m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckBusEntryConflicts" ), + &m_ercSettings.check_bus_entry_conflicts, true ) ); - m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckBusToBusConflicts" ), - &m_ercSettings.check_bus_to_bus_conflicts, true ) ); + m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckBusToBusConflicts" ), + &m_ercSettings.check_bus_to_bus_conflicts, true ) ); - m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckBusToNetConflicts" ), - &m_ercSettings.check_bus_to_net_conflicts, true ) ); + m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckBusToNetConflicts" ), + &m_ercSettings.check_bus_to_net_conflicts, true ) ); + } + catch( boost::bad_pointer& ) + { + // Out of memory? Ship's going down anyway.... + } return m_projectFileParams; } @@ -343,24 +350,32 @@ 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_showPageLimits, true ) ); - m_configSettings.push_back( new PARAM_CFG_INT( - true, UnitsEntry, (int*) &m_userUnits, (int) EDA_UNITS::MILLIMETRES ) ); + try + { + m_configSettings.push_back( new PARAM_CFG_BOOL( true, ShowPageLimitsEntry, + &m_showPageLimits, true ) ); + m_configSettings.push_back( new PARAM_CFG_INT( + true, UnitsEntry, (int*) &m_userUnits, (int) EDA_UNITS::MILLIMETRES ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, PrintMonochromeEntry, - &m_printMonochrome, true ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, PrintSheetRefEntry, - &m_printSheetReference, true ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, PrintMonochromeEntry, + &m_printMonochrome, true ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, PrintSheetRefEntry, + &m_printSheetReference, true ) ); + + m_configSettings.push_back( new PARAM_CFG_INT( true, RepeatLabelIncrementEntry, + &m_repeatDeltaLabel, DEFAULT_REPEAT_LABEL_INC, + -10, +10 ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, ShowIllegalSymboLibDialog, + &m_showIllegalSymbolLibDialog, true ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, showSheetFileNameCaseSensitivityDlg, + &m_showSheetFileNameCaseSensitivityDlg, + true ) ); + } + catch( boost::bad_pointer& ) + { + // Out of memory? Ship's going down anyway.... + } - m_configSettings.push_back( new PARAM_CFG_INT( true, RepeatLabelIncrementEntry, - &m_repeatDeltaLabel, DEFAULT_REPEAT_LABEL_INC, - -10, +10 ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, ShowIllegalSymboLibDialog, - &m_showIllegalSymbolLibDialog, true ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, showSheetFileNameCaseSensitivityDlg, - &m_showSheetFileNameCaseSensitivityDlg, - true ) ); return m_configSettings; } diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 880fc62a37..93c1be4764 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -554,21 +554,11 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) switch( GetLabelSpinStyle() ) { - case LABEL_SPIN_STYLE::LEFT: - msg = _( "Horizontal left" ); - break; - case LABEL_SPIN_STYLE::UP: - msg = _( "Vertical up" ); - break; - case LABEL_SPIN_STYLE::RIGHT: - msg = _( "Horizontal right" ); - break; - case LABEL_SPIN_STYLE::BOTTOM: - msg = _( "Vertical down" ); - break; - default: - msg = wxT( "???" ); - break; + case LABEL_SPIN_STYLE::LEFT: msg = _( "Horizontal left" ); break; + case LABEL_SPIN_STYLE::UP: msg = _( "Vertical up" ); break; + case LABEL_SPIN_STYLE::RIGHT: msg = _( "Horizontal right" ); break; + case LABEL_SPIN_STYLE::BOTTOM: msg = _( "Vertical down" ); break; + default: msg = wxT( "???" ); break; } aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), msg, BROWN ) ); @@ -589,24 +579,12 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { switch( GetShape() ) { - case PINSHEETLABEL_SHAPE::PS_INPUT: - msg = _( "Input" ); - break; - case PINSHEETLABEL_SHAPE::PS_OUTPUT: - msg = _( "Output" ); - break; - case PINSHEETLABEL_SHAPE::PS_BIDI: - msg = _( "Bidirectional" ); - break; - case PINSHEETLABEL_SHAPE::PS_TRISTATE: - msg = _( "Tri-State" ); - break; - case PINSHEETLABEL_SHAPE::PS_UNSPECIFIED: - msg = _( "Passive" ); - break; - default: - msg = wxT( "???" ); - break; + case PINSHEETLABEL_SHAPE::PS_INPUT: msg = _( "Input" ); break; + case PINSHEETLABEL_SHAPE::PS_OUTPUT: msg = _( "Output" ); break; + case PINSHEETLABEL_SHAPE::PS_BIDI: msg = _( "Bidirectional" ); break; + case PINSHEETLABEL_SHAPE::PS_TRISTATE: msg = _( "Tri-State" ); break; + case PINSHEETLABEL_SHAPE::PS_UNSPECIFIED: msg = _( "Passive" ); break; + default: msg = wxT( "???" ); break; } aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, BLUE ) ); diff --git a/gerbview/gerbview_config.cpp b/gerbview/gerbview_config.cpp index 54e70b6a88..10b6a140a1 100644 --- a/gerbview/gerbview_config.cpp +++ b/gerbview/gerbview_config.cpp @@ -52,26 +52,33 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings() if( !m_configSettings.empty() ) return m_configSettings; - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ), - &m_displayMode, 2, 0, 2 ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( - true, wxT( "DCodeColorEx" ), - &g_ColorsSettings.m_LayersColors[LAYER_DCODES], WHITE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( - true, wxT( "NegativeObjectsColorEx" ), - &g_ColorsSettings.m_LayersColors[LAYER_NEGATIVE_OBJECTS], DARKGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( - true, wxT( "GridColorEx" ), - &g_ColorsSettings.m_LayersColors[LAYER_GERBVIEW_GRID], DARKGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( - true, wxT( "WorksheetColorEx" ), - &g_ColorsSettings.m_LayersColors[ LAYER_WORKSHEET], DARKRED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( - true, wxT( "BackgroundColorEx" ), - &g_ColorsSettings.m_LayersColors[LAYER_PCB_BACKGROUND], BLACK ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( - true, wxT( "DisplayPolarCoordinates" ), - &m_PolarCoords, false ) ); + try + { + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ), + &m_displayMode, 2, 0, 2 ) ); + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( + true, wxT( "DCodeColorEx" ), + &g_ColorsSettings.m_LayersColors[LAYER_DCODES], WHITE ) ); + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( + true, wxT( "NegativeObjectsColorEx" ), + &g_ColorsSettings.m_LayersColors[LAYER_NEGATIVE_OBJECTS], DARKGRAY ) ); + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( + true, wxT( "GridColorEx" ), + &g_ColorsSettings.m_LayersColors[LAYER_GERBVIEW_GRID], DARKGRAY ) ); + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( + true, wxT( "WorksheetColorEx" ), + &g_ColorsSettings.m_LayersColors[ LAYER_WORKSHEET], DARKRED ) ); + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( + true, wxT( "BackgroundColorEx" ), + &g_ColorsSettings.m_LayersColors[LAYER_PCB_BACKGROUND], BLACK ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( + true, wxT( "DisplayPolarCoordinates" ), + &m_PolarCoords, false ) ); + } + catch( boost::bad_pointer& ) + { + // Out of memory? Ship's going down anyway.... + } // Default colors for layers 0 to 31 static const COLOR4D color_default[] = { diff --git a/include/advanced_config.h b/include/advanced_config.h index 398c1eb7e7..386bbf80dd 100644 --- a/include/advanced_config.h +++ b/include/advanced_config.h @@ -88,21 +88,6 @@ public: */ int m_coroutineStackSize; - /** - * Helper to determine if legacy canvas is allowed (according to platform - * and config) - * @return true if legacy canvas should be shown - */ - bool AllowLegacyCanvas() const; - -private: - /* - * These settings are private, as there is extra logic provide by helper - * functions above. - */ - - bool m_allowLegacyCanvasInGtk3; - private: ADVANCED_CFG(); diff --git a/pcbnew/board_design_settings.cpp b/pcbnew/board_design_settings.cpp index 528ead8463..c98472b147 100644 --- a/pcbnew/board_design_settings.cpp +++ b/pcbnew/board_design_settings.cpp @@ -531,174 +531,181 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() : // values are saved in mm void BOARD_DESIGN_SETTINGS::AppendConfigs( BOARD* aBoard, PARAM_CFG_ARRAY* aResult ) { - aResult->push_back( new PARAM_CFG_LAYERS( aBoard ) ); + try + { + aResult->push_back( new PARAM_CFG_LAYERS( aBoard ) ); - aResult->push_back( new PARAM_CFG_BOOL( wxT( "AllowMicroVias" ), - &m_MicroViasAllowed, false ) ); + aResult->push_back( new PARAM_CFG_BOOL( wxT( "AllowMicroVias" ), + &m_MicroViasAllowed, false ) ); - aResult->push_back( new PARAM_CFG_BOOL( wxT( "AllowBlindVias" ), - &m_BlindBuriedViaAllowed, false ) ); + aResult->push_back( new PARAM_CFG_BOOL( wxT( "AllowBlindVias" ), + &m_BlindBuriedViaAllowed, false ) ); - aResult->push_back( new PARAM_CFG_BOOL( wxT( "RequireCourtyardDefinitions" ), - &m_RequireCourtyards, false ) ); + aResult->push_back( new PARAM_CFG_BOOL( wxT( "RequireCourtyardDefinitions" ), + &m_RequireCourtyards, false ) ); - aResult->push_back( new PARAM_CFG_BOOL( wxT( "ProhibitOverlappingCourtyards" ), - &m_ProhibitOverlappingCourtyards, true ) ); + aResult->push_back( new PARAM_CFG_BOOL( wxT( "ProhibitOverlappingCourtyards" ), + &m_ProhibitOverlappingCourtyards, true ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinTrackWidth" ), - &m_TrackMinWidth, - Millimeter2iu( DEFAULT_TRACKMINWIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), - nullptr, MM_PER_IU ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinTrackWidth" ), + &m_TrackMinWidth, + Millimeter2iu( DEFAULT_TRACKMINWIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), + nullptr, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinViaDiameter" ), - &m_ViasMinSize, - Millimeter2iu( DEFAULT_VIASMINSIZE ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), - nullptr, MM_PER_IU ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinViaDiameter" ), + &m_ViasMinSize, + Millimeter2iu( DEFAULT_VIASMINSIZE ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), + nullptr, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinViaDrill" ), - &m_ViasMinDrill, - Millimeter2iu( DEFAULT_VIASMINDRILL ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), - nullptr, MM_PER_IU ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinViaDrill" ), + &m_ViasMinDrill, + Millimeter2iu( DEFAULT_VIASMINDRILL ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), + nullptr, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinMicroViaDiameter" ), - &m_MicroViasMinSize, - Millimeter2iu( DEFAULT_MICROVIASMINSIZE ), Millimeter2iu( 0.01 ), Millimeter2iu( 10.0 ), - nullptr, MM_PER_IU ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinMicroViaDiameter" ), + &m_MicroViasMinSize, + Millimeter2iu( DEFAULT_MICROVIASMINSIZE ), Millimeter2iu( 0.01 ), Millimeter2iu( 10.0 ), + nullptr, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinMicroViaDrill" ), - &m_MicroViasMinDrill, - Millimeter2iu( DEFAULT_MICROVIASMINDRILL ), Millimeter2iu( 0.01 ), Millimeter2iu( 10.0 ), - nullptr, MM_PER_IU ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinMicroViaDrill" ), + &m_MicroViasMinDrill, + Millimeter2iu( DEFAULT_MICROVIASMINDRILL ), Millimeter2iu( 0.01 ), Millimeter2iu( 10.0 ), + nullptr, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinHoleToHole" ), - &m_HoleToHoleMin, - Millimeter2iu( DEFAULT_HOLETOHOLEMIN ), Millimeter2iu( 0.0 ), Millimeter2iu( 10.0 ), - nullptr, MM_PER_IU ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinHoleToHole" ), + &m_HoleToHoleMin, + Millimeter2iu( DEFAULT_HOLETOHOLEMIN ), Millimeter2iu( 0.0 ), Millimeter2iu( 10.0 ), + nullptr, MM_PER_IU ) ); - // Note: a clearance of -0.01 is a flag indicating we should use the legacy (pre-6.0) method - // based on the edge cut thicknesses. - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperEdgeClearance" ), - &m_CopperEdgeClearance, - Millimeter2iu( LEGACY_COPPEREDGECLEARANCE ), Millimeter2iu( -0.01 ), Millimeter2iu( 25.0 ), - nullptr, MM_PER_IU ) ); + // Note: a clearance of -0.01 is a flag indicating we should use the legacy (pre-6.0) method + // based on the edge cut thicknesses. + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperEdgeClearance" ), + &m_CopperEdgeClearance, + Millimeter2iu( LEGACY_COPPEREDGECLEARANCE ), Millimeter2iu( -0.01 ), Millimeter2iu( 25.0 ), + nullptr, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_TRACKWIDTHS( &m_TrackWidthList ) ); - aResult->push_back( new PARAM_CFG_VIADIMENSIONS( &m_ViasDimensionsList ) ); - aResult->push_back( new PARAM_CFG_DIFFPAIRDIMENSIONS( &m_DiffPairDimensionsList ) ); + aResult->push_back( new PARAM_CFG_TRACKWIDTHS( &m_TrackWidthList ) ); + aResult->push_back( new PARAM_CFG_VIADIMENSIONS( &m_ViasDimensionsList ) ); + aResult->push_back( new PARAM_CFG_DIFFPAIRDIMENSIONS( &m_DiffPairDimensionsList ) ); - aResult->push_back( new PARAM_CFG_NETCLASSES( wxT( "Netclasses" ), &m_NetClasses ) ); + aResult->push_back( new PARAM_CFG_NETCLASSES( wxT( "Netclasses" ), &m_NetClasses ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SilkLineWidth" ), - &m_LineThickness[ LAYER_CLASS_SILK ], - Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), - nullptr, MM_PER_IU, wxT( "ModuleOutlineThickness" ) ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SilkLineWidth" ), + &m_LineThickness[ LAYER_CLASS_SILK ], + Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), + nullptr, MM_PER_IU, wxT( "ModuleOutlineThickness" ) ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SilkTextSizeV" ), - &m_TextSize[ LAYER_CLASS_SILK ].y, - Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, - nullptr, MM_PER_IU, wxT( "ModuleTextSizeV" ) ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SilkTextSizeV" ), + &m_TextSize[ LAYER_CLASS_SILK ].y, + Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, + nullptr, MM_PER_IU, wxT( "ModuleTextSizeV" ) ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SilkTextSizeH" ), - &m_TextSize[ LAYER_CLASS_SILK ].x, - Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, - nullptr, MM_PER_IU, wxT( "ModuleTextSizeH" ) ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SilkTextSizeH" ), + &m_TextSize[ LAYER_CLASS_SILK ].x, + Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, + nullptr, MM_PER_IU, wxT( "ModuleTextSizeH" ) ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SilkTextSizeThickness" ), - &m_TextThickness[ LAYER_CLASS_SILK ], - Millimeter2iu( DEFAULT_SILK_TEXT_WIDTH ), 1, TEXTS_MAX_WIDTH, - nullptr, MM_PER_IU, wxT( "ModuleTextSizeThickness" ) ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SilkTextSizeThickness" ), + &m_TextThickness[ LAYER_CLASS_SILK ], + Millimeter2iu( DEFAULT_SILK_TEXT_WIDTH ), 1, TEXTS_MAX_WIDTH, + nullptr, MM_PER_IU, wxT( "ModuleTextSizeThickness" ) ) ); - aResult->push_back( new PARAM_CFG_BOOL( wxT( "SilkTextItalic" ), - &m_TextItalic[ LAYER_CLASS_SILK ], false ) ); + aResult->push_back( new PARAM_CFG_BOOL( wxT( "SilkTextItalic" ), + &m_TextItalic[ LAYER_CLASS_SILK ], false ) ); - aResult->push_back( new PARAM_CFG_BOOL( wxT( "SilkTextUpright" ), - &m_TextUpright[ LAYER_CLASS_SILK ], true ) ); + aResult->push_back( new PARAM_CFG_BOOL( wxT( "SilkTextUpright" ), + &m_TextUpright[ LAYER_CLASS_SILK ], true ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperLineWidth" ), - &m_LineThickness[ LAYER_CLASS_COPPER ], - Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), - nullptr, MM_PER_IU, wxT( "DrawSegmentWidth" ) ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperLineWidth" ), + &m_LineThickness[ LAYER_CLASS_COPPER ], + Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), + nullptr, MM_PER_IU, wxT( "DrawSegmentWidth" ) ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperTextSizeV" ), - &m_TextSize[ LAYER_CLASS_COPPER ].y, - Millimeter2iu( DEFAULT_COPPER_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, - nullptr, MM_PER_IU, wxT( "PcbTextSizeV" ) ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperTextSizeV" ), + &m_TextSize[ LAYER_CLASS_COPPER ].y, + Millimeter2iu( DEFAULT_COPPER_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, + nullptr, MM_PER_IU, wxT( "PcbTextSizeV" ) ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperTextSizeH" ), - &m_TextSize[ LAYER_CLASS_COPPER ].x, - Millimeter2iu( DEFAULT_COPPER_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, - nullptr, MM_PER_IU, wxT( "PcbTextSizeH" ) ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperTextSizeH" ), + &m_TextSize[ LAYER_CLASS_COPPER ].x, + Millimeter2iu( DEFAULT_COPPER_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, + nullptr, MM_PER_IU, wxT( "PcbTextSizeH" ) ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperTextThickness" ), - &m_TextThickness[ LAYER_CLASS_COPPER ], - Millimeter2iu( DEFAULT_COPPER_TEXT_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), - nullptr, MM_PER_IU, wxT( "PcbTextThickness" ) ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperTextThickness" ), + &m_TextThickness[ LAYER_CLASS_COPPER ], + Millimeter2iu( DEFAULT_COPPER_TEXT_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), + nullptr, MM_PER_IU, wxT( "PcbTextThickness" ) ) ); - aResult->push_back( new PARAM_CFG_BOOL( wxT( "CopperTextItalic" ), - &m_TextItalic[ LAYER_CLASS_COPPER ], false ) ); + aResult->push_back( new PARAM_CFG_BOOL( wxT( "CopperTextItalic" ), + &m_TextItalic[ LAYER_CLASS_COPPER ], false ) ); - aResult->push_back( new PARAM_CFG_BOOL( wxT( "CopperTextUpright" ), - &m_TextUpright[ LAYER_CLASS_COPPER ], true ) ); + aResult->push_back( new PARAM_CFG_BOOL( wxT( "CopperTextUpright" ), + &m_TextUpright[ LAYER_CLASS_COPPER ], true ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "EdgeCutLineWidth" ), - &m_LineThickness[ LAYER_CLASS_EDGES ], - Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), - nullptr, MM_PER_IU, wxT( "BoardOutlineThickness" ) ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "EdgeCutLineWidth" ), + &m_LineThickness[ LAYER_CLASS_EDGES ], + Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), + nullptr, MM_PER_IU, wxT( "BoardOutlineThickness" ) ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CourtyardLineWidth" ), - &m_LineThickness[ LAYER_CLASS_COURTYARD ], - Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), - nullptr, MM_PER_IU ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CourtyardLineWidth" ), + &m_LineThickness[ LAYER_CLASS_COURTYARD ], + Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), + nullptr, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "OthersLineWidth" ), - &m_LineThickness[ LAYER_CLASS_OTHERS ], - Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), - nullptr, MM_PER_IU, wxT( "ModuleOutlineThickness" ) ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "OthersLineWidth" ), + &m_LineThickness[ LAYER_CLASS_OTHERS ], + Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), + nullptr, MM_PER_IU, wxT( "ModuleOutlineThickness" ) ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "OthersTextSizeV" ), - &m_TextSize[ LAYER_CLASS_OTHERS ].x, - Millimeter2iu( DEFAULT_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, - nullptr, MM_PER_IU ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "OthersTextSizeV" ), + &m_TextSize[ LAYER_CLASS_OTHERS ].x, + Millimeter2iu( DEFAULT_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, + nullptr, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "OthersTextSizeH" ), - &m_TextSize[ LAYER_CLASS_OTHERS ].y, - Millimeter2iu( DEFAULT_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, - nullptr, MM_PER_IU ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "OthersTextSizeH" ), + &m_TextSize[ LAYER_CLASS_OTHERS ].y, + Millimeter2iu( DEFAULT_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, + nullptr, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "OthersTextSizeThickness" ), - &m_TextThickness[ LAYER_CLASS_OTHERS ], - Millimeter2iu( DEFAULT_TEXT_WIDTH ), 1, TEXTS_MAX_WIDTH, - nullptr, MM_PER_IU ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "OthersTextSizeThickness" ), + &m_TextThickness[ LAYER_CLASS_OTHERS ], + Millimeter2iu( DEFAULT_TEXT_WIDTH ), 1, TEXTS_MAX_WIDTH, + nullptr, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_BOOL( wxT( "OthersTextItalic" ), - &m_TextItalic[ LAYER_CLASS_OTHERS ], false ) ); + aResult->push_back( new PARAM_CFG_BOOL( wxT( "OthersTextItalic" ), + &m_TextItalic[ LAYER_CLASS_OTHERS ], false ) ); - aResult->push_back( new PARAM_CFG_BOOL( wxT( "OthersTextUpright" ), - &m_TextUpright[ LAYER_CLASS_OTHERS ], true ) ); + aResult->push_back( new PARAM_CFG_BOOL( wxT( "OthersTextUpright" ), + &m_TextUpright[ LAYER_CLASS_OTHERS ], true ) ); - aResult->push_back( new PARAM_CFG_INT( wxT( "DimensionUnits" ), - &m_DimensionUnits, 0, 0, 2 ) ); - aResult->push_back( new PARAM_CFG_INT( wxT( "DimensionPrecision" ), - &m_DimensionPrecision, 1, 0, 2 ) ); + aResult->push_back( new PARAM_CFG_INT( wxT( "DimensionUnits" ), + &m_DimensionUnits, 0, 0, 2 ) ); + aResult->push_back( new PARAM_CFG_INT( wxT( "DimensionPrecision" ), + &m_DimensionPrecision, 1, 0, 2 ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderMaskClearance" ), - &m_SolderMaskMargin, - Millimeter2iu( DEFAULT_SOLDERMASK_CLEARANCE ), Millimeter2iu( -1.0 ), Millimeter2iu( 1.0 ), - nullptr, MM_PER_IU ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderMaskClearance" ), + &m_SolderMaskMargin, + Millimeter2iu( DEFAULT_SOLDERMASK_CLEARANCE ), Millimeter2iu( -1.0 ), Millimeter2iu( 1.0 ), + nullptr, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderMaskMinWidth" ), - &m_SolderMaskMinWidth, - Millimeter2iu( DEFAULT_SOLDERMASK_MIN_WIDTH ), 0, Millimeter2iu( 1.0 ), - nullptr, MM_PER_IU ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderMaskMinWidth" ), + &m_SolderMaskMinWidth, + Millimeter2iu( DEFAULT_SOLDERMASK_MIN_WIDTH ), 0, Millimeter2iu( 1.0 ), + nullptr, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderPasteClearance" ), - &m_SolderPasteMargin, - Millimeter2iu( DEFAULT_SOLDERPASTE_CLEARANCE ), Millimeter2iu( -1.0 ), Millimeter2iu( 1.0 ), - nullptr, MM_PER_IU ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderPasteClearance" ), + &m_SolderPasteMargin, + Millimeter2iu( DEFAULT_SOLDERPASTE_CLEARANCE ), Millimeter2iu( -1.0 ), Millimeter2iu( 1.0 ), + nullptr, MM_PER_IU ) ); - aResult->push_back( new PARAM_CFG_DOUBLE( wxT( "SolderPasteRatio" ), - &m_SolderPasteMarginRatio, - DEFAULT_SOLDERPASTE_RATIO, -0.5, 1.0 ) ); + aResult->push_back( new PARAM_CFG_DOUBLE( wxT( "SolderPasteRatio" ), + &m_SolderPasteMarginRatio, + DEFAULT_SOLDERPASTE_RATIO, -0.5, 1.0 ) ); + } + catch( boost::bad_pointer& ) + { + // Out of memory? Ship's going down anyway.... + } } diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 995f769c2d..1a45a2ebb7 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -540,29 +540,36 @@ 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" ), - &m_Drill.x, - Millimeter2iu( 0.6 ), - Millimeter2iu( 0.1 ), Millimeter2iu( 10.0 ), - NULL, MM_PER_IU ) ); + try + { + aResult->push_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" ), - &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( "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" ), - &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( "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" ), - &m_Size.y, - Millimeter2iu( 1.4 ), - Millimeter2iu( 0.1 ), Millimeter2iu( 20.0 ), - NULL, MM_PER_IU ) ); + aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadSizeV" ), + &m_Size.y, + Millimeter2iu( 1.4 ), + Millimeter2iu( 0.1 ), Millimeter2iu( 20.0 ), + NULL, MM_PER_IU ) ); + } + catch( boost::bad_pointer& ) + { + // Out of memory? Ship's going down anyway.... + } } diff --git a/pcbnew/pcb_general_settings.cpp b/pcbnew/pcb_general_settings.cpp index af3b15d98e..cd302d8f90 100644 --- a/pcbnew/pcb_general_settings.cpp +++ b/pcbnew/pcb_general_settings.cpp @@ -34,30 +34,37 @@ PCB_GENERAL_SETTINGS::PCB_GENERAL_SETTINGS( FRAME_T aFrameType ) : m_frameType( aFrameType ), m_colorsSettings( aFrameType ) { - switch( m_frameType ) + try { - case FRAME_PCB_EDITOR: - 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( "MagneticGraphics", &m_MagneticGraphics, true ); - Add( "FlipLeftRight", &m_FlipLeftRight, false ); - break; + switch( m_frameType ) + { + case FRAME_PCB_EDITOR: + 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( "MagneticGraphics", &m_MagneticGraphics, true ); + Add( "FlipLeftRight", &m_FlipLeftRight, false ); + break; - case FRAME_FOOTPRINT_EDITOR: - m_params.push_back( new PARAM_CFG_BOOL( "FpEditorUse45DegreeGraphicSegments", - &m_Use45DegreeGraphicSegments, false, - nullptr, "Use45DegreeGraphicSegments" ) ); // legacy location - m_params.push_back( new PARAM_CFG_INT( "FpEditorMagneticPads", - reinterpret_cast( &m_MagneticPads ), - CAPTURE_CURSOR_IN_TRACK_TOOL, // default - NO_EFFECT, // min - CAPTURE_ALWAYS, // max - nullptr, "MagneticPads" ) ); // legacy location - break; + case FRAME_FOOTPRINT_EDITOR: + m_params.push_back( new PARAM_CFG_BOOL( "FpEditorUse45DegreeGraphicSegments", + &m_Use45DegreeGraphicSegments, false, + nullptr, "Use45DegreeGraphicSegments" ) ); // legacy location + m_params.push_back( new PARAM_CFG_INT( "FpEditorMagneticPads", + reinterpret_cast( &m_MagneticPads ), + CAPTURE_CURSOR_IN_TRACK_TOOL, // default + NO_EFFECT, // min + CAPTURE_ALWAYS, // max + nullptr, "MagneticPads" ) ); // legacy location + break; - default: - break; + default: + break; + } + } + catch( boost::bad_pointer& ) + { + // Out of memory? Ship's going down anyway.... } }