Skip to content

Commit 74095a5

Browse files
committed
Move entry point into XRay::Editor namespace (https://github.com/Xottab-DUTY/xray-16/issues/1)
And some additional macro usages
1 parent 7252c9a commit 74095a5

File tree

4 files changed

+33
-17
lines changed

4 files changed

+33
-17
lines changed

src/editors/xrWeatherEditor/entry_point.cpp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#pragma unmanaged
44
#include <windows.h>
5+
#include "Common/xr_impexp_macros.h"
56
#include "Include/editor/engine.hpp"
67
#include "ide_impl.hpp"
78
#pragma managed
@@ -10,10 +11,14 @@
1011

1112
#pragma comment(lib, "user32.lib")
1213

14+
namespace XRay
15+
{
16+
namespace Editor
17+
{
1318
private ref class window_ide_final : public editor::window_ide
1419
{
1520
public:
16-
window_ide_final(XRay::Editor::ide_base*& ide, XRay::Editor::engine_base* engine) : editor::window_ide(engine)
21+
window_ide_final(ide_base*& ide, engine_base* engine) : editor::window_ide(engine)
1722
{
1823
m_ide = ide;
1924
Application::Idle += gcnew System::EventHandler(this, &window_ide_final::on_idle);
@@ -44,45 +49,47 @@ private ref class window_ide_final : public editor::window_ide
4449
private:
4550
void on_idle(System::Object ^ sender, System::EventArgs ^ event_args)
4651
{
47-
XRay::Editor::ide_impl* impl = dynamic_cast<XRay::Editor::ide_impl*>(m_ide);
52+
ide_impl* impl = dynamic_cast<ide_impl*>(m_ide);
4853
impl->on_idle_start();
4954

5055
MSG message;
5156
do
5257
{
5358
m_engine->on_idle();
5459
impl->on_idle();
55-
} while (m_engine && !PeekMessage(&message, HWND(0), 0, 0, 0));
60+
} while (m_engine&&!PeekMessage(&message, HWND(0), 0, 0, 0));
5661

5762
impl->on_idle_end();
5863
}
5964
};
6065

61-
XRay::Editor::ide_impl* g_ide = nullptr;
66+
ide_impl* g_ide = nullptr;
6267

63-
static void initialize_impl(XRay::Editor::ide_base*& ide, XRay::Editor::engine_base* engine)
68+
static void initialize_impl(ide_base*& ide, engine_base* engine)
6469
{
6570
VERIFY(!g_ide);
66-
g_ide = new XRay::Editor::ide_impl(engine);
71+
g_ide = new ide_impl(engine);
6772
ide = g_ide;
6873
g_ide->window(gcnew window_ide_final(ide, engine));
6974
}
75+
} // namespace Editor
76+
} // namespace XRay
7077

7178
#pragma unmanaged
7279
#include <objbase.h>
7380
WINOLEAPI CoInitializeEx(IN LPVOID pvReserved, IN DWORD dwCoInit);
7481
#pragma comment(lib, "ole32.lib")
7582

76-
extern "C" __declspec(dllexport) void initialize(XRay::Editor::ide_base*& ide, XRay::Editor::engine_base* engine)
83+
extern "C" XR_EXPORT void initialize(XRay::Editor::ide_base*& ide, XRay::Editor::engine_base* engine)
7784
{
7885
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
79-
initialize_impl(ide, engine);
86+
XRay::Editor::initialize_impl(ide, engine);
8087
}
8188

82-
extern "C" __declspec(dllexport) void finalize(XRay::Editor::ide_base*& ide)
89+
extern "C" XR_EXPORT void finalize(XRay::Editor::ide_base*& ide)
8390
{
8491
delete (ide);
8592
ide = nullptr;
86-
g_ide = nullptr;
93+
XRay::Editor::g_ide = nullptr;
8794
}
8895
#pragma managed

src/editors/xrWeatherEditor/pch.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
// Created : 04.12.2007
44
// Modified : 04.12.2007
55
// Author : Dmitriy Iassenev
6-
// Description : preocmpiled header for editor library
6+
// Description : precompiled header for editor library
77
////////////////////////////////////////////////////////////////////////////
88

99
#ifndef PCH_HPP_INCLUDED
1010
#define PCH_HPP_INCLUDED
1111

12+
#include "xrCommon/inlining_macros.h"
13+
1214
#ifdef DEBUG
1315
#define VERIFY(expression) \
1416
do \
@@ -19,14 +21,14 @@
1921
#define NODEFAULT \
2022
do \
2123
{ \
22-
__debugbreak(); \
24+
DEBUG_BREAK; \
2325
} while (0)
2426
#else // #ifdef DEBUG
2527
#define VERIFY(expression) \
2628
do \
2729
{ \
2830
} while (0)
29-
#define NODEFAULT __assume(0)
31+
#define NODEFAULT XR_ASSUME(0)
3032
#endif // #ifdef DEBUG
3133

3234
typedef unsigned int u32;

src/editors/xrWeatherEditor/property_collection_editor.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ using System::ComponentModel::Design::CollectionEditor;
2525
typedef PropertyBag::PropertySpecDescriptor PropertySpecDescriptor;
2626

2727
#pragma unmanaged
28-
extern XRay::Editor::ide_impl* g_ide;
28+
namespace XRay
29+
{
30+
namespace Editor
31+
{
32+
extern ide_impl* g_ide;
33+
}
34+
}
2935
#pragma managed
3036

3137
property_collection_editor::property_collection_editor(Type ^ type) : inherited(type) {}
@@ -58,7 +64,7 @@ String ^ property_collection_editor::GetDisplayText(Object ^ value)
5864
return (to_string(buffer));
5965
}
6066

61-
void property_collection_editor::on_move(Object ^ sender, EventArgs ^ e) { g_ide->window()->view().Invalidate(); }
67+
void property_collection_editor::on_move(Object ^ sender, EventArgs ^ e) { XRay::Editor::g_ide->window()->view().Invalidate(); }
6268
property_collection_editor::CollectionForm ^ property_collection_editor::CreateCollectionForm()
6369
{
6470
//VERIFY(!m_collection_form);

src/editors/xrWeatherEditor/property_container.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ namespace XRay
2222
namespace Editor
2323
{
2424
class ide_impl;
25+
extern ide_impl* g_ide;
2526
}
2627
}
27-
extern XRay::Editor::ide_impl* g_ide;
28+
2829
#pragma managed
2930

3031
property_container::property_container(property_holder* holder, property_container_holder ^ container_holder)
@@ -41,7 +42,7 @@ property_container::!property_container()
4142
if (!m_holder)
4243
return;
4344

44-
if (!g_ide)
45+
if (!XRay::Editor::g_ide)
4546
return;
4647

4748
property_holder* holder = dynamic_cast<property_holder*>(m_holder);

0 commit comments

Comments
 (0)