Skip to content

Commit fc57908

Browse files
committed
xrECore: new forms added
New forms: - WindowMain - WindowView - WindowSplash - WindowLog New files: ELog.h/cpp UI_MainCommand.h/cpp Token.h moved to Core folder Other minor changes
1 parent bd869e1 commit fc57908

22 files changed

+10016
-48
lines changed

src/editors/xrECore/Core/ELog.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include "pch.hpp"
2+
#include "ELog.h"
3+
#include "Props/WindowLog.h"
4+
5+
gcroot<EditorLog^> ELog;
6+
7+
using namespace XRay::ECore::Props;
8+
9+
XRECORE_API void ELogCallback(void* context, pcstr message)
10+
{
11+
if (0 == message[0])
12+
return;
13+
bool isDialog = ('#' == message[0]) || ((0 != message[1]) && ('#' == message[1]));
14+
MessageType type = ('!' == message[0]) || ((0 != message[1]) && ('!' == message[1])) ? MessageType::Error : MessageType::Information;
15+
if (('!' == message[0]) || ('#' == message[0]))
16+
message++;
17+
if (('!' == message[0]) || ('#' == message[0]))
18+
message++;
19+
20+
auto windowLog = safe_cast<WindowLog^>(Form::FromHandle(IntPtr(context)));
21+
22+
if (windowLog)
23+
{
24+
if (isDialog)
25+
windowLog->AddDialogMessage(type, message);
26+
else
27+
windowLog->AddMessage(type, message);
28+
}
29+
}

src/editors/xrECore/Core/ELog.h

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#pragma once
2+
3+
enum class MessageType
4+
{
5+
Information,
6+
Warning,
7+
Error,
8+
Confirmation,
9+
Custom
10+
};
11+
12+
ref class EditorLog
13+
{
14+
public:
15+
bool in_use;
16+
17+
EditorLog() : in_use(false) {}
18+
19+
public: System::Windows::Forms::DialogResult DlgMsg(MessageType type, System::String^ message)
20+
{
21+
using namespace System::Windows::Forms;
22+
23+
in_use = true;
24+
25+
//ExecCommand(COMMAND_RENDER_FOCUS);
26+
27+
DialogResult result;
28+
29+
if (type == MessageType::Confirmation)
30+
{
31+
result = MessageBox::Show(message, "Message", MessageBoxButtons::YesNoCancel);
32+
switch (result)
33+
{
34+
case DialogResult::Yes: message->Concat(" - Yes."); break;
35+
case DialogResult::No: message->Concat(" - No."); break;
36+
case DialogResult::Cancel: message->Concat(" - Cancel."); break;
37+
default: message->Concat(" - Something.");
38+
}
39+
}
40+
else
41+
result = MessageBox::Show(message, "Message", MessageBoxButtons::OK);
42+
43+
msclr::interop::marshal_context ctx;
44+
Log(ctx.marshal_as<pcstr>(message));
45+
46+
in_use = false;
47+
48+
return result;
49+
}
50+
51+
public: System::Windows::Forms::DialogResult DlgMsg(MessageType type, System::String^ message, System::Windows::Forms::MessageBoxButtons buttons)
52+
{
53+
using namespace System::Windows::Forms;
54+
55+
in_use = true;
56+
57+
//ExecCommand(COMMAND_RENDER_FOCUS);
58+
59+
DialogResult result = MessageBox::Show(message, "Message", buttons);;
60+
if (type == MessageType::Confirmation)
61+
{
62+
switch (result)
63+
{
64+
case DialogResult::Yes: message->Concat(" - Yes."); break;
65+
case DialogResult::No: message->Concat(" - No."); break;
66+
case DialogResult::Cancel: message->Concat(" - Cancel."); break;
67+
default: message->Concat(" - Something.");
68+
}
69+
}
70+
71+
msclr::interop::marshal_context ctx;
72+
Log(ctx.marshal_as<pcstr>(message));
73+
74+
in_use = false;
75+
76+
return result;
77+
}
78+
};
79+
80+
void XRECORE_API ELogCallback(void* context, pcstr message);
81+
82+
extern XRECORE_API gcroot<EditorLog^> ELog;
File renamed without changes.

0 commit comments

Comments
 (0)