Skip to content

Commit

Permalink
#5127: Remove a bunch of unused members from EntityClassChooser
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jan 3, 2021
1 parent 46bd5c9 commit 0363efd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 35 deletions.
19 changes: 6 additions & 13 deletions libs/wxutil/EntityClassChooser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "dataview/TreeViewItemStyle.h"
#include "dataview/ThreadedResourceTreePopulator.h"
#include "dataview/VFSTreePopulator.h"
#include "menu/IconTextMenuItem.h"

#include "i18n.h"
#include "ifavourites.h"
Expand Down Expand Up @@ -143,11 +142,10 @@ class ThreadedEntityClassLoader final :
};

// Main constructor
EntityClassChooser::EntityClassChooser()
: DialogBase(_(ECLASS_CHOOSER_TITLE)),
_treeStore(nullptr),
_treeView(nullptr),
_selectedName("")
EntityClassChooser::EntityClassChooser() :
DialogBase(_(ECLASS_CHOOSER_TITLE)),
_treeView(nullptr),
_selectedName("")
{
loadNamedPanel(this, "EntityClassChooserMainPanel");

Expand Down Expand Up @@ -296,14 +294,9 @@ int EntityClassChooser::ShowModal()

void EntityClassChooser::setupTreeView()
{
_treeStore = new TreeModel(_columns);
TreeModel::Row row = _treeStore->AddItem();

row[_columns.iconAndName] = wxVariant(wxDataViewIconText(_("Loading...")));

wxPanel* parent = findNamedObject<wxPanel>(this, "EntityClassChooserLeftPane");

_treeView = new ResourceTreeView(parent, _treeStore, _columns);
_treeView = new ResourceTreeView(parent, _columns);
_treeView->AddSearchColumn(_columns.iconAndName);
_treeView->SetExpandTopLevelItemsAfterPopulation(true);
_treeView->EnableFavouriteManagement(decl::Type::EntityDef);
Expand Down Expand Up @@ -335,7 +328,7 @@ void EntityClassChooser::updateSelection()

if (item.IsOk())
{
TreeModel::Row row(item, *_treeStore);
TreeModel::Row row(item, *_treeView->GetModel());

if (!row[_columns.isFolder].getBool())
{
Expand Down
23 changes: 1 addition & 22 deletions libs/wxutil/EntityClassChooser.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@

#include "preview/ModelPreview.h"
#include "dialog/DialogBase.h"
#include "dataview/TreeModelFilter.h"
#include "dataview/TreeModel.h"
#include "dataview/ResourceTreeView.h"
#include "dataview/IResourceTreePopulator.h"
#include "XmlResourceBasedWidget.h"
#include "PanedPosition.h"
#include "menu/PopupMenu.h"

#include <memory>
#include <sigc++/connection.h>
Expand All @@ -32,15 +28,8 @@ class EntityClassChooser :
{
private:
ResourceTreeView::Columns _columns;

// Tree model holding the classnames
TreeModel::Ptr _treeStore;
TreeModelFilter::Ptr _treeModelFilter;
ResourceTreeView* _treeView;

// Delegated object for loading entity classes in a separate thread
std::unique_ptr<wxutil::IResourceTreePopulator> _eclassLoader;

// Last selected classname
std::string _selectedName;

Expand All @@ -51,17 +40,7 @@ class EntityClassChooser :

sigc::connection _defsReloaded;

wxDataViewItem _emptyFavouritesLabel;

enum class TreeMode
{
ShowAll,
ShowFavourites,
};
TreeMode _mode;

private:
// Constructor. Creates the GTK widgets.
EntityClassChooser();

void loadEntityClasses();
Expand Down Expand Up @@ -107,4 +86,4 @@ class EntityClassChooser :
static std::string chooseEntityClass(const std::string& preselectEclass = std::string());
};

} // namespace ui
} // namespace

0 comments on commit 0363efd

Please sign in to comment.