Kick SetSheetNumberAndCount to SCHEMATIC
This commit is contained in:
parent
bc45ae1b72
commit
0190606886
|
@ -627,30 +627,7 @@ EDA_ITEM* SCH_EDIT_FRAME::GetItem( const KIID& aId ) const
|
|||
|
||||
void SCH_EDIT_FRAME::SetSheetNumberAndCount()
|
||||
{
|
||||
SCH_SCREEN* screen;
|
||||
SCH_SCREENS s_list( Schematic().Root() );
|
||||
|
||||
// Set the sheet count, and the sheet number (1 for root sheet)
|
||||
int sheet_count = Schematic().Root().CountSheets();
|
||||
int sheet_number = 1;
|
||||
const KIID_PATH& current_sheetpath = GetCurrentSheet().Path();
|
||||
|
||||
// @todo Remove all pseudo page number system is left over from prior to real page number
|
||||
// implementation.
|
||||
for( const SCH_SHEET_PATH& sheet : Schematic().GetSheets() )
|
||||
{
|
||||
if( sheet.Path() == current_sheetpath ) // Current sheet path found
|
||||
break;
|
||||
|
||||
sheet_number++; // Not found, increment before this current path
|
||||
}
|
||||
|
||||
for( screen = s_list.GetFirst(); screen != nullptr; screen = s_list.GetNext() )
|
||||
screen->SetPageCount( sheet_count );
|
||||
|
||||
GetCurrentSheet().SetVirtualPageNumber( sheet_number );
|
||||
GetScreen()->SetVirtualPageNumber( sheet_number );
|
||||
GetScreen()->SetPageNumber( GetCurrentSheet().GetPageNumber() );
|
||||
Schematic().SetSheetNumberAndCount();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -139,10 +139,10 @@ void SCH_PLOTTER::createPDFFile( const SCH_PLOT_SETTINGS& aPlotSettings,
|
|||
m_schFrame->SetCurrentSheet( sheetList[i] );
|
||||
else
|
||||
m_schematic->SetCurrentSheet( sheetList[i] );
|
||||
|
||||
m_schematic->CurrentSheet().UpdateAllScreenReferences();
|
||||
|
||||
if( m_schFrame )
|
||||
m_schFrame->SetSheetNumberAndCount();
|
||||
m_schematic->SetSheetNumberAndCount();
|
||||
|
||||
SCH_SCREEN* screen = m_schematic->CurrentSheet().LastScreen();
|
||||
|
||||
|
@ -315,8 +315,7 @@ void SCH_PLOTTER::createPSFiles( const SCH_PLOT_SETTINGS& aPlotSettings,
|
|||
|
||||
m_schematic->CurrentSheet().UpdateAllScreenReferences();
|
||||
|
||||
if( m_schFrame )
|
||||
m_schFrame->SetSheetNumberAndCount();
|
||||
m_schematic->SetSheetNumberAndCount();
|
||||
|
||||
SCH_SCREEN* screen = m_schematic->CurrentSheet().LastScreen();
|
||||
PAGE_INFO actualPage = screen->GetPageSettings();
|
||||
|
@ -400,8 +399,7 @@ void SCH_PLOTTER::createPSFiles( const SCH_PLOT_SETTINGS& aPlotSettings,
|
|||
|
||||
m_schematic->CurrentSheet().UpdateAllScreenReferences();
|
||||
|
||||
if( m_schFrame )
|
||||
m_schFrame->SetSheetNumberAndCount();
|
||||
m_schematic->SetSheetNumberAndCount();
|
||||
}
|
||||
|
||||
|
||||
|
@ -490,8 +488,7 @@ void SCH_PLOTTER::createSVGFiles( const SCH_PLOT_SETTINGS& aPlotSettings,
|
|||
|
||||
m_schematic->CurrentSheet().UpdateAllScreenReferences();
|
||||
|
||||
if( m_schFrame )
|
||||
m_schFrame->SetSheetNumberAndCount();
|
||||
m_schematic->SetSheetNumberAndCount();
|
||||
|
||||
screen = m_schematic->CurrentSheet().LastScreen();
|
||||
|
||||
|
@ -556,8 +553,7 @@ void SCH_PLOTTER::createSVGFiles( const SCH_PLOT_SETTINGS& aPlotSettings,
|
|||
|
||||
m_schematic->CurrentSheet().UpdateAllScreenReferences();
|
||||
|
||||
if( m_schFrame )
|
||||
m_schFrame->SetSheetNumberAndCount();
|
||||
m_schematic->SetSheetNumberAndCount();
|
||||
}
|
||||
|
||||
|
||||
|
@ -652,8 +648,7 @@ void SCH_PLOTTER::createHPGLFiles( const SCH_PLOT_SETTINGS& aPlotSettings,
|
|||
m_schematic->SetCurrentSheet( sheetList[i] );
|
||||
m_schematic->CurrentSheet().UpdateAllScreenReferences();
|
||||
|
||||
if( m_schFrame )
|
||||
m_schFrame->SetSheetNumberAndCount();
|
||||
m_schematic->SetSheetNumberAndCount();
|
||||
|
||||
screen = m_schematic->CurrentSheet().LastScreen();
|
||||
|
||||
|
@ -736,8 +731,7 @@ void SCH_PLOTTER::createHPGLFiles( const SCH_PLOT_SETTINGS& aPlotSettings,
|
|||
|
||||
m_schematic->CurrentSheet().UpdateAllScreenReferences();
|
||||
|
||||
if( m_schFrame )
|
||||
m_schFrame->SetSheetNumberAndCount();
|
||||
m_schematic->SetSheetNumberAndCount();
|
||||
}
|
||||
|
||||
|
||||
|
@ -845,8 +839,7 @@ void SCH_PLOTTER::createDXFFiles( const SCH_PLOT_SETTINGS& aPlotSettings,
|
|||
m_schematic->SetCurrentSheet( sheetList[i] );
|
||||
m_schematic->CurrentSheet().UpdateAllScreenReferences();
|
||||
|
||||
if( m_schFrame )
|
||||
m_schFrame->SetSheetNumberAndCount();
|
||||
m_schematic->SetSheetNumberAndCount();
|
||||
|
||||
SCH_SCREEN* screen = m_schematic->CurrentSheet().LastScreen();
|
||||
wxPoint plot_offset;
|
||||
|
@ -902,8 +895,7 @@ void SCH_PLOTTER::createDXFFiles( const SCH_PLOT_SETTINGS& aPlotSettings,
|
|||
|
||||
m_schematic->CurrentSheet().UpdateAllScreenReferences();
|
||||
|
||||
if( m_schFrame )
|
||||
m_schFrame->SetSheetNumberAndCount();
|
||||
m_schematic->SetSheetNumberAndCount();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -918,8 +910,7 @@ void SCH_PLOTTER::createDXFFiles( const SCH_PLOT_SETTINGS& aPlotSettings,
|
|||
|
||||
m_schematic->CurrentSheet().UpdateAllScreenReferences();
|
||||
|
||||
if( m_schFrame )
|
||||
m_schFrame->SetSheetNumberAndCount();
|
||||
m_schematic->SetSheetNumberAndCount();
|
||||
}
|
||||
|
||||
|
||||
|
@ -990,8 +981,7 @@ void SCH_PLOTTER::restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH& aOl
|
|||
|
||||
m_schematic->CurrentSheet().UpdateAllScreenReferences();
|
||||
|
||||
if( m_schFrame )
|
||||
m_schFrame->SetSheetNumberAndCount();
|
||||
m_schematic->SetSheetNumberAndCount();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -467,4 +467,33 @@ wxString SCHEMATIC::GetUniqueFilenameForCurrentSheet()
|
|||
filename += wxT( "-" ) + CurrentSheet().at( i )->GetName();
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
||||
void SCHEMATIC::SetSheetNumberAndCount()
|
||||
{
|
||||
SCH_SCREEN* screen;
|
||||
SCH_SCREENS s_list( Root() );
|
||||
|
||||
// Set the sheet count, and the sheet number (1 for root sheet)
|
||||
int sheet_count = Root().CountSheets();
|
||||
int sheet_number = 1;
|
||||
const KIID_PATH& current_sheetpath = CurrentSheet().Path();
|
||||
|
||||
// @todo Remove all pseudo page number system is left over from prior to real page number
|
||||
// implementation.
|
||||
for( const SCH_SHEET_PATH& sheet : GetSheets() )
|
||||
{
|
||||
if( sheet.Path() == current_sheetpath ) // Current sheet path found
|
||||
break;
|
||||
|
||||
sheet_number++; // Not found, increment before this current path
|
||||
}
|
||||
|
||||
for( screen = s_list.GetFirst(); screen != nullptr; screen = s_list.GetNext() )
|
||||
screen->SetPageCount( sheet_count );
|
||||
|
||||
CurrentSheet().SetVirtualPageNumber( sheet_number );
|
||||
CurrentSheet().LastScreen()->SetVirtualPageNumber( sheet_number );
|
||||
CurrentSheet().LastScreen()->SetPageNumber( CurrentSheet().GetPageNumber() );
|
||||
}
|
|
@ -188,6 +188,13 @@ public:
|
|||
*/
|
||||
wxString GetUniqueFilenameForCurrentSheet();
|
||||
|
||||
/**
|
||||
* Set the m_ScreenNumber and m_NumberOfScreens members for screens.
|
||||
*
|
||||
* @note This must be called after deleting or adding a sheet and when entering a sheet.
|
||||
*/
|
||||
void SetSheetNumberAndCount();
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const override {}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue