fix formatting and update comments
This commit is contained in:
parent
80e40b862c
commit
ff5828fc33
|
@ -1807,12 +1807,14 @@ void BOARD::SanitizeNetcodes()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void BOARD::AddListener( BOARD_LISTENER* aListener )
|
||||
{
|
||||
if( std::find( m_listeners.begin(), m_listeners.end(), aListener ) == m_listeners.end() )
|
||||
m_listeners.push_back( aListener );
|
||||
}
|
||||
|
||||
|
||||
void BOARD::RemoveListener( BOARD_LISTENER* aListener )
|
||||
{
|
||||
auto i = std::find( m_listeners.begin(), m_listeners.end(), aListener );
|
||||
|
@ -1824,6 +1826,7 @@ void BOARD::RemoveListener( BOARD_LISTENER* aListener )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void BOARD::OnItemChanged( BOARD_ITEM* aItem )
|
||||
{
|
||||
InvokeListeners( &BOARD_LISTENER::OnBoardItemChanged, *this, aItem );
|
||||
|
|
|
@ -395,9 +395,10 @@ public:
|
|||
bool IsHighLightNetON() const { return m_highLight.m_highLightOn; }
|
||||
|
||||
/**
|
||||
* Function HighLightON
|
||||
* Enable net highlight.
|
||||
* if m_highLight_NetCode >= 0, this net will be highlighted
|
||||
* Enable or disable net highlighting. If a netcode >= 0 has been set
|
||||
* with SetHighLightNet and aValue is true, the net will be highlighted.
|
||||
* If aValue is false, net highlighting will be disabled regardless of
|
||||
* the highlight netcode being set.
|
||||
*/
|
||||
void HighLightON( bool aValue = true );
|
||||
|
||||
|
|
|
@ -435,6 +435,7 @@ public:
|
|||
{
|
||||
return m_items.begin();
|
||||
}
|
||||
|
||||
CONST_ITER end() const
|
||||
{
|
||||
return m_items.end();
|
||||
|
|
|
@ -62,6 +62,7 @@ def_col( COLUMN_TOTAL_LENGTH, 6, _( "Length" ) );
|
|||
|
||||
#undef def_col
|
||||
|
||||
|
||||
struct DIALOG_SELECT_NET_FROM_LIST::LIST_ITEM
|
||||
{
|
||||
LIST_ITEM( NETINFO_ITEM* aNet ) : m_net( aNet )
|
||||
|
@ -76,6 +77,7 @@ struct DIALOG_SELECT_NET_FROM_LIST::LIST_ITEM
|
|||
int m_total_length = 0;
|
||||
};
|
||||
|
||||
|
||||
struct DIALOG_SELECT_NET_FROM_LIST::LIST_ITEM_NET_CMP_LESS
|
||||
{
|
||||
const LIST_ITEM* m_base_ptr;
|
||||
|
@ -101,6 +103,7 @@ struct DIALOG_SELECT_NET_FROM_LIST::LIST_ITEM_NET_CMP_LESS
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
struct DIALOG_SELECT_NET_FROM_LIST::ROW_DESC
|
||||
{
|
||||
int row_num = -1;
|
||||
|
@ -185,17 +188,20 @@ DIALOG_SELECT_NET_FROM_LIST::~DIALOG_SELECT_NET_FROM_LIST()
|
|||
m_brd->RemoveListener( this );
|
||||
}
|
||||
|
||||
|
||||
DIALOG_SELECT_NET_FROM_LIST::SETTINGS DIALOG_SELECT_NET_FROM_LIST::Settings() const
|
||||
{
|
||||
return { m_textCtrlFilter->GetValue(), m_cbShowZeroPad->IsChecked() };
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SELECT_NET_FROM_LIST::onParentWindowClosed( wxCommandEvent& event )
|
||||
{
|
||||
Close();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SELECT_NET_FROM_LIST::onUnitsChanged( wxCommandEvent& event )
|
||||
{
|
||||
this->m_units = m_frame->GetUserUnits();
|
||||
|
@ -206,6 +212,7 @@ void DIALOG_SELECT_NET_FROM_LIST::onUnitsChanged( wxCommandEvent& event )
|
|||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SELECT_NET_FROM_LIST::onBoardChanged( wxCommandEvent& event )
|
||||
{
|
||||
if( m_brd != nullptr )
|
||||
|
@ -224,6 +231,7 @@ void DIALOG_SELECT_NET_FROM_LIST::onBoardChanged( wxCommandEvent& event )
|
|||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_SELECT_NET_FROM_LIST::netFilterMatches( NETINFO_ITEM* aNet ) const
|
||||
{
|
||||
// Note: the filtering is case insensitive.
|
||||
|
@ -269,10 +277,7 @@ std::vector<CN_ITEM*> DIALOG_SELECT_NET_FROM_LIST::relevantConnectivityItems() c
|
|||
std::vector<CN_ITEM*> cn_items;
|
||||
cn_items.reserve( 1024 );
|
||||
|
||||
|
||||
auto connectivity = m_brd->GetConnectivity();
|
||||
|
||||
for( auto& cn_item : connectivity->GetConnectivityAlgo()->ItemList() )
|
||||
for( auto& cn_item : m_brd->GetConnectivity()->GetConnectivityAlgo()->ItemList() )
|
||||
{
|
||||
if( cn_item->Valid() && type_bits[cn_item->Parent()->Type()] )
|
||||
cn_items.push_back( cn_item );
|
||||
|
@ -283,11 +288,13 @@ std::vector<CN_ITEM*> DIALOG_SELECT_NET_FROM_LIST::relevantConnectivityItems() c
|
|||
return cn_items;
|
||||
}
|
||||
|
||||
|
||||
DIALOG_SELECT_NET_FROM_LIST::ROW_DESC DIALOG_SELECT_NET_FROM_LIST::findRow( int aNetCode )
|
||||
{
|
||||
return findRow( m_brd->FindNet( aNetCode ) );
|
||||
}
|
||||
|
||||
|
||||
DIALOG_SELECT_NET_FROM_LIST::ROW_DESC DIALOG_SELECT_NET_FROM_LIST::findRow( NETINFO_ITEM* aNet )
|
||||
{
|
||||
auto i = std::lower_bound( m_list_items_by_net.begin(), m_list_items_by_net.end(), aNet,
|
||||
|
@ -299,6 +306,7 @@ DIALOG_SELECT_NET_FROM_LIST::ROW_DESC DIALOG_SELECT_NET_FROM_LIST::findRow( NETI
|
|||
return {};
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SELECT_NET_FROM_LIST::deleteRow( const ROW_DESC& aRow )
|
||||
{
|
||||
if( !aRow )
|
||||
|
@ -314,6 +322,7 @@ void DIALOG_SELECT_NET_FROM_LIST::deleteRow( const ROW_DESC& aRow )
|
|||
LIST_ITEM_NET_CMP_LESS( m_list_items ) );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SELECT_NET_FROM_LIST::setValue(
|
||||
const ROW_DESC& aRow, const COLUMN_ID& aCol, wxString aVal )
|
||||
{
|
||||
|
@ -321,26 +330,31 @@ void DIALOG_SELECT_NET_FROM_LIST::setValue(
|
|||
m_netsList->SetValue( aVal, aRow.row_num, aCol.col_num );
|
||||
}
|
||||
|
||||
|
||||
wxString DIALOG_SELECT_NET_FROM_LIST::formatNetCode( const NETINFO_ITEM* aNet ) const
|
||||
{
|
||||
return wxString::Format( "%.3d", aNet->GetNet() );
|
||||
}
|
||||
|
||||
|
||||
wxString DIALOG_SELECT_NET_FROM_LIST::formatNetName( const NETINFO_ITEM* aNet ) const
|
||||
{
|
||||
return UnescapeString( aNet->GetNetname() );
|
||||
}
|
||||
|
||||
|
||||
wxString DIALOG_SELECT_NET_FROM_LIST::formatCount( unsigned int aValue ) const
|
||||
{
|
||||
return wxString::Format( "%u", aValue );
|
||||
}
|
||||
|
||||
|
||||
wxString DIALOG_SELECT_NET_FROM_LIST::formatLength( int aValue ) const
|
||||
{
|
||||
return MessageTextFromValue( GetUserUnits(), aValue );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SELECT_NET_FROM_LIST::OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardItem )
|
||||
{
|
||||
if( NETINFO_ITEM* net = dyn_cast<NETINFO_ITEM*>( aBoardItem ) )
|
||||
|
@ -375,6 +389,7 @@ void DIALOG_SELECT_NET_FROM_LIST::OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* a
|
|||
else if( auto* i = dyn_cast<BOARD_CONNECTED_ITEM*>( aBoardItem ) )
|
||||
{
|
||||
auto r = findRow( i->GetNet() );
|
||||
|
||||
if( r )
|
||||
{
|
||||
// try to handle frequent operations quickly.
|
||||
|
@ -402,6 +417,7 @@ void DIALOG_SELECT_NET_FROM_LIST::OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* a
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SELECT_NET_FROM_LIST::OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoardItem )
|
||||
{
|
||||
if( auto* net = dyn_cast<NETINFO_ITEM*>( aBoardItem ) )
|
||||
|
@ -414,6 +430,7 @@ void DIALOG_SELECT_NET_FROM_LIST::OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM*
|
|||
for( const D_PAD* pad : mod->Pads() )
|
||||
{
|
||||
auto r = findRow( pad->GetNet() );
|
||||
|
||||
if( r )
|
||||
{
|
||||
r.by_row->m_pad_count -= 1;
|
||||
|
@ -428,6 +445,7 @@ void DIALOG_SELECT_NET_FROM_LIST::OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM*
|
|||
else if( auto* i = dyn_cast<BOARD_CONNECTED_ITEM*>( aBoardItem ) )
|
||||
{
|
||||
auto r = findRow( i->GetNet() );
|
||||
|
||||
if( r )
|
||||
{
|
||||
// try to handle frequent operations quickly.
|
||||
|
@ -455,6 +473,7 @@ void DIALOG_SELECT_NET_FROM_LIST::OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM*
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SELECT_NET_FROM_LIST::OnBoardItemChanged( BOARD& aBoard, BOARD_ITEM* aBoardItem )
|
||||
{
|
||||
if( dynamic_cast<BOARD_CONNECTED_ITEM*>( aBoardItem ) != nullptr
|
||||
|
@ -465,6 +484,7 @@ void DIALOG_SELECT_NET_FROM_LIST::OnBoardItemChanged( BOARD& aBoard, BOARD_ITEM*
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SELECT_NET_FROM_LIST::OnBoardHighlightNetChanged( BOARD& aBoard )
|
||||
{
|
||||
if( !m_brd->IsHighLightNetON() )
|
||||
|
@ -556,6 +576,7 @@ void DIALOG_SELECT_NET_FROM_LIST::updateNet( NETINFO_ITEM* aNet )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SELECT_NET_FROM_LIST::buildNetsList()
|
||||
{
|
||||
// when rebuilding the netlist, try to keep the row selection
|
||||
|
@ -679,6 +700,7 @@ void DIALOG_SELECT_NET_FROM_LIST::buildNetsList()
|
|||
else
|
||||
{
|
||||
auto r = findRow( prev_selected_netcode );
|
||||
|
||||
if( r )
|
||||
{
|
||||
m_selection = r.by_row->m_net->GetNetname();
|
||||
|
@ -691,9 +713,11 @@ void DIALOG_SELECT_NET_FROM_LIST::buildNetsList()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SELECT_NET_FROM_LIST::HighlightNet( NETINFO_ITEM* aNet )
|
||||
{
|
||||
const auto r = findRow( aNet );
|
||||
|
||||
if( r )
|
||||
{
|
||||
auto i = m_netsList->RowToItem( r.row_num );
|
||||
|
@ -704,6 +728,7 @@ void DIALOG_SELECT_NET_FROM_LIST::HighlightNet( NETINFO_ITEM* aNet )
|
|||
m_netsList->UnselectAll();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SELECT_NET_FROM_LIST::highlightNetOnBoard( NETINFO_ITEM* aNet ) const
|
||||
{
|
||||
int netCode = aNet != nullptr ? aNet->GetNet() : -1;
|
||||
|
|
Loading…
Reference in New Issue