Ensure junctions and no-connects are visible even on fat wires.

Also adds a preference for junction size.

Fixes: lp:1545422
* https://bugs.launchpad.net/kicad/+bug/1545422
This commit is contained in:
Jeff Young 2018-09-10 00:04:42 +01:00
parent ca3751fbbb
commit 96724af2c4
10 changed files with 1068 additions and 817 deletions

View File

@ -30,7 +30,7 @@
#include <class_libentry.h>
#include <panel_eeschema_display_options.h>
#include <widgets/gal_options_panel.h>
#include <sch_junction.h>
PANEL_EESCHEMA_DISPLAY_OPTIONS::PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME* aFrame,
wxWindow* aWindow ) :
@ -62,6 +62,7 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow()
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_checkShowHiddenPins->SetValue( m_frame->GetShowAllPins() );
m_checkPageLimits->SetValue( m_frame->ShowPageLimits() );
@ -97,6 +98,7 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
SetDefaultBusThickness( ValueFromString( INCHES, m_busWidthCtrl->GetValue(), true ) );
SetDefaultLineThickness( ValueFromString( INCHES, m_lineWidthCtrl->GetValue(), true ) );
SCH_JUNCTION::SetSymbolSize( ValueFromString( INCHES, m_jctSizeCtrl->GetValue(), true ) );
m_frame->SetShowAllPins( m_checkShowHiddenPins->GetValue() );
m_frame->SetShowPageLimits( m_checkPageLimits->GetValue() );

View File

@ -17,88 +17,93 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
m_galOptionsSizer = new wxBoxSizer( wxVERTICAL );
bPanelSizer->Add( m_galOptionsSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bPanelSizer->Add( m_galOptionsSizer, 1, wxEXPAND|wxLEFT, 5 );
wxBoxSizer* bRightColumn;
bRightColumn = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimensions") ), wxVERTICAL );
wxFlexGridSizer* fgSizer32;
fgSizer32 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer32 = new wxFlexGridSizer( 0, 3, 3, 0 );
fgSizer32->AddGrowableCol( 1 );
fgSizer32->SetFlexibleDirection( wxBOTH );
fgSizer32->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizer32->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
fgSizer32->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer32->Add( 0, 0, 1, wxEXPAND, 5 );
m_busWidthLabel = new wxStaticText( this, wxID_ANY, _("&Bus thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_busWidthLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("&Bus thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_busWidthLabel->Wrap( -1 );
fgSizer32->Add( m_busWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_busWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP );
fgSizer32->Add( m_busWidthCtrl, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_busWidthCtrl = new wxTextCtrl( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP );
fgSizer32->Add( m_busWidthCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_busWidthUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_busWidthUnits = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_busWidthUnits->Wrap( -1 );
fgSizer32->Add( m_busWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_lineWidthLabel = new wxStaticText( this, wxID_ANY, _("&Line thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
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|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fgSizer32->Add( m_lineWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_lineWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP );
fgSizer32->Add( m_lineWidthCtrl, 0, wxEXPAND|wxBOTTOM, 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_lineWidthUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthUnits = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthUnits->Wrap( -1 );
fgSizer32->Add( m_lineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fgSizer32->Add( m_lineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_jctSizeLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Junction size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_jctSizeLabel->Wrap( -1 );
fgSizer32->Add( m_jctSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_jctSizeCtrl = new wxTextCtrl( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer32->Add( m_jctSizeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_jctSizeUnits = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_jctSizeUnits->Wrap( -1 );
fgSizer32->Add( m_jctSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
fgSizer32->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 10 );
sbSizer2->Add( fgSizer32, 0, wxBOTTOM|wxRIGHT|wxEXPAND, 5 );
fgSizer32->Add( 0, 0, 1, wxEXPAND, 5 );
bRightColumn->Add( sbSizer2, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Annotations") ), wxVERTICAL );
fgSizer32->Add( 0, 0, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer6;
bSizer6 = new wxBoxSizer( wxHORIZONTAL );
m_staticText26 = new wxStaticText( this, wxID_ANY, _("Symbol unit notation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText26 = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("Symbol unit notation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText26->Wrap( -1 );
fgSizer32->Add( m_staticText26, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
bSizer6->Add( m_staticText26, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
wxString m_choiceSeparatorRefIdChoices[] = { _("A"), _(".A"), _("-A"), _("_A"), _(".1"), _("-1"), _("_1") };
int m_choiceSeparatorRefIdNChoices = sizeof( m_choiceSeparatorRefIdChoices ) / sizeof( wxString );
m_choiceSeparatorRefId = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceSeparatorRefIdNChoices, m_choiceSeparatorRefIdChoices, 0 );
m_choiceSeparatorRefId = new wxChoice( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceSeparatorRefIdNChoices, m_choiceSeparatorRefIdChoices, 0 );
m_choiceSeparatorRefId->SetSelection( 0 );
fgSizer32->Add( m_choiceSeparatorRefId, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
bSizer6->Add( m_choiceSeparatorRefId, 1, wxEXPAND|wxRIGHT, 5 );
fgSizer32->Add( 0, 0, 1, wxEXPAND, 5 );
sbSizer1->Add( bSizer6, 0, wxEXPAND|wxRIGHT, 5 );
bRightColumn->Add( fgSizer32, 0, wxBOTTOM|wxRIGHT|wxEXPAND, 5 );
sbSizer1->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 );
wxBoxSizer* bSizer92;
bSizer92 = new wxBoxSizer( wxVERTICAL );
m_checkShowHiddenPins = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("S&how hidden pins"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer1->Add( m_checkShowHiddenPins, 0, wxEXPAND|wxALL, 5 );
m_checkShowHiddenPins = new wxCheckBox( this, wxID_ANY, _("S&how hidden pins"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer92->Add( m_checkShowHiddenPins, 0, wxEXPAND|wxALL, 5 );
m_checkPageLimits = new wxCheckBox( this, wxID_ANY, _("Show page limi&ts"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkPageLimits = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Show page limi&ts"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkPageLimits->SetValue(true);
bSizer92->Add( m_checkPageLimits, 0, wxEXPAND|wxALL, 5 );
sbSizer1->Add( m_checkPageLimits, 0, wxEXPAND|wxALL, 5 );
bRightColumn->Add( bSizer92, 0, wxTOP|wxRIGHT, 12 );
bRightColumn->Add( sbSizer1, 1, wxEXPAND|wxTOP|wxRIGHT, 5 );
bPanelSizer->Add( bRightColumn, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bPanelSizer->Add( bRightColumn, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 );
this->SetSizer( bPanelSizer );

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,7 @@
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/statbox.h>
#include <wx/choice.h>
#include <wx/checkbox.h>
#include <wx/panel.h>
@ -40,6 +41,9 @@ class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE : public wxPanel
wxStaticText* m_lineWidthLabel;
wxTextCtrl* m_lineWidthCtrl;
wxStaticText* m_lineWidthUnits;
wxStaticText* m_jctSizeLabel;
wxTextCtrl* m_jctSizeCtrl;
wxStaticText* m_jctSizeUnits;
wxStaticText* m_staticText26;
wxChoice* m_choiceSeparatorRefId;
wxCheckBox* m_checkShowHiddenPins;

View File

@ -50,6 +50,7 @@
#include <dialogs/panel_libedit_settings.h>
#include <sch_view.h>
#include <sch_painter.h>
#include "sch_junction.h"
#define FR_HISTORY_LIST_CNT 10 ///< Maximum number of find and replace strings.
@ -321,6 +322,7 @@ const wxChar LibIconScaleEntry[] = wxT( "LibIconScale" );
static const wxChar FootprintPreviewEntry[] = wxT( "FootprintPreview" );
static const wxChar DefaultBusWidthEntry[] = wxT( "DefaultBusWidth" );
static const wxChar DefaultDrawLineWidthEntry[] = wxT( "DefaultDrawLineWidth" );
static const wxChar DefaultJctSizeEntry[] = wxT( "DefaultJunctionSize" );
static const wxChar ShowHiddenPinsEntry[] = wxT( "ShowHiddenPins" );
static const wxChar HorzVertLinesOnlyEntry[] = wxT( "HorizVertLinesOnly" );
static const wxChar PreviewFramePositionXEntry[] = wxT( "PreviewFramePositionX" );
@ -408,6 +410,7 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
SetDefaultBusThickness( aCfg->Read( DefaultBusWidthEntry, DEFAULTBUSTHICKNESS ) );
SetDefaultLineThickness( aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) );
SCH_JUNCTION::SetSymbolSize( aCfg->Read( DefaultJctSizeEntry, SCH_JUNCTION::GetSymbolSize() ) );
aCfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false );
aCfg->Read( HorzVertLinesOnlyEntry, &m_forceHVLines, true );
aCfg->Read( AutoplaceFieldsEntry, &m_autoplaceFields, true );
@ -477,6 +480,7 @@ void SCH_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg )
aCfg->Write( DefaultBusWidthEntry, (long) GetDefaultBusThickness() );
aCfg->Write( DefaultDrawLineWidthEntry, (long) GetDefaultLineThickness() );
aCfg->Write( DefaultJctSizeEntry, (long) SCH_JUNCTION::GetSymbolSize() );
aCfg->Write( ShowHiddenPinsEntry, m_showAllPins );
aCfg->Write( HorzVertLinesOnlyEntry, GetForceHVLines() );
aCfg->Write( AutoplaceFieldsEntry, m_autoplaceFields );

View File

@ -42,6 +42,13 @@
int SCH_JUNCTION::m_symbolSize = 40; // Default diameter of the junction symbol
int SCH_JUNCTION::GetEffectiveSymbolSize()
{
return std::max( KiROUND( GetDefaultLineThickness() * 1.5 ), m_symbolSize );
}
SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) :
SCH_ITEM( NULL, SCH_JUNCTION_T )
{
@ -71,7 +78,7 @@ const EDA_RECT SCH_JUNCTION::GetBoundingBox() const
EDA_RECT rect;
rect.SetOrigin( m_pos );
rect.Inflate( ( GetPenSize() + GetSymbolSize() ) / 2 );
rect.Inflate( ( GetPenSize() + GetEffectiveSymbolSize() ) / 2 );
return rect;
}
@ -90,7 +97,7 @@ void SCH_JUNCTION::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffs
GRSetDrawMode( aDC, aDrawMode );
GRFilledCircle( aPanel->GetClipBox(), aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y,
( GetSymbolSize() / 2 ), 0, color, color );
( GetEffectiveSymbolSize() / 2 ), 0, color, color );
}
@ -199,7 +206,7 @@ bool SCH_JUNCTION::doIsConnected( const wxPoint& aPosition ) const
void SCH_JUNCTION::Plot( PLOTTER* aPlotter )
{
aPlotter->SetColor( GetLayerColor( GetLayer() ) );
aPlotter->Circle( m_pos, GetSymbolSize(), FILLED_SHAPE );
aPlotter->Circle( m_pos, GetEffectiveSymbolSize(), FILLED_SHAPE );
}

View File

@ -53,6 +53,10 @@ public:
static int GetSymbolSize() { return m_symbolSize; }
static void SetSymbolSize( int aSize ) { m_symbolSize = aSize; }
// Return the size the symbol should be drawn at. This is GetSymbolSize() clamped to be
// no less than 1.5 X the current wire width.
static int GetEffectiveSymbolSize();
void SwapData( SCH_ITEM* aItem ) override;
const EDA_RECT GetBoundingBox() const override;

View File

@ -43,10 +43,8 @@
SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) :
SCH_ITEM( NULL, SCH_NO_CONNECT_T )
{
#define DRAWNOCONNECT_SIZE 48 /* No symbol connection range. */
m_pos = pos;
m_size.x = m_size.y = DRAWNOCONNECT_SIZE;
#undef DRAWNOCONNECT_SIZE
m_size = 48; ///< No-connect symbol size.
SetLayer( LAYER_NOCONNECT );
}
@ -71,7 +69,7 @@ void SCH_NO_CONNECT::SwapData( SCH_ITEM* aItem )
const EDA_RECT SCH_NO_CONNECT::GetBoundingBox() const
{
int delta = ( GetPenSize() + m_size.x ) / 2;
int delta = ( GetPenSize() + GetSize() ) / 2;
EDA_RECT box;
box.SetOrigin( m_pos );
@ -98,7 +96,7 @@ void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
GR_DRAWMODE aDrawMode, COLOR4D aColor )
{
int pX, pY;
int delta = m_size.x / 2;
int delta = GetSize() / 2;
int width = GetDefaultLineThickness();
pX = m_pos.x + aOffset.x;
@ -179,7 +177,7 @@ bool SCH_NO_CONNECT::doIsConnected( const wxPoint& aPosition ) const
bool SCH_NO_CONNECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
int delta = ( ( m_size.x + GetDefaultLineThickness() ) / 2 ) + aAccuracy;
int delta = ( ( GetSize() + GetDefaultLineThickness() ) / 2 ) + aAccuracy;
wxPoint dist = aPosition - m_pos;
@ -205,7 +203,7 @@ bool SCH_NO_CONNECT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccur
void SCH_NO_CONNECT::Plot( PLOTTER* aPlotter )
{
int delta = m_size.x / 2;
int delta = GetSize() / 2;
int pX, pY;
pX = m_pos.x;

View File

@ -37,7 +37,7 @@ class NETLIST_OBJECT_LIST;
class SCH_NO_CONNECT : public SCH_ITEM
{
wxPoint m_pos; ///< Position of the no connect object.
wxSize m_size; ///< Size of the no connect object.
int m_size; ///< Size of the no connect object.
public:
SCH_NO_CONNECT( const wxPoint& pos = wxPoint( 0, 0 ) );
@ -51,9 +51,9 @@ public:
return wxT( "SCH_NO_CONNECT" );
}
wxSize GetSize() const
int GetSize() const
{
return m_size;
return std::max( m_size, KiROUND( GetDefaultLineThickness() * 3 ) );
}
int GetPenSize() const override;

View File

@ -872,7 +872,7 @@ void SCH_PAINTER::draw( SCH_JUNCTION *aJct, int aLayer )
m_gal->SetIsFill(true);
m_gal->SetStrokeColor( color );
m_gal->SetFillColor( color );
m_gal->DrawCircle( aJct->GetPosition(), aJct->GetSymbolSize() / 2 );
m_gal->DrawCircle( aJct->GetPosition(), aJct->GetEffectiveSymbolSize() / 2 );
}
@ -1254,7 +1254,7 @@ void SCH_PAINTER::draw( SCH_SHEET *aSheet, int aLayer )
void SCH_PAINTER::draw( SCH_NO_CONNECT *aNC, int aLayer )
{
int delta = aNC->GetSize().x / 2;
int delta = aNC->GetSize() / 2;
int width = GetDefaultLineThickness();
m_gal->SetStrokeColor( m_schSettings.GetLayerColor( LAYER_NOCONNECT ) );