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

#include <lib_fields_data_model.h>

Inheritance diagram for LIB_FIELDS_EDITOR_GRID_DATA_MODEL:
WX_GRID_TABLE_BASE

Public Member Functions

 LIB_FIELDS_EDITOR_GRID_DATA_MODEL ()
 
 ~LIB_FIELDS_EDITOR_GRID_DATA_MODEL () override
 
void CreateDerivedSymbol (int aRow, int aCol, wxString &aNewSymbolName)
 
void CreateDerivedSymbolImmediate (int aRow, int aCol, wxString &aNewSymbolName)
 
void AddColumn (const wxString &aFieldName, const wxString &aLabel, bool aAddedByUser, bool aIsCheckbox)
 
void RemoveColumn (int aCol)
 
void RenameColumn (int aCol, const wxString &newName)
 
void MoveColumn (int aCol, int aNewPos)
 
int GetNumberRows () override
 
int GetNumberCols () override
 
void SetColLabelValue (int aCol, const wxString &aLabel) override
 
wxString GetColLabelValue (int aCol) override
 
wxString GetColFieldName (int aCol)
 
int GetFieldNameCol (const wxString &aFieldName)
 
void SetFieldsOrder (const std::vector< wxString > &aNewOrder)
 
bool IsEmptyCell (int aRow, int aCol) override
 
wxString GetValue (int aRow, int aCol) override
 
wxString GetTypeName (int row, int col) override
 
wxString GetValue (const LIB_DATA_MODEL_ROW &group, int aCol)
 
void SetValue (int aRow, int aCol, const wxString &aValue) override
 
wxGridCellAttr * GetAttr (int row, int col, wxGridCellAttr::wxAttrKind kind) override
 
void RevertRow (int aRow)
 
void ClearCell (int aRow, int aCol)
 
bool ColIsValue (int aCol)
 
bool ColIsCheck (int aCol)
 
void SetSorting (int aCol, bool ascending)
 
int GetSortCol ()
 
bool GetSortAsc ()
 
const LIB_SYMBOLGetSymbolForRow (int aRow)
 
void GetSymbolNames (wxArrayString &aList)
 
void SetSymbols (const std::vector< LIB_SYMBOL * > &aSymbolsList)
 
void RebuildRows ()
 
void ExpandRow (int aRow)
 
void CollapseRow (int aRow)
 
void ExpandCollapseRow (int aRow)
 
void CollapseForSort ()
 
void ExpandAfterSort ()
 
void ApplyData (std::function< void(LIB_SYMBOL *)> symbolChangeHandler, std::function< void()> postApplyHandler=nullptr)
 
std::vector< std::pair< LIB_SYMBOL *, wxString > > GetAndClearCreatedDerivedSymbols ()
 Get and clear the list of newly created derived symbols for library manager processing.
 
bool IsEdited ()
 
int GetDataWidth (int aCol)
 
void SetFilter (const wxString &aFilter)
 
const wxString & GetFilter ()
 
void SetGroupingEnabled (bool group)
 
bool GetGroupingEnabled ()
 
void SetGroupColumn (int aCol, bool group)
 
bool GetGroupColumn (int aCol)
 
void SetShowColumn (int aCol, bool show)
 
bool GetShowColumn (int aCol)
 
bool IsRowEditable (int aRow)
 
bool IsCellEdited (int aRow, int aCol)
 
bool IsCellClear (int aRow, int aCol)
 
bool IsRowSingleSymbol (int aRow)
 
void SetColAttr (wxGridCellAttr *aAttr, int aCol) override
 

Static Public Attributes

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

Protected Member Functions

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

Protected Attributes

std::vector< LIB_SYMBOL * > m_symbolsList
 
bool m_edited
 
int m_sortColumn
 
bool m_sortAscending
 
wxString m_filter
 
bool m_groupingEnabled
 
std::vector< LIB_DATA_MODEL_COLm_cols
 
std::vector< LIB_DATA_MODEL_ROWm_rows
 
std::map< KIID, std::map< wxString, LIB_DATA_ELEMENT > > m_dataStore
 
std::vector< std::pair< LIB_SYMBOL *, wxString > > m_createdDerivedSymbols
 
STRIPED_STRING_RENDERERm_stripedStringRenderer
 
std::map< wxString, wxGridCellRenderer * > m_stripedRenderers
 
std::map< int, wxGridCellAttr * > m_colAttrs
 

Private Member Functions

bool groupMatch (const LIB_SYMBOL *lhRef, const LIB_SYMBOL *rhRef)
 
wxString getAttributeValue (const LIB_SYMBOL *, const wxString &aAttributeName)
 
void setAttributeValue (LIB_SYMBOL *aSymbol, const wxString &aAttributeName, const wxString &aValue)
 
void createActualDerivedSymbol (const LIB_SYMBOL *aParentSymbol, const wxString &aNewSymbolName, const KIID &aNewSymbolUuid)
 
void Sort ()
 
void updateDataStoreSymbolField (const LIB_SYMBOL *aSymbol, const wxString &aFieldName)
 
bool isStripeableField (int aCol)
 
wxGridCellRenderer * getStripedRenderer (int aCol) const
 

Static Private Member Functions

static bool cmp (const LIB_DATA_MODEL_ROW &lhGroup, const LIB_DATA_MODEL_ROW &rhGroup, LIB_FIELDS_EDITOR_GRID_DATA_MODEL *dataModel, int sortCol, bool ascending)
 

Detailed Description

Definition at line 80 of file lib_fields_data_model.h.

Constructor & Destructor Documentation

◆ LIB_FIELDS_EDITOR_GRID_DATA_MODEL()

LIB_FIELDS_EDITOR_GRID_DATA_MODEL::LIB_FIELDS_EDITOR_GRID_DATA_MODEL ( )
inline

◆ ~LIB_FIELDS_EDITOR_GRID_DATA_MODEL()

LIB_FIELDS_EDITOR_GRID_DATA_MODEL::~LIB_FIELDS_EDITOR_GRID_DATA_MODEL ( )
inlineoverride

Definition at line 93 of file lib_fields_data_model.h.

References m_stripedRenderers.

Member Function Documentation

◆ AddColumn()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::AddColumn ( const wxString & aFieldName,
const wxString & aLabel,
bool aAddedByUser,
bool aIsCheckbox )

◆ ApplyData()

◆ ClearCell()

◆ cmp()

bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::cmp ( const LIB_DATA_MODEL_ROW & lhGroup,
const LIB_DATA_MODEL_ROW & rhGroup,
LIB_FIELDS_EDITOR_GRID_DATA_MODEL * dataModel,
int sortCol,
bool ascending )
staticprivate

◆ ColIsCheck()

bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::ColIsCheck ( int aCol)

Definition at line 600 of file lib_fields_data_model.cpp.

References m_cols.

Referenced by ApplyData(), GetTypeName(), isStripeableField(), and updateDataStoreSymbolField().

◆ ColIsValue()

bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::ColIsValue ( int aCol)

Definition at line 593 of file lib_fields_data_model.cpp.

References GetCanonicalFieldName(), m_cols, and VALUE.

◆ CollapseForSort()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::CollapseForSort ( )

Definition at line 906 of file lib_fields_data_model.cpp.

References CollapseRow(), GROUP_COLLAPSED_DURING_SORT, GROUP_EXPANDED, and m_rows.

Referenced by Sort().

◆ CollapseRow()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::CollapseRow ( int aRow)

Definition at line 875 of file lib_fields_data_model.cpp.

References CHILD_ITEM, GROUP_COLLAPSED, and m_rows.

Referenced by CollapseForSort(), and ExpandCollapseRow().

◆ createActualDerivedSymbol()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::createActualDerivedSymbol ( const LIB_SYMBOL * aParentSymbol,
const wxString & aNewSymbolName,
const KIID & aNewSymbolUuid )
private

◆ CreateDerivedSymbol()

◆ CreateDerivedSymbolImmediate()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::CreateDerivedSymbolImmediate ( int aRow,
int aCol,
wxString & aNewSymbolName )

◆ enhanceAttr()

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

◆ ExpandAfterSort()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::ExpandAfterSort ( )

Definition at line 919 of file lib_fields_data_model.cpp.

References ExpandRow(), GROUP_COLLAPSED_DURING_SORT, and m_rows.

Referenced by Sort().

◆ ExpandCollapseRow()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::ExpandCollapseRow ( int aRow)

◆ ExpandRow()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::ExpandRow ( int aRow)

Definition at line 846 of file lib_fields_data_model.cpp.

References CHILD_ITEM, GROUP_EXPANDED, and m_rows.

Referenced by ExpandAfterSort(), and ExpandCollapseRow().

◆ GetAndClearCreatedDerivedSymbols()

std::vector< std::pair< LIB_SYMBOL *, wxString > > LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetAndClearCreatedDerivedSymbols ( )
inline

Get and clear the list of newly created derived symbols for library manager processing.

Definition at line 209 of file lib_fields_data_model.h.

References m_createdDerivedSymbols, and result.

◆ GetAttr()

wxGridCellAttr * LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetAttr ( int row,
int col,
wxGridCellAttr::wxAttrKind kind )
override

◆ getAttributeValue()

wxString LIB_FIELDS_EDITOR_GRID_DATA_MODEL::getAttributeValue ( const LIB_SYMBOL * aSymbol,
const wxString & aAttributeName )
private

◆ GetColFieldName()

wxString LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetColFieldName ( int aCol)
inline

Definition at line 146 of file lib_fields_data_model.h.

References m_cols.

Referenced by GetDataWidth().

◆ GetColLabelValue()

wxString LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetColLabelValue ( int aCol)
inlineoverride

Definition at line 140 of file lib_fields_data_model.h.

References m_cols.

◆ GetDataWidth()

int LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetDataWidth ( int aCol)

◆ GetFieldNameCol()

int LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetFieldNameCol ( const wxString & aFieldName)

Definition at line 134 of file lib_fields_data_model.cpp.

References m_cols.

Referenced by AddColumn(), ApplyData(), and updateDataStoreSymbolField().

◆ GetFilter()

const wxString & LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetFilter ( )
inline

Definition at line 221 of file lib_fields_data_model.h.

References m_filter.

◆ GetGroupColumn()

bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetGroupColumn ( int aCol)
inline

Definition at line 232 of file lib_fields_data_model.h.

References m_cols.

◆ GetGroupingEnabled()

bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetGroupingEnabled ( )
inline

Definition at line 224 of file lib_fields_data_model.h.

References m_groupingEnabled.

◆ GetNumberCols()

int LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetNumberCols ( )
inlineoverride

Definition at line 132 of file lib_fields_data_model.h.

References m_cols.

◆ GetNumberRows()

int LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetNumberRows ( )
inlineoverride

Definition at line 131 of file lib_fields_data_model.h.

References m_rows.

◆ GetShowColumn()

bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetShowColumn ( int aCol)
inline

Definition at line 244 of file lib_fields_data_model.h.

References m_cols.

◆ GetSortAsc()

bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetSortAsc ( )
inline

Definition at line 181 of file lib_fields_data_model.h.

References m_sortAscending.

◆ GetSortCol()

int LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetSortCol ( )
inline

Definition at line 180 of file lib_fields_data_model.h.

References m_sortColumn.

◆ getStripedRenderer()

wxGridCellRenderer * LIB_FIELDS_EDITOR_GRID_DATA_MODEL::getStripedRenderer ( int aCol) const
private

Definition at line 1154 of file lib_fields_data_model.cpp.

References m_cols, and m_stripedRenderers.

Referenced by GetAttr().

◆ GetSymbolForRow()

const LIB_SYMBOL * LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetSymbolForRow ( int aRow)
inline

Definition at line 182 of file lib_fields_data_model.h.

References m_rows.

◆ GetSymbolNames()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetSymbolNames ( wxArrayString & aList)
inline

Definition at line 188 of file lib_fields_data_model.h.

References m_symbolsList.

◆ GetTypeName()

wxString LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetTypeName ( int row,
int col )
override

Definition at line 1145 of file lib_fields_data_model.cpp.

References ColIsCheck().

◆ GetValue() [1/2]

wxString LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetValue ( const LIB_DATA_MODEL_ROW & group,
int aCol )

◆ GetValue() [2/2]

wxString LIB_FIELDS_EDITOR_GRID_DATA_MODEL::GetValue ( int aRow,
int aCol )
override

Definition at line 178 of file lib_fields_data_model.cpp.

References CHILD_ITEM, GetValue(), GROUP_COLLAPSED, GROUP_EXPANDED, m_cols, and m_rows.

Referenced by cmp(), and GetValue().

◆ groupMatch()

bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::groupMatch ( const LIB_SYMBOL * lhRef,
const LIB_SYMBOL * rhRef )
private

◆ IsCellClear()

bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::IsCellClear ( int aRow,
int aCol )
inline

Definition at line 263 of file lib_fields_data_model.h.

References m_cols, m_dataStore, and m_rows.

◆ IsCellEdited()

bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::IsCellEdited ( int aRow,
int aCol )
inline

Definition at line 256 of file lib_fields_data_model.h.

References m_cols, m_dataStore, and m_rows.

◆ IsEdited()

bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::IsEdited ( )
inline

Definition at line 216 of file lib_fields_data_model.h.

References m_edited.

◆ IsEmptyCell()

bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::IsEmptyCell ( int aRow,
int aCol )
inlineoverride

Definition at line 156 of file lib_fields_data_model.h.

◆ IsRowEditable()

bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::IsRowEditable ( int aRow)
inline

Definition at line 250 of file lib_fields_data_model.h.

References GROUP_SINGLETON, and m_rows.

◆ IsRowSingleSymbol()

bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::IsRowSingleSymbol ( int aRow)
inline

Definition at line 270 of file lib_fields_data_model.h.

References CHILD_ITEM, GROUP_SINGLETON, and m_rows.

◆ isStripeableField()

bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::isStripeableField ( int aCol)
private

Definition at line 1183 of file lib_fields_data_model.cpp.

References ColIsCheck(), and m_cols.

Referenced by GetAttr().

◆ MoveColumn()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::MoveColumn ( int aCol,
int aNewPos )
inline

Definition at line 111 of file lib_fields_data_model.h.

References m_cols.

◆ RebuildRows()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::RebuildRows ( )

◆ RemoveColumn()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::RemoveColumn ( int aCol)

Definition at line 93 of file lib_fields_data_model.cpp.

References m_cols, m_dataStore, m_edited, and m_symbolsList.

◆ RenameColumn()

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

Definition at line 115 of file lib_fields_data_model.cpp.

References m_cols, m_dataStore, m_edited, and m_symbolsList.

◆ RevertRow()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::RevertRow ( int aRow)

◆ setAttributeValue()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::setAttributeValue ( LIB_SYMBOL * aSymbol,
const wxString & aAttributeName,
const wxString & aValue )
private

◆ SetColAttr()

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

Definition at line 51 of file wx_grid.h.

References m_colAttrs.

◆ SetColLabelValue()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::SetColLabelValue ( int aCol,
const wxString & aLabel )
inlineoverride

Definition at line 134 of file lib_fields_data_model.h.

References m_cols.

◆ SetFieldsOrder()

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

Definition at line 146 of file lib_fields_data_model.cpp.

References m_cols.

◆ SetFilter()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::SetFilter ( const wxString & aFilter)
inline

Definition at line 220 of file lib_fields_data_model.h.

References m_filter.

◆ SetGroupColumn()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::SetGroupColumn ( int aCol,
bool group )
inline

Definition at line 226 of file lib_fields_data_model.h.

References group, and m_cols.

◆ SetGroupingEnabled()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::SetGroupingEnabled ( bool group)
inline

Definition at line 223 of file lib_fields_data_model.h.

References group, and m_groupingEnabled.

◆ SetShowColumn()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::SetShowColumn ( int aCol,
bool show )
inline

Definition at line 238 of file lib_fields_data_model.h.

References m_cols.

◆ SetSorting()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::SetSorting ( int aCol,
bool ascending )
inline

Definition at line 173 of file lib_fields_data_model.h.

References m_cols, m_sortAscending, and m_sortColumn.

◆ SetSymbols()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::SetSymbols ( const std::vector< LIB_SYMBOL * > & aSymbolsList)
inline

Definition at line 196 of file lib_fields_data_model.h.

References m_symbolsList.

◆ SetValue()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::SetValue ( int aRow,
int aCol,
const wxString & aValue )
override

◆ Sort()

void LIB_FIELDS_EDITOR_GRID_DATA_MODEL::Sort ( )
private

Definition at line 646 of file lib_fields_data_model.cpp.

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

Referenced by RebuildRows().

◆ updateDataStoreSymbolField()

Member Data Documentation

◆ ITEM_NUMBER_VARIABLE

const wxString LIB_FIELDS_EDITOR_GRID_DATA_MODEL::ITEM_NUMBER_VARIABLE = wxS( "${ITEM_NUMBER}" )
static

Definition at line 102 of file lib_fields_data_model.h.

◆ m_colAttrs

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

◆ m_cols

◆ m_createdDerivedSymbols

std::vector<std::pair<LIB_SYMBOL*, wxString> > LIB_FIELDS_EDITOR_GRID_DATA_MODEL::m_createdDerivedSymbols
protected

◆ m_dataStore

std::map<KIID, std::map<wxString, LIB_DATA_ELEMENT> > LIB_FIELDS_EDITOR_GRID_DATA_MODEL::m_dataStore
protected

◆ m_edited

◆ m_filter

wxString LIB_FIELDS_EDITOR_GRID_DATA_MODEL::m_filter
protected

◆ m_groupingEnabled

bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::m_groupingEnabled
protected

◆ m_rows

◆ m_sortAscending

bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::m_sortAscending
protected

◆ m_sortColumn

int LIB_FIELDS_EDITOR_GRID_DATA_MODEL::m_sortColumn
protected

◆ m_stripedRenderers

std::map<wxString, wxGridCellRenderer*> LIB_FIELDS_EDITOR_GRID_DATA_MODEL::m_stripedRenderers
mutableprotected

◆ m_stripedStringRenderer

STRIPED_STRING_RENDERER* LIB_FIELDS_EDITOR_GRID_DATA_MODEL::m_stripedStringRenderer
mutableprotected

Definition at line 314 of file lib_fields_data_model.h.

Referenced by LIB_FIELDS_EDITOR_GRID_DATA_MODEL().

◆ m_symbolsList

std::vector<LIB_SYMBOL*> LIB_FIELDS_EDITOR_GRID_DATA_MODEL::m_symbolsList
protected

◆ QUANTITY_VARIABLE

const wxString LIB_FIELDS_EDITOR_GRID_DATA_MODEL::QUANTITY_VARIABLE
static

Definition at line 101 of file lib_fields_data_model.h.


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