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.

83 lines
2.0 KiB

  1. // TransposePage.cpp : Implementation of CTransposePage
  2. #include "stdafx.h"
  3. #include "ToolProps.h"
  4. #include "TransposePage.h"
  5. /////////////////////////////////////////////////////////////////////////////
  6. // CTransposePage
  7. CTransposePage::CTransposePage()
  8. {
  9. m_dwTitleID = IDS_TITLETransposePage;
  10. m_dwHelpFileID = IDS_HELPFILETransposePage;
  11. m_dwDocStringID = IDS_DOCSTRINGTransposePage;
  12. m_pTranspose = NULL;
  13. }
  14. CTransposePage::~CTransposePage()
  15. {
  16. if (m_pTranspose)
  17. {
  18. m_pTranspose->Release();
  19. }
  20. }
  21. STDMETHODIMP CTransposePage::SetObjects(ULONG cObjects,IUnknown **ppUnk)
  22. {
  23. if (cObjects < 1 || cObjects > 1)
  24. return E_UNEXPECTED;
  25. return ppUnk[0]->QueryInterface(IID_IDirectMusicTransposeTool,(void **) &m_pTranspose);
  26. }
  27. STDMETHODIMP CTransposePage::Apply(void)
  28. {
  29. m_pTranspose->SetTranspose((long) m_ctTranspose.GetValue());
  30. m_pTranspose->SetType(m_ctType.GetValue());
  31. m_bDirty = FALSE;
  32. return S_OK;
  33. }
  34. LRESULT CTransposePage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  35. {
  36. if (m_pTranspose)
  37. {
  38. static char *pTypes[2] = { "Linear","In Scale"};
  39. m_ctTranspose.Init(GetDlgItem(IDC_TRANSPOSE),GetDlgItem(IDC_TRANSPOSE_DISPLAY),-24,24,true);
  40. m_ctType.Init(GetDlgItem(IDC_TYPE),IDC_TYPE,pTypes,2);
  41. DWORD dwType;
  42. m_pTranspose->GetType(&dwType);
  43. m_ctType.SetValue(dwType);
  44. long lTranspose;
  45. m_pTranspose->GetTranspose(&lTranspose);
  46. m_ctTranspose.SetValue((float)lTranspose);
  47. }
  48. return 1;
  49. }
  50. LRESULT CTransposePage::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  51. {
  52. LRESULT lr = m_ctTranspose.MessageHandler(uMsg, wParam,lParam, bHandled);
  53. if (!bHandled)
  54. lr = m_ctType.MessageHandler(uMsg, wParam, lParam, bHandled);
  55. if (bHandled)
  56. SetDirty(true);
  57. return lr;
  58. }
  59. LRESULT CTransposePage::OnSlider(UINT uMsg, WPARAM wParam,LPARAM lParam, BOOL& bHandled)
  60. {
  61. LRESULT lr = m_ctTranspose.MessageHandler(uMsg, wParam,lParam, bHandled);
  62. if (bHandled)
  63. SetDirty(true);
  64. return lr;
  65. }