Push panel_setup_netclasses down into common.
This commit is contained in:
parent
d85a707385
commit
2819570d1e
|
@ -184,6 +184,9 @@ set( COMMON_DLG_SRCS
|
||||||
dialogs/panel_hotkeys_editor.cpp
|
dialogs/panel_hotkeys_editor.cpp
|
||||||
dialogs/panel_mouse_settings.cpp
|
dialogs/panel_mouse_settings.cpp
|
||||||
dialogs/panel_mouse_settings_base.cpp
|
dialogs/panel_mouse_settings_base.cpp
|
||||||
|
dialogs/panel_setup_netclasses.cpp
|
||||||
|
dialogs/panel_setup_netclasses_base.cpp
|
||||||
|
dialogs/panel_setup_severities.cpp
|
||||||
dialogs/panel_text_variables.cpp
|
dialogs/panel_text_variables.cpp
|
||||||
dialogs/panel_text_variables_base.cpp
|
dialogs/panel_text_variables_base.cpp
|
||||||
dialogs/wx_html_report_panel.cpp
|
dialogs/wx_html_report_panel.cpp
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2004-2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2009 Dick Hollenbeck, dick@softplc.com
|
* Copyright (C) 2009 Dick Hollenbeck, dick@softplc.com
|
||||||
* Copyright (C) 2009-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2009-2020 KiCad Developers, see AUTHORS.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
|
||||||
|
@ -25,13 +25,13 @@
|
||||||
|
|
||||||
#include <base_units.h>
|
#include <base_units.h>
|
||||||
#include <bitmaps.h>
|
#include <bitmaps.h>
|
||||||
#include <board_design_settings.h>
|
#include <netclass.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <grid_tricks.h>
|
#include <grid_tricks.h>
|
||||||
#include <panel_setup_netclasses.h>
|
#include <panel_setup_netclasses.h>
|
||||||
#include <pcb_edit_frame.h>
|
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <widgets/wx_grid.h>
|
#include <widgets/wx_grid.h>
|
||||||
|
#include <kicad_string.h>
|
||||||
|
|
||||||
// Columns of netclasses grid
|
// Columns of netclasses grid
|
||||||
enum {
|
enum {
|
||||||
|
@ -48,16 +48,11 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame,
|
PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, NETCLASSES* aNetclasses ) :
|
||||||
PANEL_SETUP_FEATURE_CONSTRAINTS* aConstraintsPanel ) :
|
PANEL_SETUP_NETCLASSES_BASE( aParent->GetTreebook() ),
|
||||||
PANEL_SETUP_NETCLASSES_BASE( aParent->GetTreebook() )
|
m_Parent( aParent ),
|
||||||
|
m_Netclasses( aNetclasses )
|
||||||
{
|
{
|
||||||
m_Parent = aParent;
|
|
||||||
m_Frame = aFrame;
|
|
||||||
m_Pcb = m_Frame->GetBoard();
|
|
||||||
m_BrdSettings = &m_Pcb->GetDesignSettings();
|
|
||||||
m_ConstraintsPanel = aConstraintsPanel;
|
|
||||||
|
|
||||||
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
|
||||||
|
@ -152,15 +147,20 @@ static void netclassToGridRow( EDA_UNITS aUnits, wxGrid* aGrid, int aRow, const
|
||||||
|
|
||||||
bool PANEL_SETUP_NETCLASSES::TransferDataToWindow()
|
bool PANEL_SETUP_NETCLASSES::TransferDataToWindow()
|
||||||
{
|
{
|
||||||
NETCLASSES& netclasses = m_BrdSettings->GetNetClasses();
|
NETCLASSPTR netclass = m_Netclasses->GetDefault();
|
||||||
NETCLASSPTR netclass = netclasses.GetDefault();
|
|
||||||
|
std::map<wxString, wxString> netToNetclassMap;
|
||||||
|
|
||||||
if( m_netclassGrid->GetNumberRows() )
|
if( m_netclassGrid->GetNumberRows() )
|
||||||
m_netclassGrid->DeleteRows( 0, m_netclassGrid->GetNumberRows() );
|
m_netclassGrid->DeleteRows( 0, m_netclassGrid->GetNumberRows() );
|
||||||
m_netclassGrid->AppendRows( netclasses.GetCount() + 1 ); // + 1 for default netclass
|
|
||||||
|
m_netclassGrid->AppendRows( (int) m_Netclasses->GetCount() + 1 ); // + 1 for default netclass
|
||||||
|
|
||||||
// enter the Default NETCLASS.
|
// enter the Default NETCLASS.
|
||||||
netclassToGridRow( m_Frame->GetUserUnits(), m_netclassGrid, 0, netclass );
|
netclassToGridRow( m_Parent->GetUserUnits(), m_netclassGrid, 0, netclass );
|
||||||
|
|
||||||
|
for( const wxString& net : *netclass )
|
||||||
|
netToNetclassMap[ net ] = netclass->GetName();
|
||||||
|
|
||||||
// make the Default NETCLASS name read-only
|
// make the Default NETCLASS name read-only
|
||||||
wxGridCellAttr* cellAttr = m_netclassGrid->GetOrCreateCellAttr( 0, GRID_NAME );
|
wxGridCellAttr* cellAttr = m_netclassGrid->GetOrCreateCellAttr( 0, GRID_NAME );
|
||||||
|
@ -170,26 +170,28 @@ bool PANEL_SETUP_NETCLASSES::TransferDataToWindow()
|
||||||
// enter other netclasses
|
// enter other netclasses
|
||||||
int row = 1;
|
int row = 1;
|
||||||
|
|
||||||
for( NETCLASSES::iterator i = netclasses.begin(); i != netclasses.end(); ++i, ++row )
|
for( NETCLASSES::iterator i = m_Netclasses->begin(); i != m_Netclasses->end(); ++i, ++row )
|
||||||
netclassToGridRow( m_Frame->GetUserUnits(), m_netclassGrid, row, i->second );
|
{
|
||||||
|
netclass = i->second;
|
||||||
|
|
||||||
// ensure that all nets have net classes assigned
|
netclassToGridRow( m_Parent->GetUserUnits(), m_netclassGrid, row, netclass );
|
||||||
m_Pcb->BuildListOfNets();
|
|
||||||
|
for( const wxString& net : *netclass )
|
||||||
|
netToNetclassMap[ net ] = i->second->GetName();
|
||||||
|
}
|
||||||
|
|
||||||
if( m_membershipGrid->GetNumberRows() )
|
if( m_membershipGrid->GetNumberRows() )
|
||||||
m_membershipGrid->DeleteRows( 0, m_membershipGrid->GetNumberRows() );
|
m_membershipGrid->DeleteRows( 0, m_membershipGrid->GetNumberRows() );
|
||||||
|
|
||||||
for( NETINFO_ITEM* net : m_Pcb->GetNetInfo() )
|
// add all the nets discovered in the netclass membership lists
|
||||||
{
|
for( const std::pair<const wxString, wxString>& ii : netToNetclassMap )
|
||||||
if( net->GetNet() > 0 && net->IsCurrent() )
|
addNet( UnescapeString( ii.first ), ii.second );
|
||||||
addNet( UnescapeString( net->GetNetname() ), net->GetNetClass()->GetName() );
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PANEL_SETUP_NETCLASSES::addNet( wxString netName, const wxString& netclass )
|
void PANEL_SETUP_NETCLASSES::addNet( const wxString& netName, const wxString& netclass )
|
||||||
{
|
{
|
||||||
int i = m_membershipGrid->GetNumberRows();
|
int i = m_membershipGrid->GetNumberRows();
|
||||||
|
|
||||||
|
@ -250,38 +252,30 @@ bool PANEL_SETUP_NETCLASSES::TransferDataFromWindow()
|
||||||
if( !validateData() )
|
if( !validateData() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
NETCLASSES& netclasses = m_BrdSettings->GetNetClasses();
|
|
||||||
|
|
||||||
// Remove all netclasses from board. We'll copy new list after
|
// Remove all netclasses from board. We'll copy new list after
|
||||||
netclasses.Clear();
|
m_Netclasses->Clear();
|
||||||
|
|
||||||
// Copy the default NetClass:
|
// Copy the default NetClass:
|
||||||
gridRowToNetclass( m_Frame->GetUserUnits(), m_netclassGrid, 0, netclasses.GetDefault());
|
gridRowToNetclass( m_Parent->GetUserUnits(), m_netclassGrid, 0, m_Netclasses->GetDefault() );
|
||||||
|
|
||||||
// Copy other NetClasses :
|
// Copy other NetClasses :
|
||||||
for( int row = 1; row < m_netclassGrid->GetNumberRows(); ++row )
|
for( int row = 1; row < m_netclassGrid->GetNumberRows(); ++row )
|
||||||
{
|
{
|
||||||
NETCLASSPTR nc = std::make_shared<NETCLASS>( m_netclassGrid->GetCellValue( row, GRID_NAME ) );
|
NETCLASSPTR nc = std::make_shared<NETCLASS>( m_netclassGrid->GetCellValue( row, GRID_NAME ) );
|
||||||
|
|
||||||
if( netclasses.Add( nc ) )
|
if( m_Netclasses->Add( nc ) )
|
||||||
gridRowToNetclass( m_Frame->GetUserUnits(), m_netclassGrid, row, nc );
|
gridRowToNetclass( m_Parent->GetUserUnits(), m_netclassGrid, row, nc );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now read all nets and push them in the corresponding netclass net buffer
|
// Now read all nets and push them in the corresponding netclass net buffer
|
||||||
for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
|
for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
|
||||||
{
|
{
|
||||||
NETCLASSPTR nc = netclasses.Find( m_membershipGrid->GetCellValue( row, 1 ) );
|
NETCLASSPTR nc = m_Netclasses->Find( m_membershipGrid->GetCellValue( row, 1 ) );
|
||||||
|
|
||||||
if( nc )
|
if( nc )
|
||||||
nc->Add( m_membershipGrid->GetCellValue( row, 0 ) );
|
nc->Add( m_membershipGrid->GetCellValue( row, 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Pcb->SynchronizeNetsAndNetClasses();
|
|
||||||
m_BrdSettings->SetCurrentNetClass( NETCLASS::Default );
|
|
||||||
|
|
||||||
if( m_Frame->GetToolManager() )
|
|
||||||
m_Frame->GetToolManager()->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -520,25 +514,12 @@ void PANEL_SETUP_NETCLASSES::OnUpdateUI( wxUpdateUIEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int PANEL_SETUP_NETCLASSES::getNetclassValue( int aRow, int aCol )
|
|
||||||
{
|
|
||||||
return ValueFromString( m_Frame->GetUserUnits(), m_netclassGrid->GetCellValue( aRow, aCol ), true );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool PANEL_SETUP_NETCLASSES::validateData()
|
bool PANEL_SETUP_NETCLASSES::validateData()
|
||||||
{
|
{
|
||||||
if( !m_netclassGrid->CommitPendingChanges() || !m_membershipGrid->CommitPendingChanges() )
|
if( !m_netclassGrid->CommitPendingChanges() || !m_membershipGrid->CommitPendingChanges() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
int minViaAnnulus = m_ConstraintsPanel->m_viaMinAnnulus.GetValue();
|
|
||||||
int minViaDia = m_ConstraintsPanel->m_viaMinSize.GetValue();
|
|
||||||
int minThroughHole = m_ConstraintsPanel->m_throughHoleMin.GetValue();
|
|
||||||
int minUViaDia = m_ConstraintsPanel->m_uviaMinSize.GetValue();
|
|
||||||
int minUViaDrill = m_ConstraintsPanel->m_uviaMinDrill.GetValue();
|
|
||||||
int minTrackWidth = m_ConstraintsPanel->m_trackMinWidth.GetValue();
|
|
||||||
int minClearance = m_ConstraintsPanel->m_minClearance.GetValue();
|
|
||||||
|
|
||||||
// Test net class parameters.
|
// Test net class parameters.
|
||||||
for( int row = 0; row < m_netclassGrid->GetNumberRows(); row++ )
|
for( int row = 0; row < m_netclassGrid->GetNumberRows(); row++ )
|
||||||
|
@ -549,104 +530,17 @@ bool PANEL_SETUP_NETCLASSES::validateData()
|
||||||
|
|
||||||
if( !validateNetclassName( row, netclassName, false ) )
|
if( !validateNetclassName( row, netclassName, false ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( getNetclassValue( row, GRID_CLEARANCE ) < minClearance )
|
|
||||||
{
|
|
||||||
msg.Printf( _( "Clearance less than minimum clearance (%s)." ),
|
|
||||||
StringFromValue( m_Frame->GetUserUnits(), minClearance, true, true ) );
|
|
||||||
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_CLEARANCE );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( getNetclassValue( row, GRID_TRACKSIZE ) < minTrackWidth )
|
|
||||||
{
|
|
||||||
msg.Printf( _( "Track width less than minimum track width (%s)." ),
|
|
||||||
StringFromValue( m_Frame->GetUserUnits(), minTrackWidth, true, true ) );
|
|
||||||
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_TRACKSIZE );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( getNetclassValue( row, GRID_DIFF_PAIR_WIDTH ) < minTrackWidth )
|
|
||||||
{
|
|
||||||
msg.Printf( _( "Differential pair width less than minimum track width (%s)." ),
|
|
||||||
StringFromValue( m_Frame->GetUserUnits(), minTrackWidth, true, true ) );
|
|
||||||
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_DIFF_PAIR_WIDTH );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test vias
|
|
||||||
if( getNetclassValue( row, GRID_VIASIZE ) < minViaDia )
|
|
||||||
{
|
|
||||||
msg.Printf( _( "Via diameter less than minimum via diameter (%s)." ),
|
|
||||||
StringFromValue( m_Frame->GetUserUnits(), minViaDia, true, true ) );
|
|
||||||
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_VIASIZE );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( getNetclassValue( row, GRID_VIADRILL ) >= getNetclassValue( row, GRID_VIASIZE ) )
|
|
||||||
{
|
|
||||||
msg = _( "Via drill larger than via diameter." );
|
|
||||||
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_VIADRILL );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ( getNetclassValue( row, GRID_VIASIZE )
|
|
||||||
- getNetclassValue( row, GRID_VIADRILL ) ) / 2 < minViaAnnulus )
|
|
||||||
{
|
|
||||||
msg.Printf( _( "Via diameter and drill leave via annulus less than minimum (%s)." ),
|
|
||||||
StringFromValue( m_Frame->GetUserUnits(), minViaAnnulus, true, true ) );
|
|
||||||
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_VIASIZE );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( getNetclassValue( row, GRID_VIADRILL ) < minThroughHole )
|
|
||||||
{
|
|
||||||
msg.Printf( _( "Via drill less than minimum via drill (%s)." ),
|
|
||||||
StringFromValue( m_Frame->GetUserUnits(), minThroughHole, true, true ) );
|
|
||||||
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_VIADRILL );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test Micro vias
|
|
||||||
if( getNetclassValue( row, GRID_uVIASIZE ) < minUViaDia )
|
|
||||||
{
|
|
||||||
msg.Printf( _( "Microvia diameter less than minimum microvia diameter (%s)." ),
|
|
||||||
StringFromValue( m_Frame->GetUserUnits(), minUViaDia, true, true ) );
|
|
||||||
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_uVIASIZE );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( getNetclassValue( row, GRID_uVIADRILL ) >= getNetclassValue( row, GRID_uVIASIZE ) )
|
|
||||||
{
|
|
||||||
msg = _( "Microvia drill larger than microvia diameter." );
|
|
||||||
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_uVIADRILL );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( getNetclassValue( row, GRID_uVIADRILL ) < minUViaDrill )
|
|
||||||
{
|
|
||||||
msg.Printf( _( "Microvia drill less than minimum microvia drill (%s)." ),
|
|
||||||
StringFromValue( m_Frame->GetUserUnits(), minUViaDrill, true, true ) );
|
|
||||||
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_uVIADRILL );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// JEY TODO: test microvias agains via min annulus?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PANEL_SETUP_NETCLASSES::ImportSettingsFrom( BOARD* aBoard )
|
void PANEL_SETUP_NETCLASSES::ImportSettingsFrom( NETCLASSES* aNetclasses )
|
||||||
{
|
{
|
||||||
// Note: do not change the board, as we need to get the current nets from it for
|
NETCLASSES* savedSettings = m_Netclasses;
|
||||||
// netclass memberships. All the netclass definitions and dimension lists are in
|
|
||||||
// the BOARD_DESIGN_SETTINGS.
|
|
||||||
|
|
||||||
BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
|
m_Netclasses = aNetclasses;
|
||||||
|
|
||||||
m_BrdSettings = &aBoard->GetDesignSettings();
|
|
||||||
TransferDataToWindow();
|
TransferDataToWindow();
|
||||||
|
|
||||||
rebuildNetclassDropdowns();
|
rebuildNetclassDropdowns();
|
||||||
|
@ -654,7 +548,7 @@ void PANEL_SETUP_NETCLASSES::ImportSettingsFrom( BOARD* aBoard )
|
||||||
m_netclassGrid->ForceRefresh();
|
m_netclassGrid->ForceRefresh();
|
||||||
m_membershipGrid->ForceRefresh();
|
m_membershipGrid->ForceRefresh();
|
||||||
|
|
||||||
m_BrdSettings = savedSettings;
|
m_Netclasses = savedSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,34 +25,23 @@
|
||||||
#ifndef PANEL_SETUP_NETCLASSES_H
|
#ifndef PANEL_SETUP_NETCLASSES_H
|
||||||
#define PANEL_SETUP_NETCLASSES_H
|
#define PANEL_SETUP_NETCLASSES_H
|
||||||
|
|
||||||
#include <class_board.h>
|
|
||||||
#include <widgets/unit_binder.h>
|
#include <widgets/unit_binder.h>
|
||||||
#include <widgets/paged_dialog.h>
|
#include <widgets/paged_dialog.h>
|
||||||
|
|
||||||
#include <panel_setup_netclasses_base.h>
|
#include <panel_setup_netclasses_base.h>
|
||||||
#include "panel_setup_feature_constraints.h"
|
|
||||||
|
|
||||||
class PCB_EDIT_FRAME;
|
class NETCLASSES;
|
||||||
class BOARD_DESIGN_SETTINGS;
|
|
||||||
|
|
||||||
|
|
||||||
class PANEL_SETUP_NETCLASSES : public PANEL_SETUP_NETCLASSES_BASE
|
class PANEL_SETUP_NETCLASSES : public PANEL_SETUP_NETCLASSES_BASE
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
PAGED_DIALOG* m_Parent;
|
PAGED_DIALOG* m_Parent;
|
||||||
PCB_EDIT_FRAME* m_Frame;
|
NETCLASSES* m_Netclasses;
|
||||||
BOARD* m_Pcb;
|
|
||||||
BOARD_DESIGN_SETTINGS* m_BrdSettings;
|
|
||||||
|
|
||||||
// We must validate against the current m_BrdSettings as they may have been
|
int* m_originalColWidths;
|
||||||
// changed but not yet committed. Fetch them from the constraints panel.
|
bool m_netclassesDirty; // The netclass drop-down menus need rebuilding
|
||||||
PANEL_SETUP_FEATURE_CONSTRAINTS* m_ConstraintsPanel;
|
wxSize m_membershipSize; // The size needed to show the membership list
|
||||||
|
|
||||||
int* m_originalColWidths;
|
|
||||||
bool m_netclassesDirty; // Indicates the netclass drop-down
|
|
||||||
// menus need rebuilding
|
|
||||||
wxSize m_membershipSize; // The size needed to show the membership
|
|
||||||
// properties
|
|
||||||
private:
|
private:
|
||||||
void OnAddNetclassClick( wxCommandEvent& event ) override;
|
void OnAddNetclassClick( wxCommandEvent& event ) override;
|
||||||
void OnRemoveNetclassClick( wxCommandEvent& event ) override;
|
void OnRemoveNetclassClick( wxCommandEvent& event ) override;
|
||||||
|
@ -70,9 +59,8 @@ private:
|
||||||
bool validateData();
|
bool validateData();
|
||||||
|
|
||||||
void rebuildNetclassDropdowns();
|
void rebuildNetclassDropdowns();
|
||||||
int getNetclassValue( int aRow, int aCol );
|
|
||||||
|
|
||||||
void addNet( wxString netName, const wxString& netclass );
|
void addNet( const wxString& netName, const wxString& netclass );
|
||||||
void doApplyFilters( bool aShowAll );
|
void doApplyFilters( bool aShowAll );
|
||||||
void doAssignments( bool aAssignAll );
|
void doAssignments( bool aAssignAll );
|
||||||
|
|
||||||
|
@ -80,14 +68,13 @@ private:
|
||||||
void AdjustMembershipGridColumns( int aWidth );
|
void AdjustMembershipGridColumns( int aWidth );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame,
|
PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, NETCLASSES* aNetclasses );
|
||||||
PANEL_SETUP_FEATURE_CONSTRAINTS* aConstraintsPanel );
|
|
||||||
~PANEL_SETUP_NETCLASSES( ) override;
|
~PANEL_SETUP_NETCLASSES( ) override;
|
||||||
|
|
||||||
bool TransferDataToWindow() override;
|
bool TransferDataToWindow() override;
|
||||||
bool TransferDataFromWindow() override;
|
bool TransferDataFromWindow() override;
|
||||||
|
|
||||||
void ImportSettingsFrom( BOARD* aBoard );
|
void ImportSettingsFrom( NETCLASSES* aBoard );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //PANEL_SETUP_NETCLASSES_H
|
#endif //PANEL_SETUP_NETCLASSES_H
|
|
@ -158,15 +158,12 @@ set( PCBNEW_DIALOGS
|
||||||
dialogs/panel_setup_feature_constraints_base.cpp
|
dialogs/panel_setup_feature_constraints_base.cpp
|
||||||
dialogs/panel_setup_layers.cpp
|
dialogs/panel_setup_layers.cpp
|
||||||
dialogs/panel_setup_layers_base.cpp
|
dialogs/panel_setup_layers_base.cpp
|
||||||
dialogs/panel_setup_netclasses.cpp
|
|
||||||
dialogs/panel_setup_netclasses_base.cpp
|
|
||||||
dialogs/panel_setup_rules.cpp
|
dialogs/panel_setup_rules.cpp
|
||||||
dialogs/panel_setup_rules_base.cpp
|
dialogs/panel_setup_rules_base.cpp
|
||||||
dialogs/panel_setup_text_and_graphics.cpp
|
dialogs/panel_setup_text_and_graphics.cpp
|
||||||
dialogs/panel_setup_text_and_graphics_base.cpp
|
dialogs/panel_setup_text_and_graphics_base.cpp
|
||||||
dialogs/panel_setup_tracks_and_vias.cpp
|
dialogs/panel_setup_tracks_and_vias.cpp
|
||||||
dialogs/panel_setup_tracks_and_vias_base.cpp
|
dialogs/panel_setup_tracks_and_vias_base.cpp
|
||||||
../common/dialogs/panel_setup_severities.cpp
|
|
||||||
footprint_wizard.cpp
|
footprint_wizard.cpp
|
||||||
footprint_wizard_frame.cpp
|
footprint_wizard_frame.cpp
|
||||||
footprint_wizard_frame_functions.cpp
|
footprint_wizard_frame_functions.cpp
|
||||||
|
|
|
@ -106,8 +106,6 @@ BOARD::BOARD() :
|
||||||
m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the
|
m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the
|
||||||
// zone contour currently in progress
|
// zone contour currently in progress
|
||||||
|
|
||||||
BuildListOfNets(); // prepare pad and netlist containers.
|
|
||||||
|
|
||||||
for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
|
for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
|
||||||
{
|
{
|
||||||
m_Layer[layer].m_name = GetStandardLayerName( ToLAYER_ID( layer ) );
|
m_Layer[layer].m_name = GetStandardLayerName( ToLAYER_ID( layer ) );
|
||||||
|
@ -190,21 +188,18 @@ void BOARD::SetProject( PROJECT* aProject )
|
||||||
PROJECT_FILE& project = aProject->GetProjectFile();
|
PROJECT_FILE& project = aProject->GetProjectFile();
|
||||||
|
|
||||||
// Link the design settings object to the project file
|
// Link the design settings object to the project file
|
||||||
project.m_BoardSettings = &GetDesignSettings();
|
project.m_BoardSettings = &GetDesignSettings();
|
||||||
|
|
||||||
// Set parent, which also will load the values from JSON stored in the project
|
// Set parent, which also will load the values from JSON stored in the project
|
||||||
project.m_BoardSettings->SetParent( &project );
|
project.m_BoardSettings->SetParent( &project );
|
||||||
|
|
||||||
// The netclasses pointer will be pointing to the internal netclasses list at this point. If
|
// The DesignSettings' netclasses pointer will be pointing to its internal netclasses
|
||||||
// it has anything other than the default net, this means we loaded some netclasses from a
|
// list at this point. If we loaded anything into it from a legacy board file then we
|
||||||
// board saved in legacy format where the netclass info is included. Move this info to the
|
// want to transfer it over to the project netclasses list.
|
||||||
// netclasses stored in the project.
|
|
||||||
|
|
||||||
NETCLASSES& local = GetDesignSettings().GetNetClasses();
|
|
||||||
|
|
||||||
if( m_LegacyNetclassesLoaded )
|
if( m_LegacyNetclassesLoaded )
|
||||||
project.NetSettings().m_NetClasses = local;
|
project.NetSettings().m_NetClasses = GetDesignSettings().GetNetClasses();
|
||||||
|
|
||||||
|
// Now update the DesignSettings' netclass pointer ot point into the project.
|
||||||
GetDesignSettings().SetNetClasses( &project.NetSettings().m_NetClasses );
|
GetDesignSettings().SetNetClasses( &project.NetSettings().m_NetClasses );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,16 +44,16 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
|
||||||
PAGED_DIALOG( aFrame, _( "Board Setup" ), _( "Import Settings from Another Board..." ) ),
|
PAGED_DIALOG( aFrame, _( "Board Setup" ), _( "Import Settings from Another Board..." ) ),
|
||||||
m_frame( aFrame )
|
m_frame( aFrame )
|
||||||
{
|
{
|
||||||
|
BOARD_DESIGN_SETTINGS& bds = aFrame->GetDesignSettings();
|
||||||
|
|
||||||
m_layers = new PANEL_SETUP_LAYERS( this, aFrame );
|
m_layers = new PANEL_SETUP_LAYERS( this, aFrame );
|
||||||
m_textAndGraphics = new PANEL_SETUP_TEXT_AND_GRAPHICS( this, aFrame );
|
m_textAndGraphics = new PANEL_SETUP_TEXT_AND_GRAPHICS( this, aFrame );
|
||||||
m_constraints = new PANEL_SETUP_FEATURE_CONSTRAINTS( this, aFrame );
|
m_constraints = new PANEL_SETUP_FEATURE_CONSTRAINTS( this, aFrame );
|
||||||
m_netclasses = new PANEL_SETUP_NETCLASSES( this, aFrame, m_constraints );
|
m_netclasses = new PANEL_SETUP_NETCLASSES( this, &bds.GetNetClasses() );
|
||||||
m_rules = new PANEL_SETUP_RULES( this, aFrame );
|
m_rules = new PANEL_SETUP_RULES( this, aFrame );
|
||||||
m_tracksAndVias = new PANEL_SETUP_TRACKS_AND_VIAS( this, aFrame, m_constraints );
|
m_tracksAndVias = new PANEL_SETUP_TRACKS_AND_VIAS( this, aFrame, m_constraints );
|
||||||
m_maskAndPaste = new PANEL_SETUP_MASK_AND_PASTE( this, aFrame );
|
m_maskAndPaste = new PANEL_SETUP_MASK_AND_PASTE( this, aFrame );
|
||||||
m_physicalStackup = new PANEL_SETUP_BOARD_STACKUP( this, aFrame, m_layers );
|
m_physicalStackup = new PANEL_SETUP_BOARD_STACKUP( this, aFrame, m_layers );
|
||||||
|
|
||||||
BOARD_DESIGN_SETTINGS& bds = aFrame->GetDesignSettings();
|
|
||||||
m_severities = new PANEL_SETUP_SEVERITIES( this, DRC_ITEM::GetItemsWithSeverities(),
|
m_severities = new PANEL_SETUP_SEVERITIES( this, DRC_ITEM::GetItemsWithSeverities(),
|
||||||
bds.m_DRCSeverities );
|
bds.m_DRCSeverities );
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ void DIALOG_BOARD_SETUP::OnAuxiliaryAction( wxCommandEvent& event )
|
||||||
if( importDlg.m_ConstraintsOpt->GetValue() )
|
if( importDlg.m_ConstraintsOpt->GetValue() )
|
||||||
m_constraints->ImportSettingsFrom( otherBoard );
|
m_constraints->ImportSettingsFrom( otherBoard );
|
||||||
if( importDlg.m_NetclassesOpt->GetValue() )
|
if( importDlg.m_NetclassesOpt->GetValue() )
|
||||||
m_netclasses->ImportSettingsFrom( otherBoard );
|
m_netclasses->ImportSettingsFrom( &otherBoard->GetDesignSettings().GetNetClasses() );
|
||||||
if( importDlg.m_TracksAndViasOpt->GetValue() )
|
if( importDlg.m_TracksAndViasOpt->GetValue() )
|
||||||
m_tracksAndVias->ImportSettingsFrom( otherBoard );
|
m_tracksAndVias->ImportSettingsFrom( otherBoard );
|
||||||
if( importDlg.m_MaskAndPasteOpt->GetValue() )
|
if( importDlg.m_MaskAndPasteOpt->GetValue() )
|
||||||
|
|
|
@ -600,7 +600,6 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||||
|
|
||||||
// we should not ask PLUGINs to do these items:
|
// we should not ask PLUGINs to do these items:
|
||||||
loadedBoard->BuildListOfNets();
|
loadedBoard->BuildListOfNets();
|
||||||
loadedBoard->SynchronizeNetsAndNetClasses();
|
|
||||||
ResolveDRCExclusions();
|
ResolveDRCExclusions();
|
||||||
|
|
||||||
if( loadedBoard->IsModified() )
|
if( loadedBoard->IsModified() )
|
||||||
|
|
|
@ -637,6 +637,9 @@ void PCB_EDIT_FRAME::ActivateGalCanvas()
|
||||||
void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage, const wxString& aErrorMsg,
|
void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage, const wxString& aErrorMsg,
|
||||||
int aErrorCtrlId, int aErrorLine, int aErrorCol )
|
int aErrorCtrlId, int aErrorLine, int aErrorCol )
|
||||||
{
|
{
|
||||||
|
// Make sure everything's up-to-date
|
||||||
|
GetBoard()->BuildListOfNets();
|
||||||
|
|
||||||
DIALOG_BOARD_SETUP dlg( this );
|
DIALOG_BOARD_SETUP dlg( this );
|
||||||
|
|
||||||
if( !aInitialPage.IsEmpty() )
|
if( !aInitialPage.IsEmpty() )
|
||||||
|
@ -647,6 +650,8 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage, const w
|
||||||
|
|
||||||
if( dlg.ShowQuasiModal() == wxID_OK )
|
if( dlg.ShowQuasiModal() == wxID_OK )
|
||||||
{
|
{
|
||||||
|
GetBoard()->SynchronizeNetsAndNetClasses();
|
||||||
|
GetBoard()->GetDesignSettings().SetCurrentNetClass( NETCLASS::Default );
|
||||||
SaveProjectSettings();
|
SaveProjectSettings();
|
||||||
|
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
|
@ -657,6 +662,8 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage, const w
|
||||||
|
|
||||||
GetCanvas()->Refresh();
|
GetCanvas()->Refresh();
|
||||||
|
|
||||||
|
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||||
|
|
||||||
//this event causes the routing tool to reload its design rules information
|
//this event causes the routing tool to reload its design rules information
|
||||||
TOOL_EVENT toolEvent( TC_COMMAND, TA_MODEL_CHANGE, AS_ACTIVE );
|
TOOL_EVENT toolEvent( TC_COMMAND, TA_MODEL_CHANGE, AS_ACTIVE );
|
||||||
toolEvent.SetHasPosition( false );
|
toolEvent.SetHasPosition( false );
|
||||||
|
|
Loading…
Reference in New Issue