Old fashion design for PC-104
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.

335 lines
7.8 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 05/11/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: LgReport.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of LgReport.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "LgLibReport.h"
  16. #include "LgReport.h"
  17. #include "LgReportDlg.h"
  18. #include "LgReportStorage.h"
  19. #ifdef _DEBUG
  20. #undef THIS_FILE
  21. static char THIS_FILE[]=__FILE__;
  22. #define new DEBUG_NEW
  23. #endif
  24. /*
  25. CLgReportDialog::CLgReportDialog()
  26. {
  27. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  28. m_pReserved = NULL;
  29. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CLgReportDialog::CLgReportDialog") );
  30. }
  31. CLgReportDialog::~CLgReportDialog()
  32. {
  33. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CLgReportDialog::~CLgReportDialog") );
  34. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  35. Destroy();
  36. }
  37. void CLgReportDialog::Destroy()
  38. {
  39. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  40. if( !m_pReserved )
  41. return;
  42. static_cast<CLgReportDlg*>(m_pReserved)->DestroyWindow();
  43. delete static_cast<CLgReportDlg*>(m_pReserved);
  44. m_pReserved = NULL;
  45. }
  46. BOOL CLgReportDialog::Create( LPCTSTR pRootPath, HWND hParentWnd )
  47. {
  48. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  49. if( m_pReserved )
  50. return TRUE;
  51. m_pReserved = new CLgReportDlg();
  52. if( !m_pReserved )
  53. return FALSE;
  54. return static_cast<CLgReportDlg*>(m_pReserved)->Create( pRootPath, hParentWnd );
  55. }
  56. BOOL CLgReportDialog::DoModal( LPCTSTR pRootPath, HWND hParentWnd )
  57. {
  58. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  59. CLgReportDlg dlg;
  60. return dlg.DoModal( pRootPath, hParentWnd );
  61. }
  62. HWND CLgReportDialog::GetControlEvent()
  63. {
  64. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  65. return m_pReserved ? static_cast<CLgReportDlg*>(m_pReserved)->GetControlEvent() : NULL;
  66. }
  67. HWND CLgReportDialog::GetControlTree()
  68. {
  69. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  70. return m_pReserved ? static_cast<CLgReportDlg*>(m_pReserved)->GetControlTree() : NULL;
  71. }
  72. HWND CLgReportDialog::GetControlFilterEvent()
  73. {
  74. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  75. return m_pReserved ? static_cast<CLgReportDlg*>(m_pReserved)->GetControlFilterEvent() : NULL;
  76. }
  77. HWND CLgReportDialog::GetControlFilterSensor()
  78. {
  79. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  80. return m_pReserved ? static_cast<CLgReportDlg*>(m_pReserved)->GetControlFilterSensor() : NULL;
  81. }
  82. HWND CLgReportDialog::GetControlVideo()
  83. {
  84. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  85. return m_pReserved ? static_cast<CLgReportDlg*>(m_pReserved)->GetControlVideo() : NULL;
  86. }
  87. HWND CLgReportDialog::GetControlSite()
  88. {
  89. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  90. return m_pReserved ? static_cast<CLgReportDlg*>(m_pReserved)->GetControlSite() : NULL;
  91. }
  92. HWND CLgReportDialog::GetControlScroll()
  93. {
  94. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  95. return m_pReserved ? static_cast<CLgReportDlg*>(m_pReserved)->GetControlScroll() : NULL;
  96. }
  97. */
  98. CLgReport::CLgReport()
  99. {
  100. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CLgReport::CLgReport") );
  101. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  102. m_pReserved = new CLgReportStorage();
  103. }
  104. CLgReport::~CLgReport()
  105. {
  106. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CLgReport::~CLgReport") );
  107. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  108. Destroy();
  109. if( m_pReserved )
  110. delete static_cast<CLgReportStorage*>(m_pReserved);
  111. }
  112. BOOL CLgReport::Create( LPCTSTR pPathRoot, INT nMaxStorageDays )
  113. {
  114. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  115. if( !m_pReserved )
  116. return FALSE;
  117. return static_cast<CLgReportStorage*>(m_pReserved)->Create( pPathRoot, nMaxStorageDays, this );
  118. }
  119. void CLgReport::Destroy()
  120. {
  121. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  122. if( !m_pReserved )
  123. return;
  124. static_cast<CLgReportStorage*>(m_pReserved)->Destroy();
  125. }
  126. BOOL CLgReport::OnSensor( LPCTSTR pName, float x, float y )
  127. {
  128. if( !m_pReserved )
  129. return FALSE;
  130. return static_cast<CLgReportStorage*>(m_pReserved)->OnSensor( pName, x, y );
  131. }
  132. BOOL CLgReport::OnFilter( BYTE bId, LPCTSTR pName )
  133. {
  134. if( !m_pReserved )
  135. return FALSE;
  136. return static_cast<CLgReportStorage*>(m_pReserved)->OnFilter( bId, pName );
  137. }
  138. BOOL CLgReport::Reset()
  139. {
  140. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  141. if( !m_pReserved )
  142. return FALSE;
  143. return static_cast<CLgReportStorage*>(m_pReserved)->Reset();
  144. }
  145. BOOL CLgReport::StoreEvent(SYSTEMTIME *pST, BYTE bId, BOOL bSensor, WORD wSensorIndex, BOOL bPosition, float x, float y, LARGE_INTEGER *pOffset, LPCTSTR pFormat, ... )
  146. {
  147. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  148. if( !m_pReserved )
  149. return FALSE;
  150. va_list pMarker;
  151. va_start( pMarker, pFormat );
  152. BOOL bResult = static_cast<CLgReportStorage*>(m_pReserved)->StoreEvent( pST, bId, bSensor, wSensorIndex, bPosition, x, y, pOffset, pFormat, pMarker );
  153. va_end( pMarker );
  154. return bResult;
  155. }
  156. BOOL CLgReport::StoreImage( HBITMAP hBitmap, LARGE_INTEGER *pOffset )
  157. {
  158. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  159. if( !m_pReserved )
  160. return FALSE;
  161. return static_cast<CLgReportStorage*>(m_pReserved)->StoreImage( hBitmap, pOffset );
  162. }
  163. BOOL CLgReport::StoreImage( CLgImageDIB& dib, LARGE_INTEGER *pOffset )
  164. {
  165. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  166. if( !m_pReserved )
  167. return FALSE;
  168. return static_cast<CLgReportStorage*>(m_pReserved)->StoreImage( dib, pOffset );
  169. }
  170. BOOL CLgReport::StoreImage( CLgImageJPEG& jpeg, LARGE_INTEGER *pOffset )\
  171. {
  172. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  173. if( !m_pReserved )
  174. return FALSE;
  175. return static_cast<CLgReportStorage*>(m_pReserved)->StoreImage( jpeg, pOffset );
  176. }
  177. BOOL CLgReport::StoreBackground( CLgImageDIB& dib )
  178. {
  179. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  180. if( !m_pReserved )
  181. return FALSE;
  182. return static_cast<CLgReportStorage*>(m_pReserved)->StoreBackground( dib );
  183. }
  184. BOOL CLgReport::StoreBackground( CLgImageJPEG& jpeg )
  185. {
  186. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  187. if( !m_pReserved )
  188. return FALSE;
  189. return static_cast<CLgReportStorage*>(m_pReserved)->StoreBackground( jpeg );
  190. }
  191. /*
  192. BOOL CLgReport::StoreSensors()
  193. {
  194. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  195. if( !m_pReserved )
  196. return FALSE;
  197. return static_cast<CLgReportStorage*>(m_pReserved)->StoreSensors();
  198. }
  199. BOOL CLgReport::StoreFilters()
  200. {
  201. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  202. if( !m_pReserved )
  203. return FALSE;
  204. return static_cast<CLgReportStorage*>(m_pReserved)->StoreFilters();
  205. }
  206. */
  207. BOOL CLgReport::SetMaxStoreTime( INT nDays )
  208. {
  209. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  210. if( !m_pReserved )
  211. return FALSE;
  212. return static_cast<CLgReportStorage*>(m_pReserved)->SetMaxStoreTime( nDays );
  213. }
  214. BOOL CLgReport::Dlg_Create( HWND hParentWnd )
  215. {
  216. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  217. if( !m_pReserved )
  218. return FALSE;
  219. return static_cast<CLgReportStorage*>(m_pReserved)->Dlg_Create( hParentWnd );
  220. }
  221. BOOL CLgReport::Dlg_DoModal( HWND hParentWnd )
  222. {
  223. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  224. if( !m_pReserved )
  225. return FALSE;
  226. return static_cast<CLgReportStorage*>(m_pReserved)->Dlg_DoModal( hParentWnd );
  227. }
  228. BOOL CLgReport::DlgSetup_DoModal( HWND hParentWnd )
  229. {
  230. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  231. if( !m_pReserved )
  232. return FALSE;
  233. return static_cast<CLgReportStorage*>(m_pReserved)->DlgSetup_DoModal( hParentWnd );
  234. }
  235. void CLgReport::Dlg_Destroy()
  236. {
  237. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  238. if( !m_pReserved )
  239. return;
  240. static_cast<CLgReportStorage*>(m_pReserved)->Dlg_Destroy();
  241. }