Skip to content

Commit

Permalink
OrthoView::setViewType() is now setOrientation()
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Mott committed Sep 13, 2023
1 parent c32e050 commit bd82dba
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
18 changes: 4 additions & 14 deletions radiant/xyview/GlobalXYWnd.cpp
Expand Up @@ -268,16 +268,6 @@ void XYWndManager::updateAllViews(bool force)
}
}

void XYWndManager::doWithActiveXyWnd(const std::function<void(OrthoView&)>& action) const
{
auto window = _xyWnds.find(_activeXYWndId);

if (window != _xyWnds.end())
{
action(*window->second);
}
}

void XYWndManager::zoomIn(const cmd::ArgumentList& args)
{
doWithActiveXyWnd([](auto& activeXyWnd) { activeXyWnd.zoomIn(); });
Expand Down Expand Up @@ -364,19 +354,19 @@ OrthoOrientation XYWndManager::getActiveViewType() const

void XYWndManager::setActiveViewType(OrthoOrientation viewType)
{
doWithActiveXyWnd([&](auto& activeXyWnd) { activeXyWnd.setViewType(viewType); });
doWithActiveXyWnd([&](auto& activeXyWnd) { activeXyWnd.setOrientation(viewType); });
}

void XYWndManager::toggleActiveView(const cmd::ArgumentList& args)
{
doWithActiveXyWnd([&](auto& activeXyWnd)
{
if (activeXyWnd.getOrientation() == OrthoOrientation::XY)
activeXyWnd.setViewType(OrthoOrientation::XZ);
activeXyWnd.setOrientation(OrthoOrientation::XZ);
else if (activeXyWnd.getOrientation() == OrthoOrientation::XZ)
activeXyWnd.setViewType(OrthoOrientation::YZ);
activeXyWnd.setOrientation(OrthoOrientation::YZ);
else
activeXyWnd.setViewType(OrthoOrientation::XY);
activeXyWnd.setOrientation(OrthoOrientation::XY);

// Re-focus the view when toggling projections
activeXyWnd.setOrigin(getFocusPosition());
Expand Down
7 changes: 6 additions & 1 deletion radiant/xyview/GlobalXYWnd.h
Expand Up @@ -149,7 +149,12 @@ class XYWndManager: public IOrthoViewManager, public IUserControlCreator
wxWindow* createWidget(wxWindow* parent) override;

private:
void doWithActiveXyWnd(const std::function<void(OrthoView&)>& action) const;
template<typename F> void doWithActiveXyWnd(F functor) const
{
if (auto window = _xyWnds.find(_activeXYWndId); window != _xyWnds.end()) {
functor(*window->second);
}
}

/* greebo: This function determines the point currently being "looked" at, it is used for toggling the ortho views
* If something is selected the center of the selection is taken as new origin, otherwise the camera
Expand Down
2 changes: 1 addition & 1 deletion radiant/xyview/OrthoView.cpp
Expand Up @@ -452,7 +452,7 @@ void OrthoView::positionView(const Vector3& position) {
queueDraw();
}

void OrthoView::setViewType(OrthoOrientation viewType) {
void OrthoView::setOrientation(OrthoOrientation viewType) {
_orientation = viewType;
updateModelview();
}
Expand Down
2 changes: 1 addition & 1 deletion radiant/xyview/OrthoView.h
Expand Up @@ -151,7 +151,7 @@ class OrthoView final :
void updateProjection();

/// Change the view orientation
void setViewType(OrthoOrientation n);
void setOrientation(OrthoOrientation n);

/// \see IOrthoView::getOrientation
OrthoOrientation getOrientation() const override;
Expand Down

0 comments on commit bd82dba

Please sign in to comment.