X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwgamelist.c;h=26c843be2b508e7a408d9f82f0f92dafc7081d8b;hb=4d057f1c54f1904fc7e01828b5896c2a979d15ea;hp=1c8a15d294b506bfc0a5eca93000b25194f4124e;hpb=570f0d333ffba03730d5bc5a69ef5a509247104f;p=xboard.git diff --git a/winboard/wgamelist.c b/winboard/wgamelist.c index 1c8a15d..26c843b 100644 --- a/winboard/wgamelist.c +++ b/winboard/wgamelist.c @@ -1,9 +1,10 @@ /* * wgamelist.c -- Game list window for WinBoard - * $Id: wgamelist.c,v 2.1 2003/10/27 19:21:02 mann Exp $ * * Copyright 1995,2009 Free Software Foundation, Inc. * + * Enhancements Copyright 2005 Alessandro Scotti + * * ------------------------------------------------------------------------ * * GNU XBoard is free software: you can redistribute it and/or modify @@ -41,16 +42,18 @@ #include "wsnap.h" #include "wgamelist.h" +extern BoardSize boardSize; + /* Module globals */ HWND gameListDialog = NULL; BOOLEAN gameListUp = FALSE; FILE* gameFile; char* gameFileName = NULL; -int gameListX, gameListY, gameListW, gameListH; /* Imports from winboard.c */ extern HINSTANCE hInst; extern HWND hwndMain; +extern WindowPlacement wpGameList; struct GameListStats { @@ -224,6 +227,9 @@ GameListDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) /* Initialize the dialog items */ hwndText = GetDlgItem(hDlg, OPT_TagsText); + /* Set font */ + SendDlgItemMessage( hDlg, OPT_GameListText, WM_SETFONT, (WPARAM)font[boardSize][MOVEHISTORY_FONT]->hf, MAKELPARAM(TRUE, 0 )); + count = GameListToListBox( hDlg, gameListDialog ? TRUE : FALSE, NULL, &stats ); SendDlgItemMessage( hDlg, IDC_GameListFilter, WM_SETTEXT, 0, (LPARAM) "" ); @@ -238,18 +244,18 @@ GameListDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) GetClientRect(hDlg, &rect); sizeX = rect.right; sizeY = rect.bottom; - if (gameListX != CW_USEDEFAULT && gameListY != CW_USEDEFAULT && - gameListW != CW_USEDEFAULT && gameListH != CW_USEDEFAULT) { + if (wpGameList.x != CW_USEDEFAULT && wpGameList.y != CW_USEDEFAULT && + wpGameList.width != CW_USEDEFAULT && wpGameList.height != CW_USEDEFAULT) { WINDOWPLACEMENT wp; - EnsureOnScreen(&gameListX, &gameListY); + EnsureOnScreen(&wpGameList.x, &wpGameList.y, 0, 0); wp.length = sizeof(WINDOWPLACEMENT); wp.flags = 0; wp.showCmd = SW_SHOW; wp.ptMaxPosition.x = wp.ptMaxPosition.y = 0; - wp.rcNormalPosition.left = gameListX; - wp.rcNormalPosition.right = gameListX + gameListW; - wp.rcNormalPosition.top = gameListY; - wp.rcNormalPosition.bottom = gameListY + gameListH; + wp.rcNormalPosition.left = wpGameList.x; + wp.rcNormalPosition.right = wpGameList.x + wpGameList.width; + wp.rcNormalPosition.top = wpGameList.y; + wp.rcNormalPosition.bottom = wpGameList.y + wpGameList.height; SetWindowPlacement(hDlg, &wp); GetClientRect(hDlg, &rect); @@ -414,6 +420,7 @@ GameListDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) CmailLoadGame(gameFile, nItem + 1, gameFileName, TRUE); } else { + SetFocus(hwndMain); // [HGM] automatic focus switch LoadGame(gameFile, nItem + 1, gameFileName, TRUE); } } @@ -440,6 +447,7 @@ VOID GameListPopUp(FILE *fp, char *filename) if (gameListDialog) { SendMessage(gameListDialog, WM_INITDIALOG, 0, 0); if (!gameListUp) ShowWindow(gameListDialog, SW_SHOW); + else SetFocus(gameListDialog); } else { lpProc = MakeProcInstance((FARPROC)GameListDialog, hInst); CreateDialog(hInst, MAKEINTRESOURCE(DLG_GameList), @@ -477,7 +485,8 @@ VOID GameListDestroy() VOID ShowGameListProc() { if (gameListUp) { - GameListPopDown(); + if(gameListDialog) SetFocus(gameListDialog); +// GameListPopDown(); } else { if (gameFileName) { GameListPopUp(gameFile, gameFileName);