7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 09:01:42 +00:00

SCH_PRINTOUT::PrintPage(): update code.

This updated code is not in use. However it is updated just in case.
This commit is contained in:
jean-pierre charras 2024-12-13 10:46:27 +01:00
parent add58faa30
commit ac73616e7c

View File

@ -157,7 +157,26 @@ bool SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen, wxDC* aDC, bool aForPrinting
pageSizeIU = ToWxSize( aScreen->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS ) );
FitThisSizeToPaper( pageSizeIU );
fitRect = !aForPrinting ? wxRect( 0, 0, 6000, 4000 ) : GetLogicalPaperRect();
if( aForPrinting )
fitRect = GetLogicalPaperRect();
else
{
fitRect = wxRect( 0, 0, 6000, 4000 );
if( wxMemoryDC* memdc = dynamic_cast<wxMemoryDC*>( dc ) )
{
wxBitmap& bm = memdc->GetSelectedBitmap();
fitRect = wxRect( 0, 0, bm.GetWidth(), bm.GetHeight() );
// If the dc is a memory dc (should be the case when not printing on a printer,
// i.e. when printing on the clipboard), calculate a suitable dc user scale
double dc_scale;
double ppi = 300; // Use 300 pixels per inch to create bitmap images on start
double inch2Iu = 1000.0 * schIUScale.IU_PER_MILS;
dc_scale = ppi / inch2Iu;
dc->SetUserScale( dc_scale, dc_scale );
}
}
// When is the actual paper size does not match the schematic page size, the drawing will
// not be centered on X or Y axis. Give a draw offset to center the schematic page on the