HANDLE chatHandle[MAX_CHAT];\r
\r
void SendToICS P((char *s));\r
-void ChatPopUp();\r
+void ChatPopUp P((char *s));\r
void ChatPopDown();\r
\r
/* Imports from backend.c */\r
sprintf(buf, "Chat Window %s", first.tidy);\r
SetWindowText(hDlg, buf);\r
}\r
- chatPartner[partner][0] = 0;\r
- filterHasFocus[partner] = FALSE;\r
-\r
+// chatPartner[partner][0] = 0;\r
+ SendMessage( GetDlgItem(hDlg, IDC_ChatPartner), // [HGM] clickbox: initialize with requested handle\r
+ WM_SETTEXT, 0, (LPARAM) chatPartner[partner] );\r
+ filterHasFocus[partner] = TRUE;\r
+ if(chatPartner[partner][0]) {\r
+ filterHasFocus[partner] = FALSE;\r
+ SetFocus( GetDlgItem(hDlg, OPT_ChatInput) );\r
+ }\r
return FALSE;\r
\r
case WM_COMMAND:\r
}\r
\r
// front end\r
-void ChatPopUp()\r
+void ChatPopUp(char *icsHandle)\r
{\r
FARPROC lpProc;\r
+ int i, partner = -1;\r
\r
if(chatCount >= MAX_CHAT) return;\r
\r
CheckMenuItem(GetMenu(hwndMain), IDM_NewChat, MF_CHECKED);\r
+ for(i=0; i<MAX_CHAT; i++) if(chatHandle[i] == NULL) { partner = i; break; }\r
+ if(partner == -1) { DisplayError("No chat box available", 0); return; }\r
+ if(icsHandle) // [HGM] clickbox set handle in advance\r
+ strcpy(chatPartner[partner], icsHandle);\r
+ else chatPartner[partner][0] = NULLCHAR;\r
chatCount++;\r
\r
lpProc = MakeProcInstance( (FARPROC) ChatProc, hInst );\r
void AnimateAtomicCapture(int fromX, int fromY, int toX, int toY, int nFrames);\r
void DisplayMove P((int moveNumber));\r
Boolean ParseFEN P((Board board, int *blackPlaysFirst, char *fen));\r
-void ChatPopUp P(());\r
+void ChatPopUp P((char *s));\r
typedef struct {\r
ChessSquare piece; \r
POINT pos; /* window coordinates of current pos */\r
break;\r
\r
case IDM_NewChat:\r
- ChatPopUp();\r
+ ChatPopUp(NULL);\r
break;\r
\r
case IDM_CopyPosition:\r
SetWindowText(hInput, buf);\r
SendMessage(hInput, WM_CHAR, '\r', 0);\r
} else {\r
+ if(!strcmp(command, "chat")) { ChatPopUp(name); return; }\r
sprintf(buf, "%s %s ", command, name); /* trailing space */\r
SetWindowText(hInput, buf);\r
sel.cpMin = 999999;\r