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

Composed widget that edits a symbol's named pin maps and the footprint each is bound to. More...

#include <panel_symbol_pin_map.h>

Inheritance diagram for PANEL_SYMBOL_PIN_MAP:
PANEL_SYMBOL_PIN_MAP_BASE

Public Member Functions

 PANEL_SYMBOL_PIN_MAP (wxWindow *aParent)
 
 ~PANEL_SYMBOL_PIN_MAP () override
 
void SetSymbol (LIB_SYMBOL *aSymbol)
 Load the editable state from aSymbol.
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
void ApplyToSymbol (LIB_SYMBOL *aSymbol)
 Write the edited pin maps and associations into aSymbol.
 
bool CommitPendingChanges ()
 Commit any in-progress grid cell edit;.
 
void ResetColumnToIdentity (int aCol)
 Set every cell in pad column aCol back to its row's symbol pin number (1:1).
 
void CopyColumn (int aSrcCol, int aDstCol)
 Copy every pad value from column aSrcCol into column aDstCol.
 
void RenameColumn (int aCol)
 Prompt for a new name for column aCol's map and update every reference to it.
 
wxString GetColumnMapName (int aCol) const
 
void ValidateCell (int aRow, int aCol)
 Re-evaluate the colour of pad cell (aRow, aCol) from its current contents.
 

Static Public Attributes

static constexpr int FIXED_COLS = 3
 Number of fixed leading columns (unit, pin number, pin name).
 

Protected Member Functions

void OnAddMap (wxCommandEvent &aEvent) override
 
void OnRemoveMap (wxCommandEvent &aEvent) override
 
void OnSizeGrid (wxSizeEvent &aEvent) override
 

Protected Attributes

WX_GRIDm_grid
 
STD_BITMAP_BUTTONm_addMapButton
 
STD_BITMAP_BUTTONm_removeMapButton
 

Private Member Functions

void onCellChanged (wxGridEvent &aEvent)
 
void onLabelDClick (wxGridEvent &aEvent)
 Double-clicking a map column's header opens its rename dialog.
 
void applyColumnFootprint (int aCol, const wxString &aFootprintId)
 Bind (or clear, when empty) the footprint entered in column aCol's footprint cell.
 
void rebuildGrid ()
 Rebuild the whole grid from the working model.
 
void adjustGridColumns ()
 Resize the pad columns to fill the available width.
 
void harvestGrid ()
 Read every pad cell back into the working pin maps.
 
void validateAllCells ()
 Re-evaluate the colour of every pad cell.
 
wxString makeUniqueMapName () const
 
const std::set< wxString > & padNumbersFor (const wxString &aFootprintId)
 

Private Attributes

LIB_SYMBOLm_symbol
 
std::vector< wxString > m_pinNumbers
 
PIN_MAP_SET m_pinMaps
 
std::vector< ASSOCIATED_FOOTPRINTm_associations
 
std::unique_ptr< PIN_MAP_GRID_TRICKSm_gridTricks
 
std::map< wxString, std::set< wxString > > m_footprintPads
 

Detailed Description

Composed widget that edits a symbol's named pin maps and the footprint each is bound to.

Each grid column is a named pin map. Row 0 binds a footprint to the map; the remaining rows are the symbol's logical pins, whose cells carry the pad each pin maps to. A cell left at its pin number is identity and is not stored. The leading columns (unit, number, name) are read-only.

Definition at line 44 of file panel_symbol_pin_map.h.

Constructor & Destructor Documentation

◆ PANEL_SYMBOL_PIN_MAP()

◆ ~PANEL_SYMBOL_PIN_MAP()

PANEL_SYMBOL_PIN_MAP::~PANEL_SYMBOL_PIN_MAP ( )
override

Definition at line 160 of file panel_symbol_pin_map.cpp.

References PANEL_SYMBOL_PIN_MAP_BASE::m_grid.

Member Function Documentation

◆ adjustGridColumns()

void PANEL_SYMBOL_PIN_MAP::adjustGridColumns ( )
private

Resize the pad columns to fill the available width.

Definition at line 580 of file panel_symbol_pin_map.cpp.

References FIXED_COLS, and PANEL_SYMBOL_PIN_MAP_BASE::m_grid.

Referenced by OnSizeGrid(), and rebuildGrid().

◆ applyColumnFootprint()

void PANEL_SYMBOL_PIN_MAP::applyColumnFootprint ( int aCol,
const wxString & aFootprintId )
private

Bind (or clear, when empty) the footprint entered in column aCol's footprint cell.

Definition at line 511 of file panel_symbol_pin_map.cpp.

References _, GetColumnMapName(), LIB_ID::GetUniStringLibId(), m_associations, ASSOCIATED_FOOTPRINT::m_FootprintLibId, PANEL_SYMBOL_PIN_MAP_BASE::m_grid, ASSOCIATED_FOOTPRINT::m_MapName, LIB_ID::Parse(), and ValidateCell().

Referenced by onCellChanged().

◆ ApplyToSymbol()

void PANEL_SYMBOL_PIN_MAP::ApplyToSymbol ( LIB_SYMBOL * aSymbol)

Write the edited pin maps and associations into aSymbol.

Provided so the host dialog can target a symbol other than the one used to populate the panel. Equivalent to TransferDataFromWindow() when given the same symbol.

Definition at line 215 of file panel_symbol_pin_map.cpp.

References harvestGrid(), m_associations, m_pinMaps, LIB_SYMBOL::SetAssociatedFootprints(), and LIB_SYMBOL::SetPinMaps().

Referenced by TransferDataFromWindow().

◆ CommitPendingChanges()

bool PANEL_SYMBOL_PIN_MAP::CommitPendingChanges ( )

Commit any in-progress grid cell edit;.

Returns
false if the edit is invalid. Call this for validation before the host snapshots the symbol for undo, then ApplyToSymbol() afterwards.

Definition at line 209 of file panel_symbol_pin_map.cpp.

References PANEL_SYMBOL_PIN_MAP_BASE::m_grid.

◆ CopyColumn()

void PANEL_SYMBOL_PIN_MAP::CopyColumn ( int aSrcCol,
int aDstCol )

Copy every pad value from column aSrcCol into column aDstCol.

Definition at line 448 of file panel_symbol_pin_map.cpp.

References PANEL_SYMBOL_PIN_MAP_BASE::m_grid, and ValidateCell().

◆ GetColumnMapName()

wxString PANEL_SYMBOL_PIN_MAP::GetColumnMapName ( int aCol) const
Returns
the map name shown for pad column aCol, for menu captions.

Definition at line 421 of file panel_symbol_pin_map.cpp.

References FIXED_COLS, index, and m_pinMaps.

Referenced by applyColumnFootprint(), and RenameColumn().

◆ harvestGrid()

void PANEL_SYMBOL_PIN_MAP::harvestGrid ( )
private

Read every pad cell back into the working pin maps.

Definition at line 605 of file panel_symbol_pin_map.cpp.

References PIN_MAP_SET::AddOrReplace(), FIXED_COLS, PANEL_SYMBOL_PIN_MAP_BASE::m_grid, m_pinMaps, m_pinNumbers, pad, and PIN_MAP::SetEntry().

Referenced by ApplyToSymbol(), OnAddMap(), OnRemoveMap(), and RenameColumn().

◆ makeUniqueMapName()

wxString PANEL_SYMBOL_PIN_MAP::makeUniqueMapName ( ) const
private
Returns
a map name not already used by m_pinMaps.

Definition at line 635 of file panel_symbol_pin_map.cpp.

References m_pinMaps.

Referenced by OnAddMap().

◆ OnAddMap()

void PANEL_SYMBOL_PIN_MAP::OnAddMap ( wxCommandEvent & aEvent)
overrideprotectedvirtual

◆ onCellChanged()

void PANEL_SYMBOL_PIN_MAP::onCellChanged ( wxGridEvent & aEvent)
private

◆ onLabelDClick()

void PANEL_SYMBOL_PIN_MAP::onLabelDClick ( wxGridEvent & aEvent)
private

Double-clicking a map column's header opens its rename dialog.

Definition at line 412 of file panel_symbol_pin_map.cpp.

References FIXED_COLS, and RenameColumn().

Referenced by PANEL_SYMBOL_PIN_MAP().

◆ OnRemoveMap()

void PANEL_SYMBOL_PIN_MAP::OnRemoveMap ( wxCommandEvent & aEvent)
overrideprotectedvirtual

◆ OnSizeGrid()

void PANEL_SYMBOL_PIN_MAP::OnSizeGrid ( wxSizeEvent & aEvent)
overrideprotectedvirtual

Reimplemented from PANEL_SYMBOL_PIN_MAP_BASE.

Definition at line 745 of file panel_symbol_pin_map.cpp.

References adjustGridColumns().

◆ padNumbersFor()

const std::set< wxString > & PANEL_SYMBOL_PIN_MAP::padNumbersFor ( const wxString & aFootprintId)
private
Returns
the pad number strings of aFootprintId.

Definition at line 649 of file panel_symbol_pin_map.cpp.

References KIWAY::FACE_CVPCB, KIFACE_FOOTPRINT_PAD_NUMBERS, and m_footprintPads.

Referenced by ValidateCell().

◆ rebuildGrid()

void PANEL_SYMBOL_PIN_MAP::rebuildGrid ( )
private

◆ RenameColumn()

void PANEL_SYMBOL_PIN_MAP::RenameColumn ( int aCol)

Prompt for a new name for column aCol's map and update every reference to it.

Definition at line 469 of file panel_symbol_pin_map.cpp.

References _, GetColumnMapName(), harvestGrid(), m_associations, PANEL_SYMBOL_PIN_MAP_BASE::m_grid, m_pinMaps, and rebuildGrid().

Referenced by onLabelDClick().

◆ ResetColumnToIdentity()

void PANEL_SYMBOL_PIN_MAP::ResetColumnToIdentity ( int aCol)

Set every cell in pad column aCol back to its row's symbol pin number (1:1).

Definition at line 433 of file panel_symbol_pin_map.cpp.

References PANEL_SYMBOL_PIN_MAP_BASE::m_grid, and ValidateCell().

◆ SetSymbol()

void PANEL_SYMBOL_PIN_MAP::SetSymbol ( LIB_SYMBOL * aSymbol)

Load the editable state from aSymbol.

The symbol is not retained; only its pin list, pin maps and associated footprints are copied into the working model.

Definition at line 166 of file panel_symbol_pin_map.cpp.

References m_associations, m_pinMaps, m_pinNumbers, and m_symbol.

◆ TransferDataFromWindow()

bool PANEL_SYMBOL_PIN_MAP::TransferDataFromWindow ( )
override

◆ TransferDataToWindow()

bool PANEL_SYMBOL_PIN_MAP::TransferDataToWindow ( )
override

Definition at line 190 of file panel_symbol_pin_map.cpp.

References rebuildGrid().

◆ validateAllCells()

void PANEL_SYMBOL_PIN_MAP::validateAllCells ( )
private

Re-evaluate the colour of every pad cell.

Definition at line 327 of file panel_symbol_pin_map.cpp.

References FIXED_COLS, PANEL_SYMBOL_PIN_MAP_BASE::m_grid, and ValidateCell().

Referenced by rebuildGrid().

◆ ValidateCell()

void PANEL_SYMBOL_PIN_MAP::ValidateCell ( int aRow,
int aCol )

Member Data Documentation

◆ FIXED_COLS

int PANEL_SYMBOL_PIN_MAP::FIXED_COLS = 3
staticconstexpr

◆ m_addMapButton

STD_BITMAP_BUTTON* PANEL_SYMBOL_PIN_MAP_BASE::m_addMapButton
protectedinherited

◆ m_associations

std::vector<ASSOCIATED_FOOTPRINT> PANEL_SYMBOL_PIN_MAP::m_associations
private

◆ m_footprintPads

std::map<wxString, std::set<wxString> > PANEL_SYMBOL_PIN_MAP::m_footprintPads
private

Definition at line 129 of file panel_symbol_pin_map.h.

Referenced by padNumbersFor().

◆ m_grid

◆ m_gridTricks

std::unique_ptr<PIN_MAP_GRID_TRICKS> PANEL_SYMBOL_PIN_MAP::m_gridTricks
private

Definition at line 128 of file panel_symbol_pin_map.h.

Referenced by PANEL_SYMBOL_PIN_MAP().

◆ m_pinMaps

◆ m_pinNumbers

std::vector<wxString> PANEL_SYMBOL_PIN_MAP::m_pinNumbers
private

Definition at line 125 of file panel_symbol_pin_map.h.

Referenced by harvestGrid(), rebuildGrid(), and SetSymbol().

◆ m_removeMapButton

STD_BITMAP_BUTTON* PANEL_SYMBOL_PIN_MAP_BASE::m_removeMapButton
protectedinherited

◆ m_symbol

LIB_SYMBOL* PANEL_SYMBOL_PIN_MAP::m_symbol
private

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