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.3 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. // Copyright (c) 2002 Microsoft Corporation. All rights reserved.
  3. // Copyright (c) 2002 OSR Open Systems Resources, Inc.
  4. //
  5. // FormatSourceSelectDlg.cpp : implementation file
  6. //////////////////////////////////////////////////////////////////////////////
  7. #include "stdafx.h"
  8. #include <tchar.h>
  9. #include <wmistr.h>
  10. #include <initguid.h>
  11. extern "C" {
  12. #include <evntrace.h>
  13. }
  14. #include <traceprt.h>
  15. #include "TraceView.h"
  16. #include "LogSession.h"
  17. #include "ProviderFormatInfo.h"
  18. #include "PathDlg.h"
  19. #include "FormatSourceSelectDlg.h"
  20. // CFormatSourceSelectDlg dialog
  21. IMPLEMENT_DYNAMIC(CFormatSourceSelectDlg, CDialog)
  22. CFormatSourceSelectDlg::CFormatSourceSelectDlg(CWnd* pParent, CTraceSession *pTraceSession)
  23. : CDialog(CFormatSourceSelectDlg::IDD, pParent)
  24. {
  25. //
  26. // Store off the trace session pointer
  27. //
  28. m_pTraceSession = pTraceSession;
  29. }
  30. CFormatSourceSelectDlg::~CFormatSourceSelectDlg()
  31. {
  32. }
  33. BOOL CFormatSourceSelectDlg::OnInitDialog()
  34. {
  35. BOOL retVal;
  36. retVal = CDialog::OnInitDialog();
  37. //
  38. // Default to using the path select
  39. //
  40. ((CButton *)GetDlgItem(IDC_TMF_SELECT_RADIO))->SetCheck(BST_UNCHECKED);
  41. ((CButton *)GetDlgItem(IDC_TMF_SEARCH_RADIO))->SetCheck(BST_CHECKED);
  42. return retVal;
  43. }
  44. void CFormatSourceSelectDlg::DoDataExchange(CDataExchange* pDX)
  45. {
  46. CDialog::DoDataExchange(pDX);
  47. }
  48. BEGIN_MESSAGE_MAP(CFormatSourceSelectDlg, CDialog)
  49. ON_BN_CLICKED(IDC_TMF_SELECT_RADIO, OnBnClickedTmfSelectRadio)
  50. ON_BN_CLICKED(IDC_TMF_SEARCH_RADIO, OnBnClickedTmfSearchRadio)
  51. END_MESSAGE_MAP()
  52. // CFormatSourceSelectDlg message handlers
  53. void CFormatSourceSelectDlg::OnOK()
  54. {
  55. //
  56. // Determine which dialog to popup next
  57. //
  58. if(((CButton *)GetDlgItem(IDC_TMF_SELECT_RADIO))->GetCheck()) {
  59. //
  60. // Pop up the TMF select dialog
  61. //
  62. CProviderFormatInfo *pDialog = new CProviderFormatInfo(this, m_pTraceSession);
  63. if(pDialog == NULL) {
  64. EndDialog(2);
  65. return;
  66. }
  67. pDialog->DoModal();
  68. delete pDialog;
  69. EndDialog(1);
  70. return;
  71. } else {
  72. //
  73. // Pop up the path select dialog
  74. //
  75. DWORD flags = 0;
  76. CString path;
  77. flags |= (OFN_SHOWHELP | OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ENABLETEMPLATE);
  78. CPathDlg pathDlg(FALSE, NULL, NULL, flags, NULL);
  79. if(IDOK != pathDlg.DoModal()) {
  80. EndDialog(2);
  81. return;
  82. }
  83. WORD fileOffset;
  84. CString directory;
  85. fileOffset = pathDlg.m_ofn.nFileOffset;
  86. pathDlg.m_ofn.lpstrFile[fileOffset - 1] = 0;
  87. directory = pathDlg.m_ofn.lpstrFile;
  88. m_pTraceSession->m_tmfPath = directory + "\\";
  89. EndDialog(1);
  90. }
  91. }
  92. void CFormatSourceSelectDlg::OnBnClickedTmfSelectRadio()
  93. {
  94. ((CButton *)GetDlgItem(IDC_TMF_SELECT_RADIO))->SetCheck(BST_CHECKED);
  95. ((CButton *)GetDlgItem(IDC_TMF_SEARCH_RADIO))->SetCheck(BST_UNCHECKED);
  96. }
  97. void CFormatSourceSelectDlg::OnBnClickedTmfSearchRadio()
  98. {
  99. ((CButton *)GetDlgItem(IDC_TMF_SELECT_RADIO))->SetCheck(BST_UNCHECKED);
  100. ((CButton *)GetDlgItem(IDC_TMF_SEARCH_RADIO))->SetCheck(BST_CHECKED);
  101. }