Eeschema: fix sheet properties dialog page number bug.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/6151
This commit is contained in:
Wayne Stambaugh 2020-10-25 07:32:01 -04:00
parent d6f91c810f
commit 15c2181a89
1 changed files with 7 additions and 3 deletions

View File

@ -167,9 +167,14 @@ bool DIALOG_SHEET_PROPERTIES::TransferDataToWindow()
wxString nextPageNumber; wxString nextPageNumber;
if( m_sheet->IsNew() ) if( m_sheet->IsNew() )
{
nextPageNumber.Printf( "%d", static_cast<int>( hierarchy.size() ) + 1 ); nextPageNumber.Printf( "%d", static_cast<int>( hierarchy.size() ) + 1 );
}
else else
{
instance.push_back( m_sheet );
nextPageNumber = m_sheet->GetPageNumber( instance ); nextPageNumber = m_sheet->GetPageNumber( instance );
}
m_pageNumberTextCtrl->ChangeValue( nextPageNumber ); m_pageNumberTextCtrl->ChangeValue( nextPageNumber );
@ -331,11 +336,10 @@ bool DIALOG_SHEET_PROPERTIES::TransferDataFromWindow()
SCH_SHEET_LIST hierarchy = m_frame->Schematic().GetFullHierarchy(); SCH_SHEET_LIST hierarchy = m_frame->Schematic().GetFullHierarchy();
SCH_SHEET_PATH instance = m_frame->GetCurrentSheet(); SCH_SHEET_PATH instance = m_frame->GetCurrentSheet();
if( m_sheet->IsNew() )
{
instance.push_back( m_sheet ); instance.push_back( m_sheet );
if( m_sheet->IsNew() )
m_sheet->AddInstance( instance.Path() ); m_sheet->AddInstance( instance.Path() );
}
m_sheet->SetPageNumber( instance, m_pageNumberTextCtrl->GetValue() ); m_sheet->SetPageNumber( instance, m_pageNumberTextCtrl->GetValue() );