From b81b7decf674aad4b80f0a562a2e87249d88943a Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 17 Oct 2019 07:31:08 -0700 Subject: [PATCH] eeschema: Add junction when breaking overlapping wires This is the v5 version of 363281dd4. Fixes: lp:1848450 * https://bugs.launchpad.net/kicad/+bug/1848450 --- eeschema/onrightclick.cpp | 13 +------------ eeschema/schedit.cpp | 5 ++++- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index b09c9f0527..90c227438d 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -684,10 +684,6 @@ void SCH_EDIT_FRAME::addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunct { if( m_collectedItems.IsDraggableJunction() ) AddMenuItem( aMenu, ID_SCH_DRAG_ITEM, _( "Drag Junction" ), KiBitmap( drag_xpm ) ); - - if( screen->GetWire( aJunction->GetPosition(), EXCLUDE_END_POINTS_T ) ) - AddMenuItem( aMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), - KiBitmap( break_line_xpm ) ); } if( screen->GetWireOrBus( aJunction->GetPosition() ) ) @@ -702,7 +698,6 @@ void SCH_EDIT_FRAME::addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunct void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame ) { - SCH_SCREEN* screen = frame->GetScreen(); wxPoint pos = frame->GetCrossHairPosition(); wxString msg; @@ -729,12 +724,7 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame ) KiBitmap( delete_node_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ), KiBitmap( delete_connection_xpm ) ); - - SCH_LINE* line = screen->GetWireOrBus( frame->GetCrossHairPosition() ); - - if( line && !line->IsEndPoint( frame->GetCrossHairPosition() ) ) - AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), - KiBitmap( break_line_xpm ) ); + AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), KiBitmap( break_line_xpm ) ); PopMenu->AppendSeparator(); @@ -771,7 +761,6 @@ void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame ) msg = AddHotkeyName( _( "Delete Bus" ), g_Schematic_Hotkeys_Descr, HK_DELETE ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_bus_xpm ) ); - AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), KiBitmap( break_bus_xpm ) ); PopMenu->AppendSeparator(); diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index 05d3ca6b1a..6deb06e572 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -203,7 +203,10 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_BREAK_WIRE: SaveWireImage(); m_canvas->MoveCursorToCrossHair(); - BreakSegments( GetCrossHairPosition() ); + + if( BreakSegments( GetCrossHairPosition() ) && + screen->IsJunctionNeeded( GetCrossHairPosition(), true ) ) + AddJunction( GetCrossHairPosition(), true ); TestDanglingEnds(); m_canvas->Refresh();