zones work
This commit is contained in:
parent
2a2bf46920
commit
3c74b2e5c3
|
@ -16,9 +16,14 @@ email address.
|
|||
+ all
|
||||
* Added Doxygen configuration file, whose standard name is Doxyfile. Output
|
||||
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
|
||||
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>
|
||||
|
|
|
@ -247,14 +247,16 @@ void Trace_DrawSegmentPcb( WinEDA_DrawPanel* panel, wxDC* DC,
|
|||
/* coord de depart */
|
||||
ux0 = PtDrawSegment->m_Start.x;
|
||||
uy0 = PtDrawSegment->m_Start.y;
|
||||
|
||||
/* coord d'arrivee */
|
||||
dx = PtDrawSegment->m_End.x;
|
||||
dy = PtDrawSegment->m_End.y;
|
||||
|
||||
|
||||
mode = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH;
|
||||
|
||||
if( PtDrawSegment->m_Flags & FORCE_SKETCH )
|
||||
mode = SKETCH;
|
||||
|
||||
if( l_piste < (L_MIN_DESSIN * zoom) )
|
||||
mode = FILAIRE;
|
||||
|
||||
|
|
|
@ -433,6 +433,8 @@ public:
|
|||
|
||||
EDGE_ZONE* Next() { return (EDGE_ZONE*) Pnext; }
|
||||
|
||||
EDGE_ZONE* Back() { return (EDGE_ZONE*) Pback; }
|
||||
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
|
||||
/**
|
||||
* Class COLLECTORS_GUIDE
|
||||
* is an abstract base class whose derivatives may be passed to a GENERALCOLLECTOR,
|
||||
* telling GENERALCOLLECTOR what should be collected (aside from HitTest()ing
|
||||
* and KICAD_T scanTypes[], information which are provided to the GENERALCOLLECTOR
|
||||
* is an abstract base class whose derivatives may be passed to a GENERAL_COLLECTOR,
|
||||
* telling GENERAL_COLLECTOR what should be collected (aside from HitTest()ing
|
||||
* and KICAD_T scanTypes[], information which are provided to the GENERAL_COLLECTOR
|
||||
* through attributes or arguments separately).
|
||||
* <p>
|
||||
* A justification for this class is to keep the structural storage details of
|
||||
|
@ -302,7 +302,7 @@ public:
|
|||
|
||||
/**
|
||||
* 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 aScanList A list of KICAD_Ts with a terminating EOT, that specs
|
||||
* what is to be collected and the priority order of the resultant
|
||||
|
|
|
@ -176,8 +176,8 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode )
|
|||
if( g_HightLigt_Status )
|
||||
DrawHightLight( DC, g_HightLigth_NetCode );
|
||||
|
||||
EDGE_ZONE* segment = m_Pcb->m_CurrentLimitZone;
|
||||
for( ; segment != NULL; segment = (EDGE_ZONE*) segment->Pback )
|
||||
EDGE_ZONE* segment;
|
||||
for( segment = m_Pcb->m_CurrentLimitZone; segment; segment = segment->Next() )
|
||||
{
|
||||
if( segment->m_Flags & IS_MOVED )
|
||||
continue;
|
||||
|
|
133
pcbnew/zones.cpp
133
pcbnew/zones.cpp
|
@ -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.
|
||||
* La zone est constituee des segments zones de meme TimeStamp
|
||||
*/
|
||||
{
|
||||
unsigned long TimeStamp;
|
||||
int nb_segm = 0;
|
||||
bool modify = FALSE;
|
||||
|
||||
TimeStamp = Zone->m_TimeStamp;
|
||||
|
||||
SEGZONE* next;
|
||||
for( SEGZONE* zone = m_Pcb->m_Zone; zone; zone = next )
|
||||
{
|
||||
next = zone->Next();
|
||||
if( zone->m_TimeStamp == TimeStamp )
|
||||
|
||||
if( zone->m_TimeStamp == aZone->m_TimeStamp )
|
||||
{
|
||||
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 */
|
||||
{
|
||||
EDGE_ZONE* Segm, * previous_segm;
|
||||
EDGE_ZONE* segm;
|
||||
|
||||
if( m_Pcb->m_CurrentLimitZone )
|
||||
Segm = m_Pcb->m_CurrentLimitZone;
|
||||
segm = m_Pcb->m_CurrentLimitZone;
|
||||
else
|
||||
Segm = edge_zone;
|
||||
segm = edge_zone;
|
||||
|
||||
if( Segm == NULL )
|
||||
if( segm == NULL )
|
||||
return NULL;
|
||||
|
||||
Trace_DrawSegmentPcb( DrawPanel, DC, Segm, GR_XOR );
|
||||
Trace_DrawSegmentPcb( DrawPanel, DC, segm, GR_XOR );
|
||||
|
||||
previous_segm = (EDGE_ZONE*) Segm->Pback;
|
||||
delete Segm;
|
||||
m_Pcb->m_CurrentLimitZone = segm->Next();
|
||||
delete segm;
|
||||
|
||||
Segm = previous_segm;
|
||||
m_Pcb->m_CurrentLimitZone = Segm;
|
||||
SetCurItem( Segm );
|
||||
segm = m_Pcb->m_CurrentLimitZone;
|
||||
SetCurItem( segm );
|
||||
|
||||
if( Segm )
|
||||
if( segm )
|
||||
{
|
||||
Segm->Pnext = NULL;
|
||||
segm->Pback = NULL;
|
||||
if( DrawPanel->ManageCurseur )
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
|
||||
}
|
||||
|
@ -504,7 +501,7 @@ EDGE_ZONE* WinEDA_PcbFrame::Del_SegmEdgeZone( wxDC* DC, EDGE_ZONE* edge_zone )
|
|||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
SetCurItem( NULL );
|
||||
}
|
||||
return Segm;
|
||||
return segm;
|
||||
}
|
||||
|
||||
|
||||
|
@ -639,20 +636,18 @@ void WinEDA_BasePcbFrame::DelLimitesZone( wxDC* DC, bool Redraw )
|
|||
return;
|
||||
|
||||
// erase the old zone border, one segment at a time
|
||||
segment = m_Pcb->m_CurrentLimitZone;
|
||||
for( ; segment != NULL; segment = next )
|
||||
for( segment = m_Pcb->m_CurrentLimitZone; segment; segment = next )
|
||||
{
|
||||
next = (EDGE_ZONE*) segment->Pback;
|
||||
next = segment->Next();
|
||||
|
||||
if( Redraw )
|
||||
Trace_DrawSegmentPcb( DrawPanel, DC, segment, GR_XOR );
|
||||
|
||||
segment->Pnext = NULL;
|
||||
delete segment;
|
||||
}
|
||||
m_Pcb->m_CurrentLimitZone = NULL;
|
||||
|
||||
SetCurItem( NULL );
|
||||
m_Pcb->m_CurrentLimitZone = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -678,10 +673,10 @@ EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone()
|
|||
newedge->SetLayer( GetScreen()->m_Active_Layer );
|
||||
|
||||
// link into list:
|
||||
newedge->Pback = oldedge;
|
||||
newedge->Pnext = oldedge;
|
||||
|
||||
if( oldedge )
|
||||
oldedge->Pnext = newedge;
|
||||
oldedge->Pback = newedge;
|
||||
|
||||
m_Pcb->m_CurrentLimitZone = newedge;
|
||||
|
||||
|
@ -701,8 +696,8 @@ EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone()
|
|||
newedge->SetLayer( GetScreen()->m_Active_Layer );
|
||||
|
||||
// link into list:
|
||||
newedge->Pback = oldedge;
|
||||
oldedge->Pnext = newedge;
|
||||
newedge->Pnext = oldedge;
|
||||
oldedge->Pback = 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)
|
||||
*/
|
||||
{
|
||||
EDGE_ZONE* PtLim;
|
||||
EDGE_ZONE* edge;
|
||||
|
||||
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. */
|
||||
/* il sera raccorde au point de depart */
|
||||
PtLim = m_Pcb->m_CurrentLimitZone;
|
||||
PtLim->m_Flags &= ~(IS_NEW | IS_MOVED);
|
||||
edge = m_Pcb->m_CurrentLimitZone;
|
||||
edge->m_Flags &= ~(IS_NEW | IS_MOVED);
|
||||
|
||||
while( PtLim && PtLim->Pback )
|
||||
while( edge && edge->Next() )
|
||||
{
|
||||
PtLim = (EDGE_ZONE*) PtLim->Pback;
|
||||
if( PtLim->m_Flags & STARTPOINT )
|
||||
edge = edge->Next();
|
||||
if( edge->m_Flags & STARTPOINT )
|
||||
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);
|
||||
m_Pcb->m_CurrentLimitZone->m_End = PtLim->m_Start;
|
||||
edge->m_Flags &= ~(IS_NEW | IS_MOVED);
|
||||
m_Pcb->m_CurrentLimitZone->m_End = edge->m_Start;
|
||||
}
|
||||
Trace_DrawSegmentPcb( DrawPanel, DC, m_Pcb->m_CurrentLimitZone, GR_XOR );
|
||||
}
|
||||
|
@ -759,7 +754,8 @@ 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
|
||||
*/
|
||||
{
|
||||
EDGE_ZONE* PtLim, * edgezone;
|
||||
EDGE_ZONE* edge;
|
||||
EDGE_ZONE* currentEdge;
|
||||
WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) panel->m_Parent;
|
||||
|
||||
if( pcbframe->m_Pcb->m_CurrentLimitZone == NULL )
|
||||
|
@ -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 */
|
||||
if( erase )
|
||||
{
|
||||
PtLim = pcbframe->m_Pcb->m_CurrentLimitZone;
|
||||
for( ; PtLim != NULL; PtLim = (EDGE_ZONE*) PtLim->Pback )
|
||||
edge = pcbframe->m_Pcb->m_CurrentLimitZone;
|
||||
// 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 */
|
||||
edgezone = PtLim = pcbframe->m_Pcb->m_CurrentLimitZone;
|
||||
for( ; PtLim != NULL; PtLim = (EDGE_ZONE*) PtLim->Pback )
|
||||
for( edge = pcbframe->m_Pcb->m_CurrentLimitZone; edge; edge = edge->Next() )
|
||||
{
|
||||
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 */
|
||||
currentEdge = pcbframe->m_Pcb->m_CurrentLimitZone;
|
||||
if( Zone_45_Only )
|
||||
{/* Calcul de l'extremite de la piste pour orientations permises:
|
||||
* horiz,vertical ou 45 degre */
|
||||
edgezone->m_End = pcbframe->GetScreen()->m_Curseur;
|
||||
Calcule_Coord_Extremite_45( edgezone->m_Start.x, edgezone->m_Start.y,
|
||||
&edgezone->m_End.x, &edgezone->m_End.y );
|
||||
{
|
||||
// Calcul de l'extremite de la piste pour orientations permises:
|
||||
// horiz,vertical ou 45 degre
|
||||
currentEdge->m_End = pcbframe->GetScreen()->m_Curseur;
|
||||
Calcule_Coord_Extremite_45( currentEdge->m_Start.x, currentEdge->m_Start.y,
|
||||
¤tEdge->m_End.x, ¤tEdge->m_End.y );
|
||||
}
|
||||
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( ; PtLim != NULL; PtLim = (EDGE_ZONE*) PtLim->Pback )
|
||||
// for( ; currentEdge; currentEdge = currentEdge->Next() )
|
||||
{
|
||||
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 */
|
||||
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 );
|
||||
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:
|
||||
* les pistes du net sont des points d'accrochage convenables*/
|
||||
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() )
|
||||
continue;
|
||||
|
@ -950,8 +946,7 @@ void WinEDA_PcbFrame::Fill_Zone( wxDC* DC )
|
|||
Route_Layer_BOTTOM = Route_Layer_TOP = GetScreen()->m_Active_Layer;
|
||||
|
||||
/* Trace des limites de la zone sur la matrice de routage: */
|
||||
PtLim = m_Pcb->m_CurrentLimitZone;
|
||||
for( ; PtLim != NULL; PtLim = (EDGE_ZONE*) PtLim->Pback )
|
||||
for( PtLim = m_Pcb->m_CurrentLimitZone; PtLim; PtLim=PtLim->Next() )
|
||||
{
|
||||
int ux0, uy0, ux1, uy1;
|
||||
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
|
||||
* (a pu etre detruit par PlaceCells()) : */
|
||||
PtLim = m_Pcb->m_CurrentLimitZone;
|
||||
for( ; PtLim != NULL; PtLim = (EDGE_ZONE*) PtLim->Pback )
|
||||
for( PtLim = m_Pcb->m_CurrentLimitZone; PtLim; PtLim = PtLim->Next() )
|
||||
{
|
||||
int ux0, uy0, ux1, uy1;
|
||||
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->SetLayer( layer );
|
||||
pt_track->SetNet( net_code );
|
||||
|
||||
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->Insert( frame->m_Pcb, NULL );
|
||||
pt_track->Draw( frame->DrawPanel, DC, GR_OR );
|
||||
nbsegm++;
|
||||
|
@ -1142,8 +1143,13 @@ static void Genere_Segments_Zone( WinEDA_PcbFrame* frame, wxDC* DC, int net_code
|
|||
pt_track->SetLayer( layer );
|
||||
pt_track->m_Width = g_GridRoutingSize;
|
||||
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->Insert( frame->m_Pcb, NULL );
|
||||
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 )
|
||||
return FALSE; /* pas de zone */
|
||||
|
||||
if( frame->m_Pcb->m_Zone->m_TimeStamp != s_TimeStamp ) /* c'est une autre zone */
|
||||
return FALSE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue