home *** CD-ROM | disk | FTP | other *** search
/ MORE WinGames / WINGAMES.iso / chess / initmenu.c < prev    next >
C/C++ Source or Header  |  1991-06-16  |  4KB  |  103 lines

  1. /*
  2.   C source for GNU CHESS
  3.  
  4.   Revision: 1990-09-30
  5.  
  6.   Modified by Daryl Baker for use in MS WINDOWS environment
  7.  
  8.   This file is part of CHESS.
  9.  
  10.   CHESS is distributed in the hope that it will be useful, but WITHOUT ANY
  11.   WARRANTY.  No author or distributor accepts responsibility to anyone for
  12.   the consequences of using it or for whether it serves any particular
  13.   purpose or works at all, unless he says so in writing.  Refer to the CHESS
  14.   General Public License for full details.
  15.  
  16.   Everyone is granted permission to copy, modify and redistribute CHESS, but
  17.   only under the conditions described in the CHESS General Public License.
  18.   A copy of this license is supposed to have been given to you along with
  19.   CHESS so you can know your rights and responsibilities.  It should be in a
  20.   file named COPYING.  Among other things, the copyright notice and this
  21.   notice must be preserved on all copies.
  22. */
  23.  
  24. #define NOATOM 
  25. #define NOCLIPBOARD
  26. #define NOCREATESTRUCT
  27. #define NOFONT
  28. #define NOREGION
  29. #define NOSOUND
  30. #define NOWH
  31. #define NOWINOFFSETS
  32. #define NOCOMM
  33. #define NOKANJI
  34.  
  35. #include <windows.h>
  36. #include "gnuchess.h"
  37. #include "chess.h"
  38.  
  39. extern int coords;
  40.  
  41. void Init_Menus (HWND hWnd, WORD wParam, LONG lParam )
  42. {
  43.    WORD Status;
  44.         if ( lParam == MENU_ID_FILE )  {
  45.             EnableMenuItem ( wParam, MSG_CHESS_SAVE,
  46.                              (GameCnt>0 ? MF_ENABLED : MF_GRAYED) );
  47.             EnableMenuItem ( wParam, MSG_CHESS_LIST,
  48.                              (GameCnt>0 ? MF_ENABLED : MF_GRAYED) );
  49.  
  50.         } else if ( lParam == MENU_ID_EDIT ) {       /*Edit Menu */
  51.             EnableMenuItem ( wParam, MSG_CHESS_REVIEW,
  52.                              (GameCnt>0 ? MF_ENABLED : MF_GRAYED) );
  53.             EnableMenuItem ( wParam, MSG_CHESS_UNDO,
  54.                              (GameCnt>0 ? MF_ENABLED : MF_GRAYED) );
  55.             EnableMenuItem ( wParam, MSG_CHESS_REMOVE,
  56.                              (GameCnt>1 ? MF_ENABLED : MF_GRAYED) );
  57.             if ( flag.force == false)  Status = MF_UNCHECKED; else Status = MF_CHECKED;
  58.             CheckMenuItem ( wParam, MSG_CHESS_FORCE, Status);
  59.  
  60.         } else if ( lParam == MENU_ID_OPTIONS ){  /* Options Menu */
  61.             if ( flag.hash == false)  Status = MF_UNCHECKED; else Status = MF_CHECKED;
  62.             CheckMenuItem ( wParam, MSG_CHESS_HASH, Status);
  63.  
  64.             if ( coords == false)  Status = MF_UNCHECKED; else Status = MF_CHECKED;
  65.             CheckMenuItem ( wParam, MSG_CHESS_COORD, Status);
  66.  
  67.             if ( flag.beep == false)  Status = MF_UNCHECKED; else Status = MF_CHECKED;
  68.             CheckMenuItem ( wParam, MSG_CHESS_BEEP, Status);
  69.  
  70.             if ( flag.bothsides == false)  Status = MF_UNCHECKED; else Status = MF_CHECKED;
  71.             CheckMenuItem ( wParam, MSG_CHESS_BOTH, Status);
  72.  
  73.             if ( Book == NULL)  Status = MF_UNCHECKED; else Status = MF_CHECKED;
  74.             CheckMenuItem ( wParam, MSG_CHESS_BOOK, Status);
  75.  
  76.             if ( flag.post == false)  Status = MF_UNCHECKED; else Status = MF_CHECKED;
  77.             CheckMenuItem ( wParam, MSG_CHESS_POST, Status);
  78.         } else if (lParam == MENU_ID_SKILL) {
  79.            if ( dither == 0)
  80.                   Status = MF_UNCHECKED; else Status = MF_CHECKED;
  81.             CheckMenuItem ( wParam, MSG_CHESS_RANDOM, Status);
  82.   
  83.             if ( flag.easy == false)
  84.                   Status = MF_UNCHECKED; else Status = MF_CHECKED;
  85.             CheckMenuItem ( wParam, MSG_CHESS_EASY, Status);
  86.  
  87.          } else if ( lParam == MENU_ID_SIDE) {
  88.             if ( flag.reverse == false)
  89.                   Status = MF_UNCHECKED; else Status = MF_CHECKED;
  90.             CheckMenuItem ( wParam, MSG_CHESS_REVERSE, Status);
  91.   
  92.             if ( computer == black ){
  93.                CheckMenuItem ( wParam, MSG_CHESS_BLACK, MF_CHECKED);
  94.                CheckMenuItem ( wParam, MSG_CHESS_WHITE, MF_UNCHECKED);
  95.             } else {
  96.                CheckMenuItem ( wParam, MSG_CHESS_WHITE, MF_CHECKED);
  97.                CheckMenuItem ( wParam, MSG_CHESS_BLACK, MF_UNCHECKED);
  98.             }
  99.  
  100.          }
  101.  
  102. }
  103.