Fix some issues with incorrectly scaled defaults given in mils.

This commit is contained in:
Jeff Young 2021-08-25 19:36:37 +01:00
parent ed39b33d74
commit 69fac89e86
12 changed files with 33 additions and 33 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2016-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -42,13 +42,13 @@
#define DEFAULTSELECTIONTHICKNESS 3
///< The default line width in mils. (can be changed in preference menu)
#define DEFAULT_LINE_THICKNESS 6
#define DEFAULT_LINE_WIDTH_MILS 6
///< The default wire width in mils. (can be changed in preference menu)
#define DEFAULT_WIRE_THICKNESS 6
#define DEFAULT_WIRE_WIDTH_MILS 6
///< The default bus width in mils. (can be changed in preference menu)
#define DEFAULT_BUS_THICKNESS 12
#define DEFAULT_BUS_WIDTH_MILS 12
///< The default noconnect size in mils.
#define DEFAULT_NOCONNECT_SIZE 48

View File

@ -120,7 +120,7 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
&m_AutoplaceFields.align_to_grid, true ) );
m_params.emplace_back( new PARAM<int>( "drawing.default_bus_thickness",
&m_Drawing.default_bus_thickness, DEFAULT_BUS_THICKNESS ) );
&m_Drawing.default_bus_thickness, DEFAULT_BUS_WIDTH_MILS ) );
m_params.emplace_back( new PARAM<int>( "drawing.default_junction_size",
&m_Drawing.default_junction_size, DEFAULT_JUNCTION_DIAM ) );
@ -128,11 +128,11 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
m_params.emplace_back( new PARAM<int>( "drawing.pin_symbol_size",
&m_Drawing.pin_symbol_size, DEFAULT_TEXT_SIZE / 2 ) );
m_params.emplace_back(
new PARAM<double>( "drawing.text_offset_ratio", &m_Drawing.text_offset_ratio, 0.08 ) );
m_params.emplace_back( new PARAM<double>( "drawing.text_offset_ratio",
&m_Drawing.text_offset_ratio, 0.08 ) );
m_params.emplace_back( new PARAM<int>( "drawing.default_line_thickness",
&m_Drawing.default_line_thickness, DEFAULT_LINE_THICKNESS ) );
&m_Drawing.default_line_thickness, DEFAULT_LINE_WIDTH_MILS ) );
m_params.emplace_back( new PARAM<int>( "drawing.default_repeat_offset_x",
&m_Drawing.default_repeat_offset_x, 0 ) );
@ -141,10 +141,10 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
&m_Drawing.default_repeat_offset_y, 100 ) );
m_params.emplace_back( new PARAM<int>( "drawing.default_wire_thickness",
&m_Drawing.default_wire_thickness, DEFAULT_WIRE_THICKNESS ) );
&m_Drawing.default_wire_thickness, DEFAULT_WIRE_WIDTH_MILS ) );
m_params.emplace_back( new PARAM<int>(
"drawing.default_text_size", &m_Drawing.default_text_size, DEFAULT_TEXT_SIZE ) );
m_params.emplace_back( new PARAM<int>( "drawing.default_text_size",
&m_Drawing.default_text_size, DEFAULT_TEXT_SIZE ) );
m_params.emplace_back( new PARAM<wxString>( "drawing.field_names",
&m_Drawing.field_names, "" ) );

View File

@ -182,7 +182,7 @@ int SCH_BUS_WIRE_ENTRY::GetPenWidth() const
if( Schematic() )
return std::max( Schematic()->Settings().m_DefaultWireThickness, 1 );
return DEFAULT_WIRE_THICKNESS;
return Mils2iu( DEFAULT_WIRE_WIDTH_MILS );
}
@ -199,7 +199,7 @@ int SCH_BUS_BUS_ENTRY::GetPenWidth() const
if( Schematic() )
return std::max( Schematic()->Settings().m_DefaultBusThickness, 1 );
return DEFAULT_BUS_THICKNESS;
return Mils2iu( DEFAULT_BUS_WIDTH_MILS );
}

View File

@ -151,7 +151,7 @@ typedef std::unordered_set<SCH_ITEM*> SCH_ITEM_SET;
class STROKE_PARAMS
{
public:
STROKE_PARAMS( int aWidth = Mils2iu( DEFAULT_LINE_THICKNESS ),
STROKE_PARAMS( int aWidth = Mils2iu( DEFAULT_LINE_WIDTH_MILS ),
PLOT_DASH_TYPE aPlotStyle = PLOT_DASH_TYPE::DEFAULT,
const COLOR4D& aColor = COLOR4D::UNSPECIFIED ) :
m_width( aWidth ),

View File

@ -287,7 +287,7 @@ int SCH_LINE::GetPenWidth() const
if( Schematic() )
return Schematic()->Settings().m_DefaultLineWidth;
return DEFAULT_LINE_THICKNESS;
return Mils2iu( DEFAULT_LINE_WIDTH_MILS );
case LAYER_WIRE:
if( m_stroke.GetWidth() > 0 )
@ -299,7 +299,7 @@ int SCH_LINE::GetPenWidth() const
if( Schematic() )
return Schematic()->Settings().m_DefaultWireThickness;
return DEFAULT_WIRE_THICKNESS;
return Mils2iu( DEFAULT_WIRE_WIDTH_MILS );
case LAYER_BUS:
if( m_stroke.GetWidth() > 0 )
@ -311,7 +311,7 @@ int SCH_LINE::GetPenWidth() const
if( Schematic() )
return Schematic()->Settings().m_DefaultBusThickness;
return DEFAULT_BUS_THICKNESS;
return Mils2iu( DEFAULT_BUS_WIDTH_MILS );
}
}

View File

@ -81,12 +81,12 @@ SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS() :
m_OverrideItemColors( false ),
m_LabelSizeRatio( DEFAULT_LABEL_SIZE_RATIO ),
m_TextOffsetRatio( DEFAULT_TEXT_OFFSET_RATIO ),
m_DefaultWireThickness( DEFAULT_WIRE_THICKNESS * IU_PER_MILS ),
m_DefaultBusThickness( DEFAULT_BUS_THICKNESS * IU_PER_MILS ),
m_DefaultWireThickness( DEFAULT_WIRE_WIDTH_MILS * IU_PER_MILS ),
m_DefaultBusThickness( DEFAULT_BUS_WIDTH_MILS * IU_PER_MILS ),
m_PinSymbolSize( DEFAULT_TEXT_SIZE * IU_PER_MILS / 2 ),
m_JunctionSize( DEFAULT_JUNCTION_DIAM * IU_PER_MILS )
{
SetDefaultPenWidth( DEFAULT_LINE_THICKNESS * IU_PER_MILS );
SetDefaultPenWidth( DEFAULT_LINE_WIDTH_MILS * IU_PER_MILS );
m_minPenWidth = ADVANCED_CFG::GetCfg().m_MinPlotPenWidth * IU_PER_MM;
}

View File

@ -477,7 +477,7 @@ void SCH_SEXPR_PARSER::parseStroke( STROKE_PARAMS& aStroke )
wxCHECK_RET( CurTok() == T_stroke,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a stroke." ) );
aStroke.SetWidth( Mils2iu( DEFAULT_LINE_THICKNESS ) );
aStroke.SetWidth( Mils2iu( DEFAULT_LINE_WIDTH_MILS ) );
aStroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
aStroke.SetColor( COLOR4D::UNSPECIFIED );

View File

@ -514,7 +514,7 @@ int SCH_SHEET::GetPenWidth() const
if( Schematic() )
return Schematic()->Settings().m_DefaultLineWidth;
return DEFAULT_LINE_THICKNESS;
return Mils2iu( DEFAULT_LINE_WIDTH_MILS );
}

View File

@ -100,7 +100,7 @@ int SCH_SHEET_PIN::GetPenWidth() const
if( Schematic() )
return Schematic()->Settings().m_DefaultLineWidth;
return DEFAULT_LINE_THICKNESS;
return Mils2iu( DEFAULT_LINE_WIDTH_MILS );
}

View File

@ -38,9 +38,9 @@ const int schSettingsSchemaVersion = 1;
SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
NESTED_SETTINGS( "schematic", schSettingsSchemaVersion, aParent, aPath ),
m_DefaultLineWidth( DEFAULT_LINE_THICKNESS * IU_PER_MILS ),
m_DefaultWireThickness( DEFAULT_WIRE_THICKNESS * IU_PER_MILS ),
m_DefaultBusThickness( DEFAULT_BUS_THICKNESS * IU_PER_MILS ),
m_DefaultLineWidth( DEFAULT_LINE_WIDTH_MILS * IU_PER_MILS ),
m_DefaultWireThickness( DEFAULT_WIRE_WIDTH_MILS * IU_PER_MILS ),
m_DefaultBusThickness( DEFAULT_BUS_WIDTH_MILS * IU_PER_MILS ),
m_DefaultTextSize( DEFAULT_TEXT_SIZE * IU_PER_MILS ),
m_LabelSizeRatio( DEFAULT_LABEL_SIZE_RATIO ),
m_TextOffsetRatio( DEFAULT_TEXT_OFFSET_RATIO ),
@ -59,11 +59,11 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
EESCHEMA_SETTINGS* appSettings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
int defaultLineThickness =
appSettings ? appSettings->m_Drawing.default_line_thickness : DEFAULT_LINE_THICKNESS;
appSettings ? appSettings->m_Drawing.default_line_thickness : DEFAULT_LINE_WIDTH_MILS;
int defaultWireThickness =
appSettings ? appSettings->m_Drawing.default_wire_thickness : DEFAULT_WIRE_THICKNESS;
appSettings ? appSettings->m_Drawing.default_wire_thickness : DEFAULT_WIRE_WIDTH_MILS;
int defaultBusThickness =
appSettings ? appSettings->m_Drawing.default_bus_thickness : DEFAULT_BUS_THICKNESS;
appSettings ? appSettings->m_Drawing.default_bus_thickness : DEFAULT_BUS_WIDTH_MILS;
int defaultTextSize =
appSettings ? appSettings->m_Drawing.default_text_size : DEFAULT_TEXT_SIZE;
int defaultPinSymbolSize =

View File

@ -47,7 +47,7 @@ SYMBOL_EDITOR_SETTINGS::SYMBOL_EDITOR_SETTINGS() :
SetLegacyFilename( "eeschema" );
m_params.emplace_back( new PARAM<int>( "defaults.line_width",
&m_Defaults.line_width, DEFAULT_LINE_THICKNESS ) );
&m_Defaults.line_width, DEFAULT_LINE_WIDTH_MILS ) );
m_params.emplace_back( new PARAM<int>( "defaults.text_size",
&m_Defaults.text_size, DEFAULT_TEXT_SIZE ) );

View File

@ -143,7 +143,7 @@ SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAM
GetRenderSettings()->m_ShowHiddenText = true;
GetRenderSettings()->m_ShowHiddenPins = true;
GetRenderSettings()->SetDefaultPenWidth( DEFAULT_LINE_THICKNESS * IU_PER_MILS );
GetRenderSettings()->SetDefaultPenWidth( DEFAULT_LINE_WIDTH_MILS * IU_PER_MILS );
setupTools();
setupUIConditions();