diff --git a/change_log.txt b/change_log.txt index 76e74bb7c0..924e36fbe2 100644 --- a/change_log.txt +++ b/change_log.txt @@ -24,6 +24,8 @@ email address. * Added WinEDA_DrawPanel::PostDirtyRect() * Renamed Supprime_Une_Piste() to Remove_One_Track() and it now uses PostDirtyRect(). + * void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* Track ) now redraws + the screen after a net deletion. 2008-Mar-10 UPDATE Jean-Pierre Charras diff --git a/pcbnew/deltrack.cpp b/pcbnew/deltrack.cpp index 61ccc0bd79..8516ec5245 100644 --- a/pcbnew/deltrack.cpp +++ b/pcbnew/deltrack.cpp @@ -149,33 +149,34 @@ void WinEDA_PcbFrame::Delete_Track( wxDC* DC, TRACK* Track ) void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* Track ) /********************************************************/ { - TRACK* pt_segm, * pt_start; - int ii; - int net_code_delete; - - pt_segm = Track; - - if( pt_segm == NULL ) + if( Track == NULL ) return; if( IsOK( this, _( "Delete NET ?" ) ) ) { - net_code_delete = pt_segm->GetNet(); + int net_code_delete = Track->GetNet(); + /* Recherche du debut de la zone des pistes du net_code courant */ - pt_start = m_Pcb->m_Track->GetStartNetCode( net_code_delete ); + TRACK* trackList = m_Pcb->m_Track->GetStartNetCode( net_code_delete ); /* Decompte du nombre de segments de la sous-chaine */ - pt_segm = pt_start; - for( ii = 0; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext ) + + int ii; + TRACK* segm = trackList; + for( ii = 0; segm; segm = segm->Next(), ++ii ) { - if( pt_segm->GetNet() != net_code_delete ) + if( segm->GetNet() != net_code_delete ) break; - ii++; + + // This works ok, but sometimes leaves stuff on screen. I think + // the erase rectangle is not large enough always. + // DrawPanel->PostDirtyRect( segm->GetBoundingBox() ); } - Trace_Une_Piste( DrawPanel, DC, pt_start, ii, GR_XOR ); + // Do this instead of PostDirtyRect() for now + DrawPanel->Refresh( TRUE ); - SaveItemEfface( pt_start, ii ); + SaveItemEfface( trackList, ii ); GetScreen()->SetModify(); test_1_net_connexion( DC, net_code_delete ); m_Pcb->Display_Infos( this ); diff --git a/share/drawpanel.cpp b/share/drawpanel.cpp index a8dc88f09c..1a755f2e42 100644 --- a/share/drawpanel.cpp +++ b/share/drawpanel.cpp @@ -271,8 +271,9 @@ void WinEDA_DrawPanel::PostDirtyRect( EDA_Rect aRect ) // Convert the rect coordinates and size to pixels (make a draw clip box): ConvertPcbUnitsToPixelsUnits( &aRect ); - // Ensure the last line and column are in the dirty rectangle after truncations. - // The pcb units have finer granularity than the pixels, so this can happen. + // Ensure the rectangle is large enough after truncations. + // The pcb units have finer granularity than the pixels, so it can happen + // that the rectangle is not large enough for the erase portion. aRect.m_Size.x += 1; aRect.m_Size.y += 1; @@ -538,6 +539,7 @@ void WinEDA_DrawPanel::EraseScreen( wxDC* DC ) /*********************************************/ { GRSetDrawMode( DC, GR_COPY ); + GRSFilledRect( &m_ClipBox, DC, m_ClipBox.GetX(), m_ClipBox.GetY(), m_ClipBox.GetRight(), m_ClipBox.GetBottom(), g_DrawBgColor, g_DrawBgColor );