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.

203 lines
5.0 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: 10/12/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: ChicagoClientDlg.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of ChicagoClientDlg.cpp
  13. //----------------------------------------------------------------------------
  14. // ChicagoClientDlg.cpp : implementation file
  15. //
  16. #include "stdafx.h"
  17. #include "ChicagoClient.h"
  18. #include "ChicagoClientDlg.h"
  19. #ifdef _DEBUG
  20. #define new DEBUG_NEW
  21. #endif
  22. // CAboutDlg dialog used for App About
  23. class CAboutDlg : public CDialog
  24. {
  25. public:
  26. CAboutDlg();
  27. // Dialog Data
  28. enum { IDD = IDD_ABOUTBOX };
  29. protected:
  30. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  31. // Implementation
  32. protected:
  33. DECLARE_MESSAGE_MAP()
  34. };
  35. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  36. {
  37. }
  38. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  39. {
  40. CDialog::DoDataExchange(pDX);
  41. }
  42. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  43. END_MESSAGE_MAP()
  44. CChicagoClientDlg::CChicagoClientDlg(CWnd* pParent /*=NULL*/)
  45. : CDialog(CChicagoClientDlg::IDD, pParent)
  46. {
  47. m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  48. }
  49. void CChicagoClientDlg::DoDataExchange(CDataExchange* pDX)
  50. {
  51. CDialog::DoDataExchange(pDX);
  52. }
  53. BEGIN_MESSAGE_MAP(CChicagoClientDlg, CDialog)
  54. ON_WM_SYSCOMMAND()
  55. ON_WM_PAINT()
  56. ON_WM_QUERYDRAGICON()
  57. //}}AFX_MSG_MAP
  58. END_MESSAGE_MAP()
  59. BOOL CChicagoClientDlg::OnInitDialog()
  60. {
  61. CDialog::OnInitDialog();
  62. /*
  63. CLgSiteManager manager[2];
  64. CLgArchiveM arStore( TRUE ), arLoad( FALSE );
  65. const int nItem = 10;
  66. CLgSiteDeviceCamera *pCamera[nItem];
  67. CLgSiteDeviceCameraPTZ *pCameraPTZ[nItem];
  68. CLgSiteDeviceSensorDC *pDC[nItem];
  69. CLgSiteDeviceSensorLGS *pLGS[nItem];
  70. for( INT i = 0; i < nItem; i++ )
  71. {
  72. pCamera[i] = new CLgSiteDeviceCamera;
  73. pCameraPTZ[i] = new CLgSiteDeviceCameraPTZ;
  74. pDC[i] = new CLgSiteDeviceSensorDC;
  75. pLGS[i] = new CLgSiteDeviceSensorLGS;
  76. pCamera[i]->GetName() = _T("Camera");
  77. pCameraPTZ[i]->GetName() = _T("CameraPTZ");
  78. pDC[i]->GetName() = _T("DC");
  79. pLGS[i]->GetName() = _T("LGS");
  80. manager[0].ObjectToChildLinkP::Link( pCamera[i] );
  81. manager[0].ObjectToChildLinkP::Link( pDC[i] );
  82. manager[0].ObjectToChildLinkP::Link( pLGS[i] );
  83. manager[0].ObjectToChildLinkP::Link( pCameraPTZ[i] );
  84. }
  85. for( i = 0; i < nItem; i++ )
  86. {
  87. int n1 = rand() % nItem;
  88. int n2 = rand() % nItem;
  89. pCameraPTZ[n1]->Connect( pLGS[n2] );
  90. pCamera[n1]->Connect( pDC[n2] );
  91. pCameraPTZ[n1]->Connect( pDC[n2] );
  92. pCamera[n1]->Connect( pLGS[n2] );
  93. }
  94. manager[0].Serialize( arStore );
  95. arLoad.Write( &arStore );
  96. manager[1].Serialize( arLoad );
  97. manager[0].Dump( 0 );
  98. manager[1].Dump( 0 );
  99. */
  100. // Add "About..." menu item to system menu.
  101. // IDM_ABOUTBOX must be in the system command range.
  102. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  103. ASSERT(IDM_ABOUTBOX < 0xF000);
  104. CMenu* pSysMenu = GetSystemMenu(FALSE);
  105. if (pSysMenu != NULL)
  106. {
  107. CString strAboutMenu;
  108. strAboutMenu.LoadString(IDS_ABOUTBOX);
  109. if (!strAboutMenu.IsEmpty())
  110. {
  111. pSysMenu->AppendMenu(MF_SEPARATOR);
  112. pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
  113. }
  114. }
  115. // Set the icon for this dialog. The framework does this automatically
  116. // when the application's main window is not a dialog
  117. SetIcon(m_hIcon, TRUE); // Set big icon
  118. SetIcon(m_hIcon, FALSE); // Set small icon
  119. // TODO: Add extra initialization here
  120. m_SiteManager.GetBackground()->Load( "Main_Map.bmp", NULL, 1.0 );
  121. m_WholeWnd.Create( this, m_SiteManager.GetBackground(), 0, 0, 200, 200 );
  122. m_WholeWnd.ShowWindow( SW_SHOW );
  123. m_WholeWnd.UpdateInfo( TRUE );
  124. return TRUE; // return TRUE unless you set the focus to a control
  125. }
  126. void CChicagoClientDlg::OnSysCommand(UINT nID, LPARAM lParam)
  127. {
  128. if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  129. {
  130. CAboutDlg dlgAbout;
  131. dlgAbout.DoModal();
  132. }
  133. else
  134. {
  135. CDialog::OnSysCommand(nID, lParam);
  136. }
  137. }
  138. // If you add a minimize button to your dialog, you will need the code below
  139. // to draw the icon. For MFC applications using the document/view model,
  140. // this is automatically done for you by the framework.
  141. void CChicagoClientDlg::OnPaint()
  142. {
  143. if (IsIconic())
  144. {
  145. CPaintDC dc(this); // device context for painting
  146. SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
  147. // Center icon in client rectangle
  148. int cxIcon = GetSystemMetrics(SM_CXICON);
  149. int cyIcon = GetSystemMetrics(SM_CYICON);
  150. CRect rect;
  151. GetClientRect(&rect);
  152. int x = (rect.Width() - cxIcon + 1) / 2;
  153. int y = (rect.Height() - cyIcon + 1) / 2;
  154. // Draw the icon
  155. dc.DrawIcon(x, y, m_hIcon);
  156. }
  157. else
  158. {
  159. CDialog::OnPaint();
  160. }
  161. }
  162. // The system calls this function to obtain the cursor to display while the user drags
  163. // the minimized window.
  164. HCURSOR CChicagoClientDlg::OnQueryDragIcon()
  165. {
  166. return static_cast<HCURSOR>(m_hIcon);
  167. }