34 m_Refs( { aFirstReference } )
40 std::vector<const LIB_SYMBOL*>
m_Refs;
96 pair.second->DecRef();
107 void AddColumn(
const wxString& aFieldName,
const wxString& aLabel,
bool aAddedByUser,
bool aIsCheckbox );
113 wxCHECK_RET( aCol >= 0 && aCol < (
int)
m_cols.size(),
"Invalid Column Number" );
115 if( aCol == aNewPos )
119 else if( aCol < aNewPos )
121 std::rotate( std::begin(
m_cols ) + aCol, std::begin(
m_cols ) + aCol + 1,
122 std::begin(
m_cols ) + aNewPos + 1 );
126 std::rotate( std::begin(
m_cols ) + aNewPos, std::begin(
m_cols ) + aCol,
127 std::begin(
m_cols ) + aCol + 1 );
136 wxCHECK_RET( aCol >= 0 && aCol < (
int)
m_cols.size(),
"Invalid Column Number" );
137 m_cols[aCol].m_label = aLabel;
142 wxCHECK( aCol >= 0 && aCol < (
int)
m_cols.size(), wxString() );
143 return m_cols[aCol].m_label;
148 wxCHECK( aCol >= 0 && aCol < (
int)
m_cols.size(), wxString() );
149 return m_cols[aCol].m_fieldName;
161 wxString
GetValue(
int aRow,
int aCol )
override;
164 void SetValue(
int aRow,
int aCol,
const wxString& aValue )
override;
166 wxGridCellAttr*
GetAttr(
int row,
int col, wxGridCellAttr::wxAttrKind kind )
override;
175 wxCHECK_RET( aCol >= 0 && aCol < (
int)
m_cols.size(),
"Invalid Column Number" );
184 wxCHECK( aRow >= 0 && aRow < (
int)
m_rows.size(),
nullptr );
185 return m_rows[aRow].m_Refs[0];
193 aList.Add( symbol->GetName() );
206 std::function<
void()> postApplyHandler =
nullptr );
228 wxCHECK_RET( aCol >= 0 && aCol < (
int)
m_cols.size(),
"Invalid Column Number" );
234 wxCHECK_MSG( aCol >= 0 && aCol < (
int)
m_cols.size(),
false,
"Invalid Column Number" );
235 return m_cols[aCol].m_group;
240 wxCHECK_RET( aCol >= 0 && aCol < (
int)
m_cols.size(),
"Invalid Column Number" );
241 m_cols[aCol].m_show = show;
246 wxCHECK_MSG( aCol >= 0 && aCol < (
int)
m_cols.size(),
false,
"Invalid Column Number" );
247 return m_cols[aCol].m_show;
252 wxCHECK_MSG( aRow >= 0 && aRow < (
int)
m_rows.size(),
false,
"Invalid Row Number" );
258 wxCHECK_MSG( aRow >= 0 && aRow < (
int)
m_rows.size(),
false,
"Invalid Row Number" );
259 wxCHECK_MSG( aCol >= 0 && aCol < (
int)
m_cols.size(),
false,
"Invalid Column Number" );
265 wxCHECK_MSG( aRow >= 0 && aRow < (
int)
m_rows.size(),
false,
"Invalid Row Number" );
266 wxCHECK_MSG( aCol >= 0 && aCol < (
int)
m_cols.size(),
false,
"Invalid Column Number" );
272 wxCHECK_MSG( aRow >= 0 && aRow < (
int)
m_rows.size(),
false,
"Invalid Row Number" );
285 const KIID& aNewSymbolUuid );
wxString GetColLabelValue(int aCol) override
void SetFieldsOrder(const std::vector< wxString > &aNewOrder)
bool GetShowColumn(int aCol)
wxGridCellRenderer * getStripedRenderer(int aCol) const
int GetNumberRows() override
void SetValue(int aRow, int aCol, const wxString &aValue) override
void GetSymbolNames(wxArrayString &aList)
wxString GetColFieldName(int aCol)
wxString getAttributeValue(const LIB_SYMBOL *, const wxString &aAttributeName)
bool IsCellClear(int aRow, int aCol)
std::vector< std::pair< LIB_SYMBOL *, wxString > > m_createdDerivedSymbols
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)
std::map< KIID, std::map< wxString, LIB_DATA_ELEMENT > > m_dataStore
void MoveColumn(int aCol, int aNewPos)
void SetGroupingEnabled(bool group)
bool GetGroupColumn(int aCol)
static const wxString ITEM_NUMBER_VARIABLE
std::map< wxString, wxGridCellRenderer * > m_stripedRenderers
wxGridCellAttr * GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind) override
bool ColIsValue(int aCol)
void SetGroupColumn(int aCol, bool group)
void CreateDerivedSymbolImmediate(int aRow, int aCol, wxString &aNewSymbolName)
bool isStripeableField(int aCol)
wxString GetValue(int aRow, int aCol) override
void RemoveColumn(int aCol)
bool ColIsCheck(int aCol)
void createActualDerivedSymbol(const LIB_SYMBOL *aParentSymbol, const wxString &aNewSymbolName, const KIID &aNewSymbolUuid)
std::vector< LIB_DATA_MODEL_COL > m_cols
void AddColumn(const wxString &aFieldName, const wxString &aLabel, bool aAddedByUser, bool aIsCheckbox)
void ApplyData(std::function< void(LIB_SYMBOL *)> symbolChangeHandler, std::function< void()> postApplyHandler=nullptr)
void ExpandCollapseRow(int aRow)
std::vector< LIB_DATA_MODEL_ROW > m_rows
int GetFieldNameCol(const wxString &aFieldName)
void updateDataStoreSymbolField(const LIB_SYMBOL *aSymbol, const wxString &aFieldName)
void RenameColumn(int aCol, const wxString &newName)
std::vector< LIB_SYMBOL * > m_symbolsList
void SetColLabelValue(int aCol, const wxString &aLabel) override
STRIPED_STRING_RENDERER * m_stripedStringRenderer
const wxString & GetFilter()
bool IsRowEditable(int aRow)
bool groupMatch(const LIB_SYMBOL *lhRef, const LIB_SYMBOL *rhRef)
void SetSorting(int aCol, bool ascending)
int GetDataWidth(int aCol)
void CreateDerivedSymbol(int aRow, int aCol, wxString &aNewSymbolName)
void ClearCell(int aRow, int aCol)
void setAttributeValue(LIB_SYMBOL *aSymbol, const wxString &aAttributeName, const wxString &aValue)
~LIB_FIELDS_EDITOR_GRID_DATA_MODEL() override
static const wxString QUANTITY_VARIABLE
bool IsRowSingleSymbol(int aRow)
std::vector< std::pair< LIB_SYMBOL *, wxString > > GetAndClearCreatedDerivedSymbols()
Get and clear the list of newly created derived symbols for library manager processing.
bool GetGroupingEnabled()
void SetFilter(const wxString &aFilter)
void CollapseRow(int aRow)
wxString GetTypeName(int row, int col) override
const LIB_SYMBOL * GetSymbolForRow(int aRow)
bool IsCellEdited(int aRow, int aCol)
LIB_FIELDS_EDITOR_GRID_DATA_MODEL()
void SetShowColumn(int aCol, bool show)
void SetSymbols(const std::vector< LIB_SYMBOL * > &aSymbolsList)
bool IsEmptyCell(int aRow, int aCol) override
int GetNumberCols() override
Define a library symbol object.
STRIPED_CELL_RENDERER< wxGridCellStringRenderer > STRIPED_STRING_RENDERER
bool m_createDerivedSymbol
wxString m_derivedSymbolName
LIB_DATA_MODEL_ROW(const LIB_SYMBOL *aFirstReference, GROUP_TYPE aType)
std::vector< const LIB_SYMBOL * > m_Refs
wxString result
Test unit parsing edge cases and error handling.