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.

126 lines
5.0 KiB

  1. Notes on Unicode-enabling certain UI elements of HTMLHelp.
  2. Paul Chase Dempsey
  3. August 20, 1998
  4. Questions? mailto:[email protected]
  5. -----------------
  6. What's been done:
  7. Common control wrapper layer for the Tree View, List View, and Tab controls.
  8. These files also implement generic helpers that let you create and manipulate
  9. selected windows as Unicode.
  10. There's also a subset of the WindowsX.h-style APIs for edit controls
  11. and combo boxes.
  12. include\cctlww.h
  13. hhctrl\cctlww.cpp
  14. I've implemented the use of these wrappers for the common controls, edit boxes,
  15. and combos on the major UI elements: the tab control, TOC, Search, Advanced Search,
  16. and the edit control for the index.
  17. Implemented dual Ansi/Unicode message pump.
  18. I'ts not enough to create just the control as Unicode or enable the
  19. Win95 Unicode support in the IE5 controls. The parent windows of the
  20. controls must also be Unicode [enabled]. All the windows in
  21. SendMessage/notify chains must all do the Uni thing in parallel.
  22. Just one Ansi proc or SendMessage slices off the Unicode-ness of
  23. the message or data.
  24. Take note of how we create, subclass, and call window procedures for
  25. conditionally Unicode windows.
  26. I modified CDlg so that it _can_ create Unicode version when possible.
  27. This must be done explicitly with SetUnicode(TRUE) for each dialog
  28. before calling DoModal() or DoModeless(). In some places, this is
  29. done in the constructor for the derived dialog class, so make sure
  30. you look at the headers to see if this is happening for a dialog or not.
  31. ---------------------
  32. What's not been done:
  33. grep for "paulde" for detailed points left to do or things to consider.
  34. Topic list needs CTable Unicode support.
  35. I haven't done the Unicode thing on bookmarks/favorites, subsets,
  36. infotypes, samples, notes, or history.
  37. I haven't handled the way conjunctions are inserted.
  38. Currently these use ANSI, so you can get text trashed in some scenarios
  39. by using the conjunctions dropdown. There are a couple of ways to approach
  40. fixing it. You probably need to write W_Edit_GetSel and W_ComboBox_GetEditSel
  41. that translate the DBCS byte index from the edit control to Unicode character
  42. index. If you need to use a codepage different from the sytem, use
  43. IsDBCSLeadByteEx rather than IsDBCSLeadByte or CharNext (I think there's an
  44. implementation in the intl utils I threw over from VS).
  45. Index.cpp needs Unicode version of isSameString and more. I expect
  46. there's a fair amount of work to make the word-wheeling Unicode.
  47. aboutbox.cpp: gets strings from the file, so should convert using
  48. an appropriate codepage and displayed using the Unicode text funcs.
  49. EXTENSIBLE_TAB for custom tabs. Need some way of indicating the proper
  50. codepage for the tab name.
  51. I don't think there are any Print issues.
  52. When a CHM is loaded, the LCID and codepage of the CHM should be
  53. checked to see if the support for that locale/codepage is
  54. installed on the system, and either refuse to load or warn that not
  55. everything is well in the world. (I was getting a GPF in ITSS doing a
  56. search on a Japanese title when the system didn't have the codepage).
  57. We'll probably need Unicode version of GetStaticDimensions,
  58. using the W text API wrappers so Uni text is measured correctly.
  59. If you see UI elements getting truncated or too wide, look
  60. for this as the cause.
  61. On NT we just create the controls as Unicode and use our generic
  62. A/W wrappers, so the significant input and display works natively
  63. as Unicode. Richedit is useful ONLY on win95/98. Since we're
  64. shipping 1.1d only in NT (no Office, Win95/98 service pack, and no
  65. web release), there's no point to doing the additional work to use
  66. richedit.
  67. Richedit supports Unicode in a different way than the common controls.
  68. The common controls use separate A and W message ids and notifications.
  69. Richedit uses the same message ids, but the arguments and return values
  70. are in terms of WCHARs.
  71. This means that you can't use the generic A/W wrappers with richedit. They
  72. aren't richedit-aware. Implementing that would require every wrapper to
  73. look at the window class name (ugh, slow, but doable), or get passed a flag
  74. to do things the richedit way.
  75. If a list or tree view is still getting Ansi notifications on NT5,
  76. then there's some Ansi window handling messages somewhere in the
  77. routing, or someone is calling IsDialogMessageA or another Ansi
  78. message API. To fix this, make sure that W APIs are called as
  79. appropriate (look at the wrappers in cctlww.cpp), and that the
  80. windows in question are created/subclassed/etc. using the wrappers
  81. following the model of the windows that have already been enabled.
  82. If you don't control the creation of the window, it can be subclassed
  83. using SetWindowLongW to convert it to a Unicode window. The subclass
  84. procedure will need to carefully map/send the relevant messages appropriately.
  85. I hope you don't have to do this -- it should only be necessary for the
  86. imbedded contents and search controls.
  87. If a subclassed Unicode edit box is getting trashed on NT, look for a
  88. DefWindowProc, DefDlgProc, or CallWindowProc. These need to use the
  89. wrappers W_DefWindowProc, W_DefDlgProc, and W_DelegateWindowProc.