From 74095a58f96f00cff7bbb901333b46360f17b8e4 Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Wed, 6 Sep 2017 23:52:18 +0500 Subject: [PATCH] Move entry point into XRay::Editor namespace (https://github.com/Xottab-DUTY/xray-16/issues/1) And some additional macro usages --- src/editors/xrWeatherEditor/entry_point.cpp | 27 ++++++++++++------- src/editors/xrWeatherEditor/pch.hpp | 8 +++--- .../property_collection_editor.cpp | 10 +++++-- .../xrWeatherEditor/property_container.cpp | 5 ++-- 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/editors/xrWeatherEditor/entry_point.cpp b/src/editors/xrWeatherEditor/entry_point.cpp index 0a88d771b8a..1ca7d116929 100644 --- a/src/editors/xrWeatherEditor/entry_point.cpp +++ b/src/editors/xrWeatherEditor/entry_point.cpp @@ -2,6 +2,7 @@ #pragma unmanaged #include +#include "Common/xr_impexp_macros.h" #include "Include/editor/engine.hpp" #include "ide_impl.hpp" #pragma managed @@ -10,10 +11,14 @@ #pragma comment(lib, "user32.lib") +namespace XRay +{ +namespace Editor +{ private ref class window_ide_final : public editor::window_ide { public: - window_ide_final(XRay::Editor::ide_base*& ide, XRay::Editor::engine_base* engine) : editor::window_ide(engine) + window_ide_final(ide_base*& ide, engine_base* engine) : editor::window_ide(engine) { m_ide = ide; Application::Idle += gcnew System::EventHandler(this, &window_ide_final::on_idle); @@ -44,7 +49,7 @@ private ref class window_ide_final : public editor::window_ide private: void on_idle(System::Object ^ sender, System::EventArgs ^ event_args) { - XRay::Editor::ide_impl* impl = dynamic_cast(m_ide); + ide_impl* impl = dynamic_cast(m_ide); impl->on_idle_start(); MSG message; @@ -52,37 +57,39 @@ private ref class window_ide_final : public editor::window_ide { m_engine->on_idle(); impl->on_idle(); - } while (m_engine && !PeekMessage(&message, HWND(0), 0, 0, 0)); + } while (m_engine&&!PeekMessage(&message, HWND(0), 0, 0, 0)); impl->on_idle_end(); } }; -XRay::Editor::ide_impl* g_ide = nullptr; +ide_impl* g_ide = nullptr; -static void initialize_impl(XRay::Editor::ide_base*& ide, XRay::Editor::engine_base* engine) +static void initialize_impl(ide_base*& ide, engine_base* engine) { VERIFY(!g_ide); - g_ide = new XRay::Editor::ide_impl(engine); + g_ide = new ide_impl(engine); ide = g_ide; g_ide->window(gcnew window_ide_final(ide, engine)); } +} // namespace Editor +} // namespace XRay #pragma unmanaged #include WINOLEAPI CoInitializeEx(IN LPVOID pvReserved, IN DWORD dwCoInit); #pragma comment(lib, "ole32.lib") -extern "C" __declspec(dllexport) void initialize(XRay::Editor::ide_base*& ide, XRay::Editor::engine_base* engine) +extern "C" XR_EXPORT void initialize(XRay::Editor::ide_base*& ide, XRay::Editor::engine_base* engine) { CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); - initialize_impl(ide, engine); + XRay::Editor::initialize_impl(ide, engine); } -extern "C" __declspec(dllexport) void finalize(XRay::Editor::ide_base*& ide) +extern "C" XR_EXPORT void finalize(XRay::Editor::ide_base*& ide) { delete (ide); ide = nullptr; - g_ide = nullptr; + XRay::Editor::g_ide = nullptr; } #pragma managed diff --git a/src/editors/xrWeatherEditor/pch.hpp b/src/editors/xrWeatherEditor/pch.hpp index ca9788ff789..2400f6d6d42 100644 --- a/src/editors/xrWeatherEditor/pch.hpp +++ b/src/editors/xrWeatherEditor/pch.hpp @@ -3,12 +3,14 @@ // Created : 04.12.2007 // Modified : 04.12.2007 // Author : Dmitriy Iassenev -// Description : preocmpiled header for editor library +// Description : precompiled header for editor library //////////////////////////////////////////////////////////////////////////// #ifndef PCH_HPP_INCLUDED #define PCH_HPP_INCLUDED +#include "xrCommon/inlining_macros.h" + #ifdef DEBUG #define VERIFY(expression) \ do \ @@ -19,14 +21,14 @@ #define NODEFAULT \ do \ { \ - __debugbreak(); \ + DEBUG_BREAK; \ } while (0) #else // #ifdef DEBUG #define VERIFY(expression) \ do \ { \ } while (0) -#define NODEFAULT __assume(0) +#define NODEFAULT XR_ASSUME(0) #endif // #ifdef DEBUG typedef unsigned int u32; diff --git a/src/editors/xrWeatherEditor/property_collection_editor.cpp b/src/editors/xrWeatherEditor/property_collection_editor.cpp index 17b2facec57..441cede5504 100644 --- a/src/editors/xrWeatherEditor/property_collection_editor.cpp +++ b/src/editors/xrWeatherEditor/property_collection_editor.cpp @@ -25,7 +25,13 @@ using System::ComponentModel::Design::CollectionEditor; typedef PropertyBag::PropertySpecDescriptor PropertySpecDescriptor; #pragma unmanaged -extern XRay::Editor::ide_impl* g_ide; +namespace XRay +{ +namespace Editor +{ +extern ide_impl* g_ide; +} +} #pragma managed property_collection_editor::property_collection_editor(Type ^ type) : inherited(type) {} @@ -58,7 +64,7 @@ String ^ property_collection_editor::GetDisplayText(Object ^ value) return (to_string(buffer)); } -void property_collection_editor::on_move(Object ^ sender, EventArgs ^ e) { g_ide->window()->view().Invalidate(); } +void property_collection_editor::on_move(Object ^ sender, EventArgs ^ e) { XRay::Editor::g_ide->window()->view().Invalidate(); } property_collection_editor::CollectionForm ^ property_collection_editor::CreateCollectionForm() { //VERIFY(!m_collection_form); diff --git a/src/editors/xrWeatherEditor/property_container.cpp b/src/editors/xrWeatherEditor/property_container.cpp index 9f18901d9c5..25790cd61f6 100644 --- a/src/editors/xrWeatherEditor/property_container.cpp +++ b/src/editors/xrWeatherEditor/property_container.cpp @@ -22,9 +22,10 @@ namespace XRay namespace Editor { class ide_impl; +extern ide_impl* g_ide; } } -extern XRay::Editor::ide_impl* g_ide; + #pragma managed property_container::property_container(property_holder* holder, property_container_holder ^ container_holder) @@ -41,7 +42,7 @@ property_container::!property_container() if (!m_holder) return; - if (!g_ide) + if (!XRay::Editor::g_ide) return; property_holder* holder = dynamic_cast(m_holder);