Naming conventions.

This commit is contained in:
Jeff Young 2021-05-05 22:41:51 +01:00
parent d4e5861c62
commit 2e3860de6f
26 changed files with 189 additions and 198 deletions

View File

@ -30,10 +30,10 @@
using namespace TFIELD_T;
#define REFCANONICAL "Reference"
#define VALCANONICAL "Value"
#define FTPCANONICAL "Footprint"
#define DSHCANONICAL "Datasheet"
#define REFERENCE_CANONICAL "Reference"
#define VALUE_CANONICAL "Value"
#define FOOTPRINT_CANONICAL "Footprint"
#define DATASHEET_CANONICAL "Datasheet"
static std::mutex s_defaultFieldMutex;
@ -50,25 +50,25 @@ const wxString TEMPLATE_FIELDNAME::GetDefaultFieldName( int aFieldNdx, bool aTra
{
switch( aFieldNdx )
{
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
case REFERENCE_FIELD: return REFERENCE_CANONICAL; // The symbol reference, R1, C1, etc.
case VALUE_FIELD: return VALUE_CANONICAL; // The symbol value
case FOOTPRINT_FIELD: return FOOTPRINT_CANONICAL; // The footprint for use with Pcbnew
case DATASHEET_FIELD: return DATASHEET_CANONICAL; // Link to a datasheet for symbol
}
}
// Mutex protection is needed so that multiple loader threads don't write to the static variables
// at once
// Mutex protection is needed so that multiple loader threads don't write to the static
// variables at once
std::lock_guard<std::mutex> lock( s_defaultFieldMutex );
// Fetching translations can take a surprising amount of time when loading libraries,
// so only do it when necessary.
if( Pgm().GetLocale() != locale )
{
referenceDefault = _( REFCANONICAL );
valueDefault = _( VALCANONICAL );
footprintDefault = _( FTPCANONICAL );
datasheetDefault = _( DSHCANONICAL );
referenceDefault = _( REFERENCE_CANONICAL );
valueDefault = _( VALUE_CANONICAL );
footprintDefault = _( FOOTPRINT_CANONICAL );
datasheetDefault = _( DATASHEET_CANONICAL );
fieldDefault = _( "Field%d" );
locale = Pgm().GetLocale();
}
@ -76,19 +76,19 @@ const wxString TEMPLATE_FIELDNAME::GetDefaultFieldName( int aFieldNdx, bool aTra
// Fixed values for the mandatory fields
switch( aFieldNdx )
{
case REFERENCE_FIELD: return referenceDefault; // The component reference, R1, C1, etc.
case VALUE_FIELD: return valueDefault; // The component value + name
case REFERENCE_FIELD: return referenceDefault; // The symbol reference, R1, C1, etc.
case VALUE_FIELD: return valueDefault; // The symbol value
case FOOTPRINT_FIELD: return footprintDefault; // The footprint for use with Pcbnew
case DATASHEET_FIELD: return datasheetDefault; // Link to a datasheet for component
case DATASHEET_FIELD: return datasheetDefault; // Link to a datasheet for symbol
default: return wxString::Format( fieldDefault, aFieldNdx );
}
}
#undef REFCANONICAL
#undef VALCANONICAL
#undef FTPCANONICAL
#undef DSHCANONICAL
#undef REFERENCE_CANONICAL
#undef VALUE_CANONICAL
#undef FOOTPRINT_CANONICAL
#undef DATASHEET_CANONICAL
void TEMPLATE_FIELDNAME::Format( OUTPUTFORMATTER* out, int nestLevel ) const

View File

@ -359,7 +359,7 @@ wxString PageLayoutDescrFileWildcard()
}
// Wildcard for cvpcb component to footprint link file
// Wildcard for cvpcb symbol to footprint link file
wxString ComponentFileWildcard()
{
return _( "KiCad symbol footprint link files" ) + AddFileExtListToFilter( { "cmp" } );

View File

@ -23,17 +23,17 @@
*/
/******************************************************************************
* Field autoplacer: Tries to find an optimal place for component fields, and
* places them there. There are two modes: "auto"-autoplace, and "manual" autoplace.
* Auto mode is for when the process is run automatically, like when rotating parts,
* and it avoids doing things that would be helpful for the final positioning but
* annoying if they happened without permission.
* Field autoplacer: Tries to find an optimal place for symbol fields, and places them there.
* There are two modes: "auto"-autoplace, and "manual" autoplace.
* Auto mode is for when the process is run automatically, like when rotating parts, and it
* avoids doing things that would be helpful for the final positioning but annoying if they
* happened without permission.
* Short description of the process:
*
* 1. Compute the dimensions of the fields' bounding box ::computeFBoxSize
* 2. Determine which side the fields will go on. ::chooseSideForFields
* 1. Sort the four sides in preference order,
* depending on the component's shape and
* depending on the symbol's shape and
* orientation ::getPreferredSides
* 2. If in manual mode, sift out the sides that would
* cause fields to overlap other items ::getCollidingSides
@ -237,7 +237,7 @@ protected:
}
/**
* Count the number of pins on a side of the component.
* Count the number of pins on a side of the symbol.
*/
unsigned pinsOnSide( SIDE aSide )
{
@ -256,9 +256,8 @@ protected:
}
/**
* Populate a list of all drawing items that *may* collide with the fields. That is,
* all drawing items, including other fields, that are not the current component or
* its own fields.
* Populate a list of all drawing items that *may* collide with the fields. That is, all
* drawing items, including other fields, that are not the current symbol or its own fields.
*/
void getPossibleCollisions( std::vector<SCH_ITEM*>& aItems )
{
@ -306,8 +305,8 @@ protected:
}
/**
* Return a list with the preferred field sides for the component, in
* decreasing order of preference.
* Return a list with the preferred field sides for the symbol, in decreasing order of
* preference.
*/
std::vector<SIDE_AND_NPINS> getPreferredSides()
{
@ -356,13 +355,13 @@ protected:
}
else
{
// If the component is horizontally mirrored, swap left and right
// If the symbol is horizontally mirrored, swap left and right
if( h_mirrored )
{
std::swap( sides[0], sides[2] );
}
// If the component is very long or is a power symbol, swap H and V
// If the symbol is very long or is a power symbol, swap H and V
if( w/h > 3.0 )
{
std::swap( sides[0], sides[1] );
@ -458,7 +457,7 @@ protected:
}
/**
* Look where a component's pins are to pick a side to put the fields on
* Look where a symbol's pins are to pick a side to put the fields on
* @param aAvoidCollisions - if true, pick last the sides where the label will collide
* with other items.
*/

View File

@ -518,9 +518,9 @@ void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet,
}
else if( item->Type() == SCH_COMPONENT_T )
{
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
for( SCH_PIN* pin : component->GetPins( &aSheet ) )
for( SCH_PIN* pin : symbol->GetPins( &aSheet ) )
{
pin->InitializeConnection( aSheet, this );

View File

@ -338,9 +338,9 @@ private:
* Any item that is stored in the list of items that have a connection point
* at a given (x, y) location will eventually be electrically connected.
* This means that we can't store SCH_COMPONENTs in this map -- we must store
* a structure that links a specific pin on a component back to that
* component: a SCH_PIN_CONNECTION. This wrapper class is a convenience for
* linking a pin and component to a specific (x, y) point.
* a structure that links a specific pin on a symbol back to that symbol: a
* SCH_PIN_CONNECTION. This wrapper class is a convenience for linking a pin
* and symbol to a specific (x, y) point.
*
* In the second phase, we iterate over each value in the map, which is a
* vector of items that have overlapping connection points. After some

View File

@ -39,10 +39,10 @@
#include <advanced_config.h>
#include <netclass.h>
SCH_ITEM* SCH_EDITOR_CONTROL::FindComponentAndItem( const wxString& aReference,
bool aSearchHierarchy,
SCH_SEARCH_T aSearchType,
const wxString& aSearchText )
SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString& aReference,
bool aSearchHierarchy,
SCH_SEARCH_T aSearchType,
const wxString& aSearchText )
{
SCH_SHEET_PATH* sheetWithComponentFound = nullptr;
SCH_COMPONENT* component = nullptr;
@ -349,7 +349,7 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
if( idcmd == nullptr ) // Highlight component only (from CvPcb or Pcbnew)
{
// Highlight component part_ref, or clear Highlight, if part_ref is not existing
editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_COMPONENT, wxEmptyString );
editor->FindSymbolAndItem( part_ref, true, HIGHLIGHT_COMPONENT, wxEmptyString );
return;
}
@ -364,21 +364,21 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
{
// Highlighting the reference itself isn't actually that useful, and it's harder to
// see. Highlight the parent and display the message.
editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_COMPONENT, msg );
editor->FindSymbolAndItem( part_ref, true, HIGHLIGHT_COMPONENT, msg );
}
else if( strcmp( idcmd, "$VAL:" ) == 0 )
{
// Highlighting the value itself isn't actually that useful, and it's harder to see.
// Highlight the parent and display the message.
editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_COMPONENT, msg );
editor->FindSymbolAndItem( part_ref, true, HIGHLIGHT_COMPONENT, msg );
}
else if( strcmp( idcmd, "$PAD:" ) == 0 )
{
editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_PIN, msg );
editor->FindSymbolAndItem( part_ref, true, HIGHLIGHT_PIN, msg );
}
else
{
editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_COMPONENT, wxEmptyString );
editor->FindSymbolAndItem( part_ref, true, HIGHLIGHT_COMPONENT, wxEmptyString );
}
}

View File

@ -442,12 +442,12 @@ bool DIALOG_CHANGE_SYMBOLS::processMatchingSymbols()
wxCHECK2( screen, continue );
std::vector<SCH_COMPONENT*> components;
std::vector<SCH_COMPONENT*> symbols;
for( SCH_ITEM* item : screen->Items().OfType( SCH_COMPONENT_T ) )
components.push_back( static_cast<SCH_COMPONENT*>( item ) );
symbols.push_back( static_cast<SCH_COMPONENT*>( item ) );
for( SCH_COMPONENT* symbol : components )
for( SCH_COMPONENT* symbol : symbols )
{
if( !isMatch( symbol, &instance ) )
continue;

View File

@ -88,7 +88,7 @@ class DIALOG_CHOOSE_SYMBOL : public DIALOG_SHIM
{
public:
/**
* Create dialog to choose component.
* Create dialog to choose symbol.
*
* @param aParent a SCH_BASE_FRAME parent window.
* @param aTitle Dialog title.
@ -112,10 +112,10 @@ public:
/**
* To be called after this dialog returns from ShowModal().
*
* For multi-unit components, if the user selects the component itself
* rather than picking an individual unit, 0 will be returned in aUnit.
* Beware that this is an invalid unit number - this should be replaced
* with whatever default is desired (usually 1).
* For multi-unit symbols, if the user selects the component itself rather than picking
* an individual unit, 0 will be returned in aUnit.
* Beware that this is an invalid unit number - this should be replaced with whatever
* default is desired (usually 1).
*
* @param aUnit if not NULL, the selected unit is filled in here.
* @return the #LIB_ID of the symbol that has been selected.
@ -153,8 +153,7 @@ public:
}
/**
* @return true if the user pressed the thumbnail view of the component to
* launch the component browser.
* @return true if the user requested the symbol browser.
*/
bool IsExternalBrowserSelected() const
{
@ -175,10 +174,10 @@ protected:
void OnComponentPreselected( wxCommandEvent& aEvent );
/**
* Handle the selection of an item. This is called when either the search
* box or the tree receive an Enter, or the tree receives a double click.
* If the item selected is a category, it is expanded or collapsed; if it
* is a component, the component is picked.
* Handle the selection of an item. This is called when either the search box or the tree
* receive an Enter, or the tree receives a double click.
* If the item selected is a category, it is expanded or collapsed; if it is a symbol, the
* symbol is picked.
*/
void OnComponentSelected( wxCommandEvent& aEvent );

View File

@ -39,7 +39,7 @@ class SCINTILLA_TRICKS;
/**
* A base class to edit schematic and component library fields.
* A base class to edit schematic and symbol library fields.
*
* This class is setup in expectation of its children possibly using Kiway player so
* #DIALOG_SHIM::ShowQuasiModal is required when calling any subclasses.
@ -103,7 +103,7 @@ protected:
/**
* Handle editing a single component field in the library editor.
* Handle editing a single symbol field in the library editor.
*
* @note Use ShowQuasiModal when calling this class!
*/
@ -119,7 +119,7 @@ public:
{
aField->SetText( m_text );
// VALUE === component name, so update the parent component if it changes.
// VALUE === symbol name, so update the parent symbol if it changes.
if( aField->GetId() == VALUE_FIELD && aField->GetParent() )
aField->GetParent()->SetName( m_text );
@ -129,7 +129,7 @@ public:
/**
* Handle editing a single component field in the schematic editor.
* Handle editing a single symbol field in the schematic editor.
*
* @note Use ShowQuasiModal when calling this class!
*/

View File

@ -368,7 +368,7 @@ void DIALOG_ERC::testErc()
m_parent->RecalculateConnections( NO_CLEANUP );
sch->ConnectionGraph()->RunERC();
// Test is all units of each multiunit component have the same footprint assigned.
// Test is all units of each multiunit symbol have the same footprint assigned.
if( settings.IsTestEnabled( ERCE_DIFFERENT_UNIT_FP ) )
{
AdvancePhase( _( "Checking footprints..." ) );

View File

@ -1147,8 +1147,8 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::OnTableCellClick( wxGridEvent& event )
{
SCH_EDITOR_CONTROL* editor = m_parent->GetToolManager()->GetTool<SCH_EDITOR_CONTROL>();
editor->FindComponentAndItem( refs[0].GetRef() + refs[0].GetRefNumber(), true,
HIGHLIGHT_COMPONENT, wxEmptyString );
editor->FindSymbolAndItem( refs[ 0 ].GetRef() + refs[ 0 ].GetRefNumber(), true,
HIGHLIGHT_COMPONENT, wxEmptyString );
}
}
else

View File

@ -339,19 +339,19 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
if( aItem->Type() == SCH_COMPONENT_T )
{
SCH_COMPONENT* component = (SCH_COMPONENT*) aItem;
SCH_COMPONENT* symbol = (SCH_COMPONENT*) aItem;
if( m_references->GetValue() )
processItem( aSheetPath, component->GetField( REFERENCE_FIELD ), aItem );
processItem( aSheetPath, symbol->GetField( REFERENCE_FIELD ), aItem );
if( m_values->GetValue() )
processItem( aSheetPath, component->GetField( VALUE_FIELD ), aItem );
processItem( aSheetPath, symbol->GetField( VALUE_FIELD ), aItem );
if( m_otherFields->GetValue() )
{
for( int i = 2; i < component->GetFieldCount(); ++i )
for( int i = 2; i < symbol->GetFieldCount(); ++i )
{
SCH_FIELD& field = component->GetFields()[i];
SCH_FIELD& field = symbol->GetFields()[i];
const wxString& fieldName = field.GetName();
if( !m_fieldnameFilterOpt->GetValue() || m_fieldnameFilter->GetValue().IsEmpty()

View File

@ -92,7 +92,7 @@ public:
int TestConflictingBusAliases();
/**
* Test if all units of each multiunit component have the same footprint assigned.
* Test if all units of each multiunit symbol have the same footprint assigned.
* @return The error count.
*/
int TestMultiunitFootprints();
@ -111,7 +111,7 @@ public:
int TestPinToPin();
/**
* Checks if shared pins on multi-unit components have been connected to different nets
* Checks if shared pins on multi-unit symbols have been connected to different nets
* @return the error count
*/
int TestMultUnitPinConflicts();

View File

@ -37,12 +37,12 @@ class SCH_LEGACY_PLUGIN_CACHE;
/**
* Field object used in symbol libraries. At least MANDATORY_FIELDS are always present
* in a ram resident library symbol. All constructors must ensure this because
* the component property editor assumes it.
* Field object used in symbol libraries. At least MANDATORY_FIELDS are always present in a
* RAM-resident library symbol. All constructors must ensure this because the symbol property
* editor assumes it.
* <p>
* A field is a string linked to a component. Unlike purely graphical text, fields can
* be used in netlist generation and other tools (BOM).
* A field is a string linked to a symbol. Unlike purely graphical text, fields can be used in
* netlist generation and other tools (BOM).
*
* The first 4 fields have a special meaning:
*
@ -128,8 +128,8 @@ public:
* Set a user definable field name to \a aName.
*
* Reserved fields such as value and reference are not renamed. If the field name is
* changed, the field modified flag is set. If the field is the child of a component,
* the parent component's modified flag is also set.
* changed, the field modified flag is set. If the field is the child of a symbol, the
* parent symbol's modified flag is also set.
*
* @param aName - User defined field name.
*/

View File

@ -68,8 +68,9 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
wxString errorMsg;
SCH_SCREENS screens( Schematic().Root() );
// Create a new empty library to archive components:
std::unique_ptr<PART_LIB> archLib = std::make_unique<PART_LIB>( SCH_LIB_TYPE::LT_EESCHEMA, aFileName );
// Create a new empty library to archive symbols:
std::unique_ptr<PART_LIB> archLib = std::make_unique<PART_LIB>( SCH_LIB_TYPE::LT_EESCHEMA,
aFileName );
// Save symbols to file only when the library will be fully filled
archLib->EnableBuffering();
@ -84,21 +85,21 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
for( auto aItem : screen->Items().OfType( SCH_COMPONENT_T ) )
{
LIB_PART* part = nullptr;
auto component = static_cast<SCH_COMPONENT*>( aItem );
LIB_PART* part = nullptr;
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( aItem );
try
{
if( archLib->FindPart( component->GetLibId() ) )
if( archLib->FindPart( symbol->GetLibId() ) )
continue;
part = GetLibPart( component->GetLibId(), true );
part = GetLibPart( symbol->GetLibId(), true );
}
catch( const IO_ERROR& )
{
// Queue up error messages for later.
tmp.Printf( _( "Failed to add symbol \"%s\" to library file \"%s\"." ),
component->GetLibId().GetUniStringLibItemName(), aFileName );
symbol->GetLibId().GetUniStringLibItemName(), aFileName );
// Don't bail out here. Attempt to add as many of the symbols to the library
// as possible.
@ -113,7 +114,7 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
std::unique_ptr<LIB_PART> flattenedPart = part->Flatten();
// Use the full LIB_ID as the symbol name to prevent symbol name collisions.
flattenedPart->SetName( component->GetLibId().GetUniStringLibId() );
flattenedPart->SetName( symbol->GetLibId().GetUniStringLibId() );
// AddPart() does first clone the part before adding.
archLib->AddPart( flattenedPart.get() );
@ -121,10 +122,10 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
else
{
tmp.Printf( _( "Symbol %s not found in any library or cache." ),
component->GetLibId().GetUniStringLibId() );
symbol->GetLibId().GetUniStringLibId() );
}
if( !tmp.empty() && !errorMsg.Contains( component->GetLibId().GetUniStringLibId() ) )
if( !tmp.empty() && !errorMsg.Contains( symbol->GetLibId().GetUniStringLibId() ) )
{
if( errorMsg.empty() )
errorMsg += tmp;

View File

@ -141,27 +141,25 @@ public:
void UpdateStatusBar() override;
/**
* Call the library viewer to select component to import into schematic.
* if the library viewer is currently running, it is closed and reopened
* in modal mode.
* Call the library viewer to select symbol to import into schematic.
* If the library viewer is currently running, it is closed and reopened in modal mode.
*
* aAllowFields chooses whether or not features that permit the user to edit
* fields (e.g. footprint selection) should be enabled. This should be false
* when they would have no effect, for example loading a part into symbol_editor.
* aAllowFields chooses whether or not features that permit the user to edit fields
* (e.g. footprint selection) should be enabled. This should be false when they would
* have no effect, for example loading a part into symbol_editor.
*
* @param aFilter is a #SCHLIB_FILTER filter to pass the allowed library names
* and/or the library name to load the component from and/or some other filter
* if NULL, no filtering.
* @param aHistoryList is the list of previously loaded components - will be edited
* @param aUseLibBrowser is the flag to call the library viewer to select the component
* @param aFilter is an optional #SCHLIB_FILTER filter to pass the allowed library names
* and/or the library name to load the symbol from and/or some other filter
* @param aHistoryList is the list of previously loaded symbols - will be edited
* @param aUseLibBrowser is the flag to call the library viewer to select the symbol
* @param aUnit is the preselected unit.
* @param aConvert is the preselected De Morgan shape.
* @param aHighlight is the name of component to highlight in the list.
* @param aHighlight is the name of symbol to highlight in the list.
* highlights none if there isn't one by that name.
* @param aShowFootprints is the whether to show footprints in the dialog.
* @param aAllowFields is whether to allow field editing in the dialog.
*
* @return the selected component
* @return the selected symbol
*/
PICKED_SYMBOL PickSymbolFromLibTree( const SCHLIB_FILTER* aFilter,
std::vector<PICKED_SYMBOL>& aHistoryList,
@ -187,17 +185,16 @@ public:
LIB_PART* GetFlattenedLibPart( const LIB_ID& aLibId, bool aShowErrorMsg = false );
/**
* Call the library viewer to select component to import into schematic.
* if the library viewer is currently running, it is closed and reopened
* in modal mode.
* Call the library viewer to select symbol to import into schematic.
* If the library viewer is currently running, it is closed and reopened in modal mode.
*
* @param aParent is the caller.
* @param aFilter is a filter to pass the allowed library names
* and/or some other filter.
* @param aPreselectedLibId is the preselected component #LIB_ID. Not valid if none selected.
* @param aPreselectedLibId is the preselected symbol's #LIB_ID. Not valid if none selected.
* @param aUnit is the preselected unit.
* @param aConvert is the preselected deMorgan conversion.
* @return the selected component.
* @return the selected symbol.
*/
PICKED_SYMBOL PickSymbolFromLibBrowser( wxTopLevelWindow* aParent,
const SCHLIB_FILTER* aFilter,

View File

@ -23,12 +23,11 @@
*/
/*
* Fields are texts attached to a component, having a special meaning
* Fields 0 and 1 are very important: reference and value
* Fields are texts attached to a symbol, some of which have a special meaning.
* Fields 0 and 1 are very important: reference and value.
* Field 2 is used as default footprint name.
* Field 3 is reserved (not currently used
* Fields 4 and more are user fields.
* They can be renamed and can appear in reports
* Field 3 is used to point to a datasheet (usually a URL).
* Fields 4+ are user fields. They can be renamed and can appear in reports.
*/
#include <wx/menu.h>
@ -687,9 +686,9 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter ) const
void SCH_FIELD::SetPosition( const wxPoint& aPosition )
{
// Actual positions are calculated by the rotation/mirror transform of the
// parent component of the field. The inverse transform is used to calculate
// the position relative to the parent component.
// Actual positions are calculated by the rotation/mirror transform of the parent symbol
// of the field. The inverse transform is used to calculate the position relative to the
// parent symbol.
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
{
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );

View File

@ -37,7 +37,7 @@ class LIB_FIELD;
/**
* Instances are attached to a symbol or sheet and provide a place for the component's value,
* Instances are attached to a symbol or sheet and provide a place for the symbol's value,
* reference designator, footprint, , a sheet's name, filename, and user definable name-value
* pairs of arbitrary purpose.
*

View File

@ -788,7 +788,7 @@ void SCH_LEGACY_PLUGIN::LoadContent( LINE_READER& aReader, SCH_SCREEN* aScreen,
if( strCompare( "$Descr", line ) )
loadPageSettings( aReader, aScreen );
else if( strCompare( "$Comp", line ) )
aScreen->Append( loadComponent( aReader ) );
aScreen->Append( loadSymbol( aReader ) );
else if( strCompare( "$Sheet", line ) )
aScreen->Append( loadSheet( aReader ) );
else if( strCompare( "$Bitmap", line ) )
@ -1490,13 +1490,13 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( LINE_READER& aReader )
}
SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( LINE_READER& aReader )
SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader )
{
const char* line = aReader.Line();
wxCHECK( strCompare( "$Comp", line, &line ), NULL );
std::unique_ptr<SCH_COMPONENT> component = std::make_unique<SCH_COMPONENT>();
std::unique_ptr<SCH_COMPONENT> symbol = std::make_unique<SCH_COMPONENT>();
line = aReader.ReadLine();
@ -1526,7 +1526,7 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( LINE_READER& aReader )
else
libId.SetLibItemName( libName, false );
component->SetLibId( libId );
symbol->SetLibId( libId );
wxString refDesignator = tokens.GetNextToken();
@ -1547,9 +1547,9 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( LINE_READER& aReader )
prefix.Trim( false );
if( prefix.IsEmpty() )
component->SetPrefix( wxString( "U" ) );
symbol->SetPrefix( wxString( "U" ) );
else
component->SetPrefix( prefix );
symbol->SetPrefix( prefix );
}
else if( strCompare( "U", line, &line ) )
{
@ -1566,7 +1566,7 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( LINE_READER& aReader )
m_rootSheet->GetScreen()->SetModify();
}
component->SetUnit( unit );
symbol->SetUnit( unit );
// Same can also happen with the convert parameter
int convert = parseInt( aReader, line, &line );
@ -1580,13 +1580,13 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( LINE_READER& aReader )
m_rootSheet->GetScreen()->SetModify();
}
component->SetConvert( convert );
symbol->SetConvert( convert );
wxString text;
parseUnquotedString( text, aReader, line, &line );
if( text != "00000000" )
const_cast<KIID&>( component->m_Uuid ) = KIID( text );
const_cast<KIID&>( symbol->m_Uuid ) = KIID( text );
}
else if( strCompare( "P", line, &line ) )
{
@ -1594,7 +1594,7 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( LINE_READER& aReader )
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
pos.y = Mils2Iu( parseInt( aReader, line, &line ) );
component->SetPosition( pos );
symbol->SetPosition( pos );
}
else if( strCompare( "AR", line, &line ) )
{
@ -1609,7 +1609,7 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( LINE_READER& aReader )
parseQuotedString( pathStr, aReader, line, &line );
// Note: AR path excludes root sheet, but includes component. Normalize to
// Note: AR path excludes root sheet, but includes symbol. Normalize to
// internal format by shifting everything down one and adding the root sheet.
KIID_PATH path( pathStr );
@ -1649,8 +1649,8 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( LINE_READER& aReader )
if( tmp < 0 || tmp > MAX_UNIT_COUNT_PER_PACKAGE )
SCH_PARSE_ERROR( "unit value out of range", aReader, line );
component->AddHierarchicalReference( path, reference, (int)tmp );
component->GetField( REFERENCE_FIELD )->SetText( reference );
symbol->AddHierarchicalReference( path, reference, (int)tmp );
symbol->GetField( REFERENCE_FIELD )->SetText( reference );
}
else if( strCompare( "F", line, &line ) )
@ -1668,23 +1668,23 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( LINE_READER& aReader )
int size = Mils2Iu( parseInt( aReader, line, &line ) );
int attributes = parseHex( aReader, line, &line );
if( index >= component->GetFieldCount() )
if( index >= symbol->GetFieldCount() )
{
// The first MANDATOR_FIELDS _must_ be constructed within
// the SCH_COMPONENT constructor. This assert is simply here
// to guard against a change in that constructor.
wxASSERT( component->GetFieldCount() >= MANDATORY_FIELDS );
// The first MANDATOR_FIELDS _must_ be constructed within the SCH_COMPONENT
// constructor. This assert is simply here to guard against a change in that
// constructor.
wxASSERT( symbol->GetFieldCount() >= MANDATORY_FIELDS );
// Ignore the _supplied_ fieldNdx. It is not important anymore
// if within the user defined fields region (i.e. >= MANDATORY_FIELDS).
// Ignore the _supplied_ fieldNdx. It is not important anymore if within the
// user defined fields region (i.e. >= MANDATORY_FIELDS).
// We freely renumber the index to fit the next available field slot.
index = component->GetFieldCount(); // new has this index after insertion
index = symbol->GetFieldCount(); // new has this index after insertion
SCH_FIELD field( wxPoint( 0, 0 ), index, component.get(), name );
component->AddField( field );
SCH_FIELD field( wxPoint( 0, 0 ), index, symbol.get(), name );
symbol->AddField( field );
}
SCH_FIELD& field = component->GetFields()[index];
SCH_FIELD& field = symbol->GetFields()[index];
// Prior to version 2 of the schematic file format, none of the following existed.
if( m_version > 1 )
@ -1702,7 +1702,7 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( LINE_READER& aReader )
else if( hjustify == 'R' )
field.SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
else if( hjustify != 'C' )
SCH_PARSE_ERROR( "component field text horizontal justification must be "
SCH_PARSE_ERROR( "symbol field text horizontal justification must be "
"L, R, or C", aReader, line );
// We are guaranteed to have a least one character here for older file formats
@ -1712,26 +1712,26 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( LINE_READER& aReader )
else if( textAttrs[0] == 'B' )
field.SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
else if( textAttrs[0] != 'C' )
SCH_PARSE_ERROR( "component field text vertical justification must be "
SCH_PARSE_ERROR( "symbol field text vertical justification must be "
"B, T, or C", aReader, line );
// Newer file formats include the bold and italics text attribute.
if( textAttrs.Length() > 1 )
{
if( textAttrs.Length() != 3 )
SCH_PARSE_ERROR( _( "component field text attributes must be 3 characters wide" ),
SCH_PARSE_ERROR( _( "symbol field text attributes must be 3 characters wide" ),
aReader, line );
if( textAttrs[1] == 'I' )
field.SetItalic( true );
else if( textAttrs[1] != 'N' )
SCH_PARSE_ERROR( "component field text italics indicator must be I or N",
SCH_PARSE_ERROR( "symbol field text italics indicator must be I or N",
aReader, line );
if( textAttrs[2] == 'B' )
field.SetBold( true );
else if( textAttrs[2] != 'N' )
SCH_PARSE_ERROR( "component field text bold indicator must be B or N",
SCH_PARSE_ERROR( "symbol field text bold indicator must be B or N",
aReader, line );
}
}
@ -1746,7 +1746,7 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( LINE_READER& aReader )
else if( orientation == 'V' )
field.SetTextAngle( TEXT_ANGLE_VERT );
else
SCH_PARSE_ERROR( "component field orientation must be H or V", aReader, line );
SCH_PARSE_ERROR( "symbol field orientation must be H or V", aReader, line );
if( name.IsEmpty() )
name = TEMPLATE_FIELDNAME::GetDefaultFieldName( index );
@ -1756,8 +1756,8 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( LINE_READER& aReader )
else if( strCompare( "$EndComp", line ) )
{
// Ensure all flags (some are set by previous initializations) are reset:
component->ClearFlags();
return component.release();
symbol->ClearFlags();
return symbol.release();
}
else
{
@ -1777,30 +1777,30 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( LINE_READER& aReader )
transform.x1 = parseInt( aReader, line, &line );
if( transform.x1 < -1 || transform.x1 > 1 )
SCH_PARSE_ERROR( "invalid component X1 transform value", aReader, line );
SCH_PARSE_ERROR( "invalid symbol X1 transform value", aReader, line );
transform.y1 = parseInt( aReader, line, &line );
if( transform.y1 < -1 || transform.y1 > 1 )
SCH_PARSE_ERROR( "invalid component Y1 transform value", aReader, line );
SCH_PARSE_ERROR( "invalid symbol Y1 transform value", aReader, line );
transform.x2 = parseInt( aReader, line, &line );
if( transform.x2 < -1 || transform.x2 > 1 )
SCH_PARSE_ERROR( "invalid component X2 transform value", aReader, line );
SCH_PARSE_ERROR( "invalid symbol X2 transform value", aReader, line );
transform.y2 = parseInt( aReader, line, &line );
if( transform.y2 < -1 || transform.y2 > 1 )
SCH_PARSE_ERROR( "invalid component Y2 transform value", aReader, line );
SCH_PARSE_ERROR( "invalid symbol Y2 transform value", aReader, line );
component->SetTransform( transform );
symbol->SetTransform( transform );
}
line = aReader.ReadLine();
}
SCH_PARSE_ERROR( "invalid component line", aReader, line );
SCH_PARSE_ERROR( "invalid symbol line", aReader, line );
return NULL; // Prevents compiler warning. Should never get here.
}
@ -2057,11 +2057,10 @@ void SCH_LEGACY_PLUGIN::saveComponent( SCH_COMPONENT* aComponent )
{
/*format:
* AR Path="/140/2" Ref="C99" Part="1"
* where 140 is the uid of the containing sheet
* and 2 is the timestamp of this component.
* where 140 is the uid of the containing sheet and 2 is the timestamp of this symbol.
* (timestamps are actually 8 hex chars)
* Ref is the conventional component reference for this 'path'
* Part is the conventional component part selection for this 'path'
* Ref is the conventional symbol reference designator for this 'path'
* Part is the conventional symbol unit selection for this 'path'
*/
wxString path = "/";

View File

@ -150,7 +150,7 @@ private:
SCH_LINE* loadWire( LINE_READER& aReader );
SCH_BUS_ENTRY_BASE* loadBusEntry( LINE_READER& aReader );
SCH_TEXT* loadText( LINE_READER& aReader );
SCH_COMPONENT* loadComponent( LINE_READER& aReader );
SCH_COMPONENT* loadSymbol( LINE_READER& aReader );
std::shared_ptr<BUS_ALIAS> loadBusAlias( LINE_READER& aReader, SCH_SCREEN* aScreen );
void saveComponent( SCH_COMPONENT* aComponent );

View File

@ -760,7 +760,7 @@ void SCH_SHEET::Rotate( wxPoint aCenter )
}
else
{
// Move the fields to the new position because the component itself has moved.
// Move the fields to the new position because the parent itself has moved.
for( SCH_FIELD& field : m_fields )
{
wxPoint pos = field.GetTextPos();

View File

@ -56,7 +56,7 @@ std::string toUTFTildaText( const wxString& txt )
/**
* Used to draw a dummy shape when a LIB_PART is not found in library
*
* This component is a 400 mils square with the text ??
* This symbol is a 400 mils square with the text "??"
* DEF DUMMY U 0 40 Y Y 1 0 N
* F0 "U" 0 -350 60 H V
* F1 "DUMMY" 0 350 60 H V
@ -883,35 +883,35 @@ void SCH_COMPONENT::SwapData( SCH_ITEM* aItem )
wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_COMPONENT_T),
wxT( "Cannot swap data with invalid symbol." ) );
SCH_COMPONENT* component = (SCH_COMPONENT*) aItem;
SCH_COMPONENT* symbol = (SCH_COMPONENT*) aItem;
std::swap( m_lib_id, component->m_lib_id );
std::swap( m_lib_id, symbol->m_lib_id );
LIB_PART* part = component->m_part.release();
component->m_part.reset( m_part.release() );
component->UpdatePins();
LIB_PART* part = symbol->m_part.release();
symbol->m_part.reset( m_part.release() );
symbol->UpdatePins();
m_part.reset( part );
UpdatePins();
std::swap( m_pos, component->m_pos );
std::swap( m_unit, component->m_unit );
std::swap( m_convert, component->m_convert );
std::swap( m_pos, symbol->m_pos );
std::swap( m_unit, symbol->m_unit );
std::swap( m_convert, symbol->m_convert );
m_fields.swap( component->m_fields ); // std::vector's swap()
m_fields.swap( symbol->m_fields ); // std::vector's swap()
for( SCH_FIELD& field : component->m_fields )
field.SetParent( component );
for( SCH_FIELD& field : symbol->m_fields )
field.SetParent( symbol );
for( SCH_FIELD& field : m_fields )
field.SetParent( this );
TRANSFORM tmp = m_transform;
m_transform = component->m_transform;
component->m_transform = tmp;
m_transform = symbol->m_transform;
symbol->m_transform = tmp;
std::swap( m_instanceReferences, component->m_instanceReferences );
std::swap( m_schLibSymbolName, component->m_schLibSymbolName );
std::swap( m_instanceReferences, symbol->m_instanceReferences );
std::swap( m_schLibSymbolName, symbol->m_schLibSymbolName );
}

View File

@ -138,18 +138,16 @@ public:
void AssignFootprints( const std::string& aChangedSetOfReferences );
/**
* Find a component in the schematic and an item in this component.
* Find a symbol in the schematic and an item in this symobl.
*
* @param aReference The component reference designator to find.
* @param aReference The symbol reference designator to find.
* @param aSearchHierarchy If false, search the current sheet only. Otherwise,
* the entire hierarchy
* @param aSearchType A #SCH_SEARCH_T value used to determine what to search for.
* @param aSearchText The text to search for, either in value, reference or elsewhere.
*/
SCH_ITEM* FindComponentAndItem( const wxString& aReference,
bool aSearchHierarchy,
SCH_SEARCH_T aSearchType,
const wxString& aSearchText );
SCH_ITEM* FindSymbolAndItem( const wxString& aReference, bool aSearchHierarchy,
SCH_SEARCH_T aSearchType, const wxString& aSearchText );
private:
///< copy selection to clipboard
@ -167,7 +165,7 @@ private:
SCH_SHEET_PATH updatePastedSheet( const SCH_SHEET_PATH& aPastePath, const KIID_PATH& aClipPath,
SCH_SHEET* aSheet, bool aForceKeepAnnotations,
SCH_SHEET_LIST* aPastedSheetsSoFar,
SCH_SHEET_LIST* aPastedSheetsSoFar,
SCH_REFERENCE_LIST* aPastedSymbolsSoFar );
void setClipboardInstances( const SCH_SCREEN* aPastedScreen );
@ -192,9 +190,8 @@ private:
* field if \a aForceVisibilityState is true.
* @return bool = true if success.
*/
bool processCmpToFootprintLinkFile( const wxString& aFullFilename,
bool aForceVisibilityState,
bool aVisibilityState );
bool processCmpToFootprintLinkFile( const wxString& aFullFilename, bool aForceVisibilityState,
bool aVisibilityState );
///< Set up handlers for various events.
void setTransitions() override;

View File

@ -514,8 +514,8 @@ void SYMBOL_EDITOR_EDIT_TOOL::editFieldProperties( LIB_FIELD* aField )
LIB_PART* parent = aField->GetParent();
wxCHECK( parent, /* void */ );
// 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.
// Editing the symbol value field is equivalent to creating a new symbol based on the
// current symbol. Set the dialog message to inform the user.
if( aField->GetId() == VALUE_FIELD )
caption = _( "Edit Symbol Name" );
else

View File

@ -35,7 +35,7 @@ class SYMBOL_LIBRARY_MANAGER;
class wxBoxSizer;
/**
* Library Editor pane with component tree and symbol library table selector.
* Library Editor pane with symbol tree and symbol library table selector.
*/
class SYMBOL_TREE_PANE : public wxPanel
{
@ -53,7 +53,7 @@ protected:
void onUpdateUI( wxUpdateUIEvent& aEvent );
SYMBOL_EDIT_FRAME* m_symbolEditFrame;
LIB_TREE* m_tree; ///< component search tree widget
LIB_TREE* m_tree; ///< symbol search tree widget
SYMBOL_LIBRARY_MANAGER* m_libMgr;
};

View File

@ -208,7 +208,7 @@ protected:
class LEGACY_NETLIST_READER : public NETLIST_READER
{
/**
* Function loadComponent
* Function loadSymbol
* read the \a aLine containing the description of a component from a legacy format
* netlist and add it to the netlist.
*