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