Implement castling in -variant caparandom
[xboard.git] / xboard.c
index c9546e2..3c4d8d7 100644 (file)
--- a/xboard.c
+++ b/xboard.c
@@ -200,7 +200,9 @@ extern char *getenv();
 // must be moved to xengineoutput.h
 
 void EngineOutputProc P((Widget w, XEvent *event,
- String *prms, Cardinal *nprms));
+                        String *prms, Cardinal *nprms));
+void EvalGraphProc P((Widget w, XEvent *event,
+                     String *prms, Cardinal *nprms));
 
 
 #ifdef __EMX__
@@ -605,9 +607,9 @@ MenuItem modeMenu[] = {
     {N_("Training"), TrainingProc},
     {"----", NothingProc},
     {N_("Show Engine Output"), EngineOutputProc},
-    {N_("Show Evaluation Graph"), NothingProc}, // [HGM] evalgr: not functional yet
+    {N_("Show Evaluation Graph"), EvalGraphProc},
     {N_("Show Game List"), ShowGameListProc},
-    {"Show Move History", HistoryShowProc}, // [HGM] hist: activate 4.2.7 code
+    {N_("Show Move History"), HistoryShowProc}, // [HGM] hist: activate 4.2.7 code
     {"----", NothingProc},
     {N_("Edit Tags"), EditTagsProc},
     {N_("Edit Comment"), EditCommentProc},
@@ -865,6 +867,7 @@ XtActionsRec boardActions[] = {
     { "EditPositionProc", EditPositionProc },
     { "TrainingProc", EditPositionProc },
     { "EngineOutputProc", EngineOutputProc}, // [HGM] Winboard_x engine-output window
+    { "EvalGraphProc", EvalGraphProc},       // [HGM] Winboard_x avaluation graph window
     { "ShowGameListProc", ShowGameListProc },
     { "ShowMoveListProc", HistoryShowProc},
     { "EditTagsProc", EditCommentProc },
@@ -944,6 +947,7 @@ XtActionsRec boardActions[] = {
     { "PromotionPopDown", (XtActionProc) PromotionPopDown },
     { "HistoryPopDown", (XtActionProc) HistoryPopDown },
     { "EngineOutputPopDown", (XtActionProc) EngineOutputPopDown },
+    { "EvalGraphPopDown", (XtActionProc) EvalGraphPopDown },
     { "ShufflePopDown", (XtActionProc) ShufflePopDown },
     { "EnginePopDown", (XtActionProc) EnginePopDown },
     { "UciPopDown", (XtActionProc) UciPopDown },
@@ -1245,13 +1249,13 @@ BoardToTop()
 #define JAWS_ARGS
 #define CW_USEDEFAULT (1<<31)
 #define ICS_TEXT_MENU_SIZE 90
+#define DEBUG_FILE "xboard.debug"
 #define SetCurrentDirectory chdir
 #define GetCurrentDirectory(SIZE, NAME) getcwd(NAME, SIZE)
 #define OPTCHAR "-"
 #define SEPCHAR " "
 
 // these two must some day move to frontend.h, when they are implemented
-Boolean EvalGraphIsUp();
 Boolean MoveHistoryIsUp();
 Boolean GameListIsUp();
 
@@ -1261,6 +1265,8 @@ Boolean GameListIsUp();
 // front-end part of option handling
 
 // [HGM] This platform-dependent table provides the location for storing the color info
+extern char *crWhite, * crBlack;
+
 void *
 colorVariable[] = {
   &appData.whitePieceColor, 
@@ -1275,8 +1281,8 @@ colorVariable[] = {
   NULL,
   NULL,
   NULL,
-  NULL,
-  NULL,
+  &crWhite,
+  &crBlack,
   NULL
 };
 
@@ -1357,7 +1363,9 @@ SaveFontArg(FILE *f, ArgDescriptor *ad)
     default:
       return;
   }
-  fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", ad->argName, name);
+//  Do not save fonts for now, as the saved font would be board-size specific
+//  and not suitable for a re-start at another board size
+//  fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", ad->argName, name); 
 }
 
 void
@@ -1420,15 +1428,12 @@ GetWindowCoords()
   GetActualPlacement(shellWidget, &wpMain);
   if(EngineOutputIsUp()) GetActualPlacement(engineOutputShell, &wpEngineOutput); else
   if(MoveHistoryIsUp()) GetActualPlacement(historyShell, &wpMoveHistory);
+  if(EvalGraphIsUp()) GetActualPlacement(evalGraphShell, &wpEvalGraph);
   if(GameListIsUp()) GetActualPlacement(gameListShell, &wpGameList);
   if(commentShell) GetActualPlacement(commentShell, &wpComment);
   else             GetActualPlacement(editShell,    &wpComment);
   if(tagsShell) GetActualPlacement(tagsShell, &wpTags);
   else      GetActualPlacement(editTagsShell, &wpTags);
-#if 0
-  GetActualPlacement(hwndConsole, &wpConsole);
-  GetActualPlacement(evalGraphDialog, &wpEvalGraph);
-#endif
 }
 
 void
@@ -1460,12 +1465,6 @@ EnsureOnScreen(int *x, int *y, int minX, int minY)
   return;
 }
 
-Boolean
-EvalGraphIsUp()
-{
-  return False;
-}
-
 int
 MainWindowUp()
 { // [HGM] args: allows testing if main window is realized from back-end
@@ -1659,45 +1658,9 @@ main(argc, argv)
     char *p;
     XrmDatabase xdb;
     int forceMono = False;
-//define INDIRECTION
-#ifdef INDIRECTION
-    // [HGM] before anything else, expand any indirection files amongst options
-    char *argvCopy[1000]; // 1000 seems enough
-    char newArgs[10000];  // holds actual characters
-    int k = 0;
 
     srandom(time(0)); // [HGM] book: make random truly random
 
-    j = 0;
-    for(i=0; i<argc; i++) {
-       if(j >= 1000-2) { printf(_("too many arguments\n")); exit(-1); }
-//fprintf(stderr, "arg %s\n", argv[i]);
-       if(argv[i][0] != '@') argvCopy[j++] = argv[i]; else {
-           char c;
-           FILE *f = fopen(argv[i]+1, "rb");
-           if(f == NULL) { fprintf(stderr, _("ignore %s\n"), argv[i]); continue; } // do not expand non-existing
-           argvCopy[j++] = newArgs + k; // get ready for first argument from file
-           while((c = fgetc(f)) != EOF) { // each line of file inserts 1 argument in the list
-               if(c == '\n') {
-                   if(j >= 1000-2) { printf(_("too many arguments\n")); exit(-1); }
-                   newArgs[k++] = 0;  // terminate current arg
-                   if(k >= 10000-1) { printf(_("too long arguments\n")); exit(-1); }
-                   argvCopy[j++] = newArgs + k; // get ready for next
-               } else {
-                   if(k >= 10000-1) { printf(_("too long arguments\n")); exit(-1); }
-                   newArgs[k++] = c;
-               }
-           }
-           newArgs[k] = 0;
-           j--;
-           fclose(f);
-       }
-    }
-    argvCopy[j] = NULL;
-    argv = argvCopy;
-    argc = j;
-#endif
-
     setbuf(stdout, NULL);
     setbuf(stderr, NULL);
     debugFP = stderr;
@@ -2466,10 +2429,11 @@ XBoard square size (hint): %d\n\
       HistoryPopUp();
     }
 
-//    if( wpEvalGraph.visible ) {
-//      EvalGraphPopUp();
-//    }
-
+    if( wpEvalGraph.visible ) 
+      {
+       EvalGraphPopUp();
+      };
+    
     if( wpEngineOutput.visible ) {
       EngineOutputPopUp();
     }