Refresh item when its dangling state changes.
Fixes: lp:1797996 * https://bugs.launchpad.net/kicad/+bug/1797996
This commit is contained in:
parent
ecd893c4b1
commit
1114b5cfa9
|
@ -168,13 +168,13 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
||||||
CheckListConnections( block->GetItems(), true );
|
CheckListConnections( block->GetItems(), true );
|
||||||
block->ClearItemsList();
|
block->ClearItemsList();
|
||||||
SchematicCleanUp( true );
|
SchematicCleanUp( true );
|
||||||
|
TestDanglingEnds();
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
||||||
// clear dome flags and pointers
|
// clear dome flags and pointers
|
||||||
GetScreen()->ClearDrawingState();
|
GetScreen()->ClearDrawingState();
|
||||||
GetScreen()->ClearBlockCommand();
|
GetScreen()->ClearBlockCommand();
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem( NULL );
|
||||||
GetScreen()->TestDanglingEnds();
|
|
||||||
|
|
||||||
if( block->GetCount() )
|
if( block->GetCount() )
|
||||||
{
|
{
|
||||||
|
@ -294,7 +294,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
|
||||||
append = true;
|
append = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->TestDanglingEnds();
|
TestDanglingEnds();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_COPY: // Save a copy of items in paste buffer
|
case BLOCK_COPY: // Save a copy of items in paste buffer
|
||||||
|
|
|
@ -268,6 +268,27 @@ void SCH_EDIT_FRAME::GetSchematicConnections( std::vector< wxPoint >& aConnectio
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SCH_EDIT_FRAME::TestDanglingEnds()
|
||||||
|
{
|
||||||
|
std::vector<DANGLING_END_ITEM> endPoints;
|
||||||
|
bool hasStateChanged = false;
|
||||||
|
|
||||||
|
for( SCH_ITEM* item = GetScreen()->GetDrawList().begin(); item; item = item->Next() )
|
||||||
|
item->GetEndPoints( endPoints );
|
||||||
|
|
||||||
|
for( SCH_ITEM* item = GetScreen()->GetDrawList().begin(); item; item = item->Next() )
|
||||||
|
{
|
||||||
|
if( item->IsDanglingStateChanged( endPoints ) )
|
||||||
|
{
|
||||||
|
GetCanvas()->GetView()->Update( item, KIGFX::REPAINT );
|
||||||
|
hasStateChanged = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hasStateChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::EndSegment()
|
void SCH_EDIT_FRAME::EndSegment()
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
|
@ -349,10 +370,11 @@ void SCH_EDIT_FRAME::EndSegment()
|
||||||
AddJunction( i, true );
|
AddJunction( i, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->TestDanglingEnds();
|
TestDanglingEnds();
|
||||||
screen->ClearDrawingState();
|
screen->ClearDrawingState();
|
||||||
screen->SetCurItem( NULL );
|
screen->SetCurItem( NULL );
|
||||||
m_canvas->EndMouseCapture( -1, -1, wxEmptyString, false );
|
m_canvas->EndMouseCapture( -1, -1, wxEmptyString, false );
|
||||||
|
m_canvas->Refresh();
|
||||||
OnModify();
|
OnModify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,7 +656,7 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( bool aAppend )
|
||||||
|
|
||||||
SaveCopyInUndoList( itemList, UR_CHANGED, aAppend );
|
SaveCopyInUndoList( itemList, UR_CHANGED, aAppend );
|
||||||
|
|
||||||
return !!( itemList.GetCount() );
|
return itemList.GetCount() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -778,7 +800,7 @@ SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( const wxPoint& aPosition, bool aAppen
|
||||||
|
|
||||||
AddToScreen( junction );
|
AddToScreen( junction );
|
||||||
broken_segments = BreakSegments( aPosition, aAppend );
|
broken_segments = BreakSegments( aPosition, aAppend );
|
||||||
screen->TestDanglingEnds();
|
TestDanglingEnds();
|
||||||
OnModify();
|
OnModify();
|
||||||
SaveCopyInUndoList( junction, UR_NEW, broken_segments || aAppend );
|
SaveCopyInUndoList( junction, UR_NEW, broken_segments || aAppend );
|
||||||
|
|
||||||
|
@ -798,7 +820,7 @@ SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( const wxPoint& aPosition )
|
||||||
SetRepeatItem( no_connect );
|
SetRepeatItem( no_connect );
|
||||||
AddToScreen( no_connect );
|
AddToScreen( no_connect );
|
||||||
SchematicCleanUp();
|
SchematicCleanUp();
|
||||||
GetScreen()->TestDanglingEnds();
|
TestDanglingEnds();
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
||||||
auto view = GetCanvas()->GetView();
|
auto view = GetCanvas()->GetView();
|
||||||
|
@ -870,7 +892,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem()
|
||||||
AddToScreen( my_clone );
|
AddToScreen( my_clone );
|
||||||
|
|
||||||
if( my_clone->IsConnectable() )
|
if( my_clone->IsConnectable() )
|
||||||
GetScreen()->TestDanglingEnds();
|
TestDanglingEnds();
|
||||||
|
|
||||||
SaveCopyInUndoList( my_clone, UR_NEW );
|
SaveCopyInUndoList( my_clone, UR_NEW );
|
||||||
my_clone->ClearFlags();
|
my_clone->ClearFlags();
|
||||||
|
@ -879,3 +901,5 @@ void SCH_EDIT_FRAME::RepeatDrawItem()
|
||||||
// clone my_clone, now that it has been moved, thus saving new position.
|
// clone my_clone, now that it has been moved, thus saving new position.
|
||||||
SetRepeatItem( my_clone );
|
SetRepeatItem( my_clone );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY_BASE* BusEntry, c
|
||||||
s_LastShape = entry_shape == '/' ? '/' : '\\';
|
s_LastShape = entry_shape == '/' ? '/' : '\\';
|
||||||
|
|
||||||
BusEntry->SetBusEntryShape( s_LastShape );
|
BusEntry->SetBusEntryShape( s_LastShape );
|
||||||
GetScreen()->TestDanglingEnds();
|
TestDanglingEnds();
|
||||||
|
|
||||||
OnModify( );
|
OnModify( );
|
||||||
}
|
}
|
||||||
|
|
|
@ -534,7 +534,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
|
||||||
m_cmp->UpdatePinCache();
|
m_cmp->UpdatePinCache();
|
||||||
|
|
||||||
GetParent()->OnModify();
|
GetParent()->OnModify();
|
||||||
GetParent()->GetScreen()->TestDanglingEnds();
|
GetParent()->TestDanglingEnds();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,7 +317,7 @@ void SCH_EDIT_FRAME::OrientComponent( COMPONENT_ORIENTATION_T aOrientation )
|
||||||
SchematicCleanUp( true );
|
SchematicCleanUp( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->TestDanglingEnds();
|
TestDanglingEnds();
|
||||||
|
|
||||||
RefreshItem( item );
|
RefreshItem( item );
|
||||||
OnModify();
|
OnModify();
|
||||||
|
@ -361,7 +361,7 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent )
|
||||||
if( m_autoplaceFields )
|
if( m_autoplaceFields )
|
||||||
component->AutoAutoplaceFields( GetScreen() );
|
component->AutoAutoplaceFields( GetScreen() );
|
||||||
|
|
||||||
screen->TestDanglingEnds();
|
TestDanglingEnds();
|
||||||
|
|
||||||
RefreshItem( component );
|
RefreshItem( component );
|
||||||
OnModify();
|
OnModify();
|
||||||
|
@ -403,7 +403,7 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* aComponent )
|
||||||
|
|
||||||
// The alternate symbol may cause a change in the connection status so test the
|
// The alternate symbol may cause a change in the connection status so test the
|
||||||
// connections so the connection indicators are drawn correctly.
|
// connections so the connection indicators are drawn correctly.
|
||||||
GetScreen()->TestDanglingEnds();
|
TestDanglingEnds();
|
||||||
aComponent->ClearFlags();
|
aComponent->ClearFlags();
|
||||||
aComponent->SetFlags( flags ); // Restore m_Flag (modified by SetConvert())
|
aComponent->SetFlags( flags ); // Restore m_Flag (modified by SetConvert())
|
||||||
|
|
||||||
|
|
|
@ -1332,7 +1332,7 @@ bool SCH_EDIT_FRAME::isAutoSaveRequired() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::addCurrentItemToScreen( bool aRedraw )
|
void SCH_EDIT_FRAME::addCurrentItemToScreen()
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
SCH_ITEM* item = screen->GetCurItem();
|
SCH_ITEM* item = screen->GetCurItem();
|
||||||
|
@ -1447,10 +1447,9 @@ void SCH_EDIT_FRAME::addCurrentItemToScreen( bool aRedraw )
|
||||||
if( screen->IsJunctionNeeded( *i, true ) )
|
if( screen->IsJunctionNeeded( *i, true ) )
|
||||||
AddJunction( *i, true );
|
AddJunction( *i, true );
|
||||||
}
|
}
|
||||||
screen->TestDanglingEnds();
|
TestDanglingEnds();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aRedraw )
|
|
||||||
GetCanvas()->Refresh();
|
GetCanvas()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -191,10 +191,8 @@ protected:
|
||||||
/**
|
/**
|
||||||
* Add the item currently being edited to the schematic and adds the changes to
|
* Add the item currently being edited to the schematic and adds the changes to
|
||||||
* the undo/redo container.
|
* the undo/redo container.
|
||||||
*
|
|
||||||
* @param aRedraw = true (default) to redrw -the screen after adding the item.
|
|
||||||
*/
|
*/
|
||||||
void addCurrentItemToScreen( bool aRedraw = true );
|
void addCurrentItemToScreen();
|
||||||
|
|
||||||
void updateFindReplaceView( wxFindDialogEvent& aEvent );
|
void updateFindReplaceView( wxFindDialogEvent& aEvent );
|
||||||
|
|
||||||
|
@ -473,6 +471,12 @@ public:
|
||||||
*/
|
*/
|
||||||
bool BreakSegmentsOnJunctions( bool aApped = false );
|
bool BreakSegmentsOnJunctions( bool aApped = false );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test all of the connectable objects in the schematic for unused connection points.
|
||||||
|
* @return True if any connection state changes were made.
|
||||||
|
*/
|
||||||
|
bool TestDanglingEnds();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message to Pcbnew via a socket connection.
|
* Send a message to Pcbnew via a socket connection.
|
||||||
*
|
*
|
||||||
|
|
|
@ -197,19 +197,19 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
screen->SetCurItem( NULL );
|
screen->SetCurItem( NULL );
|
||||||
SetRepeatItem( NULL );
|
SetRepeatItem( NULL );
|
||||||
|
|
||||||
screen->TestDanglingEnds();
|
TestDanglingEnds();
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_BREAK_WIRE:
|
case ID_POPUP_SCH_BREAK_WIRE:
|
||||||
{
|
|
||||||
SaveWireImage();
|
SaveWireImage();
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
BreakSegments( GetCrossHairPosition() );
|
BreakSegments( GetCrossHairPosition() );
|
||||||
if( screen->TestDanglingEnds() )
|
|
||||||
|
TestDanglingEnds();
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_DELETE_CMP:
|
case ID_POPUP_SCH_DELETE_CMP:
|
||||||
|
@ -221,7 +221,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
SchematicCleanUp( true );
|
SchematicCleanUp( true );
|
||||||
screen->SetCurItem( NULL );
|
screen->SetCurItem( NULL );
|
||||||
SetRepeatItem( NULL );
|
SetRepeatItem( NULL );
|
||||||
screen->TestDanglingEnds();
|
TestDanglingEnds();
|
||||||
SetSheetNumberAndCount();
|
SetSheetNumberAndCount();
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
OnModify();
|
OnModify();
|
||||||
|
@ -235,7 +235,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
case ID_POPUP_SCH_RESIZE_SHEET:
|
case ID_POPUP_SCH_RESIZE_SHEET:
|
||||||
ReSizeSheet( (SCH_SHEET*) item, nullptr );
|
ReSizeSheet( (SCH_SHEET*) item, nullptr );
|
||||||
|
|
||||||
if( screen->TestDanglingEnds() )
|
TestDanglingEnds();
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -347,7 +347,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
screen->SetCurItem( AddJunction( GetCrossHairPosition() ) );
|
screen->SetCurItem( AddJunction( GetCrossHairPosition() ) );
|
||||||
|
|
||||||
if( screen->TestDanglingEnds() )
|
TestDanglingEnds();
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
|
|
||||||
screen->SetCurItem( NULL );
|
screen->SetCurItem( NULL );
|
||||||
|
@ -662,7 +662,7 @@ bool SCH_EDIT_FRAME::DeleteItemAtCrossHair()
|
||||||
DeleteItem( item );
|
DeleteItem( item );
|
||||||
|
|
||||||
if( itemHasConnections )
|
if( itemHasConnections )
|
||||||
screen->TestDanglingEnds();
|
TestDanglingEnds();
|
||||||
|
|
||||||
GetCanvas()->Refresh();
|
GetCanvas()->Refresh();
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
|
@ -407,7 +407,7 @@ void SCH_EDIT_FRAME::GetSchematicFromUndoList( wxCommandEvent& event )
|
||||||
OnModify();
|
OnModify();
|
||||||
SetSheetNumberAndCount();
|
SetSheetNumberAndCount();
|
||||||
|
|
||||||
GetScreen()->TestDanglingEnds();
|
TestDanglingEnds();
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,6 +430,6 @@ void SCH_EDIT_FRAME::GetSchematicFromRedoList( wxCommandEvent& event )
|
||||||
OnModify();
|
OnModify();
|
||||||
SetSheetNumberAndCount();
|
SetSheetNumberAndCount();
|
||||||
|
|
||||||
GetScreen()->TestDanglingEnds();
|
TestDanglingEnds();
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue