From 1176ff4a156765ad4847e9a59963d9bf4a4b864b Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Tue, 8 Apr 2025 08:11:28 -0400 Subject: [PATCH] Use symbol line width schematic setting when printing and plotting. Fixes https://gitlab.com/kicad/code/kicad/-/issues/20574 --- eeschema/eeschema_config.cpp | 3 ++- eeschema/printing/sch_printout.cpp | 3 +++ eeschema/sch_item.cpp | 11 ++++++++++- eeschema/sch_render_settings.cpp | 1 + eeschema/sch_render_settings.h | 1 + 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index eb2a030ab0..f75fa98f61 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -65,7 +65,7 @@ bool SCH_EDIT_FRAME::LoadProjectSettings() GetRenderSettings()->m_LabelSizeRatio = settings.m_LabelSizeRatio; GetRenderSettings()->m_TextOffsetRatio = settings.m_TextOffsetRatio; GetRenderSettings()->m_PinSymbolSize = settings.m_PinSymbolSize; - + GetRenderSettings()->m_SymbolLineWidth = settings.m_DefaultLineWidth; GetRenderSettings()->SetDashLengthRatio( settings.m_DashedLineDashRatio ); GetRenderSettings()->SetGapLengthRatio( settings.m_DashedLineGapRatio ); @@ -151,6 +151,7 @@ void SCH_EDIT_FRAME::ShowSchematicSetupDialog( const wxString& aInitialPage ) GetRenderSettings()->m_LabelSizeRatio = Schematic().Settings().m_LabelSizeRatio; GetRenderSettings()->m_TextOffsetRatio = Schematic().Settings().m_TextOffsetRatio; GetRenderSettings()->m_PinSymbolSize = Schematic().Settings().m_PinSymbolSize; + GetRenderSettings()->m_SymbolLineWidth = Schematic().Settings().m_DefaultLineWidth; GetRenderSettings()->SetDashLengthRatio( Schematic().Settings().m_DashedLineDashRatio ); GetRenderSettings()->SetGapLengthRatio( Schematic().Settings().m_DashedLineGapRatio ); diff --git a/eeschema/printing/sch_printout.cpp b/eeschema/printing/sch_printout.cpp index 505b2e42e0..104f7be97b 100644 --- a/eeschema/printing/sch_printout.cpp +++ b/eeschema/printing/sch_printout.cpp @@ -180,6 +180,9 @@ bool SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen, wxDC* aDC, bool aForPrinting // Init the SCH_RENDER_SETTINGS used by the painter used to print schematic SCH_RENDER_SETTINGS* dstSettings = painter->GetSettings(); + if( aForPrinting ) + *dstSettings = *m_parent->GetRenderSettings(); + dstSettings->m_ShowPinsElectricalType = false; // Set the color scheme diff --git a/eeschema/sch_item.cpp b/eeschema/sch_item.cpp index 167f7b9247..bfa60ab7eb 100644 --- a/eeschema/sch_item.cpp +++ b/eeschema/sch_item.cpp @@ -496,11 +496,20 @@ int SCH_ITEM::GetEffectivePenWidth( const SCH_RENDER_SETTINGS* aSettings ) const // numbers meant "don't stroke". if( GetPenWidth() < 0 ) + { return 0; + } else if( GetPenWidth() == 0 ) - return std::max( aSettings->GetDefaultPenWidth(), aSettings->GetMinPenWidth() ); + { + if( GetParent() && GetParent()->Type() == LIB_SYMBOL_T ) + return std::max( aSettings->m_SymbolLineWidth, aSettings->GetMinPenWidth() ); + else + return std::max( aSettings->GetDefaultPenWidth(), aSettings->GetMinPenWidth() ); + } else + { return std::max( GetPenWidth(), aSettings->GetMinPenWidth() ); + } } diff --git a/eeschema/sch_render_settings.cpp b/eeschema/sch_render_settings.cpp index f6d269c8d6..cf3ba56e85 100644 --- a/eeschema/sch_render_settings.cpp +++ b/eeschema/sch_render_settings.cpp @@ -48,6 +48,7 @@ SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS() : m_LabelSizeRatio( DEFAULT_LABEL_SIZE_RATIO ), m_TextOffsetRatio( DEFAULT_TEXT_OFFSET_RATIO ), m_PinSymbolSize( DEFAULT_TEXT_SIZE * schIUScale.IU_PER_MILS / 2 ), + m_SymbolLineWidth( DEFAULT_LINE_WIDTH_MILS * schIUScale.IU_PER_MILS ), m_Transform() { SetDefaultPenWidth( DEFAULT_LINE_WIDTH_MILS * schIUScale.IU_PER_MILS ); diff --git a/eeschema/sch_render_settings.h b/eeschema/sch_render_settings.h index d250026c28..4b00fa092b 100644 --- a/eeschema/sch_render_settings.h +++ b/eeschema/sch_render_settings.h @@ -100,6 +100,7 @@ public: double m_TextOffsetRatio; // Proportion of font size to offset text above/below // wires, buses, etc. int m_PinSymbolSize; + int m_SymbolLineWidth; ///< Override line widths for symbol drawing objects set to default line width. TRANSFORM m_Transform; };