From: H.G.Muller Date: Mon, 9 May 2016 05:08:18 +0000 (+0200) Subject: Add Mute all Sounds menu XB X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=8bafdd17133b7db1812f17181f370bbf88bfc6fb Add Mute all Sounds menu XB XBoard now also has a menu item to mute all sounds (except the Play button in the Sounds dialog) at the topof the Options menu, like WinBoard. --- diff --git a/dialogs.c b/dialogs.c index 9b48704..64001c2 100644 --- a/dialogs.c +++ b/dialogs.c @@ -866,7 +866,9 @@ static void Test (int n) { GenericReadout(soundOptions, 1); + mute <<= 1; // temporarily enable if(soundFiles[values[2]]) PlaySoundFile(soundFiles[values[2]]); + mute >>= 1; } void diff --git a/frontend.h b/frontend.h index 16d1f5b..8bdf558 100644 --- a/frontend.h +++ b/frontend.h @@ -216,6 +216,7 @@ extern char *programName; extern int commentUp; extern char *firstChessProgramNames; extern char *icsTextMenuString; +extern int mute; void GreyRevert P((Boolean grey)); void EnableNamedMenuItem P((char *menuRef, int state)); diff --git a/menus.c b/menus.c index 50968c1..fbc7893 100644 --- a/menus.c +++ b/menus.c @@ -403,6 +403,13 @@ EditMenuProc () } void +MuteProc () +{ + mute = !mute; + MarkMenuItem("Options.Mute", mute); +} + +void NothingProc () { return; @@ -726,6 +733,8 @@ MenuItem engineMenu[100] = { }; MenuItem optionsMenu[] = { + {N_("Mute all Sounds"), NULL, "Mute", MuteProc, CHECK}, + {"----", NULL, NULL, NothingProc}, #ifdef OPTIONSDIALOG {N_("General..."), NULL, "General", OptionsProc}, #endif diff --git a/usounds.c b/usounds.c index 6432335..dce58e0 100644 --- a/usounds.c +++ b/usounds.c @@ -76,10 +76,10 @@ extern char *getenv(); #include "common.h" #include "frontend.h" - int PlaySoundFile (char *name) { + if(mute == 1) return 1; if (*name == NULLCHAR) { return 0; } else if (strcmp(name, "$") == 0) { diff --git a/xboard.texi b/xboard.texi index 6187303..3b77b70 100644 --- a/xboard.texi +++ b/xboard.texi @@ -1415,6 +1415,10 @@ The maximum number of displayed engine names is set by the @section Options Menu @cindex Menu, Options @cindex Options Menu +@section Mute all Sounds +@cindex Mute sounds, Menu Item +Ticking this menu item toggles all sounds XBoard can make on or off, +without losing their definitions. @section General Options @cindex General Options, Menu Item The following items to set option values appear in the dialog