2011-11-11 20:10:24 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-04-16 15:26:51 +00:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2017-12-07 23:01:03 +00:00
|
|
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
2022-01-29 19:07:07 +00:00
|
|
|
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-11-11 20:10:24 +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
|
|
|
|
*/
|
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
/**
|
2021-06-15 13:24:55 +00:00
|
|
|
* @file symbol_library.h
|
2021-06-15 12:31:28 +00:00
|
|
|
* @brief Definition for symbol library class.
|
2011-10-07 14:41:30 +00:00
|
|
|
*/
|
2008-09-13 18:59:57 +00:00
|
|
|
|
2021-06-15 13:24:55 +00:00
|
|
|
#ifndef SYMBOL_LIBRARY_H
|
|
|
|
#define SYMBOL_LIBRARY_H
|
2008-09-13 18:59:57 +00:00
|
|
|
|
2021-04-18 17:39:46 +00:00
|
|
|
#include <mutex>
|
2019-11-06 19:15:42 +00:00
|
|
|
#include <boost/ptr_container/ptr_vector.hpp>
|
2010-11-10 15:30:12 +00:00
|
|
|
#include <wx/filename.h>
|
|
|
|
|
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
|
|
|
#include <project.h>
|
2022-01-29 19:07:07 +00:00
|
|
|
#include <sch_io_mgr.h>
|
|
|
|
#include <symbol_library_common.h>
|
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2021-06-10 18:51:46 +00:00
|
|
|
class LIB_SYMBOL;
|
2017-01-31 01:31:19 +00:00
|
|
|
class LIB_ID;
|
2011-10-31 20:49:48 +00:00
|
|
|
class LINE_READER;
|
2011-11-01 15:06:26 +00:00
|
|
|
class OUTPUTFORMATTER;
|
2022-11-06 16:51:52 +00:00
|
|
|
class STRING_UTF8_MAP;
|
2017-01-27 15:56:36 +00:00
|
|
|
class SCH_PLUGIN;
|
2021-06-15 12:31:28 +00:00
|
|
|
class SYMBOL_LIB;
|
2009-10-08 13:19:28 +00:00
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
|
2022-01-29 19:07:07 +00:00
|
|
|
/* Helpers for creating a list of symbol libraries. */
|
2021-06-15 12:31:28 +00:00
|
|
|
typedef boost::ptr_vector< SYMBOL_LIB > SYMBOL_LIBS_BASE;
|
2009-09-18 14:56:05 +00:00
|
|
|
|
|
|
|
|
2009-09-02 18:12:45 +00:00
|
|
|
/**
|
2021-06-15 12:31:28 +00:00
|
|
|
* A collection of #SYMBOL_LIB objects.
|
2017-12-07 23:01:03 +00:00
|
|
|
*
|
|
|
|
* It extends from PROJECT::_ELEM so it can be hung in the PROJECT. It does not use any
|
|
|
|
* UI calls, but rather simply throws an IO_ERROR when there is a problem.
|
2009-09-02 18:12:45 +00:00
|
|
|
*/
|
2021-06-15 12:31:28 +00:00
|
|
|
class SYMBOL_LIBS : public SYMBOL_LIBS_BASE, public PROJECT::_ELEM
|
2008-09-13 18:59:57 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-06-15 12:31:28 +00:00
|
|
|
KICAD_T Type() override { return SYMBOL_LIBS_T; }
|
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
|
|
|
|
2022-02-07 20:40:21 +00:00
|
|
|
SYMBOL_LIBS() {}
|
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
|
|
|
|
|
|
|
/**
|
2021-06-15 12:31:28 +00:00
|
|
|
* Allocate and adds a symbol library to the library list.
|
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
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* @param aFileName is the file name object of symbol library.
|
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
|
|
|
* @throw IO_ERROR if there's any problem loading.
|
|
|
|
*/
|
2021-06-15 12:31:28 +00:00
|
|
|
SYMBOL_LIB* AddLibrary( const wxString& aFileName );
|
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
|
|
|
|
|
|
|
/**
|
2021-06-15 12:31:28 +00:00
|
|
|
* Insert a symbol library into the library list.
|
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
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* @param aFileName is the file name object of symbol library.
|
|
|
|
* @param aIterator is an iterator to insert library in front of.
|
|
|
|
* @return the new SYMBOL_LIB, which remains owned by this SYMBOL_LIBS container.
|
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
|
|
|
* @throw IO_ERROR if there's any problem loading.
|
|
|
|
*/
|
2021-06-15 12:31:28 +00:00
|
|
|
SYMBOL_LIB* AddLibrary( const wxString& aFileName, SYMBOL_LIBS::iterator& aIterator );
|
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
|
|
|
|
2023-05-31 20:37:58 +00:00
|
|
|
/**
|
|
|
|
* Refreshes the library from the (possibly updated) contents on disk
|
|
|
|
*
|
|
|
|
* @param aFileName is the file name of the symbol library
|
|
|
|
* @return true if successfully updated
|
|
|
|
*/
|
|
|
|
bool ReloadLibrary( const wxString& aFileName );
|
|
|
|
|
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
|
|
|
/**
|
2017-12-07 23:01:03 +00:00
|
|
|
* Load all of the project's libraries into this container, which should
|
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
|
|
|
* be cleared before calling it.
|
2017-12-07 23:01:03 +00:00
|
|
|
*
|
|
|
|
* @note This method is only to be used when loading legacy projects. All further symbol
|
|
|
|
* library access should be done via the symbol library table.
|
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
|
|
|
*/
|
2017-06-08 21:47:21 +00:00
|
|
|
void LoadAllLibraries( PROJECT* aProject, bool aShowProgress=true );
|
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
|
|
|
|
2022-10-11 10:22:09 +00:00
|
|
|
static void GetLibNamesAndPaths( PROJECT* aProject, wxString* aPaths,
|
|
|
|
wxArrayString* aNames = nullptr );
|
|
|
|
|
|
|
|
static void SetLibNamesAndPaths( PROJECT* aProject, const wxString& aPaths,
|
|
|
|
const wxArrayString& aNames );
|
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
|
|
|
|
|
|
|
/**
|
2017-12-07 23:01:03 +00:00
|
|
|
* Return the name of the cache library after potentially fixing it from
|
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
|
|
|
* an older naming scheme. That is, the old file is renamed if needed.
|
2017-12-07 23:01:03 +00:00
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* @param aFullProjectFilename is the *.pro filename with absolute path.
|
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
|
|
|
*/
|
|
|
|
static const wxString CacheName( const wxString& aFullProjectFilename );
|
|
|
|
|
|
|
|
/**
|
2021-06-15 12:31:28 +00:00
|
|
|
* Find a symbol library by \a aName.
|
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
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* @param aName is the library file name without path or extension to find.
|
|
|
|
* @return the symbol library if found, otherwise NULL.
|
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
|
|
|
*/
|
2021-06-15 12:31:28 +00:00
|
|
|
SYMBOL_LIB* FindLibrary( const wxString& aName );
|
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
|
|
|
|
2021-06-15 12:31:28 +00:00
|
|
|
SYMBOL_LIB* FindLibraryByFullFileName( const wxString& aFullFileName );
|
2017-02-13 18:47:18 +00:00
|
|
|
|
2021-06-15 12:31:28 +00:00
|
|
|
SYMBOL_LIB* GetCacheLibrary();
|
2017-09-01 20:42:20 +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
|
|
|
/**
|
2021-06-15 12:31:28 +00:00
|
|
|
* Return the list of symbol library file names without path and extension.
|
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
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* @param aSorted sort the list of name if true. Otherwise use the library load order.
|
|
|
|
* @return the list of library names.
|
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
|
|
|
*/
|
|
|
|
wxArrayString GetLibraryNames( bool aSorted = true );
|
|
|
|
|
|
|
|
/**
|
2021-06-15 12:31:28 +00:00
|
|
|
* Search all libraries in the list for a symbol.
|
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
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* A symbol object will always be returned. If the entry found
|
|
|
|
* is an alias. The root symbol will be found and returned.
|
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
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* @param aLibId is the #LIB_ID of the symbol to search for.
|
|
|
|
* @param aLibraryName is the name of the library to search for symbol.
|
|
|
|
* @return the symbol object if found, otherwise NULL.
|
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
|
|
|
*/
|
2021-06-15 12:31:28 +00:00
|
|
|
LIB_SYMBOL* FindLibSymbol( const LIB_ID& aLibId, const wxString& aLibraryName = wxEmptyString );
|
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
|
|
|
|
|
|
|
/**
|
2021-06-10 18:51:46 +00:00
|
|
|
* Search all libraries in the list for a #LIB_SYMBOL using a case insensitive comparison.
|
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
|
|
|
*
|
2014-09-17 16:04:04 +00:00
|
|
|
* Helper function used in dialog to find all candidates.
|
|
|
|
* During a long time, eeschema was using a case insensitive search.
|
2021-06-14 18:00:08 +00:00
|
|
|
* Therefore, for old schematics (<= 2013), or libs, for some symbols,
|
2014-09-17 16:04:04 +00:00
|
|
|
* the chip name (name of alias in lib) can be broken.
|
2021-06-14 18:00:08 +00:00
|
|
|
* This function can be used to display a list of candidates, in symbol properties dialog.
|
2014-09-14 15:43:18 +00:00
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* @param aEntryName is the name of entries to search for (case insensitive).
|
|
|
|
* @param aLibraryName is the name of the library to search.
|
|
|
|
* @param aCandidates is a std::vector to store candidates.
|
2014-09-14 15:43:18 +00:00
|
|
|
*/
|
2021-06-10 18:51:46 +00:00
|
|
|
void FindLibraryNearEntries( std::vector<LIB_SYMBOL*>& aCandidates, const wxString& aEntryName,
|
2016-10-24 23:18:50 +00:00
|
|
|
const wxString& aLibraryName = wxEmptyString );
|
2014-09-14 15:43:18 +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
|
|
|
int GetLibraryCount() { return size(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2017-12-07 23:01:03 +00:00
|
|
|
* Object used to load, save, search, and otherwise manipulate symbol library files.
|
2019-11-06 19:15:42 +00:00
|
|
|
*
|
|
|
|
* @warning This code is obsolete with the exception of the cache library. All other
|
|
|
|
* symbol library I/O is managed by the #SCH_IO_MGR object.
|
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
|
|
|
*/
|
2021-06-15 12:31:28 +00:00
|
|
|
class SYMBOL_LIB
|
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:
|
2021-06-15 12:31:28 +00:00
|
|
|
SYMBOL_LIB( SCH_LIB_TYPE aType, const wxString& aFileName,
|
2022-01-29 19:07:07 +00:00
|
|
|
SCH_IO_MGR::SCH_FILE_T aPluginType = SCH_IO_MGR::SCH_LEGACY );
|
2021-06-15 12:31:28 +00:00
|
|
|
~SYMBOL_LIB();
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2017-07-09 18:17:18 +00:00
|
|
|
/**
|
|
|
|
* @return a magic number that changes if the library has changed
|
|
|
|
*/
|
2017-01-27 15:56:36 +00:00
|
|
|
int GetModHash() const { return m_mod_hash; }
|
2009-09-25 18:49:04 +00:00
|
|
|
|
2017-01-27 15:56:36 +00:00
|
|
|
SCH_IO_MGR::SCH_FILE_T GetPluginType() const { return m_pluginType; }
|
2008-09-18 17:10:54 +00:00
|
|
|
|
2017-01-27 15:56:36 +00:00
|
|
|
void SetPluginType( SCH_IO_MGR::SCH_FILE_T aPluginType );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2017-01-27 15:56:36 +00:00
|
|
|
void Create( const wxString& aFileName = wxEmptyString );
|
2009-09-02 18:12:45 +00:00
|
|
|
|
2017-01-27 15:56:36 +00:00
|
|
|
void SetFileName( const wxString& aFileName ) { fileName = aFileName; }
|
2009-09-02 18:12:45 +00:00
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
bool IsModified() const
|
2009-09-02 18:12:45 +00:00
|
|
|
{
|
2009-12-15 21:11:05 +00:00
|
|
|
return isModified;
|
2009-08-27 11:41:56 +00:00
|
|
|
}
|
|
|
|
|
2017-02-28 09:17:11 +00:00
|
|
|
bool IsCache() const;
|
2009-09-18 14:56:05 +00:00
|
|
|
|
2017-02-28 09:17:11 +00:00
|
|
|
void SetCache();
|
2009-09-18 14:56:05 +00:00
|
|
|
|
2017-02-28 09:17:11 +00:00
|
|
|
bool IsBuffering() const;
|
|
|
|
|
|
|
|
void EnableBuffering( bool aEnable = true );
|
2017-01-27 15:56:36 +00:00
|
|
|
|
|
|
|
void Save( bool aSaveDocFile = true );
|
|
|
|
|
2011-08-12 17:43:16 +00:00
|
|
|
/**
|
|
|
|
* @return true if current user does not have write access to the library file.
|
|
|
|
*/
|
|
|
|
bool IsReadOnly() const { return !fileName.IsFileWritable(); }
|
|
|
|
|
|
|
|
/**
|
2009-08-27 11:41:56 +00:00
|
|
|
* Load a string array with the names of all the entries in this library.
|
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* @param aNames is the array to place entry names into.
|
2009-08-27 11:41:56 +00:00
|
|
|
*/
|
2021-06-15 12:31:28 +00:00
|
|
|
void GetSymbolNames( wxArrayString& aNames ) const;
|
2009-08-27 11:41:56 +00:00
|
|
|
|
2017-02-24 16:09:27 +00:00
|
|
|
/**
|
|
|
|
* Load a vector with all the entries in this library.
|
|
|
|
*
|
2021-06-10 18:51:46 +00:00
|
|
|
* @param aSymbols is a vector to receive the aliases.
|
2017-02-24 16:09:27 +00:00
|
|
|
*/
|
2021-06-15 12:31:28 +00:00
|
|
|
void GetSymbols( std::vector<LIB_SYMBOL*>& aSymbols ) const;
|
2017-02-24 16:09:27 +00:00
|
|
|
|
2009-08-27 11:41:56 +00:00
|
|
|
/**
|
2021-06-10 18:51:46 +00:00
|
|
|
* Find #LIB_SYMBOL by \a aName.
|
2009-09-14 13:24:17 +00:00
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* @param aName is the name of the symbol, case sensitive.
|
|
|
|
* @return LIB_SYMBOL pointer symbol if found, else NULL.
|
2009-09-14 13:24:17 +00:00
|
|
|
*/
|
2021-06-15 12:31:28 +00:00
|
|
|
LIB_SYMBOL* FindSymbol( const wxString& aName ) const;
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2021-06-15 12:31:28 +00:00
|
|
|
LIB_SYMBOL* FindSymbol( const LIB_ID& aLibId ) const;
|
2017-12-07 23:01:03 +00:00
|
|
|
|
2009-08-27 11:41:56 +00:00
|
|
|
/**
|
2021-06-10 18:51:46 +00:00
|
|
|
* Add \a aSymbol entry to library.
|
2016-10-25 22:43:54 +00:00
|
|
|
*
|
2021-06-10 18:51:46 +00:00
|
|
|
* @note A #LIB_SYMBOL can have an alias list so these alias will be added in library.
|
2016-10-25 22:43:54 +00:00
|
|
|
* and the any existing duplicate aliases will be removed from the library.
|
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
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* @param aSymbol is the symbol to add, caller retains ownership, a clone is added.
|
2009-08-27 11:41:56 +00:00
|
|
|
*/
|
2021-06-15 12:31:28 +00:00
|
|
|
void AddSymbol( LIB_SYMBOL* aSymbol );
|
2009-08-27 11:41:56 +00:00
|
|
|
|
|
|
|
/**
|
2010-10-04 18:54:14 +00:00
|
|
|
* Safely remove \a aEntry from the library and return the next entry.
|
2009-08-27 11:41:56 +00:00
|
|
|
*
|
2010-10-04 18:54:14 +00:00
|
|
|
* The next entry returned depends on the entry being removed. If the entry being
|
2021-06-15 12:31:28 +00:00
|
|
|
* remove also removes the symbol, then the next entry from the list is returned.
|
|
|
|
* If the entry being used only removes an alias from a symbol, then the next alias
|
|
|
|
* of the symbol is returned.
|
2009-08-27 11:41:56 +00:00
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* @param aEntry is the entry to remove from library.
|
2010-10-04 18:54:14 +00:00
|
|
|
* @return The next entry in the library or NULL if the library is empty.
|
2009-08-27 11:41:56 +00:00
|
|
|
*/
|
2021-06-15 12:31:28 +00:00
|
|
|
LIB_SYMBOL* RemoveSymbol( LIB_SYMBOL* aEntry );
|
2009-08-27 11:41:56 +00:00
|
|
|
|
2009-09-14 13:24:17 +00:00
|
|
|
/**
|
2021-06-15 12:31:28 +00:00
|
|
|
* Replace an existing symbol entry in the library.
|
2019-11-06 19:15:42 +00:00
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* @note A symbol can have an alias list so these aliases will be added in library and
|
|
|
|
* previously existing alias removed.
|
|
|
|
*
|
|
|
|
* @param aOldSymbol is the symbol to replace.
|
|
|
|
* @param aNewSymbol is the new symbol.
|
2009-09-14 13:24:17 +00:00
|
|
|
*/
|
2021-06-15 12:31:28 +00:00
|
|
|
LIB_SYMBOL* ReplaceSymbol( LIB_SYMBOL* aOldSymbol, LIB_SYMBOL* aNewSymbol );
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
/**
|
|
|
|
* Return the file name without path or extension.
|
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* @return the name of library file.
|
2009-09-18 14:56:05 +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
|
|
|
const wxString GetName() const { return fileName.GetName(); }
|
2009-09-18 14:56:05 +00:00
|
|
|
|
|
|
|
/**
|
2017-12-07 23:01:03 +00:00
|
|
|
* Return the full file library name with path and extension.
|
2009-09-18 14:56:05 +00:00
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* @return the full library file name with path and extension.
|
2009-09-18 14:56:05 +00:00
|
|
|
*/
|
2017-10-28 10:07:40 +00:00
|
|
|
wxString GetFullFileName() const { return fileName.GetFullPath(); }
|
2009-09-18 14:56:05 +00:00
|
|
|
|
|
|
|
/**
|
2017-12-07 23:01:03 +00:00
|
|
|
* Return the logical name of the library.
|
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* @return The logical name of this library.
|
2010-07-31 23:57:36 +00:00
|
|
|
*/
|
2017-10-28 10:07:40 +00:00
|
|
|
const wxString GetLogicalName() const
|
2010-08-04 19:14:51 +00:00
|
|
|
{
|
|
|
|
/* for now is the filename without path or extension.
|
|
|
|
|
|
|
|
Technically the library should not know its logical name!
|
|
|
|
This will eventually come out of a pair of lookup tables using a
|
|
|
|
reverse lookup using the full name or library pointer as a key.
|
|
|
|
Search will be by project lookup table and then user lookup table if
|
|
|
|
not found.
|
|
|
|
*/
|
|
|
|
return fileName.GetName();
|
|
|
|
}
|
2010-07-31 23:57:36 +00:00
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
/**
|
2017-12-07 23:01:03 +00:00
|
|
|
* Allocate and load a symbol library file.
|
2009-09-18 14:56:05 +00:00
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* @param aFileName is the file name of the symbol library to load.
|
|
|
|
* @return SYMBOL_LIB* is the allocated and loaded SYMBOL_LIB, which is owned by the caller.
|
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
|
|
|
* @throw IO_ERROR if there's any problem loading the library.
|
2009-09-18 14:56:05 +00:00
|
|
|
*/
|
2022-12-09 08:36:58 +00:00
|
|
|
static SYMBOL_LIB* LoadSymbolLibrary( const wxString& aFileName );
|
2021-03-25 14:07:16 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
SCH_LIB_TYPE type; ///< Library type indicator.
|
|
|
|
wxFileName fileName; ///< Library file name.
|
|
|
|
wxDateTime timeStamp; ///< Library save time and date.
|
|
|
|
int versionMajor; ///< Library major version number.
|
|
|
|
int versionMinor; ///< Library minor version number.
|
|
|
|
wxString header; ///< first line of loaded library.
|
|
|
|
bool isModified; ///< Library modification status.
|
|
|
|
int m_mod_hash; ///< incremented each time library is changed.
|
|
|
|
|
|
|
|
SCH_IO_MGR::SCH_FILE_T m_pluginType;
|
|
|
|
std::unique_ptr< SCH_PLUGIN > m_plugin;
|
2022-11-06 16:51:52 +00:00
|
|
|
std::unique_ptr<STRING_UTF8_MAP> m_properties; ///< Library properties
|
2008-09-13 18:59:57 +00:00
|
|
|
};
|
|
|
|
|
2009-08-27 11:41:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Case insensitive library name comparison.
|
|
|
|
*/
|
2021-06-15 12:31:28 +00:00
|
|
|
bool operator==( const SYMBOL_LIB& aLibrary, const wxString& aName );
|
|
|
|
bool operator!=( const SYMBOL_LIB& aLibrary, const wxString& aName );
|
2009-08-27 11:41:56 +00:00
|
|
|
|
2021-06-15 13:24:55 +00:00
|
|
|
#endif // SYMBOL_LIBRARY_H
|