Schematic: add automatic annotation toggle

This commit is contained in:
Mike Williams 2022-04-21 13:06:28 -04:00 committed by Seth Hillbrand
parent dabd42bbc4
commit 85516a4691
6 changed files with 29 additions and 0 deletions

View File

@ -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() ) );

View File

@ -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 );

View File

@ -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" ),

View File

@ -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;

View File

@ -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() );

View File

@ -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 );