/*\r
* wgamelist.c -- Game list window for WinBoard\r
- * $Id: wgamelist.c,v 2.1 2003/10/27 19:21:02 mann Exp $\r
*\r
- * Copyright 1995 Free Software Foundation, Inc.\r
+ * Copyright 1995,2009 Free Software Foundation, Inc.\r
+ *\r
+ * Enhancements Copyright 2005 Alessandro Scotti\r
*\r
* ------------------------------------------------------------------------\r
- * This program is free software; you can redistribute it and/or modify\r
+ *\r
+ * GNU XBoard is free software: you can redistribute it and/or modify\r
* it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
+ * the Free Software Foundation, either version 3 of the License, or (at\r
+ * your option) any later version.\r
*\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
+ * GNU XBoard is distributed in the hope that it will be useful, but\r
+ * WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+ * General Public License for more details.\r
*\r
* You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
- * ------------------------------------------------------------------------\r
- */\r
+ * along with this program. If not, see http://www.gnu.org/licenses/. *\r
+ *\r
+ *------------------------------------------------------------------------\r
+ ** See the file ChangeLog for a revision history. */\r
+\r
#include "config.h"\r
\r
#include <windows.h> /* required for all Windows applications */\r
#include "backend.h"\r
\r
#include "wsnap.h"\r
+#include "wgamelist.h"\r
+\r
+extern BoardSize boardSize;\r
\r
/* Module globals */\r
HWND gameListDialog = NULL;\r
BOOLEAN gameListUp = FALSE;\r
FILE* gameFile;\r
char* gameFileName = NULL;\r
-int gameListX, gameListY, gameListW, gameListH;\r
\r
/* Imports from winboard.c */\r
extern HINSTANCE hInst;\r
extern HWND hwndMain;\r
+extern WindowPlacement wpGameList;\r
\r
struct GameListStats\r
{\r
/* Initialize the dialog items */\r
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
+\r
count = GameListToListBox( hDlg, gameListDialog ? TRUE : FALSE, NULL, &stats );\r
\r
SendDlgItemMessage( hDlg, IDC_GameListFilter, WM_SETTEXT, 0, (LPARAM) "" );\r
GetClientRect(hDlg, &rect);\r
sizeX = rect.right;\r
sizeY = rect.bottom;\r
- if (gameListX != CW_USEDEFAULT && gameListY != CW_USEDEFAULT &&\r
- gameListW != CW_USEDEFAULT && gameListH != CW_USEDEFAULT) {\r
+ if (wpGameList.x != CW_USEDEFAULT && wpGameList.y != CW_USEDEFAULT &&\r
+ wpGameList.width != CW_USEDEFAULT && wpGameList.height != CW_USEDEFAULT) {\r
WINDOWPLACEMENT wp;\r
- EnsureOnScreen(&gameListX, &gameListY);\r
+ EnsureOnScreen(&wpGameList.x, &wpGameList.y, 0, 0);\r
wp.length = sizeof(WINDOWPLACEMENT);\r
wp.flags = 0;\r
wp.showCmd = SW_SHOW;\r
wp.ptMaxPosition.x = wp.ptMaxPosition.y = 0;\r
- wp.rcNormalPosition.left = gameListX;\r
- wp.rcNormalPosition.right = gameListX + gameListW;\r
- wp.rcNormalPosition.top = gameListY;\r
- wp.rcNormalPosition.bottom = gameListY + gameListH;\r
+ wp.rcNormalPosition.left = wpGameList.x;\r
+ wp.rcNormalPosition.right = wpGameList.x + wpGameList.width;\r
+ wp.rcNormalPosition.top = wpGameList.y;\r
+ wp.rcNormalPosition.bottom = wpGameList.y + wpGameList.height;\r
SetWindowPlacement(hDlg, &wp);\r
\r
GetClientRect(hDlg, &rect);\r
CmailLoadGame(gameFile, nItem + 1, gameFileName, TRUE);\r
}\r
else {\r
+ SetFocus(hwndMain); // [HGM] automatic focus switch\r
LoadGame(gameFile, nItem + 1, gameFileName, TRUE);\r
}\r
}\r
if (gameListDialog) {\r
SendMessage(gameListDialog, WM_INITDIALOG, 0, 0);\r
if (!gameListUp) ShowWindow(gameListDialog, SW_SHOW);\r
+ else SetFocus(gameListDialog);\r
} else {\r
lpProc = MakeProcInstance((FARPROC)GameListDialog, hInst);\r
CreateDialog(hInst, MAKEINTRESOURCE(DLG_GameList),\r
VOID ShowGameListProc()\r
{\r
if (gameListUp) {\r
- GameListPopDown();\r
+ if(gameListDialog) SetFocus(gameListDialog);\r
+// GameListPopDown();\r
} else {\r
if (gameFileName) {\r
GameListPopUp(gameFile, gameFileName);\r