Eeschema: SCH_SHEET_LIST improvements.
* Derive SCH_SHEET_LIST from std::vector rather than using internal array management. Change all internal code to use iterators or array operator in loops. * Allow creation of empty SCH_SHEET_LIST for external population for plotting and printing. * Clean up print an plot code to take advantage of new SCH_SHEET_LIST behavior. * Make BuildSheetList() public so list can be populated after creation. * Update all instances of SCH_SHEET_LIST with the appropriate SCH_SHEET object on initialization. * Create const and non-const version of SCH_SHEET_PATH::GetSheet().
This commit is contained in:
@@ -41,7 +41,6 @@
|
||||
void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
|
||||
{
|
||||
SCH_SCREEN* screen = m_parent->GetScreen();
|
||||
SCH_SHEET_PATH* sheetpath;
|
||||
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
|
||||
|
||||
/* When printing all pages, the printed page is not the current page. In
|
||||
@@ -51,9 +50,12 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
|
||||
* between many sheets and component references depend on the actual sheet
|
||||
* path used
|
||||
*/
|
||||
SCH_SHEET_LIST SheetList( NULL );
|
||||
SCH_SHEET_LIST sheetList;
|
||||
|
||||
sheetpath = SheetList.GetFirst();
|
||||
if( aPlotAll )
|
||||
sheetList.BuildSheetList( g_RootSheet );
|
||||
else
|
||||
sheetList.push_back( m_parent->GetCurrentSheet() );
|
||||
|
||||
// Allocate the plotter and set the job level parameter
|
||||
PDF_PLOTTER* plotter = new PDF_PLOTTER();
|
||||
@@ -65,26 +67,14 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
|
||||
wxFileName plotFileName;
|
||||
REPORTER& reporter = m_MessagesBox->Reporter();
|
||||
|
||||
// First page handling is different
|
||||
bool first_page = true;
|
||||
|
||||
do
|
||||
for( unsigned i = 0; i < sheetList.size(); i++ )
|
||||
{
|
||||
// Step over the schematic hierarchy
|
||||
if( aPlotAll )
|
||||
{
|
||||
wxCHECK_RET( sheetpath != NULL, wxT( "Attempt to plot undefined sheet path." ) );
|
||||
m_parent->SetCurrentSheet( sheetList[i] );
|
||||
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
|
||||
m_parent->SetSheetNumberAndCount();
|
||||
screen = m_parent->GetCurrentSheet().LastScreen();
|
||||
|
||||
SCH_SHEET_PATH list = *sheetpath;
|
||||
|
||||
m_parent->SetCurrentSheet( list );
|
||||
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
|
||||
m_parent->SetSheetNumberAndCount();
|
||||
screen = m_parent->GetCurrentSheet().LastScreen();
|
||||
sheetpath = SheetList.GetNext();
|
||||
}
|
||||
|
||||
if( first_page )
|
||||
if( i == 0 )
|
||||
{
|
||||
|
||||
try
|
||||
@@ -107,8 +97,6 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
|
||||
SetLocaleTo_C_standard();
|
||||
setupPlotPagePDF( plotter, screen );
|
||||
plotter->StartPlot();
|
||||
first_page = false;
|
||||
|
||||
}
|
||||
catch( const IO_ERROR& e )
|
||||
{
|
||||
@@ -131,7 +119,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
|
||||
}
|
||||
|
||||
plotOneSheetPDF( plotter, screen, aPlotFrameRef );
|
||||
} while( aPlotAll && sheetpath );
|
||||
}
|
||||
|
||||
// Everything done, close the plot and restore the environment
|
||||
msg.Printf( _( "Plot: '%s' OK.\n" ), GetChars( plotFileName.GetFullPath() ) );
|
||||
|
||||
Reference in New Issue
Block a user