KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SYMBOL_EDITOR_TAB_CONTEXT Class Reference

One open symbol tab owning a working LIB_SYMBOL and screen lent to the frame while active. More...

#include <symbol_editor_tab_context.h>

Inheritance diagram for SYMBOL_EDITOR_TAB_CONTEXT:
EDITOR_TAB_CONTEXT

Public Member Functions

 SYMBOL_EDITOR_TAB_CONTEXT (const wxString &aLib, const wxString &aName, SYMBOL_BUFFER *aBuffer)
 
 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 () const override
 Short label shown on the tab.
 
bool IsTransient () const
 True for an instance (schematic) tab, which is session-only and never persisted.
 
bool IsFromSchematic () const
 
const KIIDGetSchematicSymbolUUID () 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
 
LIB_SYMBOLGetSymbol () const
 Observe the working symbol/screen.
 
SCH_SCREENGetScreen () 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_CONTAINERUndoList ()
 
UNDO_REDO_CONTAINERRedoList ()
 
VIEW_SNAPSHOTViewSnapshot ()
 
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.
 

Protected Attributes

bool m_preview = false
 
std::unique_ptr< UNDO_REDO_CONTAINERm_undo
 
std::unique_ptr< UNDO_REDO_CONTAINERm_redo
 
VIEW_SNAPSHOT m_viewSnapshot
 
std::vector< KIIDm_savedSelection
 

Private Attributes

wxString m_lib
 
wxString m_name
 
LIB_SYMBOLm_symbol
 Working copy; owned by the context while detached.
 
SCH_SCREENm_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
 True for an instance tab edited in place from a placed schematic symbol.
 
bool m_fromSchematic
 Source instance UUID, used as both the de-dup key and the save-back target.
 
KIID m_schematicSymbolUUID
 Reference designator of the source instance, shown as the tab label.
 
wxString m_reference
 

Detailed Description

One open symbol tab owning a working LIB_SYMBOL and screen lent to the frame while active.

A tab is one of two 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.

Definition at line 41 of file symbol_editor_tab_context.h.

Constructor & Destructor Documentation

◆ SYMBOL_EDITOR_TAB_CONTEXT() [1/2]

SYMBOL_EDITOR_TAB_CONTEXT::SYMBOL_EDITOR_TAB_CONTEXT ( const wxString & aLib,
const wxString & aName,
SYMBOL_BUFFER * aBuffer )

◆ SYMBOL_EDITOR_TAB_CONTEXT() [2/2]

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 50 of file symbol_editor_tab_context.cpp.

References m_bodyStyle, m_frameOwns, m_fromSchematic, m_reference, m_schematicSymbolUUID, m_screen, m_symbol, and m_unit.

◆ ~SYMBOL_EDITOR_TAB_CONTEXT()

SYMBOL_EDITOR_TAB_CONTEXT::~SYMBOL_EDITOR_TAB_CONTEXT ( )
override

Definition at line 65 of file symbol_editor_tab_context.cpp.

References m_frameOwns, m_screen, and m_symbol.

Member Function Documentation

◆ AdoptWorkingObjects()

void SYMBOL_EDITOR_TAB_CONTEXT::AdoptWorkingObjects ( LIB_SYMBOL * aSymbol,
SCH_SCREEN * aScreen )
inline

Take ownership back on detach, capturing whatever the frame's symbol now points at.

Definition at line 118 of file symbol_editor_tab_context.h.

References m_frameOwns, m_screen, and m_symbol.

Referenced by SYMBOL_EDIT_FRAME::promptAndCloseSymbolTab().

◆ GetBodyStyle()

int SYMBOL_EDITOR_TAB_CONTEXT::GetBodyStyle ( ) const
inline

◆ GetDisplayName()

wxString SYMBOL_EDITOR_TAB_CONTEXT::GetDisplayName ( ) const
inlineoverridevirtual

Short label shown on the tab.

Implements EDITOR_TAB_CONTEXT.

Definition at line 83 of file symbol_editor_tab_context.h.

References m_fromSchematic, m_name, and m_reference.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and SYMBOL_EDIT_FRAME::promptAndCloseSymbolTab().

◆ GetLibrary()

const wxString & SYMBOL_EDITOR_TAB_CONTEXT::GetLibrary ( ) const
inline

Definition at line 99 of file symbol_editor_tab_context.h.

References m_lib.

Referenced by SYMBOL_EDIT_FRAME::activateSymbolTab().

◆ GetName()

const wxString & SYMBOL_EDITOR_TAB_CONTEXT::GetName ( ) const
inline

Definition at line 100 of file symbol_editor_tab_context.h.

References m_name.

◆ GetReference()

const wxString & SYMBOL_EDITOR_TAB_CONTEXT::GetReference ( ) const
inline

◆ GetSchematicSymbolUUID()

const KIID & SYMBOL_EDITOR_TAB_CONTEXT::GetSchematicSymbolUUID ( ) const
inline

◆ GetScreen()

SCH_SCREEN * SYMBOL_EDITOR_TAB_CONTEXT::GetScreen ( ) const
inline

◆ GetSymbol()

LIB_SYMBOL * SYMBOL_EDITOR_TAB_CONTEXT::GetSymbol ( ) const
inline

Observe the working symbol/screen.

Valid whether active or detached.

Definition at line 105 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().

◆ GetTabKey()

wxString SYMBOL_EDITOR_TAB_CONTEXT::GetTabKey ( ) const
inlineoverridevirtual

Stable identity for persistence and de-duplication.

Implements EDITOR_TAB_CONTEXT.

Definition at line 77 of file symbol_editor_tab_context.h.

References m_fromSchematic, m_lib, m_name, m_schematicSymbolUUID, MakeInstanceTabKey(), and MakeTabKey().

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and SYMBOL_EDIT_FRAME::restoreSymbolTabsFromSettings().

◆ GetUnit()

int SYMBOL_EDITOR_TAB_CONTEXT::GetUnit ( ) const
inline

Definition at line 134 of file symbol_editor_tab_context.h.

References m_unit.

Referenced by SYMBOL_EDIT_FRAME::activateSymbolTab(), and BOOST_AUTO_TEST_CASE().

◆ IsFromSchematic()

bool SYMBOL_EDITOR_TAB_CONTEXT::IsFromSchematic ( ) const
inline

◆ IsModified()

bool SYMBOL_EDITOR_TAB_CONTEXT::IsModified ( ) const
overridevirtual

True when the working screen carries unsaved edits.

Implements EDITOR_TAB_CONTEXT.

Definition at line 76 of file symbol_editor_tab_context.cpp.

References m_screen.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), SYMBOL_EDIT_FRAME::promptAndCloseSymbolTab(), and SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME().

◆ IsPreview()

bool EDITOR_TAB_CONTEXT::IsPreview ( ) const
inlineinherited

Definition at line 58 of file editor_tab_context.h.

References m_preview.

◆ IsTransient()

bool SYMBOL_EDITOR_TAB_CONTEXT::IsTransient ( ) const
inline

True for an instance (schematic) tab, which is session-only and never persisted.

Definition at line 88 of file symbol_editor_tab_context.h.

References m_fromSchematic.

Referenced by BOOST_AUTO_TEST_CASE().

◆ MakeInstanceTabKey()

static wxString SYMBOL_EDITOR_TAB_CONTEXT::MakeInstanceTabKey ( const KIID & aSchematicSymbolUUID)
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 72 of file symbol_editor_tab_context.h.

References KIID::AsString().

Referenced by BOOST_AUTO_TEST_CASE(), SYMBOL_EDIT_FRAME::findOrCreateSymbolInstanceTab(), and GetTabKey().

◆ MakeTabKey()

static wxString SYMBOL_EDITOR_TAB_CONTEXT::MakeTabKey ( const wxString & aLib,
const wxString & aName )
inlinestatic

De-duplication key for a library:symbol pair.

Definition at line 61 of file symbol_editor_tab_context.h.

Referenced by BOOST_AUTO_TEST_CASE(), SYMBOL_EDIT_FRAME::findOrCreateSymbolTab(), and GetTabKey().

◆ RedoList()

◆ RefreshFrameOwnedObjects()

void SYMBOL_EDITOR_TAB_CONTEXT::RefreshFrameOwnedObjects ( LIB_SYMBOL * aSymbol,
SCH_SCREEN * aScreen )
inline

Track the frame's new working symbol after undo/redo replaces it, while staying frame-owned.

Definition at line 128 of file symbol_editor_tab_context.h.

References m_screen, and m_symbol.

◆ ReleaseToFrame()

void SYMBOL_EDITOR_TAB_CONTEXT::ReleaseToFrame ( )
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 113 of file symbol_editor_tab_context.h.

References m_frameOwns.

Referenced by SYMBOL_EDIT_FRAME::activateSymbolTab().

◆ SavedSelection()

std::vector< KIID > & EDITOR_TAB_CONTEXT::SavedSelection ( )
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().

◆ SetBodyStyle()

void SYMBOL_EDITOR_TAB_CONTEXT::SetBodyStyle ( int aBodyStyle)
inline

◆ SetPreview()

void EDITOR_TAB_CONTEXT::SetPreview ( bool aPreview)
inlineinherited

Definition at line 59 of file editor_tab_context.h.

References m_preview.

◆ SetUnit()

void SYMBOL_EDITOR_TAB_CONTEXT::SetUnit ( int aUnit)
inline

◆ UndoList()

◆ ViewSnapshot()

VIEW_SNAPSHOT & EDITOR_TAB_CONTEXT::ViewSnapshot ( )
inlineinherited

Member Data Documentation

◆ m_bodyStyle

int SYMBOL_EDITOR_TAB_CONTEXT::m_bodyStyle
private

True for an instance tab edited in place from a placed schematic symbol.

Definition at line 147 of file symbol_editor_tab_context.h.

Referenced by GetBodyStyle(), SetBodyStyle(), SYMBOL_EDITOR_TAB_CONTEXT(), and SYMBOL_EDITOR_TAB_CONTEXT().

◆ m_frameOwns

bool SYMBOL_EDITOR_TAB_CONTEXT::m_frameOwns
private

True while the tab is active and the frame owns the symbol/screen.

Definition at line 145 of file symbol_editor_tab_context.h.

Referenced by AdoptWorkingObjects(), ReleaseToFrame(), SYMBOL_EDITOR_TAB_CONTEXT(), SYMBOL_EDITOR_TAB_CONTEXT(), and ~SYMBOL_EDITOR_TAB_CONTEXT().

◆ m_fromSchematic

bool SYMBOL_EDITOR_TAB_CONTEXT::m_fromSchematic
private

Source instance UUID, used as both the de-dup key and the save-back target.

Definition at line 150 of file symbol_editor_tab_context.h.

Referenced by GetDisplayName(), GetTabKey(), IsFromSchematic(), IsTransient(), SYMBOL_EDITOR_TAB_CONTEXT(), and SYMBOL_EDITOR_TAB_CONTEXT().

◆ m_lib

wxString SYMBOL_EDITOR_TAB_CONTEXT::m_lib
private

Definition at line 141 of file symbol_editor_tab_context.h.

Referenced by GetLibrary(), GetTabKey(), and SYMBOL_EDITOR_TAB_CONTEXT().

◆ m_name

wxString SYMBOL_EDITOR_TAB_CONTEXT::m_name
private

◆ m_preview

bool EDITOR_TAB_CONTEXT::m_preview = false
protectedinherited

Definition at line 80 of file editor_tab_context.h.

Referenced by IsPreview(), and SetPreview().

◆ m_redo

std::unique_ptr<UNDO_REDO_CONTAINER> EDITOR_TAB_CONTEXT::m_redo
protectedinherited

Definition at line 82 of file editor_tab_context.h.

Referenced by EDITOR_TAB_CONTEXT(), and RedoList().

◆ m_reference

wxString SYMBOL_EDITOR_TAB_CONTEXT::m_reference
private

◆ m_savedSelection

std::vector<KIID> EDITOR_TAB_CONTEXT::m_savedSelection
protectedinherited

Definition at line 84 of file editor_tab_context.h.

Referenced by SavedSelection().

◆ m_schematicSymbolUUID

KIID SYMBOL_EDITOR_TAB_CONTEXT::m_schematicSymbolUUID
private

Reference designator of the source instance, shown as the tab label.

Definition at line 153 of file symbol_editor_tab_context.h.

Referenced by GetSchematicSymbolUUID(), GetTabKey(), and SYMBOL_EDITOR_TAB_CONTEXT().

◆ m_screen

SCH_SCREEN* SYMBOL_EDITOR_TAB_CONTEXT::m_screen
private

◆ m_symbol

LIB_SYMBOL* SYMBOL_EDITOR_TAB_CONTEXT::m_symbol
private

◆ m_undo

std::unique_ptr<UNDO_REDO_CONTAINER> EDITOR_TAB_CONTEXT::m_undo
protectedinherited

Definition at line 81 of file editor_tab_context.h.

Referenced by EDITOR_TAB_CONTEXT(), and UndoList().

◆ m_unit

int SYMBOL_EDITOR_TAB_CONTEXT::m_unit
private

◆ m_viewSnapshot

VIEW_SNAPSHOT EDITOR_TAB_CONTEXT::m_viewSnapshot
protectedinherited

Definition at line 83 of file editor_tab_context.h.

Referenced by ViewSnapshot().


The documentation for this class was generated from the following files: