Comment translation and capitalization fixes.
* Complete comment translation of PCBNew source. * Some tooltip capitalization fixes in PCBNew toolbars.
This commit is contained in:
parent
de62fa09dd
commit
de44203368
|
@ -16,10 +16,10 @@
|
|||
#define OPTKEY_PRINT_PAGE_FRAME wxT( "PrintPageFrame" )
|
||||
#define OPTKEY_PRINT_MONOCHROME_MODE wxT( "PrintMonochrome" )
|
||||
|
||||
/* Constantes de conversion d'unites */
|
||||
/* coeff de conversion dim en 0.1 mil -> dim en unite PS: (unite PS = pouce) */
|
||||
/* Conversion unit constants. */
|
||||
/* Convert pcb dimension of 0.1 mil to PS units of inches. */
|
||||
#define SCALE_PS .0001
|
||||
/* coeff de conversion dim en 0,1 mil -> dim en unite HPGL: */
|
||||
/* Convert dimension 0.1 mil -> HPGL units: */
|
||||
#define SCALE_HPGL 0.102041
|
||||
|
||||
/* Plot Options : */
|
||||
|
@ -29,7 +29,8 @@ public:
|
|||
bool Exclude_Edges_Pcb;
|
||||
int PlotLine_Width;
|
||||
bool Plot_Frame_Ref; // True to plot/print frame references
|
||||
bool DrawViaOnMaskLayer; // True if vias are drawn on Mask layer (ie protected by mask)
|
||||
bool DrawViaOnMaskLayer; // True if vias are drawn on Mask layer
|
||||
// (ie protected by mask)
|
||||
GRTraceMode Trace_Mode;
|
||||
bool Plot_Set_MIROIR;
|
||||
int HPGL_Pen_Num;
|
||||
|
@ -39,14 +40,14 @@ public:
|
|||
int PlotPSColorOpt; // True for color Postscript output
|
||||
bool Plot_PS_Negative; // True to create a negative board ps plot
|
||||
|
||||
/* Autorisation de trace des divers items en serigraphie */
|
||||
/* Flags to enable or disable ploting of various PCB elements. */
|
||||
bool Sel_Texte_Reference;
|
||||
bool Sel_Texte_Valeur;
|
||||
bool Sel_Texte_Divers;
|
||||
bool Sel_Texte_Invisible;
|
||||
bool PlotPadsOnSilkLayer;
|
||||
bool Plot_Pads_All_Layers; /* Plot pads meme n'appartenant pas a la
|
||||
* couche ( utile pour serigraphie) */
|
||||
bool Plot_Pads_All_Layers; /* Plot pads even outside the
|
||||
* Layer (useful for silkscreen) */
|
||||
|
||||
/* id for plot format (see enum PlotFormat in plot_common.h) */
|
||||
int PlotFormat;
|
||||
|
@ -68,17 +69,12 @@ public:
|
|||
|
||||
extern PCB_Plot_Options g_pcb_plot_options;
|
||||
|
||||
/*************************************/
|
||||
/* Constantes utiles en trace GERBER */
|
||||
/*************************************/
|
||||
|
||||
/* PLOT_RTN.CC */
|
||||
void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
|
||||
GRTraceMode trace_mode );
|
||||
|
||||
/* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules,
|
||||
* prepare les parametres de trace de texte */
|
||||
|
||||
/* Plat PCB text type, ie other than text on modules
|
||||
* prepare the plot settings of text */
|
||||
void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* PtSegm, int masque_layer,
|
||||
GRTraceMode trace_mode );
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/*********************************************************/
|
||||
/* Routines de trace: fonction communes aux diff formats */
|
||||
/*********************************************************/
|
||||
|
||||
/* Fichier PLOT_RTN.CPP*/
|
||||
/*************************/
|
||||
/* Common plot routines. */
|
||||
/*************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "common.h"
|
||||
|
@ -16,19 +14,17 @@
|
|||
#include "class_board_design_settings.h"
|
||||
|
||||
|
||||
/* Local functions */
|
||||
static void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer,
|
||||
GRTraceMode trace_mode );
|
||||
static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
|
||||
GRTraceMode trace_mode );
|
||||
|
||||
/**********************************************************/
|
||||
void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
|
||||
int masque_layer, GRTraceMode trace_mode )
|
||||
/***********************************************************/
|
||||
|
||||
/* Creates the plot for silkscreen layers
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
|
||||
int masque_layer,
|
||||
GRTraceMode trace_mode )
|
||||
{
|
||||
wxPoint pos, shape_pos;
|
||||
wxSize size;
|
||||
|
@ -39,31 +35,46 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
|
|||
|
||||
/* Plot edge layer and graphic items */
|
||||
|
||||
for( PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||
for( PtStruct = m_Pcb->m_Drawings;
|
||||
PtStruct != NULL;
|
||||
PtStruct = PtStruct->Next() )
|
||||
{
|
||||
switch( PtStruct->Type() )
|
||||
{
|
||||
case TYPE_DRAWSEGMENT:
|
||||
PlotDrawSegment( plotter, (DRAWSEGMENT*) PtStruct, masque_layer, trace_mode );
|
||||
PlotDrawSegment( plotter,
|
||||
(DRAWSEGMENT*) PtStruct,
|
||||
masque_layer,
|
||||
trace_mode );
|
||||
break;
|
||||
|
||||
case TYPE_TEXTE:
|
||||
PlotTextePcb( plotter, (TEXTE_PCB*) PtStruct, masque_layer, trace_mode );
|
||||
PlotTextePcb( plotter,
|
||||
(TEXTE_PCB*) PtStruct,
|
||||
masque_layer,
|
||||
trace_mode );
|
||||
break;
|
||||
|
||||
case TYPE_COTATION:
|
||||
PlotCotation( plotter, (COTATION*) PtStruct, masque_layer, trace_mode );
|
||||
PlotCotation( plotter,
|
||||
(COTATION*) PtStruct,
|
||||
masque_layer,
|
||||
trace_mode );
|
||||
break;
|
||||
|
||||
case TYPE_MIRE:
|
||||
PlotMirePcb( plotter, (MIREPCB*) PtStruct, masque_layer, trace_mode );
|
||||
PlotMirePcb( plotter,
|
||||
(MIREPCB*) PtStruct,
|
||||
masque_layer,
|
||||
trace_mode );
|
||||
break;
|
||||
|
||||
case TYPE_MARKER_PCB:
|
||||
break;
|
||||
|
||||
default:
|
||||
DisplayError( this, wxT( "Plot_Serigraphie() error: unexpected Type()" ) );
|
||||
DisplayError( this,
|
||||
wxT( "Plot_Serigraphie() error: unexpected Type()" ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -79,11 +90,12 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
|
|||
Module;
|
||||
Module = Module->Next() )
|
||||
{
|
||||
for( pt_pad = (D_PAD*) Module->m_Pads; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
||||
for( pt_pad = (D_PAD*) Module->m_Pads;
|
||||
pt_pad != NULL;
|
||||
pt_pad = pt_pad->Next() )
|
||||
{
|
||||
/* Seen if the pad is on this layer */
|
||||
if( (pt_pad->m_Masque_Layer & masque_layer) == 0
|
||||
|
||||
/* Copper pads go on copper silk, component
|
||||
* pads go on component silk */
|
||||
&& ( ( (pt_pad->m_Masque_Layer & CUIVRE_LAYER) == 0 )
|
||||
|
@ -122,7 +134,10 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
|
|||
|
||||
case PAD_RECT:
|
||||
default:
|
||||
plotter->flash_pad_rect( pos, size, pt_pad->m_Orient, FILAIRE );
|
||||
plotter->flash_pad_rect( pos,
|
||||
size,
|
||||
pt_pad->m_Orient,
|
||||
FILAIRE );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -143,8 +158,8 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
|
|||
{
|
||||
wxString errMsg;
|
||||
|
||||
errMsg.Printf(
|
||||
_( "Your BOARD has a bad layer number of %u for module\n %s's \"reference\" text." ),
|
||||
errMsg.Printf( _( "Your BOARD has a bad layer number of %u for \
|
||||
module\n %s's \"reference\" text." ),
|
||||
textLayer, GetChars( Module->GetReference() ) );
|
||||
DisplayError( this, errMsg );
|
||||
return;
|
||||
|
@ -163,8 +178,8 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
|
|||
{
|
||||
wxString errMsg;
|
||||
|
||||
errMsg.Printf(
|
||||
_( "Your BOARD has a bad layer number of %u for module\n %s's \"value\" text." ),
|
||||
errMsg.Printf( _( "Your BOARD has a bad layer number of %u for \
|
||||
module\n %s's \"value\" text." ),
|
||||
textLayer, GetChars( Module->GetReference() ) );
|
||||
DisplayError( this, errMsg );
|
||||
return;
|
||||
|
@ -192,7 +207,8 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
|
|||
|
||||
if( !g_pcb_plot_options.Sel_Texte_Divers )
|
||||
continue;
|
||||
if( (pt_texte->m_NoShow) && !g_pcb_plot_options.Sel_Texte_Invisible )
|
||||
if( (pt_texte->m_NoShow)
|
||||
&& !g_pcb_plot_options.Sel_Texte_Invisible )
|
||||
continue;
|
||||
|
||||
textLayer = pt_texte->GetLayer();
|
||||
|
@ -200,9 +216,8 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
|
|||
{
|
||||
wxString errMsg;
|
||||
|
||||
errMsg.Printf(
|
||||
_(
|
||||
"Your BOARD has a bad layer number of %u for module\n %s's \"module text\" text of %s." ),
|
||||
errMsg.Printf( _( "Your BOARD has a bad layer number of %u \
|
||||
for module\n %s's \"module text\" text of %s." ),
|
||||
textLayer, GetChars( Module->GetReference() ),
|
||||
GetChars( pt_texte->m_Text ) );
|
||||
DisplayError( this, errMsg );
|
||||
|
@ -216,7 +231,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
|
|||
}
|
||||
}
|
||||
|
||||
/* Plot filled ares */
|
||||
/* Plot filled areas */
|
||||
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
||||
{
|
||||
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii );
|
||||
|
@ -225,7 +240,8 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
|
|||
PlotFilledAreas( plotter, edge_zone, trace_mode );
|
||||
}
|
||||
|
||||
// Plot segments used to fill zone areas (outdated, but here for old boards compatibility):
|
||||
// Plot segments used to fill zone areas (outdated, but here for old boards
|
||||
// compatibility):
|
||||
for( SEGZONE* seg = m_Pcb->m_Zone; seg != NULL; seg = seg->Next() )
|
||||
{
|
||||
if( ( ( 1 << seg->GetLayer() ) & masque_layer ) == 0 )
|
||||
|
@ -236,10 +252,8 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
|
|||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
|
||||
GRTraceMode trace_mode )
|
||||
/********************************************************************/
|
||||
{
|
||||
wxSize size;
|
||||
wxPoint pos;
|
||||
|
@ -266,10 +280,8 @@ static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
|
|||
}
|
||||
|
||||
|
||||
/*******************************************************************************/
|
||||
void PlotCotation( PLOTTER* plotter, COTATION* Cotation, int masque_layer,
|
||||
GRTraceMode trace_mode )
|
||||
/*******************************************************************************/
|
||||
{
|
||||
DRAWSEGMENT* DrawTmp;
|
||||
|
||||
|
@ -283,42 +295,54 @@ void PlotCotation( PLOTTER* plotter, COTATION* Cotation, int masque_layer,
|
|||
|
||||
PlotTextePcb( plotter, Cotation->m_Text, masque_layer, trace_mode );
|
||||
|
||||
DrawTmp->m_Start.x = Cotation->Barre_ox; DrawTmp->m_Start.y = Cotation->Barre_oy;
|
||||
DrawTmp->m_End.x = Cotation->Barre_fx; DrawTmp->m_End.y = Cotation->Barre_fy;
|
||||
DrawTmp->m_Start.x = Cotation->Barre_ox;
|
||||
DrawTmp->m_Start.y = Cotation->Barre_oy;
|
||||
DrawTmp->m_End.x = Cotation->Barre_fx;
|
||||
DrawTmp->m_End.y = Cotation->Barre_fy;
|
||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
||||
|
||||
DrawTmp->m_Start.x = Cotation->TraitG_ox; DrawTmp->m_Start.y = Cotation->TraitG_oy;
|
||||
DrawTmp->m_End.x = Cotation->TraitG_fx; DrawTmp->m_End.y = Cotation->TraitG_fy;
|
||||
DrawTmp->m_Start.x = Cotation->TraitG_ox;
|
||||
DrawTmp->m_Start.y = Cotation->TraitG_oy;
|
||||
DrawTmp->m_End.x = Cotation->TraitG_fx;
|
||||
DrawTmp->m_End.y = Cotation->TraitG_fy;
|
||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
||||
|
||||
DrawTmp->m_Start.x = Cotation->TraitD_ox; DrawTmp->m_Start.y = Cotation->TraitD_oy;
|
||||
DrawTmp->m_End.x = Cotation->TraitD_fx; DrawTmp->m_End.y = Cotation->TraitD_fy;
|
||||
DrawTmp->m_Start.x = Cotation->TraitD_ox;
|
||||
DrawTmp->m_Start.y = Cotation->TraitD_oy;
|
||||
DrawTmp->m_End.x = Cotation->TraitD_fx;
|
||||
DrawTmp->m_End.y = Cotation->TraitD_fy;
|
||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
||||
|
||||
DrawTmp->m_Start.x = Cotation->FlecheD1_ox; DrawTmp->m_Start.y = Cotation->FlecheD1_oy;
|
||||
DrawTmp->m_End.x = Cotation->FlecheD1_fx; DrawTmp->m_End.y = Cotation->FlecheD1_fy;
|
||||
DrawTmp->m_Start.x = Cotation->FlecheD1_ox;
|
||||
DrawTmp->m_Start.y = Cotation->FlecheD1_oy;
|
||||
DrawTmp->m_End.x = Cotation->FlecheD1_fx;
|
||||
DrawTmp->m_End.y = Cotation->FlecheD1_fy;
|
||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
||||
|
||||
DrawTmp->m_Start.x = Cotation->FlecheD2_ox; DrawTmp->m_Start.y = Cotation->FlecheD2_oy;
|
||||
DrawTmp->m_End.x = Cotation->FlecheD2_fx; DrawTmp->m_End.y = Cotation->FlecheD2_fy;
|
||||
DrawTmp->m_Start.x = Cotation->FlecheD2_ox;
|
||||
DrawTmp->m_Start.y = Cotation->FlecheD2_oy;
|
||||
DrawTmp->m_End.x = Cotation->FlecheD2_fx;
|
||||
DrawTmp->m_End.y = Cotation->FlecheD2_fy;
|
||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
||||
|
||||
DrawTmp->m_Start.x = Cotation->FlecheG1_ox; DrawTmp->m_Start.y = Cotation->FlecheG1_oy;
|
||||
DrawTmp->m_End.x = Cotation->FlecheG1_fx; DrawTmp->m_End.y = Cotation->FlecheG1_fy;
|
||||
DrawTmp->m_Start.x = Cotation->FlecheG1_ox;
|
||||
DrawTmp->m_Start.y = Cotation->FlecheG1_oy;
|
||||
DrawTmp->m_End.x = Cotation->FlecheG1_fx;
|
||||
DrawTmp->m_End.y = Cotation->FlecheG1_fy;
|
||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
||||
|
||||
DrawTmp->m_Start.x = Cotation->FlecheG2_ox; DrawTmp->m_Start.y = Cotation->FlecheG2_oy;
|
||||
DrawTmp->m_End.x = Cotation->FlecheG2_fx; DrawTmp->m_End.y = Cotation->FlecheG2_fy;
|
||||
DrawTmp->m_Start.x = Cotation->FlecheG2_ox;
|
||||
DrawTmp->m_Start.y = Cotation->FlecheG2_oy;
|
||||
DrawTmp->m_End.x = Cotation->FlecheG2_fx;
|
||||
DrawTmp->m_End.y = Cotation->FlecheG2_fy;
|
||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
||||
|
||||
delete DrawTmp;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer,
|
||||
GRTraceMode trace_mode )
|
||||
/*****************************************************************/
|
||||
{
|
||||
DRAWSEGMENT* DrawTmp;
|
||||
int dx1, dx2, dy1, dy2, radius;
|
||||
|
@ -340,7 +364,10 @@ void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer,
|
|||
DrawTmp->m_Shape = S_SEGMENT;
|
||||
|
||||
radius = Mire->m_Size / 2;
|
||||
dx1 = radius, dy1 = 0; dx2 = 0, dy2 = radius;
|
||||
dx1 = radius;
|
||||
dy1 = 0;
|
||||
dx2 = 0;
|
||||
dy2 = radius;
|
||||
|
||||
if( Mire->m_Shape ) /* Shape X */
|
||||
{
|
||||
|
@ -349,23 +376,25 @@ void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer,
|
|||
dy2 = -dy1;
|
||||
}
|
||||
|
||||
DrawTmp->m_Start.x = Mire->m_Pos.x - dx1; DrawTmp->m_Start.y = Mire->m_Pos.y - dy1;
|
||||
DrawTmp->m_End.x = Mire->m_Pos.x + dx1; DrawTmp->m_End.y = Mire->m_Pos.y + dy1;
|
||||
DrawTmp->m_Start.x = Mire->m_Pos.x - dx1;
|
||||
DrawTmp->m_Start.y = Mire->m_Pos.y - dy1;
|
||||
DrawTmp->m_End.x = Mire->m_Pos.x + dx1;
|
||||
DrawTmp->m_End.y = Mire->m_Pos.y + dy1;
|
||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
||||
|
||||
DrawTmp->m_Start.x = Mire->m_Pos.x - dx2; DrawTmp->m_Start.y = Mire->m_Pos.y - dy2;
|
||||
DrawTmp->m_End.x = Mire->m_Pos.x + dx2; DrawTmp->m_End.y = Mire->m_Pos.y + dy2;
|
||||
DrawTmp->m_Start.x = Mire->m_Pos.x - dx2;
|
||||
DrawTmp->m_Start.y = Mire->m_Pos.y - dy2;
|
||||
DrawTmp->m_End.x = Mire->m_Pos.x + dx2;
|
||||
DrawTmp->m_End.y = Mire->m_Pos.y + dy2;
|
||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
||||
|
||||
delete DrawTmp;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/* Plot footprints graphic items (outlines) */
|
||||
void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer,
|
||||
GRTraceMode trace_mode )
|
||||
/**********************************************************************/
|
||||
/* Plot footprints graphic items (outlines) */
|
||||
{
|
||||
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
|
@ -385,17 +414,15 @@ void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer,
|
|||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
/* Plot a graphic item (outline) relative to a footprint */
|
||||
void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
|
||||
GRTraceMode trace_mode )
|
||||
/**************************************************************/
|
||||
/* Plot a graphic item (outline) relative to a footprint */
|
||||
{
|
||||
int type_trace; /* forme a tracer (segment, cercle) */
|
||||
int thickness; /* thickness des segments */
|
||||
int radius; /* radius des cercles a tracer */
|
||||
int type_trace; /* Type of item to plot. */
|
||||
int thickness; /* Segment thickness. */
|
||||
int radius; /* Circle radius. */
|
||||
int StAngle, EndAngle;
|
||||
wxPoint pos, end; /* Coord des segments a tracer */
|
||||
wxPoint pos, end;
|
||||
|
||||
if( PtEdge->Type() != TYPE_EDGE_MODULE )
|
||||
return;
|
||||
|
@ -413,15 +440,22 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
|
|||
break;
|
||||
|
||||
case S_CIRCLE:
|
||||
radius = (int) hypot( (double) ( end.x - pos.x ), (double) ( end.y - pos.y ) );
|
||||
radius = (int) hypot( (double) ( end.x - pos.x ),
|
||||
(double) ( end.y - pos.y ) );
|
||||
plotter->thick_circle( pos, radius * 2, thickness, trace_mode );
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
radius = (int) hypot( (double) ( end.x - pos.x ), (double) ( end.y - pos.y ) );
|
||||
radius = (int) hypot( (double) ( end.x - pos.x ),
|
||||
(double) ( end.y - pos.y ) );
|
||||
StAngle = ArcTangente( end.y - pos.y, end.x - pos.x );
|
||||
EndAngle = StAngle + PtEdge->m_Angle;
|
||||
plotter->thick_arc( pos, -EndAngle, -StAngle, radius, thickness, trace_mode );
|
||||
plotter->thick_arc( pos,
|
||||
-EndAngle,
|
||||
-StAngle,
|
||||
radius,
|
||||
thickness,
|
||||
trace_mode );
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
|
@ -432,7 +466,8 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
|
|||
if( PtEdge->GetParent() && (PtEdge->GetParent()->Type() == TYPE_MODULE) )
|
||||
Module = (MODULE*) PtEdge->GetParent();
|
||||
|
||||
int* ptr_base = (int*) MyMalloc( 2 * PtEdge->m_PolyPoints.size() * sizeof(int) );
|
||||
int* ptr_base =
|
||||
(int*) MyMalloc( 2 * PtEdge->m_PolyPoints.size() * sizeof(int) );
|
||||
int* ptr = ptr_base;
|
||||
|
||||
int* source = (int*) &PtEdge->m_PolyPoints[0];
|
||||
|
@ -456,7 +491,8 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
|
|||
*ptr++ = y;
|
||||
}
|
||||
|
||||
plotter->poly( PtEdge->m_PolyPoints.size(), ptr_base, NO_FILL, thickness );
|
||||
plotter->poly( PtEdge->m_PolyPoints.size(), ptr_base, NO_FILL,
|
||||
thickness );
|
||||
free( ptr_base );
|
||||
}
|
||||
break;
|
||||
|
@ -464,11 +500,9 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
|
|||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* Plot a PCB Text, i;e. a text found on a copper or technical layer */
|
||||
void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
|
||||
GRTraceMode trace_mode )
|
||||
/****************************************************************************/
|
||||
/* Plot a PCB Text, i;e. a text found on a copper or technical layer */
|
||||
{
|
||||
int orient, thickness;
|
||||
wxPoint pos;
|
||||
|
@ -517,12 +551,10 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
|
|||
}
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
|
||||
GRTraceMode trace_mode )
|
||||
/*********************************************************/
|
||||
/* Plot areas (given by .m_FilledPolysList member) in a zone
|
||||
*/
|
||||
void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
|
||||
GRTraceMode trace_mode )
|
||||
{
|
||||
static int* CornersBuffer = NULL;
|
||||
static unsigned CornersBufferSize = 0;
|
||||
|
@ -533,7 +565,7 @@ void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
|
|||
|
||||
// We need a buffer to store corners coordinates:
|
||||
|
||||
imax++; // provide room to sore an extra coordinte to close the ploygon
|
||||
imax++; // provide room to sore an extra coordinate to close the polygon
|
||||
if( CornersBuffer == NULL )
|
||||
{
|
||||
CornersBufferSize = imax * 2;
|
||||
|
@ -543,14 +575,15 @@ void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
|
|||
if( (imax * 4) > CornersBufferSize )
|
||||
{
|
||||
CornersBufferSize = imax * 2;
|
||||
CornersBuffer = (int*) realloc( CornersBuffer, CornersBufferSize * sizeof(int) );
|
||||
CornersBuffer = (int*) realloc( CornersBuffer,
|
||||
CornersBufferSize * sizeof(int) );
|
||||
}
|
||||
|
||||
imax--;
|
||||
|
||||
/* Plot all filled areas: filled areas have a filled area and a thick outline
|
||||
* we must plot the filled area itself ( as a filled polygon OR a set of segments )
|
||||
* and plot the thick outline itself
|
||||
/* Plot all filled areas: filled areas have a filled area and a thick
|
||||
* outline we must plot the filled area itself ( as a filled polygon
|
||||
* OR a set of segments ) and plot the thick outline itself
|
||||
*
|
||||
* in non filled mode the outline is plotted, but not the filling items
|
||||
*/
|
||||
|
@ -576,15 +609,22 @@ void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
|
|||
if( trace_mode == FILLED )
|
||||
{
|
||||
// Plot the current filled area polygon
|
||||
if( aZone->m_FillMode == 0 ) // We are using solid polygons (if != 0: using segments )
|
||||
if( aZone->m_FillMode == 0 ) // We are using solid polygons
|
||||
// (if != 0: using segments )
|
||||
plotter->poly( corners_count, CornersBuffer, FILLED_SHAPE );
|
||||
else // We are using areas filled by segments: plot hem )
|
||||
else // We are using areas filled by
|
||||
// segments: plot hem )
|
||||
{
|
||||
for( unsigned iseg = 0; iseg < aZone->m_FillSegmList.size(); iseg++ )
|
||||
for( unsigned iseg = 0;
|
||||
iseg < aZone->m_FillSegmList.size();
|
||||
iseg++ )
|
||||
{
|
||||
wxPoint start = aZone->m_FillSegmList[iseg].m_Start;
|
||||
wxPoint end = aZone->m_FillSegmList[iseg].m_End;
|
||||
plotter->thick_segment( start, end, aZone->m_ZoneMinThickness, trace_mode );
|
||||
plotter->thick_segment( start,
|
||||
end,
|
||||
aZone->m_ZoneMinThickness,
|
||||
trace_mode );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -615,13 +655,10 @@ void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
|
|||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* pt_segm, int masque_layer,
|
||||
GRTraceMode trace_mode )
|
||||
/******************************************************************************/
|
||||
|
||||
/* Plot items type DRAWSEGMENT on layers allowed by masque_layer
|
||||
*/
|
||||
void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* pt_segm, int masque_layer,
|
||||
GRTraceMode trace_mode )
|
||||
{
|
||||
wxPoint start, end;
|
||||
int thickness;
|
||||
|
@ -642,21 +679,32 @@ void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* pt_segm, int masque_layer,
|
|||
switch( pt_segm->m_Shape )
|
||||
{
|
||||
case S_CIRCLE:
|
||||
radius = (int) hypot( (double) ( end.x - start.x ), (double) ( end.y - start.y ) );
|
||||
radius =
|
||||
(int) hypot( (double) ( end.x - start.x ),
|
||||
(double) ( end.y - start.y ) );
|
||||
plotter->thick_circle( start, radius * 2, thickness, trace_mode );
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
radius = (int) hypot( (double) ( end.x - start.x ), (double) ( end.y - start.y ) );
|
||||
radius =
|
||||
(int) hypot( (double) ( end.x - start.x ),
|
||||
(double) ( end.y - start.y ) );
|
||||
StAngle = ArcTangente( end.y - start.y, end.x - start.x );
|
||||
EndAngle = StAngle + pt_segm->m_Angle;
|
||||
plotter->thick_arc( start, -EndAngle, -StAngle, radius, thickness, trace_mode );
|
||||
plotter->thick_arc( start,
|
||||
-EndAngle,
|
||||
-StAngle,
|
||||
radius,
|
||||
thickness,
|
||||
trace_mode );
|
||||
break;
|
||||
|
||||
case S_CURVE:
|
||||
for( unsigned i = 1; i < pt_segm->m_BezierPoints.size(); i++ )
|
||||
plotter->thick_segment( pt_segm->m_BezierPoints[i - 1],
|
||||
pt_segm->m_BezierPoints[i], thickness, trace_mode );
|
||||
pt_segm->m_BezierPoints[i],
|
||||
thickness,
|
||||
trace_mode );
|
||||
|
||||
break;
|
||||
|
||||
|
@ -666,10 +714,8 @@ void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* pt_segm, int masque_layer,
|
|||
}
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer,
|
||||
GRTraceMode trace_mode )
|
||||
/*********************************************************************/
|
||||
{
|
||||
// Specify that the contents of the "Edges Pcb" layer are to be plotted
|
||||
// in addition to the contents of the currently specified layer.
|
||||
|
@ -698,12 +744,13 @@ void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer,
|
|||
case LAST_COPPER_LAYER:
|
||||
Plot_Standard_Layer( plotter, layer_mask, true, trace_mode );
|
||||
|
||||
// Adding drill marks, if required and if the plotter is able to plot them:
|
||||
if( g_pcb_plot_options.DrillShapeOpt != PCB_Plot_Options::NO_DRILL_SHAPE )
|
||||
// Adding drill marks, if required and if the plotter is able to plot
|
||||
// them:
|
||||
if( g_pcb_plot_options.DrillShapeOpt !=
|
||||
PCB_Plot_Options::NO_DRILL_SHAPE )
|
||||
{
|
||||
if( plotter->GetPlotterType() == PLOT_FORMAT_POST )
|
||||
PlotDrillMark(
|
||||
plotter,
|
||||
PlotDrillMark( plotter,
|
||||
trace_mode,
|
||||
g_pcb_plot_options.DrillShapeOpt ==
|
||||
PCB_Plot_Options::SMALL_DRILL_SHAPE );
|
||||
|
@ -728,27 +775,28 @@ void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer,
|
|||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask,
|
||||
bool aPlotVia, GRTraceMode aPlotMode )
|
||||
/*******************************************************************************/
|
||||
|
||||
/* Trace en format HPGL. d'une couche cuivre ou masque
|
||||
* 1 unite HPGL = 0.98 mils ( 1 mil = 1.02041 unite HPGL ) .
|
||||
/* Plot a copper layer or mask in HPGL format.
|
||||
* HPGL unit = 0.98 mils (1 mil = 1.02041 unit HPGL).
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter,
|
||||
int aLayerMask,
|
||||
bool aPlotVia,
|
||||
GRTraceMode aPlotMode )
|
||||
{
|
||||
wxPoint pos;
|
||||
wxSize size;
|
||||
wxString msg;
|
||||
|
||||
// trace des elements type Drawings Pcb :
|
||||
|
||||
// Plot pcb draw items.
|
||||
for( BOARD_ITEM* item = m_Pcb->m_Drawings; item; item = item->Next() )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
case TYPE_DRAWSEGMENT:
|
||||
PlotDrawSegment( aPlotter, (DRAWSEGMENT*) item, aLayerMask, aPlotMode );
|
||||
PlotDrawSegment( aPlotter,
|
||||
(DRAWSEGMENT*) item,
|
||||
aLayerMask,
|
||||
aPlotMode );
|
||||
break;
|
||||
|
||||
case TYPE_TEXTE:
|
||||
|
@ -782,7 +830,9 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask
|
|||
{
|
||||
case TYPE_EDGE_MODULE:
|
||||
if( aLayerMask & g_TabOneLayerMask[ item->GetLayer() ] )
|
||||
Plot_1_EdgeModule( aPlotter, (EDGE_MODULE*) item, aPlotMode );
|
||||
Plot_1_EdgeModule( aPlotter,
|
||||
(EDGE_MODULE*) item,
|
||||
aPlotMode );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -803,7 +853,9 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask
|
|||
shape_pos = pad->ReturnShapePos();
|
||||
pos = shape_pos;
|
||||
wxSize margin;
|
||||
switch( aLayerMask & (SOLDERMASK_LAYER_CU|SOLDERMASK_LAYER_CMP|SOLDERPASTE_LAYER_CU|SOLDERPASTE_LAYER_CMP) )
|
||||
switch( aLayerMask &
|
||||
( SOLDERMASK_LAYER_CU | SOLDERMASK_LAYER_CMP |
|
||||
SOLDERPASTE_LAYER_CU | SOLDERPASTE_LAYER_CMP ) )
|
||||
{
|
||||
case SOLDERMASK_LAYER_CMP:
|
||||
case SOLDERMASK_LAYER_CU:
|
||||
|
@ -839,7 +891,11 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask
|
|||
case PAD_TRAPEZOID:
|
||||
{
|
||||
wxSize delta = pad->m_DeltaSize;
|
||||
aPlotter->flash_pad_trapez( pos, size, delta, pad->m_Orient, aPlotMode );
|
||||
aPlotter->flash_pad_trapez( pos,
|
||||
size,
|
||||
delta,
|
||||
pad->m_Orient,
|
||||
aPlotMode );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -873,7 +929,9 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask
|
|||
continue;
|
||||
|
||||
int via_margin = 0;
|
||||
// If the current layer is a solder mask, use the global mask clearance for vias
|
||||
|
||||
// If the current layer is a solder mask, use the global mask
|
||||
// clearance for vias
|
||||
if( ( aLayerMask & ( SOLDERMASK_LAYER_CU | SOLDERMASK_LAYER_CMP ) ) )
|
||||
via_margin = g_DesignSettings.m_SolderMaskMargin;
|
||||
pos = Via->m_Start;
|
||||
|
@ -934,12 +992,15 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask
|
|||
/** function PlotDrillMark
|
||||
* Draw a drill mark for pads and vias.
|
||||
* Must be called after all drawings, because it
|
||||
* redraw the drill mark on a pad or via, as a negative (i.e. white) shape in FILLED plot mode
|
||||
* redraw the drill mark on a pad or via, as a negative (i.e. white) shape in
|
||||
* FILLED plot mode
|
||||
* @param aPlotter = the PLOTTER
|
||||
* @param aTraceMode = the mode of plot (FILLED, SKETCH)
|
||||
* @param aSmallDrillShape = true to plot a small drill shape, false to plot the actual drill shape
|
||||
* @param aSmallDrillShape = true to plot a small drill shape, false to plot
|
||||
* the actual drill shape
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter, GRTraceMode aTraceMode,
|
||||
void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter,
|
||||
GRTraceMode aTraceMode,
|
||||
bool aSmallDrillShape )
|
||||
{
|
||||
const int SMALL_DRILL = 150;
|
||||
|
@ -959,7 +1020,8 @@ void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter, GRTraceMode aTraceMo
|
|||
if( pts->Type() != TYPE_VIA )
|
||||
continue;
|
||||
pos = pts->m_Start;
|
||||
if( g_pcb_plot_options.DrillShapeOpt == PCB_Plot_Options::SMALL_DRILL_SHAPE )
|
||||
if( g_pcb_plot_options.DrillShapeOpt ==
|
||||
PCB_Plot_Options::SMALL_DRILL_SHAPE )
|
||||
diam.x = diam.y = SMALL_DRILL;
|
||||
else
|
||||
diam.x = diam.y = pts->GetDrillValue();
|
||||
|
@ -983,7 +1045,10 @@ void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter, GRTraceMode aTraceMo
|
|||
if( PtPad->m_DrillShape == PAD_OVAL )
|
||||
{
|
||||
diam = PtPad->m_Drill;
|
||||
aPlotter->flash_pad_oval( pos, diam, PtPad->m_Orient, aTraceMode );
|
||||
aPlotter->flash_pad_oval( pos,
|
||||
diam,
|
||||
PtPad->m_Orient,
|
||||
aTraceMode );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*******************************/
|
||||
/**** Routine de trace HPGL ****/
|
||||
/*******************************/
|
||||
/******************/
|
||||
/**** Plot DXF ****/
|
||||
/******************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "common.h"
|
||||
|
@ -12,10 +12,8 @@
|
|||
|
||||
#include "protos.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
void WinEDA_BasePcbFrame::Genere_DXF( const wxString& FullFileName, int Layer,
|
||||
GRTraceMode trace_mode )
|
||||
/*****************************************************************************/
|
||||
{
|
||||
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*******************************/
|
||||
/**** Routine de trace HPGL ****/
|
||||
/*******************************/
|
||||
/*******************/
|
||||
/**** Plot HPGL ****/
|
||||
/*******************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "common.h"
|
||||
|
@ -12,10 +12,9 @@
|
|||
|
||||
#include "protos.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
|
||||
GRTraceMode trace_mode )
|
||||
/*****************************************************************************/
|
||||
{
|
||||
wxSize SheetSize;
|
||||
wxSize BoardSize;
|
||||
|
@ -28,7 +27,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
|
|||
ClearMsgPanel();
|
||||
|
||||
// Compute pen_dim (from g_HPGL_Pen_Diam in mils) in pcb units,
|
||||
// with plot scale (if Scale is 2, pen diametre is always g_HPGL_Pen_Diam
|
||||
// with plot scale (if Scale is 2, pen diameter is always g_HPGL_Pen_Diam
|
||||
// so apparent pen diam is real pen diam / Scale
|
||||
int pen_diam = wxRound( (g_pcb_plot_options.HPGL_Pen_Diam * U_PCB) / g_pcb_plot_options.Scale );
|
||||
|
||||
|
@ -53,14 +52,14 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
|
|||
AppendMsgPanel( _( "File" ), FullFileName, CYAN );
|
||||
|
||||
if( g_pcb_plot_options.PlotScaleOpt != 1 )
|
||||
Center = TRUE; // Echelle != 1 donc trace centree du PCB
|
||||
Center = TRUE; // Scale != 1 so center PCB plot.
|
||||
|
||||
|
||||
// calcul en unites internes des dimensions des feuilles ( connues en 1/1000 pouce )
|
||||
// Scale units from 0.0001" to HPGL plot units.
|
||||
SheetSize.x = currentsheet->m_Size.x * U_PCB;
|
||||
SheetSize.y = currentsheet->m_Size.y * U_PCB;
|
||||
|
||||
/* calcul des dimensions et centre du PCB */
|
||||
/* Calculate the center of the PCB. */
|
||||
m_Pcb->ComputeBoundaryBox();
|
||||
BoardSize = m_Pcb->m_BoundaryBox.GetSize();
|
||||
BoardCenter = m_Pcb->m_BoundaryBox.Centre();
|
||||
|
@ -77,7 +76,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
|
|||
else
|
||||
scale = g_pcb_plot_options.Scale;
|
||||
|
||||
// Calcul du cadrage (echelle != 1 donc recadrage du trace)
|
||||
// Calculate the page size offset.
|
||||
if( Center )
|
||||
{
|
||||
offset.x = BoardCenter.x - ( SheetSize.x / 2 ) / scale;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************/
|
||||
/**** Pcbnew: Routine de trace PS ****/
|
||||
/*************************************/
|
||||
/*************************/
|
||||
/**** Plot Postscript ****/
|
||||
/*************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "common.h"
|
||||
|
@ -12,14 +12,12 @@
|
|||
|
||||
#include "protos.h"
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Generate a PostScript file (*. ps) of the circuit layer.
|
||||
* If layer < 0: all layers are plotted.
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
|
||||
bool useA4, GRTraceMode trace_mode )
|
||||
/****************************************************************************/
|
||||
|
||||
/* Genere un fichier POSTSCRIPT (*.ps) de trace du circuit, couche layer
|
||||
* if layer < 0: all layers
|
||||
*/
|
||||
{
|
||||
wxSize SheetSize;
|
||||
wxSize PaperSize;
|
||||
|
@ -45,13 +43,12 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
|
|||
AppendMsgPanel( _( "File" ), FullFileName, CYAN );
|
||||
|
||||
if( g_pcb_plot_options.PlotScaleOpt != 1 )
|
||||
Center = TRUE; // Echelle != 1 donc trace centree du PCB
|
||||
Center = TRUE; // Scale != 1 so center plot.
|
||||
|
||||
// Set default line width
|
||||
if( g_pcb_plot_options.PlotLine_Width < 1 )
|
||||
g_pcb_plot_options.PlotLine_Width = 1;
|
||||
|
||||
// calcul en unites internes des dimensions des feuilles ( connues en 1/1000 pouce )
|
||||
SheetSize.x = currentsheet->m_Size.x * U_PCB;
|
||||
SheetSize.y = currentsheet->m_Size.y * U_PCB;
|
||||
|
||||
|
@ -69,7 +66,6 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
|
|||
paperscale = 1;
|
||||
}
|
||||
|
||||
/* calcul des dimensions et centre du PCB */
|
||||
m_Pcb->ComputeBoundaryBox();
|
||||
BoardSize = m_Pcb->m_BoundaryBox.GetSize();
|
||||
BoardCenter = m_Pcb->m_BoundaryBox.Centre();
|
||||
|
@ -86,7 +82,6 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
|
|||
else
|
||||
scale = g_pcb_plot_options.Scale * paperscale;
|
||||
|
||||
// Calcul du cadrage (echelle != 1 donc recadrage du trace)
|
||||
if( Center )
|
||||
{
|
||||
offset.x = BoardCenter.x - ( PaperSize.x / 2 ) / scale;
|
||||
|
|
|
@ -12,20 +12,20 @@
|
|||
#include "pcbplot.h"
|
||||
#include "protos.h"
|
||||
|
||||
/* Local functions */
|
||||
|
||||
static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module,
|
||||
int draw_mode, int masklayer );
|
||||
|
||||
|
||||
/************************************************************************************************************/
|
||||
void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMaskLayer, bool aPrintMirrorMode )
|
||||
/************************************************************************************************************/
|
||||
|
||||
/** Function PrintPage
|
||||
* Used to print the board (on printer, or when creating SVF files).
|
||||
* Print the board, but only layers allowed by aPrintMaskLayer
|
||||
* ( printmasklayer is a 32 bits mask: bit n = 1 -> layer n is printed)
|
||||
*/
|
||||
void WinEDA_DrawPanel::PrintPage( wxDC* aDC,
|
||||
bool aPrint_Sheet_Ref,
|
||||
int aPrintMaskLayer,
|
||||
bool aPrintMirrorMode )
|
||||
{
|
||||
MODULE* Module;
|
||||
int drawmode = GR_COPY;
|
||||
|
@ -61,14 +61,13 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMa
|
|||
|
||||
m_PrintIsMirrored = aPrintMirrorMode;
|
||||
|
||||
// The OR mode is used in color mode, but be aware the backgroud *must be BLACK.
|
||||
// In print page dialog, we first plrint in BLACK, and after reprint in color,
|
||||
// on the black "local" backgroud, in OR mode
|
||||
// the black print is not made before, only a white page is printed
|
||||
// The OR mode is used in color mode, but be aware the backgroud *must be
|
||||
// BLACK. In the print page dialog, we first plrint in BLACK, and after
|
||||
// reprint in color, on the black "local" backgroud, in OR mode the black
|
||||
// print is not made before, only a white page is printed
|
||||
if( GetGRForceBlackPenState() == false )
|
||||
drawmode = GR_OR;
|
||||
|
||||
|
||||
/* Print the pcb graphic items (texts, ...) */
|
||||
GRSetDrawMode( aDC, drawmode );
|
||||
for( BOARD_ITEM* item = Pcb->m_Drawings; item; item = item->Next() )
|
||||
|
@ -85,7 +84,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMa
|
|||
item->Draw( this, aDC, drawmode );
|
||||
break;
|
||||
|
||||
case TYPE_MARKER_PCB: /* Trace des marqueurs */
|
||||
case TYPE_MARKER_PCB:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -97,13 +96,19 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMa
|
|||
{
|
||||
if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 )
|
||||
continue;
|
||||
if( pt_piste->Type() == TYPE_VIA ) /* VIA rencontree */
|
||||
if( pt_piste->Type() == TYPE_VIA ) /* VIA encountered. */
|
||||
{
|
||||
int rayon = pt_piste->m_Width >> 1;
|
||||
int color = g_DesignSettings.m_ViaColor[pt_piste->m_Shape];
|
||||
GRSetDrawMode( aDC, drawmode );
|
||||
GRFilledCircle( &m_ClipBox, aDC, pt_piste->m_Start.x, pt_piste->m_Start.y,
|
||||
rayon, 0, color, color );
|
||||
GRFilledCircle( &m_ClipBox,
|
||||
aDC,
|
||||
pt_piste->m_Start.x,
|
||||
pt_piste->m_Start.y,
|
||||
rayon,
|
||||
0,
|
||||
color,
|
||||
color );
|
||||
}
|
||||
else
|
||||
pt_piste->Draw( this, aDC, drawmode );
|
||||
|
@ -128,15 +133,16 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMa
|
|||
zone->DrawFilledArea( this, aDC, drawmode );
|
||||
}
|
||||
|
||||
// Draw footprints, this is done at last in order to print the pad holes in white (or g_DrawBgColor)
|
||||
// after the tracks and zones
|
||||
// Draw footprints, this is done at last in order to print the pad holes in
|
||||
// white (or g_DrawBgColor) after the tracks and zones
|
||||
Module = (MODULE*) Pcb->m_Modules;
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
{
|
||||
Print_Module( this, aDC, Module, drawmode, aPrintMaskLayer );
|
||||
}
|
||||
|
||||
/* Print via holes in bg color: Not sure it is good for buried or blind vias */
|
||||
/* Print via holes in bg color: Not sure it is good for buried or blind
|
||||
* vias */
|
||||
pt_piste = Pcb->m_Track;
|
||||
int color = g_DrawBgColor;
|
||||
bool blackpenstate = GetGRForceBlackPenState();
|
||||
|
@ -146,13 +152,20 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMa
|
|||
{
|
||||
if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 )
|
||||
continue;
|
||||
if( pt_piste->Type() == TYPE_VIA ) /* VIA rencontree */
|
||||
if( pt_piste->Type() == TYPE_VIA ) /* VIA encountered. */
|
||||
{
|
||||
int rayon = pt_piste->GetDrillValue() / 2;
|
||||
GRFilledCircle( &m_ClipBox, aDC, pt_piste->m_Start.x, pt_piste->m_Start.y,
|
||||
rayon, 0, color, color );
|
||||
GRFilledCircle( &m_ClipBox,
|
||||
aDC,
|
||||
pt_piste->m_Start.x,
|
||||
pt_piste->m_Start.y,
|
||||
rayon,
|
||||
0,
|
||||
color,
|
||||
color );
|
||||
}
|
||||
}
|
||||
|
||||
GRForceBlackPen( blackpenstate );
|
||||
|
||||
if( aPrint_Sheet_Ref )
|
||||
|
@ -168,10 +181,8 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMa
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************/
|
||||
static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
MODULE* Module, int draw_mode, int masklayer )
|
||||
/***********************************************************/
|
||||
{
|
||||
D_PAD* pt_pad;
|
||||
EDA_BaseStruct* PtStruct;
|
||||
|
@ -184,14 +195,18 @@ static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC,
|
|||
{
|
||||
if( (pt_pad->m_Masque_Layer & masklayer ) == 0 )
|
||||
continue;
|
||||
|
||||
// Usually we draw pads in sketch mode on non copper layers:
|
||||
if( (masklayer & ALL_CU_LAYERS) == 0 )
|
||||
{
|
||||
int tmp_fill = ((WinEDA_BasePcbFrame*)panel->m_Parent)->m_DisplayPadFill;
|
||||
int tmp_fill =
|
||||
( (WinEDA_BasePcbFrame*) panel->m_Parent )->m_DisplayPadFill;
|
||||
|
||||
// Switch in sketch mode
|
||||
( (WinEDA_BasePcbFrame*) panel->m_Parent )->m_DisplayPadFill = 0;
|
||||
pt_pad->Draw( panel, DC, draw_mode );
|
||||
((WinEDA_BasePcbFrame*)panel->m_Parent)->m_DisplayPadFill = tmp_fill;
|
||||
( (WinEDA_BasePcbFrame*) panel->m_Parent )->m_DisplayPadFill =
|
||||
tmp_fill;
|
||||
}
|
||||
else // on copper layer, draw pads according to current options
|
||||
pt_pad->Draw( panel, DC, draw_mode );
|
||||
|
|
361
pcbnew/protos.h
361
pcbnew/protos.h
|
@ -1,6 +1,6 @@
|
|||
/***************************************/
|
||||
/* prototypage des fonctions de PCBNEW */
|
||||
/***************************************/
|
||||
/***********/
|
||||
/* protos.h */
|
||||
/***********/
|
||||
|
||||
#ifndef PROTO_H
|
||||
#define PROTO_H
|
||||
|
@ -22,11 +22,12 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage );
|
|||
|
||||
|
||||
/* install function for DialogNonCopperZonesEditor dialog frame :*/
|
||||
bool InstallDialogNonCopperZonesEditor(WinEDA_PcbFrame* aParent, ZONE_CONTAINER* aZone);
|
||||
bool InstallDialogNonCopperZonesEditor( WinEDA_PcbFrame* aParent,
|
||||
ZONE_CONTAINER* aZone );
|
||||
|
||||
/***************/
|
||||
/*******************/
|
||||
/* PAD_CONNECT.CPP */
|
||||
/***************/
|
||||
/*******************/
|
||||
|
||||
class D_PAD;
|
||||
|
||||
|
@ -43,7 +44,7 @@ void CreateSortedPadListByXCoord( BOARD* aBoard, std::vector<D_PAD*>* aVector );
|
|||
|
||||
|
||||
/* Create a sorted list of pointers to pads.
|
||||
* This list is sorted by X ccordinate value.
|
||||
* This list is sorted by X coordinate value.
|
||||
* The list must be freed bu user
|
||||
*/
|
||||
|
||||
|
@ -57,45 +58,46 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose );
|
|||
/* TRPISTE.CPP */
|
||||
/***************/
|
||||
|
||||
/* Routine trace of n consecutive segments in memory.
|
||||
* Useful for mounting a track record for being the segments that
|
||||
* Tracks are contiguous in memory
|
||||
* Parameters:
|
||||
* Pt_start_piste = starting address of the list of segments
|
||||
* Nbsegment = number of segments was traced
|
||||
* Mode_color = mode (GrXOR, Gror ..)
|
||||
* CAUTION:
|
||||
* The starting point of a track following MUST exist: may be
|
||||
* Then put a 0 before calling a routine if the track is the last draw
|
||||
*/
|
||||
void Trace_Une_Piste( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
TRACK* pt_start_piste,
|
||||
int nbsegment,
|
||||
int mode_color );
|
||||
|
||||
/* routine de trace de n segments consecutifs en memoire.
|
||||
* Utile pour monter une piste en cours de trace car les segments de cette
|
||||
* piste sont alors contigus en memoire
|
||||
* Parametres :
|
||||
* pt_start_piste = adresse de depart de la liste des segments
|
||||
* nbsegment = nombre de segments a tracer
|
||||
* mode_color = mode ( GrXOR, GrOR..)
|
||||
* ATTENTION:
|
||||
* le point de depart d'une piste suivante DOIT exister: peut etre
|
||||
* donc mis a 0 avant appel a la routine si la piste a tracer est la derniere
|
||||
*/
|
||||
|
||||
|
||||
/****************/
|
||||
/* TRACEMOD.C : */
|
||||
/****************/
|
||||
void Trace_Pads_Only( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module, int ox, int oy,
|
||||
int MasqueLayer, int mode_color );
|
||||
|
||||
/* Trace les pads d'un module en mode SKETCH.
|
||||
* Utilisee pour afficher les pastilles d'un module lorsque celui ci n'est
|
||||
* pas affiche par les options d'affichage des Modules
|
||||
* Les pads affiches doivent apparaitre sur les couches donnees par
|
||||
* MasqueLayer */
|
||||
/* Trace the pads of a module in sketch mode.
|
||||
* Used to display a module pads when it is not displayed by the display
|
||||
* options Module.
|
||||
* The pads must appear on the data layers by MasqueLayer
|
||||
*/
|
||||
void Trace_Pads_Only( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
MODULE* Module,
|
||||
int ox,
|
||||
int oy,
|
||||
int MasqueLayer,
|
||||
int mode_color );
|
||||
|
||||
/****************/
|
||||
/* LOCATE.CPP : */
|
||||
/****************/
|
||||
|
||||
/* Recherche d'une empreinte par son nom */
|
||||
|
||||
/* Recherche d'un pad par son nom, pour le module Module */
|
||||
|
||||
/* Find a pad by it's name om the module. */
|
||||
TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer = -1 );
|
||||
|
||||
/**
|
||||
|
@ -106,130 +108,126 @@ TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer = -1 );
|
|||
* @param aLayer The layer to match, pass -1 for a don't care.
|
||||
* @return TRACK* - actually a SEGVIA* if found, else NULL.
|
||||
*/
|
||||
TRACK* Locate_Via_Area( TRACK* aStart, const wxPoint& aPos, int aLayer = -1 );
|
||||
TRACK* Locate_Via_Area( TRACK* aStart,
|
||||
const wxPoint& aPos,
|
||||
int aLayer = -1 );
|
||||
|
||||
/* Locates the center through the point x, y, on layer data
|
||||
* by masquelayer.
|
||||
* Search is done to address start_adr has end_adr (not included)
|
||||
*/
|
||||
TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr,
|
||||
const wxPoint& pos, int masquelayer );
|
||||
|
||||
/* Localise la via de centre le point x,y , sur les couches donnees
|
||||
* par masquelayer.
|
||||
* la recherche se fait de l'adresse start_adr a end_adr(non comprise)
|
||||
/* Locates the center through the point x, y, on layer data
|
||||
* by masquelayer.
|
||||
* Search is done to address start_adr has end_adr (not included)
|
||||
*/
|
||||
|
||||
TRACK* Fast_Locate_Piste( TRACK* start_adr, TRACK* end_adr,
|
||||
const wxPoint& ref_pos, int masquelayer );
|
||||
|
||||
/* Localiste le segment dont une extremite coincide avec le point x,y
|
||||
* sur les couches donnees par masquelayer
|
||||
* la recherche se fait de l'adresse start_adr a end_adr(non comprise)
|
||||
/* Search for segment connected to the segment edge by
|
||||
* Ptr_piste:
|
||||
* If int = START, the point of beginning of the segment is used
|
||||
* If int = END, the end point of the segment is used
|
||||
* The search is done only on the ends of segments
|
||||
* The search is limited to the area [... pt_base] pt_lim.
|
||||
*/
|
||||
|
||||
TRACK* Locate_Piste_Connectee( TRACK* ptr_piste, TRACK* pt_base,
|
||||
TRACK* pt_lim, int extr );
|
||||
|
||||
/* recherche le segment connecte au segment pointe par
|
||||
* ptr_piste:
|
||||
* si int = START, le point de debut du segment est utilise
|
||||
* si int = END, le point de fin du segment est utilise
|
||||
* La recherche ne se fait que sur les EXTREMITES des segments
|
||||
* La recherche est limitee a la zone [pt_base...]pt_lim.
|
||||
/*
|
||||
* 1 - Locate segment of track leading from the mouse.
|
||||
* 2 - Locate segment of track point by point.
|
||||
* Ref_pX, ref_pY.
|
||||
*
|
||||
* If layer <0 the layer is not tested.
|
||||
*
|
||||
* The search begins to address start_adresse
|
||||
*/
|
||||
|
||||
TRACK* Locate_Pistes( TRACK* start_adresse, int layer, int typeloc );
|
||||
TRACK* Locate_Pistes( TRACK* start_adresse,
|
||||
const wxPoint& ref_pos, int layer );
|
||||
|
||||
/*
|
||||
* 1 - routine de localisation du segment de piste pointe par la souris.
|
||||
* 2 - routine de localisation du segment de piste pointe par le point
|
||||
* ref_pX , ref_pY.
|
||||
*
|
||||
* Si layer < 0 la couche n'est pas testee.
|
||||
*
|
||||
* La recherche commence a l'adresse start_adresse
|
||||
/* Locate pad connected to the beginning or end of a segment
|
||||
* Input: pointer to the segment, and flag = START or END
|
||||
* Returns:
|
||||
* A pointer to the description of the patch if pad was found.
|
||||
* NULL pointer if pad was not found.
|
||||
*/
|
||||
|
||||
D_PAD* Locate_Pad_Connecte( BOARD* Pcb, TRACK* ptr_segment, int extr );
|
||||
|
||||
/* localisation de la pastille connectee au debut ou fin du segment
|
||||
* entree : pointeur sur le segment, et flag = START ou END
|
||||
* retourne:
|
||||
* un pointeur sur la description de la pastille si localisation
|
||||
* pointeur NULL si pastille non trouvee */
|
||||
|
||||
D_PAD* Locate_Any_Pad( BOARD* Pcb, int typeloc, bool OnlyCurrentLayer = FALSE );
|
||||
D_PAD* Locate_Any_Pad( BOARD* Pcb, const wxPoint& ref_pos, bool OnlyCurrentLayer = FALSE );
|
||||
|
||||
/*
|
||||
* localisation de la pastille pointee par la coordonnee ref_pX,,ref_pY, ou
|
||||
* par la souris, recherche faite sur toutes les empreintes.
|
||||
* entree : (OVERHAEAD)
|
||||
* - coord souris (Curseur_X et Curseur_Y)
|
||||
* ou ref_pX, ref_pY
|
||||
* retourne:
|
||||
* pointeur sur la description de la pastille si localisation
|
||||
* pointeur NULL si pastille non trouvee
|
||||
* Locate pad pointed to by the coordinate ref_pX,, ref_pY or the current
|
||||
* cursor position, search done on all tracks.
|
||||
* Entry:
|
||||
* - Mouse coord (Curseur_X and Curseur_Y)
|
||||
* Or ref_pX, ref_pY
|
||||
* Returns:
|
||||
* Pointer to the pad if found
|
||||
* NULL pointer if pad not found
|
||||
*/
|
||||
D_PAD* Locate_Any_Pad( BOARD* Pcb,
|
||||
int typeloc,
|
||||
bool OnlyCurrentLayer = FALSE );
|
||||
D_PAD* Locate_Any_Pad( BOARD* Pcb,
|
||||
const wxPoint& ref_pos,
|
||||
bool OnlyCurrentLayer = FALSE );
|
||||
|
||||
/* Locate pad pointed to by the coordinate ref_pX,, ref_pY or the cursor
|
||||
* position of the current footprint.
|
||||
* Input:
|
||||
* - The module to search.
|
||||
* - Layer to search or -1 to search all layers.
|
||||
* Returns:
|
||||
* A pointer to the pad if found otherwise NULL.
|
||||
*/
|
||||
D_PAD* Locate_Pads( MODULE* Module, int layer, int typeloc );
|
||||
D_PAD* Locate_Pads( MODULE* Module, const wxPoint& ref_pos, int layer );
|
||||
|
||||
/* localisation de la pastille pointee par la coordonnee ref_pX,,ref_pY, ou
|
||||
* par la souris, concernant l'empreinte en cours.
|
||||
* entree :
|
||||
* - parametres generaux de l'empreinte mise a jous par caract()
|
||||
* - layer = couche ou doit se trouver la pastille
|
||||
* (si layer < 0 ) la couche est ignoree)
|
||||
* retourne:
|
||||
* un pointeur sur la description de la pastille si localisation
|
||||
* pointeur NULL si pastille non trouvee
|
||||
*/
|
||||
|
||||
/* Locate a footprint by its bounding rectangle. */
|
||||
MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc );
|
||||
|
||||
/* localisation d'une empreinte par son rectangle d'encadrement */
|
||||
|
||||
/* Locate a pad pointed to by the cursor on the footprint.
|
||||
* Module.
|
||||
* Input:
|
||||
* - Module to search.
|
||||
* Returns:
|
||||
* A pointer to the pad if found otherwise NULL.
|
||||
*/
|
||||
D_PAD* Locate_Pads( MODULE* Module, int typeloc );
|
||||
|
||||
/* localisation de la pastille pointee par la souris, concernant l'empreinte
|
||||
* Module.
|
||||
* entree :
|
||||
* - parametres generaux de l'empreinte mise a jous par caract()
|
||||
* retourne:
|
||||
* un pointeur sur la description de la pastille si localisation
|
||||
* pointeur NULL si pastille non trouvee
|
||||
/* Locate a trace segment at the current cursor position.
|
||||
* The search begins to address start_adresse.
|
||||
*/
|
||||
|
||||
TRACK* Locate_Pistes( TRACK* start_adresse, int typeloc );
|
||||
|
||||
/* routine de localisation du segment de piste pointe par la souris
|
||||
* La recherche commence a l'adresse start_adresse */
|
||||
|
||||
DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc );
|
||||
|
||||
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
|
||||
* ( extremite de piste )
|
||||
* La liste des pads doit deja exister.
|
||||
/* Locate pad containing the point px, py, layer on layer.
|
||||
*
|
||||
* retourne :
|
||||
* NULL si pas de pad localise.
|
||||
* pointeur sur le pad correspondante si pad trouve
|
||||
* (bonne position ET bonne couche). */
|
||||
|
||||
|
||||
TRACK* Locate_Zone( TRACK* start_adresse, int layer, int typeloc );
|
||||
TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer );
|
||||
* The list of pads must already exist.
|
||||
*
|
||||
* Returns:
|
||||
* Pointer to the pad if found, otherwise NULL.
|
||||
*/
|
||||
D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb,
|
||||
const wxPoint& ref_pos,
|
||||
int layer );
|
||||
|
||||
/*
|
||||
* 1 - routine de localisation du segment de zone pointe par la souris.
|
||||
* 2 - routine de localisation du segment de zone pointe par le point
|
||||
* ref_pX , ref_pY.r
|
||||
* 1 - Locate trace segment at the current cursor position.
|
||||
* 2 - Locate trace segment at the given coordinates ref_pos.
|
||||
*
|
||||
* Si layer == -1 , le tst de la couche n'est pas fait
|
||||
* If layer == -1, check all layers.
|
||||
*
|
||||
* La recherche commence a l'adresse start_adresse
|
||||
* The search begins to address start_adresse
|
||||
*/
|
||||
TRACK* Locate_Zone( TRACK* start_adresse, int layer, int typeloc );
|
||||
TRACK* Locate_Zone( TRACK* start_adresse,
|
||||
const wxPoint& ref_pos,
|
||||
int layer );
|
||||
|
||||
|
||||
/*************/
|
||||
|
@ -237,12 +235,15 @@ TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int l
|
|||
/*************/
|
||||
int ChangeSideNumLayer( int oldlayer );
|
||||
void DrawModuleOutlines( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module );
|
||||
void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||
void Montre_Position_Empreinte( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
bool erase );
|
||||
|
||||
|
||||
/* LOADCMP.C : */
|
||||
MODULE* Load_Module_From_Library( WinEDA_DrawFrame* frame, wxDC* DC );
|
||||
|
||||
|
||||
/****************/
|
||||
/* EDITRACK.C : */
|
||||
/****************/
|
||||
|
@ -252,108 +253,119 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack );
|
|||
void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC, bool erase );
|
||||
|
||||
/* Determine coordinate for a segment direction of 0, 90 or 45 degrees,
|
||||
* depending on it's position from the origin (ox, oy) and the current
|
||||
* cursor position.
|
||||
*/
|
||||
void Calcule_Coord_Extremite_45( int ox, int oy, int* fx, int* fy );
|
||||
|
||||
/* determine les coord fx et fy d'un segment
|
||||
* pour avoir un segment oriente a 0, 90 ou 45 degres, selon position
|
||||
* du point d'origine (ox,oy) et de la souris */
|
||||
|
||||
/*****************/
|
||||
/* TRACK.CPP : */
|
||||
/*****************/
|
||||
|
||||
/**
|
||||
* Function Marque_Une_Piste
|
||||
* marks a chain of track segments, connected to aTrackList.
|
||||
* Each segment is marked by setting the BUSY bit into m_Flags. Electrical continuity
|
||||
* is detected by walking each segment, and finally the segments are rearranged
|
||||
* into a contiguous chain within the given list.
|
||||
* @param aPcb = the board to analyse
|
||||
* @param aStartSegm The first interesting segment within a list of track segment of aPcb
|
||||
* @param aSegmCount = a pointer to an integer where to return the number of interesting segments
|
||||
* @param aTrackLen = a pointer to an integer where to return the lenght of the track
|
||||
* @param aReorder =
|
||||
* true for reorder the interesting segments (useful for track edition/deletion)
|
||||
* in this case the flag BUSY is set (the user is responsible of flag clearing)
|
||||
* false for no reorder : useful when we want just calculate the track lenght
|
||||
* in this case, flags are reset
|
||||
* Each segment is marked by setting the BUSY bit into m_Flags. Electrical
|
||||
* continuity is detected by walking each segment, and finally the segments
|
||||
* are rearranged into a contiguous chain within the given list.
|
||||
*
|
||||
* @param aPcb = the board to analyze
|
||||
* @param aStartSegm - The first interesting segment within a list of track
|
||||
* segment of aPcb
|
||||
* @param aSegmCount = a pointer to an integer where to return the number of
|
||||
* interesting segments
|
||||
* @param aTrackLen = a pointer to an integer where to return the lenght of the
|
||||
* track
|
||||
* @param aReorder = true for reorder the interesting segments (useful for
|
||||
* track edition/deletion) in this case the flag BUSY is
|
||||
* set (the user is responsible of flag clearing). False
|
||||
* for no reorder : useful when we want just calculate the
|
||||
* track length in this case, flags are reset
|
||||
* @return TRACK* the first in the chain of interesting segments.
|
||||
*/
|
||||
TRACK* Marque_Une_Piste( BOARD * aPcb, TRACK* aStartSegm, int* aSegmCount, int * aTrackLen, bool aReorder );
|
||||
TRACK* Marque_Une_Piste( BOARD* aPcb,
|
||||
TRACK* aStartSegm,
|
||||
int* aSegmCount,
|
||||
int* aTrackLen,
|
||||
bool aReorder );
|
||||
|
||||
/* Calculate end coordinate of a trace.
|
||||
* Returns 1 if OK, 0 if trace looped back on itself.
|
||||
* The coord are returned StartTrack-> ox, oy
|
||||
* And EndTrack-> fx, fy if OK
|
||||
* The segments are drawn consecutively.
|
||||
*/
|
||||
int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
|
||||
TRACK** StartTrack, TRACK** EndTrack );
|
||||
|
||||
/* Calcule les coordonnes des extremites d'une piste
|
||||
* retourne 1 si OK, 0 si piste bouclee
|
||||
* Les coord sont retournees en StartTrack->ox, oy
|
||||
* et EndTrack->fx, fy si OK
|
||||
* Les segments sont supposes chaines de facon consecutive */
|
||||
|
||||
/* Update the state of a list of structures. */
|
||||
void ListSetState( EDA_BaseStruct* Start, int Nbitem, int State, int onoff );
|
||||
|
||||
/* Met a jour le membre .state d'une chaine de structures */
|
||||
|
||||
|
||||
/**************/
|
||||
/* CLEAN.CPP : */
|
||||
/**************/
|
||||
|
||||
/* Remove segments connected incorrectly.
|
||||
*/
|
||||
int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche );
|
||||
|
||||
/* Supprime les segments mal connectes, cad interconnectant des segments
|
||||
* de net_code differents */
|
||||
|
||||
|
||||
/************/
|
||||
/* ZONES.CPP */
|
||||
/************/
|
||||
int Propagation( WinEDA_PcbFrame* frame );
|
||||
|
||||
/***************/
|
||||
/****************/
|
||||
/* ATTRIBUT.CPP */
|
||||
/***************/
|
||||
/****************/
|
||||
|
||||
void MasqueAttributs( int* masque_set, int* masque_clr );
|
||||
|
||||
/* Calcule les attributs a remettre a 0 (masque_clr) et a mettre a 1
|
||||
* (masque_set), en fonction des options d'attributs
|
||||
/* Compute the attributes that are 0 (masque_clr) and put a 1
|
||||
* (Masque_set), depending on the options attribute.
|
||||
*
|
||||
* ces attributs sont normalement le membre .flags de la structure TRACK
|
||||
* les pointeurs NULLs sont acceptes
|
||||
* These attributes are normally the member flags of the structure TRACK
|
||||
* Pointers NULLs are accepted.
|
||||
*/
|
||||
void MasqueAttributs( int* masque_set, int* masque_clr );
|
||||
|
||||
|
||||
/***************/
|
||||
/* DUPLTRAC.CPP */
|
||||
/***************/
|
||||
|
||||
/* Routine trouvant le point " d'accrochage " d'une extremite de piste.
|
||||
* Ce point peut etre un PAD ou un autre segment de piste
|
||||
* Retourne:
|
||||
* - pointeur sur ce PAD ou:
|
||||
* - pointeur sur le segment ou:
|
||||
/* Routine to find the point "attachment" at the end of a trace.
|
||||
* This may be a PAD or another trace segment.
|
||||
* Returns:
|
||||
* - Pointer to the PAD or:
|
||||
* - Pointer to the segment or:
|
||||
* - NULL
|
||||
* Parametres d'appel:
|
||||
* coord aPos du point tst
|
||||
* aLayerMask masque des couches a tester
|
||||
* Parameters:
|
||||
* - aPos - coordinate point test
|
||||
* ALayerMask of mask layers to be tested
|
||||
*/
|
||||
BOARD_ITEM* LocateLockPoint( BOARD* aPcb, wxPoint aPos, int aLayerMask );
|
||||
|
||||
|
||||
/* Routine de creation d'un point intermediaire sur un segment
|
||||
* le segment aSegm est casse en 2 segments se raccordant au point pX, pY
|
||||
* retourne:
|
||||
* NULL si pas de nouveau point ( c.a.d si aRefPoint correspondait deja
|
||||
* a une extremite ou:
|
||||
* pointeur sur le segment cree
|
||||
* si aRefSegm != NULL refsegm est pointeur sur le segment incident,
|
||||
* et le point cree est l'intersection des 2 axes des segments ptsegm et aRefSegm
|
||||
* retourne la valeur exacte de aRefPoint
|
||||
* Si aSegm pointe sur une via:
|
||||
* retourne la valeur exacte de aRefPoint et aSegm,
|
||||
* mais ne cree pas de point supplementaire
|
||||
/* Create an intermediate point on a segment
|
||||
* ASegm segment is broken into 2 segments connecting point pX, pY
|
||||
* Returns:
|
||||
* NULL if no new point (ie if aRefPoint already corresponded
|
||||
* At one end where:
|
||||
* Pointer to the segment created
|
||||
* If aRefSegm! Refsegm = NULL pointer is on the segment
|
||||
* Created and the point is the intersection of 2 lines segments ptsegm
|
||||
* and aRefSegm
|
||||
* Returns the exact value of aRefPoint
|
||||
* If aSegm points to a via:
|
||||
* Returns the exact value of aRefPoint and aSegm, but does not create
|
||||
* extra point
|
||||
*/
|
||||
TRACK* CreateLockPoint( wxPoint & aRefPoint, TRACK* aSegm, TRACK* aRefSegm, PICKED_ITEMS_LIST* aItemsListPicker );
|
||||
TRACK* CreateLockPoint( wxPoint& aRefPoint,
|
||||
TRACK* aSegm,
|
||||
TRACK* aRefSegm,
|
||||
PICKED_ITEMS_LIST* aItemsListPicker );
|
||||
|
||||
|
||||
/****************/
|
||||
/* CONTROLE.CPP */
|
||||
|
@ -365,17 +377,18 @@ bool Project( wxPoint* res, wxPoint on_grid, const TRACK* track );
|
|||
/***************/
|
||||
/* AUTOROUT.CPP */
|
||||
/***************/
|
||||
void DisplayBoard( WinEDA_DrawPanel* panel, wxDC* DC ); /* routine de Debug */
|
||||
void DisplayBoard( WinEDA_DrawPanel* panel, wxDC* DC ); /* for Debugging */
|
||||
|
||||
|
||||
/**************/
|
||||
/* NETLIST.CPP */
|
||||
/**************/
|
||||
|
||||
/* List the names of the modules of PCB
|
||||
* Returns a pointer to the module selected or NULL if no selection.
|
||||
*/
|
||||
MODULE* ListAndSelectModuleName( COMMAND* Cmd );
|
||||
|
||||
/* liste les noms des modules du PCB
|
||||
* Retourne un pointeur sur le module selectionne
|
||||
* ( ou NULL si pas de selection ) */
|
||||
|
||||
/*****************/
|
||||
/* SET_COLOR.CPP */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*******************************************/
|
||||
/* EDITEUR de PCB: routines d'AUTOROUTAGE: */
|
||||
/*******************************************/
|
||||
/*************/
|
||||
/* queue.cpp */
|
||||
/*************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
@ -28,17 +28,15 @@ static struct PcbQueue *Head = NULL;
|
|||
static struct PcbQueue* Tail = NULL;
|
||||
static struct PcbQueue* Save = NULL; /* hold empty queue structs */
|
||||
|
||||
/* Routines definies ici : */
|
||||
|
||||
void InitQueue();
|
||||
void GetQueue( int*, int*, int*, int*, int* );
|
||||
int SetQueue( int, int, int, int, int, int, int );
|
||||
void ReSetQueue( int, int, int, int, int, int, int );
|
||||
|
||||
|
||||
/************************/
|
||||
void FreeQueue()
|
||||
/************************/
|
||||
/* Free the memory used for storing all the queue */
|
||||
void FreeQueue()
|
||||
{
|
||||
struct PcbQueue* p;
|
||||
|
||||
|
@ -48,9 +46,7 @@ struct PcbQueue *p;
|
|||
Save = p->Next; MyFree( p );
|
||||
}
|
||||
}
|
||||
/************************/
|
||||
/* void InitQueue() */
|
||||
/************************/
|
||||
|
||||
|
||||
/* initialize the search queue */
|
||||
void InitQueue()
|
||||
|
@ -62,15 +58,12 @@ struct PcbQueue *p;
|
|||
Head = p->Next;
|
||||
p->Next = Save; Save = p;
|
||||
}
|
||||
|
||||
Tail = NULL;
|
||||
OpenNodes = ClosNodes = MoveNodes = MaxNodes = qlen = 0;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
/* void GetQueue(int *r, int *c, int *s, int *d, int *a) */
|
||||
/*********************************************************/
|
||||
|
||||
/* get search queue item from list */
|
||||
void GetQueue( int* r, int* c, int* s, int* d, int* a )
|
||||
{
|
||||
|
@ -81,13 +74,13 @@ struct PcbQueue *p;
|
|||
*r = p->Row; *c = p->Col;
|
||||
*s = p->Side;
|
||||
*d = p->Dist; *a = p->ApxDist;
|
||||
if ((Head = p->Next) == NULL) Tail = NULL;
|
||||
if( (Head = p->Next) == NULL )
|
||||
Tail = NULL;
|
||||
|
||||
/* put node on free list */
|
||||
p->Next = Save; Save = p;
|
||||
ClosNodes++; qlen--;
|
||||
}
|
||||
|
||||
else /* empty list */
|
||||
{
|
||||
*r = *c = *s = *d = *a = ILLEGAL;
|
||||
|
@ -95,18 +88,16 @@ struct PcbQueue *p;
|
|||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
int SetQueue (int r,int c,int side,int d,int a,int r2,int c2 )
|
||||
/****************************************************************/
|
||||
/* add a search node to the list
|
||||
Return:
|
||||
1 si OK
|
||||
0 si defaut allocation Memoire
|
||||
* Return:
|
||||
* 1 - OK
|
||||
* 0 - Failed to allocate memory.
|
||||
*/
|
||||
int SetQueue( int r, int c, int side, int d, int a, int r2, int c2 )
|
||||
{
|
||||
struct PcbQueue* p, * q, * t;
|
||||
int i, j;
|
||||
|
||||
j = 0; // gcc warning fix
|
||||
|
||||
if( (p = Save) != NULL ) /* try free list first */
|
||||
|
@ -114,32 +105,36 @@ int SetQueue (int r,int c,int side,int d,int a,int r2,int c2 )
|
|||
Save = p->Next;
|
||||
}
|
||||
else if( ( p = (struct PcbQueue*) MyMalloc( sizeof(PcbQueue) ) ) == NULL )
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
p->Row = r;
|
||||
p->Col = c;
|
||||
p->Side = side;
|
||||
i = (p->Dist = d) + (p->ApxDist = a);
|
||||
p->Next = NULL;
|
||||
if( (q = Head) != NULL)
|
||||
{ /* insert in proper position in list */
|
||||
if (q->Dist + q->ApxDist > i)
|
||||
{ /* insert at head */
|
||||
if( (q = Head) != NULL ) /* insert in proper position in list */
|
||||
{
|
||||
if( q->Dist + q->ApxDist > i ) /* insert at head */
|
||||
{
|
||||
p->Next = q; Head = p;
|
||||
}
|
||||
else { /* search for proper position */
|
||||
else /* search for proper position */
|
||||
{
|
||||
for( t = q, q = q->Next; q && i > ( j = q->Dist + q->ApxDist );
|
||||
t = q, q = q->Next )
|
||||
;
|
||||
|
||||
if( q && i == j && q->Row == r2 && q->Col == c2 )
|
||||
{
|
||||
/* insert after q, which is a goal node */
|
||||
if ( (p->Next = q->Next) == NULL) Tail = p;
|
||||
if( ( p->Next = q->Next ) == NULL )
|
||||
Tail = p;
|
||||
q->Next = p;
|
||||
}
|
||||
else
|
||||
{ /* insert in front of q */
|
||||
if ((p->Next = q) == NULL) Tail = p;
|
||||
else /* insert in front of q */
|
||||
{
|
||||
if( ( p->Next = q ) == NULL )
|
||||
Tail = p;
|
||||
t->Next = p;
|
||||
}
|
||||
}
|
||||
|
@ -147,33 +142,39 @@ int SetQueue (int r,int c,int side,int d,int a,int r2,int c2 )
|
|||
else /* empty search list */
|
||||
Head = Tail = p;
|
||||
OpenNodes++;
|
||||
if (++qlen > MaxNodes) MaxNodes = qlen;
|
||||
return(1);
|
||||
if( ++qlen > MaxNodes )
|
||||
MaxNodes = qlen;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
void ReSetQueue (int r,int c,int s,int d,int a,int r2,int c2 )
|
||||
/******************************************************************/
|
||||
/* reposition node in list */
|
||||
void ReSetQueue( int r, int c, int s, int d, int a, int r2, int c2 )
|
||||
{
|
||||
struct PcbQueue* p, * q;
|
||||
|
||||
/* first, see if it is already in the list */
|
||||
for (q = NULL, p = Head; p; q = p, p = p->Next) {
|
||||
if (p->Row == r && p->Col == c && p->Side == s) {
|
||||
for( q = NULL, p = Head; p; q = p, p = p->Next )
|
||||
{
|
||||
if( p->Row == r && p->Col == c && p->Side == s )
|
||||
{
|
||||
/* old one to remove */
|
||||
if( q )
|
||||
{
|
||||
if ( (q->Next = p->Next) == NULL) Tail = q;
|
||||
if( ( q->Next = p->Next ) == NULL )
|
||||
Tail = q;
|
||||
}
|
||||
else if ((Head = p->Next) == NULL) Tail = NULL;
|
||||
p->Next = Save; Save = p;
|
||||
OpenNodes--; MoveNodes++;
|
||||
else if( ( Head = p->Next ) == NULL )
|
||||
Tail = NULL;
|
||||
p->Next = Save;
|
||||
Save = p;
|
||||
OpenNodes--;
|
||||
MoveNodes++;
|
||||
qlen--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !p ) /* not found, it has already been closed once */
|
||||
ClosNodes--; /* we will close it again, but just count once */
|
||||
/* if it was there, it's gone now; insert it at the proper position */
|
||||
|
|
|
@ -15,21 +15,27 @@
|
|||
#include "protos.h"
|
||||
|
||||
|
||||
/* local variables */
|
||||
static std::vector <D_PAD*> s_localPadBuffer; // for local ratsnest calculations when moving a footprint: buffer of pads to consider
|
||||
static std::vector <D_PAD*> s_localPadBuffer; // for local ratsnest
|
||||
// calculations when moving a
|
||||
// footprint: buffer of pads to
|
||||
// consider
|
||||
|
||||
static bool DisplayRastnestInProgress; // Enable the display of the ratsnest during the ratsnest computations
|
||||
static bool DisplayRastnestInProgress; // Enable the display of the
|
||||
// ratsnest during the ratsnest
|
||||
// computations
|
||||
|
||||
/* Note about the ratsnest computation:
|
||||
* Building the general ratsnest:
|
||||
* I used the "lee algoritm".
|
||||
* This is a 2 steps algoritm.
|
||||
* the m_SubRatsnest member of pads handle a "block number" or a "cluster number" or a "subnet number"
|
||||
* I used the "lee algorithm".
|
||||
* This is a 2 steps algorithm.
|
||||
* the m_SubRatsnest member of pads handle a "block number" or a "cluster
|
||||
* number" or a "subnet number"
|
||||
* initially, m_SubRatsnest = 0 (pad not connected).
|
||||
* Build_Board_Ratsnest( wxDC* DC ) Create this rastnest
|
||||
* Build_Board_Ratsnest( wxDC* DC ) Create this ratsnest
|
||||
* for each net:
|
||||
* First:
|
||||
* we create a link (and therefore a logical block) between 2 pad. This is achieved by:
|
||||
* we create a link (and therefore a logical block) between 2 pad. This is
|
||||
* achieved by:
|
||||
* search for a pad without link.
|
||||
* search its nearest pad
|
||||
* link these 2 pads (i.e. create a ratsnest item)
|
||||
|
@ -38,75 +44,82 @@ static bool DisplayRastnestInProgress; // Enable the display of
|
|||
* Each logical block has a number called block number or "subnet number",
|
||||
* stored in m_SubRatsnest member for each pad of the block.
|
||||
* The first block has its block number = 1, the second is 2 ...
|
||||
* the function to do thas is gen_rats_pad_to_pad()
|
||||
* the function to do that is gen_rats_pad_to_pad()
|
||||
*
|
||||
* Secondly:
|
||||
* The first pass created many logical blocks
|
||||
* A block contains 2 or more pads.
|
||||
* we create links between 2 block. This is achieved by:
|
||||
* Test all pads in the first block, and search (for each pad)
|
||||
* a neighboor in other blocks and compute the distance between pads,
|
||||
* a neighbor in other blocks and compute the distance between pads,
|
||||
* We select the pad pair which have the smallest distance.
|
||||
* These 2 pads are linked (i.e. a new ratsnest item is created between thes 2 pads)
|
||||
* These 2 pads are linked (i.e. a new ratsnest item is created between the 2
|
||||
* pads)
|
||||
* and the 2 block are merged.
|
||||
* Therefore the logical block 1 contains the initial block 1 "eats" the pads of the other block
|
||||
* Therefore the logical block 1 contains the initial block 1 "eats" the pads
|
||||
* of the other block
|
||||
* The computation is made until only one block is found.
|
||||
* the function used is gen_rats_block_to_block()
|
||||
*
|
||||
*
|
||||
* How existing and new tracks are handled:
|
||||
* The complete rastnest (using the pad analysis) is computed.
|
||||
* it is independant of the tracks and handle the "logical connections".
|
||||
* The complete ratsnest (using the pad analysis) is computed.
|
||||
* it is independent of the tracks and handle the "logical connections".
|
||||
* It depends only on the footprints geometry (and the netlist),
|
||||
* and must be computed only after a netlist read or a footprints geometry change.
|
||||
* Each link (ratsnest) can only be INACTIVE (because pads are connected by a track) or ACTIVE (no tracks)
|
||||
* and must be computed only after a netlist read or a footprints geometry
|
||||
* change.
|
||||
* Each link (ratsnest) can only be INACTIVE (because pads are connected by a
|
||||
* track) or ACTIVE (no tracks)
|
||||
*
|
||||
* After the complete rastnest is built, or when a track is added or deleted,
|
||||
* we run an algorithm derived from the complete rastnest computation.
|
||||
* it is much faster because it analyses only the existing rastnest and not all the pads list
|
||||
* and determine only if an existing rastnest must be activated
|
||||
* After the complete ratsnest is built, or when a track is added or deleted,
|
||||
* we run an algorithm derived from the complete ratsnest computation.
|
||||
* it is much faster because it analysis only the existing ratsnest and not all
|
||||
* the pads list
|
||||
* and determine only if an existing ratsnest must be activated
|
||||
* (no physical track exists) or not (a physical track exists)
|
||||
* if a track is added or deleted only the corresponding net is tested.
|
||||
*
|
||||
* the m_SubRatsnest member of pads is set to 0 (no blocks), and alls links are set to INACTIVE (ratsnest not show).
|
||||
* Before running this fast lee algorithm, we create blocks (and their corresponding block number)
|
||||
* the m_SubRatsnest member of pads is set to 0 (no blocks), and all links are
|
||||
* set to INACTIVE (ratsnest not show).
|
||||
* Before running this fast lee algorithm, we create blocks (and their
|
||||
* corresponding block number)
|
||||
* by grouping pads connected by tracks.
|
||||
* So, when tracks exists, the fast lee algorithm is started with some blocks already created.
|
||||
* because the fast lee algorithm test only the ratsnest and does not search for
|
||||
* nearest pads (this search was previously made) the online ratsnest can be done
|
||||
* when a track is created without noticeable computing time
|
||||
* So, when tracks exists, the fast lee algorithm is started with some blocks
|
||||
* already created.
|
||||
* because the fast lee algorithm test only the ratsnest and does not search
|
||||
* for nearest pads (this search was previously made) the online ratsnest
|
||||
* can be done when a track is created without noticeable computing time
|
||||
* First:
|
||||
* for all links (in this step, all are inactive):
|
||||
* search for a link which have 1 (or 2) pad having the m_SubRatsnest member = 0.
|
||||
* if found the link is set to ACTIVE (i.e. the ratsnest will be showed) and the pad is meged with the block
|
||||
* search for a link which have 1 (or 2) pad having the m_SubRatsnest member =
|
||||
* 0.
|
||||
* if found the link is set to ACTIVE (i.e. the ratsnest will be showed) and
|
||||
* the pad is merged with the block
|
||||
* or a new block is created ( see tst_rats_pad_to_pad() ).
|
||||
* Secondly:
|
||||
* blocks are tested:
|
||||
* for all links we search if the 2 pads linkeds are in 2 different block.
|
||||
* for all links we search if the 2 pads linked are in 2 different block.
|
||||
* if yes, the link status is set to ACTIVE, and the 2 block are merged
|
||||
* until only one block is found
|
||||
* ( see tst_rats_block_to_block() )
|
||||
*
|
||||
*
|
||||
*/
|
||||
/******************************************************************************/
|
||||
void WinEDA_BasePcbFrame::Compile_Ratsnest( wxDC* DC, bool display_status_pcb )
|
||||
/******************************************************************************/
|
||||
|
||||
/** Function Compile_Ratsnest
|
||||
* Create the entire board ratsnesr.
|
||||
* Create the entire board ratsnest.
|
||||
* Must be called after a board change (changes for
|
||||
* pads, footprints or a read netlist ).
|
||||
*
|
||||
* @param display_status_pcb : if true, display the computation results
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::Compile_Ratsnest( wxDC* DC, bool display_status_pcb )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
DisplayRastnestInProgress = TRUE;
|
||||
|
||||
|
||||
GetBoard()->m_Status_Pcb = 0; /* we want a full ratnest computation, from the scratch */
|
||||
GetBoard()->m_Status_Pcb = 0; /* we want a full ratsnest computation,
|
||||
* from the scratch */
|
||||
MsgPanel->EraseMsgBox();
|
||||
|
||||
// Rebuild the full pads and net info list
|
||||
|
@ -126,18 +139,20 @@ void WinEDA_BasePcbFrame::Compile_Ratsnest( wxDC* DC, bool display_status_pcb )
|
|||
|
||||
/* Compute the full ratsnest
|
||||
* which can be see like all the possible links or logical connections.
|
||||
* some of thems are active (no track connected) and others are inactive (when track connect pads)
|
||||
* some of them are active (no track connected) and others are inactive
|
||||
* (when track connect pads)
|
||||
* This full ratsnest is not modified by track editing.
|
||||
* It changes only when a netlist is read, or footprints are modified
|
||||
*/
|
||||
Build_Board_Ratsnest( DC );
|
||||
|
||||
/* Compute the pad connections due to the existing tracks (physical connections)*/
|
||||
/* Compute the pad connections due to the existing tracks (physical
|
||||
* connections) */
|
||||
test_connexions( DC );
|
||||
|
||||
/* Compute the active ratsnest, i.e. the unconnected links
|
||||
* it is faster than Build_Board_Ratsnest()
|
||||
* because many optimisations and computations are already made
|
||||
* because many optimizations and computations are already made
|
||||
*/
|
||||
Tst_Ratsnest( DC, 0 );
|
||||
|
||||
|
@ -150,13 +165,10 @@ void WinEDA_BasePcbFrame::Compile_Ratsnest( wxDC* DC, bool display_status_pcb )
|
|||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
static int sortByNetcode( const void* o1, const void* o2 )
|
||||
/****************************************************************/
|
||||
|
||||
/* Sort function used by QSORT
|
||||
* Sort pads by net code
|
||||
*/
|
||||
static int sortByNetcode( const void* o1, const void* o2 )
|
||||
{
|
||||
D_PAD** pt_ref = (D_PAD**) o1;
|
||||
D_PAD** pt_compare = (D_PAD**) o2;
|
||||
|
@ -165,13 +177,10 @@ static int sortByNetcode( const void* o1, const void* o2 )
|
|||
}
|
||||
|
||||
|
||||
/********************************************************/
|
||||
static int sort_by_length( const void* o1, const void* o2 )
|
||||
/********************************************************/
|
||||
|
||||
/* Sort function used by QSORT
|
||||
* Sort ratsnest by lenght
|
||||
* Sort ratsnest by length
|
||||
*/
|
||||
static int sort_by_length( const void* o1, const void* o2 )
|
||||
{
|
||||
RATSNEST_ITEM* ref = (RATSNEST_ITEM*) o1;
|
||||
RATSNEST_ITEM* compare = (RATSNEST_ITEM*) o2;
|
||||
|
@ -180,32 +189,37 @@ static int sort_by_length( const void* o1, const void* o2 )
|
|||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
static int gen_rats_block_to_block( std::vector<RATSNEST_ITEM>& aRatsnestBuffer,
|
||||
std::vector<D_PAD*>& aPadBuffer,
|
||||
unsigned aPadIdxStart,
|
||||
unsigned aPadIdxMax )
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Function used by Build_Board_Ratsnest()
|
||||
* This function creates a rastsnet between two blocks ( which fit the same net )
|
||||
* A block is a group of pads already linked (by a previous ratsnest computation, or tracks)
|
||||
* The search is made between the pads in block 1 (the reference block) and other blocks
|
||||
* This function creates a ratsnest between two blocks ( which fit the same
|
||||
* net )
|
||||
* A block is a group of pads already linked (by a previous ratsnest
|
||||
* computation, or tracks)
|
||||
* The search is made between the pads in block 1 (the reference block) and
|
||||
* other blocks
|
||||
* the block n ( n > 1 ) it connected to block 1 by their 2 nearest pads.
|
||||
* When the block is found, it is merged with the block 1
|
||||
* the D_PAD member m_SubRatsnest handles the block number
|
||||
* @param aRatsnestBuffer = a std::vector<RATSNEST_ITEM> buffer to fill with new ratsnest items
|
||||
* @param aPadBuffer = a std::vector<D_PAD*> that is the list of pads to consider
|
||||
* @param aRatsnestBuffer = a std::vector<RATSNEST_ITEM> buffer to fill with
|
||||
* new ratsnest items
|
||||
* @param aPadBuffer = a std::vector<D_PAD*> that is the list of pads to
|
||||
* consider
|
||||
* @param aPadIdxStart = starting index (within the pad list) for search
|
||||
* @param aPadIdxMax = ending index (within the pad list) for search
|
||||
* @return blocks not connected count
|
||||
*/
|
||||
static int gen_rats_block_to_block(
|
||||
std::vector<RATSNEST_ITEM>& aRatsnestBuffer,
|
||||
std::vector<D_PAD*>& aPadBuffer,
|
||||
unsigned aPadIdxStart,
|
||||
unsigned aPadIdxMax )
|
||||
{
|
||||
int dist_min, current_dist;
|
||||
int current_num_block = 1;
|
||||
int padBlock1Idx = -1; // Index in aPadBuffer for the "better" pad found in block 1
|
||||
int padBlockToMergeIdx = -1; // Index in aPadBuffer for the "better" pad found in block to merge
|
||||
int padBlock1Idx = -1; // Index in aPadBuffer for the "better" pad
|
||||
// found in block 1
|
||||
int padBlockToMergeIdx = -1; // Index in aPadBuffer for the "better" pad
|
||||
// found in block to merge
|
||||
|
||||
dist_min = 0x7FFFFFFF;
|
||||
|
||||
|
@ -218,7 +232,7 @@ static int gen_rats_block_to_block( std::vector<RATSNEST_ITEM>& aRatsnestBuffer,
|
|||
if( ref_pad->GetSubRatsnest() != 1 )
|
||||
continue;
|
||||
|
||||
/* pad is found, search its nearest neighbour in other blocks */
|
||||
/* pad is found, search its nearest neighbor in other blocks */
|
||||
for( unsigned jj = aPadIdxStart; jj < aPadIdxMax; jj++ )
|
||||
{
|
||||
D_PAD* curr_pad = aPadBuffer[jj];
|
||||
|
@ -233,7 +247,7 @@ static int gen_rats_block_to_block( std::vector<RATSNEST_ITEM>& aRatsnestBuffer,
|
|||
if( dist_min > current_dist ) // we have found a better pad pair
|
||||
{
|
||||
// The tested block can be a good candidate for merging
|
||||
// we memorise the "best" current values for merging
|
||||
// we memorize the "best" current values for merging
|
||||
current_num_block = curr_pad->GetSubRatsnest();
|
||||
dist_min = current_dist;
|
||||
|
||||
|
@ -243,15 +257,16 @@ static int gen_rats_block_to_block( std::vector<RATSNEST_ITEM>& aRatsnestBuffer,
|
|||
}
|
||||
}
|
||||
|
||||
/* The reference block is labelled block 1.
|
||||
* if current_num_block != 1 we have found an other block, and we must merge it
|
||||
* with the reference block
|
||||
/* The reference block is labeled block 1.
|
||||
* if current_num_block != 1 we have found an other block, and we must
|
||||
* merge it with the reference block
|
||||
* The link is made by the 2 nearest pads
|
||||
*/
|
||||
if( current_num_block > 1 )
|
||||
{
|
||||
/* The block n (n=current_num_block) is merged with the bloc 1 :
|
||||
* to do that, we set the m_SubRatsnest member to 1 for all pads in block n
|
||||
* to do that, we set the m_SubRatsnest member to 1 for all pads in
|
||||
* block n
|
||||
*/
|
||||
for( unsigned ii = aPadIdxStart; ii < aPadIdxMax; ii++ )
|
||||
{
|
||||
|
@ -261,10 +276,11 @@ static int gen_rats_block_to_block( std::vector<RATSNEST_ITEM>& aRatsnestBuffer,
|
|||
}
|
||||
|
||||
if( padBlock1Idx < 0 )
|
||||
DisplayError( NULL, wxT( "gen_rats_block_to_block() internal error" ) );
|
||||
DisplayError( NULL,
|
||||
wxT( "gen_rats_block_to_block() internal error" ) );
|
||||
else
|
||||
{
|
||||
/* Create the new ratsnet */
|
||||
/* Create the new ratsnest */
|
||||
RATSNEST_ITEM net;
|
||||
net.SetNet( aPadBuffer[padBlock1Idx]->GetNet() );
|
||||
net.m_Status = CH_ACTIF | CH_VISIBLE;
|
||||
|
@ -278,32 +294,33 @@ static int gen_rats_block_to_block( std::vector<RATSNEST_ITEM>& aRatsnestBuffer,
|
|||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Function used by Build_Board_Ratsnest()
|
||||
* this is the first pass of the lee algorithm
|
||||
* This function creates the link (ratsnest) between 2 pads ( fitting the same
|
||||
* net )
|
||||
* the function search for a first not connected pad and search its nearest
|
||||
* neighbor
|
||||
* Its creates a block if the 2 pads are not connected, or merge the
|
||||
* unconnected pad to the existing block.
|
||||
* These blocks include 2 pads and the 2 pads are linked by a ratsnest.
|
||||
*
|
||||
* @param aRatsnestBuffer = a std::vector<RATSNEST_ITEM> buffer to fill with
|
||||
* new ratsnest items
|
||||
* @param aPadBuffer = a std::vector<D_PAD*> that is the list of pads to
|
||||
* consider
|
||||
* @param aPadIdxStart = starting index (within the pad list) for search
|
||||
* @param aPadIdxMax = ending index (within the pad list) for search
|
||||
* @param current_num_block = Last existing block number of pads
|
||||
* These block are created by the existing tracks analysis
|
||||
*
|
||||
* @return the last block number used
|
||||
*/
|
||||
static int gen_rats_pad_to_pad( vector<RATSNEST_ITEM>& aRatsnestBuffer,
|
||||
std::vector<D_PAD*>& aPadBuffer,
|
||||
unsigned aPadIdxStart,
|
||||
unsigned aPadIdxMax,
|
||||
int current_num_block )
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Function used by Build_Board_Ratsnest()
|
||||
* this is the first pass of the lee algorithm
|
||||
* This function creates the link (ratsnest) between 2 pads ( fitting the same net )
|
||||
* the function search for a first not connected pad
|
||||
* and search its nearest neighboor
|
||||
* Its creates a block if the 2 pads are not connected, or merge the unconnected pad to the existing block.
|
||||
* These blocks include 2 pads and the 2 pads are linked by a ratsnest.
|
||||
*
|
||||
* @param aRatsnestBuffer = a std::vector<RATSNEST_ITEM> buffer to fill with new ratsnest items
|
||||
* @param aPadBuffer = a std::vector<D_PAD*> that is the list of pads to consider
|
||||
* @param aPadIdxStart = starting index (within the pad list) for search
|
||||
* @param aPadIdxMax = ending index (within the pad list) for search
|
||||
* @param current_num_block = Last existing block number de pads
|
||||
* These block are created by the existing tracks analysis
|
||||
*
|
||||
* @return the last block number used
|
||||
*/
|
||||
{
|
||||
int dist_min, current_dist;
|
||||
D_PAD* ref_pad, * pad;
|
||||
|
@ -316,7 +333,8 @@ static int gen_rats_pad_to_pad( vector<RATSNEST_ITEM>& aRatsnestBuffer,
|
|||
continue; // Pad already connected
|
||||
|
||||
dist_min = 0x7FFFFFFF;
|
||||
int padBlockToMergeIdx = -1; // Index in aPadBuffer for the "better" pad found in block to merge
|
||||
int padBlockToMergeIdx = -1; // Index in aPadBuffer for the "better"
|
||||
// pad found in block to merge
|
||||
for( unsigned jj = aPadIdxStart; jj < aPadIdxMax; jj++ )
|
||||
{
|
||||
if( ii == jj )
|
||||
|
@ -342,19 +360,22 @@ static int gen_rats_pad_to_pad( vector<RATSNEST_ITEM>& aRatsnestBuffer,
|
|||
/* Update the block number
|
||||
* if the 2 pads are not already created : a new block is created
|
||||
*/
|
||||
if( (pad->GetSubRatsnest() == 0) && (ref_pad->GetSubRatsnest() == 0) )
|
||||
if( (pad->GetSubRatsnest() == 0)
|
||||
&& (ref_pad->GetSubRatsnest() == 0) )
|
||||
{
|
||||
current_num_block++; // Creates a new block number (or subratsnest)
|
||||
current_num_block++; // Creates a new block number (or
|
||||
// subratsnest)
|
||||
pad->SetSubRatsnest( current_num_block );
|
||||
ref_pad->SetSubRatsnest( current_num_block );
|
||||
}
|
||||
/* If a pad is already connected connected : merge the other pad in the block */
|
||||
/* If a pad is already connected connected : merge the other pad in
|
||||
* the block */
|
||||
else
|
||||
{
|
||||
ref_pad->SetSubRatsnest( pad->GetSubRatsnest() );
|
||||
}
|
||||
|
||||
/* Create the new ratsnet item */
|
||||
/* Create the new ratsnest item */
|
||||
RATSNEST_ITEM rast;
|
||||
rast.SetNet( ref_pad->GetNet() );
|
||||
rast.m_Status = CH_ACTIF | CH_VISIBLE;
|
||||
|
@ -369,10 +390,6 @@ static int gen_rats_pad_to_pad( vector<RATSNEST_ITEM>& aRatsnestBuffer,
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************/
|
||||
void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
|
||||
/***********************************************************/
|
||||
|
||||
/** Function to compute the full ratsnest (using the LEE algorithm )
|
||||
* In the functions tracks are not considered
|
||||
* This is only the "basic" ratsnest depending only on pads.
|
||||
|
@ -383,14 +400,14 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
|
|||
*
|
||||
* - Compute the ratsnest (LEE algorithm ):
|
||||
* a - Create the ratsnest between a not connected pad and its nearest
|
||||
* neighbour. Blocks of pads are created
|
||||
* neighbor. Blocks of pads are created
|
||||
* b - Create the ratsnest between blocks:
|
||||
* Test the pads of the 1st block and create a link (ratsnest)
|
||||
* with the nearest pad found in an other block.
|
||||
* The other block is merged with the first block.
|
||||
* until only one block is left.
|
||||
*
|
||||
* A ratnest can be seen as a logical connection.
|
||||
* A ratsnest can be seen as a logical connection.
|
||||
*
|
||||
* Update :
|
||||
* nb_nodes = Active pads count for the board
|
||||
|
@ -398,6 +415,7 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
|
|||
* (there are n-1 links for an equipotent which have n active pads) .
|
||||
*
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
|
||||
{
|
||||
D_PAD* pad;
|
||||
int noconn;
|
||||
|
@ -420,12 +438,13 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
|
|||
}
|
||||
|
||||
if( m_Pcb->GetNodesCount() == 0 )
|
||||
return; /* pas de connexions utiles */
|
||||
return; /* No useful connections. */
|
||||
|
||||
/* Ratsnest computation */
|
||||
DisplayRastnestInProgress = TRUE;
|
||||
|
||||
unsigned current_net_code = 1; // 1er net_code a analyser (net_code = 0 -> no connect)
|
||||
unsigned current_net_code = 1; // First net code is analyzed.
|
||||
// (net_code = 0 -> no connect)
|
||||
noconn = 0;
|
||||
|
||||
for( ; current_net_code < m_Pcb->m_NetInfo->GetCount(); current_net_code++ )
|
||||
|
@ -433,7 +452,8 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
|
|||
NETINFO_ITEM* net = m_Pcb->FindNet( current_net_code );
|
||||
if( net == NULL ) //Should not occur
|
||||
{
|
||||
DisplayError( this, wxT( "Build_Board_Ratsnest() error: net not found" ) );
|
||||
DisplayError( this,
|
||||
wxT( "Build_Board_Ratsnest() error: net not found" ) );
|
||||
return;
|
||||
}
|
||||
net->m_RatsnestStartIdx = m_Pcb->GetRatsnestsCount();
|
||||
|
@ -459,14 +479,16 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
|
|||
/* b - blocks connection (Iteration) */
|
||||
while( icnt > 1 )
|
||||
{
|
||||
icnt = gen_rats_block_to_block( m_Pcb->m_FullRatsnest, net->m_ListPad, 0,
|
||||
icnt = gen_rats_block_to_block( m_Pcb->m_FullRatsnest,
|
||||
net->m_ListPad,
|
||||
0,
|
||||
net->m_ListPad.size() );
|
||||
net = m_Pcb->FindNet( current_net_code );
|
||||
}
|
||||
|
||||
net->m_RatsnestEndIdx = m_Pcb->GetRatsnestsCount();
|
||||
|
||||
/* sort by lenght */
|
||||
/* sort by length */
|
||||
net = m_Pcb->FindNet( current_net_code );
|
||||
if( ( net->m_RatsnestEndIdx - net->m_RatsnestStartIdx ) > 1 )
|
||||
{
|
||||
|
@ -487,20 +509,19 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
|
|||
m_Pcb->m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE;
|
||||
|
||||
if( DC )
|
||||
m_Pcb->m_FullRatsnest[ii].Draw( DrawPanel, DC, GR_XOR, wxPoint( 0, 0 ) );
|
||||
m_Pcb->m_FullRatsnest[ii].Draw( DrawPanel, DC, GR_XOR,
|
||||
wxPoint( 0, 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
void WinEDA_BasePcbFrame::DrawGeneralRatsnest( wxDC* DC, int net_code )
|
||||
/*********************************************************************/
|
||||
|
||||
/**
|
||||
* Displays the general ratsnest
|
||||
* Only ratsnets with the status bit CH_VISIBLE is set are displayed
|
||||
* @param netcode if > 0, Display only the ratsnest relative to the correponding net_code
|
||||
* Only ratsnest with the status bit CH_VISIBLE is set are displayed
|
||||
* @param netcode if > 0, Display only the ratsnest relative to the
|
||||
* corresponding net_code
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::DrawGeneralRatsnest( wxDC* DC, int net_code )
|
||||
{
|
||||
if( ( m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
|
||||
return;
|
||||
|
@ -511,20 +532,19 @@ void WinEDA_BasePcbFrame::DrawGeneralRatsnest( wxDC* DC, int net_code )
|
|||
|
||||
for( unsigned ii = 0; ii < m_Pcb->GetRatsnestsCount(); ii++ )
|
||||
{
|
||||
if( ( m_Pcb->m_FullRatsnest[ii].m_Status & (CH_VISIBLE | CH_ACTIF) ) !=
|
||||
if( ( m_Pcb->m_FullRatsnest[ii].m_Status &
|
||||
( CH_VISIBLE | CH_ACTIF ) ) !=
|
||||
( CH_VISIBLE | CH_ACTIF ) )
|
||||
continue;
|
||||
|
||||
if( (net_code <= 0) || ( net_code == m_Pcb->m_FullRatsnest[ii].GetNet() ) )
|
||||
m_Pcb->m_FullRatsnest[ii].Draw( DrawPanel, DC, GR_XOR, wxPoint( 0, 0 ) );
|
||||
if( ( net_code <= 0 )
|
||||
|| ( net_code == m_Pcb->m_FullRatsnest[ii].GetNet() ) )
|
||||
m_Pcb->m_FullRatsnest[ii].Draw( DrawPanel, DC, GR_XOR,
|
||||
wxPoint( 0, 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************************************/
|
||||
static int tst_rats_block_to_block( NETINFO_ITEM* net, vector<RATSNEST_ITEM>& aRatsnestBuffer )
|
||||
/**********************************************************************************************/
|
||||
|
||||
/**
|
||||
* Function used by Tst_Ratsnest()
|
||||
* Function like gen_rats_block_to_block(..)
|
||||
|
@ -538,19 +558,24 @@ static int tst_rats_block_to_block( NETINFO_ITEM* net, vector<RATSNEST_ITEM>& aR
|
|||
*
|
||||
* @param net = the current NETINFO_ITEM for the current net
|
||||
* output:
|
||||
* .state member of the ratsnests
|
||||
* .state member of the ratsnest
|
||||
* @return blocks not connected count
|
||||
*/
|
||||
static int tst_rats_block_to_block( NETINFO_ITEM* net,
|
||||
vector<RATSNEST_ITEM>& aRatsnestBuffer )
|
||||
{
|
||||
int current_num_block, min_block;
|
||||
RATSNEST_ITEM* rats, * min_rats;
|
||||
|
||||
/* Search a link from a block to an other block */
|
||||
min_rats = NULL;
|
||||
for( unsigned ii = net->m_RatsnestStartIdx; ii < net->m_RatsnestEndIdx; ii++ )
|
||||
for( unsigned ii = net->m_RatsnestStartIdx;
|
||||
ii < net->m_RatsnestEndIdx;
|
||||
ii++ )
|
||||
{
|
||||
rats = &aRatsnestBuffer[ii];
|
||||
if( rats->m_PadStart->GetSubRatsnest() == rats->m_PadEnd->GetSubRatsnest() ) // Same block
|
||||
if( rats->m_PadStart->GetSubRatsnest() ==
|
||||
rats->m_PadEnd->GetSubRatsnest() ) // Same block
|
||||
continue;
|
||||
|
||||
if( min_rats == NULL )
|
||||
|
@ -562,7 +587,7 @@ static int tst_rats_block_to_block( NETINFO_ITEM* net, vector<RATSNEST_ITEM>& aR
|
|||
if( min_rats == NULL )
|
||||
return 1;
|
||||
|
||||
/* At this point we have found a link between 2 differents blocks (clusters) :
|
||||
/* At this point we have found a link between 2 different blocks (clusters)
|
||||
* we must set its status to ACTIVE and merge the 2 blocks
|
||||
*/
|
||||
min_rats->m_Status |= CH_ACTIF;
|
||||
|
@ -585,22 +610,19 @@ static int tst_rats_block_to_block( NETINFO_ITEM* net, vector<RATSNEST_ITEM>& aR
|
|||
}
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
static int tst_rats_pad_to_pad( int current_num_block,
|
||||
RATSNEST_ITEM* start_rat_list, RATSNEST_ITEM* end_rat_list )
|
||||
/**********************************************************************/
|
||||
|
||||
/**
|
||||
* Function used by Tst_Ratsnest_general()
|
||||
* The general ratsnest list must exists
|
||||
* Activates the ratsnest between 2 pads ( supposes du meme net )
|
||||
* The function links 1 pad not already connected an other pad and activate
|
||||
* some blocks linked by a ratsnest
|
||||
* Its test only the existing ratsnest and activate some ratsnest (status bit CH_ACTIF set)
|
||||
* Its test only the existing ratsnest and activate some ratsnest (status bit
|
||||
* CH_ACTIF set)
|
||||
*
|
||||
* @param start_rat_list = starting address for the ratnest list
|
||||
* @param end_rat_list = ending address for the ratnest list
|
||||
* @param current_num_block = last block number (computed from the track analysis)
|
||||
* @param start_rat_list = starting address for the ratsnest list
|
||||
* @param end_rat_list = ending address for the ratsnest list
|
||||
* @param current_num_block = last block number (computed from the track
|
||||
* analysis)
|
||||
*
|
||||
* output:
|
||||
* ratsnest list (status member set)
|
||||
|
@ -608,6 +630,9 @@ static int tst_rats_pad_to_pad( int current_num_block,
|
|||
*
|
||||
* @return new block number
|
||||
*/
|
||||
static int tst_rats_pad_to_pad( int current_num_block,
|
||||
RATSNEST_ITEM* start_rat_list,
|
||||
RATSNEST_ITEM* end_rat_list )
|
||||
{
|
||||
D_PAD* pad_start, * pad_end;
|
||||
RATSNEST_ITEM* chevelu;
|
||||
|
@ -617,16 +642,19 @@ static int tst_rats_pad_to_pad( int current_num_block,
|
|||
pad_start = chevelu->m_PadStart;
|
||||
pad_end = chevelu->m_PadEnd;
|
||||
|
||||
/* Update the block if the 2 pads are not connected : a new block is created
|
||||
/* Update the block if the 2 pads are not connected : a new block is
|
||||
* created
|
||||
*/
|
||||
if( (pad_start->GetSubRatsnest() == 0) && (pad_end->GetSubRatsnest() == 0) )
|
||||
if( (pad_start->GetSubRatsnest() == 0)
|
||||
&& (pad_end->GetSubRatsnest() == 0) )
|
||||
{
|
||||
current_num_block++;
|
||||
pad_start->SetSubRatsnest( current_num_block );
|
||||
pad_end->SetSubRatsnest( current_num_block );
|
||||
chevelu->m_Status |= CH_ACTIF;
|
||||
}
|
||||
/* If a pad is already connected : the other is merged in the current block */
|
||||
/* If a pad is already connected : the other is merged in the current
|
||||
* block */
|
||||
else if( pad_start->GetSubRatsnest() == 0 )
|
||||
{
|
||||
pad_start->SetSubRatsnest( pad_end->GetSubRatsnest() );
|
||||
|
@ -643,15 +671,12 @@ static int tst_rats_pad_to_pad( int current_num_block,
|
|||
}
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
void WinEDA_BasePcbFrame::Tst_Ratsnest( wxDC* DC, int ref_netcode )
|
||||
/*******************************************************************/
|
||||
|
||||
/* Compute the active ratsnest
|
||||
* The general ratsnest list must exists
|
||||
* Compute the ACTIVE ratsnests in the general ratsnest list
|
||||
* Compute the ACTIVE ratsnest in the general ratsnest list
|
||||
* if ref_netcode == 0, test all nets, else test only ref_netcode
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::Tst_Ratsnest( wxDC* DC, int ref_netcode )
|
||||
{
|
||||
RATSNEST_ITEM* rats;
|
||||
D_PAD* pad;
|
||||
|
@ -662,7 +687,9 @@ void WinEDA_BasePcbFrame::Tst_Ratsnest( wxDC* DC, int ref_netcode )
|
|||
if( (m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
||||
Build_Board_Ratsnest( DC );
|
||||
|
||||
for( int net_code = 1; net_code < (int) m_Pcb->m_NetInfo->GetCount(); net_code++ )
|
||||
for( int net_code = 1;
|
||||
net_code < (int) m_Pcb->m_NetInfo->GetCount();
|
||||
net_code++ )
|
||||
{
|
||||
net = m_Pcb->FindNet( net_code );
|
||||
if( net == NULL ) //Should not occur
|
||||
|
@ -683,18 +710,20 @@ void WinEDA_BasePcbFrame::Tst_Ratsnest( wxDC* DC, int ref_netcode )
|
|||
num_block = MAX( num_block, subnet );
|
||||
}
|
||||
|
||||
for( unsigned ii = net->m_RatsnestStartIdx; ii < net->m_RatsnestEndIdx; ii++ )
|
||||
for( unsigned ii = net->m_RatsnestStartIdx;
|
||||
ii < net->m_RatsnestEndIdx;
|
||||
ii++ )
|
||||
{
|
||||
m_Pcb->m_FullRatsnest[ii].m_Status &= ~CH_ACTIF;
|
||||
}
|
||||
|
||||
/* a - tst connection between pads */
|
||||
/* a - test connection between pads */
|
||||
rats = &m_Pcb->m_FullRatsnest[0];
|
||||
int icnt = tst_rats_pad_to_pad( num_block,
|
||||
rats + net->m_RatsnestStartIdx,
|
||||
rats + net->m_RatsnestEndIdx );
|
||||
|
||||
/* b - test connexion between blocks (Iteration) */
|
||||
/* b - test connection between blocks (Iteration) */
|
||||
while( icnt > 1 )
|
||||
{
|
||||
icnt = tst_rats_block_to_block( net, m_Pcb->m_FullRatsnest );
|
||||
|
@ -710,14 +739,11 @@ void WinEDA_BasePcbFrame::Tst_Ratsnest( wxDC* DC, int ref_netcode )
|
|||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
int WinEDA_BasePcbFrame::Test_1_Net_Ratsnest( wxDC* DC, int ref_netcode )
|
||||
/**************************************************************************/
|
||||
|
||||
/** function Test_1_Net_Ratsnest
|
||||
* Compute the rastnest relative to the net "net_code"
|
||||
* @param ref_netcode = netcode used to compute the rastnest.
|
||||
* Compute the ratsnest relative to the net "net_code"
|
||||
* @param ref_netcode = netcode used to compute the ratsnest.
|
||||
*/
|
||||
int WinEDA_BasePcbFrame::Test_1_Net_Ratsnest( wxDC* DC, int ref_netcode )
|
||||
{
|
||||
DisplayRastnestInProgress = FALSE;
|
||||
DrawGeneralRatsnest( DC, ref_netcode );
|
||||
|
@ -728,33 +754,36 @@ int WinEDA_BasePcbFrame::Test_1_Net_Ratsnest( wxDC* DC, int ref_netcode )
|
|||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
void WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Build a rastenest relative to one footprint. This is a simplified computation
|
||||
* used only in move footprint. It is not optimal, but it is fast and sufficient
|
||||
* Build a ratsnest relative to one footprint. This is a simplified
|
||||
* computation
|
||||
* used only in move footprint. It is not optimal, but it is fast and
|
||||
* sufficient
|
||||
* to guide a footprint placement
|
||||
* It shows the connections from a pad to the nearest conected pad
|
||||
* It shows the connections from a pad to the nearest connected pad
|
||||
* @param Module = module to consider.
|
||||
*
|
||||
* The ratsnest has 2 sections:
|
||||
* - An "internal" ratsnet relative to pads of this footprint which are in the same net.
|
||||
* - An "internal" ratsnest relative to pads of this footprint which are
|
||||
* in the same net.
|
||||
* this ratsnest section is computed once.
|
||||
* - An "external" rastnest connecting a pad of this footprint to an other pad (in an other footprint)
|
||||
* - An "external" ratsnest connecting a pad of this footprint to an other
|
||||
* pad (in an other footprint)
|
||||
* The ratsnest section must be computed for each new position
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
|
||||
{
|
||||
static unsigned pads_module_count; // node count (node = pad with a net code) for the footprint beeing moved
|
||||
static unsigned internalRatsCount; // number of internal links (links between pads of the module)
|
||||
static unsigned pads_module_count; // node count (node = pad with a net
|
||||
// code) for the footprint being moved
|
||||
static unsigned internalRatsCount; // number of internal links (links
|
||||
// between pads of the module)
|
||||
D_PAD** baseListePad;
|
||||
D_PAD* pad_ref;
|
||||
D_PAD* pad_externe;
|
||||
int current_net_code;
|
||||
int distance; // variables de calcul de ratsnest
|
||||
wxPoint pad_pos; // True pad position according to the current footprint position
|
||||
|
||||
int distance;
|
||||
wxPoint pad_pos; // True pad position according to the
|
||||
// current footprint position
|
||||
|
||||
if( (GetBoard()->m_Status_Pcb & LISTE_PAD_OK) == 0 )
|
||||
{
|
||||
|
@ -763,13 +792,15 @@ void WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
|
|||
}
|
||||
|
||||
/* Compute the "local" ratsnest if needed (when this footprint starts move)
|
||||
* and the list of external pads to consider, i.e pads in others footprints which are "connected" to
|
||||
* and the list of external pads to consider, i.e pads in others
|
||||
* footprints which are "connected" to
|
||||
* a pad in the current footprint
|
||||
*/
|
||||
if( (m_Pcb->m_Status_Pcb & RATSNEST_ITEM_LOCAL_OK) != 0 )
|
||||
goto CalculateExternalRatsnest;
|
||||
|
||||
/* Compute the "internal" ratsnest, i.e the links between the curent footprint pads */
|
||||
/* Compute the "internal" ratsnest, i.e the links between the current
|
||||
*footprint pads */
|
||||
s_localPadBuffer.clear();
|
||||
m_Pcb->m_LocalRatsnest.clear();
|
||||
|
||||
|
@ -787,7 +818,10 @@ void WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
|
|||
if( pads_module_count == 0 )
|
||||
return; /* no connection! */
|
||||
|
||||
qsort( &s_localPadBuffer[0], pads_module_count, sizeof(D_PAD*), sortByNetcode );
|
||||
qsort( &s_localPadBuffer[0],
|
||||
pads_module_count,
|
||||
sizeof(D_PAD*),
|
||||
sortByNetcode );
|
||||
|
||||
/* Build the list of pads linked to the current footprint pads */
|
||||
DisplayRastnestInProgress = FALSE;
|
||||
|
@ -799,11 +833,13 @@ void WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
|
|||
if( pad_ref->GetNet() == current_net_code )
|
||||
continue;
|
||||
|
||||
// A new net was found, load all pads of others modules members of this net:
|
||||
// A new net was found, load all pads of others modules members of this
|
||||
// net:
|
||||
NETINFO_ITEM* net = m_Pcb->FindNet( pad_ref->GetNet() );
|
||||
if( net == NULL ) //Should not occur
|
||||
{
|
||||
DisplayError( this, wxT( "build_ratsnest_module() error: net not found" ) );
|
||||
DisplayError( this,
|
||||
wxT( "build_ratsnest_module() error: net not found" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -827,8 +863,9 @@ void WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
|
|||
sizeof(D_PAD*), sortByNetcode );
|
||||
|
||||
/* Compute the internal rats nest:
|
||||
* this is the same as general ratsnest, but considers only the current footprint pads
|
||||
* it is therefore not time consuming, and it is made only once
|
||||
* this is the same as general ratsnest, but considers only the current
|
||||
* footprint pads it is therefore not time consuming, and it is made only
|
||||
* once
|
||||
*/
|
||||
current_net_code = s_localPadBuffer[0]->GetNet();
|
||||
|
||||
|
@ -847,12 +884,20 @@ void WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
|
|||
|
||||
/* End of list found: */
|
||||
/* a - first step of lee algorithm : build the pad to pad link list */
|
||||
int icnt = gen_rats_pad_to_pad( m_Pcb->m_LocalRatsnest, s_localPadBuffer, ii, jj, 0 );
|
||||
int icnt = gen_rats_pad_to_pad( m_Pcb->m_LocalRatsnest,
|
||||
s_localPadBuffer,
|
||||
ii,
|
||||
jj,
|
||||
0 );
|
||||
|
||||
/* b - second step of lee algorithm : build the block to block link list (Iteration) */
|
||||
/* b - second step of lee algorithm : build the block to block link
|
||||
*list (Iteration) */
|
||||
while( icnt > 1 )
|
||||
{
|
||||
icnt = gen_rats_block_to_block( m_Pcb->m_LocalRatsnest, s_localPadBuffer, ii, jj );
|
||||
icnt = gen_rats_block_to_block( m_Pcb->m_LocalRatsnest,
|
||||
s_localPadBuffer,
|
||||
ii,
|
||||
jj );
|
||||
}
|
||||
|
||||
ii = jj;
|
||||
|
@ -862,7 +907,7 @@ void WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
|
|||
|
||||
internalRatsCount = m_Pcb->m_LocalRatsnest.size();
|
||||
|
||||
/* set the ratsnets status, flag LOCAL_RATSNEST_ITEM */
|
||||
/* set the ratsnest status, flag LOCAL_RATSNEST_ITEM */
|
||||
for( unsigned ii = 0; ii < m_Pcb->m_LocalRatsnest.size(); ii++ )
|
||||
{
|
||||
m_Pcb->m_LocalRatsnest[ii].m_Status = LOCAL_RATSNEST_ITEM;
|
||||
|
@ -870,14 +915,16 @@ void WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
|
|||
|
||||
m_Pcb->m_Status_Pcb |= RATSNEST_ITEM_LOCAL_OK;
|
||||
|
||||
/*
|
||||
* This section computes the "external" ratsnest: must be done when the footprint position changes
|
||||
/* This section computes the "external" ratsnest: must be done when the
|
||||
* footprint position changes
|
||||
*/
|
||||
CalculateExternalRatsnest:
|
||||
|
||||
/* This section search:
|
||||
* for each current module pad the nearest neighbour external pad (of course for the same net code).
|
||||
* For each current footprint cluster of pad (pads having the same net code),
|
||||
* for each current module pad the nearest neighbor external pad (of
|
||||
* course for the same net code).
|
||||
* For each current footprint cluster of pad (pads having the same net
|
||||
* code),
|
||||
* we search the smaller rats nest.
|
||||
* so, for each net, only one rats nest item is created
|
||||
*/
|
||||
|
@ -886,7 +933,8 @@ CalculateExternalRatsnest:
|
|||
local_rats.m_Status = 0;
|
||||
bool addRats = false;
|
||||
if( internalRatsCount < m_Pcb->m_LocalRatsnest.size() )
|
||||
m_Pcb->m_LocalRatsnest.erase( m_Pcb->m_LocalRatsnest.begin() + internalRatsCount,
|
||||
m_Pcb->m_LocalRatsnest.erase(
|
||||
m_Pcb->m_LocalRatsnest.begin() + internalRatsCount,
|
||||
m_Pcb->m_LocalRatsnest.end() );
|
||||
|
||||
current_net_code = s_localPadBuffer[0]->GetNet();
|
||||
|
@ -908,7 +956,9 @@ CalculateExternalRatsnest:
|
|||
pad_pos = pad_ref->m_Pos - g_Offset_Module;
|
||||
|
||||
// Search the nearest external pad of this current pad
|
||||
for( unsigned jj = pads_module_count; jj < s_localPadBuffer.size(); jj++ )
|
||||
for( unsigned jj = pads_module_count;
|
||||
jj < s_localPadBuffer.size();
|
||||
jj++ )
|
||||
{
|
||||
pad_externe = s_localPadBuffer[jj];
|
||||
|
||||
|
@ -916,7 +966,9 @@ CalculateExternalRatsnest:
|
|||
if( pad_externe->GetNet() < pad_ref->GetNet() )
|
||||
continue;
|
||||
|
||||
if( pad_externe->GetNet() > pad_ref->GetNet() ) // remember pads are sorted by net code
|
||||
if( pad_externe->GetNet() > pad_ref->GetNet() ) // remember pads
|
||||
// are sorted by
|
||||
// net code
|
||||
break;
|
||||
|
||||
distance = abs( pad_externe->m_Pos.x - pad_pos.x ) +
|
||||
|
@ -940,13 +992,11 @@ CalculateExternalRatsnest:
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************/
|
||||
void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC )
|
||||
/**********************************************************/
|
||||
|
||||
/*
|
||||
* Display the rastnest of a moving footprint, computed by build_ratsnest_module()
|
||||
* Display the ratsnest of a moving footprint, computed by
|
||||
* build_ratsnest_module()
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC )
|
||||
{
|
||||
if( DC == NULL )
|
||||
return;
|
||||
|
@ -977,26 +1027,30 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC )
|
|||
|
||||
|
||||
/*
|
||||
* construction de la liste en mode de calcul rapide pour affichage
|
||||
* en temps reel du chevelu d'un pad lors des tracés d'une piste démarrant
|
||||
* sur ce pad.
|
||||
* Construction of the list mode display for quick calculation
|
||||
* in real time the net of a pad in the paths of a track starting
|
||||
* on the pad.
|
||||
*
|
||||
* parametres d'appel:
|
||||
* pad_ref ( si null : mise a 0 du nombre de chevelus )
|
||||
* ox, oy = coord de l'extremite de la piste en trace
|
||||
* init (flag)
|
||||
* = 0 : mise a jour des chevelu
|
||||
* <> 0: creation de la liste
|
||||
* Parameters:
|
||||
* Pad_ref (if null: 0 has put the number of ratsnest)
|
||||
* Ox, oy = coord of extremity of the track record
|
||||
* Init (flag)
|
||||
* = 0: update of the ratsnest.
|
||||
* <> 0: Creating a list
|
||||
*/
|
||||
|
||||
/* Buffer to store pads coordinates when creating a track.
|
||||
* these pads are members of the net
|
||||
* and when the mouse is moved, the g_MaxLinksShowed links to neightbors are drawn
|
||||
* and when the mouse is moved, the g_MaxLinksShowed links to neighbors are
|
||||
* drawn
|
||||
*/
|
||||
static std::vector <wxPoint> s_RatsnestMouseToPads;
|
||||
static wxPoint s_CursorPos; // Coordinate of the moving point (mouse cursor and end of current track segment)
|
||||
static wxPoint s_CursorPos; // Coordinate of the moving point (mouse cursor and
|
||||
// end of current track segment)
|
||||
|
||||
/* Used by build_ratsnest_pad(): sort function by link lenght (manhattan distance)*/
|
||||
/* Used by build_ratsnest_pad(): sort function by link length (manhattan
|
||||
* distance)
|
||||
*/
|
||||
static bool sort_by_localnetlength( const wxPoint& ref, const wxPoint& compare )
|
||||
{
|
||||
wxPoint deltaref = ref - s_CursorPos;
|
||||
|
@ -1012,10 +1066,8 @@ static bool sort_by_localnetlength( const wxPoint& ref, const wxPoint& compare )
|
|||
}
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
void WinEDA_BasePcbFrame::build_ratsnest_pad( BOARD_ITEM* ref,
|
||||
const wxPoint& refpos, bool init )
|
||||
/****************************************************************************************/
|
||||
{
|
||||
int current_net_code = 0, conn_number = 0;
|
||||
D_PAD* pad_ref = NULL;
|
||||
|
@ -1028,7 +1080,6 @@ void WinEDA_BasePcbFrame::build_ratsnest_pad( BOARD_ITEM* ref,
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
s_CursorPos = refpos;
|
||||
if( init )
|
||||
{
|
||||
|
@ -1061,13 +1112,16 @@ void WinEDA_BasePcbFrame::build_ratsnest_pad( BOARD_ITEM* ref,
|
|||
return;
|
||||
|
||||
NETINFO_ITEM* net = m_Pcb->FindNet( current_net_code );
|
||||
|
||||
if( net == NULL ) // Should not occur
|
||||
{
|
||||
DisplayError( this, wxT( "build_ratsnest_pad() error: net not found" ) );
|
||||
DisplayError( this,
|
||||
wxT( "build_ratsnest_pad() error: net not found" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a list of pads candidates ( pads not already connected to the current track:
|
||||
// Create a list of pads candidates ( pads not already connected to the
|
||||
// current track:
|
||||
for( unsigned ii = 0; ii < net->m_ListPad.size(); ii++ )
|
||||
{
|
||||
D_PAD* pad = net->m_ListPad[ii];
|
||||
|
@ -1080,17 +1134,15 @@ void WinEDA_BasePcbFrame::build_ratsnest_pad( BOARD_ITEM* ref,
|
|||
} /* end if Init */
|
||||
|
||||
if( s_RatsnestMouseToPads.size() > 1 )
|
||||
sort( s_RatsnestMouseToPads.begin(), s_RatsnestMouseToPads.end(), sort_by_localnetlength );
|
||||
sort( s_RatsnestMouseToPads.begin(),
|
||||
s_RatsnestMouseToPads.end(), sort_by_localnetlength );
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************/
|
||||
void WinEDA_BasePcbFrame::trace_ratsnest_pad( wxDC* DC )
|
||||
/*******************************************************/
|
||||
|
||||
/*
|
||||
* Displays a "ratsnest" during track creation
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::trace_ratsnest_pad( wxDC* DC )
|
||||
{
|
||||
if( DC == NULL )
|
||||
return;
|
||||
|
@ -1105,6 +1157,7 @@ void WinEDA_BasePcbFrame::trace_ratsnest_pad( wxDC* DC )
|
|||
if( ii >= g_MaxLinksShowed )
|
||||
break;
|
||||
|
||||
GRLine( &DrawPanel->m_ClipBox, DC, s_CursorPos, s_RatsnestMouseToPads[ii], 0, YELLOW );
|
||||
GRLine( &DrawPanel->m_ClipBox, DC, s_CursorPos,
|
||||
s_RatsnestMouseToPads[ii], 0, YELLOW );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,19 +18,15 @@ enum layer_sel_id {
|
|||
};
|
||||
|
||||
|
||||
/***********************************************/
|
||||
/* classe pour la frame de selection de layers */
|
||||
/***********************************************/
|
||||
|
||||
class WinEDA_SelLayerFrame : public wxDialog
|
||||
{
|
||||
private:
|
||||
WinEDA_BasePcbFrame* m_Parent;
|
||||
wxRadioBox* m_LayerList;
|
||||
int m_LayerId[NB_LAYERS + 1]; // One extra element for "(Deselect)" radiobutton
|
||||
int m_LayerId[NB_LAYERS + 1]; // One extra element for "(Deselect)"
|
||||
// radiobutton
|
||||
|
||||
public:
|
||||
|
||||
// Constructor and destructor
|
||||
WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent, int default_layer,
|
||||
int min_layer, int max_layer, bool null_layer );
|
||||
|
@ -43,7 +39,7 @@ private:
|
|||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/* Table des evenements pour WinEDA_SelLayerFrame */
|
||||
|
||||
BEGIN_EVENT_TABLE( WinEDA_SelLayerFrame, wxDialog )
|
||||
EVT_BUTTON( wxID_OK, WinEDA_SelLayerFrame::Sel_Layer )
|
||||
EVT_BUTTON( wxID_CANCEL, WinEDA_SelLayerFrame::OnCancelClick )
|
||||
|
@ -51,31 +47,34 @@ BEGIN_EVENT_TABLE( WinEDA_SelLayerFrame, wxDialog )
|
|||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
int WinEDA_BasePcbFrame::SelectLayer( int default_layer, int min_layer, int max_layer,
|
||||
bool null_layer )
|
||||
/****************************************************************************************/
|
||||
|
||||
/** Install the dialog box for layer selection
|
||||
* @param default_layer = Preselection (NB_LAYERS for "(Deselect)" layer)
|
||||
* @param min_layer = min layer value (-1 if no min value)
|
||||
* @param max_layer = max layer value (-1 if no max value)
|
||||
* @param null_layer = display a "(Deselect)" radiobutton (when set to true)
|
||||
* @return new layer value (NB_LAYERS when "(Deselect)" radiobutton selected),
|
||||
* or -1 if cancelled
|
||||
* or -1 if canceled
|
||||
*
|
||||
* Providing the option to also display a "(Deselect)" radiobutton makes the
|
||||
* "Swap Layers" command (and GerbView's "Export to Pcbnew" command) more "user
|
||||
* friendly", by permitting any layer to be "deselected" immediately after its
|
||||
* corresponding radiobutton has been clicked on. (It would otherwise be
|
||||
* necessary to first cancel the "Select Layer:" dialog box (invoked after a
|
||||
* different radiobutton is clicked on) prior to then clicking on the "Deselect"
|
||||
* different radiobutton is clicked on) prior to then clicking on the
|
||||
* "Deselect"
|
||||
* button provided within the "Swap Layers:" or "Layer selection:" dialog box).
|
||||
*/
|
||||
int WinEDA_BasePcbFrame::SelectLayer( int default_layer,
|
||||
int min_layer,
|
||||
int max_layer,
|
||||
bool null_layer )
|
||||
{
|
||||
int layer;
|
||||
WinEDA_SelLayerFrame* frame =
|
||||
new WinEDA_SelLayerFrame( this, default_layer, min_layer, max_layer, null_layer );
|
||||
WinEDA_SelLayerFrame* frame = new WinEDA_SelLayerFrame( this,
|
||||
default_layer,
|
||||
min_layer,
|
||||
max_layer,
|
||||
null_layer );
|
||||
|
||||
layer = frame->ShowModal();
|
||||
frame->Destroy();
|
||||
|
@ -83,37 +82,38 @@ int WinEDA_BasePcbFrame::SelectLayer( int default_layer, int min_layer, int max_
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent,
|
||||
int default_layer, int min_layer,
|
||||
int max_layer, bool null_layer ) :
|
||||
wxDialog( parent, -1, _("Select Layer:"), wxPoint( -1, -1 ),
|
||||
wxSize( 470, 250 ),
|
||||
DIALOG_STYLE )
|
||||
/***********************************************************************/
|
||||
|
||||
/*
|
||||
* The "OK" and "Cancel" buttons are positioned (in a horizontal line)
|
||||
* beneath the "Layer" radiobox, unless that contains only one column of
|
||||
* radiobuttons, in which case they are positioned (in a vertical line)
|
||||
* to the right of that radiobox.
|
||||
*/
|
||||
WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent,
|
||||
int default_layer, int min_layer,
|
||||
int max_layer, bool null_layer ) :
|
||||
wxDialog( parent, -1, _( "Select Layer:" ), wxPoint( -1, -1 ),
|
||||
wxSize( 470, 250 ),
|
||||
DIALOG_STYLE )
|
||||
{
|
||||
BOARD* board = parent->GetBoard();
|
||||
wxButton* Button;
|
||||
int ii;
|
||||
wxString LayerList[NB_LAYERS + 1]; // One extra element for "(Deselect)" radiobutton
|
||||
wxString LayerList[NB_LAYERS + 1]; // One extra element for "(Deselect)"
|
||||
// radiobutton
|
||||
int LayerCount, LayerSelect = -1;
|
||||
|
||||
m_Parent = parent;
|
||||
|
||||
/* Build the layer list */
|
||||
LayerCount = 0;
|
||||
int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.GetCopperLayerCount( ) - 1];
|
||||
int Masque_Layer =
|
||||
g_TabAllCopperLayerMask[g_DesignSettings.GetCopperLayerCount() - 1];
|
||||
Masque_Layer += ALL_NO_CU_LAYERS;
|
||||
for( ii = 0; ii < NB_LAYERS; ii++ )
|
||||
{
|
||||
m_LayerId[ii] = 0;
|
||||
if( (g_TabOneLayerMask[ii] & Masque_Layer) )
|
||||
|
||||
if( g_TabOneLayerMask[ii] & Masque_Layer )
|
||||
{
|
||||
if( min_layer > ii )
|
||||
continue;
|
||||
|
@ -129,6 +129,7 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent,
|
|||
LayerCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// When appropriate, also provide a "(Deselect)" radiobutton
|
||||
if( null_layer )
|
||||
{
|
||||
|
@ -141,8 +142,10 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent,
|
|||
}
|
||||
|
||||
m_LayerList = new wxRadioBox( this, ID_LAYER_SELECT, _( "Layer" ),
|
||||
wxPoint( -1, -1 ), wxSize( -1, -1 ), LayerCount, LayerList,
|
||||
(LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS );
|
||||
wxPoint( -1, -1 ), wxSize( -1, -1 ),
|
||||
LayerCount, LayerList,
|
||||
(LayerCount < 8) ? LayerCount : 8,
|
||||
wxRA_SPECIFY_ROWS );
|
||||
|
||||
if( LayerSelect >= 0 )
|
||||
m_LayerList->SetSelection( LayerSelect );
|
||||
|
@ -166,9 +169,7 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent,
|
|||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
void WinEDA_SelLayerFrame::Sel_Layer( wxCommandEvent& event )
|
||||
/***************************************************************/
|
||||
{
|
||||
int ii = m_LayerId[m_LayerList->GetSelection()];
|
||||
|
||||
|
@ -176,17 +177,15 @@ void WinEDA_SelLayerFrame::Sel_Layer( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
void WinEDA_SelLayerFrame::OnCancelClick( wxCommandEvent& event )
|
||||
/***************************************************************/
|
||||
{
|
||||
EndModal( -1 );
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
/* classe pour la frame de selection de paires de layers */
|
||||
/*********************************************************/
|
||||
/*********************************************/
|
||||
/* Dialog for the selecting pairs of layers. */
|
||||
/*********************************************/
|
||||
|
||||
class WinEDA_SelLayerPairFrame : public wxDialog
|
||||
{
|
||||
|
@ -196,10 +195,7 @@ private:
|
|||
wxRadioBox* m_LayerListBOTTOM;
|
||||
int m_LayerId[NB_COPPER_LAYERS];
|
||||
|
||||
public:
|
||||
|
||||
// Constructor and destructor
|
||||
WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent );
|
||||
public: WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent );
|
||||
~WinEDA_SelLayerPairFrame() { };
|
||||
|
||||
private:
|
||||
|
@ -210,20 +206,16 @@ private:
|
|||
};
|
||||
|
||||
|
||||
/* Table des evenements pour WinEDA_SelLayerPairFrame */
|
||||
BEGIN_EVENT_TABLE( WinEDA_SelLayerPairFrame, wxDialog )
|
||||
EVT_BUTTON( wxID_OK, WinEDA_SelLayerPairFrame::OnOkClick )
|
||||
EVT_BUTTON( wxID_CANCEL, WinEDA_SelLayerPairFrame::OnCancelClick )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
/***********************************************/
|
||||
void WinEDA_BasePcbFrame::SelectLayerPair()
|
||||
/***********************************************/
|
||||
|
||||
/* Affiche une double liste de layers cuivre pour selection d'une paire de layers
|
||||
* pour autorutage, vias...
|
||||
/* Display a list of two copper layers for selection of a pair of layers
|
||||
* for auto-routing, vias ...
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::SelectLayerPair()
|
||||
{
|
||||
// Check whether more than one copper layer has been enabled for the
|
||||
// current PCB file, as Layer Pairs can only meaningfully be defined
|
||||
|
@ -232,7 +224,7 @@ void WinEDA_BasePcbFrame::SelectLayerPair()
|
|||
{
|
||||
wxString InfoMsg;
|
||||
InfoMsg = _( "Less than two copper layers are being used." );
|
||||
InfoMsg << wxT( "\n" ) << _( "Hence Layer Pairs cannot be specified." );
|
||||
InfoMsg << wxT( "\n" ) << _( "Hence layer pairs cannot be specified." );
|
||||
DisplayInfoMessage( this, InfoMsg );
|
||||
return;
|
||||
}
|
||||
|
@ -254,11 +246,9 @@ void WinEDA_BasePcbFrame::SelectLayerPair()
|
|||
}
|
||||
|
||||
|
||||
/*******************************************************************************/
|
||||
WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent ) :
|
||||
wxDialog( parent, -1, _( "Select Layer Pair:" ), wxPoint( -1, -1 ),
|
||||
wxSize( 470, 250 ), DIALOG_STYLE )
|
||||
/*******************************************************************************/
|
||||
{
|
||||
BOARD* board = parent->GetBoard();
|
||||
wxButton* Button;
|
||||
|
@ -269,9 +259,10 @@ WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent
|
|||
m_Parent = parent;
|
||||
|
||||
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen();
|
||||
/* Construction de la liste des couches autoris<69>s */
|
||||
int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.GetCopperLayerCount( ) - 1];
|
||||
int Masque_Layer =
|
||||
g_TabAllCopperLayerMask[g_DesignSettings.GetCopperLayerCount() - 1];
|
||||
Masque_Layer += ALL_NO_CU_LAYERS;
|
||||
|
||||
for( ii = 0, LayerCount = 0; ii < NB_COPPER_LAYERS; ii++ )
|
||||
{
|
||||
m_LayerId[ii] = 0;
|
||||
|
@ -287,14 +278,20 @@ WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent
|
|||
}
|
||||
}
|
||||
|
||||
m_LayerListTOP = new wxRadioBox( this, ID_LAYER_SELECT_TOP, _("Top Layer"),
|
||||
wxPoint( -1, -1 ), wxSize( -1, -1 ), LayerCount, LayerList,
|
||||
(LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS );
|
||||
m_LayerListTOP = new wxRadioBox( this, ID_LAYER_SELECT_TOP,
|
||||
_( "Top Layer" ),
|
||||
wxPoint( -1, -1 ), wxSize( -1, -1 ),
|
||||
LayerCount, LayerList,
|
||||
(LayerCount < 8) ? LayerCount : 8,
|
||||
wxRA_SPECIFY_ROWS );
|
||||
m_LayerListTOP->SetSelection( LayerTopSelect );
|
||||
|
||||
m_LayerListBOTTOM = new wxRadioBox( this, ID_LAYER_SELECT_BOTTOM, _("Bottom Layer"),
|
||||
wxPoint( -1, -1 ), wxSize( -1, -1 ), LayerCount, LayerList,
|
||||
(LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS );
|
||||
m_LayerListBOTTOM = new wxRadioBox( this, ID_LAYER_SELECT_BOTTOM,
|
||||
_( "Bottom Layer" ),
|
||||
wxPoint( -1, -1 ), wxSize( -1, -1 ),
|
||||
LayerCount, LayerList,
|
||||
(LayerCount < 8) ? LayerCount : 8,
|
||||
wxRA_SPECIFY_ROWS );
|
||||
m_LayerListBOTTOM->SetSelection( LayerBottomSelect );
|
||||
|
||||
wxBoxSizer* FrameBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
@ -322,28 +319,27 @@ WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent
|
|||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
void WinEDA_SelLayerPairFrame::OnOkClick( wxCommandEvent& event )
|
||||
/***************************************************************/
|
||||
{
|
||||
// select the same layer for top and bottom is allowed (normal in some boards)
|
||||
// select the same layer for top and bottom is allowed (normal in some
|
||||
// boards)
|
||||
// but could be a mistake. So display an info message
|
||||
if( m_LayerId[m_LayerListTOP->GetSelection()]
|
||||
== m_LayerId[m_LayerListBOTTOM->GetSelection()] )
|
||||
DisplayInfoMessage( this, _( "Warning: The Top Layer and Bottom Layer are same." ) );
|
||||
DisplayInfoMessage( this,
|
||||
_( "Warning: The Top Layer and Bottom Layer are same." ) );
|
||||
|
||||
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen();
|
||||
|
||||
screen->m_Route_Layer_TOP = m_LayerId[m_LayerListTOP->GetSelection()];
|
||||
screen->m_Route_Layer_BOTTOM = m_LayerId[m_LayerListBOTTOM->GetSelection()];
|
||||
screen->m_Route_Layer_BOTTOM =
|
||||
m_LayerId[m_LayerListBOTTOM->GetSelection()];
|
||||
|
||||
EndModal( 0 );
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
void WinEDA_SelLayerPairFrame::OnCancelClick( wxCommandEvent& event )
|
||||
/***************************************************************/
|
||||
{
|
||||
EndModal( -1 );
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
/***************************************************/
|
||||
/* set_grid.cpp - Gestion de la grille utilisateur */
|
||||
/***************************************************/
|
||||
/*
|
||||
Affichage et modifications des parametres de travail de PcbNew
|
||||
Parametres = dimensions de la grille utilisateur
|
||||
*/
|
||||
/************************************/
|
||||
/* set_grid.cpp - manage user grid. */
|
||||
/************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "common.h"
|
||||
|
@ -20,7 +16,6 @@
|
|||
#include "set_grid.h"
|
||||
|
||||
|
||||
/************************************************************/
|
||||
void WinEDA_BasePcbFrame::InstallGridFrame( const wxPoint& pos )
|
||||
{
|
||||
WinEDA_PcbGridFrame dlg( this, pos );
|
||||
|
@ -55,7 +50,6 @@ BEGIN_EVENT_TABLE( WinEDA_PcbGridFrame, wxDialog )
|
|||
////@end WinEDA_PcbGridFrame event table entries
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
/*!
|
||||
* WinEDA_PcbGridFrame constructors
|
||||
*/
|
||||
|
@ -64,6 +58,7 @@ WinEDA_PcbGridFrame::WinEDA_PcbGridFrame( )
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
WinEDA_PcbGridFrame::WinEDA_PcbGridFrame( WinEDA_BasePcbFrame* parent,
|
||||
const wxPoint& pos,
|
||||
wxWindowID id,
|
||||
|
@ -73,16 +68,23 @@ WinEDA_PcbGridFrame::WinEDA_PcbGridFrame( WinEDA_BasePcbFrame* parent,
|
|||
Create( parent, id, caption, pos, size, style );
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* WinEDA_PcbGridFrame creator
|
||||
*/
|
||||
|
||||
bool WinEDA_PcbGridFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
|
||||
bool WinEDA_PcbGridFrame::Create( wxWindow* parent,
|
||||
wxWindowID id,
|
||||
const wxString& caption,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style )
|
||||
{
|
||||
////@begin WinEDA_PcbGridFrame member initialisation
|
||||
m_UnitGrid = NULL;
|
||||
m_OptGridSizeX = NULL;
|
||||
m_OptGridSizeY = NULL;
|
||||
|
||||
////@end WinEDA_PcbGridFrame member initialisation
|
||||
|
||||
////@begin WinEDA_PcbGridFrame creation
|
||||
|
@ -94,10 +96,12 @@ bool WinEDA_PcbGridFrame::Create( wxWindow* parent, wxWindowID id, const wxStrin
|
|||
{
|
||||
GetSizer()->SetSizeHints( this );
|
||||
}
|
||||
|
||||
////@end WinEDA_PcbGridFrame creation
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Control creation for WinEDA_PcbGridFrame
|
||||
*/
|
||||
|
@ -110,6 +114,7 @@ void WinEDA_PcbGridFrame::CreateControls()
|
|||
WinEDA_PcbGridFrame* itemDialog1 = this;
|
||||
|
||||
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
itemDialog1->SetSizer( itemBoxSizer2 );
|
||||
|
||||
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxVERTICAL );
|
||||
|
@ -118,37 +123,69 @@ void WinEDA_PcbGridFrame::CreateControls()
|
|||
wxArrayString m_UnitGridStrings;
|
||||
m_UnitGridStrings.Add( _( "Inches" ) );
|
||||
m_UnitGridStrings.Add( _( "mm" ) );
|
||||
m_UnitGrid = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Grid Size Units"), wxDefaultPosition, wxDefaultSize, m_UnitGridStrings, 1, wxRA_SPECIFY_COLS );
|
||||
m_UnitGrid = new wxRadioBox( itemDialog1, ID_RADIOBOX,
|
||||
_( "Grid Size Units" ), wxDefaultPosition,
|
||||
wxDefaultSize, m_UnitGridStrings, 1,
|
||||
wxRA_SPECIFY_COLS );
|
||||
m_UnitGrid->SetSelection( 0 );
|
||||
itemBoxSizer3->Add( m_UnitGrid, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
itemBoxSizer3->Add( 5, 5, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
|
||||
|
||||
wxStaticText* itemStaticText6 = new wxStaticText( itemDialog1, wxID_STATIC, _("User Grid Size X"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer3->Add(itemStaticText6, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
||||
wxStaticText* itemStaticText6 = new wxStaticText( itemDialog1,
|
||||
wxID_STATIC,
|
||||
_( "User Grid Size X" ),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
0 );
|
||||
itemBoxSizer3->Add( itemStaticText6,
|
||||
0,
|
||||
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
|
||||
m_OptGridSizeX = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer3->Add(m_OptGridSizeX, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
||||
m_OptGridSizeX = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer3->Add( m_OptGridSizeX,
|
||||
0,
|
||||
wxGROW | wxLEFT | wxRIGHT | wxBOTTOM,
|
||||
5 );
|
||||
|
||||
wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _("User Grid Size Y"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer3->Add(itemStaticText8, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
||||
wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1,
|
||||
wxID_STATIC,
|
||||
_( "User Grid Size Y" ),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
0 );
|
||||
itemBoxSizer3->Add( itemStaticText8,
|
||||
0,
|
||||
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
|
||||
m_OptGridSizeY = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer3->Add(m_OptGridSizeY, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
||||
m_OptGridSizeY = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T( "" ),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer3->Add( m_OptGridSizeY,
|
||||
0,
|
||||
wxGROW | wxLEFT | wxRIGHT | wxBOTTOM,
|
||||
5 );
|
||||
|
||||
wxBoxSizer* itemBoxSizer10 = new wxBoxSizer( wxVERTICAL );
|
||||
itemBoxSizer2->Add( itemBoxSizer10, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||
|
||||
wxButton* itemButton11 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
wxButton* itemButton11 = new wxButton( itemDialog1, wxID_OK, _( "&OK" ),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize, 0 );
|
||||
itemButton11->SetDefault();
|
||||
itemBoxSizer10->Add( itemButton11, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
|
||||
|
||||
wxButton* itemButton12 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
wxButton* itemButton12 = new wxButton( itemDialog1, wxID_CANCEL,
|
||||
_( "&Cancel" ), wxDefaultPosition,
|
||||
wxDefaultSize, 0 );
|
||||
itemBoxSizer10->Add( itemButton12, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
|
||||
|
||||
////@end WinEDA_PcbGridFrame content construction
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Should we show tooltips?
|
||||
*/
|
||||
|
@ -158,6 +195,7 @@ bool WinEDA_PcbGridFrame::ShowToolTips()
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Get bitmap resources
|
||||
*/
|
||||
|
@ -168,9 +206,11 @@ wxBitmap WinEDA_PcbGridFrame::GetBitmapResource( const wxString& name )
|
|||
////@begin WinEDA_PcbGridFrame bitmap retrieval
|
||||
wxUnusedVar( name );
|
||||
return wxNullBitmap;
|
||||
|
||||
////@end WinEDA_PcbGridFrame bitmap retrieval
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Get icon resources
|
||||
*/
|
||||
|
@ -181,6 +221,7 @@ wxIcon WinEDA_PcbGridFrame::GetIconResource( const wxString& name )
|
|||
////@begin WinEDA_PcbGridFrame icon retrieval
|
||||
wxUnusedVar( name );
|
||||
return wxNullIcon;
|
||||
|
||||
////@end WinEDA_PcbGridFrame icon retrieval
|
||||
}
|
||||
|
||||
|
@ -195,6 +236,7 @@ void WinEDA_PcbGridFrame::SetGridSize( const wxRealPoint& grid )
|
|||
m_OptGridSizeY->SetValue( msg );
|
||||
}
|
||||
|
||||
|
||||
wxRealPoint WinEDA_PcbGridFrame::GetGridSize()
|
||||
{
|
||||
wxRealPoint grid;
|
||||
|
@ -207,12 +249,14 @@ wxRealPoint WinEDA_PcbGridFrame::GetGridSize()
|
|||
return grid;
|
||||
}
|
||||
|
||||
|
||||
void WinEDA_PcbGridFrame::SetGridUnits( int units )
|
||||
{
|
||||
if( units != INCHES )
|
||||
m_UnitGrid->SetSelection( 1 );
|
||||
}
|
||||
|
||||
|
||||
int WinEDA_PcbGridFrame::GetGridUnits()
|
||||
{
|
||||
return m_UnitGrid->GetSelection();
|
||||
|
|
635
pcbnew/solve.cpp
635
pcbnew/solve.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
/****************************/
|
||||
/* affichage des empreintes */
|
||||
/****************************/
|
||||
/*******************/
|
||||
/* Highlight nets. */
|
||||
/*******************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
@ -16,22 +16,20 @@
|
|||
#define Pad_fill (Pad_Fill_Item.State == RUN)
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
void WinEDA_PcbFrame::ListNetsAndSelect( wxCommandEvent& event )
|
||||
/*********************************************************/
|
||||
|
||||
/** Function ListNetsAndSelect
|
||||
* called by a command event
|
||||
* displays the sorted list of nets in a dialog frame
|
||||
* If a net is selected, it is hightlighted
|
||||
* If a net is selected, it is highlighted
|
||||
*/
|
||||
void WinEDA_PcbFrame::ListNetsAndSelect( wxCommandEvent& event )
|
||||
{
|
||||
NETINFO_ITEM* net;
|
||||
wxString netFilter;
|
||||
int selection;
|
||||
|
||||
netFilter = wxT( "*" );
|
||||
Get_Message( _( "Filter for net names:" ), _( "Net Filter" ), netFilter, this );
|
||||
Get_Message( _( "Filter for net names:" ), _( "Net Filter" ),
|
||||
netFilter, this );
|
||||
if( netFilter.IsEmpty() )
|
||||
return;
|
||||
|
||||
|
@ -87,12 +85,10 @@ void WinEDA_PcbFrame::ListNetsAndSelect( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/**************************************************/
|
||||
/* Locate track or pad and highlight the corresponding net
|
||||
* Returns the Netcode, or -1 if no net located.
|
||||
*/
|
||||
int WinEDA_PcbFrame::Select_High_Light( wxDC* DC )
|
||||
/**************************************************/
|
||||
|
||||
/* Localise track ou pad et met en surbrillance le net correspondant
|
||||
* Retourne le netcode, ou -1 si pas de net localis<EFBFBD>*/
|
||||
{
|
||||
if( g_HightLigt_Status )
|
||||
Hight_Light( DC );
|
||||
|
@ -145,14 +141,12 @@ int WinEDA_PcbFrame::Select_High_Light( wxDC* DC )
|
|||
}
|
||||
|
||||
|
||||
/*******************************************/
|
||||
void WinEDA_PcbFrame::Hight_Light( wxDC* DC )
|
||||
/*******************************************/
|
||||
|
||||
/*
|
||||
* fonction d'appel de Surbrillance a partir du menu
|
||||
* Met ou supprime la surbrillance d'un net pointe par la souris
|
||||
* Highlight command.
|
||||
*
|
||||
* Show or removes the net at the current cursor position.
|
||||
*/
|
||||
void WinEDA_PcbFrame::Hight_Light( wxDC* DC )
|
||||
{
|
||||
g_HightLigt_Status = !g_HightLigt_Status;
|
||||
|
||||
|
|
|
@ -15,11 +15,12 @@
|
|||
|
||||
#include "wx/statline.h"
|
||||
|
||||
/* Variables locales */
|
||||
|
||||
#define LAYER_NO_CHANGE NB_LAYERS
|
||||
static int New_Layer[NB_LAYERS];
|
||||
wxStaticText* layer_list[NB_LAYERS];
|
||||
|
||||
|
||||
enum swap_layer_id {
|
||||
ID_WINEDA_SWAPLAYERFRAME = 1800,
|
||||
ID_BUTTON_0,
|
||||
|
@ -27,10 +28,6 @@ enum swap_layer_id {
|
|||
};
|
||||
|
||||
|
||||
/***********************************************/
|
||||
/* classe pour la frame de selection de layers */
|
||||
/***********************************************/
|
||||
|
||||
class WinEDA_SwapLayerFrame : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
@ -46,7 +43,6 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
// Constructor and destructor
|
||||
WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame* parent );
|
||||
~WinEDA_SwapLayerFrame() { };
|
||||
|
||||
|
@ -58,7 +54,7 @@ private:
|
|||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/* Table des evenements pour WinEDA_SwapLayerFrame */
|
||||
|
||||
BEGIN_EVENT_TABLE( WinEDA_SwapLayerFrame, wxDialog )
|
||||
EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + NB_LAYERS - 1,
|
||||
wxEVT_COMMAND_BUTTON_CLICKED,
|
||||
|
@ -72,7 +68,6 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame* parent ) :
|
|||
wxDialog( parent, -1, _( "Swap Layers:" ), wxPoint( -1, -1 ),
|
||||
wxDefaultSize, wxDEFAULT_DIALOG_STYLE | MAYBE_RESIZE_BORDER )
|
||||
{
|
||||
/*************************************************************************/
|
||||
BOARD* board = parent->GetBoard();
|
||||
|
||||
OuterBoxSizer = NULL;
|
||||
|
@ -357,7 +352,7 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event )
|
|||
if( ii != 1 )
|
||||
return; // (Canceled dialog box returns -1 instead)
|
||||
|
||||
/* Modifications des pistes */
|
||||
/* Change traces. */
|
||||
pt_segm = GetBoard()->m_Track;
|
||||
for( ; pt_segm != NULL; pt_segm = pt_segm->Next() )
|
||||
{
|
||||
|
@ -385,7 +380,7 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event )
|
|||
}
|
||||
}
|
||||
|
||||
/* Modifications des zones */
|
||||
/* Change zones. */
|
||||
for( pt_segm = GetBoard()->m_Zone; pt_segm; pt_segm = pt_segm->Next() )
|
||||
{
|
||||
GetScreen()->SetModify();
|
||||
|
@ -394,7 +389,7 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event )
|
|||
pt_segm->SetLayer( New_Layer[jj] );
|
||||
}
|
||||
|
||||
/* Modifications des autres segments */
|
||||
/* Change other segments. */
|
||||
PtStruct = GetBoard()->m_Drawings;
|
||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************/
|
||||
/* tool_modeit.cpp: construction du menu de l'editeur de modules */
|
||||
/*****************************************************************/
|
||||
/***********************************************/
|
||||
/* tool_modeit.cpp: footprint editor toolbars. */
|
||||
/***********************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
|
||||
|
@ -22,10 +22,9 @@
|
|||
#define LISTBOX_WIDTH 120
|
||||
#endif
|
||||
|
||||
/***************************************************/
|
||||
void WinEDA_ModuleEditFrame::ReCreateHToolbar()
|
||||
/***************************************************/
|
||||
|
||||
/* Create the main horizontal toolbar for the footprint editor */
|
||||
void WinEDA_ModuleEditFrame::ReCreateHToolbar()
|
||||
{
|
||||
if( m_HToolBar != NULL )
|
||||
return;
|
||||
|
@ -140,9 +139,7 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
|
|||
}
|
||||
|
||||
|
||||
/********************************************************/
|
||||
void WinEDA_ModuleEditFrame::ReCreateVToolbar()
|
||||
/********************************************************/
|
||||
{
|
||||
if( m_VToolBar )
|
||||
return;
|
||||
|
@ -192,14 +189,12 @@ void WinEDA_ModuleEditFrame::ReCreateVToolbar()
|
|||
}
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
void WinEDA_ModuleEditFrame::ReCreateOptToolbar()
|
||||
/*********************************************************/
|
||||
{
|
||||
if( m_OptionsToolBar )
|
||||
return;
|
||||
|
||||
// creation du tool bar options
|
||||
// Create options tool bar.
|
||||
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this,
|
||||
ID_OPT_TOOLBAR, FALSE );
|
||||
|
||||
|
@ -245,9 +240,7 @@ void WinEDA_ModuleEditFrame::ReCreateOptToolbar()
|
|||
}
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
|
||||
/*********************************************************/
|
||||
{
|
||||
size_t i;
|
||||
wxString msg;
|
||||
|
@ -260,14 +253,14 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
|
|||
// Set up toolbar
|
||||
m_AuxiliaryToolBar->AddSeparator();
|
||||
|
||||
// Boite de selection du pas de grille
|
||||
// Grid selection choice box.
|
||||
m_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
|
||||
ID_ON_GRID_SELECT,
|
||||
wxPoint( -1, -1 ),
|
||||
wxSize( LISTBOX_WIDTH, -1 ) );
|
||||
m_AuxiliaryToolBar->AddControl( m_SelGridBox );
|
||||
|
||||
// Boite de selection du Zoom
|
||||
// Zoom selection choice box.
|
||||
m_AuxiliaryToolBar->AddSeparator();
|
||||
m_SelZoomBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
|
||||
ID_ON_ZOOM_SELECT,
|
||||
|
@ -298,7 +291,7 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
|
|||
m_AuxiliaryToolBar->Realize();
|
||||
}
|
||||
|
||||
// mise a jour des affichages
|
||||
// Update tool bar to reflect setting.
|
||||
m_SelGridBox->Clear();
|
||||
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/********************************************************************************/
|
||||
/* tool_onrightclick.cpp: fonctions appel<65>s par le bouton droit sur un TOOL */
|
||||
/********************************************************************************/
|
||||
/*************************/
|
||||
/* tool_onrightclick.cpp */
|
||||
/*************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "common.h"
|
||||
|
@ -12,9 +12,7 @@
|
|||
#include "pcbnew_id.h"
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
void WinEDA_PcbFrame::ToolOnRightClick( wxCommandEvent& event )
|
||||
/*****************************************************************/
|
||||
{
|
||||
wxPoint pos;
|
||||
int id = event.GetSelection();
|
||||
|
@ -49,9 +47,7 @@ void WinEDA_PcbFrame::ToolOnRightClick( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
void WinEDA_ModuleEditFrame::ToolOnRightClick( wxCommandEvent& event )
|
||||
/************************************************************************/
|
||||
{
|
||||
wxPoint pos;
|
||||
int id = event.GetSelection();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*********************************************/
|
||||
/* tool_pcb.cpp: construction des tool bars */
|
||||
/*********************************************/
|
||||
/***************************************/
|
||||
/* tool_pcb.cpp: PCB editor tool bars */
|
||||
/***************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
|
||||
|
@ -34,7 +34,8 @@ static wxBitmap* LayerPairBitmap = NULL;
|
|||
|
||||
static const char s_BitmapLayerIcon[16][16] = {
|
||||
// 0 = draw pixel with active layer color
|
||||
// 1 = draw pixel with top layer color (top/bottom layer used in autoroute and place via)
|
||||
// 1 = draw pixel with top layer color (top/bottom layer used in
|
||||
// autoroute and place via)
|
||||
// 2 = draw pixel with bottom layer color
|
||||
// 3 = draw pixel with via color
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 1, 1, 1, 1, 0, 0 },
|
||||
|
@ -56,12 +57,9 @@ static const char s_BitmapLayerIcon[16][16] = {
|
|||
};
|
||||
|
||||
|
||||
/************************************************************/
|
||||
void WinEDA_PcbFrame::PrepareLayerIndicator()
|
||||
/************************************************************/
|
||||
|
||||
/* Draw the icon for the "Select layer pair" bitmap tool
|
||||
*/
|
||||
void WinEDA_PcbFrame::PrepareLayerIndicator()
|
||||
{
|
||||
int ii, jj;
|
||||
int active_layer_color, Route_Layer_TOP_color,
|
||||
|
@ -106,8 +104,8 @@ void WinEDA_PcbFrame::PrepareLayerIndicator()
|
|||
LayerPairBitmap = new wxBitmap( 16, 16 );
|
||||
}
|
||||
|
||||
/* Draw the icon, with colors according to the active layer and layer pairs for
|
||||
* via command (change layer)
|
||||
/* Draw the icon, with colors according to the active layer and layer
|
||||
* pairs for via command (change layer)
|
||||
*/
|
||||
wxMemoryDC iconDC;
|
||||
iconDC.SelectObject( *LayerPairBitmap );
|
||||
|
@ -178,12 +176,9 @@ void WinEDA_PcbFrame::PrepareLayerIndicator()
|
|||
}
|
||||
|
||||
|
||||
/******************************************/
|
||||
void WinEDA_PcbFrame::ReCreateHToolbar()
|
||||
/******************************************/
|
||||
|
||||
/* Creates or updates the main horizontal toolbar for the board editor
|
||||
*/
|
||||
void WinEDA_PcbFrame::ReCreateHToolbar()
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
|
@ -272,19 +267,20 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
|
|||
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ),
|
||||
_( "Read netlist" ) );
|
||||
m_HToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, wxBitmap( erc_xpm ),
|
||||
_( "Pcb Design Rules Check" ) );
|
||||
_( "Perform design rules check" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
|
||||
ReCreateLayerBox( m_HToolBar );
|
||||
PrepareLayerIndicator(); // Initialize the bitmap with current active layer colors for the next tool
|
||||
PrepareLayerIndicator(); // Initialize the bitmap with current
|
||||
// active layer colors for the next tool
|
||||
m_HToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, wxEmptyString,
|
||||
*LayerPairBitmap, SEL_LAYER_HELP );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( ID_TOOLBARH_PCB_AUTOPLACE, wxEmptyString,
|
||||
wxBitmap( mode_module_xpm ),
|
||||
_( "Mode Module: Manual and Automatic Move or Place for modules" ),
|
||||
_( "Manual and automatic move or place of modules" ),
|
||||
wxITEM_CHECK );
|
||||
m_HToolBar->AddTool( ID_TOOLBARH_PCB_AUTOROUTE, wxEmptyString,
|
||||
wxBitmap( mode_track_xpm ),
|
||||
|
@ -306,28 +302,24 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
|
|||
}
|
||||
|
||||
|
||||
/*********************************************/
|
||||
void WinEDA_PcbFrame::ReCreateOptToolbar()
|
||||
/*********************************************/
|
||||
|
||||
// Create the left vertical toolbar (option selections)
|
||||
{
|
||||
if( m_OptionsToolBar )
|
||||
return;
|
||||
|
||||
// creation du tool bar options
|
||||
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this,
|
||||
ID_OPT_TOOLBAR, FALSE );
|
||||
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_DRC_OFF, wxEmptyString,
|
||||
wxBitmap( drc_off_xpm ),
|
||||
_( "Drc OFF" ), wxITEM_CHECK );
|
||||
_( "Enable design rule checking" ),
|
||||
wxITEM_CHECK );
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
|
||||
wxBitmap( grid_xpm ),
|
||||
_( "Display Grid OFF" ), wxITEM_CHECK );
|
||||
_( "Hide grid" ), wxITEM_CHECK );
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
|
||||
wxBitmap( polar_coord_xpm ),
|
||||
_( "Display Polar Coord ON" ), wxITEM_CHECK );
|
||||
_( "Display polar coordinates" ), wxITEM_CHECK );
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
|
||||
wxBitmap( unit_inch_xpm ),
|
||||
_( "Units in inches" ), wxITEM_CHECK );
|
||||
|
@ -336,57 +328,63 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
|
|||
_( "Units in millimeters" ), wxITEM_CHECK );
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
|
||||
wxBitmap( cursor_shape_xpm ),
|
||||
_( "Change Cursor Shape" ), wxITEM_CHECK );
|
||||
_( "Change cursor shape" ), wxITEM_CHECK );
|
||||
|
||||
m_OptionsToolBar->AddSeparator();
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_RATSNEST, wxEmptyString,
|
||||
wxBitmap( general_ratsnet_xpm ),
|
||||
_( "Show General Ratsnest" ), wxITEM_CHECK );
|
||||
_( "Show board ratsnest" ), wxITEM_CHECK );
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST, wxEmptyString,
|
||||
wxBitmap( local_ratsnet_xpm ),
|
||||
_( "Show Module Ratsnest when moving" ),
|
||||
_( "Show module ratsnest when moving" ),
|
||||
wxITEM_CHECK );
|
||||
|
||||
m_OptionsToolBar->AddSeparator();
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_AUTO_DEL_TRACK, wxEmptyString,
|
||||
wxBitmap( auto_delete_track_xpm ),
|
||||
_( "Enable Auto Del Track" ), wxITEM_CHECK );
|
||||
_( "Enable automatic track deletion" ),
|
||||
wxITEM_CHECK );
|
||||
|
||||
m_OptionsToolBar->AddSeparator();
|
||||
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString,
|
||||
wxBitmap( show_zone_xpm ), wxNullBitmap,
|
||||
_( "Show filled areas in zones" ) );
|
||||
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, wxEmptyString,
|
||||
wxBitmap( show_zone_disable_xpm ), wxNullBitmap,
|
||||
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE,
|
||||
wxEmptyString,
|
||||
wxBitmap( show_zone_disable_xpm ),
|
||||
wxNullBitmap,
|
||||
_( "Do not show filled areas in zones" ));
|
||||
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, wxEmptyString,
|
||||
wxBitmap( show_zone_outline_only_xpm ), wxNullBitmap,
|
||||
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
|
||||
wxEmptyString,
|
||||
wxBitmap( show_zone_outline_only_xpm ),
|
||||
wxNullBitmap,
|
||||
_( "Show outlines of filled areas only in zones" ) );
|
||||
|
||||
m_OptionsToolBar->AddSeparator();
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
|
||||
wxBitmap( pad_sketch_xpm ),
|
||||
_( "Show Pads Sketch" ), wxITEM_CHECK );
|
||||
_( "Show pads in outline mode" ), wxITEM_CHECK );
|
||||
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, wxEmptyString,
|
||||
wxBitmap( via_sketch_xpm ),
|
||||
_( "Show Vias Sketch" ), wxITEM_CHECK );
|
||||
_( "Show vias in outline mode" ), wxITEM_CHECK );
|
||||
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, wxEmptyString,
|
||||
wxBitmap( showtrack_xpm ),
|
||||
_( "Show Tracks Sketch" ), wxITEM_CHECK );
|
||||
_( "Show tracks in outline mode" ),
|
||||
wxITEM_CHECK );
|
||||
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
|
||||
wxEmptyString,
|
||||
wxBitmap( palette_xpm ),
|
||||
_( "High Contrast Mode Display" ),
|
||||
_( "Enable high contrast display mode" ),
|
||||
wxITEM_CHECK );
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
|
||||
DisplayOpt.ContrastModeDisplay );
|
||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
|
||||
wxEmptyString,
|
||||
wxBitmap( invisible_text_xpm ),
|
||||
_( "Show Invisible Text" ),
|
||||
_( "Show invisible text" ),
|
||||
wxITEM_CHECK );
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
|
||||
g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ));
|
||||
|
@ -408,12 +406,9 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
|
|||
}
|
||||
|
||||
|
||||
/********************************************/
|
||||
void WinEDA_PcbFrame::ReCreateVToolbar()
|
||||
/********************************************/
|
||||
|
||||
/* Create the main vertical right toolbar, showing usual tools
|
||||
*/
|
||||
void WinEDA_PcbFrame::ReCreateVToolbar()
|
||||
{
|
||||
if( m_VToolBar )
|
||||
return;
|
||||
|
@ -490,12 +485,10 @@ void WinEDA_PcbFrame::ReCreateVToolbar()
|
|||
}
|
||||
|
||||
|
||||
/*********************************************/
|
||||
void WinEDA_PcbFrame::ReCreateAuxVToolbar()
|
||||
/*********************************************/
|
||||
|
||||
/* Create the auxiliary vertical right toolbar, showing tools for microwave applications
|
||||
/* Create the auxiliary vertical right toolbar, showing tools for
|
||||
* microwave applications
|
||||
*/
|
||||
void WinEDA_PcbFrame::ReCreateAuxVToolbar()
|
||||
{
|
||||
if( m_AuxVToolBar )
|
||||
return;
|
||||
|
@ -533,10 +526,6 @@ void WinEDA_PcbFrame::ReCreateAuxVToolbar()
|
|||
}
|
||||
|
||||
|
||||
/****************************************************/
|
||||
void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
|
||||
/****************************************************/
|
||||
|
||||
/* Creates auxiliary horizontal toolbar
|
||||
* displays:
|
||||
* existing track width choice
|
||||
|
@ -546,6 +535,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
|
|||
* grid size choice
|
||||
* zoom level choice
|
||||
*/
|
||||
void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
|
||||
{
|
||||
size_t i;
|
||||
wxString msg;
|
||||
|
@ -676,16 +666,13 @@ an existing track use its width\notherwise, use current width setting" ),
|
|||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
void WinEDA_PcbFrame::UpdateToolbarLayerInfo()
|
||||
/**************************************************************************/
|
||||
{
|
||||
wxASSERT( m_SelLayerBox );
|
||||
|
||||
// Activation de l'affichage sur la bonne couche
|
||||
// Pour eviter la reentrance (Bug wxGTK version Linux?), la selection n'est faite que si
|
||||
// elle est mauvaise (Pb corrige sur wxGTK 2.6.0)
|
||||
|
||||
// Enable the display on the correct layer
|
||||
// To avoid reentrancy ( Bug wxGTK Linux version? ), the selection is
|
||||
// made where it is bad ( corrected on wxGTK 2.6.0 )
|
||||
int count = m_SelLayerBox->GetCount();
|
||||
int choice = m_SelLayerBox->GetChoice();
|
||||
int layer = GetScreen()->m_Active_Layer;
|
||||
|
@ -702,9 +689,7 @@ void WinEDA_PcbFrame::UpdateToolbarLayerInfo()
|
|||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
|
||||
/**************************************************************************/
|
||||
{
|
||||
if( m_SelLayerBox == NULL )
|
||||
{
|
||||
|
@ -716,7 +701,8 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
|
|||
wxPoint( -1, -1 ),
|
||||
#if defined (__UNIX__)
|
||||
|
||||
// Width enough for the longest string: "Component (Page Down)"
|
||||
// Width enough for the longest
|
||||
// string: "Component (Page Down)"
|
||||
// Maybe that string is too long?
|
||||
wxSize( 230, -1 )
|
||||
#else
|
||||
|
|
|
@ -144,14 +144,15 @@ void WinEDA_PcbFrame::AuxiliaryToolBar_Update_UI()
|
|||
}
|
||||
|
||||
|
||||
/***************************************/
|
||||
void WinEDA_PcbFrame::SetToolbars()
|
||||
/***************************************/
|
||||
|
||||
/*
|
||||
* Active ou desactive les tools des toolbars, en fonction des commandes
|
||||
* en cours
|
||||
* Enable or disable the toolbar's controls, depending on the current
|
||||
* state.
|
||||
*
|
||||
* @todo: All of this should be perform in appropriate wxUpdateUIEvent
|
||||
* handles. This is not how it how updating user interface controls
|
||||
* is handle in wxWidgets.
|
||||
*/
|
||||
void WinEDA_PcbFrame::SetToolbars()
|
||||
{
|
||||
bool state;
|
||||
|
||||
|
@ -187,10 +188,8 @@ void WinEDA_PcbFrame::SetToolbars()
|
|||
!Drc_On );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF,
|
||||
Drc_On ?
|
||||
_(
|
||||
"DRC Off (Disable !!!), Currently: DRC is active" )
|
||||
:
|
||||
_( "DRC On (Currently: DRC is inactive !!!)" ) );
|
||||
_( "Disable design rule checking" ) :
|
||||
_( "Enable design rule checking" ) );
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM,
|
||||
g_UnitMetric == MILLIMETRE ? TRUE : false );
|
||||
|
@ -201,13 +200,15 @@ void WinEDA_PcbFrame::SetToolbars()
|
|||
DisplayOpt.DisplayPolarCood );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
|
||||
DisplayOpt.DisplayPolarCood ?
|
||||
_( "Polar coords not show" ) :
|
||||
_( "Display polar coords" ) );
|
||||
_( "Display rectangular coordinates" ) :
|
||||
_( "Display polar coordinates" ) );
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
|
||||
m_Draw_Grid );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID,
|
||||
m_Draw_Grid ? _( "Grid not show" ) : _( "Show grid" ) );
|
||||
m_Draw_Grid ?
|
||||
_( "Hide grid" ) :
|
||||
_( "Show grid" ) );
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR,
|
||||
m_CursorShape );
|
||||
|
@ -216,8 +217,8 @@ void WinEDA_PcbFrame::SetToolbars()
|
|||
g_Show_Ratsnest );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_RATSNEST,
|
||||
g_Show_Ratsnest ?
|
||||
_( "Hide general ratsnest" ) :
|
||||
_( "Show general ratsnest" ) );
|
||||
_( "Hide board ratsnest" ) :
|
||||
_( "Show board ratsnest" ) );
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
|
||||
g_Show_Module_Ratsnest );
|
||||
|
@ -239,31 +240,31 @@ void WinEDA_PcbFrame::SetToolbars()
|
|||
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
|
||||
m_DisplayPadFill ?
|
||||
_( "Show pads sketch mode" ) :
|
||||
_( "Show pads filled mode" ) );
|
||||
_( "Show pads in outline mode" ) :
|
||||
_( "Show pads in fill mode" ) );
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
|
||||
!m_DisplayViaFill );
|
||||
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
|
||||
m_DisplayViaFill ?
|
||||
_( "Show vias sketch mode" ) :
|
||||
_( "Show vias filled mode" ) );
|
||||
_( "Show vias in outline mode" ) :
|
||||
_( "Show vias in fill mode" ) );
|
||||
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
|
||||
!m_DisplayPcbTrackFill );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
|
||||
m_DisplayPcbTrackFill ?
|
||||
_( "Show tracks sketch mode" ) :
|
||||
_( "Show tracks filled mode" ) );
|
||||
_( "Show tracks in outline mode" ) :
|
||||
_( "Show tracks in fill mode" ) );
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
|
||||
DisplayOpt.ContrastModeDisplay );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
|
||||
DisplayOpt.ContrastModeDisplay ?
|
||||
_( "Normal contrast mode display" ) :
|
||||
_( "High contrast mode display" ) );
|
||||
_( "Normal contrast display mode" ) :
|
||||
_( "High contrast display mode" ) );
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
|
||||
g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ) );
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/**************************************************/
|
||||
/* Edition des pistes */
|
||||
/* Routines de modification automatique de pistes */
|
||||
/**************************************************/
|
||||
/******************/
|
||||
/* Trace editing. */
|
||||
/******************/
|
||||
|
||||
#include "fctsys.h"
|
||||
|
||||
|
@ -13,54 +12,59 @@
|
|||
|
||||
/** function EraseRedundantTrack
|
||||
* Called after creating a track
|
||||
* Remove (if exists) the old track that have the same starting and the same ending point as the new created track
|
||||
* (this is the redunding track)
|
||||
* Remove (if exists) the old track that have the same starting and the same
|
||||
* ending point as the new created track (this is the redunding track)
|
||||
* @param aDC = the current device context (can be NULL)
|
||||
* @param aNewTrack = the new created track (a pointer to a segment of the track list)
|
||||
* @param aNewTrack = the new created track (a pointer to a segment of the
|
||||
* track list)
|
||||
* @param aNewTrackSegmentsCount = number of segments in this new track
|
||||
* @param aItemsListPicker = the list picker to use for an undo command (can be NULL)
|
||||
* @param aItemsListPicker = the list picker to use for an undo command (can
|
||||
* be NULL)
|
||||
*/
|
||||
int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewTrackSegmentsCount, PICKED_ITEMS_LIST* aItemsListPicker )
|
||||
int WinEDA_PcbFrame::EraseRedundantTrack(
|
||||
wxDC* aDC,
|
||||
TRACK* aNewTrack,
|
||||
int aNewTrackSegmentsCount,
|
||||
PICKED_ITEMS_LIST* aItemsListPicker )
|
||||
{
|
||||
TRACK* StartTrack, * EndTrack;/* Pointeurs des segments de debut et fin
|
||||
* (extremites) de la nouvelle piste */
|
||||
TRACK* StartTrack, * EndTrack;
|
||||
TRACK* pt_segm;
|
||||
TRACK* pt_del;
|
||||
int ii, jj, nb_segm, nbconnect;
|
||||
wxPoint start; /* coord du point de depart de la piste */
|
||||
wxPoint end; /* coord du point de fin de la piste */
|
||||
int startmasklayer, endmasklayer; /* masque couche de depart et de fin */
|
||||
TRACK* BufDeb, * BufEnd; /* Pointeurs de debut et de fin de la zone
|
||||
* des pistes equipotentielles */
|
||||
wxPoint start;
|
||||
wxPoint end;
|
||||
int startmasklayer, endmasklayer;
|
||||
TRACK* BufDeb, * BufEnd;
|
||||
|
||||
int netcode = aNewTrack->GetNet();
|
||||
|
||||
|
||||
/* Reconstitution de la piste complete ( la nouvelle piste
|
||||
* a pu demarrer sur un segment de piste en l'air
|
||||
/* Reconstruct the complete track (the new track has to start on a
|
||||
* segment of track).
|
||||
*/
|
||||
|
||||
ListSetState( aNewTrack, aNewTrackSegmentsCount, BUSY, OFF );
|
||||
|
||||
/* si la nouvelle piste commence par une via, il est plus sur de rechercher
|
||||
* la piste complete en utilisant le segment suivant comme reference, car
|
||||
* une via est souvent sur un carrefour de segments, et ne caracterise pas
|
||||
* une piste */
|
||||
/* If the new track begins with a via, complete the track segment using
|
||||
* the following segment as a reference because a via is often a hub of
|
||||
* segments, and does not characterize track.
|
||||
*/
|
||||
if( aNewTrack->Type() == TYPE_VIA && ( aNewTrackSegmentsCount > 1 ) )
|
||||
aNewTrack = aNewTrack->Next();
|
||||
|
||||
aNewTrack = Marque_Une_Piste( GetBoard(), aNewTrack, &aNewTrackSegmentsCount, NULL, true );
|
||||
aNewTrack = Marque_Une_Piste( GetBoard(), aNewTrack,
|
||||
&aNewTrackSegmentsCount, NULL, true );
|
||||
wxASSERT( aNewTrack );
|
||||
|
||||
#if 0 && defined(DEBUG)
|
||||
TRACK* EndNewTrack; /* Pointeur sur le dernier segment de la liste
|
||||
* chainee de la mouvelle piste */
|
||||
TRACK* EndNewTrack; /* The last segment of the list chained to
|
||||
* the track */
|
||||
|
||||
EndNewTrack = aNewTrack;
|
||||
for( ii = 1; ii < aNewTrackSegmentsCount; ii++ )
|
||||
{
|
||||
wxASSERT( EndNewTrack->GetState( -1 ) != 0 );
|
||||
D(printf("track %p is newly part of net %d\n", EndNewTrack, netcode );)
|
||||
D( printf( "track %p is newly part of net %d\n", EndNewTrack,
|
||||
netcode ); )
|
||||
EndNewTrack = EndNewTrack->Next();
|
||||
}
|
||||
|
||||
|
@ -69,16 +73,17 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
|
|||
|
||||
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
|
||||
track->Show( 0, std::cout );
|
||||
|
||||
#endif
|
||||
|
||||
/* Calcul des limites de recherche des segments de piste */
|
||||
/* BufDeb pointe le 1er segment utile */
|
||||
/* Calculate search in terms of segments of track, 1st edge BufDeb useful
|
||||
* segment. */
|
||||
BufDeb = m_Pcb->m_Track->GetStartNetCode( netcode );
|
||||
|
||||
/* BufEnd Pointe le dernier segment */
|
||||
/* Point BufEnd the last segment. */
|
||||
BufEnd = BufDeb->GetEndNetCode( netcode );
|
||||
|
||||
/* nettoyage des flags pour tout le net */
|
||||
/* Flags for cleaning the net. */
|
||||
for( pt_del = BufDeb; pt_del; pt_del = pt_del->Next() )
|
||||
{
|
||||
D( printf( "track %p turning off BUSY | EDIT | CHAIN\n", pt_del ); )
|
||||
|
@ -87,7 +92,6 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
|
|||
break;
|
||||
}
|
||||
|
||||
/* Calcul des points limites de la nouvelle piste */
|
||||
if( ReturnEndsTrack( aNewTrack, aNewTrackSegmentsCount,
|
||||
&StartTrack, &EndTrack ) == 0 )
|
||||
return 0;
|
||||
|
@ -95,26 +99,25 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
|
|||
if( ( StartTrack == NULL ) || ( EndTrack == NULL ) )
|
||||
return 0;
|
||||
|
||||
/* Calcul des caracteristiques des points de debut et de fin */
|
||||
start = StartTrack->m_Start;
|
||||
end = EndTrack->m_End;
|
||||
|
||||
/* Les points de depart et de fin doivent etre distincts */
|
||||
/* The start and end points cannot be the same. */
|
||||
if( start == end )
|
||||
return 0;
|
||||
|
||||
/* Determinations des couches interconnectees a ces points */
|
||||
/* Determine layers interconnected these points. */
|
||||
startmasklayer = StartTrack->ReturnMaskLayer();
|
||||
endmasklayer = EndTrack->ReturnMaskLayer();
|
||||
|
||||
/* Il peut y avoir une via ou un pad sur les extremites: */
|
||||
/* There may be a via or a pad on the end points. */
|
||||
pt_segm = Fast_Locate_Via( m_Pcb->m_Track, NULL, start, startmasklayer );
|
||||
if( pt_segm )
|
||||
startmasklayer |= pt_segm->ReturnMaskLayer();
|
||||
|
||||
if( StartTrack->start && ( StartTrack->start->Type() == TYPE_PAD ) )
|
||||
{
|
||||
/* start sur pad */
|
||||
/* Start on pad. */
|
||||
D_PAD* pt_pad = (D_PAD*)(StartTrack->start);
|
||||
startmasklayer |= pt_pad->m_Masque_Layer;
|
||||
}
|
||||
|
@ -129,27 +132,27 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
|
|||
endmasklayer |= pt_pad->m_Masque_Layer;
|
||||
}
|
||||
|
||||
/* Marquage a DELETED de la piste nouvelle (qui ne doit pas intervenir
|
||||
* dans la recherche d'autres connexions)
|
||||
/* Mark as deleted a new track (which is not involved in the search for
|
||||
* other connections)
|
||||
*/
|
||||
ListSetState( aNewTrack, aNewTrackSegmentsCount, DELETED, ON );
|
||||
|
||||
/* test : un segment doit etre connecte au point de depart car sinon
|
||||
* il est inutile d'analyser l'autre point
|
||||
/* A segment must be connected to the starting point, otherwise
|
||||
* it is unnecessary to analyze the other point
|
||||
*/
|
||||
|
||||
pt_segm = Fast_Locate_Piste( BufDeb, BufEnd, start, startmasklayer );
|
||||
|
||||
if( pt_segm == NULL ) /* Pas de piste reliee au point de depart */
|
||||
if( pt_segm == NULL ) /* Not connected to the track starting point. */
|
||||
{
|
||||
/* Suppression du flag DELETED */
|
||||
/* Clear the delete flag. */
|
||||
ListSetState( aNewTrack, aNewTrackSegmentsCount, DELETED, OFF );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Marquage a CHAIN des segments candidats connectes au point de fin
|
||||
* Remarque: les vias ne sont pas prises en compte car elles ne permettent
|
||||
* pas de definir une piste, puisque elles sont sur un carrefour */
|
||||
/* Marking a list of candidate segmented connect to endpoint
|
||||
* Note: the vias are not taken into account because they do
|
||||
* not define a track, since they are on an intersection.
|
||||
*/
|
||||
for( pt_del = BufDeb, nbconnect = 0; ; )
|
||||
{
|
||||
pt_segm = Fast_Locate_Piste( pt_del, BufEnd, end, endmasklayer );
|
||||
|
@ -158,7 +161,6 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
|
|||
|
||||
if( pt_segm->Type() != TYPE_VIA )
|
||||
{
|
||||
/* Segment trouve */
|
||||
if( pt_segm->GetState( CHAIN ) == 0 )
|
||||
{
|
||||
pt_segm->SetState( CHAIN, ON );
|
||||
|
@ -173,7 +175,7 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
|
|||
|
||||
if( nbconnect == 0 )
|
||||
{
|
||||
/* Clear used flagss */
|
||||
/* Clear used flags */
|
||||
for( pt_del = BufDeb; pt_del; pt_del = pt_del->Next() )
|
||||
{
|
||||
pt_del->SetState( BUSY | DELETED | EDIT | CHAIN, OFF );
|
||||
|
@ -184,13 +186,13 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Marquage a EDIT de la piste nouvelle (qui ne doit pas intervenir
|
||||
* dans la recherche d'autres pistes) */
|
||||
/* Mark trace as edited (which does not involve searching for other
|
||||
* tracks)
|
||||
*/
|
||||
ListSetState( aNewTrack, aNewTrackSegmentsCount, DELETED, OFF );
|
||||
|
||||
ListSetState( aNewTrack, aNewTrackSegmentsCount, EDIT, ON );
|
||||
|
||||
/* Examen de tous les segments marques */
|
||||
/* Test all marked segments. */
|
||||
while( nbconnect )
|
||||
{
|
||||
for( pt_del = BufDeb; pt_del; pt_del = pt_del->Next() )
|
||||
|
@ -206,8 +208,8 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
|
|||
|
||||
pt_del = Marque_Une_Piste( GetBoard(), pt_del, &nb_segm, NULL, true );
|
||||
|
||||
/* Test si La piste marquee est redondante, c'est a dire si l'un des
|
||||
* segments marques est connecte au point de depart de la piste nouvelle
|
||||
/* Test if the marked track is redundant, ie if one of marked segments
|
||||
* is connected to the starting point of the new track.
|
||||
*/
|
||||
ii = 0;
|
||||
pt_segm = pt_del;
|
||||
|
@ -218,9 +220,10 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
|
|||
|
||||
if( pt_segm->m_Start == start || pt_segm->m_End == start )
|
||||
{
|
||||
/* la piste marquee peut etre effacee */
|
||||
/* Marked track can be erased. */
|
||||
TRACK* NextS;
|
||||
Trace_Une_Piste( DrawPanel, aDC, pt_del, nb_segm, GR_XOR | GR_SURBRILL );
|
||||
Trace_Une_Piste( DrawPanel, aDC, pt_del, nb_segm,
|
||||
GR_XOR | GR_SURBRILL );
|
||||
|
||||
for( jj = 0; jj < nb_segm; jj++, pt_del = NextS )
|
||||
{
|
||||
|
@ -237,8 +240,9 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
|
|||
pt_del->DeleteStructure();
|
||||
}
|
||||
|
||||
/* nettoyage des flags */
|
||||
for( pt_del = m_Pcb->m_Track; pt_del != NULL; pt_del = pt_del->Next() )
|
||||
/* Clean up flags. */
|
||||
for( pt_del = m_Pcb->m_Track; pt_del != NULL;
|
||||
pt_del = pt_del->Next() )
|
||||
{
|
||||
if( pt_del->GetState( EDIT ) )
|
||||
{
|
||||
|
@ -253,8 +257,8 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
|
|||
}
|
||||
}
|
||||
|
||||
/* nettoyage du flag BUSY puisque ici la piste marquee n'a pas
|
||||
* ete retenuee */
|
||||
/* Clear BUSY flag here because the track did not get marked.
|
||||
*/
|
||||
ListSetState( pt_del, nb_segm, BUSY, OFF );
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*************************/
|
||||
/* affichage des modules */
|
||||
/*************************/
|
||||
/*******************/
|
||||
/* Display modules */
|
||||
/*******************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
@ -11,29 +11,22 @@
|
|||
#include "pcbnew.h"
|
||||
#include "drag.h"
|
||||
|
||||
/* Police des caracteres de la routine de trace des textes */
|
||||
/* Font of characters for the trace text routine. */
|
||||
extern char* graphic_fonte_shape[];
|
||||
|
||||
#include "protos.h"
|
||||
|
||||
#define L_MIN_DESSIN 1 /* seuil de largeur des segments pour trace autre que filaire */
|
||||
|
||||
/* fonctions locales : */
|
||||
#define L_MIN_DESSIN 1 /* line width for segments other than traces. */
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
void Trace_Pads_Only( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module,
|
||||
int ox, int oy,
|
||||
int MasqueLayer, int draw_mode )
|
||||
/******************************************************************/
|
||||
|
||||
/* Trace les pads d'un module en mode SKETCH.
|
||||
* Utilisee pour afficher les pastilles d'un module lorsque celui ci n'est
|
||||
* pas affiche par les options d'affichage des Modules
|
||||
/* Trace the pads of a module in sketch mode.
|
||||
* Used to display a module pads when it is not displayed by the display
|
||||
* options Module setting.
|
||||
*
|
||||
* Les pads affiches doivent apparaitre sur les couches donnees par
|
||||
* MasqueLayer
|
||||
* The pads posters must appear on the data layers by MasqueLayer
|
||||
*/
|
||||
void Trace_Pads_Only( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module,
|
||||
int ox, int oy, int MasqueLayer, int draw_mode )
|
||||
{
|
||||
int tmp;
|
||||
PCB_SCREEN* screen;
|
||||
|
@ -45,7 +38,7 @@ void Trace_Pads_Only( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module,
|
|||
tmp = frame->m_DisplayPadFill;
|
||||
frame->m_DisplayPadFill = FALSE;
|
||||
|
||||
/* trace des pastilles */
|
||||
/* Draw pads. */
|
||||
for( D_PAD* pad = Module->m_Pads; pad; pad = pad->Next() )
|
||||
{
|
||||
if( (pad->m_Masque_Layer & MasqueLayer) == 0 )
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
/*****************************************/
|
||||
/* Routines generales d'affichage du PCB */
|
||||
/*****************************************/
|
||||
|
||||
/* fichier tracepcb.cpp */
|
||||
/****************/
|
||||
/* tracepcb.cpp */
|
||||
/****************/
|
||||
|
||||
/*
|
||||
* Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ...
|
||||
* Routines to display grid box coordinates, cursors, markers ...
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
|
@ -21,13 +19,9 @@
|
|||
#include "protos.h"
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||
/**********************************************************************/
|
||||
|
||||
/* Draw the footprint editor BOARD, and others elements : axis, grid ..
|
||||
*/
|
||||
|
||||
void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||
{
|
||||
PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen();
|
||||
|
||||
|
@ -59,12 +53,9 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||
/****************************************************************/
|
||||
|
||||
/* Draw the BOARD, and others elements : axis, grid ..
|
||||
*/
|
||||
void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||
{
|
||||
PCB_SCREEN* screen = GetScreen();
|
||||
|
||||
|
@ -95,25 +86,24 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
/* Redraw the BOARD items but not cursors, axis or grid */
|
||||
void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
|
||||
int aDrawMode, const wxPoint& offset )
|
||||
/********************************************************************/
|
||||
/* Redraw the BOARD items but not cursors, axis or grid */
|
||||
{
|
||||
/* The order of drawing is flexible on some systems and not on others. For
|
||||
* OSes which use OR to draw, the order is not important except for the
|
||||
* effect of the highlight and its relationship to markers. See comment below.
|
||||
* This order indepence comes from the fact that a binary OR operation is
|
||||
* effect of the highlight and its relationship to markers. See comment
|
||||
* below.
|
||||
* This order independence comes from the fact that a binary OR operation is
|
||||
* commutative in nature.
|
||||
* However on the OSX, the OR operation is not used, and so this sequence
|
||||
* below is chosen to give MODULEs the highest visible priority.
|
||||
*/
|
||||
|
||||
|
||||
/* Draw all tracks and zones. As long as dark colors are used for the tracks,
|
||||
* Then the OR draw mode should show tracks underneath other tracks. But a white
|
||||
* track will cover any other color since it has more bits to OR in.
|
||||
/* Draw all tracks and zones. As long as dark colors are used for the
|
||||
* tracks, Then the OR draw mode should show tracks underneath other
|
||||
* tracks. But a white track will cover any other color since it has
|
||||
* more bits to OR in.
|
||||
*/
|
||||
for( TRACK* track = m_Track; track; track = track->Next() )
|
||||
{
|
||||
|
@ -191,7 +181,8 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
|
|||
if( g_HightLigt_Status )
|
||||
DrawHighLight( aPanel, DC, g_HightLigth_NetCode );
|
||||
|
||||
// draw the BOARD's markers last, otherwise the high light will erase any marker on a pad
|
||||
// draw the BOARD's markers last, otherwise the high light will erase
|
||||
// any marker on a pad
|
||||
for( unsigned i=0; i < m_markers.size(); ++i )
|
||||
{
|
||||
m_markers[i]->Draw( aPanel, DC, aDrawMode );
|
||||
|
@ -199,9 +190,7 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
|
|||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
void BOARD::DrawHighLight( WinEDA_DrawPanel* aDrawPanel, wxDC* DC, int aNetCode )
|
||||
/******************************************************************************/
|
||||
{
|
||||
int draw_mode;
|
||||
|
||||
|
@ -252,4 +241,3 @@ void BOARD::DrawHighLight( WinEDA_DrawPanel* aDrawPanel, wxDC* DC, int aNetCode
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
224
pcbnew/track.cpp
224
pcbnew/track.cpp
|
@ -1,6 +1,6 @@
|
|||
/*********************************************
|
||||
/*****************
|
||||
* track.cpp
|
||||
*********************************************/
|
||||
*****************/
|
||||
|
||||
#include "fctsys.h"
|
||||
|
||||
|
@ -9,34 +9,44 @@
|
|||
|
||||
#include "protos.h"
|
||||
|
||||
/* Functions to reconize a track.
|
||||
/* Functions to recognize a track.
|
||||
* A track is a list of connected segments (or/and vias)
|
||||
* from a starting to an ending point
|
||||
* starting and ending points are a pad or a point with more than 2 segments connected
|
||||
* (and obviouly a dangling segment end)
|
||||
* starting and ending points are a pad or a point with more than 2 segments
|
||||
*connected
|
||||
* (and obviously a dangling segment end)
|
||||
*/
|
||||
|
||||
typedef std::vector<TRACK*> TRACK_PTRS; // buffer of item candidates when search for items on the same track
|
||||
typedef std::vector<TRACK*> TRACK_PTRS; // buffer of item candidates when
|
||||
// search for items on the same track
|
||||
|
||||
|
||||
/* Local functions */
|
||||
static void Marque_Chaine_segments( BOARD* Pcb, wxPoint ref_pos, int masklayer, TRACK_PTRS* aList );
|
||||
static void Marque_Chaine_segments( BOARD* Pcb,
|
||||
wxPoint ref_pos,
|
||||
int masklayer,
|
||||
TRACK_PTRS* aList );
|
||||
|
||||
|
||||
/**
|
||||
* Function Marque_Une_Piste
|
||||
* marks a chain of track segments, connected to aTrackList.
|
||||
* Each segment is marked by setting the BUSY bit into m_Flags. Electrical continuity
|
||||
* is detected by walking each segment, and finally the segments are rearranged
|
||||
* into a contiguous chain within the given list.
|
||||
* @param aPcb = the board to analyse
|
||||
* @param aStartSegm The first interesting segment within a list of track segment of aPcb
|
||||
* @param aSegmCount = a pointer to an integer where to return the number of interesting segments
|
||||
* @param aTrackLen = a pointer to an integer where to return the lenght of the track
|
||||
* Each segment is marked by setting the BUSY bit into m_Flags. Electrical
|
||||
* continuity is detected by walking each segment, and finally the segments
|
||||
* are rearranged into a contiguous chain within the given list.
|
||||
* @param aPcb = the board to analyze
|
||||
* @param aStartSegm - The first interesting segment within a list of track
|
||||
* segment of aPcb
|
||||
* @param aSegmCount = a pointer to an integer where to return the number of
|
||||
* interesting segments
|
||||
* @param aTrackLen = a pointer to an integer where to return the length of the
|
||||
* track
|
||||
* @param aReorder = bool:
|
||||
* true for reorder the interesting segments (useful for track edition/deletion)
|
||||
* in this case the flag BUSY is set (the user is responsible of flag clearing)
|
||||
* false for no reorder : useful when we want just calculate the track lenght
|
||||
* true for reorder the interesting segments (useful for track
|
||||
*edition/deletion)
|
||||
* in this case the flag BUSY is set (the user is responsible of flag
|
||||
*clearing)
|
||||
* false for no reorder : useful when we want just calculate the track length
|
||||
* in this case, flags are reset
|
||||
* @return TRACK* the first in the chain of interesting segments.
|
||||
*/
|
||||
|
@ -70,10 +80,11 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
|||
|
||||
trackList.push_back( aStartSegm );
|
||||
|
||||
/* Examine the initial track segment : if it is really a segment, this is easy.
|
||||
/* Examine the initial track segment : if it is really a segment, this is
|
||||
* easy.
|
||||
* If it is a via, one must search for connected segments.
|
||||
* If <=2, this via connect 2 segments (or is connected to only one segment)
|
||||
* and this via and these 2 segments are a part of a track.
|
||||
* If <=2, this via connect 2 segments (or is connected to only one
|
||||
* segment) and this via and these 2 segments are a part of a track.
|
||||
* If > 2 only this via is flagged (the track has only this via)
|
||||
*/
|
||||
if( aStartSegm->Type() == TYPE_VIA )
|
||||
|
@ -91,34 +102,45 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
|||
Segm3 = Fast_Locate_Piste( Segm2->Next(), NULL,
|
||||
aStartSegm->m_Start, masque_layer );
|
||||
}
|
||||
if( Segm3 ) // More than 2 segments are connected to this via. the "track" is only this via
|
||||
if( Segm3 ) // More than 2 segments are connected to this via. the
|
||||
// "track" is only this via
|
||||
{
|
||||
if( aSegmCount )
|
||||
*aSegmCount = 1;
|
||||
return aStartSegm;
|
||||
}
|
||||
if( Segm1 ) // search for others segments connected to the initial segment start point
|
||||
if( Segm1 ) // search for others segments connected to the initial
|
||||
// segment start point
|
||||
{
|
||||
masque_layer = Segm1->ReturnMaskLayer();
|
||||
Marque_Chaine_segments(
|
||||
aPcb, aStartSegm->m_Start, masque_layer, &trackList );
|
||||
Marque_Chaine_segments( aPcb, aStartSegm->m_Start, masque_layer,
|
||||
&trackList );
|
||||
}
|
||||
if( Segm2 ) // search for others segments connected to the initial segment end point
|
||||
if( Segm2 ) // search for others segments connected to the initial
|
||||
// segment end point
|
||||
{
|
||||
masque_layer = Segm2->ReturnMaskLayer();
|
||||
Marque_Chaine_segments(
|
||||
aPcb, aStartSegm->m_Start, masque_layer, &trackList );
|
||||
Marque_Chaine_segments( aPcb, aStartSegm->m_Start, masque_layer,
|
||||
&trackList );
|
||||
}
|
||||
}
|
||||
else // mark the chain using both ends of the initial segment
|
||||
{
|
||||
Marque_Chaine_segments( aPcb, aStartSegm->m_Start, masque_layer, &trackList );
|
||||
Marque_Chaine_segments( aPcb, aStartSegm->m_End, masque_layer, &trackList );
|
||||
Marque_Chaine_segments( aPcb,
|
||||
aStartSegm->m_Start,
|
||||
masque_layer,
|
||||
&trackList );
|
||||
Marque_Chaine_segments( aPcb,
|
||||
aStartSegm->m_End,
|
||||
masque_layer,
|
||||
&trackList );
|
||||
}
|
||||
|
||||
// Now we examine selected vias and flag them if they are on the track
|
||||
// If a via is connected to only one or 2 segments, it is flagged (is on the track)
|
||||
// If a via is connected to more than 2 segments, it is a track end, and it is removed from the list
|
||||
// Now examine selected vias and flag them if they are on the track
|
||||
// If a via is connected to only one or 2 segments, it is flagged (is on
|
||||
// the track)
|
||||
// If a via is connected to more than 2 segments, it is a track end, and it
|
||||
// is removed from the list
|
||||
// go through the list backwards.
|
||||
for( int i = trackList.size() - 1; i>=0; --i )
|
||||
{
|
||||
|
@ -130,23 +152,30 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
|||
if( via == aStartSegm )
|
||||
continue;
|
||||
|
||||
via->SetState( BUSY, ON ); // Try to flag it. the flag will be cleared later if needed
|
||||
via->SetState( BUSY, ON ); // Try to flag it. the flag will be cleared
|
||||
// later if needed
|
||||
|
||||
masque_layer = via->ReturnMaskLayer();
|
||||
|
||||
TRACK* track = Fast_Locate_Piste( aPcb->m_Track, NULL, via->m_Start, masque_layer );
|
||||
TRACK* track = Fast_Locate_Piste( aPcb->m_Track,
|
||||
NULL,
|
||||
via->m_Start,
|
||||
masque_layer );
|
||||
|
||||
// Fast_Locate_Piste does not consider tracks flagged BUSY.
|
||||
// So if no connected track found, this via is on the current track only: keep it
|
||||
// So if no connected track found, this via is on the current track
|
||||
// only: keep it
|
||||
if( track == NULL )
|
||||
continue;
|
||||
|
||||
/* if a track is found, this via connects also others segments of an other track
|
||||
* This case happens when the vias ends the selected track.
|
||||
* But must we consider this via is on the selected track, or on an other track.
|
||||
* (this is important when selecting a track for deletion: must this via be deleted or not?)
|
||||
* We consider here this via on the track if others segment connected to this via
|
||||
* remain connected when removing this via.
|
||||
/* If a track is found, this via connects also others segments of an
|
||||
* other track. This case happens when the vias ends the selected
|
||||
* track but must we consider this via is on the selected track, or
|
||||
* on an other track.
|
||||
* (this is important when selecting a track for deletion: must this
|
||||
* via be deleted or not?)
|
||||
* We consider here this via on the track if others segment connected
|
||||
* to this via remain connected when removing this via.
|
||||
* We search for all others segment connected together:
|
||||
* if there are on the same layer, the via is on the selected track
|
||||
* if there are on different layers, the via is on an other track
|
||||
|
@ -154,26 +183,30 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
|||
int layer = track->GetLayer();
|
||||
|
||||
while( ( track = Fast_Locate_Piste( track->Next(), NULL,
|
||||
via->m_Start, masque_layer ) ) != NULL )
|
||||
via->m_Start,
|
||||
masque_layer ) ) != NULL )
|
||||
{
|
||||
if( layer != track->GetLayer() )
|
||||
{
|
||||
// The via connects segments of an other track: it is removed from list
|
||||
// because it is member of an other track
|
||||
// The via connects segments of an other track: it is removed
|
||||
// from list because it is member of an other track
|
||||
via->SetState( BUSY, OFF );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Rearrange the track list in order to have flagged segments linked from firstTrack
|
||||
* So the NbSegmBusy segments are consecutive segments in list, the first item
|
||||
* in the full track list is firstTrack, and the NbSegmBusy-1 next items
|
||||
* (NbSegmBusy when including firstTrack) are the flagged segments
|
||||
/* Rearrange the track list in order to have flagged segments linked
|
||||
* from firstTrack so the NbSegmBusy segments are consecutive segments
|
||||
* in list, the first item in the full track list is firstTrack, and
|
||||
* the NbSegmBusy-1 next items (NbSegmBusy when including firstTrack)
|
||||
* are the flagged segments
|
||||
*/
|
||||
NbSegmBusy = 0;
|
||||
TRACK* firstTrack;
|
||||
for( firstTrack = aPcb->m_Track; firstTrack; firstTrack = firstTrack->Next() )
|
||||
for( firstTrack = aPcb->m_Track;
|
||||
firstTrack;
|
||||
firstTrack = firstTrack->Next() )
|
||||
{
|
||||
// Search for the first flagged BUSY segments
|
||||
if( firstTrack->GetState( BUSY ) )
|
||||
|
@ -233,11 +266,6 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
|||
}
|
||||
|
||||
|
||||
/********************************************************************************/
|
||||
static void Marque_Chaine_segments( BOARD* aPcb, wxPoint aRef_pos, int aLayerMask,
|
||||
TRACK_PTRS* aList )
|
||||
/********************************************************************************/
|
||||
|
||||
/**
|
||||
* Function used by Marque_Une_Piste()
|
||||
* - Set the BUSY flag of connected segments, the first search point is
|
||||
|
@ -247,40 +275,50 @@ static void Marque_Chaine_segments( BOARD* aPcb, wxPoint aRef_pos, int aLayerMas
|
|||
* @param Pcb = the board
|
||||
* @param aRef_pos = the reference coordinate of the starting search
|
||||
* @param aLayerMask = the allowed layers for segments to search
|
||||
* (1 layer when starting point is on a segment, but more than one when starting point is on a via)
|
||||
* (1 layer when starting point is on a segment, but more than one when
|
||||
* starting point is on a via)
|
||||
* @param aList = the track list to fill with points of segments flagged
|
||||
*/
|
||||
static void Marque_Chaine_segments( BOARD* aPcb,
|
||||
wxPoint aRef_pos,
|
||||
int aLayerMask,
|
||||
TRACK_PTRS* aList )
|
||||
{
|
||||
TRACK* pt_segm, // Pointe le segment courant analyse
|
||||
* pt_via, // pointe la via reperee, eventuellement a detruire
|
||||
* SegmentCandidate; // pointe le segment a detruire (= NULL ou pt_segm
|
||||
TRACK* pt_segm, // The current segment being analyzed.
|
||||
* pt_via, // The via identified, eventually destroy
|
||||
|
||||
* SegmentCandidate; // The end segment to destroy (or NULL =
|
||||
// pt_segm
|
||||
int NbSegm;
|
||||
|
||||
if( aPcb->m_Track == NULL )
|
||||
return;
|
||||
|
||||
/* Set the BUSY flag of all connected segments, first search starting at aRef_pos
|
||||
/* Set the BUSY flag of all connected segments, first search starting at
|
||||
* aRef_pos
|
||||
* Search ends when:
|
||||
* - a pad is found (end of a track)
|
||||
* - a segment end has more than one other segment end connected
|
||||
* - and obviously when no connected item found
|
||||
* Vias are a special case, because we must see others segment connected on others layers
|
||||
* and they change the layer mask. They can be a track end or not
|
||||
* They will be analyser later, and vias on terminal points of the track will be
|
||||
* considered as part of this track if they do not connect segments of an other track together
|
||||
* and will be considered as part of an other track
|
||||
* if when removing the via, the segments of taht other track are disconnected
|
||||
* Vias are a special case, because we must see others segment connected
|
||||
* on others layers and they change the layer mask. They can be a track
|
||||
* end or not
|
||||
* They will be analyzer later, and vias on terminal points of the track
|
||||
* will be considered as part of this track if they do not connect segments
|
||||
* of an other track together and will be considered as part of an other
|
||||
* track if when removing the via, the segments of that other track are
|
||||
* disconnected
|
||||
*/
|
||||
for( ; ; )
|
||||
{
|
||||
if( Fast_Locate_Pad_Connecte( aPcb, aRef_pos, aLayerMask ) != NULL )
|
||||
return;
|
||||
|
||||
/* Test for a via: a via changes the layer mask and can connect a lot of segments
|
||||
* at location aRef_pos
|
||||
* When found, the via is just pushed in list.
|
||||
* Vias will be examined later, when all connected segment are found and push in list
|
||||
* This is because whena via is found we do not know at this time the number of connected items
|
||||
/* Test for a via: a via changes the layer mask and can connect a lot
|
||||
* of segments at location aRef_pos. When found, the via is just
|
||||
* pushed in list. Vias will be examined later, when all connected
|
||||
* segment are found and push in list. This is because when a via
|
||||
* is found we do not know at this time the number of connected items
|
||||
* and we do not know if this via is on the track or finish the track
|
||||
*/
|
||||
pt_via = Fast_Locate_Via( aPcb->m_Track, NULL, aRef_pos, aLayerMask );
|
||||
|
@ -301,7 +339,8 @@ static void Marque_Chaine_segments( BOARD* aPcb, wxPoint aRef_pos, int aLayerMas
|
|||
while( ( pt_segm = Fast_Locate_Piste( pt_segm, NULL,
|
||||
aRef_pos, aLayerMask ) ) != NULL )
|
||||
{
|
||||
if( pt_segm->GetState( BUSY ) ) // already found and selected: skip it
|
||||
if( pt_segm->GetState( BUSY ) ) // already found and selected: skip
|
||||
// it
|
||||
{
|
||||
pt_segm = pt_segm->Next();
|
||||
continue;
|
||||
|
@ -314,21 +353,25 @@ static void Marque_Chaine_segments( BOARD* aPcb, wxPoint aRef_pos, int aLayerMas
|
|||
}
|
||||
|
||||
NbSegm++;
|
||||
if( NbSegm == 1 ) /* First time we found a connected item: pt_segm is candidate */
|
||||
if( NbSegm == 1 ) /* First time we found a connected item: pt_segm
|
||||
* is candidate */
|
||||
{
|
||||
SegmentCandidate = pt_segm;
|
||||
pt_segm = pt_segm->Next();
|
||||
}
|
||||
else /* More than 1 segment connected -> this location is an end of the track */
|
||||
else /* More than 1 segment connected -> this location is an end of
|
||||
* the track */
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( SegmentCandidate ) // A candidate is found: flag it an push it in list
|
||||
if( SegmentCandidate ) // A candidate is found: flag it an push it
|
||||
// in list
|
||||
{
|
||||
/* Initialize parameters to search items connected to this candidate:
|
||||
* we must analyse connections to its other end
|
||||
/* Initialize parameters to search items connected to this
|
||||
* candidate:
|
||||
* we must analyze connections to its other end
|
||||
*/
|
||||
aLayerMask = SegmentCandidate->ReturnMaskLayer();
|
||||
|
||||
|
@ -341,7 +384,7 @@ static void Marque_Chaine_segments( BOARD* aPcb, wxPoint aRef_pos, int aLayerMas
|
|||
aRef_pos = SegmentCandidate->m_Start;
|
||||
}
|
||||
|
||||
pt_segm = aPcb->m_Track; /* restart list of tracks to analyse */
|
||||
pt_segm = aPcb->m_Track; /* restart list of tracks to analyze */
|
||||
|
||||
/* flag this item an push it in list of selected items */
|
||||
aList->push_back( SegmentCandidate );
|
||||
|
@ -353,20 +396,18 @@ static void Marque_Chaine_segments( BOARD* aPcb, wxPoint aRef_pos, int aLayerMas
|
|||
}
|
||||
|
||||
|
||||
/********************************************************/
|
||||
int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
|
||||
TRACK** StartTrack, TRACK** EndTrack )
|
||||
/**********************************************************/
|
||||
|
||||
/* Calculate the end points coordinates of a track (a list of connected segments)
|
||||
/* Calculate the end points coordinates of a track (a list of connected
|
||||
* segments)
|
||||
* RefTrack is a segment of the track
|
||||
* return 1 if OK, 0 when a track is a closed loop
|
||||
* and the beginning and the end of the track in *StartTrack and *EndTrack
|
||||
* Modify *StartTrack en *EndTrack :
|
||||
* (*StartTrack)->m_Start coordinate is the beginning of the track
|
||||
* (*EndTrack)->m_End coordinate is the end of the track
|
||||
* Segments connected must be consecutives in list
|
||||
* Segments connected must be consecutive in list
|
||||
*/
|
||||
int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
|
||||
TRACK** StartTrack, TRACK** EndTrack )
|
||||
{
|
||||
TRACK* Track, * via, * segm, * TrackListEnd;
|
||||
int NbEnds, masque_layer, ii, ok = 0;
|
||||
|
@ -374,10 +415,10 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
|
|||
if( NbSegm <= 1 )
|
||||
{
|
||||
*StartTrack = *EndTrack = RefTrack;
|
||||
return 1; /* cas trivial */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* calcul de la limite d'analyse */
|
||||
/* Calculation of the limit analysis. */
|
||||
*StartTrack = *EndTrack = NULL;
|
||||
TrackListEnd = Track = RefTrack; ii = 0;
|
||||
for( ; ( Track != NULL ) && ( ii < NbSegm ); ii++, Track = Track->Next() )
|
||||
|
@ -386,7 +427,7 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
|
|||
Track->m_Param = 0;
|
||||
}
|
||||
|
||||
/* Calcul des extremites */
|
||||
/* Calculate the extremes. */
|
||||
NbEnds = 0; Track = RefTrack; ii = 0;
|
||||
for( ; ( Track != NULL ) && ( ii < NbSegm ); ii++, Track = Track->Next() )
|
||||
{
|
||||
|
@ -421,7 +462,7 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
|
|||
int BeginPad, EndPad;
|
||||
*EndTrack = Track;
|
||||
|
||||
/* permutation de ox,oy avec fx,fy */
|
||||
/* Swap ox, oy with fx, fy */
|
||||
BeginPad = Track->GetState( BEGIN_ONPAD );
|
||||
EndPad = Track->GetState( END_ONPAD );
|
||||
|
||||
|
@ -463,7 +504,7 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
|
|||
*StartTrack = Track;
|
||||
NbEnds++;
|
||||
|
||||
/* permutation de ox,oy avec fx,fy */
|
||||
/* Swap ox, oy with fx, fy */
|
||||
BeginPad = Track->GetState( BEGIN_ONPAD );
|
||||
EndPad = Track->GetState( END_ONPAD );
|
||||
|
||||
|
@ -490,12 +531,9 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
|
|||
}
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
void ListSetState( EDA_BaseStruct* Start, int NbItem, int State, int onoff )
|
||||
/***************************************************************************/
|
||||
|
||||
/* Set to onoff the .m_State member, bit mask State of a list of items
|
||||
*/
|
||||
void ListSetState( EDA_BaseStruct* Start, int NbItem, int State, int onoff )
|
||||
{
|
||||
if( Start == NULL )
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************/
|
||||
/* Routines de tracage des pistes ( Toutes, 1 piste, 1 segment ) */
|
||||
/*****************************************************************/
|
||||
/********************************/
|
||||
/* Routines for plotting traces */
|
||||
/********************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
@ -11,30 +11,24 @@
|
|||
|
||||
#include "protos.h"
|
||||
|
||||
/* variables locales : */
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* Trace consecutive segments in memory.
|
||||
*
|
||||
* Parameters:
|
||||
* Pt_start_piste = first segment in the list
|
||||
* Nbsegment = number of segments traced
|
||||
* Draw_mode = mode (GR_XOR, GR_OR ..)
|
||||
* CAUTION:
|
||||
* The starting point of a track following MUST exist: may be
|
||||
* then put a 0 before calling a routine if the track is the last drawn.
|
||||
*/
|
||||
void Trace_Une_Piste( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* aTrackList,
|
||||
int nbsegment, int draw_mode )
|
||||
/************************************************************************/
|
||||
|
||||
/* routine de trace de n segments consecutifs en memoire.
|
||||
* Utile pour monter une piste en cours de trace car les segments de cette
|
||||
* piste sont alors contigus en memoire
|
||||
* Parametres :
|
||||
* pt_start_piste = adresse de depart de la liste des segments
|
||||
* nbsegment = nombre de segments a tracer
|
||||
* draw_mode = mode ( GR_XOR, GR_OR..)
|
||||
* ATTENTION:
|
||||
* le point de depart d'une piste suivante DOIT exister: peut etre
|
||||
* donc mis a 0 avant appel a la routine si la piste a tracer est la derniere
|
||||
*/
|
||||
{
|
||||
// preserve the start of the list for debugging.
|
||||
for( TRACK* track = aTrackList; nbsegment > 0 && track; nbsegment--, track = track->Next() )
|
||||
for( TRACK* track = aTrackList; nbsegment > 0 && track;
|
||||
nbsegment--, track = track->Next() )
|
||||
{
|
||||
track->Draw( panel, DC, draw_mode );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
128
pcbnew/work.cpp
128
pcbnew/work.cpp
|
@ -1,8 +1,6 @@
|
|||
/********************************************/
|
||||
/* AUTOROUTAGE PCB : routines d'autoroutage */
|
||||
/********************************************/
|
||||
|
||||
/* fichier WORK.CC */
|
||||
/************************/
|
||||
/* Autorouting routines */
|
||||
/************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
@ -13,7 +11,7 @@
|
|||
#include "cell.h"
|
||||
|
||||
#include "protos.h"
|
||||
/**/
|
||||
|
||||
|
||||
struct CWORK /* a unit of work is a hole-pair to connect */
|
||||
{
|
||||
|
@ -23,18 +21,18 @@ struct CWORK /* a unit of work is a hole-pair to connect */
|
|||
int net_code; /* net_code */
|
||||
int ToRow; /* target row */
|
||||
int ToCol; /* target column */
|
||||
RATSNEST_ITEM *pt_rats; /* chevelu correspondant*/
|
||||
RATSNEST_ITEM* pt_rats; /* Corresponding ratsnest */
|
||||
int ApxDist; /* approximate distance */
|
||||
int Cost; /* cost for sort by length */
|
||||
int Priority; /* routage priority */
|
||||
int Priority; /* route priority */
|
||||
};
|
||||
|
||||
|
||||
/* pointers to the first and last item of work to do */
|
||||
static CWORK* Head = NULL;
|
||||
static CWORK* Tail = NULL;
|
||||
static CWORK* Current = NULL;
|
||||
|
||||
/* Routines definies ici : */
|
||||
|
||||
void InitWork();
|
||||
void ReInitWork();
|
||||
|
@ -43,10 +41,6 @@ void GetWork( int *, int *, int *, int *, int *, RATSNEST_ITEM ** );
|
|||
void SortWork();
|
||||
|
||||
|
||||
/************************/
|
||||
/* void InitWork () */
|
||||
/************************/
|
||||
|
||||
/* initialize the work list */
|
||||
void InitWork()
|
||||
{
|
||||
|
@ -54,34 +48,35 @@ CWORK *ptr;
|
|||
|
||||
while( ( ptr = Head ) != NULL )
|
||||
{
|
||||
Head = ptr->Next; MyFree( ptr );
|
||||
Head = ptr->Next;
|
||||
MyFree( ptr );
|
||||
}
|
||||
|
||||
Tail = Current = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*************************/
|
||||
/* void ReInitWork() */
|
||||
/*************************/
|
||||
|
||||
/* initialize the work list */
|
||||
void ReInitWork()
|
||||
{
|
||||
Current = Head;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*int SetWork(int r1,int c1,int* n_c,int r2,int c2,RATSNEST_ITEM * pt_ch,int pri )*/
|
||||
/*****************************************************************************/
|
||||
|
||||
/* add a unit of work to the work list
|
||||
Return:
|
||||
1 si OK
|
||||
0 si defaut d'allocation memoire
|
||||
* Return:
|
||||
* 1 if OK
|
||||
* 0 if memory allocation failed
|
||||
*/
|
||||
static int GetCost( int r1, int c1, int r2, int c2 );
|
||||
|
||||
int SetWork(int r1,int c1,int n_c,int r2,int c2,RATSNEST_ITEM * pt_ch,int pri )
|
||||
int SetWork( int r1,
|
||||
int c1,
|
||||
int n_c,
|
||||
int r2,
|
||||
int c2,
|
||||
RATSNEST_ITEM* pt_ch,
|
||||
int pri )
|
||||
{
|
||||
CWORK* p;
|
||||
|
||||
|
@ -102,19 +97,20 @@ CWORK *p;
|
|||
else /* first in list */
|
||||
Head = Current = p;
|
||||
Tail = p;
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
else /* can't get any more memory */
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* void GetWork (int *r1,int *c1,int *r2,int *c2, char **n1,char **n2 ) */
|
||||
/************************************************************************/
|
||||
|
||||
void GetWork (int *r1,int *c1,int *n_c,int *r2,int *c2,RATSNEST_ITEM** pt_ch )
|
||||
/* fetch a unit of work from the work list */
|
||||
void GetWork( int* r1,
|
||||
int* c1,
|
||||
int* n_c,
|
||||
int* r2,
|
||||
int* c2,
|
||||
RATSNEST_ITEM** pt_ch )
|
||||
{
|
||||
if( Current )
|
||||
{
|
||||
|
@ -126,8 +122,8 @@ void GetWork (int *r1,int *c1,int *n_c,int *r2,int *c2,RATSNEST_ITEM** pt_ch )
|
|||
*pt_ch = Current->pt_rats;
|
||||
Current = Current->Next;
|
||||
}
|
||||
|
||||
else { /* none left */
|
||||
else /* none left */
|
||||
{
|
||||
*r1 = *c1 = *r2 = *c2 = ILLEGAL;
|
||||
*n_c = 0;
|
||||
*pt_ch = NULL;
|
||||
|
@ -135,10 +131,6 @@ void GetWork (int *r1,int *c1,int *n_c,int *r2,int *c2,RATSNEST_ITEM** pt_ch )
|
|||
}
|
||||
|
||||
|
||||
/***********************/
|
||||
/* void SortWork() */
|
||||
/***********************/
|
||||
|
||||
/* order the work items; shortest (low cost) first */
|
||||
void SortWork()
|
||||
{
|
||||
|
@ -148,46 +140,56 @@ CWORK *q1; /* sort other PAD_CONNECTs in q1 */
|
|||
CWORK* r;
|
||||
|
||||
q0 = q1 = NULL;
|
||||
while( (p = Head) != NULL )
|
||||
{ /* prioritize each work item */
|
||||
while( (p = Head) != NULL ) /* prioritize each work item */
|
||||
{
|
||||
Head = Head->Next;
|
||||
if (p->Priority)
|
||||
{ /* put at end of priority list */
|
||||
if( p->Priority ) /* put at end of priority list */
|
||||
{
|
||||
p->Next = NULL;
|
||||
if( (r = q0) == NULL ) /* empty list? */
|
||||
q0 = p;
|
||||
else
|
||||
{ /* attach at end */
|
||||
else /* attach at end */
|
||||
{
|
||||
while( r->Next ) /* search for end */
|
||||
r = r->Next;
|
||||
|
||||
r->Next = p; /* attach */
|
||||
}
|
||||
}
|
||||
else if( ( ( r = q1 ) == NULL ) || ( p->Cost < q1->Cost ) )
|
||||
{
|
||||
p->Next = q1; q1 = p;
|
||||
p->Next = q1;
|
||||
q1 = p;
|
||||
}
|
||||
else { /* find proper position in list */
|
||||
while (r->Next && p->Cost >= r->Next->Cost) r = r->Next;
|
||||
p->Next = r->Next; r->Next = p;
|
||||
else /* find proper position in list */
|
||||
{
|
||||
while( r->Next && p->Cost >= r->Next->Cost )
|
||||
r = r->Next;
|
||||
|
||||
p->Next = r->Next;
|
||||
r->Next = p;
|
||||
}
|
||||
}
|
||||
|
||||
if( (p = q0) != NULL)
|
||||
{ /* any priority PAD_CONNECTs? */
|
||||
while (q0->Next) q0 = q0->Next;
|
||||
if( (p = q0) != NULL ) /* any priority PAD_CONNECTs? */
|
||||
{
|
||||
while( q0->Next )
|
||||
q0 = q0->Next;
|
||||
|
||||
q0->Next = q1;
|
||||
}
|
||||
else p = q1;
|
||||
else
|
||||
p = q1;
|
||||
|
||||
/* reposition Head and Tail */
|
||||
for(Head = Current = Tail = p; Tail && Tail->Next; Tail = Tail->Next) ;
|
||||
for( Head = Current = Tail = p; Tail && Tail->Next; Tail = Tail->Next )
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
/* routine de calcul du cout d'un chevelu:
|
||||
cout = (|dx| + |dy|) * handicap
|
||||
handicap = 1 si dx ou dy = 0, max si |dx| # |dy|
|
||||
/* Calculate the cost of a net:
|
||||
* cost = (| dx | + | dy |) * disability
|
||||
* disability = 1 if dx or dy = 0, max if | dx | # | dy |
|
||||
*/
|
||||
static int GetCost( int r1, int c1, int r2, int c2 )
|
||||
{
|
||||
|
@ -197,11 +199,15 @@ float incl;
|
|||
dx = abs( c2 - c1 );
|
||||
dy = abs( r2 - r1 );
|
||||
incl = 1.0;
|
||||
mx = dx; my = dy;
|
||||
if ( mx < my ) { mx = dy; my = dx;}
|
||||
if ( mx ) incl += (2*(float)my/mx);
|
||||
mx = dx;
|
||||
my = dy;
|
||||
|
||||
if( mx < my )
|
||||
{
|
||||
mx = dy; my = dx;
|
||||
}
|
||||
if( mx )
|
||||
incl += (2 * (float) my / mx);
|
||||
|
||||
return (int) ( ( dx + dy ) * incl );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/******************************/
|
||||
/* PCBNEW: echange de modules */
|
||||
/******************************/
|
||||
|
||||
/* Fichier xchmod.cpp */
|
||||
/*******************************/
|
||||
/* Pcbnew: exchange of modules */
|
||||
/*******************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "common.h"
|
||||
|
@ -14,12 +12,10 @@
|
|||
|
||||
#include "dialog_exchange_modules_base.h"
|
||||
|
||||
// Local variables:
|
||||
int s_SelectionMode = 0; // Remember the last exchange option, when exit dialog.
|
||||
|
||||
/************************************/
|
||||
/* class DIALOG_EXCHANGE_MODULE */
|
||||
/************************************/
|
||||
int s_SelectionMode = 0; // Remember the last exchange option, when exit
|
||||
// dialog.
|
||||
|
||||
|
||||
class DIALOG_EXCHANGE_MODULE : public DIALOG_EXCHANGE_MODULE_BASE
|
||||
{
|
||||
|
@ -28,10 +24,7 @@ private:
|
|||
WinEDA_PcbFrame* m_Parent;
|
||||
MODULE* m_CurrentModule;
|
||||
|
||||
public:
|
||||
|
||||
// Constructor and destructor
|
||||
DIALOG_EXCHANGE_MODULE( WinEDA_PcbFrame* aParent, MODULE* aModule );
|
||||
public: DIALOG_EXCHANGE_MODULE( WinEDA_PcbFrame* aParent, MODULE* aModule );
|
||||
~DIALOG_EXCHANGE_MODULE() { };
|
||||
|
||||
private:
|
||||
|
@ -53,7 +46,8 @@ private:
|
|||
};
|
||||
|
||||
|
||||
DIALOG_EXCHANGE_MODULE::DIALOG_EXCHANGE_MODULE( WinEDA_PcbFrame* parent, MODULE* Module ) :
|
||||
DIALOG_EXCHANGE_MODULE::DIALOG_EXCHANGE_MODULE( WinEDA_PcbFrame* parent,
|
||||
MODULE* Module ) :
|
||||
DIALOG_EXCHANGE_MODULE_BASE( parent )
|
||||
{
|
||||
m_Parent = parent;
|
||||
|
@ -137,15 +131,12 @@ void DIALOG_EXCHANGE_MODULE::OnSelectionClicked( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
/*
|
||||
* Met a jour le fichier name.CMP (s'il existe) apres un echange de module
|
||||
* (par la commande changeMod), si les modules sont geres par ce fichier
|
||||
* Updates the file name.CMP (if any) after an exchange module
|
||||
* (By command changeMod), if the modules are managed by this file
|
||||
*
|
||||
* Si ShowError != 0 affiche message d'erreur si le fichier .cmp n'est pas
|
||||
* trouve.
|
||||
* Retoure 1 si erreur
|
||||
* If ShowError! = 0 displays error message if the file. Cmp is not found.
|
||||
* Return 1 if error
|
||||
*/
|
||||
int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
|
||||
const wxString& old_name,
|
||||
|
@ -160,13 +151,12 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
|
|||
char* result; // quiet compiler
|
||||
|
||||
if( old_name == new_name )
|
||||
return 0; /* pas de changement de nom */
|
||||
return 0; /* no change of name */
|
||||
|
||||
/* Calcul nom fichier CMP par changement de l'extension du nom netliste */
|
||||
/* Calculation CMP file name by changing the extension name NetList */
|
||||
fn = m_Parent->GetScreen()->m_FileName;
|
||||
fn.SetExt( NetCmpExtBuffer );
|
||||
|
||||
// Modification du fichier .cmp correcpondant
|
||||
FichCmp = wxFopen( fn.GetFullPath(), wxT( "rt" ) );
|
||||
if( FichCmp == NULL )
|
||||
{
|
||||
|
@ -178,7 +168,6 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Analyse du fichier et modif */
|
||||
tmpFileName = fn;
|
||||
tmpFileName.SetExt( wxT( "$$$" ) );
|
||||
NewFile = wxFopen( tmpFileName.GetFullPath(), wxT( "wt" ) );
|
||||
|
@ -237,13 +226,12 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Routine de changement d'un module:
|
||||
* Change le module pointe par la souris, par un autre en conservant
|
||||
* - meme orientation
|
||||
* - meme position
|
||||
* - memes textes valeur et ref
|
||||
* - memes netnames pour pads de meme nom
|
||||
/* Change the module at the current cursor position.
|
||||
* Retains the following:
|
||||
* - Same direction
|
||||
* - Same position
|
||||
* - Same text value and ref
|
||||
* - Same NetNames for pads same name
|
||||
*/
|
||||
void DIALOG_EXCHANGE_MODULE::Change_Module()
|
||||
{
|
||||
|
@ -266,15 +254,15 @@ void DIALOG_EXCHANGE_MODULE::Change_Module()
|
|||
|
||||
|
||||
/*
|
||||
* Routine de changement de tous les modules de meme nom lib que celui
|
||||
* selectionne, en conservant
|
||||
* - meme orientation
|
||||
* - meme position
|
||||
* - memes textes valeur et ref
|
||||
* - memes netnames pour pads de meme nom
|
||||
* et en remplacant l'ancien module par le noveau module
|
||||
* Attention: m_CurrentModule ne pointe plus sur le module de reference
|
||||
* puisque celui ci a ete change!!
|
||||
* Change of all modules with the same name as that lib
|
||||
* Retains:
|
||||
* - Same direction
|
||||
* - Same position
|
||||
* - Same text value and ref
|
||||
* - Same NetNames for pads same name
|
||||
* And replacing the old module with the new module
|
||||
* Note: m_CurrentModule no longer on the module reference
|
||||
* since it has been changed!
|
||||
*/
|
||||
void DIALOG_EXCHANGE_MODULE::Change_ModuleId( bool aUseValue )
|
||||
{
|
||||
|
@ -284,7 +272,7 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleId( bool aUseValue )
|
|||
wxString newmodulename = m_NewModule->GetValue();
|
||||
wxString value, lib_reference;
|
||||
bool check_module_value = false;
|
||||
int ShowErr = 3; // Affiche 3 messages d'err maxi
|
||||
int ShowErr = 3; // Post 3 error messages max.
|
||||
|
||||
if( m_Parent->GetBoard()->m_Modules == NULL )
|
||||
return;
|
||||
|
@ -310,12 +298,13 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleId( bool aUseValue )
|
|||
if( !IsOK( this, msg ) )
|
||||
return;
|
||||
|
||||
/* Le changement s'effectue a partir du dernier module car la routine
|
||||
* Change_1_Module() modifie le dernier module de la liste
|
||||
/* The change is done from the last module for the routine
|
||||
* Change_1_Module () modifies the last module in the list.
|
||||
*/
|
||||
|
||||
PICKED_ITEMS_LIST pickList;
|
||||
/* note: for the first module in chain (the last here), Module->Back() points the board or is NULL
|
||||
|
||||
/* note: for the first module in chain (the last here), Module->Back()
|
||||
* points the board or is NULL
|
||||
*/
|
||||
Module = m_Parent->GetBoard()->m_Modules.GetLast();
|
||||
for( ; Module && ( Module->Type() == TYPE_MODULE ); Module = PtBack )
|
||||
|
@ -346,18 +335,18 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleId( bool aUseValue )
|
|||
|
||||
|
||||
/*
|
||||
* Routine de changement de tous les modules par les modules de meme nom lib:
|
||||
* en conservant
|
||||
* - meme orientation
|
||||
* - meme position
|
||||
* - memes textes valeur et ref
|
||||
* - memes netnames pour pads de meme nom
|
||||
* Change all modules with module of the same name in library.
|
||||
* Maintains:
|
||||
* - Same direction
|
||||
* - Same position
|
||||
* - Same text value and ref
|
||||
* - Same NetNames for pads same name
|
||||
*/
|
||||
void DIALOG_EXCHANGE_MODULE::Change_ModuleAll()
|
||||
{
|
||||
MODULE* Module, * PtBack;
|
||||
bool change = false;
|
||||
int ShowErr = 3; // Affiche 3 messages d'err maxi
|
||||
int ShowErr = 3; // Post 3 error messages max.
|
||||
|
||||
if( m_Parent->GetBoard()->m_Modules == NULL )
|
||||
return;
|
||||
|
@ -365,13 +354,13 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleAll()
|
|||
if( !IsOK( this, _( "Change ALL modules ?" ) ) )
|
||||
return;
|
||||
|
||||
/* Le changement s'effectue a partir du dernier module car la routine
|
||||
* Change_1_Module() modifie le dernier module de la liste
|
||||
/* The change is done from the last module for the routine
|
||||
* Change_1_Module () modifies the last module in the list
|
||||
*/
|
||||
|
||||
PICKED_ITEMS_LIST pickList;
|
||||
|
||||
/* note: for the first module in chain (the last here), Module->Back() points the board or is NULL
|
||||
/* note: for the first module in chain (the last here), Module->Back()
|
||||
* points the board or is NULL
|
||||
*/
|
||||
Module = m_Parent->GetBoard()->m_Modules.GetLast();
|
||||
for( ; Module && ( Module->Type() == TYPE_MODULE ); Module = PtBack )
|
||||
|
@ -394,16 +383,15 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleAll()
|
|||
|
||||
|
||||
/*
|
||||
* Routine de changement d'un module:
|
||||
* Change le module de numero empr, avec le module de nom new_module
|
||||
* - meme orientation
|
||||
* - meme position
|
||||
* - memes textes valeur et ref
|
||||
* - memes netnames pour pads de meme nom
|
||||
* Retourne :
|
||||
* false si pas de changement ( si le nouveau module n'est pas en libr)
|
||||
* true si OK
|
||||
* Ratsnest *must be recalculated* after modules changes
|
||||
* Change the number empr module with the module name new_module
|
||||
* - Same direction
|
||||
* - Same position
|
||||
* - Same text value and ref
|
||||
* - Same NetNames for pads same name
|
||||
* Returns:
|
||||
* False if no change (if the new module is not free)
|
||||
* True if OK
|
||||
* Ratsnest must be recalculated after module exchange
|
||||
*/
|
||||
bool DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module,
|
||||
const wxString& new_module,
|
||||
|
@ -419,13 +407,14 @@ bool DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module,
|
|||
|
||||
wxBusyCursor dummy;
|
||||
|
||||
/* Memorisation des parametres utiles de l'ancien module */
|
||||
/* Copy parameters from the old module. */
|
||||
oldnamecmp = Module->m_LibRef;
|
||||
namecmp = new_module;
|
||||
|
||||
/* Chargement du module */
|
||||
/* Load module. */
|
||||
Line.Printf( _( "Change module %s (%s) " ),
|
||||
GetChars( Module->m_Reference->m_Text ), GetChars( oldnamecmp ) );
|
||||
GetChars( Module->m_Reference->m_Text ),
|
||||
GetChars( oldnamecmp ) );
|
||||
m_WinMessages->AppendText( Line );
|
||||
|
||||
namecmp.Trim( true );
|
||||
|
@ -433,7 +422,7 @@ bool DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module,
|
|||
NewModule = m_Parent->Get_Librairie_Module( wxEmptyString,
|
||||
namecmp,
|
||||
ShowError );
|
||||
if( NewModule == NULL ) /* Nouveau module NON trouve, reaffichage de l'ancien */
|
||||
if( NewModule == NULL ) /* New module not found, redraw the old one. */
|
||||
{
|
||||
m_WinMessages->AppendText( wxT( "No\n" ) );
|
||||
return false;
|
||||
|
@ -460,16 +449,18 @@ bool DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module,
|
|||
* OldModule is deleted or put in undo list.
|
||||
* @param aOldModule = footprint to replace
|
||||
* @param aNewModule = footprint to put
|
||||
* @param aUndoPickList = the undo list used to save OldModule. If null, OldModule is deleted
|
||||
* @param aUndoPickList = the undo list used to save OldModule. If null,
|
||||
* OldModule is deleted
|
||||
*/
|
||||
void WinEDA_PcbFrame::Exchange_Module( MODULE* aOldModule,
|
||||
MODULE* aNewModule,
|
||||
PICKED_ITEMS_LIST* aUndoPickList )
|
||||
{
|
||||
wxPoint oldpos; /* memorisation temporaire pos curseur */
|
||||
wxPoint oldpos;
|
||||
D_PAD* pad, * old_pad;
|
||||
|
||||
if( (aOldModule->Type() != TYPE_MODULE) || (aNewModule->Type() != TYPE_MODULE) )
|
||||
if( ( aOldModule->Type() != TYPE_MODULE )
|
||||
|| ( aNewModule->Type() != TYPE_MODULE ) )
|
||||
{
|
||||
wxMessageBox( wxT( "WinEDA_PcbFrame::Exchange_Module() StuctType error" ) );
|
||||
return;
|
||||
|
@ -481,7 +472,7 @@ void WinEDA_PcbFrame::Exchange_Module( MODULE* aOldModule,
|
|||
oldpos = GetScreen()->m_Curseur;
|
||||
GetScreen()->m_Curseur = aOldModule->m_Pos;
|
||||
|
||||
/* place module without ratsnets refresh: this will be made later
|
||||
/* place module without ratsnest refresh: this will be made later
|
||||
* when all modules are on board
|
||||
*/
|
||||
Place_Module( aNewModule, NULL, true );
|
||||
|
@ -503,7 +494,7 @@ void WinEDA_PcbFrame::Exchange_Module( MODULE* aOldModule,
|
|||
aNewModule->m_Reference->m_Text = aOldModule->m_Reference->m_Text;
|
||||
aNewModule->m_Value->m_Text = aOldModule->m_Value->m_Text;
|
||||
|
||||
/* Mise a jour des autres parametres */
|
||||
/* Updating other parameters */
|
||||
aNewModule->m_TimeStamp = aOldModule->m_TimeStamp;
|
||||
aNewModule->m_Path = aOldModule->m_Path;
|
||||
|
||||
|
@ -533,7 +524,7 @@ void WinEDA_PcbFrame::Exchange_Module( MODULE* aOldModule,
|
|||
aUndoPickList->PushItem( picker_old );
|
||||
aUndoPickList->PushItem( picker_new );
|
||||
}
|
||||
else /* Effacement de l'ancien module */
|
||||
else
|
||||
aOldModule->DeleteStructure();
|
||||
|
||||
GetBoard()->m_Status_Pcb = 0;
|
||||
|
@ -543,7 +534,7 @@ void WinEDA_PcbFrame::Exchange_Module( MODULE* aOldModule,
|
|||
|
||||
|
||||
/*
|
||||
* affiche la liste des modules en librairie et selectione 1 nom
|
||||
* Displays the list of modules in library name and select 1 name.
|
||||
*/
|
||||
void DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint( wxCommandEvent& event )
|
||||
{
|
||||
|
@ -580,7 +571,7 @@ void WinEDA_PcbFrame::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
|
|||
return;
|
||||
}
|
||||
|
||||
/* Calcul nom fichier CMP par changement de l'extension du nom netliste */
|
||||
/* Calculation file name by changing the extension name to NetList */
|
||||
fn = GetScreen()->m_FileName;
|
||||
fn.SetExt( NetCmpExtBuffer );
|
||||
wildcard = _( "Component files (." ) + NetCmpExtBuffer + wxT( ")|*." ) +
|
||||
|
|
Loading…
Reference in New Issue