User configurability of pin electrical symbol size.

Also fixes a bug where a bunch of eeschema settings weren't getting
loaded because it looked like they were larger than the max value
(which wasn't being scaled from mils to internal units).

Fixes https://gitlab.com/kicad/code/kicad/issues/2089
This commit is contained in:
Jeff Young 2020-05-04 00:55:31 +01:00
parent da1a89fc7e
commit c155d80213
13 changed files with 288 additions and 40 deletions

View File

@ -36,6 +36,7 @@ PANEL_SETUP_FORMATTING::PANEL_SETUP_FORMATTING( wxWindow* aWindow, SCH_EDIT_FRAM
m_lineWidth( aFrame, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits, true ), m_lineWidth( aFrame, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits, true ),
m_busWidth( aFrame, m_busWidthLabel, m_busWidthCtrl, m_busWidthUnits, true ), m_busWidth( aFrame, m_busWidthLabel, m_busWidthCtrl, m_busWidthUnits, true ),
m_wireWidth( aFrame, m_wireWidthLabel, m_wireWidthCtrl, m_wireWidthUnits, true ), m_wireWidth( aFrame, m_wireWidthLabel, m_wireWidthCtrl, m_wireWidthUnits, true ),
m_pinSymbolSize( aFrame, m_pinSymbolSizeLabel, m_pinSymbolSizeCtrl, m_pinSymbolSizeUnits, true ),
m_junctionSize( aFrame, m_jctSizeLabel, m_jctSizeCtrl, m_jctSizeUnits, true ) m_junctionSize( aFrame, m_jctSizeLabel, m_jctSizeCtrl, m_jctSizeUnits, true )
{ {
} }
@ -61,12 +62,14 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
m_lineWidth.SetUnits( EDA_UNITS::INCHES, true ); m_lineWidth.SetUnits( EDA_UNITS::INCHES, true );
m_busWidth.SetUnits( EDA_UNITS::INCHES, true ); m_busWidth.SetUnits( EDA_UNITS::INCHES, true );
m_wireWidth.SetUnits( EDA_UNITS::INCHES, true ); m_wireWidth.SetUnits( EDA_UNITS::INCHES, true );
m_pinSymbolSize.SetUnits( EDA_UNITS::INCHES, true );
m_junctionSize.SetUnits( EDA_UNITS::INCHES, true ); m_junctionSize.SetUnits( EDA_UNITS::INCHES, true );
m_textSize.SetValue( m_frame->GetDefaultTextSize() ); m_textSize.SetValue( m_frame->GetDefaultTextSize() );
m_lineWidth.SetValue( m_frame->GetDefaultLineWidth() ); m_lineWidth.SetValue( m_frame->GetDefaultLineWidth() );
m_busWidth.SetValue( m_frame->GetDefaultBusThickness() ); m_busWidth.SetValue( m_frame->GetDefaultBusThickness() );
m_wireWidth.SetValue( m_frame->GetDefaultWireThickness() ); m_wireWidth.SetValue( m_frame->GetDefaultWireThickness() );
m_pinSymbolSize.SetValue( m_frame->GetPinSymbolSize() );
m_junctionSize.SetValue( SCH_JUNCTION::g_SymbolSize ); m_junctionSize.SetValue( SCH_JUNCTION::g_SymbolSize );
wxString offsetRatio = wxString::Format( "%f", m_frame->GetTextOffsetRatio() * 100.0 ); wxString offsetRatio = wxString::Format( "%f", m_frame->GetTextOffsetRatio() * 100.0 );
@ -104,6 +107,7 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
m_frame->SetDefaultLineWidth( (int) m_lineWidth.GetValue() ); m_frame->SetDefaultLineWidth( (int) m_lineWidth.GetValue() );
m_frame->SetDefaultWireThickness( (int) m_wireWidth.GetValue() ); m_frame->SetDefaultWireThickness( (int) m_wireWidth.GetValue() );
m_frame->SetDefaultBusThickness( (int) m_busWidth.GetValue() ); m_frame->SetDefaultBusThickness( (int) m_busWidth.GetValue() );
m_frame->SetPinSymbolSize( (int) m_pinSymbolSize.GetValue() );
SCH_JUNCTION::g_SymbolSize = (int) m_junctionSize.GetValue(); SCH_JUNCTION::g_SymbolSize = (int) m_junctionSize.GetValue();
double dtmp = 0.0; double dtmp = 0.0;
@ -115,6 +119,7 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
m_frame->GetRenderSettings()->m_DefaultWireThickness = m_frame->GetDefaultWireThickness(); m_frame->GetRenderSettings()->m_DefaultWireThickness = m_frame->GetDefaultWireThickness();
m_frame->GetRenderSettings()->m_DefaultBusThickness = m_frame->GetDefaultBusThickness(); m_frame->GetRenderSettings()->m_DefaultBusThickness = m_frame->GetDefaultBusThickness();
m_frame->GetRenderSettings()->m_TextOffsetRatio = m_frame->GetTextOffsetRatio(); m_frame->GetRenderSettings()->m_TextOffsetRatio = m_frame->GetTextOffsetRatio();
m_frame->GetRenderSettings()->m_PinSymbolSize = m_frame->GetPinSymbolSize();
m_frame->GetCanvas()->GetView()->MarkDirty(); m_frame->GetCanvas()->GetView()->MarkDirty();
m_frame->GetCanvas()->GetView()->UpdateAllItems( KIGFX::REPAINT ); m_frame->GetCanvas()->GetView()->UpdateAllItems( KIGFX::REPAINT );

View File

@ -36,6 +36,7 @@ class PANEL_SETUP_FORMATTING : public PANEL_SETUP_FORMATTING_BASE
UNIT_BINDER m_busWidth; UNIT_BINDER m_busWidth;
UNIT_BINDER m_wireWidth; UNIT_BINDER m_wireWidth;
UNIT_BINDER m_pinSymbolSize;
UNIT_BINDER m_junctionSize; UNIT_BINDER m_junctionSize;
public: public:

View File

@ -98,6 +98,17 @@ PANEL_SETUP_FORMATTING_BASE::PANEL_SETUP_FORMATTING_BASE( wxWindow* parent, wxWi
m_lineWidthUnits->Wrap( -1 ); m_lineWidthUnits->Wrap( -1 );
fgSizer321->Add( m_lineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); fgSizer321->Add( m_lineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_pinSymbolSizeLabel = new wxStaticText( sbSizer41->GetStaticBox(), wxID_ANY, _("Pin symbol size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinSymbolSizeLabel->Wrap( -1 );
fgSizer321->Add( m_pinSymbolSizeLabel, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_pinSymbolSizeCtrl = new wxTextCtrl( sbSizer41->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer321->Add( m_pinSymbolSizeCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_pinSymbolSizeUnits = new wxStaticText( sbSizer41->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinSymbolSizeUnits->Wrap( -1 );
fgSizer321->Add( m_pinSymbolSizeUnits, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
sbSizer41->Add( fgSizer321, 1, wxEXPAND|wxBOTTOM, 5 ); sbSizer41->Add( fgSizer321, 1, wxEXPAND|wxBOTTOM, 5 );

View File

@ -831,6 +831,192 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Pin symbol size:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_pinSymbolSizeLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_pinSymbolSizeCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">mils</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_pinSymbolSizeUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
</object> </object>
</object> </object>
</object> </object>

View File

@ -43,6 +43,9 @@ class PANEL_SETUP_FORMATTING_BASE : public wxPanel
wxStaticText* m_lineWidthLabel; wxStaticText* m_lineWidthLabel;
wxTextCtrl* m_lineWidthCtrl; wxTextCtrl* m_lineWidthCtrl;
wxStaticText* m_lineWidthUnits; wxStaticText* m_lineWidthUnits;
wxStaticText* m_pinSymbolSizeLabel;
wxTextCtrl* m_pinSymbolSizeCtrl;
wxStaticText* m_pinSymbolSizeUnits;
wxStaticText* m_busWidthLabel; wxStaticText* m_busWidthLabel;
wxTextCtrl* m_busWidthCtrl; wxTextCtrl* m_busWidthCtrl;
wxStaticText* m_busWidthUnits; wxStaticText* m_busWidthUnits;

View File

@ -273,35 +273,39 @@ void SCH_EDIT_FRAME::AddFormattingParameters( std::vector<PARAM_CFG*>& params )
wxCHECK( appSettings, /*void*/ ); wxCHECK( appSettings, /*void*/ );
params.push_back( new PARAM_CFG_INT( wxT( "SubpartIdSeparator" ), params.push_back( new PARAM_CFG_INT( wxT( "SubpartIdSeparator" ),
LIB_PART::SubpartIdSeparatorPtr(), 0, 0, 126 ) ); LIB_PART::SubpartIdSeparatorPtr(), 0, 0, 126 ) );
params.push_back( new PARAM_CFG_INT( wxT( "SubpartFirstId" ), params.push_back( new PARAM_CFG_INT( wxT( "SubpartFirstId" ),
LIB_PART::SubpartFirstIdPtr(), 'A', '1', 'z' ) ); LIB_PART::SubpartFirstIdPtr(), 'A', '1', 'z' ) );
params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "LabSize" ), params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "LabSize" ),
&m_defaultTextSize, &m_defaultTextSize,
Mils2iu( DEFAULT_SIZE_TEXT ), Mils2iu( DEFAULT_SIZE_TEXT ),
5, 1000, nullptr, 1 / IU_PER_MILS ) ); Mils2iu( 5 ), Mils2iu( 1000 ), nullptr, 1 / IU_PER_MILS ) );
params.push_back( new PARAM_CFG_DOUBLE( wxT( "TextOffsetRatio" ), params.push_back( new PARAM_CFG_DOUBLE( wxT( "TextOffsetRatio" ),
&m_textOffsetRatio, &m_textOffsetRatio,
(double) TXT_MARGIN / DEFAULT_SIZE_TEXT, (double) TXT_MARGIN / DEFAULT_SIZE_TEXT,
-200.0, 200.0 ) ); -200.0, 200.0 ) );
params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "LineThickness" ), params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "LineThickness" ),
&m_defaultLineWidth, &m_defaultLineWidth,
Mils2iu( appSettings->m_Drawing.default_line_thickness ), Mils2iu( appSettings->m_Drawing.default_line_thickness ),
5, 1000, nullptr, 1 / IU_PER_MILS ) ); Mils2iu( 5 ), Mils2iu( 1000 ), nullptr, 1 / IU_PER_MILS ) );
params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "BusThickness" ), params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "BusThickness" ),
&m_defaultBusThickness, &m_defaultBusThickness,
Mils2iu( appSettings->m_Drawing.default_bus_thickness ), Mils2iu( appSettings->m_Drawing.default_bus_thickness ),
5, 1000, nullptr, 1 / IU_PER_MILS ) ); Mils2iu( 5 ), Mils2iu( 1000 ), nullptr, 1 / IU_PER_MILS ) );
params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "WireThickness" ), params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "WireThickness" ),
&m_defaultWireThickness, &m_defaultWireThickness,
Mils2iu( appSettings->m_Drawing.default_wire_thickness ), Mils2iu( appSettings->m_Drawing.default_wire_thickness ),
5, 1000, nullptr, 1 / IU_PER_MILS ) ); Mils2iu( 5 ), Mils2iu( 1000 ), nullptr, 1 / IU_PER_MILS ) );
params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PinSymbolSize" ),
&m_pinSymbolSize,
Mils2iu( appSettings->m_Drawing.pin_symbol_size ),
Mils2iu( 5 ), Mils2iu( 1000 ), nullptr, 1 / IU_PER_MILS ) );
params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "JunctionSize" ), params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "JunctionSize" ),
&SCH_JUNCTION::g_SymbolSize, &SCH_JUNCTION::g_SymbolSize,
Mils2iu( appSettings->m_Drawing.default_junction_size ), Mils2iu( appSettings->m_Drawing.default_junction_size ),
5, 1000, nullptr, 1 / IU_PER_MILS ) ); Mils2iu( 5 ), Mils2iu( 1000 ), nullptr, 1 / IU_PER_MILS ) );
} }
@ -329,7 +333,7 @@ std::vector<PARAM_CFG*>& SCH_EDIT_FRAME::GetProjectFileParameters()
} }
std::vector<PARAM_CFG*> ERC_SETTINGS::GetProjectFileParameters() std::vector<PARAM_CFG*> ERC_SETTINGS::GetProjectFileParameters()
{ {
std::vector<PARAM_CFG*> params; std::vector<PARAM_CFG*> params;
@ -348,6 +352,7 @@ bool SCH_EDIT_FRAME::LoadProjectFile()
GetRenderSettings()->m_DefaultWireThickness = GetDefaultWireThickness(); GetRenderSettings()->m_DefaultWireThickness = GetDefaultWireThickness();
GetRenderSettings()->m_DefaultBusThickness = GetDefaultBusThickness(); GetRenderSettings()->m_DefaultBusThickness = GetDefaultBusThickness();
GetRenderSettings()->m_TextOffsetRatio = m_textOffsetRatio; GetRenderSettings()->m_TextOffsetRatio = m_textOffsetRatio;
GetRenderSettings()->m_PinSymbolSize = m_pinSymbolSize;
// Verify some values, because the config file can be edited by hand, // Verify some values, because the config file can be edited by hand,
// and have bad values: // and have bad values:

View File

@ -86,6 +86,9 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : APP_SETTINGS_BASE( "eeschema", eeschema
m_params.emplace_back( new PARAM<int>( "drawing.default_junction_size", m_params.emplace_back( new PARAM<int>( "drawing.default_junction_size",
&m_Drawing.default_junction_size, DEFAULT_JUNCTION_DIAM ) ); &m_Drawing.default_junction_size, DEFAULT_JUNCTION_DIAM ) );
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<int>( "drawing.default_line_thickness", 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_THICKNESS ) );

View File

@ -64,6 +64,7 @@ public:
int default_repeat_offset_x; int default_repeat_offset_x;
int default_repeat_offset_y; int default_repeat_offset_y;
int default_wire_thickness; int default_wire_thickness;
int pin_symbol_size;
COLOR4D default_sheet_border_color; COLOR4D default_sheet_border_color;
COLOR4D default_sheet_background_color; COLOR4D default_sheet_background_color;
wxString field_names; wxString field_names;

View File

@ -54,6 +54,7 @@
#include <trace_helpers.h> #include <trace_helpers.h>
#include <libedit/libedit_settings.h> #include <libedit/libedit_settings.h>
#include <default_values.h> #include <default_values.h>
#include "sch_painter.h"
static const int pin_orientation_codes[] = static const int pin_orientation_codes[] =
{ {
@ -132,8 +133,12 @@ static const wxString getPinOrientationName( unsigned aPinOrientationCode )
// i.e. the clock symbols (falling clock is actually external but is of // i.e. the clock symbols (falling clock is actually external but is of
// the same kind) // the same kind)
static int InternalPinDecoSize( const LIB_PIN &aPin ) static int internalPinDecoSize( RENDER_SETTINGS* aSettings, const LIB_PIN &aPin )
{ {
KIGFX::SCH_RENDER_SETTINGS* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aSettings );
if( settings && settings->m_PinSymbolSize )
return settings->m_PinSymbolSize;
return aPin.GetNameTextSize() != 0 ? aPin.GetNameTextSize() / 2 : aPin.GetNumberTextSize() / 2; return aPin.GetNameTextSize() != 0 ? aPin.GetNameTextSize() / 2 : aPin.GetNumberTextSize() / 2;
} }
@ -141,8 +146,13 @@ static int InternalPinDecoSize( const LIB_PIN &aPin )
/// Utility for getting the size of the 'external' pin decorators (as a radius) /// Utility for getting the size of the 'external' pin decorators (as a radius)
// i.e. the negation circle, the polarity 'slopes' and the nonlogic // i.e. the negation circle, the polarity 'slopes' and the nonlogic
// marker // marker
static int ExternalPinDecoSize( const LIB_PIN &aPin ) static int externalPinDecoSize( RENDER_SETTINGS* aSettings, const LIB_PIN &aPin )
{ {
KIGFX::SCH_RENDER_SETTINGS* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aSettings );
if( settings && settings->m_PinSymbolSize )
return settings->m_PinSymbolSize;
return aPin.GetNumberTextSize() / 2; return aPin.GetNumberTextSize() / 2;
} }
@ -607,7 +617,7 @@ void LIB_PIN::PrintPinSymbol( RENDER_SETTINGS* aSettings, const wxPoint& aPos, i
if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK ) if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
{ {
const int radius = ExternalPinDecoSize( *this ); const int radius = externalPinDecoSize( aSettings, *this );
GRCircle( nullptr, DC, MapX1 * radius + x1, MapY1 * radius + y1, radius, width, color ); GRCircle( nullptr, DC, MapX1 * radius + x1, MapY1 * radius + y1, radius, width, color );
GRMoveTo( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 ); GRMoveTo( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 );
@ -624,7 +634,7 @@ void LIB_PIN::PrintPinSymbol( RENDER_SETTINGS* aSettings, const wxPoint& aPos, i
|| m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK || m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK
|| m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW ) || m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
{ {
const int clock_size = InternalPinDecoSize( *this ); const int clock_size = internalPinDecoSize( aSettings, *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */ if( MapY1 == 0 ) /* MapX1 = +- 1 */
{ {
GRMoveTo( x1, y1 + clock_size ); GRMoveTo( x1, y1 + clock_size );
@ -643,7 +653,7 @@ void LIB_PIN::PrintPinSymbol( RENDER_SETTINGS* aSettings, const wxPoint& aPos, i
if( m_shape == GRAPHIC_PINSHAPE::INPUT_LOW || m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK if( m_shape == GRAPHIC_PINSHAPE::INPUT_LOW || m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK
|| m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW ) || m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
{ {
const int deco_size = ExternalPinDecoSize( *this ); const int deco_size = externalPinDecoSize( aSettings, *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */ if( MapY1 == 0 ) /* MapX1 = +- 1 */
{ {
GRMoveTo( x1 + MapX1 * deco_size * 2, y1 ); GRMoveTo( x1 + MapX1 * deco_size * 2, y1 );
@ -660,7 +670,7 @@ void LIB_PIN::PrintPinSymbol( RENDER_SETTINGS* aSettings, const wxPoint& aPos, i
if( m_shape == GRAPHIC_PINSHAPE::OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */ if( m_shape == GRAPHIC_PINSHAPE::OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
{ {
const int deco_size = ExternalPinDecoSize( *this ); const int deco_size = externalPinDecoSize( aSettings, *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */ if( MapY1 == 0 ) /* MapX1 = +- 1 */
{ {
GRMoveTo( x1, y1 - deco_size * 2 ); GRMoveTo( x1, y1 - deco_size * 2 );
@ -674,7 +684,7 @@ void LIB_PIN::PrintPinSymbol( RENDER_SETTINGS* aSettings, const wxPoint& aPos, i
} }
else if( m_shape == GRAPHIC_PINSHAPE::NONLOGIC ) /* NonLogic pin symbol */ else if( m_shape == GRAPHIC_PINSHAPE::NONLOGIC ) /* NonLogic pin symbol */
{ {
const int deco_size = ExternalPinDecoSize( *this ); const int deco_size = externalPinDecoSize( aSettings, *this );
GRMoveTo( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size ); GRMoveTo( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size );
GRLineTo( nullptr, DC, x1 + (MapX1 + MapY1) * deco_size, GRLineTo( nullptr, DC, x1 + (MapX1 + MapY1) * deco_size,
y1 + ( MapY1 - MapX1 ) * deco_size, width, color ); y1 + ( MapY1 - MapX1 ) * deco_size, width, color );
@ -910,7 +920,7 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK ) if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
{ {
const int radius = ExternalPinDecoSize( *this ); const int radius = externalPinDecoSize( aPlotter->RenderSettings(), *this );
aPlotter->Circle( wxPoint( MapX1 * radius + x1, MapY1 * radius + y1 ), radius * 2, aPlotter->Circle( wxPoint( MapX1 * radius + x1, MapY1 * radius + y1 ), radius * 2,
NO_FILL, penWidth ); NO_FILL, penWidth );
@ -919,7 +929,7 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
} }
else if( m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK ) else if( m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK )
{ {
const int deco_size = InternalPinDecoSize( *this ); const int deco_size = internalPinDecoSize( aPlotter->RenderSettings(), *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */ if( MapY1 == 0 ) /* MapX1 = +- 1 */
{ {
aPlotter->MoveTo( wxPoint( x1, y1 + deco_size ) ); aPlotter->MoveTo( wxPoint( x1, y1 + deco_size ) );
@ -945,7 +955,7 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
if( m_shape == GRAPHIC_PINSHAPE::CLOCK || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK if( m_shape == GRAPHIC_PINSHAPE::CLOCK || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK
|| m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW ) || m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
{ {
const int deco_size = InternalPinDecoSize( *this ); const int deco_size = internalPinDecoSize( aPlotter->RenderSettings(), *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */ if( MapY1 == 0 ) /* MapX1 = +- 1 */
{ {
aPlotter->MoveTo( wxPoint( x1, y1 + deco_size ) ); aPlotter->MoveTo( wxPoint( x1, y1 + deco_size ) );
@ -963,7 +973,7 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
if( m_shape == GRAPHIC_PINSHAPE::INPUT_LOW if( m_shape == GRAPHIC_PINSHAPE::INPUT_LOW
|| m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW ) /* IEEE symbol "Active Low Input" */ || m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW ) /* IEEE symbol "Active Low Input" */
{ {
const int deco_size = ExternalPinDecoSize( *this ); const int deco_size = externalPinDecoSize( aPlotter->RenderSettings(), *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */ if( MapY1 == 0 ) /* MapX1 = +- 1 */
{ {
@ -982,7 +992,7 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
if( m_shape == GRAPHIC_PINSHAPE::OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */ if( m_shape == GRAPHIC_PINSHAPE::OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
{ {
const int symbol_size = ExternalPinDecoSize( *this ); const int symbol_size = externalPinDecoSize( aPlotter->RenderSettings(), *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */ if( MapY1 == 0 ) /* MapX1 = +- 1 */
{ {
@ -997,7 +1007,7 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
} }
else if( m_shape == GRAPHIC_PINSHAPE::NONLOGIC ) /* NonLogic pin symbol */ else if( m_shape == GRAPHIC_PINSHAPE::NONLOGIC ) /* NonLogic pin symbol */
{ {
const int deco_size = ExternalPinDecoSize( *this ); const int deco_size = externalPinDecoSize( aPlotter->RenderSettings(), *this );
aPlotter->MoveTo( wxPoint( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size ) ); aPlotter->MoveTo( wxPoint( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size ) );
aPlotter->FinishTo( wxPoint( x1 + (MapX1 + MapY1) * deco_size, y1 + (MapY1 - MapX1) * deco_size ) ); aPlotter->FinishTo( wxPoint( x1 + (MapX1 + MapY1) * deco_size, y1 + (MapY1 - MapX1) * deco_size ) );
aPlotter->MoveTo( wxPoint( x1 - (MapX1 - MapY1) * deco_size, y1 - (MapY1 + MapX1) * deco_size ) ); aPlotter->MoveTo( wxPoint( x1 - (MapX1 - MapY1) * deco_size, y1 - (MapY1 + MapX1) * deco_size ) );
@ -1511,7 +1521,7 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles ) const
int numberTextHeight = showNum ? KiROUND( m_numTextSize * 1.1 ) : 0; int numberTextHeight = showNum ? KiROUND( m_numTextSize * 1.1 ) : 0;
if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK ) if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
minsizeV = std::max( TARGET_PIN_RADIUS, ExternalPinDecoSize( *this ) ); minsizeV = std::max( TARGET_PIN_RADIUS, externalPinDecoSize( nullptr, *this ) );
// calculate top left corner position // calculate top left corner position
// for the default pin orientation (PIN_RIGHT) // for the default pin orientation (PIN_RIGHT)

View File

@ -88,6 +88,7 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
m_defaultBusThickness( DEFAULT_BUS_THICKNESS * IU_PER_MILS ), m_defaultBusThickness( DEFAULT_BUS_THICKNESS * IU_PER_MILS ),
m_defaultTextSize( DEFAULT_TEXT_SIZE * IU_PER_MILS ), m_defaultTextSize( DEFAULT_TEXT_SIZE * IU_PER_MILS ),
m_textOffsetRatio( 0.08 ), m_textOffsetRatio( 0.08 ),
m_pinSymbolSize( DEFAULT_TEXT_SIZE * IU_PER_MILS / 2 ),
m_showPinElectricalTypeName( false ) m_showPinElectricalTypeName( false )
{ {
createCanvas(); createCanvas();
@ -148,6 +149,13 @@ void SCH_BASE_FRAME::SetDefaultBusThickness( int aThickness )
} }
void SCH_BASE_FRAME::SetPinSymbolSize( int aSize )
{
m_pinSymbolSize = aSize;
GetRenderSettings()->m_PinSymbolSize = aSize;
}
void SCH_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings ) void SCH_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
{ {
GetScreen()->SetPageSettings( aPageSettings ); GetScreen()->SetPageSettings( aPageSettings );

View File

@ -93,6 +93,7 @@ protected:
int m_defaultBusThickness; int m_defaultBusThickness;
int m_defaultTextSize; int m_defaultTextSize;
double m_textOffsetRatio; double m_textOffsetRatio;
int m_pinSymbolSize;
TEMPLATES m_templateFieldNames; TEMPLATES m_templateFieldNames;
@ -140,6 +141,9 @@ public:
int GetDefaultBusThickness() const { return m_defaultBusThickness; } int GetDefaultBusThickness() const { return m_defaultBusThickness; }
void SetDefaultBusThickness( int aThickness ); void SetDefaultBusThickness( int aThickness );
int GetPinSymbolSize() const { return m_pinSymbolSize; }
void SetPinSymbolSize( int aSize );
int GetDefaultTextSize() const { return m_defaultTextSize; } int GetDefaultTextSize() const { return m_defaultTextSize; }
void SetDefaultTextSize( int aSize ) { m_defaultTextSize = aSize; } void SetDefaultTextSize( int aSize ) { m_defaultTextSize = aSize; }

View File

@ -77,7 +77,8 @@ SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS() :
m_OverrideItemColors( false ), m_OverrideItemColors( false ),
m_TextOffsetRatio( 0.08 ), m_TextOffsetRatio( 0.08 ),
m_DefaultWireThickness( DEFAULT_WIRE_THICKNESS * IU_PER_MILS ), m_DefaultWireThickness( DEFAULT_WIRE_THICKNESS * IU_PER_MILS ),
m_DefaultBusThickness( DEFAULT_BUS_THICKNESS * IU_PER_MILS ) m_DefaultBusThickness( DEFAULT_BUS_THICKNESS * IU_PER_MILS ),
m_PinSymbolSize( DEFAULT_TEXT_SIZE * IU_PER_MILS / 2 )
{ {
SetDefaultPenWidth( DEFAULT_LINE_THICKNESS * IU_PER_MILS ); SetDefaultPenWidth( DEFAULT_LINE_THICKNESS * IU_PER_MILS );
} }
@ -691,16 +692,22 @@ void SCH_PAINTER::draw( LIB_TEXT *aText, int aLayer )
} }
static int InternalPinDecoSize( const LIB_PIN &aPin ) int SCH_PAINTER::internalPinDecoSize( const LIB_PIN &aPin )
{ {
if( m_schSettings.m_PinSymbolSize > 0 )
return m_schSettings.m_PinSymbolSize;
return aPin.GetNameTextSize() != 0 ? aPin.GetNameTextSize() / 2 : aPin.GetNumberTextSize() / 2; return aPin.GetNameTextSize() != 0 ? aPin.GetNameTextSize() / 2 : aPin.GetNumberTextSize() / 2;
} }
// Utility for getting the size of the 'external' pin decorators (as a radius) // Utility for getting the size of the 'external' pin decorators (as a radius)
// i.e. the negation circle, the polarity 'slopes' and the nonlogic marker // i.e. the negation circle, the polarity 'slopes' and the nonlogic marker
static int ExternalPinDecoSize( const LIB_PIN &aPin ) int SCH_PAINTER::externalPinDecoSize( const LIB_PIN &aPin )
{ {
if( m_schSettings.m_PinSymbolSize > 0 )
return m_schSettings.m_PinSymbolSize;
return aPin.GetNumberTextSize() / 2; return aPin.GetNumberTextSize() / 2;
} }
@ -782,9 +789,9 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
m_gal->SetFontBold( false ); m_gal->SetFontBold( false );
m_gal->SetFontItalic( false ); m_gal->SetFontItalic( false );
const int radius = ExternalPinDecoSize( *aPin ); const int radius = externalPinDecoSize( *aPin );
const int diam = radius*2; const int diam = radius*2;
const int clock_size = InternalPinDecoSize( *aPin ); const int clock_size = internalPinDecoSize( *aPin );
if( aPin->GetType() == ELECTRICAL_PINTYPE::PT_NC ) // Draw a N.C. symbol if( aPin->GetType() == ELECTRICAL_PINTYPE::PT_NC ) // Draw a N.C. symbol
{ {

View File

@ -115,6 +115,7 @@ public:
int m_DefaultWireThickness; int m_DefaultWireThickness;
int m_DefaultBusThickness; int m_DefaultBusThickness;
int m_PinSymbolSize;
}; };
@ -168,6 +169,9 @@ private:
void drawPinDanglingSymbol( const VECTOR2I& aPos, bool aDrawingShadows ); void drawPinDanglingSymbol( const VECTOR2I& aPos, bool aDrawingShadows );
void drawDanglingSymbol( const wxPoint& aPos, bool aDrawingShadows ); void drawDanglingSymbol( const wxPoint& aPos, bool aDrawingShadows );
int internalPinDecoSize( const LIB_PIN &aPin );
int externalPinDecoSize( const LIB_PIN &aPin );
bool isUnitAndConversionShown( const LIB_ITEM* aItem ); bool isUnitAndConversionShown( const LIB_ITEM* aItem );
float getShadowWidth(); float getShadowWidth();