KiCad PCB EDA Suite
Loading...
Searching...
No Matches
FIELDS_TABLE_DATA_MODEL< ITEM_TYPE > Class Template Referenceabstract

The rest of the generic fields data model stuff, primarily around row functionality. More...

#include <fields_table_data_model.h>

Inheritance diagram for FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >:
FIELDS_TABLE_DATA_MODEL_BASE WX_GRID_TABLE_BASE

Public Member Functions

void AddColumn (const wxString &aFieldName, const wxString &aLabel, bool aAddedByUser) override
 
void ClearCell (int aRow, int aCol) override
 Clears the field from the data store, rather than setting its value to an empty string.
 
bool IsCellClear (int aRow, int aCol) override
 Returns true if the cell is not present in the data store for any item in the row, not just empty.
 
bool IsCellEdited (int aRow, int aCol) override
 Returns true if the cell has been modified from the live value in any item in the row (symbol/footprint/etc).
 
int GetNumberRows () override
 
ROW_STATE GetRowState (int aRow) const override
 
std::vector< KIID_PATHGetRowItemKeys (int aRow) const override
 Return the stable data-store keys of every item represented by a row.
 
std::vector< ITEM_TYPE > GetRowReferences (int aRow) const
 
void RevertRow (int aRow) override
 Go through and revert all the fields in the row to their live values from the item (symbol/footprint/etc).
 
void ExpandRow (int aRow)
 
void CollapseRow (int aRow)
 
void ExpandCollapseRow (int aRow) override
 
void CollapseForSort ()
 
void ExpandAfterSort ()
 
wxString GetGroupedValue (const DATA_MODEL_ROW< ITEM_TYPE > &aRow, int aCol, const wxString &refDelimiter=wxT(", "), const wxString &refRangeDelimiter=wxT("-"), bool resolveVars=false, bool listMixedValues=false)
 
wxString GetValue (int aRow, int aCol) override
 
wxString GetResolvedValue (int aRow, int aCol) override
 
wxString GetExportValue (int aRow, int aCol, const wxString &refDelimiter, const wxString &refRangeDelimiter) override
 
bool IsCellReadOnly (int aRow, int aCol) override
 
virtual KIID_PATH getDataStoreKey (const ITEM_TYPE &aItem) const =0
 
virtual wxString getItemIdentifier (const ITEM_TYPE &aItem) const =0
 
virtual wxString getFieldResolvedLiveValue (const ITEM_TYPE &aItem, const wxString &aFieldName)=0
 Explicitly bypasses the data store's field values and retries them from the item's current field value on the editing canvas.
 
virtual wxString resolveTextVars (const ITEM_TYPE &aItem, const wxString &aText)=0
 
bool IsEdited ()
 
void MoveColumn (int aCol, int aNewPos)
 
void RemoveColumn (int aCol)
 
void RenameColumn (int aCol, const wxString &newName)
 
int GetNumberCols () override
 
void SetColLabelValue (int aCol, const wxString &aLabel) override
 
wxString GetColLabelValue (int aCol) override
 
wxString GetColFieldName (int aCol)
 
int GetColDataWidth (int aCol)
 
int GetFieldNameCol (const wxString &aFieldName) const
 
std::vector< BOM_FIELDGetFieldsOrdered ()
 
void SetFieldsOrder (const std::vector< wxString > &aNewOrder)
 
bool IsEmptyCell (int aRow, int aCol) override
 
bool ColIsReference (int aCol) const
 
bool ColIsQuantity (int aCol) const
 
bool ColIsItemNumber (int aCol) const
 
bool ColIsValue (int aCol) const
 
bool ColIsFootprint (int aCol) const
 
bool ColIsAttribute (int aCol) const
 
bool ColIsItemProperty (int aCol) const
 
bool ColIsComputed (int aCol) const
 
virtual bool ColIsItemIdentifier (int aCol) const
 Reference for symbol/fields tables, lib_id for lib tables.
 
virtual bool ColIsReadOnly (int aCol) const
 
bool IsExpanderColumn (int aCol) const override
 
void SetSorting (int aCol, bool aAscending)
 
int GetSortCol ()
 
bool GetSortAsc ()
 
void EnableRebuilds ()
 
void DisableRebuilds ()
 
virtual void RebuildRows ()=0
 
void SetFilter (const wxString &aFilter)
 
const wxString & GetFilter ()
 
void SetFilterScope (BOM_FILTER_SCOPE aScope)
 
BOM_FILTER_SCOPE GetFilterScope () const
 
void SetSelectionItems (const std::unordered_set< KIID_PATH > &aItems)
 
void ClearSelectionItems ()
 
void SetGroupingEnabled (bool aGroup)
 
bool GetGroupingEnabled ()
 
void SetIncludeExcludedFromBOM (bool aInclude)
 
bool GetIncludeExcludedFromBOM ()
 
void SetExcludeDNP (bool aExclude)
 
bool GetExcludeDNP ()
 
void SetGroupColumn (int aCol, bool aGroup)
 
bool GetGroupColumn (int aCol)
 
void SetShowColumn (int aCol, bool aShow)
 
bool GetShowColumn (int aCol)
 
void ApplyBomPreset (const BOM_PRESET &aPreset)
 
BOM_PRESET GetBomSettings ()
 
wxString Export (const BOM_FMT_PRESET &aSettings)
 
bool CanClearCell (int aRow, int aCol)
 
bool IsRowEdited (int aRow)
 Return true if any cell in the row has been edited.
 
void SetCurrentVariant (const wxString &aVariantName)
 Set the current variant name for highlighting purposes.
 
const wxString & GetCurrentVariant () const
 
void SetVariantNames (const std::vector< wxString > &aVariantNames)
 
const std::vector< wxString > & GetVariantNames () const
 
bool HasUndoStateSerialization () const override
 Optional identity-based serialization for the host dialog's Ctrl+Z/Ctrl+Y.
 
wxString SerializeUndoState () const override
 
void RestoreUndoState (const wxString &aState) override
 
void SetColAttr (wxGridCellAttr *aAttr, int aCol) override
 
wxGridCellAttr * GetAttr (int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind) override
 
void Clear () override
 

Static Public Attributes

static const wxString QUANTITY_VARIABLE = wxS( "${QUANTITY}" )
 
static const wxString ITEM_NUMBER_VARIABLE = wxS( "${ITEM_NUMBER}" )
 

Protected Member Functions

bool MatchesFilter (const ITEM_TYPE &aItem, const wxString &aReference, EDA_COMBINED_MATCHER &aMatcher)
 
virtual bool attributeForcedOnBySheet (const ITEM_TYPE &aItem, const wxString &aAttributeName) const
 Sheets can force all the symbols in them to have certain attributes on, like DNP.
 
bool allRowItemsHaveAttributeForcedOnBySheet (const DATA_MODEL_ROW< ITEM_TYPE > &aRow, int aCol)
 
bool cmpRows (const DATA_MODEL_ROW< ITEM_TYPE > &lhRow, const DATA_MODEL_ROW< ITEM_TYPE > &rhRow, int aSortCol, bool aAscending)
 
virtual bool cmpRowItems (const ITEM_TYPE &lhItem, const ITEM_TYPE &rhItem)
 
virtual bool unitMatch (const ITEM_TYPE &lhItem, const ITEM_TYPE &rhItem)=0
 
bool groupMatch (const ITEM_TYPE &lhItem, const ITEM_TYPE &rhItem)
 
void Sort ()
 
virtual bool getLiveFieldValue (const ITEM_TYPE &aItem, const wxString &aFieldName, wxString &aValue)=0
 Gets the current value of the field from the live item, e.g.
 
const std::map< wxString, wxString > & getStoredFields (const ITEM_TYPE &aItem) const
 Returns all stored fields for an item without creating a data-store entry.
 
bool getStoredFieldValue (const ITEM_TYPE &aItem, const wxString &aFieldName, wxString &aValue) const
 Gets the stored value of the field from the data store, not from the live item, e.g.
 
void setStoredFieldValue (const ITEM_TYPE &aItem, const wxString &aFieldName, const wxString &aValue)
 Creates or updates a field in the data store.
 
void ensureStoredFieldPresent (const ITEM_TYPE &aItem, const wxString &aFieldName)
 Makes sure a field is at least marked present-but-empty without changing its value if it has one already.
 
void clearStoredField (const ITEM_TYPE &aItem, const wxString &aFieldName)
 Clears a field, e.g.
 
bool fieldIsModified (const ITEM_TYPE &aItem, const wxString &aFieldName)
 Compares the live value of the field to the stored value in the data store.
 
void updateDataStoreItemFieldFromLive (const ITEM_TYPE &aItem, const wxString &aFieldName)
 Updates the data store with the current value of the field from the live item.
 
void initializeDataStoreItemField (const ITEM_TYPE &aItem, const DATA_MODEL_COL &aCol)
 Puts the live value of the field in the data store, correctly handling a missing field in the souce item as empty or not-present based on whether the col was added by the user.
 
void initializeDataStoreItem (const ITEM_TYPE &aItem)
 Initializes every column in the data store for a newly added (or refreshed) item.
 
virtual std::vector< ITEM_TYPE > getAllItems () const =0
 
virtual bool fieldIsAttribute (const wxString &aFieldName) const
 
virtual bool fieldIsItemProperty (const wxString &aFieldName) const
 
virtual wxString getAttributeResolvedValue (const wxString &aFieldName, bool aValue) const
 
bool cellUsesResolvedTextRenderer (int aRow, int aCol)
 
void applyResolvedTextRenderer (wxGridCellAttr *aAttr, bool aApplyTint)
 
bool cellUsesUrlEditor (int aRow, int aCol)
 
wxGridCellAttr * cloneUrlEditorAttr ()
 
wxGridCellAttr * applyCellDecorations (wxGridCellAttr *aAttr, int aRow, int aCol)
 
wxGridCellAttr * applyFieldPresenceRenderer (wxGridCellAttr *aAttr, int aRow, int aCol)
 
void commitPendingGridChanges ()
 
wxGridCellAttr * enhanceAttr (wxGridCellAttr *aInputAttr, int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind)
 

Protected Attributes

std::vector< DATA_MODEL_ROW< ITEM_TYPE > > m_rows
 
wxGridCellRenderer * m_stripedRenderer
 
wxGridCellRenderer * m_resolvedTextRenderer
 
bool m_edited
 
int m_sortColumn
 
bool m_sortAscending
 
wxString m_filter
 
BOM_FILTER_SCOPE m_filterScope
 
bool m_groupingEnabled
 
bool m_excludeDNP
 
bool m_includeExcluded
 
bool m_rebuildsEnabled
 Items included by the user selection scope.
 
std::unordered_set< KIID_PATHm_selectionItems
 
wxString m_currentVariant
 Current variant name for highlighting.
 
std::vector< wxString > m_variantNames
 Variant names for multi-variant DNP filtering.
 
std::vector< DATA_MODEL_COLm_cols
 
std::map< KIID_PATH, std::map< wxString, wxString > > m_dataStore
 
std::map< int, wxGridCellAttr * > m_colAttrs
 

Detailed Description

template<typename ITEM_TYPE>
class FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >

The rest of the generic fields data model stuff, primarily around row functionality.

Templated because rows differ per model, e.g. SCH_REFERENCE for the schematic fields table.

Definition at line 357 of file fields_table_data_model.h.

Member Function Documentation

◆ AddColumn()

◆ allRowItemsHaveAttributeForcedOnBySheet()

template<typename ITEM_TYPE>
bool FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::allRowItemsHaveAttributeForcedOnBySheet ( const DATA_MODEL_ROW< ITEM_TYPE > & aRow,
int aCol )
inlineprotected

◆ ApplyBomPreset()

◆ applyCellDecorations()

wxGridCellAttr * FIELDS_TABLE_DATA_MODEL_BASE::applyCellDecorations ( wxGridCellAttr * aAttr,
int aRow,
int aCol )
protectedinherited

Definition at line 188 of file fields_table_data_model.cpp.

References applyFieldPresenceRenderer(), and grid.

◆ applyFieldPresenceRenderer()

wxGridCellAttr * FIELDS_TABLE_DATA_MODEL_BASE::applyFieldPresenceRenderer ( wxGridCellAttr * aAttr,
int aRow,
int aCol )
protectedinherited

Definition at line 164 of file fields_table_data_model.cpp.

References ColIsAttribute(), and IsCellClear().

Referenced by applyCellDecorations().

◆ applyResolvedTextRenderer()

void FIELDS_TABLE_DATA_MODEL_BASE::applyResolvedTextRenderer ( wxGridCellAttr * aAttr,
bool aApplyTint )
protectedinherited

◆ attributeForcedOnBySheet()

template<typename ITEM_TYPE>
virtual bool FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::attributeForcedOnBySheet ( const ITEM_TYPE & aItem,
const wxString & aAttributeName ) const
inlineprotectedvirtual

Sheets can force all the symbols in them to have certain attributes on, like DNP.

They can't force them off.

Returns true if the attribute is forced on by a sheet

Reimplemented in FOOTPRINT_FIELDS_EDITOR_GRID_DATA_MODEL, and SYMBOL_FIELDS_EDITOR_GRID_DATA_MODEL.

Definition at line 811 of file fields_table_data_model.h.

Referenced by allRowItemsHaveAttributeForcedOnBySheet(), GetGroupedValue(), groupMatch(), and MatchesFilter().

◆ CanClearCell()

bool FIELDS_TABLE_DATA_MODEL_BASE::CanClearCell ( int aRow,
int aCol )
inherited

◆ cellUsesResolvedTextRenderer()

bool FIELDS_TABLE_DATA_MODEL_BASE::cellUsesResolvedTextRenderer ( int aRow,
int aCol )
protectedinherited

◆ cellUsesUrlEditor()

bool FIELDS_TABLE_DATA_MODEL_BASE::cellUsesUrlEditor ( int aRow,
int aCol )
protectedinherited

Definition at line 133 of file fields_table_data_model.cpp.

◆ Clear()

void WX_GRID_TABLE_BASE::Clear ( )
inlineoverrideinherited

Definition at line 97 of file wx_grid.h.

◆ ClearCell()

template<typename ITEM_TYPE>
void FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::ClearCell ( int aRow,
int aCol )
inlineoverridevirtual

Clears the field from the data store, rather than setting its value to an empty string.

Implements FIELDS_TABLE_DATA_MODEL_BASE.

Reimplemented in SYMBOL_FIELDS_EDITOR_GRID_DATA_MODEL.

Definition at line 388 of file fields_table_data_model.h.

References FIELDS_TABLE_DATA_MODEL_BASE::CanClearCell(), clearStoredField(), FIELDS_TABLE_DATA_MODEL_BASE::m_cols, FIELDS_TABLE_DATA_MODEL_BASE::m_edited, and m_rows.

◆ ClearSelectionItems()

void FIELDS_TABLE_DATA_MODEL_BASE::ClearSelectionItems ( )
inlineinherited

Definition at line 195 of file fields_table_data_model.h.

References m_selectionItems.

◆ clearStoredField()

template<typename ITEM_TYPE>
void FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::clearStoredField ( const ITEM_TYPE & aItem,
const wxString & aFieldName )
inlineprotected

Clears a field, e.g.

marks in not-present (as opposed to an empty string)

Definition at line 1054 of file fields_table_data_model.h.

References getDataStoreKey(), and FIELDS_TABLE_DATA_MODEL_BASE::m_dataStore.

Referenced by ClearCell(), and updateDataStoreItemFieldFromLive().

◆ cloneUrlEditorAttr()

wxGridCellAttr * FIELDS_TABLE_DATA_MODEL_BASE::cloneUrlEditorAttr ( )
protectedinherited

Definition at line 152 of file fields_table_data_model.cpp.

◆ cmpRowItems()

template<typename ITEM_TYPE>
virtual bool FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::cmpRowItems ( const ITEM_TYPE & lhItem,
const ITEM_TYPE & rhItem )
inlineprotectedvirtual

Definition at line 878 of file fields_table_data_model.h.

References getItemIdentifier(), and StrNumCmp().

Referenced by cmpRows().

◆ cmpRows()

template<typename ITEM_TYPE>
bool FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::cmpRows ( const DATA_MODEL_ROW< ITEM_TYPE > & lhRow,
const DATA_MODEL_ROW< ITEM_TYPE > & rhRow,
int aSortCol,
bool aAscending )
inlineprotected

◆ ColIsAttribute()

◆ ColIsComputed()

◆ ColIsFootprint()

bool FIELDS_TABLE_DATA_MODEL_BASE::ColIsFootprint ( int aCol) const
inherited

Definition at line 431 of file fields_table_data_model.cpp.

References FOOTPRINT, GetDefaultFieldName(), m_cols, and UNTRANSLATED.

◆ ColIsItemIdentifier()

virtual bool FIELDS_TABLE_DATA_MODEL_BASE::ColIsItemIdentifier ( int aCol) const
inlinevirtualinherited

◆ ColIsItemNumber()

bool FIELDS_TABLE_DATA_MODEL_BASE::ColIsItemNumber ( int aCol) const
inherited

◆ ColIsItemProperty()

bool FIELDS_TABLE_DATA_MODEL_BASE::ColIsItemProperty ( int aCol) const
inherited

Definition at line 446 of file fields_table_data_model.cpp.

References fieldIsItemProperty(), and m_cols.

Referenced by ColIsComputed().

◆ ColIsQuantity()

bool FIELDS_TABLE_DATA_MODEL_BASE::ColIsQuantity ( int aCol) const
inherited

◆ ColIsReadOnly()

bool FIELDS_TABLE_DATA_MODEL_BASE::ColIsReadOnly ( int aCol) const
virtualinherited

◆ ColIsReference()

bool FIELDS_TABLE_DATA_MODEL_BASE::ColIsReference ( int aCol) const
inherited

◆ ColIsValue()

bool FIELDS_TABLE_DATA_MODEL_BASE::ColIsValue ( int aCol) const
inherited

Definition at line 424 of file fields_table_data_model.cpp.

References GetDefaultFieldName(), m_cols, UNTRANSLATED, and VALUE.

◆ CollapseForSort()

template<typename ITEM_TYPE>
void FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::CollapseForSort ( )
inline

Definition at line 572 of file fields_table_data_model.h.

References CollapseRow(), and m_rows.

Referenced by Sort().

◆ CollapseRow()

template<typename ITEM_TYPE>
void FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::CollapseRow ( int aRow)
inline

Definition at line 543 of file fields_table_data_model.h.

References m_rows.

Referenced by CollapseForSort(), and ExpandCollapseRow().

◆ commitPendingGridChanges()

void FIELDS_TABLE_DATA_MODEL_BASE::commitPendingGridChanges ( )
protectedinherited

◆ DisableRebuilds()

void FIELDS_TABLE_DATA_MODEL_BASE::DisableRebuilds ( )
inherited

Definition at line 544 of file fields_table_data_model.cpp.

References m_rebuildsEnabled.

Referenced by DIALOG_FIELDS_TABLE::doApplyBomPreset().

◆ EnableRebuilds()

void FIELDS_TABLE_DATA_MODEL_BASE::EnableRebuilds ( )
inherited

Definition at line 538 of file fields_table_data_model.cpp.

References m_rebuildsEnabled.

Referenced by DIALOG_FIELDS_TABLE::doApplyBomPreset().

◆ enhanceAttr()

wxGridCellAttr * WX_GRID_TABLE_BASE::enhanceAttr ( wxGridCellAttr * aInputAttr,
int aRow,
int aCol,
wxGridCellAttr::wxAttrKind aKind )
protectedinherited

◆ ensureStoredFieldPresent()

template<typename ITEM_TYPE>
void FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::ensureStoredFieldPresent ( const ITEM_TYPE & aItem,
const wxString & aFieldName )
inlineprotected

Makes sure a field is at least marked present-but-empty without changing its value if it has one already.

Definition at line 1046 of file fields_table_data_model.h.

References getDataStoreKey(), and FIELDS_TABLE_DATA_MODEL_BASE::m_dataStore.

Referenced by initializeDataStoreItemField().

◆ ExpandAfterSort()

template<typename ITEM_TYPE>
void FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::ExpandAfterSort ( )
inline

Definition at line 585 of file fields_table_data_model.h.

References ExpandRow(), and m_rows.

Referenced by Sort().

◆ ExpandCollapseRow()

template<typename ITEM_TYPE>
void FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::ExpandCollapseRow ( int aRow)
inlineoverridevirtual

Implements FIELDS_TABLE_DATA_MODEL_BASE.

Definition at line 563 of file fields_table_data_model.h.

References CollapseRow(), ExpandRow(), and m_rows.

◆ ExpandRow()

template<typename ITEM_TYPE>
void FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::ExpandRow ( int aRow)
inline

Definition at line 500 of file fields_table_data_model.h.

References m_rows, and unitMatch().

Referenced by ExpandAfterSort(), and ExpandCollapseRow().

◆ Export()

◆ fieldIsAttribute()

bool FIELDS_TABLE_DATA_MODEL_BASE::fieldIsAttribute ( const wxString & aFieldName) const
protectedvirtualinherited

◆ fieldIsItemProperty()

bool FIELDS_TABLE_DATA_MODEL_BASE::fieldIsItemProperty ( const wxString & aFieldName) const
protectedvirtualinherited

◆ fieldIsModified()

template<typename ITEM_TYPE>
bool FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::fieldIsModified ( const ITEM_TYPE & aItem,
const wxString & aFieldName )
inlineprotected

Compares the live value of the field to the stored value in the data store.

If they differ in presence or value then the field has been modified

Definition at line 1067 of file fields_table_data_model.h.

References getLiveFieldValue(), and getStoredFieldValue().

Referenced by IsCellEdited(), and RevertRow().

◆ getAllItems()

template<typename ITEM_TYPE>
virtual std::vector< ITEM_TYPE > FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::getAllItems ( ) const
protectedpure virtual

◆ GetAttr()

wxGridCellAttr * WX_GRID_TABLE_BASE::GetAttr ( int aRow,
int aCol,
wxGridCellAttr::wxAttrKind aKind )
inlineoverrideinherited

◆ getAttributeResolvedValue()

wxString FIELDS_TABLE_DATA_MODEL_BASE::getAttributeResolvedValue ( const wxString & aFieldName,
bool aValue ) const
protectedvirtualinherited

◆ GetBomSettings()

◆ GetColDataWidth()

int FIELDS_TABLE_DATA_MODEL_BASE::GetColDataWidth ( int aCol)
inherited

◆ GetColFieldName()

wxString FIELDS_TABLE_DATA_MODEL_BASE::GetColFieldName ( int aCol)
inherited

Definition at line 338 of file fields_table_data_model.cpp.

References m_cols.

Referenced by GetBomSettings().

◆ GetColLabelValue()

wxString FIELDS_TABLE_DATA_MODEL_BASE::GetColLabelValue ( int aCol)
overrideinherited

Definition at line 331 of file fields_table_data_model.cpp.

References m_cols.

Referenced by DIALOG_FIELDS_TABLE::doApplyBomPreset(), and GetColDataWidth().

◆ GetCurrentVariant()

const wxString & FIELDS_TABLE_DATA_MODEL_BASE::GetCurrentVariant ( ) const
inlineinherited

Definition at line 244 of file fields_table_data_model.h.

References m_currentVariant.

◆ getDataStoreKey()

template<typename ITEM_TYPE>
virtual KIID_PATH FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::getDataStoreKey ( const ITEM_TYPE & aItem) const
pure virtual

◆ GetExcludeDNP()

bool FIELDS_TABLE_DATA_MODEL_BASE::GetExcludeDNP ( )
inlineinherited

Definition at line 208 of file fields_table_data_model.h.

References m_excludeDNP.

Referenced by GetBomSettings().

◆ GetExportValue()

template<typename ITEM_TYPE>
wxString FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::GetExportValue ( int aRow,
int aCol,
const wxString & refDelimiter,
const wxString & refRangeDelimiter )
inlineoverridevirtual

Implements FIELDS_TABLE_DATA_MODEL_BASE.

Definition at line 733 of file fields_table_data_model.h.

References GetGroupedValue(), and m_rows.

◆ GetFieldNameCol()

◆ getFieldResolvedLiveValue()

template<typename ITEM_TYPE>
virtual wxString FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::getFieldResolvedLiveValue ( const ITEM_TYPE & aItem,
const wxString & aFieldName )
pure virtual

Explicitly bypasses the data store's field values and retries them from the item's current field value on the editing canvas.

Will also handle generated fields as necessary. Returns empty string for private/missing fields.

Example: BOM template provides ${DNP} as a field, but they symbol doesn't have the field.

Returns
Resolved display text for the field's live value from the canvas.

Implemented in FOOTPRINT_FIELDS_EDITOR_GRID_DATA_MODEL, LIB_FIELDS_EDITOR_GRID_DATA_MODEL, and SYMBOL_FIELDS_EDITOR_GRID_DATA_MODEL.

Referenced by GetGroupedValue(), groupMatch(), and MatchesFilter().

◆ GetFieldsOrdered()

std::vector< BOM_FIELD > FIELDS_TABLE_DATA_MODEL_BASE::GetFieldsOrdered ( )
inherited

◆ GetFilter()

const wxString & FIELDS_TABLE_DATA_MODEL_BASE::GetFilter ( )
inlineinherited

Definition at line 190 of file fields_table_data_model.h.

References m_filter.

Referenced by GetBomSettings().

◆ GetFilterScope()

BOM_FILTER_SCOPE FIELDS_TABLE_DATA_MODEL_BASE::GetFilterScope ( ) const
inlineinherited

Definition at line 192 of file fields_table_data_model.h.

References m_filterScope.

Referenced by GetBomSettings().

◆ GetGroupColumn()

bool FIELDS_TABLE_DATA_MODEL_BASE::GetGroupColumn ( int aCol)
inherited

Definition at line 561 of file fields_table_data_model.cpp.

References m_cols.

Referenced by DIALOG_FIELDS_TABLE::doApplyBomPreset().

◆ GetGroupedValue()

◆ GetGroupingEnabled()

bool FIELDS_TABLE_DATA_MODEL_BASE::GetGroupingEnabled ( )
inlineinherited

Definition at line 198 of file fields_table_data_model.h.

References m_groupingEnabled.

Referenced by GetBomSettings().

◆ GetIncludeExcludedFromBOM()

bool FIELDS_TABLE_DATA_MODEL_BASE::GetIncludeExcludedFromBOM ( )
inlineinherited

Definition at line 205 of file fields_table_data_model.h.

References m_includeExcluded.

Referenced by GetBomSettings(), and DIALOG_FIELDS_TABLE::PreviewRefresh().

◆ getItemIdentifier()

template<typename ITEM_TYPE>
virtual wxString FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::getItemIdentifier ( const ITEM_TYPE & aItem) const
pure virtual

◆ getLiveFieldValue()

template<typename ITEM_TYPE>
virtual bool FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::getLiveFieldValue ( const ITEM_TYPE & aItem,
const wxString & aFieldName,
wxString & aValue )
protectedpure virtual

Gets the current value of the field from the live item, e.g.

from the symbol on the schematic.

Returns
True if the field is present in the live item, false if it is not present (and aValue will be empty).

Implemented in FOOTPRINT_FIELDS_EDITOR_GRID_DATA_MODEL, LIB_FIELDS_EDITOR_GRID_DATA_MODEL, LIB_FOOTPRINT_FIELDS_EDITOR_GRID_DATA_MODEL, and SYMBOL_FIELDS_EDITOR_GRID_DATA_MODEL.

Referenced by fieldIsModified(), and updateDataStoreItemFieldFromLive().

◆ GetNumberCols()

◆ GetNumberRows()

template<typename ITEM_TYPE>
int FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::GetNumberRows ( )
inlineoverride

Definition at line 445 of file fields_table_data_model.h.

References m_rows.

Referenced by GetValue().

◆ GetResolvedValue()

template<typename ITEM_TYPE>
wxString FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::GetResolvedValue ( int aRow,
int aCol )
inlineoverridevirtual

Implements FIELDS_TABLE_DATA_MODEL_BASE.

Definition at line 728 of file fields_table_data_model.h.

References GetGroupedValue(), and m_rows.

◆ GetRowItemKeys()

template<typename ITEM_TYPE>
std::vector< KIID_PATH > FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::GetRowItemKeys ( int aRow) const
inlineoverridevirtual

Return the stable data-store keys of every item represented by a row.

Implements FIELDS_TABLE_DATA_MODEL_BASE.

Definition at line 449 of file fields_table_data_model.h.

References getDataStoreKey(), and m_rows.

◆ GetRowReferences()

template<typename ITEM_TYPE>
std::vector< ITEM_TYPE > FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::GetRowReferences ( int aRow) const
inline

Definition at line 462 of file fields_table_data_model.h.

References m_rows.

◆ GetRowState()

template<typename ITEM_TYPE>
ROW_STATE FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::GetRowState ( int aRow) const
inlineoverridevirtual

Reimplemented from WX_GRID_TABLE_BASE.

Definition at line 446 of file fields_table_data_model.h.

References m_rows, and ROW_STATE::ROW_STATE.

◆ GetShowColumn()

bool FIELDS_TABLE_DATA_MODEL_BASE::GetShowColumn ( int aCol)
inherited

Definition at line 575 of file fields_table_data_model.cpp.

References m_cols.

Referenced by DIALOG_FIELDS_TABLE::doApplyBomPreset().

◆ GetSortAsc()

bool FIELDS_TABLE_DATA_MODEL_BASE::GetSortAsc ( )
inlineinherited

◆ GetSortCol()

int FIELDS_TABLE_DATA_MODEL_BASE::GetSortCol ( )
inlineinherited

Definition at line 180 of file fields_table_data_model.h.

References m_sortColumn.

Referenced by GetBomSettings().

◆ getStoredFields()

template<typename ITEM_TYPE>
const std::map< wxString, wxString > & FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::getStoredFields ( const ITEM_TYPE & aItem) const
inlineprotected

Returns all stored fields for an item without creating a data-store entry.

Definition at line 1001 of file fields_table_data_model.h.

References getDataStoreKey(), and FIELDS_TABLE_DATA_MODEL_BASE::m_dataStore.

Referenced by getStoredFieldValue().

◆ getStoredFieldValue()

template<typename ITEM_TYPE>
bool FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::getStoredFieldValue ( const ITEM_TYPE & aItem,
const wxString & aFieldName,
wxString & aValue ) const
inlineprotected

Gets the stored value of the field from the data store, not from the live item, e.g.

from the symbol on the schematic.

Returns
True if the field is present in the data store, false if it is not present (and aValue will be empty).

Definition at line 1019 of file fields_table_data_model.h.

References getStoredFields().

Referenced by fieldIsModified(), GetGroupedValue(), groupMatch(), IsCellClear(), and MatchesFilter().

◆ GetValue()

template<typename ITEM_TYPE>
wxString FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::GetValue ( int aRow,
int aCol )
inlineoverride

◆ GetVariantNames()

const std::vector< wxString > & FIELDS_TABLE_DATA_MODEL_BASE::GetVariantNames ( ) const
inlineinherited

Definition at line 247 of file fields_table_data_model.h.

References m_variantNames.

◆ groupMatch()

◆ HasUndoStateSerialization()

bool FIELDS_TABLE_DATA_MODEL_BASE::HasUndoStateSerialization ( ) const
inlineoverridevirtualinherited

Optional identity-based serialization for the host dialog's Ctrl+Z/Ctrl+Y.

The dialog's generic grid undo snapshots cells by (row, col) position, which is wrong for tables whose rows can regroup/sort/reorder. A table that returns true here is asked to serialize and restore its own state by stable identity instead.

Reimplemented from WX_GRID_TABLE_BASE.

Definition at line 251 of file fields_table_data_model.h.

◆ initializeDataStoreItem()

template<typename ITEM_TYPE>
void FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::initializeDataStoreItem ( const ITEM_TYPE & aItem)
inlineprotected

Initializes every column in the data store for a newly added (or refreshed) item.

Like the field initializer, this will correctly handle missing fields in the source item as empty or not-present based on the column user-added status

Definition at line 1113 of file fields_table_data_model.h.

References initializeDataStoreItemField(), and FIELDS_TABLE_DATA_MODEL_BASE::m_cols.

◆ initializeDataStoreItemField()

template<typename ITEM_TYPE>
void FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::initializeDataStoreItemField ( const ITEM_TYPE & aItem,
const DATA_MODEL_COL & aCol )
inlineprotected

Puts the live value of the field in the data store, correctly handling a missing field in the souce item as empty or not-present based on whether the col was added by the user.

Definition at line 1099 of file fields_table_data_model.h.

References ensureStoredFieldPresent(), DATA_MODEL_COL::m_fieldName, DATA_MODEL_COL::m_userAdded, and updateDataStoreItemFieldFromLive().

Referenced by AddColumn(), and initializeDataStoreItem().

◆ IsCellClear()

template<typename ITEM_TYPE>
bool FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::IsCellClear ( int aRow,
int aCol )
inlineoverridevirtual

Returns true if the cell is not present in the data store for any item in the row, not just empty.

Implements FIELDS_TABLE_DATA_MODEL_BASE.

Definition at line 409 of file fields_table_data_model.h.

References getStoredFieldValue(), FIELDS_TABLE_DATA_MODEL_BASE::m_cols, and m_rows.

◆ IsCellEdited()

template<typename ITEM_TYPE>
bool FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::IsCellEdited ( int aRow,
int aCol )
inlineoverridevirtual

Returns true if the cell has been modified from the live value in any item in the row (symbol/footprint/etc).

Implements FIELDS_TABLE_DATA_MODEL_BASE.

Definition at line 430 of file fields_table_data_model.h.

References fieldIsModified(), FIELDS_TABLE_DATA_MODEL_BASE::m_cols, and m_rows.

◆ IsCellReadOnly()

template<typename ITEM_TYPE>
bool FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::IsCellReadOnly ( int aRow,
int aCol )
inlineoverridevirtual

◆ IsEdited()

bool FIELDS_TABLE_DATA_MODEL_BASE::IsEdited ( )
inlineinherited

Definition at line 130 of file fields_table_data_model.h.

References m_edited.

◆ IsEmptyCell()

bool FIELDS_TABLE_DATA_MODEL_BASE::IsEmptyCell ( int aRow,
int aCol )
inlineoverrideinherited

Definition at line 149 of file fields_table_data_model.h.

◆ IsExpanderColumn()

bool FIELDS_TABLE_DATA_MODEL_BASE::IsExpanderColumn ( int aCol) const
overridevirtualinherited

Reimplemented from WX_GRID_TABLE_BASE.

Definition at line 462 of file fields_table_data_model.cpp.

References m_cols.

Referenced by ColIsReadOnly().

◆ IsRowEdited()

bool FIELDS_TABLE_DATA_MODEL_BASE::IsRowEdited ( int aRow)
inherited

Return true if any cell in the row has been edited.

Definition at line 516 of file fields_table_data_model.cpp.

References GetNumberCols(), and IsCellEdited().

◆ MatchesFilter()

◆ MoveColumn()

void FIELDS_TABLE_DATA_MODEL_BASE::MoveColumn ( int aCol,
int aNewPos )
inherited

Definition at line 227 of file fields_table_data_model.cpp.

Referenced by DIALOG_FIELDS_TABLE::OnColMove().

◆ RebuildRows()

◆ RemoveColumn()

void FIELDS_TABLE_DATA_MODEL_BASE::RemoveColumn ( int aCol)
inherited

Definition at line 260 of file fields_table_data_model.cpp.

Referenced by DIALOG_FIELDS_TABLE::OnRemoveField().

◆ RenameColumn()

void FIELDS_TABLE_DATA_MODEL_BASE::RenameColumn ( int aCol,
const wxString & newName )
inherited

◆ resolveTextVars()

template<typename ITEM_TYPE>
virtual wxString FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::resolveTextVars ( const ITEM_TYPE & aItem,
const wxString & aText )
pure virtual

◆ RestoreUndoState()

void FIELDS_TABLE_DATA_MODEL_BASE::RestoreUndoState ( const wxString & aState)
overridevirtualinherited

Reimplemented from WX_GRID_TABLE_BASE.

Definition at line 798 of file fields_table_data_model.cpp.

References m_dataStore, m_edited, and RebuildRows().

◆ RevertRow()

template<typename ITEM_TYPE>
void FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::RevertRow ( int aRow)
inlineoverridevirtual

Go through and revert all the fields in the row to their live values from the item (symbol/footprint/etc).

Then recheck if any fields in the entire table are modified, and set edited state accordingly.

Implements FIELDS_TABLE_DATA_MODEL_BASE.

Reimplemented in SYMBOL_FIELDS_EDITOR_GRID_DATA_MODEL.

Definition at line 474 of file fields_table_data_model.h.

References fieldIsModified(), getAllItems(), FIELDS_TABLE_DATA_MODEL_BASE::m_cols, FIELDS_TABLE_DATA_MODEL_BASE::m_edited, m_rows, and updateDataStoreItemFieldFromLive().

Referenced by SYMBOL_FIELDS_EDITOR_GRID_DATA_MODEL::RevertRow().

◆ SerializeUndoState()

wxString FIELDS_TABLE_DATA_MODEL_BASE::SerializeUndoState ( ) const
overridevirtualinherited

Reimplemented from WX_GRID_TABLE_BASE.

Definition at line 778 of file fields_table_data_model.cpp.

References m_dataStore, and name.

◆ SetColAttr()

void WX_GRID_TABLE_BASE::SetColAttr ( wxGridCellAttr * aAttr,
int aCol )
inlineoverrideinherited

Definition at line 66 of file wx_grid.h.

References m_colAttrs.

Referenced by DIALOG_FIELDS_TABLE::SetupColumnProperties().

◆ SetColLabelValue()

void FIELDS_TABLE_DATA_MODEL_BASE::SetColLabelValue ( int aCol,
const wxString & aLabel )
overrideinherited

◆ SetCurrentVariant()

void FIELDS_TABLE_DATA_MODEL_BASE::SetCurrentVariant ( const wxString & aVariantName)
inlineinherited

Set the current variant name for highlighting purposes.

When a variant is set, cells that differ from the default (non-variant) value will be highlighted.

Parameters
aVariantNameThe name of the current variant, or empty string for default.

Definition at line 243 of file fields_table_data_model.h.

References m_currentVariant.

Referenced by BOOST_FIXTURE_TEST_CASE(), DIALOG_FIELDS_TABLE::doApplyBomPreset(), EESCHEMA_JOBS_HANDLER::JobExportBom(), and PCBNEW_JOBS_HANDLER::JobExportBom().

◆ SetExcludeDNP()

void FIELDS_TABLE_DATA_MODEL_BASE::SetExcludeDNP ( bool aExclude)
inlineinherited

Definition at line 207 of file fields_table_data_model.h.

References m_excludeDNP.

Referenced by ApplyBomPreset().

◆ SetFieldsOrder()

void FIELDS_TABLE_DATA_MODEL_BASE::SetFieldsOrder ( const std::vector< wxString > & aNewOrder)
inherited

Definition at line 379 of file fields_table_data_model.cpp.

References commitPendingGridChanges(), and m_cols.

Referenced by ApplyBomPreset().

◆ SetFilter()

void FIELDS_TABLE_DATA_MODEL_BASE::SetFilter ( const wxString & aFilter)
inlineinherited

Definition at line 189 of file fields_table_data_model.h.

References m_filter.

Referenced by ApplyBomPreset(), and DIALOG_FIELDS_TABLE::OnFilterText().

◆ SetFilterScope()

void FIELDS_TABLE_DATA_MODEL_BASE::SetFilterScope ( BOM_FILTER_SCOPE aScope)
inlineinherited

Definition at line 191 of file fields_table_data_model.h.

References m_filterScope.

Referenced by ApplyBomPreset(), and DIALOG_FIELDS_TABLE::OnFilterScope().

◆ SetGroupColumn()

void FIELDS_TABLE_DATA_MODEL_BASE::SetGroupColumn ( int aCol,
bool aGroup )
inherited

◆ SetGroupingEnabled()

void FIELDS_TABLE_DATA_MODEL_BASE::SetGroupingEnabled ( bool aGroup)
inlineinherited

◆ SetIncludeExcludedFromBOM()

void FIELDS_TABLE_DATA_MODEL_BASE::SetIncludeExcludedFromBOM ( bool aInclude)
inlineinherited

Definition at line 204 of file fields_table_data_model.h.

References m_includeExcluded.

Referenced by ApplyBomPreset(), and DIALOG_FIELDS_TABLE::PreviewRefresh().

◆ SetSelectionItems()

void FIELDS_TABLE_DATA_MODEL_BASE::SetSelectionItems ( const std::unordered_set< KIID_PATH > & aItems)
inlineinherited

Definition at line 194 of file fields_table_data_model.h.

References m_selectionItems.

◆ SetShowColumn()

void FIELDS_TABLE_DATA_MODEL_BASE::SetShowColumn ( int aCol,
bool aShow )
inherited

◆ SetSorting()

void FIELDS_TABLE_DATA_MODEL_BASE::SetSorting ( int aCol,
bool aAscending )
inherited

◆ setStoredFieldValue()

template<typename ITEM_TYPE>
void FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::setStoredFieldValue ( const ITEM_TYPE & aItem,
const wxString & aFieldName,
const wxString & aValue )
inlineprotected

Creates or updates a field in the data store.

Always marks the field present as a result.

Definition at line 1036 of file fields_table_data_model.h.

References getDataStoreKey(), and FIELDS_TABLE_DATA_MODEL_BASE::m_dataStore.

Referenced by updateDataStoreItemFieldFromLive().

◆ SetVariantNames()

void FIELDS_TABLE_DATA_MODEL_BASE::SetVariantNames ( const std::vector< wxString > & aVariantNames)
inlineinherited

◆ Sort()

template<typename ITEM_TYPE>
void FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::Sort ( )
inlineprotected

Definition at line 957 of file fields_table_data_model.h.

References CollapseForSort(), ExpandAfterSort(), and m_rows.

◆ unitMatch()

template<typename ITEM_TYPE>
virtual bool FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::unitMatch ( const ITEM_TYPE & lhItem,
const ITEM_TYPE & rhItem )
protectedpure virtual

◆ updateDataStoreItemFieldFromLive()

template<typename ITEM_TYPE>
void FIELDS_TABLE_DATA_MODEL< ITEM_TYPE >::updateDataStoreItemFieldFromLive ( const ITEM_TYPE & aItem,
const wxString & aFieldName )
inlineprotected

Updates the data store with the current value of the field from the live item.

If the field is not present on the item, it will be cleared from the data store rather than set to empty.

Definition at line 1084 of file fields_table_data_model.h.

References clearStoredField(), getLiveFieldValue(), and setStoredFieldValue().

Referenced by initializeDataStoreItemField(), and RevertRow().

Member Data Documentation

◆ ITEM_NUMBER_VARIABLE

const wxString FIELDS_TABLE_DATA_MODEL_BASE::ITEM_NUMBER_VARIABLE = wxS( "${ITEM_NUMBER}" )
staticinherited

◆ m_colAttrs

std::map<int, wxGridCellAttr*> WX_GRID_TABLE_BASE::m_colAttrs
protectedinherited

Definition at line 108 of file wx_grid.h.

Referenced by GetAttr(), SetColAttr(), and ~WX_GRID_TABLE_BASE().

◆ m_cols

◆ m_currentVariant

wxString FIELDS_TABLE_DATA_MODEL_BASE::m_currentVariant
protectedinherited

Current variant name for highlighting.

Definition at line 300 of file fields_table_data_model.h.

Referenced by GetCurrentVariant(), and SetCurrentVariant().

◆ m_dataStore

◆ m_edited

◆ m_excludeDNP

bool FIELDS_TABLE_DATA_MODEL_BASE::m_excludeDNP
protectedinherited

◆ m_filter

wxString FIELDS_TABLE_DATA_MODEL_BASE::m_filter
protectedinherited

◆ m_filterScope

BOM_FILTER_SCOPE FIELDS_TABLE_DATA_MODEL_BASE::m_filterScope
protectedinherited

◆ m_groupingEnabled

bool FIELDS_TABLE_DATA_MODEL_BASE::m_groupingEnabled
protectedinherited

◆ m_includeExcluded

bool FIELDS_TABLE_DATA_MODEL_BASE::m_includeExcluded
protectedinherited

◆ m_rebuildsEnabled

bool FIELDS_TABLE_DATA_MODEL_BASE::m_rebuildsEnabled
protectedinherited

Items included by the user selection scope.

Definition at line 295 of file fields_table_data_model.h.

Referenced by DisableRebuilds(), EnableRebuilds(), and FIELDS_TABLE_DATA_MODEL_BASE().

◆ m_resolvedTextRenderer

wxGridCellRenderer* FIELDS_TABLE_DATA_MODEL_BASE::m_resolvedTextRenderer
protectedinherited

◆ m_rows

◆ m_selectionItems

std::unordered_set<KIID_PATH> FIELDS_TABLE_DATA_MODEL_BASE::m_selectionItems
protectedinherited

Definition at line 298 of file fields_table_data_model.h.

Referenced by ClearSelectionItems(), and SetSelectionItems().

◆ m_sortAscending

bool FIELDS_TABLE_DATA_MODEL_BASE::m_sortAscending
protectedinherited

Definition at line 289 of file fields_table_data_model.h.

Referenced by FIELDS_TABLE_DATA_MODEL_BASE(), GetSortAsc(), and SetSorting().

◆ m_sortColumn

int FIELDS_TABLE_DATA_MODEL_BASE::m_sortColumn
protectedinherited

Definition at line 288 of file fields_table_data_model.h.

Referenced by FIELDS_TABLE_DATA_MODEL_BASE(), GetSortCol(), and SetSorting().

◆ m_stripedRenderer

wxGridCellRenderer* FIELDS_TABLE_DATA_MODEL_BASE::m_stripedRenderer
protectedinherited

◆ m_variantNames

std::vector<wxString> FIELDS_TABLE_DATA_MODEL_BASE::m_variantNames
protectedinherited

Variant names for multi-variant DNP filtering.

Definition at line 301 of file fields_table_data_model.h.

Referenced by GetVariantNames(), and SetVariantNames().

◆ QUANTITY_VARIABLE

const wxString FIELDS_TABLE_DATA_MODEL_BASE::QUANTITY_VARIABLE = wxS( "${QUANTITY}" )
staticinherited

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