Make sure users don't run into min text size.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17543
(cherry picked from commit fc572bfbc6
)
This commit is contained in:
parent
f3621496fb
commit
4bea619855
|
@ -364,8 +364,8 @@ void EDA_TEXT::SetTextSize( VECTOR2I aNewSize, bool aEnforceMinTextSize )
|
|||
|
||||
if( aEnforceMinTextSize )
|
||||
{
|
||||
int min = m_IuScale.get().MilsToIU( TEXT_MIN_SIZE_MILS );
|
||||
int max = m_IuScale.get().MilsToIU( TEXT_MAX_SIZE_MILS );
|
||||
int min = m_IuScale.get().mmToIU( TEXT_MIN_SIZE_MM );
|
||||
int max = m_IuScale.get().mmToIU( TEXT_MAX_SIZE_MM );
|
||||
|
||||
aNewSize = VECTOR2I( alg::clamp( min, aNewSize.x, max ),
|
||||
alg::clamp( min, aNewSize.y, max ) );
|
||||
|
@ -380,8 +380,8 @@ void EDA_TEXT::SetTextSize( VECTOR2I aNewSize, bool aEnforceMinTextSize )
|
|||
|
||||
void EDA_TEXT::SetTextWidth( int aWidth )
|
||||
{
|
||||
int min = m_IuScale.get().MilsToIU( TEXT_MIN_SIZE_MILS );
|
||||
int max = m_IuScale.get().MilsToIU( TEXT_MAX_SIZE_MILS );
|
||||
int min = m_IuScale.get().mmToIU( TEXT_MIN_SIZE_MM );
|
||||
int max = m_IuScale.get().mmToIU( TEXT_MAX_SIZE_MM );
|
||||
|
||||
m_attributes.m_Size.x = alg::clamp( min, aWidth, max );
|
||||
ClearRenderCache();
|
||||
|
@ -391,8 +391,8 @@ void EDA_TEXT::SetTextWidth( int aWidth )
|
|||
|
||||
void EDA_TEXT::SetTextHeight( int aHeight )
|
||||
{
|
||||
int min = m_IuScale.get().MilsToIU( TEXT_MIN_SIZE_MILS );
|
||||
int max = m_IuScale.get().MilsToIU( TEXT_MAX_SIZE_MILS );
|
||||
int min = m_IuScale.get().mmToIU( TEXT_MIN_SIZE_MM );
|
||||
int max = m_IuScale.get().mmToIU( TEXT_MAX_SIZE_MM );
|
||||
|
||||
m_attributes.m_Size.y = alg::clamp( min, aHeight, max );
|
||||
ClearRenderCache();
|
||||
|
|
|
@ -62,9 +62,8 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @brief some define and functions to convert a value in mils, decimils or mm
|
||||
* to the internal unit used in pcbnew, cvpcb or gerbview (nanometer or deci-mil)
|
||||
* depending on compile time option
|
||||
* @brief some macros and functions to convert a value in mils, decimils or mm to the internal
|
||||
* unit used in pcbnew, cvpcb or gerbview (nanometer or deci-mil) depending on compile time option
|
||||
*/
|
||||
|
||||
constexpr double GERB_IU_PER_MM = 1e5; // Gerbview IU is 10 nanometers.
|
||||
|
|
|
@ -38,9 +38,12 @@ class SHAPE_COMPOUND;
|
|||
class SHAPE_POLY_SET;
|
||||
|
||||
|
||||
// These are only here for algorithmic safety, not to tell the user what to do
|
||||
#define TEXT_MIN_SIZE_MILS 1 ///< Minimum text size in mils
|
||||
#define TEXT_MAX_SIZE_MILS 10000 ///< Maximum text size in mils (10 inches)
|
||||
// These are only here for algorithmic safety, not to tell the user what to do.
|
||||
// PL_EDITOR has the least resolution (its internal units are microns), so the min size is chosen
|
||||
// to yield 1 in PL_EDITOR.
|
||||
// The max size chosen is somewhat arbitrary, but no one has complained yet.
|
||||
#define TEXT_MIN_SIZE_MM 0.001 ///< Minimum text size (1 micron).
|
||||
#define TEXT_MAX_SIZE_MM 250.0 ///< Maximum text size in mm (~10 inches)
|
||||
|
||||
|
||||
namespace KIGFX
|
||||
|
|
|
@ -670,8 +670,8 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
|
|||
},
|
||||
{} ) );
|
||||
|
||||
int minTextSize = pcbIUScale.MilsToIU( TEXT_MIN_SIZE_MILS );
|
||||
int maxTextSize = pcbIUScale.MilsToIU( TEXT_MAX_SIZE_MILS );
|
||||
int minTextSize = pcbIUScale.mmToIU( TEXT_MIN_SIZE_MM );
|
||||
int maxTextSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM );
|
||||
int minStroke = 1;
|
||||
int maxStroke = pcbIUScale.mmToIU( 100 );
|
||||
|
||||
|
|
|
@ -377,8 +377,8 @@ bool DIALOG_FOOTPRINT_PROPERTIES::Validate()
|
|||
return false;
|
||||
}
|
||||
|
||||
int minSize = pcbIUScale.MilsToIU( TEXT_MIN_SIZE_MILS );
|
||||
int maxSize = pcbIUScale.MilsToIU( TEXT_MAX_SIZE_MILS );
|
||||
int minSize = pcbIUScale.mmToIU( TEXT_MIN_SIZE_MM );
|
||||
int maxSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM );
|
||||
int width = m_frame->ValueFromString( m_itemsGrid->GetCellValue( i, FPT_WIDTH ) );
|
||||
int height = m_frame->ValueFromString( m_itemsGrid->GetCellValue( i, FPT_HEIGHT ) );
|
||||
|
||||
|
|
|
@ -425,8 +425,8 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::Validate()
|
|||
return false;
|
||||
}
|
||||
|
||||
int minSize = pcbIUScale.MilsToIU( TEXT_MIN_SIZE_MILS );
|
||||
int maxSize = pcbIUScale.MilsToIU( TEXT_MAX_SIZE_MILS );
|
||||
int minSize = pcbIUScale.mmToIU( TEXT_MIN_SIZE_MM );
|
||||
int maxSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM );
|
||||
|
||||
if( field.GetTextWidth() < minSize || field.GetTextWidth() > maxSize )
|
||||
{
|
||||
|
|
|
@ -511,8 +511,8 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( BOARD_COMMIT& aCommit, BOA
|
|||
|
||||
bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
|
||||
{
|
||||
int minTextSize = pcbIUScale.MilsToIU( TEXT_MIN_SIZE_MILS );
|
||||
int maxTextSize = pcbIUScale.MilsToIU( TEXT_MAX_SIZE_MILS );
|
||||
int minTextSize = pcbIUScale.mmToIU( TEXT_MIN_SIZE_MM );
|
||||
int maxTextSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM );
|
||||
|
||||
if( !m_textWidth.Validate( minTextSize, maxTextSize )
|
||||
|| !m_textHeight.Validate( minTextSize, maxTextSize ) )
|
||||
|
|
|
@ -428,8 +428,8 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
|
|||
if( !DIALOG_TEXT_PROPERTIES_BASE::TransferDataFromWindow() )
|
||||
return false;
|
||||
|
||||
int minSize = pcbIUScale.MilsToIU( TEXT_MIN_SIZE_MILS );
|
||||
int maxSize = pcbIUScale.MilsToIU( TEXT_MAX_SIZE_MILS );
|
||||
int minSize = pcbIUScale.mmToIU( TEXT_MIN_SIZE_MM );
|
||||
int maxSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM );
|
||||
|
||||
if( !m_textWidth.Validate( minSize, maxSize ) || !m_textHeight.Validate( minSize, maxSize ) )
|
||||
return false;
|
||||
|
|
|
@ -290,8 +290,8 @@ bool DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow()
|
|||
if( !DIALOG_TEXTBOX_PROPERTIES_BASE::TransferDataFromWindow() )
|
||||
return false;
|
||||
|
||||
int minSize = pcbIUScale.MilsToIU( TEXT_MIN_SIZE_MILS );
|
||||
int maxSize = pcbIUScale.MilsToIU( TEXT_MAX_SIZE_MILS );
|
||||
int minSize = pcbIUScale.mmToIU( TEXT_MIN_SIZE_MM );
|
||||
int maxSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM );
|
||||
|
||||
if( !m_textWidth.Validate( minSize, maxSize ) || !m_textHeight.Validate( minSize, maxSize ) )
|
||||
return false;
|
||||
|
|
|
@ -361,8 +361,8 @@ bool PANEL_FP_EDITOR_DEFAULTS::TransferDataFromWindow()
|
|||
// A minimal value for sizes and thickness:
|
||||
const int minWidth = pcbIUScale.mmToIU( MINIMUM_LINE_WIDTH_MM );
|
||||
const int maxWidth = pcbIUScale.mmToIU( MAXIMUM_LINE_WIDTH_MM );
|
||||
const int minSize = pcbIUScale.MilsToIU( TEXT_MIN_SIZE_MILS );
|
||||
const int maxSize = pcbIUScale.MilsToIU( TEXT_MAX_SIZE_MILS );
|
||||
const int minSize = pcbIUScale.mmToIU( TEXT_MIN_SIZE_MM );
|
||||
const int maxSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM );
|
||||
wxString errorsMsg;
|
||||
|
||||
for( int i = 0; i < ROW_COUNT; ++i )
|
||||
|
|
|
@ -205,8 +205,8 @@ bool PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataFromWindow()
|
|||
// A minimal value for sizes and thickness
|
||||
const int minWidth = pcbIUScale.mmToIU( MINIMUM_LINE_WIDTH_MM );
|
||||
const int maxWidth = pcbIUScale.mmToIU( MAXIMUM_LINE_WIDTH_MM );
|
||||
const int minSize = pcbIUScale.MilsToIU( TEXT_MIN_SIZE_MILS );
|
||||
const int maxSize = pcbIUScale.MilsToIU( TEXT_MAX_SIZE_MILS );
|
||||
const int minSize = pcbIUScale.mmToIU( TEXT_MIN_SIZE_MM );
|
||||
const int maxSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM );
|
||||
wxString errorsMsg;
|
||||
UNITS_PROVIDER* unitProvider = m_Frame;
|
||||
|
||||
|
|
|
@ -184,8 +184,8 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
|
|||
{ "${REFERENCE}", true, F_Fab }
|
||||
} ) ) );
|
||||
|
||||
int minTextSize = pcbIUScale.MilsToIU( TEXT_MIN_SIZE_MILS );
|
||||
int maxTextSize = pcbIUScale.MilsToIU( TEXT_MAX_SIZE_MILS );
|
||||
int minTextSize = pcbIUScale.mmToIU( TEXT_MIN_SIZE_MM );
|
||||
int maxTextSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM );
|
||||
int minStroke = 1;
|
||||
int maxStroke = pcbIUScale.mmToIU( 100 );
|
||||
|
||||
|
|
Loading…
Reference in New Issue