[SNDVOL32] Disable the balance trackbar for mono channels.
authorEric Kohl <eric.kohl@reactos.org>
Mon, 11 Feb 2019 20:16:32 +0000 (21:16 +0100)
committerEric Kohl <eric.kohl@reactos.org>
Mon, 11 Feb 2019 20:16:32 +0000 (21:16 +0100)
CORE-15743

base/applications/sndvol32/dialog.c

index 8ff9a49..a93a638 100644 (file)
@@ -562,21 +562,36 @@ EnumConnectionsCallback(
                                   }
                               }
 
-                              /* Set the balance trackbar */
-                              wID = (PrefContext->Count + 1) * IDC_LINE_SLIDER_HORZ;
-
-                              /* get dialog control */
-                              hDlgCtrl = GetDlgItem(PrefContext->MixerWindow->hWnd, wID);
+                              if (Line->cChannels == 1)
+                              {
+                                  /* Disable the balance trackbar for mono channels */
+                                  wID = (PrefContext->Count + 1) * IDC_LINE_SLIDER_HORZ;
 
-                              if (hDlgCtrl != NULL)
+                                  /* get dialog control */
+                                  hDlgCtrl = GetDlgItem(PrefContext->MixerWindow->hWnd, wID);
+                                  if (hDlgCtrl != NULL)
+                                  {
+                                      EnableWindow(hDlgCtrl, FALSE);
+                                  }
+                              }
+                              else if (Line->cChannels == 2)
                               {
-                                  /* check state */
-                                  LRESULT OldPosition = SendMessageW(hDlgCtrl, TBM_GETPOS, 0, 0);
+                                  /* Set the balance trackbar */
+                                  wID = (PrefContext->Count + 1) * IDC_LINE_SLIDER_HORZ;
+
+                                  /* get dialog control */
+                                  hDlgCtrl = GetDlgItem(PrefContext->MixerWindow->hWnd, wID);
 
-                                  if (OldPosition != balancePosition)
+                                  if (hDlgCtrl != NULL)
                                   {
-                                      /* update control state */
-                                      SendMessageW(hDlgCtrl, TBM_SETPOS, (WPARAM)TRUE, balancePosition);
+                                      /* check state */
+                                      LRESULT OldPosition = SendMessageW(hDlgCtrl, TBM_GETPOS, 0, 0);
+
+                                      if (OldPosition != balancePosition)
+                                      {
+                                          /* update control state */
+                                          SendMessageW(hDlgCtrl, TBM_SETPOS, (WPARAM)TRUE, balancePosition);
+                                      }
                                   }
                               }
                           }