allow the result comment as a display item in the game list
authorH.G. Muller <h.g.muller@hccnet.nl>
Sun, 27 Sep 2009 17:35:58 +0000 (10:35 -0700)
committerArun Persaud <arun@nubati.net>
Wed, 30 Sep 2009 05:17:57 +0000 (22:17 -0700)
common.h
gamelist.c
winboard/winboard.c
winboard/winboard.rc

index af659b4..fb218bc 100644 (file)
--- a/common.h
+++ b/common.h
@@ -615,10 +615,11 @@ typedef struct {
 #define GLT_TIME_CONTROL    't'
 #define GLT_VARIANT         'v'
 #define GLT_OUT_OF_BOOK     'a'
+#define GLT_RESULT_COMMENT  'c'     /* [HGM] rescom */
 
 #define GLT_DEFAULT_TAGS    "eprd"  /* Event, players, result, date */
 
-#define GLT_ALL_TAGS        "esdoprwbtva"
+#define GLT_ALL_TAGS        "esdoprwbtvac"
 
 #define PGN_OUT_OF_BOOK     "Annotator"
 
index a0978a0..0a4979e 100644 (file)
@@ -111,6 +111,7 @@ void GameListInitGameInfo(gameInfo)
     gameInfo->blackRating = -1; /* unknown */
     gameInfo->variant = VariantNormal;
     gameInfo->outOfBook = NULL;
+    gameInfo->resultDetails = NULL;
 }
 
 
@@ -155,6 +156,7 @@ int GameListBuild(f)
     ListGame *currentListGame = NULL;
     int error;
     int offset;
+    char lastComment[MSG_SIZ];
 
     GameListFree(&gameList);
     yynewfile(f);
@@ -240,6 +242,19 @@ int GameListBuild(f)
              lastStart = MoveNumberOne;
            }
            break;
+        case WhiteWins: // [HGM] rescom: save last comment as result details
+        case BlackWins:
+        case GameIsDrawn:
+        case GameUnfinished:
+           if (currentListGame->gameInfo.resultDetails != NULL) {
+               free(currentListGame->gameInfo.resultDetails);
+           }
+           if(yy_text[0] == '{') { char *p;
+               strcpy(lastComment, yy_text+1);
+               if(p = strchr(lastComment, '}')) *p = 0;
+               currentListGame->gameInfo.resultDetails = StrSave(lastComment);
+           }
+           break;
          default:
            break;
        }
@@ -302,6 +317,9 @@ void ClearGameInfo(gameInfo)
     if (gameInfo->outOfBook != NULL) {
         free(gameInfo->outOfBook);
     }
+    if (gameInfo->resultDetails != NULL) {
+        free(gameInfo->resultDetails);
+    }
 
     GameListInitGameInfo(gameInfo);
 }
@@ -381,6 +399,9 @@ char * GameListLine( int number, GameInfo * gameInfo )
         case GLT_OUT_OF_BOOK:
             strncpy( buf, gameInfo->outOfBook ? gameInfo->outOfBook : "?", MAX_FIELD_LEN );
             break;
+        case GLT_RESULT_COMMENT:
+            strncpy( buf, gameInfo->resultDetails ? gameInfo->resultDetails : "res?", MAX_FIELD_LEN );
+            break;
         default:
             break;
         }
index 4cb6ef4..e270565 100644 (file)
@@ -497,6 +497,7 @@ static int fromX = -1, fromY = -1, toX, toY; // [HGM] moved upstream, so JAWS ca
 #include "jaws.c"\r
 #else\r
 #define JAWS_INIT\r
+#define JAWS_ARGS\r
 #define JAWS_ALT_INTERCEPT\r
 #define JAWS_KB_NAVIGATION\r
 #define JAWS_MENU_ITEMS\r
@@ -919,6 +920,7 @@ ArgDescriptor argDescriptors[] = {
   { "loadGameFile", ArgFilename, (LPVOID) &appData.loadGameFile, FALSE },\r
   { "", ArgNone, NULL },\r
   /* keyword arguments */\r
+  JAWS_ARGS\r
   { "whitePieceColor", ArgColor, (LPVOID) &whitePieceColor, TRUE },\r
   { "wpc", ArgColor, (LPVOID) &whitePieceColor, FALSE },\r
   { "blackPieceColor", ArgColor, (LPVOID) &blackPieceColor, TRUE },\r
@@ -9408,6 +9410,7 @@ static GLT_Item GLT_ItemInfo[] = {
     { GLT_TIME_CONTROL,"Time Control" },\r
     { GLT_VARIANT,    "Variant" },\r
     { GLT_OUT_OF_BOOK,PGN_OUT_OF_BOOK },\r
+    { GLT_RESULT_COMMENT, "Result Comment" }, // [HGM] rescom\r
     { 0, 0 }\r
 };\r
 \r
index bb0927d..ba85b6f 100644 (file)
@@ -393,25 +393,26 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Sounds"\r
 FONT 8, "MS Sans Serif"\r
 BEGIN\r
-    DEFPUSHBUTTON   "OK",IDOK,132,86,50,14\r
-    PUSHBUTTON      "Cancel",IDCANCEL,188,86,50,14\r
-    LTEXT           "Event:",IDC_STATIC,4,7,26,9\r
+    LTEXT           "&Event:",IDC_STATIC,4,7,26,9\r
     COMBOBOX        CBO_Sounds,30,4,208,110,CBS_DROPDOWNLIST | WS_VSCROLL | \r
                     WS_TABSTOP\r
-    CONTROL         "No sound",OPT_NoSound,"Button",BS_AUTORADIOBUTTON | \r
+//    GROUPBOX        "sound type",IDC_STATIC,8,18,66,62\r
+    CONTROL         "&No sound",OPT_NoSound,"Button",BS_AUTORADIOBUTTON | \r
                     WS_GROUP | WS_TABSTOP,12,22,47,10\r
-    CONTROL         "Default beep",OPT_DefaultBeep,"Button",\r
+    CONTROL         "&Default beep",OPT_DefaultBeep,"Button",\r
                     BS_AUTORADIOBUTTON | WS_TABSTOP,12,36,57,10\r
-    CONTROL         "Built-in sound:",OPT_BuiltInSound,"Button",\r
+    CONTROL         "&Built-in sound:",OPT_BuiltInSound,"Button",\r
                     BS_AUTORADIOBUTTON | WS_TABSTOP,12,51,60,10\r
-    COMBOBOX        OPT_BuiltInSoundName,76,48,103,109,CBS_DROPDOWNLIST | \r
-                    CBS_SORT | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Play",OPT_PlaySound,188,47,50,14\r
-    CONTROL         "WAV file:",OPT_WavFile,"Button",BS_AUTORADIOBUTTON | \r
+    CONTROL         "&WAV file:",OPT_WavFile,"Button",BS_AUTORADIOBUTTON | \r
                     WS_TABSTOP,12,66,45,10\r
+    COMBOBOX        OPT_BuiltInSoundName,76,48,103,109,CBS_DROPDOWNLIST | \r
+                    CBS_SORT | WS_VSCROLL | WS_TABSTOP | WS_GROUP\r
     EDITTEXT        OPT_WavFileName,76,65,103,12,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "Browse...",OPT_BrowseSound,188,64,50,14\r
+    PUSHBUTTON      "B&rowse...",OPT_BrowseSound,188,64,50,14\r
     PUSHBUTTON      "Defaults",OPT_DefaultSounds,6,86,50,14\r
+    DEFPUSHBUTTON   "OK",IDOK,132,86,50,14\r
+    PUSHBUTTON      "Cancel",IDCANCEL,188,86,50,14\r
+    PUSHBUTTON      "&Play",OPT_PlaySound,188,47,50,14\r
 END\r
 \r
 DLG_GeneralOptions DIALOG DISCARDABLE  0, 0, 250, 183\r
@@ -756,21 +757,21 @@ BEGIN
     PUSHBUTTON      "Cancel",IDCANCEL,122,28,50,14\r
 END\r
 \r
-DLG_GameListOptions DIALOG DISCARDABLE  0, 0, 206, 140\r
+DLG_GameListOptions DIALOG DISCARDABLE  0, 0, 206, 150\r
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU\r
 CAPTION "Game List Options"\r
 FONT 8, "MS Sans Serif"\r
 BEGIN\r
     LTEXT           "PGN &Tags:",IDC_GLT,2,2,36,8\r
-    LISTBOX         IDC_GameListTags,2,12,158,102,LBS_USETABSTOPS | \r
+    LISTBOX         IDC_GameListTags,2,12,158,112,LBS_USETABSTOPS | \r
                     LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP\r
     PUSHBUTTON      "&Up",IDC_GLT_Up,164,12,38,14\r
     PUSHBUTTON      "&Down",IDC_GLT_Down,164,30,38,14\r
-    PUSHBUTTON      "Default",IDC_GLT_Restore,164,82,38,14\r
-    PUSHBUTTON      "Factory",IDC_GLT_Default,164,100,38,14\r
-    DEFPUSHBUTTON   "OK",IDOK,96,122,50,14\r
-    PUSHBUTTON      "Cancel",IDCANCEL,152,122,50,14\r
-    LTEXT           "Restore to:",IDC_GLT_RestoreTo,164,70,36,8\r
+    PUSHBUTTON      "Default",IDC_GLT_Restore,164,92,38,14\r
+    PUSHBUTTON      "Factory",IDC_GLT_Default,164,110,38,14\r
+    DEFPUSHBUTTON   "OK",IDOK,96,132,50,14\r
+    PUSHBUTTON      "Cancel",IDCANCEL,152,132,50,14\r
+    LTEXT           "Restore to:",IDC_GLT_RestoreTo,164,80,36,8\r
 END\r
 \r
 DLG_MoveHistory DIALOGEX 0, 0, 225, 130\r