|
KiCad PCB EDA Suite
|
One open footprint tab owning its fp-holder board, lent to the frame by raw pointer while active. More...
#include <footprint_editor_tab_context.h>
Public Types | |
| enum class | KIND { LIBRARY , BOARD_INSTANCE , UNSAVED } |
| What the tab edits, which decides its key, its label and whether it is persisted. More... | |
Public Member Functions | |
| FOOTPRINT_EDITOR_TAB_CONTEXT (const wxString &aLib, const wxString &aName, std::unique_ptr< BOARD > aBoard) | |
| FOOTPRINT_EDITOR_TAB_CONTEXT (const KIID &aSourceUuid, const wxString &aReference, std::unique_ptr< BOARD > aBoard) | |
| Construct an instance (board) tab over an fp-holder board carrying a clone of a placed footprint. | |
| ~FOOTPRINT_EDITOR_TAB_CONTEXT () override | |
| wxString | GetTabKey () const override |
| Stable identity for persistence and de-duplication. | |
| wxString | GetDisplayName () const override |
| Short label shown on the tab. | |
| void | PromoteToLibrary (const wxString &aLib, const wxString &aName) |
| Give an imported footprint the library identity a save-as just assigned it. | |
| bool | IsTransient () const |
| True for a tab that is session-only and never persisted. | |
| bool | IsFromBoard () const |
| bool | IsUnsaved () const |
| const KIID & | GetSourceUuid () const |
| const wxString & | GetReference () const |
| std::map< KIID, KIID > & | BoardFootprintUuids () |
| Editor-to-board UUID remap captured at load, used by SaveFootprintToBoard to restore the original board item identities. | |
| bool | IsModified () const override |
| True only when dirty and the board actually holds a footprint to edit. | |
| void | SetModified (bool aModified) |
| BOARD * | GetBoard () const |
| The fp-holder board owned by this context. | |
| const wxString & | GetLib () const |
| const wxString & | GetName () const |
| void | SetName (const wxString &aName) |
| FOOTPRINT * | GetOriginalFootprintCopy () const |
| Baseline clone captured at load, used to detect edits and to revert. | |
| void | SetOriginalFootprintCopy (std::unique_ptr< FOOTPRINT > aCopy) |
| const wxString & | GetFootprintNameWhenLoaded () const |
| void | SetFootprintNameWhenLoaded (const wxString &aName) |
| bool | IsPreview () const |
| void | SetPreview (bool aPreview) |
| UNDO_REDO_CONTAINER & | UndoList () |
| UNDO_REDO_CONTAINER & | RedoList () |
| VIEW_SNAPSHOT & | ViewSnapshot () |
| std::vector< KIID > & | SavedSelection () |
| Selection saved as resolved KIIDs, restored after the view is rebuilt. | |
Static Public Member Functions | |
| static std::unique_ptr< FOOTPRINT_EDITOR_TAB_CONTEXT > | MakeUnsaved (std::unique_ptr< BOARD > aBoard) |
| Construct a tab for an imported footprint that has no library identity yet. | |
| static wxString | MakeInstanceTabKey (const KIID &aSourceUuid) |
| De-duplication key for a placed board footprint, in a namespace disjoint from library keys. | |
| static wxString | MakeUnsavedTabKey (const KIID &aSessionId) |
| De-duplication key for an imported footprint, in a namespace disjoint from the library and instance keys. | |
Protected Attributes | |
| bool | m_preview = false |
| std::unique_ptr< UNDO_REDO_CONTAINER > | m_undo |
| std::unique_ptr< UNDO_REDO_CONTAINER > | m_redo |
| VIEW_SNAPSHOT | m_viewSnapshot |
| std::vector< KIID > | m_savedSelection |
Private Member Functions | |
| FOOTPRINT_EDITOR_TAB_CONTEXT (KIND aKind, std::unique_ptr< BOARD > aBoard) | |
Private Attributes | |
| wxString | m_lib |
| wxString | m_name |
| std::unique_ptr< BOARD > | m_board |
| std::unique_ptr< FOOTPRINT > | m_originalFootprintCopy |
| wxString | m_footprintNameWhenLoaded |
| bool | m_modified = false |
| KIND | m_kind = KIND::LIBRARY |
| Source board footprint UUID, used as the de-dup key and save-back target. | |
| KIID | m_sourceUuid |
| Identity of an unsaved import, which has no library:name pair to key on. | |
| KIID | m_sessionId |
| Reference designator of the source footprint, shown as the tab label. | |
| wxString | m_reference |
| Editor-to-board UUID remap used to save instance edits back to the original board items. | |
| std::map< KIID, KIID > | m_boardFootprintUuids |
One open footprint tab owning its fp-holder board, lent to the frame by raw pointer while active.
A tab is one of three kinds. A library tab edits a library footprint, is keyed by its library:name pair and persisted across sessions. An instance tab edits a footprint pulled from a placed board footprint (Ctrl-E); it is keyed by the source board footprint UUID, carries the board-uuid remap used to save the edits back to that instance, and is session-only so it is never persisted. An unsaved tab edits an imported footprint that has no library home yet; it is keyed by a session id and is promoted to a library tab by the save-as that gives it an identity.
Definition at line 45 of file footprint_editor_tab_context.h.
|
strong |
What the tab edits, which decides its key, its label and whether it is persisted.
| Enumerator | |
|---|---|
| LIBRARY | A library footprint, keyed library:name and persisted across sessions. |
| BOARD_INSTANCE | A footprint pulled off a placed board footprint, session-only. |
| UNSAVED | An imported footprint with no library home yet, session-only. |
Definition at line 51 of file footprint_editor_tab_context.h.
| FOOTPRINT_EDITOR_TAB_CONTEXT::FOOTPRINT_EDITOR_TAB_CONTEXT | ( | const wxString & | aLib, |
| const wxString & | aName, | ||
| std::unique_ptr< BOARD > | aBoard ) |
Definition at line 28 of file footprint_editor_tab_context.cpp.
References m_board, m_footprintNameWhenLoaded, m_lib, m_name, and move.
Referenced by MakeUnsaved().
| FOOTPRINT_EDITOR_TAB_CONTEXT::FOOTPRINT_EDITOR_TAB_CONTEXT | ( | const KIID & | aSourceUuid, |
| const wxString & | aReference, | ||
| std::unique_ptr< BOARD > | aBoard ) |
Construct an instance (board) tab over an fp-holder board carrying a clone of a placed footprint.
| aSourceUuid | is the source board footprint's UUID, used as the de-dup key and tab label. |
| aReference | is the placed footprint reference shown on the tab. |
Definition at line 39 of file footprint_editor_tab_context.cpp.
References BOARD_INSTANCE, m_board, m_kind, m_reference, m_sourceUuid, and move.
|
overridedefault |
|
private |
Definition at line 50 of file footprint_editor_tab_context.cpp.
Editor-to-board UUID remap captured at load, used by SaveFootprintToBoard to restore the original board item identities.
Empty for a library tab.
Definition at line 135 of file footprint_editor_tab_context.h.
References m_boardFootprintUuids.
Referenced by BOOST_AUTO_TEST_CASE(), and FOOTPRINT_EDIT_FRAME::installFootprintTabBoard().
|
inline |
The fp-holder board owned by this context.
The frame borrows this pointer when active.
Definition at line 147 of file footprint_editor_tab_context.h.
References m_board.
Referenced by FOOTPRINT_EDIT_FRAME::activateFootprintTab(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), FOOTPRINT_EDIT_FRAME::findOrCreateFootprintTab(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), and FOOTPRINT_EDIT_FRAME::promptAndCloseFootprintTab().
|
overridevirtual |
Short label shown on the tab.
Implements EDITOR_TAB_CONTEXT.
Definition at line 68 of file footprint_editor_tab_context.cpp.
References _, BOARD_INSTANCE, m_kind, m_name, m_reference, and UNSAVED.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and FOOTPRINT_EDIT_FRAME::promptAndCloseFootprintTab().
|
inline |
Definition at line 159 of file footprint_editor_tab_context.h.
References m_footprintNameWhenLoaded.
Referenced by FOOTPRINT_EDIT_FRAME::installFootprintTabBoard().
|
inline |
Definition at line 149 of file footprint_editor_tab_context.h.
References m_lib.
Referenced by FOOTPRINT_EDIT_FRAME::SaveSettings().
|
inline |
Definition at line 150 of file footprint_editor_tab_context.h.
References m_name.
Referenced by FOOTPRINT_EDIT_FRAME::SaveSettings().
|
inline |
Baseline clone captured at load, used to detect edits and to revert.
Definition at line 156 of file footprint_editor_tab_context.h.
References m_originalFootprintCopy.
Referenced by FOOTPRINT_EDIT_FRAME::installFootprintTabBoard().
|
inline |
Definition at line 129 of file footprint_editor_tab_context.h.
References m_reference.
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Definition at line 128 of file footprint_editor_tab_context.h.
References m_sourceUuid.
Referenced by BOOST_AUTO_TEST_CASE().
|
inlineoverridevirtual |
Stable identity for persistence and de-duplication.
Implements EDITOR_TAB_CONTEXT.
Definition at line 101 of file footprint_editor_tab_context.h.
References BOARD_INSTANCE, m_kind, m_lib, m_name, m_sessionId, m_sourceUuid, MakeInstanceTabKey(), MakeUnsavedTabKey(), and UNSAVED.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and FOOTPRINT_EDIT_FRAME::SaveSettings().
|
inline |
Definition at line 126 of file footprint_editor_tab_context.h.
References BOARD_INSTANCE, and m_kind.
Referenced by BOOST_AUTO_TEST_CASE().
|
overridevirtual |
True only when dirty and the board actually holds a footprint to edit.
Implements EDITOR_TAB_CONTEXT.
Definition at line 93 of file footprint_editor_tab_context.cpp.
References m_board, and m_modified.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), FOOTPRINT_EDIT_FRAME::installFootprintTabBoard(), and FOOTPRINT_EDIT_FRAME::promptAndCloseFootprintTab().
|
inlineinherited |
Definition at line 58 of file editor_tab_context.h.
References m_preview.
|
inline |
True for a tab that is session-only and never persisted.
Definition at line 124 of file footprint_editor_tab_context.h.
References LIBRARY, and m_kind.
Referenced by BOOST_AUTO_TEST_CASE(), and FOOTPRINT_EDIT_FRAME::SaveSettings().
|
inline |
Definition at line 127 of file footprint_editor_tab_context.h.
|
inlinestatic |
De-duplication key for a placed board footprint, in a namespace disjoint from library keys.
The leading control character cannot appear in a library nickname, so an instance key can never collide with a library:name key.
Definition at line 87 of file footprint_editor_tab_context.h.
References KIID::AsString().
Referenced by BOOST_AUTO_TEST_CASE(), FOOTPRINT_EDIT_FRAME::findOrCreateFootprintInstanceTab(), GetTabKey(), and FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard().
|
static |
Construct a tab for an imported footprint that has no library identity yet.
Each import gets its own session id, so importing the same file twice opens two tabs rather than one clobbering the other.
Definition at line 61 of file footprint_editor_tab_context.cpp.
References FOOTPRINT_EDITOR_TAB_CONTEXT(), and UNSAVED.
Referenced by FOOTPRINT_EDIT_FRAME::createUnsavedFootprintTab().
|
inlinestatic |
De-duplication key for an imported footprint, in a namespace disjoint from the library and instance keys.
Definition at line 96 of file footprint_editor_tab_context.h.
References KIID::AsString().
Referenced by GetTabKey().
| void FOOTPRINT_EDITOR_TAB_CONTEXT::PromoteToLibrary | ( | const wxString & | aLib, |
| const wxString & | aName ) |
Give an imported footprint the library identity a save-as just assigned it.
The key changes with the kind, so the caller must re-key the tab strip entry using the key it captured before this call.
Definition at line 82 of file footprint_editor_tab_context.cpp.
References LIBRARY, m_footprintNameWhenLoaded, m_kind, m_lib, m_name, and UNSAVED.
|
inlineinherited |
Definition at line 62 of file editor_tab_context.h.
References m_redo.
Referenced by SYMBOL_EDIT_FRAME::activateSymbolTab(), SYMBOL_EDIT_FRAME::clearSymbolTabUndoRedo(), FOOTPRINT_EDIT_FRAME::freeFootprintTabUndoRedo(), and FOOTPRINT_EDIT_FRAME::installFootprintTabBoard().
|
inlineinherited |
Selection saved as resolved KIIDs, restored after the view is rebuilt.
Definition at line 77 of file editor_tab_context.h.
References m_savedSelection.
Referenced by SYMBOL_EDIT_FRAME::activateSymbolTab(), and FOOTPRINT_EDIT_FRAME::installFootprintTabBoard().
|
inline |
Definition at line 160 of file footprint_editor_tab_context.h.
References m_footprintNameWhenLoaded.
|
inline |
Definition at line 142 of file footprint_editor_tab_context.h.
References m_modified.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and FOOTPRINT_EDIT_FRAME::promptAndCloseFootprintTab().
|
inline |
Definition at line 151 of file footprint_editor_tab_context.h.
References m_name.
| void FOOTPRINT_EDITOR_TAB_CONTEXT::SetOriginalFootprintCopy | ( | std::unique_ptr< FOOTPRINT > | aCopy | ) |
Definition at line 99 of file footprint_editor_tab_context.cpp.
References m_originalFootprintCopy.
|
inlineinherited |
Definition at line 59 of file editor_tab_context.h.
References m_preview.
|
inlineinherited |
Definition at line 61 of file editor_tab_context.h.
References m_undo.
Referenced by SYMBOL_EDIT_FRAME::activateSymbolTab(), SYMBOL_EDIT_FRAME::clearSymbolTabUndoRedo(), FOOTPRINT_EDIT_FRAME::freeFootprintTabUndoRedo(), and FOOTPRINT_EDIT_FRAME::installFootprintTabBoard().
|
inlineinherited |
Definition at line 72 of file editor_tab_context.h.
References m_viewSnapshot.
Referenced by SYMBOL_EDIT_FRAME::activateSymbolTab(), and FOOTPRINT_EDIT_FRAME::installFootprintTabBoard().
|
private |
Definition at line 167 of file footprint_editor_tab_context.h.
Referenced by FOOTPRINT_EDITOR_TAB_CONTEXT(), FOOTPRINT_EDITOR_TAB_CONTEXT(), FOOTPRINT_EDITOR_TAB_CONTEXT(), GetBoard(), and IsModified().
Definition at line 184 of file footprint_editor_tab_context.h.
Referenced by BoardFootprintUuids().
|
private |
Definition at line 169 of file footprint_editor_tab_context.h.
Referenced by FOOTPRINT_EDITOR_TAB_CONTEXT(), GetFootprintNameWhenLoaded(), PromoteToLibrary(), and SetFootprintNameWhenLoaded().
|
private |
Source board footprint UUID, used as the de-dup key and save-back target.
Definition at line 172 of file footprint_editor_tab_context.h.
Referenced by FOOTPRINT_EDITOR_TAB_CONTEXT(), FOOTPRINT_EDITOR_TAB_CONTEXT(), GetDisplayName(), GetTabKey(), IsFromBoard(), IsTransient(), IsUnsaved(), and PromoteToLibrary().
|
private |
Definition at line 165 of file footprint_editor_tab_context.h.
Referenced by FOOTPRINT_EDITOR_TAB_CONTEXT(), GetLib(), GetTabKey(), and PromoteToLibrary().
|
private |
Definition at line 170 of file footprint_editor_tab_context.h.
Referenced by IsModified(), and SetModified().
|
private |
Definition at line 166 of file footprint_editor_tab_context.h.
Referenced by FOOTPRINT_EDITOR_TAB_CONTEXT(), GetDisplayName(), GetName(), GetTabKey(), PromoteToLibrary(), and SetName().
|
private |
Definition at line 168 of file footprint_editor_tab_context.h.
Referenced by GetOriginalFootprintCopy(), and SetOriginalFootprintCopy().
|
protectedinherited |
Definition at line 80 of file editor_tab_context.h.
Referenced by IsPreview(), and SetPreview().
|
protectedinherited |
Definition at line 82 of file editor_tab_context.h.
Referenced by EDITOR_TAB_CONTEXT(), and RedoList().
|
private |
Editor-to-board UUID remap used to save instance edits back to the original board items.
Definition at line 181 of file footprint_editor_tab_context.h.
Referenced by FOOTPRINT_EDITOR_TAB_CONTEXT(), GetDisplayName(), and GetReference().
|
protectedinherited |
Definition at line 84 of file editor_tab_context.h.
Referenced by SavedSelection().
|
private |
Reference designator of the source footprint, shown as the tab label.
Definition at line 178 of file footprint_editor_tab_context.h.
Referenced by GetTabKey().
|
private |
Identity of an unsaved import, which has no library:name pair to key on.
Definition at line 175 of file footprint_editor_tab_context.h.
Referenced by FOOTPRINT_EDITOR_TAB_CONTEXT(), GetSourceUuid(), and GetTabKey().
|
protectedinherited |
Definition at line 81 of file editor_tab_context.h.
Referenced by EDITOR_TAB_CONTEXT(), and UndoList().
|
protectedinherited |
Definition at line 83 of file editor_tab_context.h.
Referenced by ViewSnapshot().