diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index 99bd9ee755..9832de090e 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 )->SetCurrentSheetPath( &GetCurrentSheet() ); + ( (SCH_COMPONENT*) item )->SetCurrentSheet( GetCurrentSheet().Last() ); MSG_PANEL_ITEMS items; item->GetMsgPanelInfo( items ); diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp index 0d899b24dc..3a606a12dd 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->SetCurrentSheetPath( &GetCurrentSheet() ); + component->SetCurrentSheet( GetCurrentSheet().Last() ); component->GetMsgPanelInfo( items ); SetMsgPanel( items ); } diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index 63c878e558..a6ca456207 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, unit, convert, - GetCrossHairPosition(), true ); + SCH_COMPONENT* component = new SCH_COMPONENT( *part, m_CurrentSheet->Last(), 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->SetCurrentSheetPath( &GetCurrentSheet() ); + component->SetCurrentSheet( GetCurrentSheet().Last() ); component->GetMsgPanelInfo( items ); SetMsgPanel( items ); diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 40e1cf0c00..b62a09f293 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_currentSheetPath = NULL; + m_currentSheet = NULL; m_fieldsAutoplaced = AUTOPLACED_NO; } -SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* sheet, int unit, +SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET* aSheet, 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_currentSheetPath = NULL; + m_unit = unit; + m_convert = convert; + m_part_name = aPart.GetName(); + m_part = aPart.SharedPtr(); + m_currentSheet = aSheet; m_fieldsAutoplaced = AUTOPLACED_NO; SetTimeStamp( GetNewTimeStamp() ); @@ -186,7 +186,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* sheet, int unit, // update the reference -- just the prefix for now. msg += wxT( "?" ); - SetRef( sheet->Last(), msg ); + SetRef( aSheet, 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_PATH* sheet, int unit, SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aComponent ) : SCH_ITEM( aComponent ) { - 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; + 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; SetTimeStamp( aComponent.m_TimeStamp ); @@ -1528,9 +1528,8 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) if( !alias ) return; - if( m_currentSheetPath ) - aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), - GetRef( m_currentSheetPath->Last() ), + if( m_currentSheet ) + aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), GetRef( m_currentSheet ), DARKCYAN ) ); wxString msg = part->IsPower() ? _( "Power symbol" ) : _( "Value" ); diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h index 6dc73c9cc5..9f917f3fef 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 path is required to generate the correct reference designator string + * A temporary sheet 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_PATH* m_currentSheetPath; + const SCH_SHEET* m_currentSheet; /** * 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_PATH* aSheet, + SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET* 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 SetCurrentSheetPath( const SCH_SHEET_PATH* aSheetPath ) + void SetCurrentSheet( const SCH_SHEET* aSheet ) { - m_currentSheetPath = aSheetPath; + m_currentSheet = aSheet; } /**