Skip to content

Commit

Permalink
Remove unneeded static methods from XYWnd
Browse files Browse the repository at this point in the history
getViewTypeStr() was never called at all; getViewTypeTitle() can be
replaced with a simple map.
  • Loading branch information
Matthew Mott committed Jul 12, 2023
1 parent 78d266d commit 97950da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 36 deletions.
39 changes: 9 additions & 30 deletions radiant/xyview/XYWnd.cpp
Expand Up @@ -65,6 +65,13 @@ namespace
{
constexpr const char* const RKEY_XYVIEW_ROOT = "user/ui/xyview";
constexpr const char* const RKEY_SELECT_EPSILON = "user/ui/selectionEpsilon";

// User-visible titles for view directions
static const std::map<EViewType, std::string> VIEWTYPE_TITLES {
{XY, _("XY Top")},
{XZ, _("XZ Front")},
{YZ, _("YZ Side")},
};
}

int XYWnd::_nextId = 1;
Expand Down Expand Up @@ -267,32 +274,6 @@ void XYWnd::ensureFont()
_font = GlobalOpenGL().getFont(manager.fontStyle(), manager.fontSize());
}

const std::string XYWnd::getViewTypeTitle(EViewType viewtype) {
if (viewtype == XY) {
return _("XY Top");
}
if (viewtype == XZ) {
return _("XZ Front");
}
if (viewtype == YZ) {
return _("YZ Side");
}
return "";
}

const std::string XYWnd::getViewTypeStr(EViewType viewtype) {
if (viewtype == XY) {
return "XY";
}
if (viewtype == XZ) {
return "XZ";
}
if (viewtype == YZ) {
return "YZ";
}
return "";
}

void XYWnd::forceRedraw()
{
if (_drawing)
Expand Down Expand Up @@ -896,11 +877,9 @@ void XYWnd::drawGrid()
}

// we do this part (the old way) only if show_axis is disabled
if (!GlobalXYWnd().showAxes())
{
if (!GlobalXYWnd().showAxes()) {
glRasterPos2d( _origin[nDim1] - w + 35 / _scale, _origin[nDim2] + h - 20 / _scale );

_font->drawString(getViewTypeTitle(_viewType));
_font->drawString(VIEWTYPE_TITLES.at(_viewType));
}
}

Expand Down
6 changes: 0 additions & 6 deletions radiant/xyview/XYWnd.h
Expand Up @@ -123,12 +123,6 @@ class XYWnd final :
static void captureStates();
static void releaseStates();

// Returns the long type string ("XY Top", "YZ Side", "XZ Front") for use in window titles
static const std::string getViewTypeTitle(EViewType viewtype);

// Returns the short type string (XY, XZ, YZ)
static const std::string getViewTypeStr(EViewType viewtype);

void positionView(const Vector3& position);
const Vector3& getOrigin() const override;
void setOrigin(const Vector3& origin) override;
Expand Down

0 comments on commit 97950da

Please sign in to comment.