From 8a5179fc70f1c5f8433a7967b0788f5d0d0f7ebd Mon Sep 17 00:00:00 2001 From: charras Date: Thu, 11 Jun 2009 18:30:03 +0000 Subject: [PATCH] pcbnew: fixed serious bug in clean pcb function some cleanup. --- common/drawframe.cpp | 5 ----- common/edaappl.cpp | 20 +++----------------- common/projet_config.cpp | 8 ++++---- pcbnew/clean.cpp | 25 ++++++++++++------------- pcbnew/pcbcfg.cpp | 5 ----- 5 files changed, 19 insertions(+), 44 deletions(-) diff --git a/common/drawframe.cpp b/common/drawframe.cpp index a13d0785dd..efacdc26d5 100644 --- a/common/drawframe.cpp +++ b/common/drawframe.cpp @@ -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, diff --git a/common/edaappl.cpp b/common/edaappl.cpp index ce1f8c34b4..709a3c7cd0 100644 --- a/common/edaappl.cpp +++ b/common/edaappl.cpp @@ -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() ); } } diff --git a/common/projet_config.cpp b/common/projet_config.cpp index a839aa4ffc..11de925896 100644 --- a/common/projet_config.cpp +++ b/common/projet_config.cpp @@ -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 ); } diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index 7fb5a24377..f026a0e18c 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -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; } diff --git a/pcbnew/pcbcfg.cpp b/pcbnew/pcbcfg.cpp index 9812015170..8a71e5a047 100644 --- a/pcbnew/pcbcfg.cpp +++ b/pcbnew/pcbcfg.cpp @@ -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 );