23#include <wx/settings.h>
43 wxGridCellStringRenderer()
47 void Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC& aDC,
const wxRect& aRect,
int aRow,
int aCol,
48 bool isSelected )
override
50 wxString value = aGrid.GetCellValue( aRow, aCol );
53 value =
model->GetResolvedValue( aRow, aCol );
58 wxGridCellRenderer::Draw( aGrid, aAttr, aDC, aRect, aRow, aCol, isSelected );
59 SetTextColoursAndFont( aGrid, aAttr, aDC, isSelected );
60 aGrid.DrawTextRectangle( aDC, value, rect, wxALIGN_LEFT, wxALIGN_CENTRE );
63 wxSize
GetBestSize( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC& aDC,
int aRow,
int aCol )
override
65 wxString value = aGrid.GetCellValue( aRow, aCol );
68 value =
model->GetResolvedValue( aRow, aCol );
70 return wxGridCellStringRenderer::DoGetBestSize( aAttr, aDC, value );
101 default:
return wxT(
"unknown column" );
124 return rowData.
label;
129 return wxT(
"bad wxWidgets!" );
146 wxFAIL_MSG( wxString::Format( wxT(
"column %d doesn't hold a bool value" ), aCol ) );
165 rowData.
label = aValue;
169 wxFAIL_MSG( wxString::Format( wxT(
"column %d doesn't hold a string value" ), aCol ) );
172 GetView()->Refresh();
188 wxFAIL_MSG( wxString::Format( wxT(
"column %d doesn't hold a bool value" ), aCol ) );
194 bool aShow,
bool aGroupBy )
198 if( wxGrid*
grid = GetView() )
200 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
201 grid->ProcessTableMessage( msg );
212 if( wxGrid*
grid = GetView() )
214 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aRow, 1 );
215 grid->ProcessTableMessage( msg );
222 wxCHECK( aRow >= 0 && aRow <
GetNumberRows(), wxEmptyString );
236 rowData.
name = aName;
245 bool aAddedByUser,
const wxString& aVariantName )
251 m_cols.push_back( { aFieldName, aLabel, aAddedByUser,
false,
false } );
259 const wxString& aFieldName,
260 const wxString& aVariantName )
275 if( field->IsPrivate() )
312 if( wxGrid*
grid = GetView() )
314 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_COLS_DELETED, aCol, 1 );
315 grid->ProcessTableMessage( msg );
330 node.key() = newName;
335 m_cols[aCol].m_fieldName = newName;
336 m_cols[aCol].m_label = newName;
342 for(
size_t i = 0; i <
m_cols.size(); i++ )
344 if(
m_cols[i].m_fieldName == aFieldName )
345 return static_cast<int>( i );
354 std::vector<BOM_FIELD> fields;
357 fields.push_back( { col.m_fieldName, col.m_label, col.m_show, col.m_group } );
365 size_t foundCount = 0;
367 for(
const wxString& newField : aNewOrder )
369 if( foundCount >=
m_cols.size() )
374 if( col.m_fieldName == newField )
376 std::swap(
m_cols[foundCount], col );
388 for(
int col = 0; col < aCol; ++col )
407 return GetValue(
m_rows[aRow], aCol, wxT(
", " ), wxT(
"-" ),
true,
false );
413 wxGridCellAttr* attr =
nullptr;
414 bool needsUrlEditor =
false;
415 bool needsVariantHighlight =
false;
416 bool needsTextVarRenderer =
false;
417 wxColour highlightColor;
424 needsUrlEditor =
true;
433 if( rawValue.Contains( wxT(
"${" ) ) )
434 needsTextVarRenderer =
true;
439 && aCol >= 0 && aCol < (
int)
m_cols.size() )
441 const wxString& fieldName =
m_cols[aCol].m_fieldName;
458 symbolKey.push_back( symbol->m_Uuid );
462 wxString currentValue;
467 if( currentValue != defaultValue )
469 needsVariantHighlight =
true;
472 wxColour bg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
473 bool isDark = ( bg.Red() + bg.Green() + bg.Blue() ) < 384;
476 highlightColor = wxColour( 80, 80, 40 );
478 highlightColor = wxColour( 255, 255, 200 );
487 if( !needsUrlEditor && !needsVariantHighlight && !needsTextVarRenderer )
493 if( needsVariantHighlight )
497 attr->SetBackgroundColour( highlightColor );
517 attr =
new wxGridCellAttr();
520 if( needsVariantHighlight )
521 attr->SetBackgroundColour( highlightColor );
523 if( needsTextVarRenderer )
532 if( !needsVariantHighlight )
534 wxColour bg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
535 bool isDark = ( bg.Red() + bg.Green() + bg.Blue() ) < 384;
537 attr->SetBackgroundColour( isDark ? wxColour( 40, 60, 80 )
538 : wxColour( 220, 235, 255 ) );
547 const wxString& refDelimiter,
548 const wxString& refRangeDelimiter,
550 bool listMixedValues )
552 std::vector<SCH_REFERENCE> references;
553 std::set<wxString> mixedValues;
560 references.push_back( ref );
579 else if( refFieldValue.Contains( wxT(
"${" ) ) )
583 std::function<bool( wxString* )> symbolResolver =
584 [&]( wxString* token ) ->
bool
589 refFieldValue =
ExpandTextVars( refFieldValue, & symbolResolver );
593 if( listMixedValues )
594 mixedValues.insert( refFieldValue );
595 else if( &ref == &
group.m_Refs.front() )
596 fieldValue = refFieldValue;
597 else if( fieldValue != refFieldValue )
602 if( listMixedValues )
604 fieldValue = wxEmptyString;
606 for(
const wxString& value : mixedValues )
608 if( value.IsEmpty() )
610 else if( fieldValue.IsEmpty() )
613 fieldValue +=
"," + value;
620 std::sort( references.begin(), references.end(),
623 wxString l_ref( l.GetRef() << l.GetRefNumber() );
624 wxString r_ref( r.GetRef() << r.GetRefNumber() );
625 return StrNumCmp( l_ref, r_ref, true ) < 0;
628 auto logicalEnd = std::unique( references.begin(), references.end(),
633 if( l.GetRefNumber() == wxT(
"?" ) )
636 wxString l_ref( l.GetRef() << l.GetRefNumber() );
637 wxString r_ref( r.GetRef() << r.GetRefNumber() );
638 return l_ref == r_ref;
641 references.erase( logicalEnd, references.end() );
647 fieldValue = wxString::Format( wxT(
"%d" ), (
int) references.size() );
649 fieldValue = wxString::Format( wxT(
"%d" ),
group.m_ItemNumber );
657 wxCHECK_RET( aCol >= 0 && aCol <
static_cast<int>(
m_cols.size() ), wxS(
"Invalid column number" ) );
669 bool isSharedInstance =
false;
678 screen =
static_cast<const SCH_SCREEN*
>( symbol->GetParent() );
680 isSharedInstance = ( screen && ( screen->
GetRefCount() > 1 ) );
681 sharedSymbol = symbol;
694 if( row.m_ItemNumber == aRow + 1 )
714 wxCHECK( aCol >= 0 && aCol <
static_cast<int>(
m_cols.size() ),
false );
721 wxCHECK( aCol >= 0 && aCol <
static_cast<int>(
m_cols.size() ),
false );
728 wxCHECK( aCol >= 0 && aCol <
static_cast<int>(
m_cols.size() ),
false );
735 wxCHECK( aCol >= 0 && aCol <
static_cast<int>(
m_cols.size() ),
false );
742 wxCHECK( aCol >= 0 && aCol <
static_cast<int>(
m_cols.size() ),
false );
753 if( lhGroup.
m_Refs.size() == 0 )
755 else if( rhGroup.
m_Refs.size() == 0 )
761 [ ascending ](
const auto a,
const auto b )
773 wxString lhs = dataModel->
GetValue( lhGroup, sortCol, wxT(
", " ), wxT(
"-" ),
true ).Trim(
true ).Trim(
false );
774 wxString rhs = dataModel->
GetValue( rhGroup, sortCol, wxT(
", " ), wxT(
"-" ),
true ).Trim(
true ).Trim(
false );
778 wxString lhRef = lhGroup.
m_Refs[0].GetRef() + lhGroup.
m_Refs[0].GetRefNumber();
779 wxString rhRef = rhGroup.
m_Refs[0].GetRef() + rhGroup.
m_Refs[0].GetRefNumber();
780 return local_cmp(
StrNumCmp( lhRef, rhRef,
true ), 0 );
797 std::sort( row.m_Refs.begin(), row.m_Refs.end(),
800 wxString lhs_ref( lhs.GetRef() << lhs.GetRefNumber() );
801 wxString rhs_ref( rhs.GetRef() << rhs.GetRefNumber() );
802 return StrNumCmp( lhs_ref, rhs_ref, true ) < 0;
809 return cmp( lhs, rhs, this, m_sortColumn, m_sortAscending );
817 row.m_ItemNumber = itemNumber++;
837 bool matchFound =
false;
844 if(
m_cols[refCol].m_group )
857 for(
size_t i = 0; i <
m_cols.size(); ++i )
860 if(
static_cast<int>( i ) == refCol )
902 const wxString& aFieldName )
909 return wxEmptyString;
921 std::function<bool( wxString* )> symbolResolver =
922 [&]( wxString* token ) ->
bool
930 return wxEmptyString;
936 return aFieldName == wxS(
"${DNP}" )
937 || aFieldName == wxS(
"${EXCLUDE_FROM_BOARD}" )
938 || aFieldName == wxS(
"${EXCLUDE_FROM_BOM}" )
939 || aFieldName == wxS(
"${EXCLUDE_FROM_SIM}" );
944 const wxString& aVariantName )
946 if( aAttributeName == wxS(
"${DNP}" ) )
947 return aRef.
GetSymbolDNP( aVariantName ) ? wxS(
"1" ) : wxS(
"0" );
949 if( aAttributeName == wxS(
"${EXCLUDE_FROM_BOARD}" ) )
952 if( aAttributeName == wxS(
"${EXCLUDE_FROM_BOM}" ) )
955 if( aAttributeName == wxS(
"${EXCLUDE_FROM_SIM}" ) )
963 const wxString& aFieldName )
968 return wxEmptyString;
977 if( field->IsPrivate() )
978 return wxEmptyString;
982 field->GetText( &aRef.
GetSheetPath(), wxEmptyString ) );
990 return wxEmptyString;
995 const wxString& aAttributeName,
996 const wxString& aValue,
997 const wxString& aVariantName )
999 bool attrChanged =
false;
1000 bool newValue = aValue == wxS(
"1" );
1002 if( aAttributeName == wxS(
"${DNP}" ) )
1004 attrChanged = aRef.
GetSymbolDNP( aVariantName ) != newValue;
1007 else if( aAttributeName == wxS(
"${EXCLUDE_FROM_BOARD}" ) )
1012 else if( aAttributeName == wxS(
"${EXCLUDE_FROM_BOM}" ) )
1017 else if( aAttributeName == wxS(
"${EXCLUDE_FROM_SIM}" ) )
1048 static_cast<WX_GRID*
>( GetView() )->CommitPendingChanges(
true );
1050 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0,
m_rows.size() );
1051 GetView()->ProcessTableMessage( msg );
1093 bool isExcluded =
false;
1120 || (
m_scope == SCOPE::SCOPE_SHEET_RECURSIVE
1126 bool matchFound =
false;
1144 row.m_Refs.push_back( ref );
1150 row.m_Refs.push_back( ref );
1162 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
m_rows.size() );
1163 GetView()->ProcessTableMessage( msg );
1172 std::vector<DATA_MODEL_ROW> children;
1176 bool matchFound =
false;
1186 child.m_Refs.push_back( ref );
1195 if( children.size() < 2 )
1198 std::sort( children.begin(), children.end(),
1201 return cmp( lhs, rhs, this, m_sortColumn, m_sortAscending );
1205 m_rows.insert(
m_rows.begin() + aRow + 1, children.begin(), children.end() );
1207 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_INSERTED, aRow, children.size() );
1208 GetView()->ProcessTableMessage( msg );
1214 auto firstChild =
m_rows.begin() + aRow + 1;
1215 auto afterLastChild = firstChild;
1218 while( afterLastChild !=
m_rows.end() && afterLastChild->m_Flag == CHILD_ITEM )
1225 m_rows.erase( firstChild, afterLastChild );
1227 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aRow + 1, deleted );
1228 GetView()->ProcessTableMessage( msg );
1245 for(
size_t i = 0; i <
m_rows.size(); ++i )
1258 for(
size_t i = 0; i <
m_rows.size(); ++i )
1267 const wxString& aVariantName )
1269 bool symbolModified =
false;
1270 std::unique_ptr<SCH_SYMBOL> symbolCopy;
1281 symbolCopy = std::make_unique<SCH_SYMBOL>( *symbol );
1284 const std::map<wxString, wxString>& fieldStore =
m_dataStore[key];
1286 for(
const auto& [srcName, srcValue] : fieldStore )
1302 if( destField && destField->
IsPrivate() )
1304 if( srcValue.IsEmpty() )
1311 bool userAdded = ( col != -1 &&
m_cols[col].m_userAdded );
1314 bool createField = !destField && ( !srcValue.IsEmpty() || userAdded );
1322 destField->
SetVisible( srcTemplate->m_Visible );
1327 symbolModified =
true;
1342 if( !createField && ( previousValue != srcValue ) )
1343 symbolModified =
true;
1346 for(
int ii =
static_cast<int>( symbol->
GetFields().size() ) - 1; ii >= 0; ii-- )
1351 if( fieldStore.count( symbol->
GetFields()[ii].GetName() ) == 0 )
1354 symbolModified =
true;
1358 if( symbolModified && ( symbol != nextSymbol ) )
1362 if( symbol != nextSymbol )
1365 symbolCopy = std::make_unique<SCH_SYMBOL>( *nextSymbol );
1367 symbolCopy.reset(
nullptr );
1369 symbolModified =
false;
1390 for(
unsigned symbolRef = 0; symbolRef <
m_symbolsList.GetCount(); ++symbolRef )
1407 for(
size_t i = 0; i <
m_cols.size(); i++ )
1413 std::set<wxString> seen;
1414 std::vector<wxString> order;
1420 if( !field.
name || seen.count( field.
name ) )
1423 seen.insert( field.
name );
1424 order.emplace_back( field.
name );
1495 for(
size_t col = 0; col <
m_cols.size(); col++ )
1498 last_col =
static_cast<int>( col );
1502 if( last_col == -1 )
1506 [&]( wxString field,
bool last ) -> wxString
1510 field.Replace( wxS(
"\r" ), wxS(
"" ) );
1511 field.Replace( wxS(
"\n" ), wxS(
"" ) );
1516 field.Replace( wxS(
"\t" ), wxS(
"" ) );
1530 for(
size_t col = 0; col <
m_cols.size(); col++ )
1532 if( !
m_cols[col].m_show )
1535 out.Append( formatField(
m_cols[col].m_label, col ==
static_cast<size_t>( last_col ) ) );
1539 for(
size_t row = 0; row <
m_rows.size(); row++ )
1542 if(
GetRowFlags(
static_cast<int>( row ) ) == CHILD_ITEM )
1545 for(
size_t col = 0; col <
m_cols.size(); col++ )
1547 if( !
m_cols[col].m_show )
1551 out.Append( formatField(
GetExportValue(
static_cast<int>( row ),
static_cast<int>( col ),
1553 col ==
static_cast<size_t>( last_col ) ) );
1563 bool refListChanged =
false;
1578 if( !field.IsPrivate() )
1580 wxString
name = field.GetCanonicalName();
1587 refListChanged =
true;
1591 if( refListChanged )
1605 std::vector<KIID_PATH> keysToRemove;
1609 if( !key.empty() && ( key.back() == symbolUuid ) )
1610 keysToRemove.push_back( key );
1613 for(
const KIID_PATH& key : keysToRemove )
1620 return ref.GetSymbol()->m_Uuid == aSymbol.m_Uuid;
1643 const wxString& aVariantName )
1645 bool refListChanged =
false;
1662 refListChanged =
true;
1666 if( refListChanged )
1673 size_t curNumRows =
m_rows.size();
1675 if( aPosition >= curNumRows )
1677 wxFAIL_MSG( wxString::Format( wxT(
"Called FIELDS_EDITOR_GRID_DATA_MODEL::DeleteRows(aPosition=%lu, "
1678 "aNumRows=%lu)\nPosition value is invalid for present table with %lu rows" ),
1679 (
unsigned long) aPosition, (
unsigned long) aNumRows,
1680 (
unsigned long) curNumRows ) );
1685 if( aNumRows > curNumRows - aPosition )
1687 aNumRows = curNumRows - aPosition;
1690 if( aNumRows >= curNumRows )
1697 const auto first =
m_rows.begin() + aPosition;
1698 std::vector<SCH_REFERENCE> dataMapRefs = first->m_Refs;
1699 m_rows.erase( first, first + aNumRows );
1707 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aPosition, aNumRows );
1708 GetView()->ProcessTableMessage( msg );
COMMIT & Modified(EDA_ITEM *aItem, EDA_ITEM *aCopy, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
bool Find(const wxString &aTerm, int &aMatchersTriggered, int &aPosition)
Look in all existing matchers, return the earliest match of any of the existing.
const EDA_ANGLE & GetTextAngle() const
void SetTextPos(const VECTOR2I &aPoint)
virtual void SetVisible(bool aVisible)
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
int GetFieldNameCol(const wxString &aFieldName) const
void AddColumn(const wxString &aFieldName, const wxString &aLabel, bool aAddedByUser, const wxString &aVariantName)
wxString GetColFieldName(int aCol)
std::vector< DATA_MODEL_ROW > m_rows
void SetFieldsOrder(const std::vector< wxString > &aNewOrder)
SCH_REFERENCE_LIST m_symbolsList
The flattened by hierarchy list of symbols.
void SetGroupingEnabled(bool group)
wxGridCellRenderer * m_textVarRenderer
Renderer for cells with text variable references.
void UpdateReferences(const SCH_REFERENCE_LIST &aRefs, const wxString &aVariantName)
bool ColIsItemNumber(int aCol)
int GetNumberCols() override
bool ColIsQuantity(int aCol)
wxString m_currentVariant
Current variant name for highlighting.
bool DeleteRows(size_t aPosition=0, size_t aNumRows=1) override
bool groupMatch(const SCH_REFERENCE &lhRef, const SCH_REFERENCE &rhRef)
wxGridCellAttr * m_urlEditor
void updateDataStoreSymbolField(const SCH_REFERENCE &aSymbolRef, const wxString &aFieldName, const wxString &aVariantName)
BOM_PRESET GetBomSettings()
bool unitMatch(const SCH_REFERENCE &lhRef, const SCH_REFERENCE &rhRef)
wxString getAttributeValue(const SCH_REFERENCE &aRef, const wxString &aAttributeName, const wxString &aVariantNames)
bool ColIsReference(int aCol)
wxString GetExportValue(int aRow, int aCol, const wxString &refDelimiter, const wxString &refRangeDelimiter)
bool GetGroupingEnabled()
wxString getDefaultFieldValue(const SCH_REFERENCE &aRef, const wxString &aFieldName)
Get the default (non-variant) value for a field.
int GetNumberRows() override
void CollapseRow(int aRow)
wxString getFieldShownText(const SCH_REFERENCE &aRef, const wxString &aFieldName)
wxString GetResolvedValue(int aRow, int aCol)
void RenameColumn(int aCol, const wxString &newName)
FIELDS_EDITOR_GRID_DATA_MODEL(const SCH_REFERENCE_LIST &aSymbolsList, wxGridCellAttr *aURLEditor)
bool IsExpanderColumn(int aCol) const override
wxString Export(const BOM_FMT_PRESET &settings)
std::vector< wxString > m_variantNames
Variant names for multi-variant DNP filtering.
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_REFERENCE &aRef, const wxString &aAttributeName, const wxString &aValue, const wxString &aVariantName=wxEmptyString)
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)
void ApplyBomPreset(const BOM_PRESET &preset, const wxString &aVariantName)
static const wxString ITEM_NUMBER_VARIABLE
void SetIncludeExcludedFromBOM(bool include)
bool isAttribute(const wxString &aFieldName)
wxString GetValue(int aRow, int aCol) override
int GetDataWidth(int aCol)
void RemoveColumn(int aCol)
GROUP_TYPE GetRowFlags(int aRow)
const wxString & GetFilter()
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
std::map< KIID_PATH, std::map< wxString, wxString > > m_dataStore
bool ColIsAttribute(int aCol)
void ApplyData(SCH_COMMIT &aCommit, TEMPLATES &aTemplateFieldnames, const wxString &aVariantName)
void SetColLabelValue(int aCol, const wxString &aLabel) override
void SetCurrentVariant(const wxString &aVariantName)
Set the current variant name for highlighting purposes.
void RemoveReferences(const SCH_REFERENCE_LIST &aRefs)
bool GetIncludeExcludedFromBOM()
void SetShowColumn(int aCol, bool show)
void AddReferences(const SCH_REFERENCE_LIST &aRefs)
Cell renderer that shows the expanded result of text variables (e.g.
GRID_CELL_RESOLVED_TEXT_RENDERER()
wxSize GetBestSize(wxGrid &aGrid, wxGridCellAttr &aAttr, wxDC &aDC, int aRow, int aCol) override
wxGridCellRenderer * Clone() const override
void Draw(wxGrid &aGrid, wxGridCellAttr &aAttr, wxDC &aDC, const wxRect &aRect, int aRow, int aCol, bool isSelected) override
wxString ConvertKIIDsToRefs(const wxString &aSource) const
wxString ConvertRefsToKIIDs(const wxString &aSource) const
virtual const wxString & GetText() const override
Return the string associated with the text object.
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0, const wxString &aVariantName=wxEmptyString) const
void SetText(const wxString &aText) override
void SetPrivate(bool aPrivate)
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
bool ResolveExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
static wxString Shorthand(std::vector< SCH_REFERENCE > aList, const wxString &refDelimiter, const wxString &refRangeDelimiter)
Return a shorthand string representing all the references in the list.
A helper to define a symbol's reference designator in a schematic.
void SetSymbolExcludedFromBoard(bool aEnable)
const SCH_SHEET_PATH & GetSheetPath() const
void SetSymbolExcludedFromBOM(bool aEnable, const wxString &aVariant=wxEmptyString)
bool GetSymbolExcludedFromBOM(const wxString &aVariant=wxEmptyString) const
bool GetSymbolDNP(const wxString &aVariant=wxEmptyString) const
SCH_SYMBOL * GetSymbol() const
void SetSymbolExcludedFromSim(bool aEnable, const wxString &aVariant=wxEmptyString)
bool GetSymbolExcludedFromBoard() const
wxString GetFullRef(bool aIncludeUnit=true) const
Return reference name with unit altogether.
bool GetSymbolExcludedFromSim(const wxString &aVariant=wxEmptyString) const
wxString GetRefNumber() const
void SetSymbolDNP(bool aEnable, const wxString &aVariant=wxEmptyString)
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
bool GetExcludedFromBOM() const
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
bool IsContainedWithin(const SCH_SHEET_PATH &aSheetPathToTest) const
Check if this path is contained inside aSheetPathToTest.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
VECTOR2I GetPosition() const override
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
virtual bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
Set or clear the 'Do Not Populate' flag.
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
const TEMPLATE_FIELDNAME * GetFieldName(const wxString &aName)
Search for aName in the template field name list.
void SetValueAsBool(int aRow, int aCol, bool aValue) override
wxString GetCanonicalFieldName(int aRow)
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 GetValueAsBool(int aRow, int aCol) override
void SetCanonicalFieldName(int aRow, const wxString &aName)
wxString GetValue(int aRow, int aCol) override
wxGridCellAttr * enhanceAttr(wxGridCellAttr *aInputAttr, int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind)
std::map< int, wxGridCellAttr * > m_colAttrs
wxGridCellAttr * GetAttr(int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind) override
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject, int aFlags)
bool IsGeneratedField(const wxString &aSource)
Returns true if the string is generated, e.g contains a single text var reference.
static KIID_PATH makeDataStoreKey(const SCH_SHEET_PATH &aSheetPath, const SCH_SYMBOL &aSymbol)
Create a unique key for the data store by combining the KIID_PATH from the SCH_SHEET_PATH with the sy...
#define DISPLAY_NAME_COLUMN
#define SHOW_FIELD_COLUMN
KICOMMON_API wxSize GetTextSize(const wxString &aSingleLine, wxWindow *aWindow)
Return the size of aSingleLine of text when it is rendered in aWindow using whatever font is currentl...
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
int ValueStringCompare(const wxString &strFWord, const wxString &strSWord)
Compare strings like the strcmp function but handle numbers and modifiers within the string text corr...
bool IsURL(wxString aStr)
Performs a URL sniff-test on a string.
wxString refRangeDelimiter
std::vector< BOM_FIELD > fieldsOrdered
bool includeExcludedFromBOM
std::vector< SCH_REFERENCE > m_Refs
Hold a name of a symbol's field, field value, and default visibility.
wxString GetDefaultFieldName(FIELD_T aFieldId, bool aTranslateForHI)
Return a default symbol field name for a mandatory field type.
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
@ USER
The field ID hasn't been set yet; field is invalid.
@ DATASHEET
name of datasheet
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
wxString GetCanonicalFieldName(FIELD_T aFieldType)
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
GROUP_COLLAPSED_DURING_SORT