Eeschema: fix annotation bugs. (fixes lp:1542579)
* Ensure proper SCH_SHEET object page numbering which caused annotation to calculate incorrect reference designators when annotating by using page offsets. * Added SetPageNumbers to SCH_SHEET for setting sheet page numbers after schematic is loaded.
This commit is contained in:
parent
4c7a61dd25
commit
61454bf04c
|
@ -327,7 +327,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
||||
Zoom_Automatique( false );
|
||||
SetSheetNumberAndCount();
|
||||
|
||||
g_RootSheet->SetPageNumbers();
|
||||
m_canvas->Refresh( true );
|
||||
|
||||
return true;
|
||||
|
|
|
@ -56,6 +56,7 @@ SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
|
|||
m_screen = NULL;
|
||||
m_name.Printf( wxT( "Sheet%8.8lX" ), (long) m_TimeStamp );
|
||||
m_fileName.Printf( wxT( "file%8.8lX.sch" ), (long) m_TimeStamp );
|
||||
m_number = 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,6 +73,7 @@ SCH_SHEET::SCH_SHEET( const SCH_SHEET& aSheet ) :
|
|||
m_name = aSheet.m_name;
|
||||
m_fileName = aSheet.m_fileName;
|
||||
m_pins = aSheet.m_pins;
|
||||
m_number = aSheet.m_number;
|
||||
|
||||
for( size_t i = 0; i < m_pins.size(); i++ )
|
||||
m_pins[i].SetParent( this );
|
||||
|
@ -182,11 +184,6 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
|
|||
SCH_SHEET_PIN* sheetPin;
|
||||
char* ptcar;
|
||||
|
||||
if( IsRootSheet() )
|
||||
m_number = 1;
|
||||
else
|
||||
m_number = GetRootSheet()->CountSheets();
|
||||
|
||||
SetTimeStamp( GetNewTimeStamp() );
|
||||
|
||||
// sheets are added to the GetDrawItems() like other schematic components.
|
||||
|
@ -1166,6 +1163,21 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
|
|||
}
|
||||
|
||||
|
||||
void SCH_SHEET::SetPageNumbers()
|
||||
{
|
||||
int pageNumber = 1;
|
||||
std::vector< const SCH_SHEET* > sheets;
|
||||
|
||||
GetRootSheet()->GetSheets( sheets );
|
||||
|
||||
for( unsigned i = 0; i < sheets.size(); i++ )
|
||||
{
|
||||
const_cast< SCH_SHEET* >( sheets[i] )->m_number = pageNumber;
|
||||
pageNumber += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SCH_SHEET* SCH_SHEET::FindSheetByName( const wxString& aSheetName )
|
||||
{
|
||||
std::vector< const SCH_SHEET* > sheets;
|
||||
|
|
|
@ -610,6 +610,18 @@ public:
|
|||
|
||||
EDA_ITEM* Clone() const;
|
||||
|
||||
/**
|
||||
* Function SetPageNumbers
|
||||
*
|
||||
* sets the page numbers for each sheet by load order.
|
||||
*
|
||||
* The root sheet is always used to set the page numbers no matter which sheet this
|
||||
* function is called. This function will only have meaning when loading legacy
|
||||
* schematics. The upcoming s-expression schematic file format will allow for user
|
||||
* defined page numbers.
|
||||
*/
|
||||
void SetPageNumbers();
|
||||
|
||||
/**
|
||||
* Function FindSheetByName
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue