Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1939 lines
50 KiB

  1. /**************************************************/
  2. /* */
  3. /* */
  4. /* MDI Mainframe window class */
  5. /* */
  6. /* */
  7. /* */
  8. /* Copyright (c) 1997-1999 Microsoft Corporation. */
  9. /**************************************************/
  10. #include "stdafx.h"
  11. #include "eudcedit.h"
  12. #include "mainfrm.h"
  13. #include "editwnd.h"
  14. #include "refrwnd.h"
  15. #include "eudcdlg.h"
  16. #include "refrdlg.h"
  17. #include "registry.h"
  18. #include "assocdlg.h"
  19. #include "imprtdlg.h"
  20. #include "gagedlg.h"
  21. #include "blinkdlg.h"
  22. #include "util.h"
  23. #include "rotatdlg.h"
  24. #include "extfunc.h"
  25. extern "C"
  26. {
  27. #include "imelist.h"
  28. }
  29. #define STRSAFE_LIB
  30. #include <strsafe.h>
  31. #define BUFFERMAX 800
  32. #ifdef _DEBUG
  33. #undef THIS_FILE
  34. static char BASED_CODE THIS_FILE[] = __FILE__;
  35. #endif
  36. // Global paramter
  37. BOOL TitleFlag;
  38. extern CPoint PalettePt;
  39. CEditWnd *pEditChild;
  40. CRefrWnd *pRefrChild;
  41. extern BOOL SetCountryInfo(UINT LocalCP);
  42. IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
  43. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  44. //{{AFX_MSG_MAP(CMainFrame)
  45. ON_WM_CREATE()
  46. ON_WM_SIZE()
  47. ON_COMMAND_EX(IDW_STYLES, OnStylesBar)
  48. ON_UPDATE_COMMAND_UI(IDW_STYLES, OnUpdateStylesBar)
  49. ON_UPDATE_COMMAND_UI(ID_TOOLBAR, OnUpdateToolbar)
  50. ON_WM_DESTROY()
  51. ON_COMMAND(ID_REFFERFILE_NEW, OnRefferfileNew)
  52. ON_COMMAND(ID_READ_CHAR, OnReadChar)
  53. ON_UPDATE_COMMAND_UI(ID_REFFERFILE_NEW, OnUpdateRefferfileNew)
  54. ON_COMMAND(ID_TOOLBAR, OnToolbar)
  55. ON_COMMAND(ID_REFFER_CLOSE, OnRefferClose)
  56. ON_UPDATE_COMMAND_UI(ID_REFFER_CLOSE, OnUpdateRefferClose)
  57. ON_WM_CLOSE()
  58. ON_COMMAND(ID_SHOW_GRID, OnShowGrid)
  59. ON_UPDATE_COMMAND_UI(ID_SHOW_GRID, OnUpdateShowGrid)
  60. ON_COMMAND(ID_SELECTFAMILY, OnSelectfamily)
  61. ON_COMMAND(ID_SAVECHAR, OnSavechar)
  62. ON_UPDATE_COMMAND_UI(ID_SAVECHAR, OnUpdateSavechar)
  63. ON_COMMAND(ID_SAVE_CHARAS, OnSaveCharas)
  64. ON_UPDATE_COMMAND_UI(ID_SAVE_CHARAS, OnUpdateSaveCharas)
  65. ON_COMMAND(ID_LINKIME, OnLinkime)
  66. ON_WM_INITMENU()
  67. ON_UPDATE_COMMAND_UI(ID_READ_CHAR, OnUpdateReadChar)
  68. ON_UPDATE_COMMAND_UI(ID_LINKIME, OnUpdateLinkime)
  69. ON_COMMAND(ID_NEXTCODE, OnNextcode)
  70. ON_UPDATE_COMMAND_UI(ID_NEXTCODE, OnUpdateNextcode)
  71. ON_COMMAND(ID_PREVCODE, OnPrevcode)
  72. ON_UPDATE_COMMAND_UI(ID_PREVCODE, OnUpdatePrevcode)
  73. ON_COMMAND(ID_CALL_CHAR, OnCallChar)
  74. ON_UPDATE_COMMAND_UI(ID_CALL_CHAR, OnUpdateCallChar)
  75. ON_COMMAND(ID_IMPORT_FILE, OnImportFile)
  76. ON_UPDATE_COMMAND_UI(ID_IMPORT_FILE, OnUpdateImportFile)
  77. ON_COMMAND(ID_LINKBATCHMODE, OnLinkbatchmode)
  78. ON_UPDATE_COMMAND_UI(ID_LINKBATCHMODE, OnUpdateLinkbatchmode)
  79. ON_COMMAND(ID_HELP, OnHelp)
  80. ON_COMMAND(ID_FIT_CURVE, OnFitCurve)
  81. ON_UPDATE_COMMAND_UI(ID_FIT_CURVE, OnUpdateFitCurve)
  82. ON_COMMAND(ID_ROTATE, OnRotate)
  83. ON_UPDATE_COMMAND_UI(ID_ROTATE, OnUpdateRotate)
  84. ON_COMMAND(ID_PALETTEBRUSH, OnPalettebrush)
  85. ON_UPDATE_COMMAND_UI(ID_PALETTEBRUSH, OnUpdatePalettebrush)
  86. ON_COMMAND(ID_PALETTECIRCLE, OnPalettecircle)
  87. ON_UPDATE_COMMAND_UI(ID_PALETTECIRCLE, OnUpdatePalettecircle)
  88. ON_COMMAND(ID_PALETTECIRCLEFILL, OnPalettecirclefill)
  89. ON_UPDATE_COMMAND_UI(ID_PALETTECIRCLEFILL, OnUpdatePalettecirclefill)
  90. ON_COMMAND(ID_PALETTEFREEFORM, OnPalettefreeform)
  91. ON_UPDATE_COMMAND_UI(ID_PALETTEFREEFORM, OnUpdatePalettefreeform)
  92. ON_COMMAND(ID_PALETTEERASER, OnPaletteeraser)
  93. ON_UPDATE_COMMAND_UI(ID_PALETTEERASER, OnUpdatePaletteeraser)
  94. ON_COMMAND(ID_PALETTEPEN, OnPalettepen)
  95. ON_UPDATE_COMMAND_UI(ID_PALETTEPEN, OnUpdatePalettepen)
  96. ON_COMMAND(ID_PALETTERECT, OnPaletterect)
  97. ON_UPDATE_COMMAND_UI(ID_PALETTERECT, OnUpdatePaletterect)
  98. ON_COMMAND(ID_PALETTERECTBAND, OnPaletterectband)
  99. ON_UPDATE_COMMAND_UI(ID_PALETTERECTBAND, OnUpdatePaletterectband)
  100. ON_COMMAND(ID_PALETTERECTFILL, OnPaletterectfill)
  101. ON_UPDATE_COMMAND_UI(ID_PALETTERECTFILL, OnUpdatePaletterectfill)
  102. ON_COMMAND(ID_PALETTESLOPE, OnPaletteslope)
  103. ON_UPDATE_COMMAND_UI(ID_PALETTESLOPE, OnUpdatePaletteslope)
  104. ON_CBN_SELCHANGE(IDC_SELECTCHARSET, OnSelectCharSet)
  105. //}}AFX_MSG_MAP
  106. END_MESSAGE_MAP()
  107. static UINT BASED_CODE Palette[] =
  108. {
  109. // Correspond to palette bitmap data
  110. ID_PALETTEPEN,
  111. ID_PALETTEBRUSH,
  112. ID_PALETTESLOPE,
  113. ID_PALETTERECT,
  114. ID_PALETTERECTFILL,
  115. ID_PALETTECIRCLE,
  116. ID_PALETTECIRCLEFILL,
  117. ID_PALETTERECTBAND,
  118. ID_PALETTEFREEFORM,
  119. ID_PALETTEERASER
  120. };
  121. /************************************************/
  122. /* */
  123. /* Constructor */
  124. /* */
  125. /************************************************/
  126. CMainFrame::CMainFrame()
  127. {
  128. CustomWndOpen = FALSE; // Whether edit open or not
  129. RefferWndVisible = FALSE; // Whether referrence visible or not
  130. ToolBarVisible = TRUE; // Whether toolbox visible or not
  131. GuideBarVisible = TRUE; // Whether guidebar visible or not
  132. }
  133. /************************************************/
  134. /* */
  135. /* Destructor */
  136. /* */
  137. /************************************************/
  138. CMainFrame::~CMainFrame()
  139. {
  140. }
  141. /************************************************/
  142. /* */
  143. /* Create MDI mainframe window */
  144. /* */
  145. /************************************************/
  146. BOOL
  147. CMainFrame::Create(
  148. LPCTSTR WndTitle,
  149. DWORD WndStyle,
  150. RECT MainWndRect,
  151. LPCTSTR nID)
  152. {
  153. // Register MDI mainframe window class
  154. const TCHAR *MainWndClass =
  155. AfxRegisterWndClass( 0, AfxGetApp()->LoadStandardCursor(IDC_ARROW),
  156. (HBRUSH)(COLOR_WINDOW+1),
  157. AfxGetApp()->LoadIcon(IDR_MAINFRAME));
  158. if( !CFrameWnd::Create( MainWndClass,
  159. WndTitle, WndStyle, MainWndRect, NULL, nID))
  160. return FALSE;
  161. return TRUE;
  162. }
  163. /************************************************/
  164. /* */
  165. /* Process before MDI mainframe create */
  166. /* */
  167. /************************************************/
  168. int
  169. CMainFrame::OnCreate(
  170. LPCREATESTRUCT lpCreateStruct)
  171. {
  172. if( CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  173. return -1;
  174. if( !LoadAccelTable( MAKEINTRESOURCE(IDR_MAINFRAME)))
  175. return -1;
  176. if( !CreateGuideBar())
  177. return -1;
  178. if( !CreateToolBar())
  179. return -1;
  180. EnableDocking(CBRS_ALIGN_ANY);
  181. if( !CreateReferWnd())
  182. return -1;
  183. m_wndToolBar.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_LEFT);
  184. DockControlBar(&m_wndToolBar);
  185. return 0;
  186. }
  187. /************************************************/
  188. /* */
  189. /* Create client area */
  190. /* */
  191. /************************************************/
  192. BOOL
  193. CMainFrame::OnCreateClient(
  194. LPCREATESTRUCT lpcs,
  195. CCreateContext *pContext)
  196. {
  197. if( !CMDIFrameWnd::CreateClient( lpcs, NULL))
  198. return FALSE;
  199. return TRUE;
  200. }
  201. /************************************************/
  202. /* */
  203. /* Create tool bar ( left side) */
  204. /* */
  205. /************************************************/
  206. BOOL
  207. CMainFrame::CreateToolBar()
  208. {
  209. if( !m_wndToolBar.Create( this, WS_CHILD | WS_VISIBLE | CBRS_LEFT |
  210. CBRS_TOOLTIPS, 0)||
  211. !m_wndToolBar.LoadBitmap( IDR_MAINFRAME) ||
  212. !m_wndToolBar.SetButtons( Palette,
  213. sizeof( Palette)/sizeof( UINT)))
  214. return FALSE;
  215. else
  216. return TRUE;
  217. }
  218. /************************************************/
  219. /* */
  220. /* Create Guideline bar ( upper side) */
  221. /* */
  222. /************************************************/
  223. BOOL
  224. CMainFrame::CreateGuideBar()
  225. {
  226. const UINT nIndicators[] = {IDS_CHARSET_STR,
  227. IDS_CODE_STR,
  228. IDS_FONT_STR,
  229. IDS_FILE_STR};
  230. if( !m_wndGuideBar.Create( this, ID_TOOLBAR) ||
  231. !m_wndGuideBar.SetIndicators(nIndicators,
  232. sizeof(nIndicators)/sizeof(UINT)))
  233. return FALSE;
  234. else{
  235. m_wndGuideBar.PositionStatusPane();
  236. return TRUE;
  237. }
  238. }
  239. /************************************************/
  240. /* */
  241. /* COMMAND "ASSOCIATIONS" */
  242. /* */
  243. /************************************************/
  244. void
  245. CMainFrame::OnSelectfamily()
  246. {
  247. CAssocDlg dlg;
  248. if( CustomWndOpen){
  249. if( !OutputSaveMessage())
  250. return;
  251. }
  252. if( dlg.DoModal() == IDOK){
  253. if( CustomWndOpen){
  254. pEditChild->UpdateBitmap();
  255. pEditChild->SelectCodes();
  256. }
  257. m_wndGuideBar.PositionStatusPane();
  258. }
  259. }
  260. /************************************************/
  261. /* */
  262. /* COMMAND "SELECTCODE" */
  263. /* */
  264. /************************************************/
  265. void
  266. CMainFrame::OnReadChar()
  267. {
  268. CEudcDlg dlg;
  269. HRESULT hresult;
  270. if( CustomWndOpen){
  271. if( !OutputSaveMessage())
  272. return;
  273. }
  274. dlg.WorRFlag = FALSE;
  275. if( dlg.DoModal() == IDOK){
  276. AfxGetApp()->DoWaitCursor(1);
  277. EudcWndRect.SetRectEmpty();
  278. if( !CustomWndOpen){
  279. // CalcEudcWndRect();
  280. CEditWnd *pEudcWnd = new CEditWnd;
  281. if( !pEudcWnd->Create( TEXT("EDITWINDOW"),
  282. WS_CHILD | WS_VISIBLE | WS_BORDER,
  283. EudcWndRect,this))
  284. return;
  285. pEditChild = pEudcWnd;
  286. SetEudcWndPos();
  287. pEudcWnd->ShowWindow( SW_SHOWNORMAL);
  288. pEudcWnd->UpdateWindow();
  289. CustomWndOpen = TRUE;
  290. }
  291. pEditChild->UpdateBitmap();
  292. pEditChild->UpdateCode = dlg.m_EditList.SelectCode;
  293. pEditChild->SelectCodes();
  294. //*STRSAFE* wsprintf( SelectEUDC.m_Code, TEXT("%X"), dlg.m_EditList.SelectCode);
  295. hresult = StringCchPrintf(SelectEUDC.m_Code , ARRAYLEN(SelectEUDC.m_Code), TEXT("%X"), dlg.m_EditList.SelectCode);
  296. if (!SUCCEEDED(hresult))
  297. {
  298. return;
  299. }
  300. CountryInfo.CurrentRange = dlg.m_EditList.cRange;
  301. m_wndGuideBar.PositionStatusPane();
  302. AfxGetApp()->DoWaitCursor( -1);
  303. }
  304. }
  305. /************************************************/
  306. /* */
  307. /* COMMAND "SELECTCODE" (Update) */
  308. /* */
  309. /************************************************/
  310. void
  311. CMainFrame::OnUpdateReadChar(
  312. CCmdUI* pCmdUI)
  313. {
  314. if( SelectEUDC.m_Font[0] != TEXT('\0') &&
  315. InqTypeFace((TCHAR *)SelectEUDC.m_Font,
  316. ( TCHAR *)SelectEUDC.m_File, sizeof( SelectEUDC.m_File)/sizeof(TCHAR)))
  317. pCmdUI->Enable( TRUE);
  318. else pCmdUI->Enable( FALSE);
  319. }
  320. /************************************************/
  321. /* */
  322. /* COMMAND "REGISTER" */
  323. /* */
  324. /************************************************/
  325. void
  326. CMainFrame::OnSavechar()
  327. {
  328. AfxGetApp()->DoWaitCursor(1);
  329. pEditChild->SaveEUDCCode(MB_OK);
  330. AfxGetApp()->DoWaitCursor(-1);
  331. }
  332. /************************************************/
  333. /* */
  334. /* COMMAND "REGISTER" (Update) */
  335. /* */
  336. /************************************************/
  337. void
  338. CMainFrame::OnUpdateSavechar(
  339. CCmdUI* pCmdUI)
  340. {
  341. if( InqTypeFace((TCHAR *)SelectEUDC.m_Font,
  342. ( TCHAR *)SelectEUDC.m_File,
  343. sizeof( SelectEUDC.m_File )/sizeof(TCHAR)) && CustomWndOpen)
  344. pCmdUI->Enable( TRUE);
  345. else pCmdUI->Enable( FALSE);
  346. }
  347. /************************************************/
  348. /* */
  349. /* COMMAND "REGISTER AS" */
  350. /* */
  351. /************************************************/
  352. void
  353. CMainFrame::OnSaveCharas()
  354. {
  355. CEudcDlg dlg;
  356. HRESULT hresult;
  357. dlg.WorRFlag = TRUE;
  358. if( dlg.DoModal() == IDOK){
  359. AfxGetApp()->DoWaitCursor(1);
  360. pEditChild->UpdateCode = dlg.m_EditList.SelectCode;
  361. pEditChild->SaveEUDCCode(MB_OK);
  362. //*STRSAFE* wsprintf( SelectEUDC.m_Code, TEXT("%X"), dlg.m_EditList.SelectCode);
  363. hresult = StringCchPrintf(SelectEUDC.m_Code , ARRAYLEN(SelectEUDC.m_Code), TEXT("%X"), dlg.m_EditList.SelectCode);
  364. if (!SUCCEEDED(hresult))
  365. {
  366. AfxGetApp()->DoWaitCursor(-1);
  367. return ;
  368. }
  369. CountryInfo.CurrentRange = dlg.m_EditList.cRange;
  370. m_wndGuideBar.PositionStatusPane();
  371. AfxGetApp()->DoWaitCursor(-1);
  372. }
  373. }
  374. /************************************************/
  375. /* */
  376. /* COMMAND "REGISTER AS" (Update) */
  377. /* */
  378. /************************************************/
  379. void
  380. CMainFrame::OnUpdateSaveCharas(
  381. CCmdUI* pCmdUI)
  382. {
  383. if( InqTypeFace((TCHAR *)SelectEUDC.m_Font,
  384. ( TCHAR *)SelectEUDC.m_File,
  385. sizeof( SelectEUDC.m_File )/sizeof(TCHAR)) && CustomWndOpen)
  386. pCmdUI->Enable( TRUE);
  387. else pCmdUI->Enable( FALSE);
  388. }
  389. /************************************************/
  390. /* */
  391. /* COMMAND "IMPORT" */
  392. /* */
  393. /************************************************/
  394. void
  395. CMainFrame::OnImportFile()
  396. {
  397. CImportDlg dlg1;
  398. BOOL Tmp = FALSE;
  399. if( CustomWndOpen){
  400. if( !OutputSaveMessage())
  401. return;
  402. }
  403. if (!OExistTTF(SelectEUDC.m_File))
  404. {
  405. OutputMessageBox(this->GetSafeHwnd(), IDS_MAINFRAMETITLE, IDS_NOTTE, TRUE);
  406. return;
  407. }
  408. if( dlg1.DoModal() == IDOK){
  409. if( CustomWndOpen){
  410. Tmp = FALSE;
  411. if( pEditChild->FlagTmp){
  412. Tmp = TRUE;
  413. this->SendMessage( WM_COMMAND,
  414. ID_FIT_CURVE, 0L);
  415. }
  416. }
  417. CGageDlg dlg2;
  418. if( dlg2.DoModal() == IDOK){
  419. ;
  420. }
  421. if( CustomWndOpen){
  422. if( Tmp){
  423. this->SendMessage( WM_COMMAND,
  424. ID_FIT_CURVE, 0L);
  425. }
  426. }
  427. }else ;
  428. }
  429. /************************************************/
  430. /* */
  431. /* COMMAND "IMPORT" (Update) */
  432. /* */
  433. /************************************************/
  434. void
  435. CMainFrame::OnUpdateImportFile(
  436. CCmdUI* pCmdUI)
  437. {
  438. if(InqTypeFace((TCHAR *)SelectEUDC.m_Font,
  439. (TCHAR *)SelectEUDC.m_File,
  440. sizeof( SelectEUDC.m_File)/sizeof(TCHAR)))
  441. pCmdUI->Enable( TRUE);
  442. else pCmdUI->Enable( FALSE);
  443. }
  444. /************************************************/
  445. /* */
  446. /* COMMAND "Select Charset" */
  447. /* */
  448. /************************************************/
  449. void
  450. CMainFrame::OnSelectCharSet()
  451. {
  452. CHAR CPCode[2];
  453. WCHAR UCode[1];
  454. CEudcDlg dlg;
  455. HRESULT hresult;
  456. UINT LocalCP =GetACP();
  457. if (m_wndGuideBar.m_comboCharset.GetCurSel() ==
  458. m_wndGuideBar.m_comboCharset.GetCount()-1){
  459. //We are switching to unicode.
  460. if ( CountryInfo.bUnicodeMode )
  461. // We are already in unicode mode. No change.
  462. return;
  463. CountryInfo.CurrentRange = CountryInfo.nRange-1;
  464. CountryInfo.bUnicodeMode =TRUE;
  465. SetTrailByteRange(LocalCP);
  466. if( SelectEUDC.m_Code[0] != '\0'){
  467. CPCode[0]= HIBYTE(Mytcstol(SelectEUDC.m_Code, (TCHAR **)0, 16));
  468. CPCode[1]= LOBYTE(Mytcstol(SelectEUDC.m_Code, (TCHAR **)0, 16));
  469. MultiByteToWideChar(LocalCP, 0, CPCode,2, UCode,1);
  470. //*STRSAFE* wsprintf( SelectEUDC.m_Code, TEXT("%X"),UCode[0]);
  471. hresult = StringCchPrintf(SelectEUDC.m_Code , ARRAYLEN(SelectEUDC.m_Code), TEXT("%X"),UCode[0]);
  472. if (!SUCCEEDED(hresult))
  473. {
  474. return ;
  475. }
  476. m_wndGuideBar.PositionStatusPane();
  477. pEditChild->UpdateCode = UCode[0];
  478. dlg.m_EditList.SelectCode = UCode[0];
  479. }
  480. }else{
  481. //We are switching to code page
  482. if ( !CountryInfo.bUnicodeMode )
  483. // We are already in code page mode. No change.
  484. return;
  485. CountryInfo.bUnicodeMode = FALSE;
  486. SetTrailByteRange(LocalCP);
  487. if( SelectEUDC.m_Code[0] != '\0'){
  488. BOOL bNotConverted;
  489. UCode[0] = (WCHAR)Mytcstol(SelectEUDC.m_Code, (TCHAR **)0, 16);
  490. WideCharToMultiByte(LocalCP, 0,UCode,1, CPCode,2, NULL, &bNotConverted);
  491. TCHAR CodeTmp[16] = {0};
  492. BOOL bValidCode = TRUE;
  493. if (CountryInfo.LangID == EUDC_CHS)
  494. {
  495. bValidCode = FALSE;
  496. WORD wdCode = MAKEWORD(CPCode[1], CPCode[0]);
  497. BYTE sOffset = LOBYTE(wdCode);
  498. int kk;
  499. for (kk = 0; kk < CountryInfo.nRange-1; kk++)
  500. {
  501. if ((wdCode >= CountryInfo.sRange[kk]) &&
  502. (wdCode <= CountryInfo.eRange[kk]))
  503. break;
  504. }
  505. CorrectTrailByteRange(kk);
  506. for( kk = 0; kk < CountryInfo.nTralByte; kk++)
  507. {
  508. if( sOffset >= CountryInfo.sTralByte[kk] &&
  509. sOffset <= CountryInfo.eTralByte[kk])
  510. {
  511. bValidCode = TRUE;
  512. break;
  513. }
  514. }
  515. }
  516. if (bNotConverted || !bValidCode){
  517. OutputMessageBox( this->GetSafeHwnd(),
  518. IDS_MAINFRAMETITLE,
  519. IDS_INVALID_CODE_MSG, TRUE);
  520. if( CustomWndOpen){
  521. CountryInfo.bUnicodeMode = TRUE;
  522. OutputSaveMessage();
  523. CountryInfo.bUnicodeMode = FALSE;
  524. }
  525. CountryInfo.CurrentRange = 0;
  526. dlg.m_EditList.SetInitEUDCCodeRange(CountryInfo.CurrentRange);
  527. dlg.m_EditList.SelectCode=CountryInfo.sRange[CountryInfo.CurrentRange];
  528. pEditChild->SelectCodes();
  529. //*STRSAFE* wsprintf( SelectEUDC.m_Code, TEXT("%X"), dlg.m_EditList.SelectCode);
  530. hresult = StringCchPrintf(SelectEUDC.m_Code , ARRAYLEN(SelectEUDC.m_Code), TEXT("%X"), dlg.m_EditList.SelectCode);
  531. if (!SUCCEEDED(hresult))
  532. {
  533. return ;
  534. }
  535. OnReadChar();
  536. return;
  537. }else{
  538. //*STRSAFE* wsprintf( CodeTmp, TEXT("%X"), (BYTE)CPCode[0]);
  539. hresult = StringCchPrintf(CodeTmp , ARRAYLEN(CodeTmp), TEXT("%X"), (BYTE)CPCode[0]);
  540. if (!SUCCEEDED(hresult))
  541. {
  542. return ;
  543. }
  544. SelectEUDC.m_Code[0] = CodeTmp[0];
  545. SelectEUDC.m_Code[1] = CodeTmp[1];
  546. //*STRSAFE* wsprintf( CodeTmp, TEXT("%X"), (BYTE)CPCode[1]);
  547. hresult = StringCchPrintf(CodeTmp , ARRAYLEN(CodeTmp), TEXT("%X"), (BYTE)CPCode[1]);
  548. if (!SUCCEEDED(hresult))
  549. {
  550. return ;
  551. }
  552. SelectEUDC.m_Code[2] = CodeTmp[0];
  553. SelectEUDC.m_Code[3] = CodeTmp[1];
  554. dlg.m_EditList.SelectCode = (WORD)Mytcstol(SelectEUDC.m_Code, (TCHAR **)0, 16);
  555. for (int i=0;i<CountryInfo.nRange - 1; i++)
  556. {
  557. if (dlg.m_EditList.SelectCode >= CountryInfo.sRange[i] &&
  558. dlg.m_EditList.SelectCode <= CountryInfo.eRange[i])
  559. {
  560. CountryInfo.CurrentRange = i;
  561. }
  562. }
  563. }
  564. m_wndGuideBar.PositionStatusPane();
  565. pEditChild->UpdateCode = dlg.m_EditList.SelectCode;
  566. }
  567. else
  568. {
  569. CountryInfo.CurrentRange = 0;
  570. }
  571. }
  572. dlg.m_EditList.SetInitEUDCCodeRange( CountryInfo.CurrentRange);
  573. }
  574. /************************************************/
  575. /* */
  576. /* COMMAND "CALL" */
  577. /* */
  578. /************************************************/
  579. void
  580. CMainFrame::OnCallChar()
  581. {
  582. UINT Result;
  583. if( CustomWndOpen){
  584. if( !OutputSaveMessage())
  585. return;
  586. }
  587. if(( Result = SetReffCode( TRUE)) == IDOK){
  588. pEditChild->UpdateBitmap();
  589. pEditChild->CallCharTextOut();
  590. }
  591. }
  592. /************************************************/
  593. /* */
  594. /* COMMAND "CALL" (Update) */
  595. /* */
  596. /************************************************/
  597. void
  598. CMainFrame::OnUpdateCallChar(
  599. CCmdUI* pCmdUI)
  600. {
  601. if( CustomWndOpen)
  602. pCmdUI->Enable( TRUE);
  603. else pCmdUI->Enable( FALSE);
  604. }
  605. /************************************************/
  606. /* */
  607. /* COMMAND "LINK" */
  608. /* */
  609. /************************************************/
  610. void
  611. CMainFrame::OnLinkime()
  612. {
  613. #if 0
  614. CIMEDlg dlg;
  615. dlg.EudcCode = pEditChild->UpdateCode;
  616. dlg.DoModal();
  617. #endif
  618. ImeLink( this->GetSafeHwnd(),
  619. pEditChild->UpdateCode,
  620. CountryInfo.bUnicodeMode ? TRUE : FALSE,
  621. AfxGetInstanceHandle());
  622. }
  623. /************************************************/
  624. /* */
  625. /* COMMAND "LINK" (Update) */
  626. /* */
  627. /************************************************/
  628. void
  629. CMainFrame::OnUpdateLinkime(
  630. CCmdUI* pCmdUI)
  631. {
  632. if( CustomWndOpen &&
  633. ( CountryInfo.LangID == EUDC_CHT ||
  634. CountryInfo.LangID == EUDC_CHS )){
  635. pCmdUI->Enable(TRUE);
  636. }else pCmdUI->Enable(FALSE);
  637. }
  638. /************************************************/
  639. /* */
  640. /* COMMAND "BATCHLINK" */
  641. /* */
  642. /************************************************/
  643. void
  644. CMainFrame::OnLinkbatchmode()
  645. {
  646. CBLinkDlg dlg;
  647. dlg.DoModal();
  648. }
  649. /************************************************/
  650. /* */
  651. /* COMMAND "BATCHLINK" (Update) */
  652. /* */
  653. /************************************************/
  654. void
  655. CMainFrame::OnUpdateLinkbatchmode(
  656. CCmdUI* pCmdUI)
  657. {
  658. #ifdef BUILD_ON_WINNT
  659. //
  660. // IME batch link should be font independent feature
  661. // and available after launch EUDCEDIT. The batch link
  662. // menu item is grayed after launching EUDCEDIT.
  663. // It will be enabled after font association and EUDC
  664. // code are selected.
  665. // But font association and EUDC code selection do not
  666. // have any relationship with IME batch link.
  667. // The user does not need to select font association
  668. // and EUDC code if they want to do IME batch link only.
  669. //
  670. // NTRaid #19424.
  671. //
  672. if( CountryInfo.LangID == EUDC_CHT ||
  673. CountryInfo.LangID == EUDC_CHS ){
  674. pCmdUI->Enable(TRUE);
  675. }else pCmdUI->Enable(FALSE);
  676. #else
  677. if( CustomWndOpen &&
  678. ( CountryInfo.LangID == EUDC_CHT ||
  679. CountryInfo.LangID == EUDC_CHS )){
  680. pCmdUI->Enable(TRUE);
  681. }else pCmdUI->Enable(FALSE);
  682. #endif // BUILD_ON_WINNT
  683. }
  684. /************************************************/
  685. /* */
  686. /* COMMAND "GUIDEBAR" */
  687. /* */
  688. /************************************************/
  689. BOOL
  690. CMainFrame::OnStylesBar(
  691. UINT nID)
  692. {
  693. GuideBarVisible = !GuideBarVisible;
  694. if( GuideBarVisible)
  695. m_wndGuideBar.ShowWindow(SW_SHOWNA);
  696. else m_wndGuideBar.ShowWindow(SW_HIDE);
  697. m_wndGuideBar.PositionStatusPane();
  698. this->SendMessage( WM_SIZE);
  699. return TRUE;
  700. }
  701. /************************************************/
  702. /* */
  703. /* COMMAND "GUIDEBAR" (Update) */
  704. /* */
  705. /************************************************/
  706. void
  707. CMainFrame::OnUpdateStylesBar(
  708. CCmdUI* pCmdUI)
  709. {
  710. if (pCmdUI)
  711. {
  712. pCmdUI->SetCheck(GuideBarVisible);
  713. }
  714. }
  715. /************************************************/
  716. /* */
  717. /* COMMAND "TOOLBOX" */
  718. /* */
  719. /************************************************/
  720. void
  721. CMainFrame::OnToolbar()
  722. {
  723. ToolBarVisible = !ToolBarVisible;
  724. if( ToolBarVisible)
  725. {
  726. DockControlBar(&m_wndToolBar);
  727. m_wndToolBar.ShowWindow( SW_SHOWNORMAL);
  728. }else{
  729. if (m_wndToolBar.IsFloating())
  730. {
  731. m_wndToolBar.GetParentOwner()->ShowWindow( SW_HIDE);
  732. }
  733. else
  734. {
  735. m_wndToolBar.ShowWindow( SW_HIDE);
  736. }
  737. }
  738. this->SendMessage(WM_SIZE);
  739. }
  740. /************************************************/
  741. /* */
  742. /* COMMAND "TOOLBOX" (Update) */
  743. /* */
  744. /************************************************/
  745. void
  746. CMainFrame::OnUpdateToolbar(
  747. CCmdUI* pCmdUI)
  748. {
  749. ToolBarVisible = m_wndToolBar.IsWindowVisible();
  750. pCmdUI->SetCheck(ToolBarVisible);
  751. }
  752. /************************************************/
  753. /* */
  754. /* COMMAND "GRID" */
  755. /* */
  756. /************************************************/
  757. void
  758. CMainFrame::OnShowGrid()
  759. {
  760. pEditChild->GridShow = !pEditChild->GridShow;
  761. pEditChild->Invalidate( FALSE);
  762. pEditChild->UpdateWindow();
  763. if( RefferWndVisible){
  764. pRefrChild->GridShow = !pRefrChild->GridShow;
  765. pRefrChild->Invalidate(FALSE);
  766. pRefrChild->UpdateWindow();
  767. }
  768. }
  769. /************************************************/
  770. /* */
  771. /* COMMAND "GRID" (Update) */
  772. /* */
  773. /************************************************/
  774. void
  775. CMainFrame::OnUpdateShowGrid(
  776. CCmdUI* pCmdUI)
  777. {
  778. if( CustomWndOpen){
  779. pCmdUI->Enable(1);
  780. pCmdUI->SetCheck( pEditChild->GridShow);
  781. }else pCmdUI->Enable(0);
  782. }
  783. /************************************************/
  784. /* */
  785. /* COMMAND "NEXT CODE" */
  786. /* */
  787. /************************************************/
  788. void
  789. CMainFrame::OnNextcode()
  790. {
  791. HRESULT hresult;
  792. if( CustomWndOpen){
  793. if( !OutputSaveMessage())
  794. return;
  795. }
  796. EudcWndRect.SetRectEmpty();
  797. pEditChild->UpdateBitmap();
  798. pEditChild->UpdateCode++;
  799. pEditChild->UpdateCode = CorrectCode( pEditChild->UpdateCode, TRUE);
  800. pEditChild->SelectCodes();
  801. //*STRSAFE* wsprintf( SelectEUDC.m_Code, TEXT("%X"), pEditChild->UpdateCode);
  802. hresult = StringCchPrintf(SelectEUDC.m_Code , ARRAYLEN(SelectEUDC.m_Code), TEXT("%X"), pEditChild->UpdateCode);
  803. if (!SUCCEEDED(hresult))
  804. {
  805. return ;
  806. }
  807. m_wndGuideBar.PositionStatusPane();
  808. }
  809. /************************************************/
  810. /* */
  811. /* COMMAND "NEXT CODE" (Update) */
  812. /* */
  813. /************************************************/
  814. void
  815. CMainFrame::OnUpdateNextcode(
  816. CCmdUI* pCmdUI)
  817. {
  818. if( CustomWndOpen &&
  819. ( InqTypeFace((TCHAR *)SelectEUDC.m_Font,
  820. (TCHAR *)SelectEUDC.m_File, sizeof( SelectEUDC.m_File)/sizeof(TCHAR)))){
  821. if( CountryInfo.eRange[CountryInfo.CurrentRange]
  822. <= pEditChild->UpdateCode)
  823. pCmdUI->Enable( FALSE);
  824. else pCmdUI->Enable( TRUE);
  825. }else pCmdUI->Enable( FALSE);
  826. }
  827. /************************************************/
  828. /* */
  829. /* COMMAND "PREV CODE" */
  830. /* */
  831. /************************************************/
  832. void
  833. CMainFrame::OnPrevcode()
  834. {
  835. HRESULT hresult;
  836. if( CustomWndOpen){
  837. if( !OutputSaveMessage())
  838. return;
  839. }
  840. EudcWndRect.SetRectEmpty();
  841. pEditChild->UpdateBitmap();
  842. pEditChild->UpdateCode--;
  843. pEditChild->UpdateCode = CorrectCode( pEditChild->UpdateCode, FALSE);
  844. pEditChild->SelectCodes();
  845. //*STRSAFE* wsprintf( SelectEUDC.m_Code, TEXT("%X"), pEditChild->UpdateCode);
  846. hresult = StringCchPrintf(SelectEUDC.m_Code , ARRAYLEN(SelectEUDC.m_Code), TEXT("%X"), pEditChild->UpdateCode);
  847. if (!SUCCEEDED(hresult))
  848. {
  849. return ;
  850. }
  851. m_wndGuideBar.PositionStatusPane();
  852. }
  853. /************************************************/
  854. /* */
  855. /* COMMAND "PREV CODE" (Update) */
  856. /* */
  857. /************************************************/
  858. void
  859. CMainFrame::OnUpdatePrevcode(
  860. CCmdUI* pCmdUI)
  861. {
  862. if( CustomWndOpen &&
  863. ( InqTypeFace((TCHAR *)SelectEUDC.m_Font,
  864. (TCHAR *)SelectEUDC.m_File, sizeof( SelectEUDC.m_File)/sizeof(TCHAR)))){
  865. if( CountryInfo.sRange[CountryInfo.CurrentRange]
  866. >= pEditChild->UpdateCode)
  867. pCmdUI->Enable( FALSE);
  868. else pCmdUI->Enable( TRUE);
  869. }else pCmdUI->Enable( FALSE);
  870. }
  871. /************************************************/
  872. /* */
  873. /* COMMAND "SHOW OUTLINE" */
  874. /* */
  875. /************************************************/
  876. void
  877. CMainFrame::OnFitCurve()
  878. {
  879. if( CustomWndOpen){
  880. pEditChild->FlagTmp = !pEditChild->FlagTmp;
  881. pEditChild->Invalidate(FALSE);
  882. pEditChild->UpdateWindow();
  883. }
  884. }
  885. /************************************************/
  886. /* */
  887. /* COMMAND "SHOW OUTLINE"(Update) */
  888. /* */
  889. /************************************************/
  890. void
  891. CMainFrame::OnUpdateFitCurve(
  892. CCmdUI* pCmdUI)
  893. {
  894. if( CustomWndOpen){
  895. pCmdUI->Enable(TRUE);
  896. pCmdUI->SetCheck( pEditChild->FlagTmp);
  897. }else pCmdUI->Enable(FALSE);
  898. }
  899. /************************************************/
  900. /* */
  901. /* COMMAND "PEN" */
  902. /* */
  903. /************************************************/
  904. void
  905. CMainFrame::OnPalettepen()
  906. {
  907. pEditChild->SelectItem = PEN;
  908. pEditChild->WriteSelRectBitmap();
  909. pEditChild->MDIActivate();
  910. }
  911. /************************************************/
  912. /* */
  913. /* COMMAND "PEN" (Update) */
  914. /* */
  915. /************************************************/
  916. void
  917. CMainFrame::OnUpdatePalettepen(
  918. CCmdUI* pCmdUI)
  919. {
  920. if( CustomWndOpen){
  921. pCmdUI->Enable( TRUE);
  922. if( pEditChild->SelectItem == PEN)
  923. pCmdUI->SetRadio( TRUE);
  924. else pCmdUI->SetRadio( FALSE);
  925. }else pCmdUI->Enable( FALSE);
  926. }
  927. /************************************************/
  928. /* */
  929. /* COMMAND "BRUSh" */
  930. /* */
  931. /************************************************/
  932. void
  933. CMainFrame::OnPalettebrush()
  934. {
  935. pEditChild->SelectItem = BRUSH;
  936. pEditChild->WriteSelRectBitmap();
  937. pEditChild->MDIActivate();
  938. }
  939. /************************************************/
  940. /* */
  941. /* COMMAND "BRUSH" (Update) */
  942. /* */
  943. /************************************************/
  944. void
  945. CMainFrame::OnUpdatePalettebrush(
  946. CCmdUI* pCmdUI)
  947. {
  948. if( CustomWndOpen){
  949. pCmdUI->Enable( TRUE);
  950. if( pEditChild->SelectItem == BRUSH)
  951. pCmdUI->SetRadio( TRUE);
  952. else pCmdUI->SetRadio( FALSE);
  953. }else pCmdUI->Enable( FALSE);
  954. }
  955. /************************************************/
  956. /* */
  957. /* COMMAND "STRAIGHT LINE" */
  958. /* */
  959. /************************************************/
  960. void
  961. CMainFrame::OnPaletteslope()
  962. {
  963. pEditChild->SelectItem = SLOPE;
  964. pEditChild->WriteSelRectBitmap();
  965. pEditChild->MDIActivate();
  966. }
  967. /************************************************/
  968. /* */
  969. /* COMMAND "STRAIGHT LINE"(Update) */
  970. /* */
  971. /************************************************/
  972. void
  973. CMainFrame::OnUpdatePaletteslope(
  974. CCmdUI* pCmdUI)
  975. {
  976. if( CustomWndOpen){
  977. pCmdUI->Enable( TRUE);
  978. if( pEditChild->SelectItem == SLOPE)
  979. pCmdUI->SetRadio( TRUE);
  980. else pCmdUI->SetRadio( FALSE);
  981. }else pCmdUI->Enable( FALSE);
  982. }
  983. /************************************************/
  984. /* */
  985. /* COMMAND "RECTANGLE" */
  986. /* */
  987. /************************************************/
  988. void
  989. CMainFrame::OnPaletterect()
  990. {
  991. pEditChild->SelectItem = RECTBAND;
  992. pEditChild->WriteSelRectBitmap();
  993. pEditChild->MDIActivate();
  994. }
  995. /************************************************/
  996. /* */
  997. /* COMMAND "RECTANGLE" (Update) */
  998. /* */
  999. /************************************************/
  1000. void
  1001. CMainFrame::OnUpdatePaletterect(
  1002. CCmdUI* pCmdUI)
  1003. {
  1004. if( CustomWndOpen){
  1005. pCmdUI->Enable( TRUE);
  1006. if( pEditChild->SelectItem == RECTBAND)
  1007. pCmdUI->SetRadio( TRUE);
  1008. else pCmdUI->SetRadio( FALSE);
  1009. }else pCmdUI->Enable( FALSE);
  1010. }
  1011. /************************************************/
  1012. /* */
  1013. /* COMMAND "FILRECTANGLE" */
  1014. /* */
  1015. /************************************************/
  1016. void
  1017. CMainFrame::OnPaletterectfill()
  1018. {
  1019. pEditChild->SelectItem = RECTFILL;
  1020. pEditChild->WriteSelRectBitmap();
  1021. pEditChild->MDIActivate();
  1022. }
  1023. /************************************************/
  1024. /* */
  1025. /* COMMAND "FILRECTANGLE" (Update) */
  1026. /* */
  1027. /************************************************/
  1028. void
  1029. CMainFrame::OnUpdatePaletterectfill(
  1030. CCmdUI* pCmdUI)
  1031. {
  1032. if( CustomWndOpen){
  1033. pCmdUI->Enable( TRUE);
  1034. if( pEditChild->SelectItem == RECTFILL)
  1035. pCmdUI->SetRadio( TRUE);
  1036. else pCmdUI->SetRadio( FALSE);
  1037. }else pCmdUI->Enable( FALSE);
  1038. }
  1039. /************************************************/
  1040. /* */
  1041. /* COMMAND "CIRCLE" */
  1042. /* */
  1043. /************************************************/
  1044. void
  1045. CMainFrame::OnPalettecircle()
  1046. {
  1047. pEditChild->SelectItem = CIRCLE;
  1048. pEditChild->WriteSelRectBitmap();
  1049. pEditChild->MDIActivate();
  1050. }
  1051. /************************************************/
  1052. /* */
  1053. /* COMMAND "CIRCLE" (Update) */
  1054. /* */
  1055. /************************************************/
  1056. void
  1057. CMainFrame::OnUpdatePalettecircle(
  1058. CCmdUI* pCmdUI)
  1059. {
  1060. if( CustomWndOpen){
  1061. pCmdUI->Enable( TRUE);
  1062. if( pEditChild->SelectItem == CIRCLE)
  1063. pCmdUI->SetRadio( TRUE);
  1064. else pCmdUI->SetRadio( FALSE);
  1065. }else pCmdUI->Enable( FALSE);
  1066. }
  1067. /************************************************/
  1068. /* */
  1069. /* COMMAND "FILCIRCLE" */
  1070. /* */
  1071. /************************************************/
  1072. void
  1073. CMainFrame::OnPalettecirclefill()
  1074. {
  1075. pEditChild->SelectItem = CIRCLEFILL;
  1076. pEditChild->WriteSelRectBitmap();
  1077. pEditChild->MDIActivate();
  1078. }
  1079. /************************************************/
  1080. /* */
  1081. /* COMMAND "FILCIRCLE" (Update) */
  1082. /* */
  1083. /************************************************/
  1084. void
  1085. CMainFrame::OnUpdatePalettecirclefill(
  1086. CCmdUI* pCmdUI)
  1087. {
  1088. if( CustomWndOpen){
  1089. pCmdUI->Enable( TRUE);
  1090. if( pEditChild->SelectItem == CIRCLEFILL)
  1091. pCmdUI->SetRadio( TRUE);
  1092. else pCmdUI->SetRadio( FALSE);
  1093. }else pCmdUI->Enable( FALSE);
  1094. }
  1095. /************************************************/
  1096. /* */
  1097. /* COMMAND "FREEFORM" */
  1098. /* */
  1099. /************************************************/
  1100. void
  1101. CMainFrame::OnPalettefreeform()
  1102. {
  1103. pEditChild->SelectItem = FREEFORM;
  1104. pRefrChild->SelectItems = FREEFORM;
  1105. pEditChild->WriteSelRectBitmap();
  1106. pEditChild->MDIActivate();
  1107. }
  1108. /************************************************/
  1109. /* */
  1110. /* COMMAND "FREEFORM" (Update) */
  1111. /* */
  1112. /************************************************/
  1113. void
  1114. CMainFrame::OnUpdatePalettefreeform(
  1115. CCmdUI* pCmdUI)
  1116. {
  1117. if( CustomWndOpen){
  1118. pCmdUI->Enable( TRUE);
  1119. if( pEditChild->SelectItem == FREEFORM)
  1120. pCmdUI->SetRadio( TRUE);
  1121. else pCmdUI->SetRadio( FALSE);
  1122. }else pCmdUI->Enable( FALSE);
  1123. }
  1124. /************************************************/
  1125. /* */
  1126. /* COMMAND "ERASER" */
  1127. /* */
  1128. /************************************************/
  1129. void
  1130. CMainFrame::OnPaletteeraser()
  1131. {
  1132. pEditChild->SelectItem = ERASER;
  1133. pEditChild->WriteSelRectBitmap();
  1134. pEditChild->MDIActivate();
  1135. }
  1136. /************************************************/
  1137. /* */
  1138. /* COMMAND "ERASER" (Update) */
  1139. /* */
  1140. /************************************************/
  1141. void
  1142. CMainFrame::OnUpdatePaletteeraser(
  1143. CCmdUI* pCmdUI)
  1144. {
  1145. if( CustomWndOpen){
  1146. pCmdUI->Enable( TRUE);
  1147. if( pEditChild->SelectItem == ERASER)
  1148. pCmdUI->SetRadio( TRUE);
  1149. else pCmdUI->SetRadio( FALSE);
  1150. }else pCmdUI->Enable( FALSE);
  1151. }
  1152. /************************************************/
  1153. /* */
  1154. /* COMMAND "RECTBAND" */
  1155. /* */
  1156. /************************************************/
  1157. void
  1158. CMainFrame::OnPaletterectband()
  1159. {
  1160. pEditChild->SelectItem = RECTCLIP;
  1161. pRefrChild->SelectItems = RECTCLIP;
  1162. pEditChild->WriteSelRectBitmap();
  1163. pEditChild->MDIActivate();
  1164. }
  1165. /************************************************/
  1166. /* */
  1167. /* COMMAND "RECTBAND"(Update) */
  1168. /* */
  1169. /************************************************/
  1170. void
  1171. CMainFrame::OnUpdatePaletterectband(
  1172. CCmdUI* pCmdUI)
  1173. {
  1174. if( CustomWndOpen){
  1175. pCmdUI->Enable( TRUE);
  1176. if( pEditChild->SelectItem == RECTCLIP)
  1177. pCmdUI->SetRadio( TRUE);
  1178. else pCmdUI->SetRadio( FALSE);
  1179. }else pCmdUI->Enable( FALSE);
  1180. }
  1181. /************************************************/
  1182. /* */
  1183. /* COMMAND "FLIP/ROTATE" */
  1184. /* */
  1185. /************************************************/
  1186. void
  1187. CMainFrame::OnRotate()
  1188. {
  1189. CRotateDlg dlg;
  1190. if( CustomWndOpen){
  1191. if( dlg.DoModal() == IDOK){
  1192. pEditChild->FlipRotate( dlg.RadioItem);
  1193. }
  1194. }
  1195. }
  1196. /************************************************/
  1197. /* */
  1198. /* COMMAND "FLIP/ROTATE" (Update) */
  1199. /* */
  1200. /************************************************/
  1201. void
  1202. CMainFrame::OnUpdateRotate(
  1203. CCmdUI* pCmdUI)
  1204. {
  1205. if( CustomWndOpen){
  1206. pCmdUI->Enable(TRUE);
  1207. }else pCmdUI->Enable(FALSE);
  1208. }
  1209. /************************************************/
  1210. /* */
  1211. /* COMMAND "REFERRENCE" */
  1212. /* */
  1213. /************************************************/
  1214. void
  1215. CMainFrame::OnRefferfileNew()
  1216. {
  1217. UINT Result;
  1218. if( !RefferWndVisible){
  1219. if(( Result = SetReffCode( FALSE)) == IDOK){
  1220. SetReffWndPos();
  1221. pRefrChild->UpdateBitmap();
  1222. pRefrChild->GridShow = pEditChild->GridShow;
  1223. pRefrChild->ShowWindow(SW_SHOWNORMAL);
  1224. pRefrChild->UpdateWindow();
  1225. RefferWndVisible = TRUE;
  1226. if( CustomWndOpen)
  1227. SetEudcWndPos();
  1228. }
  1229. }else{
  1230. if(( Result = SetReffCode( FALSE)) == IDOK){
  1231. pRefrChild->UpdateBitmap();
  1232. }
  1233. }
  1234. }
  1235. /************************************************/
  1236. /* */
  1237. /* COMMAND "REFERRENCE" (Update) */
  1238. /* */
  1239. /************************************************/
  1240. void
  1241. CMainFrame::OnUpdateRefferfileNew(
  1242. CCmdUI* pCmdUI)
  1243. {
  1244. pCmdUI->Enable( CustomWndOpen);
  1245. }
  1246. /************************************************/
  1247. /* */
  1248. /* COMMAND "CLOSE REF" */
  1249. /* */
  1250. /************************************************/
  1251. void
  1252. CMainFrame::OnRefferClose()
  1253. {
  1254. RefferWndVisible = FALSE;
  1255. pRefrChild->ShowWindow( SW_HIDE);
  1256. pRefrChild->UpdateWindow();
  1257. SetEudcWndPos();
  1258. }
  1259. /************************************************/
  1260. /* */
  1261. /* COMMAND "CLOSE REF"(Update) */
  1262. /* */
  1263. /************************************************/
  1264. void
  1265. CMainFrame::OnUpdateRefferClose(
  1266. CCmdUI* pCmdUI)
  1267. {
  1268. pCmdUI->Enable(RefferWndVisible);
  1269. }
  1270. /************************************************/
  1271. /* */
  1272. /* COMMAND "HELP TOPICS" */
  1273. /* */
  1274. /************************************************/
  1275. void
  1276. CMainFrame::OnHelp()
  1277. {
  1278. if( this->IsWindowEnabled())
  1279. {
  1280. ::HtmlHelp (this->GetSafeHwnd(), TEXT("eudcedit.chm"), HH_DISPLAY_TOPIC,(DWORD)0);
  1281. }
  1282. }
  1283. /************************************************/
  1284. /* */
  1285. /* if bitmap is dirty, output message */
  1286. /* */
  1287. /************************************************/
  1288. BOOL
  1289. CMainFrame::OutputSaveMessage()
  1290. {
  1291. int Result;
  1292. Result = IDYES;
  1293. if( pEditChild->GetBitmapDirty()){
  1294. Result = OutputMessageBox( this->GetSafeHwnd(),
  1295. IDS_MAINFRAMETITLE,
  1296. IDS_SAVEORNOT, FALSE);
  1297. if( Result == IDYES){
  1298. AfxGetApp()->DoWaitCursor(1);
  1299. if (!pEditChild->SaveEUDCCode(MB_OKCANCEL))
  1300. Result = IDCANCEL;
  1301. AfxGetApp()->DoWaitCursor(-1);
  1302. }else if( Result == IDNO){
  1303. pEditChild->SetBitmapDirty( FALSE);
  1304. }
  1305. }
  1306. if( Result == IDCANCEL)
  1307. return FALSE;
  1308. else return TRUE;
  1309. }
  1310. /************************************************/
  1311. /* */
  1312. /* Create refferrence window */
  1313. /* */
  1314. /************************************************/
  1315. BOOL
  1316. CMainFrame::CreateReferWnd()
  1317. {
  1318. ReffWndRect.SetRectEmpty();
  1319. CalcReffWndRect();
  1320. CRefrWnd *pReffWnd = new CRefrWnd;
  1321. if( !pReffWnd->Create( TEXT("REFERWINDOW"),
  1322. WS_CHILD | WS_BORDER, ReffWndRect, this))
  1323. return FALSE;
  1324. pRefrChild = pReffWnd;
  1325. RefferWndVisible = FALSE;
  1326. return TRUE;
  1327. }
  1328. /************************************************/
  1329. /* */
  1330. /* Change size of edit window */
  1331. /* */
  1332. /************************************************/
  1333. void
  1334. CMainFrame::SetEudcWndPos()
  1335. {
  1336. CalcEudcWndRect();
  1337. pEditChild->MoveWindow( EudcWndRect.left, EudcWndRect.top,
  1338. EudcWndRect.Width(), EudcWndRect.Height(), TRUE);
  1339. }
  1340. /************************************************/
  1341. /* */
  1342. /* Calcurate size of edit window */
  1343. /* */
  1344. /************************************************/
  1345. void
  1346. CMainFrame::CalcEudcWndRect()
  1347. {
  1348. CRect CalcRect;
  1349. CSize Frame;
  1350. int Twice;
  1351. int Remain;
  1352. //
  1353. // Try to determine the proper value of the Frame. Can be
  1354. // different depending with Theme is used. The Luna Theme
  1355. // take more prixel for the width of the frame.
  1356. //
  1357. CRect* FrameBefore = new CRect(0, 0, BITMAP_WIDTH, BITMAP_HEIGHT);
  1358. if (FrameBefore == NULL)
  1359. {
  1360. return;
  1361. }
  1362. CRect FrameAfter;
  1363. pEditChild->MoveWindow(FrameBefore, TRUE);
  1364. pEditChild->GetClientRect(&FrameAfter);
  1365. Frame.cx = FrameBefore->Width() - FrameAfter.Width();
  1366. Frame.cy = FrameBefore->Height() - FrameAfter.Height();
  1367. GetClientRect( &EudcWndRect);
  1368. if( GuideBarVisible){
  1369. m_wndGuideBar.GetWindowRect( &CalcRect);
  1370. EudcWndRect.bottom -= CalcRect.Height();
  1371. }
  1372. if( ToolBarVisible){
  1373. m_wndToolBar.GetWindowRect( &CalcRect);
  1374. EudcWndRect.right -= CalcRect.Width();
  1375. }
  1376. if( RefferWndVisible)
  1377. EudcWndRect.right = EudcWndRect.right /2;
  1378. if( EudcWndRect.Width() < EudcWndRect.Height()){
  1379. Twice = EudcWndRect.Width() /BITMAP_WIDTH;
  1380. Remain = EudcWndRect.Width() %BITMAP_WIDTH;
  1381. if( Remain < Frame.cx )
  1382. Twice -= 1;
  1383. if( Twice <= 0) Twice = 1;
  1384. EudcWndRect.left = 0;
  1385. EudcWndRect.right = EudcWndRect.left + BITMAP_WIDTH *Twice
  1386. + Frame.cx;
  1387. EudcWndRect.bottom = BITMAP_HEIGHT*Twice + Frame.cy
  1388. + CAPTION_HEIGHT;
  1389. }else{
  1390. Twice = EudcWndRect.Height() /BITMAP_HEIGHT;
  1391. Remain = EudcWndRect.Height() %BITMAP_HEIGHT;
  1392. if( Remain < CAPTION_HEIGHT + Frame.cy )
  1393. Twice -= 1;
  1394. if( Twice <= 0) Twice = 1;
  1395. EudcWndRect.left = 0;
  1396. EudcWndRect.right = EudcWndRect.left + BITMAP_WIDTH *Twice
  1397. + Frame.cx;
  1398. EudcWndRect.bottom = BITMAP_HEIGHT*Twice + Frame.cy + CAPTION_HEIGHT;
  1399. }
  1400. delete FrameBefore;
  1401. }
  1402. /************************************************/
  1403. /* */
  1404. /* Change size of referrence window */
  1405. /* */
  1406. /************************************************/
  1407. void
  1408. CMainFrame::SetReffWndPos()
  1409. {
  1410. CalcReffWndRect();
  1411. pRefrChild->MoveWindow( ReffWndRect.left, ReffWndRect.top,
  1412. ReffWndRect.Width(), ReffWndRect.Height(), TRUE);
  1413. }
  1414. /************************************************/
  1415. /* */
  1416. /* Calcurate size of referrence window */
  1417. /* */
  1418. /************************************************/
  1419. void
  1420. CMainFrame::CalcReffWndRect()
  1421. {
  1422. CRect CalcRect;
  1423. CSize Frame;
  1424. int Twice;
  1425. int Remain;
  1426. Frame.cx = ( GetSystemMetrics( SM_CXFRAME)
  1427. - GetSystemMetrics( SM_CXBORDER)) * 2;
  1428. Frame.cy = ( GetSystemMetrics( SM_CYFRAME)
  1429. - GetSystemMetrics( SM_CYBORDER)) * 2;
  1430. GetClientRect( &ReffWndRect);
  1431. if( GuideBarVisible){
  1432. m_wndGuideBar.GetWindowRect( &CalcRect);
  1433. ReffWndRect.bottom -= CalcRect.Height();
  1434. }
  1435. if( ToolBarVisible){
  1436. m_wndToolBar.GetWindowRect( &CalcRect);
  1437. ReffWndRect.right -= CalcRect.Width();
  1438. }
  1439. ReffWndRect.left = ReffWndRect.right /2;
  1440. if( ReffWndRect.Width() < ReffWndRect.Height()){
  1441. Twice = ReffWndRect.Width() /BITMAP_WIDTH;
  1442. Remain = ReffWndRect.Width() %BITMAP_WIDTH;
  1443. if( Remain < Frame.cx + 4)
  1444. Twice -= 1;
  1445. if( Twice <= 0){/*
  1446. if( RefferWndVisible){
  1447. pRefrChild->ShowWindow( SW_HIDE);
  1448. pRefrChild->UpdateWindow();
  1449. RefferWndVisible = FALSE;
  1450. }*/
  1451. }
  1452. ReffWndRect.right = ReffWndRect.left + BITMAP_WIDTH*Twice
  1453. + Frame.cx;
  1454. ReffWndRect.bottom = BITMAP_HEIGHT*Twice + Frame.cy
  1455. + CAPTION_HEIGHT;
  1456. }else{
  1457. Twice = ReffWndRect.Height() /BITMAP_HEIGHT;
  1458. Remain = ReffWndRect.Height() %BITMAP_HEIGHT;
  1459. if( Remain < CAPTION_HEIGHT + Frame.cy + 4)
  1460. Twice -= 1;
  1461. if( Twice <= 0) Twice = 1;
  1462. ReffWndRect.right = ReffWndRect.left + BITMAP_WIDTH*Twice
  1463. + Frame.cx;
  1464. ReffWndRect.bottom = BITMAP_HEIGHT*Twice + Frame.cy
  1465. + CAPTION_HEIGHT;
  1466. }
  1467. }
  1468. /************************************************/
  1469. /* */
  1470. /* MESSAGE "WM_SIZE" */
  1471. /* */
  1472. /************************************************/
  1473. void
  1474. CMainFrame::OnSize(
  1475. UINT nType,
  1476. int cx,
  1477. int cy)
  1478. {
  1479. CMDIFrameWnd::OnSize(nType, cx, cy);
  1480. if( RefferWndVisible){
  1481. SetReffWndPos();
  1482. }
  1483. if( CustomWndOpen){
  1484. SetEudcWndPos();
  1485. }
  1486. if( !ToolBarVisible){
  1487. m_wndToolBar.Invalidate( FALSE);
  1488. m_wndToolBar.UpdateWindow();
  1489. }
  1490. }
  1491. /************************************************/
  1492. /* */
  1493. /* MESSAGE "WM_DESTROY" */
  1494. /* Write "EUDCEDIT.INI" */
  1495. /* */
  1496. /************************************************/
  1497. void
  1498. CMainFrame::OnDestroy()
  1499. {
  1500. TCHAR ProfileBuf[BUFFERMAX];
  1501. TCHAR SelectName1[] = TEXT("WindowSize");
  1502. TCHAR SelectName2[] = TEXT("Bitmap");
  1503. TCHAR SelectName3[] = TEXT("Color");
  1504. TCHAR EntryName1[] = TEXT("MainWindowSize");
  1505. TCHAR EntryName2[] = TEXT("MinMaxFlag");
  1506. TCHAR EntryName3[] = TEXT("BitmapSize");
  1507. TCHAR EntryName4[] = TEXT("Grid");
  1508. TCHAR EntryName5[] = TEXT("Curve");
  1509. TCHAR EntryName6[] = TEXT("Fitting");
  1510. TCHAR EudcIniFile[] = TEXT("Eudcedit.ini");
  1511. CRect rect;
  1512. short MaxWndFlag;
  1513. HRESULT hresult;
  1514. if( IsZoomed())
  1515. MaxWndFlag = 1;
  1516. else MaxWndFlag = 0;
  1517. //*STRSAFE* wsprintf( ProfileBuf,TEXT("%d %d %d"), GetRValue(COLOR_GRID), GetGValue(COLOR_GRID), GetBValue(COLOR_GRID));
  1518. hresult = StringCchPrintf(ProfileBuf , ARRAYLEN(ProfileBuf), TEXT("%d %d %d"), GetRValue(COLOR_GRID), GetGValue(COLOR_GRID), GetBValue(COLOR_GRID));
  1519. if (!SUCCEEDED(hresult))
  1520. {
  1521. goto RET ;
  1522. }
  1523. ::WritePrivateProfileString( SelectName3, EntryName4,
  1524. ProfileBuf, EudcIniFile);
  1525. //*STRSAFE* wsprintf( ProfileBuf,TEXT("%d %d %d"), GetRValue(COLOR_CURVE),GetGValue(COLOR_CURVE), GetBValue(COLOR_CURVE));
  1526. hresult = StringCchPrintf(ProfileBuf , ARRAYLEN(ProfileBuf), TEXT("%d %d %d"), GetRValue(COLOR_CURVE),GetGValue(COLOR_CURVE), GetBValue(COLOR_CURVE));
  1527. if (!SUCCEEDED(hresult))
  1528. {
  1529. goto RET ;
  1530. }
  1531. ::WritePrivateProfileString( SelectName3, EntryName5,
  1532. ProfileBuf, EudcIniFile);
  1533. //*STRSAFE* wsprintf( ProfileBuf,TEXT("%d %d %d"), GetRValue(COLOR_FITTING),GetGValue(COLOR_FITTING), GetBValue(COLOR_FITTING));
  1534. hresult = StringCchPrintf(ProfileBuf , ARRAYLEN(ProfileBuf), TEXT("%d %d %d"), GetRValue(COLOR_FITTING),GetGValue(COLOR_FITTING), GetBValue(COLOR_FITTING));
  1535. if (!SUCCEEDED(hresult))
  1536. {
  1537. goto RET ;
  1538. }
  1539. ::WritePrivateProfileString( SelectName3, EntryName6,
  1540. ProfileBuf, EudcIniFile);
  1541. //*STRSAFE* wsprintf( ProfileBuf, TEXT("%d"), BITMAP_WIDTH);
  1542. hresult = StringCchPrintf(ProfileBuf , ARRAYLEN(ProfileBuf), TEXT("%d"), BITMAP_WIDTH);
  1543. if (!SUCCEEDED(hresult))
  1544. {
  1545. goto RET ;
  1546. }
  1547. ::WritePrivateProfileString( SelectName2, EntryName3,
  1548. ProfileBuf, EudcIniFile);
  1549. //*STRSAFE* wsprintf( ProfileBuf, TEXT("%d"), MaxWndFlag);
  1550. hresult = StringCchPrintf(ProfileBuf , ARRAYLEN(ProfileBuf), TEXT("%d"), MaxWndFlag);
  1551. if (!SUCCEEDED(hresult))
  1552. {
  1553. goto RET ;
  1554. }
  1555. ::WritePrivateProfileString( SelectName1, EntryName2,
  1556. ProfileBuf, EudcIniFile);
  1557. if( !MaxWndFlag && !IsIconic()){
  1558. GetWindowRect( &rect);
  1559. //*STRSAFE* wsprintf( ProfileBuf, TEXT("%d %d %d %d"), rect.left, rect.top, rect.right, rect.bottom);
  1560. hresult = StringCchPrintf(ProfileBuf , ARRAYLEN(ProfileBuf), TEXT("%d %d %d %d"), rect.left, rect.top, rect.right, rect.bottom);
  1561. if (!SUCCEEDED(hresult))
  1562. {
  1563. goto RET ;
  1564. }
  1565. ::WritePrivateProfileString( SelectName1, EntryName1,
  1566. ProfileBuf, EudcIniFile);
  1567. }
  1568. RET:
  1569. CMDIFrameWnd::OnDestroy();
  1570. }
  1571. /************************************************/
  1572. /* */
  1573. /* MESSAGE "WM_CLOSE" */
  1574. /* */
  1575. /************************************************/
  1576. void
  1577. CMainFrame::OnClose()
  1578. {
  1579. CString MsgTitle;
  1580. CString Msg;
  1581. int result;
  1582. if( CustomWndOpen){
  1583. if(( pEditChild->GetBitmapDirty()) &&
  1584. ( InqTypeFace((TCHAR *)SelectEUDC.m_Font,
  1585. (TCHAR *)SelectEUDC.m_File, sizeof( SelectEUDC.m_File)/sizeof(TCHAR)))){
  1586. MsgTitle.LoadString( IDS_MAINFRAMETITLE);
  1587. Msg.LoadString( IDS_SAVEORNOT);
  1588. result = MessageBox( Msg, MsgTitle,
  1589. MB_ICONQUESTION | MB_YESNOCANCEL);
  1590. if( result == IDYES){
  1591. AfxGetApp()->DoWaitCursor(1);
  1592. if (!pEditChild->SaveEUDCCode(MB_OKCANCEL))
  1593. result = IDCANCEL;
  1594. AfxGetApp()->DoWaitCursor(-1);
  1595. }
  1596. if( result == IDCANCEL)
  1597. return;
  1598. }
  1599. }
  1600. CMDIFrameWnd::OnClose();
  1601. }
  1602. /************************************************/
  1603. /* */
  1604. /* MESSAGE "WM_INITMENU" */
  1605. /* */
  1606. /************************************************/
  1607. void
  1608. CMainFrame::OnInitMenu(
  1609. CMenu* pMenu)
  1610. {
  1611. if (!pMenu)
  1612. {
  1613. return;
  1614. }
  1615. CMDIFrameWnd::OnInitMenu(pMenu);
  1616. if( CountryInfo.LangID != EUDC_CHT &&
  1617. CountryInfo.LangID != EUDC_CHS ){
  1618. pMenu->DeleteMenu( ID_LINKIME, MF_BYCOMMAND);
  1619. pMenu->DeleteMenu( ID_LINKBATCHMODE, MF_BYCOMMAND);
  1620. if (CountryInfo.LangID != EUDC_JPN)
  1621. pMenu->DeleteMenu( ID_IMPORT_FILE, MF_BYCOMMAND);
  1622. this->DrawMenuBar();
  1623. }
  1624. }
  1625. /************************************************/
  1626. /* */
  1627. /* Correct it if code is illegal range */
  1628. /* */
  1629. /************************************************/
  1630. WORD
  1631. CMainFrame::CorrectCode(
  1632. WORD Code,
  1633. BOOL UporDown)
  1634. {
  1635. COUNTRYINFO Info;
  1636. WORD wCode;
  1637. BYTE LByte, HByte;
  1638. int TralPos = 0;
  1639. LByte = LOBYTE( Code);
  1640. HByte = HIBYTE( Code);
  1641. Info = CountryInfo;
  1642. for( int i = 0; i < Info.nTralByte; i++){
  1643. if( LByte >= (Info.sTralByte[i]) &&
  1644. LByte <= (Info.eTralByte[i])){
  1645. goto RET;
  1646. }else if( LByte < (Info.sTralByte[i])){
  1647. TralPos = i;
  1648. break;
  1649. }else TralPos = i+1;
  1650. }
  1651. if( UporDown)
  1652. if( TralPos == Info.nTralByte){
  1653. LByte = (Info.sTralByte[0]);
  1654. HByte += 0x1;
  1655. }else LByte = (Info.sTralByte[TralPos]);
  1656. else{
  1657. if( !TralPos){
  1658. LByte = (Info.eTralByte[Info.nTralByte-1]);
  1659. HByte -= 0x1;
  1660. }else LByte = (Info.eTralByte[TralPos-1]);
  1661. }
  1662. RET:
  1663. wCode = MAKEWORD( LByte, HByte);
  1664. return wCode;
  1665. }
  1666. /************************************************/
  1667. /* */
  1668. /* Set Reference dialog */
  1669. /* */
  1670. /************************************************/
  1671. UINT
  1672. CMainFrame::SetReffCode( BOOL EditorRefer)
  1673. {
  1674. CRefrDlg dlg;
  1675. UINT Result;
  1676. TitleFlag = EditorRefer;
  1677. if(( Result = (UINT)dlg.DoModal()) == IDOK){
  1678. if( !EditorRefer){
  1679. if( dlg.m_CodeList.SelectCode){
  1680. pRefrChild->ReferCode =
  1681. dlg.m_CodeList.SelectCode;
  1682. }else pRefrChild->ReferCode = 0;
  1683. }else{
  1684. if( dlg.m_CodeList.SelectCode)
  1685. pEditChild->CallCode =
  1686. dlg.m_CodeList.SelectCode;
  1687. else pEditChild->CallCode = 0;
  1688. }
  1689. }else{
  1690. if( !EditorRefer)
  1691. pRefrChild->ReferCode = 0;
  1692. else pEditChild->CallCode = 0;
  1693. }
  1694. return Result;
  1695. }
  1696. /************************************************/
  1697. /* */
  1698. /* Window procedure */
  1699. /* */
  1700. /************************************************/
  1701. LRESULT
  1702. CMainFrame::WindowProc(
  1703. UINT message,
  1704. WPARAM wParam,
  1705. LPARAM lParam)
  1706. {
  1707. CRect WorkRect;
  1708. CRect rect;
  1709. CRect Dummy;
  1710. RECT *Rect;
  1711. POINT *Point;
  1712. int Zm;
  1713. if( message == WM_DUPLICATE){
  1714. Zm = pEditChild->ZoomRate;
  1715. pEditChild->GetClientRect( &WorkRect);
  1716. pEditChild->ClientToScreen( &WorkRect);
  1717. Point = (LPPOINT)lParam;
  1718. Rect = (LPRECT)wParam;
  1719. pEditChild->ScreenToClient( Point);
  1720. Rect->left = ((Point->x - Rect->left) /Zm) *Zm;
  1721. Rect->top = ((Point->y - Rect->top - CAPTION_HEIGHT)
  1722. /Zm) *Zm + CAPTION_HEIGHT;
  1723. Rect->right = Rect->left + Rect->right;
  1724. Rect->bottom = Rect->top + Rect->bottom;
  1725. pEditChild->ClientToScreen( Rect);
  1726. if( Dummy.IntersectRect( &WorkRect, Rect)){
  1727. if( Dummy.EqualRect( Rect)){
  1728. pEditChild->ScreenToClient( Rect);
  1729. pEditChild->SetDuplicateRect( Rect, Point);
  1730. }else{
  1731. int Tmp;
  1732. rect.SetRect( Rect->left, Rect->top,
  1733. Rect->right, Rect->bottom);
  1734. if( rect.left < WorkRect.left){
  1735. Tmp = WorkRect.left - rect.left;
  1736. rect.OffsetRect( Tmp, 0);
  1737. }
  1738. if( rect.top < WorkRect.top + CAPTION_HEIGHT){
  1739. Tmp = WorkRect.top + CAPTION_HEIGHT
  1740. - rect.top;
  1741. rect.OffsetRect( 0, Tmp);
  1742. }
  1743. if( rect.right > WorkRect.right){
  1744. Tmp = WorkRect.right - rect.right + 1;
  1745. rect.OffsetRect( Tmp, 0);
  1746. }
  1747. if( rect.bottom > WorkRect.bottom){
  1748. Tmp = WorkRect.bottom - rect.bottom + 1;
  1749. rect.OffsetRect( 0, Tmp);
  1750. }
  1751. pEditChild->ScreenToClient( &rect);
  1752. pEditChild->SetDuplicateRect( &rect, Point);
  1753. }
  1754. pRefrChild->RectVisible = FALSE;
  1755. pEditChild->MDIActivate();
  1756. if( pRefrChild->SelectItems == FREEFORM)
  1757. pEditChild->SelectItem = FREEFORM;
  1758. else pEditChild->SelectItem = RECTCLIP;
  1759. }else{
  1760. pRefrChild->Invalidate( FALSE);
  1761. pRefrChild->UpdateWindow();
  1762. }
  1763. return (0L);
  1764. }else return CFrameWnd::WindowProc( message, wParam, lParam);
  1765. }
  1766. /************************************************/
  1767. /* */
  1768. /* Activate Edit Window */
  1769. /* */
  1770. /************************************************/
  1771. BOOL CMainFrame::CustomActivate()
  1772. {
  1773. pEditChild->MDIActivate();
  1774. return TRUE;
  1775. }
  1776. #ifdef _DEBUG
  1777. void CMainFrame::AssertValid() const
  1778. {
  1779. CMDIFrameWnd::AssertValid();
  1780. }
  1781. void CMainFrame::Dump(CDumpContext& dc) const
  1782. {
  1783. CMDIFrameWnd::Dump(dc);
  1784. }
  1785. #endif //_DEBUG