Netclass setup for Eeschema.

ADDED netclass panel in Schematic Setup dialog.

Fixes https://gitlab.com/kicad/code/kicad/issues/2132
This commit is contained in:
Jeff Young 2020-07-04 00:28:24 +01:00
parent 2819570d1e
commit b0ca7d5140
5 changed files with 20 additions and 2 deletions

View File

@ -185,7 +185,10 @@ bool PANEL_SETUP_NETCLASSES::TransferDataToWindow()
// add all the nets discovered in the netclass membership lists
for( const std::pair<const wxString, wxString>& ii : netToNetclassMap )
addNet( UnescapeString( ii.first ), ii.second );
{
if( !ii.first.IsEmpty() )
addNet( UnescapeString( ii.first ), ii.second );
}
return true;
}

View File

@ -124,6 +124,12 @@ NET_SETTINGS::NET_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
netclass->SetDiffPairViaGap(
get( entry, "diff_pair_via_gap", netclass->GetDiffPairViaGap() ) );
if( entry.contains( "nets" ) && entry["nets"].is_array() )
{
for( const auto& net : entry["nets"].items() )
netclass->Add( net.value().get<wxString>() );
}
if( netclass != defaultClass )
m_NetClasses.Add( netclass );
}

View File

@ -22,6 +22,7 @@
#include <schematic.h>
#include <kiface_i.h>
#include <dialog_sch_import_settings.h>
#include <dialogs/panel_setup_netclasses.h>
#include <panel_setup_severities.h>
#include <panel_setup_formatting.h>
#include <panel_setup_pinmap.h>
@ -29,6 +30,7 @@
#include <erc_item.h>
#include <panel_text_variables.h>
#include <project/project_file.h>
#include <project/net_settings.h>
#include <settings/settings_manager.h>
#include "dialog_schematic_setup.h"
#include "panel_eeschema_template_fieldnames.h"
@ -50,6 +52,9 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
m_textVars = new PANEL_TEXT_VARIABLES( m_treebook, &Prj() );
PROJECT_FILE& project = aFrame->Prj().GetProjectFile();
m_netclasses = new PANEL_SETUP_NETCLASSES( this, &project.NetSettings().m_NetClasses );
/*
* WARNING: If you change page names you MUST update calls to ShowSchematicSetupDialog().
*/
@ -63,6 +68,7 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
m_treebook->AddSubPage( m_pinMap, _( "Pin Conflicts Map" ) );
m_treebook->AddPage( new wxPanel( this ), _( "Project" ) );
m_treebook->AddSubPage( m_netclasses, _( "Net Classes" ) );
m_treebook->AddSubPage( m_textVars, _( "Text Variables" ) );
for( size_t i = 0; i < m_treebook->GetPageCount(); ++i )
@ -96,6 +102,7 @@ void DIALOG_SCHEMATIC_SETUP::OnPageChange( wxBookCtrlEvent& event )
{
wxSize pageSize = m_treebook->GetPage( page )->GetSize();
pageSize.x -= 1;
pageSize.y += 2;
m_treebook->GetPage( page )->SetSize( pageSize );
m_macHack[ page ] = false;

View File

@ -29,6 +29,7 @@ class PANEL_EESCHEMA_TEMPLATE_FIELDNAMES;
class PANEL_SETUP_FORMATTING;
class PANEL_SETUP_PINMAP;
class PANEL_TEXT_VARIABLES;
class PANEL_SETUP_NETCLASSES;
class DIALOG_SCHEMATIC_SETUP : public PAGED_DIALOG
@ -46,6 +47,7 @@ protected:
PANEL_EESCHEMA_TEMPLATE_FIELDNAMES* m_fieldNameTemplates;
PANEL_SETUP_PINMAP* m_pinMap;
PANEL_SETUP_SEVERITIES* m_severities;
PANEL_SETUP_NETCLASSES* m_netclasses;
PANEL_TEXT_VARIABLES* m_textVars;
ERC_ITEM* m_pinToPinError;

View File

@ -76,11 +76,11 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
m_treebook->AddPage( new wxPanel( this ), _( "Design Rules" ) );
m_treebook->AddSubPage( m_constraints, _( "Constraints" ) );
m_treebook->AddSubPage( m_netclasses, _( "Net Classes" ) );
m_treebook->AddSubPage( m_rules, _( "Rules" ) );
m_treebook->AddSubPage( m_severities, _( "Violation Severity" ) );
m_treebook->AddPage( new wxPanel( this ), _( "Project" ) );
m_treebook->AddSubPage( m_netclasses, _( "Net Classes" ) );
m_treebook->AddSubPage( m_textVars, _( "Text Variables" ) );
for( size_t i = 0; i < m_treebook->GetPageCount(); ++i )