Fix preselect in CMP_TREE_MODEL_ADAPTER
This commit is contained in:
parent
12b65cf56b
commit
b2f1d22bbf
|
@ -386,7 +386,12 @@ bool CMP_TREE_MODEL_ADAPTER::ShowPreselect()
|
|||
return FindAndExpand( m_tree,
|
||||
[&]( CMP_TREE_NODE const* n )
|
||||
{
|
||||
return m_preselect_name == n->Name && m_preselect_unit == n->Unit;
|
||||
if( n->Type == CMP_TREE_NODE::ALIAS && ( n->Children.empty() || !m_preselect_unit ) )
|
||||
return m_preselect_name == n->Name;
|
||||
else if( n->Type == CMP_TREE_NODE::UNIT && m_preselect_unit )
|
||||
return m_preselect_name == n->Parent->Name && m_preselect_unit == n->Unit;
|
||||
else
|
||||
return false;
|
||||
} );
|
||||
}
|
||||
|
||||
|
|
|
@ -141,15 +141,7 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibrary( const SCHLIB_FILTER* aFilte
|
|||
|
||||
if( !aHistoryList.empty() )
|
||||
{
|
||||
// This is good for a transition for experienced users: giving them a History. Ideally,
|
||||
// we actually make this part even faster to access with a popup on ALT-a or something.
|
||||
// the history is under a node named "-- History --"
|
||||
// However, because it is translatable, and we need to have a node name starting by "-- "
|
||||
// because we (later) sort all node names alphabetically and this node should be the first,
|
||||
// we build it with only with "History" string translatable
|
||||
wxString nodename;
|
||||
nodename << wxT("-- ") << _("History") << wxT(" --");
|
||||
adapter->AddAliasList( nodename, aHistoryList, NULL );
|
||||
adapter->AddAliasList( "-- " + _( "History" ) + " --", aHistoryList, NULL );
|
||||
adapter->SetPreselectNode( aHistoryList[0], aHistoryLastUnit );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue