From 8587488984b3fcb37067a782d4d65a8ff15c3669 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Mon, 15 Feb 2016 15:15:51 -0500 Subject: [PATCH] Undo commit -r 6595. --- eeschema/controle.cpp | 2 +- eeschema/edit_component_in_schematic.cpp | 2 +- eeschema/getpart.cpp | 6 ++-- eeschema/sch_component.cpp | 35 ++++++++++++------------ eeschema/sch_component.h | 10 +++---- 5 files changed, 28 insertions(+), 27 deletions(-) diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index 362b1fc66a..aa5d57ae03 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -187,7 +187,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, const KICAD_T aF if( item ) { if( item->Type() == SCH_COMPONENT_T ) - ( (SCH_COMPONENT*) item )->SetCurrentSheet( GetCurrentSheet().Last() ); + ( (SCH_COMPONENT*) item )->SetCurrentSheetPath( &GetCurrentSheet() ); MSG_PANEL_ITEMS items; item->GetMsgPanelInfo( items ); diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp index 3a606a12dd..0d899b24dc 100644 --- a/eeschema/edit_component_in_schematic.cpp +++ b/eeschema/edit_component_in_schematic.cpp @@ -146,7 +146,7 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField ) } MSG_PANEL_ITEMS items; - component->SetCurrentSheet( GetCurrentSheet().Last() ); + component->SetCurrentSheetPath( &GetCurrentSheet() ); component->GetMsgPanelInfo( items ); SetMsgPanel( items ); } diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index a6ca456207..63c878e558 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -221,8 +221,8 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aDC, return NULL; } - SCH_COMPONENT* component = new SCH_COMPONENT( *part, m_CurrentSheet->Last(), unit, convert, - GetCrossHairPosition(), true ); + SCH_COMPONENT* component = new SCH_COMPONENT( *part, m_CurrentSheet, unit, convert, + GetCrossHairPosition(), true ); // Set the m_ChipName value, from component name in lib, for aliases // Note if part is found, and if name is an alias of a component, @@ -237,7 +237,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aDC, MSG_PANEL_ITEMS items; - component->SetCurrentSheet( GetCurrentSheet().Last() ); + component->SetCurrentSheetPath( &GetCurrentSheet() ); component->GetMsgPanelInfo( items ); SetMsgPanel( items ); diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index b62a09f293..40e1cf0c00 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -118,22 +118,22 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) : SCH_ITEM( aParent, SCH_COMPONENT_T ) { Init( aPos ); - m_currentSheet = NULL; + m_currentSheetPath = NULL; m_fieldsAutoplaced = AUTOPLACED_NO; } -SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET* aSheet, int unit, +SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* sheet, int unit, int convert, const wxPoint& pos, bool setNewItemFlag ) : SCH_ITEM( NULL, SCH_COMPONENT_T ) { Init( pos ); - m_unit = unit; - m_convert = convert; - m_part_name = aPart.GetName(); - m_part = aPart.SharedPtr(); - m_currentSheet = aSheet; + m_unit = unit; + m_convert = convert; + m_part_name = aPart.GetName(); + m_part = aPart.SharedPtr(); + m_currentSheetPath = NULL; m_fieldsAutoplaced = AUTOPLACED_NO; SetTimeStamp( GetNewTimeStamp() ); @@ -186,7 +186,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET* aSheet, int unit, // update the reference -- just the prefix for now. msg += wxT( "?" ); - SetRef( aSheet, msg ); + SetRef( sheet->Last(), msg ); // Use the schematic component name instead of the library value field // name. @@ -197,13 +197,13 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET* aSheet, int unit, SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aComponent ) : SCH_ITEM( aComponent ) { - m_currentSheet = NULL; - m_Parent = aComponent.m_Parent; - m_Pos = aComponent.m_Pos; - m_unit = aComponent.m_unit; - m_convert = aComponent.m_convert; - m_part_name = aComponent.m_part_name; - m_part = aComponent.m_part; + m_currentSheetPath = NULL; + m_Parent = aComponent.m_Parent; + m_Pos = aComponent.m_Pos; + m_unit = aComponent.m_unit; + m_convert = aComponent.m_convert; + m_part_name = aComponent.m_part_name; + m_part = aComponent.m_part; SetTimeStamp( aComponent.m_TimeStamp ); @@ -1528,8 +1528,9 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) if( !alias ) return; - if( m_currentSheet ) - aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), GetRef( m_currentSheet ), + if( m_currentSheetPath ) + aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), + GetRef( m_currentSheetPath->Last() ), DARKCYAN ) ); wxString msg = part->IsPower() ? _( "Power symbol" ) : _( "Value" ); diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h index 9f917f3fef..6dc73c9cc5 100644 --- a/eeschema/sch_component.h +++ b/eeschema/sch_component.h @@ -89,12 +89,12 @@ private: AUTOPLACED m_fieldsAutoplaced; ///< indicates status of field autoplacement /** - * A temporary sheet is required to generate the correct reference designator string + * A temporary sheet path is required to generate the correct reference designator string * in complex heirarchies. Hopefully this is only a temporary hack to decouple schematic * objects from the drawing window until a better design for handling complex heirarchies * can be implemented. */ - const SCH_SHEET* m_currentSheet; + const SCH_SHEET_PATH* m_currentSheetPath; /** * Defines the hierarchical path and reference of the component. This allows support @@ -121,7 +121,7 @@ public: * @param pos - Position to place new component. * @param setNewItemFlag - Set the component IS_NEW and IS_MOVED flags. */ - SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET* aSheet, + SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* aSheet, int unit = 0, int convert = 0, const wxPoint& pos = wxPoint( 0, 0 ), bool setNewItemFlag = false ); @@ -404,9 +404,9 @@ public: */ static bool IsReferenceStringValid( const wxString& aReferenceString ); - void SetCurrentSheet( const SCH_SHEET* aSheet ) + void SetCurrentSheetPath( const SCH_SHEET_PATH* aSheetPath ) { - m_currentSheet = aSheet; + m_currentSheetPath = aSheetPath; } /**