netclasses done
This commit is contained in:
parent
c7cc6ea101
commit
00d369ad5a
|
@ -7,12 +7,11 @@ email address.
|
||||||
2009-Sep-10 UPDATE Dick Hollenbeck <dick@softplc.com>
|
2009-Sep-10 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
================================================================================
|
================================================================================
|
||||||
++pcbnew
|
++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.
|
into DRC. Fixed DRC dialog so progress during DRC is sensible and visible.
|
||||||
The specctra_export probably still needs a little work regarding VIAs.
|
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
|
I compiled wxformbuilder from source, so you may need to upgrade to
|
||||||
and look but I would not install it quite yet. I compiled wxformbuilder
|
load my *.fbp files.
|
||||||
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
|
Jean-Pierre @ todo: pcbnew/zones_test_and_combine_areas.cpp needs to
|
||||||
use NETCLASS and not g_DesignSettings.m_TrackClearance
|
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.
|
// 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;
|
NETCLASS* netclass;
|
||||||
|
|
||||||
NETCLASSES& netclasses = m_Pcb->m_NetClasses;
|
NETCLASSES& netclasses = m_Pcb->m_NetClasses;
|
||||||
|
@ -116,7 +119,7 @@ static bool sortByClassThenName( NETCUP* a, NETCUP* b )
|
||||||
if( a->clazz < b->clazz )
|
if( a->clazz < b->clazz )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if( a->net < a->net )
|
if( a->net < b->net )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
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 )
|
void DIALOG_DESIGN_RULES::FillListBoxWithNetNames( wxListCtrl* aListCtrl, const wxString& aNetClass )
|
||||||
{
|
{
|
||||||
aListCtrl->ClearAll();
|
aListCtrl->DeleteAllItems();
|
||||||
|
|
||||||
#if 0 // out of time for troubleshooting this now.
|
|
||||||
|
|
||||||
PNETCUPS ptrList;
|
PNETCUPS ptrList;
|
||||||
|
|
||||||
// get a subset of m_AllNets in pointer form, sorted as desired.
|
// get a subset of m_AllNets in pointer form, sorted as desired.
|
||||||
makePointers( &ptrList, aNetClass );
|
makePointers( &ptrList, aNetClass );
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if 0 && defined(DEBUG)
|
||||||
int r = 0;
|
int r = 0;
|
||||||
for( PNETCUPS::iterator i = ptrList.begin(); i!=ptrList.end(); ++i, ++r )
|
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();
|
aListCtrl->Show();
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -469,42 +467,42 @@ void DIALOG_DESIGN_RULES::OnRightCBSelection( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Called on clicking the "<<<" or Copy Right to Left button:
|
void DIALOG_DESIGN_RULES::moveSelectedItems( wxListCtrl* src, const wxString& newClassName )
|
||||||
* Selected items are moved from the right list to the left list
|
{
|
||||||
*/
|
wxListItem item;
|
||||||
|
wxString netName;
|
||||||
|
|
||||||
|
for( int row = 0; row < src->GetItemCount(); ++row )
|
||||||
|
{
|
||||||
|
if( !src->GetItemState( row, wxLIST_STATE_SELECTED ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
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 )
|
void DIALOG_DESIGN_RULES::OnRightToLeftCopyButton( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString oldClassName = m_leftClassChoice->GetStringSelection();
|
wxString newClassName = m_leftClassChoice->GetStringSelection();
|
||||||
wxString newClassName = m_rightClassChoice->GetStringSelection();
|
|
||||||
|
|
||||||
wxASSERT( oldClassName != wxEmptyString );
|
moveSelectedItems( m_rightListCtrl, newClassName );
|
||||||
wxASSERT( newClassName != wxEmptyString );
|
|
||||||
|
|
||||||
for( int row = 0; row < m_rightListCtrl->GetItemCount(); ++row )
|
|
||||||
{
|
|
||||||
if( !m_rightListCtrl->GetItemState( row, wxLIST_STATE_SELECTED ) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/*
|
|
||||||
@todo: get the netName, call setNetClass()
|
|
||||||
wxString netName = m_rightListCtrl->OnGetItemText( row, 0 );
|
|
||||||
|
|
||||||
setNetClass( netName, newClassName == wildCard ? NETCLASS::Default : newClassName );
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
|
FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
|
||||||
FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->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 )
|
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_leftListCtrl, m_leftClassChoice->GetStringSelection() );
|
||||||
FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() );
|
FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() );
|
||||||
|
|
|
@ -15,72 +15,76 @@ struct NETCUP
|
||||||
clazz = aClass;
|
clazz = aClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString net;
|
wxString net; ///< a net name
|
||||||
wxString clazz;
|
wxString clazz; ///< a class name
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef std::vector<NETCUP> NETCUPS;
|
typedef std::vector<NETCUP> NETCUPS;
|
||||||
typedef std::vector<NETCUP*> PNETCUPS;
|
typedef std::vector<NETCUP*> PNETCUPS;
|
||||||
|
|
||||||
class DIALOG_DESIGN_RULES : public DIALOG_DESIGN_RULES_BASE
|
class DIALOG_DESIGN_RULES : public DIALOG_DESIGN_RULES_BASE
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
|
|
||||||
static const wxString wildCard;
|
private:
|
||||||
|
|
||||||
WinEDA_PcbFrame* m_Parent;
|
static const wxString wildCard;
|
||||||
BOARD* m_Pcb;
|
|
||||||
|
|
||||||
std::vector<wxString> m_NetClasses;
|
WinEDA_PcbFrame* m_Parent;
|
||||||
NETCUPS m_AllNets;
|
BOARD* m_Pcb;
|
||||||
|
|
||||||
private:
|
std::vector<wxString> m_NetClasses;
|
||||||
void OnLayerCountClick( wxCommandEvent& event );
|
NETCUPS m_AllNets;
|
||||||
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 );
|
|
||||||
|
|
||||||
/**
|
private:
|
||||||
* Function swapNetClass
|
void OnLayerCountClick( wxCommandEvent& event );
|
||||||
* replaces one net class name with another in the master list, m_AllNets.
|
void OnLayerGridLeftClick( wxGridEvent& event ){ event.Skip(); }
|
||||||
*/
|
void OnLayerGridRighttClick( wxGridEvent& event ){ event.Skip(); }
|
||||||
void swapNetClass( const wxString& oldClass, const wxString& newClass )
|
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:
|
public:
|
||||||
DIALOG_DESIGN_RULES( WinEDA_PcbFrame* parent );
|
DIALOG_DESIGN_RULES( WinEDA_PcbFrame* parent );
|
||||||
~DIALOG_DESIGN_RULES( ) { };
|
~DIALOG_DESIGN_RULES( ) { };
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
|
||||||
m_leftClassChoice->SetSelection( 0 );
|
m_leftClassChoice->SetSelection( 0 );
|
||||||
leftNetSelectBoxSizer->Add( m_leftClassChoice, 0, wxALL|wxEXPAND, 5 );
|
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 ) );
|
m_leftListCtrl->SetMinSize( wxSize( 220,-1 ) );
|
||||||
|
|
||||||
leftNetSelectBoxSizer->Add( m_leftListCtrl, 1, wxALL|wxEXPAND, 5 );
|
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 );
|
m_rightClassChoice->SetSelection( 0 );
|
||||||
rghtNetSelectBoxSizer->Add( m_rightClassChoice, 0, wxALL|wxEXPAND, 5 );
|
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 ) );
|
m_rightListCtrl->SetMinSize( wxSize( 220,-1 ) );
|
||||||
|
|
||||||
rghtNetSelectBoxSizer->Add( m_rightListCtrl, 1, wxALL|wxEXPAND, 5 );
|
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;
|
wxStaticBoxSizer* sbSizer2;
|
||||||
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Messages:") ), wxHORIZONTAL );
|
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Messages:") ), wxHORIZONTAL );
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
<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">1</property>
|
||||||
<object class="wxStaticBoxSizer" expanded="1">
|
<object class="wxStaticBoxSizer" expanded="0">
|
||||||
<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"></property>
|
<property name="minimum_size"></property>
|
||||||
|
@ -399,7 +399,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">2</property>
|
||||||
<object class="wxStaticBoxSizer" expanded="0">
|
<object class="wxStaticBoxSizer" expanded="0">
|
||||||
<property name="id">wxID_ANY</property>
|
<property name="id">wxID_ANY</property>
|
||||||
<property name="label">Membership:</property>
|
<property name="label">Membership:</property>
|
||||||
|
@ -492,7 +492,7 @@
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<property name="pos"></property>
|
<property name="pos"></property>
|
||||||
<property name="size"></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="subclass"></property>
|
||||||
<property name="tooltip"></property>
|
<property name="tooltip"></property>
|
||||||
<property name="validator_data_type"></property>
|
<property name="validator_data_type"></property>
|
||||||
|
@ -802,7 +802,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">0</property>
|
||||||
<object class="wxBoxSizer" expanded="1">
|
<object class="wxBoxSizer" expanded="1">
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
<property name="name">rghtNetSelectBoxSizer</property>
|
<property name="name">rghtNetSelectBoxSizer</property>
|
||||||
|
@ -883,7 +883,7 @@
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<property name="pos"></property>
|
<property name="pos"></property>
|
||||||
<property name="size"></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="subclass"></property>
|
||||||
<property name="tooltip"></property>
|
<property name="tooltip"></property>
|
||||||
<property name="validator_data_type"></property>
|
<property name="validator_data_type"></property>
|
||||||
|
|
Loading…
Reference in New Issue