2011-10-17 20:01:27 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2012-06-08 09:56:42 +00:00
|
|
|
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
|
|
|
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
2019-05-28 23:23:58 +00:00
|
|
|
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-17 20:01:27 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2012-04-16 01:25:26 +00:00
|
|
|
#include <base_units.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_board.h>
|
|
|
|
#include <class_module.h>
|
|
|
|
#include <class_track.h>
|
|
|
|
#include <class_zone.h>
|
|
|
|
#include <class_marker_pcb.h>
|
|
|
|
#include <pcbnew.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <footprint_edit_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbplot.h>
|
2010-09-21 23:46:02 +00:00
|
|
|
#include <wx/overlay.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2010-01-28 13:10:46 +00:00
|
|
|
// Local functions:
|
|
|
|
/* Trace the pads of a module in sketch mode.
|
2010-01-31 20:01:46 +00:00
|
|
|
* Used to display pads when when the module visibility is set to not visible
|
2010-01-28 13:10:46 +00:00
|
|
|
* and we want to see pad through.
|
2011-09-07 19:41:04 +00:00
|
|
|
* The pads must appear on the layers selected in LayerMask
|
2010-01-28 13:10:46 +00:00
|
|
|
*/
|
2019-05-31 12:15:25 +00:00
|
|
|
static void Trace_Pads_Only( PCB_BASE_FRAME* aFrame, wxDC* DC, MODULE* Module,
|
|
|
|
int ox, int oy, LSET LayerMask );
|
2010-01-28 13:10:46 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Redraw the BOARD items but not cursors, axis or grid
|
2019-05-31 12:15:25 +00:00
|
|
|
void BOARD::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-05-29 16:26:07 +00:00
|
|
|
/* The order of drawing is flexible on some systems and not on others. For
|
|
|
|
* OSes which use OR to draw, the order is not important except for the
|
2009-11-20 14:55:20 +00:00
|
|
|
* effect of the highlight and its relationship to markers. See comment
|
|
|
|
* below.
|
|
|
|
* This order independence comes from the fact that a binary OR operation is
|
2009-05-29 16:26:07 +00:00
|
|
|
* commutative in nature.
|
|
|
|
* However on the OSX, the OR operation is not used, and so this sequence
|
|
|
|
* below is chosen to give MODULEs the highest visible priority.
|
|
|
|
*/
|
2009-02-25 16:35:47 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Draw all tracks and zones. As long as dark colors are used for the
|
|
|
|
* tracks, Then the OR draw mode should show tracks underneath other
|
|
|
|
* tracks. But a white track will cover any other color since it has
|
|
|
|
* more bits to OR in.
|
2009-05-29 16:26:07 +00:00
|
|
|
*/
|
2019-05-31 02:30:28 +00:00
|
|
|
for( auto track : m_tracks )
|
2009-05-29 16:26:07 +00:00
|
|
|
{
|
2014-09-24 16:56:20 +00:00
|
|
|
if( track->IsMoving() )
|
|
|
|
continue;
|
|
|
|
|
2019-05-31 12:15:25 +00:00
|
|
|
track->Print( aFrame, DC );
|
2009-05-29 16:26:07 +00:00
|
|
|
}
|
2007-08-15 02:43:03 +00:00
|
|
|
|
2018-08-26 19:40:22 +00:00
|
|
|
// Draw areas (i.e. zones)
|
|
|
|
for( int ii = 0; ii < GetAreaCount(); ii++ )
|
|
|
|
{
|
|
|
|
ZONE_CONTAINER* zone = GetArea( ii );
|
|
|
|
|
|
|
|
// Areas must be drawn here only if not moved or dragged,
|
|
|
|
// because these areas are drawn by ManageCursor() in a specific manner
|
2019-04-22 08:58:06 +00:00
|
|
|
if( ( zone->GetEditFlags() & (IN_EDIT | IS_DRAGGED | IS_MOVED) ) == 0 )
|
2018-08-26 19:40:22 +00:00
|
|
|
{
|
2019-05-31 12:15:25 +00:00
|
|
|
zone->Print( aFrame, DC );
|
|
|
|
zone->PrintFilledArea( aFrame, DC );
|
2018-08-26 19:40:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
// Draw the graphic items
|
2019-05-30 13:33:59 +00:00
|
|
|
for( auto item : m_drawings )
|
2007-08-15 02:43:03 +00:00
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
if( item->IsMoving() )
|
2007-08-15 02:43:03 +00:00
|
|
|
continue;
|
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
switch( item->Type() )
|
2007-08-15 02:43:03 +00:00
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_DIMENSION_T:
|
|
|
|
case PCB_TEXT_T:
|
2011-09-07 19:41:04 +00:00
|
|
|
case PCB_TARGET_T:
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_LINE_T:
|
2019-05-31 12:15:25 +00:00
|
|
|
item->Print( aFrame, DC );
|
2007-08-15 02:43:03 +00:00
|
|
|
break;
|
|
|
|
|
2013-01-25 17:29:54 +00:00
|
|
|
default:
|
2007-08-15 02:43:03 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
LSET all_cu = LSET::AllCuMask();
|
|
|
|
|
2019-05-31 00:15:57 +00:00
|
|
|
for( auto module : m_modules )
|
2009-05-29 16:26:07 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
bool display = true;
|
|
|
|
LSET layerMask = all_cu;
|
2009-05-29 16:26:07 +00:00
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
if( module->IsMoving() )
|
2009-05-29 16:26:07 +00:00
|
|
|
continue;
|
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
if( !IsElementVisible( LAYER_MOD_FR ) )
|
2009-05-29 16:26:07 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
if( module->GetLayer() == F_Cu )
|
2011-08-26 17:01:17 +00:00
|
|
|
display = false;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
layerMask.set( F_Cu, false );
|
2009-05-29 16:26:07 +00:00
|
|
|
}
|
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
if( !IsElementVisible( LAYER_MOD_BK ) )
|
2009-05-29 16:26:07 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
if( module->GetLayer() == B_Cu )
|
2011-08-26 17:01:17 +00:00
|
|
|
display = false;
|
2013-01-25 17:29:54 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
layerMask.set( B_Cu, false );
|
2009-05-29 16:26:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( display )
|
2019-05-31 12:15:25 +00:00
|
|
|
module->Print( aFrame, DC );
|
2009-05-29 16:26:07 +00:00
|
|
|
else
|
2019-05-31 12:15:25 +00:00
|
|
|
Trace_Pads_Only( aFrame, DC, module, 0, 0, layerMask );
|
2009-05-29 16:26:07 +00:00
|
|
|
}
|
2007-08-15 02:43:03 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
// draw the BOARD's markers last, otherwise the high light will erase any marker on a pad
|
2013-01-25 17:29:54 +00:00
|
|
|
for( unsigned i = 0; i < m_markers.size(); ++i )
|
2008-04-01 05:21:50 +00:00
|
|
|
{
|
2019-05-31 12:15:25 +00:00
|
|
|
m_markers[i]->Print( aFrame, DC );
|
2008-04-01 05:21:50 +00:00
|
|
|
}
|
2009-02-25 16:35:47 +00:00
|
|
|
}
|
2008-12-14 19:45:05 +00:00
|
|
|
|
2009-02-25 16:35:47 +00:00
|
|
|
|
2010-01-28 13:10:46 +00:00
|
|
|
/* Trace the pads of a module in sketch mode.
|
2010-01-31 20:01:46 +00:00
|
|
|
* Used to display pads when when the module visibility is set to not visible
|
2010-01-28 13:10:46 +00:00
|
|
|
* and we want to see pad through.
|
2011-09-07 19:41:04 +00:00
|
|
|
* The pads must appear on the layers selected in LayerMask
|
2010-01-28 13:10:46 +00:00
|
|
|
*/
|
2019-05-31 12:15:25 +00:00
|
|
|
static void Trace_Pads_Only( PCB_BASE_FRAME* aFrame, wxDC* DC, MODULE* aModule,
|
|
|
|
int ox, int oy, LSET aLayerMask )
|
2010-01-28 13:10:46 +00:00
|
|
|
{
|
2019-11-07 14:23:09 +00:00
|
|
|
PCB_DISPLAY_OPTIONS displ_opts = aFrame->GetDisplayOptions();
|
|
|
|
int tmp = displ_opts.m_DisplayPadFill;
|
2010-01-28 13:10:46 +00:00
|
|
|
|
2019-11-07 14:23:09 +00:00
|
|
|
displ_opts.m_DisplayPadFill = false;
|
|
|
|
aFrame->SetDisplayOptions( displ_opts );
|
2010-01-28 13:10:46 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Draw pads.
|
2019-06-01 23:23:36 +00:00
|
|
|
for( auto pad : aModule->Pads() )
|
2010-01-28 13:10:46 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
if( (pad->GetLayerSet() & aLayerMask) == 0 )
|
2010-01-28 13:10:46 +00:00
|
|
|
continue;
|
|
|
|
|
2019-05-31 12:15:25 +00:00
|
|
|
pad->Print( aFrame, DC, wxPoint( ox, oy ) );
|
2010-01-28 13:10:46 +00:00
|
|
|
}
|
|
|
|
|
2019-11-07 14:23:09 +00:00
|
|
|
displ_opts.m_DisplayPadFill = tmp;
|
|
|
|
aFrame->SetDisplayOptions( displ_opts );
|
2010-01-28 13:10:46 +00:00
|
|
|
}
|