Prepare for MODULE -> FOOTPRINT.
This commit is contained in:
parent
2bc004eb0b
commit
f0d0e17aab
|
@ -46,10 +46,10 @@ const wxString TEMPLATE_FIELDNAME::GetDefaultFieldName( int aFieldNdx, bool aTra
|
|||
{
|
||||
switch( aFieldNdx )
|
||||
{
|
||||
case REFERENCE: return REFCANONICAL; // The component reference, R1, C1, etc.
|
||||
case VALUE: return VALCANONICAL; // The component value + name
|
||||
case FOOTPRINT: return FTPCANONICAL; // The footprint for use with Pcbnew
|
||||
case DATASHEET: return DSHCANONICAL; // Link to a datasheet for component
|
||||
case REFERENCE_FIELD: return REFCANONICAL; // The component reference, R1, C1, etc.
|
||||
case VALUE_FIELD: return VALCANONICAL; // The component value + name
|
||||
case FOOTPRINT_FIELD: return FTPCANONICAL; // The footprint for use with Pcbnew
|
||||
case DATASHEET_FIELD: return DSHCANONICAL; // Link to a datasheet for component
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,11 +68,11 @@ const wxString TEMPLATE_FIELDNAME::GetDefaultFieldName( int aFieldNdx, bool aTra
|
|||
// Fixed values for the mandatory fields
|
||||
switch( aFieldNdx )
|
||||
{
|
||||
case REFERENCE: return referenceDefault; // The component reference, R1, C1, etc.
|
||||
case VALUE: return valueDefault; // The component value + name
|
||||
case FOOTPRINT: return footprintDefault; // The footprint for use with Pcbnew
|
||||
case DATASHEET: return datasheetDefault; // Link to a datasheet for component
|
||||
default: return wxString::Format( fieldDefault, aFieldNdx );
|
||||
case REFERENCE_FIELD: return referenceDefault; // The component reference, R1, C1, etc.
|
||||
case VALUE_FIELD: return valueDefault; // The component value + name
|
||||
case FOOTPRINT_FIELD: return footprintDefault; // The footprint for use with Pcbnew
|
||||
case DATASHEET_FIELD: return datasheetDefault; // Link to a datasheet for component
|
||||
default: return wxString::Format( fieldDefault, aFieldNdx );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,10 +41,10 @@ class TEMPLATE_FIELDNAMES_LEXER;
|
|||
* user defined fields, only some of which have indices defined here.
|
||||
*/
|
||||
enum NumFieldType {
|
||||
REFERENCE = 0, ///< Field Reference of part, i.e. "IC21"
|
||||
VALUE, ///< Field Value of part, i.e. "3.3K"
|
||||
FOOTPRINT, ///< Field Name Module PCB, i.e. "16DIP300"
|
||||
DATASHEET, ///< name of datasheet
|
||||
REFERENCE_FIELD = 0, ///< Field Reference of part, i.e. "IC21"
|
||||
VALUE_FIELD, ///< Field Value of part, i.e. "3.3K"
|
||||
FOOTPRINT_FIELD, ///< Field Name Module PCB, i.e. "16DIP300"
|
||||
DATASHEET_FIELD, ///< name of datasheet
|
||||
|
||||
/// The first 4 are mandatory, and must be instantiated in SCH_COMPONENT
|
||||
/// and LIB_PART constructors
|
||||
|
|
|
@ -99,10 +99,10 @@ LIB_PART::LIB_PART( const wxString& aName, LIB_PART* aParent, PART_LIB* aLibrary
|
|||
// Add the MANDATORY_FIELDS in RAM only. These are assumed to be present
|
||||
// when the field editors are invoked.
|
||||
m_drawings[LIB_FIELD_T].reserve( 4 );
|
||||
m_drawings[LIB_FIELD_T].push_back( new LIB_FIELD( this, VALUE ) );
|
||||
m_drawings[LIB_FIELD_T].push_back( new LIB_FIELD( this, REFERENCE ) );
|
||||
m_drawings[LIB_FIELD_T].push_back( new LIB_FIELD( this, FOOTPRINT ) );
|
||||
m_drawings[LIB_FIELD_T].push_back( new LIB_FIELD( this, DATASHEET ) );
|
||||
m_drawings[LIB_FIELD_T].push_back( new LIB_FIELD( this, VALUE_FIELD ) );
|
||||
m_drawings[LIB_FIELD_T].push_back( new LIB_FIELD( this, REFERENCE_FIELD ) );
|
||||
m_drawings[LIB_FIELD_T].push_back( new LIB_FIELD( this, FOOTPRINT_FIELD ) );
|
||||
m_drawings[LIB_FIELD_T].push_back( new LIB_FIELD( this, DATASHEET_FIELD ) );
|
||||
|
||||
SetName( aName );
|
||||
|
||||
|
@ -574,7 +574,7 @@ void LIB_PART::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert,
|
|||
// to add '?' and the part id
|
||||
wxString tmp = field.GetShownText();
|
||||
|
||||
if( field.GetId() == REFERENCE )
|
||||
if( field.GetId() == REFERENCE_FIELD )
|
||||
{
|
||||
wxString text = field.GetFullText( aUnit );
|
||||
field.SetText( text );
|
||||
|
@ -913,7 +913,7 @@ const LIB_FIELD* LIB_PART::FindField( const wxString& aFieldName ) const
|
|||
|
||||
LIB_FIELD& LIB_PART::GetValueField()
|
||||
{
|
||||
LIB_FIELD* field = GetField( VALUE );
|
||||
LIB_FIELD* field = GetField( VALUE_FIELD );
|
||||
wxASSERT( field != NULL );
|
||||
return *field;
|
||||
}
|
||||
|
@ -921,7 +921,7 @@ LIB_FIELD& LIB_PART::GetValueField()
|
|||
|
||||
LIB_FIELD& LIB_PART::GetReferenceField()
|
||||
{
|
||||
LIB_FIELD* field = GetField( REFERENCE );
|
||||
LIB_FIELD* field = GetField( REFERENCE_FIELD );
|
||||
wxASSERT( field != NULL );
|
||||
return *field;
|
||||
}
|
||||
|
@ -929,7 +929,7 @@ LIB_FIELD& LIB_PART::GetReferenceField()
|
|||
|
||||
LIB_FIELD& LIB_PART::GetFootprintField()
|
||||
{
|
||||
LIB_FIELD* field = GetField( FOOTPRINT );
|
||||
LIB_FIELD* field = GetField( FOOTPRINT_FIELD );
|
||||
wxASSERT( field != NULL );
|
||||
return *field;
|
||||
}
|
||||
|
@ -937,7 +937,7 @@ LIB_FIELD& LIB_PART::GetFootprintField()
|
|||
|
||||
LIB_FIELD& LIB_PART::GetDatasheetField()
|
||||
{
|
||||
LIB_FIELD* field = GetField( DATASHEET );
|
||||
LIB_FIELD* field = GetField( DATASHEET_FIELD );
|
||||
wxASSERT( field != NULL );
|
||||
return *field;
|
||||
}
|
||||
|
|
|
@ -377,12 +377,16 @@ std::string FormatProbeItem( EDA_ITEM* aItem, SCH_COMPONENT* aComp )
|
|||
{
|
||||
case SCH_FIELD_T:
|
||||
if( aComp )
|
||||
return StrPrintf( "$PART: \"%s\"", TO_UTF8( aComp->GetField( REFERENCE )->GetText() ) );
|
||||
{
|
||||
return StrPrintf( "$PART: \"%s\"",
|
||||
TO_UTF8( aComp->GetField( REFERENCE_FIELD )->GetText() ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case SCH_COMPONENT_T:
|
||||
aComp = (SCH_COMPONENT*) aItem;
|
||||
return StrPrintf( "$PART: \"%s\"", TO_UTF8( aComp->GetField( REFERENCE )->GetText() ) );
|
||||
return StrPrintf( "$PART: \"%s\"",
|
||||
TO_UTF8( aComp->GetField( REFERENCE_FIELD )->GetText() ) );
|
||||
|
||||
case SCH_SHEET_T:
|
||||
{
|
||||
|
@ -415,12 +419,12 @@ std::string FormatProbeItem( EDA_ITEM* aItem, SCH_COMPONENT* aComp )
|
|||
{
|
||||
return StrPrintf( "$PIN: \"%s\" $PART: \"%s\"",
|
||||
TO_UTF8( pin->GetNumber() ),
|
||||
TO_UTF8( aComp->GetField( REFERENCE )->GetText() ) );
|
||||
TO_UTF8( aComp->GetField( REFERENCE_FIELD )->GetText() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return StrPrintf( "$PART: \"%s\"",
|
||||
TO_UTF8( aComp->GetField( REFERENCE )->GetText() ) );
|
||||
TO_UTF8( aComp->GetField( REFERENCE_FIELD )->GetText() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_COMPO
|
|||
{
|
||||
m_fieldsBox->Append( TEMPLATE_FIELDNAME::GetDefaultFieldName( i ) );
|
||||
|
||||
if( i != REFERENCE && i != VALUE )
|
||||
if( i != REFERENCE_FIELD && i != VALUE_FIELD )
|
||||
m_fieldsBox->Check( i, true );
|
||||
}
|
||||
|
||||
|
|
|
@ -395,7 +395,7 @@ void DIALOG_CHOOSE_COMPONENT::ShowFootprintFor( LIB_ID const& aLibId )
|
|||
if( !symbol )
|
||||
return;
|
||||
|
||||
LIB_FIELD* fp_field = symbol->GetField( FOOTPRINT );
|
||||
LIB_FIELD* fp_field = symbol->GetField( FOOTPRINT_FIELD );
|
||||
wxString fp_name = fp_field ? fp_field->GetFullText() : wxString( "" );
|
||||
|
||||
ShowFootprint( fp_name );
|
||||
|
@ -457,7 +457,7 @@ void DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector( LIB_ID const& aLibId )
|
|||
if( symbol != nullptr )
|
||||
{
|
||||
LIB_PINS temp_pins;
|
||||
LIB_FIELD* fp_field = symbol->GetField( FOOTPRINT );
|
||||
LIB_FIELD* fp_field = symbol->GetField( FOOTPRINT_FIELD );
|
||||
wxString fp_name = fp_field ? fp_field->GetFullText() : wxString( "" );
|
||||
|
||||
symbol->GetPins( temp_pins );
|
||||
|
@ -483,11 +483,11 @@ void DIALOG_CHOOSE_COMPONENT::OnFootprintSelected( wxCommandEvent& aEvent )
|
|||
m_field_edits.erase( std::remove_if( m_field_edits.begin(), m_field_edits.end(),
|
||||
[]( std::pair<int, wxString> const& i )
|
||||
{
|
||||
return i.first == FOOTPRINT;
|
||||
return i.first == FOOTPRINT_FIELD;
|
||||
} ),
|
||||
m_field_edits.end() );
|
||||
|
||||
m_field_edits.emplace_back( std::make_pair( FOOTPRINT, m_fp_override ) );
|
||||
m_field_edits.emplace_back( std::make_pair( FOOTPRINT_FIELD, m_fp_override ) );
|
||||
|
||||
ShowFootprint( m_fp_override );
|
||||
}
|
||||
|
|
|
@ -753,7 +753,7 @@ bool DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow()
|
|||
m_isModified = true;
|
||||
|
||||
cmp.m_Screen->Remove( cmp.m_Component );
|
||||
SCH_FIELD* value = cmp.m_Component->GetField( VALUE );
|
||||
SCH_FIELD* value = cmp.m_Component->GetField( VALUE_FIELD );
|
||||
|
||||
// If value is a proxy for the itemName then make sure it gets updated
|
||||
if( cmp.m_Component->GetLibId().GetLibItemName().wx_str() == value->GetText() )
|
||||
|
|
|
@ -53,7 +53,7 @@ DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent, const wxS
|
|||
SetTitle( aTitle );
|
||||
|
||||
// The field ID and power status are Initialized in the derived object's ctor.
|
||||
m_fieldId = VALUE;
|
||||
m_fieldId = VALUE_FIELD;
|
||||
m_isPower = false;
|
||||
|
||||
m_scintillaTricks = new SCINTILLA_TRICKS( m_StyledTextCtrl, wxT( "{}" ) );
|
||||
|
@ -87,7 +87,7 @@ void DIALOG_EDIT_ONE_FIELD::init()
|
|||
m_CommonConvert->Show( false );
|
||||
m_CommonUnit->Show( false );
|
||||
|
||||
if( !isSymbolEditor && ( m_fieldId == REFERENCE || m_fieldId == VALUE ) )
|
||||
if( !isSymbolEditor && ( m_fieldId == REFERENCE_FIELD || m_fieldId == VALUE_FIELD ) )
|
||||
{
|
||||
m_StyledTextCtrl->Show( false );
|
||||
SetInitialFocus( m_TextCtrl );
|
||||
|
@ -100,11 +100,11 @@ void DIALOG_EDIT_ONE_FIELD::init()
|
|||
|
||||
// Show the footprint selection dialog if this is the footprint field.
|
||||
m_TextValueSelectButton->SetBitmap( KiBitmap( small_library_xpm ) );
|
||||
m_TextValueSelectButton->Show( m_fieldId == FOOTPRINT );
|
||||
m_TextValueSelectButton->Show( m_fieldId == FOOTPRINT_FIELD );
|
||||
|
||||
// Value fields of power components cannot be modified. This will grey out
|
||||
// the text box and display an explanation.
|
||||
if( m_fieldId == VALUE && m_isPower )
|
||||
if( m_fieldId == VALUE_FIELD && m_isPower )
|
||||
{
|
||||
m_PowerComponentValues->Show( true );
|
||||
m_TextCtrl->Enable( false );
|
||||
|
@ -167,13 +167,13 @@ void DIALOG_EDIT_ONE_FIELD::OnSetFocusText( wxFocusEvent& event )
|
|||
// Note that we can't do this on OSX as it tends to provoke Apple's
|
||||
// "[NSAlert runModal] may not be invoked inside of transaction begin/commit pair"
|
||||
// bug. See: https://bugs.launchpad.net/kicad/+bug/1837225
|
||||
if( m_fieldId == REFERENCE || m_fieldId == VALUE || m_fieldId == SHEETNAME_V )
|
||||
if( m_fieldId == REFERENCE_FIELD || m_fieldId == VALUE_FIELD || m_fieldId == SHEETNAME_V )
|
||||
m_TextCtrl->Update();
|
||||
#endif
|
||||
|
||||
if( m_fieldId == REFERENCE )
|
||||
if( m_fieldId == REFERENCE_FIELD )
|
||||
KIUI::SelectReferenceNumber( static_cast<wxTextEntry*>( m_TextCtrl ) );
|
||||
else if( m_fieldId == VALUE || m_fieldId == SHEETNAME_V )
|
||||
else if( m_fieldId == VALUE_FIELD || m_fieldId == SHEETNAME_V )
|
||||
m_TextCtrl->SetSelection( -1, -1 );
|
||||
|
||||
event.Skip();
|
||||
|
@ -208,7 +208,7 @@ bool DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow()
|
|||
else if( m_StyledTextCtrl->IsShown() )
|
||||
m_text = m_StyledTextCtrl->GetValue();
|
||||
|
||||
if( m_fieldId == REFERENCE )
|
||||
if( m_fieldId == REFERENCE_FIELD )
|
||||
{
|
||||
// Test if the reference string is valid:
|
||||
if( !SCH_COMPONENT::IsReferenceStringValid( m_text ) )
|
||||
|
@ -217,7 +217,7 @@ bool DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow()
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else if( m_fieldId == VALUE )
|
||||
else if( m_fieldId == VALUE_FIELD )
|
||||
{
|
||||
if( m_text.IsEmpty() )
|
||||
{
|
||||
|
@ -395,11 +395,11 @@ void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH*
|
|||
{
|
||||
SCH_COMPONENT* comp = static_cast<SCH_COMPONENT*>( parent );
|
||||
|
||||
if( fieldType == REFERENCE )
|
||||
if( fieldType == REFERENCE_FIELD )
|
||||
comp->SetRef( aSheetPath, m_text );
|
||||
else if( fieldType == VALUE )
|
||||
else if( fieldType == VALUE_FIELD )
|
||||
comp->SetValue( m_text );
|
||||
else if( fieldType == FOOTPRINT )
|
||||
else if( fieldType == FOOTPRINT_FIELD )
|
||||
comp->SetFootprint( m_text );
|
||||
}
|
||||
|
||||
|
@ -429,9 +429,9 @@ void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH*
|
|||
{
|
||||
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( parent );
|
||||
|
||||
if( symbol->IsAnnotated( aSheetPath ) && ( fieldType == VALUE
|
||||
|| fieldType == FOOTPRINT
|
||||
|| fieldType == DATASHEET ) )
|
||||
if( symbol->IsAnnotated( aSheetPath ) && ( fieldType == VALUE_FIELD
|
||||
|| fieldType == FOOTPRINT_FIELD
|
||||
|| fieldType == DATASHEET_FIELD ) )
|
||||
{
|
||||
wxString ref = symbol->GetRef( aSheetPath );
|
||||
int unit = symbol->GetUnit();
|
||||
|
@ -449,9 +449,9 @@ void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH*
|
|||
editFrame->SaveCopyInUndoList( screen, otherUnit, UNDO_REDO::CHANGED,
|
||||
appendUndo );
|
||||
|
||||
if( fieldType == VALUE )
|
||||
if( fieldType == VALUE_FIELD )
|
||||
otherUnit->SetValue( m_text );
|
||||
else if( fieldType == FOOTPRINT )
|
||||
else if( fieldType == FOOTPRINT_FIELD )
|
||||
otherUnit->SetFootprint( m_text );
|
||||
else
|
||||
otherUnit->GetField( fieldType )->SetText( m_text );
|
||||
|
|
|
@ -126,7 +126,7 @@ public:
|
|||
aField->SetText( m_text );
|
||||
|
||||
// VALUE === component name, so update the parent component if it changes.
|
||||
if( aField->GetId() == VALUE && aField->GetParent() )
|
||||
if( aField->GetId() == VALUE_FIELD && aField->GetParent() )
|
||||
aField->GetParent()->SetName( m_text );
|
||||
|
||||
updateText( aField );
|
||||
|
|
|
@ -79,13 +79,13 @@ public:
|
|||
protected:
|
||||
void showPopupMenu( wxMenu& menu ) override
|
||||
{
|
||||
if( m_grid->GetGridCursorCol() == FOOTPRINT )
|
||||
if( m_grid->GetGridCursorCol() == FOOTPRINT_FIELD )
|
||||
{
|
||||
menu.Append( MYID_SELECT_FOOTPRINT, _( "Select Footprint..." ),
|
||||
_( "Browse for footprint" ) );
|
||||
menu.AppendSeparator();
|
||||
}
|
||||
else if( m_grid->GetGridCursorCol() == DATASHEET )
|
||||
else if( m_grid->GetGridCursorCol() == DATASHEET_FIELD )
|
||||
{
|
||||
menu.Append( MYID_SHOW_DATASHEET, _( "Show Datasheet" ),
|
||||
_( "Show datasheet in browser" ) );
|
||||
|
@ -100,17 +100,17 @@ protected:
|
|||
if( event.GetId() == MYID_SELECT_FOOTPRINT )
|
||||
{
|
||||
// pick a footprint using the footprint picker.
|
||||
wxString fpid = m_grid->GetCellValue( m_grid->GetGridCursorRow(), FOOTPRINT );
|
||||
wxString fpid = m_grid->GetCellValue( m_grid->GetGridCursorRow(), FOOTPRINT_FIELD );
|
||||
KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_VIEWER_MODAL, true, m_dlg );
|
||||
|
||||
if( frame->ShowModal( &fpid, m_dlg ) )
|
||||
m_grid->SetCellValue( m_grid->GetGridCursorRow(), FOOTPRINT, fpid );
|
||||
m_grid->SetCellValue( m_grid->GetGridCursorRow(), FOOTPRINT_FIELD, fpid );
|
||||
|
||||
frame->Destroy();
|
||||
}
|
||||
else if (event.GetId() == MYID_SHOW_DATASHEET )
|
||||
{
|
||||
wxString datasheet_uri = m_grid->GetCellValue( m_grid->GetGridCursorRow(), DATASHEET );
|
||||
wxString datasheet_uri = m_grid->GetCellValue( m_grid->GetGridCursorRow(), DATASHEET_FIELD );
|
||||
GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj() );
|
||||
}
|
||||
else
|
||||
|
@ -120,11 +120,11 @@ protected:
|
|||
|
||||
if( event.GetId() >= GRIDTRICKS_FIRST_SHOWHIDE && event.GetId() < GRIDTRICKS_LAST_ID )
|
||||
{
|
||||
if( !m_grid->IsColShown( REFERENCE ) )
|
||||
if( !m_grid->IsColShown( REFERENCE_FIELD ) )
|
||||
{
|
||||
DisplayError( m_dlg, _( "The Reference column cannot be hidden." ) );
|
||||
|
||||
m_grid->ShowCol( REFERENCE );
|
||||
m_grid->ShowCol( REFERENCE_FIELD );
|
||||
}
|
||||
|
||||
// Refresh Show checkboxes from grid columns
|
||||
|
@ -246,7 +246,7 @@ public:
|
|||
|
||||
wxString GetValue( int aRow, int aCol ) override
|
||||
{
|
||||
if( aCol == REFERENCE )
|
||||
if( aCol == REFERENCE_FIELD )
|
||||
{
|
||||
// Poor-man's tree controls
|
||||
if( m_rows[ aRow ].m_Flag == GROUP_COLLAPSED )
|
||||
|
@ -275,7 +275,7 @@ public:
|
|||
|
||||
for( const auto& ref : group.m_Refs )
|
||||
{
|
||||
if( aCol == REFERENCE || aCol == QUANTITY_COLUMN )
|
||||
if( aCol == REFERENCE_FIELD || aCol == QUANTITY_COLUMN )
|
||||
{
|
||||
references.push_back( ref );
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if( aCol == REFERENCE || aCol == QUANTITY_COLUMN )
|
||||
if( aCol == REFERENCE_FIELD || aCol == QUANTITY_COLUMN )
|
||||
{
|
||||
// Remove duplicates (other units of multi-unit parts)
|
||||
std::sort( references.begin(), references.end(),
|
||||
|
@ -326,7 +326,7 @@ public:
|
|||
references.erase( logicalEnd, references.end() );
|
||||
}
|
||||
|
||||
if( aCol == REFERENCE )
|
||||
if( aCol == REFERENCE_FIELD )
|
||||
{
|
||||
fieldValue = SCH_REFERENCE_LIST::Shorthand( references );
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ public:
|
|||
|
||||
void SetValue( int aRow, int aCol, const wxString &aValue ) override
|
||||
{
|
||||
if( aCol == REFERENCE || aCol == QUANTITY_COLUMN )
|
||||
if( aCol == REFERENCE_FIELD || aCol == QUANTITY_COLUMN )
|
||||
return; // Can't modify references or quantity
|
||||
|
||||
DATA_MODEL_ROW& rowGroup = m_rows[ aRow ];
|
||||
|
@ -378,7 +378,7 @@ public:
|
|||
wxString lhs = dataModel->GetValue( (DATA_MODEL_ROW&) lhGroup, sortCol );
|
||||
wxString rhs = dataModel->GetValue( (DATA_MODEL_ROW&) rhGroup, sortCol );
|
||||
|
||||
if( lhs == rhs || sortCol == REFERENCE )
|
||||
if( lhs == rhs || sortCol == REFERENCE_FIELD )
|
||||
{
|
||||
wxString lhRef = lhGroup.m_Refs[ 0 ].GetRef() + lhGroup.m_Refs[ 0 ].GetRefNumber();
|
||||
wxString rhRef = rhGroup.m_Refs[ 0 ].GetRef() + rhGroup.m_Refs[ 0 ].GetRefNumber();
|
||||
|
@ -427,7 +427,7 @@ public:
|
|||
|
||||
// First check the reference column. This can be done directly out of the
|
||||
// SCH_REFERENCEs as the references can't be edited in the grid.
|
||||
if( fieldsCtrl->GetToggleValue( REFERENCE, GROUP_BY_COLUMN ) )
|
||||
if( fieldsCtrl->GetToggleValue( REFERENCE_FIELD, GROUP_BY_COLUMN ) )
|
||||
{
|
||||
// if we're grouping by reference, then only the prefix must match
|
||||
if( lhRef.GetRef() != rhRef.GetRef() )
|
||||
|
@ -441,7 +441,7 @@ public:
|
|||
|
||||
// Now check all the other columns. This must be done out of the dataStore
|
||||
// for the refresh button to work after editing.
|
||||
for( int i = REFERENCE + 1; i < fieldsCtrl->GetItemCount(); ++i )
|
||||
for( int i = REFERENCE_FIELD + 1; i < fieldsCtrl->GetItemCount(); ++i )
|
||||
{
|
||||
if( !fieldsCtrl->GetToggleValue( i, GROUP_BY_COLUMN ) )
|
||||
continue;
|
||||
|
@ -633,17 +633,17 @@ public:
|
|||
{
|
||||
comp.RemoveField( srcName );
|
||||
}
|
||||
else if( destField->GetId() == REFERENCE )
|
||||
else if( destField->GetId() == REFERENCE_FIELD )
|
||||
{
|
||||
// Reference is not editable
|
||||
}
|
||||
else if( destField->GetId() == VALUE )
|
||||
else if( destField->GetId() == VALUE_FIELD )
|
||||
{
|
||||
// Value field cannot be empty
|
||||
if( !srcValue.IsEmpty() )
|
||||
comp.SetValue( srcValue );
|
||||
}
|
||||
else if( destField->GetId() == FOOTPRINT )
|
||||
else if( destField->GetId() == FOOTPRINT_FIELD )
|
||||
{
|
||||
comp.SetFootprint( srcValue );
|
||||
}
|
||||
|
@ -662,7 +662,7 @@ public:
|
|||
{
|
||||
int width = 0;
|
||||
|
||||
if( aCol == REFERENCE )
|
||||
if( aCol == REFERENCE_FIELD )
|
||||
{
|
||||
for( int row = 0; row < GetNumberRows(); ++row )
|
||||
{
|
||||
|
@ -783,17 +783,17 @@ DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL( SCH_EDIT_FRAME* parent
|
|||
// set reference column attributes
|
||||
wxGridCellAttr* attr = new wxGridCellAttr;
|
||||
attr->SetReadOnly();
|
||||
m_grid->SetColAttr( REFERENCE, attr );
|
||||
m_grid->SetColAttr( REFERENCE_FIELD, attr );
|
||||
|
||||
// set footprint column browse button
|
||||
attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new GRID_CELL_FOOTPRINT_ID_EDITOR( this ) );
|
||||
m_grid->SetColAttr( FOOTPRINT, attr );
|
||||
m_grid->SetColAttr( FOOTPRINT_FIELD, attr );
|
||||
|
||||
// set datasheet column viewer button
|
||||
attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new GRID_CELL_URL_EDITOR( this ) );
|
||||
m_grid->SetColAttr( DATASHEET, attr );
|
||||
m_grid->SetColAttr( DATASHEET_FIELD, attr );
|
||||
|
||||
// set quantities column attributes
|
||||
attr = new wxGridCellAttr;
|
||||
|
@ -1066,7 +1066,7 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::OnColumnItemToggled( wxDataViewEvent& event )
|
|||
{
|
||||
bool value = m_fieldsCtrl->GetToggleValue( row, col );
|
||||
|
||||
if( row == REFERENCE && !value )
|
||||
if( row == REFERENCE_FIELD && !value )
|
||||
{
|
||||
DisplayError( this, _( "The Reference column cannot be hidden." ) );
|
||||
|
||||
|
@ -1155,7 +1155,7 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::OnRegroupComponents( wxCommandEvent& aEvent )
|
|||
|
||||
void DIALOG_FIELDS_EDITOR_GLOBAL::OnTableCellClick( wxGridEvent& event )
|
||||
{
|
||||
if( event.GetCol() == REFERENCE )
|
||||
if( event.GetCol() == REFERENCE_FIELD )
|
||||
{
|
||||
m_grid->ClearSelection();
|
||||
m_grid->SetGridCursor( event.GetRow(), event.GetCol() );
|
||||
|
|
|
@ -359,10 +359,10 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
|
|||
SCH_COMPONENT* component = (SCH_COMPONENT*) aItem;
|
||||
|
||||
if( m_references->GetValue() )
|
||||
processItem( aSheetPath, component->GetField( REFERENCE ) );
|
||||
processItem( aSheetPath, component->GetField( REFERENCE_FIELD ) );
|
||||
|
||||
if( m_values->GetValue() )
|
||||
processItem( aSheetPath, component->GetField( VALUE ) );
|
||||
processItem( aSheetPath, component->GetField( VALUE_FIELD ) );
|
||||
|
||||
if( m_otherFields->GetValue() )
|
||||
{
|
||||
|
|
|
@ -37,8 +37,8 @@ DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT( EDA_DRAW_FRAME* aParent,
|
|||
if( aRootSymbolNames && aRootSymbolNames->GetCount() )
|
||||
m_comboInheritanceSelect->Append( *aRootSymbolNames );
|
||||
|
||||
m_textName->SetValidator( SCH_FIELD_VALIDATOR( true, VALUE ) );
|
||||
m_textReference->SetValidator( SCH_FIELD_VALIDATOR( true, REFERENCE ) );
|
||||
m_textName->SetValidator( SCH_FIELD_VALIDATOR( true, VALUE_FIELD ) );
|
||||
m_textReference->SetValidator( SCH_FIELD_VALIDATOR( true, REFERENCE_FIELD ) );
|
||||
|
||||
m_pinTextPosition.SetValue( Mils2iu( DEFAULT_PIN_NAME_OFFSET ) );
|
||||
|
||||
|
|
|
@ -73,9 +73,9 @@ DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* a
|
|||
|
||||
wxGridCellAttr* attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new GRID_CELL_URL_EDITOR( this ) );
|
||||
m_grid->SetAttr( DATASHEET, FDC_VALUE, attr );
|
||||
m_grid->SetAttr( DATASHEET_FIELD, FDC_VALUE, attr );
|
||||
|
||||
m_SymbolNameCtrl->SetValidator( SCH_FIELD_VALIDATOR( true, VALUE ) );
|
||||
m_SymbolNameCtrl->SetValidator( SCH_FIELD_VALIDATOR( true, VALUE_FIELD ) );
|
||||
|
||||
// Configure button logos
|
||||
m_bpAdd->SetBitmap( KiBitmap( small_plus_xpm ) );
|
||||
|
@ -215,7 +215,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::Validate()
|
|||
|
||||
// Alias symbol reference can be empty because it inherits from the parent symbol.
|
||||
if( m_libEntry->IsRoot() &&
|
||||
!SCH_COMPONENT::IsReferenceStringValid( m_fields->at( REFERENCE ).GetText() ) )
|
||||
!SCH_COMPONENT::IsReferenceStringValid( m_fields->at( REFERENCE_FIELD ).GetText() ) )
|
||||
{
|
||||
if( m_NoteBook->GetSelection() != 0 )
|
||||
m_NoteBook->SetSelection( 0 );
|
||||
|
@ -223,7 +223,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::Validate()
|
|||
m_delayedErrorMessage = _( "References must start with a letter." );
|
||||
m_delayedFocusGrid = m_grid;
|
||||
m_delayedFocusColumn = FDC_VALUE;
|
||||
m_delayedFocusRow = REFERENCE;
|
||||
m_delayedFocusRow = REFERENCE_FIELD;
|
||||
m_delayedFocusPage = 0;
|
||||
|
||||
return false;
|
||||
|
@ -290,7 +290,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
|||
return false;
|
||||
|
||||
// We need to keep the name and the value the same at the moment!
|
||||
wxString newName = m_fields->at( VALUE ).GetText();
|
||||
wxString newName = m_fields->at( VALUE_FIELD ).GetText();
|
||||
wxString oldName = m_libEntry->GetName();
|
||||
|
||||
if( oldName != newName )
|
||||
|
@ -422,7 +422,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnGridCellChanging( wxGridEvent& event )
|
|||
}
|
||||
}
|
||||
}
|
||||
else if( event.GetRow() == VALUE && event.GetCol() == FDC_VALUE )
|
||||
else if( event.GetRow() == VALUE_FIELD && event.GetCol() == FDC_VALUE )
|
||||
m_SymbolNameCtrl->ChangeValue( event.GetString() );
|
||||
|
||||
editor->DecRef();
|
||||
|
@ -431,7 +431,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnGridCellChanging( wxGridEvent& event )
|
|||
|
||||
void DIALOG_LIB_SYMBOL_PROPERTIES::OnSymbolNameText( wxCommandEvent& event )
|
||||
{
|
||||
m_grid->SetCellValue( VALUE, FDC_VALUE, m_SymbolNameCtrl->GetValue() );
|
||||
m_grid->SetCellValue( VALUE_FIELD, FDC_VALUE, m_SymbolNameCtrl->GetValue() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -675,7 +675,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
|
|||
int row = m_grid->GetGridCursorRow();
|
||||
int col = m_grid->GetGridCursorCol();
|
||||
|
||||
if( row == VALUE && col == FDC_VALUE )
|
||||
if( row == VALUE_FIELD && col == FDC_VALUE )
|
||||
{
|
||||
wxGridCellEditor* editor = m_grid->GetCellEditor( row, col );
|
||||
m_SymbolNameCtrl->ChangeValue( editor->GetValue() );
|
||||
|
|
|
@ -287,7 +287,7 @@ DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES( SCH_EDIT_FRAME* aParent,
|
|||
m_fields = new FIELDS_GRID_TABLE<SCH_FIELD>( this, aParent, m_part );
|
||||
|
||||
m_width = 0;
|
||||
m_delayedFocusRow = REFERENCE;
|
||||
m_delayedFocusRow = REFERENCE_FIELD;
|
||||
m_delayedFocusColumn = FDC_VALUE;
|
||||
m_delayedSelection = true;
|
||||
|
||||
|
@ -539,12 +539,12 @@ bool DIALOG_SYMBOL_PROPERTIES::Validate()
|
|||
if( !m_fieldsGrid->CommitPendingChanges() || !m_fieldsGrid->Validate() )
|
||||
return false;
|
||||
|
||||
if( !SCH_COMPONENT::IsReferenceStringValid( m_fields->at( REFERENCE ).GetText() ) )
|
||||
if( !SCH_COMPONENT::IsReferenceStringValid( m_fields->at( REFERENCE_FIELD ).GetText() ) )
|
||||
{
|
||||
DisplayErrorMessage( this, _( "References must start with a letter." ) );
|
||||
|
||||
m_delayedFocusColumn = FDC_VALUE;
|
||||
m_delayedFocusRow = REFERENCE;
|
||||
m_delayedFocusRow = REFERENCE_FIELD;
|
||||
m_delayedSelection = false;
|
||||
|
||||
return false;
|
||||
|
@ -641,7 +641,7 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
|||
LIB_PART* entry = GetParent()->GetLibPart( m_comp->GetLibId() );
|
||||
|
||||
if( entry && entry->IsPower() )
|
||||
m_fields->at( VALUE ).SetText( m_comp->GetLibId().GetLibItemName() );
|
||||
m_fields->at( VALUE_FIELD ).SetText( m_comp->GetLibId().GetLibItemName() );
|
||||
|
||||
// Push all fields to the component -except- for those which are TEMPLATE_FIELDNAMES
|
||||
// with empty values.
|
||||
|
@ -674,12 +674,12 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
|||
// Reference has a specific initialization, depending on the current active sheet
|
||||
// because for a given component, in a complex hierarchy, there are more than one
|
||||
// reference.
|
||||
m_comp->SetRef( &GetParent()->GetCurrentSheet(), m_fields->at( REFERENCE ).GetText() );
|
||||
m_comp->SetRef( &GetParent()->GetCurrentSheet(), m_fields->at( REFERENCE_FIELD ).GetText() );
|
||||
|
||||
// Similar for Value and Footprint, except that the GUI behaviour is that they are kept
|
||||
// in sync between multiple instances.
|
||||
m_comp->SetValue( m_fields->at( VALUE ).GetText() );
|
||||
m_comp->SetFootprint( m_fields->at( FOOTPRINT ).GetText() );
|
||||
m_comp->SetValue( m_fields->at( VALUE_FIELD ).GetText() );
|
||||
m_comp->SetFootprint( m_fields->at( FOOTPRINT_FIELD ).GetText() );
|
||||
|
||||
m_comp->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() );
|
||||
m_comp->SetIncludeOnBoard( !m_cbExcludeFromBoard->IsChecked() );
|
||||
|
@ -703,9 +703,9 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
|||
{
|
||||
GetParent()->SaveCopyInUndoList( screen, otherUnit, UNDO_REDO::CHANGED,
|
||||
appendUndo );
|
||||
otherUnit->SetValue( m_fields->at( VALUE ).GetText() );
|
||||
otherUnit->SetFootprint( m_fields->at( FOOTPRINT ).GetText() );
|
||||
otherUnit->GetField( DATASHEET )->SetText( m_fields->at( DATASHEET ).GetText() );
|
||||
otherUnit->SetValue( m_fields->at( VALUE_FIELD ).GetText() );
|
||||
otherUnit->SetFootprint( m_fields->at( FOOTPRINT_FIELD ).GetText() );
|
||||
otherUnit->GetField( DATASHEET_FIELD )->SetText( m_fields->at( DATASHEET_FIELD ).GetText() );
|
||||
otherUnit->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() );
|
||||
otherUnit->SetIncludeOnBoard( !m_cbExcludeFromBoard->IsChecked() );
|
||||
GetParent()->UpdateItem( otherUnit );
|
||||
|
@ -775,7 +775,7 @@ void DIALOG_SYMBOL_PROPERTIES::OnGridCellChanging( wxGridEvent& event )
|
|||
|
||||
void DIALOG_SYMBOL_PROPERTIES::OnGridEditorShown( wxGridEvent& aEvent )
|
||||
{
|
||||
if( aEvent.GetRow() == REFERENCE && aEvent.GetCol() == FDC_VALUE )
|
||||
if( aEvent.GetRow() == REFERENCE_FIELD && aEvent.GetCol() == FDC_VALUE )
|
||||
m_delayedSelection= true;
|
||||
}
|
||||
|
||||
|
@ -790,7 +790,7 @@ void DIALOG_SYMBOL_PROPERTIES::OnAddField( wxCommandEvent& event )
|
|||
SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_comp,
|
||||
TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldID ) );
|
||||
|
||||
newField.SetTextAngle( m_fields->at( REFERENCE ).GetTextAngle() );
|
||||
newField.SetTextAngle( m_fields->at( REFERENCE_FIELD ).GetTextAngle() );
|
||||
newField.SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) );
|
||||
|
||||
m_fields->push_back( newField );
|
||||
|
@ -1006,7 +1006,7 @@ void DIALOG_SYMBOL_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
|
|||
// Handle a delayed selection
|
||||
if( m_delayedSelection )
|
||||
{
|
||||
wxGridCellEditor* cellEditor = m_fieldsGrid->GetCellEditor( REFERENCE, FDC_VALUE );
|
||||
wxGridCellEditor* cellEditor = m_fieldsGrid->GetCellEditor( REFERENCE_FIELD, FDC_VALUE );
|
||||
|
||||
if( wxTextEntry* txt = dynamic_cast<wxTextEntry*>( cellEditor->GetControl() ) )
|
||||
KIUI::SelectReferenceNumber( txt );
|
||||
|
|
|
@ -54,8 +54,8 @@ FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* a
|
|||
m_mandatoryFieldCount( MANDATORY_FIELDS ),
|
||||
m_part( aPart ),
|
||||
m_fieldNameValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_NAME ),
|
||||
m_referenceValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), REFERENCE ),
|
||||
m_valueValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), VALUE ),
|
||||
m_referenceValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), REFERENCE_FIELD ),
|
||||
m_valueValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), VALUE_FIELD ),
|
||||
m_libIdValidator( LIB_ID::ID_PCB ),
|
||||
m_urlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ),
|
||||
m_nonUrlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ),
|
||||
|
@ -75,7 +75,7 @@ FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* a
|
|||
m_part( nullptr ),
|
||||
m_fieldNameValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_NAME ),
|
||||
m_referenceValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), SHEETNAME_V ),
|
||||
m_valueValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), VALUE ),
|
||||
m_valueValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), VALUE_FIELD ),
|
||||
m_libIdValidator( LIB_ID::ID_PCB ),
|
||||
m_urlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ),
|
||||
m_nonUrlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ),
|
||||
|
@ -262,12 +262,12 @@ wxGridCellAttr* FIELDS_GRID_TABLE<T>::GetAttr( int aRow, int aCol, wxGridCellAtt
|
|||
}
|
||||
|
||||
case FDC_VALUE:
|
||||
if( m_parentType == SCH_COMPONENT_T && aRow == REFERENCE )
|
||||
if( m_parentType == SCH_COMPONENT_T && aRow == REFERENCE_FIELD )
|
||||
{
|
||||
m_referenceAttr->IncRef();
|
||||
return m_referenceAttr;
|
||||
}
|
||||
else if( m_parentType == SCH_COMPONENT_T && aRow == VALUE )
|
||||
else if( m_parentType == SCH_COMPONENT_T && aRow == VALUE_FIELD )
|
||||
{
|
||||
// For power symbols, the value is not editable, because value and pin name must
|
||||
// be the same and can be edited only in library editor.
|
||||
|
@ -284,12 +284,12 @@ wxGridCellAttr* FIELDS_GRID_TABLE<T>::GetAttr( int aRow, int aCol, wxGridCellAtt
|
|||
return m_valueAttr;
|
||||
}
|
||||
}
|
||||
else if( m_parentType == SCH_COMPONENT_T && aRow == FOOTPRINT )
|
||||
else if( m_parentType == SCH_COMPONENT_T && aRow == FOOTPRINT_FIELD )
|
||||
{
|
||||
m_footprintAttr->IncRef();
|
||||
return m_footprintAttr;
|
||||
}
|
||||
else if( m_parentType == SCH_COMPONENT_T && aRow == DATASHEET )
|
||||
else if( m_parentType == SCH_COMPONENT_T && aRow == DATASHEET_FIELD )
|
||||
{
|
||||
m_urlAttr->IncRef();
|
||||
return m_urlAttr;
|
||||
|
@ -570,13 +570,13 @@ template class FIELDS_GRID_TABLE<LIB_FIELD>;
|
|||
|
||||
void FIELDS_GRID_TRICKS::showPopupMenu( wxMenu& menu )
|
||||
{
|
||||
if( m_grid->GetGridCursorRow() == FOOTPRINT && m_grid->GetGridCursorCol() == FDC_VALUE )
|
||||
if( m_grid->GetGridCursorRow() == FOOTPRINT_FIELD && m_grid->GetGridCursorCol() == FDC_VALUE )
|
||||
{
|
||||
menu.Append( MYID_SELECT_FOOTPRINT, _( "Select Footprint..." ),
|
||||
_( "Browse for footprint" ) );
|
||||
menu.AppendSeparator();
|
||||
}
|
||||
else if( m_grid->GetGridCursorRow() == DATASHEET && m_grid->GetGridCursorCol() == FDC_VALUE )
|
||||
else if( m_grid->GetGridCursorRow() == DATASHEET_FIELD && m_grid->GetGridCursorCol() == FDC_VALUE )
|
||||
{
|
||||
menu.Append( MYID_SHOW_DATASHEET, _( "Show Datasheet" ),
|
||||
_( "Show datasheet in browser" ) );
|
||||
|
@ -592,17 +592,17 @@ void FIELDS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
|
|||
if( event.GetId() == MYID_SELECT_FOOTPRINT )
|
||||
{
|
||||
// pick a footprint using the footprint picker.
|
||||
wxString fpid = m_grid->GetCellValue( FOOTPRINT, FDC_VALUE );
|
||||
wxString fpid = m_grid->GetCellValue( FOOTPRINT_FIELD, FDC_VALUE );
|
||||
KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_VIEWER_MODAL, true, m_dlg );
|
||||
|
||||
if( frame->ShowModal( &fpid, m_dlg ) )
|
||||
m_grid->SetCellValue( FOOTPRINT, FDC_VALUE, fpid );
|
||||
m_grid->SetCellValue( FOOTPRINT_FIELD, FDC_VALUE, fpid );
|
||||
|
||||
frame->Destroy();
|
||||
}
|
||||
else if (event.GetId() == MYID_SHOW_DATASHEET )
|
||||
{
|
||||
wxString datasheet_uri = m_grid->GetCellValue( DATASHEET, FDC_VALUE );
|
||||
wxString datasheet_uri = m_grid->GetCellValue( DATASHEET_FIELD, FDC_VALUE );
|
||||
GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj() );
|
||||
}
|
||||
else
|
||||
|
|
|
@ -961,7 +961,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
|
|||
SCH_COMPONENT* cmp = static_cast<SCH_COMPONENT*>( item );
|
||||
|
||||
// Update footprint LIB_ID to point to the imported Eagle library
|
||||
SCH_FIELD* fpField = cmp->GetField( FOOTPRINT );
|
||||
SCH_FIELD* fpField = cmp->GetField( FOOTPRINT_FIELD );
|
||||
|
||||
if( !fpField->GetText().IsEmpty() )
|
||||
{
|
||||
|
|
|
@ -167,7 +167,7 @@ protected:
|
|||
|
||||
switch( aField.GetId() )
|
||||
{
|
||||
case DATASHEET:
|
||||
case DATASHEET_FIELD:
|
||||
text = m_symbol->GetDatasheetField().GetText();
|
||||
|
||||
if( text.IsEmpty() || text == wxT( "~" ) )
|
||||
|
@ -189,7 +189,7 @@ protected:
|
|||
|
||||
break;
|
||||
|
||||
case VALUE:
|
||||
case VALUE_FIELD:
|
||||
// showing the value just repeats the name, so that's not much use...
|
||||
return wxEmptyString;
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ void LIB_FIELD::Init( int id )
|
|||
|
||||
// By contrast, VALUE and REFERENCE are are always constructed as initially visible, and
|
||||
// template fieldsnames' initial visibility is controlled by the template fieldname config.
|
||||
if( id == DATASHEET || id == FOOTPRINT )
|
||||
if( id == DATASHEET_FIELD || id == FOOTPRINT_FIELD )
|
||||
SetVisible( false );
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ bool LIB_FIELD::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
|||
EDA_TEXT tmp_text( *this );
|
||||
|
||||
// Reference designator text has one or 2 additional character (displays U? or U?A)
|
||||
if( m_id == REFERENCE )
|
||||
if( m_id == REFERENCE_FIELD )
|
||||
{
|
||||
const LIB_PART* parent = dynamic_cast<const LIB_PART*>( m_Parent );
|
||||
|
||||
|
@ -296,7 +296,7 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
|||
|
||||
wxString LIB_FIELD::GetFullText( int unit ) const
|
||||
{
|
||||
if( m_id != REFERENCE )
|
||||
if( m_id != REFERENCE_FIELD )
|
||||
return GetText();
|
||||
|
||||
wxString text = GetText();
|
||||
|
@ -342,9 +342,9 @@ void LIB_FIELD::ViewGetLayers( int aLayers[], int& aCount ) const
|
|||
|
||||
switch( m_id )
|
||||
{
|
||||
case REFERENCE: aLayers[0] = LAYER_REFERENCEPART; break;
|
||||
case VALUE: aLayers[0] = LAYER_VALUEPART; break;
|
||||
default: aLayers[0] = LAYER_FIELDS; break;
|
||||
case REFERENCE_FIELD: aLayers[0] = LAYER_REFERENCEPART; break;
|
||||
case VALUE_FIELD: aLayers[0] = LAYER_VALUEPART; break;
|
||||
default: aLayers[0] = LAYER_FIELDS; break;
|
||||
}
|
||||
|
||||
aLayers[1] = LAYER_SELECTION_SHADOWS;
|
||||
|
@ -355,9 +355,9 @@ SCH_LAYER_ID LIB_FIELD::GetDefaultLayer()
|
|||
{
|
||||
switch( m_id )
|
||||
{
|
||||
case REFERENCE: return LAYER_REFERENCEPART;
|
||||
case VALUE: return LAYER_VALUEPART;
|
||||
default: return LAYER_FIELDS;
|
||||
case REFERENCE_FIELD: return LAYER_REFERENCEPART;
|
||||
case VALUE_FIELD: return LAYER_VALUEPART;
|
||||
default: return LAYER_FIELDS;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -375,10 +375,10 @@ wxString LIB_FIELD::GetCanonicalName() const
|
|||
{
|
||||
switch( m_id )
|
||||
{
|
||||
case REFERENCE: return wxT( "Reference" );
|
||||
case VALUE: return wxT( "Value" );
|
||||
case FOOTPRINT: return wxT( "Footprint" );
|
||||
case DATASHEET: return wxT( "Datasheet" );
|
||||
case REFERENCE_FIELD: return wxT( "Reference" );
|
||||
case VALUE_FIELD: return wxT( "Value" );
|
||||
case FOOTPRINT_FIELD: return wxT( "Footprint" );
|
||||
case DATASHEET_FIELD: return wxT( "Datasheet" );
|
||||
}
|
||||
|
||||
return m_name;
|
||||
|
|
|
@ -46,10 +46,10 @@ class SCH_LEGACY_PLUGIN_CACHE;
|
|||
*
|
||||
* The first 4 fields have a special meaning:
|
||||
*
|
||||
* 0 = REFERENCE
|
||||
* 1 = VALUE
|
||||
* 2 = FOOTPRINT (default Footprint)
|
||||
* 3 = DATASHEET (user doc link)
|
||||
* 0 = REFERENCE_FIELD
|
||||
* 1 = VALUE_FIELD
|
||||
* 2 = FOOTPRINT_FIELD (default Footprint)
|
||||
* 3 = DATASHEET_FIELD (user doc link)
|
||||
*
|
||||
* others = free fields
|
||||
* </p>
|
||||
|
|
|
@ -78,8 +78,8 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName, unsig
|
|||
if( !component )
|
||||
continue;
|
||||
|
||||
if( !component->GetField( FOOTPRINT )->IsVoid() )
|
||||
footprint = component->GetField( FOOTPRINT )->GetShownText();
|
||||
if( !component->GetField( FOOTPRINT_FIELD )->IsVoid() )
|
||||
footprint = component->GetField( FOOTPRINT_FIELD )->GetShownText();
|
||||
else
|
||||
footprint = "$noname";
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ void NETLIST_EXPORTER_GENERIC::addComponentFields( XNODE* xcomp, SCH_COMPONENT*
|
|||
if( m_resolveTextVars )
|
||||
fields.value = comp2->GetValue( &sheetList[i] );
|
||||
else
|
||||
fields.value = comp2->GetField( VALUE )->GetText();
|
||||
fields.value = comp2->GetField( VALUE_FIELD )->GetText();
|
||||
}
|
||||
|
||||
if( !comp2->GetFootprint( &sheetList[i] ).IsEmpty()
|
||||
|
@ -137,16 +137,16 @@ void NETLIST_EXPORTER_GENERIC::addComponentFields( XNODE* xcomp, SCH_COMPONENT*
|
|||
if( m_resolveTextVars )
|
||||
fields.footprint = comp2->GetFootprint( &sheetList[i] );
|
||||
else
|
||||
fields.footprint = comp2->GetField( FOOTPRINT )->GetText();
|
||||
fields.footprint = comp2->GetField( FOOTPRINT_FIELD )->GetText();
|
||||
}
|
||||
|
||||
if( !comp2->GetField( DATASHEET )->IsVoid()
|
||||
if( !comp2->GetField( DATASHEET_FIELD )->IsVoid()
|
||||
&& ( unit < minUnit || fields.datasheet.IsEmpty() ) )
|
||||
{
|
||||
if( m_resolveTextVars )
|
||||
fields.datasheet = comp2->GetField( DATASHEET )->GetShownText();
|
||||
fields.datasheet = comp2->GetField( DATASHEET_FIELD )->GetShownText();
|
||||
else
|
||||
fields.datasheet = comp2->GetField( DATASHEET )->GetText();
|
||||
fields.datasheet = comp2->GetField( DATASHEET_FIELD )->GetText();
|
||||
}
|
||||
|
||||
for( int fldNdx = MANDATORY_FIELDS; fldNdx < comp2->GetFieldCount(); ++fldNdx )
|
||||
|
@ -170,19 +170,19 @@ void NETLIST_EXPORTER_GENERIC::addComponentFields( XNODE* xcomp, SCH_COMPONENT*
|
|||
else
|
||||
{
|
||||
if( m_resolveTextVars )
|
||||
fields.value = comp->GetField( VALUE )->GetShownText();
|
||||
fields.value = comp->GetField( VALUE_FIELD )->GetShownText();
|
||||
else
|
||||
fields.value = comp->GetField( VALUE )->GetText();
|
||||
fields.value = comp->GetField( VALUE_FIELD )->GetText();
|
||||
|
||||
if( m_resolveTextVars )
|
||||
fields.footprint = comp->GetField( FOOTPRINT )->GetShownText();
|
||||
fields.footprint = comp->GetField( FOOTPRINT_FIELD )->GetShownText();
|
||||
else
|
||||
fields.footprint = comp->GetField( FOOTPRINT )->GetText();
|
||||
fields.footprint = comp->GetField( FOOTPRINT_FIELD )->GetText();
|
||||
|
||||
if( m_resolveTextVars )
|
||||
fields.datasheet = comp->GetField( DATASHEET )->GetShownText();
|
||||
fields.datasheet = comp->GetField( DATASHEET_FIELD )->GetShownText();
|
||||
else
|
||||
fields.datasheet = comp->GetField( DATASHEET )->GetText();
|
||||
fields.datasheet = comp->GetField( DATASHEET_FIELD )->GetText();
|
||||
|
||||
for( int fldNdx = MANDATORY_FIELDS; fldNdx < comp->GetFieldCount(); ++fldNdx )
|
||||
{
|
||||
|
|
|
@ -186,15 +186,15 @@ wxString NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SPICE_FIELD aField,
|
|||
{
|
||||
case SF_PRIMITIVE:
|
||||
{
|
||||
const wxString refName = aComponent->GetField( REFERENCE )->GetShownText();
|
||||
const wxString refName = aComponent->GetField( REFERENCE_FIELD )->GetShownText();
|
||||
return refName.GetChar( 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
case SF_MODEL:
|
||||
{
|
||||
wxChar prim = aComponent->GetField( REFERENCE )->GetShownText().GetChar( 0 );
|
||||
wxString value = aComponent->GetField( VALUE )->GetShownText();
|
||||
wxChar prim = aComponent->GetField( REFERENCE_FIELD )->GetShownText().GetChar( 0 );
|
||||
wxString value = aComponent->GetField( VALUE_FIELD )->GetShownText();
|
||||
|
||||
// Is it a passive component?
|
||||
if( aCtl & NET_ADJUST_PASSIVE_VALS && ( prim == 'C' || prim == 'L' || prim == 'R' ) )
|
||||
|
|
|
@ -188,9 +188,9 @@ void SCH_COMPONENT::Init( const wxPoint& pos )
|
|||
{
|
||||
m_Fields.emplace_back( pos, i, this, TEMPLATE_FIELDNAME::GetDefaultFieldName( i ) );
|
||||
|
||||
if( i == REFERENCE )
|
||||
if( i == REFERENCE_FIELD )
|
||||
m_Fields.back().SetLayer( LAYER_REFERENCEPART );
|
||||
else if( i == VALUE )
|
||||
else if( i == VALUE_FIELD )
|
||||
m_Fields.back().SetLayer( LAYER_VALUEPART );
|
||||
else
|
||||
m_Fields.back().SetLayer( LAYER_FIELDS );
|
||||
|
@ -431,10 +431,10 @@ const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet, bool aInclude
|
|||
// use this as a default for this path. This will happen if we load a version 1 schematic
|
||||
// file. It will also mean that multiple instances of the same sheet by default all have
|
||||
// the same component references, but perhaps this is best.
|
||||
if( ref.IsEmpty() && !GetField( REFERENCE )->GetText().IsEmpty() )
|
||||
if( ref.IsEmpty() && !GetField( REFERENCE_FIELD )->GetText().IsEmpty() )
|
||||
{
|
||||
const_cast<SCH_COMPONENT*>( this )->SetRef( sheet, GetField( REFERENCE )->GetText() );
|
||||
ref = GetField( REFERENCE )->GetText();
|
||||
const_cast<SCH_COMPONENT*>( this )->SetRef( sheet, GetField( REFERENCE_FIELD )->GetText() );
|
||||
ref = GetField( REFERENCE_FIELD )->GetText();
|
||||
}
|
||||
|
||||
if( ref.IsEmpty() )
|
||||
|
@ -484,7 +484,7 @@ void SCH_COMPONENT::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref )
|
|||
for( std::unique_ptr<SCH_PIN>& pin : m_pins )
|
||||
pin->ClearDefaultNetName( sheet );
|
||||
|
||||
SCH_FIELD* rf = GetField( REFERENCE );
|
||||
SCH_FIELD* rf = GetField( REFERENCE_FIELD );
|
||||
|
||||
// @todo Should we really be checking for what is a "reasonable" position?
|
||||
if( rf->GetText().IsEmpty()
|
||||
|
@ -575,13 +575,13 @@ const wxString SCH_COMPONENT::GetValue( const SCH_SHEET_PATH* sheet ) const
|
|||
{
|
||||
if( instance.m_Path == path && !instance.m_Value.IsEmpty() )
|
||||
{
|
||||
SCH_FIELD dummy( wxDefaultPosition, VALUE, const_cast<SCH_COMPONENT*>( this ) );
|
||||
SCH_FIELD dummy( wxDefaultPosition, VALUE_FIELD, const_cast<SCH_COMPONENT*>( this ) );
|
||||
dummy.SetText( instance.m_Value );
|
||||
return dummy.GetShownText();
|
||||
}
|
||||
}
|
||||
|
||||
return GetField( VALUE )->GetShownText();
|
||||
return GetField( VALUE_FIELD )->GetShownText();
|
||||
}
|
||||
|
||||
|
||||
|
@ -593,7 +593,7 @@ void SCH_COMPONENT::SetValue( const SCH_SHEET_PATH* sheet, const wxString& aValu
|
|||
for( COMPONENT_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
instance.m_Value = wxEmptyString;
|
||||
|
||||
m_Fields[ VALUE ].SetText( aValue );
|
||||
m_Fields[ VALUE_FIELD ].SetText( aValue );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -622,13 +622,13 @@ const wxString SCH_COMPONENT::GetFootprint( const SCH_SHEET_PATH* sheet ) const
|
|||
{
|
||||
if( instance.m_Path == path && !instance.m_Footprint.IsEmpty() )
|
||||
{
|
||||
SCH_FIELD dummy( wxDefaultPosition, FOOTPRINT, const_cast<SCH_COMPONENT*>( this ) );
|
||||
SCH_FIELD dummy( wxDefaultPosition, FOOTPRINT_FIELD, const_cast<SCH_COMPONENT*>( this ) );
|
||||
dummy.SetText( instance.m_Footprint );
|
||||
return dummy.GetShownText();
|
||||
}
|
||||
}
|
||||
|
||||
return GetField( FOOTPRINT )->GetShownText();
|
||||
return GetField( FOOTPRINT_FIELD )->GetShownText();
|
||||
}
|
||||
|
||||
|
||||
|
@ -640,7 +640,7 @@ void SCH_COMPONENT::SetFootprint( const SCH_SHEET_PATH* sheet, const wxString& a
|
|||
for( COMPONENT_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
instance.m_Footprint = wxEmptyString;
|
||||
|
||||
m_Fields[ FOOTPRINT ].SetText( aFootprint );
|
||||
m_Fields[ FOOTPRINT_FIELD ].SetText( aFootprint );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -750,7 +750,7 @@ void SCH_COMPONENT::UpdateFields( bool aResetStyle, bool aResetRef )
|
|||
int idx = libField.GetId();
|
||||
SCH_FIELD* schField;
|
||||
|
||||
if( idx == REFERENCE && !aResetRef )
|
||||
if( idx == REFERENCE_FIELD && !aResetRef )
|
||||
continue;
|
||||
|
||||
if( idx >= 0 && idx < MANDATORY_FIELDS )
|
||||
|
@ -775,12 +775,12 @@ void SCH_COMPONENT::UpdateFields( bool aResetStyle, bool aResetRef )
|
|||
schField->SetTextPos( m_Pos + libField.GetTextPos() );
|
||||
}
|
||||
|
||||
if( idx == VALUE )
|
||||
if( idx == VALUE_FIELD )
|
||||
{
|
||||
schField->SetText( m_lib_id.GetLibItemName() ); // fetch alias-specific value
|
||||
symbolName = m_lib_id.GetLibItemName();
|
||||
}
|
||||
else if( idx == DATASHEET )
|
||||
else if( idx == DATASHEET_FIELD )
|
||||
{
|
||||
schField->SetText( GetDatasheet() ); // fetch alias-specific value
|
||||
}
|
||||
|
@ -902,11 +902,11 @@ bool SCH_COMPONENT::ResolveTextVar( wxString* token, int aDepth ) const
|
|||
{
|
||||
if( token->IsSameAs( m_Fields[ i ].GetCanonicalName().Upper() ) )
|
||||
{
|
||||
if( i == REFERENCE && schematic )
|
||||
if( i == REFERENCE_FIELD && schematic )
|
||||
*token = GetRef( &schematic->CurrentSheet(), true );
|
||||
else if( i == VALUE && schematic )
|
||||
else if( i == VALUE_FIELD && schematic )
|
||||
*token = GetValue( &schematic->CurrentSheet() );
|
||||
else if( i == FOOTPRINT && schematic )
|
||||
else if( i == FOOTPRINT_FIELD && schematic )
|
||||
*token = GetFootprint( &schematic->CurrentSheet() );
|
||||
else
|
||||
*token = m_Fields[ i ].GetShownText( aDepth + 1 );
|
||||
|
@ -932,7 +932,7 @@ bool SCH_COMPONENT::ResolveTextVar( wxString* token, int aDepth ) const
|
|||
if( schematic )
|
||||
footprint = GetFootprint( &schematic->CurrentSheet() );
|
||||
else
|
||||
footprint = m_Fields[ FOOTPRINT ].GetShownText();
|
||||
footprint = m_Fields[ FOOTPRINT_FIELD ].GetShownText();
|
||||
|
||||
wxArrayString parts = wxSplit( footprint, ':' );
|
||||
|
||||
|
@ -946,7 +946,7 @@ bool SCH_COMPONENT::ResolveTextVar( wxString* token, int aDepth ) const
|
|||
if( schematic )
|
||||
footprint = GetFootprint( &schematic->CurrentSheet() );
|
||||
else
|
||||
footprint = m_Fields[ FOOTPRINT ].GetShownText();
|
||||
footprint = m_Fields[ FOOTPRINT_FIELD ].GetShownText();
|
||||
|
||||
wxArrayString parts = wxSplit( footprint, ':' );
|
||||
|
||||
|
@ -1009,7 +1009,7 @@ void SCH_COMPONENT::ClearAnnotation( const SCH_SHEET_PATH* aSheetPath )
|
|||
// When a clear annotation is made, the calling function must call a
|
||||
// UpdateAllScreenReferences for the active sheet.
|
||||
// But this call cannot made here.
|
||||
m_Fields[REFERENCE].SetText( defRef ); //for drawing.
|
||||
m_Fields[REFERENCE_FIELD].SetText( defRef ); //for drawing.
|
||||
}
|
||||
|
||||
|
||||
|
@ -1028,7 +1028,7 @@ bool SCH_COMPONENT::AddSheetPathReferenceEntryIfMissing( const KIID_PATH& aSheet
|
|||
}
|
||||
|
||||
// This entry does not exist: add it, with its last-used reference
|
||||
AddHierarchicalReference( aSheetPath, m_Fields[REFERENCE].GetText(), m_unit );
|
||||
AddHierarchicalReference( aSheetPath, m_Fields[REFERENCE_FIELD].GetText(), m_unit );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1586,7 +1586,7 @@ LIB_ITEM* SCH_COMPONENT::GetDrawItem( const wxPoint& aPosition, KICAD_T aType )
|
|||
wxString SCH_COMPONENT::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
{
|
||||
return wxString::Format( _( "Symbol %s [%s]" ),
|
||||
GetField( REFERENCE )->GetShownText(),
|
||||
GetField( REFERENCE_FIELD )->GetShownText(),
|
||||
GetLibId().GetLibItemName().wx_str() );
|
||||
}
|
||||
|
||||
|
@ -1617,26 +1617,26 @@ SEARCH_RESULT SCH_COMPONENT::Visit( INSPECTOR aInspector, void* aTestData,
|
|||
|
||||
if( stype == SCH_FIELD_LOCATE_REFERENCE_T )
|
||||
{
|
||||
if( SEARCH_RESULT::QUIT == aInspector( GetField( REFERENCE ), (void*) this ) )
|
||||
if( SEARCH_RESULT::QUIT == aInspector( GetField( REFERENCE_FIELD ), (void*) this ) )
|
||||
return SEARCH_RESULT::QUIT;
|
||||
}
|
||||
|
||||
if( stype == SCH_FIELD_LOCATE_VALUE_T
|
||||
|| ( stype == SCH_COMPONENT_LOCATE_POWER_T && m_part && m_part->IsPower() ) )
|
||||
{
|
||||
if( SEARCH_RESULT::QUIT == aInspector( GetField( VALUE ), (void*) this ) )
|
||||
if( SEARCH_RESULT::QUIT == aInspector( GetField( VALUE_FIELD ), (void*) this ) )
|
||||
return SEARCH_RESULT::QUIT;
|
||||
}
|
||||
|
||||
if( stype == SCH_FIELD_LOCATE_FOOTPRINT_T )
|
||||
{
|
||||
if( SEARCH_RESULT::QUIT == aInspector( GetField( FOOTPRINT ), (void*) this ) )
|
||||
if( SEARCH_RESULT::QUIT == aInspector( GetField( FOOTPRINT_FIELD ), (void*) this ) )
|
||||
return SEARCH_RESULT::QUIT;
|
||||
}
|
||||
|
||||
if( stype == SCH_FIELD_LOCATE_DATASHEET_T )
|
||||
{
|
||||
if( SEARCH_RESULT::QUIT == aInspector( GetField( DATASHEET ), (void*) this ) )
|
||||
if( SEARCH_RESULT::QUIT == aInspector( GetField( DATASHEET_FIELD ), (void*) this ) )
|
||||
return SEARCH_RESULT::QUIT;
|
||||
}
|
||||
|
||||
|
@ -1692,7 +1692,7 @@ bool SCH_COMPONENT::operator==( const SCH_COMPONENT& aComponent ) const
|
|||
if( GetFieldCount() != aComponent.GetFieldCount() )
|
||||
return false;
|
||||
|
||||
for( int i = VALUE; i < GetFieldCount(); i++ )
|
||||
for( int i = VALUE_FIELD; i < GetFieldCount(); i++ )
|
||||
{
|
||||
if( GetField( i )->GetText().Cmp( aComponent.GetField( i )->GetText() ) != 0 )
|
||||
return false;
|
||||
|
|
|
@ -88,9 +88,9 @@ void SCH_FIELD::SetId( int aId )
|
|||
{
|
||||
switch( m_id )
|
||||
{
|
||||
case REFERENCE: SetLayer( LAYER_REFERENCEPART ); break;
|
||||
case VALUE: SetLayer( LAYER_VALUEPART ); break;
|
||||
default: SetLayer( LAYER_FIELDS ); break;
|
||||
case REFERENCE_FIELD: SetLayer( LAYER_REFERENCEPART ); break;
|
||||
case VALUE_FIELD: SetLayer( LAYER_VALUEPART ); break;
|
||||
default: SetLayer( LAYER_FIELDS ); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ wxString SCH_FIELD::GetShownText( int aDepth ) const
|
|||
{
|
||||
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( m_Parent );
|
||||
|
||||
if( m_id == REFERENCE )
|
||||
if( m_id == REFERENCE_FIELD )
|
||||
{
|
||||
// For more than one part per package, we must add the part selection
|
||||
// A, B, ... or 1, 2, .. to the reference.
|
||||
|
@ -326,7 +326,7 @@ bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
|
|||
if( !IsVisible() && !searchHiddenFields )
|
||||
return false;
|
||||
|
||||
if( m_Parent && m_Parent->Type() == SCH_COMPONENT_T && m_id == REFERENCE )
|
||||
if( m_Parent && m_Parent->Type() == SCH_COMPONENT_T && m_id == REFERENCE_FIELD )
|
||||
{
|
||||
if( searchAndReplace && !replaceReferences )
|
||||
return false;
|
||||
|
@ -358,7 +358,7 @@ bool SCH_FIELD::IsReplaceable() const
|
|||
{
|
||||
SCH_COMPONENT* parentComponent = static_cast<SCH_COMPONENT*>( m_Parent );
|
||||
|
||||
if( m_id == VALUE )
|
||||
if( m_id == VALUE_FIELD )
|
||||
{
|
||||
LIB_PART* part = parentComponent->GetPartRef().get();
|
||||
|
||||
|
@ -385,7 +385,7 @@ bool SCH_FIELD::Replace( wxFindReplaceData& aSearchData, void* aAuxData )
|
|||
{
|
||||
SCH_COMPONENT* parentComponent = static_cast<SCH_COMPONENT*>( m_Parent );
|
||||
|
||||
if( m_id == REFERENCE )
|
||||
if( m_id == REFERENCE_FIELD )
|
||||
{
|
||||
wxCHECK_MSG( aAuxData != NULL, false,
|
||||
wxT( "Cannot replace reference designator without valid sheet path." ) );
|
||||
|
@ -459,10 +459,10 @@ wxString SCH_FIELD::GetCanonicalName() const
|
|||
{
|
||||
switch( m_id )
|
||||
{
|
||||
case REFERENCE: return wxT( "Reference" );
|
||||
case VALUE: return wxT( "Value" );
|
||||
case FOOTPRINT: return wxT( "Footprint" );
|
||||
case DATASHEET: return wxT( "Datasheet" );
|
||||
case REFERENCE_FIELD: return wxT( "Reference" );
|
||||
case VALUE_FIELD: return wxT( "Value" );
|
||||
case FOOTPRINT_FIELD: return wxT( "Footprint" );
|
||||
case DATASHEET_FIELD: return wxT( "Datasheet" );
|
||||
}
|
||||
}
|
||||
else if( m_Parent && m_Parent->Type() == SCH_SHEET_T )
|
||||
|
@ -484,10 +484,10 @@ BITMAP_DEF SCH_FIELD::GetMenuImage() const
|
|||
{
|
||||
switch( m_id )
|
||||
{
|
||||
case REFERENCE: return edit_comp_ref_xpm;
|
||||
case VALUE: return edit_comp_value_xpm;
|
||||
case FOOTPRINT: return edit_comp_footprint_xpm;
|
||||
default: return edit_text_xpm;
|
||||
case REFERENCE_FIELD: return edit_comp_ref_xpm;
|
||||
case VALUE_FIELD: return edit_comp_value_xpm;
|
||||
case FOOTPRINT_FIELD: return edit_comp_footprint_xpm;
|
||||
default: return edit_text_xpm;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,13 +80,13 @@ public:
|
|||
|
||||
for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
|
||||
{
|
||||
if( *p == SCH_FIELD_LOCATE_REFERENCE_T && m_id == REFERENCE )
|
||||
if( *p == SCH_FIELD_LOCATE_REFERENCE_T && m_id == REFERENCE_FIELD )
|
||||
return true;
|
||||
else if ( *p == SCH_FIELD_LOCATE_VALUE_T && m_id == VALUE )
|
||||
else if ( *p == SCH_FIELD_LOCATE_VALUE_T && m_id == VALUE_FIELD )
|
||||
return true;
|
||||
else if ( *p == SCH_FIELD_LOCATE_FOOTPRINT_T && m_id == FOOTPRINT )
|
||||
else if ( *p == SCH_FIELD_LOCATE_FOOTPRINT_T && m_id == FOOTPRINT_FIELD )
|
||||
return true;
|
||||
else if ( *p == SCH_FIELD_LOCATE_DATASHEET_T && m_id == DATASHEET )
|
||||
else if ( *p == SCH_FIELD_LOCATE_DATASHEET_T && m_id == DATASHEET_FIELD )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1608,7 +1608,7 @@ void SCH_ALTIUM_PLUGIN::ParsePowerPort( const std::map<wxString, wxString>& aPro
|
|||
component->SetLibId( libId );
|
||||
component->SetLibSymbol( new LIB_PART( *kpart ) );
|
||||
|
||||
SCH_FIELD* valueField = component->GetField( VALUE );
|
||||
SCH_FIELD* valueField = component->GetField( VALUE_FIELD );
|
||||
|
||||
// TODO: Why do I need to set those a second time?
|
||||
valueField->SetVisible( true );
|
||||
|
@ -2013,7 +2013,7 @@ void SCH_ALTIUM_PLUGIN::ParseDesignator( const std::map<wxString, wxString>& aPr
|
|||
|
||||
component->SetRef( &sheetpath, elem.text );
|
||||
|
||||
SCH_FIELD* refField = component->GetField( REFERENCE );
|
||||
SCH_FIELD* refField = component->GetField( REFERENCE_FIELD );
|
||||
|
||||
refField->SetPosition( elem.location + m_sheetOffset );
|
||||
refField->SetVisible( true );
|
||||
|
|
|
@ -334,7 +334,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
|
|||
SCH_COMPONENT* component =
|
||||
loadSchematicSymbol( sym, kiPart, compOrientationTenthDegree );
|
||||
|
||||
SCH_FIELD* refField = component->GetField( REFERENCE );
|
||||
SCH_FIELD* refField = component->GetField( REFERENCE_FIELD );
|
||||
refField->SetText( sym.ComponentRef.Designator );
|
||||
loadSymbolFieldAttribute(
|
||||
sym.ComponentRef.AttrLoc, compOrientationTenthDegree, refField );
|
||||
|
@ -498,7 +498,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
|
|||
{
|
||||
if( mPowerSymMap.find( netTerm.SymbolID ) != mPowerSymMap.end() )
|
||||
{
|
||||
SCH_FIELD* val = mPowerSymMap.at( netTerm.SymbolID )->GetField( VALUE );
|
||||
SCH_FIELD* val = mPowerSymMap.at( netTerm.SymbolID )->GetField( VALUE_FIELD );
|
||||
val->SetText( netName );
|
||||
val->SetPosition( getKiCadPoint( netTerm.NetLabel.Position ) );
|
||||
val->SetTextAngle( getAngleTenthDegree( netTerm.NetLabel.OrientAngle ) );
|
||||
|
@ -828,7 +828,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
|
|||
if( symbol.TextLocations.find( SYMBOL_NAME_ATTRID ) != symbol.TextLocations.end() )
|
||||
{
|
||||
TEXT_LOCATION textLoc = symbol.TextLocations.at( SYMBOL_NAME_ATTRID );
|
||||
LIB_FIELD* field = aPart->GetField( REFERENCE );
|
||||
LIB_FIELD* field = aPart->GetField( REFERENCE_FIELD );
|
||||
loadLibraryFieldAttribute( textLoc, symbol.Origin, field );
|
||||
field->SetUnit( gateNumber );
|
||||
}
|
||||
|
|
|
@ -658,9 +658,10 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
|
|||
continue; // unit has been already processed
|
||||
|
||||
// Instantiate the missing component unit
|
||||
int unit = unitEntry.first;
|
||||
const wxString reference = origCmp->GetField( REFERENCE )->GetText();
|
||||
int unit = unitEntry.first;
|
||||
const wxString reference = origCmp->GetField( REFERENCE_FIELD )->GetText();
|
||||
std::unique_ptr<SCH_COMPONENT> component( (SCH_COMPONENT*) origCmp->Duplicate() );
|
||||
|
||||
component->SetUnitSelection( &sheetpath, unit );
|
||||
component->SetUnit( unit );
|
||||
component->SetOrientation( 0 );
|
||||
|
@ -1140,7 +1141,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
component->SetLibId( libId );
|
||||
component->SetUnit( unit );
|
||||
component->SetPosition( wxPoint( einstance.x.ToSchUnits(), -einstance.y.ToSchUnits() ) );
|
||||
component->GetField( FOOTPRINT )->SetText( package );
|
||||
component->GetField( FOOTPRINT_FIELD )->SetText( package );
|
||||
|
||||
if( einstance.rot )
|
||||
{
|
||||
|
@ -1174,21 +1175,21 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
m_rootSheet->LocatePathOfScreen( screen, &sheetpath );
|
||||
wxString current_sheetpath = sheetpath.PathAsString() + component->m_Uuid.AsString();
|
||||
|
||||
component->GetField( REFERENCE )->SetText( reference );
|
||||
component->GetField( REFERENCE_FIELD )->SetText( reference );
|
||||
component->AddHierarchicalReference( current_sheetpath, reference, unit );
|
||||
|
||||
if( epart->value )
|
||||
component->GetField( VALUE )->SetText( *epart->value );
|
||||
component->GetField( VALUE_FIELD )->SetText( *epart->value );
|
||||
else
|
||||
component->GetField( VALUE )->SetText( kisymbolname );
|
||||
component->GetField( VALUE_FIELD )->SetText( kisymbolname );
|
||||
|
||||
// Set the visibility of fields.
|
||||
component->GetField( REFERENCE )->SetVisible( part->GetField( REFERENCE )->IsVisible() );
|
||||
component->GetField( VALUE )->SetVisible( part->GetField( VALUE )->IsVisible() );
|
||||
component->GetField( REFERENCE_FIELD )->SetVisible( part->GetField( REFERENCE_FIELD )->IsVisible() );
|
||||
component->GetField( VALUE_FIELD )->SetVisible( part->GetField( VALUE_FIELD )->IsVisible() );
|
||||
|
||||
for( const auto& a : epart->attribute )
|
||||
{
|
||||
auto field = component->AddField( *component->GetField( VALUE ) );
|
||||
auto field = component->AddField( *component->GetField( VALUE_FIELD ) );
|
||||
field->SetName( a.first );
|
||||
field->SetText( a.second );
|
||||
field->SetVisible( false );
|
||||
|
@ -1196,7 +1197,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
|
||||
for( const auto& a : epart->variant )
|
||||
{
|
||||
auto field = component->AddField( *component->GetField( VALUE ) );
|
||||
auto field = component->AddField( *component->GetField( VALUE_FIELD ) );
|
||||
field->SetName( "VARIANT_" + a.first );
|
||||
field->SetText( a.second );
|
||||
field->SetVisible( false );
|
||||
|
@ -1217,12 +1218,12 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
|
||||
if( attr.name.Lower() == "name" )
|
||||
{
|
||||
field = component->GetField( REFERENCE );
|
||||
field = component->GetField( REFERENCE_FIELD );
|
||||
nameAttributeFound = true;
|
||||
}
|
||||
else if( attr.name.Lower() == "value" )
|
||||
{
|
||||
field = component->GetField( VALUE );
|
||||
field = component->GetField( VALUE_FIELD );
|
||||
valueAttributeFound = true;
|
||||
}
|
||||
else
|
||||
|
@ -1264,7 +1265,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
if( attributeNode->GetAttribute( "name", &variant )
|
||||
&& attributeNode->GetAttribute( "value", &value ) )
|
||||
{
|
||||
auto field = component->AddField( *component->GetField( VALUE ) );
|
||||
auto field = component->AddField( *component->GetField( VALUE_FIELD ) );
|
||||
field->SetName( "VARIANT_" + variant );
|
||||
field->SetText( value );
|
||||
field->SetVisible( false );
|
||||
|
@ -1277,10 +1278,10 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
if( einstance.smashed && einstance.smashed.Get() )
|
||||
{
|
||||
if( !valueAttributeFound )
|
||||
component->GetField( VALUE )->SetVisible( false );
|
||||
component->GetField( VALUE_FIELD )->SetVisible( false );
|
||||
|
||||
if( !nameAttributeFound )
|
||||
component->GetField( REFERENCE )->SetVisible( false );
|
||||
component->GetField( REFERENCE_FIELD )->SetVisible( false );
|
||||
}
|
||||
|
||||
// Save the pin positions
|
||||
|
@ -1355,7 +1356,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary(
|
|||
kpart->SetUnitCount( gates_count );
|
||||
kpart->LockUnits( true );
|
||||
|
||||
LIB_FIELD* reference = kpart->GetField( REFERENCE );
|
||||
LIB_FIELD* reference = kpart->GetField( REFERENCE_FIELD );
|
||||
|
||||
if( prefix.length() == 0 )
|
||||
reference->SetVisible( false );
|
||||
|
@ -1503,13 +1504,13 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
|
|||
|
||||
if( libtext->GetText().Upper() == ">NAME" )
|
||||
{
|
||||
LIB_FIELD* field = aPart->GetField( REFERENCE );
|
||||
LIB_FIELD* field = aPart->GetField( REFERENCE_FIELD );
|
||||
loadFieldAttributes( field, libtext.get() );
|
||||
foundName = true;
|
||||
}
|
||||
else if( libtext->GetText().Upper() == ">VALUE" )
|
||||
{
|
||||
LIB_FIELD* field = aPart->GetField( VALUE );
|
||||
LIB_FIELD* field = aPart->GetField( VALUE_FIELD );
|
||||
loadFieldAttributes( field, libtext.get() );
|
||||
foundValue = true;
|
||||
}
|
||||
|
@ -1539,10 +1540,10 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
|
|||
}
|
||||
|
||||
if( foundName == false )
|
||||
aPart->GetField( REFERENCE )->SetVisible( false );
|
||||
aPart->GetField( REFERENCE_FIELD )->SetVisible( false );
|
||||
|
||||
if( foundValue == false )
|
||||
aPart->GetField( VALUE )->SetVisible( false );
|
||||
aPart->GetField( VALUE_FIELD )->SetVisible( false );
|
||||
|
||||
return pincount == 1 ? ispower : false;
|
||||
}
|
||||
|
@ -2546,7 +2547,7 @@ void SCH_EAGLE_PLUGIN::addImplicitConnections(
|
|||
return;
|
||||
|
||||
int unit = aComponent->GetUnit();
|
||||
const wxString reference = aComponent->GetField( REFERENCE )->GetText();
|
||||
const wxString reference = aComponent->GetField( REFERENCE_FIELD )->GetText();
|
||||
std::vector<LIB_PIN*> pins;
|
||||
aComponent->GetPartRef()->GetPins( pins );
|
||||
std::set<int> missingUnits;
|
||||
|
|
|
@ -2249,7 +2249,7 @@ SCH_COMPONENT* SCH_SEXPR_PARSER::parseSchematicSymbol()
|
|||
fieldIDsRead.insert( field->GetId() );
|
||||
|
||||
// Set the default symbol reference prefix.
|
||||
if( field->GetId() == REFERENCE )
|
||||
if( field->GetId() == REFERENCE_FIELD )
|
||||
{
|
||||
wxString refDesignator = field->GetText();
|
||||
|
||||
|
|
|
@ -1638,7 +1638,7 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( LINE_READER& aReader )
|
|||
SCH_PARSE_ERROR( "unit value out of range", aReader, line );
|
||||
|
||||
component->AddHierarchicalReference( path, reference, (int)tmp );
|
||||
component->GetField( REFERENCE )->SetText( reference );
|
||||
component->GetField( REFERENCE_FIELD )->SetText( reference );
|
||||
|
||||
}
|
||||
else if( strCompare( "F", line, &line ) )
|
||||
|
@ -2002,10 +2002,10 @@ void SCH_LEGACY_PLUGIN::saveComponent( SCH_COMPONENT* aComponent )
|
|||
}
|
||||
else
|
||||
{
|
||||
if( aComponent->GetField( REFERENCE )->GetText().IsEmpty() )
|
||||
if( aComponent->GetField( REFERENCE_FIELD )->GetText().IsEmpty() )
|
||||
name1 = toUTFTildaText( aComponent->GetPrefix() );
|
||||
else
|
||||
name1 = toUTFTildaText( aComponent->GetField( REFERENCE )->GetText() );
|
||||
name1 = toUTFTildaText( aComponent->GetField( REFERENCE_FIELD )->GetText() );
|
||||
}
|
||||
|
||||
wxString part_name = aComponent->GetLibId().Format();
|
||||
|
@ -2729,7 +2729,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadDocs()
|
|||
|
||||
case 'F':
|
||||
if( symbol )
|
||||
symbol->GetField( DATASHEET )->SetText( text );
|
||||
symbol->GetField( DATASHEET_FIELD )->SetText( text );
|
||||
break;
|
||||
|
||||
case 0:
|
||||
|
@ -2977,7 +2977,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadAliases( std::unique_ptr<LIB_PART>& aPart,
|
|||
|
||||
*field = *parentField;
|
||||
|
||||
if( id == VALUE )
|
||||
if( id == VALUE_FIELD )
|
||||
field->SetText( newAliasName );
|
||||
|
||||
field->SetParent( newPart );
|
||||
|
@ -3130,7 +3130,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadField( std::unique_ptr<LIB_PART>& aPart,
|
|||
|
||||
// Ensure the VALUE field = the part name (can be not the case
|
||||
// with malformed libraries: edited by hand, or converted from other tools)
|
||||
if( id == VALUE )
|
||||
if( id == VALUE_FIELD )
|
||||
field->SetText( aPart->GetName() );
|
||||
}
|
||||
else
|
||||
|
|
|
@ -586,8 +586,8 @@ void SCH_SCREEN::UpdateSymbolLinks( REPORTER* aReporter )
|
|||
{
|
||||
msg.Printf( _( "Setting schematic symbol '%s %s' library identifier "
|
||||
"to '%s'. " ),
|
||||
symbol->GetField( REFERENCE )->GetText(),
|
||||
symbol->GetField( VALUE )->GetText(),
|
||||
symbol->GetField( REFERENCE_FIELD )->GetText(),
|
||||
symbol->GetField( VALUE_FIELD )->GetText(),
|
||||
symbol->GetLibId().Format().wx_str() );
|
||||
aReporter->ReportTail( msg, RPT_SEVERITY_INFO );
|
||||
}
|
||||
|
@ -661,8 +661,8 @@ void SCH_SCREEN::UpdateSymbolLinks( REPORTER* aReporter )
|
|||
if( aReporter )
|
||||
{
|
||||
msg.Printf( _( "Falling back to cache to set symbol '%s:%s' link '%s'." ),
|
||||
symbol->GetField( REFERENCE )->GetText(),
|
||||
symbol->GetField( VALUE )->GetText(),
|
||||
symbol->GetField( REFERENCE_FIELD )->GetText(),
|
||||
symbol->GetField( VALUE_FIELD )->GetText(),
|
||||
id );
|
||||
aReporter->ReportTail( msg, RPT_SEVERITY_WARNING );
|
||||
}
|
||||
|
@ -682,8 +682,8 @@ void SCH_SCREEN::UpdateSymbolLinks( REPORTER* aReporter )
|
|||
if( aReporter )
|
||||
{
|
||||
msg.Printf( _( "Setting schematic symbol '%s %s' library identifier to '%s'. " ),
|
||||
symbol->GetField( REFERENCE )->GetText(),
|
||||
symbol->GetField( VALUE )->GetText(),
|
||||
symbol->GetField( REFERENCE_FIELD )->GetText(),
|
||||
symbol->GetField( VALUE_FIELD )->GetText(),
|
||||
symbol->GetLibId().Format().wx_str() );
|
||||
aReporter->ReportTail( msg, RPT_SEVERITY_INFO );
|
||||
}
|
||||
|
@ -693,8 +693,8 @@ void SCH_SCREEN::UpdateSymbolLinks( REPORTER* aReporter )
|
|||
if( aReporter )
|
||||
{
|
||||
msg.Printf( _( "No library symbol found for schematic symbol '%s %s'. " ),
|
||||
symbol->GetField( REFERENCE )->GetText(),
|
||||
symbol->GetField( VALUE )->GetText() );
|
||||
symbol->GetField( REFERENCE_FIELD )->GetText(),
|
||||
symbol->GetField( VALUE_FIELD )->GetText() );
|
||||
aReporter->ReportTail( msg, RPT_SEVERITY_ERROR );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -615,7 +615,7 @@ int SCH_SHEET::ComponentCount() const
|
|||
{
|
||||
SCH_COMPONENT* comp = (SCH_COMPONENT*) aItem;
|
||||
|
||||
if( comp->GetField( VALUE )->GetText().GetChar( 0 ) != '#' )
|
||||
if( comp->GetField( VALUE_FIELD )->GetText().GetChar( 0 ) != '#' )
|
||||
n++;
|
||||
}
|
||||
|
||||
|
|
|
@ -252,9 +252,9 @@ void SCH_SHEET_PATH::UpdateAllScreenReferences()
|
|||
for( auto item : LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
|
||||
{
|
||||
auto component = static_cast<SCH_COMPONENT*>( item );
|
||||
component->GetField( REFERENCE )->SetText( component->GetRef( this ) );
|
||||
component->GetField( VALUE )->SetText( component->GetValue( this ) );
|
||||
component->GetField( FOOTPRINT )->SetText( component->GetFootprint( this ) );
|
||||
component->GetField( REFERENCE_FIELD )->SetText( component->GetRef( this ) );
|
||||
component->GetField( VALUE_FIELD )->SetText( component->GetValue( this ) );
|
||||
component->GetField( FOOTPRINT_FIELD )->SetText( component->GetFootprint( this ) );
|
||||
component->UpdateUnit( component->GetUnitSelection( this ) );
|
||||
}
|
||||
}
|
||||
|
@ -820,7 +820,7 @@ void SCH_SHEET_LIST::UpdateSymbolInstances(
|
|||
symbol->AddHierarchicalReference( symbolInstances[i].GetSheetPath().Path(),
|
||||
it->m_Reference, it->m_Unit, it->m_Value,
|
||||
it->m_Footprint );
|
||||
symbol->GetField( REFERENCE )->SetText( it->m_Reference );
|
||||
symbol->GetField( REFERENCE_FIELD )->SetText( it->m_Reference );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,11 +46,11 @@ SCH_FIELD_VALIDATOR::SCH_FIELD_VALIDATOR( bool aIsLibEditor, int aFieldId, wxSt
|
|||
wxString excludes( "\r\n\t" );
|
||||
|
||||
// The reference field cannot contain spaces.
|
||||
if( aFieldId == REFERENCE )
|
||||
if( aFieldId == REFERENCE_FIELD )
|
||||
{
|
||||
excludes += " ";
|
||||
}
|
||||
else if( aFieldId == VALUE && m_isLibEditor )
|
||||
else if( aFieldId == VALUE_FIELD && m_isLibEditor )
|
||||
{
|
||||
excludes += " :/\\";
|
||||
}
|
||||
|
@ -62,8 +62,8 @@ SCH_FIELD_VALIDATOR::SCH_FIELD_VALIDATOR( bool aIsLibEditor, int aFieldId, wxSt
|
|||
long style = GetStyle();
|
||||
|
||||
// The reference, value sheetname and sheetfilename fields cannot be empty.
|
||||
if( aFieldId == REFERENCE
|
||||
|| aFieldId == VALUE
|
||||
if( aFieldId == REFERENCE_FIELD
|
||||
|| aFieldId == VALUE_FIELD
|
||||
|| aFieldId == SHEETNAME_V
|
||||
|| aFieldId == SHEETFILENAME_V
|
||||
|| aFieldId == FIELD_NAME )
|
||||
|
@ -102,19 +102,19 @@ bool SCH_FIELD_VALIDATOR::Validate( wxWindow *aParent )
|
|||
|
||||
switch( m_fieldId )
|
||||
{
|
||||
case REFERENCE:
|
||||
case REFERENCE_FIELD:
|
||||
fieldCharError = _( "The reference designator cannot contain %s character(s)." );
|
||||
break;
|
||||
|
||||
case VALUE:
|
||||
case VALUE_FIELD:
|
||||
fieldCharError = _( "The value field cannot contain %s character(s)." );
|
||||
break;
|
||||
|
||||
case FOOTPRINT:
|
||||
case FOOTPRINT_FIELD:
|
||||
fieldCharError = _( "The footprint field cannot contain %s character(s)." );
|
||||
break;
|
||||
|
||||
case DATASHEET:
|
||||
case DATASHEET_FIELD:
|
||||
fieldCharError = _( "The datasheet field cannot contain %s character(s)." );
|
||||
break;
|
||||
|
||||
|
@ -140,14 +140,14 @@ bool SCH_FIELD_VALIDATOR::Validate( wxWindow *aParent )
|
|||
// Some fields cannot have an empty value, and user fields require a name:
|
||||
if( m_fieldId == FIELD_NAME )
|
||||
msg.Printf( _( "The name of the field cannot be empty." ) );
|
||||
else // the FIELD_VALUE id or REFERENCE or VALUE
|
||||
else // the FIELD_VALUE id or REFERENCE_FIELD or VALUE_FIELD
|
||||
msg.Printf( _( "The value of the field cannot be empty." ) );
|
||||
}
|
||||
else if( HasFlag( wxFILTER_EXCLUDE_CHAR_LIST ) && ContainsExcludedCharacters( val ) )
|
||||
{
|
||||
wxArrayString whiteSpace;
|
||||
bool spaceIllegal = m_fieldId == REFERENCE
|
||||
|| ( m_fieldId == VALUE && m_isLibEditor )
|
||||
bool spaceIllegal = m_fieldId == REFERENCE_FIELD
|
||||
|| ( m_fieldId == VALUE_FIELD && m_isLibEditor )
|
||||
|| m_fieldId == SHEETNAME_V
|
||||
|| m_fieldId == SHEETFILENAME_V;
|
||||
|
||||
|
@ -176,7 +176,7 @@ bool SCH_FIELD_VALIDATOR::Validate( wxWindow *aParent )
|
|||
|
||||
msg.Printf( fieldCharError, badChars );
|
||||
}
|
||||
else if( m_fieldId == REFERENCE && val.Contains( wxT( "${" ) ) )
|
||||
else if( m_fieldId == REFERENCE_FIELD && val.Contains( wxT( "${" ) ) )
|
||||
{
|
||||
msg.Printf( _( "The reference designator cannot contain text variable references" ) );
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#define FIELD_VALUE -2
|
||||
|
||||
#define SHEETNAME_V 100 // We can't use SHEETNAME and SHEETFILENAME because they
|
||||
#define SHEETFILENAME_V 101 // overlap with REFERENCE and VALUE
|
||||
#define SHEETFILENAME_V 101 // overlap with REFERENCE_FIELD and VALUE_FIELD
|
||||
#define SHEETUSERFIELD_V 102
|
||||
|
||||
/**
|
||||
|
|
|
@ -536,7 +536,7 @@ void SIM_PLOT_FRAME::AddTuner( SCH_COMPONENT* aComponent )
|
|||
if( primitiveType != SP_RESISTOR && primitiveType != SP_CAPACITOR && primitiveType != SP_INDUCTOR )
|
||||
return;
|
||||
|
||||
const wxString componentName = aComponent->GetField( REFERENCE )->GetText();
|
||||
const wxString componentName = aComponent->GetField( REFERENCE_FIELD )->GetText();
|
||||
|
||||
// Do not add multiple instances for the same component
|
||||
auto tunerIt = std::find_if( m_tuners.begin(), m_tuners.end(), [&]( const TUNER_SLIDER* t )
|
||||
|
|
|
@ -546,16 +546,16 @@ void SYMBOL_EDIT_FRAME::CreateNewPart()
|
|||
|
||||
switch( id )
|
||||
{
|
||||
case REFERENCE:
|
||||
case REFERENCE_FIELD:
|
||||
// parent's reference already copied
|
||||
break;
|
||||
|
||||
case VALUE:
|
||||
case VALUE_FIELD:
|
||||
field->SetText( name );
|
||||
break;
|
||||
|
||||
case FOOTPRINT:
|
||||
case DATASHEET:
|
||||
case FOOTPRINT_FIELD:
|
||||
case DATASHEET_FIELD:
|
||||
// - footprint might be the same as parent, but might not
|
||||
// - datasheet is most likely different
|
||||
// - probably best to play it safe and copy neither
|
||||
|
|
|
@ -87,8 +87,8 @@ void SCH_EDITOR_CONTROL::AssignFootprints( const std::string& aChangedSetOfRefer
|
|||
SCH_SHEET_PATH* sheetPath = nullptr; // &refs[ii].GetSheetPath();
|
||||
wxString oldfp = refs[ii].GetFootprint();
|
||||
|
||||
if( oldfp.IsEmpty() && component->GetField( FOOTPRINT )->IsVisible() )
|
||||
component->GetField( FOOTPRINT )->SetVisible( false );
|
||||
if( oldfp.IsEmpty() && component->GetField( FOOTPRINT_FIELD )->IsVisible() )
|
||||
component->GetField( FOOTPRINT_FIELD )->SetVisible( false );
|
||||
|
||||
if( oldfp != footprint )
|
||||
{
|
||||
|
@ -188,7 +188,7 @@ bool SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile( const wxString& aFullFil
|
|||
component->SetFootprint( sheetPath, footprint );
|
||||
|
||||
if( aForceVisibilityState )
|
||||
component->GetField( FOOTPRINT )->SetVisible( aVisibilityState );
|
||||
component->GetField( FOOTPRINT_FIELD )->SetVisible( aVisibilityState );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -362,7 +362,7 @@ int EE_INSPECTION_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent )
|
|||
|
||||
SCH_COMPONENT* component = (SCH_COMPONENT*) selection.Front();
|
||||
|
||||
datasheet = component->GetField( DATASHEET )->GetText();
|
||||
datasheet = component->GetField( DATASHEET_FIELD )->GetText();
|
||||
}
|
||||
|
||||
if( !datasheet.IsEmpty() && datasheet != wxT( "~" ) )
|
||||
|
|
|
@ -494,7 +494,7 @@ void LIB_EDIT_TOOL::editFieldProperties( LIB_FIELD* aField )
|
|||
|
||||
// Editing the component value field is equivalent to creating a new component based
|
||||
// on the current component. Set the dialog message to inform the user.
|
||||
if( aField->GetId() == VALUE )
|
||||
if( aField->GetId() == VALUE_FIELD )
|
||||
caption = _( "Edit Component Name" );
|
||||
else
|
||||
caption.Printf( _( "Edit %s Field" ), aField->GetName() );
|
||||
|
@ -508,7 +508,7 @@ void LIB_EDIT_TOOL::editFieldProperties( LIB_FIELD* aField )
|
|||
|
||||
wxString newFieldValue = LIB_ID::FixIllegalChars( dlg.GetText(), LIB_ID::ID_SCH );
|
||||
wxString oldFieldValue = aField->GetFullText( m_frame->GetUnit() );
|
||||
bool renamed = aField->GetId() == VALUE && newFieldValue != oldFieldValue;
|
||||
bool renamed = aField->GetId() == VALUE_FIELD && newFieldValue != oldFieldValue;
|
||||
|
||||
if( renamed )
|
||||
saveCopyInUndoList( parent, UNDO_REDO::LIB_RENAME );
|
||||
|
|
|
@ -1239,11 +1239,11 @@ int SCH_EDIT_TOOL::EditField( const TOOL_EVENT& aEvent )
|
|||
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
|
||||
|
||||
if( aEvent.IsAction( &EE_ACTIONS::editReference ) )
|
||||
editFieldText( component->GetField( REFERENCE ) );
|
||||
editFieldText( component->GetField( REFERENCE_FIELD ) );
|
||||
else if( aEvent.IsAction( &EE_ACTIONS::editValue ) )
|
||||
editFieldText( component->GetField( VALUE ) );
|
||||
editFieldText( component->GetField( VALUE_FIELD ) );
|
||||
else if( aEvent.IsAction( &EE_ACTIONS::editFootprint ) )
|
||||
editFieldText( component->GetField( FOOTPRINT ) );
|
||||
editFieldText( component->GetField( FOOTPRINT_FIELD ) );
|
||||
}
|
||||
else if( item->Type() == SCH_FIELD_T )
|
||||
{
|
||||
|
|
|
@ -1090,7 +1090,7 @@ int SCH_EDITOR_CONTROL::UpdateNetHighlighting( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
std::vector<SCH_FIELD>& fields = comp->GetFields();
|
||||
|
||||
for( int id : { REFERENCE, VALUE } )
|
||||
for( int id : { REFERENCE_FIELD, VALUE_FIELD } )
|
||||
{
|
||||
if( item->IsBrightened() && fields[id].IsVisible() )
|
||||
fields[id].SetBrightened();
|
||||
|
|
|
@ -33,9 +33,9 @@ TUNER_SLIDER::TUNER_SLIDER( SIM_PLOT_FRAME* aFrame, wxWindow* aParent, SCH_COMPO
|
|||
: TUNER_SLIDER_BASE( aParent ), m_component( aComponent ),
|
||||
m_min( 0.0 ), m_max( 0.0 ), m_value( 0.0 ), m_frame ( aFrame )
|
||||
{
|
||||
const wxString compName = aComponent->GetField( REFERENCE )->GetText();
|
||||
const wxString compName = aComponent->GetField( REFERENCE_FIELD )->GetText();
|
||||
m_name->SetLabel( compName );
|
||||
m_value = SPICE_VALUE( aComponent->GetField( VALUE )->GetText() );
|
||||
m_value = SPICE_VALUE( aComponent->GetField( VALUE_FIELD )->GetText() );
|
||||
|
||||
m_changed = false;
|
||||
m_spiceName = aFrame->GetExporter()->GetSpiceDevice( compName ).Lower();
|
||||
|
@ -138,7 +138,7 @@ void TUNER_SLIDER::onClose( wxCommandEvent& event )
|
|||
void TUNER_SLIDER::onSave( wxCommandEvent& event )
|
||||
{
|
||||
/// @todo it will crash when component is removed; completely remove m_component
|
||||
m_component->GetField( VALUE )->SetText( m_value.ToOrigString() );
|
||||
m_component->GetField( VALUE_FIELD )->SetText( m_value.ToOrigString() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -108,10 +108,10 @@ bool AreDefaultFieldsCorrect( const LIB_FIELDS& aFields )
|
|||
|
||||
bool ok = true;
|
||||
|
||||
ok &= FieldNameIdMatches( aFields[0], "Reference", NumFieldType::REFERENCE );
|
||||
ok &= FieldNameIdMatches( aFields[1], "Value", NumFieldType::VALUE );
|
||||
ok &= FieldNameIdMatches( aFields[2], "Footprint", NumFieldType::FOOTPRINT );
|
||||
ok &= FieldNameIdMatches( aFields[3], "Datasheet", NumFieldType::DATASHEET );
|
||||
ok &= FieldNameIdMatches( aFields[0], "Reference", NumFieldType::REFERENCE_FIELD );
|
||||
ok &= FieldNameIdMatches( aFields[1], "Value", NumFieldType::VALUE_FIELD );
|
||||
ok &= FieldNameIdMatches( aFields[2], "Footprint", NumFieldType::FOOTPRINT_FIELD );
|
||||
ok &= FieldNameIdMatches( aFields[3], "Datasheet", NumFieldType::DATASHEET_FIELD );
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
|
|
@ -107,11 +107,11 @@ BOOST_AUTO_TEST_CASE( DefaultFields )
|
|||
|
||||
// also check the default field accessors
|
||||
BOOST_CHECK_PREDICATE( KI_TEST::FieldNameIdMatches,
|
||||
( m_part_no_data.GetReferenceField() )( "Reference" )( NumFieldType::REFERENCE ) );
|
||||
( m_part_no_data.GetReferenceField() )( "Reference" )( NumFieldType::REFERENCE_FIELD ) );
|
||||
BOOST_CHECK_PREDICATE( KI_TEST::FieldNameIdMatches,
|
||||
( m_part_no_data.GetValueField() )( "Value" )( NumFieldType::VALUE ) );
|
||||
( m_part_no_data.GetValueField() )( "Value" )( NumFieldType::VALUE_FIELD ) );
|
||||
BOOST_CHECK_PREDICATE( KI_TEST::FieldNameIdMatches,
|
||||
( m_part_no_data.GetFootprintField() )( "Footprint" )( NumFieldType::FOOTPRINT ) );
|
||||
( m_part_no_data.GetFootprintField() )( "Footprint" )( NumFieldType::FOOTPRINT_FIELD ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue