Eeschema: decouple SCH_SCREEN::SchematicCleanUp() from wxDC and EDA_DRAW_FRAME.

* Remove wxDC and EDA_DRAW_FRAME parameters from SCH_SCREEN::SchematicCleanUp()
  function call.
* Update all code that calls SCH_SCREEN::SchematicCleanUp() with wxDC and/or EDA_DRAW_FRAME
  parameters.
* Fix a display refresh bug when incrementally inserting bus entries created in my last commit.
  IsDanglingStateChanged() appears to be broke for bus entries.
This commit is contained in:
Wayne Stambaugh 2016-02-20 09:59:42 -05:00
parent c379df06bb
commit 9685b3812d
7 changed files with 20 additions and 26 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -314,7 +314,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
screen->Append( s_wires );
// Correct and remove segments that need to be merged.
screen->SchematicCleanUp( NULL, DC );
screen->SchematicCleanUp();
// A junction could be needed to connect the end point of the last created segment.
if( screen->IsJunctionNeeded( endpoint ) )
@ -429,7 +429,7 @@ SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( wxDC* aDC, const wxPoint& aPositio
SetRepeatItem( no_connect );
GetScreen()->Append( no_connect );
GetScreen()->SchematicCleanUp( m_canvas, aDC );
GetScreen()->SchematicCleanUp();
OnModify();
m_canvas->Refresh();
SaveCopyInUndoList( no_connect, UR_NEW );
@ -497,7 +497,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
if( my_clone->IsConnectable() )
{
if( GetScreen()->TestDanglingEnds() )
GetScreen()->TestDanglingEnds();
m_canvas->Refresh();
}
else

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -256,11 +256,9 @@ public:
* performs routine schematic cleaning including breaking wire and buses and
* deleting identical objects superimposed on top of each other.
*
* @param aCanvas The window to draw on.
* @param aDC The device context used for drawing to \a aCanvas.
* @return True if any schematic clean up was performed.
*/
bool SchematicCleanUp( EDA_DRAW_PANEL* aCanvas = NULL, wxDC* aDC = NULL );
bool SchematicCleanUp();
/**
* Function TestDanglingEnds

View File

@ -2,8 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2012-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -480,7 +480,7 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
/* Ff wire list has changed, delete Undo Redo list to avoid pointers on deleted
* data problems.
*/
if( screen->SchematicCleanUp( NULL ) )
if( screen->SchematicCleanUp() )
screen->ClearUndoRedoList();
}

View File

@ -2,8 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2008-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -295,7 +295,7 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
screen->m_FirstRedraw = false;
SetCrossHairPosition( GetScrollCenterPosition() );
m_canvas->MoveCursorToCrossHair();
screen->SchematicCleanUp( GetCanvas(), NULL );
screen->SchematicCleanUp();
}
else
{

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Chris Pavlina <pavlina.chris@gmail.com>
* Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2015-2016 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -562,8 +562,7 @@ bool SCH_EDIT_FRAME::RescueProject( bool aRunningOnDemand )
Prj().SetElem( PROJECT::ELEM_SCH_PART_LIBS, NULL );
// Clean up wire ends
INSTALL_UNBUFFERED_DC( dc, m_canvas );
GetScreen()->SchematicCleanUp( NULL, &dc );
GetScreen()->SchematicCleanUp();
m_canvas->Refresh( true );
OnModify();

View File

@ -3,8 +3,8 @@
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2008-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -424,7 +424,7 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer )
}
bool SCH_SCREEN::SchematicCleanUp( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
bool SCH_SCREEN::SchematicCleanUp()
{
SCH_ITEM* item, * testItem;
bool modified = false;
@ -482,9 +482,6 @@ bool SCH_SCREEN::SchematicCleanUp( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
TestDanglingEnds();
if( aCanvas && modified )
aCanvas->Refresh();
return modified;
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -1168,7 +1168,7 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
}
}
GetScreen()->SchematicCleanUp( m_canvas, NULL );
GetScreen()->SchematicCleanUp();
m_canvas->Refresh();
}