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.

268 lines
6.5 KiB

  1. // WSCheck.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "minidev.h"
  5. #include "WSCheck.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CWSCheckView
  13. IMPLEMENT_DYNCREATE(CWSCheckView, CFormView)
  14. CWSCheckView::CWSCheckView()
  15. : CFormView(CWSCheckView::IDD)
  16. {
  17. //{{AFX_DATA_INIT(CWSCheckView)
  18. // NOTE: the ClassWizard will add member initialization here
  19. //}}AFX_DATA_INIT
  20. }
  21. CWSCheckView::~CWSCheckView()
  22. {
  23. }
  24. void CWSCheckView::DoDataExchange(CDataExchange* pDX)
  25. {
  26. CFormView::DoDataExchange(pDX);
  27. //{{AFX_DATA_MAP(CWSCheckView)
  28. DDX_Control(pDX, IDC_ErrWrnLstBox, m_lstErrWrn);
  29. //}}AFX_DATA_MAP
  30. }
  31. BEGIN_MESSAGE_MAP(CWSCheckView, CFormView)
  32. //{{AFX_MSG_MAP(CWSCheckView)
  33. ON_LBN_DBLCLK(IDC_ErrWrnLstBox, OnDblclkErrWrnLstBox)
  34. //}}AFX_MSG_MAP
  35. END_MESSAGE_MAP()
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CWSCheckView diagnostics
  38. #ifdef _DEBUG
  39. void CWSCheckView::AssertValid() const
  40. {
  41. CFormView::AssertValid();
  42. }
  43. void CWSCheckView::Dump(CDumpContext& dc) const
  44. {
  45. CFormView::Dump(dc);
  46. }
  47. #endif //_DEBUG
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CWSCheckView message handlers
  50. void CWSCheckView::OnDblclkErrWrnLstBox()
  51. {
  52. // TODO: Add your control notification handler code here
  53. }
  54. /******************************************************************************
  55. CWSCheckView::OnInitialUpdate
  56. Resize the frame to better fit the visible controls in it.
  57. ******************************************************************************/
  58. void CWSCheckView::OnInitialUpdate()
  59. {
  60. CRect crtxt ; // Coordinates of list box label
  61. CRect crlbfrm ; // Coordinates of list box and frame
  62. CFormView::OnInitialUpdate() ;
  63. // Get the dimensions of the list box label
  64. HWND hlblhandle ;
  65. GetDlgItem(IDC_WSCLabel, &hlblhandle) ;
  66. ::GetWindowRect(hlblhandle, crtxt) ;
  67. crtxt.NormalizeRect() ;
  68. // Get the dimensions of the list box and then add the height of the label
  69. // to those dimensions.
  70. m_lstErrWrn.GetWindowRect(crlbfrm) ;
  71. crlbfrm.bottom += crtxt.Height() ;
  72. // Make sure the frame is big enough for these 2 controls plus a little bit
  73. // more.
  74. crlbfrm.right += 40 ;
  75. crlbfrm.bottom += 40 ;
  76. GetParentFrame()->CalcWindowRect(crlbfrm) ;
  77. GetParentFrame()->SetWindowPos(NULL, 0, 0, crlbfrm.Width(), crlbfrm.Height(),
  78. SWP_NOZORDER | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOACTIVATE) ;
  79. /*
  80. CRect crPropertySheet;
  81. m_cps.GetWindowRect(crPropertySheet);
  82. crPropertySheet -= crPropertySheet.TopLeft();
  83. m_cps.MoveWindow(crPropertySheet, FALSE); // Position property sheet within the
  84. // child frame
  85. GetParentFrame()->CalcWindowRect(crPropertySheet);
  86. GetParentFrame()->SetWindowPos(NULL, 0, 0, crPropertySheet.Width(),
  87. crPropertySheet.Height(),
  88. SWP_NOZORDER | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOACTIVATE);
  89. */
  90. }
  91. /******************************************************************************
  92. CWSCheckView::PostWSCMsg
  93. Add an error or warning message along with its associated Project Node
  94. pointer to the list box.
  95. ******************************************************************************/
  96. void CWSCheckView::PostWSCMsg(CString& csmsg, CProjectNode* ppn)
  97. {
  98. int n = m_lstErrWrn.AddString(csmsg) ;
  99. m_lstErrWrn.SetItemData(n, (DWORD) PtrToUlong(ppn)) ;
  100. }
  101. /******************************************************************************
  102. CWSCheckView::DeleteAllMessages
  103. Delete all of the messages in the list box.
  104. ******************************************************************************/
  105. void CWSCheckView::DeleteAllMessages(void)
  106. {
  107. m_lstErrWrn.ResetContent() ;
  108. }
  109. /////////////////////////////////////////////////////////////////////////////
  110. // CWSCheckDoc
  111. IMPLEMENT_DYNCREATE(CWSCheckDoc, CDocument)
  112. CWSCheckDoc::CWSCheckDoc()
  113. {
  114. }
  115. /******************************************************************************
  116. CWSCheckDoc::CWSCheckDoc
  117. This is the only form of the constructor that should be called. It will save
  118. a pointer the class that created it.
  119. ******************************************************************************/
  120. CWSCheckDoc::CWSCheckDoc(CDriverResources* pcdr)
  121. {
  122. m_pcdrOwner = pcdr ;
  123. }
  124. CWSCheckDoc::~CWSCheckDoc()
  125. {
  126. }
  127. BOOL CWSCheckDoc::OnNewDocument()
  128. {
  129. if (!CDocument::OnNewDocument())
  130. return FALSE;
  131. return TRUE;
  132. }
  133. /******************************************************************************
  134. CWSCheckDoc::PostWSCMsg
  135. Pass the specified request on to what should be the one and only view
  136. attached to this document.
  137. ******************************************************************************/
  138. void CWSCheckDoc::PostWSCMsg(CString& csmsg, CProjectNode* ppn)
  139. {
  140. POSITION pos = GetFirstViewPosition() ;
  141. if (pos != NULL) {
  142. CWSCheckView* pwscv = (CWSCheckView *) GetNextView(pos) ;
  143. pwscv->PostWSCMsg(csmsg, ppn) ;
  144. pwscv->UpdateWindow() ;
  145. } ;
  146. }
  147. /******************************************************************************
  148. CWSCheckDoc::DeleteAllMessages
  149. Pass the specified request on to what should be the one and only view
  150. attached to this document.
  151. ******************************************************************************/
  152. void CWSCheckDoc::DeleteAllMessages(void)
  153. {
  154. POSITION pos = GetFirstViewPosition() ;
  155. if (pos != NULL) {
  156. CWSCheckView* pwscv = (CWSCheckView *) GetNextView(pos) ;
  157. pwscv->DeleteAllMessages() ;
  158. pwscv->UpdateWindow() ;
  159. } ;
  160. }
  161. BEGIN_MESSAGE_MAP(CWSCheckDoc, CDocument)
  162. //{{AFX_MSG_MAP(CWSCheckDoc)
  163. // NOTE - the ClassWizard will add and remove mapping macros here.
  164. //}}AFX_MSG_MAP
  165. END_MESSAGE_MAP()
  166. /////////////////////////////////////////////////////////////////////////////
  167. // CWSCheckDoc diagnostics
  168. #ifdef _DEBUG
  169. void CWSCheckDoc::AssertValid() const
  170. {
  171. CDocument::AssertValid();
  172. }
  173. void CWSCheckDoc::Dump(CDumpContext& dc) const
  174. {
  175. CDocument::Dump(dc);
  176. }
  177. #endif //_DEBUG
  178. /////////////////////////////////////////////////////////////////////////////
  179. // CWSCheckDoc serialization
  180. void CWSCheckDoc::Serialize(CArchive& ar)
  181. {
  182. if (ar.IsStoring())
  183. {
  184. // TODO: add storing code here
  185. }
  186. else
  187. {
  188. // TODO: add loading code here
  189. }
  190. }