Bugs about fill zones and block delete removed

This commit is contained in:
CHARRAS 2008-01-24 21:05:08 +00:00
parent 4195d71fa2
commit b8b0fc6e04
3 changed files with 12 additions and 5 deletions

View File

@ -285,6 +285,7 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& off
* @param draw_mode = draw mode: OR, XOR ..
*/
{
if ( DC == NULL ) return;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int color = g_DesignSettings.m_LayerColor[m_Layer];

View File

@ -220,13 +220,13 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_PCB_ZONES_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
SetCurItem( DrawStruct = Begin_Zone( DC ) );
GetScreen()->SetCurItem( DrawStruct = Begin_Zone( DC ) );
}
else if( DrawStruct
&& (DrawStruct->Type() == TYPEEDGEZONE)
&& (DrawStruct->m_Flags & IS_NEW) )
{
SetCurItem( DrawStruct = Begin_Zone( DC ) );
GetScreen()->SetCurItem( DrawStruct = Begin_Zone( DC ) );
}
else
DisplayError( this, wxT( "Edit: zone internal error" ) );

View File

@ -357,6 +357,7 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER * zone_contai
if ( zone_container->m_Poly->GetNumCorners() <= 3 )
{
zone_container->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
Delete_Zone_Fill( DC, NULL, zone_container->m_TimeStamp );
m_Pcb->Delete( zone_container );
return;
@ -373,7 +374,7 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER * zone_contai
m_Pcb->RedrawAreasOutlines(DrawPanel, DC, GR_OR, layer);
int ii = m_Pcb->GetAreaIndex(zone_container); // test if zone_container exists
if ( ii < 0 ) zone_container = NULL; // was removed by combining zones
if ( ii < 0 ) zone_container = NULL; // zone_container does not exist anymaore, after combining zones
int error_count = m_Pcb->Test_Drc_Areas_Outlines_To_Areas_Outlines(zone_container, true);
if ( error_count )
{
@ -536,13 +537,17 @@ EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
if( Drc_On && m_drc->Drc( newedge ) == BAD_DRC )
{
delete newedge;
SetCurItem(NULL);
// use the form of SetCurItem() which does not write to the msg panel,
// SCREEN::SetCurItem(), so the DRC error remains on screen.
// WinEDA_PcbFrame::SetCurItem() calls Display_Infos().
GetScreen()->SetCurItem( NULL );
DisplayError(this, _("DRC error: this start point is inside or too close an other area"));
return NULL;
}
// link into list:
newedge->Pnext = oldedge;
SetCurItem( newedge );
if( oldedge )
oldedge->Pback = newedge;
@ -575,6 +580,7 @@ EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
newedge->Pnext = oldedge;
oldedge->Pback = newedge;
m_Pcb->m_CurrentLimitZone = newedge;
SetCurItem( newedge );
}
}
@ -697,7 +703,7 @@ bool WinEDA_PcbFrame::End_Zone( wxDC* DC )
DelLimitesZone( DC, TRUE );
new_zone_container->m_Flags = 0;
SetCurItem( NULL ); // This outine can be deleted when merging outlines
GetScreen()->SetCurItem( NULL ); // This outine can be deleted when merging outlines
// Combine zones if possible :
m_Pcb->AreaPolygonModified( new_zone_container, true, verbose );