Adjust net highlighting after edits.

Fixes: lp:1800291
* https://bugs.launchpad.net/kicad/+bug/1800291
This commit is contained in:
Jeff Young 2019-05-12 18:03:17 +01:00
parent 51bfec8ef9
commit 25209516a6
9 changed files with 15 additions and 15 deletions

View File

@ -434,6 +434,8 @@ SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( const wxPoint& aPos, bool aUndoAppend
if( aFinal )
{
m_toolManager->PostEvent( EVENTS::SelectedItemsModified );
TestDanglingEnds();
OnModify();

View File

@ -82,7 +82,7 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
SetStatusText( _( "Selected net: " ) + UnescapeString( m_SelectedNetName ) );
GetToolManager()->RunAction( EE_ACTIONS::highlightNetSelection, true );
GetToolManager()->RunAction( EE_ACTIONS::updateNetHighlighting, true );
}
return;

View File

@ -286,6 +286,6 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
UpdateTitle();
GetToolManager()->RunAction( EE_ACTIONS::highlightNetSelection, true );
GetToolManager()->RunAction( EE_ACTIONS::updateNetHighlighting, true );
HardRedraw(); // Ensure any item has its view updated, especially the worksheet items
}

View File

@ -1270,7 +1270,7 @@ void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_ITEM* aItem, bool aUndoAppe
TrimWire( *i, *j );
if( screen->IsJunctionNeeded( *i, true ) )
AddJunction( *i, true );
AddJunction( *i, true, false );
}
TestDanglingEnds();

View File

@ -177,7 +177,7 @@ public:
// Net highlighting
static TOOL_ACTION highlightNet;
static TOOL_ACTION clearHighlight;
static TOOL_ACTION highlightNetSelection;
static TOOL_ACTION updateNetHighlighting;
static TOOL_ACTION highlightNetCursor;
///> @copydoc COMMON_ACTIONS::TranslateLegacyId()

View File

@ -67,7 +67,7 @@ TOOL_ACTION EE_ACTIONS::highlightNet( "eeschema.EditorControl.highlightNet",
TOOL_ACTION EE_ACTIONS::clearHighlight( "eeschema.EditorControl.clearHighlight",
AS_GLOBAL, 0, "", "" );
TOOL_ACTION EE_ACTIONS::highlightNetSelection( "eeschema.EditorControl.highlightNetSelection",
TOOL_ACTION EE_ACTIONS::updateNetHighlighting( "eeschema.EditorControl.updateNetHighlighting",
AS_GLOBAL, 0, "", "" );
TOOL_ACTION EE_ACTIONS::highlightNetCursor( "eeschema.EditorControl.highlightNetCursor",
@ -334,7 +334,7 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
editFrame->SetSelectedNetName( netName );
TOOL_EVENT dummy;
editorControl->HighlightNetSelection( dummy );
editorControl->UpdateNetHighlighting( dummy );
return retVal;
}
@ -359,7 +359,7 @@ int SCH_EDITOR_CONTROL::ClearHighlight( const TOOL_EVENT& aEvent )
}
int SCH_EDITOR_CONTROL::HighlightNetSelection( const TOOL_EVENT& aEvent )
int SCH_EDITOR_CONTROL::UpdateNetHighlighting( const TOOL_EVENT& aEvent )
{
SCH_SCREEN* screen = g_CurrentSheet->LastScreen();
std::vector<EDA_ITEM*> itemsToRedraw;
@ -710,7 +710,8 @@ void SCH_EDITOR_CONTROL::setTransitions()
Go( &SCH_EDITOR_CONTROL::HighlightNet, EE_ACTIONS::highlightNet.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ClearHighlight, EE_ACTIONS::clearHighlight.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::HighlightNetCursor, EE_ACTIONS::highlightNetCursor.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::HighlightNetSelection, EE_ACTIONS::highlightNetSelection.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::UpdateNetHighlighting, EVENTS::SelectedItemsModified );
Go( &SCH_EDITOR_CONTROL::UpdateNetHighlighting, EE_ACTIONS::updateNetHighlighting.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Cut, EE_ACTIONS::cut.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Copy, EE_ACTIONS::copy.MakeEvent() );

View File

@ -63,8 +63,8 @@ public:
///> Removes any net highlighting
int ClearHighlight( const TOOL_EVENT& aEvent );
///> Highlights frame's SelectedNetName.
int HighlightNetSelection( const TOOL_EVENT& aEvent );
///> Updates net highlighting after an edit
int UpdateNetHighlighting( const TOOL_EVENT& aEvent );
///> Launches a tool to highlight nets.
int HighlightNetCursor( const TOOL_EVENT& aEvent );

View File

@ -566,7 +566,7 @@ void SCH_MOVE_TOOL::addJunctionsIfNeeded( SELECTION& aSelection )
for( auto point : pts )
{
if( m_frame->GetScreen()->IsJunctionNeeded( point, true ) )
m_frame->AddJunction( point, true );
m_frame->AddJunction( point, true, false );
}
}

View File

@ -202,10 +202,6 @@ bool SCH_WIRE_BUS_TOOL::Init()
{
EE_TOOL_BASE::Init();
auto activeTool = [ this ] ( const SELECTION& aSel ) {
return ( m_frame->GetToolId() != ID_NO_TOOL_SELECTED );
};
auto wireOrBusTool = [ this ] ( const SELECTION& aSel ) {
return ( m_frame->GetToolId() == ID_WIRE_BUTT || m_frame->GetToolId() == ID_BUS_BUTT );
};
@ -977,6 +973,7 @@ void SCH_WIRE_BUS_TOOL::finishSegments()
m_busUnfold = {};
m_frame->TestDanglingEnds();
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->OnModify();
}