X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwgamelist.c;h=31d36ff3af77153460c7583a2e2b6d8d26489259;hb=fc95d91428ac0e5327b7d2a9a49188948dc0572e;hp=ee9759b0dea2d4e1c5e7bf869cb27c9515ed15d2;hpb=91d8e5853ca580769cc130aa6ea004869118d171;p=xboard.git diff --git a/winboard/wgamelist.c b/winboard/wgamelist.c index ee9759b..31d36ff 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 @@ -34,22 +35,16 @@ #include #include "common.h" -#include "winboard.h" #include "frontend.h" #include "backend.h" +#include "winboard.h" #include "wsnap.h" /* 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; +static BOOLEAN gameListUp = FALSE; +static FILE* gameFile; +static char* gameFileName = NULL; struct GameListStats { @@ -223,6 +218,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) "" ); @@ -237,18 +235,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); @@ -258,7 +256,9 @@ GameListDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) newSizeX, newSizeY); sizeX = newSizeX; sizeY = newSizeY; - } + } + else + GetActualPlacement( gameListDialog, &wpGameList ); GameListUpdateTitle( hDlg, szDlgTitle, count, ((ListGame *) gameList.tailPred)->number, &stats ); } @@ -413,6 +413,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); } } @@ -439,6 +440,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), @@ -476,7 +478,8 @@ VOID GameListDestroy() VOID ShowGameListProc() { if (gameListUp) { - GameListPopDown(); + if(gameListDialog) SetFocus(gameListDialog); +// GameListPopDown(); } else { if (gameFileName) { GameListPopUp(gameFile, gameFileName);