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.

135 lines
3.7 KiB

  1. #include "Precomp.h"
  2. #include "resource.h"
  3. #include "global.h"
  4. #include "PropPg.h"
  5. #include "FinishDg.h"
  6. #include "nmakwiz.h"
  7. // Static
  8. CFinishSheet* CFinishSheet::ms_pFinishSheet = NULL;
  9. ////////////////////////////////////////////////////////////////////////////////////////////////////
  10. // Member fns
  11. CFinishSheet::CFinishSheet( void ) :
  12. m_PropertySheetPage( MAKEINTRESOURCE( IDD_PROPPAGE_DEFAULT ),
  13. CFinishSheet::DlgProc),
  14. m_pFilePane( NULL )
  15. {
  16. ms_pFinishSheet = this;
  17. }
  18. CFinishSheet::~CFinishSheet(void)
  19. {
  20. delete m_pFilePane;
  21. m_pFilePane = NULL;
  22. ms_pFinishSheet = NULL;
  23. }
  24. ////////////////////////////////////////////////////////////////////////////////////////////////////
  25. // Static member fns
  26. INT_PTR CALLBACK CFinishSheet::DlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) {
  27. switch( message )
  28. {
  29. case WM_INITDIALOG:
  30. {
  31. PropSheet_SetWizButtons( GetParent( hDlg ), PSWIZB_FINISH | PSWIZB_BACK );
  32. ms_pFinishSheet->_CreateFilePane(hDlg);
  33. return TRUE;
  34. }
  35. case WM_NOTIFY:
  36. {
  37. switch( reinterpret_cast< NMHDR FAR* >( lParam ) -> code )
  38. {
  39. case PSN_QUERYCANCEL:
  40. SetWindowLong( hDlg, DWL_MSGRESULT, !VerifyExitMessageBox());
  41. return TRUE;
  42. case PSN_SETACTIVE:
  43. g_hwndActive = hDlg;
  44. PropSheet_SetWizButtons( GetParent( hDlg ), PSWIZB_FINISH | PSWIZB_BACK );
  45. ms_pFinishSheet->m_pFilePane->Validate(FALSE);
  46. return TRUE;
  47. case PSN_WIZBACK:
  48. if (!ms_pFinishSheet->m_pFilePane->Validate(TRUE))
  49. {
  50. SetWindowLong(hDlg, DWL_MSGRESULT, -1);
  51. return TRUE;
  52. }
  53. break;
  54. case PSN_WIZFINISH:
  55. if (!ms_pFinishSheet->m_pFilePane->Validate(TRUE))
  56. {
  57. SetWindowLong(hDlg, DWL_MSGRESULT, -1);
  58. return TRUE;
  59. }
  60. g_pWiz->CallbackForWhenUserHitsFinishButton();
  61. return TRUE;
  62. }
  63. break;
  64. }
  65. default:
  66. break;
  67. }
  68. return FALSE;
  69. }
  70. //
  71. // _CreateFilePane()
  72. //
  73. void CFinishSheet::_CreateFilePane(HWND hDlg)
  74. {
  75. RECT rect;
  76. GetClientRect(hDlg, &rect);
  77. int iHeight = rect.bottom - rect.top;
  78. int iWidth = rect.right - CPropertyDataWindow2::mcs_iLeft;
  79. m_pFilePane = new CFilePanePropWnd2(hDlg, IDD_FILEPANE_SETTINGS,
  80. TEXT("IDD_FILEPANE_SETTINGS"), 0, CPropertyDataWindow2::mcs_iLeft,
  81. CPropertyDataWindow2::mcs_iTop, iWidth, iHeight);
  82. HWND hwndCond = GetDlgItem(m_pFilePane->GetHwnd(), IDC_SETTINGS_FILE);
  83. m_pFilePane->ConnectControlsToCheck(IDC_SETTINGS_FILE, 2,
  84. new CControlID(hwndCond, IDC_SETTINGS_FILE, IDE_SETTINGS_FILE,
  85. CControlID::EDIT),
  86. new CControlID(hwndCond, IDC_SETTINGS_FILE, IDC_BROWSE_SETTINGS_FILE,
  87. CControlID::CHECK));
  88. m_pFilePane->SetFilePane(FALSE, IDE_SETTINGS_FILE, IDC_SETTINGS_FILE,
  89. IDC_BROWSE_SETTINGS_FILE, TEXT("Configuration File (*.ini)"),
  90. TEXT(".ini"), TEXT("nm3c.ini"));
  91. if (g_pWiz->m_IntroSheet.GetFilePane()->OptionEnabled())
  92. {
  93. TCHAR szFile[MAX_PATH];
  94. g_pWiz->m_IntroSheet.GetFilePane()->GetPathAndFile(szFile);
  95. Edit_SetText(GetDlgItem(m_pFilePane->GetHwnd(), IDE_SETTINGS_FILE),
  96. szFile);
  97. }
  98. m_pFilePane->ShowWindow(TRUE);
  99. m_pFilePane->SetCheck(IDC_SETTINGS_FILE, TRUE);
  100. }