Commit 0120f07d authored by CHARRAS's avatar CHARRAS
Browse files

code cleaning

parent 1fb25193
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -133,7 +133,6 @@ public:
     */
    BOARD_ITEM*                 PcbGeneralLocateAndDisplay( int aHotKeyCode = 0 );

    BOARD_ITEM*                 Locate( int typeloc, int LayerSearch );
    void                        ProcessItemSelection( wxCommandEvent& event );

    /**
+19 −19
Original line number Diff line number Diff line
@@ -566,11 +566,11 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
            }
        }
		
		for ( unsigned ii = 0; ii < m_Pcb->m_ZoneDescriptorList.size(); ii++ )
		for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
		{
            if( m_Pcb->m_ZoneDescriptorList[ii]->HitTest( GetScreen()->BlockLocate ) )
            if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
			{
				m_Pcb->Delete(m_Pcb->m_ZoneDescriptorList[ii]);
				m_Pcb->Delete(m_Pcb->GetArea(ii));
				ii--;	// because the current data was removed, ii points actually the next data
			}
		}
@@ -666,11 +666,11 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
            }
            track = track->Next();
        }
		for ( unsigned ii = 0; ii < m_Pcb->m_ZoneDescriptorList.size(); ii++ )
		for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
		{
            if( m_Pcb->m_ZoneDescriptorList[ii]->HitTest( GetScreen()->BlockLocate ) )
            if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
			{
				m_Pcb->m_ZoneDescriptorList[ii]->Rotate(centre, 900);
				m_Pcb->GetArea(ii)->Rotate(centre, 900);
			}
		}
    }
@@ -842,12 +842,12 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
            }
            track = (TRACK*) track->Pnext;
        }
		for ( unsigned ii = 0; ii < m_Pcb->m_ZoneDescriptorList.size(); ii++ )
		for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
		{
            if( m_Pcb->m_ZoneDescriptorList[ii]->HitTest( GetScreen()->BlockLocate ) )
            if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
			{
				m_Pcb->m_ZoneDescriptorList[ii]->Mirror( wxPoint(0, centerY) );
                m_Pcb->m_ZoneDescriptorList[ii]->SetLayer( ChangeSideNumLayer( m_Pcb->m_ZoneDescriptorList[ii]->GetLayer() ) );
				m_Pcb->GetArea(ii)->Mirror( wxPoint(0, centerY) );
                m_Pcb->GetArea(ii)->SetLayer( ChangeSideNumLayer( m_Pcb->GetArea(ii)->GetLayer() ) );
			}
		}
    }
@@ -1012,11 +1012,11 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
            }
            track = (TRACK*) track->Pnext;
        }
		for ( unsigned ii = 0; ii < m_Pcb->m_ZoneDescriptorList.size(); ii++ )
		for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
		{
            if( m_Pcb->m_ZoneDescriptorList[ii]->HitTest( GetScreen()->BlockLocate ) )
            if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
			{
				m_Pcb->m_ZoneDescriptorList[ii]->Move( MoveVector );
				m_Pcb->GetArea(ii)->Move( MoveVector );
			}
		}
    }
@@ -1176,25 +1176,25 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
        {
            if( segzone->HitTest( GetScreen()->BlockLocate ) )
            {  
                /* la piste est ici bonne a etre dupliquee */
                new_segzone = (SEGZONE*) segzone->Copy();
                new_segzone->Insert( m_Pcb, NULL );
                new_segzone->m_Start += MoveVector;
                new_segzone->m_End   += MoveVector;
                new_segzone->Draw( DrawPanel, DC, GR_OR ); // reaffichage
                new_segzone->Draw( DrawPanel, DC, GR_OR );
            }
            segzone = segzone->Next();
        }

		unsigned imax = m_Pcb->m_ZoneDescriptorList.size();
		unsigned imax = m_Pcb->GetAreaCount();
		for ( unsigned ii = 0; ii < imax; ii++ )
		{
            if( m_Pcb->m_ZoneDescriptorList[ii]->HitTest( GetScreen()->BlockLocate ) )
            if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
			{
				ZONE_CONTAINER * new_zone = new ZONE_CONTAINER(m_Pcb);
				new_zone->Copy( m_Pcb->m_ZoneDescriptorList[ii] );
				new_zone->Copy( m_Pcb->GetArea(ii) );
				new_zone->m_TimeStamp = GetTimeStamp();
				new_zone->Move( MoveVector );
				m_Pcb->m_ZoneDescriptorList.push_back(new_zone);
				m_Pcb->Add(new_zone);
				new_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
			}
		}
+6 −0
Original line number Diff line number Diff line
@@ -118,6 +118,12 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
        m_markers.push_back( (MARKER*) aBoardItem );
        break;
    
    // this one uses a vector
    case TYPEZONE_CONTAINER:
        aBoardItem->m_Parent = this;
        m_ZoneDescriptorList.push_back( (ZONE_CONTAINER*) aBoardItem );
        break;
    
    // other types may use linked list
    default:
        wxFAIL_MSG( wxT("BOARD::Add() needs work") );
+24 −2
Original line number Diff line number Diff line
@@ -19,8 +19,6 @@ class BOARD : public BOARD_ITEM
    
private:
    std::vector<MARKER*> m_markers;             ///< MARKERs for clearance problems, owned by pointer                                                 

public:
	std::vector<ZONE_CONTAINER*> m_ZoneDescriptorList; 	///< edge zone descriptors, owned by pointer                                                 

public:
@@ -225,6 +223,30 @@ public:
    
#endif

	/* Copper Areas handling */
    /**
     * Function GetArea
     * returns the Area (Zone Container) at a given index.
     * @param index The array type index into a collection of ZONE_CONTAINER *.
     * @return ZONE_CONTAINER* - a pointer to the Area or NULL if index out of range.
     */
    ZONE_CONTAINER* GetArea( int index ) const
    {
        if( (unsigned) index < m_ZoneDescriptorList.size() )
            return m_ZoneDescriptorList[index];
        return NULL;
    }

    
    /**
     * Function GetAreaCount
     * @return int - The number of Areas or ZONE_CONTAINER.
     */
    int GetAreaCount() const
    {
        return (int) m_ZoneDescriptorList.size();
    }

	/* Functions used in test, merge and cut outlines */
	/**
	  * Function AddArea
+4 −4
Original line number Diff line number Diff line
@@ -530,15 +530,15 @@ void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref)


/** Function copy
 * copy data from the source.
 * flags and some poinetrs are NOT copied
 * copy usefull data from the source.
 * flags and linked list pointers are NOT copied
 */
void ZONE_CONTAINER::Copy( ZONE_CONTAINER * src )
{
	m_Parent = src->m_Parent;
    m_Layer         = src->m_Layer;
	SetNet(src->GetNet());
    m_TimeStamp     = GetTimeStamp();
    m_TimeStamp     = src->m_TimeStamp;
	m_Poly->Copy(src->m_Poly);			// copy outlines
	m_CornerSelection = -1;      		// For corner moving, corner index to drag, or -1 if no selection
	m_ZoneClearance = src->m_ZoneClearance;		// clearance value
Loading