From 5b55a0d8e6c1526ec6bf7cdb57b2206d3d061920 Mon Sep 17 00:00:00 2001 From: Martin Aberg Date: Fri, 22 Jun 2018 05:23:25 +0100 Subject: [PATCH] eeschema: clamp text line width on hierarchical sheets When drawing a hierarchical sheet symbol, the text line width for "Sheet: ..." and "File: ..." are now clamped (limited). Clamp_Text_PenSize() is used for the calculation. Before, without the clamping, these text widths grew with the line width preferences option. That resulted in characters cluttering up. (cherry picked from commit b76407e) --- eeschema/sch_sheet.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index ac12e92f34..6ed69b7aae 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -433,6 +433,8 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint pos_sheetname,pos_filename; wxPoint pos = m_pos + aOffset; int lineWidth = GetPenSize(); + int textWidth; + wxSize textSize; EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL; if( aColor != COLOR4D::UNSPECIFIED ) @@ -460,10 +462,12 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, txtcolor = GetLayerColor( LAYER_SHEETNAME ); Text = wxT( "Sheet: " ) + m_name; + textSize = wxSize( m_sheetNameSize, m_sheetNameSize ); + textWidth = Clamp_Text_PenSize( lineWidth, textSize, false ); DrawGraphicText( clipbox, aDC, pos_sheetname, txtcolor, Text, name_orientation, - wxSize( m_sheetNameSize, m_sheetNameSize ), - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, lineWidth, + textSize, + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, textWidth, false, false ); /* Draw text : FileName */ @@ -473,10 +477,12 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, txtcolor = GetLayerColor( LAYER_SHEETFILENAME ); Text = wxT( "File: " ) + m_fileName; + textSize = wxSize( m_fileNameSize, m_fileNameSize ); + textWidth = Clamp_Text_PenSize( lineWidth, textSize, false ); DrawGraphicText( clipbox, aDC, pos_filename, txtcolor, Text, name_orientation, - wxSize( m_fileNameSize, m_fileNameSize ), - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, lineWidth, + textSize, + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, textWidth, false, false ); /* Draw text : SheetLabel */