From 216acd98d673e81ec18b5ec2ba56cfbd112178f1 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 30 Jun 2019 11:12:18 +0100 Subject: [PATCH] Separate default line and wire thicknesses. Fixes: lp:1834324 * https://bugs.launchpad.net/kicad/+bug/1834324 --- .../panel_eeschema_display_options.cpp | 21 +- .../dialogs/panel_eeschema_display_options.h | 5 + .../panel_eeschema_display_options_base.cpp | 16 +- .../panel_eeschema_display_options_base.fbp | 1392 ++++++++--------- .../panel_eeschema_display_options_base.h | 6 +- eeschema/eeschema_config.cpp | 28 +- eeschema/general.h | 6 + eeschema/sch_bus_entry.cpp | 2 +- eeschema/sch_line.cpp | 9 +- 9 files changed, 763 insertions(+), 722 deletions(-) diff --git a/eeschema/dialogs/panel_eeschema_display_options.cpp b/eeschema/dialogs/panel_eeschema_display_options.cpp index 0f98b45475..6334f94819 100644 --- a/eeschema/dialogs/panel_eeschema_display_options.cpp +++ b/eeschema/dialogs/panel_eeschema_display_options.cpp @@ -35,7 +35,10 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS::PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow ) : PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( aWindow ), - m_frame( aFrame ) + m_frame( aFrame ), + m_busWidth( aFrame, m_busWidthLabel, m_busWidthCtrl, m_busWidthUnits, true ), + m_wireWidth( aFrame, m_wireWidthLabel, m_wireWidthCtrl, m_wireWidthUnits, true ), + m_junctionSize( aFrame, m_jctSizeLabel, m_jctSizeCtrl, m_jctSizeUnits, true ) { KIGFX::GAL_DISPLAY_OPTIONS& galOptions = m_frame->GetGalDisplayOptions(); m_galOptsPanel = new GAL_OPTIONS_PANEL( this, galOptions ); @@ -60,9 +63,13 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow() m_choiceSeparatorRefId->SetSelection( refStyleSelection ); - m_busWidthCtrl->SetValue( StringFromValue( INCHES, GetDefaultBusThickness(), false, true ) ); - m_lineWidthCtrl->SetValue( StringFromValue( INCHES, GetDefaultLineThickness(), false, true ) ); - m_jctSizeCtrl->SetValue( StringFromValue( INCHES, SCH_JUNCTION::GetSymbolSize(), false, true ) ); + m_busWidth.SetUnits( INCHES, true ); + m_wireWidth.SetUnits( INCHES, true ); + m_junctionSize.SetUnits( INCHES, true ); + + m_busWidth.SetValue( GetDefaultBusThickness() ); + m_wireWidth.SetValue( GetDefaultWireThickness() ); + m_junctionSize.SetValue( SCH_JUNCTION::GetSymbolSize() ); m_checkShowHiddenPins->SetValue( m_frame->GetShowAllPins() ); m_checkPageLimits->SetValue( m_frame->ShowPageLimits() ); @@ -96,9 +103,9 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow() m_frame->SaveProjectSettings( false ); } - SetDefaultBusThickness( ValueFromString( INCHES, m_busWidthCtrl->GetValue(), true ) ); - SetDefaultLineThickness( ValueFromString( INCHES, m_lineWidthCtrl->GetValue(), true ) ); - SCH_JUNCTION::SetSymbolSize( ValueFromString( INCHES, m_jctSizeCtrl->GetValue(), true ) ); + SetDefaultBusThickness( m_busWidth.GetValue() ); + SetDefaultWireThickness( m_wireWidth.GetValue() ); + SCH_JUNCTION::SetSymbolSize( m_junctionSize.GetValue() ); m_frame->SetShowAllPins( m_checkShowHiddenPins->GetValue() ); m_frame->SetShowPageLimits( m_checkPageLimits->GetValue() ); diff --git a/eeschema/dialogs/panel_eeschema_display_options.h b/eeschema/dialogs/panel_eeschema_display_options.h index ca83c64a2f..d9d0409fba 100644 --- a/eeschema/dialogs/panel_eeschema_display_options.h +++ b/eeschema/dialogs/panel_eeschema_display_options.h @@ -20,6 +20,7 @@ #ifndef KICAD_PANEL_EESCHEMA_DISPLAY_OPTIONS_H #define KICAD_PANEL_EESCHEMA_DISPLAY_OPTIONS_H +#include #include "panel_eeschema_display_options_base.h" class SCH_EDIT_FRAME; @@ -32,6 +33,10 @@ class PANEL_EESCHEMA_DISPLAY_OPTIONS : public PANEL_EESCHEMA_DISPLAY_OPTIONS_BAS GAL_OPTIONS_PANEL* m_galOptsPanel; + UNIT_BINDER m_busWidth; + UNIT_BINDER m_wireWidth; + UNIT_BINDER m_junctionSize; + public: PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow ); diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.cpp b/eeschema/dialogs/panel_eeschema_display_options_base.cpp index 601f36c676..a415bc476b 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.cpp +++ b/eeschema/dialogs/panel_eeschema_display_options_base.cpp @@ -42,16 +42,16 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind m_busWidthUnits->Wrap( -1 ); fgSizer32->Add( m_busWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - m_lineWidthLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("&Line thickness:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_lineWidthLabel->Wrap( -1 ); - fgSizer32->Add( m_lineWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + m_wireWidthLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("&Wire thickness:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_wireWidthLabel->Wrap( -1 ); + fgSizer32->Add( m_wireWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - m_lineWidthCtrl = new wxTextCtrl( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP ); - fgSizer32->Add( m_lineWidthCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + m_wireWidthCtrl = new wxTextCtrl( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP ); + fgSizer32->Add( m_wireWidthCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - m_lineWidthUnits = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); - m_lineWidthUnits->Wrap( -1 ); - fgSizer32->Add( m_lineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + m_wireWidthUnits = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); + m_wireWidthUnits->Wrap( -1 ); + fgSizer32->Add( m_wireWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); m_jctSizeLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Junction size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_jctSizeLabel->Wrap( -1 ); diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.fbp b/eeschema/dialogs/panel_eeschema_display_options_base.fbp index b75c8bcce3..1cf0093de2 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.fbp +++ b/eeschema/dialogs/panel_eeschema_display_options_base.fbp @@ -1,8 +1,8 @@ - + - + C++ 1 source_name @@ -16,9 +16,9 @@ none 1 PanelEeschemaDisplayOptions - + . - + 1 1 1 @@ -29,57 +29,57 @@ 0 wxAUI_MGR_DEFAULT - - + + 1 1 impl_virtual - - + + 0 wxID_ANY - - + + PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE - + -1,-1 ; forward_declare - - - + + + wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + bPanelSizer wxHORIZONTAL none @@ -88,7 +88,7 @@ wxEXPAND|wxLEFT 1 - + m_galOptionsSizer wxVERTICAL protected @@ -99,7 +99,7 @@ wxEXPAND|wxRIGHT|wxLEFT 1 - + bRightColumn wxVERTICAL none @@ -110,12 +110,12 @@ wxID_ANY Dimensions - + sbSizer2 wxVERTICAL 1 none - + 5 wxBOTTOM|wxRIGHT|wxEXPAND @@ -124,7 +124,7 @@ 3 wxBOTH 1 - + 0 -1,-1 fgSizer32 @@ -141,78 +141,78 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY &Bus thickness: - + 0 - - + + 0 - + 1 m_busWidthLabel 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -224,86 +224,86 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - + 0 - - - + + + 0 - + 1 m_busWidthCtrl 1 - - + + protected 1 - + Resizable 1 - + wxSP_ARROW_KEYS|wxSP_WRAP - + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -315,78 +315,78 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY mils - + 0 - - + + 0 - + 1 m_busWidthUnits 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -398,78 +398,78 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - &Line thickness: - + &Wire thickness: + 0 - - + + 0 - + 1 - m_lineWidthLabel + m_wireWidthLabel 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -481,86 +481,86 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - + 0 - - - + + + 0 - + 1 - m_lineWidthCtrl + m_wireWidthCtrl 1 - - + + protected 1 - + Resizable 1 - + wxSP_ARROW_KEYS|wxSP_WRAP - + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -572,78 +572,78 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY mils - + 0 - - + + 0 - + 1 - m_lineWidthUnits + m_wireWidthUnits 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -655,78 +655,78 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Junction size: - + 0 - - + + 0 - + 1 m_jctSizeLabel 1 - - + + protected 1 - + Resizable 1 - - + + ; forward_declare 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -738,86 +738,86 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - + 0 - - - + + + 0 - + 1 m_jctSizeCtrl 1 - - + + protected 1 - + Resizable 1 - - + + ; forward_declare 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -829,78 +829,78 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY mils - + 0 - - + + 0 - + 1 m_jctSizeUnits 1 - - + + protected 1 - + Resizable 1 - - + + ; forward_declare 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -914,18 +914,18 @@ wxID_ANY Annotations - + sbSizer1 wxVERTICAL 1 none - + 5 wxEXPAND|wxRIGHT 0 - + bSizer6 wxHORIZONTAL none @@ -938,78 +938,78 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Symbol unit notation: - + 0 - - + + 0 - + 1 m_staticText26 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1021,83 +1021,83 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 "A" ".A" "-A" "_A" ".1" "-1" "_1" 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - + 0 - - + + 0 - + 1 m_choiceSeparatorRefId 1 - - + + protected 1 - + Resizable 0 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1121,83 +1121,83 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY S&how hidden pins - + 0 - - + + 0 - + 1 m_checkShowHiddenPins 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1209,83 +1209,83 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Show page limi&ts - + 0 - - + + 0 - + 1 m_checkPageLimits 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.h b/eeschema/dialogs/panel_eeschema_display_options_base.h index 1aaffc7a17..b01bb547d3 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.h +++ b/eeschema/dialogs/panel_eeschema_display_options_base.h @@ -38,9 +38,9 @@ class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE : public wxPanel wxStaticText* m_busWidthLabel; wxTextCtrl* m_busWidthCtrl; wxStaticText* m_busWidthUnits; - wxStaticText* m_lineWidthLabel; - wxTextCtrl* m_lineWidthCtrl; - wxStaticText* m_lineWidthUnits; + wxStaticText* m_wireWidthLabel; + wxTextCtrl* m_wireWidthCtrl; + wxStaticText* m_wireWidthUnits; wxStaticText* m_jctSizeLabel; wxTextCtrl* m_jctSizeCtrl; wxStaticText* m_jctSizeUnits; diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 166582c239..0128aff96e 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -73,6 +73,24 @@ void SetDefaultBusThickness( int aThickness) } +static int s_defaultWireThickness = DEFAULTDRAWLINETHICKNESS; + + +int GetDefaultWireThickness() +{ + return s_defaultWireThickness; +} + + +void SetDefaultWireThickness( int aThickness ) +{ + if( aThickness >=1 ) + s_defaultWireThickness = aThickness; + else + s_defaultWireThickness = 1; +} + + /// Default size for text (not only labels) static int s_defaultTextSize = DEFAULT_SIZE_TEXT; @@ -318,6 +336,7 @@ const wxChar AutoplaceJustifyEntry[] = wxT( "AutoplaceJustify" ); const wxChar AutoplaceAlignEntry[] = wxT( "AutoplaceAlign" ); static const wxChar FootprintPreviewEntry[] = wxT( "FootprintPreview" ); static const wxChar DefaultBusWidthEntry[] = wxT( "DefaultBusWidth" ); +static const wxChar DefaultWireWidthEntry[] = wxT( "DefaultWireWidth" ); static const wxChar DefaultDrawLineWidthEntry[] = wxT( "DefaultDrawLineWidth" ); static const wxChar DefaultJctSizeEntry[] = wxT( "DefaultJunctionSize" ); static const wxChar ShowHiddenPinsEntry[] = wxT( "ShowHiddenPins" ); @@ -392,7 +411,12 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) wxConfigLoadSetups( aCfg, GetConfigurationSettings() ); SetDefaultBusThickness( (int) aCfg->Read( DefaultBusWidthEntry, DEFAULTBUSTHICKNESS ) ); - SetDefaultLineThickness( (int) aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) ); + + if( !aCfg->Read( DefaultWireWidthEntry, &tmp ) ) + aCfg->Read( DefaultDrawLineWidthEntry, &tmp, DEFAULTDRAWLINETHICKNESS ); + + SetDefaultWireThickness( tmp ); + SCH_JUNCTION::SetSymbolSize( (int) aCfg->Read( DefaultJctSizeEntry, SCH_JUNCTION::GetSymbolSize() ) ); aCfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false ); aCfg->Read( HorzVertLinesOnlyEntry, &m_forceHVLines, true ); @@ -464,7 +488,7 @@ void SCH_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg ) wxConfigSaveSetups( aCfg, GetConfigurationSettings() ); aCfg->Write( DefaultBusWidthEntry, (long) GetDefaultBusThickness() ); - aCfg->Write( DefaultDrawLineWidthEntry, (long) GetDefaultLineThickness() ); + aCfg->Write( DefaultWireWidthEntry, (long) GetDefaultWireThickness() ); aCfg->Write( DefaultJctSizeEntry, (long) SCH_JUNCTION::GetSymbolSize() ); aCfg->Write( ShowHiddenPinsEntry, m_showAllPins ); aCfg->Write( HorzVertLinesOnlyEntry, GetForceHVLines() ); diff --git a/eeschema/general.h b/eeschema/general.h index c147204081..bc5e883083 100644 --- a/eeschema/general.h +++ b/eeschema/general.h @@ -102,6 +102,12 @@ void SetDefaultTextSize( int aSize ); int GetDefaultBusThickness(); void SetDefaultBusThickness( int aThickness ); +/** + * Default line thickness used to draw/plot wires. + */ +int GetDefaultWireThickness(); +void SetDefaultWireThickness( int aThickness ); + COLOR4D GetLayerColor( SCH_LAYER_ID aLayer ); void SetLayerColor( COLOR4D aColor, SCH_LAYER_ID aLayer ); diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index 02b7cba077..a09c93ea57 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -124,7 +124,7 @@ const EDA_RECT SCH_BUS_ENTRY_BASE::GetBoundingBox() const int SCH_BUS_WIRE_ENTRY::GetPenSize() const { - return GetDefaultLineThickness(); + return GetDefaultWireThickness(); } diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index f31bc96a4f..da795077dc 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -279,6 +279,8 @@ int SCH_LINE::GetDefaultWidth() const { if( m_Layer == LAYER_BUS ) return GetDefaultBusThickness(); + else if( m_Layer == LAYER_WIRE ) + return GetDefaultWireThickness(); return GetDefaultLineThickness(); } @@ -297,11 +299,8 @@ int SCH_LINE::GetPenSize() const { if( m_size > 0 ) return m_size; - - if( m_Layer == LAYER_BUS ) - return GetDefaultBusThickness(); - - return GetDefaultLineThickness(); + + return GetDefaultWidth(); }