ReactOS  0.4.12-dev-701-g3ddf59e
dialog.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS Sound Volume Control
4  * FILE: base/applications/sndvol32/dialog.c
5  * PROGRAMMERS: Johannes Anderwald
6  */
7 
8 #include "sndvol32.h"
9 
10 
11 VOID
12 ConvertRect(LPRECT lpRect, UINT xBaseUnit, UINT yBaseUnit)
13 {
14  lpRect->left = MulDiv(lpRect->left, xBaseUnit, 4);
15  lpRect->right = MulDiv(lpRect->right, xBaseUnit, 4);
16  lpRect->top = MulDiv(lpRect->top, yBaseUnit, 8);
17  lpRect->bottom = MulDiv(lpRect->bottom, yBaseUnit, 8);
18 }
19 
20 LPVOID
23  IN LPCWSTR ResourceName,
24  OUT LPDWORD ResourceLength)
25 {
26  HRSRC hSrc;
27  HGLOBAL hRes;
28  PVOID Result;
29 
30  /* find resource */
31  hSrc = FindResourceW(hModule, ResourceName, (LPCWSTR)RT_DIALOG);
32 
33  if (!hSrc)
34  {
35  /* failed to find resource */
36  return NULL;
37  }
38 
39  /* now load the resource */
40  hRes = LoadResource(hAppInstance, hSrc);
41  if (!hRes)
42  {
43  /* failed to load resource */
44  return NULL;
45  }
46 
47  /* now lock the resource */
48  Result = LockResource(hRes);
49 
50  if (!Result)
51  {
52  /* failed to lock resource */
53  return NULL;
54  }
55 
56  if (ResourceLength)
57  {
58  /* store output length */
59  *ResourceLength = SizeofResource(hAppInstance, hSrc);
60  }
61 
62  /* done */
63  return Result;
64 }
65 
66 LPWORD
69  OUT HWND *OutWnd,
70  IN LPRECT DialogOffset,
71  IN PDLGITEMTEMPLATE DialogItem,
72  IN DWORD DialogIdMultiplier,
73  IN HFONT hFont,
74  IN UINT xBaseUnit,
75  IN UINT yBaseUnit,
76  IN UINT MixerId)
77 {
78  RECT rect;
79  LPWORD Offset;
80  LPWSTR ClassName, WindowName = NULL;
81  HWND hwnd;
82  DWORD wID;
83  INT nSteps, i;
84 
85  /* initialize client rectangle */
86  rect.left = DialogItem->x;
87  rect.top = DialogItem->y;
88  rect.right = DialogItem->x + DialogItem->cx;
89  rect.bottom = DialogItem->y + DialogItem->cy;
90 
91  /* Convert Dialog units to pixes */
92  ConvertRect(&rect, xBaseUnit, yBaseUnit);
93 
94  rect.left += DialogOffset->left;
95  rect.right += DialogOffset->left;
96  rect.top += DialogOffset->top;
97  rect.bottom += DialogOffset->top;
98 
99  /* move offset after dialog item */
100  Offset = (LPWORD)(DialogItem + 1);
101 
102  if (*Offset == 0xFFFF)
103  {
104  /* class is encoded as type */
105  Offset++;
106 
107  /* get control type */
108  switch(*Offset)
109  {
110  case 0x80:
111  ClassName = L"button";
112  WindowName = (LPWSTR)(Offset + 1);
113  break ;
114  case 0x82:
115  ClassName = L"static";
116  WindowName = (LPWSTR)(Offset + 1);
117  break;
118  default:
119  /* FIXME */
120  assert(0);
121  ClassName = NULL;
122  }
123  }
124  else
125  {
126  /* class name is encoded as string */
127  ClassName = (LPWSTR)Offset;
128 
129  /* move offset to the end of class string */
130  Offset += wcslen(ClassName);
131 
132  /* get window name */
133  WindowName = (LPWSTR)(Offset + 1);
134  }
135 
136  /* move offset past class type/string */
137  Offset++;
138 
139  if (DialogItem->id == MAXWORD)
140  {
141  /* id is not important */
142  wID = DialogItem->id;
143  }
144  else
145  {
146  /* calculate id */
147  wID = DialogItem->id * (DialogIdMultiplier + 1);
148 
149  }
150 
151  /* now create the window */
152  hwnd = CreateWindowExW(DialogItem->dwExtendedStyle,
153  ClassName,
154  WindowName,
155  DialogItem->style,
156  rect.left,
157  rect.top,
158  rect.right - rect.left,
159  rect.bottom - rect.top,
160  hwndDialog,
161  UlongToPtr(wID),
162  hAppInstance,
163  NULL);
164 
165  /* sanity check */
166  assert(hwnd);
167 
168  /* store window */
169  *OutWnd = hwnd;
170 
171  /* check if this the track bar */
172  if (!wcsicmp(ClassName, L"msctls_trackbar32"))
173  {
174  if (DialogItem->style & TBS_VERT)
175  {
176  /* Vertical trackbar: Volume */
177 
178  /* Disable the volume trackbar by default */
180 
181  /* set up range */
183 
184  /* set up page size */
186 
187  /* set position */
189 
190  /* Calculate and set ticks */
191  nSteps = (VOLUME_MAX / (VOLUME_TICKS + 1));
192  if (VOLUME_MAX % (VOLUME_TICKS + 1) != 0)
193  nSteps++;
194  for (i = nSteps; i < VOLUME_MAX; i += nSteps)
196  }
197  else
198  {
199  /* Horizontal trackbar: Balance */
200 
201  /* Disable the balance trackbar by default */
203 
204  /* set up range */
206 
207  /* set up page size */
209 
210  /* set position */
212 
213  /* Calculate and set ticks */
214  nSteps = (BALANCE_STEPS / (BALANCE_TICKS + 1));
215  if (BALANCE_STEPS % (BALANCE_TICKS + 1) != 0)
216  nSteps++;
217  for (i = nSteps; i < BALANCE_STEPS; i += nSteps)
219  }
220  }
221  else if (!wcsicmp(ClassName, L"static"))
222  {
223  /* Set font */
225  }
226  else if (!wcsicmp(ClassName, L"button"))
227  {
228  if (DialogItem->style & BS_AUTOCHECKBOX)
229  {
230  if (MixerId == PLAY_MIXER)
231  {
232  /* Disable checkboxes by default, if we are in play mode */
234  }
235  }
236 
237  /* Set font */
239  }
240 
241  //ShowWindow(hwnd, SW_SHOWNORMAL);
242 
243  if (WindowName != NULL)
244  {
245  /* move offset past window name */
246  Offset += wcslen(WindowName) + 1;
247  }
248 
249  /* check if there is additional data */
250  if (*Offset == 0)
251  {
252  /* no additional data */
253  Offset++;
254  }
255  else
256  {
257  /* FIXME: Determine whether this should be "Offset += 1 + *Offset" to explicitly skip the data count too. */
258  /* skip past additional data */
259  Offset += *Offset;
260  }
261 
262  /* make sure next template is word-aligned */
263  Offset = (LPWORD)(((ULONG_PTR)Offset + 3) & ~3);
264 
265  /* done */
266  return Offset;
267 }
268 
269 VOID
271  IN PMIXER_WINDOW MixerWindow,
272  LPRECT DialogOffset,
273  WORD ItemCount,
274  PDLGITEMTEMPLATE DialogItem,
275  DWORD DialogIdMultiplier,
276  UINT xBaseUnit,
277  UINT yBaseUnit)
278 {
279  LPWORD Offset;
280  WORD Index;
281 
282  /* sanity check */
283  assert(ItemCount);
284 
285  if (MixerWindow->Window)
286  MixerWindow->Window = (HWND*)HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MixerWindow->Window, (MixerWindow->WindowCount + ItemCount) * sizeof(HWND));
287  else
288  MixerWindow->Window = (HWND*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ItemCount * sizeof(HWND));
289  if (!MixerWindow->Window)
290  {
291  /* no memory */
292  return;
293  }
294 
295  /* enumerate now all controls */
296  for (Index = 0; Index < ItemCount; Index++)
297  {
298  /* add controls */
299  Offset = AddDialogControl(MixerWindow->hWnd,
300  &MixerWindow->Window[MixerWindow->WindowCount],
301  DialogOffset,
302  DialogItem,
303  DialogIdMultiplier,
304  MixerWindow->hFont,
305  xBaseUnit,
306  yBaseUnit,
307  MixerWindow->MixerId);
308 
309  /* sanity check */
310  assert(Offset);
311 
312  /* move dialog item to new offset */
313  DialogItem =(PDLGITEMTEMPLATE)Offset;
314 
315  /* increment window count */
316  MixerWindow->WindowCount++;
317  }
318 }
319 
320 VOID
323  IN PMIXER_WINDOW MixerWindow,
324  IN LPCWSTR DialogResId,
325  IN DWORD Index)
326 {
327  LPDLGTEMPLATE DlgTemplate;
328  PDLGITEMTEMPLATE DlgItem;
329  RECT dialogRect;
330  LPWORD Offset;
331  WORD FontSize;
332  WCHAR FontName[100];
333  WORD Length;
334  int width;
335 
337  UINT xBaseUnit = LOWORD(units);
338  UINT yBaseUnit = HIWORD(units);
339 
340  /* first load the dialog resource */
341  DlgTemplate = (LPDLGTEMPLATE)LoadDialogResource(hModule, DialogResId, NULL);
342  if (!DlgTemplate)
343  {
344  /* failed to load resource */
345  return;
346  }
347 
348  /* Now walk past the dialog header */
349  Offset = (LPWORD)(DlgTemplate + 1);
350 
351  /* FIXME: support menu */
352  assert(*Offset == 0);
353  Offset++;
354 
355  /* FIXME: support classes */
356  assert(*Offset == 0);
357  Offset++;
358 
359  /* FIXME: support titles */
360  assert(*Offset == 0);
361  Offset++;
362 
363  /* get font size */
364  FontSize = *Offset;
365  Offset++;
366 
367  /* calculate font length */
368  Length = wcslen((LPWSTR)Offset) + 1;
369  assert(Length < (sizeof(FontName) / sizeof(WCHAR)));
370 
371  /* copy font */
372  wcscpy(FontName, (LPWSTR)Offset);
373 
374  if (DlgTemplate->style & DS_SETFONT)
375  {
376  HDC hDC;
377 
378  hDC = GetDC(0);
379 
380  if (!MixerWindow->hFont)
381  {
382  int pixels = MulDiv(FontSize, GetDeviceCaps(hDC, LOGPIXELSY), 72);
384  }
385 
386  if (MixerWindow->hFont)
387  {
388  SIZE charSize;
389  HFONT hOldFont;
390 
391  hOldFont = SelectObject(hDC, MixerWindow->hFont);
392  charSize.cx = GdiGetCharDimensions(hDC, NULL, &charSize.cy);
393  if (charSize.cx)
394  {
395  xBaseUnit = charSize.cx;
396  yBaseUnit = charSize.cy;
397  }
398  SelectObject(hDC, hOldFont);
399  }
400  }
401 
402 // assert(MixerWindow->hFont);
403 
404  /* move offset after font name */
405  Offset += Length;
406 
407  /* offset is now at first dialog item control */
408  DlgItem = (PDLGITEMTEMPLATE)Offset;
409 
410  dialogRect.left = 0;
411  dialogRect.right = DlgTemplate->cx;
412  dialogRect.top = 0;
413  dialogRect.bottom = DlgTemplate->cy;
414 
415  ConvertRect(&dialogRect, xBaseUnit, yBaseUnit);
416 
417  width = dialogRect.right - dialogRect.left;
418 
419  dialogRect.left += MixerWindow->rect.right;
420  dialogRect.right += MixerWindow->rect.right;
421  dialogRect.top += MixerWindow->rect.top;
422  dialogRect.bottom += MixerWindow->rect.top;
423 
424  MixerWindow->rect.right += width;
425  if ((dialogRect.bottom - dialogRect.top) > (MixerWindow->rect.bottom - MixerWindow->rect.top))
426  MixerWindow->rect.bottom = MixerWindow->rect.top + dialogRect.bottom - dialogRect.top;
427 
428  /* now add the controls */
429  LoadDialogControls(MixerWindow, &dialogRect, DlgTemplate->cdit, DlgItem, Index, xBaseUnit, yBaseUnit);
430 }
431 
432 BOOL
433 CALLBACK
435  PSND_MIXER Mixer,
436  DWORD LineID,
438  PVOID Context)
439 {
440  WCHAR LineName[MIXER_LONG_NAME_CHARS];
441  DWORD Flags;
442  DWORD wID;
443  UINT ControlCount = 0, Index;
445  HWND hDlgCtrl;
446  PMIXERCONTROLDETAILS_UNSIGNED pVolumeDetails = NULL;
448 
449  if (Line->cControls == 0)
450  return TRUE;
451 
452  /* get line name */
453  if (SndMixerGetLineName(PrefContext->MixerWindow->Mixer, PrefContext->SelectedLine, LineName, MIXER_LONG_NAME_CHARS, TRUE) == -1)
454  {
455  /* failed to get line name */
456  LineName[0] = L'\0';
457  }
458 
459  pVolumeDetails = HeapAlloc(GetProcessHeap(),
460  0,
461  Line->cChannels * sizeof(MIXERCONTROLDETAILS_UNSIGNED));
462  if (pVolumeDetails == NULL)
463  goto done;
464 
465  /* check if line is found in registry settings */
466  if (ReadLineConfig(PrefContext->DeviceName,
467  LineName,
468  Line->szName,
469  &Flags))
470  {
471  /* is it selected */
472  if (Flags != 0x4)
473  {
474  int dlgId;
475 
476  if ((Line->dwComponentType == MIXERLINE_COMPONENTTYPE_DST_SPEAKERS) ||
477  (Line->dwComponentType == MIXERLINE_COMPONENTTYPE_DST_HEADPHONES))
478  dlgId = (PrefContext->MixerWindow->Mode == SMALL_MODE) ? IDD_SMALL_MASTER : IDD_NORMAL_MASTER;
479  else
480  dlgId = (PrefContext->MixerWindow->Mode == SMALL_MODE) ? IDD_SMALL_LINE : IDD_NORMAL_LINE;
481 
482  /* load dialog resource */
483  LoadDialog(hAppInstance, PrefContext->MixerWindow, MAKEINTRESOURCE(dlgId), PrefContext->Count);
484 
485  /* get id */
486  wID = (PrefContext->Count + 1) * IDC_LINE_NAME;
487 
488  /* set line name */
489  SetDlgItemTextW(PrefContext->MixerWindow->hWnd, wID, Line->szName);
490 
491  /* query controls */
492  if (SndMixerQueryControls(Mixer, &ControlCount, Line, &Control) != FALSE)
493  {
494  /* now go through all controls and update their states */
495  for (Index = 0; Index < Line->cControls; Index++)
496  {
497  if (Control[Index].dwControlType == MIXERCONTROL_CONTROLTYPE_MUTE)
498  {
500 
501  /* get volume control details */
502  if (SndMixerGetVolumeControlDetails(Mixer, Control[Index].dwControlID, 1, sizeof(MIXERCONTROLDETAILS_BOOLEAN), (LPVOID)&Details) != -1)
503  {
504  /* update dialog control */
505  wID = (PrefContext->Count + 1) * IDC_LINE_SWITCH;
506 
507  /* get dialog control */
508  hDlgCtrl = GetDlgItem(PrefContext->MixerWindow->hWnd, wID);
509 
510  if (hDlgCtrl != NULL)
511  {
512  /* Enable the 'Mute' checkbox, if we are in play mode */
513  if (Mixer->MixerId == PLAY_MIXER)
514  EnableWindow(hDlgCtrl, TRUE);
515 
516  /* check state */
517  if (SendMessageW(hDlgCtrl, BM_GETCHECK, 0, 0) != Details.fValue)
518  {
519  /* update control state */
520  SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)Details.fValue, 0);
521  }
522  }
523  }
524  }
525  else if (Control[Index].dwControlType == MIXERCONTROL_CONTROLTYPE_VOLUME)
526  {
527  /* get volume control details */
528  if (SndMixerGetVolumeControlDetails(Mixer, Control[Index].dwControlID, Line->cChannels, sizeof(MIXERCONTROLDETAILS_UNSIGNED), (LPVOID)pVolumeDetails) != -1)
529  {
530  /* update dialog control */
531  DWORD volumePosition, volumeStep, maxVolume, i;
532  DWORD balancePosition, balanceStep;
533 
534  volumeStep = (Control[Index].Bounds.dwMaximum - Control[Index].Bounds.dwMinimum) / (VOLUME_MAX - VOLUME_MIN);
535 
536  maxVolume = 0;
537  for (i = 0; i < Line->cChannels; i++)
538  {
539  if (pVolumeDetails[i].dwValue > maxVolume)
540  maxVolume = pVolumeDetails[i].dwValue;
541  }
542 
543  volumePosition = (maxVolume - Control[Index].Bounds.dwMinimum) / volumeStep;
544 
545  if (Line->cChannels == 1)
546  {
547  balancePosition = BALANCE_CENTER;
548  }
549  else if (Line->cChannels == 2)
550  {
551  if (pVolumeDetails[0].dwValue == pVolumeDetails[1].dwValue)
552  {
553  balancePosition = BALANCE_CENTER;
554  }
555  else if (pVolumeDetails[0].dwValue == Control[Index].Bounds.dwMinimum)
556  {
557  balancePosition = BALANCE_RIGHT;
558  }
559  else if (pVolumeDetails[1].dwValue == Control[Index].Bounds.dwMinimum)
560  {
561  balancePosition = BALANCE_LEFT;
562  }
563  else
564  {
565  balanceStep = (maxVolume - Control[Index].Bounds.dwMinimum) / (BALANCE_STEPS / 2);
566 
567  if (pVolumeDetails[0].dwValue < pVolumeDetails[1].dwValue)
568  {
569  balancePosition = (pVolumeDetails[0].dwValue - Control[Index].Bounds.dwMinimum) / balanceStep;
570  balancePosition = BALANCE_RIGHT - balancePosition;
571  }
572  else if (pVolumeDetails[1].dwValue < pVolumeDetails[0].dwValue)
573  {
574  balancePosition = (pVolumeDetails[1].dwValue - Control[Index].Bounds.dwMinimum) / balanceStep;
575  balancePosition = BALANCE_LEFT + balancePosition;
576  }
577  }
578  }
579 
580  /* Set the volume trackbar */
581  wID = (PrefContext->Count + 1) * IDC_LINE_SLIDER_VERT;
582 
583  /* get dialog control */
584  hDlgCtrl = GetDlgItem(PrefContext->MixerWindow->hWnd, wID);
585 
586  if (hDlgCtrl != NULL)
587  {
588  /* check state */
589  LRESULT OldPosition = SendMessageW(hDlgCtrl, TBM_GETPOS, 0, 0);
590 
591  /* Enable the volume trackbar */
592  EnableWindow(hDlgCtrl, TRUE);
593 
594  if (OldPosition != (VOLUME_MAX - volumePosition))
595  {
596  /* update control state */
597  SendMessageW(hDlgCtrl, TBM_SETPOS, (WPARAM)TRUE, VOLUME_MAX - volumePosition);
598  }
599  }
600 
601  if (Line->cChannels == 2)
602  {
603  /* Set the balance trackbar */
604  wID = (PrefContext->Count + 1) * IDC_LINE_SLIDER_HORZ;
605 
606  /* get dialog control */
607  hDlgCtrl = GetDlgItem(PrefContext->MixerWindow->hWnd, wID);
608 
609  if (hDlgCtrl != NULL)
610  {
611  /* check state */
612  LRESULT OldPosition = SendMessageW(hDlgCtrl, TBM_GETPOS, 0, 0);
613 
614  /* Enable the balance trackbar */
615  EnableWindow(hDlgCtrl, TRUE);
616 
617  if (OldPosition != balancePosition)
618  {
619  /* update control state */
620  SendMessageW(hDlgCtrl, TBM_SETPOS, (WPARAM)TRUE, balancePosition);
621  }
622  }
623  }
624  }
625  }
626  }
627 
628  /* free controls */
630  }
631 
632  /* increment dialog count */
633  PrefContext->Count++;
634  }
635  }
636 
637 done:
638  /* Free the volume details */
639  if (pVolumeDetails)
640  HeapFree(GetProcessHeap(), 0, pVolumeDetails);
641 
642  return TRUE;
643 }
644 
645 VOID
647  PPREFERENCES_CONTEXT PrefContext)
648 {
649  HWND hDlgCtrl;
650  RECT statusRect;
651 
652  /* set dialog count to zero */
653  PrefContext->Count = 0;
654 
655  SetRectEmpty(&PrefContext->MixerWindow->rect);
656 
657  /* enumerate controls */
658  SndMixerEnumConnections(PrefContext->MixerWindow->Mixer, PrefContext->SelectedLine, EnumConnectionsCallback, (PVOID)PrefContext);
659 
660  if (PrefContext->MixerWindow->hStatusBar)
661  {
662  GetWindowRect(PrefContext->MixerWindow->hStatusBar, &statusRect);
663  PrefContext->MixerWindow->rect.bottom += (statusRect.bottom - statusRect.top);
664  }
665 
666  /* now move the window */
668  SetWindowPos(PrefContext->MixerWindow->hWnd, HWND_TOP, PrefContext->MixerWindow->rect.left, PrefContext->MixerWindow->rect.top, PrefContext->MixerWindow->rect.right - PrefContext->MixerWindow->rect.left, PrefContext->MixerWindow->rect.bottom - PrefContext->MixerWindow->rect.top, SWP_NOMOVE | SWP_NOZORDER);
669 
670  /* get last line separator */
671  hDlgCtrl = GetDlgItem(PrefContext->MixerWindow->hWnd, IDC_LINE_SEP * PrefContext->Count);
672 
673  if (hDlgCtrl != NULL)
674  {
675  /* hide last separator */
676  ShowWindow(hDlgCtrl, SW_HIDE);
677  }
678 }
679 
680 VOID
682  PPREFERENCES_CONTEXT PrefContext,
684  LONG fValue)
685 {
686  DWORD Index;
687  DWORD wID;
688  HWND hDlgCtrl;
689  WCHAR LineName[MIXER_LONG_NAME_CHARS];
690 
691  /* find the index of this line */
692  for (Index = 0; Index < PrefContext->Count; Index++)
693  {
694  /* get id */
695  wID = (Index + 1) * IDC_LINE_NAME;
696 
697  if (GetDlgItemText(PrefContext->MixerWindow->hWnd, wID, LineName, MIXER_LONG_NAME_CHARS) == 0)
698  {
699  /* failed to retrieve id */
700  continue;
701  }
702 
703  /* check if the line name matches */
704  if (!wcsicmp(LineName, Line->szName))
705  {
706  /* found matching line name */
707  wID = (Index + 1) * IDC_LINE_SWITCH;
708 
709  /* get dialog control */
710  hDlgCtrl = GetDlgItem(PrefContext->MixerWindow->hWnd, wID);
711 
712  if (hDlgCtrl != NULL)
713  {
714  /* check state */
715  if (SendMessageW(hDlgCtrl, BM_GETCHECK, 0, 0) != fValue)
716  {
717  /* update control state */
718  SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)fValue, 0);
719  }
720  }
721  break;
722  }
723  }
724 }
725 
726 VOID
728  PPREFERENCES_CONTEXT PrefContext,
730  DWORD dwDialogID,
731  DWORD Position)
732 {
733  DWORD Index;
734  DWORD wID;
735  HWND hDlgCtrl;
736  WCHAR LineName[MIXER_LONG_NAME_CHARS];
737 
738  /* find the index of this line */
739  for (Index = 0; Index < PrefContext->Count; Index++)
740  {
741  /* get id */
742  wID = (Index + 1) * IDC_LINE_NAME;
743 
744  if (GetDlgItemText(PrefContext->MixerWindow->hWnd, wID, LineName, MIXER_LONG_NAME_CHARS) == 0)
745  {
746  /* failed to retrieve id */
747  continue;
748  }
749 
750  /* check if the line name matches */
751  if (!wcsicmp(LineName, Line->szName))
752  {
753  /* found matching line name */
754  wID = (Index + 1) * dwDialogID;
755 
756  /* get dialog control */
757  hDlgCtrl = GetDlgItem(PrefContext->MixerWindow->hWnd, wID);
758 
759  if (hDlgCtrl != NULL)
760  {
761  /* check state */
762  LRESULT OldPosition = SendMessageW(hDlgCtrl, TBM_GETPOS, 0, 0);
763  if (OldPosition != Position)
764  {
765  /* update control state */
767  }
768  }
769  break;
770  }
771  }
772 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define HDC
Definition: msvc.h:22
#define IDC_LINE_SLIDER_VERT
Definition: resources.h:25
#define VOLUME_TICKS
Definition: sndvol32.h:19
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IN
Definition: typedefs.h:38
GLint GLint GLsizei width
Definition: gl.h:1546
BOOL ReadLineConfig(IN LPTSTR szDeviceName, IN LPTSTR szLineName, IN LPTSTR szControlName, OUT DWORD *Flags)
Definition: misc.c:197
#define TRUE
Definition: types.h:120
HFONT WINAPI CreateFontW(_In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_opt_ LPCWSTR)
#define IDD_NORMAL_LINE
Definition: resources.h:32
VOID LoadDialogControls(IN PMIXER_WINDOW MixerWindow, LPRECT DialogOffset, WORD ItemCount, PDLGITEMTEMPLATE DialogItem, DWORD DialogIdMultiplier, UINT xBaseUnit, UINT yBaseUnit)
Definition: dialog.c:270
#define DEFAULT_QUALITY
Definition: wingdi.h:435
INT SndMixerGetLineName(PSND_MIXER Mixer, DWORD LineID, LPTSTR lpBuffer, UINT uSize, BOOL LongName)
Definition: mixer.c:390
#define FF_DONTCARE
Definition: wingdi.h:447
HDC WINAPI GetDC(_In_opt_ HWND)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SW_HIDE
Definition: winuser.h:762
struct _PREFERENCES_CONTEXT * PPREFERENCES_CONTEXT
#define MAXWORD
static COORD Position
Definition: mouse.c:34
#define IDD_SMALL_MASTER
Definition: resources.h:33
#define BALANCE_LEFT
Definition: sndvol32.h:21
#define CALLBACK
Definition: compat.h:27
#define TBM_SETRANGE
Definition: commctrl.h:2009
#define IDD_NORMAL_MASTER
Definition: resources.h:31
LONG top
Definition: windef.h:292
HANDLE HWND
Definition: compat.h:13
BOOL SndMixerEnumConnections(PSND_MIXER Mixer, DWORD LineID, PFNSNDMIXENUMCONNECTIONS EnumProc, PVOID Context)
Definition: mixer.c:552
LPVOID LoadDialogResource(IN HMODULE hModule, IN LPCWSTR ResourceName, OUT LPDWORD ResourceLength)
Definition: dialog.c:21
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
DWORD style
Definition: winuser.h:3012
#define WS_DLGFRAME
Definition: pedump.c:626
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define assert(x)
Definition: debug.h:53
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
VOID UpdateDialogLineSliderControl(PPREFERENCES_CONTEXT PrefContext, LPMIXERLINE Line, DWORD dwDialogID, DWORD Position)
Definition: dialog.c:727
#define HWND_TOP
Definition: winuser.h:1193
#define TBM_SETPOS
Definition: commctrl.h:2008
#define VOLUME_MAX
Definition: sndvol32.h:18
VOID LoadDialogCtrls(PPREFERENCES_CONTEXT PrefContext)
Definition: dialog.c:646
LONG left
Definition: windef.h:291
#define SWP_NOZORDER
Definition: winuser.h:1232
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define DEFAULT_CHARSET
Definition: wingdi.h:383
LONG right
Definition: windef.h:293
int32_t INT
Definition: typedefs.h:56
& rect
Definition: startmenu.cpp:1413
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
HFONT hFont
Definition: main.c:53
UINT_PTR WPARAM
Definition: windef.h:207
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define BALANCE_CENTER
Definition: sndvol32.h:22
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
BOOL SndMixerQueryControls(PSND_MIXER Mixer, PUINT DisplayControls, LPMIXERLINE LineInfo, LPMIXERCONTROL *Controls)
Definition: mixer.c:112
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID UpdateDialogLineSwitchControl(PPREFERENCES_CONTEXT PrefContext, LPMIXERLINE Line, LONG fValue)
Definition: dialog.c:681
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define BALANCE_RIGHT
Definition: sndvol32.h:23
long LONG
Definition: pedump.c:60
LONG_PTR LPARAM
Definition: windef.h:208
#define IDC_LINE_SEP
Definition: resources.h:26
#define TBM_GETPOS
Definition: commctrl.h:2003
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:425
LONG WINAPI GetDialogBaseUnits(VOID)
Definition: dialog.c:2076
BOOL CALLBACK EnumConnectionsCallback(PSND_MIXER Mixer, DWORD LineID, LPMIXERLINE Line, PVOID Context)
Definition: dialog.c:434
struct _SND_MIXER * Mixer
Definition: sndvol32.h:42
LPWORD AddDialogControl(IN HWND hwndDialog, OUT HWND *OutWnd, IN LPRECT DialogOffset, IN PDLGITEMTEMPLATE DialogItem, IN DWORD DialogIdMultiplier, IN HFONT hFont, IN UINT xBaseUnit, IN UINT yBaseUnit, IN UINT MixerId)
Definition: dialog.c:67
#define IDC_LINE_NAME
Definition: resources.h:22
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
#define MAKELONG(a, b)
Definition: typedefs.h:248
#define TBM_SETPAGESIZE
Definition: commctrl.h:2023
smooth NULL
Definition: ftsmooth.c:416
#define BS_AUTOCHECKBOX
Definition: pedump.c:654
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
LONG cx
Definition: windef.h:319
BOOL WINAPI SetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPCWSTR lpString)
Definition: dialog.c:2748
#define BM_GETCHECK
Definition: winuser.h:1879
struct DLGTEMPLATE * LPDLGTEMPLATE
VOID LoadDialog(IN HMODULE hModule, IN PMIXER_WINDOW MixerWindow, IN LPCWSTR DialogResId, IN DWORD Index)
Definition: dialog.c:321
#define RT_DIALOG
Definition: pedump.c:367
#define BALANCE_PAGE_SIZE
Definition: sndvol32.h:26
#define WS_CAPTION
Definition: pedump.c:624
#define BALANCE_TICKS
Definition: sndvol32.h:25
#define BM_SETCHECK
Definition: winuser.h:1882
#define UlongToPtr(ul)
Definition: basetsd.h:98
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetDlgItemText
Definition: winuser.h:5651
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
INT SndMixerGetVolumeControlDetails(PSND_MIXER Mixer, DWORD dwControlID, DWORD cChannels, DWORD cbDetails, LPVOID paDetails)
Definition: mixer.c:498
unsigned int UINT
Definition: ndis.h:50
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned short WORD
Definition: ntddk_ex.h:93
#define OUT_DEFAULT_PRECIS
Definition: wingdi.h:414
unsigned long DWORD
Definition: ntddk_ex.h:95
WINDOW_MODE Mode
Definition: sndvol32.h:47
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define TBS_VERT
Definition: commctrl.h:1988
Definition: ncftp.h:79
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define DS_SETFONT
Definition: winuser.h:378
#define TBM_SETTIC
Definition: commctrl.h:2007
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define MIXERLINE_COMPONENTTYPE_DST_HEADPHONES
Definition: mmsystem.h:320
UINT MixerId
Definition: sndvol32.h:90
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
#define MIXER_LONG_NAME_CHARS
Definition: mmsystem.h:294
#define wcsicmp
Definition: string.h:1152
static const WCHAR Control[]
Definition: interface.c:27
#define BALANCE_STEPS
Definition: sndvol32.h:24
WORD cdit
Definition: winuser.h:3014
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
uint16_t * LPWORD
Definition: typedefs.h:54
#define MIXERCONTROL_CONTROLTYPE_VOLUME
Definition: mmsystem.h:398
TCHAR DeviceName[128]
Definition: sndvol32.h:107
static HWND hwnd[MAXHWNDS]
Definition: dialog.c:47
static HDC hDC
Definition: 3dtext.c:33
LONG WINAPI GdiGetCharDimensions(HDC, LPTEXTMETRICW, LONG *)
Definition: font.c:2008
#define MIXERCONTROL_CONTROLTYPE_MUTE
Definition: mmsystem.h:384
#define IDC_LINE_SLIDER_HORZ
Definition: resources.h:24
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define MIXERLINE_COMPONENTTYPE_DST_SPEAKERS
Definition: mmsystem.h:319
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HeapReAlloc
Definition: compat.h:393
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: gl.h:1546
#define VOLUME_MIN
Definition: sndvol32.h:17
#define IDD_SMALL_LINE
Definition: resources.h:34
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
#define PLAY_MIXER
Definition: sndvol32.h:28
short cy
Definition: winuser.h:3018
#define WM_SETFONT
Definition: winuser.h:1632
#define FW_NORMAL
Definition: wingdi.h:372
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define SendMessage
Definition: winuser.h:5709
#define OUT
Definition: typedefs.h:39
uint32_t * LPDWORD
Definition: typedefs.h:57
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2113
#define HIWORD(l)
Definition: typedefs.h:246
VOID ConvertRect(LPRECT lpRect, UINT xBaseUnit, UINT yBaseUnit)
Definition: dialog.c:12
LONG bottom
Definition: windef.h:294
#define LOGPIXELSY
Definition: wingdi.h:718
#define SWP_NOMOVE
Definition: winuser.h:1229
#define VOLUME_PAGE_SIZE
Definition: sndvol32.h:20
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LONG_PTR LRESULT
Definition: windef.h:209
GLfloat units
Definition: glext.h:11727
short cx
Definition: winuser.h:3017
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_SYSMENU
Definition: pedump.c:629
LONG cy
Definition: windef.h:320
#define LOWORD(l)
Definition: pedump.c:82
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:394
#define MulDiv(x, y, z)
Definition: gdifloat.h:86
HINSTANCE hAppInstance
Definition: mmc.c:23
HMODULE hModule
Definition: animate.c:44
PMIXER_WINDOW MixerWindow
Definition: sndvol32.h:98
HWND hwndDialog
Definition: powershemes.c:43
#define IDC_LINE_SWITCH
Definition: resources.h:23