Source code of Windows XP (NT5)
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.

86 lines
2.3 KiB

  1. #include "compatadmin.h"
  2. #include "XMLDialog.h"
  3. CXMLDialog * g_pXMLDialog = NULL;
  4. #define QUOTE '"'
  5. BOOL CXMLDialog::BeginXMLView(PDBRECORD pRecord, HWND hParent, BOOL bChildren, BOOL bSib, BOOL bLocalLayer, BOOL bFullXML, BOOL bGlobal)
  6. {
  7. m_pRecord = pRecord;
  8. g_pXMLDialog = this;
  9. m_bChildren = bChildren;
  10. m_pList = g_theApp.GetDBLocal().DisassembleRecord(m_pRecord,m_bChildren,bSib,bLocalLayer,bFullXML,bGlobal, FALSE);
  11. DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_XML),hParent,(DLGPROC)XMLDlgProc);
  12. delete m_pList;
  13. return TRUE;
  14. }
  15. BOOL CXMLDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
  16. {
  17. switch ( uMsg ) {
  18. case WM_INITDIALOG:
  19. {
  20. // Convert record into XML strings to be displayed.
  21. if ( NULL != m_pList ) {
  22. PSTRLIST pWalk = m_pList->m_pHead;
  23. while ( NULL != pWalk ) {
  24. UINT uTabs = pWalk->uExtraData;
  25. while ( uTabs > 0 ) {
  26. SendDlgItemMessage(m_hDlg,IDC_XML,EM_REPLACESEL,FALSE,(LPARAM)" ");
  27. --uTabs;
  28. }
  29. SendDlgItemMessage(m_hDlg,IDC_XML,EM_REPLACESEL,FALSE,(LPARAM)(LPCTSTR) pWalk->szStr);
  30. SendDlgItemMessage(m_hDlg,IDC_XML,EM_REPLACESEL,FALSE,(LPARAM)"\r\n");
  31. pWalk = pWalk->pNext;
  32. }
  33. }
  34. }
  35. break;
  36. case WM_COMMAND:
  37. switch ( LOWORD(wParam) ) {
  38. case IDC_SAVEXML:
  39. {
  40. CSTRING szFilename;
  41. if ( g_theApp.GetFilename(TEXT("Save XML to file"),TEXT("XML File (*.XML)\0*.XML\0\0"),TEXT(""),TEXT("XML"),OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT,FALSE,szFilename) )
  42. g_theApp.GetDBLocal().WriteXML(szFilename,m_pList);
  43. }
  44. break;
  45. case IDOK:
  46. {
  47. EndDialog(m_hDlg,1);
  48. }
  49. break;
  50. case IDCANCEL:
  51. {
  52. EndDialog(m_hDlg,0);
  53. }
  54. break;
  55. }
  56. }
  57. return FALSE;
  58. }
  59. BOOL CALLBACK XMLDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  60. {
  61. if ( NULL != g_pXMLDialog ) {
  62. g_pXMLDialog->m_hDlg = hWnd;
  63. return g_pXMLDialog->DlgProc(uMsg,wParam,lParam);
  64. }
  65. return FALSE;
  66. }