Fix awareness of settings changed by -firstOption
[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 DrawPositionX P((int fullRedraw, Board board));
84 void ResetFrontEnd P((void));
85 void NotifyFrontendLogin P((void));
86 void CommentPopUp P((String title, String comment));
87 void CommentPopDown P((void));
88 void EditCommentPopUp P((int index, String title, String text));
89 void ErrorPopDown P((void));
90 int  EventToSquare P((int x, int limit));
91 void DrawSeekAxis P(( int x, int y, int xTo, int yTo ));
92 void DrawSeekBackground P(( int left, int top, int right, int bottom ));
93 void DrawSeekText P((char *buf, int x, int y));
94 void DrawSeekDot P((int x, int y, int color));
95 void PopUpMoveDialog P((char first));
96
97 void RingBell P((void));
98 int  Roar P((void));
99 void PlayIcsWinSound P((void));
100 void PlayIcsLossSound P((void));
101 void PlayIcsDrawSound P((void));
102 void PlayIcsUnfinishedSound P((void));
103 void PlayAlarmSound P((void));
104 void PlayTellSound P((void));
105 int  PlaySoundFile P((char *name));
106 void PlaySoundByColor P((void));
107 void EchoOn P((void));
108 void EchoOff P((void));
109 void Raw P((void));
110 void Colorize P((ColorClass cc, int continuation));
111 char *InterpretFileName P((char *name, char *dir));
112 void DoSleep P((int n));
113 void DoEvents P((void));
114
115 char *UserName P((void));
116 char *HostName P((void));
117
118 int ClockTimerRunning P((void));
119 int StopClockTimer P((void));
120 void StartClockTimer P((long millisec));
121 void DisplayWhiteClock P((long timeRemaining, int highlight));
122 void DisplayBlackClock P((long timeRemaining, int highlight));
123 void UpdateLogos P((int display));
124
125 int LoadGameTimerRunning P((void));
126 int StopLoadGameTimer P((void));
127 void StartLoadGameTimer P((long millisec));
128 void AutoSaveGame P((void));
129
130 void ScheduleDelayedEvent P((DelayedEventCallback cb, long millisec));
131 DelayedEventCallback GetDelayedEvent P((void));
132 void CancelDelayedEvent P((void));
133 // [HGM] mouse: next six used by mouse handler, which was moved to backend
134 extern int fromX, fromY, toX, toY;
135 void PromotionPopUp P((char choice));
136 void DragPieceBegin P((int x, int y, Boolean instantly));
137 void DragPieceEnd P((int x, int y));
138 void DragPieceMove P((int x, int y));
139 void LeftClick P((ClickType c, int x, int y));
140 int  RightClick P((ClickType c, int x, int y, int *col, int *row));
141 void Wheel P((int dir, int x, int y));
142
143 int StartChildProcess P((char *cmdLine, char *dir, ProcRef *pr));
144 void DestroyChildProcess P((ProcRef pr, int/*boolean*/ signal));
145 void InterruptChildProcess P((ProcRef pr));
146 char *BufferCommandOutput P((char *command, int size));
147 void RunCommand P((char *buf));
148
149 int OpenTelnet P((char *host, char *port, ProcRef *pr));
150 int OpenTCP P((char *host, char *port, ProcRef *pr));
151 int OpenCommPort P((char *name, ProcRef *pr));
152 int OpenLoopback P((ProcRef *pr));
153 int OpenRcmd P((char *host, char *user, char *cmd, ProcRef *pr));
154
155 typedef void (*InputCallback) P((InputSourceRef isr, VOIDSTAR closure,
156                                  char *buf, int count, int error));
157 /* pr == NoProc means the local keyboard */
158 InputSourceRef AddInputSource P((ProcRef pr, int lineByLine,
159                                  InputCallback func, VOIDSTAR closure));
160 void RemoveInputSource P((InputSourceRef isr));
161
162 /* pr == NoProc means the local display */
163 int OutputToProcess P((ProcRef pr, char *message, int count, int *outError));
164 int OutputToProcessDelayed P((ProcRef pr, char *message, int count,
165                               int *outError, long msdelay));
166
167 void CmailSigHandlerCallBack P((InputSourceRef isr, VOIDSTAR closure,
168                                 char *buf, int count, int error));
169
170 extern ProcRef cmailPR;
171 extern int shiftKey, controlKey;
172 extern char dataDir[], manDir[];
173
174 /* in xgamelist.c or winboard.c */
175 void GLT_ClearList();
176 void GLT_DeSelectList();
177 void GLT_AddToList( char *name );
178 Boolean GLT_GetFromList( int index, char *name );
179
180 extern char lpUserGLT[];
181 extern char *homeDir;
182
183 /* these are in wgamelist.c */
184 void GameListPopUp P((FILE *fp, char *filename));
185 void GameListPopDown P((void));
186 void GameListHighlight P((int index));
187 void GameListDestroy P((void));
188 void GameListUpdate P((void));
189 FILE *GameFile P((void));
190
191 /* these are in wedittags.c */
192 void EditTagsPopUp P((char *tags, char **dest));
193 void TagsPopUp P((char *tags, char *msg));
194 void TagsPopDown P((void));
195
196 void ParseIcsTextColors P((void));
197 int  ICSInitScript P((void));
198 void StartAnalysisClock P((void));
199 void EngineOutputPopUp P((void));
200 void EgineOutputPopDown P((void));
201
202 void SetHighlights P((int fromX, int fromY, int toX, int toY));
203 void ClearHighlights P((void));
204 void SetPremoveHighlights P((int fromX, int fromY, int toX, int toY));
205 void ClearPremoveHighlights P((void));
206
207 void AnimateAtomicCapture P((Board board, int fromX, int fromY, int toX, int toY));
208 void ShutDownFrontEnd P((void));
209 void BoardToTop P((void));
210 void AnimateMove P((Board board, int fromX, int fromY, int toX, int toY));
211 void HistorySet P((char movelist[][2*MOVE_LEN], int first, int last, int current));
212 void FreezeUI P((void));
213 void ThawUI P((void));
214 void ChangeDragPiece P((ChessSquare piece));
215 void CopyFENToClipboard P((void));
216 extern char *programName;
217 extern int commentUp;
218 extern char *firstChessProgramNames;
219 extern char *icsTextMenuString;
220 extern int mute;
221
222 void GreyRevert P((Boolean grey));
223 void EnableNamedMenuItem P((char *menuRef, int state));
224
225 typedef struct FrontEndProgramStats_TAG {
226     int which;
227     int depth;
228     u64 nodes;
229     int score;
230     int time;
231     char * pv;
232     char * hint;
233     int an_move_index;
234     int an_move_count;
235 } FrontEndProgramStats;
236
237 void SetProgramStats P(( FrontEndProgramStats * stats )); /* [AS] */
238
239 void EngineOutputPopUp P((void));
240 void EngineOutputPopDown P((void));
241 int  EngineOutputIsUp P((void));
242 int  EngineOutputDialogExists P((void));
243 void EvalGraphPopUp P((void));
244 Boolean EvalGraphIsUp P((void));
245 int  EvalGraphDialogExists P((void));
246 void SlavePopUp P((void));
247 void ActivateTheme P((int new));
248 char *Col2Text P((int n));
249 char *Shorten P((char *s));
250
251 /* these are in xhistory.c  */
252 Boolean MoveHistoryIsUp P((void));
253 void HistoryPopUp P((void));
254 void FindMoveByCharIndex P(( int char_index ));
255
256 #endif /* XB_FRONTEND */