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

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>

Inheritance diagram for FOOTPRINT_EDITOR_TAB_CONTEXT:
EDITOR_TAB_CONTEXT

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.
 
bool IsTransient () const
 True for an instance (board) tab, which is session-only and never persisted.
 
bool IsFromBoard () const
 
const KIIDGetSourceUuid () 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)
 
BOARDGetBoard () const
 The fp-holder board owned by this context.
 
const wxString & GetLib () const
 
const wxString & GetName () const
 
void SetName (const wxString &aName)
 
FOOTPRINTGetOriginalFootprintCopy () 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_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 MakeInstanceTabKey (const KIID &aSourceUuid)
 De-duplication key for a placed board footprint, 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
 
std::unique_ptr< BOARDm_board
 
std::unique_ptr< FOOTPRINTm_originalFootprintCopy
 
wxString m_footprintNameWhenLoaded
 
bool m_modified = false
 True for an instance tab edited in place from a placed board footprint.
 
bool m_fromBoard = false
 Source board footprint UUID, used as the de-dup key and save-back target.
 
KIID m_sourceUuid
 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, KIIDm_boardFootprintUuids
 

Detailed Description

One open footprint tab owning its fp-holder board, lent to the frame by raw pointer while active.

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

Definition at line 43 of file footprint_editor_tab_context.h.

Constructor & Destructor Documentation

◆ FOOTPRINT_EDITOR_TAB_CONTEXT() [1/2]

FOOTPRINT_EDITOR_TAB_CONTEXT::FOOTPRINT_EDITOR_TAB_CONTEXT ( const wxString & aLib,
const wxString & aName,
std::unique_ptr< BOARD > aBoard )

Definition at line 26 of file footprint_editor_tab_context.cpp.

References m_board, m_footprintNameWhenLoaded, m_lib, m_name, and move.

◆ FOOTPRINT_EDITOR_TAB_CONTEXT() [2/2]

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.

Parameters
aSourceUuidis the source board footprint's UUID, used as the de-dup key and tab label.
aReferenceis the placed footprint reference shown on the tab.

Definition at line 37 of file footprint_editor_tab_context.cpp.

References m_board, m_fromBoard, m_reference, m_sourceUuid, and move.

◆ ~FOOTPRINT_EDITOR_TAB_CONTEXT()

FOOTPRINT_EDITOR_TAB_CONTEXT::~FOOTPRINT_EDITOR_TAB_CONTEXT ( )
overridedefault

Member Function Documentation

◆ BoardFootprintUuids()

std::map< KIID, KIID > & FOOTPRINT_EDITOR_TAB_CONTEXT::BoardFootprintUuids ( )
inline

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 92 of file footprint_editor_tab_context.h.

References m_boardFootprintUuids.

Referenced by BOOST_AUTO_TEST_CASE(), and FOOTPRINT_EDIT_FRAME::installFootprintTabBoard().

◆ GetBoard()

BOARD * FOOTPRINT_EDITOR_TAB_CONTEXT::GetBoard ( ) const
inline

The fp-holder board owned by this context.

The frame borrows this pointer when active.

Definition at line 104 of file footprint_editor_tab_context.h.

References m_board.

Referenced by FOOTPRINT_EDIT_FRAME::activateFootprintTab(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), and FOOTPRINT_EDIT_FRAME::promptAndCloseFootprintTab().

◆ GetDisplayName()

wxString FOOTPRINT_EDITOR_TAB_CONTEXT::GetDisplayName ( ) const
inlineoverridevirtual

Short label shown on the tab.

Implements EDITOR_TAB_CONTEXT.

Definition at line 77 of file footprint_editor_tab_context.h.

References m_fromBoard, m_name, and m_reference.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and FOOTPRINT_EDIT_FRAME::promptAndCloseFootprintTab().

◆ GetFootprintNameWhenLoaded()

const wxString & FOOTPRINT_EDITOR_TAB_CONTEXT::GetFootprintNameWhenLoaded ( ) const
inline

◆ GetLib()

const wxString & FOOTPRINT_EDITOR_TAB_CONTEXT::GetLib ( ) const
inline

Definition at line 106 of file footprint_editor_tab_context.h.

References m_lib.

◆ GetName()

const wxString & FOOTPRINT_EDITOR_TAB_CONTEXT::GetName ( ) const
inline

Definition at line 107 of file footprint_editor_tab_context.h.

References m_name.

◆ GetOriginalFootprintCopy()

FOOTPRINT * FOOTPRINT_EDITOR_TAB_CONTEXT::GetOriginalFootprintCopy ( ) const
inline

Baseline clone captured at load, used to detect edits and to revert.

Definition at line 113 of file footprint_editor_tab_context.h.

References m_originalFootprintCopy.

Referenced by FOOTPRINT_EDIT_FRAME::installFootprintTabBoard().

◆ GetReference()

const wxString & FOOTPRINT_EDITOR_TAB_CONTEXT::GetReference ( ) const
inline

Definition at line 86 of file footprint_editor_tab_context.h.

References m_reference.

Referenced by BOOST_AUTO_TEST_CASE().

◆ GetSourceUuid()

const KIID & FOOTPRINT_EDITOR_TAB_CONTEXT::GetSourceUuid ( ) const
inline

Definition at line 85 of file footprint_editor_tab_context.h.

References m_sourceUuid.

Referenced by BOOST_AUTO_TEST_CASE().

◆ GetTabKey()

wxString FOOTPRINT_EDITOR_TAB_CONTEXT::GetTabKey ( ) const
inlineoverridevirtual

Stable identity for persistence and de-duplication.

Implements EDITOR_TAB_CONTEXT.

Definition at line 72 of file footprint_editor_tab_context.h.

References m_fromBoard, m_lib, m_name, m_sourceUuid, and MakeInstanceTabKey().

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ IsFromBoard()

bool FOOTPRINT_EDITOR_TAB_CONTEXT::IsFromBoard ( ) const
inline

Definition at line 84 of file footprint_editor_tab_context.h.

References m_fromBoard.

Referenced by BOOST_AUTO_TEST_CASE().

◆ IsModified()

bool FOOTPRINT_EDITOR_TAB_CONTEXT::IsModified ( ) const
overridevirtual

◆ IsPreview()

bool EDITOR_TAB_CONTEXT::IsPreview ( ) const
inlineinherited

Definition at line 58 of file editor_tab_context.h.

References m_preview.

◆ IsTransient()

bool FOOTPRINT_EDITOR_TAB_CONTEXT::IsTransient ( ) const
inline

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

Definition at line 82 of file footprint_editor_tab_context.h.

References m_fromBoard.

Referenced by BOOST_AUTO_TEST_CASE().

◆ MakeInstanceTabKey()

static wxString FOOTPRINT_EDITOR_TAB_CONTEXT::MakeInstanceTabKey ( const KIID & aSourceUuid)
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 67 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().

◆ RedoList()

◆ 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().

◆ SetFootprintNameWhenLoaded()

void FOOTPRINT_EDITOR_TAB_CONTEXT::SetFootprintNameWhenLoaded ( const wxString & aName)
inline

Definition at line 117 of file footprint_editor_tab_context.h.

References m_footprintNameWhenLoaded.

◆ SetModified()

void FOOTPRINT_EDITOR_TAB_CONTEXT::SetModified ( bool aModified)
inline

◆ SetName()

void FOOTPRINT_EDITOR_TAB_CONTEXT::SetName ( const wxString & aName)
inline

Definition at line 108 of file footprint_editor_tab_context.h.

References m_name.

◆ SetOriginalFootprintCopy()

void FOOTPRINT_EDITOR_TAB_CONTEXT::SetOriginalFootprintCopy ( std::unique_ptr< FOOTPRINT > aCopy)

Definition at line 57 of file footprint_editor_tab_context.cpp.

References m_originalFootprintCopy.

◆ SetPreview()

void EDITOR_TAB_CONTEXT::SetPreview ( bool aPreview)
inlineinherited

Definition at line 59 of file editor_tab_context.h.

References m_preview.

◆ UndoList()

◆ ViewSnapshot()

VIEW_SNAPSHOT & EDITOR_TAB_CONTEXT::ViewSnapshot ( )
inlineinherited

Member Data Documentation

◆ m_board

std::unique_ptr<BOARD> FOOTPRINT_EDITOR_TAB_CONTEXT::m_board
private

◆ m_boardFootprintUuids

std::map<KIID, KIID> FOOTPRINT_EDITOR_TAB_CONTEXT::m_boardFootprintUuids
private

Definition at line 137 of file footprint_editor_tab_context.h.

Referenced by BoardFootprintUuids().

◆ m_footprintNameWhenLoaded

wxString FOOTPRINT_EDITOR_TAB_CONTEXT::m_footprintNameWhenLoaded
private

◆ m_fromBoard

bool FOOTPRINT_EDITOR_TAB_CONTEXT::m_fromBoard = false
private

Source board footprint UUID, used as the de-dup key and save-back target.

Definition at line 128 of file footprint_editor_tab_context.h.

Referenced by FOOTPRINT_EDITOR_TAB_CONTEXT(), GetDisplayName(), GetTabKey(), IsFromBoard(), and IsTransient().

◆ m_lib

wxString FOOTPRINT_EDITOR_TAB_CONTEXT::m_lib
private

Definition at line 120 of file footprint_editor_tab_context.h.

Referenced by FOOTPRINT_EDITOR_TAB_CONTEXT(), GetLib(), and GetTabKey().

◆ m_modified

bool FOOTPRINT_EDITOR_TAB_CONTEXT::m_modified = false
private

True for an instance tab edited in place from a placed board footprint.

Definition at line 125 of file footprint_editor_tab_context.h.

Referenced by IsModified(), and SetModified().

◆ m_name

wxString FOOTPRINT_EDITOR_TAB_CONTEXT::m_name
private

◆ m_originalFootprintCopy

std::unique_ptr<FOOTPRINT> FOOTPRINT_EDITOR_TAB_CONTEXT::m_originalFootprintCopy
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 FOOTPRINT_EDITOR_TAB_CONTEXT::m_reference
private

Editor-to-board UUID remap used to save instance edits back to the original board items.

Definition at line 134 of file footprint_editor_tab_context.h.

Referenced by FOOTPRINT_EDITOR_TAB_CONTEXT(), GetDisplayName(), and GetReference().

◆ 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_sourceUuid

KIID FOOTPRINT_EDITOR_TAB_CONTEXT::m_sourceUuid
private

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

Definition at line 131 of file footprint_editor_tab_context.h.

Referenced by FOOTPRINT_EDITOR_TAB_CONTEXT(), GetSourceUuid(), and GetTabKey().

◆ 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_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: