extern WindowPlacement wpTags;
// [HGM] chat
-#define MAX_CHAT 3
+#define MAX_CHAT 5
extern int chatCount;
extern char chatPartner[MAX_CHAT][MSG_SIZ];
#define IDC_Clear 1725\r
#define IDC_Send 1726\r
#define IDM_NewChat 1727\r
+#define IDC_Focus1 1730\r
+#define IDC_Focus2 1731\r
+#define IDC_Focus3 1732\r
+#define IDC_Focus4 1733\r
#define IDC_SPECIFY_ENG_STATIC 1814\r
#define IDC_SPECIFY_SERVER_STATIC 1815\r
#define OPT_MESS 1818\r
#include <malloc.h>\r
#include <commdlg.h>\r
#include <dlgs.h>\r
+#include <Windowsx.h>\r
\r
#include "common.h"\r
#include "frontend.h"\r
#include "wsnap.h"\r
\r
int chatCount;\r
+static int onTop;\r
extern char chatPartner[MAX_CHAT][MSG_SIZ];\r
HANDLE chatHandle[MAX_CHAT];\r
static WNDPROC chatInputWindowProc;\r
extern HWND hwndMain;\r
\r
extern WindowPlacement wpChat[MAX_CHAT];\r
+extern WindowPlacement wpConsole;\r
\r
extern BoardSize boardSize;\r
\r
sprintf(buf, "Chat Window %s", first.tidy);\r
SetWindowText(hDlg, buf);\r
}\r
-// chatPartner[partner][0] = 0;\r
+ for(i=0; i<MAX_CHAT; i++) if(chatHandle[i] && i != partner) {\r
+ // set our button in other open chats\r
+ SetDlgItemText(chatHandle[i], IDC_Focus1+partner-(i<partner), chatPartner[partner]);\r
+ EnableWindow( GetDlgItem(chatHandle[i], IDC_Focus1+partner-(i<partner)), 1 );\r
+ // and buttons for other chats in ours\r
+ SetDlgItemText(hDlg, IDC_Focus1+i-(i>partner), chatPartner[i]);\r
+ } else EnableWindow( GetDlgItem(hDlg, IDC_Focus1+i-(i>partner)), 1 );\r
+ for(i=0; i<MAX_CHAT-1; i++) { Button_SetStyle(GetDlgItem(hDlg, IDC_Focus1+i), BS_PUSHBUTTON|BS_LEFT, TRUE); }\r
+ SetWindowPos(hDlg, NULL, wpConsole.x, wpConsole.y, 0, 0, SWP_NOZORDER|SWP_NOSIZE);\r
SendMessage( GetDlgItem(hDlg, IDC_ChatPartner), // [HGM] clickbox: initialize with requested handle\r
WM_SETTEXT, 0, (LPARAM) chatPartner[partner] );\r
filterHasFocus[partner] = TRUE;\r
\r
case IDC_Change:\r
GetDlgItemText(hDlg, IDC_ChatPartner, chatPartner[partner], MSG_SIZ);\r
+ for(i=0; i<MAX_CHAT; i++) if(chatHandle[i] && i != partner) {\r
+ // set our button in other open chats\r
+ SetDlgItemText(chatHandle[i], IDC_Focus1+partner-(i<partner), chatPartner[partner]);\r
+ }\r
break;\r
\r
case IDC_Send:\r
SendToICS(buf);\r
break;\r
\r
+ case IDC_Focus1:\r
+ case IDC_Focus2:\r
+ case IDC_Focus3:\r
+ case IDC_Focus4:\r
+ i = LOWORD(wParam) - IDC_Focus1;\r
+ if(i >= partner) i++;\r
+ onTop = i;\r
+ SetFocus(GetDlgItem(hDlg, IDC_Send));\r
+ if(chatHandle[i]) {\r
+ int j;\r
+ for(j=0; j<MAX_CHAT; j++) if(i != j && chatHandle[j])\r
+ Button_SetState(GetDlgItem(chatHandle[j], IDC_Focus1+i-(j<i)), FALSE);\r
+ SetFocus(GetDlgItem(chatHandle[i], OPT_ChatInput));\r
+ }\r
+ break;\r
+\r
default:\r
break;\r
}\r
chatHandle[partner] = 0;\r
chatPartner[partner][0] = 0;\r
ChatPopDown();\r
+ for(i=0; i<MAX_CHAT; i++) if(chatHandle[i] && i != partner) {\r
+ // set our button in other open chats\r
+ SetDlgItemText(chatHandle[i], IDC_Focus1+partner-(i<partner), "");\r
+ EnableWindow( GetDlgItem(chatHandle[i], IDC_Focus1+partner-(i<partner)), 0 );\r
+ }\r
EndDialog(hDlg, TRUE);\r
break;\r
\r
\r
void OutputChatMessage(int partner, char *text)\r
{\r
+ int j;\r
if(!chatHandle[partner]) return;\r
\r
int n = strlen(text);\r
text[n+1] = 0; text[n] = '\n'; text[n-1] = '\r'; // Needs CR to not lose line breaks on copy-paste\r
InsertIntoMemo(chatHandle[partner], text);\r
+ if(partner != onTop) for(j=0; j<MAX_CHAT; j++) if(j != partner && chatHandle[j])\r
+ Button_SetState(GetDlgItem(chatHandle[j], IDC_Focus1+partner-(j<partner)), TRUE);\r
}\r
ICON IDI_TRANS_14,IDC_StateIcon2,164,84,20,20\r
END\r
\r
-DLG_Chat DIALOGEX 0, 0, 256, 106\r
+DLG_Chat DIALOGEX 0, 0, 290, 106\r
STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME\r
EXSTYLE WS_EX_TOOLWINDOW\r
CAPTION "Chat Window"\r
FONT 8, "MS Sans Serif"\r
BEGIN\r
LTEXT "Chat partner:",IDC_STATIC,5,5,45,10\r
- EDITTEXT IDC_ChatPartner,50,3,100,13,ES_AUTOHSCROLL\r
- PUSHBUTTON "Change",IDC_Change,155,3,35,13\r
- PUSHBUTTON "Clear",IDC_Clear,198,3,25,13\r
- DEFPUSHBUTTON "Send",IDC_Send,228,3,25,13\r
+ EDITTEXT IDC_ChatPartner,50,3,45,13,ES_AUTOHSCROLL\r
+ PUSHBUTTON "",IDC_Focus1,100,3,30,13\r
+ PUSHBUTTON "",IDC_Focus2,133,3,30,13\r
+ PUSHBUTTON "",IDC_Focus3,166,3,30,13\r
+ PUSHBUTTON "",IDC_Focus4,199,3,30,13\r
+ PUSHBUTTON "Clear",IDC_Clear,232,3,25,13\r
+ DEFPUSHBUTTON "Send",IDC_Send,262,3,25,13\r
CONTROL "",IDC_ChatMemo,"RICHEDIT",ES_MULTILINE | ES_READONLY |\r
ES_AUTOVSCROLL | WS_BORDER | WS_VSCROLL | \r
- WS_HSCROLL | WS_TABSTOP,3,17,250,70\r
+ WS_HSCROLL | WS_TABSTOP,3,17,284,70\r
CONTROL "",OPT_ChatInput,"RICHEDIT",ES_AUTOHSCROLL | ES_NOHIDESEL | \r
- WS_BORDER | WS_TABSTOP,3,90,250,13\r
+ WS_BORDER | WS_TABSTOP,3,90,284,13\r
END\r
\r
DLG_EnginePlayOptions DIALOG DISCARDABLE 0, 0, 208, 202\r