Commit 00d369ad authored by dickelbeck's avatar dickelbeck

netclasses done

parent c7cc6ea1
......@@ -7,12 +7,11 @@ email address.
2009-Sep-10 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew
More NETCLASS work, started on the UI also. Almost done. Put NETCLASS support
Finished initial NETCLASS work, along with UI. Put NETCLASS support
into DRC. Fixed DRC dialog so progress during DRC is sensible and visible.
The specctra_export probably still needs a little work regarding VIAs.
Don't install this version of PCBNEW if you need stability. You can compile
and look but I would not install it quite yet. I compiled wxformbuilder
from source, so you may need to upgrade to load my *.fbp files.
I compiled wxformbuilder from source, so you may need to upgrade to
load my *.fbp files.
Jean-Pierre @ todo: pcbnew/zones_test_and_combine_areas.cpp needs to
use NETCLASS and not g_DesignSettings.m_TrackClearance
......
......@@ -84,6 +84,9 @@ void DIALOG_DESIGN_RULES::Init()
// copy all NETs into m_AllNets by adding them as NETCUPs.
// @todo go fix m_Pcb->SynchronizeNetsAndNetClasses() so that the netcode==0 is not present in the BOARD::m_NetClasses
NETCLASS* netclass;
NETCLASSES& netclasses = m_Pcb->m_NetClasses;
......@@ -116,7 +119,7 @@ static bool sortByClassThenName( NETCUP* a, NETCUP* b )
if( a->clazz < b->clazz )
return true;
if( a->net < a->net )
if( a->net < b->net )
return true;
return false;
......@@ -179,16 +182,14 @@ void DIALOG_DESIGN_RULES::setRowItem( wxListCtrl* aListCtrl, int aRow, NETCUP* a
*/
void DIALOG_DESIGN_RULES::FillListBoxWithNetNames( wxListCtrl* aListCtrl, const wxString& aNetClass )
{
aListCtrl->ClearAll();
#if 0 // out of time for troubleshooting this now.
aListCtrl->DeleteAllItems();
PNETCUPS ptrList;
// get a subset of m_AllNets in pointer form, sorted as desired.
makePointers( &ptrList, aNetClass );
#if defined(DEBUG)
#if 0 && defined(DEBUG)
int r = 0;
for( PNETCUPS::iterator i = ptrList.begin(); i!=ptrList.end(); ++i, ++r )
{
......@@ -206,9 +207,6 @@ void DIALOG_DESIGN_RULES::FillListBoxWithNetNames( wxListCtrl* aListCtrl, const
}
aListCtrl->Show();
#endif
}
......@@ -469,42 +467,42 @@ void DIALOG_DESIGN_RULES::OnRightCBSelection( wxCommandEvent& event )
}
/* Called on clicking the "<<<" or Copy Right to Left button:
* Selected items are moved from the right list to the left list
*/
void DIALOG_DESIGN_RULES::OnRightToLeftCopyButton( wxCommandEvent& event )
void DIALOG_DESIGN_RULES::moveSelectedItems( wxListCtrl* src, const wxString& newClassName )
{
wxString oldClassName = m_leftClassChoice->GetStringSelection();
wxString newClassName = m_rightClassChoice->GetStringSelection();
wxASSERT( oldClassName != wxEmptyString );
wxASSERT( newClassName != wxEmptyString );
wxListItem item;
wxString netName;
for( int row = 0; row < m_rightListCtrl->GetItemCount(); ++row )
for( int row = 0; row < src->GetItemCount(); ++row )
{
if( !m_rightListCtrl->GetItemState( row, wxLIST_STATE_SELECTED ) )
if( !src->GetItemState( row, wxLIST_STATE_SELECTED ) )
continue;
/*
@todo: get the netName, call setNetClass()
wxString netName = m_rightListCtrl->OnGetItemText( row, 0 );
item.SetColumn( 0 );
item.SetId( row );
src->GetItem( item );
netName = item.GetText();
setNetClass( netName, newClassName == wildCard ? NETCLASS::Default : newClassName );
*/
}
}
void DIALOG_DESIGN_RULES::OnRightToLeftCopyButton( wxCommandEvent& event )
{
wxString newClassName = m_leftClassChoice->GetStringSelection();
moveSelectedItems( m_rightListCtrl, newClassName );
FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() );
}
/* Called on clicking the ">>>" or Copy Left to Right button:
* Selected items are moved from the left list to the right list
*/
void DIALOG_DESIGN_RULES::OnLeftToRightCopyButton( wxCommandEvent& event )
{
// @todo factor code from above, or combine the two functions.
wxString newClassName = m_rightClassChoice->GetStringSelection();
moveSelectedItems( m_leftListCtrl, newClassName );
FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() );
......
......@@ -15,72 +15,76 @@ struct NETCUP
clazz = aClass;
}
wxString net;
wxString clazz;
wxString net; ///< a net name
wxString clazz; ///< a class name
};
typedef std::vector<NETCUP> NETCUPS;
typedef std::vector<NETCUP*> PNETCUPS;
class DIALOG_DESIGN_RULES : public DIALOG_DESIGN_RULES_BASE
{
private:
static const wxString wildCard;
WinEDA_PcbFrame* m_Parent;
BOARD* m_Pcb;
std::vector<wxString> m_NetClasses;
NETCUPS m_AllNets;
private:
void OnLayerCountClick( wxCommandEvent& event );
void OnLayerGridLeftClick( wxGridEvent& event ){ event.Skip(); }
void OnLayerGridRighttClick( wxGridEvent& event ){ event.Skip(); }
void OnNetClassesGridLeftClick( wxGridEvent& event ){ event.Skip(); }
void OnNetClassesGridRightClick( wxGridEvent& event ){ event.Skip(); }
void OnCancelButtonClick( wxCommandEvent& event );
void OnOkButtonClick( wxCommandEvent& event );
void OnAddNetclassClick( wxCommandEvent& event );
void OnRemoveNetclassClick( wxCommandEvent& event );
void OnLeftCBSelection( wxCommandEvent& event );
void OnRightCBSelection( wxCommandEvent& event );
void OnRightToLeftCopyButton( wxCommandEvent& event );
void OnLeftToRightCopyButton( wxCommandEvent& event );
void OnLeftSelectAllButton( wxCommandEvent& event );
void OnRightSelectAllButton( wxCommandEvent& event );
bool TestDataValidity( );
void Init();
void InitRulesList();
void InitializeRulesSelectionBoxes();
void CopyRulesListToBoard();
void SetRoutableLayerStatus();
void FillListBoxWithNetNames( wxListCtrl* aListCtrl, const wxString& aNetClass );
/**
* Function swapNetClass
* replaces one net class name with another in the master list, m_AllNets.
*/
void swapNetClass( const wxString& oldClass, const wxString& newClass )
private:
static const wxString wildCard;
WinEDA_PcbFrame* m_Parent;
BOARD* m_Pcb;
std::vector<wxString> m_NetClasses;
NETCUPS m_AllNets;
private:
void OnLayerCountClick( wxCommandEvent& event );
void OnLayerGridLeftClick( wxGridEvent& event ){ event.Skip(); }
void OnLayerGridRighttClick( wxGridEvent& event ){ event.Skip(); }
void OnNetClassesGridLeftClick( wxGridEvent& event ){ event.Skip(); }
void OnNetClassesGridRightClick( wxGridEvent& event ){ event.Skip(); }
void OnCancelButtonClick( wxCommandEvent& event );
void OnOkButtonClick( wxCommandEvent& event );
void OnAddNetclassClick( wxCommandEvent& event );
void OnRemoveNetclassClick( wxCommandEvent& event );
void OnLeftCBSelection( wxCommandEvent& event );
void OnRightCBSelection( wxCommandEvent& event );
void OnRightToLeftCopyButton( wxCommandEvent& event );
void OnLeftToRightCopyButton( wxCommandEvent& event );
void OnLeftSelectAllButton( wxCommandEvent& event );
void OnRightSelectAllButton( wxCommandEvent& event );
bool TestDataValidity( );
void Init();
void InitRulesList();
void InitializeRulesSelectionBoxes();
void CopyRulesListToBoard();
void SetRoutableLayerStatus();
void FillListBoxWithNetNames( wxListCtrl* aListCtrl, const wxString& aNetClass );
/**
* Function swapNetClass
* replaces one net class name with another in the master list, m_AllNets.
*/
void swapNetClass( const wxString& oldClass, const wxString& newClass )
{
for( NETCUPS::iterator i = m_AllNets.begin(); i!=m_AllNets.end(); ++i )
{
for( NETCUPS::iterator i = m_AllNets.begin(); i!=m_AllNets.end(); ++i )
{
if( i->clazz == oldClass )
i->clazz = newClass;
}
if( i->clazz == oldClass )
i->clazz = newClass;
}
}
void makePointers( PNETCUPS* aList, const wxString& aNetClassName );
void makePointers( PNETCUPS* aList, const wxString& aNetClassName );
void setNetClass( const wxString& aNetName, const wxString& aClassName );
void setNetClass( const wxString& aNetName, const wxString& aClassName );
static void setRowItem( wxListCtrl* aListCtrl, int aRow, NETCUP* aNetAndClass );
static void setRowItem( wxListCtrl* aListCtrl, int aRow, NETCUP* aNetAndClass );
void moveSelectedItems( wxListCtrl* src, const wxString& newClassName );
public:
DIALOG_DESIGN_RULES( WinEDA_PcbFrame* parent );
~DIALOG_DESIGN_RULES( ) { };
public:
DIALOG_DESIGN_RULES( WinEDA_PcbFrame* parent );
~DIALOG_DESIGN_RULES( ) { };
};
......
......@@ -94,7 +94,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
m_leftClassChoice->SetSelection( 0 );
leftNetSelectBoxSizer->Add( m_leftClassChoice, 0, wxALL|wxEXPAND, 5 );
m_leftListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES );
m_leftListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VRULES );
m_leftListCtrl->SetMinSize( wxSize( 220,-1 ) );
leftNetSelectBoxSizer->Add( m_leftListCtrl, 1, wxALL|wxEXPAND, 5 );
......@@ -131,14 +131,14 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
m_rightClassChoice->SetSelection( 0 );
rghtNetSelectBoxSizer->Add( m_rightClassChoice, 0, wxALL|wxEXPAND, 5 );
m_rightListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES );
m_rightListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VRULES );
m_rightListCtrl->SetMinSize( wxSize( 220,-1 ) );
rghtNetSelectBoxSizer->Add( m_rightListCtrl, 1, wxALL|wxEXPAND, 5 );
sbSizer4->Add( rghtNetSelectBoxSizer, 1, wxALL|wxEXPAND, 5 );
sbSizer4->Add( rghtNetSelectBoxSizer, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( sbSizer4, 1, wxALL|wxEXPAND, 5 );
bMainSizer->Add( sbSizer4, 2, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Messages:") ), wxHORIZONTAL );
......
......@@ -88,7 +88,7 @@
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<object class="wxStaticBoxSizer" expanded="0">
<property name="id">wxID_ANY</property>
<property name="label">Net Classes:</property>
<property name="minimum_size"></property>
......@@ -399,7 +399,7 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<property name="proportion">2</property>
<object class="wxStaticBoxSizer" expanded="0">
<property name="id">wxID_ANY</property>
<property name="label">Membership:</property>
......@@ -492,7 +492,7 @@
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES</property>
<property name="style">wxLC_HRULES|wxLC_REPORT|wxLC_VRULES</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
......@@ -802,7 +802,7 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">rghtNetSelectBoxSizer</property>
......@@ -883,7 +883,7 @@
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES</property>
<property name="style">wxLC_HRULES|wxLC_REPORT|wxLC_VRULES</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment