Skip to content

Commit

Permalink
xrECore: new forms added
Browse files Browse the repository at this point in the history
New forms:
- WindowMain
- WindowView
- WindowSplash
- WindowLog

New files:
ELog.h/cpp
UI_MainCommand.h/cpp

Token.h moved to Core folder

Other minor changes
  • Loading branch information
Xottab-DUTY committed Mar 23, 2018
1 parent bd869e1 commit fc57908
Show file tree
Hide file tree
Showing 22 changed files with 10,016 additions and 48 deletions.
29 changes: 29 additions & 0 deletions src/editors/xrECore/Core/ELog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "pch.hpp"
#include "ELog.h"
#include "Props/WindowLog.h"

gcroot<EditorLog^> ELog;

using namespace XRay::ECore::Props;

XRECORE_API void ELogCallback(void* context, pcstr message)
{
if (0 == message[0])
return;
bool isDialog = ('#' == message[0]) || ((0 != message[1]) && ('#' == message[1]));
MessageType type = ('!' == message[0]) || ((0 != message[1]) && ('!' == message[1])) ? MessageType::Error : MessageType::Information;
if (('!' == message[0]) || ('#' == message[0]))
message++;
if (('!' == message[0]) || ('#' == message[0]))
message++;

auto windowLog = safe_cast<WindowLog^>(Form::FromHandle(IntPtr(context)));

if (windowLog)
{
if (isDialog)
windowLog->AddDialogMessage(type, message);
else
windowLog->AddMessage(type, message);
}
}
82 changes: 82 additions & 0 deletions src/editors/xrECore/Core/ELog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#pragma once

enum class MessageType
{
Information,
Warning,
Error,
Confirmation,
Custom
};

ref class EditorLog
{
public:
bool in_use;

EditorLog() : in_use(false) {}

public: System::Windows::Forms::DialogResult DlgMsg(MessageType type, System::String^ message)
{
using namespace System::Windows::Forms;

in_use = true;

//ExecCommand(COMMAND_RENDER_FOCUS);

DialogResult result;

if (type == MessageType::Confirmation)
{
result = MessageBox::Show(message, "Message", MessageBoxButtons::YesNoCancel);
switch (result)
{
case DialogResult::Yes: message->Concat(" - Yes."); break;
case DialogResult::No: message->Concat(" - No."); break;
case DialogResult::Cancel: message->Concat(" - Cancel."); break;
default: message->Concat(" - Something.");
}
}
else
result = MessageBox::Show(message, "Message", MessageBoxButtons::OK);

msclr::interop::marshal_context ctx;
Log(ctx.marshal_as<pcstr>(message));

in_use = false;

return result;
}

public: System::Windows::Forms::DialogResult DlgMsg(MessageType type, System::String^ message, System::Windows::Forms::MessageBoxButtons buttons)
{
using namespace System::Windows::Forms;

in_use = true;

//ExecCommand(COMMAND_RENDER_FOCUS);

DialogResult result = MessageBox::Show(message, "Message", buttons);;
if (type == MessageType::Confirmation)
{
switch (result)
{
case DialogResult::Yes: message->Concat(" - Yes."); break;
case DialogResult::No: message->Concat(" - No."); break;
case DialogResult::Cancel: message->Concat(" - Cancel."); break;
default: message->Concat(" - Something.");
}
}

msclr::interop::marshal_context ctx;
Log(ctx.marshal_as<pcstr>(message));

in_use = false;

return result;
}
};

void XRECORE_API ELogCallback(void* context, pcstr message);

extern XRECORE_API gcroot<EditorLog^> ELog;
File renamed without changes.
Loading

0 comments on commit fc57908

Please sign in to comment.