Skip to content

Commit

Permalink
SurfaceInspector uses SelectionSystem's signal now
Browse files Browse the repository at this point in the history
instead of implementing its Observer interface
  • Loading branch information
codereader committed Jul 1, 2017
1 parent 90aef32 commit 711b9ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
18 changes: 10 additions & 8 deletions radiant/ui/surfaceinspector/SurfaceInspector.cpp
Expand Up @@ -630,12 +630,6 @@ void SurfaceInspector::postRedo()
doUpdate();
}

// Gets notified upon selection change
void SurfaceInspector::selectionChanged(const scene::INodePtr& node, bool isComponent)
{
doUpdate();
}

void SurfaceInspector::fitTexture()
{
double repeatX = _fitTexture.width->GetValue();
Expand Down Expand Up @@ -703,8 +697,16 @@ void SurfaceInspector::_preShow()
{
TransientWindow::_preShow();

// Disconnect everything, in some cases we get two consecutive Show() calls in wxGTK
_selectionChanged.disconnect();
_brushFaceShaderChanged.disconnect();
_faceTexDefChanged.disconnect();
_patchTextureChanged.disconnect();

// Register self to the SelSystem to get notified upon selection changes.
GlobalSelectionSystem().addObserver(this);
_selectionChanged = GlobalSelectionSystem().signal_selectionChanged().connect(
[this] (const ISelectable&) { doUpdate(); });

GlobalUndoSystem().addObserver(this);

// Get notified about face shader changes
Expand Down Expand Up @@ -732,12 +734,12 @@ void SurfaceInspector::_preHide()
{
TransientWindow::_preHide();

_selectionChanged.disconnect();
_patchTextureChanged.disconnect();
_faceTexDefChanged.disconnect();
_brushFaceShaderChanged.disconnect();

GlobalUndoSystem().removeObserver(this);
GlobalSelectionSystem().removeObserver(this);
}

} // namespace ui
9 changes: 1 addition & 8 deletions radiant/ui/surfaceinspector/SurfaceInspector.h
Expand Up @@ -2,7 +2,6 @@

#include <map>
#include "icommandsystem.h"
#include "iselection.h"
#include "iregistry.h"
#include "iundo.h"
#include "iradiant.h"
Expand Down Expand Up @@ -32,7 +31,6 @@ typedef std::shared_ptr<SurfaceInspector> SurfaceInspectorPtr;
/// Inspector for properties of a surface and its applied texture
class SurfaceInspector :
public wxutil::TransientWindow,
public SelectionSystem::Observer,
public UndoSystem::Observer
{
struct ManipulatorRow
Expand Down Expand Up @@ -94,6 +92,7 @@ class SurfaceInspector :
sigc::connection _brushFaceShaderChanged;
sigc::connection _faceTexDefChanged;
sigc::connection _patchTextureChanged;
sigc::connection _selectionChanged;

public:

Expand All @@ -110,12 +109,6 @@ class SurfaceInspector :
*/
void keyChanged();

/** greebo: SelectionSystem::Observer implementation. Gets called by
* the SelectionSystem upon selection change to allow updating of the
* texture properties.
*/
void selectionChanged(const scene::INodePtr& node, bool isComponent);

// Command target to toggle the dialog
static void toggle(const cmd::ArgumentList& args);

Expand Down

0 comments on commit 711b9ce

Please sign in to comment.