VMSWBACKF.cpp 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. /****************************************************************************
  2. * @source :
  3. * @description :
  4. ****************************************************************************
  5. * DATE AUTHOR DESCRIPTION
  6. * --------------------------------------------------------------------------
  7. * 2016/07/27 Á¤½ÂÈ£ ÃÖÃÊÀÛ¼º
  8. *
  9. ****************************************************************************/
  10. //---------------------------------------------------------------------------
  11. #include <vcl.h>
  12. #include "AppGlobalF.h"
  13. #include "ITSSkinF.h"
  14. #include "ITSUtilF.h"
  15. #include "FrmVmsOprMainF.h"
  16. #pragma hdrstop
  17. #include "VMSWBACKF.h"
  18. //---------------------------------------------------------------------------
  19. #pragma package(smart_init)
  20. #pragma link "cxContainer"
  21. #pragma link "cxControls"
  22. #pragma link "cxDropDownEdit"
  23. #pragma link "cxEdit"
  24. #pragma link "cxGraphics"
  25. #pragma link "cxLookAndFeelPainters"
  26. #pragma link "cxLookAndFeels"
  27. #pragma link "cxMaskEdit"
  28. #pragma link "cxTextEdit"
  29. #pragma link "dxSkinBlack"
  30. #pragma link "dxSkinMcSkin"
  31. #pragma link "dxSkinsCore"
  32. #pragma link "dxSkinBlue"
  33. #pragma link "dxSkinCaramel"
  34. #pragma link "dxSkinCoffee"
  35. #pragma link "dxSkinDarkRoom"
  36. #pragma link "dxSkinDarkSide"
  37. #pragma link "dxSkinFoggy"
  38. #pragma link "dxSkinGlassOceans"
  39. #pragma link "dxSkiniMaginary"
  40. #pragma link "dxSkinLilian"
  41. #pragma link "dxSkinLiquidSky"
  42. #pragma link "dxSkinLondonLiquidSky"
  43. #pragma link "dxSkinMoneyTwins"
  44. #pragma link "dxSkinOffice2007Black"
  45. #pragma link "dxSkinOffice2007Blue"
  46. #pragma link "dxSkinOffice2007Green"
  47. #pragma link "dxSkinOffice2007Pink"
  48. #pragma link "dxSkinOffice2007Silver"
  49. #pragma link "dxSkinOffice2010Black"
  50. #pragma link "dxSkinOffice2010Blue"
  51. #pragma link "dxSkinOffice2010Silver"
  52. #pragma link "dxSkinSeven"
  53. #pragma link "dxSkinSharp"
  54. #pragma link "dxSkinSilver"
  55. #pragma link "dxSkinStardust"
  56. #pragma resource "*.dfm"
  57. //TVMSBACKM *VMSBACKM = NULL;
  58. //---------------------------------------------------------------------------
  59. __fastcall TVMSWBACK::TVMSWBACK(TComponent* AOwner, HWND AHandle, String ACaption, int AScreenIdx)
  60. : TForm(AOwner)
  61. {
  62. FListForm = new TList();
  63. FScreenName = ACaption;
  64. FScreenIndex = AScreenIdx;
  65. FPlay = false;
  66. FMinWidth = 1000;
  67. FMinHeight = 1000;
  68. FMaxWidth = 0;
  69. FMaxHeight = 0;
  70. FWndParent = AHandle;
  71. Caption = ACaption;
  72. FDisplayMode = 0;
  73. FViewWidth = 320;
  74. }
  75. //---------------------------------------------------------------------------
  76. void __fastcall TVMSWBACK::FormCreate(TObject *Sender)
  77. {
  78. ScrollBox->ParentColor = true;
  79. }
  80. //---------------------------------------------------------------------------
  81. void __fastcall TVMSWBACK::FormShow(TObject *Sender)
  82. {
  83. Refresh();
  84. ScrollBox->Align = alClient;
  85. TmrShow->Enabled = true;
  86. }
  87. //---------------------------------------------------------------------------
  88. void __fastcall TVMSWBACK::TmrShowTimer(TObject *Sender)
  89. {
  90. TmrShow->Enabled = false;
  91. }
  92. //---------------------------------------------------------------------------
  93. void __fastcall TVMSWBACK::ScrollBoxClick(TObject *Sender)
  94. {
  95. ScrollBox->SetFocus();
  96. }
  97. //---------------------------------------------------------------------------
  98. void __fastcall TVMSWBACK::ScrollBoxMouseWheel(TObject *Sender, TShiftState Shift, int WheelDelta, TPoint &MousePos, bool &Handled)
  99. {
  100. ScrollBox->VertScrollBar->Position -= WheelDelta;
  101. }
  102. //---------------------------------------------------------------------------
  103. void __fastcall TVMSWBACK::SetPlay(bool APlay)
  104. {
  105. //AnsiString sTrace;
  106. //if (APlay) sTrace = Caption + " TVMSWBACK: SetPlay = Active";
  107. //else sTrace = Caption + " TVMSWBACK: SetPlay = DeActive";
  108. //ITSUtil_Trace(sTrace.c_str());
  109. try
  110. {
  111. LockWindowUpdate(Handle);
  112. for(int ii = 0; ii < FListForm->Count; ii++)
  113. {
  114. TVMSWCAM0 *pForm = (TVMSWCAM0*)FListForm->Items[ii];
  115. pForm->Play = APlay;
  116. }
  117. }
  118. __finally
  119. {
  120. LockWindowUpdate(0);
  121. }
  122. }
  123. //---------------------------------------------------------------------------
  124. void __fastcall TVMSWBACK::FormResize(TObject *Sender)
  125. {
  126. RecalFormPosition();
  127. }
  128. //---------------------------------------------------------------------------
  129. void __fastcall TVMSWBACK::RecalFormPosition()
  130. {
  131. int h = 0;
  132. for (int ii = 0; ii < FpnlForm->ControlCount; ii++)
  133. {
  134. if (FpnlForm->Controls[ii]->BoundsRect.Bottom > h)
  135. h = FpnlForm->Controls[ii]->BoundsRect.Bottom;
  136. }
  137. FpnlForm->Height = h+50;
  138. ScrollBox->HorzScrollBar->Range = 0;
  139. ScrollBox->VertScrollBar->Range = FpnlForm->Height;
  140. }
  141. //---------------------------------------------------------------------------
  142. void __fastcall TVMSWBACK::RefreshVmsStatus()
  143. {
  144. try
  145. {
  146. for(int ii = 0; ii < FListForm->Count; ii++)
  147. {
  148. TVMSWCAM0 *pForm = (TVMSWCAM0*)FListForm->Items[ii];
  149. pForm->RefreshVmsStatus();
  150. }
  151. }
  152. catch(Exception &e)
  153. {
  154. }
  155. }
  156. //---------------------------------------------------------------------------
  157. void __fastcall TVMSWBACK::RefreshVmsMessage()
  158. {
  159. try
  160. {
  161. for(int ii = 0; ii < FListForm->Count; ii++)
  162. {
  163. TVMSWCAM0 *pForm = (TVMSWCAM0*)FListForm->Items[ii];
  164. pForm->RefreshVmsMessage();
  165. }
  166. }
  167. catch(Exception &e)
  168. {
  169. }
  170. }
  171. //---------------------------------------------------------------------------
  172. bool __fastcall TVMSWBACK::AddVmsForm(String AVmsNmbr)
  173. {
  174. TVmsCtlr *pObj = VmsManager->FLists.Find(AVmsNmbr);
  175. if (!pObj) return false;
  176. if (pObj->WIDTH > FMaxWidth) FMaxWidth = pObj->WIDTH;
  177. if (pObj->WIDTH < FMinWidth) FMinWidth = pObj->WIDTH;
  178. if (pObj->HEIGHT > FMaxHeight) FMaxHeight = pObj->HEIGHT;
  179. if (pObj->HEIGHT < FMinHeight) FMinHeight = pObj->HEIGHT;
  180. TVMSWCAM0 *pForm = new TVMSWCAM0(this, pObj);
  181. pForm->SetFormSize(pObj->WIDTH);
  182. pForm->Parent = FpnlForm;
  183. pForm->FScrollBox = ScrollBox;
  184. pForm->FWndParent = Handle;
  185. pForm->Show();
  186. FListForm->Add(pForm);
  187. return true;
  188. }
  189. //---------------------------------------------------------------------------
  190. void __fastcall TVMSWBACK::FpnlFormClick(TObject *Sender)
  191. {
  192. ScrollBox->SetFocus();
  193. }
  194. //---------------------------------------------------------------------------
  195. void __fastcall TVMSWBACK::OnVmsSelectMessage(TMessage &Msg)
  196. {
  197. if (FWndParent)
  198. {
  199. POST_MSG(FWndParent, WM_VMS_SELECT, (WPARAM)Msg.WParam, (LPARAM)Msg.LParam);
  200. }
  201. }
  202. //---------------------------------------------------------------------------
  203. void __fastcall TVMSWBACK::OnVmsSelectDblClickMessage(TMessage &Msg)
  204. {
  205. if (FWndParent)
  206. {
  207. POST_MSG(FWndParent, WM_VMS_SELECT_DBLCLICK, (WPARAM)Msg.WParam, (LPARAM)Msg.LParam);
  208. }
  209. }
  210. //---------------------------------------------------------------------------
  211. void __fastcall TVMSWBACK::FormDestroy(TObject *Sender)
  212. {
  213. ClearFormList();
  214. SAFE_DELETE(FListForm);
  215. }
  216. //---------------------------------------------------------------------------
  217. void __fastcall TVMSWBACK::SetFormSize(int AWidth)
  218. {
  219. try
  220. {
  221. LockWindowUpdate(Handle);
  222. for(int ii = 0; ii < FListForm->Count; ii++)
  223. {
  224. TVMSWCAM0 *pForm = (TVMSWCAM0*)FListForm->Items[ii];
  225. pForm->SetFormSize(AWidth);
  226. FViewWidth = pForm->Width;
  227. }
  228. }
  229. __finally
  230. {
  231. LockWindowUpdate(0);
  232. }
  233. }
  234. //---------------------------------------------------------------------------
  235. void __fastcall TVMSWBACK::ClearFormList()
  236. {
  237. try
  238. {
  239. LockWindowUpdate(Handle);
  240. for(int ii = 0; ii < FListForm->Count; ii++)
  241. {
  242. TVMSWCAM0 *pForm = (TVMSWCAM0*)FListForm->Items[ii];
  243. //pForm->CamStop();
  244. pForm->Hide();
  245. SAFE_DELETE(pForm);
  246. }
  247. FListForm->Clear();
  248. }
  249. __finally
  250. {
  251. LockWindowUpdate(0);
  252. }
  253. }
  254. //---------------------------------------------------------------------------
  255. void __fastcall TVMSWBACK::CamPlay()
  256. {
  257. try
  258. {
  259. LockWindowUpdate(Handle);
  260. for(int ii = 0; ii < FListForm->Count; ii++)
  261. {
  262. TVMSWCAM0 *pForm = (TVMSWCAM0*)FListForm->Items[ii];
  263. pForm->CamPlay();
  264. }
  265. }
  266. __finally
  267. {
  268. LockWindowUpdate(0);
  269. }
  270. }
  271. //---------------------------------------------------------------------------
  272. void __fastcall TVMSWBACK::CamStop()
  273. {
  274. try
  275. {
  276. LockWindowUpdate(Handle);
  277. for(int ii = 0; ii < FListForm->Count; ii++)
  278. {
  279. TVMSWCAM0 *pForm = (TVMSWCAM0*)FListForm->Items[ii];
  280. pForm->CamStop();
  281. }
  282. }
  283. __finally
  284. {
  285. LockWindowUpdate(0);
  286. }
  287. }
  288. //---------------------------------------------------------------------------