diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index a15572021e..c05ef6c5eb 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -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]; diff --git a/pcbnew/onleftclick.cpp b/pcbnew/onleftclick.cpp index b9004f054f..4aca41f09a 100644 --- a/pcbnew/onleftclick.cpp +++ b/pcbnew/onleftclick.cpp @@ -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" ) ); diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index be33996950..d338589ff8 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -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 );