From 5863bc09375190cd4e46dbf95458bb99e38a6c4b Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 25 Nov 2021 12:16:42 +0000 Subject: [PATCH] Put Repair Schematic behind Advanced Config. --- common/advanced_config.cpp | 5 +++++ eeschema/menubar.cpp | 5 ++++- eeschema/tools/sch_editor_control.cpp | 14 +++++++------- include/advanced_config.h | 2 ++ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/common/advanced_config.cpp b/common/advanced_config.cpp index 862bc11e33..e1a6cca774 100644 --- a/common/advanced_config.cpp +++ b/common/advanced_config.cpp @@ -177,6 +177,8 @@ static const wxChar HideVersionFromTitle[] = wxT( "HideVersionFromTitle" ); static const wxChar TraceMasks[] = wxT( "TraceMasks" ); +static const wxChar ShowRepairSchematic[] = wxT( "ShowRepairSchematic" ); + } // namespace KEYS @@ -395,6 +397,9 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg ) configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::HideVersionFromTitle, &m_HideVersionFromTitle, false ) ); + configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ShowRepairSchematic, + &m_ShowRepairSchematic, false ) ); + // Special case for trace mask setting...we just grab them and set them immediately // Because we even use wxLogTrace inside of advanced config wxString traceMasks = ""; diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 9808a2cb28..3843f615e8 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -37,6 +37,7 @@ #include "eeschema_id.h" #include "sch_edit_frame.h" #include +#include void SCH_EDIT_FRAME::ReCreateMenuBar() @@ -252,7 +253,9 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() toolsMenu->AppendSeparator(); toolsMenu->Add( EE_ACTIONS::rescueSymbols ); toolsMenu->Add( EE_ACTIONS::remapSymbols ); - toolsMenu->Add( EE_ACTIONS::repairSchematic ); + + if( ADVANCED_CFG::GetCfg().m_ShowRepairSchematic ) + toolsMenu->Add( EE_ACTIONS::repairSchematic ); toolsMenu->AppendSeparator(); toolsMenu->Add( EE_ACTIONS::editSymbolFields ); diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index c702c95481..db1ee756f6 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -2191,11 +2191,11 @@ int SCH_EDITOR_CONTROL::RepairSchematic( const TOOL_EVENT& aEvent ) { SCH_SCREEN* screen = sheet.LastScreen(); - for( SCH_ITEM* aItem : screen->Items().OfType( SCH_SYMBOL_T ) ) + for( SCH_ITEM* item : screen->Items().OfType( SCH_SYMBOL_T ) ) { - processItem( aItem ); + processItem( item ); - for( SCH_PIN* pin : static_cast( aItem )->GetPins( &sheet ) ) + for( SCH_PIN* pin : static_cast( item )->GetPins( &sheet ) ) processItem( pin ); } } @@ -2204,14 +2204,14 @@ int SCH_EDITOR_CONTROL::RepairSchematic( const TOOL_EVENT& aEvent ) { SCH_SCREEN* screen = sheet.LastScreen(); - for( SCH_ITEM* aItem : screen->Items() ) + for( SCH_ITEM* item : screen->Items() ) { - processItem( aItem ); + processItem( item ); - aItem->RunOnChildren( + item->RunOnChildren( [&]( SCH_ITEM* aChild ) { - processItem( aItem ); + processItem( item ); } ); } } diff --git a/include/advanced_config.h b/include/advanced_config.h index d02b1d1631..cd8343ab78 100644 --- a/include/advanced_config.h +++ b/include/advanced_config.h @@ -195,6 +195,8 @@ public: */ bool m_HideVersionFromTitle; + bool m_ShowRepairSchematic; + private: ADVANCED_CFG();