Separate default line and wire thicknesses.

Fixes: lp:1834324
* https://bugs.launchpad.net/kicad/+bug/1834324
This commit is contained in:
Jeff Young 2019-06-30 11:12:18 +01:00
parent 10fd8a59b2
commit 216acd98d6
9 changed files with 763 additions and 722 deletions

View File

@ -35,7 +35,10 @@
PANEL_EESCHEMA_DISPLAY_OPTIONS::PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME* aFrame, PANEL_EESCHEMA_DISPLAY_OPTIONS::PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME* aFrame,
wxWindow* aWindow ) : wxWindow* aWindow ) :
PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( 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(); KIGFX::GAL_DISPLAY_OPTIONS& galOptions = m_frame->GetGalDisplayOptions();
m_galOptsPanel = new GAL_OPTIONS_PANEL( this, galOptions ); m_galOptsPanel = new GAL_OPTIONS_PANEL( this, galOptions );
@ -60,9 +63,13 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow()
m_choiceSeparatorRefId->SetSelection( refStyleSelection ); m_choiceSeparatorRefId->SetSelection( refStyleSelection );
m_busWidthCtrl->SetValue( StringFromValue( INCHES, GetDefaultBusThickness(), false, true ) ); m_busWidth.SetUnits( INCHES, true );
m_lineWidthCtrl->SetValue( StringFromValue( INCHES, GetDefaultLineThickness(), false, true ) ); m_wireWidth.SetUnits( INCHES, true );
m_jctSizeCtrl->SetValue( StringFromValue( INCHES, SCH_JUNCTION::GetSymbolSize(), false, 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_checkShowHiddenPins->SetValue( m_frame->GetShowAllPins() );
m_checkPageLimits->SetValue( m_frame->ShowPageLimits() ); m_checkPageLimits->SetValue( m_frame->ShowPageLimits() );
@ -96,9 +103,9 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
m_frame->SaveProjectSettings( false ); m_frame->SaveProjectSettings( false );
} }
SetDefaultBusThickness( ValueFromString( INCHES, m_busWidthCtrl->GetValue(), true ) ); SetDefaultBusThickness( m_busWidth.GetValue() );
SetDefaultLineThickness( ValueFromString( INCHES, m_lineWidthCtrl->GetValue(), true ) ); SetDefaultWireThickness( m_wireWidth.GetValue() );
SCH_JUNCTION::SetSymbolSize( ValueFromString( INCHES, m_jctSizeCtrl->GetValue(), true ) ); SCH_JUNCTION::SetSymbolSize( m_junctionSize.GetValue() );
m_frame->SetShowAllPins( m_checkShowHiddenPins->GetValue() ); m_frame->SetShowAllPins( m_checkShowHiddenPins->GetValue() );
m_frame->SetShowPageLimits( m_checkPageLimits->GetValue() ); m_frame->SetShowPageLimits( m_checkPageLimits->GetValue() );

View File

@ -20,6 +20,7 @@
#ifndef KICAD_PANEL_EESCHEMA_DISPLAY_OPTIONS_H #ifndef KICAD_PANEL_EESCHEMA_DISPLAY_OPTIONS_H
#define KICAD_PANEL_EESCHEMA_DISPLAY_OPTIONS_H #define KICAD_PANEL_EESCHEMA_DISPLAY_OPTIONS_H
#include <widgets/unit_binder.h>
#include "panel_eeschema_display_options_base.h" #include "panel_eeschema_display_options_base.h"
class SCH_EDIT_FRAME; class SCH_EDIT_FRAME;
@ -32,6 +33,10 @@ class PANEL_EESCHEMA_DISPLAY_OPTIONS : public PANEL_EESCHEMA_DISPLAY_OPTIONS_BAS
GAL_OPTIONS_PANEL* m_galOptsPanel; GAL_OPTIONS_PANEL* m_galOptsPanel;
UNIT_BINDER m_busWidth;
UNIT_BINDER m_wireWidth;
UNIT_BINDER m_junctionSize;
public: public:
PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow ); PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow );

View File

@ -42,16 +42,16 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
m_busWidthUnits->Wrap( -1 ); m_busWidthUnits->Wrap( -1 );
fgSizer32->Add( m_busWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); 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_wireWidthLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("&Wire thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthLabel->Wrap( -1 ); m_wireWidthLabel->Wrap( -1 );
fgSizer32->Add( m_lineWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); 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 ); m_wireWidthCtrl = new wxTextCtrl( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP );
fgSizer32->Add( m_lineWidthCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); fgSizer32->Add( m_wireWidthCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_lineWidthUnits = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); m_wireWidthUnits = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthUnits->Wrap( -1 ); m_wireWidthUnits->Wrap( -1 );
fgSizer32->Add( m_lineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); 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 = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Junction size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_jctSizeLabel->Wrap( -1 ); m_jctSizeLabel->Wrap( -1 );

File diff suppressed because it is too large Load Diff

View File

@ -38,9 +38,9 @@ class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE : public wxPanel
wxStaticText* m_busWidthLabel; wxStaticText* m_busWidthLabel;
wxTextCtrl* m_busWidthCtrl; wxTextCtrl* m_busWidthCtrl;
wxStaticText* m_busWidthUnits; wxStaticText* m_busWidthUnits;
wxStaticText* m_lineWidthLabel; wxStaticText* m_wireWidthLabel;
wxTextCtrl* m_lineWidthCtrl; wxTextCtrl* m_wireWidthCtrl;
wxStaticText* m_lineWidthUnits; wxStaticText* m_wireWidthUnits;
wxStaticText* m_jctSizeLabel; wxStaticText* m_jctSizeLabel;
wxTextCtrl* m_jctSizeCtrl; wxTextCtrl* m_jctSizeCtrl;
wxStaticText* m_jctSizeUnits; wxStaticText* m_jctSizeUnits;

View File

@ -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) /// Default size for text (not only labels)
static int s_defaultTextSize = DEFAULT_SIZE_TEXT; static int s_defaultTextSize = DEFAULT_SIZE_TEXT;
@ -318,6 +336,7 @@ const wxChar AutoplaceJustifyEntry[] = wxT( "AutoplaceJustify" );
const wxChar AutoplaceAlignEntry[] = wxT( "AutoplaceAlign" ); const wxChar AutoplaceAlignEntry[] = wxT( "AutoplaceAlign" );
static const wxChar FootprintPreviewEntry[] = wxT( "FootprintPreview" ); static const wxChar FootprintPreviewEntry[] = wxT( "FootprintPreview" );
static const wxChar DefaultBusWidthEntry[] = wxT( "DefaultBusWidth" ); static const wxChar DefaultBusWidthEntry[] = wxT( "DefaultBusWidth" );
static const wxChar DefaultWireWidthEntry[] = wxT( "DefaultWireWidth" );
static const wxChar DefaultDrawLineWidthEntry[] = wxT( "DefaultDrawLineWidth" ); static const wxChar DefaultDrawLineWidthEntry[] = wxT( "DefaultDrawLineWidth" );
static const wxChar DefaultJctSizeEntry[] = wxT( "DefaultJunctionSize" ); static const wxChar DefaultJctSizeEntry[] = wxT( "DefaultJunctionSize" );
static const wxChar ShowHiddenPinsEntry[] = wxT( "ShowHiddenPins" ); static const wxChar ShowHiddenPinsEntry[] = wxT( "ShowHiddenPins" );
@ -392,7 +411,12 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
wxConfigLoadSetups( aCfg, GetConfigurationSettings() ); wxConfigLoadSetups( aCfg, GetConfigurationSettings() );
SetDefaultBusThickness( (int) aCfg->Read( DefaultBusWidthEntry, DEFAULTBUSTHICKNESS ) ); 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() ) ); SCH_JUNCTION::SetSymbolSize( (int) aCfg->Read( DefaultJctSizeEntry, SCH_JUNCTION::GetSymbolSize() ) );
aCfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false ); aCfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false );
aCfg->Read( HorzVertLinesOnlyEntry, &m_forceHVLines, true ); aCfg->Read( HorzVertLinesOnlyEntry, &m_forceHVLines, true );
@ -464,7 +488,7 @@ void SCH_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg )
wxConfigSaveSetups( aCfg, GetConfigurationSettings() ); wxConfigSaveSetups( aCfg, GetConfigurationSettings() );
aCfg->Write( DefaultBusWidthEntry, (long) GetDefaultBusThickness() ); aCfg->Write( DefaultBusWidthEntry, (long) GetDefaultBusThickness() );
aCfg->Write( DefaultDrawLineWidthEntry, (long) GetDefaultLineThickness() ); aCfg->Write( DefaultWireWidthEntry, (long) GetDefaultWireThickness() );
aCfg->Write( DefaultJctSizeEntry, (long) SCH_JUNCTION::GetSymbolSize() ); aCfg->Write( DefaultJctSizeEntry, (long) SCH_JUNCTION::GetSymbolSize() );
aCfg->Write( ShowHiddenPinsEntry, m_showAllPins ); aCfg->Write( ShowHiddenPinsEntry, m_showAllPins );
aCfg->Write( HorzVertLinesOnlyEntry, GetForceHVLines() ); aCfg->Write( HorzVertLinesOnlyEntry, GetForceHVLines() );

View File

@ -102,6 +102,12 @@ void SetDefaultTextSize( int aSize );
int GetDefaultBusThickness(); int GetDefaultBusThickness();
void SetDefaultBusThickness( int aThickness ); void SetDefaultBusThickness( int aThickness );
/**
* Default line thickness used to draw/plot wires.
*/
int GetDefaultWireThickness();
void SetDefaultWireThickness( int aThickness );
COLOR4D GetLayerColor( SCH_LAYER_ID aLayer ); COLOR4D GetLayerColor( SCH_LAYER_ID aLayer );
void SetLayerColor( COLOR4D aColor, SCH_LAYER_ID aLayer ); void SetLayerColor( COLOR4D aColor, SCH_LAYER_ID aLayer );

View File

@ -124,7 +124,7 @@ const EDA_RECT SCH_BUS_ENTRY_BASE::GetBoundingBox() const
int SCH_BUS_WIRE_ENTRY::GetPenSize() const int SCH_BUS_WIRE_ENTRY::GetPenSize() const
{ {
return GetDefaultLineThickness(); return GetDefaultWireThickness();
} }

View File

@ -279,6 +279,8 @@ int SCH_LINE::GetDefaultWidth() const
{ {
if( m_Layer == LAYER_BUS ) if( m_Layer == LAYER_BUS )
return GetDefaultBusThickness(); return GetDefaultBusThickness();
else if( m_Layer == LAYER_WIRE )
return GetDefaultWireThickness();
return GetDefaultLineThickness(); return GetDefaultLineThickness();
} }
@ -297,11 +299,8 @@ int SCH_LINE::GetPenSize() const
{ {
if( m_size > 0 ) if( m_size > 0 )
return m_size; return m_size;
if( m_Layer == LAYER_BUS ) return GetDefaultWidth();
return GetDefaultBusThickness();
return GetDefaultLineThickness();
} }