123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include "ITSSkinF.h"
- #include "ITSUtilF.h"
- #include "FrmResourceF.h"
- #include "ITSLangTransF.h"
- #pragma hdrstop
- #include "FRAME_UtisStatusListF.h"
- #include "CDSUtisF.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma link "cxClasses"
- #pragma link "cxControls"
- #pragma link "cxCustomData"
- #pragma link "cxData"
- #pragma link "cxDataStorage"
- #pragma link "cxEdit"
- #pragma link "cxFilter"
- #pragma link "cxGraphics"
- #pragma link "cxGrid"
- #pragma link "cxGridCustomTableView"
- #pragma link "cxGridCustomView"
- #pragma link "cxGridLevel"
- #pragma link "cxGridTableView"
- #pragma link "cxLookAndFeelPainters"
- #pragma link "cxLookAndFeels"
- #pragma link "cxPC"
- #pragma link "cxPCdxBarPopupMenu"
- #pragma link "cxStyles"
- #pragma link "cxTextEdit"
- #pragma link "dxSkinBlack"
- #pragma link "dxSkinBlue"
- #pragma link "dxSkinsCore"
- #pragma link "dxSkinscxPCPainter"
- #pragma resource "*.dfm"
- //TFRAMEUtisStatusList *FRAMEUtisStatusList;
- //---------------------------------------------------------------------------
- __fastcall TFRAMEUtisStatusList::TFRAMEUtisStatusList(TComponent* Owner)
- : TFrame(Owner)
- {
- FCodeCMS = ItsCodeManager->FLists.Find("CMS");
- FCodeCDS = ItsCodeManager->FLists.Find("CDS");
-
- InitList();
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEUtisStatusList::InitList()
- {
- InitUtisRun();
- InitRseRun();
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEUtisStatusList::InitUtisRun()
- {
- TcxGridTableView *pView= (TcxGridTableView *)TvUtisRun;
- TcxGridDataController *pGDC = (TcxGridDataController *)pView->DataController;
- CMM_ClearGridTableView(TvUtisRun);
-
- try
- {
- int nRow;
- pView->BeginUpdate();
- pGDC->BeginUpdate();
- nRow = pGDC->AppendRecord();
- pGDC->Values[nRow][ColUtisRunName->Index] = "정지영상";
- pGDC->Values[nRow][ColUtisRunCnt->Index] = FormatFloat("##,##0", ItsUtisManager->UtisRun.RunCnt[0]);
- pGDC->Values[nRow][ColUtisRunStatusCd->Index] = ItsUtisManager->UtisRun.Status[0];
- nRow = pGDC->AppendRecord();
- pGDC->Values[nRow][ColUtisRunName->Index] = "5분교통정보";
- pGDC->Values[nRow][ColUtisRunCnt->Index] = FormatFloat("##,##0", ItsUtisManager->UtisRun.RunCnt[1]);
- pGDC->Values[nRow][ColUtisRunStatusCd->Index] = ItsUtisManager->UtisRun.Status[1];
- nRow = pGDC->AppendRecord();
- pGDC->Values[nRow][ColUtisRunName->Index] = "5분교통정보(방향)";
- pGDC->Values[nRow][ColUtisRunCnt->Index] = "-";//FormatFloat("##,##0", ItsUtisManager->UtisRun.RunCnt[2]);
- pGDC->Values[nRow][ColUtisRunStatusCd->Index] = ItsUtisManager->UtisRun.Status[2];
- }
- __finally
- {
- pGDC->EndUpdate();
- pView->EndUpdate();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEUtisStatusList::InitRseRun()
- {
- TcxGridTableView *pView= (TcxGridTableView *)TvUtisRse;
- TcxGridDataController *pGDC = (TcxGridDataController *)pView->DataController;
- CMM_ClearGridTableView(TvUtisRse);
-
- try
- {
- int nRow;
- pView->BeginUpdate();
- pGDC->BeginUpdate();
- nRow = pGDC->AppendRecord();
- pGDC->Values[nRow][ColRseType->Index] = "전체";
- pGDC->Values[nRow][ColRseKind->Index] = "(대)";
- pGDC->Values[nRow][ColRseCnt->Index] = FormatFloat("##,##0 ", ItsUtisManager->RseRun[0]);
- nRow = pGDC->AppendRecord();
- pGDC->Values[nRow][ColRseType->Index] = "정보";
- pGDC->Values[nRow][ColRseKind->Index] = "업로드";
- pGDC->Values[nRow][ColRseCnt->Index] = FormatFloat("##,##0 ", ItsUtisManager->RseRun[1]);
- nRow = pGDC->AppendRecord();
- pGDC->Values[nRow][ColRseType->Index] = "정보";
- pGDC->Values[nRow][ColRseKind->Index] = "비업로드";
- pGDC->Values[nRow][ColRseCnt->Index] = FormatFloat("##,##0 ", ItsUtisManager->RseRun[0] - ItsUtisManager->RseRun[1]);
- }
- __finally
- {
- pGDC->EndUpdate();
- pView->EndUpdate();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEUtisStatusList::UpdateList()
- {
- RefreshList();
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEUtisStatusList::RefreshList()
- {
- TcxGridTableView *pView;
- TcxGridDataController *pGDC;
- pView= (TcxGridTableView *)TvUtisRun;
- pGDC = (TcxGridDataController *)pView->DataController;
- try
- {
- pView->BeginUpdate();
- pGDC->BeginUpdate();
- if (pGDC->RecordCount == 3)
- {
- pGDC->Values[0][ColUtisRunCnt->Index] = FormatFloat("##,##0", ItsUtisManager->UtisRun.RunCnt[0]);
- pGDC->Values[0][ColUtisRunStatusCd->Index] = ItsUtisManager->UtisRun.Status[0];
- pGDC->Values[1][ColUtisRunCnt->Index] = FormatFloat("##,##0", ItsUtisManager->UtisRun.RunCnt[1]);
- pGDC->Values[1][ColUtisRunStatusCd->Index] = ItsUtisManager->UtisRun.Status[1];
- pGDC->Values[2][ColUtisRunCnt->Index] = "-";//FormatFloat("##,##0", ItsUtisManager->UtisRun.RunCnt[2]);
- pGDC->Values[2][ColUtisRunStatusCd->Index] = ItsUtisManager->UtisRun.Status[2];
- }
- }
- __finally
- {
- pGDC->EndUpdate();
- pView->EndUpdate();
- }
- pView= (TcxGridTableView *)TvUtisRse;
- pGDC = (TcxGridDataController *)pView->DataController;
- try
- {
- pView->BeginUpdate();
- pGDC->BeginUpdate();
- if (pGDC->RecordCount == 3)
- {
- pGDC->Values[0][ColRseCnt->Index] = FormatFloat("##,##0 ", ItsUtisManager->RseRun[0]);
- pGDC->Values[1][ColRseCnt->Index] = FormatFloat("##,##0 ", ItsUtisManager->RseRun[1]);
- pGDC->Values[2][ColRseCnt->Index] = FormatFloat("##,##0 ", ItsUtisManager->RseRun[0] - ItsUtisManager->RseRun[1]);
- }
- }
- __finally
- {
- pGDC->EndUpdate();
- pView->EndUpdate();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEUtisStatusList::TvUtisRunCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
- bool &ADone)
- {
- //OptionsSelection.InvertSelect = False
- //OptionsView.FocusRect = False
- if (AViewInfo->GridRecord->Selected)
- {
- //ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentColor();
- //ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
- if (AViewInfo->GridRecord->Index % 2 == 0)
- {
- ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentEvenColor();
- ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
- }
- else
- {
- ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentOddColor();
- ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
- }
- }
- else
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEUtisStatusList::ColUtisRunStatusCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
- bool &ADone)
- {
- if (AViewInfo->GridRecord->RecordIndex < 0) return;
- Graphics::TBitmap *pBmp = NULL;
- pBmp = ImgStop->Picture->Bitmap;
- if (!VarIsNull(AViewInfo->GridRecord->DisplayTexts[ColUtisRunStatusCd->Index]))
- {
- String sCode = AViewInfo->GridRecord->DisplayTexts[ColUtisRunStatusCd->Index];
- if (sCode == "0") pBmp = ImgStop->Picture->Bitmap;
- else if (sCode == "1") pBmp = ImgRun->Picture->Bitmap;
- else if (sCode == "2") pBmp = ImgModule->Picture->Bitmap;
- }
- if (!pBmp) return;
- pBmp->Transparent = true;
- int nW, nH;
- nW = nH = 21;
- try
- {
- TColor bBrush = ACanvas->Brush->Color;
- if (AViewInfo->GridRecord->Selected)
- {
- if (AViewInfo->GridRecord->Index % 2 == 0)
- {
- bBrush = Sender->LookAndFeelPainter->DefaultContentEvenColor();
- }
- else
- {
- bBrush = Sender->LookAndFeelPainter->DefaultContentOddColor();
- }
- }
- ACanvas->Brush->Color = bBrush;
- TRect rc;
- TRect rcOrg = AViewInfo->Bounds;
- ACanvas->FillRect(rcOrg);
- nW = rcOrg.Bottom - rcOrg.Top - 2;
- rc.Top = rcOrg.Top+1;
- rc.Bottom = rcOrg.Bottom - 1;
- rc.Left = rcOrg.Left + (rcOrg.Width() - nW) / 2;
- rc.Right = rc.Left + nW;
- ACanvas->Canvas->StretchDraw(rc, pBmp);
- //ACanvas->Draw(AViewInfo->ContentBounds.Left, AViewInfo->ContentBounds.Top, pBmp);
- ADone = true;
- }
- catch(...) {}
- }
- //---------------------------------------------------------------------------
- void __fastcall TFRAMEUtisStatusList::ColRseCntCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
- bool &ADone)
- {
- if (AViewInfo->GridRecord->RecordIndex < 0) return;
- if (VarIsNull(AViewInfo->Value)) return;
- try
- {
- int nIdx = AViewInfo->GridRecord->RecordIndex;
- if (nIdx == 2 || nIdx == 4)
- {
- ACanvas->Font->Color = clRed;
- }
- else
- {
- ACanvas->Font->Color = clBlue;
- }
- }
- catch(...) {}
- }
- //---------------------------------------------------------------------------
|