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:
Wayne Stambaugh
2016-03-06 16:22:01 -05:00
parent 0d1395ee08
commit 92f5ab8589
23 changed files with 300 additions and 524 deletions
+13 -24
View File
@@ -39,10 +39,9 @@
void DIALOG_PLOT_SCHEMATIC::createPSFile( 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
PAGE_INFO actualPage; // page size selected in schematic
PAGE_INFO plotPage; // page size selected to plot
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
PAGE_INFO actualPage; // page size selected in schematic
PAGE_INFO plotPage; // page size selected to plot
/* When printing all pages, the printed page is not the current page.
* In complex hierarchies, we must update component references
@@ -50,26 +49,19 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef )
* because in complex hierarchies a SCH_SCREEN (a drawing )
* is shared 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();
SCH_SHEET_PATH list;
if( aPlotAll )
sheetList.BuildSheetList( g_RootSheet );
else
sheetList.push_back( m_parent->GetCurrentSheet() );
while( true )
for( unsigned i = 0; i < sheetList.size(); i++ )
{
if( aPlotAll )
{
if( sheetpath == NULL )
break;
list = *sheetpath;
m_parent->SetCurrentSheet( list );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
screen = m_parent->GetCurrentSheet().LastScreen();
sheetpath = SheetList.GetNext();
}
m_parent->SetCurrentSheet( sheetList[i] );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
screen = m_parent->GetCurrentSheet().LastScreen();
actualPage = screen->GetPageSettings();
switch( m_pageSizeSelect )
@@ -129,9 +121,6 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef )
msg.Printf( wxT( "PS Plotter exception: %s"), GetChars( e.errorText ) );
reporter.Report( msg, REPORTER::RPT_ERROR );
}
if( !aPlotAll )
break;
}
m_parent->SetCurrentSheet( oldsheetpath );