Skip to content

Commit

Permalink
#5623: Update the UI when a map is unloaded or loaded in the middle o…
Browse files Browse the repository at this point in the history
…f a merge operation
  • Loading branch information
codereader committed May 31, 2021
1 parent 2d4c6f9 commit 904227c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions radiant/ui/merge/MergeControlDialog.cpp
Expand Up @@ -214,6 +214,7 @@ void MergeControlDialog::_preHide()
// A hidden window doesn't need to listen for events
_undoHandler.disconnect();
_redoHandler.disconnect();
_mapEventHandler.disconnect();

GlobalSelectionSystem().removeObserver(this);
}
Expand All @@ -227,6 +228,10 @@ void MergeControlDialog::_preShow()

// Register self to the SelSystem to get notified upon selection changes.
GlobalSelectionSystem().addObserver(this);

_mapEventHandler = GlobalMapModule().signal_mapEvent().connect(
sigc::mem_fun(this, &MergeControlDialog::onMapEvent)
);

_undoHandler = GlobalUndoSystem().signal_postUndo().connect(
sigc::mem_fun(this, &MergeControlDialog::queueUpdate));
Expand Down Expand Up @@ -266,4 +271,12 @@ void MergeControlDialog::onIdle(wxIdleEvent& ev)
updateControlSensitivity();
}

void MergeControlDialog::onMapEvent(IMap::MapEvent ev)
{
if (ev == IMap::MapLoaded || ev == IMap::MapUnloaded)
{
updateControlSensitivity();
}
}

}
3 changes: 3 additions & 0 deletions radiant/ui/merge/MergeControlDialog.h
@@ -1,6 +1,7 @@
#pragma once

#include "iselection.h"
#include "imap.h"
#include "icommandsystem.h"
#include <sigc++/connection.h>
#include "wxutil/window/TransientWindow.h"
Expand All @@ -19,6 +20,7 @@ class MergeControlDialog :
private:
sigc::connection _undoHandler;
sigc::connection _redoHandler;
sigc::connection _mapEventHandler;

bool _updateNeeded;

Expand Down Expand Up @@ -54,6 +56,7 @@ class MergeControlDialog :
void rescanSelection();
void queueUpdate();
void onIdle(wxIdleEvent& ev);
void onMapEvent(IMap::MapEvent ev);

std::size_t getNumSelectedMergeNodes();
std::vector<scene::INodePtr> getSelectedMergeNodes();
Expand Down

0 comments on commit 904227c

Please sign in to comment.