2007-08-23 04:28:46 +00:00
|
|
|
/*
|
2011-09-30 18:15:37 +00:00
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
2007-08-23 04:28:46 +00:00
|
|
|
*
|
2008-01-22 20:35:46 +00:00
|
|
|
* Copyright (C) 2007-2008 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2011-09-30 18:15:37 +00:00
|
|
|
* Copyright (C) 2004-2007 KiCad Developers, see change_log.txt for contributors.
|
2008-01-08 17:44:20 +00:00
|
|
|
*
|
2007-08-23 04:28:46 +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.
|
2008-01-08 17:44:20 +00:00
|
|
|
*
|
2007-08-23 04:28:46 +00:00
|
|
|
* 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.
|
2008-01-08 17:44:20 +00:00
|
|
|
*
|
2007-08-23 04:28:46 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
2008-01-08 17:44:20 +00:00
|
|
|
* 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.,
|
2007-08-23 04:28:46 +00:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <collectors.h>
|
|
|
|
#include <class_board_item.h> // class BOARD_ITEM
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_module.h>
|
|
|
|
#include <class_pad.h>
|
2012-10-04 17:47:28 +00:00
|
|
|
#include <class_track.h>
|
2012-02-09 20:33:38 +00:00
|
|
|
#include <class_marker_pcb.h>
|
2007-08-23 04:28:46 +00:00
|
|
|
|
|
|
|
|
2008-01-08 17:44:20 +00:00
|
|
|
/* This module contains out of line member functions for classes given in
|
2011-03-01 19:26:17 +00:00
|
|
|
* collectors.h. Those classes augment the functionality of class PCB_EDIT_FRAME.
|
2008-01-08 17:44:20 +00:00
|
|
|
*/
|
2007-08-23 04:28:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
// see collectors.h
|
2007-08-30 22:20:52 +00:00
|
|
|
const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
|
2007-10-03 19:45:32 +00:00
|
|
|
// there are some restrictions on the order of items in the general case.
|
|
|
|
// all items in m_Drawings for instance should be contiguous.
|
2008-01-10 20:53:41 +00:00
|
|
|
// *** all items in a same list (shown here) must be contiguous ****
|
2011-10-01 19:24:27 +00:00
|
|
|
PCB_MARKER_T, // in m_markers
|
|
|
|
PCB_TEXT_T, // in m_Drawings
|
|
|
|
PCB_LINE_T, // in m_Drawings
|
|
|
|
PCB_DIMENSION_T, // in m_Drawings
|
2011-09-07 19:41:04 +00:00
|
|
|
PCB_TARGET_T, // in m_Drawings
|
2011-10-01 19:24:27 +00:00
|
|
|
PCB_VIA_T, // in m_Tracks
|
|
|
|
PCB_TRACE_T, // in m_Tracks
|
|
|
|
PCB_PAD_T, // in modules
|
|
|
|
PCB_MODULE_TEXT_T, // in modules
|
|
|
|
PCB_MODULE_T, // in m_Modules
|
|
|
|
PCB_ZONE_T, // in m_Zones
|
|
|
|
PCB_ZONE_AREA_T, // in m_ZoneDescriptorList
|
2007-08-23 04:28:46 +00:00
|
|
|
EOT
|
2008-01-08 17:44:20 +00:00
|
|
|
};
|
2007-08-23 04:28:46 +00:00
|
|
|
|
|
|
|
|
2007-10-10 14:08:26 +00:00
|
|
|
/*
|
2008-01-08 17:44:20 +00:00
|
|
|
* const KICAD_T GENERAL_COLLECTOR::PrimaryItems[] = {
|
2011-10-01 19:24:27 +00:00
|
|
|
* PCB_TEXT_T,
|
|
|
|
* PCB_LINE_T,
|
|
|
|
* PCB_DIMENSION_T,
|
|
|
|
* PCB_VIA_T,
|
|
|
|
* PCB_TRACE_T,
|
|
|
|
* PCB_MODULE_T,
|
2008-01-08 17:44:20 +00:00
|
|
|
* EOT
|
|
|
|
* };
|
|
|
|
*/
|
2007-09-06 04:34:03 +00:00
|
|
|
|
|
|
|
|
2007-09-25 15:10:01 +00:00
|
|
|
const KICAD_T GENERAL_COLLECTOR::AllButZones[] = {
|
2011-10-01 19:24:27 +00:00
|
|
|
PCB_MARKER_T,
|
|
|
|
PCB_TEXT_T,
|
|
|
|
PCB_LINE_T,
|
|
|
|
PCB_DIMENSION_T,
|
2011-09-07 19:41:04 +00:00
|
|
|
PCB_TARGET_T,
|
2011-10-01 19:24:27 +00:00
|
|
|
PCB_VIA_T,
|
|
|
|
PCB_TRACE_T,
|
|
|
|
PCB_PAD_T,
|
|
|
|
PCB_MODULE_TEXT_T,
|
|
|
|
PCB_MODULE_T,
|
|
|
|
PCB_ZONE_AREA_T, // if it is visible on screen, it should be selectable
|
2007-09-25 15:10:01 +00:00
|
|
|
EOT
|
|
|
|
};
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2007-09-25 15:10:01 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
const KICAD_T GENERAL_COLLECTOR::Modules[] = {
|
2011-10-01 19:24:27 +00:00
|
|
|
PCB_MODULE_T,
|
2007-09-12 02:14:07 +00:00
|
|
|
EOT
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-01-08 17:44:20 +00:00
|
|
|
const KICAD_T GENERAL_COLLECTOR::PadsOrModules[] = {
|
2011-10-01 19:24:27 +00:00
|
|
|
PCB_PAD_T,
|
|
|
|
PCB_MODULE_T,
|
2008-01-08 17:44:20 +00:00
|
|
|
EOT
|
2007-09-12 02:14:07 +00:00
|
|
|
};
|
|
|
|
|
2007-12-13 06:24:09 +00:00
|
|
|
|
2008-02-19 16:54:57 +00:00
|
|
|
const KICAD_T GENERAL_COLLECTOR::PadsTracksOrZones[] = {
|
2011-10-01 19:24:27 +00:00
|
|
|
PCB_PAD_T,
|
|
|
|
PCB_VIA_T,
|
|
|
|
PCB_TRACE_T,
|
|
|
|
PCB_ZONE_T,
|
|
|
|
PCB_ZONE_AREA_T,
|
2008-01-08 17:44:20 +00:00
|
|
|
EOT
|
2007-12-13 06:24:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-01-08 17:44:20 +00:00
|
|
|
const KICAD_T GENERAL_COLLECTOR::ModulesAndTheirItems[] = {
|
2011-10-01 19:24:27 +00:00
|
|
|
PCB_MODULE_TEXT_T,
|
|
|
|
PCB_MODULE_EDGE_T,
|
|
|
|
PCB_PAD_T,
|
|
|
|
PCB_MODULE_T,
|
2008-01-08 17:44:20 +00:00
|
|
|
EOT
|
2007-10-27 18:05:50 +00:00
|
|
|
};
|
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
const KICAD_T GENERAL_COLLECTOR::ModuleItems[] = {
|
|
|
|
PCB_MODULE_TEXT_T,
|
|
|
|
PCB_MODULE_EDGE_T,
|
|
|
|
PCB_PAD_T,
|
|
|
|
EOT
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
const KICAD_T GENERAL_COLLECTOR::Tracks[] = {
|
2011-10-01 19:24:27 +00:00
|
|
|
PCB_TRACE_T,
|
|
|
|
PCB_VIA_T,
|
2007-09-12 02:14:07 +00:00
|
|
|
EOT
|
|
|
|
};
|
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
|
2011-05-12 11:06:32 +00:00
|
|
|
const KICAD_T GENERAL_COLLECTOR::Zones[] = {
|
2011-10-01 19:24:27 +00:00
|
|
|
PCB_ZONE_AREA_T,
|
2011-05-12 11:06:32 +00:00
|
|
|
EOT
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
/**
|
|
|
|
* Function Inspect
|
2008-01-08 17:44:20 +00:00
|
|
|
* is the examining function within the INSPECTOR which is passed to the
|
|
|
|
* Iterate function. Searches and collects all the objects that the old
|
2007-08-23 04:28:46 +00:00
|
|
|
* function PcbGeneralLocateAndDisplay() would find, except that it keeps all
|
2008-01-08 17:44:20 +00:00
|
|
|
* that it finds and does not do any displaying.
|
2007-08-23 04:28:46 +00:00
|
|
|
*
|
2010-12-08 20:12:46 +00:00
|
|
|
* @param testItem An EDA_ITEM to examine.
|
2016-07-12 19:05:54 +00:00
|
|
|
* @param testData not used here.
|
2007-08-23 04:28:46 +00:00
|
|
|
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
|
|
|
|
* else SCAN_CONTINUE;
|
2008-01-08 17:44:20 +00:00
|
|
|
*/
|
2016-07-12 19:05:54 +00:00
|
|
|
SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
|
2007-08-23 04:28:46 +00:00
|
|
|
{
|
2008-01-08 17:44:20 +00:00
|
|
|
BOARD_ITEM* item = (BOARD_ITEM*) testItem;
|
2007-09-05 14:52:28 +00:00
|
|
|
MODULE* module = NULL;
|
2010-02-05 10:56:23 +00:00
|
|
|
D_PAD* pad = NULL;
|
|
|
|
bool pad_through = false;
|
2014-04-25 06:00:04 +00:00
|
|
|
VIA* via = NULL;
|
2012-02-09 20:33:38 +00:00
|
|
|
MARKER_PCB* marker = NULL;
|
2007-08-24 03:40:04 +00:00
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
#if 0 // debugging
|
2008-01-08 17:44:20 +00:00
|
|
|
static int breakhere = 0;
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( item->Type() )
|
2007-08-24 03:40:04 +00:00
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_PAD_T:
|
2007-09-05 15:11:48 +00:00
|
|
|
{
|
2013-08-05 20:47:34 +00:00
|
|
|
MODULE* m = (MODULE*) item->GetParent();
|
|
|
|
|
|
|
|
if( m->GetReference() == wxT( "Y2" ) )
|
|
|
|
{
|
|
|
|
breakhere++;
|
|
|
|
}
|
2007-09-05 15:11:48 +00:00
|
|
|
}
|
2007-09-05 04:48:47 +00:00
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_VIA_T:
|
2007-09-05 04:48:47 +00:00
|
|
|
breakhere++;
|
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_TRACE_T:
|
2007-09-05 04:48:47 +00:00
|
|
|
breakhere++;
|
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_ZONE_T:
|
2007-09-25 08:23:53 +00:00
|
|
|
breakhere++;
|
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_TEXT_T:
|
2007-09-05 04:48:47 +00:00
|
|
|
breakhere++;
|
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_LINE_T:
|
2007-09-05 04:48:47 +00:00
|
|
|
breakhere++;
|
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_DIMENSION_T:
|
2007-09-05 04:48:47 +00:00
|
|
|
breakhere++;
|
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_TEXT_T:
|
2008-01-08 17:44:20 +00:00
|
|
|
{
|
2013-08-05 20:47:34 +00:00
|
|
|
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
|
|
|
|
|
|
|
|
if( tm->GetText() == wxT( "10uH" ) )
|
|
|
|
{
|
|
|
|
breakhere++;
|
|
|
|
}
|
2008-01-08 17:44:20 +00:00
|
|
|
}
|
2007-09-05 04:48:47 +00:00
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_T:
|
2007-09-05 04:48:47 +00:00
|
|
|
{
|
2013-08-05 20:47:34 +00:00
|
|
|
MODULE* m = (MODULE*) item;
|
|
|
|
|
|
|
|
if( m->GetReference() == wxT( "C98" ) )
|
|
|
|
{
|
|
|
|
breakhere++;
|
|
|
|
}
|
2007-09-05 04:48:47 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2012-02-09 20:33:38 +00:00
|
|
|
case PCB_MARKER_T:
|
|
|
|
breakhere++;
|
|
|
|
break;
|
|
|
|
|
2007-08-24 03:40:04 +00:00
|
|
|
default:
|
2007-09-05 04:48:47 +00:00
|
|
|
breakhere++;
|
|
|
|
break;
|
2007-08-24 03:40:04 +00:00
|
|
|
}
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2007-08-24 03:40:04 +00:00
|
|
|
#endif
|
2007-08-30 22:20:52 +00:00
|
|
|
|
|
|
|
|
2007-09-05 04:48:47 +00:00
|
|
|
switch( item->Type() )
|
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_PAD_T:
|
2010-02-05 10:56:23 +00:00
|
|
|
// there are pad specific visibility controls.
|
|
|
|
// Criterias to select a pad is:
|
2011-09-07 19:41:04 +00:00
|
|
|
// for smd pads: the module parent must be seen, and pads on the corresponding
|
|
|
|
// board side must be seen
|
2007-09-22 04:33:44 +00:00
|
|
|
// if pad is a thru hole, then it can be visible when its parent module is not.
|
2010-04-23 09:54:40 +00:00
|
|
|
// for through pads: pads on Front or Back board sides must be seen
|
2010-02-05 10:56:23 +00:00
|
|
|
pad = (D_PAD*) item;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2015-08-23 19:40:33 +00:00
|
|
|
if( (pad->GetAttribute() != PAD_ATTRIB_SMD) &&
|
|
|
|
(pad->GetAttribute() != PAD_ATTRIB_CONN) ) // a hole is present, so multiple layers
|
2007-09-22 04:33:44 +00:00
|
|
|
{
|
2008-01-08 17:44:20 +00:00
|
|
|
// proceed to the common tests below, but without the parent module test,
|
2010-02-05 10:56:23 +00:00
|
|
|
// by leaving module==NULL, but having pad != null
|
|
|
|
pad_through = true;
|
2007-09-22 04:33:44 +00:00
|
|
|
}
|
2010-02-05 10:56:23 +00:00
|
|
|
else // smd, so use pads test after module test
|
2011-09-07 19:41:04 +00:00
|
|
|
{
|
2014-09-11 16:35:19 +00:00
|
|
|
module = static_cast<MODULE*>( item->GetParent() );
|
2011-09-07 19:41:04 +00:00
|
|
|
}
|
|
|
|
|
2007-09-05 04:48:47 +00:00
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2012-10-04 17:47:28 +00:00
|
|
|
case PCB_VIA_T: // vias are on many layers, so layer test is specific
|
2014-09-11 16:35:19 +00:00
|
|
|
via = static_cast<VIA*>( item );
|
2007-09-05 04:48:47 +00:00
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_TRACE_T:
|
2007-09-05 04:48:47 +00:00
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_ZONE_T:
|
2007-09-25 08:23:53 +00:00
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_ZONE_AREA_T:
|
2007-12-29 19:15:58 +00:00
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_TEXT_T:
|
2007-09-05 04:48:47 +00:00
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_LINE_T:
|
2007-09-05 04:48:47 +00:00
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_DIMENSION_T:
|
2007-09-05 04:48:47 +00:00
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
case PCB_TARGET_T:
|
2008-01-08 17:44:20 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_TEXT_T:
|
2007-09-05 04:48:47 +00:00
|
|
|
{
|
2014-09-11 16:35:19 +00:00
|
|
|
TEXTE_MODULE *text = static_cast<TEXTE_MODULE*>( item );
|
|
|
|
if( m_Guide->IgnoreMTextsMarkedNoShow() && !text->IsVisible() )
|
2007-09-05 04:48:47 +00:00
|
|
|
goto exit;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2014-09-11 16:35:19 +00:00
|
|
|
if( m_Guide->IgnoreMTextsOnBack() && IsBackLayer( text->GetLayer() ) )
|
2007-09-25 15:10:01 +00:00
|
|
|
goto exit;
|
2011-12-14 22:35:03 +00:00
|
|
|
|
2014-09-11 16:35:19 +00:00
|
|
|
if( m_Guide->IgnoreMTextsOnFront() && IsFrontLayer( text->GetLayer() ) )
|
2011-12-14 22:35:03 +00:00
|
|
|
goto exit;
|
|
|
|
|
2014-09-11 16:35:19 +00:00
|
|
|
/* The three text types have different criteria: reference
|
|
|
|
* and value have their own ignore flags; user text instead
|
|
|
|
* follows their layer visibility. Checking this here is
|
|
|
|
* simpler than later (when layer visibility is checked for
|
|
|
|
* other entities) */
|
|
|
|
|
|
|
|
switch( text->GetType() )
|
|
|
|
{
|
|
|
|
case TEXTE_MODULE::TEXT_is_REFERENCE:
|
|
|
|
if( m_Guide->IgnoreModulesRefs() )
|
|
|
|
goto exit;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TEXTE_MODULE::TEXT_is_VALUE:
|
|
|
|
if( m_Guide->IgnoreModulesVals() )
|
|
|
|
goto exit;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TEXTE_MODULE::TEXT_is_DIVERS:
|
|
|
|
if( !m_Guide->IsLayerVisible( text->GetLayer() )
|
|
|
|
&& m_Guide->IgnoreNonVisibleLayers() )
|
|
|
|
goto exit;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Extract the module since it could be hidden
|
|
|
|
module = static_cast<MODULE*>( item->GetParent() );
|
2007-09-05 04:48:47 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_T:
|
2014-09-11 16:35:19 +00:00
|
|
|
module = static_cast<MODULE*>( item );
|
2007-09-05 04:48:47 +00:00
|
|
|
break;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2012-02-09 20:33:38 +00:00
|
|
|
case PCB_MARKER_T:
|
2014-09-11 16:35:19 +00:00
|
|
|
marker = static_cast<MARKER_PCB*>( item );
|
2012-02-09 20:33:38 +00:00
|
|
|
break;
|
|
|
|
|
2007-09-05 04:48:47 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2007-09-05 04:48:47 +00:00
|
|
|
// common tests:
|
2007-09-05 14:52:28 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
if( module ) // true from case PCB_PAD_T, PCB_MODULE_TEXT_T, or PCB_MODULE_T
|
2007-09-05 14:52:28 +00:00
|
|
|
{
|
2014-09-11 16:35:19 +00:00
|
|
|
if( m_Guide->IgnoreModulesOnBack() && (module->GetLayer() == B_Cu) )
|
2007-09-05 14:52:28 +00:00
|
|
|
goto exit;
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2014-09-11 16:35:19 +00:00
|
|
|
if( m_Guide->IgnoreModulesOnFront() && (module->GetLayer() == F_Cu) )
|
2007-09-05 14:52:28 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2007-09-15 04:25:54 +00:00
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
// Pads are not sensitive to the layer visibility controls.
|
2010-02-05 10:56:23 +00:00
|
|
|
// They all have their own separate visibility controls
|
|
|
|
// skip them if not visible
|
2013-08-05 20:47:34 +00:00
|
|
|
if( pad )
|
2010-02-05 10:56:23 +00:00
|
|
|
{
|
|
|
|
if( m_Guide->IgnorePads() )
|
|
|
|
goto exit;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2010-02-05 10:56:23 +00:00
|
|
|
if( ! pad_through )
|
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
if( m_Guide->IgnorePadsOnFront() && pad->IsOnLayer(F_Cu ) )
|
2010-02-05 10:56:23 +00:00
|
|
|
goto exit;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
if( m_Guide->IgnorePadsOnBack() && pad->IsOnLayer(B_Cu ) )
|
2010-02-05 10:56:23 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
}
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2012-02-09 20:33:38 +00:00
|
|
|
if( marker )
|
|
|
|
{
|
|
|
|
// Markers are not sensitive to the layer
|
|
|
|
if( marker->HitTest( m_RefPos ) )
|
|
|
|
Append( item );
|
|
|
|
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-09-11 16:35:19 +00:00
|
|
|
if( item->IsOnLayer( m_Guide->GetPreferredLayer() ) ||
|
|
|
|
m_Guide->IgnorePreferredLayer() )
|
2007-08-23 04:28:46 +00:00
|
|
|
{
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID layer = item->GetLayer();
|
2007-09-15 04:25:54 +00:00
|
|
|
|
2014-09-11 16:35:19 +00:00
|
|
|
/* Modules and their subcomponents: reference, value and pads
|
|
|
|
* are not sensitive to the layer visibility controls. They all
|
|
|
|
* have their own separate visibility controls for vias,
|
|
|
|
* GetLayer() has no meaning, but IsOnLayer() works fine. User
|
|
|
|
* text in module *is* sensitive to layer visibility but that
|
|
|
|
* was already handled */
|
|
|
|
|
|
|
|
if( via || module || pad || m_Guide->IsLayerVisible( layer )
|
|
|
|
|| !m_Guide->IgnoreNonVisibleLayers() )
|
2007-08-23 04:28:46 +00:00
|
|
|
{
|
2008-01-08 17:44:20 +00:00
|
|
|
if( !m_Guide->IsLayerLocked( layer ) || !m_Guide->IgnoreLockedLayers() )
|
2007-08-24 03:40:04 +00:00
|
|
|
{
|
2007-08-30 22:20:52 +00:00
|
|
|
if( !item->IsLocked() || !m_Guide->IgnoreLockedItems() )
|
|
|
|
{
|
|
|
|
if( item->HitTest( m_RefPos ) )
|
|
|
|
{
|
2007-09-25 15:10:01 +00:00
|
|
|
Append( item );
|
2007-08-30 22:20:52 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
}
|
2007-08-24 03:40:04 +00:00
|
|
|
}
|
2007-08-23 04:28:46 +00:00
|
|
|
}
|
2007-08-30 22:20:52 +00:00
|
|
|
}
|
|
|
|
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2007-08-30 22:20:52 +00:00
|
|
|
if( m_Guide->IncludeSecondary() )
|
|
|
|
{
|
|
|
|
// for now, "secondary" means "tolerate any layer". It has
|
2008-01-08 17:44:20 +00:00
|
|
|
// no effect on other criteria, since there is a separate "ignore" control for
|
2007-08-30 22:20:52 +00:00
|
|
|
// those in the COLLECTORS_GUIDE
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID layer = item->GetLayer();
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2014-09-11 16:35:19 +00:00
|
|
|
/* Modules and their subcomponents: reference, value and pads
|
|
|
|
* are not sensitive to the layer visibility controls. They all
|
|
|
|
* have their own separate visibility controls. User texts
|
|
|
|
* follows layer visibility controls (but that was already
|
|
|
|
* checked) */
|
|
|
|
|
2015-04-03 09:13:06 +00:00
|
|
|
if( via || module || pad || m_Guide->IsLayerVisible( layer )
|
2014-09-11 16:35:19 +00:00
|
|
|
|| !m_Guide->IgnoreNonVisibleLayers() )
|
2007-08-23 04:28:46 +00:00
|
|
|
{
|
2008-01-08 17:44:20 +00:00
|
|
|
if( !m_Guide->IsLayerLocked( layer ) || !m_Guide->IgnoreLockedLayers() )
|
2007-08-30 22:20:52 +00:00
|
|
|
{
|
|
|
|
if( !item->IsLocked() || !m_Guide->IgnoreLockedItems() )
|
|
|
|
{
|
|
|
|
if( item->HitTest( m_RefPos ) )
|
|
|
|
{
|
2007-09-25 15:10:01 +00:00
|
|
|
Append2nd( item );
|
2007-08-30 22:20:52 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-08-23 04:28:46 +00:00
|
|
|
}
|
|
|
|
}
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2007-08-30 22:20:52 +00:00
|
|
|
exit:
|
|
|
|
return SEARCH_CONTINUE; // always when collecting
|
2007-08-23 04:28:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-01-08 17:44:20 +00:00
|
|
|
// see collectors.h
|
2007-09-11 04:16:31 +00:00
|
|
|
void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const KICAD_T aScanList[],
|
2008-01-08 17:44:20 +00:00
|
|
|
const wxPoint& aRefPos, const COLLECTORS_GUIDE& aGuide )
|
2007-08-30 03:53:26 +00:00
|
|
|
{
|
|
|
|
Empty(); // empty the collection, primary criteria list
|
|
|
|
Empty2nd(); // empty the collection, secondary criteria list
|
|
|
|
|
2007-08-30 22:20:52 +00:00
|
|
|
// remember guide, pass it to Inspect()
|
2007-09-11 04:16:31 +00:00
|
|
|
SetGuide( &aGuide );
|
|
|
|
|
|
|
|
SetScanTypes( aScanList );
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2007-08-30 22:20:52 +00:00
|
|
|
// remember where the snapshot was taken from and pass refPos to
|
|
|
|
// the Inspect() function.
|
2007-09-06 04:34:03 +00:00
|
|
|
SetRefPos( aRefPos );
|
2007-08-30 03:53:26 +00:00
|
|
|
|
2016-07-12 19:05:54 +00:00
|
|
|
aItem->Visit( m_inspector, NULL, m_ScanTypes );
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2007-08-30 03:53:26 +00:00
|
|
|
SetTimeNow(); // when snapshot was taken
|
2007-09-12 02:14:07 +00:00
|
|
|
|
2015-04-03 09:13:06 +00:00
|
|
|
// record the length of the primary list before concatenating on to it.
|
2007-09-12 02:14:07 +00:00
|
|
|
m_PrimaryLength = m_List.size();
|
2008-01-08 17:44:20 +00:00
|
|
|
|
|
|
|
// append 2nd list onto end of the first list
|
|
|
|
for( unsigned i = 0; i<m_List2nd.size(); ++i )
|
2007-08-30 22:20:52 +00:00
|
|
|
Append( m_List2nd[i] );
|
2008-01-08 17:44:20 +00:00
|
|
|
|
2007-08-30 03:53:26 +00:00
|
|
|
Empty2nd();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-01-22 20:35:46 +00:00
|
|
|
// see collectors.h
|
2016-07-12 19:05:54 +00:00
|
|
|
SEARCH_RESULT PCB_TYPE_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
|
2008-01-22 20:35:46 +00:00
|
|
|
{
|
2008-02-19 16:54:57 +00:00
|
|
|
// The Vist() function only visits the testItem if its type was in the
|
2008-01-22 20:35:46 +00:00
|
|
|
// the scanList, so therefore we can collect anything given to us here.
|
|
|
|
Append( testItem );
|
2008-02-19 16:54:57 +00:00
|
|
|
|
2008-01-22 20:35:46 +00:00
|
|
|
return SEARCH_CONTINUE; // always when collecting
|
|
|
|
}
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
|
|
|
void PCB_TYPE_COLLECTOR::Collect( BOARD_ITEM* aBoard, const KICAD_T aScanList[] )
|
2008-01-22 20:35:46 +00:00
|
|
|
{
|
|
|
|
Empty(); // empty any existing collection
|
2008-02-19 16:54:57 +00:00
|
|
|
|
2016-07-12 19:05:54 +00:00
|
|
|
aBoard->Visit( m_inspector, NULL, aScanList );
|
2008-01-22 20:35:46 +00:00
|
|
|
}
|