Skip to content

Commit

Permalink
Remove the help icon column from entity inspector. It used to show a …
Browse files Browse the repository at this point in the history
…tool tip back when it was based on GTK, now it's not been doing anything anymore.
  • Loading branch information
codereader committed Jan 12, 2020
1 parent 8a967df commit 6a2ca94
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 47 deletions.
54 changes: 11 additions & 43 deletions radiant/ui/einspector/EntityInspector.cpp
Expand Up @@ -52,41 +52,19 @@ namespace

const std::string RKEY_ROOT = "user/ui/entityInspector/";
const std::string RKEY_PANE_STATE = RKEY_ROOT + "pane";

const std::string HELP_ICON_NAME = "helpicon.png";
}

EntityInspector::EntityInspector() :
_mainWidget(NULL),
_editorFrame(NULL),
_showInheritedCheckbox(NULL),
_showHelpColumnCheckbox(NULL),
_primitiveNumLabel(NULL),
_keyValueTreeView(NULL),
_helpColumn(NULL),
_keyEntry(NULL),
_valEntry(NULL)
_mainWidget(nullptr),
_editorFrame(nullptr),
_showInheritedCheckbox(nullptr),
_showHelpColumnCheckbox(nullptr),
_primitiveNumLabel(nullptr),
_keyValueTreeView(nullptr),
_keyEntry(nullptr),
_valEntry(nullptr)
{}

namespace
{
wxVariant HELP_ICON()
{
static wxBitmap _helpBitmap = wxArtProvider::GetBitmap(
GlobalUIManager().ArtIdPrefix() + HELP_ICON_NAME
);
wxASSERT(_helpBitmap.IsOk());

return wxVariant(_helpBitmap);
}

wxVariant BLANK_ICON()
{
static const char* EMPTY_XPM[] = { "1 1 1 1", "* c none", "*" };
return wxVariant(wxBitmap(EMPTY_XPM));
}
}

void EntityInspector::construct()
{
_emptyIcon.CopyFromBitmap(wxArtProvider::GetBitmap(GlobalUIManager().ArtIdPrefix() + "empty.png"));
Expand All @@ -102,13 +80,11 @@ void EntityInspector::construct()
wxBoxSizer* optionsHBox = new wxBoxSizer(wxHORIZONTAL);

_showInheritedCheckbox = new wxCheckBox(_mainWidget, wxID_ANY, _("Show inherited properties"));
_showInheritedCheckbox->Connect(wxEVT_CHECKBOX,
wxCommandEventHandler(EntityInspector::_onToggleShowInherited), NULL, this);
_showInheritedCheckbox->Bind(wxEVT_CHECKBOX, &EntityInspector::_onToggleShowInherited, this);

_showHelpColumnCheckbox = new wxCheckBox(_mainWidget, wxID_ANY, _("Show help"));
_showHelpColumnCheckbox->SetValue(false);
_showHelpColumnCheckbox->Connect(wxEVT_CHECKBOX,
wxCommandEventHandler(EntityInspector::_onToggleShowHelpIcons), NULL, this);
_showHelpColumnCheckbox->Bind(wxEVT_CHECKBOX, &EntityInspector::_onToggleShowHelpIcons, this);

_primitiveNumLabel = new wxStaticText(_mainWidget, wxID_ANY, "",
wxDefaultPosition, wxDefaultSize);
Expand Down Expand Up @@ -254,7 +230,6 @@ void EntityInspector::onKeyChange(const std::string& key,

row[_columns.isInherited] = false;
row[_columns.hasHelpText] = hasDescription;
row[_columns.helpIcon] = hasDescription ? HELP_ICON() : BLANK_ICON();

if (added)
{
Expand Down Expand Up @@ -478,11 +453,6 @@ wxWindow* EntityInspector::createTreeViewPane(wxWindow* parent)
_columns.value.getColumnIndex(), wxDATAVIEW_CELL_INERT,
wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT, wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE);

// Add the help icon
_helpColumn = _keyValueTreeView->AppendBitmapColumn(_("?"),
_columns.helpIcon.getColumnIndex(), wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT);
_helpColumn->SetHidden(true);

// Used to update the help text
_keyValueTreeView->Connect(wxEVT_DATAVIEW_SELECTION_CHANGED,
wxDataViewEventHandler(EntityInspector::_onTreeViewSelectionChanged), NULL, this);
Expand Down Expand Up @@ -962,8 +932,7 @@ void EntityInspector::_onToggleShowInherited(wxCommandEvent& ev)

void EntityInspector::_onToggleShowHelpIcons(wxCommandEvent& ev)
{
// Set the visibility of the column accordingly
_helpColumn->SetHidden(!_showHelpColumnCheckbox->IsChecked());
// Set the visibility of the help text panel
_helpText->Show(_showHelpColumnCheckbox->IsChecked());

// After showing a packed control we need to call the sizer's layout() method
Expand Down Expand Up @@ -1129,7 +1098,6 @@ void EntityInspector::addClassAttribute(const EntityClassAttribute& a)

row[_columns.isInherited] = true;
row[_columns.hasHelpText] = hasDescription;
row[_columns.helpIcon] = hasDescription ? HELP_ICON() : BLANK_ICON();

row.SendItemAdded();
}
Expand Down
4 changes: 0 additions & 4 deletions radiant/ui/einspector/EntityInspector.h
Expand Up @@ -54,15 +54,13 @@ class EntityInspector :
name(add(wxutil::TreeModel::Column::IconText)),
value(add(wxutil::TreeModel::Column::String)),
isInherited(add(wxutil::TreeModel::Column::Boolean)),
helpIcon(add(wxutil::TreeModel::Column::Icon)),
hasHelpText(add(wxutil::TreeModel::Column::Boolean)),
booleanValue(add(wxutil::TreeModel::Column::Boolean))
{}

wxutil::TreeModel::Column name;
wxutil::TreeModel::Column value;
wxutil::TreeModel::Column isInherited;
wxutil::TreeModel::Column helpIcon;
wxutil::TreeModel::Column hasHelpText;
wxutil::TreeModel::Column booleanValue;
};
Expand Down Expand Up @@ -101,8 +99,6 @@ class EntityInspector :

wxIcon _emptyIcon;

wxDataViewColumn* _helpColumn;

// Cache of wxDataViewItems pointing to keyvalue rows,
// so we can quickly find existing keys to change their values
typedef std::map<std::string, wxDataViewItem, StringCompareFunctorNoCase> TreeIterMap;
Expand Down

0 comments on commit 6a2ca94

Please sign in to comment.