Windows error checking and warnings
This commit is contained in:
@@ -42,6 +42,9 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalOptions>/Gs /Oi- /w44774 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/Gs /Oi- /w44774 %(AdditionalOptions)</AdditionalOptions>
|
||||||
@@ -49,7 +52,7 @@
|
|||||||
<OmitFramePointers>true</OmitFramePointers>
|
<OmitFramePointers>true</OmitFramePointers>
|
||||||
<AdditionalIncludeDirectories>$(WinWin32Dir);$(IncDir);$(SysWindDir);$(SysShareDir);$(WinShareDir);$(LuaDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(WinWin32Dir);$(IncDir);$(SysWindDir);$(SysShareDir);$(WinShareDir);$(LuaDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>TILES;_WINDOWS;DLB;MSWIN_GRAPHICS;SAFEPROCS;NOTTYGRAPHICS;SND_LIB_WINDSOUND;USER_SOUNDS;HAS_STDINT_H;PDC_WIDE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>TILES;_WINDOWS;DLB;MSWIN_GRAPHICS;SAFEPROCS;NOTTYGRAPHICS;SND_LIB_WINDSOUND;USER_SOUNDS;HAS_STDINT_H;PDC_WIDE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4820;4706;4244;4245;4100;4310</DisableSpecificWarnings>
|
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4820;4706;4244;4245;4100;4310;6001</DisableSpecificWarnings>
|
||||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4820;4706;4244;4245;4100;4310</DisableSpecificWarnings>
|
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4820;4706;4244;4245;4100;4310</DisableSpecificWarnings>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ResourceCompile>
|
<ResourceCompile>
|
||||||
@@ -73,7 +76,7 @@
|
|||||||
<ClCompile Include="@(Lua)">
|
<ClCompile Include="@(Lua)">
|
||||||
<DisableSpecificWarnings>4701;4702;4244;4310;4774</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4701;4702;4244;4310;4774</DisableSpecificWarnings>
|
||||||
<AdditionalOptions>%(AdditionalOptions) /wd4774</AdditionalOptions>
|
<AdditionalOptions>%(AdditionalOptions) /wd4774</AdditionalOptions>
|
||||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4701;4702;4244;4310;4774;4324</DisableSpecificWarnings>
|
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4701;4702;4244;4310;4774;4324;6011;6297;6305;6385;6386;6387;28182</DisableSpecificWarnings>
|
||||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4701;4702;4244;4310;4774;4324</DisableSpecificWarnings>
|
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4701;4702;4244;4310;4774;4324</DisableSpecificWarnings>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="$(SrcDir)allmain.c" />
|
<ClCompile Include="$(SrcDir)allmain.c" />
|
||||||
@@ -147,7 +150,9 @@
|
|||||||
<ClCompile Include="$(SrcDir)options.c" />
|
<ClCompile Include="$(SrcDir)options.c" />
|
||||||
<ClCompile Include="$(SrcDir)o_init.c" />
|
<ClCompile Include="$(SrcDir)o_init.c" />
|
||||||
<ClCompile Include="$(SrcDir)pager.c" />
|
<ClCompile Include="$(SrcDir)pager.c" />
|
||||||
<ClCompile Include="$(SrcDir)pickup.c" />
|
<ClCompile Include="$(SrcDir)pickup.c">
|
||||||
|
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4820;4706;4244;4245;4100;4310;6001</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="$(SrcDir)pline.c" />
|
<ClCompile Include="$(SrcDir)pline.c" />
|
||||||
<ClCompile Include="$(SrcDir)polyself.c" />
|
<ClCompile Include="$(SrcDir)polyself.c" />
|
||||||
<ClCompile Include="$(SrcDir)potion.c" />
|
<ClCompile Include="$(SrcDir)potion.c" />
|
||||||
@@ -177,7 +182,9 @@
|
|||||||
<ClCompile Include="$(SrcDir)sys.c" />
|
<ClCompile Include="$(SrcDir)sys.c" />
|
||||||
<ClCompile Include="$(SrcDir)teleport.c" />
|
<ClCompile Include="$(SrcDir)teleport.c" />
|
||||||
<ClCompile Include="$(SrcDir)tile.c" />
|
<ClCompile Include="$(SrcDir)tile.c" />
|
||||||
<ClCompile Include="$(SrcDir)timeout.c" />
|
<ClCompile Include="$(SrcDir)timeout.c">
|
||||||
|
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4820;4706;4244;4245;4100;4310;6001</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="$(SrcDir)topten.c" />
|
<ClCompile Include="$(SrcDir)topten.c" />
|
||||||
<ClCompile Include="$(SrcDir)track.c" />
|
<ClCompile Include="$(SrcDir)track.c" />
|
||||||
<ClCompile Include="$(SrcDir)trap.c" />
|
<ClCompile Include="$(SrcDir)trap.c" />
|
||||||
@@ -200,7 +207,9 @@
|
|||||||
<ClCompile Condition="Exists('$(PDCURSES)')" Include="$(WinCursDir)cursinit.c" />
|
<ClCompile Condition="Exists('$(PDCURSES)')" Include="$(WinCursDir)cursinit.c" />
|
||||||
<ClCompile Condition="Exists('$(PDCURSES)')" Include="$(WinCursDir)cursinvt.c" />
|
<ClCompile Condition="Exists('$(PDCURSES)')" Include="$(WinCursDir)cursinvt.c" />
|
||||||
<ClCompile Condition="Exists('$(PDCURSES)')" Include="$(WinCursDir)cursmain.c" />
|
<ClCompile Condition="Exists('$(PDCURSES)')" Include="$(WinCursDir)cursmain.c" />
|
||||||
<ClCompile Condition="Exists('$(PDCURSES)')" Include="$(WinCursDir)cursmesg.c" />
|
<ClCompile Condition="Exists('$(PDCURSES)')" Include="$(WinCursDir)cursmesg.c">
|
||||||
|
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4820;4706;4244;4245;4100;4310;6001</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Condition="Exists('$(PDCURSES)')" Include="$(WinCursDir)cursmisc.c" />
|
<ClCompile Condition="Exists('$(PDCURSES)')" Include="$(WinCursDir)cursmisc.c" />
|
||||||
<ClCompile Condition="Exists('$(PDCURSES)')" Include="$(WinCursDir)cursstat.c" />
|
<ClCompile Condition="Exists('$(PDCURSES)')" Include="$(WinCursDir)cursstat.c" />
|
||||||
<ClCompile Condition="Exists('$(PDCURSES)')" Include="$(WinCursDir)curswins.c" />
|
<ClCompile Condition="Exists('$(PDCURSES)')" Include="$(WinCursDir)curswins.c" />
|
||||||
|
|||||||
+36
-30
@@ -161,7 +161,7 @@ chdrive(char* str)
|
|||||||
char drive;
|
char drive;
|
||||||
if ((ptr = strchr(str, ':')) != (char *) 0) {
|
if ((ptr = strchr(str, ':')) != (char *) 0) {
|
||||||
drive = toupper((uchar) *(ptr - 1));
|
drive = toupper((uchar) *(ptr - 1));
|
||||||
_chdrive((drive - 'A') + 1);
|
(void) _chdrive((drive - 'A') + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,18 +388,21 @@ void port_insert_pastebuf(char *buf)
|
|||||||
/* Housekeeping need: +GlobalUnlock(hglbCopy), GlobalFree(hglbCopy),
|
/* Housekeeping need: +GlobalUnlock(hglbCopy), GlobalFree(hglbCopy),
|
||||||
CloseClipboard(), free(w) */
|
CloseClipboard(), free(w) */
|
||||||
|
|
||||||
memcpy(lpwstrCopy, w, abytes);
|
if (lpwstrCopy) {
|
||||||
GlobalUnlock(hglbCopy);
|
memcpy(lpwstrCopy, w, abytes);
|
||||||
/* Housekeeping need: GlobalFree(hglbCopy), CloseClipboard(), free(w) */
|
GlobalUnlock(hglbCopy);
|
||||||
|
/* Housekeeping need: GlobalFree(hglbCopy), CloseClipboard(), free(w)
|
||||||
|
*/
|
||||||
|
|
||||||
/* put it on the clipboard */
|
/* put it on the clipboard */
|
||||||
hresult = SetClipboardData(CF_UNICODETEXT, hglbCopy);
|
hresult = SetClipboardData(CF_UNICODETEXT, hglbCopy);
|
||||||
if (!hresult) {
|
if (!hresult) {
|
||||||
raw_printf("Error copying to clipboard.\n");
|
raw_printf("Error copying to clipboard.\n");
|
||||||
GlobalFree(hglbCopy); /* only needed if clipboard didn't accept data */
|
GlobalFree(
|
||||||
|
hglbCopy); /* only needed if clipboard didn't accept data */
|
||||||
|
}
|
||||||
|
/* Housekeeping need: CloseClipboard(), free(w) */
|
||||||
}
|
}
|
||||||
/* Housekeeping need: CloseClipboard(), free(w) */
|
|
||||||
|
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
free(w);
|
free(w);
|
||||||
return;
|
return;
|
||||||
@@ -619,30 +622,33 @@ BOOL winos_font_support_cp437(HFONT hFont)
|
|||||||
HDC hdc = GetDC(NULL);
|
HDC hdc = GetDC(NULL);
|
||||||
HFONT oldFont = SelectObject(hdc, hFont);
|
HFONT oldFont = SelectObject(hdc, hFont);
|
||||||
|
|
||||||
DWORD size = GetFontUnicodeRanges(hdc, NULL);
|
|
||||||
GLYPHSET *glyphSet = (GLYPHSET *) malloc(size);
|
|
||||||
|
|
||||||
if (glyphSet != NULL) {
|
DWORD size = (size_t) GetFontUnicodeRanges(hdc, NULL);
|
||||||
GetFontUnicodeRanges(hdc, glyphSet);
|
if (size) {
|
||||||
|
GLYPHSET *glyphSet = (GLYPHSET *) malloc((size_t) size);
|
||||||
|
if (glyphSet != NULL) {
|
||||||
|
#pragma warning( push )
|
||||||
|
#pragma warning( disable : 6386 )
|
||||||
|
size = GetFontUnicodeRanges(hdc, glyphSet);
|
||||||
|
#pragma warning( pop )
|
||||||
|
allFound = TRUE;
|
||||||
|
for (int i = 0; i < 256 && allFound; i++) {
|
||||||
|
WCHAR wc = cp437[i];
|
||||||
|
BOOL found = FALSE;
|
||||||
|
for (DWORD j = 0; j < glyphSet->cRanges && !found; j++) {
|
||||||
|
WCHAR first = glyphSet->ranges[j].wcLow;
|
||||||
|
WCHAR last = first + glyphSet->ranges[j].cGlyphs - 1;
|
||||||
|
|
||||||
allFound = TRUE;
|
if (wc >= first && wc <= last)
|
||||||
for (int i = 0; i < 256 && allFound; i++) {
|
found = TRUE;
|
||||||
WCHAR wc = cp437[i];
|
}
|
||||||
BOOL found = FALSE;
|
if (!found)
|
||||||
for (DWORD j = 0; j < glyphSet->cRanges && !found; j++) {
|
allFound = FALSE;
|
||||||
WCHAR first = glyphSet->ranges[j].wcLow;
|
|
||||||
WCHAR last = first + glyphSet->ranges[j].cGlyphs - 1;
|
|
||||||
|
|
||||||
if (wc >= first && wc <= last)
|
|
||||||
found = TRUE;
|
|
||||||
}
|
}
|
||||||
if (!found)
|
|
||||||
allFound = FALSE;
|
free(glyphSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(glyphSet);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectObject(hdc, oldFont);
|
SelectObject(hdc, oldFont);
|
||||||
ReleaseDC(NULL, hdc);
|
ReleaseDC(NULL, hdc);
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ static void __cdecl mswin_moveloop(void *);
|
|||||||
|
|
||||||
#define MAX_CMDLINE_PARAM 255
|
#define MAX_CMDLINE_PARAM 255
|
||||||
|
|
||||||
|
#pragma warning( push )
|
||||||
|
#pragma warning( disable : 28251)
|
||||||
int APIENTRY
|
int APIENTRY
|
||||||
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
||||||
int nCmdShow)
|
int nCmdShow)
|
||||||
@@ -246,6 +248,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma warning( pop )
|
||||||
|
|
||||||
PNHWinApp
|
PNHWinApp
|
||||||
GetNHApp(void)
|
GetNHApp(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
case WM_COMMAND: {
|
case WM_COMMAND: {
|
||||||
TCHAR wbuf2[BUFSZ];
|
TCHAR wbuf2[BUFSZ];
|
||||||
|
|
||||||
|
wbuf2[BUFSZ - 1] = '\0';
|
||||||
switch (LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
/* OK button was pressed */
|
/* OK button was pressed */
|
||||||
case IDOK:
|
case IDOK:
|
||||||
|
|||||||
+81
-65
@@ -383,7 +383,7 @@ MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
c = 0;
|
c = 0;
|
||||||
ZeroMemory(kbd_state, sizeof(kbd_state));
|
ZeroMemory(kbd_state, sizeof(kbd_state));
|
||||||
GetKeyboardState(kbd_state);
|
(void) GetKeyboardState(kbd_state);
|
||||||
|
|
||||||
if (ToAscii((UINT) wParam, (lParam >> 16) & 0xFF, kbd_state, &c, 0)) {
|
if (ToAscii((UINT) wParam, (lParam >> 16) & 0xFF, kbd_state, &c, 0)) {
|
||||||
NHEVENT_KBD(c & 0xFF);
|
NHEVENT_KBD(c & 0xFF);
|
||||||
@@ -922,16 +922,23 @@ onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
#ifdef ENHANCED_SYMBOLS
|
#ifdef ENHANCED_SYMBOLS
|
||||||
if (SYMHANDLING(H_UTF8)) {
|
if (SYMHANDLING(H_UTF8)) {
|
||||||
WCHAR *p_copy = (WCHAR *) GlobalLock(hglbCopy);
|
WCHAR *p_copy;
|
||||||
wcsncpy(p_copy, wp, len);
|
|
||||||
p_copy[len] = 0; // null character
|
if ((p_copy = (WCHAR *) GlobalLock(hglbCopy)) != 0) {
|
||||||
} else
|
wcsncpy(p_copy, wp, len);
|
||||||
|
p_copy[len] = 0; // null character
|
||||||
|
}
|
||||||
|
} else {
|
||||||
#endif
|
#endif
|
||||||
{
|
char *p_copy;
|
||||||
char *p_copy = (char *) GlobalLock(hglbCopy);
|
|
||||||
strncpy(p_copy, p, len);
|
if ((p_copy = (char *) GlobalLock(hglbCopy)) != 0) {
|
||||||
p_copy[len] = 0; // null character
|
strncpy(p_copy, p, len);
|
||||||
|
p_copy[len] = 0; // null character
|
||||||
|
}
|
||||||
|
#ifdef ENHANCED_SYMBOLS
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
GlobalUnlock(hglbCopy);
|
GlobalUnlock(hglbCopy);
|
||||||
|
|
||||||
#ifdef ENHANCED_SYMBOLS
|
#ifdef ENHANCED_SYMBOLS
|
||||||
@@ -1001,28 +1008,33 @@ onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
text = nh_compose_ascii_screenshot();
|
text = nh_compose_ascii_screenshot();
|
||||||
if (!text)
|
if (!text)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
tlen = strlen(text);
|
tlen = strlen(text);
|
||||||
wtext = (wchar_t *) malloc(tlen * sizeof(wchar_t));
|
wtext = (wchar_t *) malloc(tlen * sizeof(wchar_t));
|
||||||
if (!wtext)
|
if (wtext) {
|
||||||
panic("out of memory");
|
MultiByteToWideChar(NH_CODEPAGE, 0, text, -1, wtext, tlen);
|
||||||
MultiByteToWideChar(NH_CODEPAGE, 0, text, -1, wtext, tlen);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filename[SIZE(filename) - 1] = '\0';
|
||||||
pFile = _tfopen(filename, TEXT("wt+,ccs=UTF-8"));
|
pFile = _tfopen(filename, TEXT("wt+,ccs=UTF-8"));
|
||||||
if (!pFile) {
|
if (!pFile) {
|
||||||
TCHAR buf[4096];
|
TCHAR buf[4096];
|
||||||
_stprintf(buf, TEXT("Cannot open %s for writing!"), filename);
|
_stprintf(buf, TEXT("Cannot open %s for writing!"), filename);
|
||||||
NHMessageBox(hWnd, buf, MB_OK | MB_ICONERROR);
|
NHMessageBox(hWnd, buf, MB_OK | MB_ICONERROR);
|
||||||
free(text);
|
if (text)
|
||||||
free(wtext);
|
free(text);
|
||||||
|
if (wtext)
|
||||||
|
free(wtext);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite(wtext, tlen * sizeof(wchar_t), 1, pFile);
|
if (wtext) {
|
||||||
fclose(pFile);
|
fwrite(wtext, tlen * sizeof(wchar_t), 1, pFile);
|
||||||
free(text);
|
fclose(pFile);
|
||||||
free(wtext);
|
free(wtext);
|
||||||
|
}
|
||||||
|
if (text)
|
||||||
|
free(text);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case IDM_NHMODE: {
|
case IDM_NHMODE: {
|
||||||
@@ -1307,26 +1319,28 @@ nh_compose_ascii_screenshot(void)
|
|||||||
|
|
||||||
text =
|
text =
|
||||||
(PMSNHMsgGetText) malloc(sizeof(MSNHMsgGetText) + TEXT_BUFFER_SIZE);
|
(PMSNHMsgGetText) malloc(sizeof(MSNHMsgGetText) + TEXT_BUFFER_SIZE);
|
||||||
text->max_size =
|
if (text && retval) {
|
||||||
TEXT_BUFFER_SIZE
|
text->max_size =
|
||||||
- 1; /* make sure we always have 0 at the end of the buffer */
|
TEXT_BUFFER_SIZE
|
||||||
|
- 1; /* make sure we always have 0 at the end of the buffer */
|
||||||
|
|
||||||
ZeroMemory(text->buffer, TEXT_BUFFER_SIZE);
|
ZeroMemory(text->buffer, TEXT_BUFFER_SIZE);
|
||||||
SendMessage(mswin_hwnd_from_winid(WIN_MESSAGE), WM_MSNH_COMMAND,
|
SendMessage(mswin_hwnd_from_winid(WIN_MESSAGE), WM_MSNH_COMMAND,
|
||||||
(WPARAM) MSNH_MSG_GETTEXT, (LPARAM) text);
|
(WPARAM) MSNH_MSG_GETTEXT, (LPARAM) text);
|
||||||
strcpy(retval, text->buffer);
|
strcpy(retval, text->buffer);
|
||||||
|
|
||||||
ZeroMemory(text->buffer, TEXT_BUFFER_SIZE);
|
ZeroMemory(text->buffer, TEXT_BUFFER_SIZE);
|
||||||
SendMessage(mswin_hwnd_from_winid(WIN_MAP), WM_MSNH_COMMAND,
|
SendMessage(mswin_hwnd_from_winid(WIN_MAP), WM_MSNH_COMMAND,
|
||||||
(WPARAM) MSNH_MSG_GETTEXT, (LPARAM) text);
|
(WPARAM) MSNH_MSG_GETTEXT, (LPARAM) text);
|
||||||
strcat(retval, text->buffer);
|
strcat(retval, text->buffer);
|
||||||
|
|
||||||
ZeroMemory(text->buffer, TEXT_BUFFER_SIZE);
|
ZeroMemory(text->buffer, TEXT_BUFFER_SIZE);
|
||||||
SendMessage(mswin_hwnd_from_winid(WIN_STATUS), WM_MSNH_COMMAND,
|
SendMessage(mswin_hwnd_from_winid(WIN_STATUS), WM_MSNH_COMMAND,
|
||||||
(WPARAM) MSNH_MSG_GETTEXT, (LPARAM) text);
|
(WPARAM) MSNH_MSG_GETTEXT, (LPARAM) text);
|
||||||
strcat(retval, text->buffer);
|
strcat(retval, text->buffer);
|
||||||
|
|
||||||
free(text);
|
free(text);
|
||||||
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1346,40 +1360,42 @@ nh_compose_unicode_screenshot(void)
|
|||||||
|
|
||||||
text =
|
text =
|
||||||
(PMSNHMsgGetText) malloc(sizeof(MSNHMsgGetText) + TEXT_BUFFER_SIZE);
|
(PMSNHMsgGetText) malloc(sizeof(MSNHMsgGetText) + TEXT_BUFFER_SIZE);
|
||||||
text->max_size =
|
if (text && retval) {
|
||||||
TEXT_BUFFER_SIZE
|
text->max_size =
|
||||||
- 1; /* make sure we always have 0 at the end of the buffer */
|
TEXT_BUFFER_SIZE
|
||||||
|
- 1; /* make sure we always have 0 at the end of the buffer */
|
||||||
|
|
||||||
wtext =
|
wtext = (PMSNHMsgGetWideText) malloc(
|
||||||
(PMSNHMsgGetWideText) malloc(sizeof(MSNHMsgGetWideText)
|
sizeof(MSNHMsgGetWideText) + TEXT_BUFFER_SIZE * sizeof(WCHAR));
|
||||||
+ TEXT_BUFFER_SIZE * sizeof(WCHAR));
|
if (wtext) {
|
||||||
wtext->max_size =
|
wtext->max_size =
|
||||||
TEXT_BUFFER_SIZE
|
TEXT_BUFFER_SIZE
|
||||||
- 1; /* make sure we always have 0 at the end of the buffer */
|
- 1; /* make sure we always have 0 at the end of the buffer */
|
||||||
|
|
||||||
ZeroMemory(text->buffer, TEXT_BUFFER_SIZE);
|
ZeroMemory(text->buffer, TEXT_BUFFER_SIZE);
|
||||||
SendMessage(mswin_hwnd_from_winid(WIN_MESSAGE), WM_MSNH_COMMAND,
|
SendMessage(mswin_hwnd_from_winid(WIN_MESSAGE), WM_MSNH_COMMAND,
|
||||||
(WPARAM) MSNH_MSG_GETTEXT, (LPARAM) text);
|
(WPARAM) MSNH_MSG_GETTEXT, (LPARAM) text);
|
||||||
retsize += MultiByteToWideChar(CP_ACP, 0,
|
retsize += MultiByteToWideChar(
|
||||||
text->buffer, strlen(text->buffer),
|
CP_ACP, 0, text->buffer, strlen(text->buffer),
|
||||||
retval + retsize, max_size - retsize);
|
retval + retsize, max_size - retsize);
|
||||||
|
|
||||||
ZeroMemory(wtext->buffer, TEXT_BUFFER_SIZE * sizeof(WCHAR));
|
ZeroMemory(wtext->buffer, TEXT_BUFFER_SIZE * sizeof(WCHAR));
|
||||||
SendMessage(mswin_hwnd_from_winid(WIN_MAP), WM_MSNH_COMMAND,
|
SendMessage(mswin_hwnd_from_winid(WIN_MAP), WM_MSNH_COMMAND,
|
||||||
(WPARAM) MSNH_MSG_GETWIDETEXT, (LPARAM) wtext);
|
(WPARAM) MSNH_MSG_GETWIDETEXT, (LPARAM) wtext);
|
||||||
wcsncpy(retval + retsize, wtext->buffer, max_size - retsize - 1);
|
wcsncpy(retval + retsize, wtext->buffer, max_size - retsize - 1);
|
||||||
retsize += wcslen(retval + retsize);
|
retsize += wcslen(retval + retsize);
|
||||||
|
|
||||||
ZeroMemory(text->buffer, TEXT_BUFFER_SIZE);
|
ZeroMemory(text->buffer, TEXT_BUFFER_SIZE);
|
||||||
SendMessage(mswin_hwnd_from_winid(WIN_STATUS), WM_MSNH_COMMAND,
|
SendMessage(mswin_hwnd_from_winid(WIN_STATUS), WM_MSNH_COMMAND,
|
||||||
(WPARAM) MSNH_MSG_GETTEXT, (LPARAM) text);
|
(WPARAM) MSNH_MSG_GETTEXT, (LPARAM) text);
|
||||||
retsize += MultiByteToWideChar(CP_ACP, 0,
|
retsize += MultiByteToWideChar(
|
||||||
text->buffer, strlen(text->buffer),
|
CP_ACP, 0, text->buffer, strlen(text->buffer),
|
||||||
retval + retsize, max_size - retsize);
|
retval + retsize, max_size - retsize);
|
||||||
retval[retsize] = L'\0';
|
retval[retsize] = L'\0';
|
||||||
|
free(wtext);
|
||||||
free(text);
|
}
|
||||||
free(wtext);
|
free(text);
|
||||||
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+93
-75
@@ -283,21 +283,22 @@ MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
HDC hdc = GetDC(control);
|
HDC hdc = GetDC(control);
|
||||||
data = (PNHMenuWindow) malloc(sizeof(NHMenuWindow));
|
data = (PNHMenuWindow) malloc(sizeof(NHMenuWindow));
|
||||||
ZeroMemory(data, sizeof(NHMenuWindow));
|
if (data) {
|
||||||
data->type = MENU_TYPE_TEXT;
|
ZeroMemory(data, sizeof(NHMenuWindow));
|
||||||
data->how = PICK_NONE;
|
data->type = MENU_TYPE_TEXT;
|
||||||
data->result = 0;
|
data->how = PICK_NONE;
|
||||||
data->done = 0;
|
data->result = 0;
|
||||||
data->bmpChecked =
|
data->done = 0;
|
||||||
LoadBitmap(GetNHApp()->hApp, MAKEINTRESOURCE(IDB_MENU_SEL));
|
data->bmpChecked =
|
||||||
data->bmpCheckedCount =
|
LoadBitmap(GetNHApp()->hApp, MAKEINTRESOURCE(IDB_MENU_SEL));
|
||||||
LoadBitmap(GetNHApp()->hApp, MAKEINTRESOURCE(IDB_MENU_SEL_COUNT));
|
data->bmpCheckedCount = LoadBitmap(
|
||||||
data->bmpNotChecked =
|
GetNHApp()->hApp, MAKEINTRESOURCE(IDB_MENU_SEL_COUNT));
|
||||||
LoadBitmap(GetNHApp()->hApp, MAKEINTRESOURCE(IDB_MENU_UNSEL));
|
data->bmpNotChecked =
|
||||||
data->bmpDC = CreateCompatibleDC(hdc);
|
LoadBitmap(GetNHApp()->hApp, MAKEINTRESOURCE(IDB_MENU_UNSEL));
|
||||||
data->is_active = FALSE;
|
data->bmpDC = CreateCompatibleDC(hdc);
|
||||||
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) data);
|
data->is_active = FALSE;
|
||||||
|
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) data);
|
||||||
|
}
|
||||||
/* set font for the text cotrol */
|
/* set font for the text cotrol */
|
||||||
cached_font * font = mswin_get_font(NHW_MENU, ATR_NONE, hdc, FALSE);
|
cached_font * font = mswin_get_font(NHW_MENU, ATR_NONE, hdc, FALSE);
|
||||||
SendMessage(control, WM_SETFONT,
|
SendMessage(control, WM_SETFONT,
|
||||||
@@ -539,6 +540,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
RECT text_rt;
|
RECT text_rt;
|
||||||
HGDIOBJ saveFont;
|
HGDIOBJ saveFont;
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
|
TCHAR *was;
|
||||||
|
|
||||||
if (data->type != MENU_TYPE_TEXT)
|
if (data->type != MENU_TYPE_TEXT)
|
||||||
SetMenuType(hWnd, MENU_TYPE_TEXT);
|
SetMenuType(hWnd, MENU_TYPE_TEXT);
|
||||||
@@ -547,12 +549,17 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
text_size = strlen(msg_data->text) + 4;
|
text_size = strlen(msg_data->text) + 4;
|
||||||
data->menui.text.text =
|
data->menui.text.text =
|
||||||
(TCHAR *) malloc(text_size * sizeof(data->menui.text.text[0]));
|
(TCHAR *) malloc(text_size * sizeof(data->menui.text.text[0]));
|
||||||
ZeroMemory(data->menui.text.text,
|
if (data->menui.text.text)
|
||||||
text_size * sizeof(data->menui.text.text[0]));
|
ZeroMemory(data->menui.text.text,
|
||||||
|
text_size * sizeof(data->menui.text.text[0]));
|
||||||
} else {
|
} else {
|
||||||
|
was = data->menui.text.text;
|
||||||
|
|
||||||
text_size = _tcslen(data->menui.text.text) + strlen(msg_data->text) + 4;
|
text_size = _tcslen(data->menui.text.text) + strlen(msg_data->text) + 4;
|
||||||
data->menui.text.text = (TCHAR *) realloc(
|
data->menui.text.text = (TCHAR *) realloc(
|
||||||
data->menui.text.text, text_size * sizeof(data->menui.text.text[0]));
|
data->menui.text.text, text_size * sizeof(data->menui.text.text[0]));
|
||||||
|
if (!data->menui.text.text)
|
||||||
|
free(was); /* this is not a good situation, but not a leak either */
|
||||||
}
|
}
|
||||||
if (!data->menui.text.text)
|
if (!data->menui.text.text)
|
||||||
break;
|
break;
|
||||||
@@ -611,75 +618,86 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
if (data->menui.menu.size == data->menui.menu.allocated) {
|
if (data->menui.menu.size == data->menui.menu.allocated) {
|
||||||
|
PNHMenuItem was = data->menui.menu.items;
|
||||||
|
|
||||||
data->menui.menu.allocated += 10;
|
data->menui.menu.allocated += 10;
|
||||||
data->menui.menu.items = (PNHMenuItem) realloc(
|
data->menui.menu.items = (PNHMenuItem) realloc(
|
||||||
data->menui.menu.items, data->menui.menu.allocated * sizeof(NHMenuItem));
|
data->menui.menu.items, data->menui.menu.allocated * sizeof(NHMenuItem));
|
||||||
|
if (!data->menui.menu.items)
|
||||||
|
free(was);
|
||||||
}
|
}
|
||||||
|
|
||||||
new_item = data->menui.menu.size;
|
if (data->menui.menu.items) {
|
||||||
ZeroMemory(&data->menui.menu.items[new_item],
|
new_item = data->menui.menu.size;
|
||||||
sizeof(data->menui.menu.items[new_item]));
|
ZeroMemory(&data->menui.menu.items[new_item],
|
||||||
data->menui.menu.items[new_item].glyphinfo = msg_data->glyphinfo;
|
sizeof(data->menui.menu.items[new_item]));
|
||||||
data->menui.menu.items[new_item].identifier = *msg_data->identifier;
|
data->menui.menu.items[new_item].glyphinfo = msg_data->glyphinfo;
|
||||||
data->menui.menu.items[new_item].accelerator = msg_data->accelerator;
|
data->menui.menu.items[new_item].identifier =
|
||||||
data->menui.menu.items[new_item].group_accel = msg_data->group_accel;
|
*msg_data->identifier;
|
||||||
data->menui.menu.items[new_item].attr = msg_data->attr;
|
data->menui.menu.items[new_item].accelerator =
|
||||||
data->menui.menu.items[new_item].color = msg_data->color;
|
msg_data->accelerator;
|
||||||
strncpy(data->menui.menu.items[new_item].str, msg_data->str,
|
data->menui.menu.items[new_item].group_accel =
|
||||||
NHMENU_STR_SIZE);
|
msg_data->group_accel;
|
||||||
/* prevent & being interpreted as a mnemonic start */
|
data->menui.menu.items[new_item].attr = msg_data->attr;
|
||||||
strNsubst(data->menui.menu.items[new_item].str, "&", "&&", 0);
|
data->menui.menu.items[new_item].color = msg_data->color;
|
||||||
data->menui.menu.items[new_item].presel = msg_data->presel;
|
strncpy(data->menui.menu.items[new_item].str, msg_data->str,
|
||||||
data->menui.menu.items[new_item].itemflags = msg_data->itemflags;
|
NHMENU_STR_SIZE);
|
||||||
|
/* prevent & being interpreted as a mnemonic start */
|
||||||
|
strNsubst(data->menui.menu.items[new_item].str, "&", "&&", 0);
|
||||||
|
data->menui.menu.items[new_item].presel = msg_data->presel;
|
||||||
|
data->menui.menu.items[new_item].itemflags = msg_data->itemflags;
|
||||||
|
|
||||||
/* calculate tabstop size */
|
/* calculate tabstop size */
|
||||||
hDC = GetDC(hWnd);
|
hDC = GetDC(hWnd);
|
||||||
cached_font * font = mswin_get_font(NHW_MENU, msg_data->attr, hDC, FALSE);
|
cached_font *font =
|
||||||
saveFont = SelectObject(hDC, font->hFont);
|
mswin_get_font(NHW_MENU, msg_data->attr, hDC, FALSE);
|
||||||
GetTextMetrics(hDC, &tm);
|
saveFont = SelectObject(hDC, font->hFont);
|
||||||
p1 = data->menui.menu.items[new_item].str;
|
GetTextMetrics(hDC, &tm);
|
||||||
p = strchr(data->menui.menu.items[new_item].str, '\t');
|
p1 = data->menui.menu.items[new_item].str;
|
||||||
column = 0;
|
p = strchr(data->menui.menu.items[new_item].str, '\t');
|
||||||
for (;;) {
|
column = 0;
|
||||||
TCHAR wbuf[BUFSZ];
|
for (;;) {
|
||||||
RECT drawRect;
|
TCHAR wbuf[BUFSZ];
|
||||||
SetRect(&drawRect, 0, 0, 1, 1);
|
RECT drawRect;
|
||||||
if (p != NULL)
|
SetRect(&drawRect, 0, 0, 1, 1);
|
||||||
*p = '\0'; /* for time being, view tab field as zstring */
|
if (p != NULL)
|
||||||
DrawText(hDC, NH_A2W(p1, wbuf, BUFSZ), strlen(p1), &drawRect,
|
*p = '\0'; /* for time being, view tab field as zstring */
|
||||||
DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_EXPANDTABS
|
DrawText(hDC, NH_A2W(p1, wbuf, BUFSZ), strlen(p1), &drawRect,
|
||||||
| DT_SINGLELINE);
|
DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_EXPANDTABS
|
||||||
data->menui.menu.tab_stop_size[column] =
|
| DT_SINGLELINE);
|
||||||
max(data->menui.menu.tab_stop_size[column],
|
data->menui.menu.tab_stop_size[column] =
|
||||||
drawRect.right - drawRect.left);
|
max(data->menui.menu.tab_stop_size[column],
|
||||||
|
drawRect.right - drawRect.left);
|
||||||
|
|
||||||
menuitemwidth += data->menui.menu.tab_stop_size[column];
|
menuitemwidth += data->menui.menu.tab_stop_size[column];
|
||||||
|
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
*p = '\t';
|
*p = '\t';
|
||||||
else /* last string so, */
|
else /* last string so, */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* add the separation only when not the last item */
|
/* add the separation only when not the last item */
|
||||||
/* in the last item, we break out of the loop, in the statement
|
/* in the last item, we break out of the loop, in the
|
||||||
* just above */
|
* statement just above */
|
||||||
menuitemwidth += TAB_SEPARATION;
|
menuitemwidth += TAB_SEPARATION;
|
||||||
|
|
||||||
++column;
|
++column;
|
||||||
p1 = p + 1;
|
p1 = p + 1;
|
||||||
p = strchr(p1, '\t');
|
p = strchr(p1, '\t');
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectObject(hDC, saveFont);
|
||||||
|
ReleaseDC(hWnd, hDC);
|
||||||
|
|
||||||
|
/* calculate new menu width */
|
||||||
|
data->menui.menu.menu_cx =
|
||||||
|
max(data->menui.menu.menu_cx,
|
||||||
|
2 * TILE_X + menuitemwidth
|
||||||
|
+ (tm.tmAveCharWidth + tm.tmOverhang) * 12);
|
||||||
|
|
||||||
|
/* increment size */
|
||||||
|
data->menui.menu.size++;
|
||||||
}
|
}
|
||||||
SelectObject(hDC, saveFont);
|
|
||||||
ReleaseDC(hWnd, hDC);
|
|
||||||
|
|
||||||
/* calculate new menu width */
|
|
||||||
data->menui.menu.menu_cx =
|
|
||||||
max(data->menui.menu.menu_cx,
|
|
||||||
2 * TILE_X + menuitemwidth
|
|
||||||
+ (tm.tmAveCharWidth + tm.tmOverhang) * 12);
|
|
||||||
|
|
||||||
/* increment size */
|
|
||||||
data->menui.menu.size++;
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case MSNH_MSG_ENDMENU: {
|
case MSNH_MSG_ENDMENU: {
|
||||||
|
|||||||
@@ -647,6 +647,7 @@ onPaint(HWND hWnd)
|
|||||||
strcpy(tmptext, data->window_text[i].text);
|
strcpy(tmptext, data->window_text[i].text);
|
||||||
strip_newline(tmptext);
|
strip_newline(tmptext);
|
||||||
NH_A2W(tmptext, wbuf, sizeof(wbuf));
|
NH_A2W(tmptext, wbuf, sizeof(wbuf));
|
||||||
|
wbuf[SIZE(wbuf) - 1] = '\0';
|
||||||
wlen = _tcslen(wbuf);
|
wlen = _tcslen(wbuf);
|
||||||
setMsgTextColor(hdc, i < (MSG_LINES - data->lines_last_turn));
|
setMsgTextColor(hdc, i < (MSG_LINES - data->lines_last_turn));
|
||||||
#ifdef MSG_WRAP_TEXT
|
#ifdef MSG_WRAP_TEXT
|
||||||
|
|||||||
+9
-2
@@ -262,13 +262,20 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
text_size = strlen(msg_data->text) + 4;
|
text_size = strlen(msg_data->text) + 4;
|
||||||
data->window_text =
|
data->window_text =
|
||||||
(TCHAR *) malloc(text_size * sizeof(data->window_text[0]));
|
(TCHAR *) malloc(text_size * sizeof(data->window_text[0]));
|
||||||
ZeroMemory(data->window_text,
|
if (data->window_text) {
|
||||||
text_size * sizeof(data->window_text[0]));
|
ZeroMemory(data->window_text,
|
||||||
|
text_size * sizeof(data->window_text[0]));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
TCHAR *was = data->window_text;
|
||||||
|
|
||||||
text_size =
|
text_size =
|
||||||
_tcslen(data->window_text) + strlen(msg_data->text) + 4;
|
_tcslen(data->window_text) + strlen(msg_data->text) + 4;
|
||||||
data->window_text = (TCHAR *) realloc(
|
data->window_text = (TCHAR *) realloc(
|
||||||
data->window_text, text_size * sizeof(data->window_text[0]));
|
data->window_text, text_size * sizeof(data->window_text[0]));
|
||||||
|
if (!data->window_text) {
|
||||||
|
free(was);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!data->window_text)
|
if (!data->window_text)
|
||||||
break;
|
break;
|
||||||
|
|||||||
+9
-2
@@ -198,13 +198,20 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
text_size = strlen(msg_data->text) + 4;
|
text_size = strlen(msg_data->text) + 4;
|
||||||
data->window_text =
|
data->window_text =
|
||||||
(TCHAR *) malloc(text_size * sizeof(data->window_text[0]));
|
(TCHAR *) malloc(text_size * sizeof(data->window_text[0]));
|
||||||
ZeroMemory(data->window_text,
|
if (data->window_text) {
|
||||||
text_size * sizeof(data->window_text[0]));
|
ZeroMemory(data->window_text,
|
||||||
|
text_size * sizeof(data->window_text[0]));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
TCHAR *was = data->window_text;
|
||||||
|
|
||||||
text_size =
|
text_size =
|
||||||
_tcslen(data->window_text) + strlen(msg_data->text) + 4;
|
_tcslen(data->window_text) + strlen(msg_data->text) + 4;
|
||||||
data->window_text = (TCHAR *) realloc(
|
data->window_text = (TCHAR *) realloc(
|
||||||
data->window_text, text_size * sizeof(data->window_text[0]));
|
data->window_text, text_size * sizeof(data->window_text[0]));
|
||||||
|
if (!data->window_text) {
|
||||||
|
free(was);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!data->window_text)
|
if (!data->window_text)
|
||||||
break;
|
break;
|
||||||
|
|||||||
+36
-23
@@ -12,7 +12,7 @@
|
|||||||
#include "dlb.h"
|
#include "dlb.h"
|
||||||
#include "func_tab.h" /* for extended commands */
|
#include "func_tab.h" /* for extended commands */
|
||||||
#include "winMS.h"
|
#include "winMS.h"
|
||||||
#include <assert.h>
|
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
#include "mhmap.h"
|
#include "mhmap.h"
|
||||||
#include "mhstatus.h"
|
#include "mhstatus.h"
|
||||||
@@ -1031,11 +1031,17 @@ mswin_putstr_ex(winid wid, int attr, const char *text, int app)
|
|||||||
/* yield a bit so it gets done immediately */
|
/* yield a bit so it gets done immediately */
|
||||||
mswin_get_nh_event();
|
mswin_get_nh_event();
|
||||||
} else {
|
} else {
|
||||||
|
char *was = GetNHApp()->saved_text;
|
||||||
|
|
||||||
// build text to display later in message box
|
// build text to display later in message box
|
||||||
GetNHApp()->saved_text =
|
GetNHApp()->saved_text =
|
||||||
realloc(GetNHApp()->saved_text,
|
realloc(GetNHApp()->saved_text,
|
||||||
strlen(text) + strlen(GetNHApp()->saved_text) + 1);
|
strlen(text) + strlen(GetNHApp()->saved_text) + 1);
|
||||||
strcat(GetNHApp()->saved_text, text);
|
if (!GetNHApp()->saved_text) {
|
||||||
|
free(was);
|
||||||
|
} else {
|
||||||
|
strcat(GetNHApp()->saved_text, text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2109,15 +2115,17 @@ mswin_getmsghistory(boolean init)
|
|||||||
if (init) {
|
if (init) {
|
||||||
text = (PMSNHMsgGetText) malloc(sizeof(MSNHMsgGetText)
|
text = (PMSNHMsgGetText) malloc(sizeof(MSNHMsgGetText)
|
||||||
+ TEXT_BUFFER_SIZE);
|
+ TEXT_BUFFER_SIZE);
|
||||||
text->max_size =
|
if (text) {
|
||||||
TEXT_BUFFER_SIZE
|
text->max_size =
|
||||||
- 1; /* make sure we always have 0 at the end of the buffer */
|
TEXT_BUFFER_SIZE
|
||||||
|
- 1; /* make sure we always have 0 at the end of the buffer */
|
||||||
|
|
||||||
ZeroMemory(text->buffer, TEXT_BUFFER_SIZE);
|
ZeroMemory(text->buffer, TEXT_BUFFER_SIZE);
|
||||||
SendMessage(mswin_hwnd_from_winid(WIN_MESSAGE), WM_MSNH_COMMAND,
|
SendMessage(mswin_hwnd_from_winid(WIN_MESSAGE), WM_MSNH_COMMAND,
|
||||||
(WPARAM) MSNH_MSG_GETTEXT, (LPARAM) text);
|
(WPARAM) MSNH_MSG_GETTEXT, (LPARAM) text);
|
||||||
|
|
||||||
next_message = text->buffer;
|
next_message = text->buffer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(next_message && next_message[0])) {
|
if (!(next_message && next_message[0])) {
|
||||||
@@ -2725,27 +2733,29 @@ mswin_color_from_string(char *colorstring, HBRUSH *brushptr,
|
|||||||
- hexadecimals);
|
- hexadecimals);
|
||||||
++colorstring;
|
++colorstring;
|
||||||
red_value *= 16;
|
red_value *= 16;
|
||||||
red_value += (int) (strchr(hexadecimals, tolower((uchar) *colorstring))
|
red_value +=
|
||||||
- hexadecimals);
|
(int) (strchr(hexadecimals, tolower((uchar) *colorstring))
|
||||||
|
- hexadecimals);
|
||||||
++colorstring;
|
++colorstring;
|
||||||
|
|
||||||
green_value = (int) (strchr(hexadecimals,
|
green_value =
|
||||||
tolower((uchar) *colorstring))
|
(int) (strchr(hexadecimals, tolower((uchar) *colorstring))
|
||||||
- hexadecimals);
|
- hexadecimals);
|
||||||
++colorstring;
|
++colorstring;
|
||||||
green_value *= 16;
|
green_value *= 16;
|
||||||
green_value += (int) (strchr(hexadecimals,
|
green_value +=
|
||||||
tolower((uchar) *colorstring))
|
(int) (strchr(hexadecimals, tolower((uchar) *colorstring))
|
||||||
- hexadecimals);
|
- hexadecimals);
|
||||||
++colorstring;
|
++colorstring;
|
||||||
|
|
||||||
blue_value = (int) (strchr(hexadecimals, tolower((uchar) *colorstring))
|
blue_value =
|
||||||
- hexadecimals);
|
(int) (strchr(hexadecimals, tolower((uchar) *colorstring))
|
||||||
|
- hexadecimals);
|
||||||
++colorstring;
|
++colorstring;
|
||||||
blue_value *= 16;
|
blue_value *= 16;
|
||||||
blue_value += (int) (strchr(hexadecimals,
|
blue_value +=
|
||||||
tolower((uchar) *colorstring))
|
(int) (strchr(hexadecimals, tolower((uchar) *colorstring))
|
||||||
- hexadecimals);
|
- hexadecimals);
|
||||||
++colorstring;
|
++colorstring;
|
||||||
|
|
||||||
*colorptr = RGB(red_value, green_value, blue_value);
|
*colorptr = RGB(red_value, green_value, blue_value);
|
||||||
@@ -2768,7 +2778,10 @@ mswin_color_from_string(char *colorstring, HBRUSH *brushptr,
|
|||||||
if (max_brush > TOTAL_BRUSHES)
|
if (max_brush > TOTAL_BRUSHES)
|
||||||
panic("Too many colors!");
|
panic("Too many colors!");
|
||||||
*brushptr = CreateSolidBrush(*colorptr);
|
*brushptr = CreateSolidBrush(*colorptr);
|
||||||
brush_table[max_brush++] = *brushptr;
|
if (IndexOk(max_brush, brush_table)) {
|
||||||
|
brush_table[max_brush] = *brushptr;
|
||||||
|
max_brush++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user