Use dataDir/manDir variables always
[xboard.git] / frontend.h
1 /*
2  * frontend.h -- Interface exported by all XBoard front ends
3  *
4  * Copyright 1991 by Digital Equipment Corporation, Maynard,
5  * Massachusetts.
6  *
7  * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
8  * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free
9  * Software Foundation, Inc.
10  *
11  * Enhancements Copyright 2005 Alessandro Scotti
12  *
13  * The following terms apply to Digital Equipment Corporation's copyright
14  * interest in XBoard:
15  * ------------------------------------------------------------------------
16  * All Rights Reserved
17  *
18  * Permission to use, copy, modify, and distribute this software and its
19  * documentation for any purpose and without fee is hereby granted,
20  * provided that the above copyright notice appear in all copies and that
21  * both that copyright notice and this permission notice appear in
22  * supporting documentation, and that the name of Digital not be
23  * used in advertising or publicity pertaining to distribution of the
24  * software without specific, written prior permission.
25  *
26  * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
27  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
28  * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
29  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
31  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
32  * SOFTWARE.
33  * ------------------------------------------------------------------------
34  *
35  * The following terms apply to the enhanced version of XBoard
36  * distributed by the Free Software Foundation:
37  * ------------------------------------------------------------------------
38  *
39  * GNU XBoard is free software: you can redistribute it and/or modify
40  * it under the terms of the GNU General Public License as published by
41  * the Free Software Foundation, either version 3 of the License, or (at
42  * your option) any later version.
43  *
44  * GNU XBoard is distributed in the hope that it will be useful, but
45  * WITHOUT ANY WARRANTY; without even the implied warranty of
46  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
47  * General Public License for more details.
48  *
49  * You should have received a copy of the GNU General Public License
50  * along with this program. If not, see http://www.gnu.org/licenses/.  *
51  *
52  *------------------------------------------------------------------------
53  ** See the file ChangeLog for a revision history.  */
54
55 #ifndef XB_FRONTEND
56 #define XB_FRONTEND
57
58 #include <stdio.h>
59
60 char *T_ P((char *s));
61 void ModeHighlight P((void));
62 void SetICSMode P((void));
63 void SetGNUMode P((void));
64 void SetNCPMode P((void));
65 void SetCmailMode P((void));
66 void SetTrainingModeOn P((void));
67 void SetTrainingModeOff P((void));
68 void SetUserThinkingEnables P((void));
69 void SetMachineThinkingEnables P((void));
70 void DisplayTitle P((String title));
71 void DisplayMessage P((String message, String extMessage));
72 void DisplayMoveError P((String message));
73
74 void DisplayNote P((String message));
75
76 void DisplayInformation P((String message));
77 void AskQuestion P((String title, String question, String replyPrefix,
78                     ProcRef pr));
79 void DisplayIcsInteractionTitle P((String title));
80 void ParseArgsFromString P((char *p));
81 void ParseArgsFromFile P((FILE *f));
82 void DrawPosition P((int fullRedraw, Board board));
83 void ResetFrontEnd P((void));
84 void NotifyFrontendLogin P((void));
85 void CommentPopUp P((String title, String comment));
86 void CommentPopDown P((void));
87 void EditCommentPopUp P((int index, String title, String text));
88 void ErrorPopDown P((void));
89 int  EventToSquare P((int x, int limit));
90 void DrawSeekAxis P(( int x, int y, int xTo, int yTo ));
91 void DrawSeekBackground P(( int left, int top, int right, int bottom ));
92 void DrawSeekText P((char *buf, int x, int y));
93 void DrawSeekDot P((int x, int y, int color));
94 void PopUpMoveDialog P((char first));
95
96 void RingBell P((void));
97 int  Roar P((void));
98 void PlayIcsWinSound P((void));
99 void PlayIcsLossSound P((void));
100 void PlayIcsDrawSound P((void));
101 void PlayIcsUnfinishedSound P((void));
102 void PlayAlarmSound P((void));
103 void PlayTellSound P((void));
104 int  PlaySoundFile P((char *name));
105 void PlaySoundByColor P((void));
106 void EchoOn P((void));
107 void EchoOff P((void));
108 void Raw P((void));
109 void Colorize P((ColorClass cc, int continuation));
110 char *InterpretFileName P((char *name, char *dir));
111 void DoSleep P((int n));
112 void DoEvents P((void));
113
114 char *UserName P((void));
115 char *HostName P((void));
116
117 int ClockTimerRunning P((void));
118 int StopClockTimer P((void));
119 void StartClockTimer P((long millisec));
120 void DisplayWhiteClock P((long timeRemaining, int highlight));
121 void DisplayBlackClock P((long timeRemaining, int highlight));
122 void UpdateLogos P((int display));
123
124 int LoadGameTimerRunning P((void));
125 int StopLoadGameTimer P((void));
126 void StartLoadGameTimer P((long millisec));
127 void AutoSaveGame P((void));
128
129 void ScheduleDelayedEvent P((DelayedEventCallback cb, long millisec));
130 DelayedEventCallback GetDelayedEvent P((void));
131 void CancelDelayedEvent P((void));
132 // [HGM] mouse: next six used by mouse handler, which was moved to backend
133 extern int fromX, fromY, toX, toY;
134 void PromotionPopUp P((char choice));
135 void DragPieceBegin P((int x, int y, Boolean instantly));
136 void DragPieceEnd P((int x, int y));
137 void DragPieceMove P((int x, int y));
138 void LeftClick P((ClickType c, int x, int y));
139 int  RightClick P((ClickType c, int x, int y, int *col, int *row));
140 void Wheel P((int dir, int x, int y));
141
142 int StartChildProcess P((char *cmdLine, char *dir, ProcRef *pr));
143 void DestroyChildProcess P((ProcRef pr, int/*boolean*/ signal));
144 void InterruptChildProcess P((ProcRef pr));
145 void RunCommand P((char *buf));
146
147 int OpenTelnet P((char *host, char *port, ProcRef *pr));
148 int OpenTCP P((char *host, char *port, ProcRef *pr));
149 int OpenCommPort P((char *name, ProcRef *pr));
150 int OpenLoopback P((ProcRef *pr));
151 int OpenRcmd P((char *host, char *user, char *cmd, ProcRef *pr));
152
153 typedef void (*InputCallback) P((InputSourceRef isr, VOIDSTAR closure,
154                                  char *buf, int count, int error));
155 /* pr == NoProc means the local keyboard */
156 InputSourceRef AddInputSource P((ProcRef pr, int lineByLine,
157                                  InputCallback func, VOIDSTAR closure));
158 void RemoveInputSource P((InputSourceRef isr));
159
160 /* pr == NoProc means the local display */
161 int OutputToProcess P((ProcRef pr, char *message, int count, int *outError));
162 int OutputToProcessDelayed P((ProcRef pr, char *message, int count,
163                               int *outError, long msdelay));
164
165 void CmailSigHandlerCallBack P((InputSourceRef isr, VOIDSTAR closure,
166                                 char *buf, int count, int error));
167
168 extern ProcRef cmailPR;
169 extern int shiftKey, controlKey;
170 extern char dataDir[], manDir[];
171
172 /* in xgamelist.c or winboard.c */
173 void GLT_ClearList();
174 void GLT_DeSelectList();
175 void GLT_AddToList( char *name );
176 Boolean GLT_GetFromList( int index, char *name );
177
178 extern char lpUserGLT[];
179 extern char *homeDir;
180
181 /* these are in wgamelist.c */
182 void GameListPopUp P((FILE *fp, char *filename));
183 void GameListPopDown P((void));
184 void GameListHighlight P((int index));
185 void GameListDestroy P((void));
186 void GameListUpdate P((void));
187 FILE *GameFile P((void));
188
189 /* these are in wedittags.c */
190 void EditTagsPopUp P((char *tags, char **dest));
191 void TagsPopUp P((char *tags, char *msg));
192 void TagsPopDown P((void));
193
194 void ParseIcsTextColors P((void));
195 int  ICSInitScript P((void));
196 void StartAnalysisClock P((void));
197 void EngineOutputPopUp P((void));
198 void EgineOutputPopDown P((void));
199
200 void SetHighlights P((int fromX, int fromY, int toX, int toY));
201 void ClearHighlights P((void));
202 void SetPremoveHighlights P((int fromX, int fromY, int toX, int toY));
203 void ClearPremoveHighlights P((void));
204
205 void AnimateAtomicCapture P((Board board, int fromX, int fromY, int toX, int toY));
206 void ShutDownFrontEnd P((void));
207 void BoardToTop P((void));
208 void AnimateMove P((Board board, int fromX, int fromY, int toX, int toY));
209 void HistorySet P((char movelist[][2*MOVE_LEN], int first, int last, int current));
210 void FreezeUI P((void));
211 void ThawUI P((void));
212 void ChangeDragPiece P((ChessSquare piece));
213 void CopyFENToClipboard P((void));
214 extern char *programName;
215 extern int commentUp;
216 extern char *firstChessProgramNames;
217
218 void GreyRevert P((Boolean grey));
219 void EnableNamedMenuItem P((char *menuRef, int state));
220
221 typedef struct FrontEndProgramStats_TAG {
222     int which;
223     int depth;
224     u64 nodes;
225     int score;
226     int time;
227     char * pv;
228     char * hint;
229     int an_move_index;
230     int an_move_count;
231 } FrontEndProgramStats;
232
233 void SetProgramStats P(( FrontEndProgramStats * stats )); /* [AS] */
234
235 void EngineOutputPopUp P((void));
236 void EngineOutputPopDown P((void));
237 int  EngineOutputIsUp P((void));
238 int  EngineOutputDialogExists P((void));
239 void EvalGraphPopUp P((void));
240 Boolean EvalGraphIsUp P((void));
241 int  EvalGraphDialogExists P((void));
242 void SlavePopUp P((void));
243 void ActivateTheme P((int new));
244 char *Col2Text P((int n));
245
246 /* these are in xhistory.c  */
247 Boolean MoveHistoryIsUp P((void));
248 void HistoryPopUp P((void));
249 void FindMoveByCharIndex P(( int char_index ));
250
251 #endif /* XB_FRONTEND */