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)
This commit is contained in:
Martin Aberg 2018-06-22 05:23:25 +01:00 committed by Jeff Young
parent f72842405a
commit 5b55a0d8e6
1 changed files with 10 additions and 4 deletions

View File

@ -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 */