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.

188 lines
5.6 KiB

  1. /*++
  2. Copyright (c) 1994-2001 Microsoft Corporation
  3. Module Name :
  4. cacheopt.h
  5. Abstract:
  6. ASP Cache Options page
  7. Author:
  8. Sergei Antonov (sergeia)
  9. Project:
  10. Internet Services Manager
  11. Revision History:
  12. --*/
  13. #ifndef _CACHE_OPT_H
  14. #define _CACHE_OPT_H
  15. #include "resource.h"
  16. #include "ExchControls.h"
  17. #include "PropSheet.h"
  18. #define SCRIPT_ENG_MIN 0
  19. #define SCRIPT_ENG_MAX 2000000000
  20. #define CACHE_SIZE_MIN 0
  21. #define CACHE_SIZE_MAX CACHE_UNLIM_MAX
  22. class CCacheOptPage :
  23. public WTL::CPropertyPageImpl<CCacheOptPage>,
  24. public WTL::CWinDataExchange<CCacheOptPage>
  25. {
  26. typedef WTL::CPropertyPageImpl<CCacheOptPage> baseClass;
  27. public:
  28. CCacheOptPage(CAppData * pData)
  29. {
  30. m_pData = pData;
  31. }
  32. ~CCacheOptPage()
  33. {
  34. }
  35. enum {IDD = IDD_CACHE_OPT};
  36. BEGIN_MSG_MAP_EX(CCacheOptPage)
  37. MSG_WM_INITDIALOG(OnInitDialog)
  38. COMMAND_HANDLER_EX(IDC_NO_CACHE, BN_CLICKED, OnCacheSwitch)
  39. COMMAND_HANDLER_EX(IDC_UNLIMITED_CACHE, BN_CLICKED, OnCacheSwitch)
  40. COMMAND_HANDLER_EX(IDC_LIMITED_CACHE, BN_CLICKED, OnCacheSwitch)
  41. COMMAND_HANDLER_EX(IDC_CACHE_SIZE_EDIT, EN_CHANGE, OnChangeCacheSize)
  42. COMMAND_HANDLER_EX(IDC_INMEM_LIM_EDIT, EN_CHANGE, OnChangeInmemCacheSize)
  43. COMMAND_HANDLER_EX(IDC_CACHE_PATH, EN_CHANGE, OnChangePath)
  44. COMMAND_HANDLER_EX(IDC_ENGINES, EN_CHANGE, OnChangeData)
  45. COMMAND_HANDLER_EX(IDC_INMEM_UNLIM_EDIT, EN_CHANGE, OnChangeData)
  46. MSG_WM_HSCROLL(OnTrackBarScroll)
  47. CHAIN_MSG_MAP(baseClass)
  48. END_MSG_MAP()
  49. BEGIN_DDX_MAP(CCacheOptPage)
  50. DDX_CHECK(IDC_NO_CACHE, m_pData->m_NoCache)
  51. DDX_CHECK(IDC_UNLIMITED_CACHE, m_pData->m_UnlimCache)
  52. DDX_CHECK(IDC_LIMITED_CACHE, m_pData->m_LimCache)
  53. DDX_CONTROL(IDC_NO_CACHE, m_NoCacheBtn)
  54. DDX_CONTROL(IDC_UNLIMITED_CACHE, m_UnlimCacheBtn)
  55. DDX_CONTROL(IDC_LIMITED_CACHE, m_LimCacheBtn)
  56. DDX_CONTROL(IDC_CACHE_DIST, m_cache_dist)
  57. DDX_CONTROL(IDC_INMEM_UNLIM_SPIN, m_inmem_unlim)
  58. DDX_CONTROL(IDC_CACHE_SIZE_SPIN, m_cache_size)
  59. DDX_CONTROL(IDC_INMEM_LIM_SPIN, m_inmem_lim)
  60. DDX_CONTROL(IDC_ENG_CACHED_SPIN, m_eng_cache)
  61. if (m_pData->m_LimCache)
  62. {
  63. DDX_INT_RANGE(IDC_CACHE_SIZE_EDIT, m_pData->m_TotalCacheSize, CACHE_SIZE_MIN, CACHE_SIZE_MAX)
  64. DDX_INT_RANGE(IDC_INMEM_LIM_EDIT, m_pData->m_LimCacheInMemorySize, 0, m_pData->m_TotalCacheSize)
  65. }
  66. if (m_pData->m_UnlimCache)
  67. {
  68. DDX_INT_RANGE(IDC_INMEM_UNLIM_EDIT, m_pData->m_UnlimCacheInMemorySize, CACHE_SIZE_MIN, CACHE_SIZE_MAX)
  69. }
  70. DDX_INT_RANGE(IDC_ENGINES, m_pData->m_ScriptEngCacheMax, SCRIPT_ENG_MIN, SCRIPT_ENG_MAX)
  71. END_DDX_MAP()
  72. public:
  73. LRESULT OnInitDialog(HWND hDlg, LPARAM lParam);
  74. void OnCacheSwitch(UINT nCode, UINT nID, HWND hWnd);
  75. void OnTrackBarScroll(UINT nSBCode, UINT nPos, HWND hwnd);
  76. void OnChangeCacheSize(UINT nCode, UINT nID, HWND hWnd);
  77. void OnChangeInmemCacheSize(UINT nCode, UINT nID, HWND hWnd);
  78. void OnChangeData(UINT nCode, UINT nID, HWND hWnd)
  79. {
  80. SET_MODIFIED(TRUE);
  81. }
  82. void OnChangePath(UINT nCode, UINT nID, HWND hWnd);
  83. BOOL OnKillActive();
  84. BOOL OnApply()
  85. {
  86. APPLY_DATA();
  87. return TRUE;
  88. }
  89. void OnDataValidateError(UINT nCtrlID, BOOL bSave, _XData& data);
  90. void OnDataExchangeError(UINT nCtrlID, BOOL bSave);
  91. void OnHelp();
  92. void AdjustTracker();
  93. protected:
  94. CAppData * m_pData;
  95. CButtonExch m_NoCacheBtn, m_UnlimCacheBtn, m_LimCacheBtn;
  96. CTrackBarCtrlExch m_cache_dist;
  97. CUpDownCtrlExch m_inmem_unlim;
  98. CUpDownCtrlExch m_inmem_lim;
  99. CUpDownCtrlExch m_cache_size;
  100. CUpDownCtrlExch m_eng_cache;
  101. CFileChooser m_FileChooser;
  102. BOOL m_bInitDone;
  103. };
  104. class CCacheOptPage_iis5 :
  105. public WTL::CPropertyPageImpl<CCacheOptPage_iis5>,
  106. public WTL::CWinDataExchange<CCacheOptPage_iis5>
  107. {
  108. typedef WTL::CPropertyPageImpl<CCacheOptPage_iis5> baseClass;
  109. public:
  110. CCacheOptPage_iis5(CAppData * pData)
  111. {
  112. m_pData = pData;
  113. }
  114. ~CCacheOptPage_iis5()
  115. {
  116. }
  117. enum {IDD = IDD_CACHE_OPT_IIS5};
  118. BEGIN_MSG_MAP_EX(CCacheOptPage_iis5)
  119. MSG_WM_INITDIALOG(OnInitDialog)
  120. COMMAND_HANDLER_EX(IDC_NO_CACHE, BN_CLICKED, OnCacheSwitch)
  121. COMMAND_HANDLER_EX(IDC_UNLIMITED_CACHE, BN_CLICKED, OnCacheSwitch)
  122. COMMAND_HANDLER_EX(IDC_LIMITED_CACHE, BN_CLICKED, OnCacheSwitch)
  123. COMMAND_HANDLER_EX(IDC_ENGINES, EN_CHANGE, OnChangeData)
  124. COMMAND_HANDLER_EX(IDC_CACHE_SIZE_EDIT, EN_CHANGE, OnChangeData)
  125. CHAIN_MSG_MAP(baseClass)
  126. END_MSG_MAP()
  127. BEGIN_DDX_MAP(CCacheOptPage)
  128. DDX_CHECK(IDC_NO_CACHE, m_pData->m_NoCache)
  129. DDX_CHECK(IDC_UNLIMITED_CACHE, m_pData->m_UnlimCache)
  130. DDX_CHECK(IDC_LIMITED_CACHE, m_pData->m_LimCache)
  131. DDX_INT_RANGE(IDC_CACHE_SIZE_EDIT, m_pData->m_LimCacheInMemorySize, CACHE_SIZE_MIN, CACHE_SIZE_MAX)
  132. DDX_CONTROL(IDC_NO_CACHE, m_NoCacheBtn)
  133. DDX_CONTROL(IDC_UNLIMITED_CACHE, m_UnlimCacheBtn)
  134. DDX_CONTROL(IDC_LIMITED_CACHE, m_LimCacheBtn)
  135. DDX_CONTROL(IDC_CACHE_SIZE_SPIN, m_inmem_lim)
  136. DDX_CONTROL(IDC_ENG_CACHED_SPIN, m_eng_cache)
  137. DDX_INT_RANGE(IDC_ENGINES, m_pData->m_ScriptEngCacheMax, SCRIPT_ENG_MIN, SCRIPT_ENG_MAX)
  138. END_DDX_MAP()
  139. public:
  140. LRESULT OnInitDialog(HWND hDlg, LPARAM lParam);
  141. void OnCacheSwitch(UINT nCode, UINT nID, HWND hWnd);
  142. void OnChangeData(UINT nCode, UINT nID, HWND hWnd)
  143. {
  144. SET_MODIFIED(TRUE);
  145. }
  146. BOOL OnKillActive();
  147. BOOL OnApply()
  148. {
  149. APPLY_DATA();
  150. return TRUE;
  151. }
  152. void OnDataValidateError(UINT nCtrlID, BOOL bSave, _XData& data);
  153. void OnDataExchangeError(UINT nCtrlID, BOOL bSave);
  154. void OnHelp();
  155. protected:
  156. CAppData * m_pData;
  157. CButtonExch m_NoCacheBtn, m_UnlimCacheBtn, m_LimCacheBtn;
  158. CUpDownCtrlExch m_inmem_lim;
  159. CUpDownCtrlExch m_eng_cache;
  160. BOOL m_bInitDone;
  161. };
  162. #endif //_CACHE_OPT_H