OptionsSheet.cpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. // OptionsSheet.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "CP_Main.h"
  5. #include "OptionsSheet.h"
  6. #include "OptionsKeyBoard.h"
  7. #include "OptionsGeneral.h"
  8. #include "OptionsQuickPaste.h"
  9. #include "OptionsStats.h"
  10. #include "OptionsTypes.h"
  11. #include "About.h"
  12. #include "OptionFriends.h"
  13. #include "OptionsCopyBuffers.h"
  14. #include "Misc.h"
  15. #include "QuickPasteKeyboard.h"
  16. #ifdef _DEBUG
  17. #define new DEBUG_NEW
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21. /////////////////////////////////////////////////////////////////////////////
  22. // COptionsSheet
  23. IMPLEMENT_DYNAMIC(COptionsSheet, CPropertySheet)
  24. COptionsSheet::COptionsSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
  25. :CPropertySheet(pszCaption, pParentWnd, iSelectPage)
  26. {
  27. m_pKeyBoardOptions = NULL;
  28. m_pGeneralOptions = NULL;
  29. m_pQuickPasteOptions = NULL;
  30. m_pCopyBuffers = NULL;
  31. m_pStats = NULL;
  32. m_pTypes = NULL;
  33. m_pAbout = NULL;
  34. m_pFriends = NULL;
  35. m_pCopyBuffers = NULL;
  36. m_pQuickPasteShortCuts = NULL;
  37. m_pUtilites = NULL;
  38. m_hWndParent = NULL;
  39. EnableStackedTabs(TRUE);
  40. m_pGeneralOptions = new COptionsGeneral;
  41. m_pKeyBoardOptions = new COptionsKeyBoard;
  42. m_pQuickPasteOptions = new COptionsQuickPaste;
  43. m_pQuickPasteShortCuts = new CQuickPasteKeyboard;
  44. m_pCopyBuffers = new COptionsCopyBuffers;
  45. m_pStats = new COptionsStats;
  46. m_pTypes = new COptionsTypes;
  47. m_pAbout = new CAbout;
  48. AddPage(m_pGeneralOptions);
  49. AddPage(m_pTypes);
  50. AddPage(m_pKeyBoardOptions);
  51. AddPage(m_pCopyBuffers);
  52. AddPage(m_pQuickPasteOptions);
  53. AddPage(m_pQuickPasteShortCuts);
  54. if(g_Opt.GetAllowFriends())
  55. {
  56. m_pFriends = new COptionFriends;
  57. AddPage(m_pFriends);
  58. }
  59. AddPage(m_pStats);
  60. AddPage(m_pAbout);
  61. }
  62. COptionsSheet::~COptionsSheet()
  63. {
  64. delete m_pGeneralOptions;
  65. delete m_pKeyBoardOptions;
  66. delete m_pQuickPasteOptions;
  67. delete m_pCopyBuffers;
  68. delete m_pStats;
  69. delete m_pTypes;
  70. delete m_pAbout;
  71. delete m_pFriends;
  72. delete m_pUtilites;
  73. delete m_pQuickPasteShortCuts;
  74. }
  75. BEGIN_MESSAGE_MAP(COptionsSheet, CPropertySheet)
  76. //{{AFX_MSG_MAP(COptionsSheet)
  77. // NOTE - the ClassWizard will add and remove mapping macros here.
  78. ON_WM_DESTROY()
  79. ON_WM_NCDESTROY()
  80. //ON_WM_CLOSE()
  81. //}}AFX_MSG_MAP
  82. END_MESSAGE_MAP()
  83. /////////////////////////////////////////////////////////////////////////////
  84. // COptionsSheet message handlers
  85. void COptionsSheet::OnDestroy()
  86. {
  87. CPropertySheet::OnDestroy();
  88. }
  89. void COptionsSheet::SetNotifyWnd(HWND hWnd)
  90. {
  91. m_hWndParent = hWnd;
  92. }
  93. BOOL COptionsSheet::OnInitDialog()
  94. {
  95. m_bModeless = FALSE;
  96. m_nFlags |= WF_CONTINUEMODAL;
  97. BOOL bResult = CPropertySheet::OnInitDialog();
  98. SetWindowText(_T("Ditto"));
  99. theApp.m_Language.UpdateOptionsSheet(this);
  100. ::ShowWindow(::GetDlgItem(m_hWnd, ID_APPLY_NOW), SW_HIDE);
  101. m_bModeless = TRUE;
  102. m_nFlags &= ~WF_CONTINUEMODAL;
  103. return bResult;
  104. }
  105. void COptionsSheet::OnNcDestroy()
  106. {
  107. CPropertySheet::OnNcDestroy();
  108. ::PostMessage(m_hWndParent, WM_OPTIONS_CLOSED, 0, 0);
  109. }