Commit 9deee66b authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Pcbnew: Fix bug 811437 . This bug (due to duplicate time stamps), cannot...

Pcbnew: Fix bug 811437 . This bug (due to duplicate time stamps), cannot happen with usual boards, only when 2 identical board (from the same .brd file) are append.
parent 6850365d
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -902,15 +902,16 @@ public:
    // zone handling

    /**
     * Function Delete_Zone_Fill (obsolete)
     * Function Delete_OldZone_Fill (obsolete)
     * Used for compatibility with old boards
     * Remove the zone filling which include the segment aZone, or the zone
     * which have the given time stamp.  A zone is a group of segments which
     * have the same TimeStamp
     * which have the given time stamp.
     * For old boards, a zone is a group of SEGZONE segments which have the same TimeStamp
     * @param aZone = zone segment within the zone to delete. Can be NULL
     * @param aTimestamp = Timestamp for the zone to delete, used if aZone ==
     *                     NULL
     */
    void Delete_Zone_Fill( SEGZONE* aZone, long aTimestamp = 0 );
    void Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp = 0 );


    /**
+16 −0
Original line number Diff line number Diff line
@@ -47,6 +47,22 @@ ZONE_CONTAINER::~ZONE_CONTAINER()
    m_Poly = NULL;
}

/**
 * Function UnFill
 * Removes the zone filling
 * @return true if a previous filling is removed, false if no change
 * (when no filling found)
 */
bool ZONE_CONTAINER::UnFill()
{
    bool change = ( m_FilledPolysList.size() > 0 ) || ( m_FillSegmList.size() > 0 );

    m_FilledPolysList.clear();
    m_FillSegmList.clear();
    m_IsFilled = false;

    return change;
}

/**
 * Function GetPosition (virtual)
+7 −0
Original line number Diff line number Diff line
@@ -289,6 +289,13 @@ public:
     */
    int  Fill_Zone_Areas_With_Segments();

    /**
     * Function UnFill
     * Removes the zone filling
     * @return true if a previous filling is removed, false if no change
     * (when no filling found)
     */
    bool  UnFill();

    /* Geometric transformations: */

+3 −3
Original line number Diff line number Diff line
@@ -381,7 +381,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
        {
            SEGZONE* zsegm   = (SEGZONE*) GetCurItem();
            int      netcode = zsegm->GetNet();
            Delete_Zone_Fill( zsegm );
            Delete_OldZone_Fill( zsegm );
            SetCurItem( NULL );
            test_1_net_connexion( NULL, netcode );
            OnModify();
@@ -498,7 +498,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
        if( ( GetCurItem() )->Type() == TYPE_ZONE_CONTAINER )
        {
            ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) GetCurItem();
            Delete_Zone_Fill( NULL, zone_container->m_TimeStamp );
            zone_container->UnFill();
            test_1_net_connexion( NULL, zone_container->GetNet() );
            OnModify();
            GetBoard()->DisplayInfo( this );
@@ -1058,7 +1058,7 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
        break;

    case TYPE_ZONE:
        Delete_Zone_Fill( (SEGZONE*) Item );
        Delete_OldZone_Fill( (SEGZONE*) Item );
        break;

    case TYPE_ZONE_EDGE_CORNER:
+6 −2
Original line number Diff line number Diff line
@@ -335,7 +335,7 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_containe
        DrawPanel->RefreshDrawingRect( zone_container->GetBoundingBox() );
        if( DC )
        {  // Remove the full zone because this is no more an area
            Delete_Zone_Fill( NULL, zone_container->m_TimeStamp );
            zone_container->UnFill();
            zone_container->DrawFilledArea( DrawPanel, DC, GR_XOR );
        }
        GetBoard()->Delete( zone_container );
@@ -851,7 +851,11 @@ void PCB_EDIT_FRAME::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_contain

    EDA_RECT dirty = zone_container->GetBoundingBox();

    Delete_Zone_Fill( NULL, zone_container->m_TimeStamp );  // Remove fill segments
    // For compatibility with old boards: remove old SEGZONE fill segments
    Delete_OldZone_Fill( NULL, zone_container->m_TimeStamp );

    // Remove current filling:
    zone_container->UnFill();

    if( ncont == 0 )    // This is the main outline: remove all
    {
Loading