//--------------------------------------------------------------------------- #include #include #include "ITSSkinF.h" #include "ITSUtilF.h" #include "AppGlobalF.h" #pragma hdrstop #include "VMSM580MF.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "cxButtons" #pragma link "cxCalendar" #pragma link "cxContainer" #pragma link "cxControls" #pragma link "cxDropDownEdit" #pragma link "cxEdit" #pragma link "cxGraphics" #pragma link "cxGroupBox" #pragma link "cxLabel" #pragma link "cxLookAndFeelPainters" #pragma link "cxLookAndFeels" #pragma link "cxMaskEdit" #pragma link "cxPC" #pragma link "cxPCdxBarPopupMenu" #pragma link "cxSpinEdit" #pragma link "cxSplitter" #pragma link "cxTextEdit" #pragma link "cxTimeEdit" #pragma link "dxSkinBlack" #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 "dxSkinMcSkin" #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 "dxSkinsCore" #pragma link "dxSkinscxPCPainter" #pragma link "dxSkinSeven" #pragma link "dxSkinSharp" #pragma link "dxSkinSilver" #pragma link "dxSkinStardust" #pragma link "cxRadioGroup" #pragma link "cxClasses" #pragma link "cxCustomData" #pragma link "cxData" #pragma link "cxDataStorage" #pragma link "cxDBData" #pragma link "cxFilter" #pragma link "cxGrid" #pragma link "cxGridCustomTableView" #pragma link "cxGridCustomView" #pragma link "cxGridDBTableView" #pragma link "cxGridLevel" #pragma link "cxGridTableView" #pragma link "cxStyles" #pragma link "cxCheckBox" #pragma link "cxImage" #pragma link "cxButtonEdit" #pragma link "cxBlobEdit" #pragma link "cxCalc" #pragma resource "*.dfm" TVMSM580M *VMSM580M = NULL; //--------------------------------------------------------------------------- __fastcall TVMSM580M::TVMSM580M(TComponent* Owner) : TForm(Owner) { ITSSkin_Load(this); //CMM_LoadForm(g_sFormsDir, this); FUpdate= false; FTitle = Caption;//"VMS °´Ã¼À̹ÌÁö ¼±ÅÃ"; FListSymb = new TList; EditMode = false; m_bSelected = false; TvList->OptionsView->DataRowHeight = 0; TvList->OptionsView->CellAutoHeight = true; TvList->OptionsView->Indicator = true; TvList->OptionsCustomize->ColumnMoving = false; TvList->OptionsCustomize->ColumnSorting = false; TvList->Columns[0]->Width = 50; TvList->Columns[0]->Options->HorzSizing = false; } //--------------------------------------------------------------------------- void __fastcall TVMSM580M::CommClose() { try { ClearSymbloList(); SAFE_DELETE(FListSymb); //CMM_SaveForm(g_sFormsDir, this); } catch(...) { } } //--------------------------------------------------------------------------- void __fastcall TVMSM580M::FormShow(TObject *Sender) { Refresh(); FormInit(); TmrShow->Enabled = true; } //--------------------------------------------------------------------------- void __fastcall TVMSM580M::FormInit() { EdPictId->Text = ""; EdImagePath->Text = ""; EdPictNm->Text = ""; EdPictSize->Text = ""; EdPictW->Text = ""; EdPictH->Text = ""; EdPictExt->Text = ""; ImgPreView->Picture->Bitmap->FreeImage(); ImgPreView->Picture->Bitmap = NULL; FNewDb = false; } //--------------------------------------------------------------------------- void __fastcall TVMSM580M::TmrShowTimer(TObject *Sender) { TmrShow->Enabled = false; LoadImageSymbol(); } //--------------------------------------------------------------------------- void __fastcall TVMSM580M::BtnCloseClick(TObject *Sender) { Close(); } //--------------------------------------------------------------------------- void __fastcall TVMSM580M::FormClose(TObject *Sender, TCloseAction &Action) { CommClose(); VMSM580M = NULL; Action = caFree; } //--------------------------------------------------------------------------- void __fastcall TVMSM580M::FormCloseQuery(TObject *Sender, bool &CanClose) { // } //--------------------------------------------------------------------------- void __fastcall TVMSM580M::DisplayInfo() { FormInit(); int nRow = TvList->DataController->FocusedRecordIndex; if( nRow <= -1 ) return; TcxGridDataController *pDc = TvList->DataController; nRow = pDc->FocusedRecordIndex; #if 0 if (nRow < FListSymb->Count) { Graphics::TBitmap *bitmap = (Graphics::TBitmap*)FListSymb->Items[nRow]; ImgPreView->Picture->Bitmap->Assign(bitmap); } #endif EdPictId->Text = VarToStr(pDc->Values[nRow][ColSYMB_NMBR->Index]); EdImagePath->Text = VarToStr(pDc->Values[nRow][ColImagePath->Index]); EdPictNm->Text = VarToStr(pDc->Values[nRow][ColSYMB_NM->Index]); EdPictSize->Text = VarToStr(pDc->Values[nRow][ColSYMB_SIZE->Index]); //EdPictW->Text = VarToStr(pDc->Values[nRow][ColPictW->Index]); //EdPictH->Text = VarToStr(pDc->Values[nRow][ColPictH->Index]); EdPictExt->Text = VarToStr(pDc->Values[nRow][ColSYMB_FILE_EXT->Index]); } //--------------------------------------------------------------------------- void __fastcall TVMSM580M::ClearSymbloList() { for(int ii = 0; ii < FListSymb->Count; ii++) { Graphics::TBitmap *bitmap = (Graphics::TBitmap *)FListSymb->Items[ii]; delete bitmap; } FListSymb->Clear(); } //--------------------------------------------------------------------------- void __fastcall TVMSM580M::LoadImageSymbol() { FormInit(); CMM_ClearGridTableView(TvList); ClearSymbloList(); String sQry; TADOQuery *pADO = NULL; sQry = "SELECT * \r\n" " FROM TB_VMS_FORM_OBJ_MOV \r\n" " WHERE 1=1 \r\n" " ORDER BY VMS_FORM_OBJ_ID \r\n"; int nRowHeight = 0; try { int nRow; TcxDataController *pGDC = TvList->DataController; TvList->BeginUpdate(); try { pADO = new TADOQuery(NULL); pADO->Close(); pADO->Connection = ITSDb_GetConnection(); ITSDb_SQLText(pADO, sQry); ITSDb_SQLOpen(pADO); String imageFilePath; String videoFilePath; String saveDirPath = TPath::GetTempPath() + "VMS\\"; ForceDirectories(saveDirPath.c_str()); for( ; !pADO->Eof; pADO->Next()) { nRow = pGDC->AppendRecord(); String VMS_FORM_OBJ_ID = pADO->FieldByName("VMS_FORM_OBJ_ID")->AsString; String MOV_TYPE = pADO->FieldByName("MOV_TYPE")->AsString; pGDC->Values[nRow][ColSYMB_NMBR->Index] = VMS_FORM_OBJ_ID; pGDC->Values[nRow][ColSYMB_NM->Index] = pADO->FieldByName("MOV_NM")->AsString; pGDC->Values[nRow][ColSYMB_DATA->Index] = pADO->FieldByName("THMB_IMG")->AsVariant; pGDC->Values[nRow][ColSYMB_FILE_EXT->Index] = DbMovieTypeToReal(MOV_TYPE); pGDC->Values[nRow][ColSYMB_SIZE->Index] = pADO->FieldByName("MOV_DATA_SZ")->AsInteger; //pGDC->Values[nRow][ColSYMB_WDTH->Index] = pADO->FieldByName("PICT_WDTH")->AsInteger; //pGDC->Values[nRow][ColSYMB_HGHT->Index] = pADO->FieldByName("PICT_HGHT")->AsInteger; pGDC->Values[nRow][ColMOV_TYPE->Index] = MOV_TYPE; String MOVIE_FILE_EXT = DbMovieTypeToReal(MOV_TYPE); TMemoryStream *pAviStream = new TMemoryStream(); pAviStream->LoadFromStream(pADO->CreateBlobStream(pADO->FieldByName("MOV_DATA"), bmRead)); videoFilePath = saveDirPath + VMS_FORM_OBJ_ID + "." + MOVIE_FILE_EXT; pAviStream->SaveToFile(videoFilePath); SAFE_DELETE(pAviStream); TMemoryStream *pImgStream = new TMemoryStream(); pImgStream->LoadFromStream(pADO->CreateBlobStream(pADO->FieldByName("THMB_IMG"), bmRead)); String MOVE_EXT = DbMovieTypeToReal(MOV_TYPE); imageFilePath = saveDirPath + VMS_FORM_OBJ_ID + ".bmp"; pImgStream->SaveToFile(imageFilePath); SAFE_DELETE(pImgStream); pGDC->Values[nRow][ColImagePath->Index] = imageFilePath; pGDC->Values[nRow][ColVideoPath->Index] = videoFilePath; } } catch(EDatabaseError &E) { DBERRORMSG("TVMSM580M::LoadImageSymbol", String(E.ClassName()), E.Message, sQry); throw Exception(String(E.ClassName()) + E.Message); } catch(Exception &e) { DBERRORMSG("TVMSM580M::LoadImageSymbol", String(e.ClassName()), e.Message, sQry); throw Exception(String(e.ClassName()) + e.Message); } } __finally { if (pADO) { pADO->Close(); delete pADO; } //TvList->OptionsView->DataRowHeight = nRowHeight; TvList->EndUpdate(); } } //--------------------------------------------------------------------------- void __fastcall TVMSM580M::TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo, TMouseButton AButton, TShiftState AShift, bool &AHandled) { if (!ACellViewInfo) return; DisplayInfo(); Sleep(200); BtnSelImageClick((TObject*)BtnSelImage); } //--------------------------------------------------------------------------- void __fastcall TVMSM580M::TvListFocusedRecordChanged(TcxCustomGridTableView *Sender, TcxCustomGridRecord *APrevFocusedRecord, TcxCustomGridRecord *AFocusedRecord, bool ANewItemRecordFocusingChanged) { if (!AFocusedRecord) return; DisplayInfo(); } //--------------------------------------------------------------------------- void __fastcall TVMSM580M::BtnSelImageClick(TObject *Sender) { if (EdPictId->Text == "" || EdImagePath->Text == "") { Application->MessageBox(L"VMS µ¿¿µ»ó °´Ã¼ ¼±ÅÃ\r\nVMS µ¿¿µ»ó ¸ñ·Ï¿¡¼­ µ¿¿µ»óÀ» ¼±ÅÃÇϼ¼¿ä.", FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL); return; } m_bSelected = true; Close(); } //---------------------------------------------------------------------------