https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cc820b7f9f90198900727…
commit cc820b7f9f9019890072772bbfb13c0ef13993ba
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sat Feb 16 12:57:19 2019 +0100
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sat Feb 16 12:59:01 2019 +0100
[SNDVOL32] Disable the Mute checkbox for all lines that do not have a mute switch
control
---
base/applications/sndvol32/dialog.c | 39 +++++++++++++++++++++++++++++------
base/applications/sndvol32/sndvol32.c | 11 +++++++---
base/applications/sndvol32/sndvol32.h | 3 +++
3 files changed, 44 insertions(+), 9 deletions(-)
diff --git a/base/applications/sndvol32/dialog.c b/base/applications/sndvol32/dialog.c
index a93a638034..b8173ab763 100644
--- a/base/applications/sndvol32/dialog.c
+++ b/base/applications/sndvol32/dialog.c
@@ -66,13 +66,14 @@ LoadDialogResource(
LPWORD
AddDialogControl(
IN HWND hwndDialog,
- IN HWND * OutWnd,
+ OUT HWND *OutWnd,
IN LPRECT DialogOffset,
IN PDLGITEMTEMPLATE DialogItem,
IN DWORD DialogIdMultiplier,
IN HFONT hFont,
- UINT xBaseUnit,
- UINT yBaseUnit)
+ IN UINT xBaseUnit,
+ IN UINT yBaseUnit,
+ IN UINT MixerId)
{
RECT rect;
LPWORD Offset;
@@ -211,9 +212,23 @@ AddDialogControl(
SendMessage(hwnd, TBM_SETTIC, 0, (LPARAM)i);
}
}
- else if (!wcsicmp(ClassName, L"static") || !wcsicmp(ClassName,
L"button"))
+ else if (!wcsicmp(ClassName, L"static"))
{
- /* set font */
+ /* Set font */
+ SendMessageW(hwnd, WM_SETFONT, (WPARAM)hFont, TRUE);
+ }
+ else if (!wcsicmp(ClassName, L"button"))
+ {
+ if (DialogItem->style & BS_AUTOCHECKBOX)
+ {
+ if (MixerId == PLAY_MIXER)
+ {
+ /* Disable checkboxes by default, if we are in play mode */
+ EnableWindow(hwnd, FALSE);
+ }
+ }
+
+ /* Set font */
SendMessageW(hwnd, WM_SETFONT, (WPARAM)hFont, TRUE);
}
@@ -275,7 +290,15 @@ LoadDialogControls(
for (Index = 0; Index < ItemCount; Index++)
{
/* add controls */
- Offset = AddDialogControl(MixerWindow->hWnd,
&MixerWindow->Window[MixerWindow->WindowCount], DialogOffset, DialogItem,
DialogIdMultiplier, MixerWindow->hFont, xBaseUnit, yBaseUnit);
+ Offset = AddDialogControl(MixerWindow->hWnd,
+
&MixerWindow->Window[MixerWindow->WindowCount],
+ DialogOffset,
+ DialogItem,
+ DialogIdMultiplier,
+ MixerWindow->hFont,
+ xBaseUnit,
+ yBaseUnit,
+ MixerWindow->MixerId);
/* sanity check */
assert(Offset);
@@ -480,6 +503,10 @@ EnumConnectionsCallback(
if (hDlgCtrl != NULL)
{
+ /* Enable the 'Mute' checkbox, if we are in
play mode */
+ if (Mixer->MixerId == PLAY_MIXER)
+ EnableWindow(hDlgCtrl, TRUE);
+
/* check state */
if (SendMessageW(hDlgCtrl, BM_GETCHECK, 0, 0) !=
Details.fValue)
{
diff --git a/base/applications/sndvol32/sndvol32.c
b/base/applications/sndvol32/sndvol32.c
index 011bec2f12..7f3d118369 100644
--- a/base/applications/sndvol32/sndvol32.c
+++ b/base/applications/sndvol32/sndvol32.c
@@ -1328,7 +1328,7 @@ HandleCommandLine(LPTSTR cmdline,
{
TCHAR option;
- *pMixerId = 0;
+ *pMixerId = PLAY_MIXER;
*pMode = (dwStyle & 0x20) ? SMALL_MODE : NORMAL_MODE;
while (*cmdline == _T(' ') || *cmdline == _T('-') || *cmdline ==
_T('/'))
@@ -1348,6 +1348,11 @@ HandleCommandLine(LPTSTR cmdline,
case 'D':
break;
+ case 'n': /* Small size */
+ case 'N':
+ *pMode = NORMAL_MODE;
+ break;
+
case 's': /* Small size */
case 'S':
*pMode = SMALL_MODE;
@@ -1360,12 +1365,12 @@ HandleCommandLine(LPTSTR cmdline,
case 'p': /* Play mode */
case 'P':
- *pMixerId = 0;
+ *pMixerId = PLAY_MIXER;
break;
case 'r': /* Record mode */
case 'R':
- *pMixerId = 1;
+ *pMixerId = RECORD_MIXER;
break;
default:
diff --git a/base/applications/sndvol32/sndvol32.h
b/base/applications/sndvol32/sndvol32.h
index 65fcb36176..7ff11d8485 100644
--- a/base/applications/sndvol32/sndvol32.h
+++ b/base/applications/sndvol32/sndvol32.h
@@ -25,6 +25,9 @@
#define BALANCE_TICKS 1
#define BALANCE_PAGE_SIZE 12
+#define PLAY_MIXER 0
+#define RECORD_MIXER 1
+
typedef enum _WINDOW_MODE
{
NORMAL_MODE,