Remove atrophied schematic default wire and bus widths.

(They're now in the netclasses, and specifically the default netclass
if no other netclass is assigned.)

Fixes https://gitlab.com/kicad/code/kicad/issues/9628
This commit is contained in:
Jeff Young 2021-11-13 22:55:46 +00:00
parent bef43f975d
commit 025d9f82ea
8 changed files with 23 additions and 37 deletions

View File

@ -81,8 +81,6 @@ bool SCH_EDIT_FRAME::LoadProjectSettings()
settings.m_JunctionSize = GetSchematicJunctionSize();
GetRenderSettings()->SetDefaultPenWidth( settings.m_DefaultLineWidth );
GetRenderSettings()->m_DefaultWireThickness = settings.m_DefaultWireThickness;
GetRenderSettings()->m_DefaultBusThickness = settings.m_DefaultBusThickness;
GetRenderSettings()->m_LabelSizeRatio = settings.m_LabelSizeRatio;
GetRenderSettings()->m_TextOffsetRatio = settings.m_TextOffsetRatio;
GetRenderSettings()->m_PinSymbolSize = settings.m_PinSymbolSize;

View File

@ -178,12 +178,12 @@ int SCH_BUS_WIRE_ENTRY::GetPenWidth() const
NETCLASSPTR netclass = NetClass();
if( !netclass && Schematic() )
netclass = Schematic()->Prj().GetProjectFile().NetSettings().m_NetClasses.GetDefault();
if( netclass )
return netclass->GetWireWidth();
if( Schematic() )
return std::max( Schematic()->Settings().m_DefaultWireThickness, 1 );
return Mils2iu( DEFAULT_WIRE_WIDTH_MILS );
}
@ -195,12 +195,12 @@ int SCH_BUS_BUS_ENTRY::GetPenWidth() const
NETCLASSPTR netclass = NetClass();
if( !netclass && Schematic() )
netclass = Schematic()->Prj().GetProjectFile().NetSettings().m_NetClasses.GetDefault();
if( netclass )
return netclass->GetBusWidth();
if( Schematic() )
return std::max( Schematic()->Settings().m_DefaultBusThickness, 1 );
return Mils2iu( DEFAULT_BUS_WIDTH_MILS );
}

View File

@ -280,7 +280,7 @@ void SCH_LINE::SetLineWidth( const int aSize )
int SCH_LINE::GetPenWidth() const
{
NETCLASSPTR netclass = NetClass();
NETCLASSPTR netclass;
switch ( m_layer )
{
@ -297,24 +297,28 @@ int SCH_LINE::GetPenWidth() const
if( m_stroke.GetWidth() > 0 )
return m_stroke.GetWidth();
netclass = NetClass();
if( !netclass && Schematic() )
netclass = Schematic()->Prj().GetProjectFile().NetSettings().m_NetClasses.GetDefault();
if( netclass )
return netclass->GetWireWidth();
if( Schematic() )
return Schematic()->Settings().m_DefaultWireThickness;
return Mils2iu( DEFAULT_WIRE_WIDTH_MILS );
case LAYER_BUS:
if( m_stroke.GetWidth() > 0 )
return m_stroke.GetWidth();
netclass = NetClass();
if( !netclass && Schematic() )
netclass = Schematic()->Prj().GetProjectFile().NetSettings().m_NetClasses.GetDefault();
if( netclass )
return netclass->GetBusWidth();
if( Schematic() )
return Schematic()->Settings().m_DefaultBusThickness;
return Mils2iu( DEFAULT_BUS_WIDTH_MILS );
}
}

View File

@ -78,8 +78,6 @@ 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_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 )
{
@ -345,7 +343,7 @@ float SCH_PAINTER::getLineWidth( const LIB_ITEM* aItem, bool aDrawingShadows ) c
float SCH_PAINTER::getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows ) const
{
wxCHECK( aItem, static_cast<float>( m_schSettings.m_DefaultWireThickness ) );
wxCHECK( aItem, static_cast<float>( Mils2iu( DEFAULT_WIRE_WIDTH_MILS ) ) );
float width = (float) aItem->GetPenWidth();

View File

@ -119,8 +119,6 @@ public:
double m_TextOffsetRatio; // Proportion of font size to offset text above/below
// wires, buses, etc.
int m_DefaultWireThickness;
int m_DefaultBusThickness;
int m_PinSymbolSize;
int m_JunctionSize;
};

View File

@ -2379,7 +2379,7 @@ int CADSTAR_SCH_ARCHIVE_LOADER::getLineThickness( const LINECODE_ID& aCadstarLin
{
wxCHECK( Assignments.Codedefs.LineCodes.find( aCadstarLineCodeID )
!= Assignments.Codedefs.LineCodes.end(),
m_schematic->Settings().m_DefaultWireThickness );
Mils2iu( DEFAULT_WIRE_WIDTH_MILS ) );
return getKiCadLength( Assignments.Codedefs.LineCodes.at( aCadstarLineCodeID ).Width );
}

View File

@ -38,8 +38,6 @@ 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_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 ),
@ -99,14 +97,6 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
&m_DefaultLineWidth, Mils2iu( defaultLineThickness ), Mils2iu( 5 ), Mils2iu( 1000 ),
1 / IU_PER_MILS ) );
m_params.emplace_back( new PARAM_SCALED<int>( "drawing.default_wire_thickness",
&m_DefaultWireThickness, Mils2iu( defaultWireThickness ), Mils2iu( 5 ), Mils2iu( 1000 ),
1 / IU_PER_MILS ) );
m_params.emplace_back( new PARAM_SCALED<int>( "drawing.default_bus_thickness",
&m_DefaultBusThickness, Mils2iu( defaultBusThickness ),
Mils2iu( 5 ), Mils2iu( 1000 ), 1 / IU_PER_MILS ) );
m_params.emplace_back( new PARAM_SCALED<int>( "drawing.default_text_size",
&m_DefaultTextSize, Mils2iu( defaultTextSize ), Mils2iu( 5 ), Mils2iu( 1000 ),
1 / IU_PER_MILS ) );

View File

@ -45,8 +45,6 @@ public:
// Default sizes are all stored in IU here, and in mils in the JSON file
int m_DefaultLineWidth;
int m_DefaultWireThickness;
int m_DefaultBusThickness;
int m_DefaultTextSize;
double m_LabelSizeRatio;
double m_TextOffsetRatio;