updated version number
[xboard.git] / xboard.c
index 27fbf15..1665f4c 100644 (file)
--- a/xboard.c
+++ b/xboard.c
@@ -260,8 +260,6 @@ static void PieceMenuSelect P((Widget w, ChessSquare piece, caddr_t junk));
 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));
@@ -291,25 +289,11 @@ void PasteGameProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
 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));
@@ -621,18 +605,18 @@ MenuItem modeMenu[] = {
   //    {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},
@@ -668,11 +652,11 @@ MenuItem optionsMenu[] = {
     //    {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}
@@ -1761,7 +1745,7 @@ XrmOptionDescRec shellOptions[] = {
 };
 
 XtActionsRec boardActions[] = {
-    { "HandleUserMove", HandleUserMove },
+    //    { "HandleUserMove", HandleUserMove },
     { "AnimateUserMove", AnimateUserMove },
     //    { "FileNameAction", FileNameAction },
     { "AskQuestionProc", AskQuestionProc },
@@ -1785,13 +1769,13 @@ XtActionsRec boardActions[] = {
     { "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},
@@ -1841,11 +1825,11 @@ XtActionsRec boardActions[] = {
     //    { "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 },
@@ -3976,41 +3960,6 @@ void DrawPosition( repaint, 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)
 {
@@ -5042,75 +4991,6 @@ void AutoSaveGame()
   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;
@@ -5150,101 +5030,6 @@ void EnterKeyProc(w, event, prms, nprms)
 }
 
 
-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;