changes from H.G. Muller; version 4.3.14
[xboard.git] / winboard / winboard.h
1 /*\r
2  * WinBoard.h -- Definitions for Windows NT front end to XBoard\r
3  *\r
4  * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.\r
5  * Enhancements Copyright 1992-97 Free Software Foundation, Inc.\r
6  *\r
7  * The following terms apply to Digital Equipment Corporation's copyright\r
8  * interest in XBoard:\r
9  * ------------------------------------------------------------------------\r
10  * All Rights Reserved\r
11  *\r
12  * Permission to use, copy, modify, and distribute this software and its\r
13  * documentation for any purpose and without fee is hereby granted,\r
14  * provided that the above copyright notice appear in all copies and that\r
15  * both that copyright notice and this permission notice appear in\r
16  * supporting documentation, and that the name of Digital not be\r
17  * used in advertising or publicity pertaining to distribution of the\r
18  * software without specific, written prior permission.\r
19  *\r
20  * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING\r
21  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL\r
22  * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR\r
23  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\r
24  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\r
25  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\r
26  * SOFTWARE.\r
27  * ------------------------------------------------------------------------\r
28  *\r
29  * The following terms apply to the enhanced version of XBoard distributed\r
30  * by the Free Software Foundation:\r
31  * ------------------------------------------------------------------------\r
32  * This program is free software; you can redistribute it and/or modify\r
33  * it under the terms of the GNU General Public License as published by\r
34  * the Free Software Foundation; either version 2 of the License, or\r
35  * (at your option) any later version.\r
36  *\r
37  * This program is distributed in the hope that it will be useful,\r
38  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
39  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
40  * GNU General Public License for more details.\r
41  *\r
42  * You should have received a copy of the GNU General Public License\r
43  * along with this program; if not, write to the Free Software\r
44  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
45  * ------------------------------------------------------------------------\r
46  */\r
47 #include "resource.h"\r
48 #include <dlgs.h>\r
49 \r
50 /* Types */\r
51 typedef struct {\r
52   char faceName[LF_FACESIZE];\r
53   float pointSize;\r
54   BYTE bold, italic, underline, strikeout;\r
55 } MyFontParams;\r
56 \r
57 typedef struct {\r
58   char *def;\r
59   MyFontParams mfp;\r
60   LOGFONT lf;\r
61   HFONT hf;\r
62 } MyFont;\r
63 \r
64 typedef struct {\r
65     COLORREF color;\r
66     int effects;\r
67     char *name;\r
68 } MyColorizeAttribs;\r
69 \r
70 typedef struct {\r
71   char* name;\r
72   void* data;\r
73 } MySound;\r
74 \r
75 typedef struct {\r
76     COLORREF color;\r
77     int effects;\r
78     MySound sound;\r
79 } MyTextAttribs;\r
80 \r
81 /* Functions */\r
82 \r
83 BOOL InitApplication(HINSTANCE);\r
84 BOOL InitInstance(HINSTANCE, int, LPSTR);\r
85 LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);\r
86 LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);\r
87 LRESULT CALLBACK BoardSizeDlg(HWND, UINT, WPARAM, LPARAM);\r
88 LRESULT CALLBACK ButtonProc(HWND, UINT, WPARAM, LPARAM);\r
89 VOID InitAppData(LPSTR);\r
90 VOID InitDrawingColors(VOID);\r
91 VOID InitDrawingSizes(BoardSize boardSize, int flags);\r
92 VOID InitMenuChecks(VOID);\r
93 VOID ICSInitScript(VOID);\r
94 BOOL CenterWindow(HWND hwndChild, HWND hwndParent);\r
95 VOID ResizeEditPlusButtons(HWND hDlg, HWND hText, int sizeX, int sizeY, int newSizeX, int newSizeY);\r
96 VOID PromotionPopup(HWND hwnd);\r
97 FILE *OpenFileDialog(HWND hWnd, char *write, char *defName, char *defExt, \r
98                      char *nameFilt, char *dlgTitle, UINT *number,\r
99                      char fileTitle[MSG_SIZ], char fileName[MSG_SIZ]);\r
100 VOID InputEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);\r
101 DWORD InputThread(LPVOID arg);\r
102 DWORD NonOvlInputThread(LPVOID arg);\r
103 DWORD SocketInputThread(LPVOID arg);\r
104 BOOL ChangeColor(HWND hwnd, COLORREF *which);\r
105 VOID ChangeBoardSize(BoardSize newSize);\r
106 BOOL APIENTRY MyCreateFont(HWND hwnd, MyFont *font);\r
107 VOID ErrorPopDown(VOID);\r
108 VOID EnsureOnScreen(int *x, int *y);\r
109 typedef char GetFunc(void *getClosure);\r
110 VOID ParseArgs(GetFunc get, void *cl);\r
111 HBITMAP \r
112 DoLoadBitmap(HINSTANCE hinst, char *piece, int squareSize, char *suffix);\r
113 COLORREF ParseColorName(char *name);\r
114 void ParseAttribs(COLORREF *color, int *effects, char* argValue);\r
115 VOID CreateFontInMF(MyFont *mf);\r
116 VOID ChangedConsoleFont();\r
117 VOID ParseFontName(char *name, MyFontParams *mfp);\r
118 void InitComboStrings(HANDLE hwndCombo, char **cd);\r
119 BOOLEAN MyLoadSound(MySound *ms);\r
120 BOOLEAN MyPlaySound(MySound *ms);\r
121 VOID ExitArgError(char *msg, char *badArg);\r
122 \r
123 /* Constants */\r
124 \r
125 #define CLOCK_FONT 0\r
126 #define MESSAGE_FONT 1\r
127 #define COORD_FONT 2\r
128 #define CONSOLE_FONT 3\r
129 #define COMMENT_FONT 4\r
130 #define EDITTAGS_FONT 5\r
131 #define MOVEHISTORY_FONT 6\r
132 #define NUM_FONTS 7\r
133 \r
134 /* Positions of some menu items.  Origin is zero and separator lines count. */\r
135 /* It's gross that these are needed. */\r
136 #define ACTION_POS 2     /* Posn of "Action" on menu bar */\r
137 #define OPTIONS_POS 4    /* Posn of "Options" on menu bar */\r
138 #define ICS_POS 4        /* Posn of "ICS " on Options menu */\r
139 #define SOUNDS_POS 6     /* Posn of "Sounds" on Options menu */\r
140 /* end grossness */\r
141 \r
142 extern MyFont *font[NUM_SIZES][NUM_FONTS];\r
143 \r
144 #define WM_USER_Input                 (WM_USER + 4242)\r
145 #define WM_USER_Mouseleave            (WM_USER + 4243)\r
146 #define WM_USER_GetConsoleBackground  (WM_USER + 4244)\r
147 \r
148 #define CLOCK_TIMER_ID        51\r
149 #define LOAD_GAME_TIMER_ID    52\r
150 #define ANALYSIS_TIMER_ID     53\r
151 #define MOUSE_TIMER_ID        54\r
152 #define DELAYED_TIMER_ID      55\r
153 \r
154 #define SOLID_PIECE           0\r
155 #define OUTLINE_PIECE         1\r
156 #define WHITE_PIECE           2\r
157 \r
158 #define COPY_TMP "wbcopy.tmp"\r
159 #define PASTE_TMP "wbpaste.tmp"\r
160 \r
161 /* [AS] Layout management */\r
162 typedef struct {\r
163     Boolean visible;\r
164     int x;\r
165     int y;\r
166     int width;\r
167     int height;\r
168 } WindowPlacement;\r
169 \r
170 VOID InitWindowPlacement( WindowPlacement * wp );\r
171 \r
172 VOID RestoreWindowPlacement( HWND hWnd, WindowPlacement * wp );\r
173 \r
174 VOID ReattachAfterMove( LPRECT lprcOldPos, int new_x, int new_y, HWND hWndChild, WindowPlacement * pwpChild );\r