NetClass settings for Eeschema.

ADDED Eeschema-specific netclass settings including wire and bus
thickness, color, and line style.

Netclasses override individual wire & bus colors and line styles.
If that proves an issue we might look at something more sophisticated
with inheritance.

Fixes https://gitlab.com/kicad/code/kicad/issues/4581
This commit is contained in:
Jeff Young 2020-07-08 19:29:16 +01:00
parent d292db866a
commit 741481591e
26 changed files with 587 additions and 243 deletions

View File

@ -201,6 +201,7 @@ set( COMMON_WIDGET_SRCS
widgets/footprint_preview_widget.cpp widgets/footprint_preview_widget.cpp
widgets/footprint_select_widget.cpp widgets/footprint_select_widget.cpp
widgets/gal_options_panel.cpp widgets/gal_options_panel.cpp
widgets/grid_color_swatch_helpers.cpp
widgets/grid_combobox.cpp widgets/grid_combobox.cpp
widgets/grid_icon_text_helpers.cpp widgets/grid_icon_text_helpers.cpp
widgets/grid_text_button_helpers.cpp widgets/grid_text_button_helpers.cpp

View File

@ -32,11 +32,15 @@
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <widgets/wx_grid.h> #include <widgets/wx_grid.h>
#include <kicad_string.h> #include <kicad_string.h>
#include <widgets/grid_color_swatch_helpers.h>
#include <widgets/grid_icon_text_helpers.h>
// Columns of netclasses grid // PCBNEW columns of netclasses grid
enum { enum {
GRID_NAME = 0, GRID_NAME = 0,
GRID_CLEARANCE,
GRID_FIRST_PCBNEW,
GRID_CLEARANCE = GRID_FIRST_PCBNEW,
GRID_TRACKSIZE, GRID_TRACKSIZE,
GRID_VIASIZE, GRID_VIASIZE,
GRID_VIADRILL, GRID_VIADRILL,
@ -44,18 +48,44 @@ enum {
GRID_uVIADRILL, GRID_uVIADRILL,
GRID_DIFF_PAIR_WIDTH, GRID_DIFF_PAIR_WIDTH,
GRID_DIFF_PAIR_GAP, GRID_DIFF_PAIR_GAP,
GRID_DIFF_PAIR_VIA_GAP
GRID_FIRST_EESCHEMA,
GRID_WIREWIDTH = GRID_FIRST_EESCHEMA,
GRID_BUSWIDTH,
GRID_SCHEMATIC_COLOR,
GRID_LINESTYLE,
GRID_END
}; };
// These are conceptually constexpr
std::vector<BITMAP_DEF> g_lineStyleIcons;
wxArrayString g_lineStyleNames;
#define NO_NETCLASS_ASSIGNMENT _( "<unassigned>" ) #define NO_NETCLASS_ASSIGNMENT _( "<unassigned>" )
PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, NETCLASSES* aNetclasses, PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, NETCLASSES* aNetclasses,
const std::vector<wxString>& aCandidateNetNames ) : const std::vector<wxString>& aCandidateNetNames,
bool aIsEEschema ) :
PANEL_SETUP_NETCLASSES_BASE( aParent->GetTreebook() ), PANEL_SETUP_NETCLASSES_BASE( aParent->GetTreebook() ),
m_Parent( aParent ), m_Parent( aParent ),
m_netclasses( aNetclasses ), m_netclasses( aNetclasses ),
m_candidateNetNames( aCandidateNetNames ) m_candidateNetNames( aCandidateNetNames )
{ {
if( g_lineStyleIcons.empty() )
{
g_lineStyleIcons.push_back( stroke_solid_xpm );
g_lineStyleNames.push_back( _( "Solid" ) );
g_lineStyleIcons.push_back( stroke_dash_xpm );
g_lineStyleNames.push_back( _( "Dashed" ) );
g_lineStyleIcons.push_back( stroke_dot_xpm );
g_lineStyleNames.push_back( _( "Dotted" ) );
g_lineStyleIcons.push_back( stroke_dashdot_xpm );
g_lineStyleNames.push_back( _( "Dash-Dot" ) );
}
m_netclassesDirty = true; m_netclassesDirty = true;
// Figure out the smallest the netclass membership pane can ever be so that nothing is cutoff // Figure out the smallest the netclass membership pane can ever be so that nothing is cutoff
@ -80,12 +110,44 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, NETCLASSE
// We calculate the column min size only from texts sizes, not using the initial col width // We calculate the column min size only from texts sizes, not using the initial col width
// as this initial width is sometimes strange depending on the language (wxGrid bug?) // as this initial width is sometimes strange depending on the language (wxGrid bug?)
int min_width = m_netclassGrid->GetVisibleWidth( i, true, true, false ); int min_width = m_netclassGrid->GetVisibleWidth( i, true, true, false );
if( i == GRID_LINESTYLE )
min_best_width *= 1.5;
m_netclassGrid->SetColMinimalWidth( i, min_width ); m_netclassGrid->SetColMinimalWidth( i, min_width );
// We use a "best size" >= min_best_width // We use a "best size" >= min_best_width
m_originalColWidths[ i ] = std::max( min_width, min_best_width ); m_originalColWidths[ i ] = std::max( min_width, min_best_width );
m_netclassGrid->SetColSize( i, m_originalColWidths[ i ] ); m_netclassGrid->SetColSize( i, m_originalColWidths[ i ] );
} }
if( aIsEEschema )
{
for( int i = GRID_FIRST_PCBNEW; i < GRID_FIRST_EESCHEMA; ++i )
{
m_netclassGrid->HideCol( i );
m_originalColWidths[ i ] = 0;
}
wxGridCellAttr* attr = new wxGridCellAttr;
attr->SetRenderer( new GRID_CELL_COLOR_RENDERER() );
attr->SetEditor( new GRID_CELL_COLOR_SELECTOR( aParent, m_netclassGrid ) );
m_netclassGrid->SetColAttr( GRID_SCHEMATIC_COLOR, attr );
attr = new wxGridCellAttr;
attr->SetRenderer( new GRID_CELL_ICON_TEXT_RENDERER( g_lineStyleIcons, g_lineStyleNames ) );
attr->SetEditor( new GRID_CELL_ICON_TEXT_POPUP( g_lineStyleIcons, g_lineStyleNames ) );
m_netclassGrid->SetColAttr( GRID_LINESTYLE, attr );
}
else
{
for( int i = GRID_FIRST_EESCHEMA; i < GRID_END; ++i )
{
m_netclassGrid->HideCol( i );
m_originalColWidths[ i ] = 0;
}
}
// Be sure the column labels are readable // Be sure the column labels are readable
m_netclassGrid->EnsureColLabelsVisible(); m_netclassGrid->EnsureColLabelsVisible();
@ -144,7 +206,13 @@ static void netclassToGridRow( EDA_UNITS aUnits, wxGrid* aGrid, int aRow, const
SET_MILS_CELL( GRID_uVIADRILL, nc->GetuViaDrill() ); SET_MILS_CELL( GRID_uVIADRILL, nc->GetuViaDrill() );
SET_MILS_CELL( GRID_DIFF_PAIR_WIDTH, nc->GetDiffPairWidth() ); SET_MILS_CELL( GRID_DIFF_PAIR_WIDTH, nc->GetDiffPairWidth() );
SET_MILS_CELL( GRID_DIFF_PAIR_GAP, nc->GetDiffPairGap() ); SET_MILS_CELL( GRID_DIFF_PAIR_GAP, nc->GetDiffPairGap() );
SET_MILS_CELL( GRID_DIFF_PAIR_VIA_GAP, nc->GetDiffPairViaGap() );
SET_MILS_CELL( GRID_WIREWIDTH, nc->GetWireWidth() );
SET_MILS_CELL( GRID_BUSWIDTH, nc->GetBusWidth() );
wxString colorAsString = nc->GetSchematicColor().ToWxString( wxC2S_CSS_SYNTAX );
aGrid->SetCellValue( aRow, GRID_SCHEMATIC_COLOR, colorAsString );
aGrid->SetCellValue( aRow, GRID_LINESTYLE, g_lineStyleNames[ nc->GetLineStyle() ] );
} }
@ -268,7 +336,12 @@ static void gridRowToNetclass( EDA_UNITS aUnits, wxGrid* grid, int row, const NE
nc->SetuViaDrill( MYCELL( GRID_uVIADRILL ) ); nc->SetuViaDrill( MYCELL( GRID_uVIADRILL ) );
nc->SetDiffPairWidth( MYCELL( GRID_DIFF_PAIR_WIDTH ) ); nc->SetDiffPairWidth( MYCELL( GRID_DIFF_PAIR_WIDTH ) );
nc->SetDiffPairGap( MYCELL( GRID_DIFF_PAIR_GAP ) ); nc->SetDiffPairGap( MYCELL( GRID_DIFF_PAIR_GAP ) );
// 6.0 TODO: nc->SetDiffPairViaGap( MYCELL( GRID_DIFF_PAIR_VIA_GAP ) );
nc->SetWireWidth( MYCELL( GRID_WIREWIDTH ) );
nc->SetBusWidth( MYCELL( GRID_BUSWIDTH ) );
nc->SetSchematicColor( wxColour( grid->GetCellValue( row, GRID_SCHEMATIC_COLOR ) ) );
nc->SetLineStyle( g_lineStyleNames.Index( grid->GetCellValue( row, GRID_LINESTYLE ) ) );
} }

View File

@ -70,7 +70,7 @@ private:
public: public:
PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, NETCLASSES* aNetclasses, PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, NETCLASSES* aNetclasses,
const std::vector<wxString>& aCandidateNetNames ); const std::vector<wxString>& aCandidateNetNames, bool isEEschema );
~PANEL_SETUP_NETCLASSES( ) override; ~PANEL_SETUP_NETCLASSES( ) override;
bool TransferDataToWindow() override; bool TransferDataToWindow() override;

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/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -23,27 +23,17 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi
wxStaticBoxSizer* sbSizerUpper; wxStaticBoxSizer* sbSizerUpper;
sbSizerUpper = new wxStaticBoxSizer( new wxStaticBox( m_netclassesPane, wxID_ANY, _("Net Classes") ), wxVERTICAL ); sbSizerUpper = new wxStaticBoxSizer( new wxStaticBox( m_netclassesPane, wxID_ANY, _("Net Classes") ), wxVERTICAL );
sbSizerUpper->SetMinSize( wxSize( -1,220 ) ); sbSizerUpper->SetMinSize( wxSize( -1,200 ) );
m_netclassGrid = new WX_GRID( m_netclassesPane, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_DEFAULT|wxHSCROLL|wxTAB_TRAVERSAL|wxVSCROLL ); m_netclassGrid = new WX_GRID( m_netclassesPane, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_DEFAULT|wxHSCROLL|wxTAB_TRAVERSAL|wxVSCROLL );
// Grid // Grid
m_netclassGrid->CreateGrid( 1, 10 ); m_netclassGrid->CreateGrid( 1, 13 );
m_netclassGrid->EnableEditing( true ); m_netclassGrid->EnableEditing( true );
m_netclassGrid->EnableGridLines( true ); m_netclassGrid->EnableGridLines( true );
m_netclassGrid->EnableDragGridSize( false ); m_netclassGrid->EnableDragGridSize( false );
m_netclassGrid->SetMargins( 0, 0 ); m_netclassGrid->SetMargins( 0, 0 );
// Columns // Columns
m_netclassGrid->SetColSize( 0, 130 );
m_netclassGrid->SetColSize( 1, 96 );
m_netclassGrid->SetColSize( 2, 96 );
m_netclassGrid->SetColSize( 3, 96 );
m_netclassGrid->SetColSize( 4, 96 );
m_netclassGrid->SetColSize( 5, 96 );
m_netclassGrid->SetColSize( 6, 96 );
m_netclassGrid->SetColSize( 7, 60 );
m_netclassGrid->SetColSize( 8, 60 );
m_netclassGrid->SetColSize( 9, 60 );
m_netclassGrid->EnableDragColMove( false ); m_netclassGrid->EnableDragColMove( false );
m_netclassGrid->EnableDragColSize( true ); m_netclassGrid->EnableDragColSize( true );
m_netclassGrid->SetColLabelSize( 24 ); m_netclassGrid->SetColLabelSize( 24 );
@ -56,7 +46,10 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi
m_netclassGrid->SetColLabelValue( 6, _("uVia Drill") ); m_netclassGrid->SetColLabelValue( 6, _("uVia Drill") );
m_netclassGrid->SetColLabelValue( 7, _("DP Width") ); m_netclassGrid->SetColLabelValue( 7, _("DP Width") );
m_netclassGrid->SetColLabelValue( 8, _("DP Gap") ); m_netclassGrid->SetColLabelValue( 8, _("DP Gap") );
m_netclassGrid->SetColLabelValue( 9, _("DP Via Gap") ); m_netclassGrid->SetColLabelValue( 9, _("Wire Thickness") );
m_netclassGrid->SetColLabelValue( 10, _("Bus Thickness") );
m_netclassGrid->SetColLabelValue( 11, _("Color") );
m_netclassGrid->SetColLabelValue( 12, _("Line Style") );
m_netclassGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); m_netclassGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows // Rows
@ -92,7 +85,7 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi
m_netclassesPane->SetSizer( sbSizerUpper ); m_netclassesPane->SetSizer( sbSizerUpper );
m_netclassesPane->Layout(); m_netclassesPane->Layout();
sbSizerUpper->Fit( m_netclassesPane ); sbSizerUpper->Fit( m_netclassesPane );
bMargins->Add( m_netclassesPane, 1, wxALL|wxEXPAND, 5 ); bMargins->Add( m_netclassesPane, 4, wxALL|wxEXPAND, 5 );
m_membershipPane = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_membershipPane = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxStaticBoxSizer* sbMembership; wxStaticBoxSizer* sbMembership;
@ -233,7 +226,7 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi
m_membershipPane->SetSizer( sbMembership ); m_membershipPane->SetSizer( sbMembership );
m_membershipPane->Layout(); m_membershipPane->Layout();
sbMembership->Fit( m_membershipPane ); sbMembership->Fit( m_membershipPane );
bMargins->Add( m_membershipPane, 1, wxALL|wxEXPAND, 5 ); bMargins->Add( m_membershipPane, 5, wxALL|wxEXPAND, 5 );
bpanelNetClassesSizer->Add( bMargins, 1, wxEXPAND, 5 ); bpanelNetClassesSizer->Add( bMargins, 1, wxEXPAND, 5 );

View File

@ -14,7 +14,6 @@
<property name="file">panel_setup_netclasses_base</property> <property name="file">panel_setup_netclasses_base</property>
<property name="first_id">1000</property> <property name="first_id">1000</property>
<property name="help_provider">none</property> <property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property> <property name="indent_with_spaces"></property>
<property name="internationalize">1</property> <property name="internationalize">1</property>
<property name="name">panel_setup_netclasses_base</property> <property name="name">panel_setup_netclasses_base</property>
@ -26,7 +25,6 @@
<property name="skip_php_events">1</property> <property name="skip_php_events">1</property>
<property name="skip_python_events">1</property> <property name="skip_python_events">1</property>
<property name="ui_table">UI</property> <property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">1</property> <property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="1"> <object class="Panel" expanded="1">
@ -69,7 +67,7 @@
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">4</property>
<object class="wxPanel" expanded="1"> <object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
@ -124,7 +122,7 @@
<object class="wxStaticBoxSizer" expanded="1"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Net Classes</property> <property name="label">Net Classes</property>
<property name="minimum_size">-1,220</property> <property name="minimum_size">-1,200</property>
<property name="name">sbSizerUpper</property> <property name="name">sbSizerUpper</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">0</property> <property name="parent">0</property>
@ -157,10 +155,10 @@
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property> <property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="col_label_size">24</property> <property name="col_label_size">24</property>
<property name="col_label_values">&quot;Name&quot; &quot;Clearance&quot; &quot;Track Width&quot; &quot;Via Size&quot; &quot;Via Drill&quot; &quot;uVia Size&quot; &quot;uVia Drill&quot; &quot;DP Width&quot; &quot;DP Gap&quot; &quot;DP Via Gap&quot;</property> <property name="col_label_values">&quot;Name&quot; &quot;Clearance&quot; &quot;Track Width&quot; &quot;Via Size&quot; &quot;Via Drill&quot; &quot;uVia Size&quot; &quot;uVia Drill&quot; &quot;DP Width&quot; &quot;DP Gap&quot; &quot;Wire Thickness&quot; &quot;Bus Thickness&quot; &quot;Color&quot; &quot;Line Style&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property> <property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">10</property> <property name="cols">13</property>
<property name="column_sizes">130,96,96,96,96,96,96,60,60,60</property> <property name="column_sizes"></property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
<property name="default_pane">0</property> <property name="default_pane">0</property>
@ -240,7 +238,6 @@
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position"></property>
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="bitmap"></property> <property name="bitmap"></property>
@ -324,7 +321,6 @@
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position"></property>
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="bitmap"></property> <property name="bitmap"></property>
@ -393,7 +389,7 @@
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">5</property>
<object class="wxPanel" expanded="1"> <object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
@ -768,7 +764,6 @@
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position"></property>
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="bitmap"></property> <property name="bitmap"></property>
@ -852,7 +847,6 @@
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position"></property>
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="bitmap"></property> <property name="bitmap"></property>
@ -1087,7 +1081,6 @@
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position"></property>
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="bitmap"></property> <property name="bitmap"></property>
@ -1171,7 +1164,6 @@
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position"></property>
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="bitmap"></property> <property name="bitmap"></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/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2009 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2009 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@inpg.fr * Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@inpg.fr
* Copyright (C) 2009 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2009-2020 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -24,29 +24,27 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
#include <kicad_string.h>
#include <macros.h>
#include <netclass.h> #include <netclass.h>
#ifndef PCBNEW
#define PCBNEW // needed to define the right value of Millimeter2iu(x)
#endif
#include <base_units.h> #include <base_units.h>
// This will get mapped to "kicad_default" in the specctra_export. // This will get mapped to "kicad_default" in the specctra_export.
const char NETCLASS::Default[] = "Default"; const char NETCLASS::Default[] = "Default";
// Initial values for netclass initialization // Initial values for netclass initialization
const int DEFAULT_CLEARANCE = Millimeter2iu( 0.2 ); // track to track and track to pads clearance const int DEFAULT_CLEARANCE = PcbMillimeter2iu( 0.2 ); // track to track and track to pads clearance
const int DEFAULT_VIA_DIAMETER = Millimeter2iu( 0.8 ); const int DEFAULT_VIA_DIAMETER = PcbMillimeter2iu( 0.8 );
const int DEFAULT_VIA_DRILL = Millimeter2iu( 0.4 ); const int DEFAULT_VIA_DRILL = PcbMillimeter2iu( 0.4 );
const int DEFAULT_UVIA_DIAMETER = Millimeter2iu( 0.3 ); const int DEFAULT_UVIA_DIAMETER = PcbMillimeter2iu( 0.3 );
const int DEFAULT_UVIA_DRILL = Millimeter2iu( 0.1 ); const int DEFAULT_UVIA_DRILL = PcbMillimeter2iu( 0.1 );
const int DEFAULT_TRACK_WIDTH = Millimeter2iu( 0.25 ); const int DEFAULT_TRACK_WIDTH = PcbMillimeter2iu( 0.25 );
const int DEFAULT_DIFF_PAIR_WIDTH = Millimeter2iu( 0.2 ); const int DEFAULT_DIFF_PAIR_WIDTH = PcbMillimeter2iu( 0.2 );
const int DEFAULT_DIFF_PAIR_GAP = Millimeter2iu( 0.25 ); const int DEFAULT_DIFF_PAIR_GAP = PcbMillimeter2iu( 0.25 );
const int DEFAULT_DIFF_PAIR_VIAGAP = Millimeter2iu( 0.25 ); const int DEFAULT_DIFF_PAIR_VIAGAP = PcbMillimeter2iu( 0.25 );
const int DEFAULT_WIRE_WIDTH = SchMils2iu( 6 );
const int DEFAULT_BUS_WIDTH = SchMils2iu( 12 );
const int DEFAULT_LINE_STYLE = 0; // solid
NETCLASS::NETCLASS( const wxString& aName ) : NETCLASS::NETCLASS( const wxString& aName ) :
@ -65,21 +63,11 @@ NETCLASS::NETCLASS( const wxString& aName ) :
SetDiffPairWidth( DEFAULT_DIFF_PAIR_WIDTH ); SetDiffPairWidth( DEFAULT_DIFF_PAIR_WIDTH );
SetDiffPairGap( DEFAULT_DIFF_PAIR_GAP ); SetDiffPairGap( DEFAULT_DIFF_PAIR_GAP );
SetDiffPairViaGap( DEFAULT_DIFF_PAIR_VIAGAP ); SetDiffPairViaGap( DEFAULT_DIFF_PAIR_VIAGAP );
}
SetWireWidth( DEFAULT_WIRE_WIDTH );
void NETCLASS::SetParams( const NETCLASS& aDefaults ) SetBusWidth( DEFAULT_BUS_WIDTH );
{ SetSchematicColor( COLOR4D::UNSPECIFIED );
SetClearance( aDefaults.GetClearance() ); SetLineStyle( DEFAULT_LINE_STYLE );
SetTrackWidth( aDefaults.GetTrackWidth() );
SetViaDiameter( aDefaults.GetViaDiameter() );
SetViaDrill( aDefaults.GetViaDrill() );
SetuViaDiameter( aDefaults.GetuViaDiameter() );
SetuViaDrill( aDefaults.GetuViaDrill() );
SetDiffPairWidth( aDefaults.GetDiffPairWidth() );
SetDiffPairGap( aDefaults.GetDiffPairGap() );
SetDiffPairViaGap( aDefaults.GetDiffPairViaGap() );
SetPcbColor( KIGFX::COLOR4D::UNSPECIFIED );
} }

View File

@ -20,13 +20,9 @@
#include <project/net_settings.h> #include <project/net_settings.h>
#include <settings/parameters.h> #include <settings/parameters.h>
#include <settings/settings_manager.h>
// Netclasses were originally only stored in board files. The IU context is PCBNEW.
#ifndef PCBNEW
#define PCBNEW
#endif
#include <base_units.h>
#include <kicad_string.h> #include <kicad_string.h>
#include <convert_to_biu.h>
const int netSettingsSchemaVersion = 0; const int netSettingsSchemaVersion = 0;
@ -51,17 +47,19 @@ NET_SETTINGS::NET_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
++nc; ++nc;
} }
// Note: we're in common/, but we do happen to know which of these fields
// are used in which units system.
nlohmann::json netJson = { nlohmann::json netJson = {
{ "name", netclass->GetName().ToUTF8() }, { "name", netclass->GetName().ToUTF8() },
{ "clearance", Iu2Millimeter( netclass->GetClearance() ) }, { "clearance", PcbIu2Millimeter( netclass->GetClearance() ) },
{ "track_width", Iu2Millimeter( netclass->GetTrackWidth() ) }, { "track_width", PcbIu2Millimeter( netclass->GetTrackWidth() ) },
{ "via_diameter", Iu2Millimeter( netclass->GetViaDiameter() ) }, { "via_diameter", PcbIu2Millimeter( netclass->GetViaDiameter() ) },
{ "via_drill", Iu2Millimeter( netclass->GetViaDrill() ) }, { "via_drill", PcbIu2Millimeter( netclass->GetViaDrill() ) },
{ "microvia_diameter", Iu2Millimeter( netclass->GetuViaDiameter() ) }, { "microvia_diameter", PcbIu2Millimeter( netclass->GetuViaDiameter() ) },
{ "microvia_drill", Iu2Millimeter( netclass->GetuViaDrill() ) }, { "microvia_drill", PcbIu2Millimeter( netclass->GetuViaDrill() ) },
{ "diff_pair_width", Iu2Millimeter( netclass->GetDiffPairWidth() ) }, { "diff_pair_width", PcbIu2Millimeter( netclass->GetDiffPairWidth() ) },
{ "diff_pair_gap", Iu2Millimeter( netclass->GetDiffPairGap() ) }, { "diff_pair_gap", PcbIu2Millimeter( netclass->GetDiffPairGap() ) },
{ "diff_pair_via_gap", Iu2Millimeter( netclass->GetDiffPairViaGap() ) } { "diff_pair_via_gap", PcbIu2Millimeter( netclass->GetDiffPairViaGap() ) }
}; };
if( netclass->GetPcbColor() != KIGFX::COLOR4D::UNSPECIFIED ) if( netclass->GetPcbColor() != KIGFX::COLOR4D::UNSPECIFIED )
@ -74,7 +72,7 @@ NET_SETTINGS::NET_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
for( const auto& ii : *netclass ) for( const auto& ii : *netclass )
{ {
if( !ii.empty() ) if( !ii.empty() )
membersJson.push_back( std::string( ii.ToUTF8() ) ); membersJson.push_back( ii );
} }
netJson["nets"] = membersJson; netJson["nets"] = membersJson;
@ -98,7 +96,7 @@ NET_SETTINGS::NET_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
[]( const nlohmann::json& aObj, const std::string& aKey, int aDefault ) []( const nlohmann::json& aObj, const std::string& aKey, int aDefault )
{ {
if( aObj.contains( aKey ) ) if( aObj.contains( aKey ) )
return Millimeter2iu( aObj[aKey].get<double>() ); return PcbMillimeter2iu( aObj[aKey].get<double>() );
else else
return aDefault; return aDefault;
}; };

View File

@ -0,0 +1,162 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <grid_color_swatch_helpers.h>
#include <settings/color_settings.h>
#include <dialogs/dialog_color_picker.h>
#include <dialog_shim.h>
//-------- Custom wxGridCellRenderers --------------------------------------------------
GRID_CELL_COLOR_RENDERER::GRID_CELL_COLOR_RENDERER()
{
}
GRID_CELL_COLOR_RENDERER::~GRID_CELL_COLOR_RENDERER()
{
}
wxGridCellRenderer* GRID_CELL_COLOR_RENDERER::Clone() const
{
return new GRID_CELL_COLOR_RENDERER;
}
wxSize GRID_CELL_COLOR_RENDERER::GetBestSize( wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
int row, int col )
{
wxSize bestSize;
dc.SetFont(attr.GetFont());
dc.GetTextExtent( "WWW", &bestSize.x, &bestSize.y );
return bestSize;
}
void GRID_CELL_COLOR_RENDERER::Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC& aDC,
const wxRect& aRect, int aRow, int aCol, bool isSelected )
{
wxRect rect = aRect;
// erase background
wxGridCellRenderer::Draw( aGrid, aAttr, aDC, aRect, aRow, aCol, isSelected );
// draw the swatch
wxBitmap bitmap( aRect.GetWidth() + 1, aRect.GetHeight() + 1 );
wxMemoryDC bmpDC;
wxBrush brush;
wxColour color;
// Prepare Bitmap
bmpDC.SelectObject( bitmap );
color.Set( aGrid.GetTable()->GetValue( aRow, aCol ) );
brush.SetStyle( wxBRUSHSTYLE_SOLID );
brush.SetColour( color );
bmpDC.SetBrush( brush );
bmpDC.DrawRectangle( -1, -1, bitmap.GetWidth()+1, bitmap.GetHeight()+1 );
aDC.DrawBitmap( bitmap, rect.GetTopLeft(), true );
}
//-------- Custom wxGridCellEditors ----------------------------------------------------
//
// Note: this implementation is an adaptation of wxGridCellBoolEditor
GRID_CELL_COLOR_SELECTOR::GRID_CELL_COLOR_SELECTOR( DIALOG_SHIM* aDialog, wxGrid* aGrid ) :
m_dialog( aDialog ),
m_grid( aGrid ),
m_value( COLOR4D::UNSPECIFIED )
{
}
wxGridCellEditor* GRID_CELL_COLOR_SELECTOR::Clone() const
{
return new GRID_CELL_COLOR_SELECTOR( m_dialog, m_grid );
}
void GRID_CELL_COLOR_SELECTOR::Create( wxWindow* aParent, wxWindowID aId,
wxEvtHandler* aEventHandler )
{
// wxWidgets needs a control to hold on to the event handler
m_control = new wxCheckBox( aParent, wxID_ANY, wxEmptyString );
wxGridCellEditor::Create( aParent, aId, aEventHandler );
}
wxString GRID_CELL_COLOR_SELECTOR::GetValue() const
{
return m_value.ToWxString( wxC2S_CSS_SYNTAX );
}
void GRID_CELL_COLOR_SELECTOR::BeginEdit( int row, int col, wxGrid* grid )
{
m_value.SetFromWxString( grid->GetTable()->GetValue( row, col ) );
DIALOG_COLOR_PICKER dialog( m_dialog, m_value, false );
if( dialog.ShowModal() == wxID_OK )
m_value = dialog.GetColor();
m_grid->GetTable()->SetValue( row, col, GetValue() );
// That's it; we're all done
m_grid->HideCellEditControl();
m_grid->ForceRefresh();
}
bool GRID_CELL_COLOR_SELECTOR::EndEdit( int row, int col, const wxGrid* grid,
const wxString& oldval, wxString *newval )
{
if ( newval )
*newval = GetValue();
return true;
}
void GRID_CELL_COLOR_SELECTOR::ApplyEdit( int aRow, int aCol, wxGrid* aGrid )
{
aGrid->GetTable()->SetValue( aRow, aCol, GetValue() );
}
void GRID_CELL_COLOR_SELECTOR::Reset()
{
}

View File

@ -0,0 +1,79 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef GRID_COLOR_SWATCH_HELPERS
#define GRID_COLOR_SWATCH_HELPERS
#include <wx/generic/gridctrl.h>
#include <wx/generic/grideditors.h>
#include <gal/color4d.h>
class wxGrid;
class DIALOG_SHIM;
//-------- Custom wxGridCellRenderers --------------------------------------------------
class GRID_CELL_COLOR_RENDERER : public wxGridCellRenderer
{
public:
GRID_CELL_COLOR_RENDERER();
~GRID_CELL_COLOR_RENDERER() override;
wxGridCellRenderer* Clone() const override;
wxSize GetBestSize( wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, int row, int col ) override;
void Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC& aDC, const wxRect& aRect, int aRow,
int aCol, bool isSelected ) override;
};
//-------- Custom wxGridCellEditors ----------------------------------------------------
//
// Note: this implementation is an adaptation of wxGridCellChoiceEditor
class GRID_CELL_COLOR_SELECTOR : public wxGridCellEditor
{
public:
GRID_CELL_COLOR_SELECTOR( DIALOG_SHIM* aDialog, wxGrid* aGrid );
wxGridCellEditor* Clone() const override;
void Create( wxWindow* aParent, wxWindowID aId, wxEvtHandler* aEventHandler ) override;
wxString GetValue() const override;
void BeginEdit( int aRow, int aCol, wxGrid* aGrid ) override;
bool EndEdit( int , int , const wxGrid* , const wxString& , wxString *newval ) override;
void ApplyEdit( int aRow, int aCol, wxGrid* aGrid ) override;
void Reset() override;
protected:
DIALOG_SHIM* m_dialog;
wxGrid* m_grid;
KIGFX::COLOR4D m_value;
wxDECLARE_NO_COPY_CLASS( GRID_CELL_COLOR_SELECTOR );
};
#endif // GRID_COLOR_SWATCH_HELPERS

View File

@ -38,8 +38,7 @@ GRID_CELL_ICON_TEXT_RENDERER::GRID_CELL_ICON_TEXT_RENDERER( const std::vector<BI
} }
void GRID_CELL_ICON_TEXT_RENDERER::Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC& aDC, void GRID_CELL_ICON_TEXT_RENDERER::Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC& aDC,
const wxRect& aRect, int aRow, int aCol, const wxRect& aRect, int aRow, int aCol, bool isSelected )
bool isSelected )
{ {
wxString value = aGrid.GetCellValue( aRow, aCol ); wxString value = aGrid.GetCellValue( aRow, aCol );
wxBitmap bitmap; wxBitmap bitmap;
@ -69,6 +68,19 @@ void GRID_CELL_ICON_TEXT_RENDERER::Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, w
aGrid.DrawTextRectangle( aDC, value, rect, wxALIGN_LEFT, wxALIGN_CENTRE ); aGrid.DrawTextRectangle( aDC, value, rect, wxALIGN_LEFT, wxALIGN_CENTRE );
} }
wxSize GRID_CELL_ICON_TEXT_RENDERER::GetBestSize( wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
int row, int col )
{
wxBitmap bitmap = KiBitmap( (BITMAP_DEF) m_icons[ row ] );
wxString text = grid.GetCellValue( row, col );
wxSize size = wxGridCellStringRenderer::DoGetBestSize( attr, dc, text );
size.x += bitmap.GetWidth() + 6;
return size;
}
//---- Grid helpers: custom wxGridCellRenderer that renders just an icon ---------------- //---- Grid helpers: custom wxGridCellRenderer that renders just an icon ----------------
// //
// Note: this renderer is supposed to be used with read only cells // Note: this renderer is supposed to be used with read only cells

View File

@ -56,7 +56,7 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
m_textVars = new PANEL_TEXT_VARIABLES( m_treebook, &Prj() ); m_textVars = new PANEL_TEXT_VARIABLES( m_treebook, &Prj() );
m_netclasses = new PANEL_SETUP_NETCLASSES( this, &project.NetSettings().m_NetClasses, m_netclasses = new PANEL_SETUP_NETCLASSES( this, &project.NetSettings().m_NetClasses,
schematic.GetNetClassAssignmentCandidates() ); schematic.GetNetClassAssignmentCandidates(), true );
/* /*
* WARNING: If you change page names you MUST update calls to ShowSchematicSetupDialog(). * WARNING: If you change page names you MUST update calls to ShowSchematicSetupDialog().

View File

@ -31,6 +31,7 @@
#include <sch_line.h> #include <sch_line.h>
#include <sch_text.h> #include <sch_text.h>
#include <settings/color_settings.h> #include <settings/color_settings.h>
#include <netclass.h>
#include "sch_painter.h" #include "sch_painter.h"
@ -122,8 +123,35 @@ const EDA_RECT SCH_BUS_ENTRY_BASE::GetBoundingBox() const
} }
COLOR4D SCH_BUS_ENTRY_BASE::GetStrokeColor() const
{
NETCLASSPTR netclass = NetClass();
if( netclass && netclass->GetSchematicColor() != COLOR4D::UNSPECIFIED )
return netclass->GetSchematicColor();
return m_stroke.GetColor();
}
PLOT_DASH_TYPE SCH_BUS_ENTRY_BASE::GetStrokeStyle() const
{
NETCLASSPTR netclass = NetClass();
if( netclass )
return (PLOT_DASH_TYPE) netclass->GetLineStyle();
return m_stroke.GetType();
}
int SCH_BUS_WIRE_ENTRY::GetPenWidth() const int SCH_BUS_WIRE_ENTRY::GetPenWidth() const
{ {
NETCLASSPTR netclass = NetClass();
if( netclass )
return netclass->GetWireWidth();
if( m_stroke.GetWidth() == 0 && Schematic() ) if( m_stroke.GetWidth() == 0 && Schematic() )
return std::max( Schematic()->Settings().m_DefaultWireThickness, 1 ); return std::max( Schematic()->Settings().m_DefaultWireThickness, 1 );
@ -133,6 +161,11 @@ int SCH_BUS_WIRE_ENTRY::GetPenWidth() const
int SCH_BUS_BUS_ENTRY::GetPenWidth() const int SCH_BUS_BUS_ENTRY::GetPenWidth() const
{ {
NETCLASSPTR netclass = NetClass();
if( netclass )
return netclass->GetBusWidth();
if( m_stroke.GetWidth() == 0 && Schematic() ) if( m_stroke.GetWidth() == 0 && Schematic() )
return std::max( Schematic()->Settings().m_DefaultBusThickness, 1 ); return std::max( Schematic()->Settings().m_DefaultBusThickness, 1 );

View File

@ -78,10 +78,10 @@ public:
virtual STROKE_PARAMS GetStroke() const override { return m_stroke; } virtual STROKE_PARAMS GetStroke() const override { return m_stroke; }
virtual void SetStroke( const STROKE_PARAMS& aStroke ) override { m_stroke = aStroke; } virtual void SetStroke( const STROKE_PARAMS& aStroke ) override { m_stroke = aStroke; }
PLOT_DASH_TYPE GetStrokeStyle() const { return m_stroke.GetType(); } PLOT_DASH_TYPE GetStrokeStyle() const;
void SetStrokeStyle( PLOT_DASH_TYPE aStyle ) { m_stroke.SetType( aStyle ); } void SetStrokeStyle( PLOT_DASH_TYPE aStyle ) { m_stroke.SetType( aStyle ); }
COLOR4D GetStrokeColor() const { return m_stroke.GetColor(); } COLOR4D GetStrokeColor() const;
void SetStrokeColor( const COLOR4D& aColor ) { m_stroke.SetColor( aColor ); } void SetStrokeColor( const COLOR4D& aColor ) { m_stroke.SetColor( aColor ); }
void SwapData( SCH_ITEM* aItem ) override; void SwapData( SCH_ITEM* aItem ) override;

View File

@ -37,6 +37,9 @@
#include <sch_pin.h> #include <sch_pin.h>
#include <schematic.h> #include <schematic.h>
#include <general.h> #include <general.h>
#include <netclass.h>
#include <project/project_file.h>
#include <project/net_settings.h>
/* Constructor and destructor for SCH_ITEM */ /* Constructor and destructor for SCH_ITEM */
@ -154,6 +157,22 @@ SCH_CONNECTION* SCH_ITEM::Connection( const SCH_SHEET_PATH& aSheet ) const
} }
NETCLASSPTR SCH_ITEM::NetClass() const
{
if( m_connection_map.size() )
{
NET_SETTINGS& netSettings = Schematic()->Prj().GetProjectFile().NetSettings();
const wxString& netname = m_connection_map.begin()->second->Name( true );
const wxString& netclassName = netSettings.m_NetClassAssignments[ netname ];
if( !netclassName.IsEmpty() )
return netSettings.m_NetClasses.Find( netclassName );
}
return nullptr;
}
ITEM_SET& SCH_ITEM::ConnectedItems( const SCH_SHEET_PATH& aSheet ) ITEM_SET& SCH_ITEM::ConnectedItems( const SCH_SHEET_PATH& aSheet )
{ {
return m_connected_items[ aSheet ]; return m_connected_items[ aSheet ];

View File

@ -37,6 +37,7 @@
#include <default_values.h> #include <default_values.h>
#include <sch_sheet_path.h> #include <sch_sheet_path.h>
#include <render_settings.h> #include <render_settings.h>
#include <netclass.h>
class CONNECTION_GRAPH; class CONNECTION_GRAPH;
class SCH_CONNECTION; class SCH_CONNECTION;
@ -426,6 +427,8 @@ public:
void SetConnectivityDirty( bool aDirty = true ) { m_connectivity_dirty = aDirty; } void SetConnectivityDirty( bool aDirty = true ) { m_connectivity_dirty = aDirty; }
NETCLASSPTR NetClass() const;
/** /**
* Return whether the fields have been automatically placed. * Return whether the fields have been automatically placed.
*/ */

View File

@ -23,13 +23,8 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
//#include <gr_basic.h>
//#include <macros.h>
//#include <sch_draw_panel.h>
#include <sch_painter.h> #include <sch_painter.h>
#include <plotter.h> #include <plotter.h>
//#include <base_units.h>
//#include <general.h>
#include <sch_line.h> #include <sch_line.h>
#include <sch_edit_frame.h> #include <sch_edit_frame.h>
#include <settings/color_settings.h> #include <settings/color_settings.h>
@ -51,17 +46,9 @@ SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
switch( layer ) switch( layer )
{ {
default: default: m_Layer = LAYER_NOTES; break;
m_Layer = LAYER_NOTES; case LAYER_WIRE: m_Layer = LAYER_WIRE; break;
break; case LAYER_BUS: m_Layer = LAYER_BUS; break;
case LAYER_WIRE:
m_Layer = LAYER_WIRE;
break;
case LAYER_BUS:
m_Layer = LAYER_BUS;
break;
} }
} }
@ -221,6 +208,11 @@ void SCH_LINE::SetLineColor( const double r, const double g, const double b, con
COLOR4D SCH_LINE::GetLineColor() const COLOR4D SCH_LINE::GetLineColor() const
{ {
NETCLASSPTR netclass = NetClass();
if( netclass && netclass->GetSchematicColor() != COLOR4D::UNSPECIFIED )
return netclass->GetSchematicColor();
return m_stroke.GetColor(); return m_stroke.GetColor();
} }
@ -258,6 +250,17 @@ PLOT_DASH_TYPE SCH_LINE::GetLineStyle() const
} }
PLOT_DASH_TYPE SCH_LINE::GetEffectiveLineStyle() const
{
NETCLASSPTR netclass = NetClass();
if( netclass )
return (PLOT_DASH_TYPE) netclass->GetLineStyle();
return GetLineStyle();
}
void SCH_LINE::SetLineWidth( const int aSize ) void SCH_LINE::SetLineWidth( const int aSize )
{ {
m_stroke.SetWidth( aSize ); m_stroke.SetWidth( aSize );
@ -266,6 +269,11 @@ void SCH_LINE::SetLineWidth( const int aSize )
int SCH_LINE::GetPenWidth() const int SCH_LINE::GetPenWidth() const
{ {
NETCLASSPTR netclass = NetClass();
if( netclass )
return ( m_Layer == LAYER_BUS ) ? netclass->GetBusWidth() : netclass->GetWireWidth();
if( m_stroke.GetWidth() == 0 && Schematic() ) if( m_stroke.GetWidth() == 0 && Schematic() )
return std::max( Schematic()->Settings().m_DefaultLineWidth, 1 ); return std::max( Schematic()->Settings().m_DefaultLineWidth, 1 );
@ -285,7 +293,7 @@ void SCH_LINE::Print( RENDER_SETTINGS* aSettings, const wxPoint& offset )
color = aSettings->GetLayerColor( m_Layer ); color = aSettings->GetLayerColor( m_Layer );
GRLine( nullptr, DC, start.x, start.y, end.x, end.y, penWidth, color, GRLine( nullptr, DC, start.x, start.y, end.x, end.y, penWidth, color,
GetwxPenStyle( GetLineStyle() ) ); GetwxPenStyle( GetEffectiveLineStyle() ) );
} }
@ -740,7 +748,7 @@ void SCH_LINE::Plot( PLOTTER* aPlotter )
penWidth = m_stroke.GetWidth(); penWidth = m_stroke.GetWidth();
aPlotter->SetCurrentLineWidth( penWidth ); aPlotter->SetCurrentLineWidth( penWidth );
aPlotter->SetDash( GetLineStyle() ); aPlotter->SetDash( GetEffectiveLineStyle() );
aPlotter->MoveTo( m_start ); aPlotter->MoveTo( m_start );
aPlotter->FinishTo( m_end ); aPlotter->FinishTo( m_end );
@ -768,7 +776,12 @@ void SCH_LINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
} }
aList.push_back( MSG_PANEL_ITEM( _( "Line Type" ), msg, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Line Type" ), msg, DARKCYAN ) );
if( GetLineStyle() != GetEffectiveLineStyle() )
msg = _( "from netclass" );
else
msg = GetLineStyleName( GetLineStyle() ); msg = GetLineStyleName( GetLineStyle() );
aList.push_back( MSG_PANEL_ITEM( _( "Line Style" ), msg, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Line Style" ), msg, DARKCYAN ) );
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ); SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );

View File

@ -103,12 +103,16 @@ public:
void SetLineStyle( const int aStyleId ); void SetLineStyle( const int aStyleId );
PLOT_DASH_TYPE GetLineStyle() const; PLOT_DASH_TYPE GetLineStyle() const;
/// @return the style that the line should be drawn in
/// this might be set on the line or inherited from the line's netclass
PLOT_DASH_TYPE GetEffectiveLineStyle() const;
/// @return the style name from the style id /// @return the style name from the style id
/// (mainly to write it in .sch file /// (mainly to write it in .sch file)
static const char* GetLineStyleName( PLOT_DASH_TYPE aStyle ); static const char* GetLineStyleName( PLOT_DASH_TYPE aStyle );
/// @return the style id from the style name /// @return the style id from the style name
/// (mainly to read style from .sch file /// (mainly to read style from .sch file)
static PLOT_DASH_TYPE GetLineStyleByName( const wxString& aStyleName ); static PLOT_DASH_TYPE GetLineStyleByName( const wxString& aStyleName );
void SetLineColor( const COLOR4D& aColor ); void SetLineColor( const COLOR4D& aColor );

View File

@ -329,27 +329,7 @@ float SCH_PAINTER::getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows )
{ {
wxCHECK( aItem, static_cast<float>( m_schSettings.m_DefaultWireThickness ) ); wxCHECK( aItem, static_cast<float>( m_schSettings.m_DefaultWireThickness ) );
float width; float width = (float) std::max( aItem->GetPenWidth(), m_schSettings.GetDefaultPenWidth() );
const SCH_LINE* line = dynamic_cast<const SCH_LINE*>( aItem );
if( line && aItem->GetLayer() == LAYER_WIRE )
{
if( line->GetLineSize() != 0 )
width = (float) line->GetLineSize();
else
width = (float) m_schSettings.m_DefaultWireThickness;
}
else if( line && aItem->GetLayer() == LAYER_BUS )
{
if( line->GetLineSize() != 0 )
width = (float) line->GetLineSize();
else
width = (float) m_schSettings.m_DefaultBusThickness;
}
else
{
width = (float) std::max( aItem->GetPenWidth(), m_schSettings.GetDefaultPenWidth() );
}
if( aItem->IsSelected() && aDrawingShadows ) if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth(); width += getShadowWidth();
@ -1226,12 +1206,13 @@ void SCH_PAINTER::draw( SCH_LINE *aLine, int aLayer )
COLOR4D color = getRenderColor( aLine, aLine->GetLayer(), drawingShadows ); COLOR4D color = getRenderColor( aLine, aLine->GetLayer(), drawingShadows );
float width = getLineWidth( aLine, drawingShadows ); float width = getLineWidth( aLine, drawingShadows );
PLOT_DASH_TYPE lineStyle = aLine->GetEffectiveLineStyle();
m_gal->SetIsStroke( true ); m_gal->SetIsStroke( true );
m_gal->SetStrokeColor( color ); m_gal->SetStrokeColor( color );
m_gal->SetLineWidth( width ); m_gal->SetLineWidth( width );
if( aLine->GetLineStyle() <= PLOT_DASH_TYPE::FIRST_TYPE || drawingShadows ) if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE || drawingShadows )
{ {
m_gal->DrawLine( aLine->GetStartPoint(), aLine->GetEndPoint() ); m_gal->DrawLine( aLine->GetStartPoint(), aLine->GetEndPoint() );
} }
@ -1246,7 +1227,7 @@ void SCH_PAINTER::draw( SCH_LINE *aLine, int aLayer )
double theta = atan2( end.y - start.y, end.x - start.x ); double theta = atan2( end.y - start.y, end.x - start.x );
double strokes[] = { 1.0, DASH_GAP_LEN( width ), 1.0, DASH_GAP_LEN( width ) }; double strokes[] = { 1.0, DASH_GAP_LEN( width ), 1.0, DASH_GAP_LEN( width ) };
switch( aLine->GetLineStyle() ) switch( lineStyle )
{ {
default: default:
case PLOT_DASH_TYPE::DASH: case PLOT_DASH_TYPE::DASH:
@ -1733,20 +1714,20 @@ void SCH_PAINTER::draw( SCH_BUS_ENTRY_BASE *aEntry, int aLayer )
if( aEntry->IsSelected() ) if( aEntry->IsSelected() )
line.SetSelected(); line.SetSelected();
else if( aEntry->IsBrightened() )
line.SetBrightened();
line.SetStartPoint( aEntry->GetPosition() ); line.SetStartPoint( aEntry->GetPosition() );
line.SetEndPoint( aEntry->m_End() ); line.SetEndPoint( aEntry->m_End() );
line.SetStroke( aEntry->GetStroke() ); line.SetStroke( aEntry->GetStroke() );
if( aEntry->GetStrokeColor() == COLOR4D::UNSPECIFIED )
{
COLOR4D color = getRenderColor( aEntry, LAYER_WIRE, drawingShadows ); COLOR4D color = getRenderColor( aEntry, LAYER_WIRE, drawingShadows );
if( aEntry->Type() == SCH_BUS_BUS_ENTRY_T ) if( aEntry->Type() == SCH_BUS_BUS_ENTRY_T )
color = getRenderColor( aEntry, LAYER_BUS, drawingShadows ); color = getRenderColor( aEntry, LAYER_BUS, drawingShadows );
line.SetLineColor( color ); line.SetLineColor( color );
} line.SetLineStyle( aEntry->GetStrokeStyle() );
draw( &line, aLayer ); draw( &line, aLayer );

View File

@ -326,12 +326,12 @@ void NGSPICE::init_dll()
const vector<string> dllPaths = { "", "/mingw64/bin", "/mingw32/bin" }; const vector<string> dllPaths = { "", "/mingw64/bin", "/mingw32/bin" };
#elif defined(__WXMAC__) #elif defined(__WXMAC__)
const vector<string> dllPaths = { const vector<string> dllPaths = {
GetOSXKicadUserDataDir() + "/PlugIns/ngspice", GetOSXKicadUserDataDir().ToStdString() + "/PlugIns/ngspice",
GetOSXKicadMachineDataDir() + "/PlugIns/ngspice", GetOSXKicadMachineDataDir().ToStdString() + "/PlugIns/ngspice",
// when running kicad.app // when running kicad.app
stdPaths.GetPluginsDir() + "/sim", stdPaths.GetPluginsDir().ToStdString() + "/sim",
// when running eeschema.app // when running eeschema.app
wxFileName( stdPaths.GetExecutablePath() ).GetPath() + "/../../../../../Contents/PlugIns/sim" wxFileName( stdPaths.GetExecutablePath() ).GetPath().ToStdString() + "/../../../../../Contents/PlugIns/sim"
}; };
#else // Unix systems #else // Unix systems
const vector<string> dllPaths = { "/usr/local/lib" }; const vector<string> dllPaths = { "/usr/local/lib" };
@ -411,8 +411,8 @@ void NGSPICE::init_dll()
{ {
".", ".",
#ifdef __WXMAC__ #ifdef __WXMAC__
stdPaths.GetPluginsDir() + "/sim/ngspice/scripts", stdPaths.GetPluginsDir().ToStdString() + "/sim/ngspice/scripts",
wxFileName( stdPaths.GetExecutablePath() ).GetPath() + "/../../../../../Contents/PlugIns/sim/ngspice/scripts" wxFileName( stdPaths.GetExecutablePath() ).GetPath().ToStdString() + "/../../../../../Contents/PlugIns/sim/ngspice/scripts"
#endif /* __WXMAC__ */ #endif /* __WXMAC__ */
"../share/kicad", "../share/kicad",
"../share", "../share",
@ -476,8 +476,8 @@ string NGSPICE::findCmPath() const
#ifdef __WXMAC__ #ifdef __WXMAC__
"/Applications/ngspice/lib/ngspice", "/Applications/ngspice/lib/ngspice",
"Contents/Frameworks", "Contents/Frameworks",
wxStandardPaths::Get().GetPluginsDir() + "/sim/ngspice", wxStandardPaths::Get().GetPluginsDir().ToStdString() + "/sim/ngspice",
wxFileName( wxStandardPaths::Get().GetExecutablePath() ).GetPath() + "/../../../../../Contents/PlugIns/sim/ngspice", wxFileName( wxStandardPaths::Get().GetExecutablePath() ).GetPath().ToStdString() + "/../../../../../Contents/PlugIns/sim/ngspice",
"../Plugins/sim/ngspice", "../Plugins/sim/ngspice",
#endif /* __WXMAC__ */ #endif /* __WXMAC__ */
"../lib/ngspice", "../lib/ngspice",

View File

@ -338,10 +338,6 @@ private:
/// The defualt settings that will be used for new zones /// The defualt settings that will be used for new zones
ZONE_SETTINGS m_defaultZoneSettings; ZONE_SETTINGS m_defaultZoneSettings;
SEVERITY severityFromString( const wxString& aSeverity );
wxString severityToString( const SEVERITY& aSeverity );
void initFromOther( const BOARD_DESIGN_SETTINGS& aOther ); void initFromOther( const BOARD_DESIGN_SETTINGS& aOther );
public: public:

View File

@ -31,50 +31,34 @@
* depending on compile time option * depending on compile time option
*/ */
constexpr double GERB_IU_PER_MM = 1e5; // Gerbview IU is 10 nanometers.
constexpr double PCB_IU_PER_MM = 1e6; // Pcbnew IU is 1 nanometer.
constexpr double PL_IU_PER_MM = 1e3; // internal units in micron (should be enough)
constexpr double SCH_IU_PER_MM = 1e4; // Schematic internal units 1=100nm
/// Scaling factor to convert mils to internal units. /// Scaling factor to convert mils to internal units.
#if defined(PCBNEW) || defined(CVPCB) || defined(GERBVIEW) #if defined(PCBNEW) || defined(CVPCB)
#if defined(GERBVIEW) constexpr double IU_PER_MM = PCB_IU_PER_MM;
constexpr double IU_PER_MM = 1e5; // Gerbview IU is 10 nanometers. #elif defined(GERBVIEW)
constexpr double IU_PER_MM = GERB_IU_PER_MM;
#elif defined(PL_EDITOR)
constexpr double IU_PER_MM = PL_IU_PER_MM;
#elif defined(EESCHEMA)
constexpr double IU_PER_MM = SCH_IU_PER_MM;
#else #else
constexpr double IU_PER_MM = 1e6; // Pcbnew IU is 1 nanometer. #define UNKNOWN_IU
#endif #endif
constexpr double IU_PER_MILS = IU_PER_MM * 0.0254; #ifndef UNKNOWN_IU
/// Convert mils to PCBNEW internal units (iu).
inline int Mils2iu( int mils )
{
double x = mils * IU_PER_MILS;
return int( x < 0 ? x - 0.5 : x + 0.5 );
}
constexpr inline double Iu2Mils( int iu )
{
double mils = iu / IU_PER_MILS;
return static_cast< int >( mils < 0 ? mils - 0.5 : mils + 0.5 );
}
#elif defined (PL_EDITOR)
constexpr double IU_PER_MM = 1e3; // internal units in micron (should be enough)
constexpr double IU_PER_MILS = (IU_PER_MM * 0.0254); constexpr double IU_PER_MILS = (IU_PER_MM * 0.0254);
/// Convert mils to page layout editor internal units (iu).
inline int Mils2iu( int mils )
{
double x = mils * IU_PER_MILS;
return int( x < 0 ? x - 0.5 : x + 0.5 );
}
#elif defined (EESCHEMA) // Eeschema
constexpr double IU_PER_MM = 1e4; // Schematic internal units 1=100nm
constexpr double IU_PER_MILS = IU_PER_MM * 0.0254;
constexpr inline int Mils2iu( int mils ) constexpr inline int Mils2iu( int mils )
{ {
double x = mils * IU_PER_MILS; double x = mils * IU_PER_MILS;
return int( x < 0 ? x - 0.5 : x + 0.5 ); return int( x < 0 ? x - 0.5 : x + 0.5 );
} }
#if defined(EESCHEMA)
constexpr inline int Iu2Mils( int iu ) constexpr inline int Iu2Mils( int iu )
{ {
double mils = iu / IU_PER_MILS; double mils = iu / IU_PER_MILS;
@ -82,12 +66,14 @@ constexpr inline int Iu2Mils( int iu )
return static_cast< int >( mils < 0 ? mils - 0.5 : mils + 0.5 ); return static_cast< int >( mils < 0 ? mils - 0.5 : mils + 0.5 );
} }
#else #else
// Here, we do not know the value of internal units: do not define constexpr inline double Iu2Mils( int iu )
// conversion functions (They do not have meaning) {
#define UNKNOWN_IU double mils = iu / IU_PER_MILS;
return static_cast< int >( mils < 0 ? mils - 0.5 : mils + 0.5 );
}
#endif #endif
#ifndef UNKNOWN_IU
// Other definitions used in a few files // Other definitions used in a few files
constexpr double MM_PER_IU = ( 1 / IU_PER_MM ); constexpr double MM_PER_IU = ( 1 / IU_PER_MM );
@ -117,6 +103,38 @@ constexpr inline double Iu2Millimeter( int iu )
constexpr int ARC_LOW_DEF = Millimeter2iu( 0.02 ); constexpr int ARC_LOW_DEF = Millimeter2iu( 0.02 );
constexpr int ARC_HIGH_DEF = Millimeter2iu( 0.005 ); constexpr int ARC_HIGH_DEF = Millimeter2iu( 0.005 );
#else
constexpr double PCB_IU_PER_MILS = (PCB_IU_PER_MM * 0.0254);
constexpr double SCH_IU_PER_MILS = (SCH_IU_PER_MM * 0.0254);
constexpr inline int PcbMils2iu( int mils )
{
double x = mils * PCB_IU_PER_MILS;
return int( x < 0 ? x - 0.5 : x + 0.5 );
}
constexpr inline int SchMils2iu( int mils )
{
double x = mils * SCH_IU_PER_MILS;
return int( x < 0 ? x - 0.5 : x + 0.5 );
}
constexpr inline int PcbMillimeter2iu( double mm )
{
return (int) ( mm < 0 ? mm * PCB_IU_PER_MM - 0.5 : mm * PCB_IU_PER_MM + 0.5 );
}
constexpr inline int SchMillimeter2iu( double mm )
{
return (int) ( mm < 0 ? mm * SCH_IU_PER_MM - 0.5 : mm * SCH_IU_PER_MM + 0.5 );
}
constexpr inline double PcbIu2Millimeter( int iu )
{
return iu / PCB_IU_PER_MM;
}
constexpr inline double SchIu2Millimeter( int iu )
{
return iu / SCH_IU_PER_MM;
}
#endif #endif
/* ZOOM LIMITS /* ZOOM LIMITS

View File

@ -1,13 +1,9 @@
/**
* @file class_netclass.h
*/
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2009 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@inpg.fr * Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@inpg.fr
* Copyright (C) 2009 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2009-2020 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -27,21 +23,18 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef CLASS_NETCLASS_H #ifndef CLASS_NETCLASS_H
#define CLASS_NETCLASS_H #define CLASS_NETCLASS_H
#include <macros.h> #include <macros.h>
#include <set>
#include <memory>
#include <richio.h>
#include <gal/color4d.h> #include <gal/color4d.h>
class LINE_READER; class LINE_READER;
class BOARD; class BOARD;
class BOARD_DESIGN_SETTINGS; class BOARD_DESIGN_SETTINGS;
using KIGFX::COLOR4D;
DECL_SET_FOR_SWIG( STRINGSET, wxString ) DECL_SET_FOR_SWIG( STRINGSET, wxString )
@ -76,10 +69,14 @@ protected:
int m_diffPairGap; int m_diffPairGap;
int m_diffPairViaGap; int m_diffPairViaGap;
KIGFX::COLOR4D m_PcbColor; ///< Optional color override for this netclass (PCB context) int m_wireWidth;
int m_busWidth;
COLOR4D m_schematicColor;
int m_lineStyle;
COLOR4D m_PcbColor; ///< Optional color override for this netclass (PCB context)
public: public:
static const char Default[]; ///< the name of the default NETCLASS static const char Default[]; ///< the name of the default NETCLASS
/** /**
@ -96,11 +93,7 @@ public:
return wxT( "NETCLASS" ); return wxT( "NETCLASS" );
} }
const wxString& GetName() const const wxString& GetName() const { return m_Name; }
{
return m_Name;
}
void SetName( const wxString& aName ) { m_Name = aName; } void SetName( const wxString& aName ) { m_Name = aName; }
/** /**
@ -196,17 +189,20 @@ public:
int GetDiffPairViaGap() const { return m_diffPairViaGap; } int GetDiffPairViaGap() const { return m_diffPairViaGap; }
void SetDiffPairViaGap( int aSize ) { m_diffPairViaGap = aSize; } void SetDiffPairViaGap( int aSize ) { m_diffPairViaGap = aSize; }
KIGFX::COLOR4D GetPcbColor() const { return m_PcbColor; } COLOR4D GetPcbColor() const { return m_PcbColor; }
void SetPcbColor( const KIGFX::COLOR4D& aColor ) { m_PcbColor = aColor; } void SetPcbColor( const COLOR4D& aColor ) { m_PcbColor = aColor; }
/** int GetWireWidth() const { return m_wireWidth; }
* Function SetParams void SetWireWidth( int aWidth ) { m_wireWidth = aWidth; }
* will set all the parameters by copying them from \a defaults.
* Parameters are the values like m_ViaSize, etc, but do not include m_Description.
* @param aDefaults is another NETCLASS object to copy from.
*/
void SetParams( const NETCLASS& aDefaults );
int GetBusWidth() const { return m_busWidth; }
void SetBusWidth( int aWidth ) { m_busWidth = aWidth; }
COLOR4D GetSchematicColor() const { return m_schematicColor; }
void SetSchematicColor( COLOR4D aColor ) { m_schematicColor = aColor; }
int GetLineStyle() const { return m_lineStyle; }
void SetLineStyle( int aStyle ) { m_lineStyle = aStyle; }
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; void Show( int nestLevel, std::ostream& os ) const;
@ -220,18 +216,13 @@ DECL_MAP_FOR_SWIG( NETCLASS_MAP, wxString, NETCLASSPTR )
/** /**
* NETCLASSES * NETCLASSES
* is a container for NETCLASS instances. It owns all its NETCLASSes * is a container for NETCLASS instances. It owns all its NETCLASSes. This container will
* (=> it will delete them at time of destruction). This container will always have * always have a default NETCLASS with the name given by const NETCLASS::Default.
* a default NETCLASS with the name given by const NETCLASS::Default.
*/ */
class NETCLASSES class NETCLASSES
{ {
private: private:
NETCLASS_MAP m_NetClasses; // All the netclasses EXCEPT the default one
/// all the NETCLASSes except the default one.
NETCLASS_MAP m_NetClasses;
/// the default NETCLASS
NETCLASSPTR m_default; NETCLASSPTR m_default;
public: public:

View File

@ -43,6 +43,7 @@ public:
void Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC& aDC, void Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC& aDC,
const wxRect& aRect, int aRow, int aCol, bool isSelected ) override; const wxRect& aRect, int aRow, int aCol, bool isSelected ) override;
wxSize GetBestSize( wxGrid & grid, wxGridCellAttr & attr, wxDC & dc, int row, int col ) override;
private: private:
const std::vector<BITMAP_DEF>& m_icons; const std::vector<BITMAP_DEF>& m_icons;

View File

@ -59,7 +59,7 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
bds.m_DRCSeverities ); bds.m_DRCSeverities );
m_netclasses = new PANEL_SETUP_NETCLASSES( this, &bds.GetNetClasses(), m_netclasses = new PANEL_SETUP_NETCLASSES( this, &bds.GetNetClasses(),
board->GetNetClassAssignmentCandidates() ); board->GetNetClassAssignmentCandidates(), false );
m_textVars = new PANEL_TEXT_VARIABLES( m_treebook, &Prj() ); m_textVars = new PANEL_TEXT_VARIABLES( m_treebook, &Prj() );

View File

@ -22,17 +22,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file pcbnew.h
*/
#ifndef PCBNEW_H #ifndef PCBNEW_H
#define PCBNEW_H #define PCBNEW_H
#include <fctsys.h> // wxWidgets include. #include <fctsys.h> // wxWidgets include.
#include <base_struct.h> // IS_DRAGGED and IN_EDIT definitions.
#include <convert_to_biu.h> // to define Mils2iu() conversion function #include <convert_to_biu.h> // to define Mils2iu() conversion function
#include <layers_id_colors_and_visibility.h>
// These are only here for algorithmic safety, not to tell the user what to do // These are only here for algorithmic safety, not to tell the user what to do
#define TEXTS_MIN_SIZE Mils2iu( 1 ) ///< Minimum text size in internal units (1 mil) #define TEXTS_MIN_SIZE Mils2iu( 1 ) ///< Minimum text size in internal units (1 mil)
@ -40,13 +34,6 @@
#define TEXTS_MAX_WIDTH Mils2iu( 10000 ) ///< Maximum text width in internal units (10 inches) #define TEXTS_MAX_WIDTH Mils2iu( 10000 ) ///< Maximum text width in internal units (10 inches)
// Flag to force the SKETCH mode to display items (.m_Flags member)
#define FORCE_SKETCH ( IS_DRAGGED | IN_EDIT )
/// List of segments of the trace currently being drawn.
class TRACK;
/** /**
* Helper function PythonPluginsReloadBase * Helper function PythonPluginsReloadBase
* Reload Python plugins if they are newer than * Reload Python plugins if they are newer than