diff --git a/eeschema/dialogs/panel_setup_formatting.cpp b/eeschema/dialogs/panel_setup_formatting.cpp index f115ae17dc..7f5ec452eb 100644 --- a/eeschema/dialogs/panel_setup_formatting.cpp +++ b/eeschema/dialogs/panel_setup_formatting.cpp @@ -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_busWidth( aFrame, m_busWidthLabel, m_busWidthCtrl, m_busWidthUnits, 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 ) { } @@ -61,12 +62,14 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow() m_lineWidth.SetUnits( EDA_UNITS::INCHES, true ); m_busWidth.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_textSize.SetValue( m_frame->GetDefaultTextSize() ); m_lineWidth.SetValue( m_frame->GetDefaultLineWidth() ); m_busWidth.SetValue( m_frame->GetDefaultBusThickness() ); m_wireWidth.SetValue( m_frame->GetDefaultWireThickness() ); + m_pinSymbolSize.SetValue( m_frame->GetPinSymbolSize() ); m_junctionSize.SetValue( SCH_JUNCTION::g_SymbolSize ); 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->SetDefaultWireThickness( (int) m_wireWidth.GetValue() ); m_frame->SetDefaultBusThickness( (int) m_busWidth.GetValue() ); + m_frame->SetPinSymbolSize( (int) m_pinSymbolSize.GetValue() ); SCH_JUNCTION::g_SymbolSize = (int) m_junctionSize.GetValue(); 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_DefaultBusThickness = m_frame->GetDefaultBusThickness(); 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()->UpdateAllItems( KIGFX::REPAINT ); diff --git a/eeschema/dialogs/panel_setup_formatting.h b/eeschema/dialogs/panel_setup_formatting.h index 227621897a..231121b40a 100644 --- a/eeschema/dialogs/panel_setup_formatting.h +++ b/eeschema/dialogs/panel_setup_formatting.h @@ -36,6 +36,7 @@ class PANEL_SETUP_FORMATTING : public PANEL_SETUP_FORMATTING_BASE UNIT_BINDER m_busWidth; UNIT_BINDER m_wireWidth; + UNIT_BINDER m_pinSymbolSize; UNIT_BINDER m_junctionSize; public: diff --git a/eeschema/dialogs/panel_setup_formatting_base.cpp b/eeschema/dialogs/panel_setup_formatting_base.cpp index 26c20d4dcc..e4621745cc 100644 --- a/eeschema/dialogs/panel_setup_formatting_base.cpp +++ b/eeschema/dialogs/panel_setup_formatting_base.cpp @@ -98,6 +98,17 @@ PANEL_SETUP_FORMATTING_BASE::PANEL_SETUP_FORMATTING_BASE( wxWindow* parent, wxWi m_lineWidthUnits->Wrap( -1 ); 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 ); diff --git a/eeschema/dialogs/panel_setup_formatting_base.fbp b/eeschema/dialogs/panel_setup_formatting_base.fbp index 7677630ae5..c26c19b8cd 100644 --- a/eeschema/dialogs/panel_setup_formatting_base.fbp +++ b/eeschema/dialogs/panel_setup_formatting_base.fbp @@ -831,6 +831,192 @@ -1 + + 5 + wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Pin symbol size: + 0 + + 0 + + + 0 + + 1 + m_pinSymbolSizeLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_pinSymbolSizeCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + mils + 0 + + 0 + + + 0 + + 1 + m_pinSymbolSizeUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + diff --git a/eeschema/dialogs/panel_setup_formatting_base.h b/eeschema/dialogs/panel_setup_formatting_base.h index 9c0de8e5d3..6f1f0fd1fb 100644 --- a/eeschema/dialogs/panel_setup_formatting_base.h +++ b/eeschema/dialogs/panel_setup_formatting_base.h @@ -43,6 +43,9 @@ class PANEL_SETUP_FORMATTING_BASE : public wxPanel wxStaticText* m_lineWidthLabel; wxTextCtrl* m_lineWidthCtrl; wxStaticText* m_lineWidthUnits; + wxStaticText* m_pinSymbolSizeLabel; + wxTextCtrl* m_pinSymbolSizeCtrl; + wxStaticText* m_pinSymbolSizeUnits; wxStaticText* m_busWidthLabel; wxTextCtrl* m_busWidthCtrl; wxStaticText* m_busWidthUnits; diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index c89a65223d..bf51d2c12d 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -273,35 +273,39 @@ void SCH_EDIT_FRAME::AddFormattingParameters( std::vector& params ) wxCHECK( appSettings, /*void*/ ); 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" ), - LIB_PART::SubpartFirstIdPtr(), 'A', '1', 'z' ) ); + LIB_PART::SubpartFirstIdPtr(), 'A', '1', 'z' ) ); params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "LabSize" ), - &m_defaultTextSize, - Mils2iu( DEFAULT_SIZE_TEXT ), - 5, 1000, nullptr, 1 / IU_PER_MILS ) ); + &m_defaultTextSize, + Mils2iu( DEFAULT_SIZE_TEXT ), + Mils2iu( 5 ), Mils2iu( 1000 ), nullptr, 1 / IU_PER_MILS ) ); params.push_back( new PARAM_CFG_DOUBLE( wxT( "TextOffsetRatio" ), - &m_textOffsetRatio, - (double) TXT_MARGIN / DEFAULT_SIZE_TEXT, - -200.0, 200.0 ) ); + &m_textOffsetRatio, + (double) TXT_MARGIN / DEFAULT_SIZE_TEXT, + -200.0, 200.0 ) ); params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "LineThickness" ), - &m_defaultLineWidth, - Mils2iu( appSettings->m_Drawing.default_line_thickness ), - 5, 1000, nullptr, 1 / IU_PER_MILS ) ); + &m_defaultLineWidth, + Mils2iu( appSettings->m_Drawing.default_line_thickness ), + Mils2iu( 5 ), Mils2iu( 1000 ), nullptr, 1 / IU_PER_MILS ) ); params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "BusThickness" ), - &m_defaultBusThickness, - Mils2iu( appSettings->m_Drawing.default_bus_thickness ), - 5, 1000, nullptr, 1 / IU_PER_MILS ) ); + &m_defaultBusThickness, + Mils2iu( appSettings->m_Drawing.default_bus_thickness ), + Mils2iu( 5 ), Mils2iu( 1000 ), nullptr, 1 / IU_PER_MILS ) ); params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "WireThickness" ), - &m_defaultWireThickness, - Mils2iu( appSettings->m_Drawing.default_wire_thickness ), - 5, 1000, nullptr, 1 / IU_PER_MILS ) ); + &m_defaultWireThickness, + Mils2iu( appSettings->m_Drawing.default_wire_thickness ), + 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" ), - &SCH_JUNCTION::g_SymbolSize, - Mils2iu( appSettings->m_Drawing.default_junction_size ), - 5, 1000, nullptr, 1 / IU_PER_MILS ) ); + &SCH_JUNCTION::g_SymbolSize, + Mils2iu( appSettings->m_Drawing.default_junction_size ), + Mils2iu( 5 ), Mils2iu( 1000 ), nullptr, 1 / IU_PER_MILS ) ); } @@ -329,7 +333,7 @@ std::vector& SCH_EDIT_FRAME::GetProjectFileParameters() } -std::vector ERC_SETTINGS::GetProjectFileParameters() +std::vector ERC_SETTINGS::GetProjectFileParameters() { std::vector params; @@ -348,6 +352,7 @@ bool SCH_EDIT_FRAME::LoadProjectFile() GetRenderSettings()->m_DefaultWireThickness = GetDefaultWireThickness(); GetRenderSettings()->m_DefaultBusThickness = GetDefaultBusThickness(); GetRenderSettings()->m_TextOffsetRatio = m_textOffsetRatio; + GetRenderSettings()->m_PinSymbolSize = m_pinSymbolSize; // Verify some values, because the config file can be edited by hand, // and have bad values: diff --git a/eeschema/eeschema_settings.cpp b/eeschema/eeschema_settings.cpp index 5512d5a841..901b804e1e 100644 --- a/eeschema/eeschema_settings.cpp +++ b/eeschema/eeschema_settings.cpp @@ -86,6 +86,9 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : APP_SETTINGS_BASE( "eeschema", eeschema m_params.emplace_back( new PARAM( "drawing.default_junction_size", &m_Drawing.default_junction_size, DEFAULT_JUNCTION_DIAM ) ); + m_params.emplace_back( new PARAM( "drawing.pin_symbol_size", + &m_Drawing.pin_symbol_size, DEFAULT_TEXT_SIZE / 2 ) ); + m_params.emplace_back( new PARAM( "drawing.default_line_thickness", &m_Drawing.default_line_thickness, DEFAULT_LINE_THICKNESS ) ); diff --git a/eeschema/eeschema_settings.h b/eeschema/eeschema_settings.h index 1304485bc8..cf6df58b59 100644 --- a/eeschema/eeschema_settings.h +++ b/eeschema/eeschema_settings.h @@ -64,6 +64,7 @@ public: int default_repeat_offset_x; int default_repeat_offset_y; int default_wire_thickness; + int pin_symbol_size; COLOR4D default_sheet_border_color; COLOR4D default_sheet_background_color; wxString field_names; diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 010b1542b3..3fdb1be414 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -54,6 +54,7 @@ #include #include #include +#include "sch_painter.h" 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 // 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( aSettings ); + + if( settings && settings->m_PinSymbolSize ) + return settings->m_PinSymbolSize; 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) // i.e. the negation circle, the polarity 'slopes' and the nonlogic // 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( aSettings ); + + if( settings && settings->m_PinSymbolSize ) + return settings->m_PinSymbolSize; + 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 ) { - const int radius = ExternalPinDecoSize( *this ); + const int radius = externalPinDecoSize( aSettings, *this ); GRCircle( nullptr, DC, MapX1 * radius + x1, MapY1 * radius + y1, radius, width, color ); 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::CLOCK_LOW ) { - const int clock_size = InternalPinDecoSize( *this ); + const int clock_size = internalPinDecoSize( aSettings, *this ); if( MapY1 == 0 ) /* MapX1 = +- 1 */ { 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 || m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW ) { - const int deco_size = ExternalPinDecoSize( *this ); + const int deco_size = externalPinDecoSize( aSettings, *this ); if( MapY1 == 0 ) /* MapX1 = +- 1 */ { 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" */ { - const int deco_size = ExternalPinDecoSize( *this ); + const int deco_size = externalPinDecoSize( aSettings, *this ); if( MapY1 == 0 ) /* MapX1 = +- 1 */ { 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 */ { - const int deco_size = ExternalPinDecoSize( *this ); + const int deco_size = externalPinDecoSize( aSettings, *this ); GRMoveTo( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size ); GRLineTo( nullptr, DC, x1 + (MapX1 + MapY1) * deco_size, 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 ) { - const int radius = ExternalPinDecoSize( *this ); + const int radius = externalPinDecoSize( aPlotter->RenderSettings(), *this ); aPlotter->Circle( wxPoint( MapX1 * radius + x1, MapY1 * radius + y1 ), radius * 2, 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 ) { - const int deco_size = InternalPinDecoSize( *this ); + const int deco_size = internalPinDecoSize( aPlotter->RenderSettings(), *this ); if( MapY1 == 0 ) /* MapX1 = +- 1 */ { 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 || 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 */ { 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 || 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 */ { @@ -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" */ { - const int symbol_size = ExternalPinDecoSize( *this ); + const int symbol_size = externalPinDecoSize( aPlotter->RenderSettings(), *this ); 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 */ { - 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->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 ) ); @@ -1511,7 +1521,7 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles ) const int numberTextHeight = showNum ? KiROUND( m_numTextSize * 1.1 ) : 0; 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 // for the default pin orientation (PIN_RIGHT) diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index 7975bf3453..751941973e 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -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_defaultTextSize( DEFAULT_TEXT_SIZE * IU_PER_MILS ), m_textOffsetRatio( 0.08 ), + m_pinSymbolSize( DEFAULT_TEXT_SIZE * IU_PER_MILS / 2 ), m_showPinElectricalTypeName( false ) { 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 ) { GetScreen()->SetPageSettings( aPageSettings ); diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h index 1d1276e6ae..5206cc0721 100644 --- a/eeschema/sch_base_frame.h +++ b/eeschema/sch_base_frame.h @@ -93,6 +93,7 @@ protected: int m_defaultBusThickness; int m_defaultTextSize; double m_textOffsetRatio; + int m_pinSymbolSize; TEMPLATES m_templateFieldNames; @@ -140,6 +141,9 @@ public: int GetDefaultBusThickness() const { return m_defaultBusThickness; } void SetDefaultBusThickness( int aThickness ); + int GetPinSymbolSize() const { return m_pinSymbolSize; } + void SetPinSymbolSize( int aSize ); + int GetDefaultTextSize() const { return m_defaultTextSize; } void SetDefaultTextSize( int aSize ) { m_defaultTextSize = aSize; } diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 47fdcba940..964c2d8c10 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -77,7 +77,8 @@ SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS() : m_OverrideItemColors( false ), m_TextOffsetRatio( 0.08 ), 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 ); } @@ -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; } // 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 -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; } @@ -782,9 +789,9 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer ) m_gal->SetFontBold( false ); m_gal->SetFontItalic( false ); - const int radius = ExternalPinDecoSize( *aPin ); + const int radius = externalPinDecoSize( *aPin ); 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 { diff --git a/eeschema/sch_painter.h b/eeschema/sch_painter.h index 13729aae9e..9a422ee867 100644 --- a/eeschema/sch_painter.h +++ b/eeschema/sch_painter.h @@ -115,6 +115,7 @@ public: int m_DefaultWireThickness; int m_DefaultBusThickness; + int m_PinSymbolSize; }; @@ -168,6 +169,9 @@ private: void drawPinDanglingSymbol( const VECTOR2I& 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 ); float getShadowWidth();