Skip to content

Commit

Permalink
#6021: Add ResourceTreeViewToolbar to SkinChooser
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jul 24, 2022
1 parent 89801e8 commit a68fd9d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions radiant/ui/common/SkinChooser.cpp
Expand Up @@ -136,6 +136,7 @@ namespace
SkinChooser::SkinChooser() :
DialogBase(_(WINDOW_TITLE)),
_treeView(nullptr),
_treeViewToolbar(nullptr),
_materialsList(nullptr),
_fileInfo(nullptr)
{
Expand Down Expand Up @@ -170,6 +171,8 @@ void SkinChooser::populateWindow()
_treeView->Bind(wxEVT_DATAVIEW_SELECTION_CHANGED, &SkinChooser::_onSelChanged, this);
_treeView->Bind(wxutil::EV_TREEVIEW_POPULATION_FINISHED, &SkinChooser::_onTreeViewPopulationFinished, this);

_treeViewToolbar = new wxutil::ResourceTreeViewToolbar(leftPanel, _treeView);

// Preview
_preview.reset(new wxutil::ModelPreview(splitter));
_preview->getWidget()->SetMinClientSize(wxSize(GetSize().GetWidth() / 3, -1));
Expand All @@ -184,6 +187,7 @@ void SkinChooser::populateWindow()

_fileInfo = new wxutil::DeclFileInfo(leftPanel, decl::Type::Skin);

leftPanel->GetSizer()->Add(_treeViewToolbar, 0, wxEXPAND | wxALIGN_LEFT | wxBOTTOM | wxLEFT | wxRIGHT, 6);
leftPanel->GetSizer()->Add(_treeView, 1, wxEXPAND);
leftPanel->GetSizer()->Add(_fileInfo, 0, wxEXPAND | wxTOP, 6);
leftPanel->GetSizer()->Add(_materialsList, 0, wxEXPAND | wxTOP, 6);
Expand All @@ -207,6 +211,8 @@ int SkinChooser::ShowModal()
{
populateSkins();

_treeViewToolbar->ClearFilter();

// Display the model in the window title
SetTitle(std::string(_(WINDOW_TITLE)) + ": " + _model);

Expand All @@ -215,8 +221,6 @@ int SkinChooser::ShowModal()
_modelLoadedConn = _preview->signal_ModelLoaded().connect(
sigc::mem_fun(this, &SkinChooser::_onPreviewModelLoaded));

setSelectedSkin(_prevSkin);

int returnCode = DialogBase::ShowModal();

if (returnCode == wxID_OK)
Expand Down
2 changes: 2 additions & 0 deletions radiant/ui/common/SkinChooser.h
Expand Up @@ -11,6 +11,7 @@

#include "wxutil/dataview/TreeModel.h"
#include "wxutil/dataview/DeclarationTreeView.h"
#include "wxutil/dataview/ResourceTreeViewToolbar.h"
#include "ui/modelselector/MaterialsList.h"

namespace wxutil { class TreeView; }
Expand All @@ -33,6 +34,7 @@ class SkinChooser :

wxutil::TreeModel::Ptr _treeStore;
wxutil::DeclarationTreeView* _treeView;
wxutil::ResourceTreeViewToolbar* _treeViewToolbar;
MaterialsList* _materialsList;

wxutil::DeclFileInfo* _fileInfo;
Expand Down

0 comments on commit a68fd9d

Please sign in to comment.