Eeschema: Add Schematic Setup GUI to set junction dot size from list

CHANGED: In Schematic Setup->General->Formatting->Connections, added
pulldown for "Junction dot size" with values none, smallest, small
default, large, largest"  Added support in "sch_painter.cpp" to not
paint junction when they have a diameter of "1" which is what "none"
sets as the diameter.
This commit is contained in:
PJM 2020-10-08 10:04:53 -07:00 committed by Jon Evans
parent 831d020544
commit 43176a5b29
12 changed files with 101 additions and 120 deletions

View File

@ -55,7 +55,7 @@
#define DEFAULT_NOCONNECT_SIZE 48
///< The default junction diameter in mils. (can be changed in preference menu)
#define DEFAULT_JUNCTION_DIAM 40
#define DEFAULT_JUNCTION_DIAM 36
///< The default bus and wire enty size in mils.
#define DEFAULT_SCH_ENTRY_SIZE 100

View File

@ -24,6 +24,8 @@
#include <sch_edit_frame.h>
#include <sch_painter.h>
#include <class_libentry.h>
#include <eeschema_settings.h>
#include <kiface_i.h>
#include <panel_setup_formatting.h>
#include <sch_junction.h>
#include <schematic.h>
@ -35,8 +37,7 @@ PANEL_SETUP_FORMATTING::PANEL_SETUP_FORMATTING( wxWindow* aWindow, SCH_EDIT_FRAM
m_frame( aFrame ),
m_textSize( aFrame, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true ),
m_lineWidth( aFrame, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits, true ),
m_pinSymbolSize( aFrame, m_pinSymbolSizeLabel, m_pinSymbolSizeCtrl, m_pinSymbolSizeUnits, true ),
m_junctionSize( aFrame, m_jctSizeLabel, m_jctSizeCtrl, m_jctSizeUnits, true )
m_pinSymbolSize( aFrame, m_pinSymbolSizeLabel, m_pinSymbolSizeCtrl, m_pinSymbolSizeUnits, true )
{
}
@ -62,12 +63,11 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
m_textSize.SetUnits( EDA_UNITS::MILS );
m_lineWidth.SetUnits( EDA_UNITS::MILS );
m_pinSymbolSize.SetUnits( EDA_UNITS::MILS );
m_junctionSize.SetUnits( EDA_UNITS::MILS );
m_textSize.SetValue( settings.m_DefaultTextSize );
m_lineWidth.SetValue( settings.m_DefaultLineWidth );
m_pinSymbolSize.SetValue( settings.m_PinSymbolSize );
m_junctionSize.SetValue( settings.m_JunctionSize );
m_choiceJunctionDotSize->SetSelection( settings.m_JunctionSizeChoice );
m_showIntersheetsReferences->SetValue( settings.m_IntersheetsRefShow );
m_radioFormatStandard->SetValue( !settings.m_IntersheetsRefFormatShort );
@ -110,7 +110,36 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
settings.m_DefaultTextSize = (int) m_textSize.GetValue();
settings.m_DefaultLineWidth = (int) m_lineWidth.GetValue();
settings.m_PinSymbolSize = (int) m_pinSymbolSize.GetValue();
settings.m_JunctionSize = (int) m_junctionSize.GetValue();
// Get the current working size in case of problem with wxChoice widget results
int currJunctionDotSize = settings.m_JunctionSize;
// See if user has made a junction dot size selection
int currDotSizeIndex = m_choiceJunctionDotSize->GetSelection();
if( currDotSizeIndex != wxNOT_FOUND )
{
EESCHEMA_SETTINGS* projSettings =
dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
if( currDotSizeIndex )
{
// Junction dots are scaled value of default line width
currJunctionDotSize =
settings.m_DefaultLineWidth
* projSettings->m_Drawing.junction_size_mult_list[currDotSizeIndex];
}
else
{
// Don't set to zero or else it's set to min of 10 mils in "sch_painter.cpp"
currJunctionDotSize = 1;
}
settings.m_JunctionSizeMult =
projSettings->m_Drawing.junction_size_mult_list[currDotSizeIndex];
settings.m_JunctionSizeChoice = currDotSizeIndex; // Store to set pulldown next time
}
settings.m_JunctionSize = currJunctionDotSize;
settings.m_IntersheetsRefShow = m_showIntersheetsReferences->GetValue();
settings.m_IntersheetsRefFormatShort = !m_radioFormatStandard->GetValue();
@ -140,7 +169,6 @@ void PANEL_SETUP_FORMATTING::ImportSettingsFrom( SCHEMATIC_SETTINGS& aSettings )
m_textSize.SetValue( aSettings.m_DefaultTextSize );
m_lineWidth.SetValue( aSettings.m_DefaultLineWidth );
m_pinSymbolSize.SetValue( aSettings.m_PinSymbolSize );
m_junctionSize.SetValue( aSettings.m_JunctionSize );
m_showIntersheetsReferences->SetValue( aSettings.m_IntersheetsRefShow );
m_radioFormatStandard->SetValue( aSettings.m_IntersheetsRefFormatShort );

View File

@ -36,7 +36,6 @@ class PANEL_SETUP_FORMATTING : public PANEL_SETUP_FORMATTING_BASE
UNIT_BINDER m_lineWidth;
UNIT_BINDER m_pinSymbolSize;
UNIT_BINDER m_junctionSize;
public:
PANEL_SETUP_FORMATTING( wxWindow* aWindow, SCH_EDIT_FRAME* aFrame );

View File

@ -118,25 +118,21 @@ PANEL_SETUP_FORMATTING_BASE::PANEL_SETUP_FORMATTING_BASE( wxWindow* parent, wxWi
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Connections") ), wxVERTICAL );
wxFlexGridSizer* fgSizer32;
fgSizer32 = new wxFlexGridSizer( 0, 3, 5, 0 );
fgSizer32->AddGrowableCol( 1 );
fgSizer32->SetFlexibleDirection( wxBOTH );
fgSizer32->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
wxBoxSizer* bSizer61;
bSizer61 = new wxBoxSizer( wxHORIZONTAL );
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_staticText261 = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Junction dot size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText261->Wrap( -1 );
bSizer61->Add( m_staticText261, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 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 );
wxString m_choiceJunctionDotSizeChoices[] = { _("None"), _("Smallest"), _("Small"), _("Default"), _("Large"), _("Largest") };
int m_choiceJunctionDotSizeNChoices = sizeof( m_choiceJunctionDotSizeChoices ) / sizeof( wxString );
m_choiceJunctionDotSize = new wxChoice( sbSizer2->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceJunctionDotSizeNChoices, m_choiceJunctionDotSizeChoices, 0 );
m_choiceJunctionDotSize->SetSelection( 3 );
bSizer61->Add( m_choiceJunctionDotSize, 1, wxEXPAND|wxRIGHT, 5 );
sbSizer2->Add( fgSizer32, 0, wxEXPAND|wxBOTTOM, 5 );
sbSizer2->Add( bSizer61, 1, wxBOTTOM|wxEXPAND, 5 );
bLeftColumn->Add( sbSizer2, 0, wxEXPAND|wxALL, 5 );

View File

@ -1035,23 +1035,16 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size">-1,-1</property>
<property name="name">fgSizer32</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="flag">wxBOTTOM|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer61</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">5</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</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>
@ -1081,7 +1074,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Junction size:</property>
<property name="label">Junction dot size:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@ -1090,7 +1083,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_jctSizeLabel</property>
<property name="name">m_staticText261</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -1101,7 +1094,7 @@
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
@ -1112,9 +1105,9 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="flag">wxEXPAND|wxRIGHT</property>
<property name="proportion">1</property>
<object class="wxChoice" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -1128,6 +1121,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;None&quot; &quot;Smallest&quot; &quot;Small&quot; &quot;Default&quot; &quot;Large&quot; &quot;Largest&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
@ -1145,12 +1139,11 @@
<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_jctSizeCtrl</property>
<property name="name">m_choiceJunctionDotSize</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -1158,83 +1151,22 @@
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">3</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="subclass"></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">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</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_jctSizeUnits</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>

View File

@ -48,9 +48,8 @@ class PANEL_SETUP_FORMATTING_BASE : public wxPanel
wxStaticText* m_pinSymbolSizeLabel;
wxTextCtrl* m_pinSymbolSizeCtrl;
wxStaticText* m_pinSymbolSizeUnits;
wxStaticText* m_jctSizeLabel;
wxTextCtrl* m_jctSizeCtrl;
wxStaticText* m_jctSizeUnits;
wxStaticText* m_staticText261;
wxChoice* m_choiceJunctionDotSize;
wxCheckBox* m_showIntersheetsReferences;
wxRadioButton* m_radioFormatStandard;
wxRadioButton* m_radioFormatAbbreviated;

View File

@ -144,6 +144,15 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
m_params.emplace_back( new PARAM<COLOR4D>( "drawing.default_sheet_background_color",
&m_Drawing.default_sheet_background_color, COLOR4D( WHITE ).WithAlpha( 0.0 ) ) );
m_params.emplace_back( new PARAM_LIST<double>( "drawing.junction_size_mult_list",
&m_Drawing.junction_size_mult_list, { 0.0, 1.7, 4.0, 6.0, 9.0, 12.0 } ) );
m_params.emplace_back(new PARAM <double>( "drawing.junction_size_mult",
&m_Drawing.junction_size_mult, 4.0 ) );
m_params.emplace_back(new PARAM <int>( "drawing.junction_size_choice",
&m_Drawing.junction_size_choice, 3 ) );
m_params.emplace_back( new PARAM<bool>( "input.drag_is_move",
&m_Input.drag_is_move, true ) );

View File

@ -78,6 +78,10 @@ public:
wxString intersheets_ref_prefix;
wxString intersheets_ref_suffix;
bool auto_start_wires;
std::vector<double> junction_size_mult_list;
// Pulldown index for user default junction dot size (e.g. smallest = 0, small = 1, etc)
int junction_size_choice;
double junction_size_mult; // User selected default multiplier for junction dot size
};
struct INPUT

View File

@ -184,7 +184,8 @@ int SCH_JUNCTION::GetDiameter() const
NETCLASSPTR netclass = NetClass();
if( netclass )
// Diameter 1 means users doesn't want to draw junction dots
if( netclass && ( diameter != 1 ) )
diameter = std::max( diameter, KiROUND( netclass->GetWireWidth() * 1.7 ) );
return std::max( diameter, 1 );

View File

@ -1195,12 +1195,15 @@ void SCH_PAINTER::draw( SCH_JUNCTION *aJct, int aLayer )
int junctionSize = aJct->GetDiameter() / 2;
m_gal->SetIsStroke( drawingShadows );
m_gal->SetLineWidth( getLineWidth( aJct, drawingShadows ) );
m_gal->SetStrokeColor( color );
m_gal->SetIsFill( !drawingShadows );
m_gal->SetFillColor( color );
m_gal->DrawCircle( aJct->GetPosition(), junctionSize );
if( junctionSize > 1 )
{
m_gal->SetIsStroke( drawingShadows );
m_gal->SetLineWidth( getLineWidth( aJct, drawingShadows ) );
m_gal->SetStrokeColor( color );
m_gal->SetIsFill( !drawingShadows );
m_gal->SetFillColor( color );
m_gal->DrawCircle( aJct->GetPosition(), junctionSize );
}
}

View File

@ -61,6 +61,8 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
appSettings ? appSettings->m_Drawing.pin_symbol_size : DEFAULT_TEXT_SIZE / 2;
int defaultJunctionSize =
appSettings ? appSettings->m_Drawing.default_junction_size : DEFAULT_JUNCTION_DIAM;
int defaultJunctionSizeChoice =
appSettings ? appSettings->m_Drawing.junction_size_choice : 3;
bool defaultIntersheetsRefShow =
appSettings ? appSettings->m_Drawing.intersheets_ref_show : false;
bool defaultIntersheetsRefFormatShort =
@ -112,6 +114,11 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
&m_JunctionSize,
Mils2iu( defaultJunctionSize ), Mils2iu( 5 ), Mils2iu( 1000 ), 1 / IU_PER_MILS ) );
// User choice for junction dot size ( e.g. none = 0, smallest = 1, small = 2, etc )
m_params.emplace_back(new PARAM<int>("drawing.junction_size_choice",
&m_JunctionSizeChoice,
defaultJunctionSizeChoice) );
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "drawing.field_names",
[&]() -> nlohmann::json
{

View File

@ -40,7 +40,7 @@ public:
virtual ~SCHEMATIC_SETTINGS();
// Default sizes are all stored in IU here, and im mils in the JSON file
// Default sizes are all stored in IU here, and in mils in the JSON file
int m_DefaultLineWidth;
int m_DefaultWireThickness;
@ -48,7 +48,10 @@ public:
int m_DefaultTextSize;
double m_TextOffsetRatio;
int m_PinSymbolSize;
int m_JunctionSize;
int m_JunctionSize; // Size of junction dot in mils
// User choice for junction dot size ( e.g. none = 0, smallest = 1, small = 2, etc )
int m_JunctionSizeChoice;
double m_JunctionSizeMult; // junction dot size = this value * default line width
bool m_IntersheetsRefShow;
bool m_IntersheetsRefFormatShort;