From 6c92eea125ea6ca96115f7b172d64a4e06ae7221 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Fri, 12 Feb 2010 22:35:11 +0100 Subject: [PATCH] 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. --- winboard/wchat.c | 23 +++++++++++++++++++++++ winboard/winboard.rc | 2 +- 2 files changed, 24 insertions(+), 1 deletions(-) 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 -- 1.7.0.4