X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwchat.c;h=2886b42348ffe5f032d99edc0eab490f4d52443e;hb=b9d21ac5e9699a398501917533c3d5c8d2295283;hp=0fd5e08b2282de6ab9c0771396cf34e69c7998f5;hpb=18fc21bfe47cf80d294fffc22eb00d7f4384cd62;p=xboard.git diff --git a/winboard/wchat.c b/winboard/wchat.c index 0fd5e08..2886b42 100644 --- a/winboard/wchat.c +++ b/winboard/wchat.c @@ -32,8 +32,8 @@ #include #include "common.h" -#include "winboard.h" #include "frontend.h" +#include "winboard.h" #include "backend.h" #include "wsnap.h" @@ -99,9 +99,7 @@ static void ResizeWindowControls( HWND hDlg ) int clientHeight; int maxControlWidth; int buttonWidth, buttonHeight; -#if 0 -} -#else + /* Initialize variables */ GetClientRect( hDlg, &rc ); @@ -121,7 +119,6 @@ static void ResizeWindowControls( HWND hDlg ) // InvalidateRect( GetDlgItem(hDlg,IDC_EngineMemo1), NULL, FALSE ); // InvalidateRect( GetDlgItem(hDlg,IDC_EngineMemo2), NULL, FALSE ); } -#endif // front end. Actual printing of PV lines into the output field static void InsertIntoMemo( HANDLE hDlg, char * text ) @@ -140,6 +137,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; + static BOOL filterHasFocus[MAX_CHAT]; for(i=0; i is pressed while editing the filter, it's better to apply + the filter rather than selecting the current game. + */ + if( LOWORD(wParam) == IDC_ChatPartner ) { + switch( HIWORD(wParam) ) { + case EN_SETFOCUS: + filterHasFocus[partner] = TRUE; + break; + case EN_KILLFOCUS: + filterHasFocus[partner] = FALSE; + break; + } + } + + if( filterHasFocus[partner] && (LOWORD(wParam) == IDC_Send) ) { + SetFocus(GetDlgItem(hDlg, OPT_ChatInput)); + wParam = IDC_Change; + } + /* [AS] End command replacement */ + switch (LOWORD(wParam)) { case IDCANCEL: @@ -177,11 +198,16 @@ LRESULT CALLBACK ChatProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam GetDlgItemText(hDlg, OPT_ChatInput, mess, MSG_SIZ); SetDlgItemText(hDlg, OPT_ChatInput, ""); // from here on it could be back-end - if(strcmp("WHISPER", chatPartner[partner])) { - sprintf(buf, "> %s\n", mess); // echo only tells, not whispers + if(!strcmp("WHISPER", chatPartner[partner])) + sprintf(buf, "whisper %s\n", mess); // WHISPER box uses "whisper" to send + else { + if(!atoi(chatPartner[partner])) { + sprintf(buf, "> %s\n", mess); // echo only tells to handle, not channel InsertIntoMemo(hDlg, buf); + sprintf(buf, "xtell %s %s\n", chatPartner[partner], mess); + } else sprintf(buf, "tell %s %s\n", chatPartner[partner], mess); - } else sprintf(buf, "whisper %s\n", mess); // SAY box uses "say" to send + } SendToICS(buf); break;