33#define DISPLAY_NAME_COLUMN 0
35#define SHOW_FIELD_COLUMN 2
36#define GROUP_BY_COLUMN 3
37#define VIEW_FIELDS_COL_COUNT 4
60 bool CanGetValueAs(
int aRow,
int aCol,
const wxString& aTypeName )
override
65 case LABEL_COLUMN:
return aTypeName == wxGRID_VALUE_STRING;
70 default: wxFAIL;
return false;
74 bool CanSetValueAs(
int aRow,
int aCol,
const wxString& aTypeName )
override
79 wxString
GetValue(
int aRow,
int aCol )
override;
82 void SetValue(
int aRow,
int aCol,
const wxString& aValue )
override;
85 void AppendRow(
const wxString& aFieldName,
const wxString& aBOMName,
bool aShow,
bool aGroupBy );
112 m_Refs.push_back( aFirstReference );
165 void AddColumn(
const wxString& aFieldName,
const wxString& aLabel,
bool aAddedByUser );
171 wxCHECK_RET( aCol >= 0 && aCol <
static_cast<int>(
m_cols.size() ),
"Invalid Column Number" );
173 if( aCol == aNewPos )
177 else if( aCol < aNewPos )
179 std::rotate( std::begin(
m_cols ) + aCol, std::begin(
m_cols ) + aCol + 1,
180 std::begin(
m_cols ) + aNewPos + 1 );
184 std::rotate( std::begin(
m_cols ) + aNewPos, std::begin(
m_cols ) + aCol,
185 std::begin(
m_cols ) + aCol + 1 );
194 wxCHECK_RET( aCol >= 0 && aCol <
static_cast<int>(
m_cols.size() ),
"Invalid Column Number" );
195 m_cols[aCol].m_label = aLabel;
200 wxCHECK( aCol >= 0 && aCol <
static_cast<int>(
m_cols.size() ), wxString() );
201 return m_cols[aCol].m_label;
206 wxCHECK( aCol >= 0 && aCol <
static_cast<int>(
m_cols.size() ), wxString() );
207 return m_cols[aCol].m_fieldName;
220 wxString
GetValue(
int aRow,
int aCol )
override;
221 wxGridCellAttr*
GetAttr(
int aRow,
int aCol, wxGridCellAttr::wxAttrKind aKind )
override;
224 const wxString& refDelimiter = wxT(
", " ),
225 const wxString& refRangDelimiter = wxT(
"-" ),
226 bool resolveVars =
false,
227 bool listMixedValues =
false );
230 const wxString& refRangeDelimiter )
232 return GetValue(
m_rows[aRow], aCol, refDelimiter, refRangeDelimiter,
true,
true );
235 void SetValue(
int aRow,
int aCol,
const wxString& aValue )
override;
241 wxCHECK( aRow >= 0 && aRow < (
int)
m_rows.size(), std::vector<SCH_REFERENCE>() );
242 return m_rows[aRow].m_Refs;
253 wxCHECK_RET( aCol >= 0 && aCol < (
int)
m_cols.size(),
"Invalid Column Number" );
303 wxCHECK_RET( aCol >= 0 && aCol < (
int)
m_cols.size(),
"Invalid Column Number" );
309 wxCHECK_MSG( aCol >= 0 && aCol < (
int)
m_cols.size(),
false,
"Invalid Column Number" );
310 return m_cols[aCol].m_group;
315 wxCHECK_RET( aCol >= 0 && aCol < (
int)
m_cols.size(),
"Invalid Column Number" );
316 m_cols[aCol].m_show = show;
321 wxCHECK_MSG( aCol >= 0 && aCol < (
int)
m_cols.size(),
false,
"Invalid Column Number" );
322 return m_cols[aCol].m_show;
int GetFieldNameCol(const wxString &aFieldName) const
wxString GetColFieldName(int aCol)
std::vector< DATA_MODEL_ROW > m_rows
void ApplyBomPreset(const BOM_PRESET &preset)
void SetFieldsOrder(const std::vector< wxString > &aNewOrder)
std::vector< SCH_REFERENCE > GetRowReferences(int aRow) const
SCH_REFERENCE_LIST m_symbolsList
The flattened by hierarchy list of symbols.
void SetGroupingEnabled(bool group)
wxString getAttributeValue(const SCH_SYMBOL &, const wxString &aAttributeName)
bool ColIsItemNumber(int aCol)
int GetNumberCols() override
bool ColIsQuantity(int aCol)
bool GetGroupColumn(int aCol)
void updateDataStoreSymbolField(const SCH_SYMBOL &aSymbol, const wxString &aFieldName)
bool groupMatch(const SCH_REFERENCE &lhRef, const SCH_REFERENCE &rhRef)
wxGridCellAttr * m_urlEditor
const SCH_SHEET_PATH & GetPath()
wxString GetColLabelValue(int aCol) override
BOM_PRESET GetBomSettings()
void SetScope(SCOPE aScope)
bool unitMatch(const SCH_REFERENCE &lhRef, const SCH_REFERENCE &rhRef)
bool ColIsReference(int aCol)
wxString GetExportValue(int aRow, int aCol, const wxString &refDelimiter, const wxString &refRangeDelimiter)
bool GetGroupingEnabled()
void SetPath(const SCH_SHEET_PATH &aPath)
int GetNumberRows() override
void CollapseRow(int aRow)
wxString getFieldShownText(const SCH_REFERENCE &aRef, const wxString &aFieldName)
bool IsEmptyCell(int aRow, int aCol) override
void RenameColumn(int aCol, const wxString &newName)
FIELDS_EDITOR_GRID_DATA_MODEL(const SCH_REFERENCE_LIST &aSymbolsList, wxGridCellAttr *aURLEditor)
wxString Export(const BOM_FMT_PRESET &settings)
void AddColumn(const wxString &aFieldName, const wxString &aLabel, bool aAddedByUser)
std::vector< DATA_MODEL_COL > m_cols
void SetSorting(int aCol, bool ascending)
void ExpandCollapseRow(int aRow)
wxGridCellAttr * GetAttr(int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind) override
void SetFilter(const wxString &aFilter)
bool setAttributeValue(SCH_SYMBOL &aSymbol, const wxString &aAttributeName, const wxString &aValue)
Set the attribute value.
static bool cmp(const DATA_MODEL_ROW &lhGroup, const DATA_MODEL_ROW &rhGroup, FIELDS_EDITOR_GRID_DATA_MODEL *dataModel, int sortCol, bool ascending)
static const wxString ITEM_NUMBER_VARIABLE
void ApplyData(SCH_COMMIT &aCommit, TEMPLATES &aTemplateFieldnames)
void SetIncludeExcludedFromBOM(bool include)
bool isAttribute(const wxString &aFieldName)
wxString GetValue(int aRow, int aCol) override
int GetDataWidth(int aCol)
void UpdateReferences(const SCH_REFERENCE_LIST &aRefs)
void RemoveColumn(int aCol)
~FIELDS_EDITOR_GRID_DATA_MODEL() override
GROUP_TYPE GetRowFlags(int aRow)
const wxString & GetFilter()
std::map< KIID, std::map< wxString, wxString > > m_dataStore
static const wxString QUANTITY_VARIABLE
bool ColIsValue(int aCol)
void SetGroupColumn(int aCol, bool group)
void SetExcludeDNP(bool exclude)
void RemoveSymbol(const SCH_SYMBOL &aSymbol)
std::vector< BOM_FIELD > GetFieldsOrdered()
void SetValue(int aRow, int aCol, const wxString &aValue) override
bool ColIsAttribute(int aCol)
bool GetShowColumn(int aCol)
void SetColLabelValue(int aCol, const wxString &aLabel) override
void MoveColumn(int aCol, int aNewPos)
void RemoveReferences(const SCH_REFERENCE_LIST &aRefs)
bool GetIncludeExcludedFromBOM()
void SetShowColumn(int aCol, bool show)
void AddReferences(const SCH_REFERENCE_LIST &aRefs)
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
A helper to define a symbol's reference designator in a schematic.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
VIEW_CONTROLS_GRID_DATA_MODEL(bool aForBOM)
bool IsEmptyCell(int aRow, int aCol) override
void SetValueAsBool(int aRow, int aCol, bool aValue) override
wxString GetCanonicalFieldName(int aRow)
~VIEW_CONTROLS_GRID_DATA_MODEL() override=default
wxString GetColLabelValue(int aCol) override
std::vector< BOM_FIELD > m_fields
void SetValue(int aRow, int aCol, const wxString &aValue) override
int GetNumberRows() override
void AppendRow(const wxString &aFieldName, const wxString &aBOMName, bool aShow, bool aGroupBy)
bool CanSetValueAs(int aRow, int aCol, const wxString &aTypeName) override
bool GetValueAsBool(int aRow, int aCol) override
bool CanGetValueAs(int aRow, int aCol, const wxString &aTypeName) override
void SetCanonicalFieldName(int aRow, const wxString &aName)
wxString GetValue(int aRow, int aCol) override
int GetNumberCols() override
@ GROUP_COLLAPSED_DURING_SORT
#define DISPLAY_NAME_COLUMN
#define SHOW_FIELD_COLUMN
#define VIEW_FIELDS_COL_COUNT
std::vector< SCH_REFERENCE > m_Refs
DATA_MODEL_ROW(const SCH_REFERENCE &aFirstReference, GROUP_TYPE aType)