123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- /****************************************************************************
- * @source :
- * @description :
- ****************************************************************************
- * DATE AUTHOR DESCRIPTION
- * --------------------------------------------------------------------------
- * 2016/07/27 Á¤½ÂÈ£ ÃÖÃÊÀÛ¼º
- *
- ****************************************************************************/
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include "AppGlobalF.h"
- #include "ITSSkinF.h"
- #include "ITSUtilF.h"
- #include "FrmVmsOprMainF.h"
- #pragma hdrstop
- #include "VMSWBACKF.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma link "cxContainer"
- #pragma link "cxControls"
- #pragma link "cxDropDownEdit"
- #pragma link "cxEdit"
- #pragma link "cxGraphics"
- #pragma link "cxLookAndFeelPainters"
- #pragma link "cxLookAndFeels"
- #pragma link "cxMaskEdit"
- #pragma link "cxTextEdit"
- #pragma link "dxSkinBlack"
- #pragma link "dxSkinMcSkin"
- #pragma link "dxSkinsCore"
- #pragma link "dxSkinBlue"
- #pragma link "dxSkinCaramel"
- #pragma link "dxSkinCoffee"
- #pragma link "dxSkinDarkRoom"
- #pragma link "dxSkinDarkSide"
- #pragma link "dxSkinFoggy"
- #pragma link "dxSkinGlassOceans"
- #pragma link "dxSkiniMaginary"
- #pragma link "dxSkinLilian"
- #pragma link "dxSkinLiquidSky"
- #pragma link "dxSkinLondonLiquidSky"
- #pragma link "dxSkinMoneyTwins"
- #pragma link "dxSkinOffice2007Black"
- #pragma link "dxSkinOffice2007Blue"
- #pragma link "dxSkinOffice2007Green"
- #pragma link "dxSkinOffice2007Pink"
- #pragma link "dxSkinOffice2007Silver"
- #pragma link "dxSkinOffice2010Black"
- #pragma link "dxSkinOffice2010Blue"
- #pragma link "dxSkinOffice2010Silver"
- #pragma link "dxSkinSeven"
- #pragma link "dxSkinSharp"
- #pragma link "dxSkinSilver"
- #pragma link "dxSkinStardust"
- #pragma resource "*.dfm"
- //TVMSBACKM *VMSBACKM = NULL;
- //---------------------------------------------------------------------------
- __fastcall TVMSWBACK::TVMSWBACK(TComponent* AOwner, HWND AHandle, String ACaption, int AScreenIdx)
- : TForm(AOwner)
- {
- FListForm = new TList();
- FScreenName = ACaption;
- FScreenIndex = AScreenIdx;
- FPlay = false;
- FMinWidth = 1000;
- FMinHeight = 1000;
- FMaxWidth = 0;
- FMaxHeight = 0;
- FWndParent = AHandle;
- Caption = ACaption;
- FDisplayMode = 0;
- FViewWidth = 320;
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::FormCreate(TObject *Sender)
- {
- ScrollBox->ParentColor = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::FormShow(TObject *Sender)
- {
- Refresh();
- ScrollBox->Align = alClient;
- TmrShow->Enabled = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::TmrShowTimer(TObject *Sender)
- {
- TmrShow->Enabled = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::ScrollBoxClick(TObject *Sender)
- {
- ScrollBox->SetFocus();
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::ScrollBoxMouseWheel(TObject *Sender, TShiftState Shift, int WheelDelta, TPoint &MousePos, bool &Handled)
- {
- ScrollBox->VertScrollBar->Position -= WheelDelta;
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::SetPlay(bool APlay)
- {
- //AnsiString sTrace;
- //if (APlay) sTrace = Caption + " TVMSWBACK: SetPlay = Active";
- //else sTrace = Caption + " TVMSWBACK: SetPlay = DeActive";
- //ITSUtil_Trace(sTrace.c_str());
- try
- {
- LockWindowUpdate(Handle);
- for(int ii = 0; ii < FListForm->Count; ii++)
- {
- TVMSWCAM0 *pForm = (TVMSWCAM0*)FListForm->Items[ii];
- pForm->Play = APlay;
- }
- }
- __finally
- {
- LockWindowUpdate(0);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::FormResize(TObject *Sender)
- {
- RecalFormPosition();
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::RecalFormPosition()
- {
- int h = 0;
- for (int ii = 0; ii < FpnlForm->ControlCount; ii++)
- {
- if (FpnlForm->Controls[ii]->BoundsRect.Bottom > h)
- h = FpnlForm->Controls[ii]->BoundsRect.Bottom;
- }
- FpnlForm->Height = h+50;
- ScrollBox->HorzScrollBar->Range = 0;
- ScrollBox->VertScrollBar->Range = FpnlForm->Height;
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::RefreshVmsStatus()
- {
- try
- {
- for(int ii = 0; ii < FListForm->Count; ii++)
- {
- TVMSWCAM0 *pForm = (TVMSWCAM0*)FListForm->Items[ii];
- pForm->RefreshVmsStatus();
- }
- }
- catch(Exception &e)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::RefreshVmsMessage()
- {
- try
- {
- for(int ii = 0; ii < FListForm->Count; ii++)
- {
- TVMSWCAM0 *pForm = (TVMSWCAM0*)FListForm->Items[ii];
- pForm->RefreshVmsMessage();
- }
- }
- catch(Exception &e)
- {
- }
- }
- //---------------------------------------------------------------------------
- bool __fastcall TVMSWBACK::AddVmsForm(String AVmsNmbr)
- {
- TVmsCtlr *pObj = VmsManager->FLists.Find(AVmsNmbr);
- if (!pObj) return false;
- if (pObj->WIDTH > FMaxWidth) FMaxWidth = pObj->WIDTH;
- if (pObj->WIDTH < FMinWidth) FMinWidth = pObj->WIDTH;
- if (pObj->HEIGHT > FMaxHeight) FMaxHeight = pObj->HEIGHT;
- if (pObj->HEIGHT < FMinHeight) FMinHeight = pObj->HEIGHT;
- TVMSWCAM0 *pForm = new TVMSWCAM0(this, pObj);
- pForm->SetFormSize(pObj->WIDTH);
- pForm->Parent = FpnlForm;
- pForm->FScrollBox = ScrollBox;
- pForm->FWndParent = Handle;
- pForm->Show();
- FListForm->Add(pForm);
- return true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::FpnlFormClick(TObject *Sender)
- {
- ScrollBox->SetFocus();
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::OnVmsSelectMessage(TMessage &Msg)
- {
- if (FWndParent)
- {
- POST_MSG(FWndParent, WM_VMS_SELECT, (WPARAM)Msg.WParam, (LPARAM)Msg.LParam);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::OnVmsSelectDblClickMessage(TMessage &Msg)
- {
- if (FWndParent)
- {
- POST_MSG(FWndParent, WM_VMS_SELECT_DBLCLICK, (WPARAM)Msg.WParam, (LPARAM)Msg.LParam);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::FormDestroy(TObject *Sender)
- {
- ClearFormList();
- SAFE_DELETE(FListForm);
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::SetFormSize(int AWidth)
- {
- try
- {
- LockWindowUpdate(Handle);
- for(int ii = 0; ii < FListForm->Count; ii++)
- {
- TVMSWCAM0 *pForm = (TVMSWCAM0*)FListForm->Items[ii];
- pForm->SetFormSize(AWidth);
- FViewWidth = pForm->Width;
- }
- }
- __finally
- {
- LockWindowUpdate(0);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::ClearFormList()
- {
- try
- {
- LockWindowUpdate(Handle);
- for(int ii = 0; ii < FListForm->Count; ii++)
- {
- TVMSWCAM0 *pForm = (TVMSWCAM0*)FListForm->Items[ii];
- //pForm->CamStop();
- pForm->Hide();
- SAFE_DELETE(pForm);
- }
- FListForm->Clear();
- }
- __finally
- {
- LockWindowUpdate(0);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::CamPlay()
- {
- try
- {
- LockWindowUpdate(Handle);
- for(int ii = 0; ii < FListForm->Count; ii++)
- {
- TVMSWCAM0 *pForm = (TVMSWCAM0*)FListForm->Items[ii];
- pForm->CamPlay();
- }
- }
- __finally
- {
- LockWindowUpdate(0);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TVMSWBACK::CamStop()
- {
- try
- {
- LockWindowUpdate(Handle);
- for(int ii = 0; ii < FListForm->Count; ii++)
- {
- TVMSWCAM0 *pForm = (TVMSWCAM0*)FListForm->Items[ii];
- pForm->CamStop();
- }
- }
- __finally
- {
- LockWindowUpdate(0);
- }
- }
- //---------------------------------------------------------------------------
|