delete net uses dirty rect

This commit is contained in:
dickelbeck 2008-03-10 15:51:44 +00:00
parent bc04d5e54c
commit e724e4fd31
3 changed files with 22 additions and 17 deletions

View File

@ -24,6 +24,8 @@ email address.
* Added WinEDA_DrawPanel::PostDirtyRect() * Added WinEDA_DrawPanel::PostDirtyRect()
* Renamed Supprime_Une_Piste() to Remove_One_Track() and it now uses * Renamed Supprime_Une_Piste() to Remove_One_Track() and it now uses
PostDirtyRect(). 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 <jean-pierre.charras@inpg.fr> 2008-Mar-10 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>

View File

@ -149,33 +149,34 @@ void WinEDA_PcbFrame::Delete_Track( wxDC* DC, TRACK* Track )
void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* Track ) void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* Track )
/********************************************************/ /********************************************************/
{ {
TRACK* pt_segm, * pt_start; if( Track == NULL )
int ii;
int net_code_delete;
pt_segm = Track;
if( pt_segm == NULL )
return; return;
if( IsOK( this, _( "Delete NET ?" ) ) ) 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 */ /* 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 */ /* 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; 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(); GetScreen()->SetModify();
test_1_net_connexion( DC, net_code_delete ); test_1_net_connexion( DC, net_code_delete );
m_Pcb->Display_Infos( this ); m_Pcb->Display_Infos( this );

View File

@ -271,8 +271,9 @@ void WinEDA_DrawPanel::PostDirtyRect( EDA_Rect aRect )
// Convert the rect coordinates and size to pixels (make a draw clip box): // Convert the rect coordinates and size to pixels (make a draw clip box):
ConvertPcbUnitsToPixelsUnits( &aRect ); ConvertPcbUnitsToPixelsUnits( &aRect );
// Ensure the last line and column are in the dirty rectangle after truncations. // Ensure the rectangle is large enough after truncations.
// The pcb units have finer granularity than the pixels, so this can happen. // 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.x += 1;
aRect.m_Size.y += 1; aRect.m_Size.y += 1;
@ -538,6 +539,7 @@ void WinEDA_DrawPanel::EraseScreen( wxDC* DC )
/*********************************************/ /*********************************************/
{ {
GRSetDrawMode( DC, GR_COPY ); GRSetDrawMode( DC, GR_COPY );
GRSFilledRect( &m_ClipBox, DC, m_ClipBox.GetX(), m_ClipBox.GetY(), GRSFilledRect( &m_ClipBox, DC, m_ClipBox.GetX(), m_ClipBox.GetY(),
m_ClipBox.GetRight(), m_ClipBox.GetBottom(), m_ClipBox.GetRight(), m_ClipBox.GetBottom(),
g_DrawBgColor, g_DrawBgColor ); g_DrawBgColor, g_DrawBgColor );