diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 8ef34e1726..cd7e168845 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -474,6 +474,13 @@ void SCH_EDIT_FRAME::setupUIConditions() return cfg && cfg->m_Appearance.show_erc_exclusions; }; + auto showAnnotateAutomaticallyCond = + [this]( const SELECTION& ) + { + EESCHEMA_SETTINGS* cfg = eeconfig(); + return cfg && cfg->m_AnnotatePanel.automatic; + }; + auto remapSymbolsCondition = [&]( const SELECTION& aSel ) { @@ -496,6 +503,7 @@ void SCH_EDIT_FRAME::setupUIConditions() mgr->SetConditions( EE_ACTIONS::toggleERCErrors, CHECK( showERCErrorsCond ) ); mgr->SetConditions( EE_ACTIONS::toggleERCWarnings, CHECK( showERCWarningsCond ) ); mgr->SetConditions( EE_ACTIONS::toggleERCExclusions, CHECK( showERCExclusionsCond ) ); + mgr->SetConditions( EE_ACTIONS::toggleAnnotateAuto, CHECK( showAnnotateAutomaticallyCond ) ); mgr->SetConditions( ACTIONS::toggleBoundingBoxes, CHECK( cond.BoundingBoxes() ) ); diff --git a/eeschema/toolbars_sch_editor.cpp b/eeschema/toolbars_sch_editor.cpp index a0060cfcf5..062873d20e 100644 --- a/eeschema/toolbars_sch_editor.cpp +++ b/eeschema/toolbars_sch_editor.cpp @@ -204,6 +204,9 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar() m_optionsToolBar->Add( EE_ACTIONS::lineMode45, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( EE_ACTIONS::lineMode135, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->AddScaledSeparator( this ); + m_optionsToolBar->Add( EE_ACTIONS::toggleAnnotateAuto, ACTION_TOOLBAR::TOGGLE ); + if( ADVANCED_CFG::GetCfg().m_DrawBoundingBoxes ) m_optionsToolBar->Add( ACTIONS::toggleBoundingBoxes, ACTION_TOOLBAR::TOGGLE ); diff --git a/eeschema/tools/ee_actions.cpp b/eeschema/tools/ee_actions.cpp index 05c9b08629..0971db75c3 100644 --- a/eeschema/tools/ee_actions.cpp +++ b/eeschema/tools/ee_actions.cpp @@ -709,6 +709,11 @@ TOOL_ACTION EE_ACTIONS::lineModeNext( "eeschema.EditorControl.lineModeNext", _( "Line Mode for Wires and Buses" ), _( "Switch to next line mode" ), BITMAPS::unknown ); +TOOL_ACTION EE_ACTIONS::toggleAnnotateAuto( "eeschema.EditorControl.annotateAutomatically", + AS_GLOBAL, 0, "", + _( "Annotate Automatically" ), _( "Toggle automatic annotation of new parts symbols" ), + BITMAPS::auto_associate ); + TOOL_ACTION EE_ACTIONS::repairSchematic( "eeschema.EditorControl.repairSchematic", AS_GLOBAL, 0, "", _( "Repair Schematic" ), diff --git a/eeschema/tools/ee_actions.h b/eeschema/tools/ee_actions.h index 57c716253b..68f7f2ccef 100644 --- a/eeschema/tools/ee_actions.h +++ b/eeschema/tools/ee_actions.h @@ -227,6 +227,9 @@ public: static TOOL_ACTION lineMode135; static TOOL_ACTION lineModeNext; + // Annotation + static TOOL_ACTION toggleAnnotateAuto; + // SPICE static TOOL_ACTION runSimulation; static TOOL_ACTION simProbe; diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 441ed105c0..1631310d70 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -2268,6 +2268,14 @@ int SCH_EDITOR_CONTROL::SwitchSegmentPosture( const TOOL_EVENT& aEvent ) } +int SCH_EDITOR_CONTROL::ToggleAnnotateAuto( const TOOL_EVENT& aEvent ) +{ + EESCHEMA_SETTINGS* cfg = m_frame->eeconfig(); + cfg->m_AnnotatePanel.automatic = !cfg->m_AnnotatePanel.automatic; + return 0; +} + + int SCH_EDITOR_CONTROL::TogglePythonConsole( const TOOL_EVENT& aEvent ) { @@ -2447,6 +2455,7 @@ void SCH_EDITOR_CONTROL::setTransitions() Go( &SCH_EDITOR_CONTROL::ChangeLineMode, EE_ACTIONS::lineMode135.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::NextLineMode, EE_ACTIONS::lineModeNext.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::SwitchSegmentPosture, EE_ACTIONS::switchSegmentPosture.MakeEvent() ); + Go( &SCH_EDITOR_CONTROL::ToggleAnnotateAuto, EE_ACTIONS::toggleAnnotateAuto.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::TogglePythonConsole, EE_ACTIONS::showPythonConsole.MakeEvent() ); diff --git a/eeschema/tools/sch_editor_control.h b/eeschema/tools/sch_editor_control.h index f571f4063a..40bf50e31f 100644 --- a/eeschema/tools/sch_editor_control.h +++ b/eeschema/tools/sch_editor_control.h @@ -145,6 +145,7 @@ public: int ChangeLineMode( const TOOL_EVENT& aEvent ); int NextLineMode( const TOOL_EVENT& aEvent ); int SwitchSegmentPosture( const TOOL_EVENT& aEvent ); + int ToggleAnnotateAuto( const TOOL_EVENT& aEvent ); int TogglePythonConsole( const TOOL_EVENT& aEvent ); int RepairSchematic( const TOOL_EVENT& aEvent );