|
KiCad PCB EDA Suite
|
One open symbol tab owning a working LIB_SYMBOL and screen lent to the frame while active. More...
#include <symbol_editor_tab_context.h>
Public Types | |
| enum class | KIND { LIBRARY , SCHEMATIC_INSTANCE , UNSAVED } |
| What the tab edits, which decides its key, its label and whether it is persisted. More... | |
Public Member Functions | |
| SYMBOL_EDITOR_TAB_CONTEXT (const wxString &aLib, const wxString &aName, SYMBOL_BUFFER *aBuffer) | |
| Construct a library tab over the buffer for aLibrary:aName. | |
| SYMBOL_EDITOR_TAB_CONTEXT (LIB_SYMBOL *aSymbol, SCH_SCREEN *aScreen) | |
| Construct an unsaved tab over an already-built transient working symbol/screen. | |
| SYMBOL_EDITOR_TAB_CONTEXT (LIB_SYMBOL *aSymbol, SCH_SCREEN *aScreen, const KIID &aSchematicSymbolUUID, const wxString &aReference) | |
| Construct an instance (schematic) tab over an already-built transient working symbol/screen. | |
| ~SYMBOL_EDITOR_TAB_CONTEXT () override | |
| wxString | GetTabKey () const override |
| Stable identity for persistence and de-duplication. | |
| wxString | GetDisplayName (bool aShortForm=false) const override |
| Short label shown on the tab. | |
| bool | IsTransient () const |
| True for a tab that is session-only and not persisted. | |
| bool | IsFromSchematic () const |
| bool | IsUnsaved () const |
| const KIID & | GetSchematicSymbolUUID () const |
| const wxString & | GetReference () const |
| bool | IsModified () const override |
| True when the working screen carries unsaved edits. | |
| const wxString & | GetLibrary () const |
| const wxString & | GetName () const |
| void | SetName (const wxString &aName) |
| void | PromoteToLibrary (const wxString &aLib, const wxString &aName) |
| Gives an unsaved new symbol a library identity. | |
| LIB_SYMBOL * | GetSymbol () const |
| Observe the working symbol/screen. | |
| SCH_SCREEN * | GetScreen () const |
| void | ReleaseToFrame () |
| Hand the working symbol/screen to the frame as the tab becomes active. | |
| void | AdoptWorkingObjects (LIB_SYMBOL *aSymbol, SCH_SCREEN *aScreen) |
| Take ownership back on detach, capturing whatever the frame's symbol now points at. | |
| void | RefreshFrameOwnedObjects (LIB_SYMBOL *aSymbol, SCH_SCREEN *aScreen) |
| Track the frame's new working symbol after undo/redo replaces it, while staying frame-owned. | |
| int | GetUnit () const |
| void | SetUnit (int aUnit) |
| int | GetBodyStyle () const |
| void | SetBodyStyle (int aBodyStyle) |
| 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 wxString | MakeTabKey (const wxString &aLib, const wxString &aName) |
| De-duplication key for a library:symbol pair. | |
| static wxString | MakeInstanceTabKey (const KIID &aSchematicSymbolUUID) |
| De-duplication key for a placed schematic instance, in a namespace disjoint from library keys. | |
| static wxString | MakeUnsavedTabKey (const KIID &aSessionId) |
| De-duplication key for an unsaved new symbol. | |
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 Attributes | |
| wxString | m_lib |
| wxString | m_name |
| LIB_SYMBOL * | m_symbol |
| Working copy; owned by the context while detached. | |
| SCH_SCREEN * | m_screen |
| Working screen; owned by the context while detached. | |
| bool | m_frameOwns |
| True while the tab is active and the frame owns the symbol/screen. | |
| int | m_unit |
| int | m_bodyStyle |
| KIND | m_kind = KIND::LIBRARY |
| KIID | m_schematicSymbolUUID |
| Source instance UUID, used as both the de-dup key and the save-back target. | |
| wxString | m_reference |
| Reference designator of the source instance, shown as the tab label. | |
| KIID | m_sessionId |
| Identity of an unsaved new symbol, which has no library:name pair to key on. | |
One open symbol tab owning a working LIB_SYMBOL and screen lent to the frame while active.
A tab is one of three kinds. A library tab edits a buffered library symbol and is keyed by its library:name pair and persisted across sessions. An instance tab edits a symbol pulled from a placed schematic instance (Ctrl-E); it owns a transient working symbol with no library buffer, is keyed by the source instance UUID, and is session-only so it is never persisted. An unsaved tab edits a brand-new symbol with no library home yet; it is keyed by a session id and is promoted to a library tab by the save that gives it an identity.
Definition at line 44 of file symbol_editor_tab_context.h.
|
strong |
What the tab edits, which decides its key, its label and whether it is persisted.
| Enumerator | |
|---|---|
| LIBRARY | A library symbol, keyed library:name and persisted across sessions. |
| SCHEMATIC_INSTANCE | A symbol pulled off a placed schematic symbol, session-only. |
| UNSAVED | A brand-new symbol with no library home yet, session-only. |
Definition at line 50 of file symbol_editor_tab_context.h.
| SYMBOL_EDITOR_TAB_CONTEXT::SYMBOL_EDITOR_TAB_CONTEXT | ( | const wxString & | aLib, |
| const wxString & | aName, | ||
| SYMBOL_BUFFER * | aBuffer ) |
Construct a library tab over the buffer for aLibrary:aName.
The context edits a private clone of the buffered symbol; the buffer keeps ownership of the original. A fresh empty screen is created since symbol geometry lives in the LIB_SYMBOL.
Definition at line 64 of file symbol_editor_tab_context.cpp.
References SYMBOL_BUFFER::GetSymbol(), SYMBOL_BUFFER::IsModified(), m_bodyStyle, m_frameOwns, m_lib, m_name, m_screen, m_symbol, and m_unit.
| SYMBOL_EDITOR_TAB_CONTEXT::SYMBOL_EDITOR_TAB_CONTEXT | ( | LIB_SYMBOL * | aSymbol, |
| SCH_SCREEN * | aScreen ) |
Construct an unsaved tab over an already-built transient working symbol/screen.
The context takes ownership of both objects, following the same frame-borrow contract as a library tab. There is no library buffer; the symbol has no library identity yet.
Definition at line 27 of file symbol_editor_tab_context.cpp.
References m_bodyStyle, m_frameOwns, m_kind, m_screen, m_sessionId, m_symbol, m_unit, and UNSAVED.
| SYMBOL_EDITOR_TAB_CONTEXT::SYMBOL_EDITOR_TAB_CONTEXT | ( | LIB_SYMBOL * | aSymbol, |
| SCH_SCREEN * | aScreen, | ||
| const KIID & | aSchematicSymbolUUID, | ||
| const wxString & | aReference ) |
Construct an instance (schematic) tab over an already-built transient working symbol/screen.
The context takes ownership of both objects, following the same frame-borrow contract as a library tab. There is no library buffer. Save routing is driven by the stored source UUID and reference, which the frame restores on activation.
Definition at line 39 of file symbol_editor_tab_context.cpp.
References m_bodyStyle, m_frameOwns, m_kind, m_reference, m_schematicSymbolUUID, m_screen, m_symbol, m_unit, and SCHEMATIC_INSTANCE.
|
override |
Definition at line 86 of file symbol_editor_tab_context.cpp.
References m_frameOwns, m_screen, and m_symbol.
|
inline |
Take ownership back on detach, capturing whatever the frame's symbol now points at.
Definition at line 181 of file symbol_editor_tab_context.h.
References m_frameOwns, m_screen, and m_symbol.
Referenced by SYMBOL_EDIT_FRAME::promptAndCloseSymbolTab().
|
inline |
Definition at line 200 of file symbol_editor_tab_context.h.
References m_bodyStyle.
Referenced by SYMBOL_EDIT_FRAME::activateSymbolTab(), and BOOST_AUTO_TEST_CASE().
|
inlineoverridevirtual |
Short label shown on the tab.
Implements EDITOR_TAB_CONTEXT.
Definition at line 123 of file symbol_editor_tab_context.h.
References _, m_kind, m_name, m_reference, SCHEMATIC_INSTANCE, and UNSAVED.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), SYMBOL_EDIT_FRAME::CreateUnsavedSymbolTab(), SYMBOL_EDIT_FRAME::findOrCreateSymbolInstanceTab(), and SYMBOL_EDIT_FRAME::promptAndCloseSymbolTab().
|
inline |
Definition at line 156 of file symbol_editor_tab_context.h.
References m_lib.
|
inline |
Definition at line 157 of file symbol_editor_tab_context.h.
References m_name.
|
inline |
Definition at line 149 of file symbol_editor_tab_context.h.
References m_reference.
Referenced by SYMBOL_EDIT_FRAME::activateSymbolTab(), and BOOST_AUTO_TEST_CASE().
|
inline |
Definition at line 148 of file symbol_editor_tab_context.h.
References m_schematicSymbolUUID.
Referenced by SYMBOL_EDIT_FRAME::activateSymbolTab(), and BOOST_AUTO_TEST_CASE().
|
inline |
Definition at line 169 of file symbol_editor_tab_context.h.
References m_screen.
Referenced by SYMBOL_EDIT_FRAME::activateSymbolTab(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and SYMBOL_EDIT_FRAME::clearTabModifiedState().
|
inline |
Observe the working symbol/screen.
Valid whether active or detached.
Definition at line 168 of file symbol_editor_tab_context.h.
References m_symbol.
Referenced by SYMBOL_EDIT_FRAME::activateSymbolTab(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
inlineoverridevirtual |
Stable identity for persistence and de-duplication.
Implements EDITOR_TAB_CONTEXT.
Definition at line 113 of file symbol_editor_tab_context.h.
References m_kind, m_lib, m_name, m_schematicSymbolUUID, m_sessionId, MakeInstanceTabKey(), MakeTabKey(), MakeUnsavedTabKey(), SCHEMATIC_INSTANCE, and UNSAVED.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), SYMBOL_EDIT_FRAME::clearTabModifiedState(), SYMBOL_EDIT_FRAME::CreateUnsavedSymbolTab(), and SYMBOL_EDIT_FRAME::restoreSymbolTabsFromSettings().
|
inline |
Definition at line 197 of file symbol_editor_tab_context.h.
References m_unit.
Referenced by SYMBOL_EDIT_FRAME::activateSymbolTab(), and BOOST_AUTO_TEST_CASE().
|
inline |
Definition at line 146 of file symbol_editor_tab_context.h.
References m_kind, and SCHEMATIC_INSTANCE.
Referenced by SYMBOL_EDIT_FRAME::activateSymbolTab(), and BOOST_AUTO_TEST_CASE().
|
overridevirtual |
True when the working screen carries unsaved edits.
Implements EDITOR_TAB_CONTEXT.
Definition at line 97 of file symbol_editor_tab_context.cpp.
References m_screen.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and SYMBOL_EDIT_FRAME::promptAndCloseSymbolTab().
|
inlineinherited |
Definition at line 58 of file editor_tab_context.h.
References m_preview.
|
inline |
True for a tab that is session-only and not persisted.
Definition at line 144 of file symbol_editor_tab_context.h.
References LIBRARY, and m_kind.
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Definition at line 147 of file symbol_editor_tab_context.h.
|
inlinestatic |
De-duplication key for a placed schematic instance, 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 100 of file symbol_editor_tab_context.h.
References KIID::AsString().
Referenced by BOOST_AUTO_TEST_CASE(), SYMBOL_EDIT_FRAME::findOrCreateSymbolInstanceTab(), and GetTabKey().
|
inlinestatic |
De-duplication key for a library:symbol pair.
Definition at line 89 of file symbol_editor_tab_context.h.
Referenced by BOOST_AUTO_TEST_CASE(), SYMBOL_EDIT_FRAME::closeSymbolTab(), SYMBOL_EDIT_FRAME::findOrCreateSymbolTab(), GetTabKey(), and SYMBOL_EDIT_FRAME::RenameSymbolTab().
|
inlinestatic |
De-duplication key for an unsaved new symbol.
Definition at line 108 of file symbol_editor_tab_context.h.
References KIID::AsString().
Referenced by GetTabKey().
| void SYMBOL_EDITOR_TAB_CONTEXT::PromoteToLibrary | ( | const wxString & | aLib, |
| const wxString & | aName ) |
|
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().
|
inline |
Track the frame's new working symbol after undo/redo replaces it, while staying frame-owned.
Definition at line 191 of file symbol_editor_tab_context.h.
|
inline |
Hand the working symbol/screen to the frame as the tab becomes active.
The context stops deleting them until AdoptWorkingObjects takes ownership back on detach.
Definition at line 176 of file symbol_editor_tab_context.h.
References m_frameOwns.
Referenced by SYMBOL_EDIT_FRAME::activateSymbolTab().
|
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(), FOOTPRINT_EDIT_FRAME::installFootprintTabBoard(), and FOOTPRINT_EDIT_FRAME::RefreshLibraryFootprintTab().
|
inline |
Definition at line 201 of file symbol_editor_tab_context.h.
References m_bodyStyle.
Referenced by BOOST_AUTO_TEST_CASE(), SYMBOL_EDIT_FRAME::findOrCreateSymbolInstanceTab(), and SYMBOL_EDIT_FRAME::findOrCreateSymbolTab().
|
inline |
Definition at line 158 of file symbol_editor_tab_context.h.
References m_name.
|
inlineinherited |
Definition at line 59 of file editor_tab_context.h.
References m_preview.
|
inline |
Definition at line 198 of file symbol_editor_tab_context.h.
References m_unit.
Referenced by BOOST_AUTO_TEST_CASE(), SYMBOL_EDIT_FRAME::findOrCreateSymbolInstanceTab(), and SYMBOL_EDIT_FRAME::findOrCreateSymbolTab().
|
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 210 of file symbol_editor_tab_context.h.
Referenced by GetBodyStyle(), SetBodyStyle(), SYMBOL_EDITOR_TAB_CONTEXT(), SYMBOL_EDITOR_TAB_CONTEXT(), and SYMBOL_EDITOR_TAB_CONTEXT().
|
private |
True while the tab is active and the frame owns the symbol/screen.
Definition at line 208 of file symbol_editor_tab_context.h.
Referenced by AdoptWorkingObjects(), ReleaseToFrame(), SYMBOL_EDITOR_TAB_CONTEXT(), SYMBOL_EDITOR_TAB_CONTEXT(), SYMBOL_EDITOR_TAB_CONTEXT(), and ~SYMBOL_EDITOR_TAB_CONTEXT().
|
private |
Definition at line 212 of file symbol_editor_tab_context.h.
Referenced by GetDisplayName(), GetTabKey(), IsFromSchematic(), IsTransient(), IsUnsaved(), PromoteToLibrary(), SYMBOL_EDITOR_TAB_CONTEXT(), and SYMBOL_EDITOR_TAB_CONTEXT().
|
private |
Definition at line 204 of file symbol_editor_tab_context.h.
Referenced by GetLibrary(), GetTabKey(), PromoteToLibrary(), and SYMBOL_EDITOR_TAB_CONTEXT().
|
private |
Definition at line 205 of file symbol_editor_tab_context.h.
Referenced by GetDisplayName(), GetName(), GetTabKey(), PromoteToLibrary(), SetName(), and SYMBOL_EDITOR_TAB_CONTEXT().
|
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 |
Reference designator of the source instance, shown as the tab label.
Definition at line 218 of file symbol_editor_tab_context.h.
Referenced by GetDisplayName(), GetReference(), and SYMBOL_EDITOR_TAB_CONTEXT().
|
protectedinherited |
Definition at line 84 of file editor_tab_context.h.
Referenced by SavedSelection().
|
private |
Source instance UUID, used as both the de-dup key and the save-back target.
Definition at line 215 of file symbol_editor_tab_context.h.
Referenced by GetSchematicSymbolUUID(), GetTabKey(), and SYMBOL_EDITOR_TAB_CONTEXT().
|
private |
Working screen; owned by the context while detached.
Definition at line 207 of file symbol_editor_tab_context.h.
Referenced by AdoptWorkingObjects(), GetScreen(), IsModified(), RefreshFrameOwnedObjects(), SYMBOL_EDITOR_TAB_CONTEXT(), SYMBOL_EDITOR_TAB_CONTEXT(), SYMBOL_EDITOR_TAB_CONTEXT(), and ~SYMBOL_EDITOR_TAB_CONTEXT().
|
private |
Identity of an unsaved new symbol, which has no library:name pair to key on.
Definition at line 221 of file symbol_editor_tab_context.h.
Referenced by GetTabKey(), and SYMBOL_EDITOR_TAB_CONTEXT().
|
private |
Working copy; owned by the context while detached.
Definition at line 206 of file symbol_editor_tab_context.h.
Referenced by AdoptWorkingObjects(), GetSymbol(), RefreshFrameOwnedObjects(), SYMBOL_EDITOR_TAB_CONTEXT(), SYMBOL_EDITOR_TAB_CONTEXT(), SYMBOL_EDITOR_TAB_CONTEXT(), and ~SYMBOL_EDITOR_TAB_CONTEXT().
|
protectedinherited |
Definition at line 81 of file editor_tab_context.h.
Referenced by EDITOR_TAB_CONTEXT(), and UndoList().
|
private |
Definition at line 209 of file symbol_editor_tab_context.h.
Referenced by GetUnit(), SetUnit(), SYMBOL_EDITOR_TAB_CONTEXT(), SYMBOL_EDITOR_TAB_CONTEXT(), and SYMBOL_EDITOR_TAB_CONTEXT().
|
protectedinherited |
Definition at line 83 of file editor_tab_context.h.
Referenced by ViewSnapshot().