void EngineOutputProc P((Widget w, XEvent *event,
String *prms, Cardinal *nprms));
-void EngineOutputPopDown();
-
#ifdef __EMX__
#ifndef HAVE_USLEEP
static void DropMenuSelect P((Widget w, ChessSquare piece, caddr_t junk));
int EventToSquare P((int x, int limit));
void DrawSquare P((int row, int column, ChessSquare piece, int do_flash));
-void HandleUserMove P((Widget w, XEvent *event,
- String *prms, Cardinal *nprms));
void AnimateUserMove P((Widget w, XEvent * event,
String * params, Cardinal * nParams));
void CommentPopUp P((char *title, char *label));
void MailMoveProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void ReloadCmailMsgProc P((Widget w, XEvent *event, String *prms,
Cardinal *nprms));
-void AnalyzeModeProc P((Widget w, XEvent *event,
- String *prms, Cardinal *nprms));
-void EditGameProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
-void EditPositionProc P((Widget w, XEvent *event,
- String *prms, Cardinal *nprms));
-void TrainingProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void EditCommentProc P((Widget w, XEvent *event,
String *prms, Cardinal *nprms));
void IcsInputBoxProc P((Widget w, XEvent *event,
String *prms, Cardinal *nprms));
void EnterKeyProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
-void PonderNextMoveProc P((Widget w, XEvent *event, String *prms,
- Cardinal *nprms));
-void PopupMoveErrorsProc P((Widget w, XEvent *event, String *prms,
- Cardinal *nprms));
-void PopupExitMessageProc P((Widget w, XEvent *event, String *prms,
- Cardinal *nprms));
-void PremoveProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
-void QuietPlayProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void AboutGameProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void DebugProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void NothingProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
static void DragPieceMove P((int x, int y));
static void DrawDragPiece P((void));
char *ModeToWidgetName P((GameMode mode));
-void EngineOutputUpdate( FrontEndProgramStats * stats );
void ShuffleMenuProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void EngineMenuProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void UciMenuProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
commentShell, promotionShell, whitePieceMenu, blackPieceMenu, dropMenu,
menuBarWidget, editShell, errorShell, analysisShell,
ICSInputShell, fileNameShell, askQuestionShell;
+
+//XSegment gridSegments[BOARD_RANKS + BOARD_FILES + 2];
+//XSegment jailGridSegments[BOARD_RANKS + BOARD_FILES + 6];
+
Font clockFontID, coordFontID, countFontID;
XFontStruct *clockFontStruct, *coordFontStruct, *countFontStruct;
XtAppContext appContext;
// {N_("Machine White"), MachineWhiteProc},
// {N_("Machine Black"), MachineBlackProc},
// {N_("Two Machines"), TwoMachinesProc},
- {N_("Analysis Mode"), AnalyzeModeProc},
+ // {N_("Analysis Mode"), AnalyzeModeProc},
// {N_("Analyze File"), AnalyzeFileProc },
// {N_("ICS Client"), IcsClientProc},
- {N_("Edit Game"), EditGameProc},
- {N_("Edit Position"), EditPositionProc},
- {N_("Training"), TrainingProc},
- {"----", NothingProc},
+ // {N_("Edit Game"), EditGameProc},
+ // {N_("Edit Position"), EditPositionProc},
+ // {N_("Training"), TrainingProc},
+ // {"----", NothingProc},
{N_("Show Engine Output"), EngineOutputProc},
{N_("Show Evaluation Graph"), NothingProc}, // [HGM] evalgr: not functional yet
{N_("Show Game List"), ShowGameListProc},
// {"Show Move History", HistoryShowProc}, // [HGM] hist: activate 4.2.7 code
- {"----", NothingProc},
+ // {"----", NothingProc},
// {N_("Edit Tags"), EditTagsProc},
{N_("Edit Comment"), EditCommentProc},
{N_("ICS Input Box"), IcsInputBoxProc},
// {N_("ICS Alarm"), IcsAlarmProc},
// {N_("Old Save Style"), OldSaveStyleProc},
// {N_("Periodic Updates"), PeriodicUpdatesProc},
- {N_("Ponder Next Move"), PonderNextMoveProc},
- {N_("Popup Exit Message"), PopupExitMessageProc},
- {N_("Popup Move Errors"), PopupMoveErrorsProc},
- {N_("Premove"), PremoveProc},
- {N_("Quiet Play"), QuietPlayProc},
+ // {N_("Ponder Next Move"), PonderNextMoveProc},
+ // {N_("Popup Exit Message"), PopupExitMessageProc},
+ // {N_("Popup Move Errors"), PopupMoveErrorsProc},
+ // {N_("Premove"), PremoveProc},
+ // {N_("Quiet Play"), QuietPlayProc},
// {N_("Hide Thinking"), HideThinkingProc},
// {N_("Test Legality"), TestLegalityProc},
{NULL, NULL}
};
XtActionsRec boardActions[] = {
- { "HandleUserMove", HandleUserMove },
+ // { "HandleUserMove", HandleUserMove },
{ "AnimateUserMove", AnimateUserMove },
// { "FileNameAction", FileNameAction },
{ "AskQuestionProc", AskQuestionProc },
{ "ReloadCmailMsgProc", ReloadCmailMsgProc },
// { "MachineWhiteProc", MachineWhiteProc },
// { "MachineBlackProc", MachineBlackProc },
- { "AnalysisModeProc", AnalyzeModeProc },
+ // { "AnalysisModeProc", AnalyzeModeProc },
// { "AnalyzeFileProc", AnalyzeFileProc },
// { "TwoMachinesProc", TwoMachinesProc },
// { "IcsClientProc", IcsClientProc },
- { "EditGameProc", EditGameProc },
- { "EditPositionProc", EditPositionProc },
- { "TrainingProc", EditPositionProc },
+ // { "EditGameProc", EditGameProc },
+ // { "EditPositionProc", EditPositionProc },
+ // { "TrainingProc", EditPositionProc },
{ "EngineOutputProc", EngineOutputProc}, // [HGM] Winboard_x engine-output window
{ "ShowGameListProc", ShowGameListProc },
// { "ShowMoveListProc", HistoryShowProc},
// { "MoveSoundProc", MoveSoundProc },
// { "OldSaveStyleProc", OldSaveStyleProc },
// { "PeriodicUpdatesProc", PeriodicUpdatesProc },
- { "PonderNextMoveProc", PonderNextMoveProc },
- { "PopupExitMessageProc", PopupExitMessageProc },
- { "PopupMoveErrorsProc", PopupMoveErrorsProc },
- { "PremoveProc", PremoveProc },
- { "QuietPlayProc", QuietPlayProc },
+ // { "PonderNextMoveProc", PonderNextMoveProc },
+ // { "PopupExitMessageProc", PopupExitMessageProc },
+ // { "PopupMoveErrorsProc", PopupMoveErrorsProc },
+ // { "PremoveProc", PremoveProc },
+ // { "QuietPlayProc", QuietPlayProc },
// { "ShowThinkingProc", ShowThinkingProc },
// { "HideThinkingProc", HideThinkingProc },
{ "TestLegalityProc", TestLegalityProc },
}
/* [HGM,HR] make sure board size is acceptable */
- if(appData.NrFiles > BOARD_SIZE ||
- appData.NrRanks > BOARD_SIZE )
- DisplayFatalError(_("Recompile with BOARD_SIZE > 12, to support this size"), 0, 2);
+ if(appData.NrFiles > BOARD_FILES ||
+ appData.NrRanks > BOARD_RANKS )
+ DisplayFatalError(_("Recompile with larger BOARD_RANKS or BOARD_FILES to support this size"), 0, 2);
#if !HIGHDRAG
/* This feature does not work; animation needs a rewrite */
}
void
+GreyRevert(grey)
+ Boolean grey;
+{
+ Widget w;
+ if (!menuBarWidget) return;
+ w = XtNameToWidget(menuBarWidget, "menuStep.Revert");
+ if (w == NULL) {
+ DisplayError("menuStep.Revert", 0);
+ } else {
+ XtSetSensitive(w, !grey);
+ }
+}
+
+void
SetMenuEnables(enab)
Enables *enab;
{
return 0;
}
-static int damage[BOARD_SIZE][BOARD_SIZE];
+static int damage[BOARD_RANKS][BOARD_FILES];
/*
* event handler for redrawing the board
return;
}
-/*
- * event handler for parsing user moves
- */
-// [HGM] This routine will need quite some reworking. Although the backend still supports the old
-// way of doing things, by calling UserMoveEvent() to test the legality of the move and then perform
-// it at the end, and doing all kind of preliminary tests here (e.g. to weed out self-captures), it
-// should be made to use the new way, of calling UserMoveTest early to determine the legality of the
-// move, (which will weed out the illegal selfcaptures and moves into the holdings, and flag promotions),
-// and at the end FinishMove() to perform the move after optional promotion popups.
-// For now I patched it to allow self-capture with King, and suppress clicks between board and holdings.
-void HandleUserMove(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- if (w != boardWidget || errorExitStatus != -1) return;
-
- if (promotionUp) {
- if (event->type == ButtonPress) {
-// XtPopdown(promotionShell);
-// XtDestroyWidget(promotionShell);
- promotionUp = False;
- ClearHighlights();
- fromX = fromY = -1;
- } else {
- return;
- }
- }
-
- // [HGM] mouse: the rest of the mouse handler is moved to the backend, and called here
- if(event->type == ButtonPress) LeftClick(Press, event->xbutton.x, event->xbutton.y);
- if(event->type == ButtonRelease) LeftClick(Release, event->xbutton.x, event->xbutton.y);
-}
-
void AnimateUserMove (Widget w, XEvent * event,
String * params, Cardinal * nParams)
{
return;
}
-void AnalyzeModeProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- char buf[MSG_SIZ];
-
- if (!first.analysisSupport) {
- snprintf(buf, sizeof(buf), _("%s does not support analysis"), first.tidy);
- DisplayError(buf, 0);
- return;
- }
- /* [DM] icsEngineAnalyze [HGM] This is horrible code; reverse the gameMode and isEngineAnalyze tests! */
- if (appData.icsActive) {
- if (gameMode != IcsObserving) {
- sprintf(buf,_("You are not observing a game"));
- DisplayError(buf, 0);
- /* secure check */
- if (appData.icsEngineAnalyze) {
- if (appData.debugMode)
- fprintf(debugFP, _("Found unexpected active ICS engine analyze \n"));
- ExitAnalyzeMode();
- ModeHighlight();
- }
- return;
- }
- /* if enable, use want disable icsEngineAnalyze */
- if (appData.icsEngineAnalyze) {
- ExitAnalyzeMode();
- ModeHighlight();
- return;
- }
- appData.icsEngineAnalyze = TRUE;
- if (appData.debugMode)
- fprintf(debugFP, _("ICS engine analyze starting... \n"));
- }
- if (!appData.showThinking)
- ShowThinkingProc(NULL,NULL);
-
- AnalyzeModeEvent();
-}
-
-void EditGameProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- EditGameEvent();
-}
-
-void EditPositionProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- EditPositionEvent();
-}
-
-void TrainingProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- TrainingEvent();
-}
void EditCommentProc(w, event, prms, nprms)
Widget w;
}
-void PonderNextMoveProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- Arg args[16];
-
- PonderNextMoveEvent(!appData.ponderNextMove);
-
- if (appData.ponderNextMove) {
- XtSetArg(args[0], XtNleftBitmap, xMarkPixmap);
- } else {
- XtSetArg(args[0], XtNleftBitmap, None);
- }
- XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Ponder Next Move"),
- args, 1);
-}
-
-void PopupExitMessageProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- Arg args[16];
-
- appData.popupExitMessage = !appData.popupExitMessage;
-
- if (appData.popupExitMessage) {
- XtSetArg(args[0], XtNleftBitmap, xMarkPixmap);
- } else {
- XtSetArg(args[0], XtNleftBitmap, None);
- }
- XtSetValues(XtNameToWidget(menuBarWidget,
- "menuOptions.Popup Exit Message"), args, 1);
-}
-
-void PopupMoveErrorsProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- Arg args[16];
-
- appData.popupMoveErrors = !appData.popupMoveErrors;
-
- if (appData.popupMoveErrors) {
- XtSetArg(args[0], XtNleftBitmap, xMarkPixmap);
- } else {
- XtSetArg(args[0], XtNleftBitmap, None);
- }
- XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Popup Move Errors"),
- args, 1);
-}
-
-void PremoveProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- Arg args[16];
-
- appData.premove = !appData.premove;
-
- if (appData.premove) {
- XtSetArg(args[0], XtNleftBitmap, xMarkPixmap);
- } else {
- XtSetArg(args[0], XtNleftBitmap, None);
- }
- XtSetValues(XtNameToWidget(menuBarWidget,
- "menuOptions.Premove"), args, 1);
-}
-
-void QuietPlayProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- Arg args[16];
-
- appData.quietPlay = !appData.quietPlay;
-
- if (appData.quietPlay) {
- XtSetArg(args[0], XtNleftBitmap, xMarkPixmap);
- } else {
- XtSetArg(args[0], XtNleftBitmap, None);
- }
- XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Quiet Play"),
- args, 1);
-}
-
void DebugProc(w, event, prms, nprms)
Widget w;
XEvent *event;
damage[player.startBoardY][player.startBoardX] = TRUE;
}
-void
-SetProgramStats( FrontEndProgramStats * stats )
-{
- // [HR] TODO
- // [HGM] done, but perhaps backend should call this directly?
- EngineOutputUpdate( stats );
-}
-
#include <sys/ioctl.h>
int get_term_width()
{