From 232b1c799fffe397a4d20527aa566cb2498c09e7 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Thu, 11 Apr 2019 00:17:07 -0400 Subject: [PATCH] Add a workaround for bus unfolding without real-time connectivity Fixes: lp:1822728 * https://bugs.launchpad.net/kicad/+bug/1822728 --- eeschema/bus-wire-junction.cpp | 3 ++- eeschema/onrightclick.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index fc43730583..e0abfde640 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -191,7 +191,8 @@ void SCH_EDIT_FRAME::BeginSegment( int type ) segment = (SCH_LINE*) GetScreen()->GetCurItem(); if( segment ) // a current item exists, but not necessary a currently edited item { - if( !segment->GetFlags() || ( segment->Type() != SCH_LINE_T ) ) + if( !segment->GetFlags() || ( segment->Type() != SCH_LINE_T ) || + ( segment->GetLayer() != type ) ) { if( segment->GetFlags() ) wxLogDebug( wxT( "BeginSegment: item->GetFlags()== %X" ), segment->GetFlags() ); diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index 4c40f8f1bb..29199c5e97 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -765,6 +765,17 @@ void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame ) AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), KiBitmap( break_bus_xpm ) ); + // TODO(JE) remove once real-time is enabled + #ifndef CONNECTIVITY_REAL_TIME + frame->RecalculateConnections(); + + // Have to pick up the pointer again because it may have been changed by SchematicCleanUp + bool actionCancelled = false; + Bus = dynamic_cast( frame->LocateAndShowItem( pos, SCH_COLLECTOR::AllItemsButPins, + 0, &actionCancelled ) ); + wxASSERT( Bus ); + #endif + // Bus unfolding menu (only available if bus is properly defined) auto connection = Bus->Connection( *g_CurrentSheet );