Skip to content

Commit

Permalink
#5127: Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jan 2, 2021
1 parent e643aa6 commit 1c44754
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions libs/wxutil/EntityClassChooser.cpp
Expand Up @@ -343,7 +343,7 @@ int EntityClassChooser::ShowModal()

void EntityClassChooser::setTreeViewModel()
{
_treeView->AssociateModel(_treeStore.get());
_treeView->setTreeModel(_treeStore);

// Expand the first layer
_treeView->ExpandTopLevelItems();
Expand All @@ -358,7 +358,6 @@ void EntityClassChooser::setTreeViewModel()

void EntityClassChooser::setupTreeView()
{
// Use the TreeModel's full string search function
_treeStore = new TreeModel(_columns);
TreeModel::Row row = _treeStore->AddItem();

Expand All @@ -367,7 +366,7 @@ void EntityClassChooser::setupTreeView()
wxPanel* parent = findNamedObject<wxPanel>(this, "EntityClassChooserLeftPane");

_treeView = new ResourceTreeView(parent, _treeStore, _columns);
_treeView->AddSearchColumn(_columns.leafName);
_treeView->AddSearchColumn(_columns.iconAndName);

_treeView->Bind(wxEVT_DATAVIEW_SELECTION_CHANGED, &EntityClassChooser::onSelectionChanged, this);

Expand Down
4 changes: 0 additions & 4 deletions libs/wxutil/ResourceTreeView.cpp
Expand Up @@ -36,10 +36,6 @@ ResourceTreeView::ResourceTreeView(wxWindow* parent, const TreeModel::Ptr& model
_treeStore.reset(new TreeModel(_columns));
}

// The wxWidgets algorithm sucks at sorting large flat lists of strings,
// so we do that ourselves
_treeStore->SetHasDefaultCompare(false);

AssociateModel(_treeStore.get());

Bind(wxEVT_DATAVIEW_ITEM_CONTEXT_MENU, &ResourceTreeView::_onContextMenu, this);
Expand Down
4 changes: 4 additions & 0 deletions radiant/ui/mediabrowser/MediaBrowserTreeView.cpp
Expand Up @@ -320,6 +320,10 @@ MediaBrowserTreeView::MediaBrowserTreeView(wxWindow* parent) :

AddSearchColumn(_columns.iconAndName);

// The wxWidgets algorithm sucks at sorting large flat lists of strings,
// so we do that ourselves
getTreeModel()->SetHasDefaultCompare(false);

Bind(wxEVT_DATAVIEW_ITEM_ACTIVATED, &MediaBrowserTreeView::_onTreeViewItemActivated, this);
Bind(wxutil::EV_TREEMODEL_POPULATION_FINISHED, &MediaBrowserTreeView::_onTreeStorePopulationFinished, this);
Bind(wxEVT_PAINT, &MediaBrowserTreeView::_onExpose, this);
Expand Down

0 comments on commit 1c44754

Please sign in to comment.