Commit 0120f07d authored by CHARRAS's avatar CHARRAS

code cleaning

parent 1fb25193
...@@ -133,7 +133,6 @@ public: ...@@ -133,7 +133,6 @@ public:
*/ */
BOARD_ITEM* PcbGeneralLocateAndDisplay( int aHotKeyCode = 0 ); BOARD_ITEM* PcbGeneralLocateAndDisplay( int aHotKeyCode = 0 );
BOARD_ITEM* Locate( int typeloc, int LayerSearch );
void ProcessItemSelection( wxCommandEvent& event ); void ProcessItemSelection( wxCommandEvent& event );
/** /**
......
...@@ -566,11 +566,11 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC ) ...@@ -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 ii--; // because the current data was removed, ii points actually the next data
} }
} }
...@@ -666,11 +666,11 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC ) ...@@ -666,11 +666,11 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
} }
track = track->Next(); 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 ) ...@@ -842,12 +842,12 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
} }
track = (TRACK*) track->Pnext; 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->GetArea(ii)->Mirror( wxPoint(0, centerY) );
m_Pcb->m_ZoneDescriptorList[ii]->SetLayer( ChangeSideNumLayer( m_Pcb->m_ZoneDescriptorList[ii]->GetLayer() ) ); m_Pcb->GetArea(ii)->SetLayer( ChangeSideNumLayer( m_Pcb->GetArea(ii)->GetLayer() ) );
} }
} }
} }
...@@ -1012,11 +1012,11 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC ) ...@@ -1012,11 +1012,11 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
} }
track = (TRACK*) track->Pnext; 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 ) ...@@ -1176,25 +1176,25 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
{ {
if( segzone->HitTest( GetScreen()->BlockLocate ) ) if( segzone->HitTest( GetScreen()->BlockLocate ) )
{ {
/* la piste est ici bonne a etre dupliquee */
new_segzone = (SEGZONE*) segzone->Copy(); new_segzone = (SEGZONE*) segzone->Copy();
new_segzone->Insert( m_Pcb, NULL ); new_segzone->Insert( m_Pcb, NULL );
new_segzone->m_Start += MoveVector; new_segzone->m_Start += MoveVector;
new_segzone->m_End += MoveVector; new_segzone->m_End += MoveVector;
new_segzone->Draw( DrawPanel, DC, GR_OR ); // reaffichage new_segzone->Draw( DrawPanel, DC, GR_OR );
} }
segzone = segzone->Next(); segzone = segzone->Next();
} }
unsigned imax = m_Pcb->m_ZoneDescriptorList.size(); unsigned imax = m_Pcb->GetAreaCount();
for ( unsigned ii = 0; ii < imax; ii++ ) 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); 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 ); 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 ); new_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
} }
} }
......
...@@ -118,6 +118,12 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl ) ...@@ -118,6 +118,12 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
m_markers.push_back( (MARKER*) aBoardItem ); m_markers.push_back( (MARKER*) aBoardItem );
break; 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 // other types may use linked list
default: default:
wxFAIL_MSG( wxT("BOARD::Add() needs work") ); wxFAIL_MSG( wxT("BOARD::Add() needs work") );
......
...@@ -19,8 +19,6 @@ class BOARD : public BOARD_ITEM ...@@ -19,8 +19,6 @@ class BOARD : public BOARD_ITEM
private: private:
std::vector<MARKER*> m_markers; ///< MARKERs for clearance problems, owned by pointer 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 std::vector<ZONE_CONTAINER*> m_ZoneDescriptorList; ///< edge zone descriptors, owned by pointer
public: public:
...@@ -225,6 +223,30 @@ public: ...@@ -225,6 +223,30 @@ public:
#endif #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 */ /* Functions used in test, merge and cut outlines */
/** /**
* Function AddArea * Function AddArea
......
...@@ -530,15 +530,15 @@ void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref) ...@@ -530,15 +530,15 @@ void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref)
/** Function copy /** Function copy
* copy data from the source. * copy usefull data from the source.
* flags and some poinetrs are NOT copied * flags and linked list pointers are NOT copied
*/ */
void ZONE_CONTAINER::Copy( ZONE_CONTAINER * src ) void ZONE_CONTAINER::Copy( ZONE_CONTAINER * src )
{ {
m_Parent = src->m_Parent; m_Parent = src->m_Parent;
m_Layer = src->m_Layer; m_Layer = src->m_Layer;
SetNet(src->GetNet()); SetNet(src->GetNet());
m_TimeStamp = GetTimeStamp(); m_TimeStamp = src->m_TimeStamp;
m_Poly->Copy(src->m_Poly); // copy outlines m_Poly->Copy(src->m_Poly); // copy outlines
m_CornerSelection = -1; // For corner moving, corner index to drag, or -1 if no selection m_CornerSelection = -1; // For corner moving, corner index to drag, or -1 if no selection
m_ZoneClearance = src->m_ZoneClearance; // clearance value m_ZoneClearance = src->m_ZoneClearance; // clearance value
......
...@@ -45,8 +45,8 @@ public: ...@@ -45,8 +45,8 @@ public:
void UnLink(void) {}; void UnLink(void) {};
/** Function copy /** Function copy
* copy data from the source. * copy usefull data from the source.
* flags and some poinetrs are NOT copied * flags and linked list pointers are NOT copied
*/ */
void Copy( ZONE_CONTAINER * src ); void Copy( ZONE_CONTAINER * src );
......
...@@ -4,20 +4,13 @@ ...@@ -4,20 +4,13 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "trigo.h"
#include "autorout.h"
#include "protos.h" #include "protos.h"
/* fonctions locales */
MIREPCB* Locate_MirePcb( BOARD_ITEM* PtStruct, int LayerSearch, int typeloc );
D_PAD* Locate_Any_Pad( BOARD* Pcb, const wxPoint& ref_pos, bool OnlyCurrentLayer );
/** /**
* Function RefPos * Function RefPos
...@@ -83,136 +76,6 @@ D_PAD* ReturnPad( MODULE* module, const wxString& name ) ...@@ -83,136 +76,6 @@ D_PAD* ReturnPad( MODULE* module, const wxString& name )
} }
/*******************************************************************************/
BOARD_ITEM* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
/*******************************************************************************/
/* General locate function
* Display infos relatives to the item found
* return a pointer to this item ( or NULL )
*/
{
int masque_layer;
BOARD_ITEM* item;
item = Locate_Texte_Pcb( m_Pcb->m_Drawings, LayerSearch, typeloc );
if( item )
{
item->Display_Infos( this );
return item;
}
item = Locate_Segment_Pcb( m_Pcb, LayerSearch, typeloc );
if( item )
{
item->Display_Infos( this );
return item;
}
item = Locate_Cotation( m_Pcb, LayerSearch, typeloc );
if( item )
{
item->Display_Infos( this );
return item;
}
item = Locate_MirePcb( m_Pcb->m_Drawings, LayerSearch, typeloc );
if( item != NULL )
{
item->Display_Infos( this ); // MIRES::Display_Infos() not implemented yet.
return item;
}
/* Search for tracks and vias, with via priority */
if( LayerSearch == -1 )
masque_layer = ALL_LAYERS;
else
masque_layer = g_TabOneLayerMask[LayerSearch];
TRACK* Track;
Track = Locate_Pistes( m_Pcb->m_Track, masque_layer, typeloc );
if( Track != NULL )
{
TRACK* TrackLocate = Track; /* a track or a via is found */
/* Search for a via */
while( ( TrackLocate = Locate_Pistes( TrackLocate,
masque_layer, typeloc ) ) != NULL )
{
Track = TrackLocate;
if( TrackLocate->Type() == TYPEVIA )
break;
TrackLocate = (TRACK*) TrackLocate->Pnext;
}
Track->Display_Infos( this );
return Track;
}
item = Locate_Any_Pad( m_Pcb, typeloc );
if( item )
{
item->Display_Infos( this );
return item;
}
/* Search for a footprint text */
// First search: locate texts for footprints on copper or component layer
// Priority to the active layer (component or copper).
// This is useful for small smd components when 2 texts overlap but are not
// on the same layer
if( LayerSearch == COPPER_LAYER_N || LayerSearch == LAYER_CMP_N )
{
MODULE* module = m_Pcb->m_Modules;
for( ; module != NULL; module = (MODULE*) module->Pnext )
{
if( module->GetLayer() != LayerSearch )
continue;
item = LocateTexteModule( m_Pcb, &module, typeloc | VISIBLE_ONLY );
if( item )
{
item->Display_Infos( this );
return item;
}
}
}
// Now Search footprint texts on all layers
MODULE* module;
module = NULL;
item = LocateTexteModule( m_Pcb, &module, typeloc | VISIBLE_ONLY );
if( item )
{
item->Display_Infos( this );
return item;
}
/* Search for a footprint */
item = Locate_Prefered_Module( m_Pcb, typeloc | VISIBLE_ONLY );
if( item )
{
item->Display_Infos( this );
return item;
}
/* Search for zones */
item = Locate_Zone( (TRACK*) m_Pcb->m_Zone,
GetScreen()->m_Active_Layer, typeloc );
if( item )
{
item->Display_Infos( this );
return item;
}
MsgPanel->EraseMsgBox();
return NULL;
}
/*******************************************************************/ /*******************************************************************/
TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer ) TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer )
/*******************************************************************/ /*******************************************************************/
...@@ -286,112 +149,6 @@ D_PAD* Locate_Pad_Connecte( BOARD* Pcb, TRACK* ptr_piste, int extr ) ...@@ -286,112 +149,6 @@ D_PAD* Locate_Pad_Connecte( BOARD* Pcb, TRACK* ptr_piste, int extr )
} }
/****************************************************************/
EDGE_MODULE* Locate_Edge_Module( MODULE* module, int typeloc )
/****************************************************************/
/* Localisation de segments de contour du type edge MODULE
* Les contours sont de differents type:
* simple : succession de droites
* Arcs de cercles : on a alors debut arc, fin arc , centre
* si debut arc = fin arc : cercle complet
*
* Retourne:
* Pointeur sur le segment localise
* NULL si rien trouve
*/
{
if( !module )
return NULL;
/* coord du point de localisation */
wxPoint ref_pos = RefPos( typeloc );
EDA_BaseStruct* PtStruct = module->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{
if( PtStruct->Type() != TYPEEDGEMODULE )
continue;
// calls virtual EDGE_MODULE::HitTest()
if( PtStruct->HitTest( ref_pos ) )
return (EDGE_MODULE*) PtStruct;
}
return NULL;
}
/*************************************************************************/
COTATION* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc )
/*************************************************************************/
/* Serach for a cotation item , on LayerSearch,
* (if LayerSearch == -1 , no yaere restriction )
* return a pointer to the located item, or NULL
*/
{
wxPoint ref_pos = RefPos( typeloc );
BOARD_ITEM* PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
if( PtStruct->Type() != TYPECOTATION )
continue;
// calls virtual COTATION::HitTest()
if( PtStruct->HitTest( ref_pos ) )
return (COTATION*) PtStruct;
}
return NULL;
}
/*************************************************************************/
DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc )
/*************************************************************************/
/* Localisation de segments de contour du type drawing
* Retourne:
* Pointeur sur DEBUT du segment localise
* NULL si rien trouve
* Le segment sur la couche active est dtect en priorite
*/
{
DRAWSEGMENT* locate_segm = NULL;
PCB_SCREEN* screen = (PCB_SCREEN*) ActiveScreen;
wxPoint ref_pos = RefPos( typeloc );
EDA_BaseStruct* PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{
if( PtStruct->Type() != TYPEDRAWSEGMENT )
continue;
DRAWSEGMENT* pts = (DRAWSEGMENT*) PtStruct;
if( (pts->GetLayer() != LayerSearch) && (LayerSearch != -1) )
continue;
if( pts->HitTest( ref_pos ) )
{
// return this hit if layer matches, else remember in
// case no layer match is found.
if( pts->GetLayer() == screen->m_Active_Layer )
return pts;
else if( !locate_segm )
locate_segm = pts;
}
}
return locate_segm;
}
/************************************************* /*************************************************
* D_PAD * Locate_Any_Pad( BOARD* Pcb, int typeloc, bool OnlyCurrentLayer) * D_PAD * Locate_Any_Pad( BOARD* Pcb, int typeloc, bool OnlyCurrentLayer)
* D_PAD* Locate_Any_Pad( BOARD* Pcb, int ref_pos, bool OnlyCurrentLayer) * D_PAD* Locate_Any_Pad( BOARD* Pcb, int ref_pos, bool OnlyCurrentLayer)
...@@ -567,100 +324,6 @@ MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc ) ...@@ -567,100 +324,6 @@ MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
return NULL; return NULL;
} }
/*****************************************************************************/
TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc )
/*****************************************************************************/
/* localisation du texte pointe par la souris (texte sur empreinte)
*
* si * PtModule == NULL; recherche sur tous les modules
* sinon sur le module pointe par module
*
* retourne
* - pointeur sur le texte localise ( ou NULL )
* - si Ptmodule != NULL: pointeur sur module module ( non modifie sinon )
*
* if typeloc has the flag VISIBLE_ONLY set, only footprints which are
* "visible" are considered
*/
{
EDA_BaseStruct* PtStruct;
TEXTE_MODULE* pt_txt_mod;
MODULE* module;
wxPoint ref_pos;
ref_pos = RefPos( typeloc );
module = *PtModule;
if( module == NULL )
{
module = Pcb->m_Modules;
}
for( ; module != NULL; module = (MODULE*) module->Pnext )
{
int layer = module->GetLayer();
if( layer==ADHESIVE_N_CU || layer==SILKSCREEN_N_CU )
layer = COPPER_LAYER_N;
else if( layer==ADHESIVE_N_CMP || layer==SILKSCREEN_N_CMP )
layer = CMP_N;
if( typeloc & VISIBLE_ONLY )
{
if( !IsModuleLayerVisible( layer ) )
continue;
}
if( typeloc & MATCH_LAYER )
{
if( ( (PCB_SCREEN*) ActiveScreen )->m_Active_Layer != layer )
continue;
}
// hit-test the reference text
pt_txt_mod = module->m_Reference;
if( pt_txt_mod->HitTest( ref_pos ) )
{
if( PtModule )
*PtModule = module;
return pt_txt_mod;
}
// hit-test the value text
pt_txt_mod = module->m_Value;
if( pt_txt_mod->HitTest( ref_pos ) )
{
if( PtModule )
*PtModule = module;
return pt_txt_mod;
}
// hit-test any other texts
PtStruct = module->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{
if( PtStruct->Type() != TYPETEXTEMODULE )
continue;
pt_txt_mod = (TEXTE_MODULE*) PtStruct;
if( pt_txt_mod->HitTest( ref_pos ) )
{
if( PtModule )
*PtModule = module;
return pt_txt_mod;
}
}
if( *PtModule != NULL )
break; /* Recherche limitee a 1 seul module */
}
return NULL;
}
/******************************************************************/ /******************************************************************/
inline bool IsPointsAreNear(wxPoint & p1, wxPoint & p2, int max_dist) inline bool IsPointsAreNear(wxPoint & p1, wxPoint & p2, int max_dist)
/******************************************************************/ /******************************************************************/
...@@ -875,7 +538,6 @@ TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos, int MasqueLa ...@@ -875,7 +538,6 @@ TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos, int MasqueLa
return NULL; return NULL;
} }
/****************************************************************/ /****************************************************************/
/* TRACK * Locate_Zone(TRACK * start_adresse, int layer, */ /* TRACK * Locate_Zone(TRACK * start_adresse, int layer, */
/* int typeloc) */ /* int typeloc) */
...@@ -916,37 +578,6 @@ TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer ) ...@@ -916,37 +578,6 @@ TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer )
} }
/************************************************************************************/
TEXTE_PCB* Locate_Texte_Pcb( EDA_BaseStruct* PtStruct, int LayerSearch, int typeloc )
/************************************************************************************/
/* localisation des inscriptions sur le Pcb:
* entree : EDA_BaseStruct pointeur sur le debut de la zone de recherche
* retour : pointeur sur la description du texte localise
*/
{
wxPoint ref = RefPos( typeloc );
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{
if( PtStruct->Type() != TYPETEXTE )
continue;
TEXTE_PCB* pt_txt_pcb = (TEXTE_PCB*) PtStruct;
if( pt_txt_pcb->GetLayer() == LayerSearch )
{
if( pt_txt_pcb->HitTest( ref ) )
{
return pt_txt_pcb;
}
}
}
return NULL;
}
/*******************************************************************************/ /*******************************************************************************/
D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb, const wxPoint& ref_pos, int masque_layer ) D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb, const wxPoint& ref_pos, int masque_layer )
...@@ -1061,33 +692,3 @@ TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr, ...@@ -1061,33 +692,3 @@ TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr,
return NULL; return NULL;
} }
/***********************************************************************/
MIREPCB* Locate_MirePcb( BOARD_ITEM* PtStruct, int LayerSearch, int typeloc )
/***********************************************************************/
/* Search for a photo target
*/
{
wxPoint ref_pos;/* coord du point de localisation */
if( PtStruct == NULL )
return NULL;
ref_pos = RefPos( typeloc );
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
if( PtStruct->Type() != TYPEMIRE )
continue;
if( LayerSearch != -1 && PtStruct->GetLayer() != LayerSearch )
continue;
if( PtStruct->HitTest( ref_pos ) )
break;
}
return (MIREPCB*) PtStruct;
}
...@@ -138,15 +138,6 @@ D_PAD * Locate_Pads(MODULE * Module, const wxPoint & ref_pos,int layer) ; ...@@ -138,15 +138,6 @@ D_PAD * Locate_Pads(MODULE * Module, const wxPoint & ref_pos,int layer) ;
pointeur NULL si pastille non trouvee pointeur NULL si pastille non trouvee
*/ */
TEXTE_MODULE * LocateTexteModule(BOARD * Pcb, MODULE ** Module, int typeloc);
/* localisation du texte pointe par la souris (texte sur empreinte)
si Module == NULL; recherche sur tous les modules
sinon sur le module pointe par Module
retourne
- pointeur sur le texte localise ( ou NULL )
- pointeur sur module Module ( non modifie sinon ) */
MODULE * Locate_Prefered_Module(BOARD * Pcb, int typeloc); MODULE * Locate_Prefered_Module(BOARD * Pcb, int typeloc);
/* localisation d'une empreinte par son rectangle d'encadrement */ /* localisation d'une empreinte par son rectangle d'encadrement */
...@@ -160,25 +151,12 @@ D_PAD * Locate_Pads(MODULE * Module, int typeloc); ...@@ -160,25 +151,12 @@ D_PAD * Locate_Pads(MODULE * Module, int typeloc);
pointeur NULL si pastille non trouvee pointeur NULL si pastille non trouvee
*/ */
EDGE_MODULE * Locate_Edge_Module(MODULE * Module, int typeloc);
/* Localisation de segments de contour du type edge MODULE
Les contours sont de differents type:
simple, Arcs de cercles, box.
Retourne:
Pointeur sur DEBUT du segment localise
NULL si rien trouve
*/
TRACK * Locate_Pistes(TRACK * start_adresse, int typeloc); TRACK * Locate_Pistes(TRACK * start_adresse, int typeloc);
/* routine de localisation du segment de piste pointe par la souris /* routine de localisation du segment de piste pointe par la souris
La recherche commence a l'adresse start_adresse */ La recherche commence a l'adresse start_adresse */
DRAWSEGMENT * Locate_Segment_Pcb(BOARD * Pcb, int LayerSearch , int typeloc) ; DRAWSEGMENT * Locate_Segment_Pcb(BOARD * Pcb, int LayerSearch , int typeloc) ;
TEXTE_PCB * Locate_Texte_Pcb(EDA_BaseStruct * PtStruct, int LayerSearch , int typeloc);
/* localisation des inscriptions sur le Pcb:
la recherche se fait a partir de l'adresse pr_texte */
D_PAD * Fast_Locate_Pad_Connecte(BOARD * Pcb, const wxPoint & ref_pos, int layer); D_PAD * Fast_Locate_Pad_Connecte(BOARD * Pcb, const wxPoint & ref_pos, int layer);
/* Routine cherchant le pad contenant le point px,py, sur la couche layer /* Routine cherchant le pad contenant le point px,py, sur la couche layer
...@@ -203,12 +181,6 @@ TRACK * Locate_Zone(TRACK * start_adresse, const wxPoint & ref_pos,int layer); ...@@ -203,12 +181,6 @@ TRACK * Locate_Zone(TRACK * start_adresse, const wxPoint & ref_pos,int layer);
La recherche commence a l'adresse start_adresse La recherche commence a l'adresse start_adresse
*/ */
COTATION* Locate_Cotation(BOARD * Pcb, int LayerSearch, int typeloc);
/* Localise un element de cotation, en priorite sur la couche active,
et a defaut sur les autres couches
retourne un pointeur sur l'element (TRACK ou TEXTE_PCB) localise
sinon retiurne NULL */
/*************/ /*************/
/* MODULES.C */ /* MODULES.C */
......
...@@ -299,17 +299,17 @@ void WinEDA_PcbFrame::End_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_conta ...@@ -299,17 +299,17 @@ void WinEDA_PcbFrame::End_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_conta
/* Combine zones if possible */ /* Combine zones if possible */
int layer = zone_container->GetLayer(); int layer = zone_container->GetLayer();
for( unsigned ii = 0; ii < m_Pcb->m_ZoneDescriptorList.size(); ii++ ) for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* edge_zone = m_Pcb->m_ZoneDescriptorList[ii]; ZONE_CONTAINER* edge_zone = m_Pcb->GetArea(ii);
if( layer == edge_zone->GetLayer() ) if( layer == edge_zone->GetLayer() )
edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR ); edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
} }
m_Pcb->AreaPolygonModified( zone_container, true, false ); m_Pcb->AreaPolygonModified( zone_container, true, false );
for( unsigned ii = 0; ii < m_Pcb->m_ZoneDescriptorList.size(); ii++ ) for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* edge_zone = m_Pcb->m_ZoneDescriptorList[ii]; ZONE_CONTAINER* edge_zone = m_Pcb->GetArea(ii);
if( layer == edge_zone->GetLayer() ) if( layer == edge_zone->GetLayer() )
edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR ); edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
} }
...@@ -336,9 +336,9 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER * zone_contai ...@@ -336,9 +336,9 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER * zone_contai
if ( DC ) if ( DC )
{ {
for( unsigned ii = 0; ii < m_Pcb->m_ZoneDescriptorList.size(); ii++ ) for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* edge_zone = m_Pcb->m_ZoneDescriptorList[ii]; ZONE_CONTAINER* edge_zone = m_Pcb->GetArea(ii);
if( layer == edge_zone->GetLayer() ) if( layer == edge_zone->GetLayer() )
edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR ); edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
} }
...@@ -350,9 +350,9 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER * zone_contai ...@@ -350,9 +350,9 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER * zone_contai
m_Pcb->AreaPolygonModified( zone_container, true, false ); m_Pcb->AreaPolygonModified( zone_container, true, false );
if ( DC ) if ( DC )
{ {
for( unsigned ii = 0; ii < m_Pcb->m_ZoneDescriptorList.size(); ii++ ) for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* edge_zone = m_Pcb->m_ZoneDescriptorList[ii]; ZONE_CONTAINER* edge_zone = m_Pcb->GetArea(ii);
if( layer == edge_zone->GetLayer() ) if( layer == edge_zone->GetLayer() )
edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR ); edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
} }
...@@ -429,15 +429,15 @@ EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone( wxDC* DC ) ...@@ -429,15 +429,15 @@ EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
EDGE_ZONE* newedge = NULL; EDGE_ZONE* newedge = NULL;
// verify if s_CurrentZone exists: // verify if s_CurrentZone exists:
unsigned ii; int ii;
for( ii = 0; ii < m_Pcb->m_ZoneDescriptorList.size(); ii++ ) for( ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{ {
if( s_CurrentZone == m_Pcb->m_ZoneDescriptorList[ii] ) if( s_CurrentZone == m_Pcb->GetArea(ii) )
break; break;
} }
if( ii == m_Pcb->m_ZoneDescriptorList.size() ) // Not found: coul be deleted since last selection if( ii == m_Pcb->GetAreaCount() ) // Not found: coul be deleted since last selection
{ {
s_AddCutoutToCurrentZone = false; s_AddCutoutToCurrentZone = false;
s_CurrentZone = NULL; s_CurrentZone = NULL;
...@@ -568,9 +568,9 @@ void WinEDA_PcbFrame::End_Zone( wxDC* DC ) ...@@ -568,9 +568,9 @@ void WinEDA_PcbFrame::End_Zone( wxDC* DC )
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
// Undraw old drawings, because they can have important changes // Undraw old drawings, because they can have important changes
for( unsigned ii = 0; ii < m_Pcb->m_ZoneDescriptorList.size(); ii++ ) for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* edge_zone = m_Pcb->m_ZoneDescriptorList[ii]; ZONE_CONTAINER* edge_zone = m_Pcb->GetArea(ii);
if( layer == edge_zone->GetLayer() ) if( layer == edge_zone->GetLayer() )
edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR ); edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
} }
...@@ -629,9 +629,9 @@ void WinEDA_PcbFrame::End_Zone( wxDC* DC ) ...@@ -629,9 +629,9 @@ void WinEDA_PcbFrame::End_Zone( wxDC* DC )
m_Pcb->AreaPolygonModified( new_zone_container, true, false ); m_Pcb->AreaPolygonModified( new_zone_container, true, false );
// Redraw the real edge zone : // Redraw the real edge zone :
for( unsigned ii = 0; ii < m_Pcb->m_ZoneDescriptorList.size(); ii++ ) for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* edge_zone = m_Pcb->m_ZoneDescriptorList[ii]; ZONE_CONTAINER* edge_zone = m_Pcb->GetArea(ii);
if( layer == edge_zone->GetLayer() ) if( layer == edge_zone->GetLayer() )
edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR ); edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
} }
...@@ -712,9 +712,9 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container ...@@ -712,9 +712,9 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
return; return;
// Undraw old zone outlines // Undraw old zone outlines
for( unsigned ii = 0; ii < m_Pcb->m_ZoneDescriptorList.size(); ii++ ) for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* edge_zone = m_Pcb->m_ZoneDescriptorList[ii]; ZONE_CONTAINER* edge_zone = m_Pcb->GetArea(ii);
edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR ); edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
} }
...@@ -732,9 +732,9 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container ...@@ -732,9 +732,9 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
m_Pcb->AreaPolygonModified( zone_container, true, false ); m_Pcb->AreaPolygonModified( zone_container, true, false );
// Redraw the real new zone outlines: // Redraw the real new zone outlines:
for( unsigned ii = 0; ii < m_Pcb->m_ZoneDescriptorList.size(); ii++ ) for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* edge_zone = m_Pcb->m_ZoneDescriptorList[ii]; ZONE_CONTAINER* edge_zone = m_Pcb->GetArea(ii);
edge_zone->m_Flags = 0; edge_zone->m_Flags = 0;
edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR ); edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
} }
...@@ -867,9 +867,9 @@ int WinEDA_PcbFrame::Fill_All_Zones( wxDC* DC, bool verbose ) ...@@ -867,9 +867,9 @@ int WinEDA_PcbFrame::Fill_All_Zones( wxDC* DC, bool verbose )
m_Pcb->m_NbSegmZone = 0; m_Pcb->m_NbSegmZone = 0;
} }
for( unsigned ii = 0; ii < m_Pcb->m_ZoneDescriptorList.size(); ii++ ) for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{ {
zone_container = m_Pcb->m_ZoneDescriptorList[ii]; zone_container = m_Pcb->GetArea(ii);
error_level = Fill_Zone( NULL, zone_container, verbose ); error_level = Fill_Zone( NULL, zone_container, verbose );
if( error_level && !verbose ) if( error_level && !verbose )
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment