Eeschema: fix text limit bug due to internal units scaling.
Change default text size and anchor positions back to mils. Internal units need to be converted at the source, otherwise the size will get converted twice in the schematic editor configuration code which will result in the default text size being off by the conversion factor. Fixes #3730 https://gitlab.com/kicad/code/kicad/issues/3730#
This commit is contained in:
parent
baa1db031e
commit
4bab82e149
|
@ -335,7 +335,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
|
||||||
|
|
||||||
bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
|
bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
|
||||||
{
|
{
|
||||||
if( !m_textSize.Validate( 1, 10000 ) ) // 1 mill .. 10 inches
|
if( !m_textSize.Validate( Mils2iu( 1 ), Mils2iu( 10000 ) ) ) // 1 mil .. 10 inches
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SCH_SHEET_LIST aSheets( g_RootSheet );
|
SCH_SHEET_LIST aSheets( g_RootSheet );
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Jean-Pierre Charras, jpe.charras at wanadoo.fr
|
* Copyright (C) 2013 Jean-Pierre Charras, jpe.charras at wanadoo.fr
|
||||||
* Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2004-2019 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -62,19 +62,20 @@ enum EDA_DRAW_MODE_T {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** This is the "default-of-the-default" hardcoded text size; individual
|
/**
|
||||||
|
* This is the "default-of-the-default" hardcoded text size; individual
|
||||||
* application define their own default policy starting with this
|
* application define their own default policy starting with this
|
||||||
* (usually with a user option or project).
|
* (usually with a user option or project).
|
||||||
**/
|
*/
|
||||||
#define DEFAULT_SIZE_TEXT Mils2iu( 50 ) // default text height (in mils, i.e. 1/1000")
|
#define DEFAULT_SIZE_TEXT 50 // default text height (in mils, i.e. 1/1000")
|
||||||
#define DIM_ANCRE_TEXTE Mils2iu( 2 ) // Anchor size for text
|
#define DIM_ANCRE_TEXTE 2 // Anchor size for text
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Struct TEXT_EFFECTS
|
* A container for text effects.
|
||||||
* is a bucket for text effects. These fields are bundled so they
|
*
|
||||||
* can be easily copied together as a lot. The privacy policy is established
|
* These fields are bundled so they can be easily copied together as a lot. The privacy
|
||||||
* by client (incorporating) code.
|
* policy is established by client (incorporating) code.
|
||||||
*/
|
*/
|
||||||
struct TEXT_EFFECTS
|
struct TEXT_EFFECTS
|
||||||
{
|
{
|
||||||
|
@ -100,8 +101,7 @@ struct TEXT_EFFECTS
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class EDA_TEXT
|
* A mix-in class (via multiple inheritance) that handles texts such as
|
||||||
* is a mix-in class (via multiple inheritance) that handles texts such as
|
|
||||||
* labels, parts, components, or footprints. Because it's a mix-in class, care
|
* labels, parts, components, or footprints. Because it's a mix-in class, care
|
||||||
* is used to provide function names (accessors) that to not collide with function
|
* is used to provide function names (accessors) that to not collide with function
|
||||||
* names likely to be seen in the combined derived classes.
|
* names likely to be seen in the combined derived classes.
|
||||||
|
@ -116,34 +116,34 @@ public:
|
||||||
virtual ~EDA_TEXT();
|
virtual ~EDA_TEXT();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetText
|
* Return the string associated with the text object.
|
||||||
* returns the string associated with the text object.
|
|
||||||
*
|
*
|
||||||
* @return a const wxString reference containing the string of the item.
|
* @return a const wxString reference containing the string of the item.
|
||||||
*/
|
*/
|
||||||
virtual const wxString& GetText() const { return m_text; }
|
virtual const wxString& GetText() const { return m_text; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the string actually shown after processing of the base
|
* Return the string actually shown after processing of the base
|
||||||
* text. Default is no processing */
|
* text. Default is no processing
|
||||||
|
*/
|
||||||
virtual wxString GetShownText() const { return m_shown_text; }
|
virtual wxString GetShownText() const { return m_shown_text; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a shortened version (max 15 characters) of the shown text */
|
* Returns a shortened version (max 15 characters) of the shown text
|
||||||
|
*/
|
||||||
wxString ShortenedShownText() const;
|
wxString ShortenedShownText() const;
|
||||||
|
|
||||||
virtual void SetText( const wxString& aText );
|
virtual void SetText( const wxString& aText );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetThickness
|
* Set the pen width.
|
||||||
* sets pen width.
|
*
|
||||||
* @param aNewThickness is the new pen width
|
* @param aNewThickness is the new pen width
|
||||||
*/
|
*/
|
||||||
void SetThickness( int aNewThickness ) { m_e.penwidth = aNewThickness; };
|
void SetThickness( int aNewThickness ) { m_e.penwidth = aNewThickness; };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetThickness
|
* Return the pen width.
|
||||||
* returns pen width.
|
|
||||||
*/
|
*/
|
||||||
int GetThickness() const { return m_e.penwidth; };
|
int GetThickness() const { return m_e.penwidth; };
|
||||||
|
|
||||||
|
@ -173,7 +173,6 @@ public:
|
||||||
bool IsMirrored() const { return m_e.Bit( TE_MIRROR ); }
|
bool IsMirrored() const { return m_e.Bit( TE_MIRROR ); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetMultiLineAllowed
|
|
||||||
* @param aAllow true if ok to use multiline option, false
|
* @param aAllow true if ok to use multiline option, false
|
||||||
* if ok to use only single line text. (Single line is faster in
|
* if ok to use only single line text. (Single line is faster in
|
||||||
* calculations than multiline.)
|
* calculations than multiline.)
|
||||||
|
@ -188,18 +187,18 @@ public:
|
||||||
void SetVertJustify( EDA_TEXT_VJUSTIFY_T aType ) { m_e.vjustify = aType; };
|
void SetVertJustify( EDA_TEXT_VJUSTIFY_T aType ) { m_e.vjustify = aType; };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetEffects
|
* Set the text effects from another instance.
|
||||||
* sets the text effects from another instance. (TEXT_EFFECTS
|
*
|
||||||
* is not exposed in the public API, but includes everything except the actual
|
* TEXT_EFFECTS is not exposed in the public API, but includes everything except the actual
|
||||||
* text string itself.)
|
* text string itself.
|
||||||
*/
|
*/
|
||||||
void SetEffects( const EDA_TEXT& aSrc );
|
void SetEffects( const EDA_TEXT& aSrc );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SwapEffects
|
* Swap the text effects of the two involved instances.
|
||||||
* swaps the text effects of the two involved instances. (TEXT_EFECTS
|
*
|
||||||
* is not exposed in the public API, but includes everything except the actual
|
* TEXT_EFFECTS is not exposed in the public API, but includes everything except the actual
|
||||||
* text string itself.)
|
* text string itself.
|
||||||
*/
|
*/
|
||||||
void SwapEffects( EDA_TEXT& aTradingPartner );
|
void SwapEffects( EDA_TEXT& aTradingPartner );
|
||||||
|
|
||||||
|
@ -208,8 +207,9 @@ public:
|
||||||
void CopyText( const EDA_TEXT& aSrc );
|
void CopyText( const EDA_TEXT& aSrc );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function used in search and replace dialog
|
* Helper function used in search and replace dialog.
|
||||||
* performs a text replace using the find and replace criteria in \a aSearchData.
|
*
|
||||||
|
* Perform a text replace using the find and replace criteria in \a aSearchData.
|
||||||
*
|
*
|
||||||
* @param aSearchData A reference to a wxFindReplaceData object containing the
|
* @param aSearchData A reference to a wxFindReplaceData object containing the
|
||||||
* search and replace criteria.
|
* search and replace criteria.
|
||||||
|
@ -245,8 +245,9 @@ public:
|
||||||
|
|
||||||
static EDA_TEXT_VJUSTIFY_T MapVertJustify( int aVertJustify );
|
static EDA_TEXT_VJUSTIFY_T MapVertJustify( int aVertJustify );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Print
|
* Print this text object to the device context \a aDC.
|
||||||
|
*
|
||||||
* @param aDC = the current Device Context
|
* @param aDC = the current Device Context
|
||||||
* @param aOffset = draw offset (usually (0,0))
|
* @param aOffset = draw offset (usually (0,0))
|
||||||
* @param aColor = text color
|
* @param aColor = text color
|
||||||
|
@ -256,20 +257,22 @@ public:
|
||||||
EDA_DRAW_MODE_T aDisplay_mode = FILLED );
|
EDA_DRAW_MODE_T aDisplay_mode = FILLED );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the text shape to a list of segment
|
* Convert the text shape to a list of segment.
|
||||||
* each segment is stored as 2 wxPoints: the starting point and the ending point
|
*
|
||||||
* there are therefore 2*n points
|
* Each segment is stored as 2 wxPoints: the starting point and the ending point
|
||||||
|
* there are therefore 2*n points.
|
||||||
|
*
|
||||||
* @param aCornerBuffer = a buffer to store the polygon
|
* @param aCornerBuffer = a buffer to store the polygon
|
||||||
*/
|
*/
|
||||||
void TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuffer ) const;
|
void TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuffer ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function TransformBoundingBoxWithClearanceToPolygon
|
* Convert the text bounding box to a rectangular polygon depending on the text
|
||||||
* Convert the text bounding box to a rectangular polygon
|
* orientation, the bounding box is not always horizontal or vertical
|
||||||
* depending on the text orientation, the bounding box
|
*
|
||||||
* is not always horizontal or vertical
|
|
||||||
* Used in filling zones calculations
|
* Used in filling zones calculations
|
||||||
* Circles and arcs are approximated by segments
|
* Circles and arcs are approximated by segments
|
||||||
|
*
|
||||||
* @param aCornerBuffer = a buffer to store the polygon
|
* @param aCornerBuffer = a buffer to store the polygon
|
||||||
* @param aClearanceValue = the clearance around the text bounding box
|
* @param aClearanceValue = the clearance around the text bounding box
|
||||||
* to the real clearance value (usually near from 1.0)
|
* to the real clearance value (usually near from 1.0)
|
||||||
|
@ -278,8 +281,8 @@ public:
|
||||||
int aClearanceValue ) const;
|
int aClearanceValue ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function TextHitTest
|
|
||||||
* Test if \a aPoint is within the bounds of this object.
|
* Test if \a aPoint is within the bounds of this object.
|
||||||
|
*
|
||||||
* @param aPoint- A wxPoint to test
|
* @param aPoint- A wxPoint to test
|
||||||
* @param aAccuracy - Amount to inflate the bounding box.
|
* @param aAccuracy - Amount to inflate the bounding box.
|
||||||
* @return bool - true if a hit, else false
|
* @return bool - true if a hit, else false
|
||||||
|
@ -287,8 +290,7 @@ public:
|
||||||
virtual bool TextHitTest( const wxPoint& aPoint, int aAccuracy = 0 ) const;
|
virtual bool TextHitTest( const wxPoint& aPoint, int aAccuracy = 0 ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function TextHitTest (overloaded)
|
* Test if object bounding box is contained within or intersects \a aRect.
|
||||||
* Tests if object bounding box is contained within or intersects \a aRect.
|
|
||||||
*
|
*
|
||||||
* @param aRect - Rect to test against.
|
* @param aRect - Rect to test against.
|
||||||
* @param aContains - Test for containment instead of intersection if true.
|
* @param aContains - Test for containment instead of intersection if true.
|
||||||
|
@ -298,20 +300,19 @@ public:
|
||||||
virtual bool TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy = 0 ) const;
|
virtual bool TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy = 0 ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function LenSize
|
|
||||||
* @return the text length in internal units
|
* @return the text length in internal units
|
||||||
* @param aLine : the line of text to consider.
|
* @param aLine : the line of text to consider.
|
||||||
* For single line text, this parameter is always m_Text
|
* For single line text, this parameter is always m_Text
|
||||||
* @param aThickness : the stroke width of the text
|
* @param aThickness : the stroke width of the text
|
||||||
* @param aMarkupFlags a flagset of MARKUP_FLAG enums indicating which markup tokens should
|
* @param aMarkupFlags a flag set of MARKUP_FLAG enums indicating which markup tokens should
|
||||||
* be processed
|
* be processed
|
||||||
*/
|
*/
|
||||||
int LenSize( const wxString& aLine, int aThickness, int aMarkupFlags ) const;
|
int LenSize( const wxString& aLine, int aThickness, int aMarkupFlags ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetTextBox
|
* Useful in multiline texts to calculate the full text or a line area (for
|
||||||
* useful in multiline texts to calculate the full text or a line area (for
|
|
||||||
* zones filling, locate functions....)
|
* zones filling, locate functions....)
|
||||||
|
*
|
||||||
* @return the rect containing the line of text (i.e. the position and the
|
* @return the rect containing the line of text (i.e. the position and the
|
||||||
* size of one line)
|
* size of one line)
|
||||||
* this rectangle is calculated for 0 orient text.
|
* this rectangle is calculated for 0 orient text.
|
||||||
|
@ -339,16 +340,15 @@ public:
|
||||||
int GetInterline() const;
|
int GetInterline() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetTextStyleName
|
|
||||||
* @return a wxString with the style name( Normal, Italic, Bold, Bold+Italic)
|
* @return a wxString with the style name( Normal, Italic, Bold, Bold+Italic)
|
||||||
*/
|
*/
|
||||||
wxString GetTextStyleName();
|
wxString GetTextStyleName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetPositionsOfLinesOfMultilineText
|
* Populate \a aPositions with the position of each line of
|
||||||
* Populates aPositions with the position of each line of
|
|
||||||
* a multiline text, according to the vertical justification and the
|
* a multiline text, according to the vertical justification and the
|
||||||
* rotation of the whole text
|
* rotation of the whole text
|
||||||
|
*
|
||||||
* @param aPositions is the list to populate by the wxPoint positions
|
* @param aPositions is the list to populate by the wxPoint positions
|
||||||
* @param aLineCount is the number of lines (not recalculated here
|
* @param aLineCount is the number of lines (not recalculated here
|
||||||
* for efficiency reasons
|
* for efficiency reasons
|
||||||
|
@ -356,8 +356,7 @@ public:
|
||||||
void GetPositionsOfLinesOfMultilineText(
|
void GetPositionsOfLinesOfMultilineText(
|
||||||
std::vector<wxPoint>& aPositions, int aLineCount ) const;
|
std::vector<wxPoint>& aPositions, int aLineCount ) const;
|
||||||
/**
|
/**
|
||||||
* Function Format
|
* Output the object to \a aFormatter in s-expression form.
|
||||||
* outputs the object to \a aFormatter in s-expression form.
|
|
||||||
*
|
*
|
||||||
* @param aFormatter The #OUTPUTFORMATTER object to write to.
|
* @param aFormatter The #OUTPUTFORMATTER object to write to.
|
||||||
* @param aNestLevel The indentation next level.
|
* @param aNestLevel The indentation next level.
|
||||||
|
@ -372,8 +371,8 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Function printOneLineOfText
|
* Print each line of this EDA_TEXT.
|
||||||
* Used to print each line of this EDA_TEXT, that can be multiline
|
*
|
||||||
* @param aDC = the current Device Context
|
* @param aDC = the current Device Context
|
||||||
* @param aOffset = draw offset (usually (0,0))
|
* @param aOffset = draw offset (usually (0,0))
|
||||||
* @param aColor = text color
|
* @param aColor = text color
|
||||||
|
|
Loading…
Reference in New Issue