2011-09-23 13:57:12 +00:00
|
|
|
/**
|
|
|
|
* @file print_board_functions.cpp
|
|
|
|
* @brief Functions to print boards.
|
|
|
|
*/
|
2013-03-13 19:06:46 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <class_drawpanel.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <printout_controler.h>
|
|
|
|
#include <class_board.h>
|
|
|
|
#include <class_module.h>
|
|
|
|
#include <class_edge_mod.h>
|
|
|
|
#include <class_track.h>
|
|
|
|
#include <class_zone.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <pcbplot.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <footprint_edit_frame.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
|
2014-06-24 16:17:18 +00:00
|
|
|
GR_DRAWMODE aDraw_mode, LSET aMasklayer,
|
2010-01-09 20:25:39 +00:00
|
|
|
PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
|
2014-06-24 16:17:18 +00:00
|
|
|
LSET aPrintMaskLayer,
|
2011-08-26 17:01:17 +00:00
|
|
|
bool aPrintMirrorMode,
|
|
|
|
void * aData)
|
2010-04-21 17:22:27 +00:00
|
|
|
{
|
2015-03-25 09:55:00 +00:00
|
|
|
const GR_DRAWMODE drawmode = (GR_DRAWMODE) 0;
|
2013-03-11 19:30:58 +00:00
|
|
|
int defaultPenSize = Millimeter2iu( 0.2 );
|
2017-10-30 17:21:07 +00:00
|
|
|
auto displ_opts = (PCB_DISPLAY_OPTIONS*) GetDisplayOptions();
|
|
|
|
PCB_DISPLAY_OPTIONS save_opt;
|
2010-04-21 17:22:27 +00:00
|
|
|
|
|
|
|
PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null
|
|
|
|
PRINT_PARAMETERS::DrillShapeOptT drillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-04-21 17:22:27 +00:00
|
|
|
if( printParameters )
|
|
|
|
defaultPenSize = printParameters->m_PenDefaultSize;
|
|
|
|
|
2015-01-10 10:27:49 +00:00
|
|
|
save_opt = *displ_opts;
|
2010-04-21 17:22:27 +00:00
|
|
|
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_ContrastModeDisplay = false;
|
|
|
|
displ_opts->m_DisplayPadFill = true;
|
|
|
|
displ_opts->m_DisplayViaFill = true;
|
|
|
|
displ_opts->m_DisplayPadNum = false;
|
2017-03-13 03:19:33 +00:00
|
|
|
bool nctmp = GetBoard()->IsElementVisible( LAYER_NO_CONNECTS );
|
|
|
|
GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, false );
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_DisplayPadIsol = false;
|
2015-02-02 08:06:39 +00:00
|
|
|
displ_opts->m_DisplayModEdgeFill = FILLED;
|
|
|
|
displ_opts->m_DisplayModTextFill = FILLED;
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_DisplayPcbTrackFill = true;
|
2017-10-30 17:21:07 +00:00
|
|
|
displ_opts->m_ShowTrackClearanceMode = PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE;
|
2015-02-02 08:06:39 +00:00
|
|
|
displ_opts->m_DisplayDrawItemsFill = FILLED;
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_DisplayZonesMode = 0;
|
|
|
|
displ_opts->m_DisplayNetNamesMode = 0;
|
2010-04-21 17:22:27 +00:00
|
|
|
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetPrintMirrored( aPrintMirrorMode );
|
2010-04-21 17:22:27 +00:00
|
|
|
|
|
|
|
// Draw footprints, this is done at last in order to print the pad holes in
|
2014-07-04 19:36:43 +00:00
|
|
|
// white after the tracks and zones
|
2010-04-21 17:22:27 +00:00
|
|
|
int tmp = D_PAD::m_PadSketchModePenSize;
|
|
|
|
D_PAD::m_PadSketchModePenSize = defaultPenSize;
|
2011-12-22 21:57:50 +00:00
|
|
|
|
|
|
|
wxSize pageSizeIU = GetPageSizeIU() / 2;
|
|
|
|
wxPoint offset( pageSizeIU.x, pageSizeIU.y );
|
|
|
|
|
|
|
|
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
|
2010-04-21 17:22:27 +00:00
|
|
|
{
|
2011-12-22 21:57:50 +00:00
|
|
|
module->Move( offset );
|
2011-12-22 22:12:21 +00:00
|
|
|
Print_Module( m_canvas, aDC, module, drawmode, aPrintMaskLayer, drillShapeOpt );
|
2011-12-22 21:57:50 +00:00
|
|
|
module->Move( -offset );
|
2010-04-21 17:22:27 +00:00
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-04-21 17:22:27 +00:00
|
|
|
D_PAD::m_PadSketchModePenSize = tmp;
|
|
|
|
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetPrintMirrored( false );
|
2010-04-21 17:22:27 +00:00
|
|
|
|
2015-01-10 10:27:49 +00:00
|
|
|
*displ_opts = save_opt;
|
2017-03-13 03:19:33 +00:00
|
|
|
GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, nctmp );
|
2010-04-21 17:22:27 +00:00
|
|
|
}
|
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
|
2014-06-24 16:17:18 +00:00
|
|
|
LSET aPrintMask,
|
2011-03-01 19:26:17 +00:00
|
|
|
bool aPrintMirrorMode,
|
|
|
|
void* aData)
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2015-03-25 09:55:00 +00:00
|
|
|
const GR_DRAWMODE drawmode = (GR_DRAWMODE) 0;
|
2017-10-30 17:21:07 +00:00
|
|
|
PCB_DISPLAY_OPTIONS save_opt;
|
2011-09-07 19:41:04 +00:00
|
|
|
BOARD* Pcb = GetBoard();
|
2013-03-11 19:30:58 +00:00
|
|
|
int defaultPenSize = Millimeter2iu( 0.2 );
|
2010-03-29 16:42:03 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
PRINT_PARAMETERS* printParameters = (PRINT_PARAMETERS*) aData; // can be null
|
2017-10-30 17:21:07 +00:00
|
|
|
auto displ_opts = (PCB_DISPLAY_OPTIONS*) GetDisplayOptions();
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2010-01-09 20:25:39 +00:00
|
|
|
PRINT_PARAMETERS::DrillShapeOptT drillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2010-01-09 20:25:39 +00:00
|
|
|
if( printParameters )
|
2010-02-22 19:56:32 +00:00
|
|
|
{
|
2010-01-09 20:25:39 +00:00
|
|
|
drillShapeOpt = printParameters->m_DrillShapeOpt;
|
2010-02-22 19:56:32 +00:00
|
|
|
defaultPenSize = printParameters->m_PenDefaultSize;
|
|
|
|
}
|
2007-08-23 04:28:46 +00:00
|
|
|
|
2015-01-10 10:27:49 +00:00
|
|
|
save_opt = *displ_opts;
|
2014-06-29 13:05:51 +00:00
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID activeLayer = GetScreen()->m_Active_Layer;
|
2010-03-29 16:42:03 +00:00
|
|
|
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_ContrastModeDisplay = false;
|
|
|
|
displ_opts->m_DisplayPadFill = true;
|
|
|
|
displ_opts->m_DisplayViaFill = true;
|
2010-03-29 16:42:03 +00:00
|
|
|
|
2018-01-22 20:23:47 +00:00
|
|
|
// Set all board layers as visible, because the print dialog has itself
|
|
|
|
// a layer selection, that have priority over the layer manager setup
|
|
|
|
LSET save_visible_brd_layers = Pcb->GetVisibleLayers();
|
2018-02-17 18:05:16 +00:00
|
|
|
Pcb->SetVisibleLayers( aPrintMask );
|
2018-01-22 20:23:47 +00:00
|
|
|
|
2018-02-04 19:39:59 +00:00
|
|
|
int save_visible_brd_elements = Pcb->GetVisibleElements();
|
|
|
|
Pcb->SetElementVisibility( LAYER_PAD_FR, true );
|
|
|
|
Pcb->SetElementVisibility( LAYER_PAD_BK, true );
|
|
|
|
Pcb->SetElementVisibility( LAYER_MOD_TEXT_FR, true );
|
2018-02-05 11:19:26 +00:00
|
|
|
Pcb->SetElementVisibility( LAYER_MOD_TEXT_BK, true );
|
2018-02-04 19:39:59 +00:00
|
|
|
|
2018-02-17 18:05:16 +00:00
|
|
|
PCB_LAYER_ID layer = aPrintMask.ExtractLayer();
|
|
|
|
|
|
|
|
// pads on Silkscreen layer are usually printed in sketch mode:
|
|
|
|
if( layer == B_SilkS || layer == F_SilkS )
|
|
|
|
displ_opts->m_DisplayPadFill = false;
|
2010-04-23 09:54:40 +00:00
|
|
|
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_DisplayPadNum = false;
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
bool nctmp = GetBoard()->IsElementVisible( LAYER_NO_CONNECTS );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, false );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
bool anchorsTmp = GetBoard()->IsElementVisible( LAYER_ANCHOR );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
GetBoard()->SetElementVisibility( LAYER_ANCHOR, false );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_DisplayPadIsol = false;
|
2015-02-02 08:06:39 +00:00
|
|
|
displ_opts->m_DisplayModEdgeFill = FILLED;
|
|
|
|
displ_opts->m_DisplayModTextFill = FILLED;
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_DisplayPcbTrackFill = true;
|
2017-10-30 17:21:07 +00:00
|
|
|
displ_opts->m_ShowTrackClearanceMode = PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE;
|
2015-02-02 08:06:39 +00:00
|
|
|
displ_opts->m_DisplayDrawItemsFill = FILLED;
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_DisplayZonesMode = 0;
|
|
|
|
displ_opts->m_DisplayNetNamesMode = 0;
|
2007-08-23 04:28:46 +00:00
|
|
|
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetPrintMirrored( aPrintMirrorMode );
|
2009-06-18 20:51:01 +00:00
|
|
|
|
2016-09-27 18:04:30 +00:00
|
|
|
for( auto item : Pcb->Drawings() )
|
2007-08-23 04:28:46 +00:00
|
|
|
{
|
2008-04-01 06:32:48 +00:00
|
|
|
switch( item->Type() )
|
2007-08-23 04:28:46 +00:00
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_LINE_T:
|
|
|
|
case PCB_DIMENSION_T:
|
|
|
|
case PCB_TEXT_T:
|
2011-09-07 19:41:04 +00:00
|
|
|
case PCB_TARGET_T:
|
2014-06-24 16:17:18 +00:00
|
|
|
if( aPrintMask[item->GetLayer()] )
|
2013-03-30 17:24:04 +00:00
|
|
|
item->Draw( m_canvas, aDC, drawmode );
|
2007-08-23 04:28:46 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MARKER_T:
|
2007-08-23 04:28:46 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Print tracks
|
2014-06-24 16:17:18 +00:00
|
|
|
for( TRACK* track = Pcb->m_Track; track; track = track->Next() )
|
2007-08-23 04:28:46 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
if( !( aPrintMask & track->GetLayerSet() ).any() )
|
2007-08-23 04:28:46 +00:00
|
|
|
continue;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2013-03-13 19:06:46 +00:00
|
|
|
if( track->Type() == PCB_VIA_T ) // VIA encountered.
|
2007-08-23 04:28:46 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
int radius = track->GetWidth() / 2;
|
|
|
|
const VIA* via = static_cast<const VIA*>( track );
|
2014-04-25 06:00:04 +00:00
|
|
|
|
2017-08-04 12:43:02 +00:00
|
|
|
COLOR4D color = Settings().Colors().GetItemColor( LAYER_VIAS + via->GetViaType() );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2011-12-29 20:11:42 +00:00
|
|
|
GRFilledCircle( m_canvas->GetClipBox(), aDC,
|
2014-04-25 06:00:04 +00:00
|
|
|
via->GetStart().x,
|
|
|
|
via->GetStart().y,
|
2011-09-07 19:41:04 +00:00
|
|
|
radius,
|
2010-01-09 20:25:39 +00:00
|
|
|
0, color, color );
|
2007-08-23 04:28:46 +00:00
|
|
|
}
|
|
|
|
else
|
2011-08-26 17:01:17 +00:00
|
|
|
{
|
2013-03-13 19:06:46 +00:00
|
|
|
track->Draw( m_canvas, aDC, drawmode );
|
2011-08-26 17:01:17 +00:00
|
|
|
}
|
2007-08-23 04:28:46 +00:00
|
|
|
}
|
|
|
|
|
2013-03-11 19:30:58 +00:00
|
|
|
// Outdated: only for compatibility to old boards
|
2014-06-24 16:17:18 +00:00
|
|
|
for( TRACK* track = Pcb->m_Zone; track; track = track->Next() )
|
2007-08-23 04:28:46 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
if( !( aPrintMask & track->GetLayerSet() ).any() )
|
2007-08-23 04:28:46 +00:00
|
|
|
continue;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2013-03-13 19:06:46 +00:00
|
|
|
track->Draw( m_canvas, aDC, drawmode );
|
2007-08-23 04:28:46 +00:00
|
|
|
}
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Draw filled areas (i.e. zones)
|
2009-01-15 14:32:29 +00:00
|
|
|
for( int ii = 0; ii < Pcb->GetAreaCount(); ii++ )
|
|
|
|
{
|
2009-11-20 14:55:20 +00:00
|
|
|
ZONE_CONTAINER* zone = Pcb->GetArea( ii );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
if( aPrintMask[zone->GetLayer()] )
|
2013-04-06 12:28:02 +00:00
|
|
|
zone->DrawFilledArea( m_canvas, aDC, drawmode );
|
2009-01-15 14:32:29 +00:00
|
|
|
}
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
// Draw footprints, this is done at last in order to print the pad holes in
|
2014-07-04 19:36:43 +00:00
|
|
|
// white after the tracks and zones
|
2010-02-22 19:56:32 +00:00
|
|
|
int tmp = D_PAD::m_PadSketchModePenSize;
|
|
|
|
D_PAD::m_PadSketchModePenSize = defaultPenSize;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
for( MODULE* module = (MODULE*) Pcb->m_Modules; module; module = module->Next() )
|
2009-08-13 06:18:06 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
Print_Module( m_canvas, aDC, module, drawmode, aPrintMask, drillShapeOpt );
|
2009-08-13 06:18:06 +00:00
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-02-22 19:56:32 +00:00
|
|
|
D_PAD::m_PadSketchModePenSize = tmp;
|
2009-08-13 06:18:06 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Print via holes in bg color: Not sure it is good for buried or blind
|
|
|
|
* vias */
|
2010-01-09 20:25:39 +00:00
|
|
|
if( drillShapeOpt != PRINT_PARAMETERS::NO_DRILL_SHAPE )
|
2007-08-23 04:28:46 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
TRACK* track = Pcb->m_Track;
|
2017-02-20 17:48:27 +00:00
|
|
|
COLOR4D color = COLOR4D::WHITE;
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2010-01-09 20:25:39 +00:00
|
|
|
bool blackpenstate = GetGRForceBlackPenState();
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2010-01-09 20:25:39 +00:00
|
|
|
GRForceBlackPen( false );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
for( ; track; track = track->Next() )
|
2007-08-23 04:28:46 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
if( !( aPrintMask & track->GetLayerSet() ).any() )
|
2010-01-09 20:25:39 +00:00
|
|
|
continue;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2013-03-13 19:06:46 +00:00
|
|
|
if( track->Type() == PCB_VIA_T ) // VIA encountered.
|
2010-01-09 20:25:39 +00:00
|
|
|
{
|
|
|
|
int diameter;
|
2014-04-25 06:00:04 +00:00
|
|
|
const VIA *via = static_cast<const VIA*>( track );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-01-09 20:25:39 +00:00
|
|
|
if( drillShapeOpt == PRINT_PARAMETERS::SMALL_DRILL_SHAPE )
|
2014-04-25 06:00:04 +00:00
|
|
|
diameter = std::min( SMALL_DRILL, via->GetDrillValue() );
|
2010-01-09 20:25:39 +00:00
|
|
|
else
|
2014-04-25 06:00:04 +00:00
|
|
|
diameter = via->GetDrillValue();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-12-29 20:11:42 +00:00
|
|
|
GRFilledCircle( m_canvas->GetClipBox(), aDC,
|
2013-03-13 19:06:46 +00:00
|
|
|
track->GetStart().x, track->GetStart().y,
|
2010-01-09 20:25:39 +00:00
|
|
|
diameter/2,
|
|
|
|
0, color, color );
|
|
|
|
}
|
2007-08-23 04:28:46 +00:00
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-01-09 20:25:39 +00:00
|
|
|
GRForceBlackPen( blackpenstate );
|
2007-08-23 04:28:46 +00:00
|
|
|
}
|
2009-11-20 14:55:20 +00:00
|
|
|
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetPrintMirrored( false );
|
2008-11-02 19:52:57 +00:00
|
|
|
|
2018-01-22 20:23:47 +00:00
|
|
|
// Restore settings:
|
2015-01-10 10:27:49 +00:00
|
|
|
*displ_opts = save_opt;
|
2018-01-22 20:23:47 +00:00
|
|
|
Pcb->SetVisibleLayers( save_visible_brd_layers );
|
2018-02-04 19:39:59 +00:00
|
|
|
Pcb->SetVisibleElements( save_visible_brd_elements );
|
2014-06-29 13:05:51 +00:00
|
|
|
GetScreen()->m_Active_Layer = activeLayer;
|
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, nctmp );
|
|
|
|
GetBoard()->SetElementVisibility( LAYER_ANCHOR, anchorsTmp );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
|
2014-06-24 16:17:18 +00:00
|
|
|
GR_DRAWMODE aDraw_mode, LSET aMask,
|
2010-01-09 20:25:39 +00:00
|
|
|
PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
// Print pads
|
2017-04-25 09:06:24 +00:00
|
|
|
for( D_PAD* pad = aModule->PadsList(); pad; pad = pad->Next() )
|
2007-08-23 04:28:46 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
if( !( pad->GetLayerSet() & aMask ).any() )
|
2007-08-23 04:28:46 +00:00
|
|
|
continue;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-03-29 16:42:03 +00:00
|
|
|
// Manage hole according to the print drill option
|
2012-02-19 04:02:19 +00:00
|
|
|
wxSize drill_tmp = pad->GetDrillSize();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
switch( aDrillShapeOpt )
|
2010-01-09 20:25:39 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
case PRINT_PARAMETERS::NO_DRILL_SHAPE:
|
|
|
|
pad->SetDrillSize( wxSize(0,0) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PRINT_PARAMETERS::SMALL_DRILL_SHAPE:
|
|
|
|
{
|
2012-08-03 15:43:15 +00:00
|
|
|
wxSize sz( std::min( SMALL_DRILL, pad->GetDrillSize().x ),
|
|
|
|
std::min( SMALL_DRILL, pad->GetDrillSize().y ) );
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
pad->SetDrillSize( sz );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PRINT_PARAMETERS::FULL_DRILL_SHAPE:
|
|
|
|
// Do nothing
|
|
|
|
break;
|
2010-01-09 20:25:39 +00:00
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
pad->Draw( aPanel, aDC, aDraw_mode );
|
|
|
|
pad->SetDrillSize( drill_tmp );
|
2007-08-23 04:28:46 +00:00
|
|
|
}
|
|
|
|
|
2015-05-27 20:14:51 +00:00
|
|
|
if( aModule->Reference().IsVisible() && aMask[aModule->Reference().GetLayer()] )
|
|
|
|
aModule->Reference().Draw( aPanel, aDC, aDraw_mode );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2015-05-27 20:14:51 +00:00
|
|
|
if( aModule->Value().IsVisible() && aMask[aModule->Value().GetLayer()] )
|
|
|
|
aModule->Value().Draw( aPanel, aDC, aDraw_mode );
|
2007-08-23 04:28:46 +00:00
|
|
|
|
2017-04-25 09:06:24 +00:00
|
|
|
for( EDA_ITEM* item = aModule->GraphicalItemsList(); item; item = item->Next() )
|
2007-08-23 04:28:46 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
switch( item->Type() )
|
2007-08-23 04:28:46 +00:00
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_TEXT_T:
|
2014-09-10 15:18:42 +00:00
|
|
|
{
|
2015-05-27 20:14:51 +00:00
|
|
|
TEXTE_MODULE* textMod = static_cast<TEXTE_MODULE*>( item );
|
|
|
|
|
|
|
|
if( !aMask[textMod->GetLayer()] )
|
2014-09-10 15:18:42 +00:00
|
|
|
break;
|
2007-08-23 04:28:46 +00:00
|
|
|
|
2014-09-10 15:18:42 +00:00
|
|
|
textMod->Draw( aPanel, aDC, aDraw_mode );
|
|
|
|
break;
|
|
|
|
}
|
2007-08-23 04:28:46 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_EDGE_T:
|
2012-02-19 04:02:19 +00:00
|
|
|
{
|
2014-09-10 15:18:42 +00:00
|
|
|
EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( item );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
if( !aMask[edge->GetLayer()] )
|
2012-02-19 04:02:19 +00:00
|
|
|
break;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
edge->Draw( aPanel, aDC, aDraw_mode );
|
|
|
|
}
|
2007-08-23 04:28:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|