FrmVmsFontF.cpp 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "ITSLangTransF.h"
  6. #include "FrmResourceF.h"
  7. #pragma hdrstop
  8. #include "FrmVmsFontF.h"
  9. //---------------------------------------------------------------------------
  10. //---------------------------------------------------------------------------
  11. #pragma package(smart_init)
  12. #pragma link "cxClasses"
  13. #pragma link "cxContainer"
  14. #pragma link "cxControls"
  15. #pragma link "cxEdit"
  16. #pragma link "cxGraphics"
  17. #pragma link "cxHint"
  18. #pragma link "cxLabel"
  19. #pragma link "cxLookAndFeelPainters"
  20. #pragma link "cxLookAndFeels"
  21. #pragma link "cxMaskEdit"
  22. #pragma link "cxPC"
  23. #pragma link "cxPCdxBarPopupMenu"
  24. #pragma link "cxSpinEdit"
  25. #pragma link "cxTextEdit"
  26. #pragma link "dxBar"
  27. #pragma link "dxCustomHint"
  28. #pragma link "dxRibbon"
  29. #pragma link "dxRibbonGallery"
  30. #pragma link "dxRibbonSkins"
  31. #pragma link "dxRibbonStatusBar"
  32. #pragma link "dxScreenTip"
  33. #pragma link "dxSkinBlack"
  34. #pragma link "dxSkinBlue"
  35. #pragma link "dxSkinCaramel"
  36. #pragma link "dxSkinChooserGallery"
  37. #pragma link "dxSkinCoffee"
  38. #pragma link "dxSkinDarkRoom"
  39. #pragma link "dxSkinDarkSide"
  40. #pragma link "dxSkinFoggy"
  41. #pragma link "dxSkinGlassOceans"
  42. #pragma link "dxSkiniMaginary"
  43. #pragma link "dxSkinLilian"
  44. #pragma link "dxSkinLiquidSky"
  45. #pragma link "dxSkinLondonLiquidSky"
  46. #pragma link "dxSkinMcSkin"
  47. #pragma link "dxSkinMoneyTwins"
  48. #pragma link "dxSkinOffice2007Black"
  49. #pragma link "dxSkinOffice2007Blue"
  50. #pragma link "dxSkinOffice2007Green"
  51. #pragma link "dxSkinOffice2007Pink"
  52. #pragma link "dxSkinOffice2007Silver"
  53. #pragma link "dxSkinOffice2010Black"
  54. #pragma link "dxSkinOffice2010Blue"
  55. #pragma link "dxSkinOffice2010Silver"
  56. #pragma link "dxSkinsCore"
  57. #pragma link "dxSkinscxPCPainter"
  58. #pragma link "dxSkinsdxBarPainter"
  59. #pragma link "dxSkinsdxRibbonPainter"
  60. #pragma link "dxSkinSeven"
  61. #pragma link "dxSkinsForm"
  62. #pragma link "dxSkinSharp"
  63. #pragma link "dxSkinSilver"
  64. #pragma link "dxSkinStardust"
  65. #pragma link "dxStatusBar"
  66. #pragma link "dxTabbedMDI"
  67. #pragma link "cxButtons"
  68. #pragma link "cxCalendar"
  69. #pragma link "cxDropDownEdit"
  70. #pragma link "cxGroupBox"
  71. #pragma link "cxSplitter"
  72. #pragma link "cxTimeEdit"
  73. #pragma link "cxCalc"
  74. #pragma link "cxCheckBox"
  75. #pragma link "cxCustomData"
  76. #pragma link "cxData"
  77. #pragma link "cxDataStorage"
  78. #pragma link "cxFilter"
  79. #pragma link "cxGrid"
  80. #pragma link "cxGridCustomTableView"
  81. #pragma link "cxGridCustomView"
  82. #pragma link "cxGridLevel"
  83. #pragma link "cxGridTableView"
  84. #pragma link "cxStyles"
  85. #pragma resource "*.dfm"
  86. TFrmVmsFont *FrmVmsFont = NULL;
  87. //---------------------------------------------------------------------------
  88. __fastcall TFrmVmsFont::TFrmVmsFont(TComponent* Owner)
  89. : TForm(Owner)//TdxCustomRibbonForm(Owner)//TForm(Owner)
  90. {
  91. CMM_SetFormPosition(g_AppCfg.bSaveForm);
  92. ITSSkin_Initialize(Application, g_AppCfg.sLang);
  93. DoubleBuffered = true;
  94. g_AppCfg.lMainWinHandle = (long)Handle;
  95. LangTrans->Translate(this, ITSDb_GetConnection());
  96. ITSSkin_Load(this);
  97. CMM_LoadForm(g_sFormsDir, this);
  98. SetColorScheme(g_AppCfg.sSkinName);
  99. CDSFontManager = new TCDSFontManager();
  100. FTitle = Caption;
  101. FEditMode = false;
  102. }
  103. //---------------------------------------------------------------------------
  104. void __fastcall TFrmVmsFont::FormCreate(TObject *Sender)
  105. {
  106. Application->ShowMainForm = false;
  107. try {
  108. Application->Icon->LoadFromResourceName(((unsigned int)HInstance), "MAINICON");
  109. } catch(...) { ShowMessage("LoadFromResourceName failed"); }
  110. Application->ShowMainForm = true;
  111. }
  112. //---------------------------------------------------------------------------
  113. void __fastcall TFrmVmsFont::FormShow(TObject *Sender)
  114. {
  115. Refresh();
  116. FormInit();
  117. TmrShow->Enabled = true;
  118. }
  119. //---------------------------------------------------------------------------
  120. void __fastcall TFrmVmsFont::FormInit()
  121. {
  122. m_pGDC = TvList->DataController;
  123. //TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;
  124. TcxComboBoxProperties *pcxComboBoxProperties;
  125. pcxComboBoxProperties = (TcxComboBoxProperties*)Column04->Properties;
  126. pcxComboBoxProperties->Items->Clear();
  127. pcxComboBoxProperties->Items->Add("Y");
  128. pcxComboBoxProperties->Items->Add("N");
  129. pcxComboBoxProperties = (TcxComboBoxProperties*)Column14->Properties;
  130. pcxComboBoxProperties->Items->Clear();
  131. pcxComboBoxProperties->Items->Add("Y");
  132. pcxComboBoxProperties->Items->Add("N");
  133. }
  134. //---------------------------------------------------------------------------
  135. void __fastcall TFrmVmsFont::FormClose(TObject *Sender, TCloseAction &Action)
  136. {
  137. CommClose();
  138. FrmVmsFont = NULL;
  139. Action = caFree;
  140. }
  141. //---------------------------------------------------------------------------
  142. void __fastcall TFrmVmsFont::CommClose()
  143. {
  144. try
  145. {
  146. ITSSkin_Term();
  147. CMM_SaveForm(g_sFormsDir, this);
  148. }
  149. catch(Exception &e)
  150. {
  151. }
  152. }
  153. //---------------------------------------------------------------------------
  154. void __fastcall TFrmVmsFont::SetColorScheme(String ASkinName)
  155. {
  156. dxSkinController1->SkinName = ASkinName;
  157. dxSkinController1->Refresh();
  158. }
  159. //---------------------------------------------------------------------------
  160. void __fastcall TFrmVmsFont::BtnCloseClick(TObject *Sender)
  161. {
  162. Close();
  163. }
  164. //---------------------------------------------------------------------------
  165. void __fastcall TFrmVmsFont::TmrShowTimer(TObject *Sender)
  166. {
  167. TmrShow->Enabled = false;
  168. BtnSearchClick((TObject*)BtnSearch);
  169. }
  170. //---------------------------------------------------------------------------
  171. void __fastcall TFrmVmsFont::BtnSearchClick(TObject *Sender)
  172. {
  173. Application->ProcessMessages();
  174. TSqlCursor sqlCrs((TControl*)BtnSearch);
  175. RefreshData();
  176. CxList->SetFocus();
  177. }
  178. //---------------------------------------------------------------------------
  179. void __fastcall TFrmVmsFont::RefreshData()
  180. {
  181. // 검색조건에 의한 링크 데이터 조회
  182. SelListData();
  183. }
  184. //---------------------------------------------------------------------------
  185. bool __fastcall TFrmVmsFont::AddObjectItem(TCDSFontName *pObj, String AMode)
  186. {
  187. int nRow;
  188. try
  189. {
  190. nRow = m_pGDC->AppendRecord();
  191. //pObj->GridIndex = nRow;
  192. m_pGDC->Values[nRow][ColumnSel->Index] = false;
  193. m_pGDC->Values[nRow][Column00->Index] = AMode;
  194. m_pGDC->Values[nRow][Column01->Index] = pObj->VMS_FONT_NAME_CD;
  195. m_pGDC->Values[nRow][Column02->Index] = pObj->VMS_FONT_NAME_NM;
  196. m_pGDC->Values[nRow][Column12->Index] = pObj->VMS_FONT_NAME_NM;
  197. m_pGDC->Values[nRow][Column03->Index] = pObj->VMS_FONT_NAME_CD;
  198. m_pGDC->Values[nRow][Column13->Index] = pObj->VMS_FONT_NAME_CD;
  199. m_pGDC->Values[nRow][Column04->Index] = pObj->USE_YN;
  200. m_pGDC->Values[nRow][Column14->Index] = pObj->USE_YN;
  201. m_pGDC->Values[nRow][Column88->Index] = 0;
  202. m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
  203. return true;
  204. }
  205. catch(...)
  206. {
  207. }
  208. return false;
  209. }
  210. //---------------------------------------------------------------------------
  211. void __fastcall TFrmVmsFont::SelListData()
  212. {
  213. FUpdate = false;
  214. CMM_ClearGridTableView(TvList);
  215. CDSFontManager->LoadFontNameInfo();
  216. int nRow = 0;
  217. TcxDataController *pGDC = TvList->DataController;
  218. try
  219. {
  220. TvList->BeginUpdate(lsimImmediate);
  221. try
  222. {
  223. FOR_STL(TCDSFontName*, pObj, CDSFontManager->FNames)
  224. {
  225. //pObj->EditMode = DB_INIT; // 미리초기화해준다.(삭제된것)
  226. //pObj->Completed = true;
  227. AddObjectItem(pObj, "-");
  228. }
  229. }
  230. catch(Exception &e)
  231. {
  232. DBERRORMSG("VMS Information Query", String(e.ClassName()), e.Message, "");
  233. throw Exception(String(e.ClassName()) + e.Message);
  234. }
  235. }
  236. __finally
  237. {
  238. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  239. TvList->EndUpdate();
  240. TvList->DataController->GotoFirst();
  241. TvList->DataController->FocusedRecordIndex = 0;
  242. }
  243. }
  244. //---------------------------------------------------------------------------
  245. void __fastcall TFrmVmsFont::Column13CustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  246. bool &ADone)
  247. {
  248. try
  249. {
  250. //ACanvas->Canvas->Brush->Color = m_pColor[0]->Color;
  251. int iIndex = AViewInfo->Item->Index;
  252. String val = (String)AViewInfo->GridRecord->DisplayTexts[iIndex];
  253. ACanvas->Canvas->Font->Color = (TColor)StrToInt(val.c_str());
  254. ACanvas->Canvas->Brush->Color = (TColor)StrToInt(val.c_str());
  255. }
  256. catch(...) {}
  257. }
  258. //---------------------------------------------------------------------------
  259. void __fastcall TFrmVmsFont::BtnEditClick(TObject *Sender)
  260. {
  261. TListFocus tvFocus(TvList);
  262. if (BtnEdit->Caption == "취소")
  263. {
  264. CxList->SetFocus();
  265. Application->ProcessMessages();
  266. SaveData();
  267. BtnSearchClick((TObject*)BtnSearch);
  268. }
  269. FrmLang->ITSSkin_ButtonClick(BtnSearch, BtnEdit, BtnInsert, BtnDelete, BtnApply);
  270. ChangeEditMode(BtnEdit->Down);
  271. FEditMode = BtnEdit->Down;
  272. }
  273. //---------------------------------------------------------------------------
  274. void __fastcall TFrmVmsFont::ChangeEditMode(bool AEdit)
  275. {
  276. bool bEditing = AEdit;
  277. try
  278. {
  279. TvList->BeginUpdate();
  280. //Column00->Visible = bEditing;
  281. Column02->Options->Editing = bEditing;
  282. //Column03->Options->Editing = bEditing;
  283. Column04->Options->Editing = bEditing;
  284. }
  285. __finally
  286. {
  287. TvList->EndUpdate();
  288. if (bEditing)
  289. {
  290. BtnEdit->Caption = FrmLang->lblCancel->Caption;//"취소";
  291. BtnEdit->Hint = FrmLang->lblCancel->Hint;//데이터 편집 취소";
  292. }
  293. else
  294. {
  295. BtnEdit->Caption = FrmLang->lblEdit->Caption;//"편집";
  296. BtnEdit->Hint = FrmLang->lblEdit->Hint;//데이터 편집";
  297. Screen->Cursor = crDefault;
  298. }
  299. }
  300. }
  301. //---------------------------------------------------------------------------
  302. void __fastcall TFrmVmsFont::TvListMouseMove(TObject *Sender, TShiftState Shift, int X, int Y)
  303. {
  304. try
  305. {
  306. if (!BtnEdit->Down) return;
  307. TcxGridSite *ASite = (TcxGridSite *)Sender;
  308. //Screen->Cursor = crDefault;
  309. //TcxCustomGridHitTest *AHitTest = tvSel->GetHitTest(X, Y);
  310. TcxCustomGridHitTest *AHitTest = dynamic_cast<TcxGridRecordHitTest*>(ASite->ViewInfo->GetHitTest(X, Y));
  311. if (dynamic_cast<TcxGridRecordHitTest*>(ASite->ViewInfo->GetHitTest(X, Y)))
  312. {
  313. int ARow = ((TcxGridRecordCellHitTest*)AHitTest)->GridRecord->Index;
  314. if (((TcxGridRecordCellHitTest*)AHitTest)->Item == NULL) return;
  315. int ACol = ((TcxGridRecordCellHitTest*)AHitTest)->Item->Index;
  316. if (ACol == Column03->Index &&
  317. ARow < ASite->GridView->DataController->RecordCount-1)
  318. {
  319. Screen->Cursor = FEditMode ? crHandPoint : crDefault;
  320. }
  321. }
  322. else
  323. {
  324. Screen->Cursor = crDefault;
  325. }
  326. }
  327. catch(...)
  328. {
  329. }
  330. }
  331. //---------------------------------------------------------------------------
  332. void __fastcall TFrmVmsFont::BtnApplyClick(TObject *Sender)
  333. {
  334. FUpdate = true;
  335. BtnEdit->Down = false;
  336. BtnEdit->Click();
  337. }
  338. //---------------------------------------------------------------------------
  339. bool __fastcall TFrmVmsFont::IsUpdate()
  340. {
  341. int nMemPtr;
  342. String sName;
  343. String sUseYn;
  344. TCDSFontName *pObj;
  345. int nUpdateCnt = 0;
  346. int nRows = m_pGDC->RecordCount;
  347. try
  348. {
  349. for (int ii = 0; ii < nRows; ii++)
  350. {
  351. m_pGDC->Values[ii][Column88->Index] = 0;
  352. nMemPtr = m_pGDC->Values[ii][Column99->Index];
  353. pObj = (TCDSFontName*)nMemPtr;
  354. sName = m_pGDC->Values[ii][Column02->Index];
  355. sUseYn = m_pGDC->Values[ii][Column04->Index];
  356. if (sName != pObj->VMS_FONT_NAME_NM ||
  357. sUseYn != pObj->USE_YN)
  358. {
  359. m_pGDC->Values[ii][Column88->Index] = 1;
  360. nUpdateCnt++;
  361. }
  362. }
  363. }
  364. catch(...)
  365. {
  366. }
  367. if (nUpdateCnt == 0)
  368. {
  369. return false;
  370. }
  371. return true;
  372. }
  373. //---------------------------------------------------------------------------
  374. void __fastcall TFrmVmsFont::RollbackListData()
  375. {
  376. int nStateVal;
  377. int nColorVal;
  378. String sName, sUseYn;
  379. try
  380. {
  381. try
  382. {
  383. int nRows = m_pGDC->RecordCount;
  384. TvList->BeginUpdate();
  385. for (int ii = 0; ii < nRows; ii++)
  386. {
  387. nStateVal = m_pGDC->Values[ii][Column88->Index];
  388. if (nStateVal == 0) continue;
  389. sName = m_pGDC->Values[ii][Column12->Index];
  390. nColorVal = m_pGDC->Values[ii][Column13->Index];
  391. sUseYn = m_pGDC->Values[ii][Column14->Index];
  392. m_pGDC->Values[ii][Column88->Index] = 0;
  393. m_pGDC->Values[ii][Column02->Index] = sName;
  394. m_pGDC->Values[ii][Column03->Index] = nColorVal;
  395. m_pGDC->Values[ii][Column04->Index] = sUseYn;
  396. }
  397. }
  398. catch (Exception &exception)
  399. {
  400. throw Exception(String(exception.ClassName()) + exception.Message);
  401. }
  402. }
  403. __finally
  404. {
  405. TvList->EndUpdate();
  406. }
  407. }
  408. //---------------------------------------------------------------------------
  409. void __fastcall TFrmVmsFont::SaveData()
  410. {
  411. this->Update();
  412. if (!IsUpdate()) return;
  413. if (!FUpdate)
  414. {
  415. if (Application->MessageBox(FrmLang->lblEidtConfirm->Caption.c_str(),//L"변경된 정보가 있습니다.\r\n변경된 정보를 저장 하시겠습니까?",
  416. FTitle.c_str(), MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES)
  417. {
  418. RollbackListData();
  419. return;
  420. }
  421. }
  422. int nStateVal;
  423. int nMemPtr;
  424. TCDSFontName *pObj;
  425. int nColorVal;
  426. String sName, sUseYn;
  427. bool bSave = false;
  428. int nUpdateCnt = 0;
  429. int nRows = m_pGDC->RecordCount;
  430. TADOQuery *pADO = NULL;
  431. String sQry;
  432. try
  433. {
  434. try
  435. {
  436. pADO = new TADOQuery(NULL);
  437. pADO->Close();
  438. pADO->Connection = ITSDb_GetConnection();
  439. TvList->BeginUpdate();
  440. ITSDb_GetConnection()->BeginTrans();
  441. {
  442. sQry = "MERGE INTO TB_VMS_FONT_NAME L \r\n"
  443. "USING (SELECT \r\n"
  444. " :p01 AS VMS_FONT_NAME_CD, \r\n"
  445. " :p02 AS VMS_FONT_NAME_NM, \r\n"
  446. " :p03 AS USE_YN \r\n"
  447. " FROM DUAL) M \r\n"
  448. " ON (L.VMS_FONT_NAME_CD = M.VMS_FONT_NAME_CD) \r\n"
  449. "WHEN MATCHED THEN \r\n"
  450. " UPDATE SET \r\n"
  451. " L.VMS_FONT_NAME_NM = M.VMS_FONT_NAME_NM, \r\n"
  452. " L.USE_YN = M.USE_YN \r\n"
  453. "WHEN NOT MATCHED THEN \r\n"
  454. " INSERT ( \r\n"
  455. " VMS_FONT_NAME_CD, \r\n"
  456. " VMS_FONT_NAME_NM, \r\n"
  457. " USE_YN ) \r\n"
  458. " VALUES ( \r\n"
  459. " M.VMS_FONT_NAME_CD, \r\n"
  460. " M.VMS_FONT_NAME_NM, \r\n"
  461. " M.USE_YN ) \r\n";
  462. ITSDb_SQLText(pADO, sQry);
  463. for (int ii = 0; ii < nRows; ii++)
  464. {
  465. TSqlCursor sqlCrs;
  466. nMemPtr = m_pGDC->Values[ii][Column99->Index];
  467. pObj = (TCDSFontName*)nMemPtr;
  468. if (!pObj) continue;
  469. String VMS_FONT_NAME_NM = VarToStr(m_pGDC->Values[ii][Column02->Index]);
  470. String USE_YN = VarToStr(m_pGDC->Values[ii][Column04->Index]);
  471. //if (!pObj->Completed && pObj->EditMode != DB_NEW)
  472. {
  473. if (pObj->VMS_FONT_NAME_NM == VMS_FONT_NAME_NM &&
  474. pObj->USE_YN == USE_YN
  475. )
  476. {
  477. continue;
  478. }
  479. }
  480. pObj->VMS_FONT_NAME_NM = VMS_FONT_NAME_NM;
  481. pObj->USE_YN = USE_YN;
  482. pADO->Parameters->ParamByName("p01")->Value = pObj->VMS_FONT_NAME_CD;
  483. pADO->Parameters->ParamByName("p02")->Value = pObj->VMS_FONT_NAME_NM;
  484. pADO->Parameters->ParamByName("p03")->Value = pObj->USE_YN;
  485. ITSDb_SQLExec(pADO);
  486. m_pGDC->Values[ii][Column88->Index] = 0;
  487. }
  488. ITSDb_GetConnection()->CommitTrans();
  489. bSave = true;
  490. }
  491. }
  492. catch(EDatabaseError &E)
  493. {
  494. ITSDb_GetConnection()->RollbackTrans();
  495. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  496. DBERRORMSG(Caption, String(E.ClassName()), E.Message, sQry);
  497. throw Exception(String(E.ClassName()) + E.Message);
  498. }
  499. catch(Exception &e)
  500. {
  501. ITSDb_GetConnection()->RollbackTrans();
  502. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  503. DBERRORMSG(Caption, String(e.ClassName()), e.Message, sQry);
  504. throw Exception(String(e.ClassName()) + e.Message);
  505. }
  506. }
  507. __finally
  508. {
  509. TvList->EndUpdate();
  510. if (pADO)
  511. {
  512. pADO->Close();
  513. delete pADO;
  514. }
  515. if (bSave)
  516. {
  517. Application->ProcessMessages();
  518. Application->MessageBox(FrmLang->lblDbSave->Caption.c_str(),//L"변경된 소통등급 정보를 저장하였습니다.",
  519. FTitle.c_str(), MB_OK|MB_ICONQUESTION|MB_APPLMODAL);
  520. RefreshData(); //소통정보 변경을 알리기 위해 먼저 다시 읽어 놓는다.
  521. //POST_MSG(Application->MainForm->Handle, WM_DATABASE_REFRESH, WP_MSG_01, 0);
  522. //Sleep(500);
  523. //POST_MSG(Application->MainForm->Handle, WM_DATABASE_REFRESH, WP_MSG_06, 0); //가공서버로 보내는 메시지
  524. }
  525. }
  526. }
  527. //---------------------------------------------------------------------------
  528. void __fastcall TFrmVmsFont::FormCloseQuery(TObject *Sender, bool &CanClose)
  529. {
  530. SaveData();
  531. }
  532. //---------------------------------------------------------------------------
  533. int __fastcall TFrmVmsFont::GetNextId()
  534. {
  535. int FMaxID = 0;
  536. FOR_STL(TCDSFontName*, pObj, CDSFontManager->FNames)
  537. {
  538. if (pObj->VMS_FONT_NAME_CD > FMaxID)
  539. {
  540. FMaxID = pObj->VMS_FONT_NAME_CD;
  541. }
  542. }
  543. return FMaxID+1;
  544. }
  545. //---------------------------------------------------------------------------
  546. void __fastcall TFrmVmsFont::BtnInsertClick(TObject *Sender)
  547. {
  548. int nMsgType = MB_OK|MB_ICONERROR|MB_APPLMODAL;
  549. try
  550. {
  551. try
  552. {
  553. TvList->BeginUpdate();
  554. TCDSFontName *pObj = new TCDSFontName();
  555. if (!pObj)
  556. {
  557. Application->MessageBox(FrmLang->lblMemErr->Caption.c_str(),//L"신규 휴일 정보를 생성할 수 없습니다.[메모리오류]",
  558. FTitle.c_str(), nMsgType);
  559. return;
  560. }
  561. pObj->VMS_FONT_NAME_CD = GetNextId();
  562. pObj->VMS_FONT_NAME_NM = "";
  563. pObj->USE_YN = "Y";
  564. CDSFontManager->FNames.Push(pObj->VMS_FONT_NAME_CD, pObj);
  565. AddObjectItem(pObj, FrmLang->lblNew->Caption);//"신규");
  566. }
  567. __finally
  568. {
  569. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  570. TvList->EndUpdate();
  571. TvList->DataController->GotoFirst();
  572. TvList->DataController->FocusedRecordIndex = 0;
  573. }
  574. }
  575. __finally
  576. {
  577. }
  578. }
  579. //---------------------------------------------------------------------------
  580. void __fastcall TFrmVmsFont::TvListCellClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  581. TMouseButton AButton, TShiftState AShift, bool &AHandled)
  582. {
  583. if (FEditMode && ACellViewInfo->Item->Index == Column02->Index)
  584. {
  585. String VMS_FONT_NAME_CD = TvList->DataController->Values[TvList->DataController->GetFocusedRecordIndex()][Column02->Index];
  586. if (FontDialog1->Execute())
  587. {
  588. TFont* Font = FontDialog1->Font;
  589. TvList->DataController->Values[TvList->DataController->GetFocusedRecordIndex()][Column02->Index] = Font->Name;
  590. try
  591. {
  592. int nRows = TvList->DataController->FocusedRecordIndex;
  593. if (nRows < 0)
  594. {
  595. return;
  596. }
  597. if (TvList->DataController->Values[nRows][Column02->Index] != TvList->DataController->Values[nRows][Column12->Index])
  598. {
  599. //int nMemPtr = TvList->DataController->Values[nRows][Column99->Index];
  600. //TCDSVmsColor *pObj = (TCDSVmsColor*)nMemPtr;
  601. //TvList->DataController->Values[nRows][Column88->Index] = 1;
  602. //TvList->DataController->Values[nRows][Column00->Index] = FrmLang->lblModify->Caption;//"수정";
  603. //if (pObj) pObj->EditMode = DB_UPDATE;
  604. }
  605. }
  606. catch(...)
  607. {
  608. }
  609. }
  610. }
  611. }
  612. //---------------------------------------------------------------------------
  613. void __fastcall TFrmVmsFont::TvListCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  614. bool &ADone)
  615. {
  616. #if 0
  617. if (AViewInfo)
  618. {
  619. String sType = AViewInfo->GridRecord->DisplayTexts[Column00->Index];
  620. if (sType == FrmLang->lblModify->Caption)//"수정")
  621. {
  622. //ACanvas->Brush->Color = clOlive;
  623. }
  624. else if (sType == FrmLang->lblDelete->Caption)//"삭제")
  625. {
  626. //ACanvas->Brush->Color = clRed;
  627. }
  628. else if (sType == FrmLang->lblNew->Caption)//"신규")
  629. {
  630. //ACanvas->Brush->Color = clLime;
  631. if (AViewInfo->Focused) ACanvas->Font->Color = clBlack;
  632. }
  633. }
  634. #endif
  635. }
  636. //---------------------------------------------------------------------------
  637. void __fastcall TFrmVmsFont::ColumnPropertiesValidate(TObject *Sender, Variant &DisplayValue, TCaption &ErrorText, bool &Error)
  638. {
  639. if (TvList->Controller->FocusedRow->IsFilterRow) return;
  640. int nRow = m_pGDC->FocusedRecordIndex;
  641. if (nRow < 0) return;
  642. int nMemPtr = TvList->DataController->Values[nRow][Column99->Index];
  643. TCDSFontName *pObj = (TCDSFontName*)nMemPtr;
  644. String VMS_FONT_NAME_NM = VarToStr(m_pGDC->Values[nRow][Column02->Index]);
  645. String USE_YN = VarToStr(m_pGDC->Values[nRow][Column04->Index]);
  646. TcxGridColumn *pColumn = TvList->Controller->FocusedColumn;
  647. if (pColumn == Column02) VMS_FONT_NAME_NM = DisplayValue;
  648. else if (pColumn == Column04) USE_YN = DisplayValue;
  649. if (pObj->VMS_FONT_NAME_NM != VMS_FONT_NAME_NM ||
  650. pObj->USE_YN != USE_YN )
  651. {
  652. m_pGDC->Values[nRow][Column00->Index] = FrmLang->lblModify->Caption;//"수정";
  653. //pObj->EditMode = DB_UPDATE;
  654. }
  655. else
  656. {
  657. TvList->DataController->Values[nRow][Column00->Index] = "-";
  658. //pObj->EditMode = DB_INIT;
  659. }
  660. }
  661. //---------------------------------------------------------------------------