mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 15:53:03 +00:00

[RICHED20] Sync to Wine-10.0 Sync wine/rbtree.h to Wine-10.0 as changes in riched20 require this. Also added a define to allow directx code to compile. Sync riched20 to Wine-10.0 and its tests using the script. Signed-off-by: Francois Gouget <fgouget@free.fr> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 9f72c5601173728c52626342a1ec6c9a4c70670f by Francois Gouget <fgouget@free.fr> Update WINESYNC.txt Update precomp.h fix build [WINESYNC]: riched20 is now in sync with wine-staging wine-10.0 [WINESYNC] riched20: Only call ME_SendRequestResize when control is in-place active. Prevent GetClientRect from being called when not in-place active. wine commit id e61db557ab8473a490c84301dbb4b4665b6c9c9f by Charlotte Pabst <cpabst@codeweavers.com> [WINESYNC] riched20: Exit from editor_ensure_visible when control is not in-place active. According to microsoft documentation, ScrollWindowEx, SetScrollPos and SetScrollRange may only be called while the control is in-place active. This fixes a segmentation fault in an application. wine commit id dafaadcb4addd9af334433666a4bc2e7aa6eb9ff by Charlotte Pabst <cpabst@codeweavers.com> [WINESYNC] riched20/tests: Test that ScrollWindowEx and GetClientRect are only called when control is in-place active. wine commit id f1301cedbea51be107017bb8545956bcfd02b610 by Charlotte Pabst <cpabst@codeweavers.com> Update editor.c [WINESYNC] riched20: Release IME input context when done using it. wine commit id 3f51fb96c162e8d3314627b3db25564fa7d9d419 by Zhiyi Zhang <zzhang@codeweavers.com> [WINESYNC] riched20: In para_set_fmt protect against out of bound cTabStop values. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56730 wine commit id 7b2ff977739df25252d46552d2447af50c23040e by Fabian Maurer <dark.shadow4@web.de> Update editor.c [WINESYNC] riched20: Don't write past end of buffer. Signed-off-by: Eric Pouech <epouech@codeweavers.com> wine commit id 5cbe3a6cb186cffed20e3fea5f88abd0880d3914 by Eric Pouech <epouech@codeweavers.com> [WINESYNC] riched20: Don't crash when no OLE obj is present. This was generating a lot of crashes in riched20 tests. Signed-off-by: Eric Pouech <epouech@codeweavers.com> wine commit id 015aae30cf2217164f631d1c03abfc9ea63bb43d by Eric Pouech <epouech@codeweavers.com> Update editor.c [WINESYNC] riched20: Use CRT allocation functions. wine commit id 42579f1dcd2f14e765e2f53ceb5b46fff5623f10 by Alex Henrie <alexhenrie24@gmail.com> [WINESYNC] riched20/tests: Make the editor paste test failures more informative and unique. Knowing the content of the edit field is more useful than knowing the strcmp() result. The text field may contain carriage returns and linefeeds so use wine_dbgstr_a() so they are clearly visible in the failure message. Also prefix the ok messages with a unique string to indicate which test_WM_PASTE() test failed. wine commit id b8950d04e439f649f2167477a36ee453ad8b81ef by Francois Gouget <fgouget@codeweavers.com> [WINESYNC] riched20: Don't call wrap_marked_paras_dc() before the editor is fully initialized. Today, CreateTextServices() sometimes triggers an assertion failure in select_style(). When ME_MakeEditor() calls ME_MakeFirstParagraph(), the editor (ME_TextEditor) is not in a fully initialized state. For example, the font cache (pFontCache) is not fully initialized, which sometimes makes select_style() believe that the cache slots are fully occupied. Fix this by delaying the call to wrap_marked_paras_dc() until the editor is fully initialized. Also, delay the call to ITextHost::TxReleaseDC() until after wrap_marked_paras_dc(), since we need the device context a bit longer. Fixes: b70eb32c5f3e506181d9e1e9fbef62e9baf3674d wine commit id 548d7179e3b2b9961321a4df50644c9b3874a295 by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20: Factor out device context acquisition from ME_MakeFirstParagraph. This lets ME_MakeEditor() reuse the device context throughout the editor initialization process. wine commit id 03036f42e1afa9c79246dcee6b9fe876286b1aa4 by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20: Don't call ME_UpdateRepaint inside set_selection(). This partially reverts c5daf6a30f21 (riched20: Call ME_UpdateRepaint instead of editor_ensure_visible in set_selection.) Fixes: c5daf6a30f21acd20263692b278acba49e014cc1 wine commit id ac5110131493b8b05795e8825285e41ca40ab6f1 by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20/tests: Add tests for change notifications caused by EM_SETSEL{,EX}. wine commit id c35926e49825f7a3d48ba826085fe1ae3d2a7e27 by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20: Wrap marked paragraphs at Text Services initialization. Today, CreateTextServices() returns an Rich Edit object without row start and end marks, which are expected to exist by many Rich Edit operations as well as EM_* message handlers. This leads to a crash when certain messages (e.g., EM_SCROLLCARET) are sent to the Rich Edit object via ITextServices::TxSendMessage(), unless ME_WrapMarkedParagraphs() has been called beforehand. Fix this by calling wrap_marked_paras_dc() early in the initialization process. This is not a problem for windowed Rich Edit controls, which already calls ME_WrapMarkedParagraphs() before the user or application starts interacting with it. wine commit id b70eb32c5f3e506181d9e1e9fbef62e9baf3674d by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20: Use nameless unions/structs. wine commit id 26826d3af8b1969de389f3d6702d7c8b805126e1 by Alexandre Julliard <julliard@winehq.org> Update editor.h [WINESYNC] riched20: Remove DECLSPEC_HIDDEN usage. wine commit id c04ab166498b5841ecde620a9bd0b74969b01596 by Alistair Leslie-Hughes <leslie_alistair@hotmail.com> [WINESYNC] riched20: Call ME_UpdateRepaint instead of editor_ensure_visible in set_selection. To prevent cases where ME_WrapMarkedParagraphs has not been called causing a NULL pointer when editor_ensure_visible tries to get the row from the cursor. wine commit id c5daf6a30f21acd20263692b278acba49e014cc1 by Santino Mazza <smazza@codeweavers.com> [WINESYNC] riched20: Update paragraph position in marked tree. nCharOfs is the key for paragraphs added to the marked tree If it is updated, re-add the entry to update its position wine commit id f1aa3f37ef326b7cbf8fc94e982c9f0b398181c4 by Daniel Lehman <dlehman25@gmail.com> Update editor.c [WINESYNC] riched20: Update the editor IME position on GCS_RESULTSTR. So that a GCS_RESULTSTR followed by GCS_COMPSTR, without interruping the composition, begins inserting the new composition text after the result instead of before it. wine commit id de45bc33a73eac5dbc3502b4a43cd48399507c73 by Rémi Bernon <rbernon@codeweavers.com> [WINESYNC] riched20/tests: Fix a typo in a comment. wine commit id 145e3c758b9594596835e291b2fcb3c80e4c0479 by Francois Gouget <fgouget@free.fr> [WINESYNC] riched20/tests: Don't specify DT_WORDBREAK in _check_txgetnaturalsize(). Today, test_TxGetNaturalSize() creates a pop-up window with a fixed size (extent) of 100 x 100. The test function then proceeds to compute the natural size of rich edit control that fits the sample text "TestSomeText" and compare it to the RECT calculated by DrawText. Apparently, this test fails if the width of the sample text "TestSomeText" exceeds the width of the test window's client area. In this case, DrawText() with DT_WORDBREAK breaks the text into the two lines due to text wrapping; however, Rich Edit's ITextServices::TxGetNaturalSize implementation does not seem to perform text wrapping on overflow. This results in extent mismatch. (Note that the test may either succeed or fail depending on the current font used for DEFAULT_GUI_FONT, which defaults to Tahoma according to Microsoft's documentation. To reproduce this failure, it may be necessary to switch fonts or change the width of the pop-up window.) Fix this by omitting the DT_WORDBREAK flag for the DrawText() call in _check_txgetnaturalsize(). Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54637 wine commit id f54a1dac64c89aea3fe02ae8c0d6eef43a0aa117 by Jinoh Kang <jinoh.kang.kr@gmail.com> Update editstr.h [WINESYNC] riched20: Implement ITextDocument::Freeze and ITextDocument::Unfreeze. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54617 wine commit id 3fe15349d39ccf31026a92eae30f83f65c91cb1f by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20: Don't assume that TxDraw preserves the device context's brush selection. Today, RichEditWndProc_common assumes that ITextServices::TxDraw preserves the brush selection of the given device context. However, this invariant may be broken by misbehaving embedded OLE objects in the text document. Fix this by not assuming that the return value of the second SelectObject() call equals the brush passed to the first SelectObject() call in RichEditWndProc_common's WM_PAINT / WM_PRINTCLIENT case. wine commit id 2027be7e0370c92595f126a0b0dd167a635d50a2 by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20/tests: Test for ITextDocument::Freeze and ITextDocument::Unfreeze. wine commit id 3105fad82b9bae390fcd710a2fc10a18988b4622 by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20: Don't set para unless committing cursor move in ME_MoveCursorWords. Introduce a temporary variable, `other_para`, so that we don't end up returning incorrect para (with stale run) inside the output cursor. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54564 wine commit id 7e28fa5c558f1417f8f033cb843424778bbfb8b8 by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20/tests: Test for word movement across paragraph boundary. wine commit id 21d25b17c2cae8eb2d2376ce42b76e3f61eb0bba by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20/tests: Fix the EM_GETSELTEXT tests in Hindi on Windows. On Windows EM_GETSELTEXT fails with an invalid parameter error in the Hindi locale but works in most other locales, including UTF-8 ones. So check for this issue and adjust the expected results accordingly. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54559 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54565 wine commit id 37cd13abdf5d91c7b3f25b39fa14976bc3a3e3a3 by Francois Gouget <fgouget@codeweavers.com> [WINESYNC] riched20/tests: EM_GETSELTEXT's wparam is not used and should be 0. wine commit id baa41970647a7e548701a72bea2e4aa2a61ca27e by Francois Gouget <fgouget@codeweavers.com> [WINESYNC] riched20/tests: Add context to the EM_FORMATRANGE tests. wine commit id 020145248371bbfd2e473e79ba873e8313dde72d by Francois Gouget <fgouget@codeweavers.com> [WINESYNC] riched20/tests: Check clipboard content after destroying the editor window. Destroying the editor window should render all the formats so they are still available after. wine commit id b5b5b0b365639b889a0240d4992e16174b428f75 by Francois Gouget <fgouget@codeweavers.com> [WINESYNC] riched20/tests: Add retry loop around OpenClipboard() to avoid access denial. Reusing existing helper from user32 & comctl32. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47888 Signed-off-by: Eric Pouech <eric.pouech@gmail.com> wine commit id 25743d46f4103c7345c955b87b4134a065fb5f1d by Eric Pouech <eric.pouech@gmail.com> [WINESYNC] riched20/tests: Ensure clipboard has been pasted before testing the result. The patch does reduce error failures locally. For the record: - WM_PASTE in undo operations haven't been transformed (as it requires UNDO stack manipulation in a coherent way across platforms) Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47888 Signed-off-by: Eric Pouech <eric.pouech@gmail.com> wine commit id 4fd5252f635817b431673accaba718c7481f48f6 by Eric Pouech <eric.pouech@gmail.com> [WINESYNC] riched20: Support SFF_SELECTION when streaming in plain text. Signed-off-by: Eric Pouech <eric.pouech@gmail.com> wine commit id 1b7a918bd7ec8bc2c51bcb76525b56b17c5ff0c0 by Eric Pouech <eric.pouech@gmail.com> [WINESYNC] riched20/tests: Add tests when pasting in plain text mode. Signed-off-by: Eric Pouech <eric.pouech@gmail.com> wine commit id 82fa1048b5cc7d9c6a2a289403f25adbdd8158c7 by Eric Pouech <eric.pouech@gmail.com> [WINESYNC] riched20: Obtain the composition start index after deleting selection. Today, the Rich Edit control handles the WM_IME_STARTCOMPOSITION message by the computing the composition start position (imeStartIndex) _before_ calling ME_DeleteSelection(), which shifts the character positions after the range of deletion. If the selection were not empty, imeStartIndex immediately becomes stale, since it does not take into account the number of deleted characters before it. Fix this by computing imeStartIndex after the ME_DeleteSelection() call. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54318 wine commit id 8c43577f0f9b4422d3641457c595c3998bd54a18 by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20: Call GlobalReAlloc with GMEM_MOVEABLE flag. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53474 wine commit id dfd44bb979ee2052eceff094083147e9879fa807 by Rémi Bernon <rbernon@codeweavers.com> [WINESYNC] riched20: Fix failing test in UTF8 locales. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52875 Signed-off-by: Eric Pouech <eric.pouech@gmail.com> wine commit id 5902cfd2990261189ce9af27981a95ac12fa2a5d by Eric Pouech <eric.pouech@gmail.com> [WINESYNC] riched20: Don't emit EN_CHANGE events during window creation. wine commit id 5c997de8dc1e4885266fa884a2fb74f840e3bedc by Evan Tang <etang@codeweavers.com> [WINESYNC] riched20: Add test for EN_CHANGE events during window creation. GenoPro isn't very happy if it receives one wine commit id 0b069106b0e0f141d6925d3e10166be89fc59145 by Evan Tang <etang@codeweavers.com> [WINESYNC] riched20: Move test class creation to a helper function. wine commit id f9083961ed187777d660796f7136addc04fff8b0 by Evan Tang <etang@codeweavers.com> [WINESYNC] riched20/tests: Use ARRAY_SIZE instead of open coding it. wine commit id 90b6288f54afdc4430dac146779a92b89f4d1219 by Michael Stefaniuc <mstefani@winehq.org> [WINESYNC] riched20/test: Add scrolling test for richole. Signed-off-by: Santino Mazza <mazzasantino1206@gmail.com> wine commit id 059c70d736baa164a1b246e949acd006cf83ab5a by Santino Mazza <mazzasantino1206@gmail.com> [WINESYNC] riched20: Ensure that cursor is visible when selecting text. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40444 Signed-off-by: Santino Mazza <mazzasantino1206@gmail.com> wine commit id 25209c162fc209124b369abbad55d915d31909b2 by Santino Mazza <mazzasantino1206@gmail.com> [WINESYNC] riched20/tests: When selection is out of view, the scrollbar should move. Signed-off-by: Santino Mazza <mazzasantino1206@gmail.com> wine commit id ee131e9eba7dad090f0baf4a73fab2d62dc73b52 by Santino Mazza <mazzasantino1206@gmail.com> [WINESYNC] riched20: Remove duplicate code. Signed-off-by: David Kahurani <k.kahurani@gmail.com> wine commit id 3588479e1a674e5f43f1acb9e7c0aa8cecf98f25 by David Kahurani <k.kahurani@gmail.com> [WINESYNC] riched20: Implement ITextDocument::Undo and ITextDocument::Redo. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53289 Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com> wine commit id ded8227774570a1ea320dc34f2de0033f85b3ce7 by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20: Add undo control state variable to ME_TextEditor. Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com> wine commit id 40c54854e61d8adfca21e2fa9260712e4f5453e9 by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20: Factor out undo-ignored status check. Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com> wine commit id 0cd86e010e41eebdc1a4c142f9cc6a4948554d0e by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20: Ensure MEPF_COMPLEX is unset when in password input mode. Otherwise, Wine may crash while attempting to fetch the script shaping information, which does not exist since shape_para() was not called. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53335 Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com> wine commit id f77f12ba3b1dad9ebdcb116c66b137e9103a0d1b by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20/tests: Test for ITextDocument::Undo and ITextDocument::Redo. Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com> wine commit id 73284ea18891a152dce989ffff59e2c527f94c73 by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20: Commit and wrap paragraphs after changing text properties. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53170 Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com> wine commit id 0974f047b57357252ec94bea119e5291250a446c by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20: Draw OLE objects with IViewObject implementation. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52752 Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com> wine commit id ecc607c6da96a5c2e8988f3021e98b442fe24c12 by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20: Fetch extent from object if REOBJECT::sizel is unset. Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com> wine commit id 164897e6c94d3eee4798f82a730472a5a847f9b2 by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20/tests: Add tests for drawing embedded OLE objects. Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com> wine commit id a7d29d1625f7e02df4fbf59ef4e4a999d39edde0 by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20/tests: Fix the spelling of a comment. Signed-off-by: Francois Gouget <fgouget@free.fr> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id f9fa5f9e523b45766f715c6981c6a6ab5f183157 by Francois Gouget <fgouget@free.fr> [WINESYNC] riched20: Implement callback to IRichEditOleCallback_QueryInsertObject. Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 10667b39aad6710668f60c1ba8f10e50aeb87242 by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20/tests: Add tests for IRichEditOleCallback_QueryInsertObject. Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 95b4072cc774ba7a7eabb0d4c114b933b7d71105 by Jinoh Kang <jinoh.kang.kr@gmail.com> Update richole.c [WINESYNC] riched20: Set REOBJECT's cp correctly in IRichEditOle::GetObject. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52705 Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 194ba06c403fd72fbfb95048385c9ca4838af169 by Jinoh Kang <jinoh.kang.kr@gmail.com> [WINESYNC] riched20: Add back-reference to outer ME_Run from struct re_object. Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 05796c4e2a4acb91e6035c536b4d0e1f7e16896d by Jinoh Kang <jinoh.kang.kr@gmail.com> fix [WINESYNC] riched20/tests: Enable compilation with long types. Signed-off-by: Eric Pouech <eric.pouech@gmail.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 9e90cecdc603d79c6332a03884ed8d4851ef2e88 by Eric Pouech <eric.pouech@gmail.com> [WINESYNC] riched20/tests: Use correct integral type. Signed-off-by: Eric Pouech <eric.pouech@gmail.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 8b66db027d4112bfd4287b03d5c7b6f33994adc3 by Eric Pouech <eric.pouech@gmail.com> fix build, sync rbtree.h [WINESYNC] riched20: Enable compilation with long types. Signed-off-by: Eric Pouech <eric.pouech@gmail.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 42d0e56643740a0eac5913a9f176e789457cb475 by Eric Pouech <eric.pouech@gmail.com> [WINESYNC] riched20/tests: Add a test to see what richedit class flavours should be available. Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id d54a0e2bea4548bb5d9c0cca9f918d7c46591e23 by Dmitry Timoshkov <dmitry@baikal.ru> [WINESYNC] riched20: Use correct integral type. Signed-off-by: Eric Pouech <eric.pouech@gmail.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 63a643f7f42ecd0c2625a5f5704b5b9647349e7b by Eric Pouech <eric.pouech@gmail.com> [WINESYNC] riched20/tests: Avoid "misleading indentation" warnings. Signed-off-by: Fabian Maurer <dark.shadow4@web.de> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 2d6fad7bda2f2e21a871f405a6b0c3e70ebf6a6a by Fabian Maurer <dark.shadow4@web.de> [WINESYNC] include: Remove the wine_ prefix on rbtree functions. Add defines for frequently-used functions. For compatibility with vkd3d. Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 3527230c461b6baba9c29e69b575ada85bdbbc43 by Alexandre Julliard <julliard@winehq.org> [WINESYNC] riched20: Defer releasing the host if inside a notify callback. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51521 Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 8138159f20d6453443861570689e0f14018051da by Huw Davies <huw@codeweavers.com> [WINESYNC] riched20: Return the nearest char pos if the coords are outside the format rect. For the two tests that remain todo_wine, the results differ between riched20 and msftedit, with Wine's implementation matching msftedit. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52041 Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 363508454d5f8f1fc5916bda47e6429756b7dc8f by Huw Davies <huw@codeweavers.com> [WINESYNC] riched20: Check font_cache in select_style() too. Signed-off-by: Serge Gautherie <winehq-git_serge_180711@gautherie.fr> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 177f808aa86e5442be1a0a92ddccc4904bf2e743 by Serge Gautherie <winehq-git_serge_180711@gautherie.fr> [WINESYNC] riched20: Use the standard va_list instead of __ms_va_list. Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 5b15bf33255bd373cbf26ec373d16a8234ec6b1c by Alexandre Julliard <julliard@winehq.org> [WINESYNC] riched20: Use regular allocation helpers for text services objects. Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 2064c206c0b67edb8524f572166b974ba9cbd6fe by Nikolay Sivov <nsivov@codeweavers.com> [WINESYNC] riched20: Remove New() allocation macro. Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 1d5c9defb19fca6cfb1107384fc2325d391726d6 by Nikolay Sivov <nsivov@codeweavers.com> [WINESYNC] riched20: Don't create custom heap. Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 8bff437e9d5e047e689d8b32f62995785c0cd48e by Dmitry Timoshkov <dmitry@baikal.ru> [WINESYNC] riched20/tests: Don't cast NULL. Signed-off-by: Michael Stefaniuc <mstefani@winehq.org> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id b701c3df99fbd6d4df7eaa11327bb11db95d8676 by Michael Stefaniuc <mstefani@winehq.org> [WINESYNC] riched20/tests: Add more tests for testing EM_GETTEXTEX with OLE objects. Signed-off-by: Jactry Zeng <jzeng@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 40988d6c3886d0f7a914c45ea68264bfc8540859 by Jactry Zeng <jzeng@codeweavers.com> Update richole.c [WINESYNC] riched20: Allow to insert OLE object at specified offset. Signed-off-by: Jactry Zeng <jzeng@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 8c894382dde5b9da88b0e9f23a753d5e851a43d6 by Jactry Zeng <jzeng@codeweavers.com> Update richole.c [WINESYNC] riched20/tests: Lock hGlobal before use. Signed-off-by: Jactry Zeng <jzeng@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id f9c8c95856ded333be35ff41ab40a246bfe345b6 by Jactry Zeng <jzeng@codeweavers.com> Co-authored-by: winesync <ros-dev@reactos.org>
500 lines
12 KiB
C
500 lines
12 KiB
C
/*
|
|
* RichEdit - structures and constant
|
|
*
|
|
* Copyright 2004 by Krzysztof Foltman
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
*/
|
|
|
|
#ifndef __EDITSTR_H
|
|
#define __EDITSTR_H
|
|
|
|
#include <assert.h>
|
|
#include <stdarg.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <limits.h>
|
|
|
|
#define COBJMACROS
|
|
|
|
#include <windef.h>
|
|
#include <winbase.h>
|
|
#include <winnls.h>
|
|
#include <winnt.h>
|
|
#include <wingdi.h>
|
|
#include <winuser.h>
|
|
#include <richedit.h>
|
|
#include <commctrl.h>
|
|
#include <ole2.h>
|
|
#include <richole.h>
|
|
#include "imm.h"
|
|
#include <textserv.h>
|
|
#include <tom.h>
|
|
#include "usp10.h"
|
|
|
|
#include "wine/asm.h"
|
|
#include "wine/debug.h"
|
|
#include "wine/list.h"
|
|
#include "wine/rbtree.h"
|
|
|
|
typedef struct tagME_String
|
|
{
|
|
WCHAR *szData;
|
|
int nLen, nBuffer;
|
|
void (*free)(struct tagME_String *);
|
|
} ME_String;
|
|
|
|
typedef struct tagME_FontCacheItem
|
|
{
|
|
LOGFONTW lfSpecs;
|
|
HFONT hFont;
|
|
int nRefs;
|
|
int nAge;
|
|
} ME_FontCacheItem;
|
|
|
|
#define HFONT_CACHE_SIZE 10
|
|
|
|
typedef struct tagME_Style
|
|
{
|
|
CHARFORMAT2W fmt;
|
|
|
|
ME_FontCacheItem *font_cache; /* cached font for the style */
|
|
TEXTMETRICW tm; /* cached font metrics for the style */
|
|
int nRefs; /* reference count */
|
|
SCRIPT_CACHE script_cache;
|
|
struct list entry;
|
|
} ME_Style;
|
|
|
|
typedef enum {
|
|
diInvalid,
|
|
diTextStart, /* start of the text buffer */
|
|
diParagraph, /* paragraph start */
|
|
diCell, /* cell start */
|
|
diRun, /* run (sequence of chars with the same character format) */
|
|
diStartRow, /* start of the row (line of text on the screen) */
|
|
diTextEnd, /* end of the text buffer */
|
|
|
|
/********************* these below are meant for finding only *********************/
|
|
diStartRowOrParagraph, /* 7 */
|
|
diStartRowOrParagraphOrEnd,
|
|
diRunOrParagraph,
|
|
diRunOrStartRow,
|
|
diParagraphOrEnd,
|
|
diRunOrParagraphOrEnd, /* 12 */
|
|
} ME_DIType;
|
|
|
|
#define SELECTIONBAR_WIDTH 8
|
|
|
|
/******************************** run flags *************************/
|
|
#define MERF_STYLEFLAGS 0x0FFF
|
|
/* run contains non-text content, which has its own rules for wrapping, sizing etc */
|
|
#define MERF_GRAPHICS 0x001
|
|
/* run is a tab (or, in future, any kind of content whose size is dependent on run position) */
|
|
#define MERF_TAB 0x002
|
|
/* run is a cell boundary */
|
|
#define MERF_ENDCELL 0x004 /* v4.1 */
|
|
|
|
#define MERF_NONTEXT (MERF_GRAPHICS | MERF_TAB | MERF_ENDCELL)
|
|
|
|
/* run is splittable (contains white spaces in the middle or end) */
|
|
#define MERF_SPLITTABLE 0x001000
|
|
/* run starts with whitespaces */
|
|
#define MERF_STARTWHITE 0x002000
|
|
/* run ends with whitespaces */
|
|
#define MERF_ENDWHITE 0x004000
|
|
/* run is completely made of whitespaces */
|
|
#define MERF_WHITESPACE 0x008000
|
|
/* the "end of paragraph" run, contains 1 character */
|
|
#define MERF_ENDPARA 0x100000
|
|
/* forcing the "end of row" run, contains 1 character */
|
|
#define MERF_ENDROW 0x200000
|
|
/* run is hidden */
|
|
#define MERF_HIDDEN 0x400000
|
|
/* start of a table row has an empty paragraph that should be skipped over. */
|
|
#define MERF_TABLESTART 0x800000 /* v4.1 */
|
|
|
|
/* runs with any of these flags set cannot be joined */
|
|
#define MERF_NOJOIN (MERF_GRAPHICS|MERF_TAB|MERF_ENDPARA|MERF_ENDROW)
|
|
/* runs that don't contain real text */
|
|
#define MERF_NOTEXT (MERF_GRAPHICS|MERF_TAB|MERF_ENDPARA|MERF_ENDROW)
|
|
|
|
/* those flags are kept when the row is split */
|
|
#define MERF_SPLITMASK (~(0))
|
|
|
|
/******************************** para flags *************************/
|
|
|
|
/* this paragraph was already wrapped and hasn't changed, every change resets that flag */
|
|
#define MEPF_REWRAP 0x01
|
|
/* v4.1 */
|
|
#define MEPF_CELL 0x04 /* The paragraph is nested in a cell */
|
|
#define MEPF_ROWSTART 0x08 /* Hidden empty paragraph at the start of the row */
|
|
#define MEPF_ROWEND 0x10 /* Visible empty paragraph at the end of the row */
|
|
#define MEPF_COMPLEX 0x20 /* Use uniscribe */
|
|
|
|
/******************************** structures *************************/
|
|
|
|
struct tagME_DisplayItem;
|
|
struct tagME_Run;
|
|
|
|
struct re_object
|
|
{
|
|
struct list entry;
|
|
REOBJECT obj;
|
|
struct tagME_Run *run; /* ptr to the reobj's run */
|
|
};
|
|
|
|
typedef struct tagME_Run
|
|
{
|
|
ME_Style *style;
|
|
struct tagME_Paragraph *para; /* ptr to the run's paragraph */
|
|
int nCharOfs; /* relative to para's offset */
|
|
int len; /* length of run's text */
|
|
int nWidth; /* width of full run, width of leading&trailing ws */
|
|
int nFlags;
|
|
int nAscent, nDescent; /* pixels above/below baseline */
|
|
POINT pt; /* relative to para's position */
|
|
struct re_object *reobj; /* FIXME: should be a union with strText (at least) */
|
|
|
|
SCRIPT_ANALYSIS script_analysis;
|
|
int num_glyphs, max_glyphs;
|
|
WORD *glyphs;
|
|
SCRIPT_VISATTR *vis_attrs;
|
|
int *advances;
|
|
GOFFSET *offsets;
|
|
int max_clusters;
|
|
WORD *clusters;
|
|
} ME_Run;
|
|
|
|
typedef struct tagME_Border
|
|
{
|
|
int width;
|
|
COLORREF colorRef;
|
|
} ME_Border;
|
|
|
|
typedef struct tagME_BorderRect
|
|
{
|
|
ME_Border top;
|
|
ME_Border left;
|
|
ME_Border bottom;
|
|
ME_Border right;
|
|
} ME_BorderRect;
|
|
|
|
struct para_num
|
|
{
|
|
ME_Style *style;
|
|
ME_String *text;
|
|
INT width;
|
|
POINT pt;
|
|
};
|
|
|
|
typedef struct tagME_Paragraph
|
|
{
|
|
PARAFORMAT2 fmt;
|
|
ME_String *text;
|
|
|
|
struct tagME_Cell *cell; /* v4.1 */
|
|
ME_BorderRect border;
|
|
|
|
int nCharOfs;
|
|
int nFlags;
|
|
POINT pt;
|
|
int nHeight, nWidth;
|
|
int nRows;
|
|
struct para_num para_num;
|
|
ME_Run *eop_run; /* ptr to the end-of-para run */
|
|
struct tagME_DisplayItem *prev_para, *next_para;
|
|
struct wine_rb_entry marked_entry;
|
|
} ME_Paragraph;
|
|
|
|
typedef struct tagME_Cell /* v4.1 */
|
|
{
|
|
int nNestingLevel; /* 0 for normal cells, and greater for nested cells */
|
|
int nRightBoundary;
|
|
ME_BorderRect border;
|
|
POINT pt;
|
|
int nHeight, nWidth;
|
|
int yTextOffset; /* The text offset is caused by the largest top border. */
|
|
struct tagME_Cell *prev_cell, *next_cell, *parent_cell;
|
|
} ME_Cell;
|
|
|
|
typedef struct tagME_Row
|
|
{
|
|
int nHeight;
|
|
int nBaseline;
|
|
int nWidth;
|
|
int nLMargin;
|
|
int nRMargin;
|
|
POINT pt;
|
|
} ME_Row;
|
|
|
|
/* the display item list layout is like this:
|
|
* - the document consists of paragraphs
|
|
* - each paragraph contains at least one run, the last run in the paragraph
|
|
* is an end-of-paragraph run
|
|
* - each formatted paragraph contains at least one row, which corresponds
|
|
* to a screen line (that's why there are no rows in an unformatted
|
|
* paragraph
|
|
* - the paragraphs contain "shortcut" pointers to the previous and the next
|
|
* paragraph, that makes iteration over paragraphs faster
|
|
* - the list starts with diTextStart and ends with diTextEnd
|
|
*/
|
|
|
|
typedef struct tagME_DisplayItem
|
|
{
|
|
ME_DIType type;
|
|
struct tagME_DisplayItem *prev, *next;
|
|
union {
|
|
ME_Run run;
|
|
ME_Row row;
|
|
ME_Cell cell;
|
|
ME_Paragraph para;
|
|
} member;
|
|
} ME_DisplayItem;
|
|
|
|
typedef struct tagME_TextBuffer
|
|
{
|
|
ME_DisplayItem *pFirst, *pLast;
|
|
ME_Style *pCharStyle;
|
|
ME_Style *pDefaultStyle;
|
|
} ME_TextBuffer;
|
|
|
|
typedef struct tagME_Cursor
|
|
{
|
|
ME_Paragraph *para;
|
|
ME_Run *run;
|
|
int nOffset;
|
|
} ME_Cursor;
|
|
|
|
typedef enum {
|
|
umAddToUndo,
|
|
umAddToRedo,
|
|
umIgnore,
|
|
umAddBackToUndo
|
|
} ME_UndoMode;
|
|
|
|
typedef enum {
|
|
undoActive,
|
|
undoSuspended,
|
|
undoDisabled
|
|
} ME_UndoControlState;
|
|
|
|
enum undo_type
|
|
{
|
|
undo_insert_run,
|
|
undo_delete_run,
|
|
undo_join_paras,
|
|
undo_split_para,
|
|
undo_set_para_fmt,
|
|
undo_set_char_fmt,
|
|
undo_end_transaction, /* marks the end of a group of changes for undo */
|
|
undo_potential_end_transaction /* allows grouping typed chars for undo */
|
|
};
|
|
|
|
struct insert_run_item
|
|
{
|
|
int pos, len;
|
|
WCHAR *str;
|
|
ME_Style *style;
|
|
DWORD flags;
|
|
};
|
|
|
|
struct delete_run_item
|
|
{
|
|
int pos, len;
|
|
};
|
|
|
|
struct join_paras_item
|
|
{
|
|
int pos;
|
|
};
|
|
|
|
struct split_para_item
|
|
{
|
|
int pos;
|
|
PARAFORMAT2 fmt;
|
|
ME_BorderRect border;
|
|
ME_String *eol_str;
|
|
DWORD flags;
|
|
ME_BorderRect cell_border;
|
|
int cell_right_boundary;
|
|
};
|
|
|
|
struct set_para_fmt_item
|
|
{
|
|
int pos;
|
|
PARAFORMAT2 fmt;
|
|
ME_BorderRect border;
|
|
};
|
|
|
|
struct set_char_fmt_item
|
|
{
|
|
int pos, len;
|
|
CHARFORMAT2W fmt;
|
|
};
|
|
|
|
struct undo_item
|
|
{
|
|
struct list entry;
|
|
enum undo_type type;
|
|
union
|
|
{
|
|
struct insert_run_item insert_run;
|
|
struct delete_run_item delete_run;
|
|
struct join_paras_item join_paras;
|
|
struct split_para_item split_para;
|
|
struct set_para_fmt_item set_para_fmt;
|
|
struct set_char_fmt_item set_char_fmt;
|
|
} u;
|
|
};
|
|
|
|
typedef enum {
|
|
stPosition = 0,
|
|
stWord,
|
|
stLine,
|
|
stParagraph,
|
|
stDocument
|
|
} ME_SelectionType;
|
|
|
|
typedef struct tagME_FontTableItem {
|
|
BYTE bCharSet;
|
|
WCHAR *szFaceName;
|
|
} ME_FontTableItem;
|
|
|
|
|
|
#define STREAMIN_BUFFER_SIZE 4096 /* M$ compatibility */
|
|
|
|
struct tagME_InStream {
|
|
EDITSTREAM *editstream;
|
|
DWORD dwSize;
|
|
DWORD dwUsed;
|
|
char buffer[STREAMIN_BUFFER_SIZE];
|
|
};
|
|
typedef struct tagME_InStream ME_InStream;
|
|
|
|
typedef struct tagME_TextEditor
|
|
{
|
|
#ifdef __REACTOS__
|
|
HWND hWnd, hwndParent;
|
|
#endif
|
|
ITextHost2 *texthost;
|
|
unsigned int bEmulateVersion10 : 1;
|
|
unsigned int in_place_active : 1;
|
|
unsigned int have_texthost2 : 1;
|
|
ME_TextBuffer *pBuffer;
|
|
ME_Cursor *pCursors;
|
|
#ifdef __REACTOS__
|
|
DWORD styleFlags;
|
|
#endif
|
|
DWORD props;
|
|
DWORD scrollbars;
|
|
int nCursors;
|
|
SIZE sizeWindow;
|
|
int nTotalLength, nLastTotalLength;
|
|
int nTotalWidth, nLastTotalWidth;
|
|
int nAvailWidth; /* 0 = wrap to client area, else wrap width in twips */
|
|
int nUDArrowX;
|
|
int total_rows;
|
|
int nEventMask;
|
|
int nModifyStep;
|
|
struct list undo_stack;
|
|
struct list redo_stack;
|
|
int nUndoStackSize;
|
|
int nUndoLimit;
|
|
ME_UndoMode nUndoMode;
|
|
ME_UndoControlState undo_ctl_state;
|
|
int nParagraphs;
|
|
LONG nLastSelStart, nLastSelEnd;
|
|
ME_Paragraph *last_sel_start_para, *last_sel_end_para;
|
|
ME_FontCacheItem pFontCache[HFONT_CACHE_SIZE];
|
|
int nZoomNumerator, nZoomDenominator;
|
|
RECT rcFormat;
|
|
BOOL bWordWrap;
|
|
int nTextLimit;
|
|
EDITWORDBREAKPROCW pfnWordBreak;
|
|
IRichEditOle *richole;
|
|
LPRICHEDITOLECALLBACK lpOleCallback;
|
|
/*TEXTMODE variable; contains only one of each of the following options:
|
|
*TM_RICHTEXT or TM_PLAINTEXT
|
|
*TM_SINGLELEVELUNDO or TM_MULTILEVELUNDO
|
|
*TM_SINGLECODEPAGE or TM_MULTICODEPAGE*/
|
|
int mode;
|
|
BOOL bHideSelection;
|
|
BOOL AutoURLDetect_bEnable;
|
|
WCHAR password_char;
|
|
BOOL bHaveFocus;
|
|
DWORD freeze_count;
|
|
#ifndef __REACTOS__
|
|
/*for IME */
|
|
int imeStartIndex;
|
|
#endif
|
|
DWORD selofs; /* The size of the selection bar on the left side of control */
|
|
ME_SelectionType nSelectionType;
|
|
|
|
/* Track previous notified selection */
|
|
CHARRANGE notified_cr;
|
|
|
|
/* Cache previously set scrollbar info */
|
|
SCROLLINFO vert_si, horz_si;
|
|
unsigned int vert_sb_enabled : 1;
|
|
unsigned int horz_sb_enabled : 1;
|
|
|
|
int caret_height;
|
|
BOOL caret_hidden;
|
|
BOOL bMouseCaptured;
|
|
int wheel_remain;
|
|
TXTBACKSTYLE back_style;
|
|
struct list style_list;
|
|
struct list reobj_list;
|
|
struct wine_rb_tree marked_paras;
|
|
} ME_TextEditor;
|
|
|
|
typedef struct tagME_Context
|
|
{
|
|
HDC hDC;
|
|
POINT pt;
|
|
RECT rcView;
|
|
SIZE dpi;
|
|
int nAvailWidth;
|
|
ME_Style *current_style;
|
|
HFONT orig_font;
|
|
|
|
/* those are valid inside ME_WrapTextParagraph and related */
|
|
ME_TextEditor *editor;
|
|
} ME_Context;
|
|
|
|
struct text_selection
|
|
{
|
|
ITextSelection ITextSelection_iface;
|
|
LONG ref;
|
|
|
|
struct text_services *services;
|
|
};
|
|
|
|
struct text_services
|
|
{
|
|
IUnknown IUnknown_inner;
|
|
ITextServices ITextServices_iface;
|
|
IRichEditOle IRichEditOle_iface;
|
|
ITextDocument2Old ITextDocument2Old_iface;
|
|
IUnknown *outer_unk;
|
|
LONG ref;
|
|
ME_TextEditor *editor;
|
|
struct text_selection *text_selection;
|
|
struct list rangelist;
|
|
struct list clientsites;
|
|
char spare[256]; /* for bug #12179 */
|
|
};
|
|
|
|
#endif
|