Skip to content

Commit

Permalink
Move exit method to mainframe for the moment being
Browse files Browse the repository at this point in the history
Cleanup and dpendency update
  • Loading branch information
codereader committed Jan 6, 2017
1 parent e6bbc35 commit 3e26e1d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 30 deletions.
26 changes: 3 additions & 23 deletions radiant/RadiantModule.cpp
Expand Up @@ -4,28 +4,22 @@
#include <iostream>
#include <ctime>

#include "ifiletypes.h"
#include "iregistry.h"
#include "icommandsystem.h"
#include "itextstream.h"
#include "iuimanager.h"
#include "ieclass.h"
#include "ipreferencesystem.h"
#include "ieventmanager.h"
#include "iclipper.h"
#include "i18n.h"
#include "imainframe.h"

#include "scene/Node.h"

#include "ui/texturebrowser/TextureBrowser.h"
#include "ui/mainframe/ScreenUpdateBlocker.h"
#include "ui/mru/MRU.h"
#include "map/Map.h"
#include "brush/csg/CSG.h"

#include "modulesystem/StaticModule.h"
#include "selection/algorithm/General.h"
#include "brush/csg/CSG.h"

#include "ui/modelselector/ModelSelector.h"
#include "EventRateLimiter.h"
Expand Down Expand Up @@ -162,37 +156,30 @@ const StringSet& RadiantModule::getDependencies() const
{
_dependencies.insert(MODULE_COMMANDSYSTEM);
_dependencies.insert(MODULE_XMLREGISTRY);
_dependencies.insert(MODULE_PREFERENCESYSTEM);
_dependencies.insert(MODULE_EVENTMANAGER);
_dependencies.insert(MODULE_SELECTIONSYSTEM);
_dependencies.insert(MODULE_RENDERSYSTEM);
_dependencies.insert(MODULE_CLIPPER);
}

return _dependencies;
}

void RadiantModule::initialiseModule(const ApplicationContext& ctx)
{
rMessage() << "RadiantModule::initialiseModule called." << std::endl;
rMessage() << getName() << "::initialiseModule called." << std::endl;

// Reset the node id count
scene::Node::resetIds();

selection::algorithm::registerCommands();
brush::algorithm::registerCommands();

GlobalCommandSystem().addCommand("Exit", exitCmd);
GlobalEventManager().addCommand("Exit", "Exit");

// Subscribe for the post-module init event
module::GlobalModuleRegistry().signal_allModulesInitialised().connect(
sigc::mem_fun(this, &RadiantModule::postModuleInitialisation));
}

void RadiantModule::shutdownModule()
{
rMessage() << "RadiantModule::shutdownModule called." << std::endl;
rMessage() << getName() << "::shutdownModule called." << std::endl;

_radiantStarted.clear();
_radiantShutdown.clear();
Expand Down Expand Up @@ -226,13 +213,6 @@ void RadiantModule::postModuleInitialisation()
rMessage() << "Startup complete at " << ctime(&localtime) << std::endl;
}

void RadiantModule::exitCmd(const cmd::ArgumentList& args)
{
// Just tell the main application window to close, which will invoke
// appropriate event handlers.
GlobalMainFrame().getWxTopLevelWindow()->Close(false /* don't force */);
}

// Define the static Radiant module
module::StaticModule<RadiantModule> radiantCoreModule;

Expand Down
7 changes: 0 additions & 7 deletions radiant/RadiantModule.h
@@ -1,8 +1,6 @@
#pragma once

#include "iradiant.h"
#include "icommandsystem.h"

#include <memory>

namespace radiant
Expand Down Expand Up @@ -46,11 +44,6 @@ class RadiantModule :

// Stuff to be done after the modules have been loaded
void postModuleInitialisation();

void registerUICommands();

// Target method bound to the "Exit" command
static void exitCmd(const cmd::ArgumentList& args);
};
typedef std::shared_ptr<RadiantModule> RadiantModulePtr;

Expand Down
2 changes: 2 additions & 0 deletions radiant/camera/GlobalCamera.cpp
Expand Up @@ -3,6 +3,7 @@
#include "imousetoolmanager.h"
#include "ieventmanager.h"
#include "iselection.h"
#include "iuimanager.h"
#include "itextstream.h"
#include "xmlutil/Node.h"

Expand Down Expand Up @@ -574,6 +575,7 @@ const StringSet& GlobalCameraManager::getDependencies() const
_dependencies.insert(MODULE_RENDERSYSTEM);
_dependencies.insert(MODULE_COMMANDSYSTEM);
_dependencies.insert(MODULE_MOUSETOOLMANAGER);
_dependencies.insert(MODULE_UIMANAGER);
}

return _dependencies;
Expand Down
12 changes: 12 additions & 0 deletions radiant/ui/mainframe/MainFrame.cpp
Expand Up @@ -107,6 +107,8 @@ void MainFrame::initialiseModule(const ApplicationContext& ctx)
);
GlobalEventManager().addCommand("ToggleFullScreenCamera", "ToggleFullScreenCamera");



#ifdef WIN32
HMODULE lib = LoadLibrary(L"dwmapi.dll");

Expand Down Expand Up @@ -143,6 +145,16 @@ void MainFrame::shutdownModule()
disableScreenUpdates();
}

void MainFrame::exitCmd(const cmd::ArgumentList& args)
{
// Just tell the main application window to close, which will invoke
// appropriate event handlers.
if (getWxTopLevelWindow() != nullptr)
{
getWxTopLevelWindow()->Close(false /* don't force */);
}
}

void MainFrame::keyChanged()
{
#ifdef WIN32
Expand Down
2 changes: 2 additions & 0 deletions radiant/ui/mainframe/MainFrame.h
Expand Up @@ -66,6 +66,8 @@ class MainFrame :
private:
void create();

void exitCmd(const cmd::ArgumentList& args);

void removeLayout();

// Save/Restore the window position as saved to the registry
Expand Down

0 comments on commit 3e26e1d

Please sign in to comment.