X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwchat.c;h=3be1e7f7d33d2bb1dd196b8191470c2a97d8c083;hb=6341a1e8f282d099affed789a69bad4660fe9cdc;hp=8d53d7c70c70168ca9cf292c9f5b8cb229a20f56;hpb=187622c7a66834db1b980750e5fe513696308c20;p=xboard.git diff --git a/winboard/wchat.c b/winboard/wchat.c index 8d53d7c..3be1e7f 100644 --- a/winboard/wchat.c +++ b/winboard/wchat.c @@ -3,7 +3,8 @@ * * Author: H.G.Muller (August 2009) * - * Copyright 2009, 2010 Free Software Foundation, Inc. + * Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free + * Software Foundation, Inc. * * ------------------------------------------------------------------------ * @@ -32,6 +33,7 @@ #include #include #include +#include #include "common.h" #include "frontend.h" @@ -41,6 +43,7 @@ #include "wsnap.h" int chatCount; +static int onTop; extern char chatPartner[MAX_CHAT][MSG_SIZ]; HANDLE chatHandle[MAX_CHAT]; static WNDPROC chatInputWindowProc; @@ -59,9 +62,11 @@ char *NextInHistory(); extern HWND ChatDialog; extern HINSTANCE hInst; -extern HWND hwndMain; +extern HWND hwndConsole; +extern char ics_handle[]; extern WindowPlacement wpChat[MAX_CHAT]; +extern WindowPlacement wpConsole; extern BoardSize boardSize; @@ -177,7 +182,7 @@ LRESULT CALLBACK ChatProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam { static SnapData sd; char buf[MSG_SIZ], mess[MSG_SIZ]; - int partner = -1, i; + int partner = -1, i, x, y; static BOOL filterHasFocus[MAX_CHAT]; WORD wMask; HWND hMemo; @@ -186,16 +191,28 @@ LRESULT CALLBACK ChatProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam switch (message) { case WM_INITDIALOG: + Translate(hDlg, DLG_Chat); if(partner<0) { for(i=0; ipartner), chatPartner[i]); + } else EnableWindow( GetDlgItem(hDlg, IDC_Focus1+i-(i>partner)), 0 ); + for(i=0; i is pressed while editing the filter, it's better to apply the filter rather than selecting the current game. @@ -250,12 +267,9 @@ LRESULT CALLBACK ChatProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam switch (LOWORD(wParam)) { - case IDCANCEL: - chatHandle[partner] = 0; - chatPartner[partner][0] = 0; - ChatPopDown(); - EndDialog(hDlg, TRUE); - break; + case IDCANCEL: /* let Esc key switch focus back to console */ + SetFocus(GetDlgItem(hwndConsole, OPT_ConsoleInput)); + break; case IDC_Clear: SendMessage( GetDlgItem(hDlg, IDC_ChatMemo), WM_SETTEXT, 0, (LPARAM) "" ); @@ -263,6 +277,10 @@ LRESULT CALLBACK ChatProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam case IDC_Change: GetDlgItemText(hDlg, IDC_ChatPartner, chatPartner[partner], MSG_SIZ); + for(i=0; i %s\r\n", mess); // echo only tells to handle, not channel + snprintf(buf, MSG_SIZ, "> %s\r\n", mess); // echo only tells to handle, not channel InsertIntoMemo(hDlg, buf); - sprintf(buf, "xtell %s %s\n", chatPartner[partner], mess); + snprintf(buf, MSG_SIZ, "xtell %s %s\n", chatPartner[partner], mess); } else - sprintf(buf, "tell %s %s\n", chatPartner[partner], mess); + snprintf(buf, MSG_SIZ, "tell %s %s\n", chatPartner[partner], mess); } SendToICS(buf); break; + case IDC_Focus1: + case IDC_Focus2: + case IDC_Focus3: + case IDC_Focus4: + i = LOWORD(wParam) - IDC_Focus1; + if(i >= partner) i++; + onTop = i; + SetFocus(GetDlgItem(hDlg, IDC_Send)); + if(chatHandle[i]) { + int j; + for(j=0; j