2011-07-12 06:57:11 +00:00
|
|
|
/*
|
2011-09-30 18:15:37 +00:00
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
2011-07-12 06:57:11 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
2019-04-27 23:50:35 +00:00
|
|
|
* Copyright (C) 2011-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-07-12 06:57:11 +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
|
|
|
|
*/
|
|
|
|
|
2019-05-10 19:22:26 +00:00
|
|
|
#ifndef EE_COLLECTORS_H
|
|
|
|
#define EE_COLLECTORS_H
|
2011-07-12 06:57:11 +00:00
|
|
|
|
|
|
|
|
2018-02-04 09:49:37 +00:00
|
|
|
#include <collector.h>
|
2019-05-10 19:57:24 +00:00
|
|
|
#include <sch_item.h>
|
2018-02-12 01:31:11 +00:00
|
|
|
#include <sch_sheet_path.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialogs/dialog_schematic_find.h>
|
2011-07-12 06:57:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2019-05-10 19:22:26 +00:00
|
|
|
* Class EE_COLLECTOR
|
2011-07-12 06:57:11 +00:00
|
|
|
*/
|
2019-05-10 19:22:26 +00:00
|
|
|
class EE_COLLECTOR : public COLLECTOR
|
2011-07-12 06:57:11 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
static const KICAD_T AllItems[];
|
|
|
|
static const KICAD_T EditableItems[];
|
|
|
|
static const KICAD_T RotatableItems[];
|
|
|
|
static const KICAD_T ComponentsOnly[];
|
|
|
|
static const KICAD_T SheetsOnly[];
|
2017-12-06 05:25:52 +00:00
|
|
|
|
2019-05-10 19:22:26 +00:00
|
|
|
EE_COLLECTOR( const KICAD_T* aScanTypes = EE_COLLECTOR::AllItems ) :
|
2019-05-19 21:04:04 +00:00
|
|
|
m_Unit( 0 ),
|
2019-05-20 10:23:32 +00:00
|
|
|
m_Convert( 0 )
|
2011-07-12 06:57:11 +00:00
|
|
|
{
|
|
|
|
SetScanTypes( aScanTypes );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-09-28 17:00:24 +00:00
|
|
|
* Overload COLLECTOR::operator[](int) to return a SCH_ITEM instead of an EDA_ITEM.
|
|
|
|
*
|
2011-07-12 06:57:11 +00:00
|
|
|
* @param aIndex The index into the list.
|
|
|
|
* @return SCH_ITEM* at \a aIndex or NULL.
|
|
|
|
*/
|
2019-04-21 23:45:34 +00:00
|
|
|
SCH_ITEM* operator[]( int aIndex ) const override
|
2011-07-12 06:57:11 +00:00
|
|
|
{
|
|
|
|
if( (unsigned)aIndex < (unsigned)GetCount() )
|
|
|
|
return (SCH_ITEM*) m_List[ aIndex ];
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-07-12 19:05:54 +00:00
|
|
|
SEARCH_RESULT Inspect( EDA_ITEM* aItem, void* aTestData ) override;
|
2011-07-12 06:57:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Collect
|
2019-05-06 02:32:01 +00:00
|
|
|
* scans a EDA_ITEM using this class's Inspector method, which does the collection.
|
|
|
|
* @param aItem A EDA_ITEM to scan.
|
2011-07-12 06:57:11 +00:00
|
|
|
* @param aFilterList A list of #KICAD_T types with a terminating #EOT, that determines
|
|
|
|
* what is to be collected and the priority order of the resulting
|
|
|
|
* collection.
|
2019-04-21 23:45:34 +00:00
|
|
|
* @param aPos A wxPoint to use in hit-testing.
|
2019-05-06 02:32:01 +00:00
|
|
|
* @param aUnit A symbol unit filter (for symbol editor)
|
|
|
|
* @param aConvert A DeMorgan filter (for symbol editor)
|
2011-07-12 06:57:11 +00:00
|
|
|
*/
|
2019-05-06 02:32:01 +00:00
|
|
|
void Collect( EDA_ITEM* aItem, const KICAD_T aFilterList[], const wxPoint& aPos,
|
|
|
|
int aUnit = 0, int aConvert = 0 );
|
2011-07-12 06:57:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function IsCorner
|
|
|
|
* tests if the collected items forms as corner of two line segments.
|
|
|
|
* @return True if the collected items form a corner of two line segments.
|
|
|
|
*/
|
|
|
|
bool IsCorner() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function IsDraggableJunction
|
|
|
|
* tests to see if the collected items form a draggable junction.
|
|
|
|
* <p>
|
2011-12-01 16:49:28 +00:00
|
|
|
* Daggable junctions are defined as:
|
2011-07-12 06:57:11 +00:00
|
|
|
* <ul>
|
|
|
|
* <li> The intersection of three or more wire end points. </li>
|
|
|
|
* <li> The intersection of one or more wire end point and one wire mid point. </li>
|
|
|
|
* <li> The crossing of two or more wire mid points and a junction. </li>
|
|
|
|
* </ul>
|
|
|
|
* </p>
|
|
|
|
* @return True if the collection is a draggable junction.
|
|
|
|
*/
|
|
|
|
bool IsDraggableJunction() const;
|
2019-04-25 20:25:44 +00:00
|
|
|
|
|
|
|
public:
|
2019-05-06 02:32:01 +00:00
|
|
|
int m_Unit; // Fixed symbol unit filter (for symbol editor)
|
|
|
|
int m_Convert; // Fixed DeMorgan filter (for symbol editor)
|
2011-07-12 06:57:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
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
|
|
|
/**
|
2019-05-10 19:22:26 +00:00
|
|
|
* Class EE_TYPE_COLLECTOR
|
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
|
|
|
* merely gathers up all SCH_ITEMs of a given set of KICAD_T type(s). It does
|
|
|
|
* no hit-testing.
|
|
|
|
*
|
|
|
|
* @see class COLLECTOR
|
|
|
|
*/
|
2019-05-10 19:22:26 +00:00
|
|
|
class EE_TYPE_COLLECTOR : public EE_COLLECTOR
|
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
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Function Inspect
|
2019-04-21 23:45:34 +00:00
|
|
|
* is the examining function within the INSPECTOR which is passed to the Iterate function.
|
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
|
|
|
*
|
|
|
|
* @param testItem An EDA_ITEM to examine.
|
|
|
|
* @param testData is not used in this class.
|
|
|
|
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
|
|
|
|
* else SCAN_CONTINUE;
|
|
|
|
*/
|
2016-07-12 19:05:54 +00:00
|
|
|
SEARCH_RESULT Inspect( EDA_ITEM* testItem, void* testData ) override;
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Collect
|
2019-04-21 23:45:34 +00:00
|
|
|
* scans a DLIST using this class's Inspector method, which does the collection.
|
|
|
|
* @param aItem The head of a DLIST to scan.
|
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
|
|
|
* @param aScanList The KICAD_Ts to gather up.
|
|
|
|
*/
|
2019-05-10 19:22:26 +00:00
|
|
|
void Collect( EDA_ITEM* aItem, const KICAD_T aScanList[] );
|
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
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-05-10 19:22:26 +00:00
|
|
|
#endif // EE_COLLECTORS_H
|