Skip to content

Commit

Permalink
Double-clicking a folder in the SoundChooser toggles the expanded sta…
Browse files Browse the repository at this point in the history
…te now as it did before.
  • Loading branch information
codereader committed Jul 14, 2017
1 parent 758e513 commit f7f0534
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion plugins/uimanager/SoundChooser.cpp
Expand Up @@ -259,7 +259,32 @@ void SoundChooser::_onSelectionChange(wxDataViewEvent& ev)

void SoundChooser::_onItemActivated(wxDataViewEvent& ev)
{
_preview->playRandomSoundFile();
wxDataViewItem item = ev.GetItem();

if (item.IsOk())
{
wxutil::TreeModel::Row row(item, *_treeStore);

bool isFolder = row[_columns.isFolder].getBool();

if (isFolder)
{
// In case we double-click a folder, toggle its expanded state
if (_treeView->IsExpanded(item))
{
_treeView->Collapse(item);
}
else
{
_treeView->Expand(item);
}

return;
}

// It's a regular item, try to play it back
_preview->playRandomSoundFile();
}
}

void SoundChooser::setTreeViewModel()
Expand Down

0 comments on commit f7f0534

Please sign in to comment.