Skip to content

Commit

Permalink
Move LayerControlDialog initialisation to UserInterfaceModule
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jan 2, 2017
1 parent d43cd6d commit b620239
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 0 additions & 2 deletions radiant/RadiantModule.cpp
Expand Up @@ -252,8 +252,6 @@ void RadiantModule::postModuleInitialisation()
// Initialise the shaderclipboard
GlobalShaderClipboard().clear();

ui::LayerControlDialog::init();

// Broadcast the startup event
broadcastStartupEvent();

Expand Down
12 changes: 9 additions & 3 deletions radiant/ui/UserInterfaceModule.cpp
Expand Up @@ -60,19 +60,25 @@ void UserInterfaceModule::initialiseModule(const ApplicationContext& ctx)

// Add the orthocontext menu's layer actions
GlobalOrthoContextMenu().addItem(
std::make_shared<LayerOrthoContextMenuItem>(_(ADD_TO_LAYER_TEXT), LayerOrthoContextMenuItem::AddToLayer),
std::make_shared<LayerOrthoContextMenuItem>(_(ADD_TO_LAYER_TEXT),
LayerOrthoContextMenuItem::AddToLayer),
IOrthoContextMenu::SECTION_LAYER
);

GlobalOrthoContextMenu().addItem(
std::make_shared<LayerOrthoContextMenuItem>(_(MOVE_TO_LAYER_TEXT), LayerOrthoContextMenuItem::MoveToLayer),
std::make_shared<LayerOrthoContextMenuItem>(_(MOVE_TO_LAYER_TEXT),
LayerOrthoContextMenuItem::MoveToLayer),
IOrthoContextMenu::SECTION_LAYER
);

GlobalOrthoContextMenu().addItem(
std::make_shared<LayerOrthoContextMenuItem>(_(REMOVE_FROM_LAYER_TEXT), LayerOrthoContextMenuItem::RemoveFromLayer),
std::make_shared<LayerOrthoContextMenuItem>(_(REMOVE_FROM_LAYER_TEXT),
LayerOrthoContextMenuItem::RemoveFromLayer),
IOrthoContextMenu::SECTION_LAYER
);

GlobalRadiant().signal_radiantStarted().connect(
sigc::ptr_fun(LayerControlDialog::onRadiantStartup));
}

void UserInterfaceModule::shutdownModule()
Expand Down
4 changes: 2 additions & 2 deletions radiant/ui/layers/LayerControlDialog.cpp
Expand Up @@ -201,7 +201,7 @@ void LayerControlDialog::toggle(const cmd::ArgumentList& args)
Instance().ToggleVisibility();
}

void LayerControlDialog::init()
void LayerControlDialog::onRadiantStartup()
{
// Lookup the stored window information in the registry
if (GlobalRegistry().getAttribute(RKEY_WINDOW_STATE, "visible") == "1")
Expand Down Expand Up @@ -241,7 +241,7 @@ LayerControlDialog& LayerControlDialog::Instance()
{
LayerControlDialogPtr& instancePtr = InstancePtr();

if (instancePtr == NULL)
if (!instancePtr)
{
// Not yet instantiated, do it now
instancePtr.reset(new LayerControlDialog);
Expand Down
4 changes: 2 additions & 2 deletions radiant/ui/layers/LayerControlDialog.h
Expand Up @@ -53,8 +53,8 @@ class LayerControlDialog :
// Command target (registered in the event manager)
static void toggle(const cmd::ArgumentList& args);

// Called during mainframe construction
static void init();
// Checks if dialog should be shown after startup
static void onRadiantStartup();

static LayerControlDialog& Instance();

Expand Down

0 comments on commit b620239

Please sign in to comment.