Add comments and show recently used even when empty.

This commit is contained in:
Jeff Young 2018-08-20 13:08:35 +01:00
parent c851d6d64b
commit dbd3900e28
2 changed files with 14 additions and 17 deletions

View File

@ -122,7 +122,8 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, LIB_TABLE* aLibTable, LIB_TREE_MODEL_ADAP
{ {
m_query_ctrl->SetHint( _( "Filter" ) ); m_query_ctrl->SetHint( _( "Filter" ) );
m_query_ctrl->SetFocus(); m_query_ctrl->SetFocus();
m_query_ctrl->SetValue( wxEmptyString ); m_query_ctrl->SetValue( wxEmptyString ); // SetValue() is required here to kick off
// initial sorting and pre-selection.
} }
// There may be a part preselected in the model. Make sure it is displayed. // There may be a part preselected in the model. Make sure it is displayed.

View File

@ -137,31 +137,27 @@ SCH_BASE_FRAME::COMPONENT_SELECTION SCH_BASE_FRAME::SelectComponentFromLibTree(
if( aFilter->GetFilterPowerParts() ) if( aFilter->GetFilterPowerParts() )
adapter->SetFilter( SYMBOL_TREE_MODEL_ADAPTER::CMP_FILTER_POWER ); adapter->SetFilter( SYMBOL_TREE_MODEL_ADAPTER::CMP_FILTER_POWER );
} }
std::vector< LIB_TREE_ITEM* > history_list;
for( auto const& i : aHistoryList )
{
LIB_ALIAS* alias = GetLibAlias( i.LibId );
if( alias )
history_list.push_back( alias );
}
adapter->DoAddLibrary( "-- " + _( "Recently Used" ) + " --", wxEmptyString, history_list, true );
if( !aHistoryList.empty() ) if( !aHistoryList.empty() )
{
std::vector< LIB_TREE_ITEM* > history_list;
for( auto const& i : aHistoryList )
{
LIB_ALIAS* alias = GetLibAlias( i.LibId );
if( alias )
history_list.push_back( alias );
}
adapter->DoAddLibrary( "-- " + _( "Recently Used" ) + " --", wxEmptyString, history_list, true );
adapter->SetPreselectNode( aHistoryList[0].LibId, aHistoryList[0].Unit ); adapter->SetPreselectNode( aHistoryList[0].LibId, aHistoryList[0].Unit );
}
const std::vector< wxString > libNicknames = libs->GetLogicalLibs(); const std::vector< wxString > libNicknames = libs->GetLogicalLibs();
if( !loaded ) if( !loaded )
{
adapter->AddLibraries( libNicknames, this ); adapter->AddLibraries( libNicknames, this );
}
if( aHighlight && aHighlight->IsValid() ) if( aHighlight && aHighlight->IsValid() )
adapter->SetPreselectNode( *aHighlight, /* aUnit */ 0 ); adapter->SetPreselectNode( *aHighlight, /* aUnit */ 0 );