//--------------------------------------------------------------------------- #include #include "ITSSkinF.h" #include "ITSUtilF.h" #include "AppGlobalF.h" #pragma hdrstop #include "VMSM590MF.h" #include "FrmVmsMsgFormMngrF.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" TVMSM590M *VMSM590M = NULL; //--------------------------------------------------------------------------- __fastcall TVMSM590M::TVMSM590M(TComponent* Owner) : TForm(Owner) { ITSSkin_Load(this); //CMM_LoadForm(g_sFormsDir, this); FUpdate= false; FTitle = Caption;//"VMS Á¦°ø±¸°£ ¼±ÅÃ"; EditMode = false; m_bSelected = false; PnlVmsForm->ParentColor = false; PnlVmsForm->Color = clBlack; FMaxSeq = 0; } //--------------------------------------------------------------------------- void __fastcall TVMSM590M::CommClose() { try { //CMM_SaveForm(g_sFormsDir, this); } catch(...) { } } //--------------------------------------------------------------------------- void __fastcall TVMSM590M::FormShow(TObject *Sender) { Refresh(); FormInit(); TmrShow->Enabled = true; } //--------------------------------------------------------------------------- void __fastcall TVMSM590M::FormInit() { FNewDb = false; ImgPreView->Picture->Bitmap->FreeImage(); ImgPreView->Picture->Bitmap = NULL; ImgTemp->Picture->Bitmap->FreeImage(); ImgTemp->Picture->Bitmap = NULL; } //--------------------------------------------------------------------------- void __fastcall TVMSM590M::TmrShowTimer(TObject *Sender) { TmrShow->Enabled = false; DisplayInfo(); } //--------------------------------------------------------------------------- void __fastcall TVMSM590M::BtnCloseClick(TObject *Sender) { Close(); } //--------------------------------------------------------------------------- void __fastcall TVMSM590M::FormClose(TObject *Sender, TCloseAction &Action) { CommClose(); VMSM590M = NULL; Action = caFree; } //--------------------------------------------------------------------------- void __fastcall TVMSM590M::DisplayInfo() { FrmVmsMsgFormMngr->m_pEdtDesigner->GetVmsFormImage(ImgTemp); PnlVmsForm->Width = ImgTemp->Picture->Bitmap->Width + 4; PnlVmsForm->Height = ImgTemp->Picture->Bitmap->Height + 4; ImgPreView->Align = alClient; ImgPreView->Picture->Bitmap->Width = ImgTemp->Picture->Bitmap->Width; ImgPreView->Picture->Bitmap->Height= ImgTemp->Picture->Bitmap->Height; ImgPreView->Picture->Bitmap->Assign(ImgTemp->Picture->Bitmap); CMM_ClearGridTableView(TvImageCell); TcxGridDataController *pGDC = TvImageCell->DataController; try { TvImageCell->BeginUpdate(); FOR_STL(TFormObjCell*, pCell, FrmVmsMsgFormMngr->FFormObjCellMap) { int nRow = pGDC->AppendRecord(); pGDC->Values[nRow][ColSeq->Index] = nRow+1; pGDC->Values[nRow][ColObjId->Index] = pCell->OBJ_ID; pGDC->Values[nRow][ColPosX->Index] = pCell->OBJ_PSTN_X; pGDC->Values[nRow][ColPosY->Index] = pCell->OBJ_PSTN_Y; pGDC->Values[nRow][ColCellId->Index] = pCell->OBJ_SEQ; if (pCell->OBJ_SEQ > FMaxSeq) { FMaxSeq = pCell->OBJ_SEQ; } } } __finally { TvImageCell->EndUpdate(); } UpdateCellColor(); } //--------------------------------------------------------------------------- void __fastcall TVMSM590M::ColAreaCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone) { int nIdx = AViewInfo->GridRecord->RecordIndex; if (nIdx < 0) return; try { String sSeq = VarToStr(TvImageCell->DataController->Values[nIdx][ColSeq->Index]); nIdx = sSeq.ToIntDef(0); ACanvas->Brush->Color = APP_GetDisplayColor(nIdx-1); ACanvas->Font->Color = ACanvas->Brush->Color; } catch(...) { } } //--------------------------------------------------------------------------- void __fastcall TVMSM590M::TvImageCellFocusedRecordChanged(TcxCustomGridTableView *Sender, TcxCustomGridRecord *APrevFocusedRecord, TcxCustomGridRecord *AFocusedRecord, bool ANewItemRecordFocusingChanged) { TcxGridDataController *pGDC = TvImageCell->DataController; int nSelIdx = pGDC->FocusedRecordIndex; if (nSelIdx < 0) return; String sCellId = VarToStr(pGDC->Values[nSelIdx][ColSeq->Index]); String sPosX = VarToStr(pGDC->Values[nSelIdx][ColPosX->Index]); String sPosY = VarToStr(pGDC->Values[nSelIdx][ColPosY->Index]); SeSeq->Value = sCellId.ToIntDef(0); SePosX->Value = sPosX.ToIntDef(0); SePosY->Value = sPosY.ToIntDef(0); UpdateCellColor(); try { TColor FOldColor = ImgPreView->Picture->Bitmap->Canvas->Pixels[SePosX->Value][SePosY->Value]; if (FOldColor == clYellow) return; ImgPreView->Picture->Bitmap->Canvas->Brush->Color = clYellow; ImgPreView->Picture->Bitmap->Canvas->FloodFill(SePosX->Value, SePosY->Value, FOldColor, fsSurface); } catch(...) {} } //--------------------------------------------------------------------------- void __fastcall TVMSM590M::UpdateCellColor() { ImgPreView->Picture->Bitmap->FreeImage(); ImgPreView->Picture->Bitmap = NULL; ImgPreView->Picture->Bitmap->Assign(ImgTemp->Picture->Bitmap); ImgPreView->Width = ImgPreView->Picture->Bitmap->Width; ImgPreView->Height = ImgPreView->Picture->Bitmap->Height; TcxGridDataController *pGDC = TvImageCell->DataController; int nRows = pGDC->RecordCount; try { TvImageCell->BeginUpdate(); pGDC->BeginUpdate(); for (int ii = 0; ii < nRows; ii++) { String sCellId = VarToStr(pGDC->Values[ii][ColSeq->Index]); String sPosX = VarToStr(pGDC->Values[ii][ColPosX->Index]); String sPosY = VarToStr(pGDC->Values[ii][ColPosY->Index]); int X = sPosX.ToIntDef(0); int Y = sPosY.ToIntDef(0); TColor FOldColor = ImgPreView->Picture->Bitmap->Canvas->Pixels[X][Y]; int nIdx = sCellId.ToIntDef(0); ImgPreView->Picture->Bitmap->Canvas->Brush->Style = bsSolid; ImgPreView->Picture->Bitmap->Canvas->Brush->Color = APP_GetDisplayColor(nIdx-1); ImgPreView->Picture->Bitmap->Canvas->FloodFill(X, Y, FOldColor, fsSurface); } } __finally { pGDC->EndUpdate(); TvImageCell->EndUpdate(); } } //--------------------------------------------------------------------------- void __fastcall TVMSM590M::ImgPreViewMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { try { SePosX->Value = X; SePosY->Value = Y; UpdateCellColor(); TColor FOldColor = ImgPreView->Picture->Bitmap->Canvas->Pixels[SePosX->Value][SePosY->Value]; ImgPreView->Picture->Bitmap->Canvas->Brush->Style = bsSolid; ImgPreView->Picture->Bitmap->Canvas->Brush->Color = clWhite; ImgPreView->Picture->Bitmap->Canvas->FloodFill(SePosX->Value, SePosY->Value, FOldColor, fsSurface); } catch(...) {} } //--------------------------------------------------------------------------- void __fastcall TVMSM590M::BtnCellApplyClick(TObject *Sender) { TcxGridDataController *pGDC = TvImageCell->DataController; String sCellId; String sPosX; String sPosY; int nCellId = SeSeq->Value; int nPosX = SePosX->Value; int nPosY = SePosY->Value; bool bFound = false; sCellId = String(nCellId); sPosX = String(nPosX); sPosY = String(nPosY); int maxSeq = 0; int nFocusedIndex = 0; try { int nRows = pGDC->RecordCount; TvImageCell->BeginUpdate(); pGDC->BeginUpdate(); for (int ii = 0; ii < nRows; ii++) { String sTmpId = pGDC->Values[ii][ColSeq->Index]; if (sTmpId.ToIntDef(1) > maxSeq) { maxSeq = sTmpId.ToIntDef(1); } if (sTmpId == sCellId) { nFocusedIndex = ii; bFound = true; } } if (!bFound) { nFocusedIndex = pGDC->AppendRecord(); pGDC->Values[nFocusedIndex][ColSeq->Index] = String(maxSeq+1); FMaxSeq++; pGDC->Values[nFocusedIndex][ColCellId->Index] = String(FMaxSeq); } pGDC->Values[nFocusedIndex][ColPosX->Index] = sPosX; pGDC->Values[nFocusedIndex][ColPosY->Index] = sPosY; } __finally { pGDC->EndUpdate(); TvImageCell->EndUpdate(); SeSeq->Value = pGDC->RecordCount+1; } UpdateCellColor(); } //--------------------------------------------------------------------------- void __fastcall TVMSM590M::BtnCellDeleteClick(TObject *Sender) { TcxGridDataController *pGDC = TvImageCell->DataController; int nSelIdx = pGDC->FocusedRecordIndex; if (nSelIdx < 0) return; pGDC->BeginUpdate(); pGDC->DeleteRecord(nSelIdx); pGDC->EndUpdate(); UpdateCellColor(); } //--------------------------------------------------------------------------- void __fastcall TVMSM590M::BtnSaveClick(TObject *Sender) { if (Application->MessageBox(L"VMS ¼ÒÅëÁ¤º¸ À̹ÌÁö ¼¿ Fill In ¼³Á¤\r\nVMS ¼ÒÅëÁ¤º¸ À̹ÌÁö ¼¿ Fill In Á¤º¸¸¦ ÀúÀåÇϽðڽÀ´Ï±î?", FTitle.c_str(), MB_YESNO|MB_APPLMODAL) != IDYES) return; FrmVmsMsgFormMngr->FFormObjCellMap.RemoveAll(); TcxGridDataController *pGDC = TvImageCell->DataController; int nRows = pGDC->RecordCount; try { TvImageCell->BeginUpdate(); pGDC->BeginUpdate(); for (int ii = 0; ii < nRows; ii++) { TFormObjCell *pCell = new TFormObjCell(); pCell->OBJ_SEQ = pGDC->Values[ii][ColCellId->Index]; pCell->OBJ_ID = VarToStr(pGDC->Values[ii][ColObjId->Index]); pCell->OBJ_PSTN_X = pGDC->Values[ii][ColPosX->Index]; pCell->OBJ_PSTN_Y = pGDC->Values[ii][ColPosY->Index]; FrmVmsMsgFormMngr->FFormObjCellMap.Push(pCell->OBJ_SEQ, pCell); } } __finally { pGDC->EndUpdate(); TvImageCell->EndUpdate(); } m_bSelected = true; Close(); } //---------------------------------------------------------------------------