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_SCALE wxT( "PrintScale" )
#define OPTKEY_PRINT_MODULE_SCALE wxT( "PrintModuleScale" ) #define OPTKEY_PRINT_MODULE_SCALE wxT( "PrintModuleScale" )
#define OPTKEY_PRINT_PAGE_FRAME wxT( "PrintPageFrame" ) #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 */ /* Conversion unit constants. */
/* coeff de conversion dim en 0.1 mil -> dim en unite PS: (unite PS = pouce) */ /* Convert pcb dimension of 0.1 mil to PS units of inches. */
#define SCALE_PS .0001 #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 #define SCALE_HPGL 0.102041
/* Plot Options : */ /* Plot Options : */
@ -29,7 +29,8 @@ public:
bool Exclude_Edges_Pcb; bool Exclude_Edges_Pcb;
int PlotLine_Width; int PlotLine_Width;
bool Plot_Frame_Ref; // True to plot/print frame references 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; GRTraceMode Trace_Mode;
bool Plot_Set_MIROIR; bool Plot_Set_MIROIR;
int HPGL_Pen_Num; int HPGL_Pen_Num;
@ -39,14 +40,14 @@ public:
int PlotPSColorOpt; // True for color Postscript output int PlotPSColorOpt; // True for color Postscript output
bool Plot_PS_Negative; // True to create a negative board ps plot 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_Reference;
bool Sel_Texte_Valeur; bool Sel_Texte_Valeur;
bool Sel_Texte_Divers; bool Sel_Texte_Divers;
bool Sel_Texte_Invisible; bool Sel_Texte_Invisible;
bool PlotPadsOnSilkLayer; bool PlotPadsOnSilkLayer;
bool Plot_Pads_All_Layers; /* Plot pads meme n'appartenant pas a la bool Plot_Pads_All_Layers; /* Plot pads even outside the
* couche ( utile pour serigraphie) */ * Layer (useful for silkscreen) */
/* id for plot format (see enum PlotFormat in plot_common.h) */ /* id for plot format (see enum PlotFormat in plot_common.h) */
int PlotFormat; int PlotFormat;
@ -68,17 +69,12 @@ public:
extern PCB_Plot_Options g_pcb_plot_options; 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, void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
/* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules, /* Plat PCB text type, ie other than text on modules
* prepare les parametres de trace de texte */ * prepare the plot settings of text */
void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* PtSegm, int masque_layer, void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* PtSegm, int masque_layer,
GRTraceMode trace_mode ); GRTraceMode trace_mode );

View File

@ -1,8 +1,6 @@
/*********************************************************/ /*************************/
/* Routines de trace: fonction communes aux diff formats */ /* Common plot routines. */
/*********************************************************/ /*************************/
/* Fichier PLOT_RTN.CPP*/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
@ -16,19 +14,17 @@
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
/* Local functions */
static void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer, static void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte, static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
/**********************************************************/
void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
int masque_layer, GRTraceMode trace_mode )
/***********************************************************/
/* Creates the plot for silkscreen layers /* Creates the plot for silkscreen layers
*/ */
void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
int masque_layer,
GRTraceMode trace_mode )
{ {
wxPoint pos, shape_pos; wxPoint pos, shape_pos;
wxSize size; wxSize size;
@ -39,31 +35,46 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
/* Plot edge layer and graphic items */ /* 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() ) switch( PtStruct->Type() )
{ {
case TYPE_DRAWSEGMENT: case TYPE_DRAWSEGMENT:
PlotDrawSegment( plotter, (DRAWSEGMENT*) PtStruct, masque_layer, trace_mode ); PlotDrawSegment( plotter,
(DRAWSEGMENT*) PtStruct,
masque_layer,
trace_mode );
break; break;
case TYPE_TEXTE: case TYPE_TEXTE:
PlotTextePcb( plotter, (TEXTE_PCB*) PtStruct, masque_layer, trace_mode ); PlotTextePcb( plotter,
(TEXTE_PCB*) PtStruct,
masque_layer,
trace_mode );
break; break;
case TYPE_COTATION: case TYPE_COTATION:
PlotCotation( plotter, (COTATION*) PtStruct, masque_layer, trace_mode ); PlotCotation( plotter,
(COTATION*) PtStruct,
masque_layer,
trace_mode );
break; break;
case TYPE_MIRE: case TYPE_MIRE:
PlotMirePcb( plotter, (MIREPCB*) PtStruct, masque_layer, trace_mode ); PlotMirePcb( plotter,
(MIREPCB*) PtStruct,
masque_layer,
trace_mode );
break; break;
case TYPE_MARKER_PCB: case TYPE_MARKER_PCB:
break; break;
default: default:
DisplayError( this, wxT( "Plot_Serigraphie() error: unexpected Type()" ) ); DisplayError( this,
wxT( "Plot_Serigraphie() error: unexpected Type()" ) );
break; break;
} }
} }
@ -76,14 +87,15 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
|| g_pcb_plot_options.Plot_Pads_All_Layers ) || g_pcb_plot_options.Plot_Pads_All_Layers )
{ {
for( MODULE* Module = m_Pcb->m_Modules; for( MODULE* Module = m_Pcb->m_Modules;
Module; Module;
Module = Module->Next() ) 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 */ /* Seen if the pad is on this layer */
if( (pt_pad->m_Masque_Layer & masque_layer) == 0 if( (pt_pad->m_Masque_Layer & masque_layer) == 0
/* Copper pads go on copper silk, component /* Copper pads go on copper silk, component
* pads go on component silk */ * pads go on component silk */
&& ( ( (pt_pad->m_Masque_Layer & CUIVRE_LAYER) == 0 ) && ( ( (pt_pad->m_Masque_Layer & CUIVRE_LAYER) == 0 )
@ -122,7 +134,10 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
case PAD_RECT: case PAD_RECT:
default: default:
plotter->flash_pad_rect( pos, size, pt_pad->m_Orient, FILAIRE ); plotter->flash_pad_rect( pos,
size,
pt_pad->m_Orient,
FILAIRE );
break; break;
} }
} }
@ -143,14 +158,14 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
{ {
wxString errMsg; wxString errMsg;
errMsg.Printf( errMsg.Printf( _( "Your BOARD has a bad layer number of %u for \
_( "Your BOARD has a bad layer number of %u for module\n %s's \"reference\" text." ), module\n %s's \"reference\" text." ),
textLayer, GetChars( Module->GetReference() ) ); textLayer, GetChars( Module->GetReference() ) );
DisplayError( this, errMsg ); DisplayError( this, errMsg );
return; return;
} }
if( ( (1 << textLayer) & masque_layer ) == 0 ) if( ( ( 1 << textLayer ) & masque_layer ) == 0 )
trace_ref = FALSE; trace_ref = FALSE;
if( text->m_NoShow && !g_pcb_plot_options.Sel_Texte_Invisible ) if( text->m_NoShow && !g_pcb_plot_options.Sel_Texte_Invisible )
@ -163,9 +178,9 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
{ {
wxString errMsg; wxString errMsg;
errMsg.Printf( errMsg.Printf( _( "Your BOARD has a bad layer number of %u for \
_( "Your BOARD has a bad layer number of %u for module\n %s's \"value\" text." ), module\n %s's \"value\" text." ),
textLayer, GetChars( Module->GetReference() ) ); textLayer, GetChars( Module->GetReference() ) );
DisplayError( this, errMsg ); DisplayError( this, errMsg );
return; return;
} }
@ -184,15 +199,16 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
PlotTextModule( plotter, Module->m_Value, trace_mode ); PlotTextModule( plotter, Module->m_Value, trace_mode );
for( pt_texte = (TEXTE_MODULE*) Module->m_Drawings.GetFirst(); for( pt_texte = (TEXTE_MODULE*) Module->m_Drawings.GetFirst();
pt_texte != NULL; pt_texte != NULL;
pt_texte = pt_texte->Next() ) pt_texte = pt_texte->Next() )
{ {
if( pt_texte->Type() != TYPE_TEXTE_MODULE ) if( pt_texte->Type() != TYPE_TEXTE_MODULE )
continue; continue;
if( !g_pcb_plot_options.Sel_Texte_Divers ) if( !g_pcb_plot_options.Sel_Texte_Divers )
continue; 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; continue;
textLayer = pt_texte->GetLayer(); textLayer = pt_texte->GetLayer();
@ -200,23 +216,22 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
{ {
wxString errMsg; wxString errMsg;
errMsg.Printf( errMsg.Printf( _( "Your BOARD has a bad layer number of %u \
_( for module\n %s's \"module text\" text of %s." ),
"Your BOARD has a bad layer number of %u for module\n %s's \"module text\" text of %s." ), textLayer, GetChars( Module->GetReference() ),
textLayer, GetChars( Module->GetReference() ), GetChars( pt_texte->m_Text ) );
GetChars( pt_texte->m_Text ) );
DisplayError( this, errMsg ); DisplayError( this, errMsg );
return; return;
} }
if( !( (1 << textLayer) & masque_layer ) ) if( !( ( 1 << textLayer ) & masque_layer ) )
continue; continue;
PlotTextModule( plotter, pt_texte, trace_mode ); PlotTextModule( plotter, pt_texte, trace_mode );
} }
} }
/* Plot filled ares */ /* Plot filled areas */
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ ) for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( 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 ); 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() ) for( SEGZONE* seg = m_Pcb->m_Zone; seg != NULL; seg = seg->Next() )
{ {
if( ( ( 1 << seg->GetLayer() ) & masque_layer ) == 0 ) 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, static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/********************************************************************/
{ {
wxSize size; wxSize size;
wxPoint pos; wxPoint pos;
@ -256,7 +270,7 @@ static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
thickness = -1; thickness = -1;
if( pt_texte->m_Mirror ) if( pt_texte->m_Mirror )
NEGATE( size.x ); // Text is mirrored NEGATE( size.x ); // Text is mirrored
plotter->text( pos, BLACK, plotter->text( pos, BLACK,
pt_texte->m_Text, 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, void PlotCotation( PLOTTER* plotter, COTATION* Cotation, int masque_layer,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/*******************************************************************************/
{ {
DRAWSEGMENT* DrawTmp; DRAWSEGMENT* DrawTmp;
@ -283,42 +295,54 @@ void PlotCotation( PLOTTER* plotter, COTATION* Cotation, int masque_layer,
PlotTextePcb( plotter, Cotation->m_Text, masque_layer, trace_mode ); 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_Start.x = Cotation->Barre_ox;
DrawTmp->m_End.x = Cotation->Barre_fx; DrawTmp->m_End.y = Cotation->Barre_fy; 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 ); PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
DrawTmp->m_Start.x = Cotation->TraitG_ox; DrawTmp->m_Start.y = Cotation->TraitG_oy; DrawTmp->m_Start.x = Cotation->TraitG_ox;
DrawTmp->m_End.x = Cotation->TraitG_fx; DrawTmp->m_End.y = Cotation->TraitG_fy; 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 ); PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
DrawTmp->m_Start.x = Cotation->TraitD_ox; DrawTmp->m_Start.y = Cotation->TraitD_oy; DrawTmp->m_Start.x = Cotation->TraitD_ox;
DrawTmp->m_End.x = Cotation->TraitD_fx; DrawTmp->m_End.y = Cotation->TraitD_fy; 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 ); PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
DrawTmp->m_Start.x = Cotation->FlecheD1_ox; DrawTmp->m_Start.y = Cotation->FlecheD1_oy; DrawTmp->m_Start.x = Cotation->FlecheD1_ox;
DrawTmp->m_End.x = Cotation->FlecheD1_fx; DrawTmp->m_End.y = Cotation->FlecheD1_fy; 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 ); PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
DrawTmp->m_Start.x = Cotation->FlecheD2_ox; DrawTmp->m_Start.y = Cotation->FlecheD2_oy; DrawTmp->m_Start.x = Cotation->FlecheD2_ox;
DrawTmp->m_End.x = Cotation->FlecheD2_fx; DrawTmp->m_End.y = Cotation->FlecheD2_fy; 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 ); PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
DrawTmp->m_Start.x = Cotation->FlecheG1_ox; DrawTmp->m_Start.y = Cotation->FlecheG1_oy; DrawTmp->m_Start.x = Cotation->FlecheG1_ox;
DrawTmp->m_End.x = Cotation->FlecheG1_fx; DrawTmp->m_End.y = Cotation->FlecheG1_fy; 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 ); PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
DrawTmp->m_Start.x = Cotation->FlecheG2_ox; DrawTmp->m_Start.y = Cotation->FlecheG2_oy; DrawTmp->m_Start.x = Cotation->FlecheG2_ox;
DrawTmp->m_End.x = Cotation->FlecheG2_fx; DrawTmp->m_End.y = Cotation->FlecheG2_fy; 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 ); PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
delete DrawTmp; delete DrawTmp;
} }
/*****************************************************************/
void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer, void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/*****************************************************************/
{ {
DRAWSEGMENT* DrawTmp; DRAWSEGMENT* DrawTmp;
int dx1, dx2, dy1, dy2, radius; int dx1, dx2, dy1, dy2, radius;
@ -328,11 +352,11 @@ void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer,
DrawTmp = new DRAWSEGMENT( NULL ); 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->SetLayer( Mire->GetLayer() );
DrawTmp->m_Start.x = Mire->m_Pos.x; DrawTmp->m_Start.y = Mire->m_Pos.y; 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_End.y = DrawTmp->m_Start.y;
DrawTmp->m_Shape = S_CIRCLE; DrawTmp->m_Shape = S_CIRCLE;
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode ); 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; DrawTmp->m_Shape = S_SEGMENT;
radius = Mire->m_Size / 2; 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 */ if( Mire->m_Shape ) /* Shape X */
{ {
dx1 = dy1 = (radius * 7) / 5; dx1 = dy1 = ( radius * 7 ) / 5;
dx2 = dx1; dx2 = dx1;
dy2 = -dy1; dy2 = -dy1;
} }
DrawTmp->m_Start.x = Mire->m_Pos.x - dx1; DrawTmp->m_Start.y = Mire->m_Pos.y - dy1; DrawTmp->m_Start.x = Mire->m_Pos.x - dx1;
DrawTmp->m_End.x = Mire->m_Pos.x + dx1; DrawTmp->m_End.y = Mire->m_Pos.y + dy1; 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 ); 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_Start.x = Mire->m_Pos.x - dx2;
DrawTmp->m_End.x = Mire->m_Pos.x + dx2; DrawTmp->m_End.y = Mire->m_Pos.y + dy2; 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 ); PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
delete DrawTmp; delete DrawTmp;
} }
/**********************************************************************/ /* Plot footprints graphic items (outlines) */
void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer, void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer,
GRTraceMode trace_mode ) 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(); for( EDGE_MODULE* edge = (EDGE_MODULE*) module->m_Drawings.GetFirst();
edge; edge;
edge = edge->Next() ) edge = edge->Next() )
{ {
if( edge->Type() != TYPE_EDGE_MODULE ) if( edge->Type() != TYPE_EDGE_MODULE )
continue; continue;
if( (g_TabOneLayerMask[edge->GetLayer()] & masque_layer) == 0 ) if( ( g_TabOneLayerMask[edge->GetLayer()] & masque_layer ) == 0 )
continue; continue;
Plot_1_EdgeModule( plotter, edge, trace_mode ); 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, void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/**************************************************************/
/* Plot a graphic item (outline) relative to a footprint */
{ {
int type_trace; /* forme a tracer (segment, cercle) */ int type_trace; /* Type of item to plot. */
int thickness; /* thickness des segments */ int thickness; /* Segment thickness. */
int radius; /* radius des cercles a tracer */ int radius; /* Circle radius. */
int StAngle, EndAngle; int StAngle, EndAngle;
wxPoint pos, end; /* Coord des segments a tracer */ wxPoint pos, end;
if( PtEdge->Type() != TYPE_EDGE_MODULE ) if( PtEdge->Type() != TYPE_EDGE_MODULE )
return; return;
@ -413,15 +440,22 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
break; break;
case S_CIRCLE: 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 ); plotter->thick_circle( pos, radius * 2, thickness, trace_mode );
break; break;
case S_ARC: 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 ); StAngle = ArcTangente( end.y - pos.y, end.x - pos.x );
EndAngle = StAngle + PtEdge->m_Angle; 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; break;
case S_POLYGON: case S_POLYGON:
@ -432,7 +466,8 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
if( PtEdge->GetParent() && (PtEdge->GetParent()->Type() == TYPE_MODULE) ) if( PtEdge->GetParent() && (PtEdge->GetParent()->Type() == TYPE_MODULE) )
Module = (MODULE*) PtEdge->GetParent(); 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* ptr = ptr_base;
int* source = (int*) &PtEdge->m_PolyPoints[0]; int* source = (int*) &PtEdge->m_PolyPoints[0];
@ -456,7 +491,8 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
*ptr++ = y; *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 ); free( ptr_base );
} }
break; 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, void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/****************************************************************************/
/* Plot a PCB Text, i;e. a text found on a copper or technical layer */
{ {
int orient, thickness; int orient, thickness;
wxPoint pos; wxPoint pos;
@ -476,13 +510,13 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
if( pt_texte->m_Text.IsEmpty() ) if( pt_texte->m_Text.IsEmpty() )
return; return;
if( (g_TabOneLayerMask[pt_texte->GetLayer()] & masque_layer) == 0 ) if( ( g_TabOneLayerMask[pt_texte->GetLayer()] & masque_layer ) == 0 )
return; return;
size = pt_texte->m_Size; size = pt_texte->m_Size;
pos = pt_texte->m_Pos; pos = pt_texte->m_Pos;
orient = pt_texte->m_Orient; 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 ) if( pt_texte->m_Mirror )
size.x = -size.x; size.x = -size.x;
@ -495,7 +529,7 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
offset.y = pt_texte->GetInterline(); offset.y = pt_texte->GetInterline();
RotatePoint( &offset, orient ); RotatePoint( &offset, orient );
for( unsigned i = 0; i<list->Count(); i++ ) for( unsigned i = 0; i < list->Count(); i++ )
{ {
wxString txt = list->Item( i ); wxString txt = list->Item( i );
plotter->text( pos, BLACK, 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 /* 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 int* CornersBuffer = NULL;
static unsigned CornersBufferSize = 0; static unsigned CornersBufferSize = 0;
@ -533,7 +565,7 @@ void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
// We need a buffer to store corners coordinates: // 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 ) if( CornersBuffer == NULL )
{ {
CornersBufferSize = imax * 2; CornersBufferSize = imax * 2;
@ -543,14 +575,15 @@ void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
if( (imax * 4) > CornersBufferSize ) if( (imax * 4) > CornersBufferSize )
{ {
CornersBufferSize = imax * 2; CornersBufferSize = imax * 2;
CornersBuffer = (int*) realloc( CornersBuffer, CornersBufferSize * sizeof(int) ); CornersBuffer = (int*) realloc( CornersBuffer,
CornersBufferSize * sizeof(int) );
} }
imax--; imax--;
/* Plot all filled areas: filled areas have a filled area and a thick outline /* Plot all filled areas: filled areas have a filled area and a thick
* we must plot the filled area itself ( as a filled polygon OR a set of segments ) * outline we must plot the filled area itself ( as a filled polygon
* and plot the thick outline itself * OR a set of segments ) and plot the thick outline itself
* *
* in non filled mode the outline is plotted, but not the filling items * 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 ) if( trace_mode == FILLED )
{ {
// Plot the current filled area polygon // 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 ); 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 start = aZone->m_FillSegmList[iseg].m_Start;
wxPoint end = aZone->m_FillSegmList[iseg].m_End; 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] ), CornersBuffer[ii * 2 - 1] ),
wxPoint( CornersBuffer[ii * 2], wxPoint( CornersBuffer[ii * 2],
CornersBuffer[ii * 2 + 1] ), CornersBuffer[ii * 2 + 1] ),
(trace_mode == FILAIRE) ? -1 : aZone->m_ZoneMinThickness, ( trace_mode == FILAIRE ) ? -1 : aZone->m_ZoneMinThickness,
trace_mode ); trace_mode );
} }
plotter->set_current_line_width( -1 ); 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 /* 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; wxPoint start, end;
int thickness; int thickness;
@ -642,21 +679,32 @@ void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* pt_segm, int masque_layer,
switch( pt_segm->m_Shape ) switch( pt_segm->m_Shape )
{ {
case S_CIRCLE: 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 ); plotter->thick_circle( start, radius * 2, thickness, trace_mode );
break; break;
case S_ARC: 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 ); StAngle = ArcTangente( end.y - start.y, end.x - start.x );
EndAngle = StAngle + pt_segm->m_Angle; 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; break;
case S_CURVE: case S_CURVE:
for( unsigned i = 1; i < pt_segm->m_BezierPoints.size(); i++ ) for( unsigned i = 1; i < pt_segm->m_BezierPoints.size(); i++ )
plotter->thick_segment( pt_segm->m_BezierPoints[i - 1], 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; break;
@ -666,10 +714,8 @@ void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* pt_segm, int masque_layer,
} }
/*********************************************************************/
void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer, void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/*********************************************************************/
{ {
// Specify that the contents of the "Edges Pcb" layer are to be plotted // Specify that the contents of the "Edges Pcb" layer are to be plotted
// in addition to the contents of the currently specified layer. // 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: case LAST_COPPER_LAYER:
Plot_Standard_Layer( plotter, layer_mask, true, trace_mode ); Plot_Standard_Layer( plotter, layer_mask, true, trace_mode );
// Adding drill marks, if required and if the plotter is able to plot them: // Adding drill marks, if required and if the plotter is able to plot
if( g_pcb_plot_options.DrillShapeOpt != PCB_Plot_Options::NO_DRILL_SHAPE ) // them:
if( g_pcb_plot_options.DrillShapeOpt !=
PCB_Plot_Options::NO_DRILL_SHAPE )
{ {
if( plotter->GetPlotterType() == PLOT_FORMAT_POST ) if( plotter->GetPlotterType() == PLOT_FORMAT_POST )
PlotDrillMark( PlotDrillMark( plotter,
plotter, trace_mode,
trace_mode, g_pcb_plot_options.DrillShapeOpt ==
g_pcb_plot_options.DrillShapeOpt == PCB_Plot_Options::SMALL_DRILL_SHAPE );
PCB_Plot_Options::SMALL_DRILL_SHAPE );
} }
break; break;
@ -728,27 +775,28 @@ void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer,
} }
/******************************************************************************/ /* Plot a copper layer or mask in HPGL format.
void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask, * HPGL unit = 0.98 mils (1 mil = 1.02041 unit HPGL).
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 ) .
*/ */
void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter,
int aLayerMask,
bool aPlotVia,
GRTraceMode aPlotMode )
{ {
wxPoint pos; wxPoint pos;
wxSize size; wxSize size;
wxString msg; wxString msg;
// trace des elements type Drawings Pcb : // Plot pcb draw items.
for( BOARD_ITEM* item = m_Pcb->m_Drawings; item; item = item->Next() ) for( BOARD_ITEM* item = m_Pcb->m_Drawings; item; item = item->Next() )
{ {
switch( item->Type() ) switch( item->Type() )
{ {
case TYPE_DRAWSEGMENT: case TYPE_DRAWSEGMENT:
PlotDrawSegment( aPlotter, (DRAWSEGMENT*) item, aLayerMask, aPlotMode ); PlotDrawSegment( aPlotter,
(DRAWSEGMENT*) item,
aLayerMask,
aPlotMode );
break; break;
case TYPE_TEXTE: case TYPE_TEXTE:
@ -768,7 +816,7 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask
default: default:
DisplayError( this, DisplayError( this,
wxT( "Plot_Standard_Layer() error : Unexpected Draw Type" ) ); wxT( "Plot_Standard_Layer() error : Unexpected Draw Type" ) );
break; break;
} }
} }
@ -782,7 +830,9 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask
{ {
case TYPE_EDGE_MODULE: case TYPE_EDGE_MODULE:
if( aLayerMask & g_TabOneLayerMask[ item->GetLayer() ] ) if( aLayerMask & g_TabOneLayerMask[ item->GetLayer() ] )
Plot_1_EdgeModule( aPlotter, (EDGE_MODULE*) item, aPlotMode ); Plot_1_EdgeModule( aPlotter,
(EDGE_MODULE*) item,
aPlotMode );
break; break;
default: default:
@ -794,7 +844,7 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask
/* Plot footprint pads */ /* Plot footprint pads */
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() ) 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; wxPoint shape_pos;
if( (pad->m_Masque_Layer & aLayerMask) == 0 ) 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(); shape_pos = pad->ReturnShapePos();
pos = shape_pos; pos = shape_pos;
wxSize margin; 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_CMP:
case SOLDERMASK_LAYER_CU: case SOLDERMASK_LAYER_CU:
margin.x = margin.y = pad->GetSolderMaskMargin(); margin.x = margin.y = pad->GetSolderMaskMargin();
break; break;
case SOLDERPASTE_LAYER_CMP: case SOLDERPASTE_LAYER_CMP:
case SOLDERPASTE_LAYER_CU: case SOLDERPASTE_LAYER_CU:
margin = pad->GetSolderPasteMargin(); margin = pad->GetSolderPasteMargin();
break; break;
default: default:
break; break;
} }
size.x = pad->m_Size.x + (2 * margin.x); size.x = pad->m_Size.x + ( 2 * margin.x );
size.y = pad->m_Size.y + (2 * margin.y); size.y = pad->m_Size.y + ( 2 * margin.y );
/* Don't draw a null size item : */ /* Don't draw a null size item : */
if( size.x <= 0 || size.y <= 0 ) if( size.x <= 0 || size.y <= 0 )
@ -839,7 +891,11 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
{ {
wxSize delta = pad->m_DeltaSize; 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; break;
@ -869,12 +925,14 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask
via_mask_layer |= SOLDERMASK_LAYER_CU; via_mask_layer |= SOLDERMASK_LAYER_CU;
if( via_mask_layer & CMP_LAYER ) if( via_mask_layer & CMP_LAYER )
via_mask_layer |= SOLDERMASK_LAYER_CMP; via_mask_layer |= SOLDERMASK_LAYER_CMP;
if( ( via_mask_layer & aLayerMask) == 0 ) if( ( via_mask_layer & aLayerMask ) == 0 )
continue; continue;
int via_margin = 0; 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; via_margin = g_DesignSettings.m_SolderMaskMargin;
pos = Via->m_Start; pos = Via->m_Start;
size.x = size.y = Via->m_Width + 2 * via_margin; 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 /** function PlotDrillMark
* Draw a drill mark for pads and vias. * Draw a drill mark for pads and vias.
* Must be called after all drawings, because it * 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 aPlotter = the PLOTTER
* @param aTraceMode = the mode of plot (FILLED, SKETCH) * @param aTraceMode = the mode of plot (FILLED, SKETCH)
* @param aSmallDrillShape = true to plot a small drill shape, false to plot the actual drill shape * @param aSmallDrillShape = true to plot a small drill shape, false to plot
* the actual drill shape
*/ */
void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter, GRTraceMode aTraceMode, void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter,
bool aSmallDrillShape ) GRTraceMode aTraceMode,
bool aSmallDrillShape )
{ {
const int SMALL_DRILL = 150; const int SMALL_DRILL = 150;
wxPoint pos; wxPoint pos;
@ -959,7 +1020,8 @@ void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter, GRTraceMode aTraceMo
if( pts->Type() != TYPE_VIA ) if( pts->Type() != TYPE_VIA )
continue; continue;
pos = pts->m_Start; 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; diam.x = diam.y = SMALL_DRILL;
else else
diam.x = diam.y = pts->GetDrillValue(); diam.x = diam.y = pts->GetDrillValue();
@ -968,12 +1030,12 @@ void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter, GRTraceMode aTraceMo
} }
for( Module = m_Pcb->m_Modules; for( Module = m_Pcb->m_Modules;
Module != NULL; Module != NULL;
Module = Module->Next() ) Module = Module->Next() )
{ {
for( PtPad = Module->m_Pads; for( PtPad = Module->m_Pads;
PtPad != NULL; PtPad != NULL;
PtPad = PtPad->Next() ) PtPad = PtPad->Next() )
{ {
if( PtPad->m_Drill.x == 0 ) if( PtPad->m_Drill.x == 0 )
continue; continue;
@ -983,7 +1045,10 @@ void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter, GRTraceMode aTraceMo
if( PtPad->m_DrillShape == PAD_OVAL ) if( PtPad->m_DrillShape == PAD_OVAL )
{ {
diam = PtPad->m_Drill; 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 else
{ {

View File

@ -1,6 +1,6 @@
/*******************************/ /******************/
/**** Routine de trace HPGL ****/ /**** Plot DXF ****/
/*******************************/ /******************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
@ -12,10 +12,8 @@
#include "protos.h" #include "protos.h"
/*****************************************************************************/
void WinEDA_BasePcbFrame::Genere_DXF( const wxString& FullFileName, int Layer, void WinEDA_BasePcbFrame::Genere_DXF( const wxString& FullFileName, int Layer,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/*****************************************************************************/
{ {
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc; 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(); DXF_PLOTTER* plotter = new DXF_PLOTTER();
plotter->set_paper_size( currentsheet ); 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_creator( wxT( "PCBNEW-DXF" ) );
plotter->set_filename( FullFileName ); plotter->set_filename( FullFileName );
plotter->start_plot( output_file ); plotter->start_plot( output_file );

View File

@ -1,6 +1,6 @@
/*******************************/ /*******************/
/**** Routine de trace HPGL ****/ /**** Plot HPGL ****/
/*******************************/ /*******************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
@ -12,10 +12,9 @@
#include "protos.h" #include "protos.h"
/*****************************************************************************/
void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer, void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/*****************************************************************************/
{ {
wxSize SheetSize; wxSize SheetSize;
wxSize BoardSize; wxSize BoardSize;
@ -28,7 +27,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
ClearMsgPanel(); ClearMsgPanel();
// Compute pen_dim (from g_HPGL_Pen_Diam in mils) in pcb units, // 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 // 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 ); 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 ); AppendMsgPanel( _( "File" ), FullFileName, CYAN );
if( g_pcb_plot_options.PlotScaleOpt != 1 ) 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.x = currentsheet->m_Size.x * U_PCB;
SheetSize.y = currentsheet->m_Size.y * 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(); m_Pcb->ComputeBoundaryBox();
BoardSize = m_Pcb->m_BoundaryBox.GetSize(); BoardSize = m_Pcb->m_BoundaryBox.GetSize();
BoardCenter = m_Pcb->m_BoundaryBox.Centre(); BoardCenter = m_Pcb->m_BoundaryBox.Centre();
@ -70,18 +69,18 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
double Xscale, Yscale; double Xscale, Yscale;
// Fit to 80% of the page // Fit to 80% of the page
Xscale = ( (SheetSize.x * 0.8) / BoardSize.x ); Xscale = ( ( SheetSize.x * 0.8 ) / BoardSize.x );
Yscale = ( (SheetSize.y * 0.8) / BoardSize.y ); Yscale = ( ( SheetSize.y * 0.8 ) / BoardSize.y );
scale = MIN( Xscale, Yscale ); scale = MIN( Xscale, Yscale );
} }
else else
scale = g_pcb_plot_options.Scale; scale = g_pcb_plot_options.Scale;
// Calcul du cadrage (echelle != 1 donc recadrage du trace) // Calculate the page size offset.
if( Center ) if( Center )
{ {
offset.x = BoardCenter.x - (SheetSize.x / 2) / scale; offset.x = BoardCenter.x - ( SheetSize.x / 2 ) / scale;
offset.y = BoardCenter.y - (SheetSize.y / 2) / scale; offset.y = BoardCenter.y - ( SheetSize.y / 2 ) / scale;
} }
else else
{ {

View File

@ -1,6 +1,6 @@
/*************************************/ /*************************/
/**** Pcbnew: Routine de trace PS ****/ /**** Plot Postscript ****/
/*************************************/ /*************************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
@ -12,14 +12,12 @@
#include "protos.h" #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, void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
bool useA4, GRTraceMode trace_mode ) bool useA4, GRTraceMode trace_mode )
/****************************************************************************/
/* Genere un fichier POSTSCRIPT (*.ps) de trace du circuit, couche layer
* if layer < 0: all layers
*/
{ {
wxSize SheetSize; wxSize SheetSize;
wxSize PaperSize; wxSize PaperSize;
@ -45,13 +43,12 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
AppendMsgPanel( _( "File" ), FullFileName, CYAN ); AppendMsgPanel( _( "File" ), FullFileName, CYAN );
if( g_pcb_plot_options.PlotScaleOpt != 1 ) 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 // Set default line width
if( g_pcb_plot_options.PlotLine_Width < 1 ) if( g_pcb_plot_options.PlotLine_Width < 1 )
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.x = currentsheet->m_Size.x * U_PCB;
SheetSize.y = currentsheet->m_Size.y * 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; paperscale = 1;
} }
/* calcul des dimensions et centre du PCB */
m_Pcb->ComputeBoundaryBox(); m_Pcb->ComputeBoundaryBox();
BoardSize = m_Pcb->m_BoundaryBox.GetSize(); BoardSize = m_Pcb->m_BoundaryBox.GetSize();
BoardCenter = m_Pcb->m_BoundaryBox.Centre(); BoardCenter = m_Pcb->m_BoundaryBox.Centre();
@ -86,11 +82,10 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
else else
scale = g_pcb_plot_options.Scale * paperscale; scale = g_pcb_plot_options.Scale * paperscale;
// Calcul du cadrage (echelle != 1 donc recadrage du trace)
if( Center ) if( Center )
{ {
offset.x = BoardCenter.x - (PaperSize.x / 2) / scale; offset.x = BoardCenter.x - ( PaperSize.x / 2 ) / scale;
offset.y = BoardCenter.y - (PaperSize.y / 2) / scale; offset.y = BoardCenter.y - ( PaperSize.y / 2 ) / scale;
} }
else else
{ {
@ -119,9 +114,9 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
// and switch the current color to WHITE // and switch the current color to WHITE
if( g_pcb_plot_options.Plot_PS_Negative ) 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_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, plotter->rect( wxPoint( m_Pcb->m_BoundaryBox.GetX() - margin,
m_Pcb->m_BoundaryBox.GetY() - margin ), m_Pcb->m_BoundaryBox.GetY() - margin ),
wxPoint( m_Pcb->m_BoundaryBox.GetRight() + margin, wxPoint( m_Pcb->m_BoundaryBox.GetRight() + margin,

View File

@ -12,23 +12,23 @@
#include "pcbplot.h" #include "pcbplot.h"
#include "protos.h" #include "protos.h"
/* Local functions */
static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module, 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 /** Function PrintPage
* Used to print the board (on printer, or when creating SVF files). * Used to print the board (on printer, or when creating SVF files).
* Print the board, but only layers allowed by aPrintMaskLayer * Print the board, but only layers allowed by aPrintMaskLayer
* ( printmasklayer is a 32 bits mask: bit n = 1 -> layer n is printed) * ( 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; MODULE* Module;
int drawmode = GR_COPY; int drawmode = GR_COPY;
DISPLAY_OPTIONS save_opt; DISPLAY_OPTIONS save_opt;
TRACK* pt_piste; TRACK* pt_piste;
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) m_Parent; 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; DisplayOpt.DisplayViaFill = false;
} }
frame->m_DisplayPadFill = DisplayOpt.DisplayPadFill; frame->m_DisplayPadFill = DisplayOpt.DisplayPadFill;
frame->m_DisplayViaFill = DisplayOpt.DisplayViaFill; frame->m_DisplayViaFill = DisplayOpt.DisplayViaFill;
frame->m_DisplayPadNum = DisplayOpt.DisplayPadNum = false; frame->m_DisplayPadNum = DisplayOpt.DisplayPadNum = false;
DisplayOpt.DisplayPadNoConn = false; DisplayOpt.DisplayPadNoConn = false;
DisplayOpt.DisplayPadIsol = false; DisplayOpt.DisplayPadIsol = false;
DisplayOpt.DisplayModEdge = FILLED; DisplayOpt.DisplayModEdge = FILLED;
DisplayOpt.DisplayModText = FILLED; DisplayOpt.DisplayModText = FILLED;
frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = FILLED; frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = FILLED;
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE; DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
DisplayOpt.DisplayDrawItems = FILLED; DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZonesMode = 0; DisplayOpt.DisplayZonesMode = 0;
DisplayOpt.DisplayNetNamesMode = 0; DisplayOpt.DisplayNetNamesMode = 0;
m_PrintIsMirrored = aPrintMirrorMode; m_PrintIsMirrored = aPrintMirrorMode;
// The OR mode is used in color mode, but be aware the backgroud *must be BLACK. // The OR mode is used in color mode, but be aware the backgroud *must be
// In print page dialog, we first plrint in BLACK, and after reprint in color, // BLACK. In the print page dialog, we first plrint in BLACK, and after
// on the black "local" backgroud, in OR mode // reprint in color, on the black "local" backgroud, in OR mode the black
// the black print is not made before, only a white page is printed // print is not made before, only a white page is printed
if( GetGRForceBlackPenState( ) == false ) if( GetGRForceBlackPenState() == false )
drawmode = GR_OR; drawmode = GR_OR;
/* Print the pcb graphic items (texts, ...) */ /* Print the pcb graphic items (texts, ...) */
GRSetDrawMode( aDC, drawmode ); 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() ) switch( item->Type() )
{ {
@ -79,13 +78,13 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMa
case TYPE_COTATION: case TYPE_COTATION:
case TYPE_TEXTE: case TYPE_TEXTE:
case TYPE_MIRE: case TYPE_MIRE:
if( ((1<<item->GetLayer()) & aPrintMaskLayer) == 0 ) if( ( ( 1 << item->GetLayer() ) & aPrintMaskLayer ) == 0 )
break; break;
item->Draw( this, aDC, drawmode ); item->Draw( this, aDC, drawmode );
break; break;
case TYPE_MARKER_PCB: /* Trace des marqueurs */ case TYPE_MARKER_PCB:
default: default:
break; break;
} }
@ -97,13 +96,19 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMa
{ {
if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 ) if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 )
continue; 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 rayon = pt_piste->m_Width >> 1;
int color = g_DesignSettings.m_ViaColor[pt_piste->m_Shape]; int color = g_DesignSettings.m_ViaColor[pt_piste->m_Shape];
GRSetDrawMode( aDC, drawmode ); GRSetDrawMode( aDC, drawmode );
GRFilledCircle( &m_ClipBox, aDC, pt_piste->m_Start.x, pt_piste->m_Start.y, GRFilledCircle( &m_ClipBox,
rayon, 0, color, color ); aDC,
pt_piste->m_Start.x,
pt_piste->m_Start.y,
rayon,
0,
color,
color );
} }
else else
pt_piste->Draw( this, aDC, drawmode ); 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) */ /* Draw filled areas (i.e. zones) */
for( int ii = 0; ii < Pcb->GetAreaCount(); ii++ ) for( int ii = 0; ii < Pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* zone = Pcb->GetArea(ii); ZONE_CONTAINER* zone = Pcb->GetArea( ii );
if( ( aPrintMaskLayer & (1 << zone->GetLayer()) ) == 0 ) if( ( aPrintMaskLayer & ( 1 << zone->GetLayer() ) ) == 0 )
continue; continue;
zone->DrawFilledArea( this, aDC, drawmode ); zone->DrawFilledArea( this, aDC, drawmode );
} }
// Draw footprints, this is done at last in order to print the pad holes in white (or g_DrawBgColor) // Draw footprints, this is done at last in order to print the pad holes in
// after the tracks and zones // white (or g_DrawBgColor) after the tracks and zones
Module = (MODULE*) Pcb->m_Modules; Module = (MODULE*) Pcb->m_Modules;
for( ; Module != NULL; Module = Module->Next() ) for( ; Module != NULL; Module = Module->Next() )
{ {
Print_Module( this, aDC, Module, drawmode, aPrintMaskLayer ); 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; pt_piste = Pcb->m_Track;
int color = g_DrawBgColor; int color = g_DrawBgColor;
bool blackpenstate = GetGRForceBlackPenState( ); bool blackpenstate = GetGRForceBlackPenState();
GRForceBlackPen( false ); GRForceBlackPen( false );
GRSetDrawMode( aDC, GR_COPY ); GRSetDrawMode( aDC, GR_COPY );
for( ; pt_piste != NULL; pt_piste = pt_piste->Next() ) for( ; pt_piste != NULL; pt_piste = pt_piste->Next() )
{ {
if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 ) if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 )
continue; continue;
if( pt_piste->Type() == TYPE_VIA ) /* VIA rencontree */ if( pt_piste->Type() == TYPE_VIA ) /* VIA encountered. */
{ {
int rayon = pt_piste->GetDrillValue() / 2; int rayon = pt_piste->GetDrillValue() / 2;
GRFilledCircle( &m_ClipBox, aDC, pt_piste->m_Start.x, pt_piste->m_Start.y, GRFilledCircle( &m_ClipBox,
rayon, 0, color, color ); aDC,
pt_piste->m_Start.x,
pt_piste->m_Start.y,
rayon,
0,
color,
color );
} }
} }
GRForceBlackPen( blackpenstate ); GRForceBlackPen( blackpenstate );
if( aPrint_Sheet_Ref ) 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, 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; D_PAD* pt_pad;
EDA_BaseStruct* PtStruct; EDA_BaseStruct* PtStruct;
@ -184,16 +195,20 @@ static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
if( (pt_pad->m_Masque_Layer & masklayer ) == 0 ) if( (pt_pad->m_Masque_Layer & masklayer ) == 0 )
continue; continue;
// Usually we draw pads in sketch mode on non copper layers: // 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 // 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 ); 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 ); pt_pad->Draw( panel, DC, draw_mode );
} }
@ -207,9 +222,9 @@ static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC,
if( mlayer & masklayer ) if( mlayer & masklayer )
{ {
if( ! Module->m_Reference->m_NoShow ) if( !Module->m_Reference->m_NoShow )
Module->m_Reference->Draw( panel, DC, draw_mode ); 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 ); 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: case TYPE_EDGE_MODULE:
{ {
EDGE_MODULE* edge = (EDGE_MODULE*) PtStruct; EDGE_MODULE* edge = (EDGE_MODULE*) PtStruct;
if( (g_TabOneLayerMask[edge->GetLayer()] & masklayer ) == 0 ) if( ( g_TabOneLayerMask[edge->GetLayer()] & masklayer ) == 0 )
break; break;
edge->Draw( panel, DC, draw_mode ); edge->Draw( panel, DC, draw_mode );
break; break;

View File

@ -1,6 +1,6 @@
/***************************************/ /***********/
/* prototypage des fonctions de PCBNEW */ /* protos.h */
/***************************************/ /***********/
#ifndef PROTO_H #ifndef PROTO_H
#define PROTO_H #define PROTO_H
@ -22,11 +22,12 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage );
/* install function for DialogNonCopperZonesEditor dialog frame :*/ /* 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 */ /* PAD_CONNECT.CPP */
/***************/ /*******************/
class D_PAD; class D_PAD;
@ -43,60 +44,61 @@ void CreateSortedPadListByXCoord( BOARD* aBoard, std::vector<D_PAD*>* aVector );
/* Create a sorted list of pointers to pads. /* 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 * The list must be freed bu user
*/ */
/**************/ /**************/
/* PCBCFG.CPP */ /* PCBCFG.CPP */
/**************/ /**************/
bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose ); bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose );
/***************/ /***************/
/* TRPISTE.CPP */ /* TRPISTE.CPP */
/***************/ /***************/
void Trace_Une_Piste( WinEDA_DrawPanel* panel, /* Routine trace of n consecutive segments in memory.
wxDC* DC, * Useful for mounting a track record for being the segments that
TRACK* pt_start_piste, * Tracks are contiguous in memory
int nbsegment, * Parameters:
int mode_color ); * Pt_start_piste = starting address of the list of segments
* Nbsegment = number of segments was traced
/* routine de trace de n segments consecutifs en memoire. * Mode_color = mode (GrXOR, Gror ..)
* Utile pour monter une piste en cours de trace car les segments de cette * CAUTION:
* piste sont alors contigus en memoire * The starting point of a track following MUST exist: may be
* Parametres : * Then put a 0 before calling a routine if the track is the last draw
* 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
*/ */
void Trace_Une_Piste( WinEDA_DrawPanel* panel,
wxDC* DC,
TRACK* pt_start_piste,
int nbsegment,
int mode_color );
/****************/ /****************/
/* TRACEMOD.C : */ /* 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. /* Trace the pads of a module in sketch mode.
* Utilisee pour afficher les pastilles d'un module lorsque celui ci n'est * Used to display a module pads when it is not displayed by the display
* pas affiche par les options d'affichage des Modules * options Module.
* Les pads affiches doivent apparaitre sur les couches donnees par * The pads must appear on the data layers by MasqueLayer
* MasqueLayer */ */
void Trace_Pads_Only( WinEDA_DrawPanel* panel,
wxDC* DC,
MODULE* Module,
int ox,
int oy,
int MasqueLayer,
int mode_color );
/****************/ /****************/
/* LOCATE.CPP : */ /* LOCATE.CPP : */
/****************/ /****************/
/* Recherche d'une empreinte par son nom */ /* Find a pad by it's name om the module. */
TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer = -1 );
/* Recherche d'un pad par son nom, pour le module Module */
TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer = -1 );
/** /**
* Function Locate_Via_Area * 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. * @param aLayer The layer to match, pass -1 for a don't care.
* @return TRACK* - actually a SEGVIA* if found, else NULL. * @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, /* Locates the center through the point x, y, on layer data
const wxPoint& pos, int masquelayer ); * by masquelayer.
* Search is done to address start_adr has end_adr (not included)
/* 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)
*/ */
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, /* Locates the center through the point x, y, on layer data
const wxPoint& ref_pos, int masquelayer ); * by masquelayer.
* Search is done to address start_adr has end_adr (not included)
/* 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)
*/ */
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, /* Search for segment connected to the segment edge by
TRACK* pt_lim, int extr ); * Ptr_piste:
* If int = START, the point of beginning of the segment is used
/* recherche le segment connecte au segment pointe par * If int = END, the end point of the segment is used
* ptr_piste: * The search is done only on the ends of segments
* si int = START, le point de debut du segment est utilise * The search is limited to the area [... pt_base] pt_lim.
* 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.
*/ */
TRACK* Locate_Piste_Connectee( TRACK* ptr_piste, TRACK* pt_base,
TRACK* Locate_Pistes( TRACK* start_adresse, int layer, int typeloc ); TRACK* pt_lim, int extr );
TRACK* Locate_Pistes( TRACK* start_adresse,
const wxPoint& ref_pos, int layer );
/* /*
* 1 - routine de localisation du segment de piste pointe par la souris. * 1 - Locate segment of track leading from the mouse.
* 2 - routine de localisation du segment de piste pointe par le point * 2 - Locate segment of track point by point.
* ref_pX , ref_pY. * 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 * Locate pad pointed to by the coordinate ref_pX,, ref_pY or the current
* par la souris, recherche faite sur toutes les empreintes. * cursor position, search done on all tracks.
* entree : (OVERHAEAD) * Entry:
* - coord souris (Curseur_X et Curseur_Y) * - Mouse coord (Curseur_X and Curseur_Y)
* ou ref_pX, ref_pY * Or ref_pX, ref_pY
* retourne: * Returns:
* pointeur sur la description de la pastille si localisation * Pointer to the pad if found
* pointeur NULL si pastille non trouvee * 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 ); /* Locate pad pointed to by the coordinate ref_pX,, ref_pY or the cursor
D_PAD* Locate_Pads( MODULE* Module, const wxPoint& ref_pos, int layer ); * position of the current footprint.
* Input:
/* localisation de la pastille pointee par la coordonnee ref_pX,,ref_pY, ou * - The module to search.
* par la souris, concernant l'empreinte en cours. * - Layer to search or -1 to search all layers.
* entree : * Returns:
* - parametres generaux de l'empreinte mise a jous par caract() * A pointer to the pad if found otherwise NULL.
* - 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
*/ */
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 */ /* Locate a pad pointed to by the cursor on the footprint.
* Module.
D_PAD* Locate_Pads( MODULE* Module, int typeloc ); * Input:
* - Module to search.
/* localisation de la pastille pointee par la souris, concernant l'empreinte * Returns:
* Module. * A pointer to the pad if found otherwise NULL.
* 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
*/ */
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 DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc );
* La recherche commence a l'adresse start_adresse */
DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc ); /* Locate pad containing the point px, py, layer on layer.
D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb, const wxPoint& ref_pos, int layer );
/* Routine cherchant le pad contenant le point px,py, sur la couche layer
* ( extremite de piste )
* La liste des pads doit deja exister.
* *
* retourne : * The list of pads must already exist.
* NULL si pas de pad localise. *
* pointeur sur le pad correspondante si pad trouve * Returns:
* (bonne position ET bonne couche). */ * Pointer to the pad if found, otherwise NULL.
*/
D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb,
TRACK* Locate_Zone( TRACK* start_adresse, int layer, int typeloc ); const wxPoint& ref_pos,
TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer ); int layer );
/* /*
* 1 - routine de localisation du segment de zone pointe par la souris. * 1 - Locate trace segment at the current cursor position.
* 2 - routine de localisation du segment de zone pointe par le point * 2 - Locate trace segment at the given coordinates ref_pos.
* ref_pX , ref_pY.r
* *
* 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 */ /* MODULES.C */
/*************/ /*************/
int ChangeSideNumLayer( int oldlayer ); int ChangeSideNumLayer( int oldlayer );
void DrawModuleOutlines( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module ); void DrawModuleOutlines( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module );
void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); void Montre_Position_Empreinte( WinEDA_DrawPanel* panel,
wxDC* DC,
bool erase );
/* LOADCMP.C : */ /* LOADCMP.C : */
MODULE* Load_Module_From_Library( WinEDA_DrawFrame* frame, wxDC* DC ); MODULE* Load_Module_From_Library( WinEDA_DrawFrame* frame, wxDC* DC );
/****************/ /****************/
/* EDITRACK.C : */ /* EDITRACK.C : */
/****************/ /****************/
TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack ); TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack );
void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel,
wxDC* DC, bool erase ); 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 : */ /* TRACK.CPP : */
/*****************/ /*****************/
/** /**
* Function Marque_Une_Piste * Function Marque_Une_Piste
* marks a chain of track segments, connected to aTrackList. * marks a chain of track segments, connected to aTrackList.
* Each segment is marked by setting the BUSY bit into m_Flags. Electrical continuity * Each segment is marked by setting the BUSY bit into m_Flags. Electrical
* is detected by walking each segment, and finally the segments are rearranged * continuity is detected by walking each segment, and finally the segments
* into a contiguous chain within the given list. * 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 aPcb = the board to analyze
* @param aSegmCount = a pointer to an integer where to return the number of interesting segments * @param aStartSegm - The first interesting segment within a list of track
* @param aTrackLen = a pointer to an integer where to return the lenght of the track * segment of aPcb
* @param aReorder = * @param aSegmCount = a pointer to an integer where to return the number of
* true for reorder the interesting segments (useful for track edition/deletion) * interesting segments
* in this case the flag BUSY is set (the user is responsible of flag clearing) * @param aTrackLen = a pointer to an integer where to return the lenght of the
* false for no reorder : useful when we want just calculate the track lenght * track
* in this case, flags are reset * @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. * @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, /* Calculate end coordinate of a trace.
TRACK** StartTrack, TRACK** EndTrack ); * 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 /* Update the state of a list of structures. */
* retourne 1 si OK, 0 si piste bouclee void ListSetState( EDA_BaseStruct* Start, int Nbitem, int State, int onoff );
* 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 */
/**************/ /**************/
/* CLEAN.CPP : */ /* CLEAN.CPP : */
/**************/ /**************/
/* Remove segments connected incorrectly.
*/
int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche ); 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 */ /* ZONES.CPP */
/************/ /************/
int Propagation( WinEDA_PcbFrame* frame ); int Propagation( WinEDA_PcbFrame* frame );
/***************/ /****************/
/* ATTRIBUT.CPP */ /* ATTRIBUT.CPP */
/***************/ /****************/
void MasqueAttributs( int* masque_set, int* masque_clr ); /* Compute the attributes that are 0 (masque_clr) and put a 1
* (Masque_set), depending on the options attribute.
/* Calcule les attributs a remettre a 0 (masque_clr) et a mettre a 1
* (masque_set), en fonction des options d'attributs
* *
* ces attributs sont normalement le membre .flags de la structure TRACK * These attributes are normally the member flags of the structure TRACK
* les pointeurs NULLs sont acceptes * Pointers NULLs are accepted.
*/ */
void MasqueAttributs( int* masque_set, int* masque_clr );
/***************/ /***************/
/* DUPLTRAC.CPP */ /* DUPLTRAC.CPP */
/***************/ /***************/
/* Routine trouvant le point " d'accrochage " d'une extremite de piste. /* Routine to find the point "attachment" at the end of a trace.
* Ce point peut etre un PAD ou un autre segment de piste * This may be a PAD or another trace segment.
* Retourne: * Returns:
* - pointeur sur ce PAD ou: * - Pointer to the PAD or:
* - pointeur sur le segment ou: * - Pointer to the segment or:
* - NULL * - NULL
* Parametres d'appel: * Parameters:
* coord aPos du point tst * - aPos - coordinate point test
* aLayerMask masque des couches a tester * ALayerMask of mask layers to be tested
*/ */
BOARD_ITEM* LocateLockPoint( BOARD* aPcb, wxPoint aPos, int aLayerMask ); BOARD_ITEM* LocateLockPoint( BOARD* aPcb, wxPoint aPos, int aLayerMask );
/* Create an intermediate point on a segment
/* Routine de creation d'un point intermediaire sur un segment * ASegm segment is broken into 2 segments connecting point pX, pY
* le segment aSegm est casse en 2 segments se raccordant au point pX, pY * Returns:
* retourne: * NULL if no new point (ie if aRefPoint already corresponded
* NULL si pas de nouveau point ( c.a.d si aRefPoint correspondait deja * At one end where:
* a une extremite ou: * Pointer to the segment created
* pointeur sur le segment cree * If aRefSegm! Refsegm = NULL pointer is on the segment
* si aRefSegm != NULL refsegm est pointeur sur le segment incident, * Created and the point is the intersection of 2 lines segments ptsegm
* et le point cree est l'intersection des 2 axes des segments ptsegm et aRefSegm * and aRefSegm
* retourne la valeur exacte de aRefPoint * Returns the exact value of aRefPoint
* Si aSegm pointe sur une via: * If aSegm points to a via:
* retourne la valeur exacte de aRefPoint et aSegm, * Returns the exact value of aRefPoint and aSegm, but does not create
* mais ne cree pas de point supplementaire * 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 */ /* CONTROLE.CPP */
@ -365,23 +377,24 @@ bool Project( wxPoint* res, wxPoint on_grid, const TRACK* track );
/***************/ /***************/
/* AUTOROUT.CPP */ /* AUTOROUT.CPP */
/***************/ /***************/
void DisplayBoard( WinEDA_DrawPanel* panel, wxDC* DC ); /* routine de Debug */ void DisplayBoard( WinEDA_DrawPanel* panel, wxDC* DC ); /* for Debugging */
/**************/ /**************/
/* NETLIST.CPP */ /* 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 ); 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 */ /* SET_COLOR.CPP */
/*****************/ /*****************/
void DisplayColorSetupFrame( WinEDA_PcbFrame* parent, 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 "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -15,167 +15,168 @@
struct PcbQueue /* search queue structure */ struct PcbQueue /* search queue structure */
{ {
struct PcbQueue *Next; struct PcbQueue* Next;
int Row; /* current row */ int Row; /* current row */
int Col; /* current column */ int Col; /* current column */
int Side; /* 0=top, 1=bottom */ int Side; /* 0=top, 1=bottom */
int Dist; /* path distance to this cell so far */ int Dist; /* path distance to this cell so far */
int ApxDist; /* approximate distance to target from here */ int ApxDist; /* approximate distance to target from here */
}; };
static long qlen = 0; /* current queue length */ static long qlen = 0; /* current queue length */
static struct PcbQueue *Head = NULL; static struct PcbQueue* Head = NULL;
static struct PcbQueue *Tail = NULL; static struct PcbQueue* Tail = NULL;
static struct PcbQueue *Save = NULL; /* hold empty queue structs */ static struct PcbQueue* Save = NULL; /* hold empty queue structs */
/* Routines definies ici : */
void InitQueue(); void InitQueue();
void GetQueue( int *, int *, int *, int *, int * ); void GetQueue( int*, int*, int*, int*, int* );
int SetQueue( int, int, int, int, int, int, int ); int SetQueue( int, int, int, int, int, int, int );
void ReSetQueue( 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 */ /* Free the memory used for storing all the queue */
void FreeQueue()
{ {
struct PcbQueue *p; struct PcbQueue* p;
InitQueue(); InitQueue();
while( (p = Save) != NULL ) while( (p = Save) != NULL )
{ {
Save = p->Next; MyFree(p); Save = p->Next; MyFree( p );
} }
} }
/************************/
/* void InitQueue() */
/************************/
/* initialize the search queue */ /* initialize the search queue */
void InitQueue() void InitQueue()
{ {
struct PcbQueue *p; struct PcbQueue* p;
while( (p = Head) != NULL ) while( (p = Head) != NULL )
{ {
Head = p->Next; Head = p->Next;
p->Next = Save; Save = p; p->Next = Save; Save = p;
} }
Tail = NULL;
OpenNodes = ClosNodes = MoveNodes = MaxNodes = qlen = 0; 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 */ /* 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 */ if( (p = Head) != NULL ) /* return first item in list */
{ {
*r = p->Row; *c = p->Col; *r = p->Row; *c = p->Col;
*s = p->Side; *s = p->Side;
*d = p->Dist; *a = p->ApxDist; *d = p->Dist; *a = p->ApxDist;
if ((Head = p->Next) == NULL) Tail = NULL; if( (Head = p->Next) == NULL )
Tail = NULL;
/* put node on free list */ /* put node on free list */
p->Next = Save; Save = p; p->Next = Save; Save = p;
ClosNodes++; qlen--; ClosNodes++; qlen--;
} }
else /* empty list */
else /* empty list */ {
{ *r = *c = *s = *d = *a = ILLEGAL;
*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 /* add a search node to the list
Return: * Return:
1 si OK * 1 - OK
0 si defaut allocation Memoire * 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; int i, j;
j = 0; // gcc warning fix
if( (p = Save) != NULL ) /* try free list first */ j = 0; // gcc warning fix
{
Save = p->Next;
}
else if ((p = (struct PcbQueue *) MyMalloc(sizeof(PcbQueue))) == NULL)
return(0);
p->Row = r; if( (p = Save) != NULL ) /* try free list first */
p->Col = c; {
p->Side = side; Save = p->Next;
i = (p->Dist = d) + (p->ApxDist = a); }
p->Next = NULL; else if( ( p = (struct PcbQueue*) MyMalloc( sizeof(PcbQueue) ) ) == NULL )
if( (q = Head) != NULL) return 0;
{ /* insert in proper position in list */
if (q->Dist + q->ApxDist > i) p->Row = r;
{ /* insert at head */ p->Col = c;
p->Next = q; Head = p; p->Side = side;
} i = (p->Dist = d) + (p->ApxDist = a);
else { /* search for proper position */ p->Next = NULL;
for (t = q, q = q->Next; q && i > (j = q->Dist + q->ApxDist); if( (q = Head) != NULL ) /* insert in proper position in list */
t = q, q = q->Next) {
; if( q->Dist + q->ApxDist > i ) /* insert at head */
if (q && i == j && q->Row == r2 && q->Col == c2) {
{ p->Next = q; Head = p;
/* insert after q, which is a goal node */ }
if ( (p->Next = q->Next) == NULL) Tail = p; else /* search for proper position */
q->Next = p; {
} for( t = q, q = q->Next; q && i > ( j = q->Dist + q->ApxDist );
else t = q, q = q->Next )
{ /* insert in front of q */ ;
if ((p->Next = q) == NULL) Tail = p;
t->Next = p; if( q && i == j && q->Row == r2 && q->Col == c2 )
} {
} /* insert after q, which is a goal node */
} if( ( p->Next = q->Next ) == NULL )
else /* empty search list */ Tail = p;
Head = Tail = p; q->Next = p;
OpenNodes++; }
if (++qlen > MaxNodes) MaxNodes = qlen; else /* insert in front of q */
return(1); {
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 */ /* 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 */ /* first, see if it is already in the list */
for (q = NULL, p = Head; p; q = p, p = p->Next) { 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( p->Row == r && p->Col == c && p->Side == s )
if (q) {
{ /* old one to remove */
if ( (q->Next = p->Next) == NULL) Tail = q; if( q )
} {
else if ((Head = p->Next) == NULL) Tail = NULL; if( ( q->Next = p->Next ) == NULL )
p->Next = Save; Save = p; Tail = q;
OpenNodes--; MoveNodes++; }
qlen--; else if( ( Head = p->Next ) == NULL )
break; Tail = NULL;
} p->Next = Save;
} Save = p;
if (!p) /* not found, it has already been closed once */ OpenNodes--;
ClosNodes--; /* we will close it again, but just count once */ MoveNodes++;
/* if it was there, it's gone now; insert it at the proper position */ qlen--;
SetQueue( r, c, s, d, a, r2, c2 ); 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 class WinEDA_SelLayerFrame : public wxDialog
{ {
private: private:
WinEDA_BasePcbFrame* m_Parent; WinEDA_BasePcbFrame* m_Parent;
wxRadioBox* m_LayerList; 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: public:
// Constructor and destructor // Constructor and destructor
WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent, int default_layer, WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent, int default_layer,
int min_layer, int max_layer, bool null_layer ); int min_layer, int max_layer, bool null_layer );
~WinEDA_SelLayerFrame() { }; ~WinEDA_SelLayerFrame() { };
private: private:
void Sel_Layer( wxCommandEvent& event ); void Sel_Layer( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
/* Table des evenements pour WinEDA_SelLayerFrame */
BEGIN_EVENT_TABLE( WinEDA_SelLayerFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_SelLayerFrame, wxDialog )
EVT_BUTTON( wxID_OK, WinEDA_SelLayerFrame::Sel_Layer ) EVT_BUTTON( wxID_OK, WinEDA_SelLayerFrame::Sel_Layer )
EVT_BUTTON( wxID_CANCEL, WinEDA_SelLayerFrame::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, WinEDA_SelLayerFrame::OnCancelClick )
@ -51,31 +47,34 @@ BEGIN_EVENT_TABLE( WinEDA_SelLayerFrame, wxDialog )
END_EVENT_TABLE() 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 /** Install the dialog box for layer selection
* @param default_layer = Preselection (NB_LAYERS for "(Deselect)" layer) * @param default_layer = Preselection (NB_LAYERS for "(Deselect)" layer)
* @param min_layer = min layer value (-1 if no min value) * @param min_layer = min layer value (-1 if no min value)
* @param max_layer = max layer value (-1 if no max value) * @param max_layer = max layer value (-1 if no max value)
* @param null_layer = display a "(Deselect)" radiobutton (when set to true) * @param null_layer = display a "(Deselect)" radiobutton (when set to true)
* @return new layer value (NB_LAYERS when "(Deselect)" radiobutton selected), * @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 * Providing the option to also display a "(Deselect)" radiobutton makes the
* "Swap Layers" command (and GerbView's "Export to Pcbnew" command) more "user * "Swap Layers" command (and GerbView's "Export to Pcbnew" command) more "user
* friendly", by permitting any layer to be "deselected" immediately after its * friendly", by permitting any layer to be "deselected" immediately after its
* corresponding radiobutton has been clicked on. (It would otherwise be * corresponding radiobutton has been clicked on. (It would otherwise be
* necessary to first cancel the "Select Layer:" dialog box (invoked after a * 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). * 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; int layer;
WinEDA_SelLayerFrame* frame = WinEDA_SelLayerFrame* frame = new WinEDA_SelLayerFrame( this,
new WinEDA_SelLayerFrame( this, default_layer, min_layer, max_layer, null_layer ); default_layer,
min_layer,
max_layer,
null_layer );
layer = frame->ShowModal(); layer = frame->ShowModal();
frame->Destroy(); 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) * The "OK" and "Cancel" buttons are positioned (in a horizontal line)
* beneath the "Layer" radiobox, unless that contains only one column of * beneath the "Layer" radiobox, unless that contains only one column of
* radiobuttons, in which case they are positioned (in a vertical line) * radiobuttons, in which case they are positioned (in a vertical line)
* to the right of that radiobox. * 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(); BOARD* board = parent->GetBoard();
wxButton* Button; wxButton* Button;
int ii; 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; int LayerCount, LayerSelect = -1;
m_Parent = parent; m_Parent = parent;
/* Build the layer list */ /* Build the layer list */
LayerCount = 0; 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; Masque_Layer += ALL_NO_CU_LAYERS;
for( ii = 0; ii < NB_LAYERS; ii++ ) for( ii = 0; ii < NB_LAYERS; ii++ )
{ {
m_LayerId[ii] = 0; m_LayerId[ii] = 0;
if( (g_TabOneLayerMask[ii] & Masque_Layer) )
if( g_TabOneLayerMask[ii] & Masque_Layer )
{ {
if( min_layer > ii ) if( min_layer > ii )
continue; continue;
if( (max_layer >= 0) && (max_layer < ii) ) if( ( max_layer >= 0 ) && ( max_layer < ii ) )
break; break;
LayerList[LayerCount] = board->GetLayerName( ii ); LayerList[LayerCount] = board->GetLayerName( ii );
@ -129,6 +129,7 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent,
LayerCount++; LayerCount++;
} }
} }
// When appropriate, also provide a "(Deselect)" radiobutton // When appropriate, also provide a "(Deselect)" radiobutton
if( null_layer ) if( null_layer )
{ {
@ -140,35 +141,35 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent,
LayerCount++; LayerCount++;
} }
m_LayerList = new wxRadioBox( this, ID_LAYER_SELECT, _("Layer"), m_LayerList = new wxRadioBox( this, ID_LAYER_SELECT, _( "Layer" ),
wxPoint( -1, -1 ), wxSize( -1, -1 ), LayerCount, LayerList, wxPoint( -1, -1 ), wxSize( -1, -1 ),
(LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS ); LayerCount, LayerList,
(LayerCount < 8) ? LayerCount : 8,
wxRA_SPECIFY_ROWS );
if( LayerSelect >= 0 ) if( LayerSelect >= 0 )
m_LayerList->SetSelection( LayerSelect ); m_LayerList->SetSelection( LayerSelect );
wxBoxSizer* FrameBoxSizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* FrameBoxSizer = new wxBoxSizer( wxHORIZONTAL );
SetSizer(FrameBoxSizer); SetSizer( FrameBoxSizer );
FrameBoxSizer->Add(m_LayerList, 0, wxALIGN_TOP|wxALL, 5); FrameBoxSizer->Add( m_LayerList, 0, wxALIGN_TOP | wxALL, 5 );
wxBoxSizer* ButtonBoxSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* ButtonBoxSizer = new wxBoxSizer( wxVERTICAL );
FrameBoxSizer->Add(ButtonBoxSizer, 0, wxALIGN_BOTTOM|wxALL, 0); FrameBoxSizer->Add( ButtonBoxSizer, 0, wxALIGN_BOTTOM | wxALL, 0 );
Button = new wxButton( this, wxID_OK, _("OK") ); Button = new wxButton( this, wxID_OK, _( "OK" ) );
ButtonBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); ButtonBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button = new wxButton( this, wxID_CANCEL, _("Cancel") ); Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
ButtonBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); ButtonBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
if( GetSizer() ) if( GetSizer() )
{ {
GetSizer()->SetSizeHints(this); GetSizer()->SetSizeHints( this );
} }
} }
/***************************************************************/
void WinEDA_SelLayerFrame::Sel_Layer( wxCommandEvent& event ) void WinEDA_SelLayerFrame::Sel_Layer( wxCommandEvent& event )
/***************************************************************/
{ {
int ii = m_LayerId[m_LayerList->GetSelection()]; int ii = m_LayerId[m_LayerList->GetSelection()];
@ -176,17 +177,15 @@ void WinEDA_SelLayerFrame::Sel_Layer( wxCommandEvent& event )
} }
/***************************************************************/
void WinEDA_SelLayerFrame::OnCancelClick( wxCommandEvent& event ) void WinEDA_SelLayerFrame::OnCancelClick( wxCommandEvent& event )
/***************************************************************/
{ {
EndModal( -1 ); EndModal( -1 );
} }
/*********************************************************/ /*********************************************/
/* classe pour la frame de selection de paires de layers */ /* Dialog for the selecting pairs of layers. */
/*********************************************************/ /*********************************************/
class WinEDA_SelLayerPairFrame : public wxDialog class WinEDA_SelLayerPairFrame : public wxDialog
{ {
@ -196,43 +195,36 @@ private:
wxRadioBox* m_LayerListBOTTOM; wxRadioBox* m_LayerListBOTTOM;
int m_LayerId[NB_COPPER_LAYERS]; int m_LayerId[NB_COPPER_LAYERS];
public: public: WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent );
// Constructor and destructor
WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent );
~WinEDA_SelLayerPairFrame() { }; ~WinEDA_SelLayerPairFrame() { };
private: private:
void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
/* Table des evenements pour WinEDA_SelLayerPairFrame */
BEGIN_EVENT_TABLE( WinEDA_SelLayerPairFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_SelLayerPairFrame, wxDialog )
EVT_BUTTON( wxID_OK, WinEDA_SelLayerPairFrame::OnOkClick ) EVT_BUTTON( wxID_OK, WinEDA_SelLayerPairFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_SelLayerPairFrame::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, WinEDA_SelLayerPairFrame::OnCancelClick )
END_EVENT_TABLE() END_EVENT_TABLE()
/***********************************************/ /* Display a list of two copper layers for selection of a pair of layers
void WinEDA_BasePcbFrame::SelectLayerPair() * for auto-routing, vias ...
/***********************************************/
/* Affiche une double liste de layers cuivre pour selection d'une paire de layers
* pour autorutage, vias...
*/ */
void WinEDA_BasePcbFrame::SelectLayerPair()
{ {
// Check whether more than one copper layer has been enabled for the // Check whether more than one copper layer has been enabled for the
// current PCB file, as Layer Pairs can only meaningfully be defined // current PCB file, as Layer Pairs can only meaningfully be defined
// within PCB files which contain at least two copper layers. // within PCB files which contain at least two copper layers.
if( GetBoard()->m_BoardSettings->GetCopperLayerCount( ) < 2 ) if( GetBoard()->m_BoardSettings->GetCopperLayerCount() < 2 )
{ {
wxString InfoMsg; wxString InfoMsg;
InfoMsg = _( "Less than two copper layers are being used." ); 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 ); DisplayInfoMessage( this, InfoMsg );
return; return;
} }
@ -254,11 +246,9 @@ void WinEDA_BasePcbFrame::SelectLayerPair()
} }
/*******************************************************************************/
WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent ) : 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 ) wxSize( 470, 250 ), DIALOG_STYLE )
/*******************************************************************************/
{ {
BOARD* board = parent->GetBoard(); BOARD* board = parent->GetBoard();
wxButton* Button; wxButton* Button;
@ -269,9 +259,10 @@ WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent
m_Parent = parent; m_Parent = parent;
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen(); PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen();
/* Construction de la liste des couches autoris<69>s */ int Masque_Layer =
int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.GetCopperLayerCount( ) - 1]; g_TabAllCopperLayerMask[g_DesignSettings.GetCopperLayerCount() - 1];
Masque_Layer += ALL_NO_CU_LAYERS; Masque_Layer += ALL_NO_CU_LAYERS;
for( ii = 0, LayerCount = 0; ii < NB_COPPER_LAYERS; ii++ ) for( ii = 0, LayerCount = 0; ii < NB_COPPER_LAYERS; ii++ )
{ {
m_LayerId[ii] = 0; 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"), m_LayerListTOP = new wxRadioBox( this, ID_LAYER_SELECT_TOP,
wxPoint( -1, -1 ), wxSize( -1, -1 ), LayerCount, LayerList, _( "Top Layer" ),
(LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS ); wxPoint( -1, -1 ), wxSize( -1, -1 ),
LayerCount, LayerList,
(LayerCount < 8) ? LayerCount : 8,
wxRA_SPECIFY_ROWS );
m_LayerListTOP->SetSelection( LayerTopSelect ); m_LayerListTOP->SetSelection( LayerTopSelect );
m_LayerListBOTTOM = new wxRadioBox( this, ID_LAYER_SELECT_BOTTOM, _("Bottom Layer"), m_LayerListBOTTOM = new wxRadioBox( this, ID_LAYER_SELECT_BOTTOM,
wxPoint( -1, -1 ), wxSize( -1, -1 ), LayerCount, LayerList, _( "Bottom Layer" ),
(LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS ); wxPoint( -1, -1 ), wxSize( -1, -1 ),
LayerCount, LayerList,
(LayerCount < 8) ? LayerCount : 8,
wxRA_SPECIFY_ROWS );
m_LayerListBOTTOM->SetSelection( LayerBottomSelect ); m_LayerListBOTTOM->SetSelection( LayerBottomSelect );
wxBoxSizer* FrameBoxSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* FrameBoxSizer = new wxBoxSizer( wxVERTICAL );
SetSizer(FrameBoxSizer); SetSizer( FrameBoxSizer );
wxBoxSizer* RadioBoxSizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* RadioBoxSizer = new wxBoxSizer( wxHORIZONTAL );
FrameBoxSizer->Add(RadioBoxSizer, 0, wxALIGN_LEFT|wxALL, 0); FrameBoxSizer->Add( RadioBoxSizer, 0, wxALIGN_LEFT | wxALL, 0 );
wxBoxSizer* ButtonBoxSizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* ButtonBoxSizer = new wxBoxSizer( wxHORIZONTAL );
FrameBoxSizer->Add(ButtonBoxSizer, 0, wxALIGN_RIGHT|wxALL, 0); FrameBoxSizer->Add( ButtonBoxSizer, 0, wxALIGN_RIGHT | wxALL, 0 );
RadioBoxSizer->Add(m_LayerListTOP, 0, wxALIGN_TOP|wxALL, 5); RadioBoxSizer->Add( m_LayerListTOP, 0, wxALIGN_TOP | wxALL, 5 );
RadioBoxSizer->Add(m_LayerListBOTTOM, 0, wxALIGN_TOP|wxALL, 5); RadioBoxSizer->Add( m_LayerListBOTTOM, 0, wxALIGN_TOP | wxALL, 5 );
Button = new wxButton( this, wxID_OK, _("OK") ); Button = new wxButton( this, wxID_OK, _( "OK" ) );
ButtonBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); ButtonBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button = new wxButton( this, wxID_CANCEL, _("Cancel") ); Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
ButtonBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); ButtonBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
if( GetSizer() ) if( GetSizer() )
{ {
GetSizer()->SetSizeHints(this); GetSizer()->SetSizeHints( this );
} }
} }
/***************************************************************/
void WinEDA_SelLayerPairFrame::OnOkClick( wxCommandEvent& event ) 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 // but could be a mistake. So display an info message
if( m_LayerId[m_LayerListTOP->GetSelection()] if( m_LayerId[m_LayerListTOP->GetSelection()]
== m_LayerId[m_LayerListBOTTOM->GetSelection()] ) == m_LayerId[m_LayerListBOTTOM->GetSelection()] )
DisplayInfoMessage( this, _( "Warning: The Top Layer and Bottom Layer are same." ) ); DisplayInfoMessage( this,
_( "Warning: The Top Layer and Bottom Layer are same." ) );
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen(); PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen();
screen->m_Route_Layer_TOP = m_LayerId[m_LayerListTOP->GetSelection()]; 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 ); EndModal( 0 );
} }
/***************************************************************/
void WinEDA_SelLayerPairFrame::OnCancelClick( wxCommandEvent& event ) void WinEDA_SelLayerPairFrame::OnCancelClick( wxCommandEvent& event )
/***************************************************************/
{ {
EndModal( -1 ); EndModal( -1 );
} }

View File

@ -1,10 +1,6 @@
/***************************************************/ /************************************/
/* set_grid.cpp - Gestion de la grille utilisateur */ /* set_grid.cpp - manage user grid. */
/***************************************************/ /************************************/
/*
Affichage et modifications des parametres de travail de PcbNew
Parametres = dimensions de la grille utilisateur
*/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
@ -20,18 +16,17 @@
#include "set_grid.h" #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.SetGridSize( m_UserGridSize );
dlg.SetGridUnits( m_UserGridUnits ); dlg.SetGridUnits( m_UserGridUnits );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
m_UserGridSize = dlg.GetGridSize(); m_UserGridSize = dlg.GetGridSize();
m_UserGridUnits = dlg.GetGridUnits(); m_UserGridUnits = dlg.GetGridUnits();
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnits, ID_POPUP_GRID_USER ); 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 WinEDA_PcbGridFrame event table entries
END_EVENT_TABLE() END_EVENT_TABLE()
/*! /*!
* WinEDA_PcbGridFrame constructors * WinEDA_PcbGridFrame constructors
*/ */
WinEDA_PcbGridFrame::WinEDA_PcbGridFrame( ) WinEDA_PcbGridFrame::WinEDA_PcbGridFrame()
{ {
} }
WinEDA_PcbGridFrame::WinEDA_PcbGridFrame( WinEDA_BasePcbFrame* parent, WinEDA_PcbGridFrame::WinEDA_PcbGridFrame( WinEDA_BasePcbFrame* parent,
const wxPoint& pos, const wxPoint& pos,
wxWindowID id, wxWindowID id,
const wxString& caption, const wxString& caption,
const wxSize& size, long style ) const wxSize& size, long style )
{ {
Create(parent, id, caption, pos, size, style); Create( parent, id, caption, pos, size, style );
} }
/*! /*!
* WinEDA_PcbGridFrame creator * 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 ////@begin WinEDA_PcbGridFrame member initialisation
m_UnitGrid = NULL; m_UnitGrid = NULL;
m_OptGridSizeX = NULL; m_OptGridSizeX = NULL;
m_OptGridSizeY = NULL; m_OptGridSizeY = NULL;
////@end WinEDA_PcbGridFrame member initialisation ////@end WinEDA_PcbGridFrame member initialisation
////@begin WinEDA_PcbGridFrame creation ////@begin WinEDA_PcbGridFrame creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS); SetExtraStyle( wxWS_EX_BLOCK_EVENTS );
wxDialog::Create( parent, id, caption, pos, size, style ); wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls(); CreateControls();
if (GetSizer()) if( GetSizer() )
{ {
GetSizer()->SetSizeHints(this); GetSizer()->SetSizeHints( this );
} }
////@end WinEDA_PcbGridFrame creation ////@end WinEDA_PcbGridFrame creation
return true; return true;
} }
/*! /*!
* Control creation for WinEDA_PcbGridFrame * Control creation for WinEDA_PcbGridFrame
*/ */
@ -109,46 +113,79 @@ void WinEDA_PcbGridFrame::CreateControls()
WinEDA_PcbGridFrame* itemDialog1 = this; WinEDA_PcbGridFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxHORIZONTAL );
itemDialog1->SetSizer(itemBoxSizer2);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL); itemDialog1->SetSizer( itemBoxSizer2 );
itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxALL, 5);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer2->Add( itemBoxSizer3, 0, wxGROW | wxALL, 5 );
wxArrayString m_UnitGridStrings; wxArrayString m_UnitGridStrings;
m_UnitGridStrings.Add(_("Inches")); m_UnitGridStrings.Add( _( "Inches" ) );
m_UnitGridStrings.Add(_("mm")); m_UnitGridStrings.Add( _( "mm" ) );
m_UnitGrid = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Grid Size Units"), wxDefaultPosition, wxDefaultSize, m_UnitGridStrings, 1, wxRA_SPECIFY_COLS ); m_UnitGrid = new wxRadioBox( itemDialog1, ID_RADIOBOX,
m_UnitGrid->SetSelection(0); _( "Grid Size Units" ), wxDefaultPosition,
itemBoxSizer3->Add(m_UnitGrid, 0, wxGROW|wxALL, 5); 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 ); wxStaticText* itemStaticText6 = new wxStaticText( itemDialog1,
itemBoxSizer3->Add(itemStaticText6, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); 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 ); m_OptGridSizeX = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ),
itemBoxSizer3->Add(m_OptGridSizeX, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); 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 ); wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1,
itemBoxSizer3->Add(itemStaticText8, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); 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 ); m_OptGridSizeY = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T( "" ),
itemBoxSizer3->Add(m_OptGridSizeY, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer3->Add( m_OptGridSizeY,
0,
wxGROW | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL); wxBoxSizer* itemBoxSizer10 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer2->Add(itemBoxSizer10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); 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(); 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 ); wxButton* itemButton12 = new wxButton( itemDialog1, wxID_CANCEL,
itemBoxSizer10->Add(itemButton12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); _( "&Cancel" ), wxDefaultPosition,
wxDefaultSize, 0 );
itemBoxSizer10->Add( itemButton12, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
////@end WinEDA_PcbGridFrame content construction ////@end WinEDA_PcbGridFrame content construction
} }
/*! /*!
* Should we show tooltips? * Should we show tooltips?
*/ */
@ -158,6 +195,7 @@ bool WinEDA_PcbGridFrame::ShowToolTips()
return true; return true;
} }
/*! /*!
* Get bitmap resources * Get bitmap resources
*/ */
@ -166,11 +204,13 @@ wxBitmap WinEDA_PcbGridFrame::GetBitmapResource( const wxString& name )
{ {
// Bitmap retrieval // Bitmap retrieval
////@begin WinEDA_PcbGridFrame bitmap retrieval ////@begin WinEDA_PcbGridFrame bitmap retrieval
wxUnusedVar(name); wxUnusedVar( name );
return wxNullBitmap; return wxNullBitmap;
////@end WinEDA_PcbGridFrame bitmap retrieval ////@end WinEDA_PcbGridFrame bitmap retrieval
} }
/*! /*!
* Get icon resources * Get icon resources
*/ */
@ -179,8 +219,9 @@ wxIcon WinEDA_PcbGridFrame::GetIconResource( const wxString& name )
{ {
// Icon retrieval // Icon retrieval
////@begin WinEDA_PcbGridFrame icon retrieval ////@begin WinEDA_PcbGridFrame icon retrieval
wxUnusedVar(name); wxUnusedVar( name );
return wxNullIcon; return wxNullIcon;
////@end WinEDA_PcbGridFrame icon retrieval ////@end WinEDA_PcbGridFrame icon retrieval
} }
@ -189,31 +230,34 @@ void WinEDA_PcbGridFrame::SetGridSize( const wxRealPoint& grid )
{ {
wxString msg; wxString msg;
msg.Printf( wxT( "%.4f" ), grid.x ); msg.Printf( wxT( "%.4f" ), grid.x );
m_OptGridSizeX->SetValue( msg ); m_OptGridSizeX->SetValue( msg );
msg.Printf( wxT( "%.4f" ), grid.y ); msg.Printf( wxT( "%.4f" ), grid.y );
m_OptGridSizeY->SetValue( msg ); m_OptGridSizeY->SetValue( msg );
} }
wxRealPoint WinEDA_PcbGridFrame::GetGridSize() wxRealPoint WinEDA_PcbGridFrame::GetGridSize()
{ {
wxRealPoint grid; wxRealPoint grid;
/* TODO: Some error checking here would be a good thing. */ /* TODO: Some error checking here would be a good thing. */
m_OptGridSizeX->GetValue().ToDouble( &grid.x ); m_OptGridSizeX->GetValue().ToDouble( &grid.x );
m_OptGridSizeY->GetValue().ToDouble( &grid.y ); m_OptGridSizeY->GetValue().ToDouble( &grid.y );
return grid; return grid;
} }
void WinEDA_PcbGridFrame::SetGridUnits( int units ) void WinEDA_PcbGridFrame::SetGridUnits( int units )
{ {
if ( units != INCHES ) if( units != INCHES )
m_UnitGrid->SetSelection( 1 ); m_UnitGrid->SetSelection( 1 );
} }
int WinEDA_PcbGridFrame::GetGridUnits() 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 "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -16,22 +16,20 @@
#define Pad_fill (Pad_Fill_Item.State == RUN) #define Pad_fill (Pad_Fill_Item.State == RUN)
/*********************************************************/
void WinEDA_PcbFrame::ListNetsAndSelect( wxCommandEvent& event )
/*********************************************************/
/** Function ListNetsAndSelect /** Function ListNetsAndSelect
* called by a command event * called by a command event
* displays the sorted list of nets in a dialog frame * 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; NETINFO_ITEM* net;
wxString netFilter; wxString netFilter;
int selection; int selection;
netFilter = wxT( "*" ); 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() ) if( netFilter.IsEmpty() )
return; return;
@ -45,7 +43,7 @@ void WinEDA_PcbFrame::ListNetsAndSelect( wxCommandEvent& event )
continue; continue;
Line.Printf( wxT( "net_code = %3.3d [%.16s] " ), net->GetNet(), Line.Printf( wxT( "net_code = %3.3d [%.16s] " ), net->GetNet(),
GetChars( net->GetNetname() ) ); GetChars( net->GetNetname() ) );
List.Append( Line ); 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 ) 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 ) if( g_HightLigt_Status )
Hight_Light( DC ); 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 * Highlight command.
* Met ou supprime la surbrillance d'un net pointe par la souris *
* Show or removes the net at the current cursor position.
*/ */
void WinEDA_PcbFrame::Hight_Light( wxDC* DC )
{ {
g_HightLigt_Status = !g_HightLigt_Status; g_HightLigt_Status = !g_HightLigt_Status;

View File

@ -15,11 +15,12 @@
#include "wx/statline.h" #include "wx/statline.h"
/* Variables locales */
#define LAYER_NO_CHANGE NB_LAYERS #define LAYER_NO_CHANGE NB_LAYERS
static int New_Layer[NB_LAYERS]; static int New_Layer[NB_LAYERS];
wxStaticText* layer_list[NB_LAYERS]; wxStaticText* layer_list[NB_LAYERS];
enum swap_layer_id { enum swap_layer_id {
ID_WINEDA_SWAPLAYERFRAME = 1800, ID_WINEDA_SWAPLAYERFRAME = 1800,
ID_BUTTON_0, ID_BUTTON_0,
@ -27,10 +28,6 @@ enum swap_layer_id {
}; };
/***********************************************/
/* classe pour la frame de selection de layers */
/***********************************************/
class WinEDA_SwapLayerFrame : public wxDialog class WinEDA_SwapLayerFrame : public wxDialog
{ {
private: private:
@ -46,7 +43,6 @@ private:
public: public:
// Constructor and destructor
WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame* parent ); WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame* parent );
~WinEDA_SwapLayerFrame() { }; ~WinEDA_SwapLayerFrame() { };
@ -58,7 +54,7 @@ private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
/* Table des evenements pour WinEDA_SwapLayerFrame */
BEGIN_EVENT_TABLE( WinEDA_SwapLayerFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_SwapLayerFrame, wxDialog )
EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + NB_LAYERS - 1, EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + NB_LAYERS - 1,
wxEVT_COMMAND_BUTTON_CLICKED, wxEVT_COMMAND_BUTTON_CLICKED,
@ -72,7 +68,6 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame* parent ) :
wxDialog( parent, -1, _( "Swap Layers:" ), wxPoint( -1, -1 ), wxDialog( parent, -1, _( "Swap Layers:" ), wxPoint( -1, -1 ),
wxDefaultSize, wxDEFAULT_DIALOG_STYLE | MAYBE_RESIZE_BORDER ) wxDefaultSize, wxDEFAULT_DIALOG_STYLE | MAYBE_RESIZE_BORDER )
{ {
/*************************************************************************/
BOARD* board = parent->GetBoard(); BOARD* board = parent->GetBoard();
OuterBoxSizer = NULL; OuterBoxSizer = NULL;
@ -357,7 +352,7 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event )
if( ii != 1 ) if( ii != 1 )
return; // (Canceled dialog box returns -1 instead) return; // (Canceled dialog box returns -1 instead)
/* Modifications des pistes */ /* Change traces. */
pt_segm = GetBoard()->m_Track; pt_segm = GetBoard()->m_Track;
for( ; pt_segm != NULL; pt_segm = pt_segm->Next() ) 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() ) for( pt_segm = GetBoard()->m_Zone; pt_segm; pt_segm = pt_segm->Next() )
{ {
GetScreen()->SetModify(); GetScreen()->SetModify();
@ -394,7 +389,7 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event )
pt_segm->SetLayer( New_Layer[jj] ); pt_segm->SetLayer( New_Layer[jj] );
} }
/* Modifications des autres segments */ /* Change other segments. */
PtStruct = GetBoard()->m_Drawings; PtStruct = GetBoard()->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) 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" #include "fctsys.h"
@ -22,10 +22,9 @@
#define LISTBOX_WIDTH 120 #define LISTBOX_WIDTH 120
#endif #endif
/***************************************************/
void WinEDA_ModuleEditFrame::ReCreateHToolbar()
/***************************************************/
/* Create the main horizontal toolbar for the footprint editor */ /* Create the main horizontal toolbar for the footprint editor */
void WinEDA_ModuleEditFrame::ReCreateHToolbar()
{ {
if( m_HToolBar != NULL ) if( m_HToolBar != NULL )
return; return;
@ -140,9 +139,7 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
} }
/********************************************************/
void WinEDA_ModuleEditFrame::ReCreateVToolbar() void WinEDA_ModuleEditFrame::ReCreateVToolbar()
/********************************************************/
{ {
if( m_VToolBar ) if( m_VToolBar )
return; return;
@ -192,14 +189,12 @@ void WinEDA_ModuleEditFrame::ReCreateVToolbar()
} }
/*********************************************************/
void WinEDA_ModuleEditFrame::ReCreateOptToolbar() void WinEDA_ModuleEditFrame::ReCreateOptToolbar()
/*********************************************************/
{ {
if( m_OptionsToolBar ) if( m_OptionsToolBar )
return; return;
// creation du tool bar options // Create options tool bar.
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this,
ID_OPT_TOOLBAR, FALSE ); ID_OPT_TOOLBAR, FALSE );
@ -245,9 +240,7 @@ void WinEDA_ModuleEditFrame::ReCreateOptToolbar()
} }
/*********************************************************/
void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar() void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
/*********************************************************/
{ {
size_t i; size_t i;
wxString msg; wxString msg;
@ -260,14 +253,14 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
// Set up toolbar // Set up toolbar
m_AuxiliaryToolBar->AddSeparator(); m_AuxiliaryToolBar->AddSeparator();
// Boite de selection du pas de grille // Grid selection choice box.
m_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar, m_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_GRID_SELECT, ID_ON_GRID_SELECT,
wxPoint( -1, -1 ), wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) ); wxSize( LISTBOX_WIDTH, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelGridBox ); m_AuxiliaryToolBar->AddControl( m_SelGridBox );
// Boite de selection du Zoom // Zoom selection choice box.
m_AuxiliaryToolBar->AddSeparator(); m_AuxiliaryToolBar->AddSeparator();
m_SelZoomBox = new WinEDAChoiceBox( m_AuxiliaryToolBar, m_SelZoomBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_ZOOM_SELECT, ID_ON_ZOOM_SELECT,
@ -298,7 +291,7 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
m_AuxiliaryToolBar->Realize(); m_AuxiliaryToolBar->Realize();
} }
// mise a jour des affichages // Update tool bar to reflect setting.
m_SelGridBox->Clear(); m_SelGridBox->Clear();
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ ) 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 "fctsys.h"
#include "common.h" #include "common.h"
@ -12,9 +12,7 @@
#include "pcbnew_id.h" #include "pcbnew_id.h"
/*****************************************************************/
void WinEDA_PcbFrame::ToolOnRightClick( wxCommandEvent& event ) void WinEDA_PcbFrame::ToolOnRightClick( wxCommandEvent& event )
/*****************************************************************/
{ {
wxPoint pos; wxPoint pos;
int id = event.GetSelection(); int id = event.GetSelection();
@ -49,9 +47,7 @@ void WinEDA_PcbFrame::ToolOnRightClick( wxCommandEvent& event )
} }
/************************************************************************/
void WinEDA_ModuleEditFrame::ToolOnRightClick( wxCommandEvent& event ) void WinEDA_ModuleEditFrame::ToolOnRightClick( wxCommandEvent& event )
/************************************************************************/
{ {
wxPoint pos; wxPoint pos;
int id = event.GetSelection(); 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" #include "fctsys.h"
@ -34,7 +34,8 @@ static wxBitmap* LayerPairBitmap = NULL;
static const char s_BitmapLayerIcon[16][16] = { static const char s_BitmapLayerIcon[16][16] = {
// 0 = draw pixel with active layer color // 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 // 2 = draw pixel with bottom layer color
// 3 = draw pixel with via color // 3 = draw pixel with via color
{ 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 1, 1, 1, 1, 0, 0 }, { 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 /* Draw the icon for the "Select layer pair" bitmap tool
*/ */
void WinEDA_PcbFrame::PrepareLayerIndicator()
{ {
int ii, jj; int ii, jj;
int active_layer_color, Route_Layer_TOP_color, int active_layer_color, Route_Layer_TOP_color,
@ -106,8 +104,8 @@ void WinEDA_PcbFrame::PrepareLayerIndicator()
LayerPairBitmap = new wxBitmap( 16, 16 ); LayerPairBitmap = new wxBitmap( 16, 16 );
} }
/* Draw the icon, with colors according to the active layer and layer pairs for /* Draw the icon, with colors according to the active layer and layer
* via command (change layer) * pairs for via command (change layer)
*/ */
wxMemoryDC iconDC; wxMemoryDC iconDC;
iconDC.SelectObject( *LayerPairBitmap ); 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 /* Creates or updates the main horizontal toolbar for the board editor
*/ */
void WinEDA_PcbFrame::ReCreateHToolbar()
{ {
wxString msg; wxString msg;
@ -272,19 +267,20 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ), m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ),
_( "Read netlist" ) ); _( "Read netlist" ) );
m_HToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, wxBitmap( erc_xpm ), m_HToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, wxBitmap( erc_xpm ),
_( "Pcb Design Rules Check" ) ); _( "Perform design rules check" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
ReCreateLayerBox( m_HToolBar ); 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, m_HToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, wxEmptyString,
*LayerPairBitmap, SEL_LAYER_HELP ); *LayerPairBitmap, SEL_LAYER_HELP );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TOOLBARH_PCB_AUTOPLACE, wxEmptyString, m_HToolBar->AddTool( ID_TOOLBARH_PCB_AUTOPLACE, wxEmptyString,
wxBitmap( mode_module_xpm ), wxBitmap( mode_module_xpm ),
_( "Mode Module: Manual and Automatic Move or Place for modules" ), _( "Manual and automatic move or place of modules" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_HToolBar->AddTool( ID_TOOLBARH_PCB_AUTOROUTE, wxEmptyString, m_HToolBar->AddTool( ID_TOOLBARH_PCB_AUTOROUTE, wxEmptyString,
wxBitmap( mode_track_xpm ), wxBitmap( mode_track_xpm ),
@ -306,28 +302,24 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
} }
/*********************************************/
void WinEDA_PcbFrame::ReCreateOptToolbar() void WinEDA_PcbFrame::ReCreateOptToolbar()
/*********************************************/
// Create the left vertical toolbar (option selections)
{ {
if( m_OptionsToolBar ) if( m_OptionsToolBar )
return; return;
// creation du tool bar options
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this,
ID_OPT_TOOLBAR, FALSE ); ID_OPT_TOOLBAR, FALSE );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_DRC_OFF, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_DRC_OFF, wxEmptyString,
wxBitmap( drc_off_xpm ), wxBitmap( drc_off_xpm ),
_( "Drc OFF" ), wxITEM_CHECK ); _( "Enable design rule checking" ),
wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
wxBitmap( grid_xpm ), wxBitmap( grid_xpm ),
_( "Display Grid OFF" ), wxITEM_CHECK ); _( "Hide grid" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
wxBitmap( polar_coord_xpm ), 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, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
wxBitmap( unit_inch_xpm ), wxBitmap( unit_inch_xpm ),
_( "Units in inches" ), wxITEM_CHECK ); _( "Units in inches" ), wxITEM_CHECK );
@ -336,60 +328,66 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
_( "Units in millimeters" ), wxITEM_CHECK ); _( "Units in millimeters" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
wxBitmap( cursor_shape_xpm ), wxBitmap( cursor_shape_xpm ),
_( "Change Cursor Shape" ), wxITEM_CHECK ); _( "Change cursor shape" ), wxITEM_CHECK );
m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_RATSNEST, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_RATSNEST, wxEmptyString,
wxBitmap( general_ratsnet_xpm ), wxBitmap( general_ratsnet_xpm ),
_( "Show General Ratsnest" ), wxITEM_CHECK ); _( "Show board ratsnest" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST, wxEmptyString,
wxBitmap( local_ratsnet_xpm ), wxBitmap( local_ratsnet_xpm ),
_( "Show Module Ratsnest when moving" ), _( "Show module ratsnest when moving" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_AUTO_DEL_TRACK, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_AUTO_DEL_TRACK, wxEmptyString,
wxBitmap( auto_delete_track_xpm ), wxBitmap( auto_delete_track_xpm ),
_( "Enable Auto Del Track" ), wxITEM_CHECK ); _( "Enable automatic track deletion" ),
wxITEM_CHECK );
m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString, m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString,
wxBitmap( show_zone_xpm ), wxNullBitmap, wxBitmap( show_zone_xpm ), wxNullBitmap,
_( "Show filled areas in zones" ) ); _( "Show filled areas in zones" ) );
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, wxEmptyString, m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE,
wxBitmap( show_zone_disable_xpm ), wxNullBitmap, wxEmptyString,
wxBitmap( show_zone_disable_xpm ),
wxNullBitmap,
_( "Do not show filled areas in zones" )); _( "Do not show filled areas in zones" ));
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, wxEmptyString, m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
wxBitmap( show_zone_outline_only_xpm ), wxNullBitmap, wxEmptyString,
wxBitmap( show_zone_outline_only_xpm ),
wxNullBitmap,
_( "Show outlines of filled areas only in zones" ) ); _( "Show outlines of filled areas only in zones" ) );
m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
wxBitmap( pad_sketch_xpm ), 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, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, wxEmptyString,
wxBitmap( via_sketch_xpm ), 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, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, wxEmptyString,
wxBitmap( showtrack_xpm ), 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, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
wxEmptyString, wxEmptyString,
wxBitmap( palette_xpm ), wxBitmap( palette_xpm ),
_( "High Contrast Mode Display" ), _( "Enable high contrast display mode" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
DisplayOpt.ContrastModeDisplay ); DisplayOpt.ContrastModeDisplay );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
wxEmptyString, wxEmptyString,
wxBitmap( invisible_text_xpm ), wxBitmap( invisible_text_xpm ),
_( "Show Invisible Text" ), _( "Show invisible text" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE, 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 #ifdef MUWAVE_ENBL
@ -408,12 +406,9 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
} }
/********************************************/
void WinEDA_PcbFrame::ReCreateVToolbar()
/********************************************/
/* Create the main vertical right toolbar, showing usual tools /* Create the main vertical right toolbar, showing usual tools
*/ */
void WinEDA_PcbFrame::ReCreateVToolbar()
{ {
if( m_VToolBar ) if( m_VToolBar )
return; return;
@ -490,12 +485,10 @@ void WinEDA_PcbFrame::ReCreateVToolbar()
} }
/*********************************************/ /* Create the auxiliary vertical right toolbar, showing tools for
void WinEDA_PcbFrame::ReCreateAuxVToolbar() * microwave applications
/*********************************************/
/* Create the auxiliary vertical right toolbar, showing tools for microwave applications
*/ */
void WinEDA_PcbFrame::ReCreateAuxVToolbar()
{ {
if( m_AuxVToolBar ) if( m_AuxVToolBar )
return; return;
@ -533,10 +526,6 @@ void WinEDA_PcbFrame::ReCreateAuxVToolbar()
} }
/****************************************************/
void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
/****************************************************/
/* Creates auxiliary horizontal toolbar /* Creates auxiliary horizontal toolbar
* displays: * displays:
* existing track width choice * existing track width choice
@ -546,6 +535,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
* grid size choice * grid size choice
* zoom level choice * zoom level choice
*/ */
void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
{ {
size_t i; size_t i;
wxString msg; wxString msg;
@ -676,16 +666,13 @@ an existing track use its width\notherwise, use current width setting" ),
} }
/**************************************************************************/
void WinEDA_PcbFrame::UpdateToolbarLayerInfo() void WinEDA_PcbFrame::UpdateToolbarLayerInfo()
/**************************************************************************/
{ {
wxASSERT( m_SelLayerBox ); wxASSERT( m_SelLayerBox );
// Activation de l'affichage sur la bonne couche // Enable the display on the correct layer
// Pour eviter la reentrance (Bug wxGTK version Linux?), la selection n'est faite que si // To avoid reentrancy ( Bug wxGTK Linux version? ), the selection is
// elle est mauvaise (Pb corrige sur wxGTK 2.6.0) // made where it is bad ( corrected on wxGTK 2.6.0 )
int count = m_SelLayerBox->GetCount(); int count = m_SelLayerBox->GetCount();
int choice = m_SelLayerBox->GetChoice(); int choice = m_SelLayerBox->GetChoice();
int layer = GetScreen()->m_Active_Layer; int layer = GetScreen()->m_Active_Layer;
@ -702,9 +689,7 @@ void WinEDA_PcbFrame::UpdateToolbarLayerInfo()
} }
/**************************************************************************/
WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent ) WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
/**************************************************************************/
{ {
if( m_SelLayerBox == NULL ) if( m_SelLayerBox == NULL )
{ {
@ -716,7 +701,8 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
wxPoint( -1, -1 ), wxPoint( -1, -1 ),
#if defined (__UNIX__) #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? // Maybe that string is too long?
wxSize( 230, -1 ) wxSize( 230, -1 )
#else #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 * 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 * Enable or disable the toolbar's controls, depending on the current
* en cours * 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; bool state;
@ -186,11 +187,9 @@ void WinEDA_PcbFrame::SetToolbars()
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_DRC_OFF, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_DRC_OFF,
!Drc_On ); !Drc_On );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF,
Drc_On ? Drc_On ?
_( _( "Disable design rule checking" ) :
"DRC Off (Disable !!!), Currently: DRC is active" ) _( "Enable design rule checking" ) );
:
_( "DRC On (Currently: DRC is inactive !!!)" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UnitMetric == MILLIMETRE ? TRUE : false ); g_UnitMetric == MILLIMETRE ? TRUE : false );
@ -200,14 +199,16 @@ void WinEDA_PcbFrame::SetToolbars()
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood ); DisplayOpt.DisplayPolarCood );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood ? DisplayOpt.DisplayPolarCood ?
_( "Polar coords not show" ) : _( "Display rectangular coordinates" ) :
_( "Display polar coords" ) ); _( "Display polar coordinates" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid ); m_Draw_Grid );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_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_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR,
m_CursorShape ); m_CursorShape );
@ -215,62 +216,62 @@ void WinEDA_PcbFrame::SetToolbars()
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_RATSNEST, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_RATSNEST,
g_Show_Ratsnest ); g_Show_Ratsnest );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_RATSNEST, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_RATSNEST,
g_Show_Ratsnest ? g_Show_Ratsnest ?
_( "Hide general ratsnest" ) : _( "Hide board ratsnest" ) :
_( "Show general ratsnest" ) ); _( "Show board ratsnest" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
g_Show_Module_Ratsnest ); g_Show_Module_Ratsnest );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
g_Show_Module_Ratsnest ? g_Show_Module_Ratsnest ?
_( "Hide module ratsnest" ) : _( "Hide module ratsnest" ) :
_( "Show module ratsnest" ) ); _( "Show module ratsnest" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_AUTO_DEL_TRACK, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_AUTO_DEL_TRACK,
g_AutoDeleteOldTrack ); g_AutoDeleteOldTrack );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_AUTO_DEL_TRACK, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_AUTO_DEL_TRACK,
g_AutoDeleteOldTrack ? g_AutoDeleteOldTrack ?
_( "Disable auto delete old track" ) : _( "Disable auto delete old track" ) :
_( "Enable auto delete old track" ) ); _( "Enable auto delete old track" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
!m_DisplayPadFill ); !m_DisplayPadFill );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
m_DisplayPadFill ? m_DisplayPadFill ?
_( "Show pads sketch mode" ) : _( "Show pads in outline mode" ) :
_( "Show pads filled mode" ) ); _( "Show pads in fill mode" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
!m_DisplayViaFill ); !m_DisplayViaFill );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
m_DisplayViaFill ? m_DisplayViaFill ?
_( "Show vias sketch mode" ) : _( "Show vias in outline mode" ) :
_( "Show vias filled mode" ) ); _( "Show vias in fill mode" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
!m_DisplayPcbTrackFill ); !m_DisplayPcbTrackFill );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
m_DisplayPcbTrackFill ? m_DisplayPcbTrackFill ?
_( "Show tracks sketch mode" ) : _( "Show tracks in outline mode" ) :
_( "Show tracks filled mode" ) ); _( "Show tracks in fill mode" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
DisplayOpt.ContrastModeDisplay ); DisplayOpt.ContrastModeDisplay );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
DisplayOpt.ContrastModeDisplay ? DisplayOpt.ContrastModeDisplay ?
_( "Normal contrast mode display" ) : _( "Normal contrast display mode" ) :
_( "High contrast mode display" ) ); _( "High contrast display mode" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ) ); g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ) );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ) ? g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ) ?
_( "Hide invisible text" ) : _( "Hide invisible text" ) :
_( "Show invisible text" ) ); _( "Show invisible text" ) );
#if !defined(KICAD_AUIMANAGER) #if !defined(KICAD_AUIMANAGER)
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,

View File

@ -1,7 +1,6 @@
/**************************************************/ /******************/
/* Edition des pistes */ /* Trace editing. */
/* Routines de modification automatique de pistes */ /******************/
/**************************************************/
#include "fctsys.h" #include "fctsys.h"
@ -13,109 +12,113 @@
/** function EraseRedundantTrack /** function EraseRedundantTrack
* Called after creating a track * 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 * Remove (if exists) the old track that have the same starting and the same
* (this is the redunding track) * ending point as the new created track (this is the redunding track)
* @param aDC = the current device context (can be NULL) * @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 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 TRACK* StartTrack, * EndTrack;
* (extremites) de la nouvelle piste */
TRACK* pt_segm; TRACK* pt_segm;
TRACK* pt_del; TRACK* pt_del;
int ii, jj, nb_segm, nbconnect; int ii, jj, nb_segm, nbconnect;
wxPoint start; /* coord du point de depart de la piste */ wxPoint start;
wxPoint end; /* coord du point de fin de la piste */ wxPoint end;
int startmasklayer, endmasklayer; /* masque couche de depart et de fin */ int startmasklayer, endmasklayer;
TRACK* BufDeb, * BufEnd; /* Pointeurs de debut et de fin de la zone TRACK* BufDeb, * BufEnd;
* des pistes equipotentielles */
int netcode = aNewTrack->GetNet(); int netcode = aNewTrack->GetNet();
/* Reconstitution de la piste complete ( la nouvelle piste /* Reconstruct the complete track (the new track has to start on a
* a pu demarrer sur un segment de piste en l'air * segment of track).
*/ */
ListSetState( aNewTrack, aNewTrackSegmentsCount, BUSY, OFF ); ListSetState( aNewTrack, aNewTrackSegmentsCount, BUSY, OFF );
/* si la nouvelle piste commence par une via, il est plus sur de rechercher /* If the new track begins with a via, complete the track segment using
* la piste complete en utilisant le segment suivant comme reference, car * the following segment as a reference because a via is often a hub of
* une via est souvent sur un carrefour de segments, et ne caracterise pas * segments, and does not characterize track.
* une piste */ */
if( aNewTrack->Type() == TYPE_VIA && (aNewTrackSegmentsCount > 1 ) ) if( aNewTrack->Type() == TYPE_VIA && ( aNewTrackSegmentsCount > 1 ) )
aNewTrack = aNewTrack->Next(); aNewTrack = aNewTrack->Next();
aNewTrack = Marque_Une_Piste( GetBoard(), aNewTrack, &aNewTrackSegmentsCount, NULL, true ); aNewTrack = Marque_Une_Piste( GetBoard(), aNewTrack,
&aNewTrackSegmentsCount, NULL, true );
wxASSERT( aNewTrack ); wxASSERT( aNewTrack );
#if 0 && defined(DEBUG) #if 0 && defined(DEBUG)
TRACK* EndNewTrack; /* Pointeur sur le dernier segment de la liste TRACK* EndNewTrack; /* The last segment of the list chained to
* chainee de la mouvelle piste */ * the track */
EndNewTrack = aNewTrack; EndNewTrack = aNewTrack;
for( ii = 1; ii < aNewTrackSegmentsCount; ii++ ) for( ii = 1; ii < aNewTrackSegmentsCount; ii++ )
{ {
wxASSERT( EndNewTrack->GetState(-1) != 0 ); wxASSERT( EndNewTrack->GetState( -1 ) != 0 );
D(printf("track %p is newly part of net %d\n", EndNewTrack, netcode );) D( printf( "track %p is newly part of net %d\n", EndNewTrack,
netcode ); )
EndNewTrack = EndNewTrack->Next(); EndNewTrack = EndNewTrack->Next();
} }
wxASSERT( EndNewTrack->GetState(-1) != 0 ); wxASSERT( EndNewTrack->GetState( -1 ) != 0 );
D(printf("track %p is newly part of net %d\n", EndNewTrack, netcode );) D( printf( "track %p is newly part of net %d\n", EndNewTrack, netcode ); )
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() ) for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
track->Show( 0, std::cout ); track->Show( 0, std::cout );
#endif #endif
/* Calcul des limites de recherche des segments de piste */ /* Calculate search in terms of segments of track, 1st edge BufDeb useful
/* BufDeb pointe le 1er segment utile */ * segment. */
BufDeb = m_Pcb->m_Track->GetStartNetCode( netcode ); BufDeb = m_Pcb->m_Track->GetStartNetCode( netcode );
/* BufEnd Pointe le dernier segment */ /* Point BufEnd the last segment. */
BufEnd = BufDeb->GetEndNetCode( netcode ); 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() ) 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 ); pt_del->SetState( BUSY | EDIT | CHAIN, OFF );
if( pt_del == BufEnd ) // Last segment reached if( pt_del == BufEnd ) // Last segment reached
break; break;
} }
/* Calcul des points limites de la nouvelle piste */
if( ReturnEndsTrack( aNewTrack, aNewTrackSegmentsCount, if( ReturnEndsTrack( aNewTrack, aNewTrackSegmentsCount,
&StartTrack, &EndTrack ) == 0 ) &StartTrack, &EndTrack ) == 0 )
return 0; return 0;
if( (StartTrack == NULL) || (EndTrack == NULL) ) if( ( StartTrack == NULL ) || ( EndTrack == NULL ) )
return 0; return 0;
/* Calcul des caracteristiques des points de debut et de fin */
start = StartTrack->m_Start; start = StartTrack->m_Start;
end = EndTrack->m_End; 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 ) if( start == end )
return 0; return 0;
/* Determinations des couches interconnectees a ces points */ /* Determine layers interconnected these points. */
startmasklayer = StartTrack->ReturnMaskLayer(); startmasklayer = StartTrack->ReturnMaskLayer();
endmasklayer = EndTrack->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 ); pt_segm = Fast_Locate_Via( m_Pcb->m_Track, NULL, start, startmasklayer );
if( pt_segm ) if( pt_segm )
startmasklayer |= pt_segm->ReturnMaskLayer(); startmasklayer |= pt_segm->ReturnMaskLayer();
if( StartTrack->start && (StartTrack->start->Type() == TYPE_PAD) ) if( StartTrack->start && ( StartTrack->start->Type() == TYPE_PAD ) )
{ {
/* start sur pad */ /* Start on pad. */
D_PAD* pt_pad = (D_PAD*) (StartTrack->start); D_PAD* pt_pad = (D_PAD*)(StartTrack->start);
startmasklayer |= pt_pad->m_Masque_Layer; startmasklayer |= pt_pad->m_Masque_Layer;
} }
@ -123,33 +126,33 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
if( pt_segm ) if( pt_segm )
endmasklayer |= pt_segm->ReturnMaskLayer(); 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; endmasklayer |= pt_pad->m_Masque_Layer;
} }
/* Marquage a DELETED de la piste nouvelle (qui ne doit pas intervenir /* Mark as deleted a new track (which is not involved in the search for
* dans la recherche d'autres connexions) * other connections)
*/ */
ListSetState( aNewTrack, aNewTrackSegmentsCount, DELETED, ON ); ListSetState( aNewTrack, aNewTrackSegmentsCount, DELETED, ON );
/* test : un segment doit etre connecte au point de depart car sinon /* A segment must be connected to the starting point, otherwise
* il est inutile d'analyser l'autre point * it is unnecessary to analyze the other point
*/ */
pt_segm = Fast_Locate_Piste( BufDeb, BufEnd, start, startmasklayer ); 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 ); ListSetState( aNewTrack, aNewTrackSegmentsCount, DELETED, OFF );
return 0; return 0;
} }
/* Marquage a CHAIN des segments candidats connectes au point de fin /* Marking a list of candidate segmented connect to endpoint
* Remarque: les vias ne sont pas prises en compte car elles ne permettent * Note: the vias are not taken into account because they do
* pas de definir une piste, puisque elles sont sur un carrefour */ * not define a track, since they are on an intersection.
*/
for( pt_del = BufDeb, nbconnect = 0; ; ) for( pt_del = BufDeb, nbconnect = 0; ; )
{ {
pt_segm = Fast_Locate_Piste( pt_del, BufEnd, end, endmasklayer ); 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 ) if( pt_segm->Type() != TYPE_VIA )
{ {
/* Segment trouve */
if( pt_segm->GetState( CHAIN ) == 0 ) if( pt_segm->GetState( CHAIN ) == 0 )
{ {
pt_segm->SetState( CHAIN, ON ); pt_segm->SetState( CHAIN, ON );
@ -173,7 +175,7 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
if( nbconnect == 0 ) if( nbconnect == 0 )
{ {
/* Clear used flagss */ /* Clear used flags */
for( pt_del = BufDeb; pt_del; pt_del = pt_del->Next() ) for( pt_del = BufDeb; pt_del; pt_del = pt_del->Next() )
{ {
pt_del->SetState( BUSY | DELETED | EDIT | CHAIN, OFF ); pt_del->SetState( BUSY | DELETED | EDIT | CHAIN, OFF );
@ -184,13 +186,13 @@ int WinEDA_PcbFrame::EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewT
return 0; return 0;
} }
/* Marquage a EDIT de la piste nouvelle (qui ne doit pas intervenir /* Mark trace as edited (which does not involve searching for other
* dans la recherche d'autres pistes) */ * tracks)
*/
ListSetState( aNewTrack, aNewTrackSegmentsCount, DELETED, OFF ); ListSetState( aNewTrack, aNewTrackSegmentsCount, DELETED, OFF );
ListSetState( aNewTrack, aNewTrackSegmentsCount, EDIT, ON ); ListSetState( aNewTrack, aNewTrackSegmentsCount, EDIT, ON );
/* Examen de tous les segments marques */ /* Test all marked segments. */
while( nbconnect ) while( nbconnect )
{ {
for( pt_del = BufDeb; pt_del; pt_del = pt_del->Next() ) 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 ); 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 /* Test if the marked track is redundant, ie if one of marked segments
* segments marques est connecte au point de depart de la piste nouvelle * is connected to the starting point of the new track.
*/ */
ii = 0; ii = 0;
pt_segm = pt_del; 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 ) if( pt_segm->m_Start == start || pt_segm->m_End == start )
{ {
/* la piste marquee peut etre effacee */ /* Marked track can be erased. */
TRACK* NextS; 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 ) 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; pt_del->m_Flags = 0;
ITEM_PICKER picker( pt_del, UR_DELETED ); ITEM_PICKER picker( pt_del, UR_DELETED );
aItemsListPicker->PushItem( picker ); aItemsListPicker->PushItem( picker );
} }
else else
pt_del->DeleteStructure(); pt_del->DeleteStructure();
} }
/* nettoyage des flags */ /* Clean up flags. */
for( pt_del = m_Pcb->m_Track; pt_del != NULL; pt_del = pt_del->Next() ) for( pt_del = m_Pcb->m_Track; pt_del != NULL;
pt_del = pt_del->Next() )
{ {
if( pt_del->GetState( EDIT ) ) 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 /* Clear BUSY flag here because the track did not get marked.
* ete retenuee */ */
ListSetState( pt_del, nb_segm, BUSY, OFF ); ListSetState( pt_del, nb_segm, BUSY, OFF );
} }

View File

@ -1,6 +1,6 @@
/*************************/ /*******************/
/* affichage des modules */ /* Display modules */
/*************************/ /*******************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -11,29 +11,22 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "drag.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[]; extern char* graphic_fonte_shape[];
#include "protos.h" #include "protos.h"
#define L_MIN_DESSIN 1 /* seuil de largeur des segments pour trace autre que filaire */ #define L_MIN_DESSIN 1 /* line width for segments other than traces. */
/* fonctions locales : */
/******************************************************************/ /* Trace the pads of a module in sketch mode.
void Trace_Pads_Only( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module, * Used to display a module pads when it is not displayed by the display
int ox, int oy, * options Module setting.
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
* *
* Les pads affiches doivent apparaitre sur les couches donnees par * The pads posters must appear on the data layers by MasqueLayer
* MasqueLayer
*/ */
void Trace_Pads_Only( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module,
int ox, int oy, int MasqueLayer, int draw_mode )
{ {
int tmp; int tmp;
PCB_SCREEN* screen; PCB_SCREEN* screen;
@ -45,7 +38,7 @@ void Trace_Pads_Only( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module,
tmp = frame->m_DisplayPadFill; tmp = frame->m_DisplayPadFill;
frame->m_DisplayPadFill = FALSE; frame->m_DisplayPadFill = FALSE;
/* trace des pastilles */ /* Draw pads. */
for( D_PAD* pad = Module->m_Pads; pad; pad = pad->Next() ) for( D_PAD* pad = Module->m_Pads; pad; pad = pad->Next() )
{ {
if( (pad->m_Masque_Layer & MasqueLayer) == 0 ) if( (pad->m_Masque_Layer & MasqueLayer) == 0 )

View File

@ -1,11 +1,9 @@
/*****************************************/ /****************/
/* Routines generales d'affichage du PCB */ /* tracepcb.cpp */
/*****************************************/ /****************/
/* fichier tracepcb.cpp */
/* /*
* Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ... * Routines to display grid box coordinates, cursors, markers ...
*/ */
#include <vector> #include <vector>
@ -21,13 +19,9 @@
#include "protos.h" #include "protos.h"
/**********************************************************************/
void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/**********************************************************************/
/* Draw the footprint editor BOARD, and others elements : axis, grid .. /* Draw the footprint editor BOARD, and others elements : axis, grid ..
*/ */
void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{ {
PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen(); 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 .. /* Draw the BOARD, and others elements : axis, grid ..
*/ */
void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{ {
PCB_SCREEN* screen = GetScreen(); 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, void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
int aDrawMode, const wxPoint& offset ) 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 /* 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 * 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. * effect of the highlight and its relationship to markers. See comment
* This order indepence comes from the fact that a binary OR operation is * below.
* This order independence comes from the fact that a binary OR operation is
* commutative in nature. * commutative in nature.
* However on the OSX, the OR operation is not used, and so this sequence * However on the OSX, the OR operation is not used, and so this sequence
* below is chosen to give MODULEs the highest visible priority. * below is chosen to give MODULEs the highest visible priority.
*/ */
/* Draw all tracks and zones. As long as dark colors are used for the
/* Draw all tracks and zones. As long as dark colors are used for the tracks, * tracks, Then the OR draw mode should show tracks underneath other
* Then the OR draw mode should show tracks underneath other tracks. But a white * tracks. But a white track will cover any other color since it has
* track will cover any other color since it has more bits to OR in. * more bits to OR in.
*/ */
for( TRACK* track = m_Track; track; track = track->Next() ) 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 ) if( g_HightLigt_Status )
DrawHighLight( aPanel, DC, g_HightLigth_NetCode ); 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 ) for( unsigned i=0; i < m_markers.size(); ++i )
{ {
m_markers[i]->Draw( aPanel, DC, aDrawMode ); 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 ) void BOARD::DrawHighLight( WinEDA_DrawPanel* aDrawPanel, wxDC* DC, int aNetCode )
/******************************************************************************/
{ {
int draw_mode; 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 * track.cpp
*********************************************/ *****************/
#include "fctsys.h" #include "fctsys.h"
@ -9,34 +9,44 @@
#include "protos.h" #include "protos.h"
/* Functions to reconize a track. /* Functions to recognize a track.
* A track is a list of connected segments (or/and vias) * A track is a list of connected segments (or/and vias)
* from a starting to an ending point * from a starting to an ending point
* starting and ending points are a pad or a point with more than 2 segments connected * starting and ending points are a pad or a point with more than 2 segments
* (and obviouly a dangling segment end) *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 */ /* 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 * Function Marque_Une_Piste
* marks a chain of track segments, connected to aTrackList. * marks a chain of track segments, connected to aTrackList.
* Each segment is marked by setting the BUSY bit into m_Flags. Electrical continuity * Each segment is marked by setting the BUSY bit into m_Flags. Electrical
* is detected by walking each segment, and finally the segments are rearranged * continuity is detected by walking each segment, and finally the segments
* into a contiguous chain within the given list. * are rearranged into a contiguous chain within the given list.
* @param aPcb = the board to analyse * @param aPcb = the board to analyze
* @param aStartSegm The first interesting segment within a list of track segment of aPcb * @param aStartSegm - The first interesting segment within a list of track
* @param aSegmCount = a pointer to an integer where to return the number of interesting segments * segment of aPcb
* @param aTrackLen = a pointer to an integer where to return the lenght of the track * @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: * @param aReorder = bool:
* true for reorder the interesting segments (useful for track edition/deletion) * true for reorder the interesting segments (useful for track
* in this case the flag BUSY is set (the user is responsible of flag clearing) *edition/deletion)
* false for no reorder : useful when we want just calculate the track lenght * 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 * in this case, flags are reset
* @return TRACK* the first in the chain of interesting segments. * @return TRACK* the first in the chain of interesting segments.
*/ */
@ -70,10 +80,11 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
trackList.push_back( aStartSegm ); 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 it is a via, one must search for connected segments.
* If <=2, this via connect 2 segments (or is connected to only one segment) * If <=2, this via connect 2 segments (or is connected to only one
* and this via and these 2 segments are a part of a track. * 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 > 2 only this via is flagged (the track has only this via)
*/ */
if( aStartSegm->Type() == TYPE_VIA ) if( aStartSegm->Type() == TYPE_VIA )
@ -91,34 +102,45 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
Segm3 = Fast_Locate_Piste( Segm2->Next(), NULL, Segm3 = Fast_Locate_Piste( Segm2->Next(), NULL,
aStartSegm->m_Start, masque_layer ); 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 ) if( aSegmCount )
*aSegmCount = 1; *aSegmCount = 1;
return aStartSegm; 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(); masque_layer = Segm1->ReturnMaskLayer();
Marque_Chaine_segments( Marque_Chaine_segments( aPcb, aStartSegm->m_Start, masque_layer,
aPcb, aStartSegm->m_Start, masque_layer, &trackList ); &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(); masque_layer = Segm2->ReturnMaskLayer();
Marque_Chaine_segments( Marque_Chaine_segments( aPcb, aStartSegm->m_Start, masque_layer,
aPcb, aStartSegm->m_Start, masque_layer, &trackList ); &trackList );
} }
} }
else // mark the chain using both ends of the initial segment 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,
Marque_Chaine_segments( aPcb, aStartSegm->m_End, masque_layer, &trackList ); 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 // 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 only one or 2 segments, it is flagged (is on
// If a via is connected to more than 2 segments, it is a track end, and it is removed from the list // 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. // go through the list backwards.
for( int i = trackList.size() - 1; i>=0; --i ) for( int i = trackList.size() - 1; i>=0; --i )
{ {
@ -130,23 +152,30 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
if( via == aStartSegm ) if( via == aStartSegm )
continue; 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(); 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. // 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 ) if( track == NULL )
continue; continue;
/* if a track is found, this via connects also others segments of an other track /* If a track is found, this via connects also others segments of an
* This case happens when the vias ends the selected track. * other track. This case happens when the vias ends the selected
* But must we consider this via is on the selected track, or on an other track. * track but must we consider this via is on the selected track, or
* (this is important when selecting a track for deletion: must this via be deleted or not?) * on an other track.
* We consider here this via on the track if others segment connected to this via * (this is important when selecting a track for deletion: must this
* remain connected when removing this via. * 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: * 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 the same layer, the via is on the selected track
* if there are on different layers, the via is on an other 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(); int layer = track->GetLayer();
while( ( track = Fast_Locate_Piste( track->Next(), NULL, while( ( track = Fast_Locate_Piste( track->Next(), NULL,
via->m_Start, masque_layer ) ) != NULL ) via->m_Start,
masque_layer ) ) != NULL )
{ {
if( layer != track->GetLayer() ) if( layer != track->GetLayer() )
{ {
// The via connects segments of an other track: it is removed from list // The via connects segments of an other track: it is removed
// because it is member of an other track // from list because it is member of an other track
via->SetState( BUSY, OFF ); via->SetState( BUSY, OFF );
break; break;
} }
} }
} }
/* Rearrange the track list in order to have flagged segments linked from firstTrack /* Rearrange the track list in order to have flagged segments linked
* So the NbSegmBusy segments are consecutive segments in list, the first item * from firstTrack so the NbSegmBusy segments are consecutive segments
* in the full track list is firstTrack, and the NbSegmBusy-1 next items * in list, the first item in the full track list is firstTrack, and
* (NbSegmBusy when including firstTrack) are the flagged segments * the NbSegmBusy-1 next items (NbSegmBusy when including firstTrack)
* are the flagged segments
*/ */
NbSegmBusy = 0; NbSegmBusy = 0;
TRACK* firstTrack; 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 // Search for the first flagged BUSY segments
if( firstTrack->GetState( BUSY ) ) 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() * Function used by Marque_Une_Piste()
* - Set the BUSY flag of connected segments, the first search point is * - 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 Pcb = the board
* @param aRef_pos = the reference coordinate of the starting search * @param aRef_pos = the reference coordinate of the starting search
* @param aLayerMask = the allowed layers for segments to 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 * @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 TRACK* pt_segm, // The current segment being analyzed.
* pt_via, // pointe la via reperee, eventuellement a detruire * pt_via, // The via identified, eventually destroy
* SegmentCandidate; // pointe le segment a detruire (= NULL ou pt_segm
int NbSegm; * SegmentCandidate; // The end segment to destroy (or NULL =
// pt_segm
int NbSegm;
if( aPcb->m_Track == NULL ) if( aPcb->m_Track == NULL )
return; 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: * Search ends when:
* - a pad is found (end of a track) * - a pad is found (end of a track)
* - a segment end has more than one other segment end connected * - a segment end has more than one other segment end connected
* - and obviously when no connected item found * - and obviously when no connected item found
* Vias are a special case, because we must see others segment connected on others layers * Vias are a special case, because we must see others segment connected
* and they change the layer mask. They can be a track end or not * on others layers and they change the layer mask. They can be a track
* They will be analyser later, and vias on terminal points of the track will be * end or not
* considered as part of this track if they do not connect segments of an other track together * They will be analyzer later, and vias on terminal points of the track
* and will be considered as part of an other track * will be considered as part of this track if they do not connect segments
* if when removing the via, the segments of taht other track are disconnected * 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( ; ; ) for( ; ; )
{ {
if( Fast_Locate_Pad_Connecte( aPcb, aRef_pos, aLayerMask ) != NULL ) if( Fast_Locate_Pad_Connecte( aPcb, aRef_pos, aLayerMask ) != NULL )
return; return;
/* Test for a via: a via changes the layer mask and can connect a lot of segments /* Test for a via: a via changes the layer mask and can connect a lot
* at location aRef_pos * of segments at location aRef_pos. When found, the via is just
* When found, the via is just pushed in list. * pushed in list. Vias will be examined later, when all connected
* Vias will be examined later, when all connected segment are found and push in list * segment are found and push in list. This is because when a via
* This is because whena via is found we do not know at this time the number of connected items * 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 * 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 ); 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, while( ( pt_segm = Fast_Locate_Piste( pt_segm, NULL,
aRef_pos, aLayerMask ) ) != 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(); pt_segm = pt_segm->Next();
continue; continue;
@ -314,21 +353,25 @@ static void Marque_Chaine_segments( BOARD* aPcb, wxPoint aRef_pos, int aLayerMas
} }
NbSegm++; 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; SegmentCandidate = pt_segm;
pt_segm = pt_segm->Next(); 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; 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: /* Initialize parameters to search items connected to this
* we must analyse connections to its other end * candidate:
* we must analyze connections to its other end
*/ */
aLayerMask = SegmentCandidate->ReturnMaskLayer(); aLayerMask = SegmentCandidate->ReturnMaskLayer();
@ -341,7 +384,7 @@ static void Marque_Chaine_segments( BOARD* aPcb, wxPoint aRef_pos, int aLayerMas
aRef_pos = SegmentCandidate->m_Start; 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 */ /* flag this item an push it in list of selected items */
aList->push_back( SegmentCandidate ); aList->push_back( SegmentCandidate );
@ -353,20 +396,18 @@ static void Marque_Chaine_segments( BOARD* aPcb, wxPoint aRef_pos, int aLayerMas
} }
/********************************************************/ /* Calculate the end points coordinates of a track (a list of connected
int ReturnEndsTrack( TRACK* RefTrack, int NbSegm, * segments)
TRACK** StartTrack, TRACK** EndTrack )
/**********************************************************/
/* Calculate the end points coordinates of a track (a list of connected segments)
* RefTrack is a segment of the track * RefTrack is a segment of the track
* return 1 if OK, 0 when a track is a closed loop * 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 * and the beginning and the end of the track in *StartTrack and *EndTrack
* Modify *StartTrack en *EndTrack : * Modify *StartTrack en *EndTrack :
* (*StartTrack)->m_Start coordinate is the beginning of the track * (*StartTrack)->m_Start coordinate is the beginning of the track
* (*EndTrack)->m_End coordinate is the end 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; TRACK* Track, * via, * segm, * TrackListEnd;
int NbEnds, masque_layer, ii, ok = 0; int NbEnds, masque_layer, ii, ok = 0;
@ -374,21 +415,21 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
if( NbSegm <= 1 ) if( NbSegm <= 1 )
{ {
*StartTrack = *EndTrack = RefTrack; *StartTrack = *EndTrack = RefTrack;
return 1; /* cas trivial */ return 1;
} }
/* calcul de la limite d'analyse */ /* Calculation of the limit analysis. */
*StartTrack = *EndTrack = NULL; *StartTrack = *EndTrack = NULL;
TrackListEnd = Track = RefTrack; ii = 0; 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; TrackListEnd = Track;
Track->m_Param = 0; Track->m_Param = 0;
} }
/* Calcul des extremites */ /* Calculate the extremes. */
NbEnds = 0; Track = RefTrack; ii = 0; 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 ) if( Track->Type() == TYPE_VIA )
continue; continue;
@ -421,7 +462,7 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
int BeginPad, EndPad; int BeginPad, EndPad;
*EndTrack = Track; *EndTrack = Track;
/* permutation de ox,oy avec fx,fy */ /* Swap ox, oy with fx, fy */
BeginPad = Track->GetState( BEGIN_ONPAD ); BeginPad = Track->GetState( BEGIN_ONPAD );
EndPad = Track->GetState( END_ONPAD ); EndPad = Track->GetState( END_ONPAD );
@ -463,7 +504,7 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
*StartTrack = Track; *StartTrack = Track;
NbEnds++; NbEnds++;
/* permutation de ox,oy avec fx,fy */ /* Swap ox, oy with fx, fy */
BeginPad = Track->GetState( BEGIN_ONPAD ); BeginPad = Track->GetState( BEGIN_ONPAD );
EndPad = Track->GetState( END_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 /* 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 ) if( Start == NULL )
return; return;
for( ; (Start != NULL) && (NbItem > 0); NbItem--, Start = Start->Next() ) for( ; (Start != NULL ) && ( NbItem > 0 ); NbItem--, Start = Start->Next() )
{ {
Start->SetState( State, onoff ); 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 "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -11,30 +11,24 @@
#include "protos.h" #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, void Trace_Une_Piste( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* aTrackList,
int nbsegment, int draw_mode ) 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. // 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 ); track->Draw( panel, DC, draw_mode );
} }
} }

View File

@ -1,8 +1,6 @@
/********************************************/ /************************/
/* AUTOROUTAGE PCB : routines d'autoroutage */ /* Autorouting routines */
/********************************************/ /************************/
/* fichier WORK.CC */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -13,195 +11,203 @@
#include "cell.h" #include "cell.h"
#include "protos.h" #include "protos.h"
/**/
struct CWORK /* a unit of work is a hole-pair to connect */ struct CWORK /* a unit of work is a hole-pair to connect */
{ {
struct CWORK *Next; struct CWORK* Next;
int FromRow; /* source row */ int FromRow; /* source row */
int FromCol; /* source column */ int FromCol; /* source column */
int net_code; /* net_code */ int net_code; /* net_code */
int ToRow; /* target row */ int ToRow; /* target row */
int ToCol; /* target column */ int ToCol; /* target column */
RATSNEST_ITEM *pt_rats; /* chevelu correspondant*/ RATSNEST_ITEM* pt_rats; /* Corresponding ratsnest */
int ApxDist; /* approximate distance */ int ApxDist; /* approximate distance */
int Cost; /* cost for sort by length */ int Cost; /* cost for sort by length */
int Priority; /* routage priority */ int Priority; /* route priority */
}; };
/* pointers to the first and last item of work to do */ /* pointers to the first and last item of work to do */
static CWORK *Head = NULL; static CWORK* Head = NULL;
static CWORK *Tail = NULL; static CWORK* Tail = NULL;
static CWORK *Current = NULL; static CWORK* Current = NULL;
/* Routines definies ici : */
void InitWork(); void InitWork();
void ReInitWork(); void ReInitWork();
int SetWork( int, int, int, int, int, RATSNEST_ITEM *, int ); int SetWork( int, int, int, int, int, RATSNEST_ITEM*, int );
void GetWork( int *, int *, int *, int *, int *, RATSNEST_ITEM ** ); void GetWork( int*, int*, int*, int*, int*, RATSNEST_ITEM** );
void SortWork(); void SortWork();
/************************/ /* initialize the work list */
/* void InitWork () */
/************************/
/* initialize the work list */
void InitWork() void InitWork()
{ {
CWORK *ptr; CWORK* ptr;
while( (ptr = Head) != NULL ) while( ( ptr = Head ) != NULL )
{ {
Head = ptr->Next; MyFree( ptr ); Head = ptr->Next;
} MyFree( ptr );
Tail = Current = NULL; }
Tail = Current = NULL;
} }
/*************************/ /* initialize the work list */
/* void ReInitWork() */
/*************************/
/* initialize the work list */
void ReInitWork() 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 /* add a unit of work to the work list
Return: * Return:
1 si OK * 1 if OK
0 si defaut d'allocation memoire * 0 if memory allocation failed
*/ */
static int GetCost(int r1,int c1,int r2,int c2); 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 ) if( ( p = (CWORK*) MyMalloc( sizeof(CWORK) ) ) != NULL )
{ {
p->FromRow = r1; p->FromRow = r1;
p->FromCol = c1; p->FromCol = c1;
p->net_code = n_c; p->net_code = n_c;
p->ToRow = r2; p->ToRow = r2;
p->ToCol = c2; p->ToCol = c2;
p->pt_rats = pt_ch; p->pt_rats = pt_ch;
p->ApxDist = GetApxDist( r1, c1, r2, c2 ); p->ApxDist = GetApxDist( r1, c1, r2, c2 );
p->Cost = GetCost( r1, c1, r2, c2 ); p->Cost = GetCost( r1, c1, r2, c2 );
p->Priority = pri; p->Priority = pri;
p->Next = NULL; p->Next = NULL;
if (Head) /* attach at end */ if( Head ) /* attach at end */
Tail->Next = p; Tail->Next = p;
else /* first in list */ else /* first in list */
Head = Current = p; Head = Current = p;
Tail = p; Tail = p;
return(1); return 1;
} }
else /* can't get any more memory */ else /* can't get any more memory */
return(0); return 0;
} }
/************************************************************************/ /* fetch a unit of work from the work list */
/* void GetWork (int *r1,int *c1,int *r2,int *c2, char **n1,char **n2 ) */ void GetWork( int* r1,
/************************************************************************/ int* c1,
int* n_c,
void GetWork (int *r1,int *c1,int *n_c,int *r2,int *c2,RATSNEST_ITEM** pt_ch ) int* r2,
/* fetch a unit of work from the work list */ int* c2,
RATSNEST_ITEM** pt_ch )
{ {
if (Current) if( Current )
{ {
*r1 = Current->FromRow; *r1 = Current->FromRow;
*c1 = Current->FromCol; *c1 = Current->FromCol;
*n_c = Current->net_code; *n_c = Current->net_code;
*r2 = Current->ToRow; *r2 = Current->ToRow;
*c2 = Current->ToCol; *c2 = Current->ToCol;
*pt_ch = Current->pt_rats; *pt_ch = Current->pt_rats;
Current = Current->Next; Current = Current->Next;
} }
else /* none left */
else { /* none left */ {
*r1 = *c1 = *r2 = *c2 = ILLEGAL; *r1 = *c1 = *r2 = *c2 = ILLEGAL;
*n_c = 0; *n_c = 0;
*pt_ch = NULL; *pt_ch = NULL;
} }
} }
/***********************/
/* void SortWork() */
/***********************/
/* order the work items; shortest (low cost) first */ /* order the work items; shortest (low cost) first */
void SortWork() void SortWork()
{ {
CWORK *p; CWORK* p;
CWORK *q0; /* put PRIORITY PAD_CONNECTs in q0 */ CWORK* q0; /* put PRIORITY PAD_CONNECTs in q0 */
CWORK *q1; /* sort other PAD_CONNECTs in q1 */ CWORK* q1; /* sort other PAD_CONNECTs in q1 */
CWORK *r; CWORK* r;
q0 = q1 = NULL; q0 = q1 = NULL;
while( (p = Head) != NULL ) while( (p = Head) != NULL ) /* prioritize each work item */
{ /* prioritize each work item */ {
Head = Head->Next; Head = Head->Next;
if (p->Priority) if( p->Priority ) /* put at end of priority list */
{ /* put at end of priority list */ {
p->Next = NULL; p->Next = NULL;
if ((r = q0) == NULL) /* empty list? */ if( (r = q0) == NULL ) /* empty list? */
q0 = p; q0 = p;
else else /* attach at end */
{ /* attach at end */ {
while (r->Next) /* search for end */ while( r->Next ) /* search for end */
r = r->Next; 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;
}
}
if( (p = q0) != NULL) r->Next = p; /* attach */
{ /* any priority PAD_CONNECTs? */ }
while (q0->Next) q0 = q0->Next; }
q0->Next = q1; else if( ( ( r = q1 ) == NULL ) || ( p->Cost < q1->Cost ) )
} {
else p = q1; 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 */ p->Next = r->Next;
for(Head = Current = Tail = p; Tail && Tail->Next; Tail = Tail->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: /* Calculate the cost of a net:
cout = (|dx| + |dy|) * handicap * cost = (| dx | + | dy |) * disability
handicap = 1 si dx ou dy = 0, max si |dx| # |dy| * disability = 1 if dx or dy = 0, max if | dx | # | dy |
*/ */
static int GetCost(int r1,int c1,int r2,int c2) static int GetCost( int r1, int c1, int r2, int c2 )
{ {
int dx, dy, mx, my; int dx, dy, mx, my;
float incl; float incl;
dx = abs(c2 - c1); dx = abs( c2 - c1 );
dy = abs(r2 - r1); dy = abs( r2 - r1 );
incl = 1.0; incl = 1.0;
mx = dx; my = dy; mx = dx;
if ( mx < my ) { mx = dy; my = dx;} my = dy;
if ( mx ) incl += (2*(float)my/mx);
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 */ /* Pcbnew: exchange of modules */
/******************************/ /*******************************/
/* Fichier xchmod.cpp */
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
@ -14,46 +12,42 @@
#include "dialog_exchange_modules_base.h" #include "dialog_exchange_modules_base.h"
// Local variables:
int s_SelectionMode = 0; // Remember the last exchange option, when exit dialog.
/************************************/ int s_SelectionMode = 0; // Remember the last exchange option, when exit
/* class DIALOG_EXCHANGE_MODULE */ // dialog.
/************************************/
class DIALOG_EXCHANGE_MODULE : public DIALOG_EXCHANGE_MODULE_BASE class DIALOG_EXCHANGE_MODULE : public DIALOG_EXCHANGE_MODULE_BASE
{ {
private: private:
WinEDA_PcbFrame* m_Parent; WinEDA_PcbFrame* m_Parent;
MODULE* m_CurrentModule; MODULE* m_CurrentModule;
public: public: DIALOG_EXCHANGE_MODULE( WinEDA_PcbFrame* aParent, MODULE* aModule );
// Constructor and destructor
DIALOG_EXCHANGE_MODULE( WinEDA_PcbFrame* aParent, MODULE* aModule );
~DIALOG_EXCHANGE_MODULE() { }; ~DIALOG_EXCHANGE_MODULE() { };
private: private:
void OnSelectionClicked( wxCommandEvent& event ); void OnSelectionClicked( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event ); void OnQuit( wxCommandEvent& event );
void BrowseAndSelectFootprint( wxCommandEvent& event ); void BrowseAndSelectFootprint( wxCommandEvent& event );
void Init(); void Init();
void Change_Module(); void Change_Module();
void Change_ModuleId( bool aUseValue ); void Change_ModuleId( bool aUseValue );
void Change_ModuleAll(); void Change_ModuleAll();
int Maj_ListeCmp( const wxString& reference, const wxString& old_name, int Maj_ListeCmp( const wxString& reference, const wxString& old_name,
const wxString& new_name, bool ShowError ); const wxString& new_name, bool ShowError );
bool Change_1_Module( MODULE* Module, bool Change_1_Module( MODULE* Module,
const wxString& new_module, const wxString& new_module,
PICKED_ITEMS_LIST* aUndoPickList, PICKED_ITEMS_LIST* aUndoPickList,
bool ShowError ); 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 ) DIALOG_EXCHANGE_MODULE_BASE( parent )
{ {
m_Parent = 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(); s_SelectionMode = m_Selection->GetSelection();
Close( true ); // true is to force the frame to close 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 * Updates the file name.CMP (if any) after an exchange module
* (par la commande changeMod), si les modules sont geres par ce fichier * (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 * If ShowError! = 0 displays error message if the file. Cmp is not found.
* trouve. * Return 1 if error
* Retoure 1 si erreur
*/ */
int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference, int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
const wxString& old_name, const wxString& old_name,
@ -160,13 +151,12 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
char* result; // quiet compiler char* result; // quiet compiler
if( old_name == new_name ) 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 = m_Parent->GetScreen()->m_FileName;
fn.SetExt( NetCmpExtBuffer ); fn.SetExt( NetCmpExtBuffer );
// Modification du fichier .cmp correcpondant
FichCmp = wxFopen( fn.GetFullPath(), wxT( "rt" ) ); FichCmp = wxFopen( fn.GetFullPath(), wxT( "rt" ) );
if( FichCmp == NULL ) if( FichCmp == NULL )
{ {
@ -178,7 +168,6 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
return 1; return 1;
} }
/* Analyse du fichier et modif */
tmpFileName = fn; tmpFileName = fn;
tmpFileName.SetExt( wxT( "$$$" ) ); tmpFileName.SetExt( wxT( "$$$" ) );
NewFile = wxFopen( tmpFileName.GetFullPath(), wxT( "wt" ) ); NewFile = wxFopen( tmpFileName.GetFullPath(), wxT( "wt" ) );
@ -187,7 +176,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
if( ShowError ) if( ShowError )
{ {
msg.Printf( _( "Unable to create file %s" ), msg.Printf( _( "Unable to create file %s" ),
GetChars( tmpFileName.GetFullPath() ) ); GetChars( tmpFileName.GetFullPath() ) );
m_WinMessages->AppendText( msg ); m_WinMessages->AppendText( msg );
} }
return 1; return 1;
@ -237,13 +226,12 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
} }
/* /* Change the module at the current cursor position.
* Routine de changement d'un module: * Retains the following:
* Change le module pointe par la souris, par un autre en conservant * - Same direction
* - meme orientation * - Same position
* - meme position * - Same text value and ref
* - memes textes valeur et ref * - Same NetNames for pads same name
* - memes netnames pour pads de meme nom
*/ */
void DIALOG_EXCHANGE_MODULE::Change_Module() 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 * Change of all modules with the same name as that lib
* selectionne, en conservant * Retains:
* - meme orientation * - Same direction
* - meme position * - Same position
* - memes textes valeur et ref * - Same text value and ref
* - memes netnames pour pads de meme nom * - Same NetNames for pads same name
* et en remplacant l'ancien module par le noveau module * And replacing the old module with the new module
* Attention: m_CurrentModule ne pointe plus sur le module de reference * Note: m_CurrentModule no longer on the module reference
* puisque celui ci a ete change!! * since it has been changed!
*/ */
void DIALOG_EXCHANGE_MODULE::Change_ModuleId( bool aUseValue ) 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 newmodulename = m_NewModule->GetValue();
wxString value, lib_reference; wxString value, lib_reference;
bool check_module_value = false; 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 ) if( m_Parent->GetBoard()->m_Modules == NULL )
return; return;
@ -297,25 +285,26 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleId( bool aUseValue )
check_module_value = true; check_module_value = true;
value = m_CurrentModule->m_Value->m_Text; value = m_CurrentModule->m_Value->m_Text;
msg.Printf( _( "Change modules <%s> -> <%s> (val = %s)?" ), msg.Printf( _( "Change modules <%s> -> <%s> (val = %s)?" ),
GetChars( m_CurrentModule->m_LibRef ), GetChars( m_CurrentModule->m_LibRef ),
GetChars( newmodulename ), GetChars( newmodulename ),
GetChars( m_CurrentModule->m_Value->m_Text ) ); GetChars( m_CurrentModule->m_Value->m_Text ) );
} }
else else
{ {
msg.Printf( _( "Change modules <%s> -> <%s> ?" ), msg.Printf( _( "Change modules <%s> -> <%s> ?" ),
GetChars( lib_reference ), GetChars( newmodulename ) ); GetChars( lib_reference ), GetChars( newmodulename ) );
} }
if( !IsOK( this, msg ) ) if( !IsOK( this, msg ) )
return; return;
/* Le changement s'effectue a partir du dernier module car la routine /* The change is done from the last module for the routine
* Change_1_Module() modifie le dernier module de la liste * 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(); Module = m_Parent->GetBoard()->m_Modules.GetLast();
for( ; Module && ( Module->Type() == TYPE_MODULE ); Module = PtBack ) 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: * Change all modules with module of the same name in library.
* en conservant * Maintains:
* - meme orientation * - Same direction
* - meme position * - Same position
* - memes textes valeur et ref * - Same text value and ref
* - memes netnames pour pads de meme nom * - Same NetNames for pads same name
*/ */
void DIALOG_EXCHANGE_MODULE::Change_ModuleAll() void DIALOG_EXCHANGE_MODULE::Change_ModuleAll()
{ {
MODULE* Module, * PtBack; MODULE* Module, * PtBack;
bool change = false; 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 ) if( m_Parent->GetBoard()->m_Modules == NULL )
return; return;
@ -365,13 +354,13 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleAll()
if( !IsOK( this, _( "Change ALL modules ?" ) ) ) if( !IsOK( this, _( "Change ALL modules ?" ) ) )
return; return;
/* Le changement s'effectue a partir du dernier module car la routine /* The change is done from the last module for the routine
* Change_1_Module() modifie le dernier module de la liste * 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(); Module = m_Parent->GetBoard()->m_Modules.GetLast();
for( ; Module && ( Module->Type() == TYPE_MODULE ); Module = PtBack ) 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 the number empr module with the module name new_module
* Change le module de numero empr, avec le module de nom new_module * - Same direction
* - meme orientation * - Same position
* - meme position * - Same text value and ref
* - memes textes valeur et ref * - Same NetNames for pads same name
* - memes netnames pour pads de meme nom * Returns:
* Retourne : * False if no change (if the new module is not free)
* false si pas de changement ( si le nouveau module n'est pas en libr) * True if OK
* true si OK * Ratsnest must be recalculated after module exchange
* Ratsnest *must be recalculated* after modules changes
*/ */
bool DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module, bool DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module,
const wxString& new_module, const wxString& new_module,
PICKED_ITEMS_LIST* aUndoPickList, PICKED_ITEMS_LIST* aUndoPickList,
bool ShowError ) bool ShowError )
{ {
wxString namecmp, oldnamecmp; wxString namecmp, oldnamecmp;
MODULE* NewModule; MODULE* NewModule;
@ -419,13 +407,14 @@ bool DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module,
wxBusyCursor dummy; wxBusyCursor dummy;
/* Memorisation des parametres utiles de l'ancien module */ /* Copy parameters from the old module. */
oldnamecmp = Module->m_LibRef; oldnamecmp = Module->m_LibRef;
namecmp = new_module; namecmp = new_module;
/* Chargement du module */ /* Load module. */
Line.Printf( _( "Change module %s (%s) " ), 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 ); m_WinMessages->AppendText( Line );
namecmp.Trim( true ); namecmp.Trim( true );
@ -433,7 +422,7 @@ bool DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module,
NewModule = m_Parent->Get_Librairie_Module( wxEmptyString, NewModule = m_Parent->Get_Librairie_Module( wxEmptyString,
namecmp, namecmp,
ShowError ); 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" ) ); m_WinMessages->AppendText( wxT( "No\n" ) );
return false; return false;
@ -460,16 +449,18 @@ bool DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module,
* OldModule is deleted or put in undo list. * OldModule is deleted or put in undo list.
* @param aOldModule = footprint to replace * @param aOldModule = footprint to replace
* @param aNewModule = footprint to put * @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, void WinEDA_PcbFrame::Exchange_Module( MODULE* aOldModule,
MODULE* aNewModule, MODULE* aNewModule,
PICKED_ITEMS_LIST* aUndoPickList) PICKED_ITEMS_LIST* aUndoPickList )
{ {
wxPoint oldpos; /* memorisation temporaire pos curseur */ wxPoint oldpos;
D_PAD* pad, * old_pad; 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" ) ); wxMessageBox( wxT( "WinEDA_PcbFrame::Exchange_Module() StuctType error" ) );
return; return;
@ -481,7 +472,7 @@ void WinEDA_PcbFrame::Exchange_Module( MODULE* aOldModule,
oldpos = GetScreen()->m_Curseur; oldpos = GetScreen()->m_Curseur;
GetScreen()->m_Curseur = aOldModule->m_Pos; 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 * when all modules are on board
*/ */
Place_Module( aNewModule, NULL, true ); 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_Reference->m_Text = aOldModule->m_Reference->m_Text;
aNewModule->m_Value->m_Text = aOldModule->m_Value->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_TimeStamp = aOldModule->m_TimeStamp;
aNewModule->m_Path = aOldModule->m_Path; 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() ) for( ; old_pad != NULL; old_pad = old_pad->Next() )
{ {
if( strnicmp( pad->m_Padname, old_pad->m_Padname, 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->SetNetname( old_pad->GetNetname() );
pad->SetNet( old_pad->GetNet() ); pad->SetNet( old_pad->GetNet() );
@ -527,13 +518,13 @@ void WinEDA_PcbFrame::Exchange_Module( MODULE* aOldModule,
if( aUndoPickList ) if( aUndoPickList )
{ {
GetBoard()->Remove(aOldModule); GetBoard()->Remove( aOldModule );
ITEM_PICKER picker_old(aOldModule, UR_DELETED); ITEM_PICKER picker_old( aOldModule, UR_DELETED );
ITEM_PICKER picker_new(aNewModule, UR_NEW); ITEM_PICKER picker_new( aNewModule, UR_NEW );
aUndoPickList->PushItem(picker_old); aUndoPickList->PushItem( picker_old );
aUndoPickList->PushItem(picker_new); aUndoPickList->PushItem( picker_new );
} }
else /* Effacement de l'ancien module */ else
aOldModule->DeleteStructure(); aOldModule->DeleteStructure();
GetBoard()->m_Status_Pcb = 0; 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 ) void DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint( wxCommandEvent& event )
{ {
@ -580,7 +571,7 @@ void WinEDA_PcbFrame::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
return; 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 = GetScreen()->m_FileName;
fn.SetExt( NetCmpExtBuffer ); fn.SetExt( NetCmpExtBuffer );
wildcard = _( "Component files (." ) + NetCmpExtBuffer + wxT( ")|*." ) + wildcard = _( "Component files (." ) + NetCmpExtBuffer + wxT( ")|*." ) +
@ -605,7 +596,7 @@ void WinEDA_PcbFrame::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
result = fgets( Line, sizeof(Line), FichCmp ); result = fgets( Line, sizeof(Line), FichCmp );
fprintf( FichCmp, "Cmp-Mod V01 Genere par PcbNew le %s\n", fprintf( FichCmp, "Cmp-Mod V01 Genere par PcbNew le %s\n",
DateAndTime( Line ) ); DateAndTime( Line ) );
for( ; Module != NULL; Module = Module->Next() ) for( ; Module != NULL; Module = Module->Next() )
{ {
@ -619,7 +610,7 @@ void WinEDA_PcbFrame::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
!Module->m_Value->m_Text.IsEmpty() ? !Module->m_Value->m_Text.IsEmpty() ?
CONV_TO_UTF8( Module->m_Value->m_Text ) : "[NoVal]" ); CONV_TO_UTF8( Module->m_Value->m_Text ) : "[NoVal]" );
fprintf( FichCmp, "IdModule = %s;\n", fprintf( FichCmp, "IdModule = %s;\n",
CONV_TO_UTF8( Module->m_LibRef ) ); CONV_TO_UTF8( Module->m_LibRef ) );
fprintf( FichCmp, "EndCmp\n" ); fprintf( FichCmp, "EndCmp\n" );
} }