200 const wxString fieldName = wxS(
"GroupedState" );
201 const wxString fieldValue = wxS(
"Original" );
202 std::set<SCH_SYMBOL*> symbols;
208 if( !symbols.insert( symbol ).second )
218 model.AddColumn( fieldName, fieldName,
false );
221 int fieldCol =
model.GetFieldNameCol( fieldName );
225 model.SetShowColumn( referenceCol,
true );
226 model.SetShowColumn( fieldCol,
true );
227 model.SetGroupingEnabled(
true );
228 model.SetGroupColumn( fieldCol,
true );
234 for(
int row = 0; row <
model.GetNumberRows() && groupedRow < 0; ++row )
236 const std::vector<SCH_REFERENCE> refs =
model.GetRowReferences( row );
238 for(
size_t ii = 1; ii < refs.size(); ++ii )
240 if( refs[ii].GetSymbol() != refs[0].GetSymbol() )
243 symbolToModify = refs[ii].GetSymbol();
543 auto model = MakeScopedModel( wxEmptyString,
name );
545 field->
SetText( wxS(
"base" ) );
546 model->UpdateReferences( m_refs );
547 m_schematic->AddVariant( wxS(
"A" ) );
548 model->SetCurrentVariant( wxS(
"A" ) );
549 model->SetValue( m_row, m_col, wxS(
"A staged" ) );
550 model->RenameStoredVariant( wxS(
"A" ), wxS(
"Renamed" ) );
551 m_schematic->RenameVariant( wxS(
"A" ), wxS(
"Renamed" ),
nullptr );
555 m_schematic->AddVariant( wxS(
"Deleted" ) );
556 model->SetCurrentVariant( wxS(
"Deleted" ) );
557 model->SetValue( m_row, m_col, wxS(
"discarded" ) );
558 model->DeleteStoredVariant( wxS(
"Deleted" ) );
559 m_schematic->DeleteVariant( wxS(
"Deleted" ),
nullptr );
560 model->SetCurrentVariant( wxS(
"Renamed" ) );
595 auto model = MakeScopedModel( wxEmptyString, valueName );
596 int valueCol = m_col;
598 field->
SetText( wxS(
"live" ) );
599 model->UpdateReferences( m_refs );
600 model->AddColumn( wxS(
"Nested" ), wxS(
"Nested" ),
true );
601 int nestedCol =
model->GetFieldNameCol( wxS(
"Nested" ) );
602 model->SetValue( m_row, nestedCol, wxS(
"Value: ${vAlUe}" ) );
603 model->AddColumn( wxS(
"Report" ), wxS(
"Report" ),
true );
604 int reportCol =
model->GetFieldNameCol( wxS(
"Report" ) );
605 model->SetShowColumn( reportCol,
true );
606 model->SetValue( m_row, reportCol, wxS(
"${REFERENCE}: ${NESTED}" ) );
607 model->SetValue( m_row, valueCol, wxS(
"base staged" ) );
608 wxString prefix = m_symbol->GetRef( &m_scopePath,
true ) + wxS(
": Value: " );
612 model->SetCurrentVariant( wxS(
"A" ) );
613 model->SetValue( m_row, nestedCol, wxS(
"Value: ${VALUE}" ) );
614 model->SetValue( m_row, reportCol, wxS(
"${REFERENCE}: ${Nested}" ) );
615 model->SetValue( m_row, valueCol, wxS(
"A staged" ) );
617 model->SetCurrentVariant( wxEmptyString );
658 m_symbol.SetKeyWords( wxS(
"original keywords" ) );
659 m_symbol.GetDescriptionField().SetText( wxS(
"Monostable" ) );
670 model.AddColumn( footprint, footprint,
false );
671 model.SetShowColumn( 0,
true );
672 model.AddColumn( keywords, keywords,
false );
673 model.SetShowColumn( 1,
true );
674 model.AddColumn( wxS(
"PartNumber" ), wxS(
"PartNumber" ),
false );
678 model.AddColumn( description, description,
false );
679 model.AddColumn( value, value,
false );
683 auto rowFor = [&](
const LIB_SYMBOL* aSymbol )
685 for(
int row = 0; row <
model.GetNumberRows(); ++row )
687 if(
model.GetSymbolForRow( row ) == aSymbol )
694 const int parentRow = rowFor( &m_symbol );
695 const int childRow = rowFor( &child );
696 const int grandchildRow = rowFor( &grandchild );
697 BOOST_REQUIRE( parentRow >= 0 && childRow >= 0 && grandchildRow >= 0 );
707 model.UseParentValue( parentRow, 0 );
708 model.UseParentValue( childRow, 4 );
721 model.SetValue( parentRow, 0, wxS(
"Package_DIP:DIP-16_W7.62mm" ) );
722 model.SetValue( parentRow, 1, wxS(
"staged keywords" ) );
723 model.SetValue( parentRow, 3, wxS(
"New description" ) );
730 model.SetValue( childRow, 0, wxS(
"Package_SO:SOIC-16" ) );
731 model.SetValue( childRow, 1, wxS(
"child keywords" ) );
732 model.SetValue( parentRow, 0, wxS(
"Package_DIP:DIP-16" ) );
733 model.SetValue( parentRow, 1, wxS(
"new parent keywords" ) );
739 model.UseParentValue( childRow, 0 );
740 model.UseParentValue( childRow, 1 );
741 model.UseParentValue( childRow, 3 );
767 childOnlyModel.
AddColumn( keywords, keywords,
false );
768 childOnlyModel.RebuildRows();
769 BOOST_CHECK_EQUAL( childOnlyModel.GetResolvedValue( 0, 0 ), wxS(
"new parent keywords" ) );
772 model.SetValue( childRow, 1, wxS(
"new parent keywords" ) );
773 model.SetValue( grandchildRow, 1, wxS(
"new parent keywords" ) );
774 model.SetGroupingEnabled(
true );
775 model.SetGroupColumn( 1,
true );
779 model.UseParentValue( 0, 1 );
783 model.SetFilter( wxS(
"*child*" ) );
788 model.UseParentValue( 0, 1 );