Clear pin net-name-driving cache when changing annotation.

Also update connectivity after clear annotation, annotate or back
annotate.

Also update status bar for highlighted nets.

Fixes https://gitlab.com/kicad/code/kicad/issues/5170
This commit is contained in:
Jeff Young 2020-08-13 22:30:30 +01:00
parent 8c94d88c78
commit 2b0b7a5153
12 changed files with 60 additions and 4 deletions

View File

@ -230,7 +230,7 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
std::vector<PARAM_CFG*> configParams;
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::RealtimeConnectivity,
&m_realTimeConnectivity, false ) );
&m_realTimeConnectivity, true ) );
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::ExtraFillMargin,
&m_extraClearance, 0.002, 0.0, 1.0 ) );

View File

@ -94,6 +94,9 @@ void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly, bool* aAppendUndo
SyncView();
GetCanvas()->Refresh();
OnModify();
// Must go after OnModify() so the connectivity graph has been updated
UpdateNetHighlightStatus();
}
@ -255,6 +258,9 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
SyncView();
GetCanvas()->Refresh();
OnModify();
// Must go after OnModify() so the connectivity graph has been updated
UpdateNetHighlightStatus();
}

View File

@ -37,6 +37,8 @@
#include <sch_edit_frame.h>
#include <sch_reference_list.h>
#include <schematic.h>
#include <tool/tool_manager.h>
#include <tool/actions.h>
#ifdef KICAD_SPICE
#include <dialog_spice_model.h>
@ -535,6 +537,9 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
GetParent()->UpdateItem( m_cmp );
GetParent()->OnModify();
// This must go after OnModify() so that the connectivity graph will have been updated.
GetParent()->GetToolManager()->PostEvent( EVENTS::SelectedItemsModified );
return true;
}

View File

@ -483,6 +483,9 @@ void SCH_COMPONENT::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref )
if( notInArray )
AddHierarchicalReference( path, ref, m_unit );
for( std::unique_ptr<SCH_PIN>& pin : m_pins )
pin->ClearDefaultNetName( sheet );
SCH_FIELD* rf = GetField( REFERENCE );
// @todo Should we really be checking for what is a "reasonable" position?
@ -871,6 +874,9 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
instance.m_Reference = defRef;
}
for( std::unique_ptr<SCH_PIN>& pin : m_pins )
pin->ClearDefaultNetName( aSheetPath );
// These 2 changes do not work in complex hierarchy.
// When a clear annotation is made, the calling function must call a
// UpdateAllScreenReferences for the active sheet.

View File

@ -1085,6 +1085,20 @@ void SCH_EDIT_FRAME::ShowChangedLanguage()
}
void SCH_EDIT_FRAME::UpdateNetHighlightStatus()
{
if( const SCH_CONNECTION* conn = GetHighlightedConnection() )
{
SetStatusText( wxString::Format( _( "Highlighted net: %s" ),
UnescapeString( conn->Name() ) ) );
}
else
{
SetStatusText( wxT( "" ) );
}
}
void SCH_EDIT_FRAME::SetScreen( BASE_SCREEN* aScreen )
{
SCH_BASE_FRAME::SetScreen( aScreen );

View File

@ -939,6 +939,8 @@ public:
*/
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
void UpdateNetHighlightStatus();
void ShowChangedLanguage() override;
void SyncToolbars() override;

View File

@ -98,6 +98,17 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
}
void SCH_PIN::ClearDefaultNetName( const SCH_SHEET_PATH* aPath )
{
std::lock_guard<std::mutex> lock( m_netmap_mutex );
if( aPath )
m_net_name_map.erase( *aPath );
else
m_net_name_map.clear();
}
wxString SCH_PIN::GetDefaultNetName( const SCH_SHEET_PATH aPath )
{
if( m_libPin->IsPowerConnection() )

View File

@ -64,6 +64,7 @@ public:
LIB_PIN* GetLibPin() const { return m_libPin; }
void ClearDefaultNetName( const SCH_SHEET_PATH* aPath );
wxString GetDefaultNetName( const SCH_SHEET_PATH aPath );
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;

View File

@ -468,6 +468,12 @@ void BACK_ANNOTATE::applyChangelist()
}
}
if( !m_dryRun )
{
m_frame->RecalculateConnections( NO_CLEANUP );
m_frame->UpdateNetHighlightStatus();
}
m_reporter.ReportHead( msg, RPT_SEVERITY_INFO );
}

View File

@ -310,6 +310,9 @@ int EE_INSPECTION_TOOL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
m_frame->ClearMsgPanel();
}
if( SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
editFrame->UpdateNetHighlightStatus();
return 0;
}

View File

@ -1141,9 +1141,11 @@ void SCH_EDIT_TOOL::editFieldText( SCH_FIELD* aField )
if( m_frame->eeconfig()->m_AutoplaceFields.enable || aField->GetParent()->Type() == SCH_SHEET_T )
static_cast<SCH_ITEM*>( aField->GetParent() )->AutoAutoplaceFields( m_frame->GetScreen() );
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->UpdateItem( aField );
m_frame->OnModify();
// This must go after OnModify() so that the connectivity graph will have been updated.
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
}

View File

@ -870,11 +870,11 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
else
{
editFrame->SetCrossProbeConnection( conn );
editFrame->SetStatusText( wxString::Format( _( "Highlighted net: %s" ),
UnescapeString( conn->Name() ) ) );
}
editFrame->SetHighlightedConnection( conn );
editFrame->UpdateNetHighlightStatus();
TOOL_EVENT dummy;
editorControl->UpdateNetHighlighting( dummy );