From: H.G. Muller Date: Fri, 12 Feb 2010 21:35:11 +0000 (+0100) Subject: Make WB Chat Boxes wrap and handle URLs X-Git-Tag: master-20100221~17 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=6c92eea125ea6ca96115f7b172d64a4e06ae7221;p=xboard.git Make WB Chat Boxes wrap and handle URLs Cloned the code for the console text field to hande URL. (Initialization to recogize the link, and notifiction to open it when clicked.) Removed the ES_AUTOHSCROLL style from the RichEdit in the resource. --- diff --git a/winboard/wchat.c b/winboard/wchat.c index b02e00e..e1f43cf 100644 --- a/winboard/wchat.c +++ b/winboard/wchat.c @@ -139,6 +139,8 @@ LRESULT CALLBACK ChatProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam char buf[MSG_SIZ], mess[MSG_SIZ]; int partner = -1, i; static BOOL filterHasFocus[MAX_CHAT]; + WORD wMask; + HWND hMemo; for(i=0; icode == EN_LINK) + { + 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); + SendMessage( GetDlgItem(hDlg, IDC_ChatMemo), EM_GETTEXTRANGE, 0, (LPARAM)&tr); + ShellExecute(NULL, "open", tr.lpstrText, NULL, NULL, SW_SHOW); + free(tr.lpstrText); + } + } + break; + case WM_COMMAND: /* [AS] diff --git a/winboard/winboard.rc b/winboard/winboard.rc index f0126ea..15d94dc 100644 --- a/winboard/winboard.rc +++ b/winboard/winboard.rc @@ -835,7 +835,7 @@ BEGIN PUSHBUTTON "Clear",IDC_Clear,198,3,25,13 DEFPUSHBUTTON "Send",IDC_Send,228,3,25,13 CONTROL "",IDC_ChatMemo,"RICHEDIT",ES_MULTILINE | ES_READONLY | - ES_AUTOVSCROLL | ES_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | + ES_AUTOVSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,3,17,250,70 CONTROL "",OPT_ChatInput,"RICHEDIT",ES_AUTOHSCROLL | ES_NOHIDESEL | WS_BORDER | WS_TABSTOP,3,90,250,13