Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 lines
4.2 KiB

  1. /*****************************************************************************
  2. *
  3. * diqeprop.c
  4. *
  5. * The dialog box that displays effect properties.
  6. *
  7. *****************************************************************************/
  8. #include "diquick.h"
  9. #pragma BEGIN_CONST_DATA
  10. CHECKLISTFLAG c_rgclfDieft[] = {
  11. { DIEFT_FFATTACK, IDS_FFATTACK, },
  12. { DIEFT_FFFADE, IDS_FFFADE, },
  13. { DIEFT_SATURATION, IDS_SATURATION, },
  14. { DIEFT_POSNEGCOEFFICIENTS, IDS_POSNEGCOEFFICIENTS },
  15. { DIEFT_POSNEGSATURATION, IDS_POSNEGSATURATION, },
  16. };
  17. #pragma END_CONST_DATA
  18. /*****************************************************************************
  19. *
  20. * Effect property dialog instance data
  21. *
  22. *****************************************************************************/
  23. typedef struct EFFPROPINFO {
  24. PDEVDLGINFO pddi;
  25. const GUID *rguidEff;
  26. } EFFPROPINFO, *PEFFPROPINFO;
  27. /*****************************************************************************
  28. *
  29. * EffProp_OnInitDialog
  30. *
  31. *****************************************************************************/
  32. BOOL INTERNAL
  33. EffProp_OnInitDialog(HWND hdlg, LPARAM lp)
  34. {
  35. PEFFPROPINFO pepi = (PV)lp;
  36. DIEFFECTINFO ei;
  37. HRESULT hres;
  38. /*
  39. * Don't SetDialogPtr until we're finished. This prevents
  40. * WM_COMMAND from causing us to do wacky things before
  41. * we're ready.
  42. */
  43. ei.dwSize = cbX(ei);
  44. hres = GetEffectInfo(pepi->pddi, &ei, pepi->rguidEff);
  45. if (SUCCEEDED(hres)) {
  46. SetWindowText(hdlg, ei.tszName);
  47. SetDlgItemText(hdlg, IDC_EPROP_GUID, MapGUID(&ei.guid, ei.tszName));
  48. LoadString(g_hinst, IDS_EFFECT_TYPEARRAY +
  49. DIEFT_GETTYPE(ei.dwEffType),
  50. ei.tszName, cA(ei.tszName));
  51. if (ei.tszName[0]) {
  52. SetDlgItemText(hdlg, IDC_EPROP_TYPE, ei.tszName);
  53. } else {
  54. SetDlgItemInt(hdlg, IDC_EPROP_TYPE, DIEFT_GETTYPE(ei.dwEffType), 0);
  55. }
  56. Checklist_InitFlags(hdlg, IDC_EPROP_FLAGS, ei.dwEffType,
  57. c_rgclfDieft, cA(c_rgclfDieft));
  58. wsprintf(ei.tszName, TEXT("%08x"), ei.dwStaticParams);
  59. SetDlgItemText(hdlg, IDC_EPROP_STATICPARM, ei.tszName);
  60. wsprintf(ei.tszName, TEXT("%08x"), ei.dwDynamicParams);
  61. SetDlgItemText(hdlg, IDC_EPROP_DYNAMICPARM, ei.tszName);
  62. }
  63. SetDialogPtr(hdlg, pepi);
  64. #if 0 // temp hack to test effect goo
  65. _asm int 3
  66. hres = IDirectInputDevice8_Acquire(pepi->pddi->pdid);
  67. {
  68. LPDIRECTINPUTEFFECT peff;
  69. hres = IDirectInputDevice8_CreateEffect(
  70. pepi->pddi->pdid, &ei.guid, 0, &peff, 0);
  71. if (SUCCEEDED(hres)) {
  72. DWORD dw = 3;
  73. DIEFFESCAPE esc = { cbX(esc), 0, &dw, 4, &dw, 4 };
  74. peff->lpVtbl->Escape(peff, &esc);
  75. // hres = IDirectInputDevice8_EnumCreatedEffects(pdev2,
  76. // EnumCallback, 0, 0);
  77. peff->lpVtbl->Release(peff);
  78. }
  79. }
  80. hres = IDirectInputDevice8_Unacquire(pepi->pddi->pdid);
  81. #endif
  82. return 1;
  83. }
  84. /*****************************************************************************
  85. *
  86. * EffProp_DlgProc
  87. *
  88. *****************************************************************************/
  89. INT_PTR INTERNAL
  90. EffProp_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp)
  91. {
  92. switch (wm) {
  93. case WM_INITDIALOG:
  94. return EffProp_OnInitDialog(hdlg, lp);
  95. case WM_DESTROY:
  96. Checklist_OnDestroy(GetDlgItem(hdlg, IDC_EPROP_FLAGS));
  97. break;
  98. case WM_CLOSE:
  99. EndDialog(hdlg, TRUE);
  100. return TRUE;
  101. }
  102. return 0;
  103. }
  104. /*****************************************************************************
  105. *
  106. * EffProp_Create
  107. *
  108. * Display info about an effect.
  109. *
  110. *****************************************************************************/
  111. INT_PTR EXTERNAL
  112. EffProp_Create(HWND hdlg, PDEVDLGINFO pddi, REFGUID rguidEff)
  113. {
  114. EFFPROPINFO epi;
  115. epi.pddi = pddi;
  116. epi.rguidEff = rguidEff;
  117. return DialogBoxParam(g_hinst, MAKEINTRESOURCE(IDD_EFFPROP),
  118. hdlg, EffProp_DlgProc, (LPARAM)&epi);
  119. }