From b5f58e6a8f9f29fd221ca37688a3d8aad7e166e0 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Mon, 17 Jan 2011 00:28:32 +0100 Subject: [PATCH] Fix WB Sound Options greyout and remove some grossness The sound and ICS Options menu items in WB were accessed 'by position', with fixed defined positions (always messing up any reorganization of the menus when you forgot to redefine the position constants in winboard.h). And not only that, but for completely mysterious reasons, the greying of the sound item greyed out the game-list options (above it) in stead when it was defined as 9, and the ICS options (below it) when it was 10 !!!. Now they are addressed 'by command' (and the position definitions are removed), which fixes things. --- winboard/winboard.c | 7 +++---- winboard/winboard.h | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/winboard/winboard.c b/winboard/winboard.c index c722994..a04d77f 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -7851,6 +7851,7 @@ Enables ncpEnables[] = { { IDM_NewChat, MF_BYCOMMAND|MF_GRAYED }, { IDM_Engine1Options, MF_BYCOMMAND|MF_GRAYED }, { IDM_Engine2Options, MF_BYCOMMAND|MF_GRAYED }, + { IDM_Sounds, MF_BYCOMMAND|MF_GRAYED }, { -1, -1 } }; @@ -8034,8 +8035,8 @@ SetICSMode() { HMENU hmenu = GetMenu(hwndMain); SetMenuEnables(hmenu, icsEnables); - EnableMenuItem(GetSubMenu(hmenu, OPTIONS_POS), ICS_POS, - MF_BYPOSITION|MF_ENABLED); + EnableMenuItem(GetSubMenu(hmenu, OPTIONS_POS), IDM_IcsOptions, + MF_BYCOMMAND|MF_ENABLED); #if ZIPPY if (appData.zippyPlay) { SetMenuEnables(hmenu, zippyEnables); @@ -8057,8 +8058,6 @@ SetNCPMode() { HMENU hmenu = GetMenu(hwndMain); SetMenuEnables(hmenu, ncpEnables); - EnableMenuItem(GetSubMenu(hmenu, OPTIONS_POS), SOUNDS_POS, - MF_BYPOSITION|MF_GRAYED); DrawMenuBar(hwndMain); } diff --git a/winboard/winboard.h b/winboard/winboard.h index 932ae66..7b14b7e 100644 --- a/winboard/winboard.h +++ b/winboard/winboard.h @@ -149,8 +149,6 @@ void SaveSettings(char* name); /* It's gross that these are needed. */ #define ACTION_POS 4 /* Posn of "Action" on menu bar */ #define OPTIONS_POS 6 /* Posn of "Options" on menu bar */ -#define ICS_POS 12 /* Posn of "ICS " on Options menu */ -#define SOUNDS_POS 11 /* Posn of "Sounds" on Options menu */ /* end grossness */ extern MyFont *font[NUM_SIZES][NUM_FONTS]; -- 1.7.0.4