Comment translation and capitalization fixes.

* Complete comment translation of PCBNew source.
* Some tooltip capitalization fixes in PCBNew toolbars.
This commit is contained in:
stambaughw 2009-11-20 14:55:20 +00:00
parent de62fa09dd
commit de44203368
25 changed files with 2299 additions and 1964 deletions

View File

@ -14,12 +14,12 @@
#define OPTKEY_PRINT_SCALE wxT( "PrintScale" )
#define OPTKEY_PRINT_MODULE_SCALE wxT( "PrintModuleScale" )
#define OPTKEY_PRINT_PAGE_FRAME wxT( "PrintPageFrame" )
#define OPTKEY_PRINT_MONOCHROME_MODE wxT( "PrintMonochrome" )
#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 );

View File

@ -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;
}
}
@ -76,14 +87,15 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
|| g_pcb_plot_options.Plot_Pads_All_Layers )
{
for( MODULE* Module = m_Pcb->m_Modules;
Module;
Module = Module->Next() )
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,14 +158,14 @@ 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." ),
textLayer, GetChars( Module->GetReference() ) );
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;
}
if( ( (1 << textLayer) & masque_layer ) == 0 )
if( ( ( 1 << textLayer ) & masque_layer ) == 0 )
trace_ref = FALSE;
if( text->m_NoShow && !g_pcb_plot_options.Sel_Texte_Invisible )
@ -163,9 +178,9 @@ 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." ),
textLayer, GetChars( Module->GetReference() ) );
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;
}
@ -184,15 +199,16 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
PlotTextModule( plotter, Module->m_Value, trace_mode );
for( pt_texte = (TEXTE_MODULE*) Module->m_Drawings.GetFirst();
pt_texte != NULL;
pt_texte = pt_texte->Next() )
pt_texte != NULL;
pt_texte = pt_texte->Next() )
{
if( pt_texte->Type() != TYPE_TEXTE_MODULE )
continue;
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,23 +216,22 @@ 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." ),
textLayer, GetChars( Module->GetReference() ),
GetChars( pt_texte->m_Text ) );
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 );
return;
}
if( !( (1 << textLayer) & masque_layer ) )
if( !( ( 1 << textLayer ) & masque_layer ) )
continue;
PlotTextModule( plotter, pt_texte, trace_mode );
}
}
/* 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;
@ -256,7 +270,7 @@ static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
thickness = -1;
if( pt_texte->m_Mirror )
NEGATE( size.x ); // Text is mirrored
NEGATE( size.x ); // Text is mirrored
plotter->text( pos, BLACK,
pt_texte->m_Text,
@ -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;
@ -328,11 +352,11 @@ void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer,
DrawTmp = new DRAWSEGMENT( NULL );
DrawTmp->m_Width = (trace_mode==FILAIRE) ? -1 : Mire->m_Width;
DrawTmp->m_Width = ( trace_mode == FILAIRE ) ? -1 : Mire->m_Width;
DrawTmp->SetLayer( Mire->GetLayer() );
DrawTmp->m_Start.x = Mire->m_Pos.x; DrawTmp->m_Start.y = Mire->m_Pos.y;
DrawTmp->m_End.x = DrawTmp->m_Start.x + (Mire->m_Size / 4);
DrawTmp->m_End.x = DrawTmp->m_Start.x + ( Mire->m_Size / 4 );
DrawTmp->m_End.y = DrawTmp->m_Start.y;
DrawTmp->m_Shape = S_CIRCLE;
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
@ -340,43 +364,48 @@ 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 */
{
dx1 = dy1 = (radius * 7) / 5;
dx1 = dy1 = ( radius * 7 ) / 5;
dx2 = dx1;
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() )
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
{
for( EDGE_MODULE* edge = (EDGE_MODULE*) module->m_Drawings.GetFirst();
edge;
edge = edge->Next() )
edge;
edge = edge->Next() )
{
if( edge->Type() != TYPE_EDGE_MODULE )
continue;
if( (g_TabOneLayerMask[edge->GetLayer()] & masque_layer) == 0 )
if( ( g_TabOneLayerMask[edge->GetLayer()] & masque_layer ) == 0 )
continue;
Plot_1_EdgeModule( plotter, edge, trace_mode );
@ -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;
@ -476,13 +510,13 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
if( pt_texte->m_Text.IsEmpty() )
return;
if( (g_TabOneLayerMask[pt_texte->GetLayer()] & masque_layer) == 0 )
if( ( g_TabOneLayerMask[pt_texte->GetLayer()] & masque_layer ) == 0 )
return;
size = pt_texte->m_Size;
pos = pt_texte->m_Pos;
size = pt_texte->m_Size;
pos = pt_texte->m_Pos;
orient = pt_texte->m_Orient;
thickness = (trace_mode==FILAIRE) ? -1 : pt_texte->m_Width;
thickness = ( trace_mode==FILAIRE ) ? -1 : pt_texte->m_Width;
if( pt_texte->m_Mirror )
size.x = -size.x;
@ -495,7 +529,7 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
offset.y = pt_texte->GetInterline();
RotatePoint( &offset, orient );
for( unsigned i = 0; i<list->Count(); i++ )
for( unsigned i = 0; i < list->Count(); i++ )
{
wxString txt = list->Item( i );
plotter->text( pos, BLACK,
@ -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 );
}
}
@ -603,7 +643,7 @@ void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
CornersBuffer[ii * 2 - 1] ),
wxPoint( CornersBuffer[ii * 2],
CornersBuffer[ii * 2 + 1] ),
(trace_mode == FILAIRE) ? -1 : aZone->m_ZoneMinThickness,
( trace_mode == FILAIRE ) ? -1 : aZone->m_ZoneMinThickness,
trace_mode );
}
plotter->set_current_line_width( -1 );
@ -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,15 +744,16 @@ 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,
trace_mode,
g_pcb_plot_options.DrillShapeOpt ==
PCB_Plot_Options::SMALL_DRILL_SHAPE );
PlotDrillMark( plotter,
trace_mode,
g_pcb_plot_options.DrillShapeOpt ==
PCB_Plot_Options::SMALL_DRILL_SHAPE );
}
break;
@ -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:
@ -768,7 +816,7 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask
default:
DisplayError( this,
wxT( "Plot_Standard_Layer() error : Unexpected Draw Type" ) );
wxT( "Plot_Standard_Layer() error : Unexpected Draw Type" ) );
break;
}
}
@ -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:
@ -794,7 +844,7 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask
/* Plot footprint pads */
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
{
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
{
wxPoint shape_pos;
if( (pad->m_Masque_Layer & aLayerMask) == 0 )
@ -803,24 +853,26 @@ 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:
margin.x = margin.y = pad->GetSolderMaskMargin();
break;
case SOLDERMASK_LAYER_CMP:
case SOLDERMASK_LAYER_CU:
margin.x = margin.y = pad->GetSolderMaskMargin();
break;
case SOLDERPASTE_LAYER_CMP:
case SOLDERPASTE_LAYER_CU:
margin = pad->GetSolderPasteMargin();
break;
case SOLDERPASTE_LAYER_CMP:
case SOLDERPASTE_LAYER_CU:
margin = pad->GetSolderPasteMargin();
break;
default:
default:
break;
}
size.x = pad->m_Size.x + (2 * margin.x);
size.y = pad->m_Size.y + (2 * margin.y);
size.x = pad->m_Size.x + ( 2 * margin.x );
size.y = pad->m_Size.y + ( 2 * margin.y );
/* Don't draw a null size item : */
if( size.x <= 0 || size.y <= 0 )
@ -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;
@ -869,12 +925,14 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask
via_mask_layer |= SOLDERMASK_LAYER_CU;
if( via_mask_layer & CMP_LAYER )
via_mask_layer |= SOLDERMASK_LAYER_CMP;
if( ( via_mask_layer & aLayerMask) == 0 )
if( ( via_mask_layer & aLayerMask ) == 0 )
continue;
int via_margin = 0;
// If the current layer is a solder mask, use the global mask clearance for vias
if( (aLayerMask & (SOLDERMASK_LAYER_CU|SOLDERMASK_LAYER_CMP) ) )
// 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;
size.x = size.y = Via->m_Width + 2 * via_margin;
@ -934,13 +992,16 @@ 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,
bool aSmallDrillShape )
void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter,
GRTraceMode aTraceMode,
bool aSmallDrillShape )
{
const int SMALL_DRILL = 150;
wxPoint pos;
@ -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();
@ -968,12 +1030,12 @@ void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter, GRTraceMode aTraceMo
}
for( Module = m_Pcb->m_Modules;
Module != NULL;
Module = Module->Next() )
Module != NULL;
Module = Module->Next() )
{
for( PtPad = Module->m_Pads;
PtPad != NULL;
PtPad = PtPad->Next() )
PtPad != NULL;
PtPad = PtPad->Next() )
{
if( PtPad->m_Drill.x == 0 )
continue;
@ -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
{

View File

@ -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 )
/*****************************************************************************/
GRTraceMode trace_mode )
{
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
@ -34,7 +32,7 @@ void WinEDA_BasePcbFrame::Genere_DXF( const wxString& FullFileName, int Layer,
DXF_PLOTTER* plotter = new DXF_PLOTTER();
plotter->set_paper_size( currentsheet );
plotter->set_viewport( wxPoint(0,0), 1, 0 );
plotter->set_viewport( wxPoint( 0, 0 ), 1, 0 );
plotter->set_creator( wxT( "PCBNEW-DXF" ) );
plotter->set_filename( FullFileName );
plotter->start_plot( output_file );

View File

@ -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();
@ -70,18 +69,18 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
double Xscale, Yscale;
// Fit to 80% of the page
Xscale = ( (SheetSize.x * 0.8) / BoardSize.x );
Yscale = ( (SheetSize.y * 0.8) / BoardSize.y );
Xscale = ( ( SheetSize.x * 0.8 ) / BoardSize.x );
Yscale = ( ( SheetSize.y * 0.8 ) / BoardSize.y );
scale = MIN( Xscale, Yscale );
}
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;
offset.y = BoardCenter.y - (SheetSize.y / 2) / scale;
offset.x = BoardCenter.x - ( SheetSize.x / 2 ) / scale;
offset.y = BoardCenter.y - ( SheetSize.y / 2 ) / scale;
}
else
{

View File

@ -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,11 +82,10 @@ 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;
offset.y = BoardCenter.y - (PaperSize.y / 2) / scale;
offset.x = BoardCenter.x - ( PaperSize.x / 2 ) / scale;
offset.y = BoardCenter.y - ( PaperSize.y / 2 ) / scale;
}
else
{
@ -119,9 +114,9 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
// and switch the current color to WHITE
if( g_pcb_plot_options.Plot_PS_Negative )
{
int margin = 500; // Add a 0.5 inch margin around the board
int margin = 500; // Add a 0.5 inch margin around the board
plotter->set_negative( true );
plotter->set_color( WHITE ); // Which will be plotted as black
plotter->set_color( WHITE ); // Which will be plotted as black
plotter->rect( wxPoint( m_Pcb->m_BoundaryBox.GetX() - margin,
m_Pcb->m_BoundaryBox.GetY() - margin ),
wxPoint( m_Pcb->m_BoundaryBox.GetRight() + margin,

View File

@ -12,23 +12,23 @@
#include "pcbplot.h"
#include "protos.h"
/* Local functions */
static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module,
int draw_mode, int masklayer );
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;
MODULE* Module;
int drawmode = GR_COPY;
DISPLAY_OPTIONS save_opt;
TRACK* pt_piste;
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) m_Parent;
@ -46,32 +46,31 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMa
DisplayOpt.DisplayViaFill = false;
}
frame->m_DisplayPadFill = DisplayOpt.DisplayPadFill;
frame->m_DisplayViaFill = DisplayOpt.DisplayViaFill;
frame->m_DisplayPadNum = DisplayOpt.DisplayPadNum = false;
frame->m_DisplayPadFill = DisplayOpt.DisplayPadFill;
frame->m_DisplayViaFill = DisplayOpt.DisplayViaFill;
frame->m_DisplayPadNum = DisplayOpt.DisplayPadNum = false;
DisplayOpt.DisplayPadNoConn = false;
DisplayOpt.DisplayPadIsol = false;
DisplayOpt.DisplayModEdge = FILLED;
DisplayOpt.DisplayModText = FILLED;
frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = FILLED;
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZonesMode = 0;
DisplayOpt.DisplayNetNamesMode = 0;
DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZonesMode = 0;
DisplayOpt.DisplayNetNamesMode = 0;
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
if( GetGRForceBlackPenState( ) == false )
// 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() )
for( BOARD_ITEM* item = Pcb->m_Drawings; item; item = item->Next() )
{
switch( item->Type() )
{
@ -79,13 +78,13 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMa
case TYPE_COTATION:
case TYPE_TEXTE:
case TYPE_MIRE:
if( ((1<<item->GetLayer()) & aPrintMaskLayer) == 0 )
if( ( ( 1 << item->GetLayer() ) & aPrintMaskLayer ) == 0 )
break;
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 );
@ -121,38 +126,46 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMa
/* Draw filled areas (i.e. zones) */
for( int ii = 0; ii < Pcb->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* zone = Pcb->GetArea(ii);
if( ( aPrintMaskLayer & (1 << zone->GetLayer()) ) == 0 )
ZONE_CONTAINER* zone = Pcb->GetArea( ii );
if( ( aPrintMaskLayer & ( 1 << zone->GetLayer() ) ) == 0 )
continue;
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( );
int color = g_DrawBgColor;
bool blackpenstate = GetGRForceBlackPenState();
GRForceBlackPen( false );
GRSetDrawMode( aDC, GR_COPY );
for( ; pt_piste != NULL; pt_piste = pt_piste->Next() )
{
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 )
/***********************************************************/
MODULE* Module, int draw_mode, int masklayer )
{
D_PAD* pt_pad;
EDA_BaseStruct* PtStruct;
@ -184,16 +195,20 @@ 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 )
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;
( (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
else // on copper layer, draw pads according to current options
pt_pad->Draw( panel, DC, draw_mode );
}
@ -207,9 +222,9 @@ static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC,
if( mlayer & masklayer )
{
if( ! Module->m_Reference->m_NoShow )
if( !Module->m_Reference->m_NoShow )
Module->m_Reference->Draw( panel, DC, draw_mode );
if( ! Module->m_Value->m_NoShow )
if( !Module->m_Value->m_NoShow )
Module->m_Value->Draw( panel, DC, draw_mode );
}
@ -228,7 +243,7 @@ static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC,
case TYPE_EDGE_MODULE:
{
EDGE_MODULE* edge = (EDGE_MODULE*) PtStruct;
if( (g_TabOneLayerMask[edge->GetLayer()] & masklayer ) == 0 )
if( ( g_TabOneLayerMask[edge->GetLayer()] & masklayer ) == 0 )
break;
edge->Draw( panel, DC, draw_mode );
break;

View File

@ -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,60 +44,61 @@ 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
*/
/**************/
/* PCBCFG.CPP */
/**************/
bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose );
bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose );
/***************/
/* TRPISTE.CPP */
/***************/
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
/* 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 );
/****************/
/* 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 */
TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer = -1 );
/* Find a pad by it's name om the module. */
TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer = -1 );
/**
* Function Locate_Via_Area
@ -106,254 +108,264 @@ 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 );
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_Via( TRACK* start_adr, TRACK* end_adr,
const wxPoint& pos, int masquelayer );
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)
/* 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 );
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.
/* 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_Pistes( TRACK* start_adresse, int layer, int typeloc );
TRACK* Locate_Pistes( TRACK* start_adresse,
const wxPoint& ref_pos, int layer );
TRACK* Locate_Piste_Connectee( TRACK* ptr_piste, TRACK* pt_base,
TRACK* pt_lim, int extr );
/*
* 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.
* 1 - Locate segment of track leading from the mouse.
* 2 - Locate segment of track point by point.
* Ref_pX, ref_pY.
*
* Si layer < 0 la couche n'est pas testee.
* If layer <0 the layer is not tested.
*
* La recherche commence a l'adresse start_adresse
* 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 );
D_PAD* Locate_Pad_Connecte( BOARD* Pcb, TRACK* ptr_segment, int extr );
/* 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 );
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 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 );
MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc );
/* Locate a footprint by its bounding rectangle. */
MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc );
/* localisation d'une empreinte par son rectangle d'encadrement */
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 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 );
TRACK* Locate_Pistes( TRACK* start_adresse, int typeloc );
/* 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 );
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 );
/*************/
/* MODULES.C */
/*************/
int ChangeSideNumLayer( int oldlayer );
void DrawModuleOutlines( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module );
void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
int ChangeSideNumLayer( int oldlayer );
void DrawModuleOutlines( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module );
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 : */
/****************/
TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack );
TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack );
void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel,
wxDC* DC, bool erase );
void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel,
wxDC* DC, bool erase );
void Calcule_Coord_Extremite_45( int ox, int oy, int* fx, int* fy );
/* 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 );
int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
TRACK** StartTrack, TRACK** EndTrack );
/* 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 */
void ListSetState( EDA_BaseStruct* Start, int Nbitem, int State, int onoff );
/* Met a jour le membre .state d'une chaine de structures */
/* Update the state of a list of structures. */
void ListSetState( EDA_BaseStruct* Start, int Nbitem, int State, int onoff );
/**************/
/* 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 );
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:
* - NULL
* Parametres d'appel:
* coord aPos du point tst
* aLayerMask masque des couches a tester
/* 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
* 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,23 +377,24 @@ 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 */
/*****************/
void DisplayColorSetupFrame( WinEDA_PcbFrame* parent,
const wxPoint& framepos );
const wxPoint& framepos );
/***************************/

View File

@ -1,6 +1,6 @@
/*******************************************/
/* EDITEUR de PCB: routines d'AUTOROUTAGE: */
/*******************************************/
/*************/
/* queue.cpp */
/*************/
#include "fctsys.h"
#include "gr_basic.h"
@ -15,167 +15,168 @@
struct PcbQueue /* search queue structure */
{
struct PcbQueue *Next;
int Row; /* current row */
int Col; /* current column */
int Side; /* 0=top, 1=bottom */
int Dist; /* path distance to this cell so far */
int ApxDist; /* approximate distance to target from here */
struct PcbQueue* Next;
int Row; /* current row */
int Col; /* current column */
int Side; /* 0=top, 1=bottom */
int Dist; /* path distance to this cell so far */
int ApxDist; /* approximate distance to target from here */
};
static long qlen = 0; /* current queue length */
static struct PcbQueue *Head = NULL;
static struct PcbQueue *Tail = NULL;
static struct PcbQueue *Save = NULL; /* hold empty queue structs */
static long qlen = 0; /* current queue length */
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 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;
struct PcbQueue* p;
InitQueue();
while( (p = Save) != NULL )
{
Save = p->Next; MyFree(p);
}
InitQueue();
while( (p = Save) != NULL )
{
Save = p->Next; MyFree( p );
}
}
/************************/
/* void InitQueue() */
/************************/
/* initialize the search queue */
void InitQueue()
{
struct PcbQueue *p;
struct PcbQueue* p;
while( (p = Head) != NULL )
{
Head = p->Next;
p->Next = Save; Save = p;
}
Tail = NULL;
OpenNodes = ClosNodes = MoveNodes = MaxNodes = qlen = 0;
while( (p = Head) != NULL )
{
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)
void GetQueue( int* r, int* c, int* s, int* d, int* a )
{
struct PcbQueue *p;
struct PcbQueue* p;
if( (p = Head) != NULL ) /* return first item in list */
{
*r = p->Row; *c = p->Col;
*s = p->Side;
*d = p->Dist; *a = p->ApxDist;
if ((Head = p->Next) == NULL) Tail = NULL;
if( (p = Head) != NULL ) /* return first item in list */
{
*r = p->Row; *c = p->Col;
*s = p->Side;
*d = p->Dist; *a = p->ApxDist;
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;
}
/* put node on free list */
p->Next = Save; Save = p;
ClosNodes++; qlen--;
}
else /* empty list */
{
*r = *c = *s = *d = *a = ILLEGAL;
}
}
/****************************************************************/
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;
struct PcbQueue* p, * q, * t;
int i, j;
j = 0; // gcc warning fix
if( (p = Save) != NULL ) /* try free list first */
{
Save = p->Next;
}
else if ((p = (struct PcbQueue *) MyMalloc(sizeof(PcbQueue))) == NULL)
return(0);
j = 0; // gcc warning fix
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 */
p->Next = q; Head = p;
}
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;
q->Next = p;
}
else
{ /* insert in front of q */
if ((p->Next = q) == NULL) Tail = p;
t->Next = p;
}
}
}
else /* empty search list */
Head = Tail = p;
OpenNodes++;
if (++qlen > MaxNodes) MaxNodes = qlen;
return(1);
if( (p = Save) != NULL ) /* try free list first */
{
Save = p->Next;
}
else if( ( p = (struct PcbQueue*) MyMalloc( sizeof(PcbQueue) ) ) == NULL )
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 */
{
p->Next = q; Head = p;
}
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;
q->Next = p;
}
else /* insert in front of q */
{
if( ( p->Next = q ) == NULL )
Tail = p;
t->Next = p;
}
}
}
else /* empty search list */
Head = Tail = p;
OpenNodes++;
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;
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) {
/* old one to remove */
if (q)
{
if ( (q->Next = p->Next) == NULL) Tail = q;
}
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 */
SetQueue( r, c, s, d, a, r2, c2 );
/* 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 )
{
/* old one to remove */
if( q )
{
if( ( q->Next = p->Next ) == NULL )
Tail = q;
}
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 */
SetQueue( r, c, s, d, a, r2, c2 );
}

File diff suppressed because it is too large Load Diff

View File

@ -18,32 +18,28 @@ 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 );
~WinEDA_SelLayerFrame() { };
private:
void Sel_Layer( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void Sel_Layer( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
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,42 +82,43 @@ 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;
if( (max_layer >= 0) && (max_layer < ii) )
if( ( max_layer >= 0 ) && ( max_layer < ii ) )
break;
LayerList[LayerCount] = board->GetLayerName( ii );
@ -129,6 +129,7 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent,
LayerCount++;
}
}
// When appropriate, also provide a "(Deselect)" radiobutton
if( null_layer )
{
@ -140,35 +141,35 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent,
LayerCount++;
}
m_LayerList = new wxRadioBox( this, ID_LAYER_SELECT, _("Layer"),
wxPoint( -1, -1 ), wxSize( -1, -1 ), LayerCount, LayerList,
(LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS );
m_LayerList = new wxRadioBox( this, ID_LAYER_SELECT, _( "Layer" ),
wxPoint( -1, -1 ), wxSize( -1, -1 ),
LayerCount, LayerList,
(LayerCount < 8) ? LayerCount : 8,
wxRA_SPECIFY_ROWS );
if( LayerSelect >= 0 )
m_LayerList->SetSelection( LayerSelect );
wxBoxSizer* FrameBoxSizer = new wxBoxSizer(wxHORIZONTAL);
SetSizer(FrameBoxSizer);
FrameBoxSizer->Add(m_LayerList, 0, wxALIGN_TOP|wxALL, 5);
wxBoxSizer* ButtonBoxSizer = new wxBoxSizer(wxVERTICAL);
FrameBoxSizer->Add(ButtonBoxSizer, 0, wxALIGN_BOTTOM|wxALL, 0);
wxBoxSizer* FrameBoxSizer = new wxBoxSizer( wxHORIZONTAL );
SetSizer( FrameBoxSizer );
FrameBoxSizer->Add( m_LayerList, 0, wxALIGN_TOP | wxALL, 5 );
wxBoxSizer* ButtonBoxSizer = new wxBoxSizer( wxVERTICAL );
FrameBoxSizer->Add( ButtonBoxSizer, 0, wxALIGN_BOTTOM | wxALL, 0 );
Button = new wxButton( this, wxID_OK, _("OK") );
ButtonBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
Button = new wxButton( this, wxID_OK, _( "OK" ) );
ButtonBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button = new wxButton( this, wxID_CANCEL, _("Cancel") );
ButtonBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
ButtonBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
if( GetSizer() )
{
GetSizer()->SetSizeHints(this);
GetSizer()->SetSizeHints( this );
}
}
/***************************************************************/
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,43 +195,36 @@ 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:
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
};
/* 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
// within PCB files which contain at least two copper layers.
if( GetBoard()->m_BoardSettings->GetCopperLayerCount( ) < 2 )
if( GetBoard()->m_BoardSettings->GetCopperLayerCount() < 2 )
{
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 ),
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,63 +278,68 @@ 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);
SetSizer(FrameBoxSizer);
wxBoxSizer* FrameBoxSizer = new wxBoxSizer( wxVERTICAL );
SetSizer( FrameBoxSizer );
wxBoxSizer* RadioBoxSizer = new wxBoxSizer(wxHORIZONTAL);
FrameBoxSizer->Add(RadioBoxSizer, 0, wxALIGN_LEFT|wxALL, 0);
wxBoxSizer* RadioBoxSizer = new wxBoxSizer( wxHORIZONTAL );
FrameBoxSizer->Add( RadioBoxSizer, 0, wxALIGN_LEFT | wxALL, 0 );
wxBoxSizer* ButtonBoxSizer = new wxBoxSizer(wxHORIZONTAL);
FrameBoxSizer->Add(ButtonBoxSizer, 0, wxALIGN_RIGHT|wxALL, 0);
wxBoxSizer* ButtonBoxSizer = new wxBoxSizer( wxHORIZONTAL );
FrameBoxSizer->Add( ButtonBoxSizer, 0, wxALIGN_RIGHT | wxALL, 0 );
RadioBoxSizer->Add(m_LayerListTOP, 0, wxALIGN_TOP|wxALL, 5);
RadioBoxSizer->Add(m_LayerListBOTTOM, 0, wxALIGN_TOP|wxALL, 5);
RadioBoxSizer->Add( m_LayerListTOP, 0, wxALIGN_TOP | wxALL, 5 );
RadioBoxSizer->Add( m_LayerListBOTTOM, 0, wxALIGN_TOP | wxALL, 5 );
Button = new wxButton( this, wxID_OK, _("OK") );
ButtonBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
Button = new wxButton( this, wxID_OK, _( "OK" ) );
ButtonBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button = new wxButton( this, wxID_CANCEL, _("Cancel") );
ButtonBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
ButtonBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
if( GetSizer() )
{
GetSizer()->SetSizeHints(this);
GetSizer()->SetSizeHints( this );
}
}
/***************************************************************/
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." ) );
== m_LayerId[m_LayerListBOTTOM->GetSelection()] )
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 );
}

View File

@ -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,18 +16,17 @@
#include "set_grid.h"
/************************************************************/
void WinEDA_BasePcbFrame::InstallGridFrame(const wxPoint & pos)
void WinEDA_BasePcbFrame::InstallGridFrame( const wxPoint& pos )
{
WinEDA_PcbGridFrame dlg( this, pos );
WinEDA_PcbGridFrame dlg( this, pos );
dlg.SetGridSize( m_UserGridSize );
dlg.SetGridUnits( m_UserGridUnits );
if( dlg.ShowModal() == wxID_CANCEL )
if( dlg.ShowModal() == wxID_CANCEL )
return;
m_UserGridSize = dlg.GetGridSize();
m_UserGridSize = dlg.GetGridSize();
m_UserGridUnits = dlg.GetGridUnits();
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnits, ID_POPUP_GRID_USER );
@ -55,49 +50,58 @@ BEGIN_EVENT_TABLE( WinEDA_PcbGridFrame, wxDialog )
////@end WinEDA_PcbGridFrame event table entries
END_EVENT_TABLE()
/*!
* WinEDA_PcbGridFrame constructors
*/
WinEDA_PcbGridFrame::WinEDA_PcbGridFrame( )
WinEDA_PcbGridFrame::WinEDA_PcbGridFrame()
{
}
WinEDA_PcbGridFrame::WinEDA_PcbGridFrame( WinEDA_BasePcbFrame* parent,
const wxPoint& pos,
wxWindowID id,
const wxString& caption,
const wxSize& size, long style )
{
Create(parent, id, caption, pos, size, style);
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_UnitGrid = NULL;
m_OptGridSizeX = NULL;
m_OptGridSizeY = NULL;
////@end WinEDA_PcbGridFrame member initialisation
////@begin WinEDA_PcbGridFrame creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
SetExtraStyle( wxWS_EX_BLOCK_EVENTS );
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
if (GetSizer())
if( GetSizer() )
{
GetSizer()->SetSizeHints(this);
GetSizer()->SetSizeHints( this );
}
////@end WinEDA_PcbGridFrame creation
return true;
}
/*!
* Control creation for WinEDA_PcbGridFrame
*/
@ -109,46 +113,79 @@ void WinEDA_PcbGridFrame::CreateControls()
WinEDA_PcbGridFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
itemDialog1->SetSizer(itemBoxSizer2);
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxALL, 5);
itemDialog1->SetSizer( itemBoxSizer2 );
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer2->Add( itemBoxSizer3, 0, wxGROW | wxALL, 5 );
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->SetSelection(0);
itemBoxSizer3->Add(m_UnitGrid, 0, wxGROW|wxALL, 5);
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->SetSelection( 0 );
itemBoxSizer3->Add( m_UnitGrid, 0, wxGROW | wxALL, 5 );
itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|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);
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);
itemBoxSizer10->Add( itemButton11, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
wxButton* itemButton12 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer10->Add(itemButton12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
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
*/
@ -166,11 +204,13 @@ wxBitmap WinEDA_PcbGridFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin WinEDA_PcbGridFrame bitmap retrieval
wxUnusedVar(name);
wxUnusedVar( name );
return wxNullBitmap;
////@end WinEDA_PcbGridFrame bitmap retrieval
}
/*!
* Get icon resources
*/
@ -179,8 +219,9 @@ wxIcon WinEDA_PcbGridFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin WinEDA_PcbGridFrame icon retrieval
wxUnusedVar(name);
wxUnusedVar( name );
return wxNullIcon;
////@end WinEDA_PcbGridFrame icon retrieval
}
@ -189,31 +230,34 @@ void WinEDA_PcbGridFrame::SetGridSize( const wxRealPoint& grid )
{
wxString msg;
msg.Printf( wxT( "%.4f" ), grid.x );
m_OptGridSizeX->SetValue( msg );
msg.Printf( wxT( "%.4f" ), grid.y );
m_OptGridSizeY->SetValue( msg );
msg.Printf( wxT( "%.4f" ), grid.x );
m_OptGridSizeX->SetValue( msg );
msg.Printf( wxT( "%.4f" ), grid.y );
m_OptGridSizeY->SetValue( msg );
}
wxRealPoint WinEDA_PcbGridFrame::GetGridSize()
{
wxRealPoint grid;
/* TODO: Some error checking here would be a good thing. */
m_OptGridSizeX->GetValue().ToDouble( &grid.x );
m_OptGridSizeY->GetValue().ToDouble( &grid.y );
m_OptGridSizeX->GetValue().ToDouble( &grid.x );
m_OptGridSizeY->GetValue().ToDouble( &grid.y );
return grid;
}
void WinEDA_PcbGridFrame::SetGridUnits( int units )
{
if ( units != INCHES )
m_UnitGrid->SetSelection( 1 );
if( units != INCHES )
m_UnitGrid->SetSelection( 1 );
}
int WinEDA_PcbGridFrame::GetGridUnits()
{
return m_UnitGrid->GetSelection();
return m_UnitGrid->GetSelection();
}

File diff suppressed because it is too large Load Diff

View File

@ -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;
@ -45,7 +43,7 @@ void WinEDA_PcbFrame::ListNetsAndSelect( wxCommandEvent& event )
continue;
Line.Printf( wxT( "net_code = %3.3d [%.16s] " ), net->GetNet(),
GetChars( net->GetNetname() ) );
GetChars( net->GetNetname() ) );
List.Append( Line );
}
@ -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;

View File

@ -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() )
{

View File

@ -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++ )
{

View File

@ -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();

View File

@ -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,60 +328,66 @@ 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 ));
g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ));
#ifdef MUWAVE_ENBL
@ -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

View File

@ -1,6 +1,6 @@
/****************************************************************
* toolbars_update_user_interface.cpp
****************************************************************/
* toolbars_update_user_interface.cpp
****************************************************************/
/*
* function to update toolbars UI after changing parameters
@ -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;
@ -186,11 +187,9 @@ void WinEDA_PcbFrame::SetToolbars()
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_DRC_OFF,
!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 !!!)" ) );
Drc_On ?
_( "Disable design rule checking" ) :
_( "Enable design rule checking" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UnitMetric == MILLIMETRE ? TRUE : false );
@ -200,14 +199,16 @@ void WinEDA_PcbFrame::SetToolbars()
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood ?
_( "Polar coords not show" ) :
_( "Display polar coords" ) );
DisplayOpt.DisplayPolarCood ?
_( "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 );
@ -215,62 +216,62 @@ void WinEDA_PcbFrame::SetToolbars()
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_RATSNEST,
g_Show_Ratsnest );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_RATSNEST,
g_Show_Ratsnest ?
_( "Hide general ratsnest" ) :
_( "Show general ratsnest" ) );
g_Show_Ratsnest ?
_( "Hide board ratsnest" ) :
_( "Show board ratsnest" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
g_Show_Module_Ratsnest );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
g_Show_Module_Ratsnest ?
_( "Hide module ratsnest" ) :
_( "Show module ratsnest" ) );
g_Show_Module_Ratsnest ?
_( "Hide module ratsnest" ) :
_( "Show module ratsnest" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_AUTO_DEL_TRACK,
g_AutoDeleteOldTrack );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_AUTO_DEL_TRACK,
g_AutoDeleteOldTrack ?
_( "Disable auto delete old track" ) :
_( "Enable auto delete old track" ) );
g_AutoDeleteOldTrack ?
_( "Disable auto delete old track" ) :
_( "Enable auto delete old track" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
!m_DisplayPadFill );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
m_DisplayPadFill ?
_( "Show pads sketch mode" ) :
_( "Show pads filled mode" ) );
m_DisplayPadFill ?
_( "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" ) );
m_DisplayViaFill ?
_( "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" ) );
m_DisplayPcbTrackFill ?
_( "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" ) );
DisplayOpt.ContrastModeDisplay ?
_( "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 ) );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ) ?
_( "Hide invisible text" ) :
_( "Show invisible text" ) );
g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ) ?
_( "Hide invisible text" ) :
_( "Show invisible text" ) );
#if !defined(KICAD_AUIMANAGER)
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,

View File

@ -1,7 +1,6 @@
/**************************************************/
/* Edition des pistes */
/* Routines de modification automatique de pistes */
/**************************************************/
/******************/
/* Trace editing. */
/******************/
#include "fctsys.h"
@ -13,109 +12,113 @@
/** 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( aNewTrack->Type() == TYPE_VIA && (aNewTrackSegmentsCount > 1 ) )
/* 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 );)
wxASSERT( EndNewTrack->GetState( -1 ) != 0 );
D( printf( "track %p is newly part of net %d\n", EndNewTrack,
netcode ); )
EndNewTrack = EndNewTrack->Next();
}
wxASSERT( EndNewTrack->GetState(-1) != 0 );
D(printf("track %p is newly part of net %d\n", EndNewTrack, netcode );)
wxASSERT( EndNewTrack->GetState( -1 ) != 0 );
D( printf( "track %p is newly part of net %d\n", EndNewTrack, netcode ); )
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 );)
D( printf( "track %p turning off BUSY | EDIT | CHAIN\n", pt_del ); )
pt_del->SetState( BUSY | EDIT | CHAIN, OFF );
if( pt_del == BufEnd ) // Last segment reached
break;
}
/* Calcul des points limites de la nouvelle piste */
if( ReturnEndsTrack( aNewTrack, aNewTrackSegmentsCount,
&StartTrack, &EndTrack ) == 0 )
return 0;
if( (StartTrack == NULL) || (EndTrack == NULL) )
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) )
if( StartTrack->start && ( StartTrack->start->Type() == TYPE_PAD ) )
{
/* start sur pad */
D_PAD* pt_pad = (D_PAD*) (StartTrack->start);
/* Start on pad. */
D_PAD* pt_pad = (D_PAD*)(StartTrack->start);
startmasklayer |= pt_pad->m_Masque_Layer;
}
@ -123,33 +126,33 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
if( pt_segm )
endmasklayer |= pt_segm->ReturnMaskLayer();
if( EndTrack->end && ( EndTrack->end->Type() == TYPE_PAD) )
if( EndTrack->end && ( EndTrack->end->Type() == TYPE_PAD ) )
{
D_PAD* pt_pad = (D_PAD*) (EndTrack->end);
D_PAD* pt_pad = (D_PAD*)(EndTrack->end);
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 )
{
@ -232,13 +235,14 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
pt_del->m_Flags = 0;
ITEM_PICKER picker( pt_del, UR_DELETED );
aItemsListPicker->PushItem( picker );
}
}
else
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 );
}

View File

@ -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 )

View File

@ -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
}
}
}

View File

@ -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
int NbSegm;
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,21 +415,21 @@ 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() )
for( ; ( Track != NULL ) && ( ii < NbSegm ); ii++, Track = Track->Next() )
{
TrackListEnd = Track;
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() )
for( ; ( Track != NULL ) && ( ii < NbSegm ); ii++, Track = Track->Next() )
{
if( Track->Type() == TYPE_VIA )
continue;
@ -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,17 +531,14 @@ 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;
for( ; (Start != NULL) && (NbItem > 0); NbItem--, Start = Start->Next() )
for( ; (Start != NULL ) && ( NbItem > 0 ); NbItem--, Start = Start->Next() )
{
Start->SetState( State, onoff );
}

View File

@ -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 );
}
}

View File

@ -1,8 +1,6 @@
/********************************************/
/* AUTOROUTAGE PCB : routines d'autoroutage */
/********************************************/
/* fichier WORK.CC */
/************************/
/* Autorouting routines */
/************************/
#include "fctsys.h"
#include "gr_basic.h"
@ -13,195 +11,203 @@
#include "cell.h"
#include "protos.h"
/**/
struct CWORK /* a unit of work is a hole-pair to connect */
{
struct CWORK *Next;
int FromRow; /* source row */
int FromCol; /* source column */
int net_code; /* net_code */
int ToRow; /* target row */
int ToCol; /* target column */
RATSNEST_ITEM *pt_rats; /* chevelu correspondant*/
int ApxDist; /* approximate distance */
int Cost; /* cost for sort by length */
int Priority; /* routage priority */
};
{
struct CWORK* Next;
int FromRow; /* source row */
int FromCol; /* source column */
int net_code; /* net_code */
int ToRow; /* target row */
int ToCol; /* target column */
RATSNEST_ITEM* pt_rats; /* Corresponding ratsnest */
int ApxDist; /* approximate distance */
int Cost; /* cost for sort by length */
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;
static CWORK* Head = NULL;
static CWORK* Tail = NULL;
static CWORK* Current = NULL;
/* Routines definies ici : */
void InitWork();
void ReInitWork();
int SetWork( int, int, int, int, int, RATSNEST_ITEM *, int );
void GetWork( int *, int *, int *, int *, int *, RATSNEST_ITEM ** );
int SetWork( int, int, int, int, int, RATSNEST_ITEM*, int );
void GetWork( int*, int*, int*, int*, int*, RATSNEST_ITEM** );
void SortWork();
/************************/
/* void InitWork () */
/************************/
/* initialize the work list */
/* initialize the work list */
void InitWork()
{
CWORK *ptr;
CWORK* ptr;
while( (ptr = Head) != NULL )
{
Head = ptr->Next; MyFree( ptr );
}
Tail = Current = NULL;
while( ( ptr = Head ) != NULL )
{
Head = ptr->Next;
MyFree( ptr );
}
Tail = Current = NULL;
}
/*************************/
/* void ReInitWork() */
/*************************/
/* initialize the work list */
/* initialize the work list */
void ReInitWork()
{
Current = Head;
}
{
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
*/
static int GetCost(int r1,int c1,int r2,int c2);
* 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;
CWORK* p;
if( (p = (CWORK *)MyMalloc( sizeof(CWORK) )) != NULL )
{
p->FromRow = r1;
p->FromCol = c1;
p->net_code = n_c;
p->ToRow = r2;
p->ToCol = c2;
p->pt_rats = pt_ch;
p->ApxDist = GetApxDist( r1, c1, r2, c2 );
p->Cost = GetCost( r1, c1, r2, c2 );
p->Priority = pri;
p->Next = NULL;
if (Head) /* attach at end */
Tail->Next = p;
else /* first in list */
Head = Current = p;
Tail = p;
return(1);
}
else /* can't get any more memory */
return(0);
if( ( p = (CWORK*) MyMalloc( sizeof(CWORK) ) ) != NULL )
{
p->FromRow = r1;
p->FromCol = c1;
p->net_code = n_c;
p->ToRow = r2;
p->ToCol = c2;
p->pt_rats = pt_ch;
p->ApxDist = GetApxDist( r1, c1, r2, c2 );
p->Cost = GetCost( r1, c1, r2, c2 );
p->Priority = pri;
p->Next = NULL;
if( Head ) /* attach at end */
Tail->Next = p;
else /* first in list */
Head = Current = p;
Tail = p;
return 1;
}
else /* can't get any more memory */
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 */
/* 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)
{
*r1 = Current->FromRow;
*c1 = Current->FromCol;
*n_c = Current->net_code;
*r2 = Current->ToRow;
*c2 = Current->ToCol;
*pt_ch = Current->pt_rats;
Current = Current->Next;
}
else { /* none left */
*r1 = *c1 = *r2 = *c2 = ILLEGAL;
*n_c = 0;
*pt_ch = NULL;
}
if( Current )
{
*r1 = Current->FromRow;
*c1 = Current->FromCol;
*n_c = Current->net_code;
*r2 = Current->ToRow;
*c2 = Current->ToCol;
*pt_ch = Current->pt_rats;
Current = Current->Next;
}
else /* none left */
{
*r1 = *c1 = *r2 = *c2 = ILLEGAL;
*n_c = 0;
*pt_ch = NULL;
}
}
/***********************/
/* void SortWork() */
/***********************/
/* order the work items; shortest (low cost) first */
void SortWork()
{
CWORK *p;
CWORK *q0; /* put PRIORITY PAD_CONNECTs in q0 */
CWORK *q1; /* sort other PAD_CONNECTs in q1 */
CWORK *r;
CWORK* p;
CWORK* q0; /* put PRIORITY PAD_CONNECTs in q0 */
CWORK* q1; /* sort other PAD_CONNECTs in q1 */
CWORK* r;
q0 = q1 = NULL;
while( (p = Head) != NULL )
{ /* prioritize each work item */
Head = Head->Next;
if (p->Priority)
{ /* put at end of priority list */
p->Next = NULL;
if ((r = q0) == NULL) /* empty list? */
q0 = p;
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;
}
else { /* find proper position in list */
while (r->Next && p->Cost >= r->Next->Cost) r = r->Next;
p->Next = r->Next; r->Next = p;
}
}
q0 = q1 = NULL;
while( (p = Head) != NULL ) /* prioritize each work item */
{
Head = Head->Next;
if( p->Priority ) /* put at end of priority list */
{
p->Next = NULL;
if( (r = q0) == NULL ) /* empty list? */
q0 = p;
else /* attach at end */
{
while( r->Next ) /* search for end */
r = r->Next;
if( (p = q0) != NULL)
{ /* any priority PAD_CONNECTs? */
while (q0->Next) q0 = q0->Next;
q0->Next = q1;
}
else p = q1;
r->Next = p; /* attach */
}
}
else if( ( ( r = q1 ) == NULL ) || ( p->Cost < q1->Cost ) )
{
p->Next = q1;
q1 = p;
}
else /* find proper position in list */
{
while( r->Next && p->Cost >= r->Next->Cost )
r = r->Next;
/* reposition Head and Tail */
for(Head = Current = Tail = p; Tail && Tail->Next; Tail = Tail->Next) ;
p->Next = r->Next;
r->Next = p;
}
}
if( (p = q0) != NULL ) /* any priority PAD_CONNECTs? */
{
while( q0->Next )
q0 = q0->Next;
q0->Next = q1;
}
else
p = q1;
/* reposition Head and Tail */
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|
*/
static int GetCost(int r1,int c1,int r2,int c2)
/* 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 )
{
int dx, dy, mx, my;
float incl;
int dx, dy, mx, my;
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);
dx = abs( c2 - c1 );
dy = abs( r2 - r1 );
incl = 1.0;
mx = dx;
my = dy;
return (int)((dx+dy) * incl) ;
if( mx < my )
{
mx = dy; my = dx;
}
if( mx )
incl += (2 * (float) my / mx);
return (int) ( ( dx + dy ) * incl );
}

View File

@ -1,8 +1,6 @@
/******************************/
/* PCBNEW: echange de modules */
/******************************/
/* Fichier xchmod.cpp */
/*******************************/
/* Pcbnew: exchange of modules */
/*******************************/
#include "fctsys.h"
#include "common.h"
@ -14,46 +12,42 @@
#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
{
private:
WinEDA_PcbFrame* m_Parent;
MODULE* m_CurrentModule;
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:
void OnSelectionClicked( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event );
void BrowseAndSelectFootprint( wxCommandEvent& event );
void Init();
void OnSelectionClicked( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event );
void BrowseAndSelectFootprint( wxCommandEvent& event );
void Init();
void Change_Module();
void Change_ModuleId( bool aUseValue );
void Change_ModuleAll();
int Maj_ListeCmp( const wxString& reference, const wxString& old_name,
const wxString& new_name, bool ShowError );
bool Change_1_Module( MODULE* Module,
const wxString& new_module,
PICKED_ITEMS_LIST* aUndoPickList,
bool ShowError );
void Change_Module();
void Change_ModuleId( bool aUseValue );
void Change_ModuleAll();
int Maj_ListeCmp( const wxString& reference, const wxString& old_name,
const wxString& new_name, bool ShowError );
bool Change_1_Module( MODULE* Module,
const wxString& new_module,
PICKED_ITEMS_LIST* aUndoPickList,
bool ShowError );
};
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;
@ -72,7 +66,7 @@ void WinEDA_PcbFrame::InstallExchangeModuleFrame( MODULE* Module )
}
void DIALOG_EXCHANGE_MODULE::OnQuit( wxCommandEvent& WXUNUSED(event) )
void DIALOG_EXCHANGE_MODULE::OnQuit( wxCommandEvent& WXUNUSED( event ) )
{
s_SelectionMode = m_Selection->GetSelection();
Close( true ); // true is to force the frame to close
@ -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" ) );
@ -187,7 +176,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
if( ShowError )
{
msg.Printf( _( "Unable to create file %s" ),
GetChars( tmpFileName.GetFullPath() ) );
GetChars( tmpFileName.GetFullPath() ) );
m_WinMessages->AppendText( msg );
}
return 1;
@ -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;
@ -297,25 +285,26 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleId( bool aUseValue )
check_module_value = true;
value = m_CurrentModule->m_Value->m_Text;
msg.Printf( _( "Change modules <%s> -> <%s> (val = %s)?" ),
GetChars( m_CurrentModule->m_LibRef ),
GetChars( newmodulename ),
GetChars( m_CurrentModule->m_Value->m_Text ) );
GetChars( m_CurrentModule->m_LibRef ),
GetChars( newmodulename ),
GetChars( m_CurrentModule->m_Value->m_Text ) );
}
else
{
msg.Printf( _( "Change modules <%s> -> <%s> ?" ),
GetChars( lib_reference ), GetChars( newmodulename ) );
GetChars( lib_reference ), GetChars( newmodulename ) );
}
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;
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,21 +383,20 @@ 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,
PICKED_ITEMS_LIST* aUndoPickList,
bool ShowError )
bool DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module,
const wxString& new_module,
PICKED_ITEMS_LIST* aUndoPickList,
bool ShowError )
{
wxString namecmp, oldnamecmp;
MODULE* NewModule;
@ -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)
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;
@ -517,7 +508,7 @@ void WinEDA_PcbFrame::Exchange_Module( MODULE* aOldModule,
for( ; old_pad != NULL; old_pad = old_pad->Next() )
{
if( strnicmp( pad->m_Padname, old_pad->m_Padname,
sizeof(pad->m_Padname) ) == 0 )
sizeof(pad->m_Padname) ) == 0 )
{
pad->SetNetname( old_pad->GetNetname() );
pad->SetNet( old_pad->GetNet() );
@ -527,13 +518,13 @@ void WinEDA_PcbFrame::Exchange_Module( MODULE* aOldModule,
if( aUndoPickList )
{
GetBoard()->Remove(aOldModule);
ITEM_PICKER picker_old(aOldModule, UR_DELETED);
ITEM_PICKER picker_new(aNewModule, UR_NEW);
aUndoPickList->PushItem(picker_old);
aUndoPickList->PushItem(picker_new);
GetBoard()->Remove( aOldModule );
ITEM_PICKER picker_old( aOldModule, UR_DELETED );
ITEM_PICKER picker_new( aNewModule, UR_NEW );
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( ")|*." ) +
@ -605,7 +596,7 @@ void WinEDA_PcbFrame::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
result = fgets( Line, sizeof(Line), FichCmp );
fprintf( FichCmp, "Cmp-Mod V01 Genere par PcbNew le %s\n",
DateAndTime( Line ) );
DateAndTime( Line ) );
for( ; Module != NULL; Module = Module->Next() )
{
@ -619,7 +610,7 @@ void WinEDA_PcbFrame::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
!Module->m_Value->m_Text.IsEmpty() ?
CONV_TO_UTF8( Module->m_Value->m_Text ) : "[NoVal]" );
fprintf( FichCmp, "IdModule = %s;\n",
CONV_TO_UTF8( Module->m_LibRef ) );
CONV_TO_UTF8( Module->m_LibRef ) );
fprintf( FichCmp, "EndCmp\n" );
}