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.

143 lines
4.1 KiB

  1. /*****************************************************************************\
  2. FILE: config.h
  3. DESCRIPTION:
  4. The class will handle the user's configuration state. It will also
  5. display the Screen Saver's configuration dialog to allow the user to change
  6. these settings.
  7. BryanSt 12/18/2000
  8. Copyright (C) Microsoft Corp 2000-2001. All rights reserved.
  9. \*****************************************************************************/
  10. #ifndef CONFIG_H
  11. #define CONFIG_H
  12. class CConfig;
  13. #include "util.h"
  14. #include "main.h"
  15. #include "resource.h"
  16. #define NUM_BOOL_SETTINGS 1
  17. #define NUM_DWORD_SETTINGS 5
  18. #define NUM_BOOL_FOLDERS 4
  19. #define MAX_QUALITY 8
  20. #define MAX_WALK 6
  21. #define MAX_VIEWTIME 30
  22. // Args for CConfig::GetFolderOn()
  23. #define CONFIG_FOLDER_MYPICTS 0
  24. #define CONFIG_FOLDER_COMMONPICTS 1
  25. #define CONFIG_FOLDER_WINPICTS 2
  26. #define CONFIG_FOLDER_OTHER 3
  27. // Args for CConfig::GetDWORDSetting()
  28. #define CONFIG_DWORD_RENDERQUALITY 0
  29. #define CONFIG_DWORD_REALTIMEMODE 1
  30. #define CONFIG_DWORD_QUALITY_SLIDER 2
  31. #define CONFIG_DWORD_SPEED_SLIDER 3
  32. #define CONFIG_DWORD_VIEWPAINTINGTIME 4
  33. #define DEFAULT_QUALITYSLIDER 2
  34. #define DEFAULT_VIEWTIMESLIDER 7
  35. #define DEFAULT_SPEEDSLIDER 2
  36. #define DEFAULT_WALKSPEED 2
  37. #define DEFAULT_RENDERQUALITY 1
  38. typedef struct
  39. {
  40. LPCTSTR pszRegValue;
  41. } QUALITY_SETTING;
  42. typedef struct
  43. {
  44. LPCTSTR pszRegValue;
  45. BOOL fDefaultToOn;
  46. } FOLDER_SETTING;
  47. extern CConfig * g_pConfig; // The configuration settings the user wants to use.
  48. extern QUALITY_SETTING s_QualitySettings[NUM_BOOL_SETTINGS];
  49. class CConfig
  50. {
  51. public:
  52. // Member Functions
  53. virtual BOOL GetBoolSetting(UINT nSetting);
  54. virtual DWORD GetDWORDSetting(UINT nSetting);
  55. virtual BOOL GetFolderOn(UINT nSetting);
  56. virtual HRESULT GetOtherDir(LPTSTR pszPath, DWORD cchSize);
  57. virtual HRESULT GetTexturePath(int nTextureIndex, DWORD * pdwScale, LPTSTR pszPath, DWORD cchSize);
  58. virtual HRESULT DisplayConfigDialog(HWND hwndParent);
  59. HRESULT LoadStatePublic(void) { return _LoadState(); }
  60. CConfig(CMSLogoDXScreenSaver * pMain);
  61. ~CConfig();
  62. private:
  63. // Helper Functions
  64. HRESULT _LoadState(void);
  65. HRESULT _SaveState(void);
  66. HRESULT _GetState(void);
  67. HRESULT _UpdateViewTimeSelection(void);
  68. HRESULT _OnBrowseForFolder(void);
  69. HRESULT _GetStateFromUI(void);
  70. HRESULT _LoadQualitySliderValues(void);
  71. BOOL _IsDialogDataValid(void);
  72. HRESULT _OnInitDlg(HWND hDlg);
  73. HRESULT _OnDestroy(HWND hDlg);
  74. HRESULT _OnCommand(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  75. INT_PTR _ConfigDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  76. // Advanced Dialog
  77. HRESULT DisplayAdvancedDialog(HWND hwndParent);
  78. INT_PTR _AdvDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  79. HRESULT _OnAdvInitDlg(HWND hDlg);
  80. HRESULT _OnAdvDestroy(HWND hDlg);
  81. HRESULT _OnAdvCommand(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  82. HRESULT _GetAdvState(void);
  83. HRESULT _OnEnableCustomTexture(int nIndex, BOOL fEnable);
  84. static INT_PTR CALLBACK AdvDlgProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam);
  85. static INT_PTR CALLBACK ConfigDlgProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam);
  86. // Member Variables
  87. HKEY m_hkeyCurrentUser; // Cached Key
  88. BOOL m_fSettings[NUM_BOOL_SETTINGS];
  89. DWORD m_dwSettings[NUM_DWORD_SETTINGS];
  90. BOOL m_fFolders[NUM_BOOL_FOLDERS];
  91. TCHAR m_szOther[MAX_PATH];
  92. BOOL m_fLoaded;
  93. HWND m_hDlg;
  94. HWND m_hDlgAdvanced;
  95. LPWSTR m_pszCustomPaths[MAX_CUSTOMTEXTURES];
  96. DWORD m_dwCustomScale[MAX_CUSTOMTEXTURES];
  97. CMSLogoDXScreenSaver * m_pMain; // Weak reference
  98. // Advanced Dialog
  99. BOOL m_fAdvSettings[NUM_BOOL_SETTINGS];
  100. DWORD m_dwAdvSettings[NUM_DWORD_SETTINGS];
  101. };
  102. #endif // CONFIG_H