added a "Mute All Sounds" item in the WinBoard Options menu, on Eric's request
[xboard.git] / winboard / winboard.c
index 6452a5b..81aa0fb 100644 (file)
@@ -879,6 +879,7 @@ InitInstance(HINSTANCE hInstance, int nCmdShow, LPSTR lpCmdLine)
     ShowWindow(hwndConsole, nCmdShow);\r
   }\r
   if(!appData.noGUI)   UpdateWindow(hwnd);  else ShowWindow(hwnd, SW_MINIMIZE);\r
+  if(gameListDialog) SetFocus(gameListDialog); // [HGM] jaws: for if we clicked multi-game game file\r
 \r
   return TRUE;\r
 \r
@@ -6133,6 +6134,12 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
       DrawPosition(FALSE, NULL);\r
       break;\r
 \r
+    case IDM_MuteSounds:\r
+      mute = !mute; // [HGM] mute: keep track of global muting variable\r
+      CheckMenuItem(GetMenu(hwndMain),IDM_MuteSounds, \r
+                               MF_BYCOMMAND|(mute?MF_CHECKED:MF_UNCHECKED));\r
+      break;\r
+\r
     case IDM_GeneralOptions:\r
       GeneralOptionsPopup(hwnd);\r
       DrawPosition(TRUE, NULL);\r
@@ -6692,6 +6699,7 @@ MyPlaySound(MySound *ms)
 {\r
   BOOLEAN ok = FALSE;\r
 \r
+  if(mute) return TRUE; // [HGM] mute: suppress all sound play when muted\r
   switch (ms->name[0]) {\r
   case NULLCHAR:\r
        if(appData.debugMode) fprintf(debugFP, "silence\n");\r