| 1 |
#include "imodule.h" |
| 2 |
|
| 3 |
#include "i18n.h" |
| 4 |
#include "itextstream.h" |
| 5 |
#include "ieclass.h" |
| 6 |
#include "iscenegraph.h" |
| 7 |
#include "ui/imenumanager.h" |
| 8 |
#include "iregistry.h" |
| 9 |
#include "iselection.h" |
| 10 |
#include "iradiant.h" |
| 11 |
#include "iundo.h" |
| 12 |
|
| 13 |
#include "ClassNameStore.h" |
| 14 |
#include "DifficultyDialog.h" |
| 15 |
|
| 16 |
/** |
| 17 |
* Module to register the menu commands for the Difficulty Editor class. |
| 18 |
*/ |
| 19 |
class DifficultyEditorModule : |
| 20 |
public RegisterableModule |
| 21 |
{ |
| 22 |
public: |
| 23 |
// RegisterableModule implementation |
| 24 |
const std::string& getName() const |
| 25 |
{ |
| 26 |
static std::string _name("DifficultyEditor"); |
| 27 |
return _name; |
| 28 |
} |
| 29 |
|
| 30 |
const StringSet& getDependencies() const |
| 31 |
{ |
| 32 |
static StringSet _dependencies |
| 33 |
{ |
| 34 |
MODULE_MENUMANAGER, |
| 35 |
MODULE_COMMANDSYSTEM |
| 36 |
}; |
| 37 |
|
| 38 |
return _dependencies; |
| 39 |
} |
| 40 |
|
| 41 |
void initialiseModule(const IApplicationContext& ctx) |
| 42 |
{ |
| 43 |
// Add the callback event |
| 44 |
GlobalCommandSystem().addCommand("DifficultyEditor", ui::DifficultyDialog::ShowDialog); |
| 45 |
|
| 46 |
// Add the menu item |
| 47 |
GlobalMenuManager().add("main/map", // menu location path |
| 48 |
"DifficultyEditor", // name |
| 49 |
ui::menu::ItemType::Item, // type |
| 50 |
_("Difficulty..."), // caption |
| 51 |
"stimresponse.png", // icon |
| 52 |
"DifficultyEditor"); // event name |
| 53 |
} |
| 54 |
|
| 55 |
void shutdownModule() |
| 56 |
{ |
| 57 |
ui::ClassNameStore::destroy(); |
| 58 |
} |
| 59 |
}; |
| 60 |
typedef std::shared_ptr<DifficultyEditorModule> DifficultyEditorModulePtr; |
| 61 |
|
| 62 |
extern "C" void DARKRADIANT_DLLEXPORT RegisterModule(IModuleRegistry& registry) |
| 63 |
{ |
| 64 |
module::performDefaultInitialisation(registry); |
| 65 |
|
| 66 |
registry.registerModule(DifficultyEditorModulePtr(new DifficultyEditorModule)); |
| 67 |
} |