Support SHEET_PATH when printing.

Fixes https://gitlab.com/kicad/code/kicad/issues/14233

(cherry picked from commit dc78797274)
This commit is contained in:
Jeff Young 2023-03-12 22:23:48 +00:00
parent 2d9bcb6e4f
commit 94057886a3
8 changed files with 35 additions and 16 deletions

View File

@ -674,9 +674,9 @@ void DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample()
GRFilledRect( &memDC, VECTOR2I( 0, 0 ), m_layout_size, 0, bgColor, bgColor );
PrintDrawingSheet( &renderSettings, pageDUMMY, emptyString, emptyString, m_tb,
nullptr, m_screen->GetPageCount(), m_screen->GetPageNumber(), 1,
&Prj(), wxEmptyString, m_screen->GetVirtualPageNumber() == 1 );
PrintDrawingSheet( &renderSettings, pageDUMMY, emptyString, emptyString, emptyString,
m_tb, nullptr, m_screen->GetPageCount(), m_screen->GetPageNumber(),
1, &Prj(), wxEmptyString, m_screen->GetVirtualPageNumber() == 1 );
memDC.SelectObject( wxNullBitmap );
m_PageLayoutExampleBitmap->SetBitmap( *m_pageBitmap );

View File

@ -990,8 +990,8 @@ static const wxString productName = wxT( "KiCad E.D.A. " );
void PrintDrawingSheet( const RENDER_SETTINGS* aSettings, const PAGE_INFO& aPageInfo,
const wxString& aFullSheetName, const wxString& aFileName,
const TITLE_BLOCK& aTitleBlock,
const wxString& aSheetName, const wxString& aSheetPath,
const wxString& aFileName, const TITLE_BLOCK& aTitleBlock,
const std::map<wxString, wxString>* aProperties, int aSheetCount,
const wxString& aPageNumber, double aMils2Iu, const PROJECT* aProject,
const wxString& aSheetLayer, bool aIsFirstPage )
@ -1003,7 +1003,8 @@ void PrintDrawingSheet( const RENDER_SETTINGS* aSettings, const PAGE_INFO& aPage
drawList.SetPageNumber( aPageNumber );
drawList.SetSheetCount( aSheetCount );
drawList.SetFileName( aFileName );
drawList.SetSheetName( aFullSheetName );
drawList.SetSheetName( aSheetName );
drawList.SetSheetPath( aSheetPath );
drawList.SetSheetLayer( aSheetLayer );
drawList.SetProject( aProject );
drawList.SetIsFirstPage( aIsFirstPage );
@ -1033,9 +1034,10 @@ void EDA_DRAW_FRAME::PrintDrawingSheet( const RENDER_SETTINGS* aSettings, BASE_S
DC->SetAxisOrientation( true, false );
}
::PrintDrawingSheet( aSettings, GetPageSettings(), GetScreenDesc(), aFilename, GetTitleBlock(),
aProperties, aScreen->GetPageCount(), aScreen->GetPageNumber(), aMils2Iu,
&Prj(), aSheetLayer, aScreen->GetVirtualPageNumber() == 1 );
::PrintDrawingSheet( aSettings, GetPageSettings(), GetScreenDesc(), GetFullScreenDesc(),
aFilename, GetTitleBlock(), aProperties, aScreen->GetPageCount(),
aScreen->GetPageNumber(), aMils2Iu, &Prj(), aSheetLayer,
aScreen->GetVirtualPageNumber() == 1 );
if( origin.y > 0 )
{
@ -1052,6 +1054,13 @@ wxString EDA_DRAW_FRAME::GetScreenDesc() const
}
wxString EDA_DRAW_FRAME::GetFullScreenDesc() const
{
// Virtual function. Base class implementation returns an empty string.
return wxEmptyString;
}
bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
const wxString& wildcard, const wxString& ext,
bool isDirectory, bool aIsGlobal,

View File

@ -647,6 +647,14 @@ SCHEMATIC& SCH_EDIT_FRAME::Schematic() const
wxString SCH_EDIT_FRAME::GetScreenDesc() const
{
wxString s = GetCurrentSheet().Last()->GetName();
return s;
}
wxString SCH_EDIT_FRAME::GetFullScreenDesc() const
{
wxString s = GetCurrentSheet().PathHumanReadable();

View File

@ -164,6 +164,7 @@ public:
* Return a human-readable description of the current screen.
*/
wxString GetScreenDesc() const override;
wxString GetFullScreenDesc() const override;
/**
* Execute a remote command sent by Pcbnew via a socket connection.

View File

@ -113,10 +113,8 @@ void SCH_VIEW::DisplaySheet( const SCH_SCREEN *aScreen )
wxCHECK( editFrame, /* void */ );
wxString sheetName = editFrame->GetCurrentSheet().Last()->GetName();
wxString sheetPath = editFrame->GetCurrentSheet().PathHumanReadable();
m_drawingSheet->SetSheetName( TO_UTF8( sheetName ) );
m_drawingSheet->SetSheetPath( TO_UTF8( sheetPath ) );
m_drawingSheet->SetSheetName( TO_UTF8( editFrame->GetScreenDesc() ) );
m_drawingSheet->SetSheetPath( TO_UTF8( editFrame->GetFullScreenDesc() ) );
}
else
{

View File

@ -129,7 +129,8 @@ private:
*
* @param aDC The device context.
* @param aPageInfo for margins and page size (in mils).
* @param aFullSheetName The sheetpath (full sheet name), for basic inscriptions.
* @param aSheetName The sheet name, for basic inscriptions.
* @param aSheetPath The sheetpath (full sheet name), for basic inscriptions.
* @param aFileName The file name, for basic inscriptions.
* @param aTitleBlock The sheet title block, for text variable resolution.
* @param aProperties Optional properties for text variable resolution.
@ -145,8 +146,8 @@ private:
* - the RBmargin The right bottom margin of the drawing sheet.
*/
void PrintDrawingSheet( const RENDER_SETTINGS* aSettings, const PAGE_INFO& aPageInfo,
const wxString& aFullSheetName, const wxString& aFileName,
const TITLE_BLOCK& aTitleBlock,
const wxString& aSheetName, const wxString& aSheetPath,
const wxString& aFileName, const TITLE_BLOCK& aTitleBlock,
const std::map<wxString, wxString>* aProperties, int aSheetCount,
const wxString& aPageNumber, double aScalar, const PROJECT* aProject,
const wxString& aSheetLayer = wxEmptyString, bool aIsFirstPage = true );

View File

@ -185,6 +185,7 @@ public:
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
virtual wxString GetScreenDesc() const;
virtual wxString GetFullScreenDesc() const;
/**
* Return a pointer to a BASE_SCREEN or one of its derivatives.

View File

@ -568,6 +568,7 @@ void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
&m_pcb->GetProperties() );
drawingSheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) );
drawingSheet->SetSheetPath( std::string( GetFullScreenDesc().mb_str() ) );
// A board is not like a schematic having a main page and sub sheets.
// So for the drawing sheet, use only the first page option to display items