diff --git a/change_log.txt b/change_log.txt index 5bda6ba995..55b86022ac 100644 --- a/change_log.txt +++ b/change_log.txt @@ -6,6 +6,14 @@ Please add newer entries at the top, list the date and your name with email address. +2008-May-2 UPDATE Dick Hollenbeck +================================================================================ ++pcbnew + Added ZONE_CONTAINER::GetBoundingBox() and used it to clean up + ZONE_CONTAINER deletion. There is still a problem dragging a zone container + edge that I will not get to. + + 2008-May-1 UPDATE Dick Hollenbeck ================================================================================ +pcbnew diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 18e91bd481..45bd4a4ec3 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -356,6 +356,33 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con } +EDA_Rect ZONE_CONTAINER::GetBoundingBox() +{ + const int PRELOAD = 500000; + + int ymax = -PRELOAD; + int ymin = PRELOAD; + int xmin = PRELOAD; + int xmax = -PRELOAD; + + int count = GetNumCorners(); + + for( int i=0; im_Poly->GetNumCorners() <= 3 ) { - zone_container->Draw( DrawPanel, DC, GR_XOR ); + DrawPanel->PostDirtyRect( zone_container->GetBoundingBox() ); Delete_Zone_Fill( DC, NULL, zone_container->m_TimeStamp ); m_Pcb->Delete( zone_container ); return; @@ -778,8 +778,7 @@ void WinEDA_PcbFrame::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_contai { int ncont = zone_container->m_Poly->GetContour( zone_container->m_CornerSelection ); - if( DC ) - zone_container->Draw( DrawPanel, DC, GR_XOR ); + EDA_Rect dirty = zone_container->GetBoundingBox(); Delete_Zone_Fill( DC, NULL, zone_container->m_TimeStamp ); // Remove fill segments @@ -789,9 +788,10 @@ void WinEDA_PcbFrame::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_contai else { zone_container->m_Poly->RemoveContour( ncont ); - if( DC ) - zone_container->Draw( DrawPanel, DC, GR_OR ); } + + DrawPanel->PostDirtyRect( dirty ); + GetScreen()->SetModify(); }