Commit 8a5179fc authored by charras's avatar charras

pcbnew: fixed serious bug in clean pcb function

some cleanup.
parent f43d1aaa
...@@ -576,11 +576,6 @@ void WinEDA_DrawFrame::AdjustScrollBars() ...@@ -576,11 +576,6 @@ void WinEDA_DrawFrame::AdjustScrollBars()
screen->m_ScrollbarPos = scrollbar_pos; screen->m_ScrollbarPos = scrollbar_pos;
screen->m_ScrollbarNumber = scrollbar_number; 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, DrawPanel->SetScrollbars( screen->m_ZoomScalar,
screen->m_ZoomScalar, screen->m_ZoomScalar,
screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.x,
......
...@@ -527,8 +527,6 @@ void WinEDA_App::SetDefaultSearchPaths( void ) ...@@ -527,8 +527,6 @@ void WinEDA_App::SetDefaultSearchPaths( void )
{ {
if( !wxFileName::IsDirReadable( m_searchPaths[i] ) ) if( !wxFileName::IsDirReadable( m_searchPaths[i] ) )
{ {
wxLogDebug( wxT( "Removing <" ) + m_searchPaths[i] +
wxT( "> from search path list." ) );
m_searchPaths.RemoveAt( i ); m_searchPaths.RemoveAt( i );
i -= 1; i -= 1;
} }
...@@ -545,17 +543,13 @@ void WinEDA_App::SetDefaultSearchPaths( void ) ...@@ -545,17 +543,13 @@ void WinEDA_App::SetDefaultSearchPaths( void )
fn.AppendDir( wxT( "library" ) ); fn.AppendDir( wxT( "library" ) );
if( fn.IsDirReadable() ) if( fn.IsDirReadable() )
{ {
wxLogDebug( wxT( "Adding <%s> to search path list" ), m_libSearchPaths.Add( fn.GetPath() );
fn.GetPath().c_str() );
m_libSearchPaths.Add( fn.GetPath() );
} }
/* Add schematic doc file path (library/doc)to search path list. */ /* Add schematic doc file path (library/doc)to search path list. */
fn.AppendDir( wxT( "doc" ) ); fn.AppendDir( wxT( "doc" ) );
if( fn.IsDirReadable() ) 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(); fn.RemoveLastDir();
...@@ -569,9 +563,7 @@ void WinEDA_App::SetDefaultSearchPaths( void ) ...@@ -569,9 +563,7 @@ void WinEDA_App::SetDefaultSearchPaths( void )
if( fn.IsDirReadable() ) if( fn.IsDirReadable() )
{ {
wxLogDebug( wxT( "Adding <%s> to library search path list" ), m_libSearchPaths.Add( fn.GetPath() );
fn.GetPath().c_str() );
m_libSearchPaths.Add( fn.GetPath() );
} }
/* Add 3D module library file path to search path list. */ /* Add 3D module library file path to search path list. */
...@@ -579,8 +571,6 @@ void WinEDA_App::SetDefaultSearchPaths( void ) ...@@ -579,8 +571,6 @@ void WinEDA_App::SetDefaultSearchPaths( void )
if( fn.IsDirReadable() ) 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(); fn.RemoveLastDir();
...@@ -591,9 +581,7 @@ void WinEDA_App::SetDefaultSearchPaths( void ) ...@@ -591,9 +581,7 @@ void WinEDA_App::SetDefaultSearchPaths( void )
if( fn.IsDirReadable() ) if( fn.IsDirReadable() )
{ {
wxLogDebug( wxT( "Adding <%s> to search path list" ), m_libSearchPaths.Add( fn.GetPath() );
fn.GetPath().c_str() );
m_libSearchPaths.Add( fn.GetPath() );
} }
fn.RemoveLastDir(); fn.RemoveLastDir();
} }
...@@ -839,8 +827,6 @@ wxString WinEDA_App::FindFileInSearchPaths( const wxString& filename, ...@@ -839,8 +827,6 @@ wxString WinEDA_App::FindFileInSearchPaths( const wxString& filename,
if( fn.DirExists() ) if( fn.DirExists() )
{ {
wxLogDebug( _T( "Adding <" ) + fn.GetPath() + _T( "> to " ) +
_T( "file \"" ) + filename + _T( "\" search path." ) );
paths.Add( fn.GetPath() ); paths.Add( fn.GetPath() );
} }
} }
......
...@@ -46,12 +46,12 @@ bool WinEDA_App::ReCreatePrjConfig( const wxString& fileName, ...@@ -46,12 +46,12 @@ bool WinEDA_App::ReCreatePrjConfig( const wxString& fileName,
m_ProjectConfig = NULL; 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 ) 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 ); fn.SetExt( ProjectFileExtension );
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#define POS_AFF_NUMSEGM 70 #define POS_AFF_NUMSEGM 70
/* local functions : */ /* 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 void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC );
static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extremite ); static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extremite );
static void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC ); static void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC );
...@@ -142,7 +142,7 @@ 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 */ /* Remove null segments and intermediate points on aligned segments */
if( s_MergeSegments ) if( s_MergeSegments )
clean_segments( frame, DC ); clean_segments( frame );
/* Delete dangling tracks */ /* Delete dangling tracks */
if( s_DeleteUnconnectedSegm ) if( s_DeleteUnconnectedSegm )
...@@ -388,11 +388,11 @@ static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC ) ...@@ -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 .. */ /* Delete null lenght segments, and intermediate points .. */
{ {
TRACK* segment; TRACK* segment, * nextsegment;
TRACK* other; TRACK* other;
int ii, nbpoints_supprimes = 0; int ii, nbpoints_supprimes = 0;
int flag, no_inc, percent, oldpercent; int flag, no_inc, percent, oldpercent;
...@@ -414,13 +414,13 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) ...@@ -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 ); 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() ) if( !segment->IsNull() )
continue; continue;
/* Length segment = 0; delete it */ /* Length segment = 0; delete it */
segment->Draw( frame->DrawPanel, DC, GR_XOR );
segment->DeleteStructure(); segment->DeleteStructure();
nbpoints_supprimes++; nbpoints_supprimes++;
...@@ -456,8 +456,9 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) ...@@ -456,8 +456,9 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
return -1; return -1;
} }
for( other = segment->Next(); other; other = other->Next() ) for( other = segment->Next(); other; other = nextsegment )
{ {
nextsegment = other->Next();
int erase = 0; int erase = 0;
if( segment->Type() != other->Type() ) if( segment->Type() != other->Type() )
...@@ -485,7 +486,6 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) ...@@ -485,7 +486,6 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
if( erase ) if( erase )
{ {
ii--; ii--;
other->Draw( frame->DrawPanel, DC, GR_OR );
other->DeleteStructure(); other->DeleteStructure();
nbpoints_supprimes++; nbpoints_supprimes++;
...@@ -507,14 +507,13 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) ...@@ -507,14 +507,13 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
Affiche_1_Parametre( frame, POS_AFF_VAR, _( "Merge" ), _( "0" ), a_color ); Affiche_1_Parametre( frame, POS_AFF_VAR, _( "Merge" ), _( "0" ), a_color );
ii = 0; ii = 0;
TRACK* next; for( segment = frame->GetBoard()->m_Track; segment; segment = nextsegment )
for( segment = frame->GetBoard()->m_Track; segment; segment = next )
{ {
TRACK* segStart; TRACK* segStart;
TRACK* segEnd; TRACK* segEnd;
TRACK* segDelete; TRACK* segDelete;
next = segment->Next(); nextsegment = segment->Next();
ii++; ii++;
percent = (100 * ii) / frame->GetBoard()->m_Track.GetCount(); percent = (100 * ii) / frame->GetBoard()->m_Track.GetCount();
...@@ -620,11 +619,11 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) ...@@ -620,11 +619,11 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
msg.Printf( wxT( "%d " ), nbpoints_supprimes ); msg.Printf( wxT( "%d " ), nbpoints_supprimes );
Affiche_1_Parametre( frame, POS_AFF_VAR, wxEmptyString, msg, a_color ); Affiche_1_Parametre( frame, POS_AFF_VAR, wxEmptyString, msg, a_color );
next = segment->Next(); nextsegment = segment->Next();
} }
} }
return 0; return 0;
} }
......
...@@ -164,12 +164,7 @@ bool Read_Config( const wxString& projectFileName ) ...@@ -164,12 +164,7 @@ bool Read_Config( const wxString& projectFileName )
int ii; int ii;
if( fn.GetExt() != ProjectFileExtension ) 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 ); fn.SetExt( ProjectFileExtension );
}
wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer ); wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer );
......
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