pcbnew: fixed serious bug in clean pcb function

some cleanup.
This commit is contained in:
charras 2009-06-11 18:30:03 +00:00
parent f43d1aaa54
commit 8a5179fc70
5 changed files with 19 additions and 44 deletions

View File

@ -576,11 +576,6 @@ void WinEDA_DrawFrame::AdjustScrollBars()
screen->m_ScrollbarPos = scrollbar_pos;
screen->m_ScrollbarNumber = scrollbar_number;
wxLogDebug( wxT( "SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
screen->m_ZoomScalar, screen->m_ZoomScalar,
screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.y,
screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.y );
DrawPanel->SetScrollbars( screen->m_ZoomScalar,
screen->m_ZoomScalar,
screen->m_ScrollbarNumber.x,

View File

@ -527,8 +527,6 @@ void WinEDA_App::SetDefaultSearchPaths( void )
{
if( !wxFileName::IsDirReadable( m_searchPaths[i] ) )
{
wxLogDebug( wxT( "Removing <" ) + m_searchPaths[i] +
wxT( "> from search path list." ) );
m_searchPaths.RemoveAt( i );
i -= 1;
}
@ -545,17 +543,13 @@ void WinEDA_App::SetDefaultSearchPaths( void )
fn.AppendDir( wxT( "library" ) );
if( fn.IsDirReadable() )
{
wxLogDebug( wxT( "Adding <%s> to search path list" ),
fn.GetPath().c_str() );
m_libSearchPaths.Add( fn.GetPath() );
m_libSearchPaths.Add( fn.GetPath() );
}
/* Add schematic doc file path (library/doc)to search path list. */
fn.AppendDir( wxT( "doc" ) );
if( fn.IsDirReadable() )
{
wxLogDebug( wxT( "Adding <%s> to search path list" ),
fn.GetPath().c_str() );
m_libSearchPaths.Add( fn.GetPath() );
}
fn.RemoveLastDir();
@ -569,9 +563,7 @@ void WinEDA_App::SetDefaultSearchPaths( void )
if( fn.IsDirReadable() )
{
wxLogDebug( wxT( "Adding <%s> to library search path list" ),
fn.GetPath().c_str() );
m_libSearchPaths.Add( fn.GetPath() );
m_libSearchPaths.Add( fn.GetPath() );
}
/* Add 3D module library file path to search path list. */
@ -579,8 +571,6 @@ void WinEDA_App::SetDefaultSearchPaths( void )
if( fn.IsDirReadable() )
{
wxLogDebug( wxT( "Adding <%s> to search path list" ),
fn.GetPath().c_str() );
m_libSearchPaths.Add( fn.GetPath() );
}
fn.RemoveLastDir();
@ -591,9 +581,7 @@ void WinEDA_App::SetDefaultSearchPaths( void )
if( fn.IsDirReadable() )
{
wxLogDebug( wxT( "Adding <%s> to search path list" ),
fn.GetPath().c_str() );
m_libSearchPaths.Add( fn.GetPath() );
m_libSearchPaths.Add( fn.GetPath() );
}
fn.RemoveLastDir();
}
@ -839,8 +827,6 @@ wxString WinEDA_App::FindFileInSearchPaths( const wxString& filename,
if( fn.DirExists() )
{
wxLogDebug( _T( "Adding <" ) + fn.GetPath() + _T( "> to " ) +
_T( "file \"" ) + filename + _T( "\" search path." ) );
paths.Add( fn.GetPath() );
}
}

View File

@ -46,12 +46,12 @@ bool WinEDA_App::ReCreatePrjConfig( const wxString& fileName,
m_ProjectConfig = NULL;
}
/* Check just in case the file name does not a kicad project extension. */
/* Check the file name does not a kicad project extension.
* This allows the user to enter a filename without extension
* or use an existing name to create te project file
*/
if( fn.GetExt() != ProjectFileExtension )
{
wxLogDebug( wxT( "ReCreatePrjConfig() called with project file <%s> \
which does not have the correct file extension." ),
fn.GetFullPath().c_str() );
fn.SetExt( ProjectFileExtension );
}

View File

@ -22,7 +22,7 @@
#define POS_AFF_NUMSEGM 70
/* local functions : */
static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC );
static int clean_segments( WinEDA_PcbFrame* frame );
static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC );
static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extremite );
static void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC );
@ -142,7 +142,7 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC )
/* Remove null segments and intermediate points on aligned segments */
if( s_MergeSegments )
clean_segments( frame, DC );
clean_segments( frame );
/* Delete dangling tracks */
if( s_DeleteUnconnectedSegm )
@ -388,11 +388,11 @@ static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC )
/************************************************************/
static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
static int clean_segments( WinEDA_PcbFrame* frame )
/************************************************************/
/* Delete null lenght segments, and intermediate points .. */
{
TRACK* segment;
TRACK* segment, * nextsegment;
TRACK* other;
int ii, nbpoints_supprimes = 0;
int flag, no_inc, percent, oldpercent;
@ -414,13 +414,13 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
Affiche_1_Parametre( frame, POS_AFF_VAR, wxT( "NullSeg" ), wxT( "0" ), a_color );
for( segment = frame->GetBoard()->m_Track; segment; segment = segment->Next() )
for( segment = frame->GetBoard()->m_Track; segment; segment = nextsegment )
{
nextsegment = segment->Next();
if( !segment->IsNull() )
continue;
/* Length segment = 0; delete it */
segment->Draw( frame->DrawPanel, DC, GR_XOR );
segment->DeleteStructure();
nbpoints_supprimes++;
@ -456,8 +456,9 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
return -1;
}
for( other = segment->Next(); other; other = other->Next() )
for( other = segment->Next(); other; other = nextsegment )
{
nextsegment = other->Next();
int erase = 0;
if( segment->Type() != other->Type() )
@ -485,7 +486,6 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
if( erase )
{
ii--;
other->Draw( frame->DrawPanel, DC, GR_OR );
other->DeleteStructure();
nbpoints_supprimes++;
@ -507,14 +507,13 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
Affiche_1_Parametre( frame, POS_AFF_VAR, _( "Merge" ), _( "0" ), a_color );
ii = 0;
TRACK* next;
for( segment = frame->GetBoard()->m_Track; segment; segment = next )
for( segment = frame->GetBoard()->m_Track; segment; segment = nextsegment )
{
TRACK* segStart;
TRACK* segEnd;
TRACK* segDelete;
next = segment->Next();
nextsegment = segment->Next();
ii++;
percent = (100 * ii) / frame->GetBoard()->m_Track.GetCount();
@ -620,11 +619,11 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
msg.Printf( wxT( "%d " ), nbpoints_supprimes );
Affiche_1_Parametre( frame, POS_AFF_VAR, wxEmptyString, msg, a_color );
next = segment->Next();
nextsegment = segment->Next();
}
}
return 0;
return 0;
}

View File

@ -164,12 +164,7 @@ bool Read_Config( const wxString& projectFileName )
int ii;
if( fn.GetExt() != ProjectFileExtension )
{
wxLogDebug( wxT( "Attempting to open project file <%s>. Changing \
file extension to a Kicad project file extension (.pro)." ),
fn.GetFullPath().c_str() );
fn.SetExt( ProjectFileExtension );
}
wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer );