mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-18 05:11:42 +00:00
Add isWindowedApplication to INeLContext
This commit is contained in:
parent
e6eaffc28b
commit
e5fc6f9d7a
9 changed files with 55 additions and 10 deletions
|
@ -88,6 +88,8 @@ namespace NLMISC
|
|||
virtual void setNoAssert(bool noAssert) =0;
|
||||
virtual bool getAlreadyCreateSharedAmongThreads() =0;
|
||||
virtual void setAlreadyCreateSharedAmongThreads(bool b) =0;
|
||||
virtual bool isWindowedApplication() = 0;
|
||||
virtual void setWindowedApplication(bool b = true) = 0;
|
||||
//@}
|
||||
protected:
|
||||
/// Called by derived class to finalize initialisation of context
|
||||
|
@ -131,6 +133,8 @@ namespace NLMISC
|
|||
virtual void setNoAssert(bool noAssert);
|
||||
virtual bool getAlreadyCreateSharedAmongThreads();
|
||||
virtual void setAlreadyCreateSharedAmongThreads(bool b);
|
||||
virtual bool isWindowedApplication();
|
||||
virtual void setWindowedApplication(bool b);
|
||||
|
||||
private:
|
||||
/// Singleton registry
|
||||
|
@ -147,6 +151,7 @@ namespace NLMISC
|
|||
bool DebugNeedAssert;
|
||||
bool NoAssert;
|
||||
bool AlreadyCreateSharedAmongThreads;
|
||||
bool WindowedApplication;
|
||||
};
|
||||
|
||||
/** This class implements the context interface for the a library module.
|
||||
|
@ -183,6 +188,8 @@ namespace NLMISC
|
|||
virtual void setNoAssert(bool noAssert);
|
||||
virtual bool getAlreadyCreateSharedAmongThreads();
|
||||
virtual void setAlreadyCreateSharedAmongThreads(bool b);
|
||||
virtual bool isWindowedApplication();
|
||||
virtual void setWindowedApplication(bool b);
|
||||
|
||||
private:
|
||||
/// Pointer to the application context.
|
||||
|
|
|
@ -42,11 +42,7 @@ class CGtkDisplayer : public NLMISC::CWindowDisplayer
|
|||
{
|
||||
public:
|
||||
|
||||
CGtkDisplayer (const char *displayerName = "") : CWindowDisplayer(displayerName)
|
||||
{
|
||||
needSlashR = false;
|
||||
createLabel ("@Clear|CLEAR");
|
||||
}
|
||||
CGtkDisplayer (const char *displayerName = "");
|
||||
|
||||
virtual ~CGtkDisplayer ();
|
||||
|
||||
|
|
|
@ -57,11 +57,7 @@ class CWinDisplayer : public NLMISC::CWindowDisplayer
|
|||
{
|
||||
public:
|
||||
|
||||
CWinDisplayer (const char *displayerName = "") : CWindowDisplayer(displayerName), Exit(false)
|
||||
{
|
||||
needSlashR = true;
|
||||
createLabel ("@Clear|CLEAR");
|
||||
}
|
||||
CWinDisplayer(const char *displayerName = "");
|
||||
|
||||
virtual ~CWinDisplayer ();
|
||||
|
||||
|
|
|
@ -114,6 +114,7 @@ CApplicationContext::CApplicationContext()
|
|||
DebugNeedAssert = false;
|
||||
NoAssert = false;
|
||||
AlreadyCreateSharedAmongThreads = false;
|
||||
WindowedApplication = false;
|
||||
|
||||
contextReady();
|
||||
}
|
||||
|
@ -242,6 +243,16 @@ void CApplicationContext::setAlreadyCreateSharedAmongThreads(bool b)
|
|||
AlreadyCreateSharedAmongThreads = b;
|
||||
}
|
||||
|
||||
bool CApplicationContext::isWindowedApplication()
|
||||
{
|
||||
return WindowedApplication;
|
||||
}
|
||||
|
||||
void CApplicationContext::setWindowedApplication(bool b)
|
||||
{
|
||||
WindowedApplication = b;
|
||||
}
|
||||
|
||||
CLibraryContext::CLibraryContext(INelContext &applicationContext)
|
||||
: _ApplicationContext(&applicationContext)
|
||||
{
|
||||
|
@ -430,6 +441,16 @@ void CLibraryContext::setAlreadyCreateSharedAmongThreads(bool b)
|
|||
_ApplicationContext->setAlreadyCreateSharedAmongThreads(b);
|
||||
}
|
||||
|
||||
bool CLibraryContext::isWindowedApplication()
|
||||
{
|
||||
return _ApplicationContext->isWindowedApplication();
|
||||
}
|
||||
|
||||
void CLibraryContext::setWindowedApplication(bool b)
|
||||
{
|
||||
_ApplicationContext->setWindowedApplication(b);
|
||||
}
|
||||
|
||||
void initNelLibrary(NLMISC::CLibrary &lib)
|
||||
{
|
||||
nlassert(lib.isLibraryLoaded());
|
||||
|
|
|
@ -1222,6 +1222,11 @@ void createDebug (const char *logPath, bool logInFile, bool eraseLastLog)
|
|||
#endif // LOG_IN_FILE
|
||||
DefaultMemDisplayer = new CMemDisplayer ("DEFAULT_MD");
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
if (GetConsoleWindow() == NULL)
|
||||
INelContext::getInstance().setWindowedApplication(true);
|
||||
#endif
|
||||
|
||||
initDebug2(logInFile);
|
||||
|
||||
INelContext::getInstance().setAlreadyCreateSharedAmongThreads(true);
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#pragma comment(lib, "gthread-1.3.lib")
|
||||
#endif
|
||||
|
||||
#include "nel/misc/app_context.h"
|
||||
#include "nel/misc/path.h"
|
||||
#include "nel/misc/command.h"
|
||||
#include "nel/misc/thread.h"
|
||||
|
@ -59,6 +60,14 @@ static GtkWidget *hrootbox = NULL, *scrolled_win2 = NULL;
|
|||
// Functions
|
||||
//
|
||||
|
||||
CGtkDisplayer (const char *displayerName) : CWindowDisplayer(displayerName)
|
||||
{
|
||||
needSlashR = false;
|
||||
createLabel ("@Clear|CLEAR");
|
||||
|
||||
INelContext::getInstance().setWindowedApplication(true);
|
||||
}
|
||||
|
||||
CGtkDisplayer::~CGtkDisplayer ()
|
||||
{
|
||||
if (_Init)
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <commctrl.h>
|
||||
#include <ctime>
|
||||
|
||||
#include "nel/misc/app_context.h"
|
||||
#include "nel/misc/path.h"
|
||||
#include "nel/misc/command.h"
|
||||
#include "nel/misc/thread.h"
|
||||
|
@ -41,6 +42,13 @@ namespace NLMISC {
|
|||
|
||||
static CHARFORMAT2 CharFormat;
|
||||
|
||||
CWinDisplayer::CWinDisplayer(const char *displayerName) : CWindowDisplayer(displayerName), Exit(false)
|
||||
{
|
||||
needSlashR = true;
|
||||
createLabel("@Clear|CLEAR");
|
||||
|
||||
INelContext::getInstance().setWindowedApplication(true);
|
||||
}
|
||||
|
||||
CWinDisplayer::~CWinDisplayer ()
|
||||
{
|
||||
|
|
|
@ -365,6 +365,8 @@ int main(int argc, char **argv)
|
|||
|
||||
createDebug();
|
||||
|
||||
INelContext::getInstance().setWindowedApplication(true);
|
||||
|
||||
#ifndef NL_DEBUG
|
||||
INelContext::getInstance().getDebugLog()->removeDisplayer("DEFAULT_SD");
|
||||
INelContext::getInstance().getInfoLog()->removeDisplayer("DEFAULT_SD");
|
||||
|
|
|
@ -1264,6 +1264,7 @@ sint main(int argc, char **argv)
|
|||
{
|
||||
// use log.log if NEL_LOG_IN_FILE and SBCLIENT_USE_LOG_LOG defined as 1
|
||||
createDebug(NULL, SBCLIENT_USE_LOG_LOG, false);
|
||||
INelContext::getInstance().setWindowedApplication(true);
|
||||
|
||||
#if SBCLIENT_USE_LOG
|
||||
// create snowballs_client.log
|
||||
|
|
Loading…
Reference in a new issue