Initial checkin. I created this by combining the XBoard 4.2.6 and
[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 enum { \r
65   SizeTiny, SizeTeeny, SizeDinky, SizePetite, SizeSlim, SizeSmall,\r
66   SizeMediocre, SizeMiddling, SizeAverage, SizeModerate, SizeMedium,\r
67   SizeBulky, SizeLarge, SizeBig, SizeHuge, SizeGiant, SizeColossal,\r
68   SizeTitanic, NUM_SIZES \r
69 } BoardSize;\r
70 \r
71 typedef struct {\r
72     COLORREF color;\r
73     int effects;\r
74     char *name;\r
75 } MyColorizeAttribs;\r
76 \r
77 typedef struct {\r
78   char* name;\r
79   void* data;\r
80 } MySound;\r
81 \r
82 typedef struct {\r
83     COLORREF color;\r
84     int effects;\r
85     MySound sound;\r
86 } MyTextAttribs;\r
87 \r
88 /* Functions */\r
89 \r
90 BOOL InitApplication(HINSTANCE);\r
91 BOOL InitInstance(HINSTANCE, int, LPSTR);\r
92 LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);\r
93 LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);\r
94 LRESULT CALLBACK BoardSizeDlg(HWND, UINT, WPARAM, LPARAM);\r
95 LRESULT CALLBACK ButtonProc(HWND, UINT, WPARAM, LPARAM);\r
96 VOID InitAppData(LPSTR);\r
97 VOID InitDrawingColors(VOID);\r
98 VOID InitDrawingSizes(BoardSize boardSize, int flags);\r
99 VOID InitMenuChecks(VOID);\r
100 VOID ICSInitScript(VOID);\r
101 BOOL CenterWindow(HWND hwndChild, HWND hwndParent);\r
102 VOID ResizeEditPlusButtons(HWND hDlg, HWND hText, int sizeX, int sizeY, int newSizeX, int newSizeY);\r
103 VOID PromotionPopup(HWND hwnd);\r
104 FILE *OpenFileDialog(HWND hWnd, BOOL write, char *defName, char *defExt, \r
105                      char *nameFilt, char *dlgTitle, UINT *number,\r
106                      char fileTitle[MSG_SIZ], char fileName[MSG_SIZ]);\r
107 VOID InputEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);\r
108 DWORD InputThread(LPVOID arg);\r
109 DWORD NonOvlInputThread(LPVOID arg);\r
110 DWORD SocketInputThread(LPVOID arg);\r
111 BOOL ChangeColor(HWND hwnd, COLORREF *which);\r
112 VOID ChangeBoardSize(BoardSize newSize);\r
113 BOOL APIENTRY MyCreateFont(HWND hwnd, MyFont *font);\r
114 VOID ErrorPopDown(VOID);\r
115 VOID EnsureOnScreen(int *x, int *y);\r
116 typedef char GetFunc(void *getClosure);\r
117 VOID ParseArgs(GetFunc get, void *cl);\r
118 HBITMAP \r
119 DoLoadBitmap(HINSTANCE hinst, char *piece, int squareSize, char *suffix);\r
120 COLORREF ParseColorName(char *name);\r
121 void ParseAttribs(COLORREF *color, int *effects, char* argValue);\r
122 VOID CreateFontInMF(MyFont *mf);\r
123 VOID ChangedConsoleFont();\r
124 VOID ParseFontName(char *name, MyFontParams *mfp);\r
125 void InitComboStrings(HANDLE hwndCombo, char **cd);\r
126 BOOLEAN MyLoadSound(MySound *ms);\r
127 BOOLEAN MyPlaySound(MySound *ms);\r
128 VOID ExitArgError(char *msg, char *badArg);\r
129 \r
130 /* Constants */\r
131 \r
132 #define CLOCK_FONT 0\r
133 #define MESSAGE_FONT 1\r
134 #define COORD_FONT 2\r
135 #define CONSOLE_FONT 3\r
136 #define COMMENT_FONT 4\r
137 #define EDITTAGS_FONT 5\r
138 #define NUM_FONTS 6\r
139 \r
140 /* Positions of some menu items.  Origin is zero and separator lines count. */\r
141 /* It's gross that these are needed. */\r
142 #define ACTION_POS 2     /* Posn of "Action" on menu bar */\r
143 #define OPTIONS_POS 4    /* Posn of "Options" on menu bar */\r
144 #define ICS_POS 4        /* Posn of "ICS " on Options menu */\r
145 #define SOUNDS_POS 6     /* Posn of "Sounds" on Options menu */\r
146 /* end grossness */\r
147 \r
148 extern MyFont *font[NUM_SIZES][NUM_FONTS];\r
149 \r
150 #define WM_USER_Input                 (WM_USER + 4242)\r
151 #define WM_USER_Mouseleave            (WM_USER + 4243)\r
152 #define WM_USER_GetConsoleBackground  (WM_USER + 4244)\r
153 \r
154 #define CLOCK_TIMER_ID        51\r
155 #define LOAD_GAME_TIMER_ID    52\r
156 #define ANALYSIS_TIMER_ID     53\r
157 #define MOUSE_TIMER_ID        54\r
158 #define DELAYED_TIMER_ID      55\r
159 \r
160 #define SOLID_PIECE           0\r
161 #define OUTLINE_PIECE         1\r
162 #define WHITE_PIECE           2\r
163 \r
164 #define COPY_TMP "wbcopy.tmp"\r
165 #define PASTE_TMP "wbpaste.tmp"\r