//--------------------------------------------------------------------------- #include #include "ITSSkinF.h" #include "FrmInitializeF.h" #pragma hdrstop #include "CDSMonitoringObjF.h" #include "FrmCctvCamViewerF.h" #include "FrmCameraFullScreenF.h" #include "FrmCameraPlayerF.h" #include "FrmCameraScreenF.h" #include "FrmCameraScreenManagerF.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "cxButtons" #pragma link "cxContainer" #pragma link "cxControls" #pragma link "cxEdit" #pragma link "cxGraphics" #pragma link "cxLookAndFeelPainters" #pragma link "cxLookAndFeels" #pragma link "cxProgressBar" #pragma link "dxSkinBlack" #pragma link "dxSkinBlue" #pragma link "dxSkinsCore" #pragma link "dxSkinsForm" #pragma link "cxLabel" #pragma link "cxDropDownEdit" #pragma link "cxMaskEdit" #pragma link "cxTextEdit" #pragma link "dxSkinMcSkin" #pragma resource "*.dfm" TFrmCctvCamViewer *FrmCctvCamViewer = NULL; //--------------------------------------------------------------------------- __fastcall TFrmCctvCamViewer::TFrmCctvCamViewer(TComponent* Owner) : TForm(Owner)//TdxCustomRibbonForm(Owner)//TForm(Owner) { //DoubleBuffered = true; Caption = g_AppCfg.sTitle; IsLoading = false; if (g_AppCfg.sLang != "kr") { Caption = "CCTV Camera Monitoring"; Font->Name = "Tahoma"; BtnMonitoringMngr->Font->Name = "Tahoma"; BtnMonitoringMngr->Caption = "Management"; BtnMonitoringMngr->Hint = "Monitoring Screen management"; LblScreenList->AutoSize = false; LblScreenList->Style->Font->Name = "Tahoma"; LblScreenList->Caption = " Screen List: "; LblScreenList->AutoSize = true; CbScreenList->Style->Font->Name = "Tahoma"; } g_AppCfg.lMainWinHandle = (long)Handle; String sLang = g_AppCfg.sLang; ITSSkin_Initialize(Application, sLang.UpperCase()); ITSSkin_Load(this); ITSSkin_Caption(false); CMM_LoadForm(g_sFormsDir, this); if (WindowState == wsMinimized) { WindowState = wsMaximized; } if (WindowState == wsMaximized) { Width = 1375; Height = 851; WindowState = wsMaximized; } SetColorScheme(g_AppCfg.sSkinName); //PnlBack->ParentColor = false; //PnlBack->Color = clBlack; //PnlBack->Font->Color = clWhite; IsFormResizing = false; FOldWidth = Width; FOldHeight= Height; FCurrPage = NULL; } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::FormCreate(TObject *Sender) { Application->ShowMainForm = false; try { Application->Icon->LoadFromResourceName(((unsigned int)HInstance), "MAINICON"); } catch(...) { ShowMessage("LoadFromResourceName failed"); } g_AppCfg.lMainWinHandle = (long)Handle; FrmCameraScreen = new TFrmCameraScreen(PnlBack); FrmCameraScreen->Parent = PnlBack; FrmCameraScreen->Show(); Application->ShowMainForm = true; } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::FormShow(TObject *Sender) { Application->ProcessMessages(); Refresh(); TmrShow->Enabled = true; } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::FormClose(TObject *Sender, TCloseAction &Action) { CommClose(); Action = caFree; } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::CommClose() { try { ITSSkin_Term(); //CMM_SaveForm(g_sFormsDir, this); } catch(Exception &e) { } } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::SetColorScheme(String ASkinName) { dxSkinController1->SkinName = ASkinName; dxSkinController1->Refresh(); } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::TmrShowTimer(TObject *Sender) { TmrShow->Enabled = false; FormInit(); } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::FormInit() { ObjScreenManager = new TMonitoringScreenManager(); ObjCtlrManager = new TMonitoringCtlrManager(enMonitoringCamera); FrmInitialize = new TFrmInitialize(this); FrmInitialize->ShowModal(); FrmInitialize = NULL; IsLoading = true; CreateMonitoringScreen(); PnlBack->ParentColor = true; //BtnMonitoringMngr->Visible = true; } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::ApplicationEvents1Minimize(TObject *Sender) { //¿µ»óÇ¥ÃâÀ» Á¤ÁöÇÑ´Ù. if (FrmCameraScreen && IsLoading) FrmCameraScreen->Stop(); } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::ApplicationEvents1Restore(TObject *Sender) { //¿µ»óÇ¥ÃâÀ» Àç»ó¿µÇÑ´Ù. if (FrmCameraScreen && IsLoading) FrmCameraScreen->Play(); } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::FormResize(TObject *Sender) { if (IsFormResizing == false) { RecalFormSize(); } } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::WMEnterSizeMove(TMessage &Msg) { IsFormResizing = true; } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::WMExitSizeMove(TMessage &Msg) { IsFormResizing = false; RecalFormSize(); } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::RecalFormSize() { int nNewW = Width; int nNewH = Height; if (nNewW == FOldWidth && nNewH == FOldHeight) { return; } Application->ProcessMessages(); FOldWidth = nNewW; FOldHeight= nNewH; if (FrmCameraScreen && IsLoading) FrmCameraScreen->RecalFormSize(); } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::CreateMonitoringScreen() { Application->ProcessMessages(); CbScreenList->Properties->OnChange = NULL; try { LockWindowUpdate(Handle); CbScreenList->Properties->Items->Clear(); FOR_STL(TMonitoringScreen*, pObj, ObjScreenManager->FLists) { CbScreenList->Properties->Items->Add(" " + pObj->NAME + " "); } CbScreenList->ItemIndex = 0; } __finally { LockWindowUpdate(0); CbScreenList->Properties->OnChange = CbScreenListPropertiesChange; ResetScreenForm(); } } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::CbScreenListPropertiesChange(TObject *Sender) { EdFocus->SetFocus(); ResetScreenForm(); } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::ResetScreenForm() { if (FrmCameraScreen && IsLoading) FrmCameraScreen->ResetScreenForm(CbScreenList->Text.Trim()); } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::BtnMonitoringMngrClick(TObject *Sender) { TFrmCameraScreenManager *pForm = new TFrmCameraScreenManager(this); pForm->ShowModal(); bool bUpdate = pForm->FUpdate; if(pForm) { delete pForm; pForm = NULL; } if (bUpdate) { ObjCtlrManager->LoadMonitoringFormFromDb(NULL); CreateMonitoringScreen(); } EdFocus->SetFocus(); } //--------------------------------------------------------------------------- void __fastcall TFrmCctvCamViewer::ApplicationEvents1Message(tagMSG &Msg, bool &Handled) { switch(Msg.message) { case WM_KEYDOWN: if (Msg.wParam == VK_F11) { if (this->WindowState == wsNormal) { PnlMenu->Visible = false; this->BorderStyle = bsNone; this->WindowState = wsMaximized; } else { if (this->BorderStyle == bsNone) { PnlMenu->Visible = true; this->BorderStyle = bsSizeable; this->WindowState = wsNormal; } else { PnlMenu->Visible = false; this->WindowState = wsNormal; this->BorderStyle = bsNone; this->WindowState = wsMaximized; } } Handled = true; } else if (Msg.wParam == VK_ESCAPE) { if (this->WindowState == wsMaximized && !PnlMenu->Visible) { PnlMenu->Visible = true; this->BorderStyle = bsSizeable; this->WindowState = wsNormal; } Handled = true; } break; case WM_KEYUP: break; } } //---------------------------------------------------------------------------