diff --git a/install/ui/aboutdialog.fbp b/install/ui/aboutdialog.fbp index b593a7773d..66cb96393e 100644 --- a/install/ui/aboutdialog.fbp +++ b/install/ui/aboutdialog.fbp @@ -1,9 +1,9 @@ - + - C++ + XRC 1 source_name 0 @@ -11,9 +11,10 @@ res UTF-8 connect - + aboutdialog 1000 none + 0 MyProject1 @@ -48,36 +49,6 @@ wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bSizer1 @@ -148,29 +119,6 @@ - - - - - - - - - - - - - - - - - - - - - - - @@ -215,6 +163,7 @@ 0 wxID_ANY DarkRadiant x.y.z + 0 0 @@ -240,29 +189,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -298,6 +224,7 @@ 0 wxID_ANY Build date: 2014-08-04 + 0 0 @@ -323,29 +250,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -381,6 +285,7 @@ 0 wxID_ANY https://www.darkradiant.net/ This product contains software technology from id Software, Inc. ('id Technology'). id Technology 2000 id Software,Inc. DarkRadiant is originally based on the GPL version of GtkRadiant. The Dark Mod (www.thedarkmod.com) + 0 0 @@ -406,29 +311,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -477,6 +359,7 @@ 0 wxID_ANY wxWidgets Properties + 0 0 @@ -502,29 +385,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -560,6 +420,7 @@ 0 wxID_ANY Version: + 0 0 @@ -585,29 +446,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -643,6 +481,7 @@ 0 wxID_ANY OpenGL Properties + 0 0 @@ -668,29 +507,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -735,6 +551,7 @@ 0 wxID_ANY Vendor: + 0 0 @@ -760,29 +577,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -818,6 +612,7 @@ 0 wxID_ANY Version: + 0 0 @@ -843,29 +638,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -901,6 +673,7 @@ 0 wxID_ANY Renderer: + 0 0 @@ -926,29 +699,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -986,6 +736,7 @@ 0 wxID_ANY OpenGL Extensions + 0 0 @@ -1011,29 +762,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -1098,207 +826,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6 - wxBOTTOM|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - DarkRadiant Modules - - 0 - - - 0 - - 1 - AboutDialogHeader4 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 12 - wxEXPAND|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - -1,70 - 1 - AboutDialogDarkRadiantModules - 1 - - - protected - 1 - - Resizable - 1 - -1,70 - wxTE_MULTILINE|wxTE_READONLY|wxTE_WORDWRAP - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1318,25 +845,31 @@ + 1 0 1 1 + 0 0 + Dock 0 Left 1 1 + 0 0 wxID_CLOSE OK + + 0 0 @@ -1351,6 +884,8 @@ protected 1 + + Resizable 1 @@ -1365,30 +900,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/install/ui/aboutdialog.xrc b/install/ui/aboutdialog.xrc index a7f785fa06..c607b22e31 100644 --- a/install/ui/aboutdialog.xrc +++ b/install/ui/aboutdialog.xrc @@ -142,25 +142,6 @@ - - - wxBOTTOM|wxTOP - 6 - - - -1 - - - - - wxEXPAND|wxLEFT - 12 - - - -1,70 - - - @@ -170,8 +151,10 @@ 0 + 0 + - \ No newline at end of file + diff --git a/radiant/RadiantApp.cpp b/radiant/RadiantApp.cpp index 51f022618f..6d6e6416a0 100644 --- a/radiant/RadiantApp.cpp +++ b/radiant/RadiantApp.cpp @@ -7,6 +7,7 @@ #include "log/PIDFile.h" #include "modulesystem/ModuleRegistry.h" #include "module/CoreModule.h" +#include "modulesystem/StaticModule.h" #include #include @@ -149,6 +150,9 @@ void RadiantApp::onStartupEvent(wxCommandEvent& ev) ui::Splash::OnAppStartup(); #endif + // Pick up all the statically defined modules and register them + module::internal::StaticModuleList::RegisterModules(); + try { module::GlobalModuleRegistry().loadAndInitialiseModules(); diff --git a/radiant/RadiantModule.cpp b/radiant/RadiantModule.cpp index ced2489ffb..d252624565 100644 --- a/radiant/RadiantModule.cpp +++ b/radiant/RadiantModule.cpp @@ -129,7 +129,9 @@ module::StaticModule radiantCoreModule; // Return the static Radiant module to other code within the main binary RadiantModulePtr getGlobalRadiant() { - return radiantCoreModule.getModule(); + return std::static_pointer_cast( + module::GlobalModuleRegistry().getModule(MODULE_RADIANT) + ); } } // namespace radiant diff --git a/radiant/brush/BrushModule.cpp b/radiant/brush/BrushModule.cpp index 15b383115d..c855ac5a66 100644 --- a/radiant/brush/BrushModule.cpp +++ b/radiant/brush/BrushModule.cpp @@ -157,5 +157,7 @@ module::StaticModule staticBrushModule; // greebo: The accessor function for the brush module containing the static instance BrushModuleImpl& GlobalBrush() { - return *staticBrushModule.getModule().get(); + return *std::static_pointer_cast( + module::GlobalModuleRegistry().getModule(MODULE_BRUSHCREATOR) + ); } diff --git a/radiant/camera/GlobalCamera.cpp b/radiant/camera/GlobalCamera.cpp index 5a2432f6c9..c17378b6a5 100644 --- a/radiant/camera/GlobalCamera.cpp +++ b/radiant/camera/GlobalCamera.cpp @@ -628,5 +628,7 @@ module::StaticModule cameraModule; // The accessor function to the GlobalCameraManager instance ui::GlobalCameraManager& GlobalCamera() { - return *ui::cameraModule.getModule(); + return *std::static_pointer_cast( + module::GlobalModuleRegistry().getModule(MODULE_CAMERA) + ); } diff --git a/radiant/map/AutoSaver.cpp b/radiant/map/AutoSaver.cpp index 9961090ec7..10f20da871 100644 --- a/radiant/map/AutoSaver.cpp +++ b/radiant/map/AutoSaver.cpp @@ -43,6 +43,7 @@ namespace const char* RKEY_AUTOSAVE_MAX_SNAPSHOT_FOLDER_SIZE = "user/ui/map/maxSnapshotFolderSize"; const char* RKEY_AUTOSAVE_SNAPSHOT_FOLDER_SIZE_HISTORY = "user/ui/map/snapshotFolderSizeHistory"; const char* GKEY_MAP_EXTENSION = "/mapFormat/fileExtension"; + const char* const MODULE_AUTOSAVER = "AutomaticMapSaver"; std::string constructSnapshotName(const fs::path& snapshotPath, const std::string& mapName, int num) { @@ -364,7 +365,7 @@ void AutoMapSaver::onMapEvent(IMap::MapEvent ev) const std::string& AutoMapSaver::getName() const { - static std::string _name("AutomaticMapSaver"); + static std::string _name(MODULE_AUTOSAVER); return _name; } @@ -434,7 +435,8 @@ module::StaticModule staticAutoSaverModule; AutoMapSaver& AutoSaver() { - return *staticAutoSaverModule.getModule(); + return *std::static_pointer_cast( + module::GlobalModuleRegistry().getModule(MODULE_AUTOSAVER)); } } // namespace map diff --git a/radiant/map/EditingStopwatch.cpp b/radiant/map/EditingStopwatch.cpp index a3cbb2377a..da217dcd3c 100644 --- a/radiant/map/EditingStopwatch.cpp +++ b/radiant/map/EditingStopwatch.cpp @@ -24,6 +24,7 @@ namespace const int TIMER_INTERVAL_SECS = 1; const char* const STATUS_BAR_ELEMENT = "EditTime"; const char* const MAP_PROPERTY_KEY = "EditTimeInSeconds"; + const char* const MODULE_EDITING_STOPWATCH = "EditingStopwatch"; } EditingStopwatch::EditingStopwatch() : @@ -32,7 +33,7 @@ EditingStopwatch::EditingStopwatch() : const std::string& EditingStopwatch::getName() const { - static std::string _name("EditingStopwatch"); + static std::string _name(MODULE_EDITING_STOPWATCH); return _name; } @@ -207,7 +208,8 @@ module::StaticModule _stopwatchModule; EditingStopwatch& EditingStopwatch::GetInstanceInternal() { - return *_stopwatchModule.getModule(); + return *std::static_pointer_cast( + module::GlobalModuleRegistry().getModule(MODULE_EDITING_STOPWATCH)); } } diff --git a/radiant/map/MapModules.cpp b/radiant/map/MapModules.cpp index 0682f92f88..30f8ef721f 100644 --- a/radiant/map/MapModules.cpp +++ b/radiant/map/MapModules.cpp @@ -23,5 +23,6 @@ module::StaticModule staticMapModule; // Accessor method containing the singleton Map instance map::Map& GlobalMap() { - return *staticMapModule.getModule(); + return *std::static_pointer_cast( + module::GlobalModuleRegistry().getModule(MODULE_MAP)); } diff --git a/radiant/map/RegionManager.cpp b/radiant/map/RegionManager.cpp index d2e9da9f15..605a53c0bd 100644 --- a/radiant/map/RegionManager.cpp +++ b/radiant/map/RegionManager.cpp @@ -41,6 +41,7 @@ namespace map { typedef std::shared_ptr RegionManagerPtr; const std::string GKEY_PLAYER_START_ECLASS = "/mapFormat/playerStartPoint"; + const char* const MODULE_REGION_MANAGER = "RegionManager"; } RegionManager::RegionManager() : @@ -393,7 +394,7 @@ void RegionManager::initialiseCommands() const std::string& RegionManager::getName() const { - static std::string _name("RegionManager"); + static std::string _name(MODULE_REGION_MANAGER); return _name; } @@ -465,5 +466,6 @@ module::StaticModule staticRegionManagerModule; map::RegionManager& GlobalRegion() { - return *map::staticRegionManagerModule.getModule(); + return *std::static_pointer_cast( + module::GlobalModuleRegistry().getModule(map::MODULE_REGION_MANAGER)); } diff --git a/radiant/modulesystem/ModuleRegistry.cpp b/radiant/modulesystem/ModuleRegistry.cpp index cf010ecc72..454f033eec 100644 --- a/radiant/modulesystem/ModuleRegistry.cpp +++ b/radiant/modulesystem/ModuleRegistry.cpp @@ -5,7 +5,6 @@ #include #include #include "ApplicationContextImpl.h" -#include "StaticModule.h" #include #include @@ -148,15 +147,6 @@ void ModuleRegistry::loadAndInitialiseModules() _sigModuleInitialisationProgress.emit(_("Searching for Modules"), 0.0f); - // Pick up all the statically registered modules - internal::StaticModuleList::ForEachModule([this](const RegisterableModulePtr& module) - { - registerModule(module); - }); - - // Be sure the list is cleared after registration - internal::StaticModuleList::Clear(); - rMessage() << "ModuleRegistry Compatibility Level is " << getCompatibilityLevel() << std::endl; // Invoke the ModuleLoad routine to load the DLLs from modules/ and plugins/ diff --git a/radiant/modulesystem/StaticModule.cpp b/radiant/modulesystem/StaticModule.cpp index 30aecb7710..cedc2624bb 100644 --- a/radiant/modulesystem/StaticModule.cpp +++ b/radiant/modulesystem/StaticModule.cpp @@ -15,21 +15,19 @@ StaticModuleList::~StaticModuleList() assert(empty()); } -void StaticModuleList::Add(const RegisterableModulePtr& module) +void StaticModuleList::Add(const ModuleCreationFunc& creationFunc) { - Instance().push_back(module); + Instance().push_back(creationFunc); } -void StaticModuleList::ForEachModule(const std::function& func) +void StaticModuleList::RegisterModules() { - for (const auto& module : Instance()) + for (const auto& creationFunc : Instance()) { - func(module); + module::GlobalModuleRegistry().registerModule(creationFunc()); } -} -void StaticModuleList::Clear() -{ + // Be sure the list is cleared after registration Instance().clear(); } diff --git a/radiant/modulesystem/StaticModule.h b/radiant/modulesystem/StaticModule.h index 910c8fa2ab..468fd3a8e1 100644 --- a/radiant/modulesystem/StaticModule.h +++ b/radiant/modulesystem/StaticModule.h @@ -1,5 +1,6 @@ #pragma once +#include #include "imodule.h" #include "ModuleRegistry.h" @@ -31,17 +32,19 @@ namespace internal * and acquired by the ModuleRegistry, after which point * this list will be cleared. */ +typedef std::function ModuleCreationFunc; + class StaticModuleList : - private std::list + private std::list { public: - ~StaticModuleList(); - static void Add(const RegisterableModulePtr& module); + ~StaticModuleList(); - static void ForEachModule(const std::function& func); + static void Add(const ModuleCreationFunc& creationFunc); - static void Clear(); + // Creates all pre-registered modules and submits them to the registry + static void RegisterModules(); private: static StaticModuleList& Instance(); @@ -54,24 +57,14 @@ class StaticModule { static_assert(std::is_base_of::value, "ModuleType must be of type RegisterableModule"); -private: - std::string _moduleName; - public: StaticModule() { - auto module = std::make_shared(); - _moduleName = module->getName(); - - // Add this to the list in the backend, it will be picked up later - internal::StaticModuleList::Add(module); - } - - inline std::shared_ptr getModule() - { - return std::static_pointer_cast( - GlobalModuleRegistry().getModule(_moduleName) - ); + // Add a creator to the list in the backend, it will be called by the registry later + internal::StaticModuleList::Add([]()->RegisterableModulePtr + { + return std::make_shared(); + }); } }; diff --git a/radiant/settings/GameManager.cpp b/radiant/settings/GameManager.cpp index 98606eae85..06d22275c1 100644 --- a/radiant/settings/GameManager.cpp +++ b/radiant/settings/GameManager.cpp @@ -431,7 +431,8 @@ module::StaticModule gameManagerModule; Manager& Manager::Instance() { - return *gameManagerModule.getModule(); + return *std::static_pointer_cast( + module::GlobalModuleRegistry().getModule(MODULE_GAMEMANAGER)); } } // namespace game diff --git a/radiant/settings/PreferenceSystem.cpp b/radiant/settings/PreferenceSystem.cpp index 832d5cf57c..c877f02c33 100644 --- a/radiant/settings/PreferenceSystem.cpp +++ b/radiant/settings/PreferenceSystem.cpp @@ -56,5 +56,6 @@ module::StaticModule preferenceSystemModule; settings::PreferenceSystem& GetPreferenceSystem() { - return *settings::preferenceSystemModule.getModule(); + return *std::static_pointer_cast( + module::GlobalModuleRegistry().getModule(MODULE_PREFERENCESYSTEM)); } diff --git a/radiant/ui/about/AboutDialog.cpp b/radiant/ui/about/AboutDialog.cpp index c319ee7e37..fffe632c15 100644 --- a/radiant/ui/about/AboutDialog.cpp +++ b/radiant/ui/about/AboutDialog.cpp @@ -96,7 +96,6 @@ void AboutDialog::populateWindow() findNamedObject(this, "AboutDialogHeader1")->SetFont(bold); findNamedObject(this, "AboutDialogHeader2")->SetFont(bold); findNamedObject(this, "AboutDialogHeader3")->SetFont(bold); - findNamedObject(this, "AboutDialogHeader4")->SetFont(bold); } void AboutDialog::_onClose(wxCommandEvent& ev) diff --git a/radiant/ui/ortho/OrthoContextMenu.cpp b/radiant/ui/ortho/OrthoContextMenu.cpp index 2f4aca07e0..5a18550025 100644 --- a/radiant/ui/ortho/OrthoContextMenu.cpp +++ b/radiant/ui/ortho/OrthoContextMenu.cpp @@ -82,7 +82,8 @@ module::StaticModule orthoContextMenuModule; OrthoContextMenu& OrthoContextMenu::Instance() { - return *orthoContextMenuModule.getModule(); + return *std::static_pointer_cast( + module::GlobalModuleRegistry().getModule("OrthoContextMenu")); } // Constructor @@ -619,7 +620,7 @@ void OrthoContextMenu::addSectionItems(int section, bool noSpacer) const std::string& OrthoContextMenu::getName() const { - static std::string _name("OrthoContextMenu"); + static std::string _name(MODULE_ORTHOCONTEXTMENU); return _name; } diff --git a/radiant/ui/texturebrowser/TextureBrowserManager.cpp b/radiant/ui/texturebrowser/TextureBrowserManager.cpp index 91288e14e8..316c6f284e 100644 --- a/radiant/ui/texturebrowser/TextureBrowserManager.cpp +++ b/radiant/ui/texturebrowser/TextureBrowserManager.cpp @@ -111,7 +111,8 @@ module::StaticModule texBrowserManagerModule; TextureBrowserManager& TextureBrowserManager::Instance() { - return *texBrowserManagerModule.getModule(); + return *std::static_pointer_cast( + module::GlobalModuleRegistry().getModule(MODULE_TEXTURE_BROWSER_MANAGER)); } } // namespace diff --git a/radiant/xyview/GlobalXYWnd.cpp b/radiant/xyview/GlobalXYWnd.cpp index 04f72982d3..8bba0fef5c 100644 --- a/radiant/xyview/GlobalXYWnd.cpp +++ b/radiant/xyview/GlobalXYWnd.cpp @@ -707,5 +707,6 @@ module::StaticModule xyWndModule; // Accessor function returning the reference ui::XYWndManager& GlobalXYWnd() { - return *ui::xyWndModule.getModule(); + return *std::static_pointer_cast( + module::GlobalModuleRegistry().getModule(MODULE_ORTHOVIEWMANAGER)); } diff --git a/tools/msvc/DarkRadiant.vcxproj b/tools/msvc/DarkRadiant.vcxproj index f0ced8b354..3c67f2fdf2 100644 --- a/tools/msvc/DarkRadiant.vcxproj +++ b/tools/msvc/DarkRadiant.vcxproj @@ -868,8 +868,6 @@ - - @@ -1351,8 +1349,6 @@ - - diff --git a/tools/msvc/DarkRadiant.vcxproj.filters b/tools/msvc/DarkRadiant.vcxproj.filters index 636d1f3035..9c9d37617e 100644 --- a/tools/msvc/DarkRadiant.vcxproj.filters +++ b/tools/msvc/DarkRadiant.vcxproj.filters @@ -442,12 +442,6 @@ src\modulesystem - - src\modulesystem - - - src\modulesystem - src\namespace @@ -1758,12 +1752,6 @@ src\modulesystem - - src\modulesystem - - - src\modulesystem - src\modulesystem