Commit 11d9edfe authored by charras's avatar charras

beautify files

parent daeb1901
......@@ -16,13 +16,13 @@
/* 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 );
static void PlotTextModule(Plotter *plotter, TEXTE_MODULE* pt_texte,
static void PlotTextModule( Plotter* plotter, TEXTE_MODULE* pt_texte,
GRTraceMode trace_mode );
/**********************************************************/
void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter* plotter,
int masque_layer, GRTraceMode trace_mode )
/***********************************************************/
......@@ -37,26 +37,24 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
/* Trace du contour du PCB et des Elements du type Drawings Pcb */
for( PtStruct = m_Pcb->m_Drawings;
PtStruct != NULL;
PtStruct = PtStruct->Next() )
for( PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
switch( PtStruct->Type() )
{
case TYPE_DRAWSEGMENT:
PlotDrawSegment(plotter, (DRAWSEGMENT*) PtStruct, masque_layer, trace_mode );
PlotDrawSegment( plotter, (DRAWSEGMENT*) PtStruct, masque_layer, trace_mode );
break;
case TYPE_TEXTE:
PlotTextePcb(plotter, (TEXTE_PCB*) PtStruct, masque_layer, trace_mode );
PlotTextePcb( plotter, (TEXTE_PCB*) PtStruct, masque_layer, trace_mode );
break;
case TYPE_COTATION:
PlotCotation(plotter, (COTATION*) PtStruct, masque_layer, trace_mode );
PlotCotation( plotter, (COTATION*) PtStruct, masque_layer, trace_mode );
break;
case TYPE_MIRE:
PlotMirePcb(plotter, (MIREPCB*) PtStruct, masque_layer, trace_mode );
PlotMirePcb( plotter, (MIREPCB*) PtStruct, masque_layer, trace_mode );
break;
case TYPE_MARKER:
......@@ -69,7 +67,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
}
/* 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 */
if( g_pcb_plot_options.PlotPadsOnSilkLayer
......@@ -79,18 +77,17 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
Module;
Module = Module->Next() )
{
for(pt_pad = (D_PAD*) Module->m_Pads;
pt_pad != NULL;
pt_pad = pt_pad->Next() )
for( pt_pad = (D_PAD*) Module->m_Pads; pt_pad != NULL; pt_pad = pt_pad->Next() )
{
/* Tst si layer OK */
if( (pt_pad->m_Masque_Layer & masque_layer) == 0
/* Copper pads go on copper silk, component
* pads go on component silk */
&& (((pt_pad->m_Masque_Layer & CUIVRE_LAYER) == 0)
|| ((masque_layer & SILKSCREEN_LAYER_CU) == 0 ))
&& (((pt_pad->m_Masque_Layer & CMP_LAYER) == 0)
|| ((masque_layer & SILKSCREEN_LAYER_CMP) == 0 )))
&& ( ( (pt_pad->m_Masque_Layer & CUIVRE_LAYER) == 0 )
|| ( (masque_layer & SILKSCREEN_LAYER_CU) == 0 ) )
&& ( ( (pt_pad->m_Masque_Layer & CMP_LAYER) == 0 )
|| ( (masque_layer & SILKSCREEN_LAYER_CMP) == 0 ) ) )
{
if( !g_pcb_plot_options.Plot_Pads_All_Layers )
continue;
......@@ -103,15 +100,16 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
switch( pt_pad->m_PadShape & 0x7F )
{
case PAD_CIRCLE:
plotter->flash_pad_circle(pos, size.x, FILAIRE);
plotter->flash_pad_circle( pos, size.x, FILAIRE );
break;
case PAD_OVAL:
plotter->flash_pad_oval(pos, size,
plotter->flash_pad_oval( pos, size,
pt_pad->m_Orient, FILAIRE );
break;
case PAD_TRAPEZOID: {
case PAD_TRAPEZOID:
{
wxSize delta;
delta = pt_pad->m_DeltaSize;
plotter->flash_pad_trapez( pos, size,
......@@ -122,8 +120,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
case PAD_RECT:
default:
plotter->flash_pad_rect( pos, size, pt_pad->m_Orient,
FILAIRE);
plotter->flash_pad_rect( pos, size, pt_pad->m_Orient, FILAIRE );
break;
}
}
......@@ -131,9 +128,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
} /* Fin Sequence de trace des Pads */
/* Trace Textes MODULES */
for( MODULE* Module = m_Pcb->m_Modules;
Module;
Module = Module->Next() )
for( MODULE* Module = m_Pcb->m_Modules; Module; Module = Module->Next() )
{
/* Analyse des autorisations de trace pour les textes VALEUR et REF */
trace_val = g_pcb_plot_options.Sel_Texte_Valeur;
......@@ -181,12 +176,12 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
/* Trace effectif des textes */
if( trace_ref )
PlotTextModule(plotter, Module->m_Reference, trace_mode );
PlotTextModule( plotter, Module->m_Reference, trace_mode );
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 = pt_texte->Next() )
{
......@@ -204,7 +199,8 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
wxString errMsg;
errMsg.Printf(
_( "Your BOARD has a bad layer number of %u for module\n %s's \"module text\" text of %s." ),
_(
"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() );
DisplayError( this, errMsg );
return;
......@@ -213,7 +209,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
if( !( (1 << textLayer) & masque_layer ) )
continue;
PlotTextModule(plotter, pt_texte, trace_mode);
PlotTextModule( plotter, pt_texte, trace_mode );
}
}
......@@ -223,7 +219,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii );
if( ( ( 1 << edge_zone->GetLayer() ) & masque_layer ) == 0 )
continue;
PlotFilledAreas(plotter, edge_zone, trace_mode );
PlotFilledAreas( plotter, edge_zone, trace_mode );
}
// Plot segments used to fill zone areas:
......@@ -231,15 +227,15 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter *plotter,
{
if( ( ( 1 << seg->GetLayer() ) & masque_layer ) == 0 )
continue;
plotter->thick_segment(seg->m_Start, seg->m_End, seg->m_Width,
trace_mode);
plotter->thick_segment( seg->m_Start, seg->m_End, seg->m_Width,
trace_mode );
}
}
/********************************************************************/
static void PlotTextModule(Plotter *plotter, TEXTE_MODULE* pt_texte,
GRTraceMode trace_mode)
static void PlotTextModule( Plotter* plotter, TEXTE_MODULE* pt_texte,
GRTraceMode trace_mode )
/********************************************************************/
{
wxSize size;
......@@ -257,7 +253,7 @@ static void PlotTextModule(Plotter *plotter, TEXTE_MODULE* pt_texte,
thickness = -1;
if( pt_texte->m_Mirror )
size.x = -size.x; // Text is mirrored
NEGATE( size.x ); // Text is mirrored
plotter->text( pos, BLACK,
pt_texte->m_Text,
......@@ -268,8 +264,8 @@ static void PlotTextModule(Plotter *plotter, TEXTE_MODULE* pt_texte,
/*******************************************************************************/
void PlotCotation(Plotter *plotter, COTATION* Cotation, int masque_layer,
GRTraceMode trace_mode)
void PlotCotation( Plotter* plotter, COTATION* Cotation, int masque_layer,
GRTraceMode trace_mode )
/*******************************************************************************/
{
DRAWSEGMENT* DrawTmp;
......@@ -279,45 +275,45 @@ void PlotCotation(Plotter *plotter, COTATION* Cotation, int masque_layer,
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() );
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_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_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_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_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_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_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_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;
}
/*****************************************************************/
void PlotMirePcb(Plotter *plotter, MIREPCB* Mire, int masque_layer,
void PlotMirePcb( Plotter* plotter, MIREPCB* Mire, int masque_layer,
GRTraceMode trace_mode )
/*****************************************************************/
{
......@@ -329,14 +325,14 @@ void PlotMirePcb(Plotter *plotter, MIREPCB* Mire, int masque_layer,
DrawTmp = new DRAWSEGMENT( NULL );
DrawTmp->m_Width = (trace_mode==FILAIRE)?-1:Mire->m_Width;
DrawTmp->m_Width = (trace_mode==FILAIRE) ? -1 : Mire->m_Width;
DrawTmp->SetLayer( Mire->GetLayer() );
DrawTmp->m_Start.x = Mire->m_Pos.x; DrawTmp->m_Start.y = Mire->m_Pos.y;
DrawTmp->m_End.x = DrawTmp->m_Start.x + (Mire->m_Size / 4);
DrawTmp->m_End.y = DrawTmp->m_Start.y;
DrawTmp->m_Shape = S_CIRCLE;
PlotDrawSegment(plotter, DrawTmp, masque_layer, trace_mode );
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
DrawTmp->m_Shape = S_SEGMENT;
/* Trace des 2 traits */
......@@ -352,24 +348,25 @@ 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_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_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;
}
/**********************************************************************/
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 )
/**********************************************************************/
/* Trace les contours des modules */
{
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->Next() )
{
......@@ -386,8 +383,8 @@ void Plot_Edges_Modules(Plotter *plotter, BOARD* pcb, int masque_layer,
/**************************************************************/
void Plot_1_EdgeModule( Plotter *plotter, EDGE_MODULE* PtEdge,
GRTraceMode trace_mode)
void Plot_1_EdgeModule( Plotter* plotter, EDGE_MODULE* PtEdge,
GRTraceMode trace_mode )
/**************************************************************/
/* Trace les contours des modules */
{
......@@ -409,12 +406,12 @@ void Plot_1_EdgeModule( Plotter *plotter, EDGE_MODULE* PtEdge,
switch( type_trace )
{
case S_SEGMENT:
plotter->thick_segment(pos, end, thickness, trace_mode);
plotter->thick_segment( pos, end, thickness, trace_mode );
break;
case S_CIRCLE:
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;
case S_ARC:
......@@ -456,7 +453,7 @@ void Plot_1_EdgeModule( Plotter *plotter, EDGE_MODULE* PtEdge,
*ptr++ = y;
}
plotter->poly(PtEdge->m_PolyPoints.size(), ptr_base, NO_FILL, thickness );
plotter->poly( PtEdge->m_PolyPoints.size(), ptr_base, NO_FILL, thickness );
free( ptr_base );
}
break;
......@@ -465,8 +462,8 @@ void Plot_1_EdgeModule( Plotter *plotter, EDGE_MODULE* PtEdge,
/****************************************************************************/
void PlotTextePcb(Plotter *plotter, TEXTE_PCB* pt_texte, int masque_layer,
GRTraceMode trace_mode)
void PlotTextePcb( Plotter* plotter, TEXTE_PCB* pt_texte, int masque_layer,
GRTraceMode trace_mode )
/****************************************************************************/
/* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules */
{
......@@ -483,7 +480,7 @@ void PlotTextePcb(Plotter *plotter, TEXTE_PCB* pt_texte, int masque_layer,
size = pt_texte->m_Size;
pos = pt_texte->m_Pos;
orient = pt_texte->m_Orient;
thickness = (trace_mode==FILAIRE)?-1:pt_texte->m_Width;
thickness = (trace_mode==FILAIRE) ? -1 : pt_texte->m_Width;
if( pt_texte->m_Mirror )
size.x = -size.x;
......@@ -509,7 +506,6 @@ void PlotTextePcb(Plotter *plotter, TEXTE_PCB* pt_texte, int masque_layer,
delete (list);
}
else
plotter->text( pos, BLACK,
pt_texte->m_Text,
......@@ -520,8 +516,8 @@ void PlotTextePcb(Plotter *plotter, TEXTE_PCB* pt_texte, int masque_layer,
/*********************************************************/
void PlotFilledAreas(Plotter *plotter, ZONE_CONTAINER* aZone,
GRTraceMode trace_mode)
void PlotFilledAreas( Plotter* plotter, ZONE_CONTAINER* aZone,
GRTraceMode trace_mode )
/*********************************************************/
/* Plot areas (given by .m_FilledPolysList member) in a zone
......@@ -571,7 +567,7 @@ void PlotFilledAreas(Plotter *plotter, ZONE_CONTAINER* aZone,
}
// 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)
plotter->poly( corners_count, CornersBuffer, FILLED_SHAPE );
......@@ -583,16 +579,16 @@ void PlotFilledAreas(Plotter *plotter, ZONE_CONTAINER* aZone,
{
if( aZone->m_ZoneMinThickness > 0 )
{
for (int ii=1; ii<corners_count; ii++)
for( int ii = 1; ii<corners_count; ii++ )
plotter->thick_segment(
wxPoint(CornersBuffer[ii*2-2],
CornersBuffer[ii*2-1]),
wxPoint(CornersBuffer[ii*2],
CornersBuffer[ii*2+1]),
(trace_mode == FILAIRE)?-1:aZone->m_ZoneMinThickness,
trace_mode);
wxPoint( CornersBuffer[ii * 2 - 2],
CornersBuffer[ii * 2 - 1] ),
wxPoint( CornersBuffer[ii * 2],
CornersBuffer[ii * 2 + 1] ),
(trace_mode == FILAIRE) ? -1 : aZone->m_ZoneMinThickness,
trace_mode );
}
plotter->set_current_line_width(-1);
plotter->set_current_line_width( -1 );
}
corners_count = 0;
ii = 0;
......@@ -600,13 +596,13 @@ void PlotFilledAreas(Plotter *plotter, ZONE_CONTAINER* aZone,
}
}
/******************************************************************************/
void PlotDrawSegment(Plotter *plotter, DRAWSEGMENT* pt_segm, int masque_layer,
GRTraceMode trace_mode)
void PlotDrawSegment( Plotter* plotter, DRAWSEGMENT* pt_segm, int masque_layer,
GRTraceMode trace_mode )
/******************************************************************************/
/* Trace un element du type DRAWSEGMENT draw appartenant
* aux couches specifiees par masque_layer
/* Plot items type DRAWSEGMENT on layers allowed by masque_layer
*/
{
wxPoint start, end;
......@@ -624,40 +620,43 @@ void PlotDrawSegment(Plotter *plotter, DRAWSEGMENT* pt_segm, int masque_layer,
start = pt_segm->m_Start;
end = pt_segm->m_End;
plotter->set_current_line_width(thickness);
switch (pt_segm->m_Shape)
plotter->set_current_line_width( thickness );
switch( pt_segm->m_Shape )
{
case S_CIRCLE:
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;
case S_ARC:
radius = (int) hypot( (double) ( end.x - start.x ), (double) ( end.y - start.y ) );
StAngle = ArcTangente( end.y - start.y, end.x - start.x );
EndAngle = StAngle + pt_segm->m_Angle;
plotter->thick_arc(start, -EndAngle, -StAngle, radius, thickness, trace_mode);
plotter->thick_arc( start, -EndAngle, -StAngle, radius, thickness, trace_mode );
break;
case S_CURVE:
for (unsigned i=1; i < pt_segm->m_BezierPoints.size(); i++)
plotter->thick_segment( pt_segm->m_BezierPoints[i-1],
pt_segm->m_BezierPoints[i], thickness, trace_mode);
for( unsigned i = 1; i < pt_segm->m_BezierPoints.size(); i++ )
plotter->thick_segment( pt_segm->m_BezierPoints[i - 1],
pt_segm->m_BezierPoints[i], thickness, trace_mode );
break;
default:
plotter->thick_segment(start, end, thickness, trace_mode);
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 )
/*********************************************************************/
{
// Specify that the contents of the "Edges Pcb" layer are to be plotted
// in addition to the contents of the currently specified layer.
int layer_mask = g_TabOneLayerMask[Layer];
if( !g_pcb_plot_options.Exclude_Edges_Pcb )
layer_mask |= EDGE_LAYER;
......@@ -686,24 +685,29 @@ void WinEDA_BasePcbFrame::Plot_Layer(Plotter *plotter, int Layer,
case SOLDERMASK_N_CMP:
Plot_Standard_Layer( plotter, layer_mask,
g_DesignSettings.m_MaskMargin,
g_pcb_plot_options.DrawViaOnMaskLayer, trace_mode);
g_pcb_plot_options.DrawViaOnMaskLayer, trace_mode );
break;
case SOLDERPASTE_N_CU:
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;
default:
Plot_Serigraphie( plotter, layer_mask, trace_mode );
break;
}
PlotDrillMark(plotter, trace_mode );
PlotDrillMark( plotter, trace_mode );
}
/*********************************************************************/
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
......@@ -716,26 +720,24 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter,
// trace des elements type Drawings Pcb :
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() )
{
case TYPE_DRAWSEGMENT:
PlotDrawSegment(plotter, (DRAWSEGMENT*) item, masque_layer, trace_mode );
PlotDrawSegment( plotter, (DRAWSEGMENT*) item, masque_layer, trace_mode );
break;
case TYPE_TEXTE:
PlotTextePcb(plotter, (TEXTE_PCB*) item, masque_layer, trace_mode );
PlotTextePcb( plotter, (TEXTE_PCB*) item, masque_layer, trace_mode );
break;
case TYPE_COTATION:
PlotCotation(plotter, (COTATION*) item, masque_layer, trace_mode );
PlotCotation( plotter, (COTATION*) item, masque_layer, trace_mode );
break;
case TYPE_MIRE:
PlotMirePcb(plotter, (MIREPCB*) item, masque_layer, trace_mode );
PlotMirePcb( plotter, (MIREPCB*) item, masque_layer, trace_mode );
break;
case TYPE_MARKER:
......@@ -743,19 +745,15 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter,
default:
DisplayError( this,
wxT( "Plot_Layer : Unexpected Draw Type" ) );
wxT( "Plot_Standard_Layer() error : Unexpected Draw Type" ) );
break;
}
}
/* Draw footprint shapes without pads (pads will plotted later) */
for( MODULE* module = m_Pcb->m_Modules;
module;
module = module->Next() )
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
{
for( BOARD_ITEM* item = module->m_Drawings;
item;
item = item->Next() )
for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() )
{
switch( item->Type() )
{
......@@ -771,9 +769,7 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter,
}
/* 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() )
{
......@@ -794,26 +790,23 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter,
switch( pad->m_PadShape )
{
case PAD_CIRCLE:
plotter->flash_pad_circle(pos, size.x, trace_mode);
plotter->flash_pad_circle( pos, size.x, trace_mode );
break;
case PAD_OVAL:
plotter->flash_pad_oval(pos, size, pad->m_Orient,
trace_mode);
plotter->flash_pad_oval( pos, size, pad->m_Orient, trace_mode );
break;
case PAD_TRAPEZOID:
{
wxSize delta = pad->m_DeltaSize;
plotter->flash_pad_trapez(pos, size,
delta, pad->m_Orient, trace_mode);
plotter->flash_pad_trapez( pos, size, delta, pad->m_Orient, trace_mode );
}
break;
case PAD_RECT:
default:
plotter->flash_pad_rect(pos, size, pad->m_Orient,
trace_mode);
plotter->flash_pad_rect( pos, size, pad->m_Orient, trace_mode );
break;
}
}
......@@ -822,9 +815,7 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter,
/* Plot vias : */
if( trace_via )
{
for( TRACK* track = m_Pcb->m_Track;
track;
track = track->Next() )
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
{
if( track->Type() != TYPE_VIA )
continue;
......@@ -849,14 +840,12 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter,
if( size.x <= 0 )
continue;
plotter->flash_pad_circle(pos, size.x, trace_mode );
plotter->flash_pad_circle( pos, size.x, trace_mode );
}
}
/* Plot tracks (not vias) : */
for( TRACK* track = m_Pcb->m_Track;
track;
track = track->Next() )
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
{
wxPoint end;
......@@ -874,9 +863,7 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter,
}
/* Plot zones: */
for( TRACK* track = m_Pcb->m_Zone;
track;
track = track->Next() )
for( TRACK* track = m_Pcb->m_Zone; track; track = track->Next() )
{
wxPoint end;
......@@ -896,14 +883,14 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter,
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii );
if( ( ( 1 << edge_zone->GetLayer() ) & masque_layer ) == 0 )
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.
* Must be called after all drawings, because it
......@@ -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 )
return;
if (trace_mode == FILLED) {
plotter->set_color(WHITE);
if( trace_mode == FILLED )
{
plotter->set_color( WHITE );
}
for( pts = m_Pcb->m_Track; pts != NULL; pts = pts->Next() )
......@@ -941,8 +929,7 @@ void WinEDA_BasePcbFrame::PlotDrillMark(Plotter *plotter, GRTraceMode trace_mode
Module != NULL;
Module = Module->Next() )
{
for(PtPad = Module->m_Pads;
for( PtPad = Module->m_Pads;
PtPad != NULL;
PtPad = PtPad->Next() )
{
......@@ -954,18 +941,19 @@ void WinEDA_BasePcbFrame::PlotDrillMark(Plotter *plotter, GRTraceMode trace_mode
if( PtPad->m_DrillShape == PAD_OVAL )
{
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
{
diam.x = (g_pcb_plot_options.DrillShapeOpt == PCB_Plot_Options::SMALL_DRILL_SHAPE)
? 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) {
plotter->set_color(BLACK);
if( trace_mode == FILLED )
{
plotter->set_color( BLACK );
}
}
......@@ -49,7 +49,7 @@ void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer
offset.y = 0;
}
FILE *output_file = wxFopen( FullFileName, wxT( "wt" ) );
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) );
if( output_file == NULL )
{
wxString msg = _( "unable to create file " ) + FullFileName;
......@@ -58,23 +58,23 @@ void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer
}
SetLocaleTo_C_standard();
Plotter *plotter = new Gerber_Plotter();
Plotter* plotter = new Gerber_Plotter();
/* 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_creator(wxT("PCBNEW-RS274X"));
plotter->set_filename(FullFileName);
plotter->set_creator( wxT( "PCBNEW-RS274X" ) );
plotter->set_filename( FullFileName );
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
if( g_pcb_plot_options.Plot_Frame_Ref )
PlotWorkSheet( plotter, GetScreen() );
Plot_Layer(plotter, Layer, trace_mode);
Plot_Layer( plotter, Layer, trace_mode );
plotter->end_plot();
delete plotter;
SetLocaleTo_Default();
}
......@@ -14,7 +14,7 @@
/*****************************************************************************/
void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
GRTraceMode trace_mode)
GRTraceMode trace_mode )
/*****************************************************************************/
{
wxSize SheetSize;
......@@ -26,6 +26,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
wxPoint offset;
MsgPanel->EraseMsgBox();
// 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
// so apparent pen diam is real pen diam / Scale
......@@ -37,9 +38,10 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
g_pcb_plot_options.HPGL_Pen_Recouvrement = 0;
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;
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 )
{
wxString msg = _( "Unable to create file " ) + FullFileName;
......@@ -66,9 +68,10 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
if( g_pcb_plot_options.PlotScaleOpt == 0 ) // Optimum scale
{
double Xscale, Yscale;
// Fit to 80% of the page
Xscale = ( (SheetSize.x*0.8) / BoardSize.x);
Yscale = ( (SheetSize.y*0.8) / BoardSize.y);
Xscale = ( (SheetSize.x * 0.8) / BoardSize.x );
Yscale = ( (SheetSize.y * 0.8) / BoardSize.y );
scale = MIN( Xscale, Yscale );
}
else
......@@ -77,8 +80,8 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
// Calcul du cadrage (echelle != 1 donc recadrage du trace)
if( Center )
{
offset.x = BoardCenter.x-(SheetSize.x/2)/scale;
offset.y = BoardCenter.y-(SheetSize.y/2)/scale;
offset.x = BoardCenter.x - (SheetSize.x / 2) / scale;
offset.y = BoardCenter.y - (SheetSize.y / 2) / scale;
}
else
{
......@@ -86,27 +89,26 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
offset.y = 0;
}
HPGL_Plotter *plotter = new HPGL_Plotter();
plotter->set_paper_size(currentsheet);
plotter->set_viewport(offset, scale,
g_pcb_plot_options.PlotOrient);
HPGL_Plotter* plotter = new HPGL_Plotter();
plotter->set_paper_size( currentsheet );
plotter->set_viewport( offset, scale,
g_pcb_plot_options.PlotOrient );
plotter->set_default_line_width( g_pcb_plot_options.PlotLine_Width );
plotter->set_creator(wxT("PCBNEW-HPGL"));
plotter->set_filename(FullFileName);
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_overlap(pen_recouvrement);
plotter->set_pen_diameter(pen_diam);
plotter->start_plot(output_file);
plotter->set_creator( wxT( "PCBNEW-HPGL" ) );
plotter->set_filename( FullFileName );
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_overlap( pen_recouvrement );
plotter->set_pen_diameter( pen_diam );
plotter->start_plot( output_file );
/* The worksheet is not significant with scale!=1... It is with
* paperscale!=1, anyway */
if( g_pcb_plot_options.Plot_Frame_Ref && !Center)
if( g_pcb_plot_options.Plot_Frame_Ref && !Center )
PlotWorkSheet( plotter, GetScreen() );
Plot_Layer(plotter, Layer, trace_mode);
Plot_Layer( plotter, Layer, trace_mode );
plotter->end_plot();
delete plotter;
SetLocaleTo_Default();
}
......@@ -14,7 +14,7 @@
/****************************************************************************/
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
......@@ -33,7 +33,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
MsgPanel->EraseMsgBox();
FILE *output_file = wxFopen( FullFileName, wxT( "wt" ) );
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) );
if( output_file == NULL )
{
wxString msg = _( "Unable to create file " ) + FullFileName;
......@@ -77,9 +77,10 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
if( g_pcb_plot_options.PlotScaleOpt == 0 ) // Optimum scale
{
double Xscale, Yscale;
// Fit to 80% of the page
Xscale = (PaperSize.x*0.8) / BoardSize.x;
Yscale = (PaperSize.y*0.8) / BoardSize.y;
Xscale = (PaperSize.x * 0.8) / BoardSize.x;
Yscale = (PaperSize.y * 0.8) / BoardSize.y;
scale = MIN( Xscale, Yscale );
}
else
......@@ -88,8 +89,8 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
// Calcul du cadrage (echelle != 1 donc recadrage du trace)
if( Center )
{
offset.x = BoardCenter.x-(PaperSize.x/2)/scale;
offset.y = BoardCenter.y-(PaperSize.y/2)/scale;
offset.x = BoardCenter.x - (PaperSize.x / 2) / scale;
offset.y = BoardCenter.y - (PaperSize.y / 2) / scale;
}
else
{
......@@ -97,20 +98,20 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
offset.y = 0;
}
PS_Plotter *plotter = new PS_Plotter();
plotter->set_paper_size(SheetPS);
plotter->set_scale_adjust(g_pcb_plot_options.ScaleAdjX,
g_pcb_plot_options.ScaleAdjY);
plotter->set_viewport(offset, scale,
g_pcb_plot_options.PlotOrient);
PS_Plotter* plotter = new PS_Plotter();
plotter->set_paper_size( SheetPS );
plotter->set_scale_adjust( g_pcb_plot_options.ScaleAdjX,
g_pcb_plot_options.ScaleAdjY );
plotter->set_viewport( offset, scale,
g_pcb_plot_options.PlotOrient );
plotter->set_default_line_width( g_pcb_plot_options.PlotLine_Width );
plotter->set_creator(wxT("PCBNEW-PS"));
plotter->set_filename(FullFileName);
plotter->start_plot(output_file);
plotter->set_creator( wxT( "PCBNEW-PS" ) );
plotter->set_filename( FullFileName );
plotter->start_plot( output_file );
/* The worksheet is not significant with scale!=1... It is with
* paperscale!=1, anyway */
if( g_pcb_plot_options.Plot_Frame_Ref && !Center)
if( g_pcb_plot_options.Plot_Frame_Ref && !Center )
PlotWorkSheet( plotter, GetScreen() );
// If plot a negative board:
......@@ -119,19 +120,18 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
if( g_pcb_plot_options.Plot_PS_Negative )
{
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->rect(wxPoint(m_Pcb->m_BoundaryBox.GetX() - margin,
m_Pcb->m_BoundaryBox.GetY() - margin),
wxPoint(m_Pcb->m_BoundaryBox.GetRight() + margin,
m_Pcb->m_BoundaryBox.GetBottom() + margin),
FILLED_SHAPE);
plotter->rect( wxPoint( m_Pcb->m_BoundaryBox.GetX() - margin,
m_Pcb->m_BoundaryBox.GetY() - margin ),
wxPoint( m_Pcb->m_BoundaryBox.GetRight() + margin,
m_Pcb->m_BoundaryBox.GetBottom() + margin ),
FILLED_SHAPE );
plotter->set_color( BLACK );
}
Plot_Layer(plotter, Layer, trace_mode);
Plot_Layer( plotter, Layer, trace_mode );
plotter->end_plot();
delete plotter;
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