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

#include <fields_data_model.h>

Inheritance diagram for FIELDS_EDITOR_GRID_DATA_MODEL:

Public Types

enum  SCOPE : int { SCOPE_ALL = 0 , SCOPE_SHEET = 1 , SCOPE_SHEET_RECURSIVE = 2 }
 

Public Member Functions

 FIELDS_EDITOR_GRID_DATA_MODEL (SCH_REFERENCE_LIST &aSymbolsList)
 
void AddColumn (const wxString &aFieldName, const wxString &aLabel, bool aAddedByUser)
 
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 (wxString aFieldName)
 
const std::vector< BOM_FIELDGetFieldsOrdered ()
 
void SetFieldsOrder (const std::vector< wxString > &aNewOrder)
 
bool IsEmptyCell (int aRow, int aCol) override
 
wxString GetValue (int aRow, int aCol) override
 
wxString GetValue (const DATA_MODEL_ROW &group, int aCol, const wxString &refDelimiter=wxT(", "), const wxString &refRangDelimiter=wxT("-"), bool resolveVars=false)
 
wxString GetExportValue (int aRow, int aCol, const wxString &refDelimiter, const wxString &refRangeDelimiter)
 
void SetValue (int aRow, int aCol, const wxString &aValue) override
 
GROUP_TYPE GetRowFlags (int aRow)
 
std::vector< SCH_REFERENCEGetRowReferences (int aRow) const
 
bool ColIsReference (int aCol)
 
bool ColIsValue (int aCol)
 
bool ColIsQuantity (int aCol)
 
bool ColIsItemNumber (int aCol)
 
bool ColIsAttribute (int aCol)
 
void SetSorting (int aCol, bool ascending)
 
int GetSortCol ()
 
bool GetSortAsc ()
 
void EnableRebuilds ()
 
void DisableRebuilds ()
 
void RebuildRows ()
 
void ExpandRow (int aRow)
 
void CollapseRow (int aRow)
 
void ExpandCollapseRow (int aRow)
 
void CollapseForSort ()
 
void ExpandAfterSort ()
 
void ApplyData (std::function< void(SCH_SYMBOL &, SCH_SHEET_PATH &)> symbolChangeHandler)
 
bool IsEdited ()
 
int GetDataWidth (int aCol)
 
void SetFilter (const wxString &aFilter)
 
const wxString & GetFilter ()
 
void SetScope (SCOPE aScope)
 
SCOPE GetScope ()
 
void SetPath (const SCH_SHEET_PATH &aPath)
 
const SCH_SHEET_PATHGetPath ()
 
void SetGroupingEnabled (bool group)
 
bool GetGroupingEnabled ()
 
void SetIncludeExcludedFromBOM (bool include)
 
bool GetIncludeExcludedFromBOM ()
 
void SetExcludeDNP (bool exclude)
 
bool GetExcludeDNP ()
 
void SetGroupColumn (int aCol, bool group)
 
bool GetGroupColumn (int aCol)
 
void SetShowColumn (int aCol, bool show)
 
bool GetShowColumn (int aCol)
 
void ApplyBomPreset (const BOM_PRESET &preset)
 
BOM_PRESET GetBomSettings ()
 
wxString Export (const BOM_FMT_PRESET &settings)
 
void AddReferences (const SCH_REFERENCE_LIST &aRefs)
 
void RemoveReferences (const SCH_REFERENCE_LIST &aRefs)
 
void RemoveSymbol (const SCH_SYMBOL &aSymbol)
 
void UpdateReferences (const SCH_REFERENCE_LIST &aRefs)
 

Static Public Attributes

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

Protected Attributes

SCH_REFERENCE_LIST m_symbolsList
 
bool m_edited
 
int m_sortColumn
 
bool m_sortAscending
 
wxString m_filter
 
enum SCOPE m_scope
 
SCH_SHEET_PATH m_path
 
bool m_groupingEnabled
 
bool m_excludeDNP
 
bool m_includeExcluded
 
bool m_rebuildsEnabled
 
std::vector< DATA_MODEL_COLm_cols
 
std::vector< DATA_MODEL_ROWm_rows
 
std::map< KIID, std::map< wxString, wxString > > m_dataStore
 

Private Member Functions

bool unitMatch (const SCH_REFERENCE &lhRef, const SCH_REFERENCE &rhRef)
 
bool groupMatch (const SCH_REFERENCE &lhRef, const SCH_REFERENCE &rhRef)
 
bool isAttribute (const wxString &aFieldName)
 
wxString getAttributeValue (const SCH_SYMBOL &, const wxString &aAttributeName)
 
void setAttributeValue (SCH_SYMBOL &aSymbol, const wxString &aAttributeName, const wxString &aValue)
 
wxString getFieldShownText (const SCH_REFERENCE &aRef, const wxString &aFieldName)
 
void Sort ()
 
SCH_REFERENCE_LIST getSymbolReferences (SCH_SYMBOL *aSymbol)
 
void storeReferenceFields (SCH_REFERENCE &aRef)
 
void updateDataStoreSymbolField (const SCH_SYMBOL &aSymbol, const wxString &aFieldName)
 

Static Private Member Functions

static bool cmp (const DATA_MODEL_ROW &lhGroup, const DATA_MODEL_ROW &rhGroup, FIELDS_EDITOR_GRID_DATA_MODEL *dataModel, int sortCol, bool ascending)
 

Detailed Description

Definition at line 73 of file fields_data_model.h.

Member Enumeration Documentation

◆ SCOPE

Enumerator
SCOPE_ALL 
SCOPE_SHEET 
SCOPE_SHEET_RECURSIVE 

Definition at line 76 of file fields_data_model.h.

Constructor & Destructor Documentation

◆ FIELDS_EDITOR_GRID_DATA_MODEL()

FIELDS_EDITOR_GRID_DATA_MODEL::FIELDS_EDITOR_GRID_DATA_MODEL ( SCH_REFERENCE_LIST aSymbolsList)
inline

Definition at line 83 of file fields_data_model.h.

References m_symbolsList, and SCH_REFERENCE_LIST::SplitReferences().

Member Function Documentation

◆ AddColumn()

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

◆ AddReferences()

void FIELDS_EDITOR_GRID_DATA_MODEL::AddReferences ( const SCH_REFERENCE_LIST aRefs)

◆ ApplyBomPreset()

◆ ApplyData()

◆ cmp()

bool FIELDS_EDITOR_GRID_DATA_MODEL::cmp ( const DATA_MODEL_ROW lhGroup,
const DATA_MODEL_ROW rhGroup,
FIELDS_EDITOR_GRID_DATA_MODEL dataModel,
int  sortCol,
bool  ascending 
)
staticprivate

◆ ColIsAttribute()

bool FIELDS_EDITOR_GRID_DATA_MODEL::ColIsAttribute ( int  aCol)

Definition at line 292 of file fields_data_model.cpp.

References isAttribute(), and m_cols.

Referenced by DIALOG_SYMBOL_FIELDS_TABLE::SetupColumnProperties(), and SetValue().

◆ ColIsItemNumber()

bool FIELDS_EDITOR_GRID_DATA_MODEL::ColIsItemNumber ( int  aCol)

◆ ColIsQuantity()

bool FIELDS_EDITOR_GRID_DATA_MODEL::ColIsQuantity ( int  aCol)

◆ ColIsReference()

◆ ColIsValue()

bool FIELDS_EDITOR_GRID_DATA_MODEL::ColIsValue ( int  aCol)

◆ CollapseForSort()

void FIELDS_EDITOR_GRID_DATA_MODEL::CollapseForSort ( )

Definition at line 690 of file fields_data_model.cpp.

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

Referenced by Sort().

◆ CollapseRow()

void FIELDS_EDITOR_GRID_DATA_MODEL::CollapseRow ( int  aRow)

Definition at line 659 of file fields_data_model.cpp.

References CHILD_ITEM, GROUP_COLLAPSED, and m_rows.

Referenced by CollapseForSort(), and ExpandCollapseRow().

◆ DisableRebuilds()

void FIELDS_EDITOR_GRID_DATA_MODEL::DisableRebuilds ( )

Definition at line 528 of file fields_data_model.cpp.

References m_rebuildsEnabled.

Referenced by DIALOG_SYMBOL_FIELDS_TABLE::doApplyBomPreset().

◆ EnableRebuilds()

void FIELDS_EDITOR_GRID_DATA_MODEL::EnableRebuilds ( )

Definition at line 522 of file fields_data_model.cpp.

References m_rebuildsEnabled.

Referenced by DIALOG_SYMBOL_FIELDS_TABLE::doApplyBomPreset().

◆ ExpandAfterSort()

void FIELDS_EDITOR_GRID_DATA_MODEL::ExpandAfterSort ( )

Definition at line 703 of file fields_data_model.cpp.

References ExpandRow(), GROUP_COLLAPSED_DURING_SORT, and m_rows.

Referenced by Sort().

◆ ExpandCollapseRow()

void FIELDS_EDITOR_GRID_DATA_MODEL::ExpandCollapseRow ( int  aRow)

◆ ExpandRow()

void FIELDS_EDITOR_GRID_DATA_MODEL::ExpandRow ( int  aRow)

Definition at line 617 of file fields_data_model.cpp.

References CHILD_ITEM, GROUP_EXPANDED, m_rows, and unitMatch().

Referenced by ExpandAfterSort(), and ExpandCollapseRow().

◆ Export()

◆ getAttributeValue()

wxString FIELDS_EDITOR_GRID_DATA_MODEL::getAttributeValue ( const SCH_SYMBOL aSymbol,
const wxString &  aAttributeName 
)
private

◆ GetBomSettings()

◆ GetColFieldName()

◆ GetColLabelValue()

wxString FIELDS_EDITOR_GRID_DATA_MODEL::GetColLabelValue ( int  aCol)
inlineoverride

Definition at line 122 of file fields_data_model.h.

References m_cols.

Referenced by DIALOG_SYMBOL_FIELDS_TABLE::doApplyBomPreset().

◆ GetDataWidth()

int FIELDS_EDITOR_GRID_DATA_MODEL::GetDataWidth ( int  aCol)

◆ GetExcludeDNP()

bool FIELDS_EDITOR_GRID_DATA_MODEL::GetExcludeDNP ( )
inline

Definition at line 220 of file fields_data_model.h.

References m_excludeDNP.

Referenced by DIALOG_SYMBOL_FIELDS_TABLE::doApplyBomPreset(), and GetBomSettings().

◆ GetExportValue()

wxString FIELDS_EDITOR_GRID_DATA_MODEL::GetExportValue ( int  aRow,
int  aCol,
const wxString &  refDelimiter,
const wxString &  refRangeDelimiter 
)
inline

Definition at line 150 of file fields_data_model.h.

References GetValue(), and m_rows.

Referenced by Export().

◆ GetFieldNameCol()

◆ getFieldShownText()

wxString FIELDS_EDITOR_GRID_DATA_MODEL::getFieldShownText ( const SCH_REFERENCE aRef,
const wxString &  aFieldName 
)
private

◆ GetFieldsOrdered()

const std::vector< BOM_FIELD > FIELDS_EDITOR_GRID_DATA_MODEL::GetFieldsOrdered ( )

Definition at line 112 of file fields_data_model.cpp.

References m_cols.

Referenced by GetBomSettings(), and EESCHEMA_JOBS_HANDLER::JobExportBom().

◆ GetFilter()

const wxString & FIELDS_EDITOR_GRID_DATA_MODEL::GetFilter ( )
inline

Definition at line 201 of file fields_data_model.h.

References m_filter.

Referenced by DIALOG_SYMBOL_FIELDS_TABLE::doApplyBomPreset(), and GetBomSettings().

◆ GetGroupColumn()

bool FIELDS_EDITOR_GRID_DATA_MODEL::GetGroupColumn ( int  aCol)
inline

Definition at line 228 of file fields_data_model.h.

References m_cols.

Referenced by DIALOG_SYMBOL_FIELDS_TABLE::doApplyBomPreset().

◆ GetGroupingEnabled()

bool FIELDS_EDITOR_GRID_DATA_MODEL::GetGroupingEnabled ( )
inline

◆ GetIncludeExcludedFromBOM()

bool FIELDS_EDITOR_GRID_DATA_MODEL::GetIncludeExcludedFromBOM ( )
inline

◆ GetNumberCols()

int FIELDS_EDITOR_GRID_DATA_MODEL::GetNumberCols ( )
inlineoverride

◆ GetNumberRows()

int FIELDS_EDITOR_GRID_DATA_MODEL::GetNumberRows ( )
inlineoverride

Definition at line 112 of file fields_data_model.h.

References m_rows.

Referenced by GetDataWidth(), and DIALOG_SYMBOL_FIELDS_TABLE::TransferDataToWindow().

◆ GetPath()

const SCH_SHEET_PATH & FIELDS_EDITOR_GRID_DATA_MODEL::GetPath ( )
inline

Definition at line 207 of file fields_data_model.h.

References m_path.

◆ GetRowFlags()

GROUP_TYPE FIELDS_EDITOR_GRID_DATA_MODEL::GetRowFlags ( int  aRow)
inline

Definition at line 158 of file fields_data_model.h.

References m_rows.

Referenced by Export().

◆ GetRowReferences()

std::vector< SCH_REFERENCE > FIELDS_EDITOR_GRID_DATA_MODEL::GetRowReferences ( int  aRow) const
inline

◆ GetScope()

SCOPE FIELDS_EDITOR_GRID_DATA_MODEL::GetScope ( )
inline

Definition at line 204 of file fields_data_model.h.

References m_scope.

Referenced by DIALOG_SYMBOL_FIELDS_TABLE::OnSchSheetChanged().

◆ GetShowColumn()

bool FIELDS_EDITOR_GRID_DATA_MODEL::GetShowColumn ( int  aCol)
inline

◆ GetSortAsc()

bool FIELDS_EDITOR_GRID_DATA_MODEL::GetSortAsc ( )
inline

◆ GetSortCol()

int FIELDS_EDITOR_GRID_DATA_MODEL::GetSortCol ( )
inline

◆ getSymbolReferences()

SCH_REFERENCE_LIST FIELDS_EDITOR_GRID_DATA_MODEL::getSymbolReferences ( SCH_SYMBOL aSymbol)
private

◆ GetValue() [1/2]

wxString FIELDS_EDITOR_GRID_DATA_MODEL::GetValue ( const DATA_MODEL_ROW group,
int  aCol,
const wxString &  refDelimiter = wxT( ", " ),
const wxString &  refRangDelimiter = wxT( "-" ),
bool  resolveVars = false 
)

◆ GetValue() [2/2]

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

◆ groupMatch()

bool FIELDS_EDITOR_GRID_DATA_MODEL::groupMatch ( const SCH_REFERENCE lhRef,
const SCH_REFERENCE rhRef 
)
private

◆ isAttribute()

bool FIELDS_EDITOR_GRID_DATA_MODEL::isAttribute ( const wxString &  aFieldName)
private

Definition at line 480 of file fields_data_model.cpp.

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

◆ IsEdited()

bool FIELDS_EDITOR_GRID_DATA_MODEL::IsEdited ( )
inline

◆ IsEmptyCell()

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

Definition at line 139 of file fields_data_model.h.

◆ MoveColumn()

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

Definition at line 98 of file fields_data_model.h.

References m_cols.

Referenced by DIALOG_SYMBOL_FIELDS_TABLE::OnColMove().

◆ RebuildRows()

◆ RemoveColumn()

void FIELDS_EDITOR_GRID_DATA_MODEL::RemoveColumn ( int  aCol)

◆ RemoveReferences()

void FIELDS_EDITOR_GRID_DATA_MODEL::RemoveReferences ( const SCH_REFERENCE_LIST aRefs)

◆ RemoveSymbol()

void FIELDS_EDITOR_GRID_DATA_MODEL::RemoveSymbol ( const SCH_SYMBOL aSymbol)

◆ RenameColumn()

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

◆ setAttributeValue()

void FIELDS_EDITOR_GRID_DATA_MODEL::setAttributeValue ( SCH_SYMBOL aSymbol,
const wxString &  aAttributeName,
const wxString &  aValue 
)
private

◆ SetColLabelValue()

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

Definition at line 115 of file fields_data_model.h.

References m_cols.

Referenced by ApplyBomPreset(), and DIALOG_SYMBOL_FIELDS_TABLE::OnColLabelChange().

◆ SetExcludeDNP()

void FIELDS_EDITOR_GRID_DATA_MODEL::SetExcludeDNP ( bool  exclude)
inline

Definition at line 219 of file fields_data_model.h.

References m_excludeDNP.

Referenced by ApplyBomPreset(), and DIALOG_SYMBOL_FIELDS_TABLE::OnExcludeDNPToggled().

◆ SetFieldsOrder()

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

Definition at line 123 of file fields_data_model.cpp.

References m_cols.

Referenced by ApplyBomPreset().

◆ SetFilter()

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

Definition at line 200 of file fields_data_model.h.

References m_filter.

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

◆ SetGroupColumn()

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

Definition at line 222 of file fields_data_model.h.

References group, and m_cols.

Referenced by ApplyBomPreset(), and DIALOG_SYMBOL_FIELDS_TABLE::OnColumnItemToggled().

◆ SetGroupingEnabled()

void FIELDS_EDITOR_GRID_DATA_MODEL::SetGroupingEnabled ( bool  group)
inline

◆ SetIncludeExcludedFromBOM()

void FIELDS_EDITOR_GRID_DATA_MODEL::SetIncludeExcludedFromBOM ( bool  include)
inline

◆ SetPath()

void FIELDS_EDITOR_GRID_DATA_MODEL::SetPath ( const SCH_SHEET_PATH aPath)
inline

◆ SetScope()

void FIELDS_EDITOR_GRID_DATA_MODEL::SetScope ( SCOPE  aScope)
inline

Definition at line 203 of file fields_data_model.h.

References m_scope.

Referenced by DIALOG_SYMBOL_FIELDS_TABLE::UpdateScope().

◆ SetShowColumn()

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

◆ SetSorting()

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

◆ SetValue()

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

◆ Sort()

void FIELDS_EDITOR_GRID_DATA_MODEL::Sort ( )
private

Definition at line 339 of file fields_data_model.cpp.

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

Referenced by RebuildRows().

◆ storeReferenceFields()

void FIELDS_EDITOR_GRID_DATA_MODEL::storeReferenceFields ( SCH_REFERENCE aRef)
private

◆ unitMatch()

bool FIELDS_EDITOR_GRID_DATA_MODEL::unitMatch ( const SCH_REFERENCE lhRef,
const SCH_REFERENCE rhRef 
)
private

Definition at line 373 of file fields_data_model.cpp.

References SCH_REFERENCE::GetRef(), and SCH_REFERENCE::GetRefNumber().

Referenced by ExpandRow(), and RebuildRows().

◆ updateDataStoreSymbolField()

void FIELDS_EDITOR_GRID_DATA_MODEL::updateDataStoreSymbolField ( const SCH_SYMBOL aSymbol,
const wxString &  aFieldName 
)
private

◆ UpdateReferences()

void FIELDS_EDITOR_GRID_DATA_MODEL::UpdateReferences ( const SCH_REFERENCE_LIST aRefs)

Member Data Documentation

◆ ITEM_NUMBER_VARIABLE

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

◆ m_cols

◆ m_dataStore

std::map<KIID, std::map<wxString, wxString> > FIELDS_EDITOR_GRID_DATA_MODEL::m_dataStore
protected

◆ m_edited

bool FIELDS_EDITOR_GRID_DATA_MODEL::m_edited
protected

Definition at line 283 of file fields_data_model.h.

Referenced by ApplyData(), IsEdited(), and SetValue().

◆ m_excludeDNP

bool FIELDS_EDITOR_GRID_DATA_MODEL::m_excludeDNP
protected

Definition at line 290 of file fields_data_model.h.

Referenced by GetExcludeDNP(), RebuildRows(), and SetExcludeDNP().

◆ m_filter

wxString FIELDS_EDITOR_GRID_DATA_MODEL::m_filter
protected

Definition at line 286 of file fields_data_model.h.

Referenced by GetFilter(), RebuildRows(), and SetFilter().

◆ m_groupingEnabled

bool FIELDS_EDITOR_GRID_DATA_MODEL::m_groupingEnabled
protected

Definition at line 289 of file fields_data_model.h.

Referenced by GetGroupingEnabled(), RebuildRows(), and SetGroupingEnabled().

◆ m_includeExcluded

bool FIELDS_EDITOR_GRID_DATA_MODEL::m_includeExcluded
protected

◆ m_path

SCH_SHEET_PATH FIELDS_EDITOR_GRID_DATA_MODEL::m_path
protected

Definition at line 288 of file fields_data_model.h.

Referenced by GetPath(), RebuildRows(), and SetPath().

◆ m_rebuildsEnabled

bool FIELDS_EDITOR_GRID_DATA_MODEL::m_rebuildsEnabled
protected

Definition at line 292 of file fields_data_model.h.

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

◆ m_rows

◆ m_scope

enum SCOPE FIELDS_EDITOR_GRID_DATA_MODEL::m_scope
protected

Definition at line 287 of file fields_data_model.h.

Referenced by GetScope(), RebuildRows(), and SetScope().

◆ m_sortAscending

bool FIELDS_EDITOR_GRID_DATA_MODEL::m_sortAscending
protected

Definition at line 285 of file fields_data_model.h.

Referenced by GetSortAsc(), and SetSorting().

◆ m_sortColumn

int FIELDS_EDITOR_GRID_DATA_MODEL::m_sortColumn
protected

Definition at line 284 of file fields_data_model.h.

Referenced by GetSortCol(), and SetSorting().

◆ m_symbolsList

◆ QUANTITY_VARIABLE

const wxString FIELDS_EDITOR_GRID_DATA_MODEL::QUANTITY_VARIABLE = wxS( "${QUANTITY}" )
static

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