Commit b8b0fc6e authored by CHARRAS's avatar CHARRAS
Browse files

Bugs about fill zones and block delete removed

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


+2 −2
Original line number Original line Diff line number Diff line
@@ -220,13 +220,13 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
    case ID_PCB_ZONES_BUTT:
    case ID_PCB_ZONES_BUTT:
        if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
        if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
        {
        {
            SetCurItem( DrawStruct = Begin_Zone( DC ) );
            GetScreen()->SetCurItem( DrawStruct = Begin_Zone( DC ) );
        }
        }
        else if( DrawStruct
        else if( DrawStruct
                && (DrawStruct->Type() == TYPEEDGEZONE)
                && (DrawStruct->Type() == TYPEEDGEZONE)
                && (DrawStruct->m_Flags & IS_NEW) )
                && (DrawStruct->m_Flags & IS_NEW) )
        {
        {
            SetCurItem( DrawStruct = Begin_Zone( DC ) );
            GetScreen()->SetCurItem( DrawStruct = Begin_Zone( DC ) );
        }
        }
        else
        else
            DisplayError( this, wxT( "Edit: zone internal error" ) );
            DisplayError( this, wxT( "Edit: zone internal error" ) );
+9 −3
Original line number Original line Diff line number Diff line
@@ -357,6 +357,7 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER * zone_contai


	if ( zone_container->m_Poly->GetNumCorners() <= 3 )
	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 );
		Delete_Zone_Fill( DC, NULL, zone_container->m_TimeStamp );
		m_Pcb->Delete( zone_container );
		m_Pcb->Delete( zone_container );
		return;
		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);
    m_Pcb->RedrawAreasOutlines(DrawPanel, DC, GR_OR, layer);


	int ii = m_Pcb->GetAreaIndex(zone_container);	// test if zone_container exists
	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);
	int error_count = m_Pcb->Test_Drc_Areas_Outlines_To_Areas_Outlines(zone_container, true);
	if ( error_count )
	if ( error_count )
	{
	{
@@ -536,13 +537,17 @@ EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
        if( Drc_On && m_drc->Drc( newedge ) == BAD_DRC )
        if( Drc_On && m_drc->Drc( newedge ) == BAD_DRC )
		{
		{
			delete newedge;
			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"));
			DisplayError(this, _("DRC error: this start point is inside or too close an other area"));
			return NULL;
			return NULL;
		}
		}


        // link into list:
        // link into list:
        newedge->Pnext = oldedge;
        newedge->Pnext = oldedge;
		SetCurItem( newedge );


        if( oldedge )
        if( oldedge )
            oldedge->Pback = newedge;
            oldedge->Pback = newedge;
@@ -575,6 +580,7 @@ EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
            newedge->Pnext = oldedge;
            newedge->Pnext = oldedge;
            oldedge->Pback = newedge;
            oldedge->Pback = newedge;
            m_Pcb->m_CurrentLimitZone = newedge;
            m_Pcb->m_CurrentLimitZone = newedge;
			SetCurItem( newedge );
        }
        }
    }
    }


@@ -697,7 +703,7 @@ bool WinEDA_PcbFrame::End_Zone( wxDC* DC )
    DelLimitesZone( DC, TRUE );
    DelLimitesZone( DC, TRUE );


    new_zone_container->m_Flags = 0;
    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 :
    // Combine zones if possible :
    m_Pcb->AreaPolygonModified( new_zone_container, true, verbose );
    m_Pcb->AreaPolygonModified( new_zone_container, true, verbose );