Skip to content

Commit

Permalink
#6131: XYWnds need to register/deregister themselves on construction/…
Browse files Browse the repository at this point in the history
…destruction

Refactor the whole active XY view handling code.
Fix Linux compilation.
  • Loading branch information
codereader committed Oct 26, 2022
1 parent 7f46937 commit 1884104
Show file tree
Hide file tree
Showing 9 changed files with 177 additions and 259 deletions.
7 changes: 2 additions & 5 deletions include/iorthoview.h
Expand Up @@ -7,7 +7,7 @@ template<typename Element>
class BasicVector3;
typedef BasicVector3<double> Vector3;

const char* const RKEY_HIGHER_ENTITY_PRIORITY = "user/ui/xyview/higherEntitySelectionPriority";
constexpr const char* const RKEY_HIGHER_ENTITY_PRIORITY = "user/ui/xyview/higherEntitySelectionPriority";

// Possible types of the orthogonal view window
enum EViewType
Expand Down Expand Up @@ -77,9 +77,6 @@ class IXWndManager :
// to redraw immediately instead of queueing the draw.
virtual void updateAllViews(bool force = false) = 0;

// Free all allocated views
virtual void destroyViews() = 0;

// Sets the origin of all available views
virtual void setOrigin(const Vector3& origin) = 0;

Expand Down Expand Up @@ -113,7 +110,7 @@ class IXWndManager :

} // namespace

const char* const MODULE_ORTHOVIEWMANAGER = "OrthoviewManager";
constexpr const char* const MODULE_ORTHOVIEWMANAGER = "OrthoviewManager";

// This is the accessor for the xy window manager module
inline ui::IXWndManager& GlobalXYWndManager()
Expand Down
7 changes: 2 additions & 5 deletions radiant/ui/mainframe/AuiLayout.cpp
Expand Up @@ -152,7 +152,7 @@ void AuiLayout::convertFloatingPaneToPropertyTab(AuiFloatingFrame* floatingWindo
}
}

void AuiLayout::handlePaneClosed(const wxAuiPaneInfo& pane)
void AuiLayout::handlePaneClosed(wxAuiPaneInfo& pane)
{
// Store the position of this pane before closing
savePaneLocation(pane);
Expand Down Expand Up @@ -272,9 +272,6 @@ void AuiLayout::activate()

void AuiLayout::deactivate()
{
// Delete all active views
GlobalXYWndManager().destroyViews();

// Get a reference to the managed window, it might be cleared by UnInit()
auto managedWindow = _auiMgr.GetManagedWindow();

Expand Down Expand Up @@ -507,7 +504,7 @@ void AuiLayout::toggleControl(const std::string& controlName)
}
}

void AuiLayout::savePaneLocation(const wxAuiPaneInfo& pane)
void AuiLayout::savePaneLocation(wxAuiPaneInfo& pane)
{
if (pane.IsFloating())
{
Expand Down
4 changes: 2 additions & 2 deletions radiant/ui/mainframe/AuiLayout.h
Expand Up @@ -70,9 +70,9 @@ class AuiLayout
const std::function<void(wxAuiPaneInfo&)>& setupPane);

void onPaneClose(wxAuiManagerEvent& ev);
void handlePaneClosed(const wxAuiPaneInfo& paneInfo);
void handlePaneClosed(wxAuiPaneInfo& paneInfo);

void savePaneLocation(const wxAuiPaneInfo& paneInfo);
void savePaneLocation(wxAuiPaneInfo& paneInfo);
void restorePaneLocation(wxAuiPaneInfo& paneInfo);

bool paneNameExists(const std::string& name) const;
Expand Down
3 changes: 3 additions & 0 deletions radiant/ui/mainframe/PropertyNotebook.cpp
Expand Up @@ -42,6 +42,9 @@ PropertyNotebook::PropertyNotebook(wxWindow* parent, AuiLayout& owner) :
);
}

PropertyNotebook::~PropertyNotebook()
{}

void PropertyNotebook::addControl(const std::string& controlName)
{
if (controlExists(controlName))
Expand Down
1 change: 1 addition & 0 deletions radiant/ui/mainframe/PropertyNotebook.h
Expand Up @@ -40,6 +40,7 @@ class PropertyNotebook :

public:
PropertyNotebook(wxWindow* parent, AuiLayout& owner);
~PropertyNotebook() override;

void addControl(const std::string& controlName);
void focusControl(const std::string& controlName);
Expand Down

0 comments on commit 1884104

Please sign in to comment.