Add naming of the outline page entries
This commit is contained in:
parent
f2377b447d
commit
209e1b2086
|
@ -670,12 +670,13 @@ void PDF_PLOTTER::closePdfStream()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PDF_PLOTTER::StartPage( const wxString& aPageNumber )
|
void PDF_PLOTTER::StartPage( const wxString& aPageNumber, const wxString& aPageName )
|
||||||
{
|
{
|
||||||
wxASSERT( m_outputFile );
|
wxASSERT( m_outputFile );
|
||||||
wxASSERT( !m_workFile );
|
wxASSERT( !m_workFile );
|
||||||
|
|
||||||
m_pageNumbers.push_back( aPageNumber );
|
m_pageNumbers.push_back( aPageNumber );
|
||||||
|
m_pageName = aPageName;
|
||||||
|
|
||||||
// Compute the paper size in IUs
|
// Compute the paper size in IUs
|
||||||
m_paperSize = m_pageInfo.GetSizeMils();
|
m_paperSize = m_pageInfo.GetSizeMils();
|
||||||
|
@ -810,8 +811,18 @@ void PDF_PLOTTER::ClosePage()
|
||||||
// Mark the page stream as idle
|
// Mark the page stream as idle
|
||||||
m_pageStreamHandle = 0;
|
m_pageStreamHandle = 0;
|
||||||
|
|
||||||
OUTLINE_NODE* pageOutlineNode = addOutlineNode(
|
wxString pageOutlineName = wxEmptyString;
|
||||||
m_outlineRoot.get(), -1, wxString::Format( _( "Page %s" ), m_pageNumbers.back() ) );
|
if( m_pageName.IsEmpty() )
|
||||||
|
{
|
||||||
|
pageOutlineName = wxString::Format( _( "Page %s" ), m_pageNumbers.back() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pageOutlineName = wxString::Format( _( "%s (Page %s)" ), m_pageName, m_pageNumbers.back() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OUTLINE_NODE* pageOutlineNode = addOutlineNode( m_outlineRoot.get(), -1, pageOutlineName );
|
||||||
|
|
||||||
// let's reorg the symbol bookmarks under a page handle
|
// let's reorg the symbol bookmarks under a page handle
|
||||||
// let's reorg the symbol bookmarks under a page handle
|
// let's reorg the symbol bookmarks under a page handle
|
||||||
|
@ -847,7 +858,14 @@ void PDF_PLOTTER::ClosePage()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PDF_PLOTTER::StartPlot(const wxString& aPageNumber)
|
bool PDF_PLOTTER::StartPlot( const wxString& aPageNumber )
|
||||||
|
{
|
||||||
|
return StartPlot( aPageNumber, wxEmptyString );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PDF_PLOTTER::StartPlot( const wxString& aPageNumber,
|
||||||
|
const wxString& aPageName )
|
||||||
{
|
{
|
||||||
wxASSERT(m_outputFile);
|
wxASSERT(m_outputFile);
|
||||||
|
|
||||||
|
@ -879,7 +897,7 @@ bool PDF_PLOTTER::StartPlot(const wxString& aPageNumber)
|
||||||
/* Now, the PDF is read from the end, (more or less)... so we start
|
/* Now, the PDF is read from the end, (more or less)... so we start
|
||||||
with the page stream for page 1. Other more important stuff is written
|
with the page stream for page 1. Other more important stuff is written
|
||||||
at the end */
|
at the end */
|
||||||
StartPage(aPageNumber);
|
StartPage(aPageNumber, aPageName);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -851,7 +851,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotDrawingSheet
|
||||||
|
|
||||||
// Open the plotter and do the first page
|
// Open the plotter and do the first page
|
||||||
setupPlotPagePDF( plotter, screen );
|
setupPlotPagePDF( plotter, screen );
|
||||||
plotter->StartPlot( sheetList[i].GetPageNumber() );
|
plotter->StartPlot( sheetList[i].GetPageNumber(), _("Root") );
|
||||||
}
|
}
|
||||||
catch( const IO_ERROR& e )
|
catch( const IO_ERROR& e )
|
||||||
{
|
{
|
||||||
|
@ -870,7 +870,8 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotDrawingSheet
|
||||||
* reconfigure, and then start a new one */
|
* reconfigure, and then start a new one */
|
||||||
plotter->ClosePage();
|
plotter->ClosePage();
|
||||||
setupPlotPagePDF( plotter, screen );
|
setupPlotPagePDF( plotter, screen );
|
||||||
plotter->StartPage( sheetList[i].GetPageNumber() );
|
plotter->StartPage( sheetList[i].GetPageNumber(),
|
||||||
|
sheetList[i].Last()->GetFields()[SHEETNAME].GetShownText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
plotOneSheetPDF( plotter, screen, aPlotDrawingSheet );
|
plotOneSheetPDF( plotter, screen, aPlotDrawingSheet );
|
||||||
|
|
|
@ -274,12 +274,16 @@ public:
|
||||||
* are to be closed and reopened. Between each page parameters can be set.
|
* are to be closed and reopened. Between each page parameters can be set.
|
||||||
*/
|
*/
|
||||||
virtual bool StartPlot( const wxString& aPageNumber ) override;
|
virtual bool StartPlot( const wxString& aPageNumber ) override;
|
||||||
|
|
||||||
|
virtual bool StartPlot( const wxString& aPageNumber,
|
||||||
|
const wxString& aPageName = wxEmptyString );
|
||||||
|
|
||||||
virtual bool EndPlot() override;
|
virtual bool EndPlot() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a new page in the PDF document.
|
* Start a new page in the PDF document.
|
||||||
*/
|
*/
|
||||||
virtual void StartPage( const wxString& aPageNumber );
|
virtual void StartPage( const wxString& aPageNumber, const wxString& aPageName = wxEmptyString );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the current page in the PDF document (and emit its compressed stream).
|
* Close the current page in the PDF document (and emit its compressed stream).
|
||||||
|
@ -467,6 +471,7 @@ protected:
|
||||||
int m_pageStreamHandle; ///< Handle of the page content object
|
int m_pageStreamHandle; ///< Handle of the page content object
|
||||||
int m_streamLengthHandle; ///< Handle to the deferred stream length
|
int m_streamLengthHandle; ///< Handle to the deferred stream length
|
||||||
wxString m_workFilename;
|
wxString m_workFilename;
|
||||||
|
wxString m_pageName;
|
||||||
FILE* m_workFile; ///< Temporary file to construct the stream before zipping
|
FILE* m_workFile; ///< Temporary file to construct the stream before zipping
|
||||||
std::vector<long> m_xrefTable; ///< The PDF xref offset table
|
std::vector<long> m_xrefTable; ///< The PDF xref offset table
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue