From 2e129d9b473865574d43670e8deff3ec63232769 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 19 Mar 2021 20:27:30 +0000 Subject: [PATCH] Naming conventions and other cleanup. --- eeschema/annotate.cpp | 2 +- eeschema/erc.cpp | 10 +-- eeschema/getpart.cpp | 61 +++++++------- eeschema/sch_edit_frame.h | 4 +- eeschema/sch_field.cpp | 17 ++-- eeschema/sch_field.h | 17 ++-- eeschema/sch_sheet.h | 8 +- eeschema/sch_sheet_path.cpp | 96 ++++++++-------------- eeschema/sch_sheet_path.h | 53 ++++-------- eeschema/symbol_editor/symbol_edit_frame.h | 2 +- eeschema/symbol_editor/symbol_editor.cpp | 2 +- eeschema/symbol_viewer_frame.cpp | 16 ++-- eeschema/symbol_viewer_frame.h | 6 +- eeschema/tools/sch_edit_tool.cpp | 83 +++++++++---------- 14 files changed, 164 insertions(+), 213 deletions(-) diff --git a/eeschema/annotate.cpp b/eeschema/annotate.cpp index 4313ed1656..1b1be30a50 100644 --- a/eeschema/annotate.cpp +++ b/eeschema/annotate.cpp @@ -135,7 +135,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( bool aAnnotateSchematic, if( aAnnotateSchematic ) sheets.GetMultiUnitSymbols( lockedComponents ); else - GetCurrentSheet().GetMultiUnitComponents( lockedComponents ); + GetCurrentSheet().GetMultiUnitSymbols( lockedComponents ); } // Store previous annotations for building info messages diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp index d2f17b500b..efe09cb9cc 100644 --- a/eeschema/erc.cpp +++ b/eeschema/erc.cpp @@ -193,15 +193,15 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet ) { if( item->Type() == SCH_COMPONENT_T ) { - SCH_COMPONENT* component = static_cast( item ); + SCH_COMPONENT* symbol = static_cast( item ); - for( SCH_FIELD& field : component->GetFields() ) + for( SCH_FIELD& field : symbol->GetFields() ) { if( unresolved( field.GetShownText() ) ) { - wxPoint pos = field.GetPosition() - component->GetPosition(); - pos = component->GetTransform().TransformCoordinate( pos ); - pos += component->GetPosition(); + wxPoint pos = field.GetPosition() - symbol->GetPosition(); + pos = symbol->GetTransform().TransformCoordinate( pos ); + pos += symbol->GetPosition(); std::shared_ptr ercItem = ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE ); ercItem->SetItems( &field ); diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index 98f8c77619..215eeaeb57 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -59,7 +59,7 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibBrowser( wxTopLevelWindow* aParen if( aPreselectedLibId.IsValid() ) { viewer->SetSelectedLibrary( aPreselectedLibId.GetLibNickname() ); - viewer->SetSelectedComponent( aPreselectedLibId.GetLibItemName() ); + viewer->SetSelectedSymbol( aPreselectedLibId.GetLibItemName()); } viewer->SetUnitAndConvert( aUnit, aConvert ); @@ -95,7 +95,7 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibTree( const SCHLIB_FILTER* aFilte std::unique_lock dialogLock( DIALOG_CHOOSE_SYMBOL::g_Mutex, std::defer_lock ); SYMBOL_LIB_TABLE* libs = Prj().SchSymbolLibTable(); - // One CHOOSE_COMPONENT dialog at a time. User probaby can't handle more anyway. + // One DIALOG_CHOOSE_SYMBOL dialog at a time. User probaby can't handle more anyway. if( !dialogLock.try_lock() ) return PICKED_SYMBOL(); @@ -162,7 +162,7 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibTree( const SCHLIB_FILTER* aFilte PICKED_SYMBOL sel; LIB_ID id = dlg.GetSelectedLibId( &sel.Unit ); - if( dlg.IsExternalBrowserSelected() ) // User requested component browser. + if( dlg.IsExternalBrowserSelected() ) // User requested symbol browser. { sel = PickSymbolFromLibBrowser( this, aFilter, id, sel.Unit, sel.Convert ); id = sel.LibId; @@ -195,55 +195,55 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibTree( const SCHLIB_FILTER* aFilte } -void SCH_EDIT_FRAME::SelectUnit( SCH_COMPONENT* aComponent, int aUnit ) +void SCH_EDIT_FRAME::SelectUnit( SCH_COMPONENT* aSymbol, int aUnit ) { - LIB_PART* part = GetLibPart( aComponent->GetLibId() ); + LIB_PART* part = GetLibPart( aSymbol->GetLibId() ); if( !part ) return; int unitCount = part->GetUnitCount(); - if( unitCount <= 1 || aComponent->GetUnit() == aUnit ) + if( unitCount <= 1 || aSymbol->GetUnit() == aUnit ) return; if( aUnit > unitCount ) aUnit = unitCount; - STATUS_FLAGS savedFlags = aComponent->GetFlags(); + STATUS_FLAGS savedFlags = aSymbol->GetFlags(); - if( !aComponent->GetEditFlags() ) // No command in progress: save in undo list - SaveCopyInUndoList( GetScreen(), aComponent, UNDO_REDO::CHANGED, false ); + if( !aSymbol->GetEditFlags() ) // No command in progress: save in undo list + SaveCopyInUndoList( GetScreen(), aSymbol, UNDO_REDO::CHANGED, false ); /* Update the unit number. */ - aComponent->SetUnitSelection( &GetCurrentSheet(), aUnit ); - aComponent->SetUnit( aUnit ); - aComponent->ClearFlags(); - aComponent->SetFlags( savedFlags ); // Restore m_Flag modified by SetUnit() + aSymbol->SetUnitSelection( &GetCurrentSheet(), aUnit ); + aSymbol->SetUnit( aUnit ); + aSymbol->ClearFlags(); + aSymbol->SetFlags( savedFlags ); // Restore m_Flag modified by SetUnit() - if( !aComponent->GetEditFlags() ) // No command in progress: update schematic + if( !aSymbol->GetEditFlags() ) // No command in progress: update schematic { if( eeconfig()->m_AutoplaceFields.enable ) - aComponent->AutoAutoplaceFields( GetScreen() ); + aSymbol->AutoAutoplaceFields( GetScreen() ); TestDanglingEnds(); - UpdateItem( aComponent ); + UpdateItem( aSymbol ); OnModify(); } } -void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* aComponent ) +void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* aSymbol ) { - if( !aComponent || !aComponent->GetPartRef() ) + if( !aSymbol || !aSymbol->GetPartRef() ) return; wxString msg; - if( !aComponent->GetPartRef()->HasConversion() ) + if( !aSymbol->GetPartRef()->HasConversion() ) { - LIB_ID id = aComponent->GetPartRef()->GetLibId(); + LIB_ID id = aSymbol->GetPartRef()->GetLibId(); msg.Printf( _( "No alternate body style found for symbol \"%s\" in library \"%s\"." ), id.GetLibItemName().wx_str(), id.GetLibNickname().wx_str() ); @@ -251,27 +251,26 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* aComponent ) return; } - STATUS_FLAGS savedFlags = aComponent->GetFlags(); + STATUS_FLAGS savedFlags = aSymbol->GetFlags(); - aComponent->SetConvert( aComponent->GetConvert() + 1 ); + aSymbol->SetConvert( aSymbol->GetConvert() + 1 ); // ensure m_convert = 1 or 2 // 1 = shape 1 = not converted // 2 = shape 2 = first converted shape - // > 2 is not used but could be used for more shapes - // like multiple shapes for a programmable component + // > 2 is not currently supported // When m_convert = val max, return to the first shape - if( aComponent->GetConvert() > LIB_ITEM::LIB_CONVERT::DEMORGAN ) - aComponent->SetConvert( LIB_ITEM::LIB_CONVERT::BASE ); + if( aSymbol->GetConvert() > LIB_ITEM::LIB_CONVERT::DEMORGAN ) + aSymbol->SetConvert( LIB_ITEM::LIB_CONVERT::BASE ); TestDanglingEnds(); - aComponent->ClearFlags(); - aComponent->SetFlags( savedFlags ); // Restore m_flags (modified by SetConvert()) + aSymbol->ClearFlags(); + aSymbol->SetFlags( savedFlags ); // Restore m_flags (modified by SetConvert()) // If selected make sure all the now-included pins are selected - if( aComponent->IsSelected() ) - m_toolManager->RunAction( EE_ACTIONS::addItemToSel, true, aComponent ); + if( aSymbol->IsSelected() ) + m_toolManager->RunAction( EE_ACTIONS::addItemToSel, true, aSymbol ); - UpdateItem( aComponent ); + UpdateItem( aSymbol ); OnModify(); } diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index 60d6cc7f63..90b911bf66 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -748,9 +748,9 @@ public: */ void DeleteJunction( SCH_ITEM* aItem, bool aAppend = false ); - void ConvertPart( SCH_COMPONENT* aComponent ); + void ConvertPart( SCH_COMPONENT* aSymbol ); - void SelectUnit( SCH_COMPONENT* aComponent, int aUnit ); + void SelectUnit( SCH_COMPONENT* aSymbol, int aUnit ); /* Undo - redo */ diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index e128c3415d..490575cc01 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -667,13 +667,12 @@ void SCH_FIELD::SetPosition( const wxPoint& aPosition ) // the position relative to the parent component. if( m_parent && m_parent->Type() == SCH_COMPONENT_T ) { - SCH_COMPONENT* parentComponent = static_cast( m_parent ); - wxPoint relativePos = aPosition - parentComponent->GetPosition(); + SCH_COMPONENT* parentSymbol = static_cast( m_parent ); + wxPoint relPos = aPosition - parentSymbol->GetPosition(); - relativePos = parentComponent->GetTransform(). - InverseTransform().TransformCoordinate( relativePos ); + relPos = parentSymbol->GetTransform().InverseTransform().TransformCoordinate( relPos ); - SetTextPos( relativePos + parentComponent->GetPosition() ); + SetTextPos( relPos + parentSymbol->GetPosition() ); return; } @@ -685,12 +684,12 @@ wxPoint SCH_FIELD::GetPosition() const { if( m_parent && m_parent->Type() == SCH_COMPONENT_T ) { - SCH_COMPONENT* parentComponent = static_cast( m_parent ); - wxPoint relativePos = GetTextPos() - parentComponent->GetPosition(); + SCH_COMPONENT* parentSymbol = static_cast( m_parent ); + wxPoint relativePos = GetTextPos() - parentSymbol->GetPosition(); - relativePos = parentComponent->GetTransform().TransformCoordinate( relativePos ); + relativePos = parentSymbol->GetTransform().TransformCoordinate( relativePos ); - return relativePos + parentComponent->GetPosition(); + return relativePos + parentSymbol->GetPosition(); } return GetTextPos(); diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h index 65474e606f..feb11ae0b6 100644 --- a/eeschema/sch_field.h +++ b/eeschema/sch_field.h @@ -38,13 +38,14 @@ class LIB_FIELD; /** * SCH_FIELD - * instances are attached to a component and provide a place for the component's value, - * reference designator, footprint, and user definable name-value pairs of arbitrary purpose. + * instances are attached to a symbol or sheet and provide a place for the component's value, + * reference designator, footprint, , a sheet's name, filename, and user definable name-value + * pairs of arbitrary purpose. * - *
  • Field 0 is reserved for the component reference.
  • - *
  • Field 1 is reserved for the component value.
  • - *
  • Field 2 is reserved for the component footprint.
  • - *
  • Field 3 is reserved for the component data sheet file.
  • + *
    • Field 0 is reserved for the symbol reference.
    • + *
    • Field 1 is reserved for the symbol value.
    • + *
    • Field 2 is reserved for the symbol footprint.
    • + *
    • Field 3 is reserved for the symbol data sheet file.
    • *
    • Field 4 and higher are user defineable.
    */ @@ -163,7 +164,7 @@ public: * @copydoc SCH_ITEM::MirrorVertically() * * This overload does nothing. Fields are never mirrored alone. They are moved - * when the parent component is mirrored. This function is only needed by the + * when the parent symbol is mirrored. This function is only needed by the * pure function of the master class. */ void MirrorVertically( int aCenter ) override @@ -174,7 +175,7 @@ public: * @copydoc SCH_ITEM::MirrorHorizontally() * * This overload does nothing. Fields are never mirrored alone. They are moved - * when the parent component is mirrored. This function is only needed by the + * when the parent symbol is mirrored. This function is only needed by the * pure function of the master class. */ void MirrorHorizontally( int aCenter ) override diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index 831d987f34..c9b27df0ed 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -76,7 +76,7 @@ enum SHEET_FIELD_TYPE { * Define a sheet pin (label) used in sheets to create hierarchical schematics. * * A SCH_SHEET_PIN is used to create a hierarchical sheet in the same way a - * pin is used in a component. It connects the objects in the sheet object + * pin is used in a symbol. It connects the objects in the sheet object * to the objects in the schematic page to the objects in the page that is * represented by the sheet. In a sheet object, a SCH_SHEET_PIN must be * connected to a wire, bus, or label. In the schematic page represented by @@ -261,7 +261,7 @@ public: * and false for items moved with no reference to anchor. * * Usually return true for small items (labels, junctions) and false for - * items which can be large (hierarchical sheets, components) + * items which can be large (hierarchical sheets, symbols) * * @return false for a hierarchical sheet */ @@ -457,9 +457,7 @@ public: void SwapData( SCH_ITEM* aItem ) override; /** - * Count our own components, without the power components. - * - * @return the component count. + * Count our own symbols, without the power symbols. */ int SymbolCount() const; diff --git a/eeschema/sch_sheet_path.cpp b/eeschema/sch_sheet_path.cpp index 226dd22e99..f7ae3c07cb 100644 --- a/eeschema/sch_sheet_path.cpp +++ b/eeschema/sch_sheet_path.cpp @@ -251,32 +251,32 @@ void SCH_SHEET_PATH::UpdateAllScreenReferences() { for( SCH_ITEM* item : LastScreen()->Items().OfType( SCH_COMPONENT_T ) ) { - SCH_COMPONENT* component = static_cast( item ); - component->GetField( REFERENCE_FIELD )->SetText( component->GetRef( this ) ); - component->GetField( VALUE_FIELD )->SetText( component->GetValue( this, false ) ); - component->GetField( FOOTPRINT_FIELD )->SetText( component->GetFootprint( this, false ) ); - component->UpdateUnit( component->GetUnitSelection( this ) ); + SCH_COMPONENT* symbol = static_cast( item ); + symbol->GetField( REFERENCE_FIELD )->SetText( symbol->GetRef( this ) ); + symbol->GetField( VALUE_FIELD )->SetText( symbol->GetValue( this, false ) ); + symbol->GetField( FOOTPRINT_FIELD )->SetText( symbol->GetFootprint( this, false ) ); + symbol->UpdateUnit( symbol->GetUnitSelection( this ) ); } } void SCH_SHEET_PATH::GetSymbols( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols, - bool aForceIncludeOrphanComponents ) const + bool aForceIncludeOrphanSymbols ) const { for( SCH_ITEM* item : LastScreen()->Items().OfType( SCH_COMPONENT_T ) ) { - SCH_COMPONENT* component = static_cast( item ); + SCH_COMPONENT* symbol = static_cast( item ); - // Skip pseudo components, which have a reference starting with #. This mainly + // Skip pseudo-symbols, which have a reference starting with #. This mainly // affects power symbols. - if( aIncludePowerSymbols || component->GetRef( this )[0] != wxT( '#' ) ) + if( aIncludePowerSymbols || symbol->GetRef( this )[0] != wxT( '#' ) ) { - LIB_PART* part = component->GetPartRef().get(); + LIB_PART* part = symbol->GetPartRef().get(); - if( part || aForceIncludeOrphanComponents ) + if( part || aForceIncludeOrphanSymbols ) { - SCH_REFERENCE schReference( component, part, *this ); + SCH_REFERENCE schReference( symbol, part, *this ); schReference.SetSheetNumber( m_virtualPageNumber ); aReferences.AddItem( schReference ); @@ -286,23 +286,23 @@ void SCH_SHEET_PATH::GetSymbols( SCH_REFERENCE_LIST& aReferences, bool aIncludeP } -void SCH_SHEET_PATH::GetMultiUnitComponents( SCH_MULTI_UNIT_REFERENCE_MAP& aRefList, - bool aIncludePowerSymbols ) const +void SCH_SHEET_PATH::GetMultiUnitSymbols( SCH_MULTI_UNIT_REFERENCE_MAP& aRefList, + bool aIncludePowerSymbols ) const { - for( auto item : LastScreen()->Items().OfType( SCH_COMPONENT_T ) ) + for( SCH_ITEM* item : LastScreen()->Items().OfType( SCH_COMPONENT_T ) ) { - auto component = static_cast( item ); + SCH_COMPONENT* symbol = static_cast( item ); - // Skip pseudo components, which have a reference starting with #. This mainly + // Skip pseudo-symbols, which have a reference starting with #. This mainly // affects power symbols. - if( !aIncludePowerSymbols && component->GetRef( this )[0] == wxT( '#' ) ) + if( !aIncludePowerSymbols && symbol->GetRef( this )[0] == wxT( '#' ) ) continue; - LIB_PART* part = component->GetPartRef().get(); + LIB_PART* part = symbol->GetPartRef().get(); if( part && part->GetUnitCount() > 1 ) { - SCH_REFERENCE schReference = SCH_REFERENCE( component, part, *this ); + SCH_REFERENCE schReference = SCH_REFERENCE( symbol, part, *this ); schReference.SetSheetNumber( m_virtualPageNumber ); wxString reference_str = schReference.GetRef(); @@ -602,23 +602,20 @@ void SCH_SHEET_LIST::AnnotatePowerSymbols() // List of reference for power symbols SCH_REFERENCE_LIST references; - // Map of locked components (not used, but needed by Annotate() - SCH_MULTI_UNIT_REFERENCE_MAP lockedComponents; + // Map of locked symbols (not used, but needed by Annotate() + SCH_MULTI_UNIT_REFERENCE_MAP lockedSymbols; - // Build the list of power components: + // Build the list of power symbols: for( SCH_SHEET_PATH& sheet : *this ) { - for( auto item : sheet.LastScreen()->Items().OfType( SCH_COMPONENT_T ) ) + for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_COMPONENT_T ) ) { - auto component = static_cast( item ); - LIB_PART* part = component->GetPartRef().get(); + SCH_COMPONENT* symbol = static_cast( item ); + LIB_PART* part = symbol->GetPartRef().get(); - if( !part || !part->IsPower() ) - continue; - - if( part ) + if( part && part->IsPower() ) { - SCH_REFERENCE schReference( component, part, sheet ); + SCH_REFERENCE schReference( symbol, part, sheet ); references.AddItem( schReference ); } } @@ -649,12 +646,12 @@ void SCH_SHEET_LIST::AnnotatePowerSymbols() } - // Break full components reference in name (prefix) and number: + // Break full symbol reference into name (prefix) and number: // example: IC1 become IC, and 1 references.SplitReferences(); // Ensure all power symbols have the reference starting by '#' - // (No sure this is really useful) + // (Not sure this is really useful) for( unsigned ii = 0; ii< references.GetCount(); ++ii ) { if( references[ii].GetRef()[0] != '#' ) @@ -665,16 +662,16 @@ void SCH_SHEET_LIST::AnnotatePowerSymbols() } // Recalculate and update reference numbers in schematic - references.Annotate( false, 0, 100, lockedComponents ); + references.Annotate( false, 0, 100, lockedSymbols ); references.UpdateAnnotation(); } void SCH_SHEET_LIST::GetSymbols( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols, - bool aForceIncludeOrphanComponents ) const + bool aForceIncludeOrphanSymbols ) const { for( const SCH_SHEET_PATH& sheet : *this ) - sheet.GetSymbols( aReferences, aIncludePowerSymbols, aForceIncludeOrphanComponents ); + sheet.GetSymbols( aReferences, aIncludePowerSymbols, aForceIncludeOrphanSymbols ); } @@ -684,7 +681,7 @@ void SCH_SHEET_LIST::GetMultiUnitSymbols( SCH_MULTI_UNIT_REFERENCE_MAP &aRefList for( SCH_SHEET_PATHS::const_iterator it = begin(); it != end(); ++it ) { SCH_MULTI_UNIT_REFERENCE_MAP tempMap; - (*it).GetMultiUnitComponents( tempMap ); + ( *it ).GetMultiUnitSymbols( tempMap ); for( SCH_MULTI_UNIT_REFERENCE_MAP::value_type& pair : tempMap ) { @@ -692,9 +689,7 @@ void SCH_SHEET_LIST::GetMultiUnitSymbols( SCH_MULTI_UNIT_REFERENCE_MAP &aRefList unsigned n_refs = pair.second.GetCount(); for( unsigned thisRef = 0; thisRef < n_refs; ++thisRef ) - { aRefList[pair.first].AddItem( pair.second[thisRef] ); - } } } } @@ -728,7 +723,9 @@ bool SCH_SHEET_LIST::TestForRecursion( const SCH_SHEET_LIST& aSrcSheetHierarchy, { if( at( i ).TestForRecursion( sheetPath->GetSheet( k )->GetFileName(), aDestFileName ) ) + { return true; + } } } } @@ -841,27 +838,6 @@ std::vector SCH_SHEET_LIST::GetPaths() const } -void SCH_SHEET_LIST::ReplaceLegacySheetPaths( const std::vector& aOldSheetPaths ) -{ - wxCHECK( size() == aOldSheetPaths.size(), /* void */ ); - - for( size_t i = 0; i < size(); i++ ) - { - const KIID_PATH oldSheetPath = aOldSheetPaths.at( i ); - const KIID_PATH newSheetPath = at( i ).Path(); - SCH_SCREEN* screen = at(i).LastScreen(); - - wxCHECK( screen, /* void */ ); - - for( SCH_ITEM* symbol : screen->Items().OfType( SCH_COMPONENT_T ) ) - { - static_cast( symbol )->ReplaceInstanceSheetPath( oldSheetPath, - newSheetPath ); - } - } -} - - bool SCH_SHEET_LIST::AllSheetPageNumbersEmpty() const { for( const SCH_SHEET_PATH& instance : *this ) diff --git a/eeschema/sch_sheet_path.h b/eeschema/sch_sheet_path.h index e4bffe5be5..38a1d77e1c 100644 --- a/eeschema/sch_sheet_path.h +++ b/eeschema/sch_sheet_path.h @@ -279,17 +279,16 @@ public: void UpdateAllScreenReferences(); /** - * Adds #SCH_REFERENCE object to \a aReferences for each component in the sheet. + * Adds #SCH_REFERENCE object to \a aReferences for each symbol in the sheet. * * @param aReferences List of references to populate. - * @param aIncludePowerSymbols : false to only get normal components. - * @param aForceIncludeOrphanComponents : true to include components having no symbol found - * in lib. - * ( orphan components) - * The normal option is false, and set to true only to build the full list of components. + * @param aIncludePowerSymbols : false to only get normal symbols. + * @param aForceIncludeOrphanSymbols : true to include symbols having no symbol found in lib. + * The normal option is false, and set to true only to + * build the full list of symbols. */ void GetSymbols( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols = true, - bool aForceIncludeOrphanComponents = false ) const; + bool aForceIncludeOrphanSymbols = false ) const; /** * Add a #SCH_REFERENCE_LIST object to \a aRefList for each same-reference set of @@ -298,10 +297,10 @@ public: * The map key for each element will be the reference designator. * * @param aRefList Map of reference designators to reference lists - * @param aIncludePowerSymbols : false to only get normal components. + * @param aIncludePowerSymbols : false to only get normal symbols. */ - void GetMultiUnitComponents( SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, - bool aIncludePowerSymbols = true ) const; + void GetMultiUnitSymbols( SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, + bool aIncludePowerSymbols = true ) const; /** * Test the SCH_SHEET_PATH file names to check adding the sheet stored in the file @@ -344,8 +343,8 @@ typedef SCH_SHEET_PATHS::iterator SCH_SHEET_PATHS_ITER; * * #SCH_SHEET objects are not unique, there can be many sheets with the same filename and * that share the same #SCH_SCREEN reference. Each The schematic file (#SCH_SCREEN) may - * be shared between these sheets and component references are specific to a sheet path. - * When a sheet is entered, component references and sheet page number are updated. + * be shared between these sheets and symbol references are specific to a sheet path. + * When a sheet is entered, symbol references and sheet page number are updated. */ class SCH_SHEET_LIST : public SCH_SHEET_PATHS { @@ -393,18 +392,16 @@ public: void AnnotatePowerSymbols(); /** - * Add a #SCH_REFERENCE object to \a aReferences for each component in the list - * of sheets. + * Add a #SCH_REFERENCE object to \a aReferences for each symbol in the list of sheets. * * @param aReferences List of references to populate. - * @param aIncludePowerSymbols Set to false to only get normal components. - * @param aForceIncludeOrphanComponents : true to include components having no symbol found - * in lib. - * ( orphan components) - * The normal option is false, and set to true only to build the full list of components. + * @param aIncludePowerSymbols Set to false to only get normal symbols. + * @param aForceIncludeOrphanSymbols : true to include symbols having no symbol found in lib. + * The normal option is false, and set to true only to + * build the full list of symbols. */ void GetSymbols( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols = true, - bool aForceIncludeOrphanComponents = false ) const; + bool aForceIncludeOrphanSymbols = false ) const; /** * Add a #SCH_REFERENCE_LIST object to \a aRefList for each same-reference set of @@ -412,7 +409,7 @@ public: * reference designator. * * @param aRefList Map of reference designators to reference lists - * @param aIncludePowerSymbols Set to false to only get normal components. + * @param aIncludePowerSymbols Set to false to only get normal symbols. */ void GetMultiUnitSymbols( SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, bool aIncludePowerSymbols = true ) const; @@ -478,20 +475,6 @@ public: std::vector GetPaths() const; - /** - * Update all of the symbol sheet paths to the sheet paths defined in \a aOldSheetPaths. - * - * @note The list of old sheet paths must be the exact same size and order as the existing - * sheet paths. This should not be an issue if no new sheets where added between the - * creation of this sheet list and \a aOldSheetPaths. This should only be called - * when updating legacy schematics to the new schematic file format. Once this - * happens, the schematic cannot be save to the legacy file format because the - * time stamp part of UUIDs are no longer guaranteed to be unique. - * - * @param aOldSheetPaths is the #SHEET_PATH_LIST to update from. - */ - void ReplaceLegacySheetPaths( const std::vector& aOldSheetPaths ); - /** * Check all of the sheet instance for empty page numbers. * diff --git a/eeschema/symbol_editor/symbol_edit_frame.h b/eeschema/symbol_editor/symbol_edit_frame.h index 4c4b606c39..65ef3c4951 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.h +++ b/eeschema/symbol_editor/symbol_edit_frame.h @@ -276,7 +276,7 @@ public: * @param aConvert the DeMorgan variant to show * @return true if the symbol defined by \a aLibId was loaded. */ - bool LoadSymbolAndSelectLib( const LIB_ID& aLibId, int aUnit, int aConvert ); + bool LoadSymbol( const LIB_ID& aLibId, int aUnit, int aConvert ); /** * Print a page. diff --git a/eeschema/symbol_editor/symbol_editor.cpp b/eeschema/symbol_editor/symbol_editor.cpp index 34ac77533a..2268073501 100644 --- a/eeschema/symbol_editor/symbol_editor.cpp +++ b/eeschema/symbol_editor/symbol_editor.cpp @@ -243,7 +243,7 @@ bool SYMBOL_EDIT_FRAME::saveCurrentPart() } -bool SYMBOL_EDIT_FRAME::LoadSymbolAndSelectLib( const LIB_ID& aLibId, int aUnit, int aConvert ) +bool SYMBOL_EDIT_FRAME::LoadSymbol( const LIB_ID& aLibId, int aUnit, int aConvert ) { if( GetCurPart() && GetCurPart()->GetLibId() == aLibId && GetUnit() == aUnit && GetConvert() == aConvert ) diff --git a/eeschema/symbol_viewer_frame.cpp b/eeschema/symbol_viewer_frame.cpp index abab166916..2efb94925c 100644 --- a/eeschema/symbol_viewer_frame.cpp +++ b/eeschema/symbol_viewer_frame.cpp @@ -401,7 +401,7 @@ bool SYMBOL_VIEWER_FRAME::ShowModal( wxString* aSymbol, wxWindow* aParent ) else { SetSelectedLibrary( libid.GetLibNickname() ); - SetSelectedComponent( libid.GetLibItemName() ); + SetSelectedSymbol( libid.GetLibItemName()); } } } @@ -635,7 +635,7 @@ void SYMBOL_VIEWER_FRAME::ClickOnCmpList( wxCommandEvent& event ) m_selection_changed = true; - SetSelectedComponent( m_symbolList->GetString( ii ) ); + SetSelectedSymbol( m_symbolList->GetString( ii )); // The m_symbolList has now the focus, in order to be able to use arrow keys // to navigate inside the list. @@ -645,16 +645,16 @@ void SYMBOL_VIEWER_FRAME::ClickOnCmpList( wxCommandEvent& event ) } -void SYMBOL_VIEWER_FRAME::SetSelectedComponent( const wxString& aComponentName ) +void SYMBOL_VIEWER_FRAME::SetSelectedSymbol( const wxString& aSymbolName ) { - if( m_entryName != aComponentName ) + if( m_entryName != aSymbolName ) { - m_entryName = aComponentName; + m_entryName = aSymbolName; // Ensure the corresponding line in m_symbolList is selected - // (which is not necessarily the case if SetSelectedComponent is called + // (which is not necessarily the case if SetSelectedSymbol is called // by another caller than ClickOnCmpList. - m_symbolList->SetStringSelection( aComponentName, true ); + m_symbolList->SetStringSelection( aSymbolName, true ); DisplayLibInfos(); if( m_selection_changed ) @@ -847,7 +847,7 @@ void SYMBOL_VIEWER_FRAME::OnSelectSymbol( wxCommandEvent& aEvent ) return; SetSelectedLibrary( id.GetLibNickname() ); - SetSelectedComponent( id.GetLibItemName() ); + SetSelectedSymbol( id.GetLibItemName() ); SetUnitAndConvert( unit, 1 ); } diff --git a/eeschema/symbol_viewer_frame.h b/eeschema/symbol_viewer_frame.h index a67d95972f..6ee0565184 100644 --- a/eeschema/symbol_viewer_frame.h +++ b/eeschema/symbol_viewer_frame.h @@ -118,17 +118,13 @@ public: /** * Set the selected library in the library window. - * - * @param aLibName name of the library to be selected. */ void SetSelectedLibrary( const wxString& aLibName ); /** * Set the selected component. - * - * @param aComponentName : the name of the component to be selected. */ - void SetSelectedComponent( const wxString& aComponentName ); + void SetSelectedSymbol( const wxString& aSymbolName ); // Accessors: /** diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 3c0e13280e..8387fe8677 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -88,27 +88,27 @@ private: { EE_SELECTION_TOOL* selTool = getToolManager()->GetTool(); EE_SELECTION& selection = selTool->GetSelection(); - SCH_COMPONENT* component = dynamic_cast( selection.Front() ); + SCH_COMPONENT* symbol = dynamic_cast( selection.Front() ); Clear(); - if( !component ) + if( !symbol ) { Append( ID_POPUP_SCH_UNFOLD_BUS, _( "no symbol selected" ), wxEmptyString ); Enable( ID_POPUP_SCH_UNFOLD_BUS, false ); return; } - int unit = component->GetUnit(); + int unit = symbol->GetUnit(); - if( !component->GetPartRef() || component->GetPartRef()->GetUnitCount() < 2 ) + if( !symbol->GetPartRef() || symbol->GetPartRef()->GetUnitCount() < 2 ) { Append( ID_POPUP_SCH_UNFOLD_BUS, _( "symbol is not multi-unit" ), wxEmptyString ); Enable( ID_POPUP_SCH_UNFOLD_BUS, false ); return; } - for( int ii = 0; ii < component->GetPartRef()->GetUnitCount(); ii++ ) + for( int ii = 0; ii < symbol->GetPartRef()->GetUnitCount(); ii++ ) { wxString num_unit; num_unit.Printf( _( "Unit %s" ), LIB_PART::SubReference( ii + 1, false ) ); @@ -432,15 +432,15 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) { case SCH_COMPONENT_T: { - SCH_COMPONENT* component = static_cast( head ); + SCH_COMPONENT* symbol = static_cast( head ); if( clockwise ) - component->SetOrientation( CMP_ROTATE_CLOCKWISE ); + symbol->SetOrientation( CMP_ROTATE_CLOCKWISE ); else - component->SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE ); + symbol->SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE ); if( m_frame->eeconfig()->m_AutoplaceFields.enable ) - component->AutoAutoplaceFields( m_frame->GetScreen() ); + symbol->AutoAutoplaceFields( m_frame->GetScreen() ); break; } @@ -625,15 +625,15 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) { case SCH_COMPONENT_T: { - SCH_COMPONENT* component = static_cast( item ); + SCH_COMPONENT* symbol = static_cast( item ); if( vertical ) - component->SetOrientation( CMP_MIRROR_X ); + symbol->SetOrientation( CMP_MIRROR_X ); else - component->SetOrientation( CMP_MIRROR_Y ); + symbol->SetOrientation( CMP_MIRROR_Y ); if( m_frame->eeconfig()->m_AutoplaceFields.enable ) - component->AutoAutoplaceFields( m_frame->GetScreen() ); + symbol->AutoAutoplaceFields( m_frame->GetScreen() ); break; } @@ -869,10 +869,10 @@ int SCH_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) case SCH_COMPONENT_T: { - SCH_COMPONENT* component = (SCH_COMPONENT*) newItem; - component->ClearAnnotation( NULL ); - component->SetParent( m_frame->GetScreen() ); - m_frame->AddToScreen( component, m_frame->GetScreen() ); + SCH_COMPONENT* symbol = (SCH_COMPONENT*) newItem; + symbol->ClearAnnotation( NULL ); + symbol->SetParent( m_frame->GetScreen() ); + m_frame->AddToScreen( symbol, m_frame->GetScreen() ); break; } @@ -884,7 +884,7 @@ int SCH_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) if( copiedSheets ) { // We clear annotation of new sheet paths. - // Annotation of new components added in current sheet is already cleared. + // Annotation of new symbols added in current sheet is already cleared. SCH_SCREENS screensList( &m_frame->Schematic().Root() ); screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList ); m_frame->SetSheetNumberAndCount(); @@ -910,7 +910,7 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent ) SCH_ITEM* newItem = sourceItem->Duplicate(); bool performDrag = false; - // If cloning a component then put into 'move' mode. + // If cloning a symbol then put into 'move' mode. if( newItem->Type() == SCH_COMPONENT_T ) { wxPoint cursorPos = (wxPoint) getViewControls()->GetCursorPosition( true ); @@ -955,7 +955,7 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent ) m_frame->AddToScreen( newItem, m_frame->GetScreen() ); m_frame->SaveCopyInUndoList( m_frame->GetScreen(), newItem, UNDO_REDO::NEWITEM, false ); - // Components need to be handled by the move tool. The move tool will handle schematic + // Symbols need to be handled by the move tool. The move tool will handle schematic // cleanup routines if( performDrag ) m_toolMgr->RunAction( EE_ACTIONS::move, true ); @@ -1173,7 +1173,7 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent ) void SCH_EDIT_TOOL::editFieldText( SCH_FIELD* aField ) { - // Save old component in undo list if not already in edit, or moving. + // Save old symbol in undo list if not already in edit, or moving. if( aField->GetEditFlags() == 0 ) // i.e. not edited, or moved saveCopyInUndoList( aField, UNDO_REDO::CHANGED ); @@ -1223,14 +1223,14 @@ int SCH_EDIT_TOOL::EditField( const TOOL_EVENT& aEvent ) if( item->Type() == SCH_COMPONENT_T ) { - SCH_COMPONENT* component = (SCH_COMPONENT*) item; + SCH_COMPONENT* symbol = (SCH_COMPONENT*) item; if( aEvent.IsAction( &EE_ACTIONS::editReference ) ) - editFieldText( component->GetField( REFERENCE_FIELD ) ); + editFieldText( symbol->GetField( REFERENCE_FIELD ) ); else if( aEvent.IsAction( &EE_ACTIONS::editValue ) ) - editFieldText( component->GetField( VALUE_FIELD ) ); + editFieldText( symbol->GetField( VALUE_FIELD ) ); else if( aEvent.IsAction( &EE_ACTIONS::editFootprint ) ) - editFieldText( component->GetField( FOOTPRINT_FIELD ) ); + editFieldText( symbol->GetField( FOOTPRINT_FIELD ) ); } else if( item->Type() == SCH_FIELD_T ) { @@ -1299,26 +1299,26 @@ int SCH_EDIT_TOOL::ConvertDeMorgan( const TOOL_EVENT& aEvent ) if( selection.Empty() ) return 0; - SCH_COMPONENT* component = (SCH_COMPONENT*) selection.Front(); + SCH_COMPONENT* symbol = (SCH_COMPONENT*) selection.Front(); if( aEvent.IsAction( &EE_ACTIONS::showDeMorganStandard ) - && component->GetConvert() == LIB_ITEM::LIB_CONVERT::BASE ) + && symbol->GetConvert() == LIB_ITEM::LIB_CONVERT::BASE ) { return 0; } if( aEvent.IsAction( &EE_ACTIONS::showDeMorganAlternate ) - && component->GetConvert() != LIB_ITEM::LIB_CONVERT::DEMORGAN ) + && symbol->GetConvert() != LIB_ITEM::LIB_CONVERT::DEMORGAN ) { return 0; } - if( !component->IsNew() ) - saveCopyInUndoList( component, UNDO_REDO::CHANGED ); + if( !symbol->IsNew() ) + saveCopyInUndoList( symbol, UNDO_REDO::CHANGED ); - m_frame->ConvertPart( component ); + m_frame->ConvertPart( symbol ); - if( component->IsNew() ) + if( symbol->IsNew() ) m_toolMgr->RunAction( ACTIONS::refreshPreview ); if( selection.IsHover() ) @@ -1374,8 +1374,8 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) { case SCH_COMPONENT_T: { - SCH_COMPONENT* component = (SCH_COMPONENT*) item; - DIALOG_SYMBOL_PROPERTIES symbolPropsDialog( m_frame, component ); + SCH_COMPONENT* symbol = (SCH_COMPONENT*) item; + DIALOG_SYMBOL_PROPERTIES symbolPropsDialog( m_frame, symbol ); // This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal // frame. Therefore this dialog as a modal frame parent, MUST be run under @@ -1386,7 +1386,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) if( retval == SYMBOL_PROPS_EDIT_OK ) { if( m_frame->eeconfig()->m_AutoplaceFields.enable ) - component->AutoAutoplaceFields( m_frame->GetScreen() ); + symbol->AutoAutoplaceFields( m_frame->GetScreen() ); m_toolMgr->PostEvent( EVENTS::SelectedItemsModified ); m_frame->OnModify(); @@ -1395,7 +1395,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) { auto editor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, true ); - editor->LoadSymbolFromSchematic( component ); + editor->LoadSymbolFromSchematic( symbol ); editor->Show( true ); editor->Raise(); @@ -1404,20 +1404,19 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) { auto editor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, true ); - editor->LoadSymbolAndSelectLib( component->GetLibId(), component->GetUnit(), - component->GetConvert() ); + editor->LoadSymbol( symbol->GetLibId(), symbol->GetUnit(), symbol->GetConvert() ); editor->Show( true ); editor->Raise(); } else if( retval == SYMBOL_PROPS_WANT_UPDATE_SYMBOL ) { - DIALOG_CHANGE_SYMBOLS dlg( m_frame, component, DIALOG_CHANGE_SYMBOLS::MODE::UPDATE ); + DIALOG_CHANGE_SYMBOLS dlg( m_frame, symbol, DIALOG_CHANGE_SYMBOLS::MODE::UPDATE ); dlg.ShowQuasiModal(); } else if( retval == SYMBOL_PROPS_WANT_EXCHANGE_SYMBOL ) { - DIALOG_CHANGE_SYMBOLS dlg( m_frame, component, DIALOG_CHANGE_SYMBOLS::MODE::CHANGE ); + DIALOG_CHANGE_SYMBOLS dlg( m_frame, symbol, DIALOG_CHANGE_SYMBOLS::MODE::CHANGE ); dlg.ShowQuasiModal(); } } @@ -1446,8 +1445,8 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) // We clear annotation of new sheet paths here: screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList ); // Clear annotation of g_CurrentSheet itself, because its sheetpath is not a new - // path, but components managed by its sheet path must have their annotation - // cleared, because they are new: + // path, but symbols managed by its sheet path must have their annotation cleared + // because they are new: sheet->GetScreen()->ClearAnnotation( &m_frame->GetCurrentSheet() ); }