X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwinboard.c;h=5fda158df19302c1f1f4db892266a5f91c715d63;hb=2249ff4080c7a199089e97b80539ad794ca6ba7c;hp=bcd0c9ca37434402af6e488b05a9d54fec25ca6f;hpb=a5acdedf686f954492492595b327089f15de76a0;p=xboard.git diff --git a/winboard/winboard.c b/winboard/winboard.c index bcd0c9c..5fda158 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -8099,12 +8099,15 @@ LRESULT CALLBACK ConsoleWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { static SnapData sd; - static HWND hText, hInput /*, hFocus*/; -// InputSource *is = consoleInputSource; + HWND hText, hInput; RECT rect; static int sizeX, sizeY; int newSizeX, newSizeY; MINMAXINFO *mmi; + WORD wMask; + + hText = GetDlgItem(hDlg, OPT_ConsoleText); + hInput = GetDlgItem(hDlg, OPT_ConsoleInput); switch (message) { case WM_NOTIFY: @@ -8113,21 +8116,18 @@ ConsoleWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) ENLINK *pLink = (ENLINK*)lParam; if (pLink->msg == WM_LBUTTONUP) { - TEXTRANGE tr; - - tr.chrg = pLink->chrg; - tr.lpstrText = malloc(1+tr.chrg.cpMax-tr.chrg.cpMin); - hText = GetDlgItem(hDlg, OPT_ConsoleText); - SendMessage(hText, EM_GETTEXTRANGE, 0, (LPARAM)&tr); - ShellExecute(NULL, "open", tr.lpstrText, NULL, NULL, SW_SHOW); - free(tr.lpstrText); + TEXTRANGE tr; + + tr.chrg = pLink->chrg; + tr.lpstrText = malloc(1+tr.chrg.cpMax-tr.chrg.cpMin); + SendMessage(hText, EM_GETTEXTRANGE, 0, (LPARAM)&tr); + ShellExecute(NULL, "open", tr.lpstrText, NULL, NULL, SW_SHOW); + free(tr.lpstrText); } } break; case WM_INITDIALOG: /* message: initialize dialog box */ hwndConsole = hDlg; - hText = GetDlgItem(hDlg, OPT_ConsoleText); - hInput = GetDlgItem(hDlg, OPT_ConsoleInput); SetFocus(hInput); consoleTextWindowProc = (WNDPROC) SetWindowLong(hText, GWL_WNDPROC, (LONG) ConsoleTextSubclass); @@ -8175,6 +8175,11 @@ ConsoleWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) SetWindowPlacement(hDlg, &wp); } + // Allow hText to highlight URLs and send notifications on them + wMask = SendMessage(hText, EM_GETEVENTMASK, 0, 0L); + SendMessage(hText, EM_SETEVENTMASK, 0, wMask | ENM_LINK); + SendMessage(hText, EM_AUTOURLDETECT, TRUE, 0L); + return FALSE; case WM_SETFOCUS: @@ -8244,18 +8249,10 @@ ConsoleWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) VOID ConsoleCreate() { - HWND hCons, hText; - WORD wMask; + HWND hCons; if (hwndConsole) return; hCons = CreateDialog(hInst, szConsoleName, 0, NULL); SendMessage(hCons, WM_INITDIALOG, 0, 0); - - - // make the text item in the console do URL links - hText = GetDlgItem(hCons, OPT_ConsoleText); - wMask = SendMessage(hText, EM_GETEVENTMASK, 0, 0L); - SendMessage(hText, EM_SETEVENTMASK, 0, wMask | ENM_LINK); - SendMessage(hText, EM_AUTOURLDETECT, TRUE, 0L); }