2011-10-28 13:43:37 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2014-09-29 10:51:04 +00:00
|
|
|
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2017-10-06 18:07:43 +00:00
|
|
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
2023-01-19 14:40:35 +00:00
|
|
|
* Copyright (C) 2004-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2017-11-12 17:55:20 +00:00
|
|
|
* Copyright (C) 2017 CERN
|
|
|
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
2011-10-28 13:43:37 +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
|
|
|
|
*/
|
|
|
|
|
2020-10-31 01:27:16 +00:00
|
|
|
#ifndef SYMBOL_EDIT_FRAME_H
|
|
|
|
#define SYMBOL_EDIT_FRAME_H
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2012-01-09 17:24:01 +00:00
|
|
|
#include <sch_base_frame.h>
|
2018-01-30 08:56:43 +00:00
|
|
|
#include <sch_screen.h>
|
2019-08-15 07:09:52 +00:00
|
|
|
#include <lib_item.h>
|
2019-05-10 19:22:26 +00:00
|
|
|
#include <ee_collectors.h>
|
2022-08-25 22:50:47 +00:00
|
|
|
#include <optional>
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
class SCH_EDIT_FRAME;
|
2017-11-12 17:55:20 +00:00
|
|
|
class SYMBOL_LIB_TABLE;
|
2021-06-10 18:51:46 +00:00
|
|
|
class LIB_SYMBOL;
|
2010-11-10 15:30:12 +00:00
|
|
|
class LIB_FIELD;
|
2021-08-06 19:54:26 +00:00
|
|
|
class DIALOG_LIB_TEXT_PROPERTIES;
|
2018-07-27 20:47:51 +00:00
|
|
|
class SYMBOL_TREE_PANE;
|
2020-02-07 17:06:24 +00:00
|
|
|
class LIB_TREE_NODE;
|
2017-10-06 18:07:43 +00:00
|
|
|
class LIB_ID;
|
2022-09-16 03:06:23 +00:00
|
|
|
class LIB_SYMBOL_LIBRARY_MANAGER;
|
2020-10-31 01:27:16 +00:00
|
|
|
class SYMBOL_EDITOR_SETTINGS;
|
2022-04-19 18:09:19 +00:00
|
|
|
class EDA_LIST_DIALOG;
|
2017-10-06 18:07:43 +00:00
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
|
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* The symbol library editor main window.
|
2010-02-04 17:46:12 +00:00
|
|
|
*/
|
2020-10-31 01:27:16 +00:00
|
|
|
class SYMBOL_EDIT_FRAME : public SCH_BASE_FRAME
|
2010-02-04 17:46:12 +00:00
|
|
|
{
|
2019-05-07 18:49:53 +00:00
|
|
|
public:
|
2020-10-31 01:27:16 +00:00
|
|
|
SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2020-10-31 01:27:16 +00:00
|
|
|
~SYMBOL_EDIT_FRAME() override;
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2019-02-24 11:56:17 +00:00
|
|
|
/**
|
2020-12-27 16:46:12 +00:00
|
|
|
* Switch currently used canvas ( Cairo / OpenGL).
|
2019-02-24 11:56:17 +00:00
|
|
|
*/
|
2019-05-28 13:51:47 +00:00
|
|
|
void SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ) override;
|
2019-02-24 11:56:17 +00:00
|
|
|
|
2019-12-19 15:34:01 +00:00
|
|
|
/**
|
2021-06-15 12:31:28 +00:00
|
|
|
* Get if any symbols or libraries have been modified but not saved.
|
2019-12-19 15:34:01 +00:00
|
|
|
*
|
|
|
|
* @return true if the any changes have not been saved
|
|
|
|
*/
|
2021-05-27 23:07:48 +00:00
|
|
|
bool IsContentModified() const override;
|
2019-12-19 15:34:01 +00:00
|
|
|
|
2019-06-13 11:44:12 +00:00
|
|
|
/**
|
|
|
|
* Check if any pending libraries have been modified.
|
|
|
|
*
|
2019-06-16 18:51:47 +00:00
|
|
|
* This only checks for modified libraries. If a new symbol was created and modified
|
|
|
|
* and no libraries have been modified, the return value will be false.
|
2019-06-13 11:44:12 +00:00
|
|
|
*
|
|
|
|
* @return True if there are any pending library modifications.
|
|
|
|
*/
|
|
|
|
bool HasLibModifications() const;
|
|
|
|
|
2021-12-22 14:27:38 +00:00
|
|
|
bool CanCloseSymbolFromSchematic( bool doClose );
|
|
|
|
|
2020-12-27 16:46:12 +00:00
|
|
|
/**
|
|
|
|
* The nickname of the current library being edited and empty string if none.
|
|
|
|
*/
|
2017-11-12 17:55:20 +00:00
|
|
|
wxString GetCurLib() const;
|
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
|
|
|
|
2020-12-27 16:46:12 +00:00
|
|
|
/**
|
|
|
|
* Set the current library nickname and returns the old library nickname.
|
|
|
|
*/
|
2017-10-06 18:07:43 +00:00
|
|
|
wxString SetCurLib( const wxString& aLibNickname );
|
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
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
LIB_TREE_NODE* GetCurrentTreeNode() const;
|
|
|
|
|
2019-06-05 19:15:57 +00:00
|
|
|
/**
|
|
|
|
* Return the LIB_ID of the library or symbol selected in the symbol tree.
|
|
|
|
*/
|
2019-06-05 22:29:59 +00:00
|
|
|
LIB_ID GetTreeLIBID( int* aUnit = nullptr ) const;
|
2019-06-05 19:15:57 +00:00
|
|
|
|
2022-09-09 02:15:44 +00:00
|
|
|
int GetTreeSelectionCount() const;
|
|
|
|
|
|
|
|
int GetTreeLIBIDs( std::vector<LIB_ID>& aSelection ) const;
|
|
|
|
|
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 current symbol being edited or NULL if none selected.
|
2017-10-06 18:07:43 +00:00
|
|
|
*
|
2021-06-10 18:51:46 +00:00
|
|
|
* This is a LIB_SYMBOL that I own, it is at best a copy of one in a 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
|
|
|
LIB_SYMBOL* GetCurSymbol() const { return m_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-10 18:51:46 +00:00
|
|
|
* Take ownership of aSymbol and notes that it is the one currently being edited.
|
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
|
|
|
void SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom );
|
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-09-16 03:06:23 +00:00
|
|
|
LIB_SYMBOL_LIBRARY_MANAGER& GetLibManager();
|
2019-11-06 19:15:42 +00:00
|
|
|
|
2020-08-06 23:03:58 +00:00
|
|
|
SELECTION& GetCurrentSelection() override;
|
|
|
|
|
2019-06-16 18:51:47 +00:00
|
|
|
// See comments for m_SyncPinEdit.
|
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
|
|
|
bool SynchronizePins();
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2017-11-12 17:55:20 +00:00
|
|
|
/**
|
2020-12-27 16:46:12 +00:00
|
|
|
* Create or add an existing library to the symbol library table.
|
2017-11-12 17:55:20 +00:00
|
|
|
*/
|
2022-04-19 18:09:19 +00:00
|
|
|
wxString AddLibraryFile( bool aCreateNew );
|
2017-11-12 17:55:20 +00:00
|
|
|
|
2022-09-14 22:28:09 +00:00
|
|
|
/**
|
|
|
|
* Add a library dropped file to the symbol library table.
|
|
|
|
*/
|
|
|
|
void DdAddLibrary( wxString aLibFile );
|
|
|
|
|
2017-11-12 17:55:20 +00:00
|
|
|
/**
|
2021-06-15 12:31:28 +00:00
|
|
|
* Create a new symbol in the selected library.
|
2023-08-20 16:05:31 +00:00
|
|
|
*
|
2023-09-05 21:07:51 +00:00
|
|
|
* @param newName is the name of the symbol to derive the new symbol from or empty
|
2023-08-20 16:05:31 +00:00
|
|
|
* to create a new root symbol.
|
2017-11-12 17:55:20 +00:00
|
|
|
*/
|
2023-09-05 21:07:51 +00:00
|
|
|
void CreateNewSymbol( const wxString& newName = wxEmptyString );
|
2017-11-12 17:55:20 +00:00
|
|
|
|
2021-06-15 12:31:28 +00:00
|
|
|
void ImportSymbol();
|
|
|
|
void ExportSymbol();
|
2017-10-31 11:13:20 +00:00
|
|
|
|
2017-11-12 17:55:20 +00:00
|
|
|
/**
|
2021-06-15 12:31:28 +00:00
|
|
|
* Save the selected symbol or library.
|
2018-07-27 10:46:09 +00:00
|
|
|
*/
|
2019-06-05 22:29:59 +00:00
|
|
|
void Save();
|
2018-07-27 10:46:09 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-27 16:28:52 +00:00
|
|
|
* Save the currently selected symbol to a new name and/or location.
|
2017-11-12 17:55:20 +00:00
|
|
|
*/
|
2023-10-28 21:25:33 +00:00
|
|
|
void SaveSymbolCopyAs();
|
2020-12-27 16:28:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Save the currently selected library to a new file.
|
|
|
|
*/
|
|
|
|
void SaveLibraryAs();
|
2018-07-27 10:46:09 +00:00
|
|
|
|
|
|
|
/**
|
2021-06-15 12:31:28 +00:00
|
|
|
* Save all modified symbols and libraries.
|
2018-07-27 10:46:09 +00:00
|
|
|
*/
|
2019-06-05 22:29:59 +00:00
|
|
|
void SaveAll();
|
2017-11-12 17:55:20 +00:00
|
|
|
|
|
|
|
/**
|
2021-06-15 12:31:28 +00:00
|
|
|
* Revert unsaved changes in a symbol, restoring to the last saved state.
|
2017-11-12 17:55:20 +00:00
|
|
|
*/
|
2019-06-13 11:44:12 +00:00
|
|
|
void Revert( bool aConfirm = true );
|
|
|
|
void RevertAll();
|
2019-06-05 22:29:59 +00:00
|
|
|
|
2021-06-15 12:31:28 +00:00
|
|
|
void DeleteSymbolFromLibrary();
|
2019-06-13 11:44:12 +00:00
|
|
|
|
2021-06-15 12:31:28 +00:00
|
|
|
void CopySymbolToClipboard();
|
2019-06-05 22:29:59 +00:00
|
|
|
|
2021-06-15 12:31:28 +00:00
|
|
|
void LoadSymbol( const wxString& aLibrary, const wxString& aSymbol, int Unit );
|
2017-11-12 17:55:20 +00:00
|
|
|
|
|
|
|
/**
|
2021-06-15 12:31:28 +00:00
|
|
|
* Insert a duplicate symbol.
|
2020-12-27 16:46:12 +00:00
|
|
|
*
|
|
|
|
* If \a aFromClipboard is true then action is a paste.
|
2017-11-12 17:55:20 +00:00
|
|
|
*/
|
2021-06-15 12:31:28 +00:00
|
|
|
void DuplicateSymbol( bool aFromClipboard );
|
2017-11-13 19:39:36 +00:00
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
void OnSelectUnit( wxCommandEvent& event );
|
2011-08-12 17:43:16 +00:00
|
|
|
|
2021-03-18 11:46:07 +00:00
|
|
|
void OnToggleSymbolTree( wxCommandEvent& event );
|
2017-10-31 11:13:20 +00:00
|
|
|
|
2023-07-26 22:32:06 +00:00
|
|
|
void ToggleProperties() override;
|
|
|
|
|
2021-12-10 00:27:03 +00:00
|
|
|
bool IsSymbolTreeShown() const;
|
2021-03-17 14:53:27 +00:00
|
|
|
void FreezeLibraryTree();
|
|
|
|
void ThawLibraryTree();
|
2011-08-12 17:43:16 +00:00
|
|
|
|
2021-06-15 12:31:28 +00:00
|
|
|
void OnUpdateUnitNumber( wxUpdateUIEvent& event );
|
2011-10-07 14:41:30 +00:00
|
|
|
|
2019-12-16 15:11:06 +00:00
|
|
|
void UpdateAfterSymbolProperties( wxString* aOldName = nullptr );
|
2019-05-06 12:32:51 +00:00
|
|
|
void RebuildSymbolUnitsList();
|
2011-08-12 17:43:16 +00:00
|
|
|
|
2020-08-24 02:01:14 +00:00
|
|
|
bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
|
|
|
|
void doCloseWindow() override;
|
2019-11-06 19:15:42 +00:00
|
|
|
void OnExitKiCad( wxCommandEvent& event );
|
2016-09-24 18:53:15 +00:00
|
|
|
void ReCreateHToolbar() override;
|
|
|
|
void ReCreateVToolbar() override;
|
2019-07-20 15:52:30 +00:00
|
|
|
void ReCreateOptToolbar() override;
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
|
|
|
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
|
|
|
|
2020-12-23 23:18:02 +00:00
|
|
|
SYMBOL_EDITOR_SETTINGS* GetSettings() const
|
2020-01-13 01:44:19 +00:00
|
|
|
{
|
|
|
|
return m_settings;
|
|
|
|
}
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2021-04-13 02:03:25 +00:00
|
|
|
APP_SETTINGS_BASE* config() const override;
|
|
|
|
|
2021-09-07 20:34:10 +00:00
|
|
|
COLOR_SETTINGS* GetColorSettings( bool aForceRefresh = false ) const override;
|
2020-03-06 03:57:50 +00:00
|
|
|
|
2010-07-23 14:12:37 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Trigger the wxCloseEvent, which is handled by the function given to EVT_CLOSE() macro:
|
2010-07-23 14:12:37 +00:00
|
|
|
* <p>
|
2020-10-31 01:27:16 +00:00
|
|
|
* EVT_CLOSE( SYMBOL_EDIT_FRAME::OnCloseWindow )
|
2017-10-06 18:07:43 +00:00
|
|
|
* </p>
|
2010-07-23 14:12:37 +00:00
|
|
|
*/
|
2010-12-14 21:39:31 +00:00
|
|
|
void CloseWindow( wxCommandEvent& event )
|
2010-07-23 14:12:37 +00:00
|
|
|
{
|
|
|
|
// Generate a wxCloseEvent
|
|
|
|
Close( false );
|
|
|
|
}
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Must be called after a schematic change in order to set the "modify" flag of the
|
2019-05-08 18:56:03 +00:00
|
|
|
* current symbol.
|
2010-02-18 20:07:29 +00:00
|
|
|
*/
|
2019-05-08 18:56:03 +00:00
|
|
|
void OnModify() override;
|
2010-02-18 20:07:29 +00:00
|
|
|
|
2019-06-01 19:48:01 +00:00
|
|
|
int GetUnit() const { return m_unit; }
|
|
|
|
void SetUnit( int aUnit ) { m_unit = aUnit; }
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2024-01-26 16:16:13 +00:00
|
|
|
int GetBodyStyle() const { return m_bodyStyle; }
|
|
|
|
void SetBodyStyle( int aBodyStyle ) { m_bodyStyle = aBodyStyle; }
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2019-06-01 19:48:01 +00:00
|
|
|
bool GetShowDeMorgan() const { return m_showDeMorgan; }
|
2011-10-07 14:41:30 +00:00
|
|
|
void SetShowDeMorgan( bool show ) { m_showDeMorgan = show; }
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2020-11-15 16:08:31 +00:00
|
|
|
void ClearMsgPanel() override
|
|
|
|
{
|
2021-08-20 19:45:57 +00:00
|
|
|
UpdateSymbolMsgPanelInfo();
|
2020-11-15 16:08:31 +00:00
|
|
|
}
|
2019-05-06 12:32:51 +00:00
|
|
|
|
2023-01-19 14:40:35 +00:00
|
|
|
void UpdateMsgPanel() override
|
|
|
|
{
|
|
|
|
UpdateSymbolMsgPanelInfo();
|
|
|
|
}
|
|
|
|
|
2023-09-12 15:17:36 +00:00
|
|
|
/**
|
|
|
|
* Update the main window title bar with the current library name and read only status
|
|
|
|
* of the library.
|
|
|
|
*/
|
|
|
|
void UpdateTitle();
|
|
|
|
|
2023-04-03 17:09:21 +00:00
|
|
|
bool IsSymbolFromSchematic() const
|
|
|
|
{
|
|
|
|
// If we've already vetted closing this window, then we have no symbol anymore
|
|
|
|
if( m_isClosing )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return m_isSymbolFromSchematic;
|
|
|
|
}
|
2020-08-31 15:06:23 +00:00
|
|
|
|
2020-12-22 00:07:01 +00:00
|
|
|
bool IsSymbolFromLegacyLibrary() const;
|
|
|
|
|
2011-08-12 17:43:16 +00:00
|
|
|
/**
|
2020-11-15 16:08:31 +00:00
|
|
|
* Display the documentation of the selected symbol.
|
2011-08-12 17:43:16 +00:00
|
|
|
*/
|
2021-08-20 19:45:57 +00:00
|
|
|
void UpdateSymbolMsgPanelInfo();
|
2010-02-04 17:46:12 +00:00
|
|
|
|
|
|
|
// General editing
|
2015-01-27 11:01:58 +00:00
|
|
|
/**
|
2020-11-15 16:08:31 +00:00
|
|
|
* Create a copy of the current symbol, and save it in the undo list.
|
2017-10-06 18:07:43 +00:00
|
|
|
*
|
2020-11-15 16:08:31 +00:00
|
|
|
* Because a symbol in library editor does not have a lot of primitives, the full data is
|
|
|
|
* duplicated. It is not worth to try to optimize this save function.
|
2015-01-27 11:01:58 +00:00
|
|
|
*/
|
2023-12-22 17:30:14 +00:00
|
|
|
void SaveCopyInUndoList( const wxString& aDescription, LIB_SYMBOL* aSymbol,
|
2023-06-09 21:41:33 +00:00
|
|
|
UNDO_REDO aUndoType = UNDO_REDO::LIBEDIT );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2023-12-22 17:30:14 +00:00
|
|
|
void PushSymbolToUndoList( const wxString& aDescription, LIB_SYMBOL* aSymbolCopy,
|
|
|
|
UNDO_REDO aUndoType = UNDO_REDO::LIBEDIT );
|
|
|
|
|
2020-11-15 16:08:31 +00:00
|
|
|
void GetSymbolFromUndoList();
|
|
|
|
void GetSymbolFromRedoList();
|
2019-05-14 19:21:10 +00:00
|
|
|
|
2020-07-13 11:21:40 +00:00
|
|
|
/**
|
|
|
|
* Free the undo or redo list from \a aList element.
|
|
|
|
*
|
|
|
|
* - Wrappers are deleted.
|
|
|
|
* - data pointed by wrappers are deleted if not in use in schematic
|
|
|
|
* i.e. when they are copy of a schematic item or they are no more in use (DELETED)
|
|
|
|
*
|
2020-07-13 13:50:35 +00:00
|
|
|
* @param whichList = the UNDO_REDO_CONTAINER to clear
|
2020-07-13 11:21:40 +00:00
|
|
|
* @param aItemCount = the count of items to remove. < 0 for all items
|
|
|
|
* items are removed from the beginning of the list.
|
|
|
|
* So this function can be called to remove old commands
|
|
|
|
*/
|
2020-07-13 13:50:35 +00:00
|
|
|
void ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCount = -1 ) override;
|
2020-07-13 11:21:40 +00:00
|
|
|
|
2011-05-28 18:51:32 +00:00
|
|
|
/**
|
2020-12-27 16:46:12 +00:00
|
|
|
* Select the currently active library and loads the symbol from \a aLibId.
|
2011-08-12 17:43:16 +00:00
|
|
|
*
|
2017-10-06 18:07:43 +00:00
|
|
|
* @param aLibId is the #LIB_ID of the symbol to select.
|
2018-11-08 21:26:01 +00:00
|
|
|
* @param aUnit the unit to show
|
2024-01-26 16:16:13 +00:00
|
|
|
* @param aBodyStyle the DeMorgan variant to show
|
2017-10-06 18:07:43 +00:00
|
|
|
* @return true if the symbol defined by \a aLibId was loaded.
|
2011-05-28 18:51:32 +00:00
|
|
|
*/
|
2024-01-26 16:16:13 +00:00
|
|
|
bool LoadSymbol( const LIB_ID& aLibId, int aUnit, int aBodyStyle );
|
2011-05-28 18:51:32 +00:00
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
/**
|
2020-12-27 16:46:12 +00:00
|
|
|
* Print a page.
|
2010-03-18 20:35:29 +00:00
|
|
|
*/
|
2020-12-20 18:18:54 +00:00
|
|
|
void PrintPage( const RENDER_SETTINGS* aSettings ) override;
|
2010-03-18 20:35:29 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2020-12-27 16:46:12 +00:00
|
|
|
* Create the SVG print file for the current edited symbol.
|
2022-12-23 15:31:35 +00:00
|
|
|
* @param aFullFileName is the full filename
|
|
|
|
* @param aOffset is a plot offset, in iu
|
2011-08-12 17:43:16 +00:00
|
|
|
*/
|
2022-12-23 15:31:35 +00:00
|
|
|
void SVGPlotSymbol( const wxString& aFullFileName, VECTOR2I aOffset );
|
2010-03-28 14:46:49 +00:00
|
|
|
|
2017-11-22 11:06:17 +00:00
|
|
|
/**
|
2018-08-25 12:21:09 +00:00
|
|
|
* Synchronize the library manager to the symbol library table, and then the symbol tree
|
|
|
|
* to the library manager. Optionally displays a progress dialog.
|
2017-11-22 11:06:17 +00:00
|
|
|
*/
|
2022-02-27 11:54:12 +00:00
|
|
|
void SyncLibraries( bool aShowProgress, bool aPreloadCancelled = false,
|
|
|
|
const wxString& aForceRefresh = wxEmptyString );
|
2017-11-22 11:06:17 +00:00
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
/**
|
2020-12-27 16:46:12 +00:00
|
|
|
* Filter, sort, and redisplay the library tree.
|
|
|
|
*
|
|
|
|
* Does NOT synchronize it with libraries in disk.
|
2020-02-07 17:06:24 +00:00
|
|
|
*/
|
|
|
|
void RegenerateLibraryTree();
|
|
|
|
|
2021-03-17 14:53:27 +00:00
|
|
|
/**
|
|
|
|
* Redisplay the library tree. Used after changing modified states, descriptions, etc.
|
|
|
|
*/
|
|
|
|
void RefreshLibraryTree();
|
|
|
|
|
2022-04-21 10:57:15 +00:00
|
|
|
/**
|
|
|
|
* Update a symbol node in the library tree.
|
|
|
|
*/
|
|
|
|
void UpdateLibraryTree( const wxDataViewItem& aTreeItem, LIB_SYMBOL* aSymbol );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return either the symbol selected in the symbol tree (if context menu is active) or the
|
|
|
|
* symbol on the editor canvas.
|
|
|
|
*/
|
|
|
|
LIB_ID GetTargetLibId() const;
|
|
|
|
|
2022-09-09 02:15:44 +00:00
|
|
|
/**
|
|
|
|
* @return a list of selected items in the symbol tree
|
|
|
|
*/
|
|
|
|
std::vector<LIB_ID> GetSelectedLibIds() const;
|
|
|
|
|
2022-04-21 10:57:15 +00:00
|
|
|
void FocusOnLibId( const LIB_ID& aLibID );
|
|
|
|
|
2018-05-14 17:34:18 +00:00
|
|
|
/**
|
|
|
|
* Called after the preferences dialog is run.
|
|
|
|
*/
|
2020-07-17 20:04:14 +00:00
|
|
|
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
|
2018-01-08 04:05:03 +00:00
|
|
|
|
2018-06-30 22:38:04 +00:00
|
|
|
void ShowChangedLanguage() override;
|
|
|
|
|
2019-06-05 19:15:57 +00:00
|
|
|
void SetScreen( BASE_SCREEN* aScreen ) override;
|
2018-08-03 12:17:19 +00:00
|
|
|
|
2020-09-25 07:31:56 +00:00
|
|
|
const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override;
|
2018-08-03 12:17:19 +00:00
|
|
|
|
|
|
|
void RebuildView();
|
|
|
|
|
2022-01-07 17:42:43 +00:00
|
|
|
void UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete = false,
|
|
|
|
bool aUpdateRtree = false ) override;
|
|
|
|
|
2018-10-17 11:14:09 +00:00
|
|
|
/**
|
|
|
|
* Rebuild the GAL and redraw the screen. Call when something went wrong.
|
|
|
|
*/
|
|
|
|
void HardRedraw() override;
|
|
|
|
|
2018-08-19 16:53:01 +00:00
|
|
|
void KiwayMailIn( KIWAY_EXPRESS& mail ) override;
|
|
|
|
|
2023-06-07 11:46:10 +00:00
|
|
|
void FocusOnItem( LIB_ITEM* aItem );
|
|
|
|
|
2020-08-31 15:06:23 +00:00
|
|
|
/**
|
|
|
|
* Load a symbol from the schematic to edit in place.
|
|
|
|
*
|
|
|
|
* @param aSymbol the symbol to edit.
|
|
|
|
*/
|
2021-06-10 14:10:55 +00:00
|
|
|
void LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol );
|
2020-08-31 15:06:23 +00:00
|
|
|
|
2021-01-08 23:24:12 +00:00
|
|
|
/**
|
|
|
|
* Test if a symbol is loaded and can be edited.
|
|
|
|
*
|
|
|
|
* The following conditions are required for a symbol to be editable:
|
|
|
|
* - The symbol must selected from either a library or the schematic.
|
|
|
|
* - The symbol must not be from a legacy library.
|
2021-02-10 22:56:26 +00:00
|
|
|
*
|
|
|
|
* Note that many things are not editable in a non-root symbol (ie: an alias), but others
|
|
|
|
* are so this routine no longer returns false for an alias.
|
2021-01-08 23:24:12 +00:00
|
|
|
*/
|
|
|
|
bool IsSymbolEditable() const;
|
|
|
|
|
2021-02-10 22:56:26 +00:00
|
|
|
bool IsSymbolAlias() const;
|
|
|
|
|
2022-04-21 10:57:15 +00:00
|
|
|
///< Return true if \a aLibId is an alias for the editor screen symbol.
|
|
|
|
bool IsCurrentSymbol( const LIB_ID& aLibId ) const;
|
|
|
|
|
2021-06-15 12:31:28 +00:00
|
|
|
///< Restore the empty editor screen, without any symbol or library selected.
|
2019-06-13 11:44:12 +00:00
|
|
|
void emptyScreen();
|
|
|
|
|
2020-12-27 16:46:12 +00:00
|
|
|
protected:
|
|
|
|
void setupUIConditions() override;
|
|
|
|
|
2022-12-16 21:37:32 +00:00
|
|
|
void doReCreateMenuBar() override;
|
|
|
|
|
2017-11-13 21:12:49 +00:00
|
|
|
private:
|
2020-12-27 16:46:12 +00:00
|
|
|
// Set up the tool framework
|
|
|
|
void setupTools();
|
|
|
|
|
2023-10-28 21:25:33 +00:00
|
|
|
void saveSymbolCopyAs();
|
2020-12-27 16:46:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Save the changes to the current library.
|
|
|
|
*
|
|
|
|
* A backup file of the current library is saved with the .bak extension before the
|
|
|
|
* changes made to the library are saved.
|
|
|
|
*
|
|
|
|
* @param aLibrary is the library name.
|
|
|
|
* @param aNewFile Ask for a new file name to save the library.
|
|
|
|
* @return True if the library was successfully saved.
|
|
|
|
*/
|
|
|
|
bool saveLibrary( const wxString& aLibrary, bool aNewFile );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the current active library to \a aLibrary.
|
|
|
|
*
|
|
|
|
* @param aLibrary the nickname of the library in the symbol library table. If empty,
|
|
|
|
* display list of available libraries to select from.
|
|
|
|
*/
|
|
|
|
void SelectActiveLibrary( const wxString& aLibrary = wxEmptyString );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load a symbol from the current active library, optionally setting the selected unit
|
|
|
|
* and convert.
|
|
|
|
*
|
|
|
|
* @param aAliasName The symbol alias name to load from the current library.
|
|
|
|
* @param aUnit Unit to be selected
|
2024-01-26 16:16:13 +00:00
|
|
|
* @param aBodyStyle Convert to be selected
|
2020-12-27 16:46:12 +00:00
|
|
|
* @return true if the symbol loaded correctly.
|
|
|
|
*/
|
2024-01-26 16:16:13 +00:00
|
|
|
bool LoadSymbolFromCurrentLib( const wxString& aAliasName, int aUnit = 0, int aBodyStyle = 0 );
|
2020-12-27 16:46:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a copy of \a aLibEntry into memory.
|
|
|
|
*
|
2021-06-10 18:51:46 +00:00
|
|
|
* @param aLibEntry A pointer to the LIB_SYMBOL object to an already loaded symbol.
|
2020-12-27 16:46:12 +00:00
|
|
|
* @param aLibrary the path to the library file that \a aLibEntry was loaded from. This is
|
|
|
|
* for error messaging purposes only.
|
|
|
|
* @param aUnit the initial unit to show.
|
2024-01-26 16:16:13 +00:00
|
|
|
* @param aBodyStyle the initial DeMorgan variant to show.
|
2020-12-27 16:46:12 +00:00
|
|
|
* @return True if a copy of \a aLibEntry was successfully copied.
|
|
|
|
*/
|
2021-06-15 12:31:28 +00:00
|
|
|
bool LoadOneLibrarySymbolAux( LIB_SYMBOL* aLibEntry, const wxString& aLibrary, int aUnit,
|
2024-01-26 16:16:13 +00:00
|
|
|
int aBodyStyle );
|
2020-12-27 16:46:12 +00:00
|
|
|
|
|
|
|
///< Create a backup copy of a file with requested extension.
|
2017-11-13 14:15:10 +00:00
|
|
|
bool backupFile( const wxFileName& aOriginalFile, const wxString& aBackupExt );
|
|
|
|
|
2021-06-15 12:31:28 +00:00
|
|
|
///< Return currently edited symbol.
|
|
|
|
LIB_SYMBOL* getTargetSymbol() const;
|
2017-11-12 17:55:20 +00:00
|
|
|
|
2020-12-27 16:46:12 +00:00
|
|
|
///< Return either the library selected in the symbol tree, if context menu is active or
|
|
|
|
///< the library that is currently modified.
|
2017-11-13 21:12:49 +00:00
|
|
|
wxString getTargetLib() const;
|
|
|
|
|
2021-10-01 21:45:49 +00:00
|
|
|
void centerItemIdleHandler( wxIdleEvent& aEvent );
|
|
|
|
|
2020-11-15 16:08:31 +00:00
|
|
|
/*
|
2020-12-27 16:46:12 +00:00
|
|
|
* Return true when the operation has succeeded (all requested libraries have been saved
|
2020-11-15 16:08:31 +00:00
|
|
|
* or none was selected and confirmed by OK).
|
2020-12-27 16:46:12 +00:00
|
|
|
*
|
2018-08-01 13:36:42 +00:00
|
|
|
* @param aRequireConfirmation when true, the user must be asked to confirm.
|
2018-02-16 10:27:43 +00:00
|
|
|
*/
|
2018-08-01 13:36:42 +00:00
|
|
|
bool saveAllLibraries( bool aRequireConfirmation );
|
2017-11-13 09:55:05 +00:00
|
|
|
|
2021-06-15 12:31:28 +00:00
|
|
|
///< Save the current symbol.
|
|
|
|
bool saveCurrentSymbol();
|
2018-08-11 20:46:03 +00:00
|
|
|
|
2021-06-15 12:31:28 +00:00
|
|
|
///< Store the currently modified symbol in the library manager buffer.
|
|
|
|
void storeCurrentSymbol();
|
2017-11-12 17:55:20 +00:00
|
|
|
|
2021-06-10 18:51:46 +00:00
|
|
|
///< Rename LIB_SYMBOL aliases to avoid conflicts before adding a symbol to a library.
|
|
|
|
void ensureUniqueName( LIB_SYMBOL* aSymbol, const wxString& aLibrary );
|
2017-11-13 19:39:36 +00:00
|
|
|
|
2020-12-29 18:59:48 +00:00
|
|
|
enum TABLE_SCOPE
|
|
|
|
{
|
|
|
|
GLOBAL_LIB_TABLE,
|
|
|
|
PROJECT_LIB_TABLE
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add \a aLibFile to the symbol library table defined by \a aScope.
|
|
|
|
*
|
|
|
|
* @note The library defined by \a aLibFile must be a KiCad (s-expression) library.
|
|
|
|
*
|
|
|
|
* @param aLibFile is the full path and file name of the symbol library to add to the table.
|
|
|
|
* @param aScope defines if \a aLibFile is added to the global or project library table.
|
|
|
|
* @return true if successful or false if a failure occurs.
|
|
|
|
*/
|
|
|
|
bool addLibTableEntry( const wxString& aLibFile, TABLE_SCOPE aScope = GLOBAL_LIB_TABLE );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Replace the file path of the symbol library table entry \a aLibNickname with \a aLibFile.
|
|
|
|
*
|
|
|
|
* @note The library defined by \a aLibFile must be a KiCad (s-expression) library.
|
|
|
|
*
|
|
|
|
* @param aLibNickmane is the nickname of an existing library table entry.
|
|
|
|
* @param aLibFile is the full path and file name of the symbol library to replace in the
|
|
|
|
* table.
|
|
|
|
* @return true if successful or false if a failure occurs.
|
|
|
|
*/
|
|
|
|
bool replaceLibTableEntry( const wxString& aLibNickname, const wxString& aLibFile );
|
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2020-12-27 16:46:12 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Set to true to synchronize pins at the same position when editing symbols with multiple
|
|
|
|
* units or multiple body styles. Deleting or moving pins will affect all pins at the same
|
|
|
|
* location.
|
|
|
|
* When units are interchangeable, synchronizing editing of pins is usually the best way,
|
|
|
|
* because if units are interchangeable, it implies that all similar pins are at the same
|
|
|
|
* location.
|
2021-06-15 12:31:28 +00:00
|
|
|
* When units are not interchangeable, do not synchronize editing of pins, because each symbol
|
2020-12-27 16:46:12 +00:00
|
|
|
* is specific, and there are no (or few) similar pins between units.
|
|
|
|
*
|
2021-06-15 12:31:28 +00:00
|
|
|
* Setting this to false allows editing each pin per symbol or body style regardless other
|
|
|
|
* pins at the same location. This requires the user to open each symbol or body style to make
|
2020-12-27 16:46:12 +00:00
|
|
|
* changes to the other pins at the same location.
|
|
|
|
*
|
|
|
|
* To know if others pins must be coupled when editing a pin, use SynchronizePins() instead
|
|
|
|
* of m_syncPinEdit, because SynchronizePins() is more reliable (takes in account the fact
|
|
|
|
* units are interchangeable, there are more than one unit).
|
|
|
|
*
|
|
|
|
* @todo Determine why this member variable is public when all the rest are private and
|
|
|
|
* either make it private or document why it needs to be public.
|
|
|
|
*/
|
|
|
|
bool m_SyncPinEdit;
|
|
|
|
|
|
|
|
private:
|
2021-06-15 12:31:28 +00:00
|
|
|
///< Helper screen used when no symbol is loaded
|
2021-10-01 20:49:14 +00:00
|
|
|
SCH_SCREEN* m_dummyScreen;
|
2020-12-27 16:46:12 +00:00
|
|
|
|
2021-06-15 12:31:28 +00:00
|
|
|
LIB_SYMBOL* m_symbol; // a symbol I own, it is not in any library, but a
|
2020-12-27 16:46:12 +00:00
|
|
|
// copy could be.
|
|
|
|
wxComboBox* m_unitSelectBox; // a ComboBox to select a unit to edit (if the
|
2021-06-15 12:31:28 +00:00
|
|
|
// symbol has multiple units)
|
2021-06-10 14:10:55 +00:00
|
|
|
SYMBOL_TREE_PANE* m_treePane; // symbol search tree widget
|
2022-09-16 03:06:23 +00:00
|
|
|
LIB_SYMBOL_LIBRARY_MANAGER* m_libMgr; // manager taking care of temporary modifications
|
2020-12-27 16:46:12 +00:00
|
|
|
SYMBOL_EDITOR_SETTINGS* m_settings; // Handle to the settings
|
|
|
|
|
2021-10-01 21:45:49 +00:00
|
|
|
LIB_ID m_centerItemOnIdle;
|
|
|
|
|
2020-12-27 16:46:12 +00:00
|
|
|
// The unit number to edit and show
|
2021-10-01 20:49:14 +00:00
|
|
|
int m_unit;
|
2020-12-27 16:46:12 +00:00
|
|
|
|
2024-01-26 16:16:13 +00:00
|
|
|
// Show the normal shape (m_bodyStyle <= 1) or the DeMorgan converted shape (m_bodyStyle > 1)
|
|
|
|
int m_bodyStyle;
|
2020-12-27 16:46:12 +00:00
|
|
|
|
|
|
|
///< Flag if the symbol being edited was loaded directly from a schematic.
|
2021-10-01 20:49:14 +00:00
|
|
|
bool m_isSymbolFromSchematic;
|
2021-11-11 16:42:25 +00:00
|
|
|
KIID m_schematicSymbolUUID;
|
2020-12-27 16:46:12 +00:00
|
|
|
|
2021-10-01 20:49:14 +00:00
|
|
|
///< RefDes of the symbol (only valid if symbol was loaded from schematic)
|
|
|
|
wxString m_reference;
|
2020-12-27 16:46:12 +00:00
|
|
|
|
|
|
|
// True to force DeMorgan/normal tools selection enabled.
|
|
|
|
// They are enabled when the loaded symbol has graphic items for converted shape
|
|
|
|
// But under some circumstances (New symbol created) these tools must left enabled
|
|
|
|
static bool m_showDeMorgan;
|
2010-02-04 17:46:12 +00:00
|
|
|
};
|
|
|
|
|
2020-10-31 01:27:16 +00:00
|
|
|
#endif // SYMBOL_EDIT_FRAME_H
|