//--------------------------------------------------------------------------- #include #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 = VmsCtlrManager->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); } } //---------------------------------------------------------------------------