46
46
static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
47
GR_DRAWMODE aDraw_mode, LAYER_MSK aMasklayer,
47
GR_DRAWMODE aDraw_mode, LSET aMasklayer,
48
48
PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt );
50
50
void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
51
LAYER_MSK aPrintMaskLayer,
52
52
bool aPrintMirrorMode,
95
95
// Draw footprints, this is done at last in order to print the pad holes in
96
// white (or g_DrawBgColor) after the tracks and zones
96
// white after the tracks and zones
97
97
int tmp = D_PAD::m_PadSketchModePenSize;
98
98
D_PAD::m_PadSketchModePenSize = defaultPenSize;
125
* is used to print the board (on printer, or when creating SVF files).
126
* Print the board, but only layers allowed by aPrintMaskLayer
127
* @param aDC = the print device context
128
* @param aPrintMaskLayer = a 32 bits mask: bit n = 1 -> layer n is printed
129
* @param aPrintMirrorMode = true to plot mirrored
130
* @param aData = a pointer to an optional data (NULL if not used)
132
123
void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
133
LAYER_MSK aPrintMaskLayer,
134
125
bool aPrintMirrorMode,
138
128
GR_DRAWMODE drawmode = GR_COPY;
139
129
DISPLAY_OPTIONS save_opt;
140
130
BOARD* Pcb = GetBoard();
141
131
int defaultPenSize = Millimeter2iu( 0.2 );
142
132
bool onePagePerLayer = false;
144
PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null
134
PRINT_PARAMETERS* printParameters = (PRINT_PARAMETERS*) aData; // can be null
146
136
if( printParameters && printParameters->m_OptionPrintPage == 0 )
147
137
onePagePerLayer = true;
157
147
save_opt = DisplayOpt;
158
LAYER_NUM activeLayer = GetScreen()->m_Active_Layer;
149
LAYER_ID activeLayer = GetScreen()->m_Active_Layer;
160
151
DisplayOpt.ContrastModeDisplay = false;
161
152
DisplayOpt.DisplayPadFill = true;
162
153
DisplayOpt.DisplayViaFill = true;
164
if( (aPrintMaskLayer & ALL_CU_LAYERS) == 0 )
155
if( !( aPrintMask & LSET::AllCuMask() ).any() )
166
157
if( onePagePerLayer )
167
{ // We can print mask layers (solder mask and solder paste) with the actual
159
// We can print mask layers (solder mask and solder paste) with the actual
168
160
// pad sizes. To do that, we must set ContrastModeDisplay to true and set
169
//the GetScreen()->m_Active_Layer to the current printed layer
161
// the GetScreen()->m_Active_Layer to the current printed layer
170
162
DisplayOpt.ContrastModeDisplay = true;
171
163
DisplayOpt.DisplayPadFill = true;
173
165
// Calculate the active layer number to print from its mask layer:
174
GetScreen()->m_Active_Layer = FIRST_LAYER;
166
GetScreen()->m_Active_Layer = B_Cu;
176
for( LAYER_NUM kk = FIRST_LAYER; kk < NB_LAYERS; ++kk )
168
for( LAYER_NUM id = LAYER_ID_COUNT-1; id >= 0; --id )
178
if( GetLayerMask( kk ) & aPrintMaskLayer )
180
GetScreen()->m_Active_Layer = kk;
172
GetScreen()->m_Active_Layer = LAYER_ID( id );
185
177
// pads on Silkscreen layer are usually plot in sketch mode:
186
if( (GetScreen()->m_Active_Layer == SILKSCREEN_N_BACK)
187
|| (GetScreen()->m_Active_Layer == SILKSCREEN_N_FRONT) )
178
if( GetScreen()->m_Active_Layer == B_SilkS ||
179
GetScreen()->m_Active_Layer == F_SilkS )
188
181
DisplayOpt.DisplayPadFill = false;
198
190
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
199
191
m_DisplayViaFill = DisplayOpt.DisplayViaFill;
200
192
m_DisplayPadNum = DisplayOpt.DisplayPadNum = false;
201
194
bool nctmp = GetBoard()->IsElementVisible( NO_CONNECTS_VISIBLE );
202
196
GetBoard()->SetElementVisibility( NO_CONNECTS_VISIBLE, false );
203
198
bool anchorsTmp = GetBoard()->IsElementVisible( ANCHOR_VISIBLE );
204
200
GetBoard()->SetElementVisibility( ANCHOR_VISIBLE, false );
205
202
DisplayOpt.DisplayPadIsol = false;
206
203
m_DisplayModEdge = DisplayOpt.DisplayModEdge = FILLED;
207
204
m_DisplayModText = DisplayOpt.DisplayModText = FILLED;
245
for( TRACK * track = Pcb->m_Track; track; track = track->Next() )
242
for( TRACK* track = Pcb->m_Track; track; track = track->Next() )
247
if( !( aPrintMaskLayer & track->GetLayerMask() ) )
244
if( !( aPrintMask & track->GetLayerSet() ).any() )
250
247
if( track->Type() == PCB_VIA_T ) // VIA encountered.
252
int radius = track->GetWidth() >> 1;
253
EDA_COLOR_T color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + track->GetShape() );
249
int radius = track->GetWidth() / 2;
250
const VIA* via = static_cast<const VIA*>( track );
252
EDA_COLOR_T color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + via->GetViaType() );
254
254
GRSetDrawMode( aDC, drawmode );
255
255
GRFilledCircle( m_canvas->GetClipBox(), aDC,
259
259
0, color, color );
267
267
// Outdated: only for compatibility to old boards
268
for( TRACK * track = Pcb->m_Zone; track != NULL; track = track->Next() )
268
for( TRACK* track = Pcb->m_Zone; track; track = track->Next() )
270
if( !( aPrintMaskLayer & track->GetLayerMask() ) )
270
if( !( aPrintMask & track->GetLayerSet() ).any() )
273
273
track->Draw( m_canvas, aDC, drawmode );
279
279
ZONE_CONTAINER* zone = Pcb->GetArea( ii );
281
if( aPrintMaskLayer & GetLayerMask( zone->GetLayer() ) )
281
if( aPrintMask[zone->GetLayer()] )
282
282
zone->DrawFilledArea( m_canvas, aDC, drawmode );
285
285
// Draw footprints, this is done at last in order to print the pad holes in
286
// white (or g_DrawBgColor) after the tracks and zones
287
Module = (MODULE*) Pcb->m_Modules;
286
// white after the tracks and zones
288
287
int tmp = D_PAD::m_PadSketchModePenSize;
289
288
D_PAD::m_PadSketchModePenSize = defaultPenSize;
291
for( ; Module != NULL; Module = Module->Next() )
290
for( MODULE* module = (MODULE*) Pcb->m_Modules; module; module = module->Next() )
293
Print_Module( m_canvas, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt );
292
Print_Module( m_canvas, aDC, module, drawmode, aPrintMask, drillShapeOpt );
296
295
D_PAD::m_PadSketchModePenSize = tmp;
300
299
if( drillShapeOpt != PRINT_PARAMETERS::NO_DRILL_SHAPE )
302
TRACK * track = Pcb->m_Track;
303
EDA_COLOR_T color = g_DrawBgColor;
301
TRACK* track = Pcb->m_Track;
302
EDA_COLOR_T color = WHITE;
304
304
bool blackpenstate = GetGRForceBlackPenState();
305
306
GRForceBlackPen( false );
306
307
GRSetDrawMode( aDC, GR_COPY );
308
for( ; track != NULL; track = track->Next() )
309
for( ; track; track = track->Next() )
310
if( !( aPrintMaskLayer & track->GetLayerMask() ) )
311
if( !( aPrintMask & track->GetLayerSet() ).any() )
313
314
if( track->Type() == PCB_VIA_T ) // VIA encountered.
317
const VIA *via = static_cast<const VIA*>( track );
317
319
if( drillShapeOpt == PRINT_PARAMETERS::SMALL_DRILL_SHAPE )
318
diameter = std::min( SMALL_DRILL, track->GetDrillValue() );
320
diameter = std::min( SMALL_DRILL, via->GetDrillValue() );
320
diameter = track->GetDrillValue();
322
diameter = via->GetDrillValue();
322
324
GRFilledCircle( m_canvas->GetClipBox(), aDC,
323
325
track->GetStart().x, track->GetStart().y,
339
341
m_DisplayPadNum = DisplayOpt.DisplayPadNum;
340
342
m_DisplayModEdge = DisplayOpt.DisplayModEdge;
341
343
m_DisplayModText = DisplayOpt.DisplayModText;
342
GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, nctmp);
343
GetBoard()->SetElementVisibility(ANCHOR_VISIBLE, anchorsTmp);
345
GetBoard()->SetElementVisibility( NO_CONNECTS_VISIBLE, nctmp );
346
GetBoard()->SetElementVisibility( ANCHOR_VISIBLE, anchorsTmp );
347
350
static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
348
GR_DRAWMODE aDraw_mode, LAYER_MSK aMasklayer,
351
GR_DRAWMODE aDraw_mode, LSET aMask,
349
352
PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt )
352
355
for( D_PAD* pad = aModule->Pads(); pad; pad = pad->Next() )
354
if( !(pad->GetLayerMask() & aMasklayer ) )
357
if( !( pad->GetLayerSet() & aMask ).any() )
357
360
// Manage hole according to the print drill option
384
387
// Print footprint graphic shapes
385
LAYER_MSK mlayer = GetLayerMask( aModule->GetLayer() );
387
if( aModule->GetLayer() == LAYER_N_BACK )
388
mlayer = SILKSCREEN_LAYER_BACK;
389
else if( aModule->GetLayer() == LAYER_N_FRONT )
390
mlayer = SILKSCREEN_LAYER_FRONT;
392
if( mlayer & aMasklayer )
388
LSET mlayer( aModule->GetLayer() );
390
if( aModule->GetLayer() == B_Cu )
391
mlayer = LSET( B_SilkS );
392
else if( aModule->GetLayer() == F_Cu )
393
mlayer = LSET( F_SilkS );
395
if( ( mlayer & aMask ).any() )
394
397
if( aModule->Reference().IsVisible() )
395
398
aModule->Reference().Draw( aPanel, aDC, aDraw_mode );
416
419
EDGE_MODULE* edge = (EDGE_MODULE*) item;
418
if( ( GetLayerMask( edge->GetLayer() ) & aMasklayer ) == 0 )
421
if( !aMask[edge->GetLayer()] )
421
424
edge->Draw( aPanel, aDC, aDraw_mode );