Allow null path in 3d model

This allows a setting where the path is not one of the options.  This
permits the user to select once to go to any path option (rather than
off the current and then back to currect) when the filetree doesn't
match the dropdown.  This also selects the drop down item if it matches
the tree.

(cherry picked from commit f5284ced54)
This commit is contained in:
Seth Hillbrand 2019-06-20 20:10:25 -07:00
parent 39c2745f55
commit d132cf37e0
1 changed files with 12 additions and 2 deletions

View File

@ -221,7 +221,7 @@ void DLG_SELECT_3DMODEL::OnFileActivated( wxTreeEvent& event )
void DLG_SELECT_3DMODEL::SetRootDir( wxCommandEvent& event )
{
if( m_FileTree )
if( m_FileTree && dirChoices->GetSelection() > 0 )
m_FileTree->SetPath( dirChoices->GetString( dirChoices->GetSelection() ) );
return;
@ -263,21 +263,31 @@ void DLG_SELECT_3DMODEL::updateDirChoiceList( void )
if( !cl.empty() )
{
unsigned int choice = 0;
dirChoices->Clear();
dirChoices->Append( "" ); //Insert a blank string at the beginning to allow selection
if( !prjDir.empty() )
{
dirChoices->Append( prjDir );
if( prjDir == m_FileTree->GetPath() )
choice = 1;
}
std::set< wxString >::const_iterator sI = cl.begin();
std::set< wxString >::const_iterator eI = cl.end();
while( sI != eI )
{
if( *sI == m_FileTree->GetPath() )
choice = dirChoices->GetCount();
dirChoices->Append( *sI );
++sI;
}
dirChoices->Select( 0 );
dirChoices->Select( choice );
}
return;