{ "firstNPS", ArgInt, (LPVOID) &appData.firstNPS, FALSE },\r
{ "secondNPS", ArgInt, (LPVOID) &appData.secondNPS, FALSE },\r
{ "noGUI", ArgTrue, (LPVOID) &appData.noGUI, FALSE },\r
+ { "keepLineBreaksICS", ArgBoolean, (LPVOID) &appData.noJoin, TRUE },\r
\r
// [HGM] placement: put all window layouts last in ini file, but man X,Y before all others\r
{ "minX", ArgZ, (LPVOID) &minX, FALSE }, // [HGM] placement: to make suer auxialary windows can be placed\r
GetDIBits(tmphdc,bufferBitmap,0,b.bmHeight,pData,(BITMAPINFO*)&bih,DIB_RGB_COLORS);\r
// fprintf(diagFile, "%8x\n", (int) pData);\r
\r
-#if 1\r
wb = b.bmWidthBytes;\r
// count colors\r
for(i=0; i<wb*(b.bmHeight - boardRect.top + OUTER_MARGIN)>>2; i++) {\r
// write bitmap data\r
for(i=0; i<wb*(b.bmHeight - boardRect.top + OUTER_MARGIN); i++) \r
fputc(pData[i], diagFile);\r
-#endif\r
}\r
}\r
\r
}\r
}\r
\r
+void UpdateICSWidth(HWND hText)\r
+{\r
+ HDC hdc;\r
+ TEXTMETRIC tm;\r
+ RECT rc;\r
+ HFONT hfont, hold_font;\r
+ LONG old_width, new_width;\r
+ \r
+ // get the text metrics\r
+ hdc = GetDC(hText);\r
+ hfont = CreateFontIndirect(&font[boardSize][CONSOLE_FONT]->lf);\r
+ hold_font = SelectObject(hdc, hfont);\r
+ GetTextMetrics(hdc, &tm);\r
+ SelectObject(hdc, hold_font);\r
+ DeleteObject(hfont);\r
+ ReleaseDC(hText, hdc);\r
+\r
+ // get the rectangle\r
+ SendMessage(hText, EM_GETRECT, 0, (LPARAM)&rc);\r
+\r
+ // update the width\r
+ new_width = (rc.right-rc.left) / tm.tmAveCharWidth;\r
+ old_width = GetWindowLong(hText, GWL_USERDATA);\r
+ if (new_width != old_width)\r
+ {\r
+ ics_update_width(new_width);\r
+ SetWindowLong(hText, GWL_USERDATA, new_width);\r
+ }\r
+}\r
+\r
VOID\r
ChangedConsoleFont()\r
{\r
paraf.dxOffset = WRAP_INDENT;\r
SendMessage(hText, EM_SETPARAFORMAT, 0, (LPARAM) ¶f);\r
SendMessage(hText, EM_EXSETSEL, 0, (LPARAM)&sel);\r
+ UpdateICSWidth(hText);\r
}\r
\r
/*---------------------------------------------------------------------------*\\r
ConsoleWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\r
{\r
static SnapData sd;\r
- static HWND hText, hInput /*, hFocus*/;\r
-// InputSource *is = consoleInputSource;\r
+ HWND hText, hInput;\r
RECT rect;\r
static int sizeX, sizeY;\r
int newSizeX, newSizeY;\r
MINMAXINFO *mmi;\r
+ WORD wMask;\r
+\r
+ hText = GetDlgItem(hDlg, OPT_ConsoleText);\r
+ hInput = GetDlgItem(hDlg, OPT_ConsoleInput);\r
\r
switch (message) {\r
case WM_NOTIFY:\r
ENLINK *pLink = (ENLINK*)lParam;\r
if (pLink->msg == WM_LBUTTONUP)\r
{\r
- TEXTRANGE tr;\r
-\r
- tr.chrg = pLink->chrg;\r
- tr.lpstrText = malloc(1+tr.chrg.cpMax-tr.chrg.cpMin);\r
- hText = GetDlgItem(hDlg, OPT_ConsoleText);\r
- SendMessage(hText, EM_GETTEXTRANGE, 0, (LPARAM)&tr);\r
- ShellExecute(NULL, "open", tr.lpstrText, NULL, NULL, SW_SHOW);\r
- free(tr.lpstrText);\r
+ TEXTRANGE tr;\r
+\r
+ tr.chrg = pLink->chrg;\r
+ tr.lpstrText = malloc(1+tr.chrg.cpMax-tr.chrg.cpMin);\r
+ SendMessage(hText, EM_GETTEXTRANGE, 0, (LPARAM)&tr);\r
+ ShellExecute(NULL, "open", tr.lpstrText, NULL, NULL, SW_SHOW);\r
+ free(tr.lpstrText);\r
}\r
}\r
break;\r
case WM_INITDIALOG: /* message: initialize dialog box */\r
hwndConsole = hDlg;\r
- hText = GetDlgItem(hDlg, OPT_ConsoleText);\r
- hInput = GetDlgItem(hDlg, OPT_ConsoleInput);\r
SetFocus(hInput);\r
consoleTextWindowProc = (WNDPROC)\r
SetWindowLong(hText, GWL_WNDPROC, (LONG) ConsoleTextSubclass);\r
wp.rcNormalPosition.bottom = wpConsole.y + wpConsole.height;\r
SetWindowPlacement(hDlg, &wp);\r
}\r
-#if 1\r
+\r
// [HGM] Chessknight's change 2004-07-13\r
else { /* Determine Defaults */\r
WINDOWPLACEMENT wp;\r
wp.rcNormalPosition.bottom = wpConsole.y + wpConsole.height;\r
SetWindowPlacement(hDlg, &wp);\r
}\r
-#endif\r
+\r
+ // Allow hText to highlight URLs and send notifications on them\r
+ wMask = SendMessage(hText, EM_GETEVENTMASK, 0, 0L);\r
+ SendMessage(hText, EM_SETEVENTMASK, 0, wMask | ENM_LINK);\r
+ SendMessage(hText, EM_AUTOURLDETECT, TRUE, 0L);\r
+ SetWindowLong(hText, GWL_USERDATA, 79); // initialize the text window's width\r
+\r
return FALSE;\r
\r
case WM_SETFOCUS:\r
return OnMoving( &sd, hDlg, wParam, lParam );\r
\r
case WM_EXITSIZEMOVE:\r
+ UpdateICSWidth(hText);\r
return OnExitSizeMove( &sd, hDlg, wParam, lParam );\r
}\r
\r
VOID\r
ConsoleCreate()\r
{\r
- HWND hCons, hText;\r
- WORD wMask;\r
+ HWND hCons;\r
if (hwndConsole) return;\r
hCons = CreateDialog(hInst, szConsoleName, 0, NULL);\r
SendMessage(hCons, WM_INITDIALOG, 0, 0);\r
-\r
-\r
- // make the text item in the console do URL links\r
- hText = GetDlgItem(hCons, OPT_ConsoleText);\r
- wMask = SendMessage(hText, EM_GETEVENTMASK, 0, 0L);\r
- SendMessage(hText, EM_SETEVENTMASK, 0, wMask | ENM_LINK);\r
- SendMessage(hText, EM_AUTOURLDETECT, TRUE, 0L);\r
}\r
\r
\r
HDCDrawPosition(NULL, (BOOLEAN) fullRedraw, board); \r
}\r
\r
+void NotifyFrontendLogin()\r
+{\r
+ if (hwndConsole)\r
+ UpdateICSWidth(GetDlgItem(hwndConsole, OPT_ConsoleText));\r
+}\r
\r
VOID\r
ResetFrontEnd()\r