zones work

This commit is contained in:
dickelbeck 2007-10-31 20:02:34 +00:00
parent 2a2bf46920
commit 3c74b2e5c3
6 changed files with 90 additions and 74 deletions

View File

@ -16,9 +16,14 @@ email address.
+ all + all
* Added Doxygen configuration file, whose standard name is Doxyfile. Output * Added Doxygen configuration file, whose standard name is Doxyfile. Output
is set to go to ./doxygen directory just off the project tree. is set to go to ./doxygen directory just off the project tree.
* added a note to todo.txt which asks folks to start using "Doxygen compatible" * Added a note to todo.txt which asks folks to start using "Doxygen compatible"
comments in member functions and classes. Run Doxygen on the project, then comments in member functions and classes. Run Doxygen on the project, then
look at the documentation for class INSPECTOR as an example. look at the documentation for class INSPECTOR as an example.
+ pcbnew
zones.cpp, Trace_Pcb(), & EDGE_ZONE class:
Reversed the usage of EDGE_ZONE::Pnext and Pback in the list management to be
consistent with other classes and with INSPECTOR::Inspect() and
BOARD::~BOARD().
2007-Oct-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2007-Oct-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>

View File

@ -247,14 +247,16 @@ void Trace_DrawSegmentPcb( WinEDA_DrawPanel* panel, wxDC* DC,
/* coord de depart */ /* coord de depart */
ux0 = PtDrawSegment->m_Start.x; ux0 = PtDrawSegment->m_Start.x;
uy0 = PtDrawSegment->m_Start.y; uy0 = PtDrawSegment->m_Start.y;
/* coord d'arrivee */ /* coord d'arrivee */
dx = PtDrawSegment->m_End.x; dx = PtDrawSegment->m_End.x;
dy = PtDrawSegment->m_End.y; dy = PtDrawSegment->m_End.y;
mode = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH; mode = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH;
if( PtDrawSegment->m_Flags & FORCE_SKETCH ) if( PtDrawSegment->m_Flags & FORCE_SKETCH )
mode = SKETCH; mode = SKETCH;
if( l_piste < (L_MIN_DESSIN * zoom) ) if( l_piste < (L_MIN_DESSIN * zoom) )
mode = FILAIRE; mode = FILAIRE;

View File

@ -433,6 +433,8 @@ public:
EDGE_ZONE* Next() { return (EDGE_ZONE*) Pnext; } EDGE_ZONE* Next() { return (EDGE_ZONE*) Pnext; }
EDGE_ZONE* Back() { return (EDGE_ZONE*) Pback; }
/** /**
* Function Save * Function Save

View File

@ -37,9 +37,9 @@
/** /**
* Class COLLECTORS_GUIDE * Class COLLECTORS_GUIDE
* is an abstract base class whose derivatives may be passed to a GENERALCOLLECTOR, * is an abstract base class whose derivatives may be passed to a GENERAL_COLLECTOR,
* telling GENERALCOLLECTOR what should be collected (aside from HitTest()ing * telling GENERAL_COLLECTOR what should be collected (aside from HitTest()ing
* and KICAD_T scanTypes[], information which are provided to the GENERALCOLLECTOR * and KICAD_T scanTypes[], information which are provided to the GENERAL_COLLECTOR
* through attributes or arguments separately). * through attributes or arguments separately).
* <p> * <p>
* A justification for this class is to keep the structural storage details of * A justification for this class is to keep the structural storage details of
@ -113,7 +113,7 @@ public:
/** /**
* Function IgnoreMTextsMarkedNoShow * Function IgnoreMTextsMarkedNoShow
* @return bool -true if MTexts marked as "no show" should be ignored. * @return bool - true if MTexts marked as "no show" should be ignored.
*/ */
virtual bool IgnoreMTextsMarkedNoShow() const = 0; virtual bool IgnoreMTextsMarkedNoShow() const = 0;
@ -302,7 +302,7 @@ public:
/** /**
* Function Collect * Function Collect
* scans a BOARD using this class's Inspector method, which does the collection. * scans a BOARD_ITEM using this class's Inspector method, which does the collection.
* @param aItem A BOARD_ITEM to scan, may be a BOARD or MODULE, or whatever. * @param aItem A BOARD_ITEM to scan, may be a BOARD or MODULE, or whatever.
* @param aScanList A list of KICAD_Ts with a terminating EOT, that specs * @param aScanList A list of KICAD_Ts with a terminating EOT, that specs
* what is to be collected and the priority order of the resultant * what is to be collected and the priority order of the resultant
@ -460,7 +460,7 @@ public:
/** /**
* Function IgnoreMTextsMarkedNoShow * Function IgnoreMTextsMarkedNoShow
* @return bool -true if MTexts marked as "no show" should be ignored. * @return bool - true if MTexts marked as "no show" should be ignored.
*/ */
bool IgnoreMTextsMarkedNoShow() const { return m_IgnoreMTextsMarkedNoShow; } bool IgnoreMTextsMarkedNoShow() const { return m_IgnoreMTextsMarkedNoShow; }
void SetIgnoreMTextsMarkedNoShow( bool ignore ) { m_IgnoreMTextsMarkedNoShow = ignore; } void SetIgnoreMTextsMarkedNoShow( bool ignore ) { m_IgnoreMTextsMarkedNoShow = ignore; }

View File

@ -176,8 +176,8 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode )
if( g_HightLigt_Status ) if( g_HightLigt_Status )
DrawHightLight( DC, g_HightLigth_NetCode ); DrawHightLight( DC, g_HightLigth_NetCode );
EDGE_ZONE* segment = m_Pcb->m_CurrentLimitZone; EDGE_ZONE* segment;
for( ; segment != NULL; segment = (EDGE_ZONE*) segment->Pback ) for( segment = m_Pcb->m_CurrentLimitZone; segment; segment = segment->Next() )
{ {
if( segment->m_Flags & IS_MOVED ) if( segment->m_Flags & IS_MOVED )
continue; continue;

View File

@ -433,24 +433,22 @@ void WinEDA_PcbFrame::Edit_Zone_Width( wxDC* DC, SEGZONE* aZone )
/**********************************************************/ /**********************************************************/
void WinEDA_PcbFrame::Delete_Zone( wxDC* DC, SEGZONE* Zone ) void WinEDA_PcbFrame::Delete_Zone( wxDC* DC, SEGZONE* aZone )
/**********************************************************/ /**********************************************************/
/* Efface la zone Zone. /* Efface la zone Zone.
* La zone est constituee des segments zones de meme TimeStamp * La zone est constituee des segments zones de meme TimeStamp
*/ */
{ {
unsigned long TimeStamp;
int nb_segm = 0; int nb_segm = 0;
bool modify = FALSE; bool modify = FALSE;
TimeStamp = Zone->m_TimeStamp;
SEGZONE* next; SEGZONE* next;
for( SEGZONE* zone = m_Pcb->m_Zone; zone; zone = next ) for( SEGZONE* zone = m_Pcb->m_Zone; zone; zone = next )
{ {
next = zone->Next(); next = zone->Next();
if( zone->m_TimeStamp == TimeStamp )
if( zone->m_TimeStamp == aZone->m_TimeStamp )
{ {
modify = TRUE; modify = TRUE;
@ -473,28 +471,27 @@ EDGE_ZONE* WinEDA_PcbFrame::Del_SegmEdgeZone( wxDC* DC, EDGE_ZONE* edge_zone )
/*****************************************************************************/ /*****************************************************************************/
/* Routine d'effacement du segment de limite zone en cours de trace */ /* Routine d'effacement du segment de limite zone en cours de trace */
{ {
EDGE_ZONE* Segm, * previous_segm; EDGE_ZONE* segm;
if( m_Pcb->m_CurrentLimitZone ) if( m_Pcb->m_CurrentLimitZone )
Segm = m_Pcb->m_CurrentLimitZone; segm = m_Pcb->m_CurrentLimitZone;
else else
Segm = edge_zone; segm = edge_zone;
if( Segm == NULL ) if( segm == NULL )
return NULL; return NULL;
Trace_DrawSegmentPcb( DrawPanel, DC, Segm, GR_XOR ); Trace_DrawSegmentPcb( DrawPanel, DC, segm, GR_XOR );
previous_segm = (EDGE_ZONE*) Segm->Pback; m_Pcb->m_CurrentLimitZone = segm->Next();
delete Segm; delete segm;
Segm = previous_segm; segm = m_Pcb->m_CurrentLimitZone;
m_Pcb->m_CurrentLimitZone = Segm; SetCurItem( segm );
SetCurItem( Segm );
if( Segm ) if( segm )
{ {
Segm->Pnext = NULL; segm->Pback = NULL;
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE ); DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
} }
@ -504,7 +501,7 @@ EDGE_ZONE* WinEDA_PcbFrame::Del_SegmEdgeZone( wxDC* DC, EDGE_ZONE* edge_zone )
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL ); SetCurItem( NULL );
} }
return Segm; return segm;
} }
@ -639,20 +636,18 @@ void WinEDA_BasePcbFrame::DelLimitesZone( wxDC* DC, bool Redraw )
return; return;
// erase the old zone border, one segment at a time // erase the old zone border, one segment at a time
segment = m_Pcb->m_CurrentLimitZone; for( segment = m_Pcb->m_CurrentLimitZone; segment; segment = next )
for( ; segment != NULL; segment = next )
{ {
next = (EDGE_ZONE*) segment->Pback; next = segment->Next();
if( Redraw ) if( Redraw )
Trace_DrawSegmentPcb( DrawPanel, DC, segment, GR_XOR ); Trace_DrawSegmentPcb( DrawPanel, DC, segment, GR_XOR );
segment->Pnext = NULL;
delete segment; delete segment;
} }
m_Pcb->m_CurrentLimitZone = NULL;
SetCurItem( NULL ); SetCurItem( NULL );
m_Pcb->m_CurrentLimitZone = NULL;
} }
@ -678,10 +673,10 @@ EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone()
newedge->SetLayer( GetScreen()->m_Active_Layer ); newedge->SetLayer( GetScreen()->m_Active_Layer );
// link into list: // link into list:
newedge->Pback = oldedge; newedge->Pnext = oldedge;
if( oldedge ) if( oldedge )
oldedge->Pnext = newedge; oldedge->Pback = newedge;
m_Pcb->m_CurrentLimitZone = newedge; m_Pcb->m_CurrentLimitZone = newedge;
@ -701,8 +696,8 @@ EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone()
newedge->SetLayer( GetScreen()->m_Active_Layer ); newedge->SetLayer( GetScreen()->m_Active_Layer );
// link into list: // link into list:
newedge->Pback = oldedge; newedge->Pnext = oldedge;
oldedge->Pnext = newedge; oldedge->Pback = newedge;
m_Pcb->m_CurrentLimitZone = newedge; m_Pcb->m_CurrentLimitZone = newedge;
} }
} }
@ -719,7 +714,7 @@ void WinEDA_PcbFrame::End_Zone( wxDC* DC )
* Routine de fin de trace d'une zone (succession de segments) * Routine de fin de trace d'une zone (succession de segments)
*/ */
{ {
EDGE_ZONE* PtLim; EDGE_ZONE* edge;
if( m_Pcb->m_CurrentLimitZone ) if( m_Pcb->m_CurrentLimitZone )
{ {
@ -727,22 +722,22 @@ void WinEDA_PcbFrame::End_Zone( wxDC* DC )
/* le dernier point genere est de longueur tj nulle donc inutile. */ /* le dernier point genere est de longueur tj nulle donc inutile. */
/* il sera raccorde au point de depart */ /* il sera raccorde au point de depart */
PtLim = m_Pcb->m_CurrentLimitZone; edge = m_Pcb->m_CurrentLimitZone;
PtLim->m_Flags &= ~(IS_NEW | IS_MOVED); edge->m_Flags &= ~(IS_NEW | IS_MOVED);
while( PtLim && PtLim->Pback ) while( edge && edge->Next() )
{ {
PtLim = (EDGE_ZONE*) PtLim->Pback; edge = edge->Next();
if( PtLim->m_Flags & STARTPOINT ) if( edge->m_Flags & STARTPOINT )
break; break;
PtLim->m_Flags &= ~(IS_NEW | IS_MOVED); edge->m_Flags &= ~(IS_NEW | IS_MOVED);
} }
if( PtLim ) if( edge )
{ {
PtLim->m_Flags &= ~(IS_NEW | IS_MOVED); edge->m_Flags &= ~(IS_NEW | IS_MOVED);
m_Pcb->m_CurrentLimitZone->m_End = PtLim->m_Start; m_Pcb->m_CurrentLimitZone->m_End = edge->m_Start;
} }
Trace_DrawSegmentPcb( DrawPanel, DC, m_Pcb->m_CurrentLimitZone, GR_XOR ); Trace_DrawSegmentPcb( DrawPanel, DC, m_Pcb->m_CurrentLimitZone, GR_XOR );
} }
@ -759,8 +754,9 @@ static void Show_Zone_Edge_While_MoveMouse( WinEDA_DrawPanel* panel, wxDC* DC, b
/* redessin du contour de la piste lors des deplacements de la souris /* redessin du contour de la piste lors des deplacements de la souris
*/ */
{ {
EDGE_ZONE* PtLim, * edgezone; EDGE_ZONE* edge;
WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) panel->m_Parent; EDGE_ZONE* currentEdge;
WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) panel->m_Parent;
if( pcbframe->m_Pcb->m_CurrentLimitZone == NULL ) if( pcbframe->m_Pcb->m_CurrentLimitZone == NULL )
return; return;
@ -768,37 +764,37 @@ static void Show_Zone_Edge_While_MoveMouse( WinEDA_DrawPanel* panel, wxDC* DC, b
/* efface ancienne position si elle a ete deja dessinee */ /* efface ancienne position si elle a ete deja dessinee */
if( erase ) if( erase )
{ {
PtLim = pcbframe->m_Pcb->m_CurrentLimitZone; edge = pcbframe->m_Pcb->m_CurrentLimitZone;
for( ; PtLim != NULL; PtLim = (EDGE_ZONE*) PtLim->Pback ) // for( ; edge; edge = edge->Next() )
{ {
Trace_DrawSegmentPcb( panel, DC, PtLim, GR_XOR ); Trace_DrawSegmentPcb( panel, DC, edge, GR_XOR );
} }
} }
/* mise a jour de la couche */ /* mise a jour de la couche */
edgezone = PtLim = pcbframe->m_Pcb->m_CurrentLimitZone; for( edge = pcbframe->m_Pcb->m_CurrentLimitZone; edge; edge = edge->Next() )
for( ; PtLim != NULL; PtLim = (EDGE_ZONE*) PtLim->Pback )
{ {
PtLim->SetLayer( pcbframe->GetScreen()->m_Active_Layer ); edge->SetLayer( pcbframe->GetScreen()->m_Active_Layer );
} }
/* dessin de la nouvelle piste : mise a jour du point d'arrivee */ /* dessin de la nouvelle piste : mise a jour du point d'arrivee */
currentEdge = pcbframe->m_Pcb->m_CurrentLimitZone;
if( Zone_45_Only ) if( Zone_45_Only )
{/* Calcul de l'extremite de la piste pour orientations permises: {
* horiz,vertical ou 45 degre */ // Calcul de l'extremite de la piste pour orientations permises:
edgezone->m_End = pcbframe->GetScreen()->m_Curseur; // horiz,vertical ou 45 degre
Calcule_Coord_Extremite_45( edgezone->m_Start.x, edgezone->m_Start.y, currentEdge->m_End = pcbframe->GetScreen()->m_Curseur;
&edgezone->m_End.x, &edgezone->m_End.y ); Calcule_Coord_Extremite_45( currentEdge->m_Start.x, currentEdge->m_Start.y,
&currentEdge->m_End.x, &currentEdge->m_End.y );
} }
else /* ici l'angle d'inclinaison est quelconque */ else /* ici l'angle d'inclinaison est quelconque */
{ {
edgezone->m_End = pcbframe->GetScreen()->m_Curseur; currentEdge->m_End = pcbframe->GetScreen()->m_Curseur;
} }
PtLim = edgezone; // for( ; currentEdge; currentEdge = currentEdge->Next() )
for( ; PtLim != NULL; PtLim = (EDGE_ZONE*) PtLim->Pback )
{ {
Trace_DrawSegmentPcb( panel, DC, PtLim, GR_XOR ); Trace_DrawSegmentPcb( panel, DC, currentEdge, GR_XOR );
} }
} }
@ -852,7 +848,7 @@ void WinEDA_PcbFrame::Fill_Zone( wxDC* DC )
/* mise a jour de la couche */ /* mise a jour de la couche */
PtLim = m_Pcb->m_CurrentLimitZone; PtLim = m_Pcb->m_CurrentLimitZone;
for( ; PtLim != NULL; PtLim = (EDGE_ZONE*) PtLim->Pback ) for( ; PtLim != NULL; PtLim = PtLim->Next() )
{ {
Trace_DrawSegmentPcb( DrawPanel, DC, PtLim, GR_XOR ); Trace_DrawSegmentPcb( DrawPanel, DC, PtLim, GR_XOR );
PtLim->SetLayer( GetScreen()->m_Active_Layer ); PtLim->SetLayer( GetScreen()->m_Active_Layer );
@ -930,7 +926,7 @@ void WinEDA_PcbFrame::Fill_Zone( wxDC* DC )
/* Init des points d'accrochage possibles de la zone: /* Init des points d'accrochage possibles de la zone:
* les pistes du net sont des points d'accrochage convenables*/ * les pistes du net sont des points d'accrochage convenables*/
TRACK* pt_segm = m_Pcb->m_Track; TRACK* pt_segm = m_Pcb->m_Track;
for( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext ) for( ; pt_segm != NULL; pt_segm = pt_segm->Next() )
{ {
if( g_HightLigth_NetCode != pt_segm->GetNet() ) if( g_HightLigth_NetCode != pt_segm->GetNet() )
continue; continue;
@ -950,8 +946,7 @@ void WinEDA_PcbFrame::Fill_Zone( wxDC* DC )
Route_Layer_BOTTOM = Route_Layer_TOP = GetScreen()->m_Active_Layer; Route_Layer_BOTTOM = Route_Layer_TOP = GetScreen()->m_Active_Layer;
/* Trace des limites de la zone sur la matrice de routage: */ /* Trace des limites de la zone sur la matrice de routage: */
PtLim = m_Pcb->m_CurrentLimitZone; for( PtLim = m_Pcb->m_CurrentLimitZone; PtLim; PtLim=PtLim->Next() )
for( ; PtLim != NULL; PtLim = (EDGE_ZONE*) PtLim->Pback )
{ {
int ux0, uy0, ux1, uy1; int ux0, uy0, ux1, uy1;
ux0 = PtLim->m_Start.x - m_Pcb->m_BoundaryBox.m_Pos.x; ux0 = PtLim->m_Start.x - m_Pcb->m_BoundaryBox.m_Pos.x;
@ -1000,8 +995,7 @@ void WinEDA_PcbFrame::Fill_Zone( wxDC* DC )
/* Trace des limites de la zone sur la matrice de routage /* Trace des limites de la zone sur la matrice de routage
* (a pu etre detruit par PlaceCells()) : */ * (a pu etre detruit par PlaceCells()) : */
PtLim = m_Pcb->m_CurrentLimitZone; for( PtLim = m_Pcb->m_CurrentLimitZone; PtLim; PtLim = PtLim->Next() )
for( ; PtLim != NULL; PtLim = (EDGE_ZONE*) PtLim->Pback )
{ {
int ux0, uy0, ux1, uy1; int ux0, uy0, ux1, uy1;
ux0 = PtLim->m_Start.x - m_Pcb->m_BoundaryBox.m_Pos.x; ux0 = PtLim->m_Start.x - m_Pcb->m_BoundaryBox.m_Pos.x;
@ -1103,10 +1097,17 @@ static void Genere_Segments_Zone( WinEDA_PcbFrame* frame, wxDC* DC, int net_code
pt_track = new SEGZONE( frame->m_Pcb ); pt_track = new SEGZONE( frame->m_Pcb );
pt_track->SetLayer( layer ); pt_track->SetLayer( layer );
pt_track->SetNet( net_code ); pt_track->SetNet( net_code );
pt_track->m_Width = g_GridRoutingSize; pt_track->m_Width = g_GridRoutingSize;
pt_track->m_Start.x = ux0; pt_track->m_Start.y = uy0;
pt_track->m_End.x = ux1; pt_track->m_End.y = uy1; pt_track->m_Start.x = ux0;
pt_track->m_Start.y = uy0;
pt_track->m_End.x = ux1;
pt_track->m_End.y = uy1;
pt_track->m_TimeStamp = s_TimeStamp; pt_track->m_TimeStamp = s_TimeStamp;
pt_track->Insert( frame->m_Pcb, NULL ); pt_track->Insert( frame->m_Pcb, NULL );
pt_track->Draw( frame->DrawPanel, DC, GR_OR ); pt_track->Draw( frame->DrawPanel, DC, GR_OR );
nbsegm++; nbsegm++;
@ -1142,8 +1143,13 @@ static void Genere_Segments_Zone( WinEDA_PcbFrame* frame, wxDC* DC, int net_code
pt_track->SetLayer( layer ); pt_track->SetLayer( layer );
pt_track->m_Width = g_GridRoutingSize; pt_track->m_Width = g_GridRoutingSize;
pt_track->SetNet( net_code ); pt_track->SetNet( net_code );
pt_track->m_Start.x = ux0; pt_track->m_Start.y = uy0;
pt_track->m_End.x = ux1; pt_track->m_End.y = uy1; pt_track->m_Start.x = ux0;
pt_track->m_Start.y = uy0;
pt_track->m_End.x = ux1;
pt_track->m_End.y = uy1;
pt_track->m_TimeStamp = s_TimeStamp; pt_track->m_TimeStamp = s_TimeStamp;
pt_track->Insert( frame->m_Pcb, NULL ); pt_track->Insert( frame->m_Pcb, NULL );
pt_track->Draw( frame->DrawPanel, DC, GR_OR ); pt_track->Draw( frame->DrawPanel, DC, GR_OR );
@ -1314,6 +1320,7 @@ static bool Genere_Pad_Connexion( WinEDA_PcbFrame* frame, wxDC* DC, int layer )
if( frame->m_Pcb->m_Zone == NULL ) if( frame->m_Pcb->m_Zone == NULL )
return FALSE; /* pas de zone */ return FALSE; /* pas de zone */
if( frame->m_Pcb->m_Zone->m_TimeStamp != s_TimeStamp ) /* c'est une autre zone */ if( frame->m_Pcb->m_Zone->m_TimeStamp != s_TimeStamp ) /* c'est une autre zone */
return FALSE; return FALSE;