Commit 11d9edfe authored by charras's avatar charras

beautify files

parent daeb1901
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
/* Fonctions locales */ /* Fonctions locales */
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, void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter* plotter,
int masque_layer, GRTraceMode trace_mode ) int masque_layer, GRTraceMode trace_mode )
/***********************************************************/ /***********************************************************/
/* Genere le trace des couches type serigraphie, en format HPGL ou GERBER*/ /* Genere le trace des couches type serigraphie, en format HPGL ou GERBER*/
...@@ -36,27 +36,25 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter, ...@@ -36,27 +36,25 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
EDA_BaseStruct* PtStruct; EDA_BaseStruct* PtStruct;
/* Trace du contour du PCB et des Elements du type Drawings Pcb */ /* Trace du contour du PCB et des Elements du type Drawings Pcb */
for( PtStruct = m_Pcb->m_Drawings; for( PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
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: case TYPE_MARKER:
...@@ -69,28 +67,27 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter, ...@@ -69,28 +67,27 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
} }
/* trace des contours des MODULES : */ /* trace des contours des MODULES : */
Plot_Edges_Modules(plotter, m_Pcb, masque_layer, trace_mode ); Plot_Edges_Modules( plotter, m_Pcb, masque_layer, trace_mode );
/* Trace des MODULES : PADS */ /* Trace des MODULES : PADS */
if( g_pcb_plot_options.PlotPadsOnSilkLayer if( g_pcb_plot_options.PlotPadsOnSilkLayer
|| 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; for( pt_pad = (D_PAD*) Module->m_Pads; pt_pad != NULL; pt_pad = pt_pad->Next() )
pt_pad != NULL;
pt_pad = pt_pad->Next() )
{ {
/* Tst si layer OK */ /* Tst si layer OK */
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
* pads go on component silk */ /* Copper pads go on copper silk, component
&& (((pt_pad->m_Masque_Layer & CUIVRE_LAYER) == 0) * pads go on component silk */
|| ((masque_layer & SILKSCREEN_LAYER_CU) == 0 )) && ( ( (pt_pad->m_Masque_Layer & CUIVRE_LAYER) == 0 )
&& (((pt_pad->m_Masque_Layer & CMP_LAYER) == 0) || ( (masque_layer & SILKSCREEN_LAYER_CU) == 0 ) )
|| ((masque_layer & SILKSCREEN_LAYER_CMP) == 0 ))) && ( ( (pt_pad->m_Masque_Layer & CMP_LAYER) == 0 )
|| ( (masque_layer & SILKSCREEN_LAYER_CMP) == 0 ) ) )
{ {
if( !g_pcb_plot_options.Plot_Pads_All_Layers ) if( !g_pcb_plot_options.Plot_Pads_All_Layers )
continue; continue;
...@@ -103,27 +100,27 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter, ...@@ -103,27 +100,27 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
switch( pt_pad->m_PadShape & 0x7F ) switch( pt_pad->m_PadShape & 0x7F )
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
plotter->flash_pad_circle(pos, size.x, FILAIRE); plotter->flash_pad_circle( pos, size.x, FILAIRE );
break; break;
case PAD_OVAL: case PAD_OVAL:
plotter->flash_pad_oval(pos, size, plotter->flash_pad_oval( pos, size,
pt_pad->m_Orient, FILAIRE ); pt_pad->m_Orient, FILAIRE );
break; break;
case PAD_TRAPEZOID: { case PAD_TRAPEZOID:
{
wxSize delta; wxSize delta;
delta = pt_pad->m_DeltaSize; delta = pt_pad->m_DeltaSize;
plotter->flash_pad_trapez( pos, size, plotter->flash_pad_trapez( pos, size,
delta, pt_pad->m_Orient, delta, pt_pad->m_Orient,
FILAIRE ); FILAIRE );
break; break;
} }
case PAD_RECT: case PAD_RECT:
default: default:
plotter->flash_pad_rect( pos, size, pt_pad->m_Orient, plotter->flash_pad_rect( pos, size, pt_pad->m_Orient, FILAIRE );
FILAIRE);
break; break;
} }
} }
...@@ -131,9 +128,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter, ...@@ -131,9 +128,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
} /* Fin Sequence de trace des Pads */ } /* Fin Sequence de trace des Pads */
/* Trace Textes MODULES */ /* Trace Textes MODULES */
for( MODULE* Module = m_Pcb->m_Modules; for( MODULE* Module = m_Pcb->m_Modules; Module; Module = Module->Next() )
Module;
Module = Module->Next() )
{ {
/* Analyse des autorisations de trace pour les textes VALEUR et REF */ /* Analyse des autorisations de trace pour les textes VALEUR et REF */
trace_val = g_pcb_plot_options.Sel_Texte_Valeur; trace_val = g_pcb_plot_options.Sel_Texte_Valeur;
...@@ -181,14 +176,14 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter, ...@@ -181,14 +176,14 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
/* Trace effectif des textes */ /* Trace effectif des textes */
if( trace_ref ) if( trace_ref )
PlotTextModule(plotter, Module->m_Reference, trace_mode ); PlotTextModule( plotter, Module->m_Reference, trace_mode );
if( trace_val ) if( trace_val )
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;
...@@ -204,7 +199,8 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter, ...@@ -204,7 +199,8 @@ 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, Module->GetReference().GetData(), pt_texte->m_Text.GetData() ); textLayer, Module->GetReference().GetData(), pt_texte->m_Text.GetData() );
DisplayError( this, errMsg ); DisplayError( this, errMsg );
return; return;
...@@ -213,7 +209,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter, ...@@ -213,7 +209,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
if( !( (1 << textLayer) & masque_layer ) ) if( !( (1 << textLayer) & masque_layer ) )
continue; continue;
PlotTextModule(plotter, pt_texte, trace_mode); PlotTextModule( plotter, pt_texte, trace_mode );
} }
} }
...@@ -223,7 +219,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter, ...@@ -223,7 +219,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii ); ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii );
if( ( ( 1 << edge_zone->GetLayer() ) & masque_layer ) == 0 ) if( ( ( 1 << edge_zone->GetLayer() ) & masque_layer ) == 0 )
continue; continue;
PlotFilledAreas(plotter, edge_zone, trace_mode ); PlotFilledAreas( plotter, edge_zone, trace_mode );
} }
// Plot segments used to fill zone areas: // Plot segments used to fill zone areas:
...@@ -231,15 +227,15 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter, ...@@ -231,15 +227,15 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
{ {
if( ( ( 1 << seg->GetLayer() ) & masque_layer ) == 0 ) if( ( ( 1 << seg->GetLayer() ) & masque_layer ) == 0 )
continue; continue;
plotter->thick_segment(seg->m_Start, seg->m_End, seg->m_Width, plotter->thick_segment( seg->m_Start, seg->m_End, seg->m_Width,
trace_mode); 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 )
/********************************************************************/ /********************************************************************/
{ {
wxSize size; wxSize size;
...@@ -257,19 +253,19 @@ static void PlotTextModule(Plotter *plotter, TEXTE_MODULE* pt_texte, ...@@ -257,19 +253,19 @@ static void PlotTextModule(Plotter *plotter, TEXTE_MODULE* pt_texte,
thickness = -1; thickness = -1;
if( pt_texte->m_Mirror ) if( pt_texte->m_Mirror )
size.x = -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,
orient, size, orient, size,
pt_texte->m_HJustify, pt_texte->m_VJustify, pt_texte->m_HJustify, pt_texte->m_VJustify,
thickness, pt_texte->m_Italic, pt_texte->m_Bold ); thickness, pt_texte->m_Italic, pt_texte->m_Bold );
} }
/*******************************************************************************/ /*******************************************************************************/
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;
...@@ -279,46 +275,46 @@ void PlotCotation(Plotter *plotter, COTATION* Cotation, int masque_layer, ...@@ -279,46 +275,46 @@ void PlotCotation(Plotter *plotter, COTATION* Cotation, int masque_layer,
DrawTmp = new DRAWSEGMENT( NULL ); DrawTmp = new DRAWSEGMENT( NULL );
DrawTmp->m_Width = (trace_mode==FILAIRE)?-1:Cotation->m_Width; DrawTmp->m_Width = (trace_mode==FILAIRE) ? -1 : Cotation->m_Width;
DrawTmp->SetLayer( Cotation->GetLayer() ); DrawTmp->SetLayer( Cotation->GetLayer() );
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_Start.y = Cotation->Barre_oy;
DrawTmp->m_End.x = Cotation->Barre_fx; DrawTmp->m_End.y = Cotation->Barre_fy; 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_Start.y = Cotation->TraitG_oy;
DrawTmp->m_End.x = Cotation->TraitG_fx; DrawTmp->m_End.y = Cotation->TraitG_fy; 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_Start.y = Cotation->TraitD_oy;
DrawTmp->m_End.x = Cotation->TraitD_fx; DrawTmp->m_End.y = Cotation->TraitD_fy; 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_Start.y = Cotation->FlecheD1_oy;
DrawTmp->m_End.x = Cotation->FlecheD1_fx; DrawTmp->m_End.y = Cotation->FlecheD1_fy; 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_Start.y = Cotation->FlecheD2_oy;
DrawTmp->m_End.x = Cotation->FlecheD2_fx; DrawTmp->m_End.y = Cotation->FlecheD2_fy; 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_Start.y = Cotation->FlecheG1_oy;
DrawTmp->m_End.x = Cotation->FlecheG1_fx; DrawTmp->m_End.y = Cotation->FlecheG1_fy; 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_Start.y = Cotation->FlecheG2_oy;
DrawTmp->m_End.x = Cotation->FlecheG2_fx; DrawTmp->m_End.y = Cotation->FlecheG2_fy; 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;
...@@ -329,14 +325,14 @@ void PlotMirePcb(Plotter *plotter, MIREPCB* Mire, int masque_layer, ...@@ -329,14 +325,14 @@ 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 );
DrawTmp->m_Shape = S_SEGMENT; DrawTmp->m_Shape = S_SEGMENT;
/* Trace des 2 traits */ /* Trace des 2 traits */
...@@ -352,26 +348,27 @@ void PlotMirePcb(Plotter *plotter, MIREPCB* Mire, int masque_layer, ...@@ -352,26 +348,27 @@ void PlotMirePcb(Plotter *plotter, MIREPCB* Mire, int masque_layer,
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_Start.y = Mire->m_Pos.y - dy1;
DrawTmp->m_End.x = Mire->m_Pos.x + dx1; DrawTmp->m_End.y = Mire->m_Pos.y + dy1; DrawTmp->m_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_Start.y = Mire->m_Pos.y - dy2;
DrawTmp->m_End.x = Mire->m_Pos.x + dx2; DrawTmp->m_End.y = Mire->m_Pos.y + dy2; DrawTmp->m_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;
} }
/**********************************************************************/ /**********************************************************************/
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 )
/**********************************************************************/ /**********************************************************************/
/* Trace les contours des modules */ /* Trace les contours des modules */
{ {
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;
...@@ -386,8 +383,8 @@ void Plot_Edges_Modules(Plotter *plotter, BOARD* pcb, int masque_layer, ...@@ -386,8 +383,8 @@ void Plot_Edges_Modules(Plotter *plotter, BOARD* pcb, int masque_layer,
/**************************************************************/ /**************************************************************/
void Plot_1_EdgeModule( Plotter *plotter, EDGE_MODULE* PtEdge, void Plot_1_EdgeModule( Plotter* plotter, EDGE_MODULE* PtEdge,
GRTraceMode trace_mode) GRTraceMode trace_mode )
/**************************************************************/ /**************************************************************/
/* Trace les contours des modules */ /* Trace les contours des modules */
{ {
...@@ -409,12 +406,12 @@ void Plot_1_EdgeModule( Plotter *plotter, EDGE_MODULE* PtEdge, ...@@ -409,12 +406,12 @@ void Plot_1_EdgeModule( Plotter *plotter, EDGE_MODULE* PtEdge,
switch( type_trace ) switch( type_trace )
{ {
case S_SEGMENT: case S_SEGMENT:
plotter->thick_segment(pos, end, thickness, trace_mode); plotter->thick_segment( pos, end, thickness, trace_mode );
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:
...@@ -456,7 +453,7 @@ void Plot_1_EdgeModule( Plotter *plotter, EDGE_MODULE* PtEdge, ...@@ -456,7 +453,7 @@ 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;
...@@ -465,8 +462,8 @@ void Plot_1_EdgeModule( Plotter *plotter, EDGE_MODULE* PtEdge, ...@@ -465,8 +462,8 @@ void Plot_1_EdgeModule( Plotter *plotter, EDGE_MODULE* PtEdge,
/****************************************************************************/ /****************************************************************************/
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 */ /* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules */
{ {
...@@ -483,7 +480,7 @@ void PlotTextePcb(Plotter *plotter, TEXTE_PCB* pt_texte, int masque_layer, ...@@ -483,7 +480,7 @@ void PlotTextePcb(Plotter *plotter, TEXTE_PCB* pt_texte, int masque_layer,
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;
...@@ -500,28 +497,27 @@ void PlotTextePcb(Plotter *plotter, TEXTE_PCB* pt_texte, int masque_layer, ...@@ -500,28 +497,27 @@ void PlotTextePcb(Plotter *plotter, TEXTE_PCB* pt_texte, int masque_layer,
{ {
wxString txt = list->Item( i ); wxString txt = list->Item( i );
plotter->text( pos, BLACK, plotter->text( pos, BLACK,
txt, txt,
orient, size, orient, size,
pt_texte->m_HJustify, pt_texte->m_VJustify, pt_texte->m_HJustify, pt_texte->m_VJustify,
thickness, pt_texte->m_Italic, pt_texte->m_Bold ); thickness, pt_texte->m_Italic, pt_texte->m_Bold );
pos += offset; pos += offset;
} }
delete (list); delete (list);
} }
else else
plotter->text( pos, BLACK, plotter->text( pos, BLACK,
pt_texte->m_Text, pt_texte->m_Text,
orient, size, orient, size,
pt_texte->m_HJustify, pt_texte->m_VJustify, pt_texte->m_HJustify, pt_texte->m_VJustify,
thickness, pt_texte->m_Italic, pt_texte->m_Bold ); thickness, pt_texte->m_Italic, pt_texte->m_Bold );
} }
/*********************************************************/ /*********************************************************/
void PlotFilledAreas(Plotter *plotter, ZONE_CONTAINER* aZone, void PlotFilledAreas( Plotter* plotter, ZONE_CONTAINER* aZone,
GRTraceMode trace_mode) GRTraceMode trace_mode )
/*********************************************************/ /*********************************************************/
/* Plot areas (given by .m_FilledPolysList member) in a zone /* Plot areas (given by .m_FilledPolysList member) in a zone
...@@ -562,8 +558,8 @@ void PlotFilledAreas(Plotter *plotter, ZONE_CONTAINER* aZone, ...@@ -562,8 +558,8 @@ void PlotFilledAreas(Plotter *plotter, ZONE_CONTAINER* aZone,
if( corner->end_contour ) // Plot the current filled area outline if( corner->end_contour ) // Plot the current filled area outline
{ {
// First, close the outline // First, close the outline
if( CornersBuffer[0] != CornersBuffer[ii - 2] if( CornersBuffer[0] != CornersBuffer[ii - 2]
|| CornersBuffer[1] != CornersBuffer[ii - 1] ) || CornersBuffer[1] != CornersBuffer[ii - 1] )
{ {
CornersBuffer[ii++] = CornersBuffer[0]; CornersBuffer[ii++] = CornersBuffer[0];
CornersBuffer[ii] = CornersBuffer[1]; CornersBuffer[ii] = CornersBuffer[1];
...@@ -571,42 +567,42 @@ void PlotFilledAreas(Plotter *plotter, ZONE_CONTAINER* aZone, ...@@ -571,42 +567,42 @@ void PlotFilledAreas(Plotter *plotter, ZONE_CONTAINER* aZone,
} }
// Plot the current filled area outline // Plot the current filled area outline
if (trace_mode == FILLED) if( trace_mode == FILLED )
{ {
if( aZone->m_FillMode == 0 ) // We are using solid polygons (if != 0: using segments in m_Zone) if( aZone->m_FillMode == 0 ) // We are using solid polygons (if != 0: using segments in m_Zone)
plotter->poly( corners_count, CornersBuffer, FILLED_SHAPE ); plotter->poly( corners_count, CornersBuffer, FILLED_SHAPE );
if( aZone->m_ZoneMinThickness > 0 ) if( aZone->m_ZoneMinThickness > 0 )
plotter->poly( corners_count, CornersBuffer, NO_FILL, plotter->poly( corners_count, CornersBuffer, NO_FILL,
aZone->m_ZoneMinThickness ); aZone->m_ZoneMinThickness );
} }
else else
{ {
if( aZone->m_ZoneMinThickness > 0 ) if( aZone->m_ZoneMinThickness > 0 )
{ {
for (int ii=1; ii<corners_count; ii++) for( int ii = 1; ii<corners_count; ii++ )
plotter->thick_segment( plotter->thick_segment(
wxPoint(CornersBuffer[ii*2-2], wxPoint( CornersBuffer[ii * 2 - 2],
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 );
} }
corners_count = 0; corners_count = 0;
ii = 0; ii = 0;
} }
} }
} }
/******************************************************************************/ /******************************************************************************/
void PlotDrawSegment(Plotter *plotter, DRAWSEGMENT* pt_segm, int masque_layer, void PlotDrawSegment( Plotter* plotter, DRAWSEGMENT* pt_segm, int masque_layer,
GRTraceMode trace_mode) GRTraceMode trace_mode )
/******************************************************************************/ /******************************************************************************/
/* Trace un element du type DRAWSEGMENT draw appartenant /* Plot items type DRAWSEGMENT on layers allowed by masque_layer
* aux couches specifiees par masque_layer
*/ */
{ {
wxPoint start, end; wxPoint start, end;
...@@ -619,50 +615,53 @@ void PlotDrawSegment(Plotter *plotter, DRAWSEGMENT* pt_segm, int masque_layer, ...@@ -619,50 +615,53 @@ void PlotDrawSegment(Plotter *plotter, DRAWSEGMENT* pt_segm, int masque_layer,
if( trace_mode == FILAIRE ) if( trace_mode == FILAIRE )
thickness = g_pcb_plot_options.PlotLine_Width; thickness = g_pcb_plot_options.PlotLine_Width;
else else
thickness = pt_segm->m_Width; thickness = pt_segm->m_Width;
start = pt_segm->m_Start; start = pt_segm->m_Start;
end = pt_segm->m_End; end = pt_segm->m_End;
plotter->set_current_line_width(thickness); plotter->set_current_line_width( thickness );
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;
default: break;
plotter->thick_segment(start, end, thickness, trace_mode);
} default:
plotter->thick_segment( start, end, thickness, trace_mode );
}
} }
/*********************************************************************/ /*********************************************************************/
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.
int layer_mask = g_TabOneLayerMask[Layer]; int layer_mask = g_TabOneLayerMask[Layer];
if( !g_pcb_plot_options.Exclude_Edges_Pcb ) if( !g_pcb_plot_options.Exclude_Edges_Pcb )
layer_mask |= EDGE_LAYER; layer_mask |= EDGE_LAYER;
switch( Layer ) switch( Layer )
{ {
case FIRST_COPPER_LAYER: case FIRST_COPPER_LAYER:
case LAYER_N_2: case LAYER_N_2:
case LAYER_N_3: case LAYER_N_3:
...@@ -679,83 +678,82 @@ void WinEDA_BasePcbFrame::Plot_Layer(Plotter *plotter, int Layer, ...@@ -679,83 +678,82 @@ void WinEDA_BasePcbFrame::Plot_Layer(Plotter *plotter, int Layer,
case LAYER_N_14: case LAYER_N_14:
case LAYER_N_15: case LAYER_N_15:
case LAST_COPPER_LAYER: case LAST_COPPER_LAYER:
Plot_Standard_Layer( plotter, layer_mask, 0, true, trace_mode ); Plot_Standard_Layer( plotter, layer_mask, 0, true, trace_mode );
break; break;
case SOLDERMASK_N_CU: case SOLDERMASK_N_CU:
case SOLDERMASK_N_CMP: case SOLDERMASK_N_CMP:
Plot_Standard_Layer( plotter, layer_mask, Plot_Standard_Layer( plotter, layer_mask,
g_DesignSettings.m_MaskMargin, g_DesignSettings.m_MaskMargin,
g_pcb_plot_options.DrawViaOnMaskLayer, trace_mode); g_pcb_plot_options.DrawViaOnMaskLayer, trace_mode );
break; break;
case SOLDERPASTE_N_CU: case SOLDERPASTE_N_CU:
case SOLDERPASTE_N_CMP: case SOLDERPASTE_N_CMP:
Plot_Standard_Layer( plotter, layer_mask, 0, false, trace_mode); Plot_Standard_Layer( plotter, layer_mask, 0, false, trace_mode );
break; break;
default: default:
Plot_Serigraphie( plotter, layer_mask, trace_mode ); Plot_Serigraphie( plotter, layer_mask, trace_mode );
break; break;
} }
PlotDrillMark(plotter, trace_mode );
PlotDrillMark( plotter, trace_mode );
} }
/*********************************************************************/ /*********************************************************************/
void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter, void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter,
int masque_layer, int garde, bool trace_via, GRTraceMode trace_mode ) int masque_layer,
int garde,
bool trace_via,
GRTraceMode trace_mode )
/*********************************************************************/ /*********************************************************************/
/* Trace en format HPGL. d'une couche cuivre ou masque /* Trace en format HPGL. d'une couche cuivre ou masque
* 1 unite HPGL = 0.98 mils ( 1 mil = 1.02041 unite HPGL ) . * 1 unite HPGL = 0.98 mils ( 1 mil = 1.02041 unite HPGL ) .
*/ */
{ {
wxPoint pos; wxPoint pos;
wxSize size; wxSize size;
wxString msg; wxString msg;
// trace des elements type Drawings Pcb : // trace des elements type Drawings Pcb :
for (BOARD_ITEM* item = m_Pcb->m_Drawings; for( BOARD_ITEM* item = m_Pcb->m_Drawings; item; item = item->Next() )
item;
item = item->Next() )
{ {
switch( item->Type() ) switch( item->Type() )
{ {
case TYPE_DRAWSEGMENT: case TYPE_DRAWSEGMENT:
PlotDrawSegment(plotter, (DRAWSEGMENT*) item, masque_layer, trace_mode ); PlotDrawSegment( plotter, (DRAWSEGMENT*) item, masque_layer, trace_mode );
break; break;
case TYPE_TEXTE: case TYPE_TEXTE:
PlotTextePcb(plotter, (TEXTE_PCB*) item, masque_layer, trace_mode ); PlotTextePcb( plotter, (TEXTE_PCB*) item, masque_layer, trace_mode );
break; break;
case TYPE_COTATION: case TYPE_COTATION:
PlotCotation(plotter, (COTATION*) item, masque_layer, trace_mode ); PlotCotation( plotter, (COTATION*) item, masque_layer, trace_mode );
break; break;
case TYPE_MIRE: case TYPE_MIRE:
PlotMirePcb(plotter, (MIREPCB*) item, masque_layer, trace_mode ); PlotMirePcb( plotter, (MIREPCB*) item, masque_layer, trace_mode );
break; break;
case TYPE_MARKER: case TYPE_MARKER:
break; break;
default: default:
DisplayError( this, DisplayError( this,
wxT( "Plot_Layer : Unexpected Draw Type" ) ); wxT( "Plot_Standard_Layer() error : Unexpected Draw Type" ) );
break; break;
} }
} }
/* Draw footprint shapes without pads (pads will plotted later) */ /* Draw footprint shapes without pads (pads will plotted later) */
for( MODULE* module = m_Pcb->m_Modules; for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
module;
module = module->Next() )
{ {
for( BOARD_ITEM* item = module->m_Drawings; for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() )
item;
item = item->Next() )
{ {
switch( item->Type() ) switch( item->Type() )
{ {
...@@ -765,15 +763,13 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter, ...@@ -765,15 +763,13 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter,
break; break;
default: default:
break; break;
} }
} }
} }
/* Plot footprint pads */ /* Plot footprint pads */
for( MODULE* module = m_Pcb->m_Modules; for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
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() )
{ {
...@@ -792,39 +788,34 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter, ...@@ -792,39 +788,34 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter,
continue; continue;
switch( pad->m_PadShape ) switch( pad->m_PadShape )
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
plotter->flash_pad_circle(pos, size.x, trace_mode); plotter->flash_pad_circle( pos, size.x, trace_mode );
break; break;
case PAD_OVAL: case PAD_OVAL:
plotter->flash_pad_oval(pos, size, pad->m_Orient, plotter->flash_pad_oval( pos, size, pad->m_Orient, trace_mode );
trace_mode);
break; break;
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
{ {
wxSize delta = pad->m_DeltaSize; wxSize delta = pad->m_DeltaSize;
plotter->flash_pad_trapez(pos, size, plotter->flash_pad_trapez( pos, size, delta, pad->m_Orient, trace_mode );
delta, pad->m_Orient, trace_mode); }
} break;
break;
case PAD_RECT: case PAD_RECT:
default: default:
plotter->flash_pad_rect(pos, size, pad->m_Orient, plotter->flash_pad_rect( pos, size, pad->m_Orient, trace_mode );
trace_mode); break;
break; }
}
} }
} }
/* Plot vias : */ /* Plot vias : */
if( trace_via ) if( trace_via )
{ {
for( TRACK* track = m_Pcb->m_Track; for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
track;
track = track->Next() )
{ {
if( track->Type() != TYPE_VIA ) if( track->Type() != TYPE_VIA )
continue; continue;
...@@ -849,14 +840,12 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter, ...@@ -849,14 +840,12 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter,
if( size.x <= 0 ) if( size.x <= 0 )
continue; continue;
plotter->flash_pad_circle(pos, size.x, trace_mode ); plotter->flash_pad_circle( pos, size.x, trace_mode );
} }
} }
/* Plot tracks (not vias) : */ /* Plot tracks (not vias) : */
for( TRACK* track = m_Pcb->m_Track; for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
track;
track = track->Next() )
{ {
wxPoint end; wxPoint end;
...@@ -874,9 +863,7 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter, ...@@ -874,9 +863,7 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter,
} }
/* Plot zones: */ /* Plot zones: */
for( TRACK* track = m_Pcb->m_Zone; for( TRACK* track = m_Pcb->m_Zone; track; track = track->Next() )
track;
track = track->Next() )
{ {
wxPoint end; wxPoint end;
...@@ -896,14 +883,14 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter, ...@@ -896,14 +883,14 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter,
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii ); ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii );
if( ( ( 1 << edge_zone->GetLayer() ) & masque_layer ) == 0 ) if( ( ( 1 << edge_zone->GetLayer() ) & masque_layer ) == 0 )
continue; continue;
PlotFilledAreas(plotter, edge_zone, trace_mode ); PlotFilledAreas( plotter, edge_zone, trace_mode );
} }
} }
/*************************************/ /***********************************************************************************/
void WinEDA_BasePcbFrame::PlotDrillMark(Plotter *plotter, GRTraceMode trace_mode ) void WinEDA_BasePcbFrame::PlotDrillMark( Plotter* plotter, GRTraceMode trace_mode )
/*************************************/ /***********************************************************************************/
/* 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
...@@ -920,8 +907,9 @@ void WinEDA_BasePcbFrame::PlotDrillMark(Plotter *plotter, GRTraceMode trace_mode ...@@ -920,8 +907,9 @@ void WinEDA_BasePcbFrame::PlotDrillMark(Plotter *plotter, GRTraceMode trace_mode
if( g_pcb_plot_options.DrillShapeOpt == PCB_Plot_Options::NO_DRILL_SHAPE ) if( g_pcb_plot_options.DrillShapeOpt == PCB_Plot_Options::NO_DRILL_SHAPE )
return; return;
if (trace_mode == FILLED) { if( trace_mode == FILLED )
plotter->set_color(WHITE); {
plotter->set_color( WHITE );
} }
for( pts = m_Pcb->m_Track; pts != NULL; pts = pts->Next() ) for( pts = m_Pcb->m_Track; pts != NULL; pts = pts->Next() )
...@@ -937,14 +925,13 @@ void WinEDA_BasePcbFrame::PlotDrillMark(Plotter *plotter, GRTraceMode trace_mode ...@@ -937,14 +925,13 @@ void WinEDA_BasePcbFrame::PlotDrillMark(Plotter *plotter, GRTraceMode trace_mode
plotter->flash_pad_circle( pos, diam.x, trace_mode ); plotter->flash_pad_circle( pos, diam.x, trace_mode );
} }
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;
...@@ -954,18 +941,19 @@ void WinEDA_BasePcbFrame::PlotDrillMark(Plotter *plotter, GRTraceMode trace_mode ...@@ -954,18 +941,19 @@ void WinEDA_BasePcbFrame::PlotDrillMark(Plotter *plotter, GRTraceMode trace_mode
if( PtPad->m_DrillShape == PAD_OVAL ) if( PtPad->m_DrillShape == PAD_OVAL )
{ {
diam = PtPad->m_Drill; diam = PtPad->m_Drill;
plotter->flash_pad_oval(pos, diam, PtPad->m_Orient, trace_mode); plotter->flash_pad_oval( pos, diam, PtPad->m_Orient, trace_mode );
} }
else else
{ {
diam.x = (g_pcb_plot_options.DrillShapeOpt == PCB_Plot_Options::SMALL_DRILL_SHAPE) diam.x = (g_pcb_plot_options.DrillShapeOpt == PCB_Plot_Options::SMALL_DRILL_SHAPE)
? SMALL_DRILL : PtPad->m_Drill.x; ? SMALL_DRILL : PtPad->m_Drill.x;
plotter->flash_pad_circle(pos, diam.x, trace_mode); plotter->flash_pad_circle( pos, diam.x, trace_mode );
} }
} }
} }
if (trace_mode == FILLED) { if( trace_mode == FILLED )
plotter->set_color(BLACK); {
plotter->set_color( BLACK );
} }
} }
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
/********************************************************************************/ /********************************************************************************/
void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer, void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer,
bool PlotOriginIsAuxAxis, bool PlotOriginIsAuxAxis,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/********************************************************************************/ /********************************************************************************/
/* Creates the output files, one per board layer: /* Creates the output files, one per board layer:
...@@ -43,13 +43,13 @@ void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer ...@@ -43,13 +43,13 @@ void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer
if( PlotOriginIsAuxAxis ) if( PlotOriginIsAuxAxis )
offset = m_Auxiliary_Axis_Position; offset = m_Auxiliary_Axis_Position;
else else
{ {
offset.x = 0; offset.x = 0;
offset.y = 0; offset.y = 0;
} }
FILE *output_file = wxFopen( FullFileName, wxT( "wt" ) ); FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) );
if( output_file == NULL ) if( output_file == NULL )
{ {
wxString msg = _( "unable to create file " ) + FullFileName; wxString msg = _( "unable to create file " ) + FullFileName;
...@@ -58,23 +58,23 @@ void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer ...@@ -58,23 +58,23 @@ void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer
} }
SetLocaleTo_C_standard(); SetLocaleTo_C_standard();
Plotter *plotter = new Gerber_Plotter(); Plotter* plotter = new Gerber_Plotter();
/* No mirror and scaling for gerbers! */ /* No mirror and scaling for gerbers! */
plotter->set_viewport(offset, scale, 0); plotter->set_viewport( offset, scale, 0 );
plotter->set_default_line_width( g_pcb_plot_options.PlotLine_Width ); plotter->set_default_line_width( g_pcb_plot_options.PlotLine_Width );
plotter->set_creator(wxT("PCBNEW-RS274X")); plotter->set_creator( wxT( "PCBNEW-RS274X" ) );
plotter->set_filename(FullFileName); plotter->set_filename( FullFileName );
Affiche_1_Parametre( this, 0, _( "File" ), FullFileName, CYAN ); Affiche_1_Parametre( this, 0, _( "File" ), FullFileName, CYAN );
plotter->start_plot(output_file); plotter->start_plot( output_file );
// Sheet refs on gerber CAN be useful... and they're always 1:1 // Sheet refs on gerber CAN be useful... and they're always 1:1
if( g_pcb_plot_options.Plot_Frame_Ref ) if( g_pcb_plot_options.Plot_Frame_Ref )
PlotWorkSheet( plotter, GetScreen() ); PlotWorkSheet( plotter, GetScreen() );
Plot_Layer(plotter, Layer, trace_mode); Plot_Layer( plotter, Layer, trace_mode );
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;
SetLocaleTo_Default(); SetLocaleTo_Default();
} }
...@@ -13,36 +13,38 @@ ...@@ -13,36 +13,38 @@
#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;
wxPoint BoardCenter; wxPoint BoardCenter;
bool Center = FALSE; bool Center = FALSE;
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc; Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
double scale; double scale;
wxPoint offset; wxPoint offset;
MsgPanel->EraseMsgBox(); MsgPanel->EraseMsgBox();
// 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 diametre 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 );
// compute pen_recouvrement (from g_HPGL_Pen_Recouvrement in mils) // compute pen_recouvrement (from g_HPGL_Pen_Recouvrement in mils)
// with plot scale // with plot scale
if( g_pcb_plot_options.HPGL_Pen_Recouvrement < 0 ) if( g_pcb_plot_options.HPGL_Pen_Recouvrement < 0 )
g_pcb_plot_options.HPGL_Pen_Recouvrement = 0; g_pcb_plot_options.HPGL_Pen_Recouvrement = 0;
if( g_pcb_plot_options.HPGL_Pen_Recouvrement >= g_pcb_plot_options.HPGL_Pen_Diam ) if( g_pcb_plot_options.HPGL_Pen_Recouvrement >= g_pcb_plot_options.HPGL_Pen_Diam )
g_pcb_plot_options.HPGL_Pen_Recouvrement = g_pcb_plot_options.HPGL_Pen_Diam - 1; g_pcb_plot_options.HPGL_Pen_Recouvrement = g_pcb_plot_options.HPGL_Pen_Diam - 1;
int pen_recouvrement = wxRound( g_pcb_plot_options.HPGL_Pen_Recouvrement * 10.0 / g_pcb_plot_options.Scale ); int pen_recouvrement = wxRound(
g_pcb_plot_options.HPGL_Pen_Recouvrement * 10.0 / g_pcb_plot_options.Scale );
FILE *output_file = wxFopen( FullFileName, wxT( "wt" ) ); FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) );
if( output_file == NULL ) if( output_file == NULL )
{ {
wxString msg = _( "Unable to create file " ) + FullFileName; wxString msg = _( "Unable to create file " ) + FullFileName;
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
...@@ -51,7 +53,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer, ...@@ -51,7 +53,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
Affiche_1_Parametre( this, 0, _( "File" ), FullFileName, CYAN ); Affiche_1_Parametre( this, 0, _( "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; // Echelle != 1 donc trace centree du PCB
// calcul en unites internes des dimensions des feuilles ( connues en 1/1000 pouce ) // calcul en unites internes des dimensions des feuilles ( connues en 1/1000 pouce )
...@@ -65,48 +67,48 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer, ...@@ -65,48 +67,48 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
if( g_pcb_plot_options.PlotScaleOpt == 0 ) // Optimum scale if( g_pcb_plot_options.PlotScaleOpt == 0 ) // Optimum scale
{ {
double Xscale, Yscale; double Xscale, Yscale;
// Fit to 80% of the page
Xscale = ( (SheetSize.x*0.8) / BoardSize.x); // Fit to 80% of the page
Yscale = ( (SheetSize.y*0.8) / BoardSize.y); Xscale = ( (SheetSize.x * 0.8) / BoardSize.x );
scale = MIN( Xscale, Yscale ); Yscale = ( (SheetSize.y * 0.8) / BoardSize.y );
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) // Calcul du cadrage (echelle != 1 donc recadrage du trace)
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
{ {
offset.x = 0; offset.x = 0;
offset.y = 0; offset.y = 0;
} }
HPGL_Plotter *plotter = new HPGL_Plotter(); HPGL_Plotter* plotter = new HPGL_Plotter();
plotter->set_paper_size(currentsheet); plotter->set_paper_size( currentsheet );
plotter->set_viewport(offset, scale, plotter->set_viewport( offset, scale,
g_pcb_plot_options.PlotOrient); g_pcb_plot_options.PlotOrient );
plotter->set_default_line_width( g_pcb_plot_options.PlotLine_Width ); plotter->set_default_line_width( g_pcb_plot_options.PlotLine_Width );
plotter->set_creator(wxT("PCBNEW-HPGL")); plotter->set_creator( wxT( "PCBNEW-HPGL" ) );
plotter->set_filename(FullFileName); plotter->set_filename( FullFileName );
plotter->set_pen_speed(g_pcb_plot_options.HPGL_Pen_Speed); plotter->set_pen_speed( g_pcb_plot_options.HPGL_Pen_Speed );
plotter->set_pen_number(g_pcb_plot_options.HPGL_Pen_Num); plotter->set_pen_number( g_pcb_plot_options.HPGL_Pen_Num );
plotter->set_pen_overlap(pen_recouvrement); plotter->set_pen_overlap( pen_recouvrement );
plotter->set_pen_diameter(pen_diam); plotter->set_pen_diameter( pen_diam );
plotter->start_plot(output_file); plotter->start_plot( output_file );
/* The worksheet is not significant with scale!=1... It is with /* The worksheet is not significant with scale!=1... It is with
* paperscale!=1, anyway */ * paperscale!=1, anyway */
if( g_pcb_plot_options.Plot_Frame_Ref && !Center) if( g_pcb_plot_options.Plot_Frame_Ref && !Center )
PlotWorkSheet( plotter, GetScreen() ); PlotWorkSheet( plotter, GetScreen() );
Plot_Layer(plotter, Layer, trace_mode); Plot_Layer( plotter, Layer, trace_mode );
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;
SetLocaleTo_Default(); SetLocaleTo_Default();
} }
...@@ -13,27 +13,27 @@ ...@@ -13,27 +13,27 @@
#include "protos.h" #include "protos.h"
/****************************************************************************/ /****************************************************************************/
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 /* Genere un fichier POSTSCRIPT (*.ps) de trace du circuit, couche layer
* if layer < 0: all layers * if layer < 0: all layers
*/ */
{ {
wxSize SheetSize; wxSize SheetSize;
wxSize PaperSize; wxSize PaperSize;
wxSize BoardSize; wxSize BoardSize;
wxPoint BoardCenter; wxPoint BoardCenter;
bool Center = FALSE; bool Center = FALSE;
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc; Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
double scale, paperscale; double scale, paperscale;
Ki_PageDescr* SheetPS; Ki_PageDescr* SheetPS;
wxPoint offset; wxPoint offset;
MsgPanel->EraseMsgBox(); MsgPanel->EraseMsgBox();
FILE *output_file = wxFopen( FullFileName, wxT( "wt" ) ); FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) );
if( output_file == NULL ) if( output_file == NULL )
{ {
wxString msg = _( "Unable to create file " ) + FullFileName; wxString msg = _( "Unable to create file " ) + FullFileName;
...@@ -49,7 +49,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer, ...@@ -49,7 +49,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
// 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 ) // 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;
...@@ -57,16 +57,16 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer, ...@@ -57,16 +57,16 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
if( useA4 ) if( useA4 )
{ {
SheetPS = &g_Sheet_A4; SheetPS = &g_Sheet_A4;
PaperSize.x = g_Sheet_A4.m_Size.x * U_PCB; PaperSize.x = g_Sheet_A4.m_Size.x * U_PCB;
PaperSize.y = g_Sheet_A4.m_Size.y * U_PCB; PaperSize.y = g_Sheet_A4.m_Size.y * U_PCB;
paperscale = (float) PaperSize.x / SheetSize.x; paperscale = (float) PaperSize.x / SheetSize.x;
} }
else else
{ {
SheetPS = currentsheet; SheetPS = currentsheet;
PaperSize = SheetSize; PaperSize = SheetSize;
paperscale = 1; paperscale = 1;
} }
/* calcul des dimensions et centre du PCB */ /* calcul des dimensions et centre du PCB */
...@@ -76,62 +76,62 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer, ...@@ -76,62 +76,62 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
if( g_pcb_plot_options.PlotScaleOpt == 0 ) // Optimum scale if( g_pcb_plot_options.PlotScaleOpt == 0 ) // Optimum scale
{ {
double Xscale, Yscale; double Xscale, Yscale;
// Fit to 80% of the page
Xscale = (PaperSize.x*0.8) / BoardSize.x; // Fit to 80% of the page
Yscale = (PaperSize.y*0.8) / BoardSize.y; Xscale = (PaperSize.x * 0.8) / BoardSize.x;
scale = MIN( Xscale, Yscale ); Yscale = (PaperSize.y * 0.8) / BoardSize.y;
scale = MIN( Xscale, Yscale );
} }
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) // 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
{ {
offset.x = 0; offset.x = 0;
offset.y = 0; offset.y = 0;
} }
PS_Plotter *plotter = new PS_Plotter(); PS_Plotter* plotter = new PS_Plotter();
plotter->set_paper_size(SheetPS); plotter->set_paper_size( SheetPS );
plotter->set_scale_adjust(g_pcb_plot_options.ScaleAdjX, plotter->set_scale_adjust( g_pcb_plot_options.ScaleAdjX,
g_pcb_plot_options.ScaleAdjY); g_pcb_plot_options.ScaleAdjY );
plotter->set_viewport(offset, scale, plotter->set_viewport( offset, scale,
g_pcb_plot_options.PlotOrient); g_pcb_plot_options.PlotOrient );
plotter->set_default_line_width( g_pcb_plot_options.PlotLine_Width ); plotter->set_default_line_width( g_pcb_plot_options.PlotLine_Width );
plotter->set_creator(wxT("PCBNEW-PS")); plotter->set_creator( wxT( "PCBNEW-PS" ) );
plotter->set_filename(FullFileName); plotter->set_filename( FullFileName );
plotter->start_plot(output_file); plotter->start_plot( output_file );
/* The worksheet is not significant with scale!=1... It is with /* The worksheet is not significant with scale!=1... It is with
* paperscale!=1, anyway */ * paperscale!=1, anyway */
if( g_pcb_plot_options.Plot_Frame_Ref && !Center) if( g_pcb_plot_options.Plot_Frame_Ref && !Center )
PlotWorkSheet( plotter, GetScreen() ); PlotWorkSheet( plotter, GetScreen() );
// If plot a negative board: // If plot a negative board:
// Draw a black rectangle (background for plot board in white) // Draw a black rectangle (background for plot board in white)
// 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,
m_Pcb->m_BoundaryBox.GetBottom() + margin), m_Pcb->m_BoundaryBox.GetBottom() + margin ),
FILLED_SHAPE); FILLED_SHAPE );
plotter->set_color( BLACK ); plotter->set_color( BLACK );
} }
Plot_Layer(plotter, Layer, trace_mode); Plot_Layer( plotter, Layer, trace_mode );
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;
SetLocaleTo_Default(); SetLocaleTo_Default();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment