Give WinBoard Game List its own font
[xboard.git] / winboard / wgamelist.c
index e13bcf0..863725a 100644 (file)
@@ -1,7 +1,7 @@
 /*\r
  * wgamelist.c -- Game list window for WinBoard\r
  *\r
- * Copyright 1995, 2009, 2010 Free Software Foundation, Inc.\r
+ * Copyright 1995, 2009, 2010, 2011 Free Software Foundation, Inc.\r
  *\r
  * Enhancements Copyright 2005 Alessandro Scotti\r
  *\r
@@ -166,7 +166,7 @@ GameListDialog(HWND hDlg, UINT message,     WPARAM wParam, LPARAM lParam)
     hwndText = GetDlgItem(hDlg, OPT_TagsText);\r
 \r
     /* Set font */\r
-    SendDlgItemMessage( hDlg, OPT_GameListText, WM_SETFONT, (WPARAM)font[boardSize][MOVEHISTORY_FONT]->hf, MAKELPARAM(TRUE, 0 ));\r
+    SendDlgItemMessage( hDlg, OPT_GameListText, WM_SETFONT, (WPARAM)font[boardSize][GAMELIST_FONT]->hf, MAKELPARAM(TRUE, 0 ));\r
 \r
     count = GameListToListBox( hDlg, gameListDialog ? TRUE : FALSE, NULL, &stats );\r
 \r
@@ -208,6 +208,7 @@ GameListDialog(HWND hDlg, UINT message,     WPARAM wParam, LPARAM lParam)
 \r
     }\r
       GameListUpdateTitle( hDlg, _("Game List"), count, ((ListGame *) gameList.tailPred)->number, &stats ); // [HGM] always update title\r
+    GameListHighlight(lastLoadGameNumber);\r
     return FALSE;\r
 \r
   case WM_SIZE:\r
@@ -359,8 +360,8 @@ GameListDialog(HWND hDlg, UINT message,     WPARAM wParam, LPARAM lParam)
             CmailLoadGame(gameFile, nItem + 1, gameFileName, TRUE);\r
         }\r
         else {\r
-           SetFocus(hwndMain); // [HGM] automatic focus switch\r
             LoadGame(gameFile, nItem + 1, gameFileName, TRUE);\r
+           SetFocus(hwndMain); // [HGM] automatic focus switch\r
         }\r
     }\r
 \r
@@ -406,9 +407,15 @@ VOID GameListPopDown(void)
 \r
 VOID GameListHighlight(int index)\r
 {\r
+  char buf[MSG_SIZ];\r
+  int i, res = 0;\r
   if (gameListDialog == NULL) return;\r
+  for(i=0; res != LB_ERR; i++) {\r
+        res = SendDlgItemMessage( gameListDialog, OPT_GameListText, LB_GETTEXT, i, (LPARAM)buf );\r
+        if(index <= atoi( buf )) break;\r
+  }\r
   SendDlgItemMessage(gameListDialog, OPT_GameListText,\r
-    LB_SETCURSEL, index - 1, 0);\r
+    LB_SETCURSEL, i, 0);\r
 }\r
 \r
 \r