Leaked source code of windows server 2003
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.

109 lines
3.5 KiB

  1. /*******************************************************************************
  2. * TTSDlg.h *
  3. *------------*
  4. * Description:
  5. * This is the header file for the default voice dialog.
  6. *-------------------------------------------------------------------------------
  7. * Created By: MIKEAR Date: 11/17/98
  8. * Copyright (C) 1998 Microsoft Corporation
  9. * All Rights Reserved
  10. *
  11. *-------------------------------------------------------------------------------
  12. * Revisions:
  13. *
  14. *******************************************************************************/
  15. #ifndef _TTSDlg_h
  16. #define _TTSDlg_h
  17. #include "audiodlg.h"
  18. #define MAX_EDIT_TEXT 1000
  19. #define MAX_ATTRIB_LENGTH 1000
  20. const int VOICE_MAX_SPEED = 10;
  21. const int VOICE_MIN_SPEED = -10;
  22. class CTTSDlg : public ISpNotifyCallback
  23. {
  24. private:
  25. BOOL m_bPreferredDevice;
  26. BOOL m_bApplied;
  27. BOOL m_bIsSpeaking;
  28. CComPtr<ISpVoice> m_cpVoice;
  29. CComPtr<ISpObjectToken> m_cpCurVoiceToken;
  30. CComPtr<ISpObjectToken> m_cpOriginalDefaultVoiceToken;
  31. int m_iOriginalRateSliderPos;
  32. int m_iSpeed;
  33. CAudioDlg *m_pAudioDlg;
  34. HWND m_hDlg;
  35. HWND m_hTTSCombo;
  36. WCHAR m_wszCurSpoken[MAX_EDIT_TEXT];
  37. bool m_fTextModified;
  38. bool m_fForceCheckStateChange;
  39. WCHAR m_szCaption[ MAX_LOADSTRING ];
  40. HINSTANCE m_hinstRichEdit;
  41. public:
  42. CTTSDlg() :
  43. m_bPreferredDevice( true ),
  44. m_bApplied( false ),
  45. m_bIsSpeaking( false ),
  46. m_iOriginalRateSliderPos( 0 ),
  47. m_iSpeed( 0 ),
  48. m_pAudioDlg( NULL ),
  49. m_hDlg( NULL ),
  50. m_cpCurVoiceToken( NULL ),
  51. m_fTextModified( false ),
  52. m_fForceCheckStateChange( false )
  53. {
  54. CSpUnicodeSupport unicode;
  55. m_hinstRichEdit = unicode.LoadLibrary( L"riched20.dll" );
  56. }
  57. ~CTTSDlg()
  58. {
  59. if ( m_pAudioDlg )
  60. {
  61. delete m_pAudioDlg;
  62. }
  63. m_cpVoice.Release();
  64. m_cpCurVoiceToken.Release();
  65. m_cpOriginalDefaultVoiceToken.Release();
  66. if ( m_hinstRichEdit )
  67. {
  68. ::FreeLibrary( m_hinstRichEdit );
  69. }
  70. }
  71. STDMETHODIMP NotifyCallback(WPARAM wParam, LPARAM lParam);
  72. void OnApply();
  73. void OnDestroy();
  74. void OnInitDialog(HWND hWnd);
  75. void InitTTSList( HWND hWnd );
  76. void PopulateEditCtrl(ISpObjectToken *);
  77. HRESULT DefaultVoiceChange(bool fUsePersistentRate);
  78. void SetCheckmark( HWND hList, int iIndex, bool bCheck );
  79. void KickCPLUI(); // Looks at the current requested defaults
  80. // and decides if "Apply" needs to be enabled
  81. void ChangeSpeed();
  82. void ChangeSpeakButton();
  83. void Speak();
  84. void StopSpeak(); // stops speaking if it's speaking
  85. inline HWND GetHDlg() { return m_hDlg; }
  86. inline BOOL IsPreferredDevice() { return m_bPreferredDevice; }
  87. inline void SetPreferredDevice( BOOL b ) { m_bPreferredDevice = b; }
  88. void SetEditModified( bool fModify );
  89. friend INT_PTR CALLBACK TTSDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  90. };
  91. // Globals
  92. extern CTTSDlg *g_pTTSDlg;
  93. extern const LPTSTR kpszHelpFilename;
  94. extern const DWORD krgHelpIDs[];
  95. #endif