Fix compilation of NLMISC under MinGW

hg/feature/game-device
kaetemi 11 years ago
parent 15dc492690
commit 3dd11fe157

@ -875,9 +875,9 @@ MACRO(NL_SETUP_BUILD)
ENDIF(APPLE)
# Fix "relocation R_X86_64_32 against.." error on x64 platforms
IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS)
IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS AND NOT MINGW)
ADD_PLATFORM_FLAGS("-fPIC")
ENDIF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS)
ENDIF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS AND NOT MINGW)
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48")

@ -34,7 +34,9 @@
#include "events.h"
#include "rect.h"
#include "game_device.h"
#ifndef NL_COMP_MINGW
# define NOMINMAX
#endif
#include <windows.h>
#include <dinput.h>
@ -101,7 +103,7 @@ public:
* \param we A windows eventsemitter. Can be NULL. Needed if you want to mix WIN32 events and Direct Input events
* (for example, a Direct Input Mouse and a Win32 Keyboard)
*/
static CDIEventEmitter *create(HINSTANCE hinst, HWND hwnd, CWinEventEmitter *we);
static CDIEventEmitter *create(HINSTANCE hinst, HWND hwnd, CWinEventEmitter *we) throw(EDirectInput);
~CDIEventEmitter();
public:

@ -220,7 +220,7 @@ private:
static TOldWinProcMap _OldWinProcMap;
bool initInternal(HINSTANCE hInstance, HWND ownerWindow, uint32 localId, uint32 foreignId = NULL);
bool initInternal(HINSTANCE hInstance, HWND ownerWindow, uint32 localId, uint32 foreignId = 0);
private:
static LRESULT CALLBACK listenerProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

@ -86,6 +86,10 @@
# define NL_COMP_VC_VERSION 60
# define NL_COMP_NEED_PARAM_ON_METHOD
# endif
# elif defined(__MINGW32__)
# define NL_COMP_MINGW
# define NL_COMP_GCC
# define NL_NO_ASM
# endif
# if defined(_HAS_TR1) && (_HAS_TR1 + 0) // VC9 TR1 feature pack or later
# define NL_ISO_STDTR1_AVAILABLE
@ -93,9 +97,13 @@
# define NL_ISO_STDTR1_NAMESPACE std::tr1
# endif
# ifdef _DEBUG
# ifndef NL_DEBUG
# define NL_DEBUG
# endif
# elif defined (NDEBUG)
# ifndef NL_RELEASE
# define NL_RELEASE
# endif
# else
# error "Don't know the compilation mode"
# endif
@ -109,7 +117,9 @@
# define _WIN32_WINNT 0x0600 // force VISTA minimal version in 64 bits
# endif
// define NOMINMAX to be sure that windows includes will not define min max macros, but instead, use the stl template
# ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
#else
# ifdef __APPLE__
# define NL_OS_MAC

@ -22,7 +22,9 @@
#ifdef NL_OS_WINDOWS
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#ifndef NL_COMP_MINGW
# define NOMINMAX
#endif
#include <windows.h>
#include "displayer.h"

@ -26,6 +26,9 @@
#include <csetjmp>
extern "C"
{
#ifdef NL_COMP_MINGW
# define HAVE_BOOLEAN
#endif
#include <jpeglib.h>
}
#endif

@ -53,7 +53,9 @@
# define _WIN32_WINNT 0x0400
# endif
# ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h>
#elif defined (NL_OS_UNIX)
# define NL_WIN_CALLBACK

@ -20,7 +20,9 @@
#include "nel/misc/common.h"
#ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h>
# include <io.h>
# include <tchar.h>
@ -37,6 +39,7 @@
using namespace std;
#ifndef NL_COMP_MINGW
#ifdef NL_OS_WINDOWS
# pragma message( " " )
@ -69,6 +72,7 @@ extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); }
#endif // NL_OS_WINDOWS
#endif // !NL_COMP_MINGW
#ifdef DEBUG_NEW
@ -1040,7 +1044,7 @@ bool openDoc (const char *document)
HINSTANCE result = ShellExecuteA(NULL, "open", document, NULL,NULL, SW_SHOWDEFAULT);
// If it failed, get the .htm regkey and lookup the program
if ((UINT)result <= HINSTANCE_ERROR)
if ((uintptr_t)result <= HINSTANCE_ERROR)
{
if (GetRegKey(HKEY_CLASSES_ROOT, ext.c_str(), key) == ERROR_SUCCESS)
{

@ -34,8 +34,10 @@
#ifdef NL_OS_WINDOWS
# define _WIN32_WINDOWS 0x0410
# ifndef NL_COMP_MINGW
# define WINVER 0x0400
# define NOMINMAX
# endif
# include <windows.h>
# include <direct.h>
# include <tchar.h>
@ -445,7 +447,7 @@ public:
EDebug() { _Reason = "Nothing about EDebug"; }
~EDebug () { }
virtual ~EDebug() throw() {}
EDebug(EXCEPTION_POINTERS * pexp) : m_pexp(pexp) { nlassert(pexp != 0); createWhat(); }
EDebug(const EDebug& se) : m_pexp(se.m_pexp) { createWhat(); }
@ -755,7 +757,7 @@ public:
HANDLE getProcessHandle()
{
return CSystemInfo::isNT()?GetCurrentProcess():(HANDLE)GetCurrentProcessId();
return CSystemInfo::isNT()?GetCurrentProcess():(HANDLE)(uintptr_t)GetCurrentProcessId();
}
// return true if found
@ -797,7 +799,7 @@ public:
while (findAndErase(rawType, "classvector<char,class char_traits<char>,class allocator<char> >", "string")) ;
}
string getFuncInfo (DWORD funcAddr, DWORD stackAddr)
string getFuncInfo (uintptr_t funcAddr, uintptr_t stackAddr)
{
string str ("NoSymbol");
@ -853,7 +855,7 @@ public:
if (stop==0 && (parse[i] == ',' || parse[i] == ')'))
{
ULONG *addr = (ULONG*)(stackAddr) + 2 + pos2++;
uintptr_t *addr = (uintptr_t*)(stackAddr) + 2 + pos2++;
string displayType = type;
cleanType (type, displayType);
@ -882,7 +884,7 @@ public:
}
else if (type == "char*")
{
if (!IsBadReadPtr(addr,sizeof(char*)) && *addr != NULL)
if (!IsBadReadPtr(addr,sizeof(char*)) && *addr != 0)
{
if (!IsBadStringPtrA((char*)*addr,32))
{
@ -920,7 +922,7 @@ public:
{
if (!IsBadReadPtr(addr,sizeof(string*)))
{
if (*addr != NULL)
if (*addr != 0)
{
if (!IsBadReadPtr((void*)*addr,sizeof(string)))
sprintf (tmp, "\"%s\"", ((string*)*addr)->c_str());
@ -929,9 +931,9 @@ public:
}
else
{
if (!IsBadReadPtr(addr,sizeof(ULONG*)))
if (!IsBadReadPtr(addr,sizeof(uintptr_t*)))
{
if(*addr == NULL)
if(*addr == 0)
sprintf (tmp, "<NULL>");
else
sprintf (tmp, "0x%p", *addr);
@ -956,7 +958,7 @@ public:
if (disp != 0)
{
str += " + ";
str += toString ((uint32)disp);
str += toString ((uintptr_t)disp);
str += " bytes";
}
}
@ -1166,6 +1168,7 @@ void createDebug (const char *logPath, bool logInFile, bool eraseLastLog)
initAcquireTimeMap();
#endif
#ifndef NL_COMP_MINGW
# ifdef NL_OS_WINDOWS
// if (!IsDebuggerPresent ())
{
@ -1181,6 +1184,7 @@ void createDebug (const char *logPath, bool logInFile, bool eraseLastLog)
}
}
# endif // NL_OS_WINDOWS
#endif //!NL_COMP_MINGW
INelContext::getInstance().setErrorLog(new CLog (CLog::LOG_ERROR));
INelContext::getInstance().setWarningLog(new CLog (CLog::LOG_WARNING));

@ -217,7 +217,7 @@ static void BuildCtrlName(LPCDIDEVICEOBJECTINSTANCE lpddoi,
//============================================================================
// A callback to enumerate the controls of a device
static BOOL CALLBACK DIEnumDeviceObjectsCallback
BOOL CALLBACK DIEnumDeviceObjectsCallback
(
LPCDIDEVICEOBJECTINSTANCE lpddoi,
LPVOID pvRef

@ -113,8 +113,8 @@ static const CKeyConv DIToNel[] =
{DIK_CONVERT, KeyCONVERT, "CONVERT", false},
{DIK_NOCONVERT, KeyNONCONVERT, "NOCONVERT", true},
//
{DIK_KANA, KeyKANA, false},
{DIK_KANJI, KeyKANJI, false},
{DIK_KANA, KeyKANA, "KANA", false},
{DIK_KANJI, KeyKANJI, "KANJI", false},
};
@ -164,7 +164,7 @@ CDIKeyboard::CDIKeyboard(CWinEventEmitter *we, HWND hwnd)
_RepeatPeriod = (uint) (1000.f / (keybSpeed * (27.5f / 31.f) + 2.5f));
}
// get keyboard layout
_KBLayout = ::GetKeyboardLayout(NULL);
_KBLayout = ::GetKeyboardLayout(0);
_RepetitionDisabled.resize(NumKeys);
_RepetitionDisabled.clearAll();

@ -27,6 +27,12 @@
#define new DEBUG_NEW
#endif
#ifdef NL_COMP_MINGW
# undef FIELD_OFFSET
# define FIELD_OFFSET(t,f) offsetof(t,f)
#endif
namespace NLMISC
{
@ -78,7 +84,7 @@ void CDIMouse::setMouseMode(TAxis axis, TAxisMode axisMode)
//======================================================
CDIMouse::TAxisMode CDIMouse::getMouseMode(TAxis axis) const
{
nlassert(axis < NumMouseAxis);
nlassert((int)axis < (int)NumMouseAxis);
return _MouseAxisMode[axis];
}

@ -39,8 +39,10 @@
// these defines is for IsDebuggerPresent(). it'll not compile on windows 95
// just comment this and the IsDebuggerPresent to compile on windows 95
# define _WIN32_WINDOWS 0x0410
# ifndef NL_COMP_MINGW
# define WINVER 0x0400
# define NOMINMAX
# endif
# include <windows.h>
#else
# define IsDebuggerPresent() false

@ -57,7 +57,7 @@ void *nlGetSymbolAddress(NL_LIB_HANDLE libHandle, const std::string &procName)
{
void *res = 0;
#ifdef NL_OS_WINDOWS
res = GetProcAddress(libHandle, procName.c_str());
res = (void *)GetProcAddress(libHandle, procName.c_str());
#elif defined(NL_OS_UNIX)
res = dlsym(libHandle, procName.c_str());
#else

@ -19,7 +19,9 @@
#include "nel/misc/log.h"
#ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <process.h>
# include <windows.h>
#else

@ -24,7 +24,9 @@
#include "nel/misc/debug.h"
#ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h>
# include <imagehlp.h>
# pragma comment(lib, "imagehlp.lib")
@ -148,7 +150,7 @@ static string getSourceInfo (DWORD_TYPE addr)
return str;
}
static DWORD_TYPE __stdcall GetModuleBase(HANDLE hProcess, DWORD_TYPE dwReturnAddress)
static uintptr_t __stdcall GetModuleBase(HANDLE hProcess, uintptr_t dwReturnAddress)
{
IMAGEHLP_MODULE moduleInfo;
@ -169,9 +171,15 @@ static DWORD_TYPE __stdcall GetModuleBase(HANDLE hProcess, DWORD_TYPE dwReturnAd
if (cch && (lstrcmp(szFile, "DBFN")== 0))
{
if (!SymLoadModule(hProcess,
NULL, "MN",
NULL, (DWORD) memoryBasicInfo.AllocationBase, 0))
char mn[] = { 'M', 'N', 0x00 };
#ifdef NL_OS_WIN64
if (!SymLoadModule64(
#else
if (!SymLoadModule(
#endif
hProcess,
NULL, mn,
NULL, (uintptr_t)memoryBasicInfo.AllocationBase, 0))
{
// DWORD dwError = GetLastError();
// nlinfo("Error: %d", dwError);
@ -179,17 +187,23 @@ static DWORD_TYPE __stdcall GetModuleBase(HANDLE hProcess, DWORD_TYPE dwReturnAd
}
else
{
if (!SymLoadModule(hProcess,
#ifdef NL_OS_WIN64
if (!SymLoadModule64(
#else
if (!SymLoadModule(
#endif
hProcess,
NULL, ((cch) ? szFile : NULL),
NULL, (DWORD) memoryBasicInfo.AllocationBase, 0))
NULL, (uintptr_t)memoryBasicInfo.AllocationBase, 0))
{
// DWORD dwError = GetLastError();
// nlinfo("Error: %d", dwError);
}
}
return (DWORD) memoryBasicInfo.AllocationBase;
return (uintptr_t)memoryBasicInfo.AllocationBase;
}
// else
// nlinfo("Error is %d", GetLastError());
@ -250,19 +264,13 @@ static void displayCallStack (CLog *log)
return;
}
#ifdef NL_OS_WIN64
WOW64_CONTEXT context;
#else
// FIXME: Implement this for MinGW
#ifndef NL_COMP_MINGW
CONTEXT context;
#endif
::ZeroMemory (&context, sizeof(context));
context.ContextFlags = CONTEXT_FULL;
#ifdef NL_OS_WIN64
if (Wow64GetThreadContext (GetCurrentThread(), &context) == FALSE)
#else
if (GetThreadContext (GetCurrentThread(), &context) == FALSE)
#endif
{
nlwarning ("DISP: GetThreadContext(%p) failed", GetCurrentThread());
return;
@ -309,6 +317,7 @@ static void displayCallStack (CLog *log)
log->displayNL (" %s : %s", srcInfo.c_str(), symInfo.c_str());
}
#endif
}
#else // NL_OS_WINDOWS

@ -44,8 +44,10 @@ using namespace std;
// these defines are for IsDebuggerPresent(). It'll not compile on windows 95
// just comment this and the IsDebuggerPresent to compile on windows 95
#define _WIN32_WINDOWS 0x0410
#ifndef NL_COMP_MINGW
# define WINVER 0x0400
# define NOMINMAX
#endif
#include <windows.h>
#ifdef DEBUG_NEW

@ -25,7 +25,9 @@
#include "nel/misc/xml_pack.h"
#ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h>
# include <sys/types.h>
# include <sys/stat.h>

@ -23,7 +23,9 @@
#include "nel/misc/path.h"
#ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h>
# include <windowsx.h>
# include <winuser.h>
@ -232,7 +234,7 @@ TReportResult report (const std::string &title, const std::string &header, const
// create the edit control
HWND edit = CreateWindowW (L"EDIT", NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | ES_READONLY | ES_LEFT | ES_MULTILINE, 7, 70, 429, 212, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
SendMessage (edit, WM_SETFONT, (LONG) font, TRUE);
SendMessage (edit, WM_SETFONT, (WPARAM) font, TRUE);
// set the edit text limit to lot of :)
SendMessage (edit, EM_LIMITTEXT, ~0U, 0);
@ -246,7 +248,7 @@ TReportResult report (const std::string &title, const std::string &header, const
{
// create the combo box control
checkIgnore = CreateWindowW (L"BUTTON", L"Don't display this report again", WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX | BS_CHECKBOX, 7, 290, 429, 18, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
SendMessage (checkIgnore, WM_SETFONT, (LONG) font, TRUE);
SendMessage (checkIgnore, WM_SETFONT, (WPARAM) font, TRUE);
if(ignoreNextTime)
{
@ -256,28 +258,28 @@ TReportResult report (const std::string &title, const std::string &header, const
// create the debug button control
debug = CreateWindowW (L"BUTTON", L"Debug", WS_CHILD | WS_VISIBLE, 7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
SendMessage (debug, WM_SETFONT, (LONG) font, TRUE);
SendMessage (debug, WM_SETFONT, (WPARAM) font, TRUE);
if (debugButton == 0)
EnableWindow(debug, FALSE);
// create the ignore button control
ignore = CreateWindowW (L"BUTTON", L"Ignore", WS_CHILD | WS_VISIBLE, 75+7+7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
SendMessage (ignore, WM_SETFONT, (LONG) font, TRUE);
SendMessage (ignore, WM_SETFONT, (WPARAM) font, TRUE);
if (ignoreButton == 0)
EnableWindow(ignore, FALSE);
// create the quit button control
quit = CreateWindowW (L"BUTTON", L"Quit", WS_CHILD | WS_VISIBLE, 75+75+7+7+7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
SendMessage (quit, WM_SETFONT, (LONG) font, TRUE);
SendMessage (quit, WM_SETFONT, (WPARAM) font, TRUE);
if (quitButton == 0)
EnableWindow(quit, FALSE);
// create the debug button control
sendReport = CreateWindowW (L"BUTTON", L"Don't send the report", WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 7, 315+32, 429, 18, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
SendMessage (sendReport, WM_SETFONT, (LONG) font, TRUE);
SendMessage (sendReport, WM_SETFONT, (WPARAM) font, TRUE);
string formatedHeader;
if (header.empty())
@ -302,7 +304,7 @@ TReportResult report (const std::string &title, const std::string &header, const
// create the label control
HWND label = CreateWindowW (L"STATIC", (LPCWSTR)uc.c_str(), WS_CHILD | WS_VISIBLE /*| SS_WHITERECT*/, 7, 7, 429, 51, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
SendMessage (label, WM_SETFONT, (LONG) font, TRUE);
SendMessage (label, WM_SETFONT, (WPARAM) font, TRUE);
DebugDefaultBehavior = debugButton==1;

@ -20,7 +20,9 @@
#include "nel/misc/debug.h"
#ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h>
#else
# include <sys/types.h>

@ -43,7 +43,9 @@
#include <vector>
#ifdef _WIN32
# ifndef __MINGW32__
#define NOMINMAX
# endif
# include <WinSock2.h>
# include <windows.h>
#endif

@ -19,7 +19,9 @@
#include "nel/misc/system_info.h"
#ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h>
# include <WinNT.h>
# include <tchar.h>
@ -1484,7 +1486,8 @@ bool CSystemInfo::getVideoInfo (std::string &deviceName, uint64 &driverVersion)
{
VS_FIXEDFILEINFO *info;
UINT len;
if (_VerQueryValue(&buffer[0], "\\", (VOID**)&info, &len))
char bslash[] = { '\\', 0x00 };
if (_VerQueryValue(&buffer[0], bslash, (VOID**)&info, &len))
{
driverVersion = (((uint64)info->dwFileVersionMS)<<32)|info->dwFileVersionLS;
return true;

@ -18,7 +18,9 @@
#include "nel/misc/system_utils.h"
#ifdef NL_OS_WINDOWS
#ifndef NL_COMP_MINGW
#define NOMINMAX
#endif
#include <windows.h>
#ifdef _WIN32_WINNT_WIN7
@ -222,7 +224,7 @@ bool CSystemUtils::supportUnicode()
bool CSystemUtils::isAzertyKeyboard()
{
#ifdef NL_OS_WINDOWS
uint16 klId = uint16((uint32)GetKeyboardLayout(0) & 0xFFFF);
uint16 klId = uint16((uintptr_t)GetKeyboardLayout(0) & 0xFFFF);
// 0x040c is French, 0x080c is Belgian
if (klId == 0x040c || klId == 0x080c)
return true;
@ -312,7 +314,8 @@ bool CSystemUtils::setRegKey(const string &ValueName, const string &Value)
HKEY hkey;
DWORD dwDisp;
if (RegCreateKeyExA(HKEY_CURRENT_USER, RootKey.c_str(), 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwDisp) == ERROR_SUCCESS)
char nstr[] = { 0x00 };
if (RegCreateKeyExA(HKEY_CURRENT_USER, RootKey.c_str(), 0, nstr, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwDisp) == ERROR_SUCCESS)
{
if (RegSetValueExA(hkey, ValueName.c_str(), 0L, REG_SZ, (const BYTE *)Value.c_str(), (DWORD)(Value.size())+1) == ERROR_SUCCESS)
res = true;

@ -20,7 +20,9 @@
#include "nel/misc/debug.h"
#ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h>
#endif // NL_OS_WINDOWS

@ -21,7 +21,9 @@
#include "nel/misc/thread.h"
#ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h>
#elif defined (NL_OS_UNIX)
# include <sys/time.h>

@ -18,8 +18,9 @@
#include "nel/misc/win_displayer.h"
#ifdef NL_OS_WINDOWS
#ifndef NL_COMP_MINGW
# define NOMINMAX
#endif
#include <windows.h>
#include <windowsx.h>
#include <winuser.h>
@ -263,7 +264,7 @@ void CWinDisplayer::updateLabels ()
{
access.value()[i].Hwnd = CreateWindowW (L"STATIC", L"", WS_CHILD | WS_VISIBLE | SS_SIMPLE, 0, 0, 0, 0, _HWnd, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL);
}
SendMessage ((HWND)access.value()[i].Hwnd, WM_SETFONT, (LONG) _HFont, TRUE);
SendMessage ((HWND)access.value()[i].Hwnd, WM_SETFONT, (WPARAM)_HFont, TRUE);
needResize = true;
}
@ -285,7 +286,7 @@ void CWinDisplayer::updateLabels ()
}
}
SendMessage ((HWND)access.value()[i].Hwnd, WM_SETTEXT, 0, (LONG) n.c_str());
SendMessage ((HWND)access.value()[i].Hwnd, WM_SETTEXT, 0, (LPARAM) n.c_str());
access.value()[i].NeedUpdate = false;
}
}
@ -422,7 +423,7 @@ void CWinDisplayer::open (string titleBar, bool iconified, sint x, sint y, sint
dwStyle |= WS_HSCROLL;
_HEdit = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, RICHEDIT_CLASSW, L"", dwStyle, 0, _ToolBarHeight, w, h-_ToolBarHeight-_InputEditHeight, _HWnd, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL);
SendMessage (_HEdit, WM_SETFONT, (LONG) _HFont, TRUE);
SendMessage (_HEdit, WM_SETFONT, (WPARAM)_HFont, TRUE);
// set the edit text limit to lot of :)
SendMessage (_HEdit, EM_LIMITTEXT, -1, 0);
@ -436,7 +437,7 @@ void CWinDisplayer::open (string titleBar, bool iconified, sint x, sint y, sint
_HInputEdit = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, RICHEDIT_CLASSW, L"", WS_CHILD | WS_VISIBLE
/*| ES_MULTILINE*/ | ES_WANTRETURN | ES_NOHIDESEL | ES_AUTOHSCROLL, 0, h-_InputEditHeight, w, _InputEditHeight,
_HWnd, NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL);
SendMessageW (_HInputEdit, WM_SETFONT, (LONG) _HFont, TRUE);
SendMessageW (_HInputEdit, WM_SETFONT, (WPARAM)_HFont, TRUE);
LRESULT dwEvent = SendMessageW(_HInputEdit, EM_GETEVENTMASK, (WPARAM)0, (LPARAM)0);
dwEvent |= ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE;
@ -486,7 +487,7 @@ void CWinDisplayer::clear ()
SendMessageW (_HEdit, EM_SETSEL, 0, nIndex);
// clear all the text
SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LONG) "");
SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LPARAM) "");
SendMessageW(_HEdit,EM_SETMODIFY,(WPARAM)TRUE,(LPARAM)0);
@ -535,7 +536,7 @@ void CWinDisplayer::display_main ()
// store old selection
DWORD startSel, endSel;
SendMessage (_HEdit, EM_GETSEL, (LONG)&startSel, (LONG)&endSel);
SendMessage (_HEdit, EM_GETSEL, (WPARAM)&startSel, (LPARAM)&endSel);
// find how many lines we have to remove in the current output to add new lines
@ -549,7 +550,7 @@ void CWinDisplayer::display_main ()
if (nblineremove == _HistorySize)
{
SendMessage (_HEdit, WM_SETTEXT, 0, (LONG) "");
SendMessage (_HEdit, WM_SETTEXT, 0, (LPARAM) "");
startSel = endSel = -1;
}
else
@ -559,7 +560,7 @@ void CWinDisplayer::display_main ()
LRESULT oldIndex2 = SendMessageW (_HEdit, EM_LINEINDEX, nblineremove, 0);
//nlassert (oldIndex2 != -1);
SendMessageW (_HEdit, EM_SETSEL, oldIndex1, oldIndex2);
SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LONG) "");
SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LPARAM) "");
// update the selection due to the erasing
sint dt = (sint)(oldIndex2 - oldIndex1);
@ -599,7 +600,7 @@ void CWinDisplayer::display_main ()
}
// add the string to the edit control
SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LONG) str.c_str());
SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LPARAM) str.c_str());
}
// restore old selection

@ -22,7 +22,9 @@
#include "nel/misc/event_server.h"
#ifdef NL_OS_WINDOWS
#ifndef NL_COMP_MINGW
#define NOMINMAX
#endif
#include <windows.h>
#include <windowsx.h>

@ -20,7 +20,9 @@
#ifdef NL_OS_WINDOWS
#include "nel/misc/path.h"
#ifndef NL_COMP_MINGW
#define NOMINMAX
#endif
#include <windows.h>
#include <typeinfo>

@ -34,7 +34,9 @@
#endif // HAVE_CONFIG_H
#ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h>
#endif // NL_OS_WINDOWS

Loading…
Cancel
Save