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()
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,
......
......@@ -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,8 +543,6 @@ 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() );
}
......@@ -554,8 +550,6 @@ void WinEDA_App::SetDefaultSearchPaths( void )
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,8 +563,6 @@ 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() );
}
......@@ -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,8 +581,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();
......@@ -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() );
}
}
......
......@@ -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 );
}
......
......@@ -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,7 +619,7 @@ 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();
}
}
......
......@@ -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 );
......
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