Recompute intersheet refs while printing.

Also fixes a bug where the schematic offset wasn't being added to
intersheet refs when printing.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14978
This commit is contained in:
Jeff Young 2023-06-17 18:11:16 +01:00
parent 1c7971c4dc
commit e3eb0abc5f
2 changed files with 9 additions and 2 deletions

View File

@ -372,6 +372,7 @@ bool SCH_PRINTOUT::OnPrintPage( int page )
m_parent->SetCurrentSheet( sheetList[ page - 1 ] );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
m_parent->RecomputeIntersheetRefs();
screen = m_parent->GetCurrentSheet().LastScreen();
PrintPage( screen );
m_parent->SetCurrentSheet( oldsheetpath );
@ -431,7 +432,7 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
COLOR_SETTINGS* theme = mgr.GetColorSettings( cfg->m_Printing.color_theme );
// Change scale factor and offset to print the whole page.
bool printReference = cfg->m_Printing.title_block;
bool printDrawingSheet = cfg->m_Printing.title_block;
pageSizeIU = ToWxSize( aScreen->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS ) );
FitThisSizeToPaper( pageSizeIU );
@ -520,7 +521,7 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
renderSettings.SetDefaultFont( cfg->m_Appearance.default_font );
if( printReference )
if( printDrawingSheet )
{
m_parent->PrintDrawingSheet( &renderSettings, aScreen, aScreen->Schematic()->GetProperties(),
schIUScale.IU_PER_MILS, aScreen->GetFileName(), wxEmptyString );

View File

@ -385,6 +385,12 @@ void SCH_FIELD::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
*/
textpos = GetBoundingBox().Centre() + aOffset;
if( GetParent() && GetParent()->Type() == SCH_GLOBAL_LABEL_T )
{
SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( GetParent() );
textpos += label->GetSchematicTextOffset( aSettings );
}
GRPrintText( DC, textpos, color, GetShownText( true ), orient, GetTextSize(),
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold(),
font );