Commit 4a9dffc3 authored by charras's avatar charras

Fixed in Eeschema a bug that crashed Eeschema after a break wire command

parent cfdb2839
......@@ -134,8 +134,7 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
* ( excluding ends)
* fill aPicklist with modified items if non null
*/
void BreakSegment(SCH_SCREEN * aScreen, wxPoint aBreakpoint,
PICKED_ITEMS_LIST * aPicklist)
void BreakSegment(SCH_SCREEN * aScreen, wxPoint aBreakpoint )
{
EDA_DrawLineStruct* segment, * NewSegment;
for( SCH_ITEM* DrawList = aScreen->EEDrawList;DrawList; DrawList = DrawList->Next() )
......@@ -153,23 +152,12 @@ void BreakSegment(SCH_SCREEN * aScreen, wxPoint aBreakpoint,
if( (segment->m_Start == aBreakpoint) || (segment->m_End == aBreakpoint ) )
continue;
/* Ici il faut couper le segment en 2 */
if( aPicklist ) // First: put copy of the old segment in undo list
{
ITEM_PICKER picker((SCH_ITEM*) segment->GenCopy(), UR_CHANGED);
picker.m_Link = segment;
aPicklist->PushItem(picker);
}
NewSegment = segment->GenCopy();
NewSegment->m_Start = aBreakpoint;
segment->m_End = NewSegment->m_Start;
NewSegment->SetNext( segment->Next() );
segment->SetNext( NewSegment );
DrawList = NewSegment;
if( aPicklist )
{
ITEM_PICKER picker(NewSegment, UR_NEW);
aPicklist->PushItem(picker);
}
}
}
......
......@@ -342,10 +342,8 @@ void BreakSegmentOnJunction( SCH_SCREEN * Screen );
/* Break a segment ( BUS, WIRE ) int 2 segments at location aBreakpoint,
* if aBreakpoint in on segment segment
* ( excluding ends)
* fill aPicklist with modified items if non null
*/
void BreakSegment(SCH_SCREEN * aScreen, wxPoint aBreakpoint,
PICKED_ITEMS_LIST * aPicklist = NULL);
void BreakSegment(SCH_SCREEN * aScreen, wxPoint aBreakpoint );
/**************/
/* EECLASS.CPP */
......
......@@ -338,10 +338,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_BREAK_WIRE:
{
DrawPanel->MouseToCursorSchema();
PICKED_ITEMS_LIST picklistForUndo;
BreakSegment( screen, screen->m_Curseur, &picklistForUndo );
if( picklistForUndo.GetCount() )
SaveCopyInUndoList( picklistForUndo, UR_UNSPECIFIED );
SCH_ITEM* oldWiresList = screen->ExtractWires( true );
BreakSegment( screen, screen->m_Curseur );
if( oldWiresList )
SaveCopyInUndoList( oldWiresList, UR_WIRE_IMAGE );
TestDanglingEnds( screen->EEDrawList, &dc );
}
break;
......
No preview for this file type
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment