Fix bugs in sheets.

1) Default_line_width is in mils, not IU.
2) Plot sheet fields.

Fixes https://gitlab.com/kicad/code/kicad/issues/8984
This commit is contained in:
Jeff Young 2021-08-17 13:19:23 +01:00
parent 8c9b0bdba4
commit fc4d748bdc
7 changed files with 24 additions and 17 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.9.0 Jun 3 2020)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -45,12 +45,12 @@ PANEL_EESCHEMA_EDITING_OPTIONS_BASE::PANEL_EESCHEMA_EDITING_OPTIONS_BASE( wxWind
m_borderColorLabel = new wxStaticText( sbSizer5->GetStaticBox(), wxID_ANY, _("Sheet border:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderColorLabel->Wrap( -1 );
bSizer6->Add( m_borderColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
bSizer6->Add( m_borderColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_borderColorSwatch = new COLOR_SWATCH( sbSizer5->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_borderColorSwatch->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
bSizer6->Add( m_borderColorSwatch, 1, wxALL, 5 );
bSizer6->Add( m_borderColorSwatch, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_backgroundColorLabel = new wxStaticText( sbSizer5->GetStaticBox(), wxID_ANY, _("Sheet background:"), wxDefaultPosition, wxDefaultSize, 0 );
m_backgroundColorLabel->Wrap( -1 );
@ -59,7 +59,7 @@ PANEL_EESCHEMA_EDITING_OPTIONS_BASE::PANEL_EESCHEMA_EDITING_OPTIONS_BASE( wxWind
m_backgroundColorSwatch = new COLOR_SWATCH( sbSizer5->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_backgroundColorSwatch->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
bSizer6->Add( m_backgroundColorSwatch, 1, wxALL, 5 );
bSizer6->Add( m_backgroundColorSwatch, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
sbSizer5->Add( bSizer6, 0, wxEXPAND, 5 );

View File

@ -14,7 +14,6 @@
<property name="file">panel_eeschema_editing_options_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">PanelEeschemaEditingOptionsBase</property>
@ -26,7 +25,6 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="1">
@ -294,7 +292,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -355,7 +353,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">1</property>
<object class="CustomControl" expanded="1">
<property name="BottomDockable">1</property>
@ -478,7 +476,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">1</property>
<object class="CustomControl" expanded="1">
<property name="BottomDockable">1</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.9.0 Jun 3 2020)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!

View File

@ -181,9 +181,9 @@ public:
}
private:
int m_width;
int m_width;
PLOT_DASH_TYPE m_plotstyle;
COLOR4D m_color;
COLOR4D m_color;
};

View File

@ -509,7 +509,13 @@ SCH_SHEET_PIN* SCH_SHEET::GetPin( const wxPoint& aPosition )
int SCH_SHEET::GetPenWidth() const
{
return std::max( GetBorderWidth(), 1 );
if( GetBorderWidth() > 0 )
return GetBorderWidth();
if( Schematic() )
return Schematic()->Settings().m_DefaultLineWidth;
return DEFAULT_LINE_THICKNESS;
}
@ -987,7 +993,7 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter ) const
int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
aPlotter->Rect( m_pos, m_pos + m_size, FILL_TYPE::NO_FILL, penWidth );
// Plot Sheet pins
// Plot sheet pins
for( SCH_SHEET_PIN* sheetPin : m_pins )
sheetPin->Plot( aPlotter );
@ -1027,7 +1033,6 @@ void SCH_SHEET::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset
for( SCH_FIELD& field : m_fields )
field.Print( aSettings, aOffset );
/* Draw text : SheetLabel */
for( SCH_SHEET_PIN* sheetPin : m_pins )
sheetPin->Print( aSettings, aOffset );
}

View File

@ -35,6 +35,7 @@
#include <sch_sheet.h>
#include <sch_sheet_pin.h>
#include <sch_painter.h>
#include <schematic.h>
#include <trigo.h>
@ -97,7 +98,10 @@ bool SCH_SHEET_PIN::operator==( const SCH_SHEET_PIN* aPin ) const
int SCH_SHEET_PIN::GetPenWidth() const
{
return 0;
if( Schematic() )
return Schematic()->Settings().m_DefaultLineWidth;
return DEFAULT_LINE_THICKNESS;
}

View File

@ -1336,7 +1336,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
static_cast<wxPoint>( cursorPos ) );
sheet->SetFlags( IS_NEW | IS_RESIZING );
sheet->SetScreen( nullptr );
sheet->SetBorderWidth( cfg->m_Drawing.default_line_thickness );
sheet->SetBorderWidth( Mils2iu( cfg->m_Drawing.default_line_thickness ) );
sheet->SetBorderColor( cfg->m_Drawing.default_sheet_border_color );
sheet->SetBackgroundColor( cfg->m_Drawing.default_sheet_background_color );
sheet->GetFields()[ SHEETNAME ].SetText( "Untitled Sheet" );