From f2cf9340839175519740750ee371fe8418ab14f2 Mon Sep 17 00:00:00 2001 From: Mike Williams Date: Thu, 26 May 2022 20:31:28 -0400 Subject: [PATCH] Schematic: Annotation Tweaks Fix newly placed symbols to be annotated and not show a ? until placement. --- eeschema/tools/sch_drawing_tools.cpp | 32 +++++++++++++++++----------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index e241dd55e5..cdd1c88dd4 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -158,6 +158,23 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent ) symbol = nullptr; }; + auto annotate = + [&] () + { + EESCHEMA_SETTINGS::PANEL_ANNOTATE& annotate = m_frame->eeconfig()->m_AnnotatePanel; + SCHEMATIC_SETTINGS& projSettings = m_frame->Schematic().Settings(); + int annotateStartNum = projSettings.m_AnnotateStartNum; + + if( annotate.automatic ) + { + NULL_REPORTER reporter; + m_frame->AnnotateSymbols( ANNOTATE_SELECTION, + (ANNOTATE_ORDER_T) annotate.sort_order, + (ANNOTATE_ALGO_T) annotate.method, annotate.recursive, + annotateStartNum, false, false, reporter, true ); + } + }; + Activate(); // Must be done after Activate() so that it gets set into the correct context getViewControls()->ShowCursor( true ); @@ -263,25 +280,13 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent ) symbol = new SCH_SYMBOL( *libSymbol, &m_frame->GetCurrentSheet(), sel, cursorPos ); addSymbol( symbol ); + annotate(); // Update cursor now that we have a symbol setCursor(); } else { - EESCHEMA_SETTINGS::PANEL_ANNOTATE& annotate = m_frame->eeconfig()->m_AnnotatePanel; - SCHEMATIC_SETTINGS& projSettings = m_frame->Schematic().Settings(); - int annotateStartNum = projSettings.m_AnnotateStartNum; - - if( annotate.automatic ) - { - NULL_REPORTER reporter; - m_frame->AnnotateSymbols( ANNOTATE_SELECTION, - (ANNOTATE_ORDER_T) annotate.sort_order, - (ANNOTATE_ALGO_T) annotate.method, annotate.recursive, - annotateStartNum, false, false, reporter, true ); - } - if( m_frame->eeconfig()->m_AutoplaceFields.enable ) symbol->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false ); @@ -325,6 +330,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent ) nextSymbol->ClearAnnotation( nullptr, false ); addSymbol( nextSymbol ); + annotate(); } }