20#ifndef SYMBOL_EDITOR_TAB_CONTEXT_H
21#define SYMBOL_EDITOR_TAB_CONTEXT_H
24#include <wx/translation.h>
82 const KIID& aSchematicSymbolUUID,
const wxString& aReference );
89 static wxString
MakeTabKey(
const wxString& aLib,
const wxString& aName )
91 return aLib + wxT(
":" ) + aName;
102 return wxString( wxT(
"\x01@sym:" ) ) + aSchematicSymbolUUID.
AsString();
110 return wxString( wxT(
"\x01@unsaved:" ) ) + aSessionId.
AsString();
131 return m_reference + wxS(
" " ) +
_(
"[from schematic]" );
134 return _(
"<unnamed>" );
wxString AsString() const
Define a library symbol object.
void RefreshFrameOwnedObjects(LIB_SYMBOL *aSymbol, SCH_SCREEN *aScreen)
Track the frame's new working symbol after undo/redo replaces it, while staying frame-owned.
void ReleaseToFrame()
Hand the working symbol/screen to the frame as the tab becomes active.
LIB_SYMBOL * GetSymbol() const
Observe the working symbol/screen.
LIB_SYMBOL * m_symbol
Working copy; owned by the context while detached.
const wxString & GetReference() const
const wxString & GetName() const
static wxString MakeTabKey(const wxString &aLib, const wxString &aName)
De-duplication key for a library:symbol pair.
wxString m_reference
Reference designator of the source instance, shown as the tab label.
static wxString MakeInstanceTabKey(const KIID &aSchematicSymbolUUID)
De-duplication key for a placed schematic instance, in a namespace disjoint from library keys.
SYMBOL_EDITOR_TAB_CONTEXT(const wxString &aLib, const wxString &aName, SYMBOL_BUFFER *aBuffer)
Construct a library tab over the buffer for aLibrary:aName.
SCH_SCREEN * GetScreen() const
~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.
const KIID & GetSchematicSymbolUUID() const
bool m_frameOwns
True while the tab is active and the frame owns the symbol/screen.
void PromoteToLibrary(const wxString &aLib, const wxString &aName)
Gives an unsaved new symbol a library identity.
KIID m_sessionId
Identity of an unsaved new symbol, which has no library:name pair to key on.
void SetBodyStyle(int aBodyStyle)
static wxString MakeUnsavedTabKey(const KIID &aSessionId)
De-duplication key for an unsaved new symbol.
bool IsModified() const override
True when the working screen carries unsaved edits.
SCH_SCREEN * m_screen
Working screen; owned by the context while detached.
void AdoptWorkingObjects(LIB_SYMBOL *aSymbol, SCH_SCREEN *aScreen)
Take ownership back on detach, capturing whatever the frame's symbol now points at.
bool IsFromSchematic() const
void SetName(const wxString &aName)
const wxString & GetLibrary() const
bool IsTransient() const
True for a tab that is session-only and not persisted.
KIID m_schematicSymbolUUID
Source instance UUID, used as both the de-dup key and the save-back target.
KIND
What the tab edits, which decides its key, its label and whether it is persisted.
@ UNSAVED
A brand-new symbol with no library home yet, session-only.
@ SCHEMATIC_INSTANCE
A symbol pulled off a placed schematic symbol, session-only.
@ LIBRARY
A library symbol, keyed library:name and persisted across sessions.