mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 14:43:02 +00:00
[RICHED20] Sync to Wine-10.0 (#8078)
[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>
This commit is contained in:
parent
c7a7376545
commit
b6925bdd6f
29 changed files with 4214 additions and 2262 deletions
|
@ -1,6 +1,5 @@
|
|||
|
||||
remove_definitions(-D_CRT_NON_CONFORMING_SWPRINTFS)
|
||||
add_definitions(-D__ROS_LONG64__)
|
||||
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
|
||||
spec2def(riched20.dll riched20.spec ADD_IMPORTLIB)
|
||||
|
||||
|
@ -44,7 +43,7 @@ endif()
|
|||
add_typelib(riched_tom.idl)
|
||||
add_dependencies(riched20 stdole2)
|
||||
set_module_type(riched20 win32dll)
|
||||
target_link_libraries(riched20 wine uuid)
|
||||
target_link_libraries(riched20 wine uuid oldnames)
|
||||
add_importlibs(riched20 ole32 oleaut32 usp10 imm32 user32 gdi32 msvcrt kernel32 ntdll)
|
||||
add_pch(riched20 precomp.h SOURCE)
|
||||
add_cd_file(TARGET riched20 DESTINATION reactos/system32 FOR all)
|
||||
|
|
|
@ -39,14 +39,14 @@ static void ME_SetCursorToEnd(ME_TextEditor *editor, ME_Cursor *cursor, BOOL fin
|
|||
}
|
||||
|
||||
|
||||
int ME_GetSelectionOfs(ME_TextEditor *editor, int *from, int *to)
|
||||
int ME_GetSelectionOfs(ME_TextEditor *editor, LONG *from, LONG *to)
|
||||
{
|
||||
*from = ME_GetCursorOfs(&editor->pCursors[0]);
|
||||
*to = ME_GetCursorOfs(&editor->pCursors[1]);
|
||||
|
||||
if (*from > *to)
|
||||
{
|
||||
int tmp = *from;
|
||||
LONG tmp = *from;
|
||||
*from = *to;
|
||||
*to = tmp;
|
||||
return 1;
|
||||
|
@ -160,7 +160,7 @@ int set_selection_cursors(ME_TextEditor *editor, int from, int to)
|
|||
/* deselected and caret moved to end of the current selection */
|
||||
if (from < 0)
|
||||
{
|
||||
int start, end;
|
||||
LONG start, end;
|
||||
ME_GetSelectionOfs(editor, &start, &end);
|
||||
if (start != end)
|
||||
{
|
||||
|
@ -461,7 +461,7 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
|
|||
/* c = updated data now */
|
||||
|
||||
if (c.run == cursor.run) c.run->nCharOfs -= shift;
|
||||
editor_propagate_char_ofs( NULL, c.run, shift );
|
||||
editor_propagate_char_ofs( editor, NULL, c.run, shift );
|
||||
|
||||
if (!cursor.run->len)
|
||||
{
|
||||
|
@ -487,9 +487,9 @@ BOOL ME_DeleteTextAtCursor(ME_TextEditor *editor, int nCursor, int nChars)
|
|||
nChars, FALSE);
|
||||
}
|
||||
|
||||
static struct re_object* create_re_object(const REOBJECT *reo)
|
||||
static struct re_object* create_re_object(const REOBJECT *reo, ME_Run *run)
|
||||
{
|
||||
struct re_object *reobj = heap_alloc(sizeof(*reobj));
|
||||
struct re_object *reobj = malloc(sizeof(*reobj));
|
||||
|
||||
if (!reobj)
|
||||
{
|
||||
|
@ -497,24 +497,54 @@ static struct re_object* create_re_object(const REOBJECT *reo)
|
|||
return NULL;
|
||||
}
|
||||
ME_CopyReObject(&reobj->obj, reo, REO_GETOBJ_ALL_INTERFACES);
|
||||
reobj->run = run;
|
||||
return reobj;
|
||||
}
|
||||
|
||||
void ME_InsertOLEFromCursor(ME_TextEditor *editor, const REOBJECT* reo, int nCursor)
|
||||
HRESULT editor_insert_oleobj(ME_TextEditor *editor, const REOBJECT *reo)
|
||||
{
|
||||
ME_Run *run, *prev;
|
||||
const WCHAR space = ' ';
|
||||
struct re_object *reobj_prev = NULL;
|
||||
ME_Cursor *cursor = editor->pCursors + nCursor;
|
||||
ME_Style *style = style_get_insert_style( editor, cursor );
|
||||
ME_Cursor *cursor, cursor_from_ofs;
|
||||
ME_Style *style;
|
||||
HRESULT hr;
|
||||
SIZEL extent;
|
||||
|
||||
if (editor->lpOleCallback)
|
||||
{
|
||||
hr = IRichEditOleCallback_QueryInsertObject(editor->lpOleCallback, (LPCLSID)&reo->clsid, reo->pstg, REO_CP_SELECTION);
|
||||
if (hr != S_OK)
|
||||
return hr;
|
||||
}
|
||||
|
||||
extent = reo->sizel;
|
||||
if (!extent.cx && !extent.cy && reo->poleobj)
|
||||
{
|
||||
hr = IOleObject_GetExtent( reo->poleobj, DVASPECT_CONTENT, &extent );
|
||||
if (FAILED(hr))
|
||||
{
|
||||
extent.cx = 0;
|
||||
extent.cy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (reo->cp == REO_CP_SELECTION)
|
||||
cursor = editor->pCursors;
|
||||
else
|
||||
{
|
||||
cursor_from_char_ofs( editor, reo->cp, &cursor_from_ofs );
|
||||
cursor = &cursor_from_ofs;
|
||||
}
|
||||
style = style_get_insert_style( editor, cursor );
|
||||
|
||||
/* FIXME no no no */
|
||||
if (ME_IsSelection(editor))
|
||||
ME_DeleteSelection(editor);
|
||||
|
||||
run = run_insert( editor, cursor, style, &space, 1, MERF_GRAPHICS );
|
||||
|
||||
run->reobj = create_re_object( reo );
|
||||
run->reobj = create_re_object( reo, run );
|
||||
run->reobj->obj.sizel = extent;
|
||||
|
||||
prev = run;
|
||||
while ((prev = run_prev_all_paras( prev )))
|
||||
|
@ -531,6 +561,7 @@ void ME_InsertOLEFromCursor(ME_TextEditor *editor, const REOBJECT* reo, int nCur
|
|||
list_add_head(&editor->reobj_list, &run->reobj->entry);
|
||||
|
||||
ME_ReleaseStyle( style );
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -816,15 +847,18 @@ ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs)
|
|||
}
|
||||
else
|
||||
{
|
||||
para = para_next( para );
|
||||
if (!para_next( para ))
|
||||
ME_Paragraph *other_para = para_next( para );
|
||||
if (!para_next( other_para ))
|
||||
{
|
||||
if (cursor->run == run) return FALSE;
|
||||
nOffset = 0;
|
||||
break;
|
||||
}
|
||||
if (para->nFlags & MEPF_ROWSTART) para = para_next( para );
|
||||
if (cursor->run == run) run = para_first_run( para );
|
||||
if (other_para->nFlags & MEPF_ROWSTART) other_para = para_next( other_para );
|
||||
if (cursor->run == run) {
|
||||
para = other_para;
|
||||
run = para_first_run( para );
|
||||
}
|
||||
nOffset = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -1030,32 +1064,17 @@ static BOOL cursor_from_virtual_coords( ME_TextEditor *editor, int x, int y,
|
|||
*
|
||||
* x & y are pixel positions in client coordinates.
|
||||
*
|
||||
* isExact will be set to TRUE if the run is directly under the pixel
|
||||
* position, FALSE if it not, unless isExact is set to NULL.
|
||||
*
|
||||
* return FALSE if outside client area and the cursor is not set,
|
||||
* otherwise TRUE is returned.
|
||||
* return TRUE if the run is directly under the pixel
|
||||
* position, FALSE if it not.
|
||||
*/
|
||||
BOOL ME_CharFromPos(ME_TextEditor *editor, int x, int y,
|
||||
ME_Cursor *cursor, BOOL *isExact)
|
||||
BOOL cursor_from_coords( ME_TextEditor *editor, int x, int y, ME_Cursor *cursor )
|
||||
{
|
||||
RECT rc;
|
||||
BOOL bResult;
|
||||
|
||||
ITextHost_TxGetClientRect(editor->texthost, &rc);
|
||||
if (x < 0 || y < 0 || x >= rc.right || y >= rc.bottom) {
|
||||
if (isExact) *isExact = FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
x += editor->horz_si.nPos;
|
||||
y += editor->vert_si.nPos;
|
||||
bResult = cursor_from_virtual_coords( editor, x, y, cursor, FALSE );
|
||||
if (isExact) *isExact = bResult;
|
||||
return TRUE;
|
||||
return cursor_from_virtual_coords( editor, x, y, cursor, FALSE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Extends the selection with a word, line, or paragraph selection type.
|
||||
*
|
||||
* The selection is anchored by editor->pCursors[2-3] such that the text
|
||||
|
@ -1405,7 +1424,7 @@ BOOL ME_IsSelection(ME_TextEditor *editor)
|
|||
|
||||
void ME_DeleteSelection(ME_TextEditor *editor)
|
||||
{
|
||||
int from, to;
|
||||
LONG from, to;
|
||||
int nStartCursor = ME_GetSelectionOfs(editor, &from, &to);
|
||||
int nEndCursor = nStartCursor ^ 1;
|
||||
ME_DeleteTextAtCursor(editor, nStartCursor, to - from);
|
||||
|
@ -1439,7 +1458,7 @@ void ME_SendSelChange(ME_TextEditor *editor)
|
|||
|
||||
if (editor->nEventMask & ENM_SELCHANGE)
|
||||
{
|
||||
TRACE("cpMin=%d cpMax=%d seltyp=%d (%s %s)\n",
|
||||
TRACE("cpMin=%ld cpMax=%ld seltyp=%d (%s %s)\n",
|
||||
sc.chrg.cpMin, sc.chrg.cpMax, sc.seltyp,
|
||||
(sc.seltyp & SEL_TEXT) ? "SEL_TEXT" : "",
|
||||
(sc.seltyp & SEL_MULTICHAR) ? "SEL_MULTICHAR" : "");
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define NONAMELESSUNION
|
||||
|
||||
#include "editor.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
|
||||
|
@ -77,7 +75,7 @@ static ULONG WINAPI EnumFormatImpl_AddRef(IEnumFORMATETC *iface)
|
|||
{
|
||||
EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface);
|
||||
LONG ref = InterlockedIncrement(&This->ref);
|
||||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
TRACE("(%p) ref=%ld\n", This, ref);
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
@ -85,11 +83,11 @@ static ULONG WINAPI EnumFormatImpl_Release(IEnumFORMATETC *iface)
|
|||
{
|
||||
EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
TRACE("(%p) ref=%ld\n", This, ref);
|
||||
|
||||
if(!ref) {
|
||||
GlobalFree(This->fmtetc);
|
||||
heap_free(This);
|
||||
free(This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -100,7 +98,7 @@ static HRESULT WINAPI EnumFormatImpl_Next(IEnumFORMATETC *iface, ULONG celt,
|
|||
{
|
||||
EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface);
|
||||
ULONG count = 0;
|
||||
TRACE("(%p)->(%d %p %p)\n", This, celt, rgelt, pceltFetched);
|
||||
TRACE("(%p)->(%ld %p %p)\n", This, celt, rgelt, pceltFetched);
|
||||
|
||||
if(!rgelt)
|
||||
return E_INVALIDARG;
|
||||
|
@ -119,7 +117,7 @@ static HRESULT WINAPI EnumFormatImpl_Skip(IEnumFORMATETC *iface, ULONG celt)
|
|||
{
|
||||
EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface);
|
||||
ULONG count = 0;
|
||||
TRACE("(%p)->(%d)\n", This, celt);
|
||||
TRACE("(%p)->(%ld)\n", This, celt);
|
||||
|
||||
count = min(celt, This->fmtetc_cnt-This->cur);
|
||||
This->cur += count;
|
||||
|
@ -165,7 +163,7 @@ static HRESULT EnumFormatImpl_Create(const FORMATETC *fmtetc, UINT fmtetc_cnt,
|
|||
EnumFormatImpl *ret;
|
||||
TRACE("\n");
|
||||
|
||||
ret = heap_alloc(sizeof(EnumFormatImpl));
|
||||
ret = malloc(sizeof(EnumFormatImpl));
|
||||
ret->IEnumFORMATETC_iface.lpVtbl = &VT_EnumFormatImpl;
|
||||
ret->ref = 1;
|
||||
ret->cur = 0;
|
||||
|
@ -194,7 +192,7 @@ static ULONG WINAPI DataObjectImpl_AddRef(IDataObject* iface)
|
|||
{
|
||||
DataObjectImpl *This = impl_from_IDataObject(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
TRACE("(%p) ref=%ld\n", This, ref);
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
@ -202,13 +200,13 @@ static ULONG WINAPI DataObjectImpl_Release(IDataObject* iface)
|
|||
{
|
||||
DataObjectImpl *This = impl_from_IDataObject(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
TRACE("(%p) ref=%d\n",This, ref);
|
||||
TRACE("(%p) ref=%ld\n",This, ref);
|
||||
|
||||
if(!ref) {
|
||||
if(This->unicode) GlobalFree(This->unicode);
|
||||
if(This->rtf) GlobalFree(This->rtf);
|
||||
if(This->fmtetc) GlobalFree(This->fmtetc);
|
||||
heap_free(This);
|
||||
free(This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -217,7 +215,7 @@ static ULONG WINAPI DataObjectImpl_Release(IDataObject* iface)
|
|||
static HRESULT WINAPI DataObjectImpl_GetData(IDataObject* iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
|
||||
{
|
||||
DataObjectImpl *This = impl_from_IDataObject(iface);
|
||||
TRACE("(%p)->(fmt=0x%08x tym=0x%08x)\n", This, pformatetc->cfFormat, pformatetc->tymed);
|
||||
TRACE("(%p)->(fmt=0x%08x tym=0x%08lx)\n", This, pformatetc->cfFormat, pformatetc->tymed);
|
||||
|
||||
if(pformatetc->lindex != -1)
|
||||
return DV_E_LINDEX;
|
||||
|
@ -226,9 +224,9 @@ static HRESULT WINAPI DataObjectImpl_GetData(IDataObject* iface, FORMATETC *pfor
|
|||
return DV_E_TYMED;
|
||||
|
||||
if(This->unicode && pformatetc->cfFormat == CF_UNICODETEXT)
|
||||
pmedium->u.hGlobal = This->unicode;
|
||||
pmedium->hGlobal = This->unicode;
|
||||
else if(This->rtf && pformatetc->cfFormat == cfRTF)
|
||||
pmedium->u.hGlobal = This->rtf;
|
||||
pmedium->hGlobal = This->rtf;
|
||||
else
|
||||
return DV_E_FORMATETC;
|
||||
|
||||
|
@ -250,7 +248,7 @@ static HRESULT WINAPI DataObjectImpl_QueryGetData(IDataObject* iface, FORMATETC
|
|||
DataObjectImpl *This = impl_from_IDataObject(iface);
|
||||
UINT i;
|
||||
BOOL foundFormat = FALSE;
|
||||
TRACE("(%p)->(fmt=0x%08x tym=0x%08x)\n", This, pformatetc->cfFormat, pformatetc->tymed);
|
||||
TRACE("(%p)->(fmt=0x%08x tym=0x%08lx)\n", This, pformatetc->cfFormat, pformatetc->tymed);
|
||||
|
||||
if(pformatetc->lindex != -1)
|
||||
return DV_E_LINDEX;
|
||||
|
@ -290,10 +288,10 @@ static HRESULT WINAPI DataObjectImpl_EnumFormatEtc(IDataObject* iface, DWORD dwD
|
|||
IEnumFORMATETC **ppenumFormatEtc)
|
||||
{
|
||||
DataObjectImpl *This = impl_from_IDataObject(iface);
|
||||
TRACE("(%p)->(%d)\n", This, dwDirection);
|
||||
TRACE("(%p)->(%ld)\n", This, dwDirection);
|
||||
|
||||
if(dwDirection != DATADIR_GET) {
|
||||
FIXME("Unsupported direction: %d\n", dwDirection);
|
||||
FIXME("Unsupported direction: %ld\n", dwDirection);
|
||||
/* WinXP riched20 also returns E_NOTIMPL in this case */
|
||||
*ppenumFormatEtc = NULL;
|
||||
return E_NOTIMPL;
|
||||
|
@ -375,7 +373,7 @@ static DWORD CALLBACK ME_AppendToHGLOBAL(DWORD_PTR dwCookie, LPBYTE lpBuff, LONG
|
|||
if (pData->nLength+cb+1 >= cb) {
|
||||
/* round up to 2^17 */
|
||||
int nNewSize = (((nMaxSize+cb+1)|0x1FFFF)+1) & 0xFFFE0000;
|
||||
pData->hData = GlobalReAlloc(pData->hData, nNewSize, 0);
|
||||
pData->hData = GlobalReAlloc(pData->hData, nNewSize, GMEM_MOVEABLE);
|
||||
}
|
||||
pDest = GlobalLock(pData->hData);
|
||||
memcpy(pDest + pData->nLength, lpBuff, cb);
|
||||
|
@ -397,7 +395,7 @@ static HGLOBAL get_rtf_text(ME_TextEditor *editor, const ME_Cursor *start, int n
|
|||
es.dwCookie = (DWORD_PTR)&gds;
|
||||
es.pfnCallback = ME_AppendToHGLOBAL;
|
||||
ME_StreamOutRange(editor, SF_RTF, start, nChars, &es);
|
||||
GlobalReAlloc(gds.hData, gds.nLength+1, 0);
|
||||
GlobalReAlloc(gds.hData, gds.nLength+1, GMEM_MOVEABLE);
|
||||
return gds.hData;
|
||||
}
|
||||
|
||||
|
@ -407,7 +405,7 @@ HRESULT ME_GetDataObject(ME_TextEditor *editor, const ME_Cursor *start, int nCha
|
|||
DataObjectImpl *obj;
|
||||
TRACE("(%p,%d,%d)\n", editor, ME_GetCursorOfs(start), nChars);
|
||||
|
||||
obj = heap_alloc(sizeof(DataObjectImpl));
|
||||
obj = malloc(sizeof(DataObjectImpl));
|
||||
if(cfRTF == 0)
|
||||
cfRTF = RegisterClipboardFormatA("Rich Text Format");
|
||||
|
||||
|
|
|
@ -224,8 +224,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#define NONAMELESSUNION
|
||||
|
||||
#include "editor.h"
|
||||
#include "commdlg.h"
|
||||
#include "winreg.h"
|
||||
|
@ -254,10 +252,9 @@ static BOOL ME_UpdateLinkAttribute(ME_TextEditor *editor, ME_Cursor *start, int
|
|||
|
||||
HINSTANCE dll_instance = NULL;
|
||||
BOOL me_debug = FALSE;
|
||||
HANDLE me_heap = NULL;
|
||||
|
||||
static ME_TextBuffer *ME_MakeText(void) {
|
||||
ME_TextBuffer *buf = heap_alloc(sizeof(*buf));
|
||||
ME_TextBuffer *buf = malloc(sizeof(*buf));
|
||||
ME_DisplayItem *p1 = ME_MakeDI(diTextStart);
|
||||
ME_DisplayItem *p2 = ME_MakeDI(diTextEnd);
|
||||
|
||||
|
@ -302,7 +299,7 @@ static LRESULT ME_StreamInText(ME_TextEditor *editor, DWORD dwFormat, ME_InStrea
|
|||
|
||||
static const char bom_utf8[] = {0xEF, 0xBB, 0xBF};
|
||||
|
||||
TRACE("%08x %p\n", dwFormat, stream);
|
||||
TRACE("%08lx %p\n", dwFormat, stream);
|
||||
|
||||
do {
|
||||
LONG nWideChars = 0;
|
||||
|
@ -618,7 +615,7 @@ void ME_RTFParAttrHook(RTF_Info *info)
|
|||
{
|
||||
while (info->rtfParam > info->nestingLevel)
|
||||
{
|
||||
RTFTable *tableDef = heap_alloc_zero(sizeof(*tableDef));
|
||||
RTFTable *tableDef = calloc(1, sizeof(*tableDef));
|
||||
tableDef->parent = info->tableDef;
|
||||
info->tableDef = tableDef;
|
||||
|
||||
|
@ -652,7 +649,7 @@ void ME_RTFParAttrHook(RTF_Info *info)
|
|||
ME_Paragraph *para;
|
||||
|
||||
if (!info->tableDef)
|
||||
info->tableDef = heap_alloc_zero(sizeof(*info->tableDef));
|
||||
info->tableDef = calloc(1, sizeof(*info->tableDef));
|
||||
tableDef = info->tableDef;
|
||||
RTFFlushOutputBuffer(info);
|
||||
if (tableDef->row_start && tableDef->row_start->nFlags & MEPF_ROWEND)
|
||||
|
@ -1070,14 +1067,14 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
|
|||
{
|
||||
tableDef = info->tableDef;
|
||||
info->tableDef = tableDef->parent;
|
||||
heap_free(tableDef);
|
||||
free(tableDef);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
info->tableDef = tableDef->parent;
|
||||
heap_free(tableDef);
|
||||
free(tableDef);
|
||||
}
|
||||
}
|
||||
else /* v1.0 - v3.0 */
|
||||
|
@ -1138,13 +1135,13 @@ static HRESULT insert_static_object(ME_TextEditor *editor, HENHMETAFILE hemf, HB
|
|||
if (hemf)
|
||||
{
|
||||
stgm.tymed = TYMED_ENHMF;
|
||||
stgm.u.hEnhMetaFile = hemf;
|
||||
stgm.hEnhMetaFile = hemf;
|
||||
fm.cfFormat = CF_ENHMETAFILE;
|
||||
}
|
||||
else if (hbmp)
|
||||
{
|
||||
stgm.tymed = TYMED_GDI;
|
||||
stgm.u.hBitmap = hbmp;
|
||||
stgm.hBitmap = hbmp;
|
||||
fm.cfFormat = CF_BITMAP;
|
||||
}
|
||||
else return E_FAIL;
|
||||
|
@ -1180,8 +1177,7 @@ static HRESULT insert_static_object(ME_TextEditor *editor, HENHMETAFILE hemf, HB
|
|||
reobject.dwFlags = 0; /* FIXME */
|
||||
reobject.dwUser = 0;
|
||||
|
||||
ME_InsertOLEFromCursor(editor, &reobject, 0);
|
||||
hr = S_OK;
|
||||
hr = editor_insert_oleobj(editor, &reobject);
|
||||
}
|
||||
|
||||
if (lpObject) IOleObject_Release(lpObject);
|
||||
|
@ -1236,7 +1232,7 @@ static DWORD read_hex_data( RTF_Info *info, BYTE **out )
|
|||
return 0;
|
||||
}
|
||||
|
||||
buf = HeapAlloc( GetProcessHeap(), 0, size );
|
||||
buf = malloc(size);
|
||||
if (!buf) return 0;
|
||||
|
||||
val = info->rtfMajor;
|
||||
|
@ -1245,7 +1241,7 @@ static DWORD read_hex_data( RTF_Info *info, BYTE **out )
|
|||
RTFGetToken( info );
|
||||
if (info->rtfClass == rtfEOF)
|
||||
{
|
||||
HeapFree( GetProcessHeap(), 0, buf );
|
||||
free(buf);
|
||||
return 0;
|
||||
}
|
||||
if (info->rtfClass != rtfText) break;
|
||||
|
@ -1254,7 +1250,7 @@ static DWORD read_hex_data( RTF_Info *info, BYTE **out )
|
|||
if (read >= size)
|
||||
{
|
||||
size *= 2;
|
||||
buf = HeapReAlloc( GetProcessHeap(), 0, buf, size );
|
||||
buf = realloc(buf, size);
|
||||
if (!buf) return 0;
|
||||
}
|
||||
buf[read++] = RTFCharToHex(val) * 16 + RTFCharToHex(info->rtfMajor);
|
||||
|
@ -1375,7 +1371,7 @@ static void ME_RTFReadPictGroup(RTF_Info *info)
|
|||
break;
|
||||
}
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, buffer );
|
||||
free( buffer );
|
||||
RTFRouteToken( info ); /* feed "}" back to router */
|
||||
return;
|
||||
}
|
||||
|
@ -1576,14 +1572,15 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
|
|||
{
|
||||
RTF_Info parser;
|
||||
ME_Style *style;
|
||||
int from, to, nUndoMode;
|
||||
LONG from, to;
|
||||
int nUndoMode;
|
||||
int nEventMask = editor->nEventMask;
|
||||
ME_InStream inStream;
|
||||
BOOL invalidRTF = FALSE;
|
||||
ME_Cursor *selStart, *selEnd;
|
||||
LRESULT num_read = 0; /* bytes read for SF_TEXT, non-control chars inserted for SF_RTF */
|
||||
|
||||
TRACE("stream==%p editor==%p format==0x%X\n", stream, editor, format);
|
||||
TRACE("stream==%p editor==%p format==0x%lX\n", stream, editor, format);
|
||||
editor->nEventMask = 0;
|
||||
|
||||
ME_GetSelectionOfs(editor, &from, &to);
|
||||
|
@ -1618,9 +1615,17 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
|
|||
{
|
||||
style = editor->pBuffer->pDefaultStyle;
|
||||
ME_AddRefStyle(style);
|
||||
if (format & SFF_SELECTION)
|
||||
{
|
||||
ME_GetSelection(editor, &selStart, &selEnd);
|
||||
ME_InternalDeleteText(editor, selStart, to - from, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_selection_cursors(editor, 0, 0);
|
||||
ME_InternalDeleteText(editor, &editor->pCursors[1],
|
||||
ME_GetTextLength(editor), FALSE);
|
||||
}
|
||||
from = to = 0;
|
||||
ME_ClearTempStyle(editor);
|
||||
editor_set_default_para_fmt( editor, &editor->pCursors[0].para->fmt );
|
||||
|
@ -1849,11 +1854,11 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, const CHARRANGE *chrg, const WCH
|
|||
ME_Cursor cursor;
|
||||
WCHAR wLastChar = ' ';
|
||||
|
||||
TRACE("flags==0x%08x, chrg->cpMin==%d, chrg->cpMax==%d text==%s\n",
|
||||
TRACE("flags==0x%08lx, chrg->cpMin==%ld, chrg->cpMax==%ld text==%s\n",
|
||||
flags, chrg->cpMin, chrg->cpMax, debugstr_w(text));
|
||||
|
||||
if (flags & ~(FR_DOWN | FR_MATCHCASE | FR_WHOLEWORD))
|
||||
FIXME("Flags 0x%08x not implemented\n",
|
||||
FIXME("Flags 0x%08lx not implemented\n",
|
||||
flags & ~(FR_DOWN | FR_MATCHCASE | FR_WHOLEWORD));
|
||||
|
||||
nMin = chrg->cpMin;
|
||||
|
@ -2092,11 +2097,11 @@ static int ME_GetTextEx(ME_TextEditor *editor, GETTEXTEX *ex, LPARAM pText)
|
|||
if (!ex->cb || !pText) return 0;
|
||||
|
||||
if (ex->flags & ~(GT_SELECTION | GT_USECRLF))
|
||||
FIXME("GETTEXTEX flags 0x%08x not supported\n", ex->flags & ~(GT_SELECTION | GT_USECRLF));
|
||||
FIXME("GETTEXTEX flags 0x%08lx not supported\n", ex->flags & ~(GT_SELECTION | GT_USECRLF));
|
||||
|
||||
if (ex->flags & GT_SELECTION)
|
||||
{
|
||||
int from, to;
|
||||
LONG from, to;
|
||||
int nStartCur = ME_GetSelectionOfs(editor, &from, &to);
|
||||
start = editor->pCursors[nStartCur];
|
||||
nChars = to - from;
|
||||
|
@ -2124,14 +2129,14 @@ static int ME_GetTextEx(ME_TextEditor *editor, GETTEXTEX *ex, LPARAM pText)
|
|||
LRESULT rc;
|
||||
|
||||
buflen = min(crlfmul * nChars, ex->cb - 1);
|
||||
buffer = heap_alloc((buflen + 1) * sizeof(WCHAR));
|
||||
buffer = malloc((buflen + 1) * sizeof(WCHAR));
|
||||
|
||||
nChars = ME_GetTextW(editor, buffer, buflen, &start, nChars, ex->flags & GT_USECRLF, FALSE);
|
||||
rc = WideCharToMultiByte(ex->codepage, 0, buffer, nChars + 1,
|
||||
(LPSTR)pText, ex->cb, ex->lpDefaultChar, ex->lpUsedDefChar);
|
||||
if (rc) rc--; /* do not count 0 terminator */
|
||||
|
||||
heap_free(buffer);
|
||||
free(buffer);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
@ -2151,8 +2156,10 @@ int set_selection( ME_TextEditor *editor, int to, int from )
|
|||
|
||||
if (!editor->bHideSelection) ME_InvalidateSelection( editor );
|
||||
end = set_selection_cursors( editor, to, from );
|
||||
editor_ensure_visible( editor, &editor->pCursors[0] );
|
||||
if (!editor->bHideSelection) ME_InvalidateSelection( editor );
|
||||
update_caret( editor );
|
||||
ME_Repaint( editor );
|
||||
ME_SendSelChange( editor );
|
||||
|
||||
return end;
|
||||
|
@ -2205,7 +2212,7 @@ static HRESULT paste_rtf(ME_TextEditor *editor, FORMATETC *fmt, STGMEDIUM *med)
|
|||
ME_GlobalDestStruct gds;
|
||||
HRESULT hr;
|
||||
|
||||
gds.hData = med->u.hGlobal;
|
||||
gds.hData = med->hGlobal;
|
||||
gds.nLength = 0;
|
||||
es.dwCookie = (DWORD_PTR)&gds;
|
||||
es.pfnCallback = ME_ReadFromHGLOBALRTF;
|
||||
|
@ -2220,7 +2227,7 @@ static HRESULT paste_text(ME_TextEditor *editor, FORMATETC *fmt, STGMEDIUM *med)
|
|||
ME_GlobalDestStruct gds;
|
||||
HRESULT hr;
|
||||
|
||||
gds.hData = med->u.hGlobal;
|
||||
gds.hData = med->hGlobal;
|
||||
gds.nLength = 0;
|
||||
es.dwCookie = (DWORD_PTR)&gds;
|
||||
es.pfnCallback = ME_ReadFromHGLOBALUnicode;
|
||||
|
@ -2234,7 +2241,7 @@ static HRESULT paste_emf(ME_TextEditor *editor, FORMATETC *fmt, STGMEDIUM *med)
|
|||
HRESULT hr;
|
||||
SIZEL sz = {0, 0};
|
||||
|
||||
hr = insert_static_object( editor, med->u.hEnhMetaFile, NULL, &sz );
|
||||
hr = insert_static_object( editor, med->hEnhMetaFile, NULL, &sz );
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
ME_CommitUndo( editor );
|
||||
|
@ -2292,7 +2299,7 @@ static BOOL paste_special(ME_TextEditor *editor, UINT cf, REPASTESPECIAL *ps, BO
|
|||
init_paste_formats();
|
||||
|
||||
if (ps && ps->dwAspect != DVASPECT_CONTENT)
|
||||
FIXME("Ignoring aspect %x\n", ps->dwAspect);
|
||||
FIXME("Ignoring aspect %lx\n", ps->dwAspect);
|
||||
|
||||
hr = OleGetClipboard( &data );
|
||||
if (hr != S_OK) return FALSE;
|
||||
|
@ -2375,7 +2382,7 @@ HRESULT editor_copy_or_cut( ME_TextEditor *editor, BOOL cut, ME_Cursor *start, i
|
|||
static BOOL copy_or_cut( ME_TextEditor *editor, BOOL cut )
|
||||
{
|
||||
HRESULT hr;
|
||||
int offs, count;
|
||||
LONG offs, count;
|
||||
int start_cursor = ME_GetSelectionOfs( editor, &offs, &count );
|
||||
ME_Cursor *sel_start = &editor->pCursors[start_cursor];
|
||||
|
||||
|
@ -2421,7 +2428,7 @@ static BOOL handle_enter(ME_TextEditor *editor)
|
|||
{
|
||||
ME_Cursor cursor = editor->pCursors[0];
|
||||
ME_Paragraph *para = cursor.para;
|
||||
int from, to;
|
||||
LONG from, to;
|
||||
ME_Style *style, *eop_style;
|
||||
|
||||
if (editor->props & TXTBIT_READONLY)
|
||||
|
@ -2698,7 +2705,7 @@ static LRESULT handle_wm_char( ME_TextEditor *editor, WCHAR wstr, LPARAM flags )
|
|||
{
|
||||
ME_Cursor cursor = editor->pCursors[0];
|
||||
ME_Paragraph *para = cursor.para;
|
||||
int from, to;
|
||||
LONG from, to;
|
||||
BOOL ctrl_is_down = GetKeyState(VK_CONTROL) & 0x8000;
|
||||
ME_GetSelectionOfs(editor, &from, &to);
|
||||
if (wstr == '\t' &&
|
||||
|
@ -2824,7 +2831,6 @@ static BOOL is_link( ME_Run *run )
|
|||
void editor_set_cursor( ME_TextEditor *editor, int x, int y )
|
||||
{
|
||||
ME_Cursor pos;
|
||||
BOOL is_exact;
|
||||
static HCURSOR cursor_arrow, cursor_hand, cursor_ibeam, cursor_reverse;
|
||||
HCURSOR cursor;
|
||||
|
||||
|
@ -2847,10 +2853,7 @@ void editor_set_cursor( ME_TextEditor *editor, int x, int y )
|
|||
else cursor = cursor_ibeam;
|
||||
}
|
||||
else if (x < editor->rcFormat.left) cursor = cursor_reverse;
|
||||
else
|
||||
{
|
||||
ME_CharFromPos( editor, x, y, &pos, &is_exact );
|
||||
if (is_exact)
|
||||
else if (cursor_from_coords( editor, x, y, &pos ))
|
||||
{
|
||||
ME_Run *run = pos.run;
|
||||
|
||||
|
@ -2858,13 +2861,13 @@ void editor_set_cursor( ME_TextEditor *editor, int x, int y )
|
|||
|
||||
else if (ME_IsSelection( editor ))
|
||||
{
|
||||
int start, end, offset = ME_GetCursorOfs( &pos );
|
||||
LONG start, end;
|
||||
int offset = ME_GetCursorOfs( &pos );
|
||||
|
||||
ME_GetSelectionOfs( editor, &start, &end );
|
||||
if (start <= offset && end >= offset) cursor = cursor_arrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ITextHost_TxSetCursor( editor->texthost, cursor, cursor == cursor_ibeam );
|
||||
}
|
||||
|
@ -2932,10 +2935,11 @@ static BOOL ME_ShowContextMenu(ME_TextEditor *editor, int x, int y)
|
|||
|
||||
ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
|
||||
{
|
||||
ME_TextEditor *ed = heap_alloc(sizeof(*ed));
|
||||
ME_TextEditor *ed = malloc( sizeof(*ed) );
|
||||
int i;
|
||||
LONG selbarwidth;
|
||||
HRESULT hr;
|
||||
HDC hdc;
|
||||
|
||||
ed->sizeWindow.cx = ed->sizeWindow.cy = 0;
|
||||
if (ITextHost_QueryInterface( texthost, &IID_ITextHost2, (void **)&ed->texthost ) == S_OK)
|
||||
|
@ -2962,7 +2966,9 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
|
|||
ed->nZoomNumerator = ed->nZoomDenominator = 0;
|
||||
ed->nAvailWidth = 0; /* wrap to client area */
|
||||
list_init( &ed->style_list );
|
||||
ME_MakeFirstParagraph(ed);
|
||||
|
||||
hdc = ITextHost_TxGetDC( ed->texthost );
|
||||
ME_MakeFirstParagraph( ed, hdc );
|
||||
/* The four cursors are for:
|
||||
* 0 - The position where the caret is shown
|
||||
* 1 - The anchored end of the selection (for normal selection)
|
||||
|
@ -2970,7 +2976,7 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
|
|||
* or paragraph selection.
|
||||
*/
|
||||
ed->nCursors = 4;
|
||||
ed->pCursors = heap_alloc(ed->nCursors * sizeof(*ed->pCursors));
|
||||
ed->pCursors = malloc( ed->nCursors * sizeof(*ed->pCursors) );
|
||||
ME_SetCursorToStart(ed, &ed->pCursors[0]);
|
||||
ed->pCursors[1] = ed->pCursors[0];
|
||||
ed->pCursors[2] = ed->pCursors[0];
|
||||
|
@ -2986,6 +2992,7 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
|
|||
ed->nUndoStackSize = 0;
|
||||
ed->nUndoLimit = STACK_SIZE_DEFAULT;
|
||||
ed->nUndoMode = umAddToUndo;
|
||||
ed->undo_ctl_state = undoActive;
|
||||
ed->nParagraphs = 1;
|
||||
ed->nLastSelStart = ed->nLastSelEnd = 0;
|
||||
ed->last_sel_start_para = ed->last_sel_end_para = ed->pCursors[0].para;
|
||||
|
@ -2997,6 +3004,7 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
|
|||
ed->mode |= (ed->props & TXTBIT_RICHTEXT) ? TM_RICHTEXT : TM_PLAINTEXT;
|
||||
ed->AutoURLDetect_bEnable = FALSE;
|
||||
ed->bHaveFocus = FALSE;
|
||||
ed->freeze_count = 0;
|
||||
ed->bMouseCaptured = FALSE;
|
||||
ed->caret_hidden = FALSE;
|
||||
ed->caret_height = 0;
|
||||
|
@ -3060,6 +3068,9 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
|
|||
list_init( &ed->reobj_list );
|
||||
OleInitialize(NULL);
|
||||
|
||||
wrap_marked_paras_dc( ed, hdc, FALSE );
|
||||
ITextHost_TxReleaseDC( ed->texthost, hdc );
|
||||
|
||||
return ed;
|
||||
}
|
||||
|
||||
|
@ -3096,9 +3107,9 @@ void ME_DestroyEditor(ME_TextEditor *editor)
|
|||
|
||||
OleUninitialize();
|
||||
|
||||
heap_free(editor->pBuffer);
|
||||
heap_free(editor->pCursors);
|
||||
heap_free(editor);
|
||||
free(editor->pBuffer);
|
||||
free(editor->pCursors);
|
||||
free(editor);
|
||||
}
|
||||
|
||||
static inline int get_default_line_height( ME_TextEditor *editor )
|
||||
|
@ -3122,15 +3133,13 @@ static inline int calc_wheel_change( int *remain, int amount_per_click )
|
|||
void link_notify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
int x,y;
|
||||
BOOL isExact;
|
||||
ME_Cursor cursor; /* The start of the clicked text. */
|
||||
ME_Run *run;
|
||||
ENLINK info;
|
||||
|
||||
x = (short)LOWORD(lParam);
|
||||
y = (short)HIWORD(lParam);
|
||||
ME_CharFromPos(editor, x, y, &cursor, &isExact);
|
||||
if (!isExact) return;
|
||||
if (!cursor_from_coords( editor, x, y, &cursor )) return;
|
||||
|
||||
if (is_link( cursor.run ))
|
||||
{ /* The clicked run has CFE_LINK set */
|
||||
|
@ -3160,7 +3169,8 @@ void link_notify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
void ME_ReplaceSel(ME_TextEditor *editor, BOOL can_undo, const WCHAR *str, int len)
|
||||
{
|
||||
int from, to, nStartCursor;
|
||||
LONG from, to;
|
||||
int nStartCursor;
|
||||
ME_Style *style;
|
||||
|
||||
nStartCursor = ME_GetSelectionOfs(editor, &from, &to);
|
||||
|
@ -3295,10 +3305,10 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
|||
case EM_GETSEL:
|
||||
{
|
||||
/* Note: wParam/lParam can be NULL */
|
||||
UINT from, to;
|
||||
PUINT pfrom = wParam ? (PUINT)wParam : &from;
|
||||
PUINT pto = lParam ? (PUINT)lParam : &to;
|
||||
ME_GetSelectionOfs(editor, (int *)pfrom, (int *)pto);
|
||||
LONG from, to;
|
||||
LONG *pfrom = wParam ? (LONG *)wParam : &from;
|
||||
LONG *pto = lParam ? (LONG *)lParam : &to;
|
||||
ME_GetSelectionOfs(editor, pfrom, pto);
|
||||
if ((*pfrom|*pto) & 0xFFFF0000)
|
||||
return -1;
|
||||
return MAKELONG(*pfrom,*pto);
|
||||
|
@ -3307,11 +3317,12 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
|||
{
|
||||
CHARRANGE *pRange = (CHARRANGE *)lParam;
|
||||
ME_GetSelectionOfs(editor, &pRange->cpMin, &pRange->cpMax);
|
||||
TRACE("EM_EXGETSEL = (%d,%d)\n", pRange->cpMin, pRange->cpMax);
|
||||
TRACE("EM_EXGETSEL = (%ld,%ld)\n", pRange->cpMin, pRange->cpMax);
|
||||
return 0;
|
||||
}
|
||||
case EM_SETUNDOLIMIT:
|
||||
{
|
||||
editor_enable_undo(editor);
|
||||
if ((int)wParam < 0)
|
||||
editor->nUndoLimit = STACK_SIZE_DEFAULT;
|
||||
else
|
||||
|
@ -3404,7 +3415,8 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
|||
{
|
||||
LPWSTR wszText;
|
||||
SETTEXTEX *pStruct = (SETTEXTEX *)wParam;
|
||||
int from, to, len;
|
||||
LONG from, to;
|
||||
int len;
|
||||
ME_Style *style;
|
||||
BOOL bRtf, bUnicode, bSelection, bUTF8;
|
||||
int oldModify = editor->nModifyStep;
|
||||
|
@ -3419,7 +3431,7 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
|||
bUnicode = !bRtf && pStruct->codepage == CP_UNICODE;
|
||||
bUTF8 = (lParam && (!strncmp((char *)lParam, utf8_bom, 3)));
|
||||
|
||||
TRACE("EM_SETTEXTEX - %s, flags %d, cp %d\n",
|
||||
TRACE("EM_SETTEXTEX - %s, flags %ld, cp %d\n",
|
||||
bUnicode ? debugstr_w((LPCWSTR)lParam) : debugstr_a((LPCSTR)lParam),
|
||||
pStruct->flags, pStruct->codepage);
|
||||
|
||||
|
@ -3561,7 +3573,7 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
|||
}
|
||||
case WM_CLEAR:
|
||||
{
|
||||
int from, to;
|
||||
LONG from, to;
|
||||
int nStartCursor = ME_GetSelectionOfs(editor, &from, &to);
|
||||
ME_InternalDeleteText(editor, &editor->pCursors[nStartCursor], to-from, FALSE);
|
||||
ME_CommitUndo(editor);
|
||||
|
@ -3626,7 +3638,7 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
|||
ME_InternalDeleteText(editor, &cursor, ME_GetTextLength(editor), FALSE);
|
||||
if (lParam)
|
||||
{
|
||||
TRACE("WM_SETTEXT lParam==%lx\n",lParam);
|
||||
TRACE("WM_SETTEXT lParam==%Ix\n",lParam);
|
||||
if (!strncmp((char *)lParam, "{\\rtf", 5) ||
|
||||
!strncmp((char *)lParam, "{\\urtf", 6))
|
||||
{
|
||||
|
@ -3684,7 +3696,8 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
|||
return ME_GetTextEx(editor, (GETTEXTEX*)wParam, lParam);
|
||||
case EM_GETSELTEXT:
|
||||
{
|
||||
int nFrom, nTo, nStartCur = ME_GetSelectionOfs(editor, &nFrom, &nTo);
|
||||
LONG nFrom, nTo;
|
||||
int nStartCur = ME_GetSelectionOfs(editor, &nFrom, &nTo);
|
||||
ME_Cursor *from = &editor->pCursors[nStartCur];
|
||||
return get_text_range( editor, (WCHAR *)lParam, from, nTo - nFrom );
|
||||
}
|
||||
|
@ -3708,7 +3721,7 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
|||
int nEnd = rng->chrg.cpMax;
|
||||
int textlength = ME_GetTextLength(editor);
|
||||
|
||||
TRACE( "EM_GETTEXTRANGE min = %d max = %d textlength = %d\n", rng->chrg.cpMin, rng->chrg.cpMax, textlength );
|
||||
TRACE( "EM_GETTEXTRANGE min = %ld max = %ld textlength = %d\n", rng->chrg.cpMin, rng->chrg.cpMax, textlength );
|
||||
if (nStart < 0) return 0;
|
||||
if ((nStart == 0 && nEnd == -1) || nEnd > textlength)
|
||||
nEnd = textlength;
|
||||
|
@ -3822,7 +3835,7 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
|||
start_ofs = ME_GetCursorOfs( &cursor );
|
||||
row_end_cursor( row, &cursor, FALSE );
|
||||
end_ofs = ME_GetCursorOfs( &cursor );
|
||||
TRACE( "EM_LINELENGTH(%ld)==%d\n", wParam, end_ofs - start_ofs );
|
||||
TRACE( "EM_LINELENGTH(%Id)==%d\n", wParam, end_ofs - start_ofs );
|
||||
return end_ofs - start_ofs;
|
||||
}
|
||||
case EM_EXLIMITTEXT:
|
||||
|
@ -3870,11 +3883,10 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
|||
case EM_CHARFROMPOS:
|
||||
{
|
||||
ME_Cursor cursor;
|
||||
if (ME_CharFromPos(editor, ((POINTL *)lParam)->x, ((POINTL *)lParam)->y,
|
||||
&cursor, NULL))
|
||||
POINTL *pt = (POINTL *)lParam;
|
||||
|
||||
cursor_from_coords(editor, pt->x, pt->y, &cursor);
|
||||
return ME_GetCursorOfs(&cursor);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
case EM_POSFROMCHAR:
|
||||
{
|
||||
|
@ -4174,20 +4186,23 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
|||
dwIndex = GCS_COMPSTR;
|
||||
|
||||
dwBufLen = ImmGetCompositionStringW(hIMC, dwIndex, NULL, 0);
|
||||
lpCompStr = HeapAlloc(GetProcessHeap(),0,dwBufLen + sizeof(WCHAR));
|
||||
lpCompStr = malloc(dwBufLen + sizeof(WCHAR));
|
||||
ImmGetCompositionStringW(hIMC, dwIndex, lpCompStr, dwBufLen);
|
||||
lpCompStr[dwBufLen/sizeof(WCHAR)] = 0;
|
||||
#ifndef __REACTOS__
|
||||
ME_InsertTextFromCursor(editor,0,lpCompStr,dwBufLen/sizeof(WCHAR),style);
|
||||
#endif
|
||||
HeapFree(GetProcessHeap(), 0, lpCompStr);
|
||||
free(lpCompStr);
|
||||
|
||||
#ifndef __REACTOS__
|
||||
if (dwIndex == GCS_COMPSTR)
|
||||
set_selection_cursors(editor,editor->imeStartIndex,
|
||||
editor->imeStartIndex + dwBufLen/sizeof(WCHAR));
|
||||
else
|
||||
editor->imeStartIndex = ME_GetCursorOfs(&editor->pCursors[0]);
|
||||
#endif
|
||||
}
|
||||
ITextHost_TxImmReleaseContext(editor->texthost, hIMC);
|
||||
ME_ReleaseStyle(style);
|
||||
ME_CommitUndo(editor);
|
||||
ME_UpdateRepaint(editor, FALSE);
|
||||
|
@ -4357,11 +4372,7 @@ int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int buflen,
|
|||
str = get_text( run, 0 );
|
||||
}
|
||||
/* append '\r' to the last paragraph. */
|
||||
#ifdef __REACTOS__
|
||||
if (run == para_end_run( para_prev( editor_end_para( editor ) ) ) && bEOP && buflen)
|
||||
#else
|
||||
if (run == para_end_run( para_prev( editor_end_para( editor ) ) ) && bEOP)
|
||||
#endif
|
||||
{
|
||||
*buffer = '\r';
|
||||
buffer ++;
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
|
||||
struct _RTF_Info;
|
||||
|
||||
extern HINSTANCE dll_instance DECLSPEC_HIDDEN;
|
||||
extern HANDLE me_heap DECLSPEC_HIDDEN;
|
||||
extern HINSTANCE dll_instance;
|
||||
|
||||
#define RUN_IS_HIDDEN(run) ((run)->style->fmt.dwMask & CFM_HIDDEN \
|
||||
&& (run)->style->fmt.dwEffects & CFE_HIDDEN)
|
||||
|
@ -50,51 +49,51 @@ static inline const char *debugstr_run( const ME_Run *run )
|
|||
}
|
||||
|
||||
/* style.c */
|
||||
ME_Style *style_get_insert_style( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
|
||||
ME_Style *ME_MakeStyle(CHARFORMAT2W *style) DECLSPEC_HIDDEN;
|
||||
void ME_AddRefStyle(ME_Style *item) DECLSPEC_HIDDEN;
|
||||
void ME_DestroyStyle(ME_Style *item) DECLSPEC_HIDDEN;
|
||||
void ME_ReleaseStyle(ME_Style *item) DECLSPEC_HIDDEN;
|
||||
ME_Style *ME_ApplyStyle(ME_TextEditor *ed, ME_Style *sSrc, CHARFORMAT2W *style) DECLSPEC_HIDDEN;
|
||||
void select_style(ME_Context *c, ME_Style *s) DECLSPEC_HIDDEN;
|
||||
void ME_InitCharFormat2W(CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN;
|
||||
void ME_SaveTempStyle(ME_TextEditor *editor, ME_Style *style) DECLSPEC_HIDDEN;
|
||||
void ME_ClearTempStyle(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_DumpStyleToBuf(CHARFORMAT2W *pFmt, char buf[2048]) DECLSPEC_HIDDEN;
|
||||
void ME_DumpStyle(ME_Style *s) DECLSPEC_HIDDEN;
|
||||
BOOL cfany_to_cf2w(CHARFORMAT2W *to, const CHARFORMAT2W *from) DECLSPEC_HIDDEN;
|
||||
BOOL cf2w_to_cfany(CHARFORMAT2W *to, const CHARFORMAT2W *from) DECLSPEC_HIDDEN;
|
||||
void ME_CopyCharFormat(CHARFORMAT2W *pDest, const CHARFORMAT2W *pSrc) DECLSPEC_HIDDEN; /* only works with 2W structs */
|
||||
void ME_CharFormatFromLogFont(HDC hDC, const LOGFONTW *lf, CHARFORMAT2W *fmt) DECLSPEC_HIDDEN; /* ditto */
|
||||
ME_Style *style_get_insert_style( ME_TextEditor *editor, ME_Cursor *cursor );
|
||||
ME_Style *ME_MakeStyle(CHARFORMAT2W *style);
|
||||
void ME_AddRefStyle(ME_Style *item);
|
||||
void ME_DestroyStyle(ME_Style *item);
|
||||
void ME_ReleaseStyle(ME_Style *item);
|
||||
ME_Style *ME_ApplyStyle(ME_TextEditor *ed, ME_Style *sSrc, CHARFORMAT2W *style);
|
||||
void select_style(ME_Context *c, ME_Style *s);
|
||||
void ME_InitCharFormat2W(CHARFORMAT2W *pFmt);
|
||||
void ME_SaveTempStyle(ME_TextEditor *editor, ME_Style *style);
|
||||
void ME_ClearTempStyle(ME_TextEditor *editor);
|
||||
void ME_DumpStyleToBuf(CHARFORMAT2W *pFmt, char buf[2048]);
|
||||
void ME_DumpStyle(ME_Style *s);
|
||||
BOOL cfany_to_cf2w(CHARFORMAT2W *to, const CHARFORMAT2W *from);
|
||||
BOOL cf2w_to_cfany(CHARFORMAT2W *to, const CHARFORMAT2W *from);
|
||||
void ME_CopyCharFormat(CHARFORMAT2W *pDest, const CHARFORMAT2W *pSrc); /* only works with 2W structs */
|
||||
void ME_CharFormatFromLogFont(HDC hDC, const LOGFONTW *lf, CHARFORMAT2W *fmt); /* ditto */
|
||||
|
||||
/* list.c */
|
||||
void ME_InsertBefore(ME_DisplayItem *diWhere, ME_DisplayItem *diWhat) DECLSPEC_HIDDEN;
|
||||
void ME_Remove(ME_DisplayItem *diWhere) DECLSPEC_HIDDEN;
|
||||
ME_DisplayItem *ME_FindItemBack(ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN;
|
||||
ME_DisplayItem *ME_FindItemFwd(ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN;
|
||||
ME_DisplayItem *ME_FindItemBackOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN;
|
||||
ME_DisplayItem *ME_MakeDI(ME_DIType type) DECLSPEC_HIDDEN;
|
||||
void ME_DestroyDisplayItem(ME_DisplayItem *item) DECLSPEC_HIDDEN;
|
||||
void ME_DumpDocument(ME_TextBuffer *buffer) DECLSPEC_HIDDEN;
|
||||
void ME_InsertBefore(ME_DisplayItem *diWhere, ME_DisplayItem *diWhat);
|
||||
void ME_Remove(ME_DisplayItem *diWhere);
|
||||
ME_DisplayItem *ME_FindItemBack(ME_DisplayItem *di, ME_DIType nTypeOrClass);
|
||||
ME_DisplayItem *ME_FindItemFwd(ME_DisplayItem *di, ME_DIType nTypeOrClass);
|
||||
ME_DisplayItem *ME_FindItemBackOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass);
|
||||
ME_DisplayItem *ME_MakeDI(ME_DIType type);
|
||||
void ME_DestroyDisplayItem(ME_DisplayItem *item);
|
||||
void ME_DumpDocument(ME_TextBuffer *buffer);
|
||||
|
||||
/* string.c */
|
||||
ME_String *ME_MakeStringN(LPCWSTR szText, int nMaxChars) DECLSPEC_HIDDEN;
|
||||
ME_String *ME_MakeStringR(WCHAR cRepeat, int nMaxChars) DECLSPEC_HIDDEN;
|
||||
ME_String *ME_MakeStringConst(const WCHAR *str, int len) DECLSPEC_HIDDEN;
|
||||
ME_String *ME_MakeStringEmpty(int len) DECLSPEC_HIDDEN;
|
||||
void ME_DestroyString(ME_String *s) DECLSPEC_HIDDEN;
|
||||
BOOL ME_AppendString(ME_String *s, const WCHAR *append, int len) DECLSPEC_HIDDEN;
|
||||
ME_String *ME_VSplitString(ME_String *orig, int nVPos) DECLSPEC_HIDDEN;
|
||||
int ME_FindNonWhitespaceV(const ME_String *s, int nVChar) DECLSPEC_HIDDEN;
|
||||
int ME_CallWordBreakProc(ME_TextEditor *editor, WCHAR *str, INT len, INT start, INT code) DECLSPEC_HIDDEN;
|
||||
void ME_StrDeleteV(ME_String *s, int nVChar, int nChars) DECLSPEC_HIDDEN;
|
||||
BOOL ME_InsertString(ME_String *s, int ofs, const WCHAR *insert, int len) DECLSPEC_HIDDEN;
|
||||
ME_String *ME_MakeStringN(LPCWSTR szText, int nMaxChars);
|
||||
ME_String *ME_MakeStringR(WCHAR cRepeat, int nMaxChars);
|
||||
ME_String *ME_MakeStringConst(const WCHAR *str, int len);
|
||||
ME_String *ME_MakeStringEmpty(int len);
|
||||
void ME_DestroyString(ME_String *s);
|
||||
BOOL ME_AppendString(ME_String *s, const WCHAR *append, int len);
|
||||
ME_String *ME_VSplitString(ME_String *orig, int nVPos);
|
||||
int ME_FindNonWhitespaceV(const ME_String *s, int nVChar);
|
||||
int ME_CallWordBreakProc(ME_TextEditor *editor, WCHAR *str, INT len, INT start, INT code);
|
||||
void ME_StrDeleteV(ME_String *s, int nVChar, int nChars);
|
||||
BOOL ME_InsertString(ME_String *s, int ofs, const WCHAR *insert, int len);
|
||||
|
||||
#define CP_UNICODE 1200
|
||||
|
||||
/* smart helpers for A<->W conversions, they reserve/free memory and call MultiByte<->WideChar functions */
|
||||
LPWSTR ME_ToUnicode(LONG codepage, LPVOID psz, INT *len) DECLSPEC_HIDDEN;
|
||||
void ME_EndToUnicode(LONG codepage, LPVOID psz) DECLSPEC_HIDDEN;
|
||||
LPWSTR ME_ToUnicode(LONG codepage, LPVOID psz, INT *len);
|
||||
void ME_EndToUnicode(LONG codepage, LPVOID psz);
|
||||
|
||||
static inline int ME_IsWSpace(WCHAR ch)
|
||||
{
|
||||
|
@ -108,131 +107,131 @@ static inline int ME_CharCompare(WCHAR a, WCHAR b, int caseSensitive)
|
|||
|
||||
/* note: those two really return the first matching offset (starting from EOS)+1
|
||||
* in other words, an offset of the first trailing white/black */
|
||||
int ME_ReverseFindNonWhitespaceV(const ME_String *s, int nVChar) DECLSPEC_HIDDEN;
|
||||
int ME_ReverseFindWhitespaceV(const ME_String *s, int nVChar) DECLSPEC_HIDDEN;
|
||||
int ME_ReverseFindNonWhitespaceV(const ME_String *s, int nVChar);
|
||||
int ME_ReverseFindWhitespaceV(const ME_String *s, int nVChar);
|
||||
|
||||
/* row.c */
|
||||
void row_end_cursor( ME_Row *row, ME_Cursor *cursor, BOOL include_eop ) DECLSPEC_HIDDEN;
|
||||
void row_first_cursor( ME_Row *row, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
|
||||
ME_Run *row_first_run( ME_Row *row ) DECLSPEC_HIDDEN;
|
||||
ME_Row *row_from_cursor( ME_Cursor *cursor ) DECLSPEC_HIDDEN;
|
||||
ME_Row *row_from_row_number( ME_TextEditor *editor, int row_num ) DECLSPEC_HIDDEN;
|
||||
ME_Row *row_next( ME_Row *row ) DECLSPEC_HIDDEN;
|
||||
ME_Row *row_next_all_paras( ME_Row *row ) DECLSPEC_HIDDEN;
|
||||
ME_Run *row_next_run( ME_Row *row, ME_Run *run ) DECLSPEC_HIDDEN;
|
||||
int row_number_from_char_ofs( ME_TextEditor *editor, int ofs ) DECLSPEC_HIDDEN;
|
||||
ME_Paragraph *row_para( ME_Row *row ) DECLSPEC_HIDDEN;
|
||||
ME_Row *row_prev_all_paras( ME_Row *row ) DECLSPEC_HIDDEN;
|
||||
void row_end_cursor( ME_Row *row, ME_Cursor *cursor, BOOL include_eop );
|
||||
void row_first_cursor( ME_Row *row, ME_Cursor *cursor );
|
||||
ME_Run *row_first_run( ME_Row *row );
|
||||
ME_Row *row_from_cursor( ME_Cursor *cursor );
|
||||
ME_Row *row_from_row_number( ME_TextEditor *editor, int row_num );
|
||||
ME_Row *row_next( ME_Row *row );
|
||||
ME_Row *row_next_all_paras( ME_Row *row );
|
||||
ME_Run *row_next_run( ME_Row *row, ME_Run *run );
|
||||
int row_number_from_char_ofs( ME_TextEditor *editor, int ofs );
|
||||
ME_Paragraph *row_para( ME_Row *row );
|
||||
ME_Row *row_prev_all_paras( ME_Row *row );
|
||||
static inline ME_DisplayItem *row_get_di( ME_Row *row )
|
||||
{
|
||||
return (ME_DisplayItem *)((ptrdiff_t)row - offsetof(ME_DisplayItem, member));
|
||||
}
|
||||
|
||||
/* run.c */
|
||||
void cursor_from_char_ofs( ME_TextEditor *editor, int char_ofs, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
|
||||
BOOL cursor_next_run( ME_Cursor *cursor, BOOL all_para ) DECLSPEC_HIDDEN;
|
||||
BOOL cursor_prev_run( ME_Cursor *cursor, BOOL all_para ) DECLSPEC_HIDDEN;
|
||||
void editor_propagate_char_ofs( ME_Paragraph *para, ME_Run *run, int shift ) DECLSPEC_HIDDEN;
|
||||
int run_char_ofs( ME_Run *run, int ofs ) DECLSPEC_HIDDEN;
|
||||
ME_Run *run_create( ME_Style *s, int nFlags ) DECLSPEC_HIDDEN;
|
||||
void cursor_from_char_ofs( ME_TextEditor *editor, int char_ofs, ME_Cursor *cursor );
|
||||
BOOL cursor_next_run( ME_Cursor *cursor, BOOL all_para );
|
||||
BOOL cursor_prev_run( ME_Cursor *cursor, BOOL all_para );
|
||||
void editor_propagate_char_ofs( ME_TextEditor *editor, ME_Paragraph *para, ME_Run *run, int shift );
|
||||
int run_char_ofs( ME_Run *run, int ofs );
|
||||
ME_Run *run_create( ME_Style *s, int nFlags );
|
||||
ME_Run *run_insert( ME_TextEditor *editor, ME_Cursor *cursor,
|
||||
ME_Style *style, const WCHAR *str, int len, int flags ) DECLSPEC_HIDDEN;
|
||||
void ME_CheckCharOffsets(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
ME_Style *style, const WCHAR *str, int len, int flags );
|
||||
void ME_CheckCharOffsets(ME_TextEditor *editor);
|
||||
/* this one accounts for 1/2 char tolerance */
|
||||
int ME_CharFromPointContext(ME_Context *c, int cx, ME_Run *run, BOOL closest, BOOL visual_order) DECLSPEC_HIDDEN;
|
||||
int ME_CharFromPoint(ME_TextEditor *editor, int cx, ME_Run *run, BOOL closest, BOOL visual_order) DECLSPEC_HIDDEN;
|
||||
int ME_PointFromCharContext(ME_Context *c, ME_Run *pRun, int nOffset, BOOL visual_order) DECLSPEC_HIDDEN;
|
||||
int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset, BOOL visual_order) DECLSPEC_HIDDEN;
|
||||
BOOL ME_CanJoinRuns(const ME_Run *run1, const ME_Run *run2) DECLSPEC_HIDDEN;
|
||||
void run_join( ME_TextEditor *editor, ME_Run *run ) DECLSPEC_HIDDEN;
|
||||
ME_Run *run_next( ME_Run *run ) DECLSPEC_HIDDEN;
|
||||
ME_Run *run_next_all_paras( ME_Run *run ) DECLSPEC_HIDDEN;
|
||||
ME_Run *run_prev( ME_Run *run ) DECLSPEC_HIDDEN;
|
||||
ME_Run *run_prev_all_paras( ME_Run *run ) DECLSPEC_HIDDEN;
|
||||
ME_Run *run_split( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
|
||||
void ME_UpdateRunFlags(ME_TextEditor *editor, ME_Run *run) DECLSPEC_HIDDEN;
|
||||
int ME_CharFromPointContext(ME_Context *c, int cx, ME_Run *run, BOOL closest, BOOL visual_order);
|
||||
int ME_CharFromPoint(ME_TextEditor *editor, int cx, ME_Run *run, BOOL closest, BOOL visual_order);
|
||||
int ME_PointFromCharContext(ME_Context *c, ME_Run *pRun, int nOffset, BOOL visual_order);
|
||||
int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset, BOOL visual_order);
|
||||
BOOL ME_CanJoinRuns(const ME_Run *run1, const ME_Run *run2);
|
||||
void run_join( ME_TextEditor *editor, ME_Run *run );
|
||||
ME_Run *run_next( ME_Run *run );
|
||||
ME_Run *run_next_all_paras( ME_Run *run );
|
||||
ME_Run *run_prev( ME_Run *run );
|
||||
ME_Run *run_prev_all_paras( ME_Run *run );
|
||||
ME_Run *run_split( ME_TextEditor *editor, ME_Cursor *cursor );
|
||||
void ME_UpdateRunFlags(ME_TextEditor *editor, ME_Run *run);
|
||||
SIZE ME_GetRunSizeCommon(ME_Context *c, const ME_Paragraph *para, ME_Run *run, int nLen,
|
||||
int startx, int *pAscent, int *pDescent) DECLSPEC_HIDDEN;
|
||||
void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN;
|
||||
void ME_SetSelectionCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN;
|
||||
int startx, int *pAscent, int *pDescent);
|
||||
void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, CHARFORMAT2W *pFmt);
|
||||
void ME_SetSelectionCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt);
|
||||
void ME_GetCharFormat(ME_TextEditor *editor, const ME_Cursor *from,
|
||||
const ME_Cursor *to, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN;
|
||||
void ME_GetSelectionCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN;
|
||||
void ME_GetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN;
|
||||
void ME_SetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *mod) DECLSPEC_HIDDEN;
|
||||
const ME_Cursor *to, CHARFORMAT2W *pFmt);
|
||||
void ME_GetSelectionCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt);
|
||||
void ME_GetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt);
|
||||
void ME_SetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *mod);
|
||||
static inline ME_DisplayItem *run_get_di( ME_Run *run )
|
||||
{
|
||||
return (ME_DisplayItem *)((ptrdiff_t)run - offsetof(ME_DisplayItem, member));
|
||||
}
|
||||
|
||||
/* caret.c */
|
||||
void cursor_coords( ME_TextEditor *editor, ME_Cursor *cursor, int *x, int *y, int *height ) DECLSPEC_HIDDEN;
|
||||
void ME_SetCursorToStart(ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN;
|
||||
int set_selection_cursors(ME_TextEditor *editor, int from, int to) DECLSPEC_HIDDEN;
|
||||
BOOL ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs) DECLSPEC_HIDDEN;
|
||||
void hide_caret(ME_TextEditor *ed) DECLSPEC_HIDDEN;
|
||||
void show_caret(ME_TextEditor *ed) DECLSPEC_HIDDEN;
|
||||
void update_caret(ME_TextEditor *ed) DECLSPEC_HIDDEN;
|
||||
void create_caret(ME_TextEditor *ed) DECLSPEC_HIDDEN;
|
||||
BOOL ME_CharFromPos(ME_TextEditor *editor, int x, int y, ME_Cursor *cursor, BOOL *isExact) DECLSPEC_HIDDEN;
|
||||
void ME_LButtonDown(ME_TextEditor *editor, int x, int y, int clickNum) DECLSPEC_HIDDEN;
|
||||
void ME_MouseMove(ME_TextEditor *editor, int x, int y) DECLSPEC_HIDDEN;
|
||||
BOOL ME_DeleteTextAtCursor(ME_TextEditor *editor, int nCursor, int nChars) DECLSPEC_HIDDEN;
|
||||
void cursor_coords( ME_TextEditor *editor, ME_Cursor *cursor, int *x, int *y, int *height );
|
||||
BOOL cursor_from_coords( ME_TextEditor *editor, int x, int y, ME_Cursor *cursor );
|
||||
void ME_SetCursorToStart(ME_TextEditor *editor, ME_Cursor *cursor);
|
||||
int set_selection_cursors(ME_TextEditor *editor, int from, int to);
|
||||
BOOL ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs);
|
||||
void hide_caret(ME_TextEditor *ed);
|
||||
void show_caret(ME_TextEditor *ed);
|
||||
void update_caret(ME_TextEditor *ed);
|
||||
void create_caret(ME_TextEditor *ed);
|
||||
void ME_LButtonDown(ME_TextEditor *editor, int x, int y, int clickNum);
|
||||
void ME_MouseMove(ME_TextEditor *editor, int x, int y);
|
||||
BOOL ME_DeleteTextAtCursor(ME_TextEditor *editor, int nCursor, int nChars);
|
||||
void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor,
|
||||
const WCHAR *str, int len, ME_Style *style) DECLSPEC_HIDDEN;
|
||||
void ME_InsertEndRowFromCursor(ME_TextEditor *editor, int nCursor) DECLSPEC_HIDDEN;
|
||||
int ME_MoveCursorChars(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs, BOOL final_eop) DECLSPEC_HIDDEN;
|
||||
BOOL ME_ArrowKey(ME_TextEditor *ed, int nVKey, BOOL extend, BOOL ctrl) DECLSPEC_HIDDEN;
|
||||
const WCHAR *str, int len, ME_Style *style);
|
||||
void ME_InsertEndRowFromCursor(ME_TextEditor *editor, int nCursor);
|
||||
int ME_MoveCursorChars(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs, BOOL final_eop);
|
||||
BOOL ME_ArrowKey(ME_TextEditor *ed, int nVKey, BOOL extend, BOOL ctrl);
|
||||
|
||||
int ME_GetCursorOfs(const ME_Cursor *cursor) DECLSPEC_HIDDEN;
|
||||
int ME_GetSelectionOfs(ME_TextEditor *editor, int *from, int *to) DECLSPEC_HIDDEN;
|
||||
int ME_GetSelection(ME_TextEditor *editor, ME_Cursor **from, ME_Cursor **to) DECLSPEC_HIDDEN;
|
||||
BOOL ME_IsSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_DeleteSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_SendSelChange(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_InsertOLEFromCursor(ME_TextEditor *editor, const REOBJECT* reo, int nCursor) DECLSPEC_HIDDEN;
|
||||
BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start, int nChars, BOOL bForce) DECLSPEC_HIDDEN;
|
||||
int ME_GetTextLength(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
int ME_GetTextLengthEx(ME_TextEditor *editor, const GETTEXTLENGTHEX *how) DECLSPEC_HIDDEN;
|
||||
ME_Style *ME_GetSelectionInsertStyle(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
int ME_GetCursorOfs(const ME_Cursor *cursor);
|
||||
int ME_GetSelectionOfs(ME_TextEditor *editor, LONG *from, LONG *to);
|
||||
int ME_GetSelection(ME_TextEditor *editor, ME_Cursor **from, ME_Cursor **to);
|
||||
BOOL ME_IsSelection(ME_TextEditor *editor);
|
||||
void ME_DeleteSelection(ME_TextEditor *editor);
|
||||
void ME_SendSelChange(ME_TextEditor *editor);
|
||||
HRESULT editor_insert_oleobj( ME_TextEditor *editor, const REOBJECT *reo );
|
||||
BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start, int nChars, BOOL bForce);
|
||||
int ME_GetTextLength(ME_TextEditor *editor);
|
||||
int ME_GetTextLengthEx(ME_TextEditor *editor, const GETTEXTLENGTHEX *how);
|
||||
ME_Style *ME_GetSelectionInsertStyle(ME_TextEditor *editor);
|
||||
|
||||
/* context.c */
|
||||
void ME_InitContext(ME_Context *c, ME_TextEditor *editor, HDC hDC) DECLSPEC_HIDDEN;
|
||||
void ME_DestroyContext(ME_Context *c) DECLSPEC_HIDDEN;
|
||||
void ME_InitContext(ME_Context *c, ME_TextEditor *editor, HDC hDC);
|
||||
void ME_DestroyContext(ME_Context *c);
|
||||
|
||||
/* wrap.c */
|
||||
BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void para_range_invalidate( ME_TextEditor *editor, ME_Paragraph *start_para, ME_Paragraph *last_para ) DECLSPEC_HIDDEN;
|
||||
void ME_SendRequestResize(ME_TextEditor *editor, BOOL force) DECLSPEC_HIDDEN;
|
||||
BOOL wrap_marked_paras_dc( ME_TextEditor *editor, HDC hdc, BOOL invalidate ) DECLSPEC_HIDDEN;
|
||||
BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor);
|
||||
void para_range_invalidate( ME_TextEditor *editor, ME_Paragraph *start_para, ME_Paragraph *last_para );
|
||||
void ME_SendRequestResize(ME_TextEditor *editor, BOOL force);
|
||||
BOOL wrap_marked_paras_dc( ME_TextEditor *editor, HDC hdc, BOOL invalidate );
|
||||
|
||||
/* para.c */
|
||||
void editor_get_selection_paras(ME_TextEditor *editor, ME_Paragraph **para, ME_Paragraph **para_end ) DECLSPEC_HIDDEN;
|
||||
void editor_get_selection_para_fmt( ME_TextEditor *editor, PARAFORMAT2 *fmt ) DECLSPEC_HIDDEN;
|
||||
void editor_mark_rewrap_all( ME_TextEditor *editor ) DECLSPEC_HIDDEN;
|
||||
void editor_set_default_para_fmt(ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN;
|
||||
BOOL editor_set_selection_para_fmt( ME_TextEditor *editor, const PARAFORMAT2 *fmt ) DECLSPEC_HIDDEN;
|
||||
void ME_MakeFirstParagraph(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_DumpParaStyle(ME_Paragraph *s) DECLSPEC_HIDDEN;
|
||||
void ME_DumpParaStyleToBuf(const PARAFORMAT2 *pFmt, char buf[2048]) DECLSPEC_HIDDEN;
|
||||
int get_total_width(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
ME_Cell *para_cell( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
void para_destroy( ME_TextEditor *editor, ME_Paragraph *item ) DECLSPEC_HIDDEN;
|
||||
ME_Row *para_end_row( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
ME_Run *para_end_run( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
ME_Row *para_first_row( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
ME_Run *para_first_run( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
BOOL para_in_table( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
ME_Paragraph *para_join( ME_TextEditor *editor, ME_Paragraph *para, BOOL use_first_fmt ) DECLSPEC_HIDDEN;
|
||||
void para_mark_add( ME_TextEditor *editor, ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
void para_mark_remove( ME_TextEditor *editor, ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
void para_mark_rewrap( ME_TextEditor *editor, ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
ME_Paragraph *para_next( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
void para_num_clear( struct para_num *pn ) DECLSPEC_HIDDEN;
|
||||
void para_num_init( ME_Context *c, ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
ME_Paragraph *para_prev( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
void editor_get_selection_paras(ME_TextEditor *editor, ME_Paragraph **para, ME_Paragraph **para_end );
|
||||
void editor_get_selection_para_fmt( ME_TextEditor *editor, PARAFORMAT2 *fmt );
|
||||
void editor_mark_rewrap_all( ME_TextEditor *editor );
|
||||
void editor_set_default_para_fmt(ME_TextEditor *editor, PARAFORMAT2 *pFmt);
|
||||
BOOL editor_set_selection_para_fmt( ME_TextEditor *editor, const PARAFORMAT2 *fmt );
|
||||
void ME_MakeFirstParagraph(ME_TextEditor *editor, HDC hdc);
|
||||
void ME_DumpParaStyle(ME_Paragraph *s);
|
||||
void ME_DumpParaStyleToBuf(const PARAFORMAT2 *pFmt, char buf[2048]);
|
||||
int get_total_width(ME_TextEditor *editor);
|
||||
ME_Cell *para_cell( ME_Paragraph *para );
|
||||
void para_destroy( ME_TextEditor *editor, ME_Paragraph *item );
|
||||
ME_Row *para_end_row( ME_Paragraph *para );
|
||||
ME_Run *para_end_run( ME_Paragraph *para );
|
||||
ME_Row *para_first_row( ME_Paragraph *para );
|
||||
ME_Run *para_first_run( ME_Paragraph *para );
|
||||
BOOL para_in_table( ME_Paragraph *para );
|
||||
ME_Paragraph *para_join( ME_TextEditor *editor, ME_Paragraph *para, BOOL use_first_fmt );
|
||||
void para_mark_add( ME_TextEditor *editor, ME_Paragraph *para );
|
||||
void para_mark_remove( ME_TextEditor *editor, ME_Paragraph *para );
|
||||
void para_mark_rewrap( ME_TextEditor *editor, ME_Paragraph *para );
|
||||
ME_Paragraph *para_next( ME_Paragraph *para );
|
||||
void para_num_clear( struct para_num *pn );
|
||||
void para_num_init( ME_Context *c, ME_Paragraph *para );
|
||||
ME_Paragraph *para_prev( ME_Paragraph *para );
|
||||
ME_Paragraph *para_split( ME_TextEditor *editor, ME_Run *run, ME_Style *style,
|
||||
const WCHAR *eol_str, int eol_len, int paraFlags ) DECLSPEC_HIDDEN;
|
||||
const WCHAR *eol_str, int eol_len, int paraFlags );
|
||||
|
||||
static inline ME_DisplayItem *para_get_di(ME_Paragraph *para)
|
||||
{
|
||||
|
@ -240,82 +239,82 @@ static inline ME_DisplayItem *para_get_di(ME_Paragraph *para)
|
|||
}
|
||||
|
||||
/* paint.c */
|
||||
void editor_draw( ME_TextEditor *editor, HDC hDC, const RECT *update ) DECLSPEC_HIDDEN;
|
||||
void ME_Repaint(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_RewrapRepaint(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now) DECLSPEC_HIDDEN;
|
||||
void editor_ensure_visible( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
|
||||
void ME_InvalidateSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
BOOL ME_SetZoom(ME_TextEditor *editor, int numerator, int denominator) DECLSPEC_HIDDEN;
|
||||
int ME_twips2pointsX(const ME_Context *c, int x) DECLSPEC_HIDDEN;
|
||||
int ME_twips2pointsY(const ME_Context *c, int y) DECLSPEC_HIDDEN;
|
||||
void editor_draw( ME_TextEditor *editor, HDC hDC, const RECT *update );
|
||||
void ME_Repaint(ME_TextEditor *editor);
|
||||
void ME_RewrapRepaint(ME_TextEditor *editor);
|
||||
void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now);
|
||||
void editor_ensure_visible( ME_TextEditor *editor, ME_Cursor *cursor );
|
||||
void ME_InvalidateSelection(ME_TextEditor *editor);
|
||||
BOOL ME_SetZoom(ME_TextEditor *editor, int numerator, int denominator);
|
||||
int ME_twips2pointsX(const ME_Context *c, int x);
|
||||
int ME_twips2pointsY(const ME_Context *c, int y);
|
||||
|
||||
/* scroll functions in paint.c */
|
||||
|
||||
void scroll_abs( ME_TextEditor *editor, int x, int y, BOOL notify ) DECLSPEC_HIDDEN;
|
||||
void scroll_h_abs( ME_TextEditor *editor, int x, BOOL notify ) DECLSPEC_HIDDEN;
|
||||
void scroll_v_abs( ME_TextEditor *editor, int y, BOOL notify ) DECLSPEC_HIDDEN;
|
||||
void ME_ScrollUp(ME_TextEditor *editor, int cy) DECLSPEC_HIDDEN;
|
||||
void ME_ScrollDown(ME_TextEditor *editor, int cy) DECLSPEC_HIDDEN;
|
||||
void ME_ScrollLeft(ME_TextEditor *editor, int cx) DECLSPEC_HIDDEN;
|
||||
void ME_ScrollRight(ME_TextEditor *editor, int cx) DECLSPEC_HIDDEN;
|
||||
void ME_UpdateScrollBar(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void scroll_abs( ME_TextEditor *editor, int x, int y, BOOL notify );
|
||||
void scroll_h_abs( ME_TextEditor *editor, int x, BOOL notify );
|
||||
void scroll_v_abs( ME_TextEditor *editor, int y, BOOL notify );
|
||||
void ME_ScrollUp(ME_TextEditor *editor, int cy);
|
||||
void ME_ScrollDown(ME_TextEditor *editor, int cy);
|
||||
void ME_ScrollLeft(ME_TextEditor *editor, int cx);
|
||||
void ME_ScrollRight(ME_TextEditor *editor, int cx);
|
||||
void ME_UpdateScrollBar(ME_TextEditor *editor);
|
||||
|
||||
/* other functions in paint.c */
|
||||
int ME_GetParaBorderWidth(const ME_Context *c, int flags) DECLSPEC_HIDDEN;
|
||||
int ME_GetParaBorderWidth(const ME_Context *c, int flags);
|
||||
|
||||
/* richole.c */
|
||||
void draw_ole( ME_Context *c, int x, int y, ME_Run* run, BOOL selected ) DECLSPEC_HIDDEN;
|
||||
void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize) DECLSPEC_HIDDEN;
|
||||
void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags) DECLSPEC_HIDDEN;
|
||||
void ME_DeleteReObject(struct re_object *re_object) DECLSPEC_HIDDEN;
|
||||
void richole_release_children( struct text_services *services ) DECLSPEC_HIDDEN;
|
||||
extern const IRichEditOleVtbl re_ole_vtbl DECLSPEC_HIDDEN;
|
||||
extern const ITextDocument2OldVtbl text_doc2old_vtbl DECLSPEC_HIDDEN;
|
||||
void draw_ole( ME_Context *c, int x, int y, ME_Run* run, BOOL selected );
|
||||
void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize);
|
||||
void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags);
|
||||
void ME_DeleteReObject(struct re_object *re_object);
|
||||
void richole_release_children( struct text_services *services );
|
||||
extern const IRichEditOleVtbl re_ole_vtbl;
|
||||
extern const ITextDocument2OldVtbl text_doc2old_vtbl;
|
||||
|
||||
/* editor.c */
|
||||
ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) DECLSPEC_HIDDEN;
|
||||
void ME_DestroyEditor(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10);
|
||||
void ME_DestroyEditor(ME_TextEditor *editor);
|
||||
LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
||||
LPARAM lParam, HRESULT* phresult ) DECLSPEC_HIDDEN;
|
||||
LPARAM lParam, HRESULT* phresult );
|
||||
int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int buflen,
|
||||
const ME_Cursor *start, int srcChars, BOOL bCRLF, BOOL bEOP) DECLSPEC_HIDDEN;
|
||||
void ME_RTFCharAttrHook(struct _RTF_Info *info) DECLSPEC_HIDDEN;
|
||||
void ME_RTFParAttrHook(struct _RTF_Info *info) DECLSPEC_HIDDEN;
|
||||
void ME_RTFTblAttrHook(struct _RTF_Info *info) DECLSPEC_HIDDEN;
|
||||
void ME_RTFSpecialCharHook(struct _RTF_Info *info) DECLSPEC_HIDDEN;
|
||||
void ME_StreamInFill(ME_InStream *stream) DECLSPEC_HIDDEN;
|
||||
extern BOOL me_debug DECLSPEC_HIDDEN;
|
||||
void ME_ReplaceSel(ME_TextEditor *editor, BOOL can_undo, const WCHAR *str, int len) DECLSPEC_HIDDEN;
|
||||
int set_selection( ME_TextEditor *editor, int to, int from ) DECLSPEC_HIDDEN;
|
||||
const ME_Cursor *start, int srcChars, BOOL bCRLF, BOOL bEOP);
|
||||
void ME_RTFCharAttrHook(struct _RTF_Info *info);
|
||||
void ME_RTFParAttrHook(struct _RTF_Info *info);
|
||||
void ME_RTFTblAttrHook(struct _RTF_Info *info);
|
||||
void ME_RTFSpecialCharHook(struct _RTF_Info *info);
|
||||
void ME_StreamInFill(ME_InStream *stream);
|
||||
extern BOOL me_debug;
|
||||
void ME_ReplaceSel(ME_TextEditor *editor, BOOL can_undo, const WCHAR *str, int len);
|
||||
int set_selection( ME_TextEditor *editor, int to, int from );
|
||||
HRESULT editor_copy_or_cut( ME_TextEditor *editor, BOOL cut, ME_Cursor *start, int count,
|
||||
IDataObject **data_out ) DECLSPEC_HIDDEN;
|
||||
ME_Paragraph *editor_end_para( ME_TextEditor *editor ) DECLSPEC_HIDDEN;
|
||||
ME_Paragraph *editor_first_para( ME_TextEditor *editor ) DECLSPEC_HIDDEN;
|
||||
void editor_set_cursor( ME_TextEditor *editor, int x, int y ) DECLSPEC_HIDDEN;
|
||||
void link_notify( ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
|
||||
IDataObject **data_out );
|
||||
ME_Paragraph *editor_end_para( ME_TextEditor *editor );
|
||||
ME_Paragraph *editor_first_para( ME_TextEditor *editor );
|
||||
void editor_set_cursor( ME_TextEditor *editor, int x, int y );
|
||||
void link_notify( ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam );
|
||||
|
||||
/* table.c */
|
||||
ME_Cell *cell_create( void ) DECLSPEC_HIDDEN;
|
||||
ME_Paragraph *cell_end_para( ME_Cell *cell ) DECLSPEC_HIDDEN;
|
||||
ME_Paragraph *cell_first_para( ME_Cell *cell ) DECLSPEC_HIDDEN;
|
||||
ME_Cell *cell_next( ME_Cell *cell ) DECLSPEC_HIDDEN;
|
||||
ME_Cell *cell_prev( ME_Cell *cell ) DECLSPEC_HIDDEN;
|
||||
ME_Paragraph *table_append_row( ME_TextEditor *editor, ME_Paragraph *table_row ) DECLSPEC_HIDDEN;
|
||||
void table_handle_tab( ME_TextEditor *editor, BOOL selected_row ) DECLSPEC_HIDDEN;
|
||||
ME_Paragraph *table_insert_cell( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
|
||||
ME_Paragraph *table_insert_row_end( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
|
||||
ME_Paragraph *table_insert_row_start( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
|
||||
ME_Paragraph *table_insert_row_start_at_para( ME_TextEditor *editor, ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
void table_move_from_row_start( ME_TextEditor *editor ) DECLSPEC_HIDDEN;
|
||||
ME_Paragraph *table_outer_para( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
void table_protect_partial_deletion( ME_TextEditor *editor, ME_Cursor *c, int *num_chars ) DECLSPEC_HIDDEN;
|
||||
ME_Paragraph *table_row_end( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
ME_Cell *table_row_end_cell( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
ME_Cell *table_row_first_cell( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
ME_Paragraph *table_row_start( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_InitTableDef(ME_TextEditor *editor, struct RTFTable *tableDef) DECLSPEC_HIDDEN;
|
||||
ME_Cell *cell_create( void );
|
||||
ME_Paragraph *cell_end_para( ME_Cell *cell );
|
||||
ME_Paragraph *cell_first_para( ME_Cell *cell );
|
||||
ME_Cell *cell_next( ME_Cell *cell );
|
||||
ME_Cell *cell_prev( ME_Cell *cell );
|
||||
ME_Paragraph *table_append_row( ME_TextEditor *editor, ME_Paragraph *table_row );
|
||||
void table_handle_tab( ME_TextEditor *editor, BOOL selected_row );
|
||||
ME_Paragraph *table_insert_cell( ME_TextEditor *editor, ME_Cursor *cursor );
|
||||
ME_Paragraph *table_insert_row_end( ME_TextEditor *editor, ME_Cursor *cursor );
|
||||
ME_Paragraph *table_insert_row_start( ME_TextEditor *editor, ME_Cursor *cursor );
|
||||
ME_Paragraph *table_insert_row_start_at_para( ME_TextEditor *editor, ME_Paragraph *para );
|
||||
void table_move_from_row_start( ME_TextEditor *editor );
|
||||
ME_Paragraph *table_outer_para( ME_Paragraph *para );
|
||||
void table_protect_partial_deletion( ME_TextEditor *editor, ME_Cursor *c, int *num_chars );
|
||||
ME_Paragraph *table_row_end( ME_Paragraph *para );
|
||||
ME_Cell *table_row_end_cell( ME_Paragraph *para );
|
||||
ME_Cell *table_row_first_cell( ME_Paragraph *para );
|
||||
ME_Paragraph *table_row_start( ME_Paragraph *para );
|
||||
struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor);
|
||||
void ME_InitTableDef(ME_TextEditor *editor, struct RTFTable *tableDef);
|
||||
static inline ME_DisplayItem *cell_get_di(ME_Cell *cell)
|
||||
{
|
||||
return (ME_DisplayItem *)((ptrdiff_t)cell - offsetof(ME_DisplayItem, member));
|
||||
|
@ -324,7 +323,7 @@ static inline ME_DisplayItem *cell_get_di(ME_Cell *cell)
|
|||
|
||||
/* txthost.c */
|
||||
#ifdef __ASM_USE_THISCALL_WRAPPER
|
||||
extern const struct ITextHost2Vtbl text_host2_stdcall_vtbl DECLSPEC_HIDDEN;
|
||||
extern const struct ITextHost2Vtbl text_host2_stdcall_vtbl;
|
||||
#define TXTHOST_VTABLE(This) (&text_host2_stdcall_vtbl)
|
||||
#else
|
||||
#define TXTHOST_VTABLE(This) (This)->lpVtbl
|
||||
|
@ -384,23 +383,30 @@ extern const struct ITextHost2Vtbl text_host2_stdcall_vtbl DECLSPEC_HIDDEN;
|
|||
#define ITextHost2_TxGetHorzExtent(This,a) TXTHOST_VTABLE(This)->TxGetHorzExtent(This,a)
|
||||
|
||||
/* undo.c */
|
||||
BOOL add_undo_insert_run( ME_TextEditor *, int pos, const WCHAR *str, int len, int flags, ME_Style *style ) DECLSPEC_HIDDEN;
|
||||
BOOL add_undo_delete_run( ME_TextEditor *, int pos, int len ) DECLSPEC_HIDDEN;
|
||||
BOOL add_undo_set_para_fmt( ME_TextEditor *, const ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
BOOL add_undo_set_char_fmt( ME_TextEditor *, int pos, int len, const CHARFORMAT2W *fmt ) DECLSPEC_HIDDEN;
|
||||
BOOL add_undo_join_paras( ME_TextEditor *, int pos ) DECLSPEC_HIDDEN;
|
||||
BOOL add_undo_split_para( ME_TextEditor *, const ME_Paragraph *para, ME_String *eol_str, const ME_Cell *cell) DECLSPEC_HIDDEN;
|
||||
void ME_CommitUndo(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_ContinueCoalescingTransaction(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_CommitCoalescingUndo(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
BOOL ME_Undo(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
BOOL ME_Redo(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_EmptyUndoStack(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
BOOL add_undo_insert_run( ME_TextEditor *, int pos, const WCHAR *str, int len, int flags, ME_Style *style );
|
||||
BOOL add_undo_delete_run( ME_TextEditor *, int pos, int len );
|
||||
BOOL add_undo_set_para_fmt( ME_TextEditor *, const ME_Paragraph *para );
|
||||
BOOL add_undo_set_char_fmt( ME_TextEditor *, int pos, int len, const CHARFORMAT2W *fmt );
|
||||
BOOL add_undo_join_paras( ME_TextEditor *, int pos );
|
||||
BOOL add_undo_split_para( ME_TextEditor *, const ME_Paragraph *para, ME_String *eol_str, const ME_Cell *cell);
|
||||
void ME_CommitUndo(ME_TextEditor *editor);
|
||||
void ME_ContinueCoalescingTransaction(ME_TextEditor *editor);
|
||||
void ME_CommitCoalescingUndo(ME_TextEditor *editor);
|
||||
BOOL ME_Undo(ME_TextEditor *editor);
|
||||
BOOL ME_Redo(ME_TextEditor *editor);
|
||||
void ME_EmptyUndoStack(ME_TextEditor *editor);
|
||||
void editor_disable_undo(ME_TextEditor *editor);
|
||||
void editor_enable_undo(ME_TextEditor *editor);
|
||||
|
||||
static inline BOOL editor_undo_ignored(ME_TextEditor *editor)
|
||||
{
|
||||
return editor->undo_ctl_state != undoActive || editor->nUndoMode == umIgnore;
|
||||
}
|
||||
|
||||
/* txtsrv.c */
|
||||
HRESULT create_text_services( IUnknown *outer, ITextHost *text_host, IUnknown **unk, BOOL emulate_10 ) DECLSPEC_HIDDEN;
|
||||
HRESULT create_text_services( IUnknown *outer, ITextHost *text_host, IUnknown **unk, BOOL emulate_10 );
|
||||
#ifdef __ASM_USE_THISCALL_WRAPPER
|
||||
extern const struct ITextServicesVtbl text_services_stdcall_vtbl DECLSPEC_HIDDEN;
|
||||
extern const struct ITextServicesVtbl text_services_stdcall_vtbl;
|
||||
#define TXTSERV_VTABLE(This) (&text_services_stdcall_vtbl)
|
||||
#else
|
||||
#define TXTSERV_VTABLE(This) (This)->lpVtbl
|
||||
|
@ -425,11 +431,11 @@ extern const struct ITextServicesVtbl text_services_stdcall_vtbl DECLSPEC_HIDDEN
|
|||
#define ITextServices_TxGetCachedSize(This,a,b) TXTSERV_VTABLE(This)->TxGetCachedSize(This,a,b)
|
||||
|
||||
/* writer.c */
|
||||
LRESULT ME_StreamOutRange(ME_TextEditor *editor, DWORD dwFormat, const ME_Cursor *start, int nChars, EDITSTREAM *stream) DECLSPEC_HIDDEN;
|
||||
LRESULT ME_StreamOut(ME_TextEditor *editor, DWORD dwFormat, EDITSTREAM *stream) DECLSPEC_HIDDEN;
|
||||
LRESULT ME_StreamOutRange(ME_TextEditor *editor, DWORD dwFormat, const ME_Cursor *start, int nChars, EDITSTREAM *stream);
|
||||
LRESULT ME_StreamOut(ME_TextEditor *editor, DWORD dwFormat, EDITSTREAM *stream);
|
||||
|
||||
/* clipboard.c */
|
||||
HRESULT ME_GetDataObject(ME_TextEditor *editor, const ME_Cursor *start, int nChars, LPDATAOBJECT *lplpdataobj) DECLSPEC_HIDDEN;
|
||||
HRESULT ME_GetDataObject(ME_TextEditor *editor, const ME_Cursor *start, int nChars, LPDATAOBJECT *lplpdataobj);
|
||||
|
||||
void release_typelib(void) DECLSPEC_HIDDEN;
|
||||
void release_typelib(void);
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
|
||||
#include "wine/asm.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/heap.h"
|
||||
#include "wine/list.h"
|
||||
#include "wine/rbtree.h"
|
||||
|
||||
|
@ -147,11 +146,13 @@ typedef enum {
|
|||
/******************************** 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
|
||||
|
@ -283,6 +284,12 @@ typedef enum {
|
|||
umAddBackToUndo
|
||||
} ME_UndoMode;
|
||||
|
||||
typedef enum {
|
||||
undoActive,
|
||||
undoSuspended,
|
||||
undoDisabled
|
||||
} ME_UndoControlState;
|
||||
|
||||
enum undo_type
|
||||
{
|
||||
undo_insert_run,
|
||||
|
@ -406,8 +413,9 @@ typedef struct tagME_TextEditor
|
|||
int nUndoStackSize;
|
||||
int nUndoLimit;
|
||||
ME_UndoMode nUndoMode;
|
||||
ME_UndoControlState undo_ctl_state;
|
||||
int nParagraphs;
|
||||
int nLastSelStart, nLastSelEnd;
|
||||
LONG nLastSelStart, nLastSelEnd;
|
||||
ME_Paragraph *last_sel_start_para, *last_sel_end_para;
|
||||
ME_FontCacheItem pFontCache[HFONT_CACHE_SIZE];
|
||||
int nZoomNumerator, nZoomDenominator;
|
||||
|
@ -426,6 +434,7 @@ typedef struct tagME_TextEditor
|
|||
BOOL AutoURLDetect_bEnable;
|
||||
WCHAR password_char;
|
||||
BOOL bHaveFocus;
|
||||
DWORD freeze_count;
|
||||
#ifndef __REACTOS__
|
||||
/*for IME */
|
||||
int imeStartIndex;
|
||||
|
|
|
@ -123,16 +123,16 @@ void ME_DestroyDisplayItem(ME_DisplayItem *item)
|
|||
list_remove(&item->member.run.reobj->entry);
|
||||
ME_DeleteReObject(item->member.run.reobj);
|
||||
}
|
||||
heap_free( item->member.run.glyphs );
|
||||
heap_free( item->member.run.clusters );
|
||||
free(item->member.run.glyphs);
|
||||
free(item->member.run.clusters);
|
||||
ME_ReleaseStyle(item->member.run.style);
|
||||
}
|
||||
heap_free(item);
|
||||
free(item);
|
||||
}
|
||||
|
||||
ME_DisplayItem *ME_MakeDI(ME_DIType type)
|
||||
{
|
||||
ME_DisplayItem *item = heap_alloc_zero(sizeof(*item));
|
||||
ME_DisplayItem *item = calloc(1, sizeof(*item));
|
||||
|
||||
item->type = type;
|
||||
item->prev = item->next = NULL;
|
||||
|
|
|
@ -110,11 +110,13 @@ void editor_draw( ME_TextEditor *editor, HDC hDC, const RECT *update )
|
|||
if (oldRgn) DeleteObject( oldRgn );
|
||||
ME_DestroyContext( &c );
|
||||
|
||||
if (editor->in_place_active) {
|
||||
if (editor->nTotalLength != editor->nLastTotalLength || editor->nTotalWidth != editor->nLastTotalWidth)
|
||||
ME_SendRequestResize(editor, FALSE);
|
||||
editor->nLastTotalLength = editor->nTotalLength;
|
||||
editor->nLastTotalWidth = editor->nTotalWidth;
|
||||
}
|
||||
}
|
||||
|
||||
void ME_Repaint(ME_TextEditor *editor)
|
||||
{
|
||||
|
@ -123,6 +125,7 @@ void ME_Repaint(ME_TextEditor *editor)
|
|||
ME_UpdateScrollBar(editor);
|
||||
FIXME("ME_Repaint had to call ME_WrapMarkedParagraphs\n");
|
||||
}
|
||||
if (!editor->freeze_count)
|
||||
ITextHost_TxViewChange(editor->texthost, TRUE);
|
||||
}
|
||||
|
||||
|
@ -140,6 +143,7 @@ void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now)
|
|||
|
||||
update_caret( editor );
|
||||
|
||||
if (!editor->freeze_count)
|
||||
ITextHost_TxViewChange(editor->texthost, update_now);
|
||||
|
||||
ME_SendSelChange(editor);
|
||||
|
@ -459,7 +463,7 @@ static void draw_run( ME_Context *c, int x, int y, ME_Cursor *cursor )
|
|||
ME_Row *row;
|
||||
ME_Run *run = cursor->run;
|
||||
int runofs = run_char_ofs( run, cursor->nOffset );
|
||||
int nSelFrom, nSelTo;
|
||||
LONG nSelFrom, nSelTo;
|
||||
|
||||
if (run->nFlags & MERF_HIDDEN) return;
|
||||
|
||||
|
@ -1210,6 +1214,8 @@ void editor_ensure_visible( ME_TextEditor *editor, ME_Cursor *cursor )
|
|||
ME_Paragraph *para = cursor->para;
|
||||
int x, y, yheight;
|
||||
|
||||
if (!editor->in_place_active)
|
||||
return;
|
||||
|
||||
if (editor->scrollbars & ES_AUTOHSCROLL)
|
||||
{
|
||||
|
@ -1248,7 +1254,7 @@ ME_InvalidateSelection(ME_TextEditor *editor)
|
|||
{
|
||||
ME_Paragraph *sel_start, *sel_end;
|
||||
ME_Paragraph *repaint_start = NULL, *repaint_end = NULL;
|
||||
int nStart, nEnd;
|
||||
LONG nStart, nEnd;
|
||||
int len = ME_GetTextLength(editor);
|
||||
|
||||
ME_GetSelectionOfs(editor, &nStart, &nEnd);
|
||||
|
|
|
@ -148,7 +148,7 @@ ME_Row *para_end_row( ME_Paragraph *para )
|
|||
return &item->member.row;
|
||||
}
|
||||
|
||||
void ME_MakeFirstParagraph(ME_TextEditor *editor)
|
||||
void ME_MakeFirstParagraph(ME_TextEditor *editor, HDC hdc)
|
||||
{
|
||||
ME_Context c;
|
||||
CHARFORMAT2W cf;
|
||||
|
@ -160,7 +160,6 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
|
|||
ME_Run *run;
|
||||
ME_Style *style;
|
||||
int eol_len;
|
||||
HDC hdc = ITextHost_TxGetDC( editor->texthost );
|
||||
|
||||
ME_InitContext( &c, editor, hdc );
|
||||
|
||||
|
@ -222,7 +221,6 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
|
|||
wine_rb_init( &editor->marked_paras, para_mark_compare );
|
||||
para_mark_add( editor, para );
|
||||
ME_DestroyContext(&c);
|
||||
ITextHost_TxReleaseDC( editor->texthost, hdc );
|
||||
}
|
||||
|
||||
static void para_mark_rewrap_paras( ME_TextEditor *editor, ME_Paragraph *first, const ME_Paragraph *end )
|
||||
|
@ -672,7 +670,7 @@ ME_Paragraph *para_split( ME_TextEditor *editor, ME_Run *run, ME_Style *style,
|
|||
para_mark_rewrap( editor, &new_para->prev_para->member.para );
|
||||
|
||||
/* we've added the end run, so we need to modify nCharOfs in the next paragraphs */
|
||||
editor_propagate_char_ofs( next_para, NULL, eol_len );
|
||||
editor_propagate_char_ofs( editor, next_para, NULL, eol_len );
|
||||
editor->nParagraphs++;
|
||||
|
||||
return new_para;
|
||||
|
@ -775,7 +773,7 @@ ME_Paragraph *para_join( ME_TextEditor *editor, ME_Paragraph *para, BOOL use_fir
|
|||
ME_Remove( para_get_di(next) );
|
||||
para_destroy( editor, next );
|
||||
|
||||
editor_propagate_char_ofs( para_next( para ), NULL, -end_len );
|
||||
editor_propagate_char_ofs( editor, para_next( para ), NULL, -end_len );
|
||||
|
||||
ME_CheckCharOffsets(editor);
|
||||
|
||||
|
@ -807,10 +805,10 @@ void ME_DumpParaStyleToBuf(const PARAFORMAT2 *pFmt, char buf[2048])
|
|||
DUMP_EFFECT(PFM_RTLPARA, "RTL para:");
|
||||
DUMP_EFFECT(PFM_SIDEBYSIDE, "Side by side:");
|
||||
DUMP_EFFECT(PFM_TABLE, "Table:");
|
||||
DUMP(PFM_OFFSETINDENT, "Offset indent:", "%d", dxStartIndent);
|
||||
DUMP(PFM_STARTINDENT, "Start indent:", "%d", dxStartIndent);
|
||||
DUMP(PFM_RIGHTINDENT, "Right indent:", "%d", dxRightIndent);
|
||||
DUMP(PFM_OFFSET, "Offset:", "%d", dxOffset);
|
||||
DUMP(PFM_OFFSETINDENT, "Offset indent:", "%ld", dxStartIndent);
|
||||
DUMP(PFM_STARTINDENT, "Start indent:", "%ld", dxStartIndent);
|
||||
DUMP(PFM_RIGHTINDENT, "Right indent:", "%ld", dxRightIndent);
|
||||
DUMP(PFM_OFFSET, "Offset:", "%ld", dxOffset);
|
||||
if (pFmt->dwMask & PFM_ALIGNMENT) {
|
||||
switch (pFmt->wAlignment) {
|
||||
case PFA_LEFT : p += sprintf(p, "Alignment: left\n"); break;
|
||||
|
@ -825,12 +823,12 @@ void ME_DumpParaStyleToBuf(const PARAFORMAT2 *pFmt, char buf[2048])
|
|||
if (pFmt->dwMask & PFM_TABSTOPS) {
|
||||
int i;
|
||||
p += sprintf(p, "\t");
|
||||
for (i = 0; i < pFmt->cTabCount; i++) p += sprintf(p, "%x ", pFmt->rgxTabs[i]);
|
||||
for (i = 0; i < pFmt->cTabCount; i++) p += sprintf(p, "%lx ", pFmt->rgxTabs[i]);
|
||||
p += sprintf(p, "\n");
|
||||
}
|
||||
DUMP(PFM_SPACEBEFORE, "Space Before:", "%d", dySpaceBefore);
|
||||
DUMP(PFM_SPACEAFTER, "Space After:", "%d", dySpaceAfter);
|
||||
DUMP(PFM_LINESPACING, "Line spacing:", "%d", dyLineSpacing);
|
||||
DUMP(PFM_SPACEBEFORE, "Space Before:", "%ld", dySpaceBefore);
|
||||
DUMP(PFM_SPACEAFTER, "Space After:", "%ld", dySpaceAfter);
|
||||
DUMP(PFM_LINESPACING, "Line spacing:", "%ld", dyLineSpacing);
|
||||
DUMP(PFM_STYLE, "Text style:", "%d", sStyle);
|
||||
DUMP(PFM_LINESPACING, "Line spacing rule:", "%u", bLineSpacingRule);
|
||||
/* bOutlineLevel should be 0 */
|
||||
|
|
|
@ -6,9 +6,6 @@
|
|||
#define _INC_WINDOWS
|
||||
#define COM_NO_WINDOWS_H
|
||||
|
||||
#define NONAMELESSUNION
|
||||
#define NONAMELESSSTRUCT
|
||||
|
||||
#include "editor.h"
|
||||
|
||||
#include <tom.h>
|
||||
|
|
|
@ -75,23 +75,6 @@ static void RTFPutCodePageChar(RTF_Info *info, int c);
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/*
|
||||
* Saves a string on the heap and returns a pointer to it.
|
||||
*/
|
||||
static inline char *RTFStrSave(const char *s)
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = heap_alloc (lstrlenA(s) + 1);
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
return lstrcpyA (p, s);
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
int _RTFGetChar(RTF_Info *info)
|
||||
{
|
||||
int ch;
|
||||
|
@ -129,14 +112,14 @@ RTFDestroyAttrs(RTF_Info *info)
|
|||
while (info->fontList)
|
||||
{
|
||||
fp = info->fontList->rtfNextFont;
|
||||
heap_free (info->fontList->rtfFName);
|
||||
heap_free (info->fontList);
|
||||
free (info->fontList->rtfFName);
|
||||
free (info->fontList);
|
||||
info->fontList = fp;
|
||||
}
|
||||
while (info->colorList)
|
||||
{
|
||||
cp = info->colorList->rtfNextColor;
|
||||
heap_free (info->colorList);
|
||||
free (info->colorList);
|
||||
info->colorList = cp;
|
||||
}
|
||||
while (info->styleList)
|
||||
|
@ -146,12 +129,12 @@ RTFDestroyAttrs(RTF_Info *info)
|
|||
while (eltList)
|
||||
{
|
||||
ep = eltList->rtfNextSE;
|
||||
heap_free (eltList->rtfSEText);
|
||||
heap_free (eltList);
|
||||
free (eltList->rtfSEText);
|
||||
free (eltList);
|
||||
eltList = ep;
|
||||
}
|
||||
heap_free (info->styleList->rtfSName);
|
||||
heap_free (info->styleList);
|
||||
free (info->styleList->rtfSName);
|
||||
free (info->styleList);
|
||||
info->styleList = sp;
|
||||
}
|
||||
}
|
||||
|
@ -162,16 +145,16 @@ RTFDestroy(RTF_Info *info)
|
|||
{
|
||||
if (info->rtfTextBuf)
|
||||
{
|
||||
heap_free(info->rtfTextBuf);
|
||||
heap_free(info->pushedTextBuf);
|
||||
free(info->rtfTextBuf);
|
||||
free(info->pushedTextBuf);
|
||||
}
|
||||
RTFDestroyAttrs(info);
|
||||
heap_free(info->cpOutputBuffer);
|
||||
free(info->cpOutputBuffer);
|
||||
while (info->tableDef)
|
||||
{
|
||||
RTFTable *tableDef = info->tableDef;
|
||||
info->tableDef = tableDef->parent;
|
||||
heap_free(tableDef);
|
||||
free(tableDef);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,8 +198,8 @@ void RTFInit(RTF_Info *info)
|
|||
|
||||
if (info->rtfTextBuf == NULL) /* initialize the text buffers */
|
||||
{
|
||||
info->rtfTextBuf = heap_alloc (rtfBufSiz);
|
||||
info->pushedTextBuf = heap_alloc (rtfBufSiz);
|
||||
info->rtfTextBuf = malloc (rtfBufSiz);
|
||||
info->pushedTextBuf = malloc (rtfBufSiz);
|
||||
if (info->rtfTextBuf == NULL || info->pushedTextBuf == NULL) {
|
||||
ERR ("Cannot allocate text buffers.\n");
|
||||
return;
|
||||
|
@ -262,7 +245,7 @@ void RTFInit(RTF_Info *info)
|
|||
if (!info->cpOutputBuffer)
|
||||
{
|
||||
info->dwMaxCPOutputCount = 0x1000;
|
||||
info->cpOutputBuffer = heap_alloc(info->dwMaxCPOutputCount);
|
||||
info->cpOutputBuffer = malloc (info->dwMaxCPOutputCount);
|
||||
}
|
||||
|
||||
info->tableDef = NULL;
|
||||
|
@ -813,7 +796,7 @@ static void ReadFontTbl(RTF_Info *info)
|
|||
if (info->rtfClass == rtfEOF)
|
||||
break;
|
||||
}
|
||||
fp = New (RTFFont);
|
||||
fp = malloc (sizeof(*fp));
|
||||
if (fp == NULL) {
|
||||
ERR ("cannot allocate font entry\n");
|
||||
break;
|
||||
|
@ -901,7 +884,7 @@ static void ReadFontTbl(RTF_Info *info)
|
|||
RTFUngetToken (info);
|
||||
}
|
||||
*bp = '\0';
|
||||
fp->rtfFName = RTFStrSave (buf);
|
||||
fp->rtfFName = strdup (buf);
|
||||
if (fp->rtfFName == NULL)
|
||||
ERR ("cannot allocate font name\n");
|
||||
/* already have next token; don't read one */
|
||||
|
@ -986,7 +969,7 @@ static void ReadColorTbl(RTF_Info *info)
|
|||
continue;
|
||||
}
|
||||
|
||||
cp = New (RTFColor);
|
||||
cp = malloc (sizeof(*cp));
|
||||
if (cp == NULL) {
|
||||
ERR ("cannot allocate color entry\n");
|
||||
break;
|
||||
|
@ -1036,7 +1019,7 @@ static void ReadStyleSheet(RTF_Info *info)
|
|||
break;
|
||||
if (RTFCheckCM (info, rtfGroup, rtfEndGroup))
|
||||
break;
|
||||
sp = New (RTFStyle);
|
||||
sp = malloc (sizeof(*sp));
|
||||
if (sp == NULL) {
|
||||
ERR ("cannot allocate stylesheet entry\n");
|
||||
break;
|
||||
|
@ -1104,7 +1087,7 @@ static void ReadStyleSheet(RTF_Info *info)
|
|||
sp->rtfSNextPar = info->rtfParam;
|
||||
continue;
|
||||
}
|
||||
sep = New (RTFStyleElt);
|
||||
sep = malloc (sizeof(*sep));
|
||||
if (sep == NULL)
|
||||
{
|
||||
ERR ("cannot allocate style element\n");
|
||||
|
@ -1114,7 +1097,7 @@ static void ReadStyleSheet(RTF_Info *info)
|
|||
sep->rtfSEMajor = info->rtfMajor;
|
||||
sep->rtfSEMinor = info->rtfMinor;
|
||||
sep->rtfSEParam = info->rtfParam;
|
||||
sep->rtfSEText = RTFStrSave (info->rtfTextBuf);
|
||||
sep->rtfSEText = strdup (info->rtfTextBuf);
|
||||
if (sep->rtfSEText == NULL)
|
||||
ERR ("cannot allocate style element text\n");
|
||||
if (sepLast == NULL)
|
||||
|
@ -1149,7 +1132,7 @@ static void ReadStyleSheet(RTF_Info *info)
|
|||
RTFGetToken (info);
|
||||
}
|
||||
*bp = '\0';
|
||||
sp->rtfSName = RTFStrSave (buf);
|
||||
sp->rtfSName = strdup (buf);
|
||||
if (sp->rtfSName == NULL)
|
||||
ERR ("cannot allocate style name\n");
|
||||
}
|
||||
|
@ -2199,10 +2182,7 @@ void LookupInit(void)
|
|||
|
||||
rp->rtfKHash = Hash (rp->rtfKStr);
|
||||
index = rp->rtfKHash % (ARRAY_SIZE(rtfKey) * 2);
|
||||
if (!rtfHashTable[index].count)
|
||||
rtfHashTable[index].value = heap_alloc(sizeof(RTFKey *));
|
||||
else
|
||||
rtfHashTable[index].value = heap_realloc(rtfHashTable[index].value, sizeof(RTFKey *) * (rtfHashTable[index].count + 1));
|
||||
rtfHashTable[index].value = realloc(rtfHashTable[index].value, sizeof(RTFKey *) * (rtfHashTable[index].count + 1));
|
||||
rtfHashTable[index].value[rtfHashTable[index].count++] = rp;
|
||||
}
|
||||
}
|
||||
|
@ -2213,7 +2193,7 @@ void LookupCleanup(void)
|
|||
|
||||
for (i = 0; i < ARRAY_SIZE(rtfKey) * 2; i++)
|
||||
{
|
||||
heap_free( rtfHashTable[i].value );
|
||||
free(rtfHashTable[i].value);
|
||||
rtfHashTable[i].value = NULL;
|
||||
rtfHashTable[i].count = 0;
|
||||
}
|
||||
|
@ -2611,7 +2591,7 @@ static void
|
|||
RTFFlushCPOutputBuffer(RTF_Info *info)
|
||||
{
|
||||
int bufferMax = info->dwCPOutputCount * 2 * sizeof(WCHAR);
|
||||
WCHAR *buffer = heap_alloc(bufferMax);
|
||||
WCHAR *buffer = malloc(bufferMax);
|
||||
int length;
|
||||
|
||||
length = MultiByteToWideChar(info->codePage, 0, info->cpOutputBuffer,
|
||||
|
@ -2619,7 +2599,7 @@ RTFFlushCPOutputBuffer(RTF_Info *info)
|
|||
info->dwCPOutputCount = 0;
|
||||
|
||||
RTFPutUnicodeString(info, buffer, length);
|
||||
heap_free(buffer);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2648,7 +2628,7 @@ RTFPutCodePageChar(RTF_Info *info, int c)
|
|||
if (info->dwCPOutputCount >= info->dwMaxCPOutputCount)
|
||||
{
|
||||
info->dwMaxCPOutputCount *= 2;
|
||||
info->cpOutputBuffer = heap_realloc(info->cpOutputBuffer, info->dwMaxCPOutputCount);
|
||||
info->cpOutputBuffer = realloc(info->cpOutputBuffer, info->dwMaxCPOutputCount);
|
||||
}
|
||||
info->cpOutputBuffer[info->dwCPOutputCount++] = c;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1078,13 +1078,6 @@ struct RTFTable
|
|||
# define RTFBorderCellBottom 0x32
|
||||
# define RTFBorderCellRight 0x33
|
||||
|
||||
/*
|
||||
* Return pointer to new element of type t, or NULL
|
||||
* if no memory available.
|
||||
*/
|
||||
|
||||
# define New(t) (heap_alloc (sizeof (t)))
|
||||
|
||||
/* Parser stack size */
|
||||
|
||||
# define maxStack 32
|
||||
|
@ -1189,31 +1182,31 @@ struct _RTF_Info {
|
|||
* Public RTF reader routines
|
||||
*/
|
||||
|
||||
void RTFInit (RTF_Info *) DECLSPEC_HIDDEN;
|
||||
void RTFDestroy(RTF_Info *info) DECLSPEC_HIDDEN;
|
||||
void RTFSetDestinationCallback (RTF_Info *, int, RTFFuncPtr) DECLSPEC_HIDDEN;
|
||||
void RTFRead (RTF_Info *) DECLSPEC_HIDDEN;
|
||||
int RTFGetToken (RTF_Info *) DECLSPEC_HIDDEN; /* writer should rarely need this */
|
||||
void RTFSetReadHook (RTF_Info *, RTFFuncPtr) DECLSPEC_HIDDEN;
|
||||
void RTFRouteToken (RTF_Info *) DECLSPEC_HIDDEN;
|
||||
void RTFSkipGroup (RTF_Info *) DECLSPEC_HIDDEN;
|
||||
void RTFReadGroup (RTF_Info *) DECLSPEC_HIDDEN;
|
||||
int RTFCheckCM (const RTF_Info *, int, int) DECLSPEC_HIDDEN;
|
||||
int RTFCheckCMM (const RTF_Info *, int, int, int) DECLSPEC_HIDDEN;
|
||||
int RTFCheckMM (const RTF_Info *, int, int) DECLSPEC_HIDDEN;
|
||||
RTFFont *RTFGetFont (const RTF_Info *, int) DECLSPEC_HIDDEN;
|
||||
RTFColor *RTFGetColor (const RTF_Info *, int) DECLSPEC_HIDDEN;
|
||||
int RTFCharToHex ( char) DECLSPEC_HIDDEN;
|
||||
void RTFInit (RTF_Info *);
|
||||
void RTFDestroy(RTF_Info *info);
|
||||
void RTFSetDestinationCallback (RTF_Info *, int, RTFFuncPtr);
|
||||
void RTFRead (RTF_Info *);
|
||||
int RTFGetToken (RTF_Info *); /* writer should rarely need this */
|
||||
void RTFSetReadHook (RTF_Info *, RTFFuncPtr);
|
||||
void RTFRouteToken (RTF_Info *);
|
||||
void RTFSkipGroup (RTF_Info *);
|
||||
void RTFReadGroup (RTF_Info *);
|
||||
int RTFCheckCM (const RTF_Info *, int, int);
|
||||
int RTFCheckCMM (const RTF_Info *, int, int, int);
|
||||
int RTFCheckMM (const RTF_Info *, int, int);
|
||||
RTFFont *RTFGetFont (const RTF_Info *, int);
|
||||
RTFColor *RTFGetColor (const RTF_Info *, int);
|
||||
int RTFCharToHex ( char);
|
||||
|
||||
void RTFFlushOutputBuffer( RTF_Info *info ) DECLSPEC_HIDDEN;
|
||||
void RTFSetEditStream(RTF_Info *info, ME_InStream *stream) DECLSPEC_HIDDEN;
|
||||
void RTFFlushOutputBuffer( RTF_Info *info );
|
||||
void RTFSetEditStream(RTF_Info *info, ME_InStream *stream);
|
||||
|
||||
void WriterInit (RTF_Info *) DECLSPEC_HIDDEN;
|
||||
int BeginFile (RTF_Info *) DECLSPEC_HIDDEN;
|
||||
void WriterInit (RTF_Info *);
|
||||
int BeginFile (RTF_Info *);
|
||||
|
||||
int RTFCharSetToCodePage(RTF_Info *info, int charset) DECLSPEC_HIDDEN;
|
||||
int RTFCharSetToCodePage(RTF_Info *info, int charset);
|
||||
|
||||
void LookupInit (void) DECLSPEC_HIDDEN;
|
||||
void LookupCleanup (void) DECLSPEC_HIDDEN;
|
||||
void LookupInit (void);
|
||||
void LookupCleanup (void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -144,7 +144,7 @@ BOOL ME_CanJoinRuns(const ME_Run *run1, const ME_Run *run2)
|
|||
* the document) of the part of the text starting from given place.
|
||||
* Call with only one of para or run non-NULL.
|
||||
*/
|
||||
void editor_propagate_char_ofs( ME_Paragraph *para, ME_Run *run, int shift )
|
||||
void editor_propagate_char_ofs( ME_TextEditor *editor, ME_Paragraph *para, ME_Run *run, int shift )
|
||||
{
|
||||
assert( !para ^ !run );
|
||||
|
||||
|
@ -160,7 +160,12 @@ void editor_propagate_char_ofs( ME_Paragraph *para, ME_Run *run, int shift )
|
|||
|
||||
do
|
||||
{
|
||||
/* update position in marked tree, if added */
|
||||
if (para->nFlags & MEPF_REWRAP)
|
||||
para_mark_remove( editor, para );
|
||||
para->nCharOfs += shift;
|
||||
if (para->nFlags & MEPF_REWRAP)
|
||||
para_mark_add( editor, para );
|
||||
para = para_next( para );
|
||||
} while (para);
|
||||
}
|
||||
|
@ -199,7 +204,7 @@ void ME_CheckCharOffsets(ME_TextEditor *editor)
|
|||
ofs = 0;
|
||||
break;
|
||||
case diRun:
|
||||
TRACE_(richedit_check)("run, real ofs = %d (+ofsp = %d), counted = %d, len = %d, txt = %s, flags=%08x, fx&mask = %08x\n",
|
||||
TRACE_(richedit_check)("run, real ofs = %d (+ofsp = %d), counted = %d, len = %d, txt = %s, flags=%08x, fx&mask = %08lx\n",
|
||||
p->member.run.nCharOfs, p->member.run.nCharOfs+ofsp, ofsp+ofs,
|
||||
p->member.run.len, debugstr_run( &p->member.run ),
|
||||
p->member.run.nFlags,
|
||||
|
@ -400,7 +405,7 @@ ME_Run *run_insert( ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style,
|
|||
ME_InsertString( run->para->text, run->nCharOfs, str, len );
|
||||
ME_InsertBefore( run_get_di( insert_before ), run_get_di( run ) );
|
||||
TRACE("Shift length:%d\n", len);
|
||||
editor_propagate_char_ofs( NULL, insert_before, len );
|
||||
editor_propagate_char_ofs( editor, NULL, insert_before, len );
|
||||
para_mark_rewrap( editor, insert_before->para );
|
||||
|
||||
/* Move any cursors that were at the end of the previous run to the end of the inserted run */
|
||||
|
@ -902,9 +907,8 @@ void ME_GetCharFormat( ME_TextEditor *editor, const ME_Cursor *from,
|
|||
run_copy_char_fmt( run, &tmp );
|
||||
|
||||
assert((tmp.dwMask & dwAttribs) == dwAttribs);
|
||||
/* reset flags that differ */
|
||||
|
||||
if (fmt->yHeight != tmp.yHeight) fmt->dwMask &= ~CFM_SIZE;
|
||||
/* reset flags that differ */
|
||||
if (fmt->dwMask & CFM_FACE)
|
||||
{
|
||||
if (!(tmp.dwMask & CFM_FACE))
|
||||
|
|
|
@ -29,7 +29,7 @@ static int ME_GetOptimalBuffer(int nLen)
|
|||
|
||||
static ME_String *make_string( void (*free)(ME_String *) )
|
||||
{
|
||||
ME_String *s = heap_alloc( sizeof(*s) );
|
||||
ME_String *s = malloc( sizeof(*s) );
|
||||
|
||||
if (s) s->free = free;
|
||||
return s;
|
||||
|
@ -49,23 +49,23 @@ ME_String *ME_MakeStringConst(const WCHAR *str, int len)
|
|||
return s;
|
||||
}
|
||||
|
||||
static void heap_string_free(ME_String *s)
|
||||
static void string_free(ME_String *s)
|
||||
{
|
||||
heap_free( s->szData );
|
||||
free( s->szData );
|
||||
}
|
||||
|
||||
/* Create a buffer (uninitialized string) of size nMaxChars */
|
||||
ME_String *ME_MakeStringEmpty(int nMaxChars)
|
||||
{
|
||||
ME_String *s = make_string( heap_string_free );
|
||||
ME_String *s = make_string( string_free );
|
||||
|
||||
if (!s) return NULL;
|
||||
s->nLen = nMaxChars;
|
||||
s->nBuffer = ME_GetOptimalBuffer(s->nLen + 1);
|
||||
s->szData = heap_alloc( s->nBuffer * sizeof(WCHAR) );
|
||||
s->szData = malloc( s->nBuffer * sizeof(WCHAR) );
|
||||
if (!s->szData)
|
||||
{
|
||||
heap_free( s );
|
||||
free( s );
|
||||
return NULL;
|
||||
}
|
||||
s->szData[s->nLen] = 0;
|
||||
|
@ -97,7 +97,7 @@ void ME_DestroyString(ME_String *s)
|
|||
{
|
||||
if (!s) return;
|
||||
if (s->free) s->free( s );
|
||||
heap_free( s );
|
||||
free( s );
|
||||
}
|
||||
|
||||
BOOL ME_InsertString(ME_String *s, int ofs, const WCHAR *insert, int len)
|
||||
|
@ -111,7 +111,7 @@ BOOL ME_InsertString(ME_String *s, int ofs, const WCHAR *insert, int len)
|
|||
if( new_len > s->nBuffer )
|
||||
{
|
||||
s->nBuffer = ME_GetOptimalBuffer( new_len );
|
||||
new = heap_realloc( s->szData, s->nBuffer * sizeof(WCHAR) );
|
||||
new = realloc( s->szData, s->nBuffer * sizeof(WCHAR) );
|
||||
if (!new) return FALSE;
|
||||
s->szData = new;
|
||||
}
|
||||
|
@ -213,12 +213,12 @@ ME_CallWordBreakProc(ME_TextEditor *editor, WCHAR *str, INT len, INT start, INT
|
|||
int result;
|
||||
int buffer_size = WideCharToMultiByte(CP_ACP, 0, str, len,
|
||||
NULL, 0, NULL, NULL);
|
||||
char *buffer = heap_alloc(buffer_size);
|
||||
char *buffer = malloc(buffer_size);
|
||||
if (!buffer) return 0;
|
||||
WideCharToMultiByte(CP_ACP, 0, str, len,
|
||||
buffer, buffer_size, NULL, NULL);
|
||||
result = editor->pfnWordBreak((WCHAR*)buffer, start, buffer_size, code);
|
||||
heap_free(buffer);
|
||||
free(buffer);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ LPWSTR ME_ToUnicode(LONG codepage, LPVOID psz, INT *len)
|
|||
|
||||
if(!nChars) return NULL;
|
||||
|
||||
if((tmp = heap_alloc( nChars * sizeof(WCHAR) )) != NULL)
|
||||
if((tmp = malloc(nChars * sizeof(WCHAR))) != NULL)
|
||||
*len = MultiByteToWideChar(codepage, 0, psz, -1, tmp, nChars) - 1;
|
||||
return tmp;
|
||||
}
|
||||
|
@ -248,5 +248,5 @@ LPWSTR ME_ToUnicode(LONG codepage, LPVOID psz, INT *len)
|
|||
void ME_EndToUnicode(LONG codepage, LPVOID psz)
|
||||
{
|
||||
if (codepage != CP_UNICODE)
|
||||
heap_free( psz );
|
||||
free(psz);
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ BOOL cf2w_to_cfany(CHARFORMAT2W *to, const CHARFORMAT2W *from)
|
|||
|
||||
ME_Style *ME_MakeStyle(CHARFORMAT2W *style)
|
||||
{
|
||||
ME_Style *s = heap_alloc(sizeof(*s));
|
||||
ME_Style *s = malloc(sizeof(*s));
|
||||
|
||||
assert(style->cbSize == sizeof(CHARFORMAT2W));
|
||||
s->fmt = *style;
|
||||
|
@ -264,12 +264,12 @@ void ME_DumpStyleToBuf(CHARFORMAT2W *pFmt, char buf[2048])
|
|||
p += sprintf(p, "N/A");
|
||||
|
||||
if (pFmt->dwMask & CFM_SIZE)
|
||||
p += sprintf(p, "\nFont size: %d\n", pFmt->yHeight);
|
||||
p += sprintf(p, "\nFont size: %ld\n", pFmt->yHeight);
|
||||
else
|
||||
p += sprintf(p, "\nFont size: N/A\n");
|
||||
|
||||
if (pFmt->dwMask & CFM_OFFSET)
|
||||
p += sprintf(p, "Char offset: %d\n", pFmt->yOffset);
|
||||
p += sprintf(p, "Char offset: %ld\n", pFmt->yOffset);
|
||||
else
|
||||
p += sprintf(p, "Char offset: N/A\n");
|
||||
|
||||
|
@ -429,7 +429,7 @@ void select_style( ME_Context *c, ME_Style *s )
|
|||
c->orig_font = NULL;
|
||||
}
|
||||
|
||||
if (c->current_style)
|
||||
if (c->current_style && c->current_style->font_cache)
|
||||
{
|
||||
release_font_cache( c->current_style->font_cache );
|
||||
c->current_style->font_cache = NULL;
|
||||
|
@ -448,7 +448,7 @@ void ME_DestroyStyle(ME_Style *s)
|
|||
s->font_cache = NULL;
|
||||
}
|
||||
ScriptFreeCache( &s->script_cache );
|
||||
heap_free(s);
|
||||
free(s);
|
||||
}
|
||||
|
||||
void ME_AddRefStyle(ME_Style *s)
|
||||
|
|
|
@ -546,7 +546,7 @@ void table_move_from_row_start( ME_TextEditor *editor )
|
|||
|
||||
struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor)
|
||||
{
|
||||
RTFTable *tableDef = heap_alloc_zero(sizeof(*tableDef));
|
||||
RTFTable *tableDef = calloc(1, sizeof(*tableDef));
|
||||
|
||||
if (!editor->bEmulateVersion10) /* v4.1 */
|
||||
tableDef->gapH = 10;
|
||||
|
|
|
@ -97,7 +97,7 @@ struct host *host_create( HWND hwnd, CREATESTRUCTW *cs, BOOL emulate_10 )
|
|||
{
|
||||
struct host *texthost;
|
||||
|
||||
texthost = CoTaskMemAlloc(sizeof(*texthost));
|
||||
texthost = malloc( sizeof(*texthost) );
|
||||
if (!texthost) return NULL;
|
||||
|
||||
texthost->ITextHost_iface.lpVtbl = &textHostVtbl;
|
||||
|
@ -164,41 +164,41 @@ static ULONG WINAPI ITextHostImpl_Release( ITextHost2 *iface )
|
|||
{
|
||||
SetWindowLongPtrW( host->window, 0, 0 );
|
||||
ITextServices_Release( host->text_srv );
|
||||
CoTaskMemFree( host );
|
||||
free( host );
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetDC,4)
|
||||
DECLSPEC_HIDDEN HDC __thiscall ITextHostImpl_TxGetDC( ITextHost2 *iface )
|
||||
HDC __thiscall ITextHostImpl_TxGetDC( ITextHost2 *iface )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
return GetDC( host->window );
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxReleaseDC,8)
|
||||
DECLSPEC_HIDDEN INT __thiscall ITextHostImpl_TxReleaseDC( ITextHost2 *iface, HDC hdc )
|
||||
INT __thiscall ITextHostImpl_TxReleaseDC( ITextHost2 *iface, HDC hdc )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
return ReleaseDC( host->window, hdc );
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxShowScrollBar,12)
|
||||
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxShowScrollBar( ITextHost2 *iface, INT bar, BOOL show )
|
||||
BOOL __thiscall ITextHostImpl_TxShowScrollBar( ITextHost2 *iface, INT bar, BOOL show )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
return ShowScrollBar( host->window, bar, show );
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxEnableScrollBar,12)
|
||||
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxEnableScrollBar( ITextHost2 *iface, INT bar, INT arrows )
|
||||
BOOL __thiscall ITextHostImpl_TxEnableScrollBar( ITextHost2 *iface, INT bar, INT arrows )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
return EnableScrollBar( host->window, bar, arrows );
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetScrollRange,20)
|
||||
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetScrollRange( ITextHost2 *iface, INT bar, LONG min_pos, INT max_pos, BOOL redraw )
|
||||
BOOL __thiscall ITextHostImpl_TxSetScrollRange( ITextHost2 *iface, INT bar, LONG min_pos, INT max_pos, BOOL redraw )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
SCROLLINFO info = { .cbSize = sizeof(info), .fMask = SIF_PAGE | SIF_RANGE };
|
||||
|
@ -223,7 +223,7 @@ DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetScrollRange( ITextHost2 *ifac
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetScrollPos,16)
|
||||
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetScrollPos( ITextHost2 *iface, INT bar, INT pos, BOOL redraw )
|
||||
BOOL __thiscall ITextHostImpl_TxSetScrollPos( ITextHost2 *iface, INT bar, INT pos, BOOL redraw )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
DWORD style = GetWindowLongW( host->window, GWL_STYLE );
|
||||
|
@ -248,28 +248,28 @@ DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetScrollPos( ITextHost2 *iface,
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxInvalidateRect,12)
|
||||
DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxInvalidateRect( ITextHost2 *iface, const RECT *rect, BOOL mode )
|
||||
void __thiscall ITextHostImpl_TxInvalidateRect( ITextHost2 *iface, const RECT *rect, BOOL mode )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
InvalidateRect( host->window, rect, mode );
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxViewChange,8)
|
||||
DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxViewChange( ITextHost2 *iface, BOOL update )
|
||||
void __thiscall ITextHostImpl_TxViewChange( ITextHost2 *iface, BOOL update )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
if (update) UpdateWindow( host->window );
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxCreateCaret,16)
|
||||
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxCreateCaret( ITextHost2 *iface, HBITMAP bitmap, INT width, INT height )
|
||||
BOOL __thiscall ITextHostImpl_TxCreateCaret( ITextHost2 *iface, HBITMAP bitmap, INT width, INT height )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
return CreateCaret( host->window, bitmap, width, height );
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxShowCaret,8)
|
||||
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxShowCaret( ITextHost2 *iface, BOOL show )
|
||||
BOOL __thiscall ITextHostImpl_TxShowCaret( ITextHost2 *iface, BOOL show )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
if (show) return ShowCaret( host->window );
|
||||
|
@ -277,27 +277,27 @@ DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxShowCaret( ITextHost2 *iface, BO
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetCaretPos,12)
|
||||
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetCaretPos( ITextHost2 *iface, INT x, INT y )
|
||||
BOOL __thiscall ITextHostImpl_TxSetCaretPos( ITextHost2 *iface, INT x, INT y )
|
||||
{
|
||||
return SetCaretPos(x, y);
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetTimer,12)
|
||||
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetTimer( ITextHost2 *iface, UINT id, UINT timeout )
|
||||
BOOL __thiscall ITextHostImpl_TxSetTimer( ITextHost2 *iface, UINT id, UINT timeout )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
return SetTimer( host->window, id, timeout, NULL ) != 0;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxKillTimer,8)
|
||||
DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxKillTimer( ITextHost2 *iface, UINT id )
|
||||
void __thiscall ITextHostImpl_TxKillTimer( ITextHost2 *iface, UINT id )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
KillTimer( host->window, id );
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxScrollWindowEx,32)
|
||||
DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxScrollWindowEx( ITextHost2 *iface, INT dx, INT dy, const RECT *scroll,
|
||||
void __thiscall ITextHostImpl_TxScrollWindowEx( ITextHost2 *iface, INT dx, INT dy, const RECT *scroll,
|
||||
const RECT *clip, HRGN update_rgn, RECT *update_rect,
|
||||
UINT flags )
|
||||
{
|
||||
|
@ -306,7 +306,7 @@ DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxScrollWindowEx( ITextHost2 *ifac
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetCapture,8)
|
||||
DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxSetCapture( ITextHost2 *iface, BOOL capture )
|
||||
void __thiscall ITextHostImpl_TxSetCapture( ITextHost2 *iface, BOOL capture )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
if (capture) SetCapture( host->window );
|
||||
|
@ -314,34 +314,34 @@ DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxSetCapture( ITextHost2 *iface, B
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetFocus,4)
|
||||
DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxSetFocus( ITextHost2 *iface )
|
||||
void __thiscall ITextHostImpl_TxSetFocus( ITextHost2 *iface )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
SetFocus( host->window );
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetCursor,12)
|
||||
DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxSetCursor( ITextHost2 *iface, HCURSOR cursor, BOOL text )
|
||||
void __thiscall ITextHostImpl_TxSetCursor( ITextHost2 *iface, HCURSOR cursor, BOOL text )
|
||||
{
|
||||
SetCursor( cursor );
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxScreenToClient,8)
|
||||
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxScreenToClient( ITextHost2 *iface, POINT *pt )
|
||||
BOOL __thiscall ITextHostImpl_TxScreenToClient( ITextHost2 *iface, POINT *pt )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
return ScreenToClient( host->window, pt );
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxClientToScreen,8)
|
||||
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxClientToScreen( ITextHost2 *iface, POINT *pt )
|
||||
BOOL __thiscall ITextHostImpl_TxClientToScreen( ITextHost2 *iface, POINT *pt )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
return ClientToScreen( host->window, pt );
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxActivate,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxActivate( ITextHost2 *iface, LONG *old_state )
|
||||
HRESULT __thiscall ITextHostImpl_TxActivate( ITextHost2 *iface, LONG *old_state )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
*old_state = HandleToLong( SetActiveWindow( host->window ) );
|
||||
|
@ -349,14 +349,14 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxActivate( ITextHost2 *iface,
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxDeactivate,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxDeactivate( ITextHost2 *iface, LONG new_state )
|
||||
HRESULT __thiscall ITextHostImpl_TxDeactivate( ITextHost2 *iface, LONG new_state )
|
||||
{
|
||||
HWND ret = SetActiveWindow( LongToHandle( new_state ) );
|
||||
return ret ? S_OK : E_FAIL;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetClientRect,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetClientRect( ITextHost2 *iface, RECT *rect )
|
||||
HRESULT __thiscall ITextHostImpl_TxGetClientRect( ITextHost2 *iface, RECT *rect )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
|
||||
|
@ -372,20 +372,20 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetClientRect( ITextHost2 *if
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetViewInset,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetViewInset( ITextHost2 *iface, RECT *rect )
|
||||
HRESULT __thiscall ITextHostImpl_TxGetViewInset( ITextHost2 *iface, RECT *rect )
|
||||
{
|
||||
SetRectEmpty( rect );
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetCharFormat,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetCharFormat( ITextHost2 *iface, const CHARFORMATW **ppCF )
|
||||
HRESULT __thiscall ITextHostImpl_TxGetCharFormat( ITextHost2 *iface, const CHARFORMATW **ppCF )
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetParaFormat,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetParaFormat( ITextHost2 *iface, const PARAFORMAT **fmt )
|
||||
HRESULT __thiscall ITextHostImpl_TxGetParaFormat( ITextHost2 *iface, const PARAFORMAT **fmt )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
*fmt = (const PARAFORMAT *)&host->para_fmt;
|
||||
|
@ -393,7 +393,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetParaFormat( ITextHost2 *if
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSysColor,8)
|
||||
DECLSPEC_HIDDEN COLORREF __thiscall ITextHostImpl_TxGetSysColor( ITextHost2 *iface, int index )
|
||||
COLORREF __thiscall ITextHostImpl_TxGetSysColor( ITextHost2 *iface, int index )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
|
||||
|
@ -402,21 +402,21 @@ DECLSPEC_HIDDEN COLORREF __thiscall ITextHostImpl_TxGetSysColor( ITextHost2 *ifa
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetBackStyle,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetBackStyle( ITextHost2 *iface, TXTBACKSTYLE *style )
|
||||
HRESULT __thiscall ITextHostImpl_TxGetBackStyle( ITextHost2 *iface, TXTBACKSTYLE *style )
|
||||
{
|
||||
*style = TXTBACK_OPAQUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetMaxLength,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetMaxLength( ITextHost2 *iface, DWORD *length )
|
||||
HRESULT __thiscall ITextHostImpl_TxGetMaxLength( ITextHost2 *iface, DWORD *length )
|
||||
{
|
||||
*length = INFINITE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetScrollBars,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetScrollBars( ITextHost2 *iface, DWORD *scrollbars )
|
||||
HRESULT __thiscall ITextHostImpl_TxGetScrollBars( ITextHost2 *iface, DWORD *scrollbars )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
|
||||
|
@ -425,7 +425,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetScrollBars( ITextHost2 *if
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetPasswordChar,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetPasswordChar( ITextHost2 *iface, WCHAR *c )
|
||||
HRESULT __thiscall ITextHostImpl_TxGetPasswordChar( ITextHost2 *iface, WCHAR *c )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
|
||||
|
@ -434,32 +434,32 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetPasswordChar( ITextHost2 *
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetAcceleratorPos,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetAcceleratorPos( ITextHost2 *iface, LONG *pos )
|
||||
HRESULT __thiscall ITextHostImpl_TxGetAcceleratorPos( ITextHost2 *iface, LONG *pos )
|
||||
{
|
||||
*pos = -1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetExtent,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetExtent( ITextHost2 *iface, SIZEL *extent )
|
||||
HRESULT __thiscall ITextHostImpl_TxGetExtent( ITextHost2 *iface, SIZEL *extent )
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_OnTxCharFormatChange,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_OnTxCharFormatChange( ITextHost2 *iface, const CHARFORMATW *pcf )
|
||||
HRESULT __thiscall ITextHostImpl_OnTxCharFormatChange( ITextHost2 *iface, const CHARFORMATW *pcf )
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_OnTxParaFormatChange,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_OnTxParaFormatChange( ITextHost2 *iface, const PARAFORMAT *ppf )
|
||||
HRESULT __thiscall ITextHostImpl_OnTxParaFormatChange( ITextHost2 *iface, const PARAFORMAT *ppf )
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetPropertyBits,12)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetPropertyBits( ITextHost2 *iface, DWORD mask, DWORD *bits )
|
||||
HRESULT __thiscall ITextHostImpl_TxGetPropertyBits( ITextHost2 *iface, DWORD mask, DWORD *bits )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
|
||||
|
@ -468,7 +468,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetPropertyBits( ITextHost2 *
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxNotify,12)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxNotify( ITextHost2 *iface, DWORD iNotify, void *pv )
|
||||
HRESULT __thiscall ITextHostImpl_TxNotify( ITextHost2 *iface, DWORD iNotify, void *pv )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
UINT id;
|
||||
|
@ -525,21 +525,21 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxNotify( ITextHost2 *iface, DW
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxImmGetContext,4)
|
||||
DECLSPEC_HIDDEN HIMC __thiscall ITextHostImpl_TxImmGetContext( ITextHost2 *iface )
|
||||
HIMC __thiscall ITextHostImpl_TxImmGetContext( ITextHost2 *iface )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
return ImmGetContext( host->window );
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxImmReleaseContext,8)
|
||||
DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxImmReleaseContext( ITextHost2 *iface, HIMC context )
|
||||
void __thiscall ITextHostImpl_TxImmReleaseContext( ITextHost2 *iface, HIMC context )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
ImmReleaseContext( host->window, context );
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSelectionBarWidth,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetSelectionBarWidth( ITextHost2 *iface, LONG *width )
|
||||
HRESULT __thiscall ITextHostImpl_TxGetSelectionBarWidth( ITextHost2 *iface, LONG *width )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
|
||||
|
@ -548,13 +548,13 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetSelectionBarWidth( ITextHo
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxIsDoubleClickPending,4)
|
||||
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxIsDoubleClickPending( ITextHost2 *iface )
|
||||
BOOL __thiscall ITextHostImpl_TxIsDoubleClickPending( ITextHost2 *iface )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetWindow,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetWindow( ITextHost2 *iface, HWND *hwnd )
|
||||
HRESULT __thiscall ITextHostImpl_TxGetWindow( ITextHost2 *iface, HWND *hwnd )
|
||||
{
|
||||
struct host *host = impl_from_ITextHost( iface );
|
||||
*hwnd = host->window;
|
||||
|
@ -562,61 +562,61 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetWindow( ITextHost2 *iface,
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetForegroundWindow,4)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxSetForegroundWindow( ITextHost2 *iface )
|
||||
HRESULT __thiscall ITextHostImpl_TxSetForegroundWindow( ITextHost2 *iface )
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetPalette,4)
|
||||
DECLSPEC_HIDDEN HPALETTE __thiscall ITextHostImpl_TxGetPalette( ITextHost2 *iface )
|
||||
HPALETTE __thiscall ITextHostImpl_TxGetPalette( ITextHost2 *iface )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetEastAsianFlags,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetEastAsianFlags( ITextHost2 *iface, LONG *flags )
|
||||
HRESULT __thiscall ITextHostImpl_TxGetEastAsianFlags( ITextHost2 *iface, LONG *flags )
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetCursor2,12)
|
||||
DECLSPEC_HIDDEN HCURSOR __thiscall ITextHostImpl_TxSetCursor2( ITextHost2 *iface, HCURSOR cursor, BOOL text )
|
||||
HCURSOR __thiscall ITextHostImpl_TxSetCursor2( ITextHost2 *iface, HCURSOR cursor, BOOL text )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxFreeTextServicesNotification,4)
|
||||
DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxFreeTextServicesNotification( ITextHost2 *iface )
|
||||
void __thiscall ITextHostImpl_TxFreeTextServicesNotification( ITextHost2 *iface )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetEditStyle,12)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetEditStyle( ITextHost2 *iface, DWORD item, DWORD *data )
|
||||
HRESULT __thiscall ITextHostImpl_TxGetEditStyle( ITextHost2 *iface, DWORD item, DWORD *data )
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetWindowStyles,12)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetWindowStyles( ITextHost2 *iface, DWORD *style, DWORD *ex_style )
|
||||
HRESULT __thiscall ITextHostImpl_TxGetWindowStyles( ITextHost2 *iface, DWORD *style, DWORD *ex_style )
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxShowDropCaret,16)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxShowDropCaret( ITextHost2 *iface, BOOL show, HDC hdc, const RECT *rect )
|
||||
HRESULT __thiscall ITextHostImpl_TxShowDropCaret( ITextHost2 *iface, BOOL show, HDC hdc, const RECT *rect )
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxDestroyCaret,4)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxDestroyCaret( ITextHost2 *iface )
|
||||
HRESULT __thiscall ITextHostImpl_TxDestroyCaret( ITextHost2 *iface )
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetHorzExtent,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetHorzExtent( ITextHost2 *iface, LONG *horz_extent )
|
||||
HRESULT __thiscall ITextHostImpl_TxGetHorzExtent( ITextHost2 *iface, LONG *horz_extent )
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
@ -900,7 +900,7 @@ static HRESULT get_lineA( ITextServices *text_srv, WPARAM wparam, LPARAM lparam,
|
|||
sizeA = *(WORD *)lparam;
|
||||
*(WORD *)lparam = 0;
|
||||
if (!sizeA) return S_OK;
|
||||
buf = heap_alloc( len * sizeof(WCHAR) );
|
||||
buf = malloc( len * sizeof(WCHAR) );
|
||||
if (!buf) return E_OUTOFMEMORY;
|
||||
*(WORD *)buf = len;
|
||||
hr = ITextServices_TxSendMessage( text_srv, EM_GETLINE, wparam, (LPARAM)buf, &len );
|
||||
|
@ -911,7 +911,7 @@ static HRESULT get_lineA( ITextServices *text_srv, WPARAM wparam, LPARAM lparam,
|
|||
if (len < sizeA) ((char *)lparam)[len] = '\0';
|
||||
*res = len;
|
||||
}
|
||||
heap_free( buf );
|
||||
free( buf );
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -930,7 +930,7 @@ static HRESULT get_text_rangeA( struct host *host, TEXTRANGEA *rangeA, LRESULT *
|
|||
range.chrg.cpMax = len;
|
||||
if (range.chrg.cpMin >= range.chrg.cpMax) return S_OK;
|
||||
count = range.chrg.cpMax - range.chrg.cpMin + 1;
|
||||
range.lpstrText = heap_alloc( count * sizeof(WCHAR) );
|
||||
range.lpstrText = malloc( count * sizeof(WCHAR) );
|
||||
if (!range.lpstrText) return E_OUTOFMEMORY;
|
||||
hr = ITextServices_TxSendMessage( host->text_srv, EM_GETTEXTRANGE, 0, (LPARAM)&range, &len );
|
||||
if (hr == S_OK && len)
|
||||
|
@ -944,7 +944,7 @@ static HRESULT get_text_rangeA( struct host *host, TEXTRANGEA *rangeA, LRESULT *
|
|||
rangeA->lpstrText[*res] = '\0';
|
||||
}
|
||||
}
|
||||
heap_free( range.lpstrText );
|
||||
free( range.lpstrText );
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -1086,7 +1086,7 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
|
|||
HRESULT hr = S_OK;
|
||||
LRESULT res = 0;
|
||||
|
||||
TRACE( "enter hwnd %p msg %04x (%s) %lx %lx, unicode %d\n",
|
||||
TRACE( "enter hwnd %p msg %04x (%s) %Ix %Ix, unicode %d\n",
|
||||
hwnd, msg, get_msg_name(msg), wparam, lparam, unicode );
|
||||
|
||||
host = (struct host *)GetWindowLongPtrW( hwnd, 0 );
|
||||
|
@ -1096,7 +1096,7 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
|
|||
{
|
||||
CREATESTRUCTW *pcs = (CREATESTRUCTW *)lparam;
|
||||
|
||||
TRACE( "WM_NCCREATE: hwnd %p style 0x%08x\n", hwnd, pcs->style );
|
||||
TRACE( "WM_NCCREATE: hwnd %p style 0x%08lx\n", hwnd, pcs->style );
|
||||
return create_windowed_editor( hwnd, pcs, FALSE );
|
||||
}
|
||||
else return DefWindowProcW( hwnd, msg, wparam, lparam );
|
||||
|
@ -1110,7 +1110,7 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
|
|||
res = send_msg_filter( host, msg, &wparam, &lparam );
|
||||
if (!--host->notify_level && host->defer_release)
|
||||
{
|
||||
TRACE( "exit (filtered deferred release) hwnd %p msg %04x (%s) %lx %lx -> 0\n",
|
||||
TRACE( "exit (filtered deferred release) hwnd %p msg %04x (%s) %Ix %Ix -> 0\n",
|
||||
hwnd, msg, get_msg_name(msg), wparam, lparam );
|
||||
ITextHost2_Release( &host->ITextHost_iface );
|
||||
return 0;
|
||||
|
@ -1118,7 +1118,7 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
|
|||
|
||||
if (res)
|
||||
{
|
||||
TRACE( "exit (filtered %lu) hwnd %p msg %04x (%s) %lx %lx -> 0\n",
|
||||
TRACE( "exit (filtered %Iu) hwnd %p msg %04x (%s) %Ix %Ix -> 0\n",
|
||||
res, hwnd, msg, get_msg_name(msg), wparam, lparam );
|
||||
return 0;
|
||||
}
|
||||
|
@ -1144,6 +1144,7 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
|
|||
WCHAR *textW = NULL;
|
||||
LONG codepage = unicode ? CP_UNICODE : CP_ACP;
|
||||
int len;
|
||||
LRESULT evmask;
|
||||
|
||||
ITextServices_OnTxInPlaceActivate( host->text_srv, NULL );
|
||||
|
||||
|
@ -1152,7 +1153,10 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
|
|||
text = unicode ? (void *)createW->lpszName : (void *)createA->lpszName;
|
||||
textW = ME_ToUnicode( codepage, text, &len );
|
||||
}
|
||||
ITextServices_TxSendMessage( host->text_srv, EM_GETEVENTMASK, 0, 0, &evmask );
|
||||
ITextServices_TxSendMessage( host->text_srv, EM_SETEVENTMASK, 0, evmask & ~ENM_CHANGE, &evmask );
|
||||
ITextServices_TxSetText( host->text_srv, textW );
|
||||
ITextServices_TxSendMessage( host->text_srv, EM_SETEVENTMASK, 0, evmask, NULL );
|
||||
if (lparam) ME_EndToUnicode( codepage, textW );
|
||||
break;
|
||||
}
|
||||
|
@ -1310,22 +1314,27 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
|
|||
HDC hdc;
|
||||
RECT rc, client, update;
|
||||
PAINTSTRUCT ps;
|
||||
HBRUSH brush = CreateSolidBrush( ITextHost_TxGetSysColor( &host->ITextHost_iface, COLOR_WINDOW ) );
|
||||
HBRUSH brush, old_brush;
|
||||
LONG view_id;
|
||||
|
||||
ITextHost_TxGetClientRect( &host->ITextHost_iface, &client );
|
||||
|
||||
if (msg == WM_PAINT)
|
||||
{
|
||||
/* TODO retrieve if the text document is frozen */
|
||||
hdc = BeginPaint( hwnd, &ps );
|
||||
update = ps.rcPaint;
|
||||
view_id = TXTVIEW_ACTIVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
hdc = (HDC)wparam;
|
||||
update = client;
|
||||
view_id = TXTVIEW_INACTIVE;
|
||||
}
|
||||
|
||||
brush = SelectObject( hdc, brush );
|
||||
brush = CreateSolidBrush( ITextHost_TxGetSysColor( &host->ITextHost_iface, COLOR_WINDOW ) );
|
||||
old_brush = SelectObject( hdc, brush );
|
||||
|
||||
/* Erase area outside of the formatting rectangle */
|
||||
if (update.top < client.top)
|
||||
|
@ -1358,8 +1367,9 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
|
|||
}
|
||||
|
||||
ITextServices_TxDraw( host->text_srv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, NULL, NULL,
|
||||
&update, NULL, 0, TXTVIEW_ACTIVE );
|
||||
DeleteObject( SelectObject( hdc, brush ) );
|
||||
&update, NULL, 0, view_id );
|
||||
SelectObject( hdc, old_brush );
|
||||
DeleteObject( brush );
|
||||
if (msg == WM_PAINT) EndPaint( hwnd, &ps );
|
||||
return 0;
|
||||
}
|
||||
|
@ -1499,7 +1509,7 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
|
|||
if (hr == S_FALSE)
|
||||
res = DefWindowProcW( hwnd, msg, wparam, lparam );
|
||||
|
||||
TRACE( "exit hwnd %p msg %04x (%s) %lx %lx, unicode %d -> %lu\n",
|
||||
TRACE( "exit hwnd %p msg %04x (%s) %Ix %Ix, unicode %d -> %Iu\n",
|
||||
hwnd, msg, get_msg_name(msg), wparam, lparam, unicode, res );
|
||||
|
||||
return res;
|
||||
|
@ -1538,7 +1548,7 @@ LRESULT WINAPI RichEdit10ANSIWndProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM
|
|||
{
|
||||
CREATESTRUCTW *pcs = (CREATESTRUCTW *)lparam;
|
||||
|
||||
TRACE( "WM_NCCREATE: hwnd %p style 0x%08x\n", hwnd, pcs->style );
|
||||
TRACE( "WM_NCCREATE: hwnd %p style 0x%08lx\n", hwnd, pcs->style );
|
||||
return create_windowed_editor( hwnd, pcs, TRUE );
|
||||
}
|
||||
return RichEditANSIWndProc( hwnd, msg, wparam, lparam );
|
||||
|
@ -1547,7 +1557,7 @@ LRESULT WINAPI RichEdit10ANSIWndProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM
|
|||
static LRESULT WINAPI REComboWndProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
|
||||
{
|
||||
/* FIXME: Not implemented */
|
||||
TRACE( "hwnd %p msg %04x (%s) %08lx %08lx\n",
|
||||
TRACE( "hwnd %p msg %04x (%s) %08Ix %08Ix\n",
|
||||
hwnd, msg, get_msg_name( msg ), wparam, lparam );
|
||||
return DefWindowProcW( hwnd, msg, wparam, lparam );
|
||||
}
|
||||
|
@ -1555,7 +1565,7 @@ static LRESULT WINAPI REComboWndProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM
|
|||
static LRESULT WINAPI REListWndProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
|
||||
{
|
||||
/* FIXME: Not implemented */
|
||||
TRACE( "hwnd %p msg %04x (%s) %08lx %08lx\n",
|
||||
TRACE( "hwnd %p msg %04x (%s) %08Ix %08Ix\n",
|
||||
hwnd, msg, get_msg_name( msg ), wparam, lparam );
|
||||
return DefWindowProcW( hwnd, msg, wparam, lparam );
|
||||
}
|
||||
|
@ -1658,7 +1668,6 @@ BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved )
|
|||
case DLL_PROCESS_ATTACH:
|
||||
dll_instance = instance;
|
||||
DisableThreadLibraryCalls( instance );
|
||||
me_heap = HeapCreate( 0, 0x10000, 0 );
|
||||
if (!register_classes( instance )) return FALSE;
|
||||
LookupInit();
|
||||
break;
|
||||
|
@ -1672,7 +1681,6 @@ BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved )
|
|||
if (listbox_registered) UnregisterClassW( L"REListBox20W", 0 );
|
||||
if (combobox_registered) UnregisterClassW( L"REComboBox20W", 0 );
|
||||
LookupCleanup();
|
||||
HeapDestroy( me_heap );
|
||||
release_typelib();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ static ULONG WINAPI ITextServicesImpl_AddRef(IUnknown *iface)
|
|||
struct text_services *services = impl_from_IUnknown( iface );
|
||||
LONG ref = InterlockedIncrement( &services->ref );
|
||||
|
||||
TRACE( "(%p) ref = %d\n", services, ref );
|
||||
TRACE( "(%p) ref = %ld\n", services, ref );
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
@ -76,13 +76,13 @@ static ULONG WINAPI ITextServicesImpl_Release(IUnknown *iface)
|
|||
struct text_services *services = impl_from_IUnknown( iface );
|
||||
LONG ref = InterlockedDecrement( &services->ref );
|
||||
|
||||
TRACE( "(%p) ref = %d\n", services, ref );
|
||||
TRACE( "(%p) ref = %ld\n", services, ref );
|
||||
|
||||
if (!ref)
|
||||
{
|
||||
richole_release_children( services );
|
||||
ME_DestroyEditor( services->editor );
|
||||
CoTaskMemFree( services );
|
||||
free( services );
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ static ULONG WINAPI fnTextSrv_Release(ITextServices *iface)
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSendMessage,20)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxSendMessage( ITextServices *iface, UINT msg, WPARAM wparam,
|
||||
HRESULT __thiscall fnTextSrv_TxSendMessage( ITextServices *iface, UINT msg, WPARAM wparam,
|
||||
LPARAM lparam, LRESULT *result )
|
||||
{
|
||||
struct text_services *services = impl_from_ITextServices( iface );
|
||||
|
@ -151,7 +151,7 @@ static HRESULT update_client_rect( struct text_services *services, const RECT *c
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxDraw,52)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxDraw( ITextServices *iface, DWORD aspect, LONG index, void *aspect_info,
|
||||
HRESULT __thiscall fnTextSrv_TxDraw( ITextServices *iface, DWORD aspect, LONG index, void *aspect_info,
|
||||
DVTARGETDEVICE *td, HDC draw, HDC target,
|
||||
const RECTL *bounds, const RECTL *mf_bounds, RECT *update,
|
||||
BOOL (CALLBACK *continue_fn)(DWORD), DWORD continue_param,
|
||||
|
@ -162,13 +162,15 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxDraw( ITextServices *iface, DWORD
|
|||
HDC dc = draw;
|
||||
BOOL rewrap = FALSE;
|
||||
|
||||
TRACE( "%p: aspect %d, %d, %p, %p, draw %p, target %p, bounds %s, mf_bounds %s, update %s, %p, %d, view %d\n",
|
||||
TRACE( "%p: aspect %ld, %ld, %p, %p, draw %p, target %p, bounds %s, mf_bounds %s, update %s, %p, %ld, view %ld\n",
|
||||
services, aspect, index, aspect_info, td, draw, target, wine_dbgstr_rect( (RECT *)bounds ),
|
||||
wine_dbgstr_rect( (RECT *)mf_bounds ), wine_dbgstr_rect( update ), continue_fn, continue_param, view_id );
|
||||
|
||||
if (aspect != DVASPECT_CONTENT || aspect_info || td || target || mf_bounds || continue_fn )
|
||||
FIXME( "Many arguments are ignored\n" );
|
||||
|
||||
if (view_id == TXTVIEW_ACTIVE && services->editor->freeze_count) return E_UNEXPECTED;
|
||||
|
||||
hr = update_client_rect( services, (RECT *)bounds );
|
||||
if (FAILED( hr )) return hr;
|
||||
if (hr == S_OK) rewrap = TRUE;
|
||||
|
@ -193,7 +195,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxDraw( ITextServices *iface, DWORD
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetHScroll,24)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetHScroll( ITextServices *iface, LONG *min_pos, LONG *max_pos, LONG *pos,
|
||||
HRESULT __thiscall fnTextSrv_TxGetHScroll( ITextServices *iface, LONG *min_pos, LONG *max_pos, LONG *pos,
|
||||
LONG *page, BOOL *enabled )
|
||||
{
|
||||
struct text_services *services = impl_from_ITextServices( iface );
|
||||
|
@ -207,7 +209,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetHScroll( ITextServices *iface,
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetVScroll,24)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetVScroll( ITextServices *iface, LONG *min_pos, LONG *max_pos, LONG *pos,
|
||||
HRESULT __thiscall fnTextSrv_TxGetVScroll( ITextServices *iface, LONG *min_pos, LONG *max_pos, LONG *pos,
|
||||
LONG *page, BOOL *enabled )
|
||||
{
|
||||
struct text_services *services = impl_from_ITextServices( iface );
|
||||
|
@ -221,13 +223,13 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetVScroll( ITextServices *iface,
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxSetCursor,40)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxSetCursor( ITextServices *iface, DWORD aspect, LONG index,
|
||||
HRESULT __thiscall fnTextSrv_OnTxSetCursor( ITextServices *iface, DWORD aspect, LONG index,
|
||||
void *aspect_info, DVTARGETDEVICE *td, HDC draw,
|
||||
HDC target, const RECT *client, INT x, INT y )
|
||||
{
|
||||
struct text_services *services = impl_from_ITextServices( iface );
|
||||
|
||||
TRACE( "%p: %d, %d, %p, %p, draw %p target %p client %s pos (%d, %d)\n", services, aspect, index, aspect_info, td, draw,
|
||||
TRACE( "%p: %ld, %ld, %p, %p, draw %p target %p client %s pos (%d, %d)\n", services, aspect, index, aspect_info, td, draw,
|
||||
target, wine_dbgstr_rect( client ), x, y );
|
||||
|
||||
if (aspect != DVASPECT_CONTENT || index || aspect_info || td || draw || target || client)
|
||||
|
@ -239,7 +241,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxSetCursor( ITextServices *iface
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxQueryHitPoint,44)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxQueryHitPoint(ITextServices *iface, DWORD dwDrawAspect, LONG lindex,
|
||||
HRESULT __thiscall fnTextSrv_TxQueryHitPoint(ITextServices *iface, DWORD dwDrawAspect, LONG lindex,
|
||||
void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcDraw,
|
||||
HDC hicTargetDev, LPCRECT lprcClient, INT x, INT y,
|
||||
DWORD *pHitResult)
|
||||
|
@ -251,7 +253,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxQueryHitPoint(ITextServices *ifac
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxInPlaceActivate,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxInPlaceActivate( ITextServices *iface, const RECT *client )
|
||||
HRESULT __thiscall fnTextSrv_OnTxInPlaceActivate( ITextServices *iface, const RECT *client )
|
||||
{
|
||||
struct text_services *services = impl_from_ITextServices( iface );
|
||||
HRESULT hr;
|
||||
|
@ -271,7 +273,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxInPlaceActivate( ITextServices
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxInPlaceDeactivate,4)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxInPlaceDeactivate(ITextServices *iface)
|
||||
HRESULT __thiscall fnTextSrv_OnTxInPlaceDeactivate(ITextServices *iface)
|
||||
{
|
||||
struct text_services *services = impl_from_ITextServices( iface );
|
||||
|
||||
|
@ -281,7 +283,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxInPlaceDeactivate(ITextServices
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxUIActivate,4)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxUIActivate(ITextServices *iface)
|
||||
HRESULT __thiscall fnTextSrv_OnTxUIActivate(ITextServices *iface)
|
||||
{
|
||||
struct text_services *services = impl_from_ITextServices( iface );
|
||||
|
||||
|
@ -290,7 +292,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxUIActivate(ITextServices *iface
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxUIDeactivate,4)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxUIDeactivate(ITextServices *iface)
|
||||
HRESULT __thiscall fnTextSrv_OnTxUIDeactivate(ITextServices *iface)
|
||||
{
|
||||
struct text_services *services = impl_from_ITextServices( iface );
|
||||
|
||||
|
@ -299,7 +301,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxUIDeactivate(ITextServices *ifa
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetText,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetText( ITextServices *iface, BSTR *text )
|
||||
HRESULT __thiscall fnTextSrv_TxGetText( ITextServices *iface, BSTR *text )
|
||||
{
|
||||
struct text_services *services = impl_from_ITextServices( iface );
|
||||
int length;
|
||||
|
@ -322,7 +324,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetText( ITextServices *iface, BS
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSetText,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxSetText( ITextServices *iface, const WCHAR *text )
|
||||
HRESULT __thiscall fnTextSrv_TxSetText( ITextServices *iface, const WCHAR *text )
|
||||
{
|
||||
struct text_services *services = impl_from_ITextServices( iface );
|
||||
ME_Cursor cursor;
|
||||
|
@ -340,7 +342,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxSetText( ITextServices *iface, co
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCurTargetX,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetCurTargetX(ITextServices *iface, LONG *x)
|
||||
HRESULT __thiscall fnTextSrv_TxGetCurTargetX(ITextServices *iface, LONG *x)
|
||||
{
|
||||
struct text_services *services = impl_from_ITextServices( iface );
|
||||
|
||||
|
@ -349,7 +351,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetCurTargetX(ITextServices *ifac
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetBaseLinePos,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetBaseLinePos(ITextServices *iface, LONG *x)
|
||||
HRESULT __thiscall fnTextSrv_TxGetBaseLinePos(ITextServices *iface, LONG *x)
|
||||
{
|
||||
struct text_services *services = impl_from_ITextServices( iface );
|
||||
|
||||
|
@ -358,7 +360,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetBaseLinePos(ITextServices *ifa
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetNaturalSize,36)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetNaturalSize( ITextServices *iface, DWORD aspect, HDC draw,
|
||||
HRESULT __thiscall fnTextSrv_TxGetNaturalSize( ITextServices *iface, DWORD aspect, HDC draw,
|
||||
HDC target, DVTARGETDEVICE *td, DWORD mode,
|
||||
const SIZEL *extent, LONG *width, LONG *height )
|
||||
{
|
||||
|
@ -368,7 +370,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetNaturalSize( ITextServices *if
|
|||
BOOL rewrap = FALSE;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE( "%p: aspect %d, draw %p, target %p, td %p, mode %08x, extent %s, *width %d, *height %d\n", services,
|
||||
TRACE( "%p: aspect %ld, draw %p, target %p, td %p, mode %08lx, extent %s, *width %ld, *height %ld\n", services,
|
||||
aspect, draw, target, td, mode, wine_dbgstr_point( (POINT *)extent ), *width, *height );
|
||||
|
||||
if (aspect != DVASPECT_CONTENT || target || td || mode != TXTNS_FITTOCONTENT )
|
||||
|
@ -398,7 +400,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetNaturalSize( ITextServices *if
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetDropTarget,8)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetDropTarget(ITextServices *iface, IDropTarget **ppDropTarget)
|
||||
HRESULT __thiscall fnTextSrv_TxGetDropTarget(ITextServices *iface, IDropTarget **ppDropTarget)
|
||||
{
|
||||
struct text_services *services = impl_from_ITextServices( iface );
|
||||
|
||||
|
@ -407,14 +409,14 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetDropTarget(ITextServices *ifac
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxPropertyBitsChange,12)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange( ITextServices *iface, DWORD mask, DWORD bits )
|
||||
HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange( ITextServices *iface, DWORD mask, DWORD bits )
|
||||
{
|
||||
struct text_services *services = impl_from_ITextServices( iface );
|
||||
DWORD scrollbars;
|
||||
HRESULT hr;
|
||||
BOOL repaint = FALSE;
|
||||
|
||||
TRACE( "%p, mask %08x, bits %08x\n", services, mask, bits );
|
||||
TRACE( "%p, mask %08lx, bits %08lx\n", services, mask, bits );
|
||||
|
||||
services->editor->props = (services->editor->props & ~mask) | (bits & mask);
|
||||
if (mask & (TXTBIT_WORDWRAP | TXTBIT_MULTILINE))
|
||||
|
@ -471,7 +473,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange( ITextServic
|
|||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCachedSize,12)
|
||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetCachedSize(ITextServices *iface, DWORD *pdwWidth, DWORD *pdwHeight)
|
||||
HRESULT __thiscall fnTextSrv_TxGetCachedSize(ITextServices *iface, DWORD *pdwWidth, DWORD *pdwHeight)
|
||||
{
|
||||
struct text_services *services = impl_from_ITextServices( iface );
|
||||
|
||||
|
@ -581,7 +583,7 @@ HRESULT create_text_services( IUnknown *outer, ITextHost *text_host, IUnknown **
|
|||
TRACE( "%p %p --> %p\n", outer, text_host, unk );
|
||||
if (text_host == NULL) return E_POINTER;
|
||||
|
||||
services = CoTaskMemAlloc( sizeof(*services) );
|
||||
services = malloc( sizeof(*services) );
|
||||
if (services == NULL) return E_OUTOFMEMORY;
|
||||
services->ref = 1;
|
||||
services->IUnknown_inner.lpVtbl = &textservices_inner_vtbl;
|
||||
|
|
|
@ -27,7 +27,7 @@ static void destroy_undo_item( struct undo_item *undo )
|
|||
switch( undo->type )
|
||||
{
|
||||
case undo_insert_run:
|
||||
heap_free( undo->u.insert_run.str );
|
||||
free( undo->u.insert_run.str );
|
||||
ME_ReleaseStyle( undo->u.insert_run.style );
|
||||
break;
|
||||
case undo_split_para:
|
||||
|
@ -37,7 +37,7 @@ static void destroy_undo_item( struct undo_item *undo )
|
|||
break;
|
||||
}
|
||||
|
||||
heap_free( undo );
|
||||
free( undo );
|
||||
}
|
||||
|
||||
static void empty_redo_stack(ME_TextEditor *editor)
|
||||
|
@ -53,7 +53,7 @@ static void empty_redo_stack(ME_TextEditor *editor)
|
|||
void ME_EmptyUndoStack(ME_TextEditor *editor)
|
||||
{
|
||||
struct undo_item *cursor, *cursor2;
|
||||
if (editor->nUndoMode == umIgnore)
|
||||
if (editor->nUndoMode == umIgnore) /* NOTE don't use editor_undo_ignored() here! */
|
||||
return;
|
||||
|
||||
TRACE("Emptying undo stack\n");
|
||||
|
@ -74,10 +74,10 @@ static struct undo_item *add_undo( ME_TextEditor *editor, enum undo_type type )
|
|||
struct undo_item *undo, *item;
|
||||
struct list *head;
|
||||
|
||||
if (editor->nUndoMode == umIgnore) return NULL;
|
||||
if (editor_undo_ignored(editor)) return NULL;
|
||||
if (editor->nUndoLimit == 0) return NULL;
|
||||
|
||||
undo = heap_alloc( sizeof(*undo) );
|
||||
undo = malloc( sizeof(*undo) );
|
||||
if (!undo) return NULL;
|
||||
undo->type = type;
|
||||
|
||||
|
@ -133,7 +133,7 @@ BOOL add_undo_insert_run( ME_TextEditor *editor, int pos, const WCHAR *str, int
|
|||
struct undo_item *undo = add_undo( editor, undo_insert_run );
|
||||
if (!undo) return FALSE;
|
||||
|
||||
undo->u.insert_run.str = heap_alloc( (len + 1) * sizeof(WCHAR) );
|
||||
undo->u.insert_run.str = malloc( (len + 1) * sizeof(WCHAR) );
|
||||
if (!undo->u.insert_run.str)
|
||||
{
|
||||
ME_EmptyUndoStack( editor );
|
||||
|
@ -229,7 +229,7 @@ void ME_CommitUndo(ME_TextEditor *editor)
|
|||
struct undo_item *item;
|
||||
struct list *head;
|
||||
|
||||
if (editor->nUndoMode == umIgnore)
|
||||
if (editor_undo_ignored(editor))
|
||||
return;
|
||||
|
||||
assert(editor->nUndoMode == umAddToUndo);
|
||||
|
@ -267,7 +267,7 @@ void ME_ContinueCoalescingTransaction(ME_TextEditor *editor)
|
|||
struct undo_item *item;
|
||||
struct list *head;
|
||||
|
||||
if (editor->nUndoMode == umIgnore)
|
||||
if (editor_undo_ignored(editor))
|
||||
return;
|
||||
|
||||
assert(editor->nUndoMode == umAddToUndo);
|
||||
|
@ -303,7 +303,7 @@ void ME_CommitCoalescingUndo(ME_TextEditor *editor)
|
|||
struct undo_item *item;
|
||||
struct list *head;
|
||||
|
||||
if (editor->nUndoMode == umIgnore)
|
||||
if (editor_undo_ignored(editor))
|
||||
return;
|
||||
|
||||
assert(editor->nUndoMode == umAddToUndo);
|
||||
|
@ -323,7 +323,7 @@ void ME_CommitCoalescingUndo(ME_TextEditor *editor)
|
|||
static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo)
|
||||
{
|
||||
|
||||
if (editor->nUndoMode == umIgnore)
|
||||
if (editor_undo_ignored(editor))
|
||||
return;
|
||||
TRACE("Playing undo/redo item, id=%d\n", undo->type);
|
||||
|
||||
|
@ -413,7 +413,7 @@ BOOL ME_Undo(ME_TextEditor *editor)
|
|||
struct list *head;
|
||||
struct undo_item *undo, *cursor2;
|
||||
|
||||
if (editor->nUndoMode == umIgnore) return FALSE;
|
||||
if (editor_undo_ignored(editor)) return FALSE;
|
||||
assert(nMode == umAddToUndo || nMode == umIgnore);
|
||||
|
||||
head = list_head( &editor->undo_stack );
|
||||
|
@ -453,7 +453,7 @@ BOOL ME_Redo(ME_TextEditor *editor)
|
|||
|
||||
assert(nMode == umAddToUndo || nMode == umIgnore);
|
||||
|
||||
if (editor->nUndoMode == umIgnore) return FALSE;
|
||||
if (editor_undo_ignored(editor)) return FALSE;
|
||||
|
||||
head = list_head( &editor->redo_stack );
|
||||
if (!head) return FALSE;
|
||||
|
@ -479,3 +479,17 @@ BOOL ME_Redo(ME_TextEditor *editor)
|
|||
ME_UpdateRepaint(editor, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void editor_disable_undo(ME_TextEditor *editor)
|
||||
{
|
||||
ME_EmptyUndoStack(editor);
|
||||
editor->undo_ctl_state = undoDisabled;
|
||||
}
|
||||
|
||||
void editor_enable_undo(ME_TextEditor *editor)
|
||||
{
|
||||
if (editor->undo_ctl_state == undoDisabled)
|
||||
{
|
||||
editor->undo_ctl_state = undoActive;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,8 +50,8 @@ typedef struct tagME_WrapContext
|
|||
|
||||
static BOOL get_run_glyph_buffers( ME_Run *run )
|
||||
{
|
||||
heap_free( run->glyphs );
|
||||
run->glyphs = heap_alloc( run->max_glyphs * (sizeof(WORD) + sizeof(SCRIPT_VISATTR) + sizeof(int) + sizeof(GOFFSET)) );
|
||||
free( run->glyphs );
|
||||
run->glyphs = malloc( run->max_glyphs * (sizeof(WORD) + sizeof(SCRIPT_VISATTR) + sizeof(int) + sizeof(GOFFSET)) );
|
||||
if (!run->glyphs) return FALSE;
|
||||
|
||||
run->vis_attrs = (SCRIPT_VISATTR*)((char*)run->glyphs + run->max_glyphs * sizeof(WORD));
|
||||
|
@ -75,9 +75,9 @@ static HRESULT shape_run( ME_Context *c, ME_Run *run )
|
|||
|
||||
if (run->max_clusters < run->len)
|
||||
{
|
||||
heap_free( run->clusters );
|
||||
free( run->clusters );
|
||||
run->max_clusters = run->len * 2;
|
||||
run->clusters = heap_alloc( run->max_clusters * sizeof(WORD) );
|
||||
run->clusters = malloc( run->max_clusters * sizeof(WORD) );
|
||||
}
|
||||
|
||||
select_style( c, run->style );
|
||||
|
@ -136,7 +136,7 @@ static ME_Run *split_run_extents( ME_WrapContext *wc, ME_Run *run, int nVChar )
|
|||
assert( run->nCharOfs != -1 );
|
||||
ME_CheckCharOffsets(editor);
|
||||
|
||||
TRACE("Before split: %s(%d, %d)\n", debugstr_run( run ),
|
||||
TRACE("Before split: %s(%ld, %ld)\n", debugstr_run( run ),
|
||||
run->pt.x, run->pt.y);
|
||||
|
||||
run_split( editor, &cursor );
|
||||
|
@ -153,7 +153,7 @@ static ME_Run *split_run_extents( ME_WrapContext *wc, ME_Run *run, int nVChar )
|
|||
|
||||
ME_CheckCharOffsets(editor);
|
||||
|
||||
TRACE("After split: %s(%d, %d), %s(%d, %d)\n",
|
||||
TRACE("After split: %s(%ld, %ld), %s(%ld, %ld)\n",
|
||||
debugstr_run( run ), run->pt.x, run->pt.y,
|
||||
debugstr_run( run2 ), run2->pt.x, run2->pt.y);
|
||||
|
||||
|
@ -250,7 +250,7 @@ static void layout_row( ME_Run *start, ME_Run *last )
|
|||
if (!num_runs) return;
|
||||
|
||||
if (num_runs > ARRAY_SIZE( buf ) / 5)
|
||||
vis_to_log = heap_alloc( num_runs * sizeof(int) * 5 );
|
||||
vis_to_log = malloc( num_runs * sizeof(int) * 5 );
|
||||
|
||||
log_to_vis = vis_to_log + num_runs;
|
||||
widths = vis_to_log + 2 * num_runs;
|
||||
|
@ -274,11 +274,11 @@ static void layout_row( ME_Run *start, ME_Run *last )
|
|||
for (i = 0, run = start; i < num_runs; run = run_next( run ))
|
||||
{
|
||||
run->pt.x = pos[ log_to_vis[ i ] ];
|
||||
TRACE( "%d: x = %d\n", i, run->pt.x );
|
||||
TRACE( "%d: x = %ld\n", i, run->pt.x );
|
||||
i++;
|
||||
}
|
||||
|
||||
if (vis_to_log != buf) heap_free( vis_to_log );
|
||||
if (vis_to_log != buf) free( vis_to_log );
|
||||
}
|
||||
|
||||
static void ME_InsertRowStart( ME_WrapContext *wc, ME_Run *last )
|
||||
|
@ -744,9 +744,9 @@ static HRESULT itemize_para( ME_Context *c, ME_Paragraph *para )
|
|||
if (items_passed > para->text->nLen + 1) break; /* something else has gone wrong */
|
||||
items_passed *= 2;
|
||||
if (items == buf)
|
||||
items = heap_alloc( items_passed * sizeof( *items ) );
|
||||
items = malloc( items_passed * sizeof( *items ) );
|
||||
else
|
||||
items = heap_realloc( items, items_passed * sizeof( *items ) );
|
||||
items = realloc( items, items_passed * sizeof( *items ) );
|
||||
if (!items) break;
|
||||
}
|
||||
if (FAILED( hr )) goto end;
|
||||
|
@ -792,7 +792,7 @@ static HRESULT itemize_para( ME_Context *c, ME_Paragraph *para )
|
|||
para->nFlags |= MEPF_COMPLEX;
|
||||
|
||||
end:
|
||||
if (items != buf) heap_free( items );
|
||||
if (items != buf) free( items );
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -835,6 +835,15 @@ static void ME_WrapTextParagraph( ME_TextEditor *editor, ME_Context *c, ME_Parag
|
|||
if (SUCCEEDED( itemize_para( c, para ) ))
|
||||
shape_para( c, para );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If the user has just converted a normal rich editor with already
|
||||
* existing text into a password input, the text may contain paragraphs
|
||||
* with MEPF_COMPLEX set. Since we don't really shape any paragraphs
|
||||
* here, we need to ensure that the MEPF_COMPLEX flag is unset.
|
||||
*/
|
||||
para->nFlags &= ~MEPF_COMPLEX;
|
||||
}
|
||||
|
||||
wc.context = c;
|
||||
wc.para = para;
|
||||
|
@ -1032,7 +1041,7 @@ BOOL wrap_marked_paras_dc( ME_TextEditor *editor, HDC hdc, BOOL invalidate )
|
|||
|
||||
ME_InitContext( &c, editor, hdc );
|
||||
|
||||
entry = wine_rb_head( editor->marked_paras.root );
|
||||
entry = rb_head( editor->marked_paras.root );
|
||||
while (entry)
|
||||
{
|
||||
para = WINE_RB_ENTRY_VALUE( entry, ME_Paragraph, marked_entry );
|
||||
|
@ -1045,7 +1054,7 @@ BOOL wrap_marked_paras_dc( ME_TextEditor *editor, HDC hdc, BOOL invalidate )
|
|||
next_entry = entry;
|
||||
}
|
||||
else
|
||||
next_entry = wine_rb_next( entry );
|
||||
next_entry = rb_next( entry );
|
||||
|
||||
c.pt = para->pt;
|
||||
prev_width = para->nWidth;
|
||||
|
@ -1076,7 +1085,7 @@ BOOL wrap_marked_paras_dc( ME_TextEditor *editor, HDC hdc, BOOL invalidate )
|
|||
}
|
||||
entry = next_entry;
|
||||
}
|
||||
wine_rb_clear( &editor->marked_paras, NULL, NULL );
|
||||
wine_rb_destroy( &editor->marked_paras, NULL, NULL );
|
||||
|
||||
editor->sizeWindow.cx = c.rcView.right-c.rcView.left;
|
||||
editor->sizeWindow.cy = c.rcView.bottom-c.rcView.top;
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define NONAMELESSUNION
|
||||
|
||||
#include "editor.h"
|
||||
#include "rtf.h"
|
||||
|
||||
|
@ -54,7 +52,7 @@ ME_StreamOutRTFText(ME_OutStream *pStream, const WCHAR *text, LONG nChars);
|
|||
static ME_OutStream*
|
||||
ME_StreamOutInit(ME_TextEditor *editor, EDITSTREAM *stream)
|
||||
{
|
||||
ME_OutStream *pStream = heap_alloc_zero(sizeof(*pStream));
|
||||
ME_OutStream *pStream = calloc(1, sizeof(*pStream));
|
||||
|
||||
pStream->stream = stream;
|
||||
pStream->stream->dwError = 0;
|
||||
|
@ -76,7 +74,7 @@ ME_StreamOutFlush(ME_OutStream *pStream)
|
|||
nWritten = pStream->pos;
|
||||
stream->dwError = stream->pfnCallback(stream->dwCookie, (LPBYTE)pStream->buffer,
|
||||
pStream->pos, &nWritten);
|
||||
TRACE("error=%u written=%u\n", stream->dwError, nWritten);
|
||||
TRACE("error=%lu written=%lu\n", stream->dwError, nWritten);
|
||||
if (nWritten == 0 || stream->dwError)
|
||||
return FALSE;
|
||||
/* Don't resend partial chunks if nWritten < pStream->pos */
|
||||
|
@ -92,9 +90,9 @@ static LONG
|
|||
ME_StreamOutFree(ME_OutStream *pStream)
|
||||
{
|
||||
LONG written = pStream->written;
|
||||
TRACE("total length = %u\n", written);
|
||||
TRACE("total length = %lu\n", written);
|
||||
|
||||
heap_free(pStream);
|
||||
free(pStream);
|
||||
return written;
|
||||
}
|
||||
|
||||
|
@ -125,11 +123,11 @@ ME_StreamOutPrint(ME_OutStream *pStream, const char *format, ...)
|
|||
{
|
||||
char string[STREAMOUT_BUFFER_SIZE]; /* This is going to be enough */
|
||||
int len;
|
||||
__ms_va_list valist;
|
||||
va_list valist;
|
||||
|
||||
__ms_va_start(valist, format);
|
||||
va_start(valist, format);
|
||||
len = vsnprintf(string, sizeof(string), format, valist);
|
||||
__ms_va_end(valist);
|
||||
va_end(valist);
|
||||
|
||||
return ME_StreamOutMove(pStream, string, len);
|
||||
}
|
||||
|
@ -400,9 +398,9 @@ static BOOL stream_out_table_props( ME_TextEditor *editor, ME_OutStream *pStream
|
|||
cell = table_row_first_cell( para );
|
||||
assert( cell );
|
||||
if (pFmt->dxOffset)
|
||||
sprintf(props + strlen(props), "\\trgaph%d", pFmt->dxOffset);
|
||||
sprintf(props + strlen(props), "\\trgaph%ld", pFmt->dxOffset);
|
||||
if (pFmt->dxStartIndent)
|
||||
sprintf(props + strlen(props), "\\trleft%d", pFmt->dxStartIndent);
|
||||
sprintf(props + strlen(props), "\\trleft%ld", pFmt->dxStartIndent);
|
||||
do
|
||||
{
|
||||
ME_Border* borders[4] = { &cell->border.top, &cell->border.left,
|
||||
|
@ -434,9 +432,9 @@ static BOOL stream_out_table_props( ME_TextEditor *editor, ME_OutStream *pStream
|
|||
|
||||
assert( !(para->nFlags & (MEPF_ROWSTART | MEPF_ROWEND | MEPF_CELL)) );
|
||||
if (pFmt->dxOffset)
|
||||
sprintf(props + strlen(props), "\\trgaph%d", pFmt->dxOffset);
|
||||
sprintf(props + strlen(props), "\\trgaph%ld", pFmt->dxOffset);
|
||||
if (pFmt->dxStartIndent)
|
||||
sprintf(props + strlen(props), "\\trleft%d", pFmt->dxStartIndent);
|
||||
sprintf(props + strlen(props), "\\trleft%ld", pFmt->dxStartIndent);
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (borders[i]->width)
|
||||
|
@ -452,7 +450,7 @@ static BOOL stream_out_table_props( ME_TextEditor *editor, ME_OutStream *pStream
|
|||
}
|
||||
for (i = 0; i < pFmt->cTabCount; i++)
|
||||
{
|
||||
sprintf(props + strlen(props), "\\cellx%d", pFmt->rgxTabs[i] & 0x00FFFFFF);
|
||||
sprintf(props + strlen(props), "\\cellx%ld", pFmt->rgxTabs[i] & 0x00FFFFFF);
|
||||
}
|
||||
}
|
||||
if (!ME_StreamOutPrint(pStream, props))
|
||||
|
@ -631,13 +629,13 @@ static BOOL stream_out_para_props( ME_TextEditor *editor, ME_OutStream *pStream,
|
|||
strcat(props, "\\sl-480\\slmult1");
|
||||
break;
|
||||
case 3:
|
||||
sprintf(props + strlen(props), "\\sl%d\\slmult0", fmt->dyLineSpacing);
|
||||
sprintf(props + strlen(props), "\\sl%ld\\slmult0", fmt->dyLineSpacing);
|
||||
break;
|
||||
case 4:
|
||||
sprintf(props + strlen(props), "\\sl-%d\\slmult0", fmt->dyLineSpacing);
|
||||
sprintf(props + strlen(props), "\\sl-%ld\\slmult0", fmt->dyLineSpacing);
|
||||
break;
|
||||
case 5:
|
||||
sprintf(props + strlen(props), "\\sl-%d\\slmult1", fmt->dyLineSpacing * 240 / 20);
|
||||
sprintf(props + strlen(props), "\\sl-%ld\\slmult1", fmt->dyLineSpacing * 240 / 20);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -663,11 +661,11 @@ static BOOL stream_out_para_props( ME_TextEditor *editor, ME_OutStream *pStream,
|
|||
fmt->dwMask & PFM_TABLE && fmt->wEffects & PFE_TABLE))
|
||||
{
|
||||
if (fmt->dxOffset)
|
||||
sprintf(props + strlen(props), "\\li%d", fmt->dxOffset);
|
||||
sprintf(props + strlen(props), "\\li%ld", fmt->dxOffset);
|
||||
if (fmt->dxStartIndent)
|
||||
sprintf(props + strlen(props), "\\fi%d", fmt->dxStartIndent);
|
||||
sprintf(props + strlen(props), "\\fi%ld", fmt->dxStartIndent);
|
||||
if (fmt->dxRightIndent)
|
||||
sprintf(props + strlen(props), "\\ri%d", fmt->dxRightIndent);
|
||||
sprintf(props + strlen(props), "\\ri%ld", fmt->dxRightIndent);
|
||||
if (fmt->dwMask & PFM_TABSTOPS) {
|
||||
static const char * const leader[6] = { "", "\\tldot", "\\tlhyph", "\\tlul", "\\tlth", "\\tleq" };
|
||||
|
||||
|
@ -690,14 +688,14 @@ static BOOL stream_out_para_props( ME_TextEditor *editor, ME_OutStream *pStream,
|
|||
}
|
||||
if (fmt->rgxTabs[i] >> 28 <= 5)
|
||||
strcat(props, leader[fmt->rgxTabs[i] >> 28]);
|
||||
sprintf(props+strlen(props), "\\tx%d", fmt->rgxTabs[i]&0x00FFFFFF);
|
||||
sprintf(props+strlen(props), "\\tx%ld", fmt->rgxTabs[i]&0x00FFFFFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fmt->dySpaceAfter)
|
||||
sprintf(props + strlen(props), "\\sa%d", fmt->dySpaceAfter);
|
||||
sprintf(props + strlen(props), "\\sa%ld", fmt->dySpaceAfter);
|
||||
if (fmt->dySpaceBefore)
|
||||
sprintf(props + strlen(props), "\\sb%d", fmt->dySpaceBefore);
|
||||
sprintf(props + strlen(props), "\\sb%ld", fmt->dySpaceBefore);
|
||||
if (fmt->sStyle != -1)
|
||||
sprintf(props + strlen(props), "\\s%d", fmt->sStyle);
|
||||
|
||||
|
@ -791,12 +789,12 @@ ME_StreamOutRTFCharProps(ME_OutStream *pStream, CHARFORMAT2W *fmt)
|
|||
if (old_fmt->yOffset != fmt->yOffset)
|
||||
{
|
||||
if (fmt->yOffset >= 0)
|
||||
sprintf(props + strlen(props), "\\up%d", fmt->yOffset);
|
||||
sprintf(props + strlen(props), "\\up%ld", fmt->yOffset);
|
||||
else
|
||||
sprintf(props + strlen(props), "\\dn%d", -fmt->yOffset);
|
||||
sprintf(props + strlen(props), "\\dn%ld", -fmt->yOffset);
|
||||
}
|
||||
if (old_fmt->yHeight != fmt->yHeight)
|
||||
sprintf(props + strlen(props), "\\fs%d", fmt->yHeight / 10);
|
||||
sprintf(props + strlen(props), "\\fs%ld", fmt->yHeight / 10);
|
||||
if (old_fmt->sSpacing != fmt->sSpacing)
|
||||
sprintf(props + strlen(props), "\\expnd%u\\expndtw%u", fmt->sSpacing / 5, fmt->sSpacing);
|
||||
if ((old_fmt->dwEffects ^ fmt->dwEffects) & (CFM_SUBSCRIPT | CFM_SUPERSCRIPT))
|
||||
|
@ -953,13 +951,13 @@ static BOOL stream_out_graphics( ME_TextEditor *editor, ME_OutStream *stream,
|
|||
if (FAILED(hr)) goto done;
|
||||
if (med.tymed != TYMED_ENHMF) goto done;
|
||||
|
||||
size = GetEnhMetaFileBits( med.u.hEnhMetaFile, 0, NULL );
|
||||
size = GetEnhMetaFileBits( med.hEnhMetaFile, 0, NULL );
|
||||
if (size < FIELD_OFFSET(ENHMETAHEADER, cbPixelFormat)) goto done;
|
||||
|
||||
emf_bits = HeapAlloc( GetProcessHeap(), 0, size );
|
||||
emf_bits = malloc( size );
|
||||
if (!emf_bits) goto done;
|
||||
|
||||
size = GetEnhMetaFileBits( med.u.hEnhMetaFile, size, (BYTE *)emf_bits );
|
||||
size = GetEnhMetaFileBits( med.hEnhMetaFile, size, (BYTE *)emf_bits );
|
||||
if (size < FIELD_OFFSET(ENHMETAHEADER, cbPixelFormat)) goto done;
|
||||
|
||||
/* size_in_pixels = (frame_size / 100) * szlDevice / szlMillimeters
|
||||
|
@ -988,7 +986,7 @@ static BOOL stream_out_graphics( ME_TextEditor *editor, ME_OutStream *stream,
|
|||
done:
|
||||
ME_DestroyContext( &c );
|
||||
ITextHost_TxReleaseDC( editor->texthost, hdc );
|
||||
HeapFree( GetProcessHeap(), 0, emf_bits );
|
||||
free( emf_bits );
|
||||
ReleaseStgMedium( &med );
|
||||
IDataObject_Release( data );
|
||||
return ret;
|
||||
|
@ -1157,7 +1155,7 @@ static BOOL ME_StreamOutText(ME_TextEditor *editor, ME_OutStream *pStream,
|
|||
nSize = WideCharToMultiByte(nCodePage, 0, get_text( cursor.run, cursor.nOffset ),
|
||||
nLen, NULL, 0, NULL, NULL);
|
||||
if (nSize > nBufLen) {
|
||||
buffer = heap_realloc(buffer, nSize);
|
||||
buffer = realloc(buffer, nSize);
|
||||
nBufLen = nSize;
|
||||
}
|
||||
WideCharToMultiByte(nCodePage, 0, get_text( cursor.run, cursor.nOffset ),
|
||||
|
@ -1171,7 +1169,7 @@ static BOOL ME_StreamOutText(ME_TextEditor *editor, ME_OutStream *pStream,
|
|||
cursor.run = run_next_all_paras( cursor.run );
|
||||
}
|
||||
|
||||
heap_free(buffer);
|
||||
free(buffer);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
@ -1198,7 +1196,7 @@ ME_StreamOut(ME_TextEditor *editor, DWORD dwFormat, EDITSTREAM *stream)
|
|||
int nChars;
|
||||
|
||||
if (dwFormat & SFF_SELECTION) {
|
||||
int nStart, nTo;
|
||||
LONG nStart, nTo;
|
||||
start = editor->pCursors[ME_GetSelectionOfs(editor, &nStart, &nTo)];
|
||||
nChars = nTo - nStart;
|
||||
} else {
|
||||
|
|
|
@ -168,7 +168,7 @@ dll/win32/query # Synced to WineStaging-4.18
|
|||
dll/win32/rasapi32 # Synced to WineStaging-3.3
|
||||
dll/win32/regapi # Synced to WineStaging-5.7
|
||||
dll/win32/resutils # Synced to WineStaging-3.3
|
||||
dll/win32/riched20 # Synced to Wine-6.10
|
||||
dll/win32/riched20 # Synced to Wine-10.0
|
||||
dll/win32/riched32 # Synced to WineStaging-3.3
|
||||
dll/win32/rpcrt4 # Synced to WineStaging-4.18
|
||||
dll/win32/rsabase # Synced to WineStaging-3.3
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
remove_definitions(-D__ROS_LONG64__)
|
||||
add_definitions(-DUSE_WINE_TODOS)
|
||||
|
||||
list(APPEND SOURCE
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -38,6 +38,27 @@
|
|||
#include <oleauto.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define DEFINE_EXPECT(func) \
|
||||
static UINT called_count_ ## func = 0
|
||||
|
||||
#define INCREASE_CALL_COUNTER(func) \
|
||||
do { \
|
||||
called_count_ ## func++; \
|
||||
}while(0)
|
||||
|
||||
#define CHECK_CALLED(func) \
|
||||
do { \
|
||||
ok(called_count_ ## func, "expected " #func "\n"); \
|
||||
}while(0)
|
||||
|
||||
#define CHECK_NOT_CALLED(func) \
|
||||
do { \
|
||||
ok(!called_count_ ## func, "unexpected " #func "\n"); \
|
||||
}while(0)
|
||||
|
||||
#define CLEAR_COUNTER(func) \
|
||||
called_count_ ## func = 0
|
||||
|
||||
static HMODULE hmoduleRichEdit;
|
||||
static IID *pIID_ITextServices;
|
||||
static IID *pIID_ITextHost;
|
||||
|
@ -81,6 +102,10 @@ static ITextServicesVtbl itextServicesStdcallVtbl;
|
|||
/************************************************************************/
|
||||
/* ITextHost implementation for conformance testing. */
|
||||
|
||||
DEFINE_EXPECT(ITextHostImpl_TxViewChange);
|
||||
DEFINE_EXPECT(ITextHostImpl_TxScrollWindowEx);
|
||||
DEFINE_EXPECT(ITextHostImpl_TxGetClientRect);
|
||||
|
||||
typedef struct ITextHostTestImpl
|
||||
{
|
||||
ITextHost ITextHost_iface;
|
||||
|
@ -173,7 +198,7 @@ static BOOL __thiscall ITextHostImpl_TxSetScrollRange(ITextHost *iface, INT fnBa
|
|||
INT nMaxPos, BOOL fRedraw)
|
||||
{
|
||||
ITextHostTestImpl *This = impl_from_ITextHost(iface);
|
||||
TRACECALL("Call to TxSetScrollRange(%p, fnBar=%d, nMinPos=%d, nMaxPos=%d, fRedraw=%d)\n",
|
||||
TRACECALL("Call to TxSetScrollRange(%p, fnBar=%d, nMinPos=%ld, nMaxPos=%d, fRedraw=%d)\n",
|
||||
This, fnBar, nMinPos, nMaxPos, fRedraw);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -198,6 +223,7 @@ static void __thiscall ITextHostImpl_TxViewChange(ITextHost *iface, BOOL fUpdate
|
|||
ITextHostTestImpl *This = impl_from_ITextHost(iface);
|
||||
TRACECALL("Call to TxViewChange(%p, fUpdate=%d)\n",
|
||||
This, fUpdate);
|
||||
INCREASE_CALL_COUNTER(ITextHostImpl_TxViewChange);
|
||||
}
|
||||
|
||||
static BOOL __thiscall ITextHostImpl_TxCreateCaret(ITextHost *iface, HBITMAP hbmp, INT xWidth, INT yHeight)
|
||||
|
@ -244,6 +270,7 @@ static void __thiscall ITextHostImpl_TxScrollWindowEx(ITextHost *iface, INT dx,
|
|||
ITextHostTestImpl *This = impl_from_ITextHost(iface);
|
||||
TRACECALL("Call to TxScrollWindowEx(%p, %d, %d, %p, %p, %p, %p, %d)\n",
|
||||
This, dx, dy, lprcScroll, lprcClip, hRgnUpdate, lprcUpdate, fuScroll);
|
||||
INCREASE_CALL_COUNTER(ITextHostImpl_TxScrollWindowEx);
|
||||
}
|
||||
|
||||
static void __thiscall ITextHostImpl_TxSetCapture(ITextHost *iface, BOOL fCapture)
|
||||
|
@ -289,7 +316,7 @@ static HRESULT __thiscall ITextHostImpl_TxActivate(ITextHost *iface, LONG *plOld
|
|||
static HRESULT __thiscall ITextHostImpl_TxDeactivate(ITextHost *iface, LONG lNewState)
|
||||
{
|
||||
ITextHostTestImpl *This = impl_from_ITextHost(iface);
|
||||
TRACECALL("Call to TxDeactivate(%p, lNewState=%d)\n", This, lNewState);
|
||||
TRACECALL("Call to TxDeactivate(%p, lNewState=%ld)\n", This, lNewState);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -297,6 +324,7 @@ static HRESULT __thiscall ITextHostImpl_TxGetClientRect(ITextHost *iface, LPRECT
|
|||
{
|
||||
ITextHostTestImpl *This = impl_from_ITextHost(iface);
|
||||
TRACECALL("Call to TxGetClientRect(%p, prc=%p)\n", This, prc);
|
||||
INCREASE_CALL_COUNTER(ITextHostImpl_TxGetClientRect);
|
||||
*prc = This->client_rect;
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -392,7 +420,7 @@ static HRESULT __thiscall ITextHostImpl_OnTxParaFormatChange(ITextHost *iface, c
|
|||
static HRESULT __thiscall ITextHostImpl_TxGetPropertyBits(ITextHost *iface, DWORD dwMask, DWORD *pdwBits)
|
||||
{
|
||||
ITextHostTestImpl *This = impl_from_ITextHost(iface);
|
||||
TRACECALL("Call to TxGetPropertyBits(%p, dwMask=0x%08x, pdwBits=%p)\n",
|
||||
TRACECALL("Call to TxGetPropertyBits(%p, dwMask=0x%08lx, pdwBits=%p)\n",
|
||||
This, dwMask, pdwBits);
|
||||
*pdwBits = This->props & dwMask;
|
||||
return S_OK;
|
||||
|
@ -400,10 +428,12 @@ static HRESULT __thiscall ITextHostImpl_TxGetPropertyBits(ITextHost *iface, DWOR
|
|||
|
||||
static int en_vscroll_sent;
|
||||
static int en_update_sent;
|
||||
static int en_change_sent;
|
||||
static int en_selchange_sent;
|
||||
static HRESULT __thiscall ITextHostImpl_TxNotify( ITextHost *iface, DWORD code, void *data )
|
||||
{
|
||||
ITextHostTestImpl *This = impl_from_ITextHost(iface);
|
||||
TRACECALL( "Call to TxNotify(%p, code = %#x, data = %p)\n", This, code, data );
|
||||
TRACECALL( "Call to TxNotify(%p, code = %#lx, data = %p)\n", This, code, data );
|
||||
switch (code)
|
||||
{
|
||||
case EN_VSCROLL:
|
||||
|
@ -414,6 +444,15 @@ static HRESULT __thiscall ITextHostImpl_TxNotify( ITextHost *iface, DWORD code,
|
|||
en_update_sent++;
|
||||
ok( !data, "got %p\n", data );
|
||||
break;
|
||||
case EN_CHANGE:
|
||||
en_change_sent++;
|
||||
todo_wine
|
||||
ok( data != NULL, "got %p\n", data );
|
||||
break;
|
||||
case EN_SELCHANGE:
|
||||
en_selchange_sent++;
|
||||
ok( data != NULL, "got %p\n", data );
|
||||
break;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -620,7 +659,7 @@ static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
|
|||
memset(&dummyTextHost->char_format, 0, sizeof(dummyTextHost->char_format));
|
||||
dummyTextHost->char_format.cbSize = sizeof(dummyTextHost->char_format);
|
||||
dummyTextHost->char_format.dwMask = CFM_ALL2;
|
||||
dummyTextHost->scrollbars = 0;
|
||||
dummyTextHost->scrollbars = ES_AUTOVSCROLL;
|
||||
dummyTextHost->props = 0;
|
||||
hf = GetStockObject(DEFAULT_GUI_FONT);
|
||||
hf_to_cf(hf, &dummyTextHost->char_format);
|
||||
|
@ -629,8 +668,8 @@ static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
|
|||
CreateTextServices which is then queried to obtain a
|
||||
ITextServices object. */
|
||||
result = pCreateTextServices(NULL, &dummyTextHost->ITextHost_iface, &init);
|
||||
ok(result == S_OK, "Did not return S_OK when created (result = %x)\n", result);
|
||||
ok(dummyTextHost->refCount == 1, "host ref %d\n", dummyTextHost->refCount);
|
||||
ok(result == S_OK, "Did not return S_OK when created (result = %lx)\n", result);
|
||||
ok(dummyTextHost->refCount == 1, "host ref %ld\n", dummyTextHost->refCount);
|
||||
if (result != S_OK) {
|
||||
CoTaskMemFree(dummyTextHost);
|
||||
win_skip("CreateTextServices failed.\n");
|
||||
|
@ -638,7 +677,7 @@ static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
|
|||
}
|
||||
|
||||
result = IUnknown_QueryInterface(init, pIID_ITextServices, (void**)txtserv);
|
||||
ok((result == S_OK) && (*txtserv != NULL), "Querying interface failed (result = %x, txtserv = %p)\n", result, *txtserv);
|
||||
ok((result == S_OK) && (*txtserv != NULL), "Querying interface failed (result = %lx, txtserv = %p)\n", result, *txtserv);
|
||||
IUnknown_Release(init);
|
||||
if (!((result == S_OK) && (*txtserv != NULL))) {
|
||||
CoTaskMemFree(dummyTextHost);
|
||||
|
@ -682,21 +721,21 @@ static void test_TxGetText(void)
|
|||
return;
|
||||
|
||||
hres = ITextServices_TxGetText(txtserv, &rettext);
|
||||
ok(hres == S_OK, "ITextServices_TxGetText failed (result = %x)\n", hres);
|
||||
ok(hres == S_OK, "ITextServices_TxGetText failed (result = %lx)\n", hres);
|
||||
SysFreeString(rettext);
|
||||
|
||||
hres = ITextServices_TxSetText(txtserv, L"abcdefg");
|
||||
ok(hres == S_OK, "Got hres: %#x.\n", hres);
|
||||
ok(hres == S_OK, "Got hres: %#lx.\n", hres);
|
||||
hres = ITextServices_QueryInterface(txtserv, &IID_IRichEditOle, (void **)&reole);
|
||||
ok(hres == S_OK, "Got hres: %#x.\n", hres);
|
||||
ok(hres == S_OK, "Got hres: %#lx.\n", hres);
|
||||
hres = IRichEditOle_GetClientSite(reole, &clientsite);
|
||||
ok(hres == S_OK, "Got hres: %#x.\n", hres);
|
||||
ok(hres == S_OK, "Got hres: %#lx.\n", hres);
|
||||
expected_string = L"abc\xfffc""defg";
|
||||
fill_reobject_struct(&reobject, 3, NULL, NULL, clientsite, 10, 10, DVASPECT_CONTENT, 0, 1);
|
||||
hres = IRichEditOle_InsertObject(reole, &reobject);
|
||||
ok(hres == S_OK, "Got hres: %#x.\n", hres);
|
||||
ok(hres == S_OK, "Got hres: %#lx.\n", hres);
|
||||
hres = ITextServices_TxGetText(txtserv, &rettext);
|
||||
ok(hres == S_OK, "Got hres: %#x.\n", hres);
|
||||
ok(hres == S_OK, "Got hres: %#lx.\n", hres);
|
||||
ok(lstrlenW(rettext) == lstrlenW(expected_string), "Got wrong length: %d.\n", lstrlenW(rettext));
|
||||
todo_wine ok(!lstrcmpW(rettext, expected_string), "Got wrong content: %s.\n", debugstr_w(rettext));
|
||||
SysFreeString(rettext);
|
||||
|
@ -719,10 +758,10 @@ static void test_TxSetText(void)
|
|||
return;
|
||||
|
||||
hres = ITextServices_TxSetText(txtserv, settext);
|
||||
ok(hres == S_OK, "ITextServices_TxSetText failed (result = %x)\n", hres);
|
||||
ok(hres == S_OK, "ITextServices_TxSetText failed (result = %lx)\n", hres);
|
||||
|
||||
hres = ITextServices_TxGetText(txtserv, &rettext);
|
||||
ok(hres == S_OK, "ITextServices_TxGetText failed (result = %x)\n", hres);
|
||||
ok(hres == S_OK, "ITextServices_TxGetText failed (result = %lx)\n", hres);
|
||||
|
||||
ok(SysStringLen(rettext) == 4,
|
||||
"String returned of wrong length (expected 4, got %d)\n", SysStringLen(rettext));
|
||||
|
@ -734,10 +773,10 @@ static void test_TxSetText(void)
|
|||
/* Null-pointer should behave the same as empty-string */
|
||||
|
||||
hres = ITextServices_TxSetText(txtserv, 0);
|
||||
ok(hres == S_OK, "ITextServices_TxSetText failed (result = %x)\n", hres);
|
||||
ok(hres == S_OK, "ITextServices_TxSetText failed (result = %lx)\n", hres);
|
||||
|
||||
hres = ITextServices_TxGetText(txtserv, &rettext);
|
||||
ok(hres == S_OK, "ITextServices_TxGetText failed (result = %x)\n", hres);
|
||||
ok(hres == S_OK, "ITextServices_TxGetText failed (result = %lx)\n", hres);
|
||||
ok(SysStringLen(rettext) == 0,
|
||||
"String returned of wrong length (expected 0, got %d)\n", SysStringLen(rettext));
|
||||
|
||||
|
@ -753,13 +792,13 @@ static void _check_txgetnaturalsize(HRESULT res, LONG width, LONG height, HDC hd
|
|||
RECT expected_rect = rect;
|
||||
LONG expected_width, expected_height;
|
||||
|
||||
DrawTextW(hdc, string, -1, &expected_rect, DT_LEFT | DT_CALCRECT | DT_NOCLIP | DT_EDITCONTROL | DT_WORDBREAK);
|
||||
DrawTextW(hdc, string, -1, &expected_rect, DT_LEFT | DT_CALCRECT | DT_NOCLIP | DT_EDITCONTROL);
|
||||
expected_width = expected_rect.right - expected_rect.left;
|
||||
expected_height = expected_rect.bottom - expected_rect.top;
|
||||
ok_(__FILE__,line)(res == S_OK, "ITextServices_TxGetNaturalSize failed: 0x%08x.\n", res);
|
||||
ok_(__FILE__,line)(res == S_OK, "ITextServices_TxGetNaturalSize failed: 0x%08lx.\n", res);
|
||||
todo_wine ok_(__FILE__,line)(width >= expected_width && width <= expected_width + 1,
|
||||
"got wrong width: %d, expected: %d {+1}.\n", width, expected_width);
|
||||
ok_(__FILE__,line)(height == expected_height, "got wrong height: %d, expected: %d.\n",
|
||||
"got wrong width: %ld, expected: %ld {+1}.\n", width, expected_width);
|
||||
ok_(__FILE__,line)(height == expected_height, "got wrong height: %ld, expected: %ld.\n",
|
||||
height, expected_height);
|
||||
}
|
||||
|
||||
|
@ -793,11 +832,11 @@ static void test_TxGetNaturalSize(void)
|
|||
hf = GetStockObject(DEFAULT_GUI_FONT);
|
||||
hf_to_cf(hf, &cf);
|
||||
result = ITextServices_TxSendMessage(txtserv, EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf, &lresult);
|
||||
ok(result == S_OK, "ITextServices_TxSendMessage failed: 0x%08x.\n", result);
|
||||
ok(result == S_OK, "ITextServices_TxSendMessage failed: 0x%08lx.\n", result);
|
||||
SelectObject(hdcDraw, hf);
|
||||
|
||||
result = ITextServices_TxSetText(txtserv, test_text);
|
||||
ok(result == S_OK, "ITextServices_TxSetText failed: 0x%08x.\n", result);
|
||||
ok(result == S_OK, "ITextServices_TxSetText failed: 0x%08lx.\n", result);
|
||||
|
||||
extent.cx = -1; extent.cy = -1;
|
||||
width = rect.right - rect.left;
|
||||
|
@ -815,15 +854,20 @@ static void test_TxGetNaturalSize(void)
|
|||
static void test_TxDraw(void)
|
||||
{
|
||||
ITextServices *txtserv;
|
||||
ITextDocument *txtdoc;
|
||||
ITextHost *host;
|
||||
HRESULT hr;
|
||||
RECT client = {0, 0, 100, 100};
|
||||
ITextHostTestImpl *host_impl;
|
||||
LONG freeze_count;
|
||||
HDC hdc;
|
||||
|
||||
if (!init_texthost(&txtserv, &host))
|
||||
return;
|
||||
|
||||
hr = ITextServices_QueryInterface( txtserv, &IID_ITextDocument, (void **)&txtdoc );
|
||||
ok( hr == S_OK, "ITextServices_QueryInterface (ITextDocument) returned %#lx\n", hr );
|
||||
|
||||
host_impl = impl_from_ITextHost( host );
|
||||
host_impl->window = CreateWindowExA( 0, "static", NULL, WS_POPUP | WS_VISIBLE,
|
||||
0, 0, 400, 400, 0, 0, 0, NULL );
|
||||
|
@ -835,30 +879,48 @@ static void test_TxDraw(void)
|
|||
|
||||
hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, 0, TXTVIEW_INACTIVE );
|
||||
ok( hr == E_INVALIDARG, "got %08x\n", hr );
|
||||
ok( hr == E_INVALIDARG, "got %08lx\n", hr );
|
||||
hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, NULL, NULL,
|
||||
NULL, NULL, 0, TXTVIEW_INACTIVE );
|
||||
ok( hr == E_INVALIDARG, "got %08x\n", hr );
|
||||
ok( hr == E_INVALIDARG, "got %08lx\n", hr );
|
||||
hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, NULL, NULL, (RECTL *)&client, NULL,
|
||||
NULL, NULL, 0, TXTVIEW_INACTIVE );
|
||||
ok( hr == E_FAIL, "got %08x\n", hr );
|
||||
ok( hr == E_FAIL, "got %08lx\n", hr );
|
||||
hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, (RECTL *)&client, NULL,
|
||||
NULL, NULL, 0, TXTVIEW_INACTIVE );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, (RECTL *)&client, NULL,
|
||||
NULL, NULL, 0, TXTVIEW_ACTIVE );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
|
||||
hr = ITextServices_OnTxInPlaceActivate( txtserv, &client );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
|
||||
hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, 0, TXTVIEW_INACTIVE );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
|
||||
freeze_count = 0xdeadbeef;
|
||||
hr = ITextDocument_Freeze( txtdoc, &freeze_count );
|
||||
ok( hr == S_OK, "ITextDocument_Freeze returned %#lx\n", hr );
|
||||
ok( freeze_count == 1, "expected count to be %d, got %ld\n", 1, freeze_count );
|
||||
|
||||
hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, (RECTL *)&client, NULL,
|
||||
NULL, NULL, 0, TXTVIEW_INACTIVE );
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, (RECTL *)&client, NULL,
|
||||
NULL, NULL, 0, TXTVIEW_ACTIVE );
|
||||
ok( hr == E_UNEXPECTED, "got %08lx\n", hr );
|
||||
|
||||
freeze_count = 0xdeadbeef;
|
||||
hr = ITextDocument_Unfreeze( txtdoc, &freeze_count );
|
||||
ok( hr == S_OK, "ITextDocument_Unfreeze returned %#lx\n", hr );
|
||||
ok( freeze_count == 0, "expected count to be %d, got %ld\n", 0, freeze_count );
|
||||
|
||||
hr = ITextServices_OnTxInPlaceDeactivate( txtserv );
|
||||
|
||||
ReleaseDC( host_impl->window, hdc );
|
||||
ITextDocument_Release(txtdoc);
|
||||
ITextServices_Release(txtserv);
|
||||
DestroyWindow( host_impl->window );
|
||||
ITextHost_Release(host);
|
||||
|
@ -929,15 +991,15 @@ static void test_COM(void)
|
|||
/* COM aggregation */
|
||||
hr = pCreateTextServices(&unk_obj.IUnknown_iface, &texthost.ITextHost_iface,
|
||||
&unk_obj.inner_unk);
|
||||
ok(hr == S_OK, "CreateTextServices failed: %08x\n", hr);
|
||||
ok(hr == S_OK, "CreateTextServices failed: %08lx\n", hr);
|
||||
hr = IUnknown_QueryInterface(unk_obj.inner_unk, pIID_ITextServices, (void**)&textsrv);
|
||||
ok(hr == S_OK, "QueryInterface for IID_ITextServices failed: %08x\n", hr);
|
||||
ok(hr == S_OK, "QueryInterface for IID_ITextServices failed: %08lx\n", hr);
|
||||
refcount = ITextServices_AddRef(textsrv);
|
||||
ok(refcount == unk_obj.ref, "CreateTextServices just pretends to support COM aggregation\n");
|
||||
refcount = ITextServices_Release(textsrv);
|
||||
ok(refcount == unk_obj.ref, "CreateTextServices just pretends to support COM aggregation\n");
|
||||
refcount = ITextServices_Release(textsrv);
|
||||
ok(refcount == 19, "Refcount should be back at 19 but is %u\n", refcount);
|
||||
ok(refcount == 19, "Refcount should be back at 19 but is %lu\n", refcount);
|
||||
|
||||
IUnknown_Release(unk_obj.inner_unk);
|
||||
}
|
||||
|
@ -963,92 +1025,92 @@ static void test_QueryInterface(void)
|
|||
return;
|
||||
|
||||
refcount = get_refcount((IUnknown *)txtserv);
|
||||
ok(refcount == 1, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 1, "got wrong ref count: %ld\n", refcount);
|
||||
|
||||
/* IID_IRichEditOle */
|
||||
hres = ITextServices_QueryInterface(txtserv, &IID_IRichEditOle, (void **)&txtsrv_reole);
|
||||
ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08lx\n", hres);
|
||||
refcount = get_refcount((IUnknown *)txtserv);
|
||||
ok(refcount == 2, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
|
||||
refcount = get_refcount((IUnknown *)txtsrv_reole);
|
||||
ok(refcount == 2, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
|
||||
|
||||
hres = ITextServices_QueryInterface( txtserv, &IID_IUnknown, (void **)&unk );
|
||||
ok( hres == S_OK, "got 0x%08x\n", hres );
|
||||
ok( hres == S_OK, "got 0x%08lx\n", hres );
|
||||
hres = IRichEditOle_QueryInterface( txtsrv_reole, &IID_IUnknown, (void **)&unk2 );
|
||||
ok( hres == S_OK, "got 0x%08x\n", hres );
|
||||
ok( hres == S_OK, "got 0x%08lx\n", hres );
|
||||
ok( unk == unk2, "unknowns differ\n" );
|
||||
IUnknown_Release( unk2 );
|
||||
IUnknown_Release( unk );
|
||||
|
||||
hres = IRichEditOle_QueryInterface(txtsrv_reole, &IID_ITextDocument, (void **)&txtdoc);
|
||||
ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08lx\n", hres);
|
||||
refcount = get_refcount((IUnknown *)txtserv);
|
||||
ok(refcount == 3, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
|
||||
refcount = get_refcount((IUnknown *)txtsrv_reole);
|
||||
ok(refcount == 3, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
|
||||
|
||||
ITextDocument_Release(txtdoc);
|
||||
refcount = get_refcount((IUnknown *)txtserv);
|
||||
ok(refcount == 2, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
|
||||
|
||||
hres = IRichEditOle_QueryInterface(txtsrv_reole, &IID_ITextDocument2Old, (void **)&txtdoc2old);
|
||||
ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08lx\n", hres);
|
||||
refcount = get_refcount((IUnknown *)txtserv);
|
||||
ok(refcount == 3, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
|
||||
refcount = get_refcount((IUnknown *)txtsrv_reole);
|
||||
ok(refcount == 3, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
|
||||
|
||||
ITextDocument2Old_Release(txtdoc2old);
|
||||
refcount = get_refcount((IUnknown *)txtserv);
|
||||
ok(refcount == 2, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
|
||||
IRichEditOle_Release(txtsrv_reole);
|
||||
refcount = get_refcount((IUnknown *)txtserv);
|
||||
ok(refcount == 1, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 1, "got wrong ref count: %ld\n", refcount);
|
||||
|
||||
/* IID_ITextDocument */
|
||||
hres = ITextServices_QueryInterface(txtserv, &IID_ITextDocument, (void **)&txtsrv_txtdoc);
|
||||
ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08lx\n", hres);
|
||||
refcount = get_refcount((IUnknown *)txtserv);
|
||||
ok(refcount == 2, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
|
||||
refcount = get_refcount((IUnknown *)txtsrv_txtdoc);
|
||||
ok(refcount == 2, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
|
||||
|
||||
hres = ITextDocument_QueryInterface(txtsrv_txtdoc, &IID_IRichEditOle, (void **)&reole);
|
||||
ok(hres == S_OK, "ITextDocument_QueryInterface: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "ITextDocument_QueryInterface: 0x%08lx\n", hres);
|
||||
refcount = get_refcount((IUnknown *)txtserv);
|
||||
ok(refcount == 3, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
|
||||
refcount = get_refcount((IUnknown *)txtsrv_txtdoc);
|
||||
ok(refcount == 3, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
|
||||
|
||||
IRichEditOle_Release(reole);
|
||||
refcount = get_refcount((IUnknown *)txtserv);
|
||||
ok(refcount == 2, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
|
||||
ITextDocument_Release(txtsrv_txtdoc);
|
||||
refcount = get_refcount((IUnknown *)txtserv);
|
||||
ok(refcount == 1, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 1, "got wrong ref count: %ld\n", refcount);
|
||||
|
||||
/* ITextDocument2Old */
|
||||
hres = ITextServices_QueryInterface(txtserv, &IID_ITextDocument2Old, (void **)&txtsrv_txtdoc2old);
|
||||
ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08lx\n", hres);
|
||||
refcount = get_refcount((IUnknown *)txtserv);
|
||||
ok(refcount == 2, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
|
||||
refcount = get_refcount((IUnknown *)txtsrv_txtdoc2old);
|
||||
ok(refcount == 2, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
|
||||
|
||||
hres = ITextDocument2Old_QueryInterface(txtsrv_txtdoc2old, &IID_IRichEditOle, (void **)&reole);
|
||||
ok(hres == S_OK, "ITextDocument2Old_QueryInterface: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "ITextDocument2Old_QueryInterface: 0x%08lx\n", hres);
|
||||
refcount = get_refcount((IUnknown *)txtserv);
|
||||
ok(refcount == 3, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
|
||||
refcount = get_refcount((IUnknown *)txtsrv_txtdoc2old);
|
||||
ok(refcount == 3, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
|
||||
|
||||
IRichEditOle_Release(reole);
|
||||
refcount = get_refcount((IUnknown *)txtserv);
|
||||
ok(refcount == 2, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
|
||||
ITextDocument2Old_Release(txtsrv_txtdoc2old);
|
||||
refcount = get_refcount((IUnknown *)txtserv);
|
||||
ok(refcount == 1, "got wrong ref count: %d\n", refcount);
|
||||
ok(refcount == 1, "got wrong ref count: %ld\n", refcount);
|
||||
|
||||
ITextServices_Release(txtserv);
|
||||
ITextHost_Release(host);
|
||||
|
@ -1069,13 +1131,13 @@ static void test_default_format(void)
|
|||
|
||||
cf2.cbSize = sizeof(CHARFORMAT2W);
|
||||
result = ITextServices_TxSendMessage(txtserv, EM_GETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf2, &lresult);
|
||||
ok(result == S_OK, "ITextServices_TxSendMessage failed: 0x%08x.\n", result);
|
||||
ok(result == S_OK, "ITextServices_TxSendMessage failed: 0x%08lx.\n", result);
|
||||
|
||||
ITextHostImpl_TxGetCharFormat(host, &host_cf);
|
||||
ok(!lstrcmpW(host_cf->szFaceName, cf2.szFaceName), "got wrong font name: %s.\n", wine_dbgstr_w(cf2.szFaceName));
|
||||
ok(cf2.yHeight == host_cf->yHeight, "got wrong yHeight: %d, expected %d.\n", cf2.yHeight, host_cf->yHeight);
|
||||
ok(cf2.yHeight == host_cf->yHeight, "got wrong yHeight: %ld, expected %ld.\n", cf2.yHeight, host_cf->yHeight);
|
||||
expected_effects = (cf2.dwEffects & ~(CFE_AUTOCOLOR | CFE_AUTOBACKCOLOR));
|
||||
ok(host_cf->dwEffects == expected_effects, "got wrong dwEffects: %x, expected %x.\n", cf2.dwEffects, expected_effects);
|
||||
ok(host_cf->dwEffects == expected_effects, "got wrong dwEffects: %lx, expected %lx.\n", cf2.dwEffects, expected_effects);
|
||||
ok(cf2.bPitchAndFamily == host_cf->bPitchAndFamily, "got wrong bPitchAndFamily: %x, expected %x.\n",
|
||||
cf2.bPitchAndFamily, host_cf->bPitchAndFamily);
|
||||
ok(cf2.bCharSet == host_cf->bCharSet, "got wrong bCharSet: %x, expected %x.\n", cf2.bCharSet, host_cf->bCharSet);
|
||||
|
@ -1100,17 +1162,17 @@ static void test_TxGetScroll(void)
|
|||
host_impl = impl_from_ITextHost( host );
|
||||
|
||||
ret = ITextServices_TxGetHScroll(txtserv, NULL, NULL, NULL, NULL, NULL);
|
||||
ok(ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08x.\n", ret);
|
||||
ok(ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08lx.\n", ret);
|
||||
|
||||
ret = ITextServices_TxGetVScroll(txtserv, NULL, NULL, NULL, NULL, NULL);
|
||||
ok(ret == S_OK, "ITextServices_TxGetVScroll failed: 0x%08x.\n", ret);
|
||||
ok(ret == S_OK, "ITextServices_TxGetVScroll failed: 0x%08lx.\n", ret);
|
||||
|
||||
ret = ITextServices_TxGetVScroll( txtserv, &min_pos, &max_pos, &pos, &page, &enabled );
|
||||
ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08x.\n", ret );
|
||||
ok( min_pos == 0, "got %d\n", min_pos );
|
||||
ok( max_pos == 0, "got %d\n", max_pos );
|
||||
ok( pos == 0, "got %d\n", pos );
|
||||
ok( page == 0, "got %d\n", page );
|
||||
ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08lx.\n", ret );
|
||||
ok( min_pos == 0, "got %ld\n", min_pos );
|
||||
ok( max_pos == 0, "got %ld\n", max_pos );
|
||||
ok( pos == 0, "got %ld\n", pos );
|
||||
ok( page == 0, "got %ld\n", page );
|
||||
ok( !enabled, "got %d\n", enabled );
|
||||
|
||||
host_impl->scrollbars = WS_VSCROLL;
|
||||
|
@ -1121,26 +1183,26 @@ static void test_TxGetScroll(void)
|
|||
0, 0, 400, 400, 0, 0, 0, NULL );
|
||||
host_impl->client_rect = client;
|
||||
ret = ITextServices_OnTxInPlaceActivate( txtserv, &client );
|
||||
ok( ret == S_OK, "got 0x%08x.\n", ret );
|
||||
ok( ret == S_OK, "got 0x%08lx.\n", ret );
|
||||
|
||||
ret = ITextServices_TxGetVScroll( txtserv, &min_pos, &max_pos, &pos, &page, &enabled );
|
||||
ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08x.\n", ret );
|
||||
ok( min_pos == 0, "got %d\n", min_pos );
|
||||
ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08lx.\n", ret );
|
||||
ok( min_pos == 0, "got %ld\n", min_pos );
|
||||
todo_wine
|
||||
ok( max_pos == 0, "got %d\n", max_pos );
|
||||
ok( pos == 0, "got %d\n", pos );
|
||||
ok( page == client.bottom, "got %d\n", page );
|
||||
ok( max_pos == 0, "got %ld\n", max_pos );
|
||||
ok( pos == 0, "got %ld\n", pos );
|
||||
ok( page == client.bottom, "got %ld\n", page );
|
||||
ok( !enabled, "got %d\n", enabled );
|
||||
|
||||
ret = ITextServices_TxSetText( txtserv, lorem );
|
||||
ok( ret == S_OK, "got 0x%08x.\n", ret );
|
||||
ok( ret == S_OK, "got 0x%08lx.\n", ret );
|
||||
|
||||
ret = ITextServices_TxGetVScroll( txtserv, &min_pos, &max_pos, &pos, &page, &enabled );
|
||||
ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08x.\n", ret );
|
||||
ok( min_pos == 0, "got %d\n", min_pos );
|
||||
ok( max_pos > client.bottom, "got %d\n", max_pos );
|
||||
ok( pos == 0, "got %d\n", pos );
|
||||
ok( page == client.bottom, "got %d\n", page );
|
||||
ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08lx.\n", ret );
|
||||
ok( min_pos == 0, "got %ld\n", min_pos );
|
||||
ok( max_pos > client.bottom, "got %ld\n", max_pos );
|
||||
ok( pos == 0, "got %ld\n", pos );
|
||||
ok( page == client.bottom, "got %ld\n", page );
|
||||
ok( enabled, "got %d\n", enabled );
|
||||
|
||||
host_impl->scrollbars = WS_VSCROLL | ES_DISABLENOSCROLL;
|
||||
|
@ -1148,12 +1210,12 @@ todo_wine
|
|||
ITextServices_TxSetText( txtserv, L"short" );
|
||||
|
||||
ret = ITextServices_TxGetVScroll( txtserv, &min_pos, &max_pos, &pos, &page, &enabled );
|
||||
ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08x.\n", ret );
|
||||
ok( min_pos == 0, "got %d\n", min_pos );
|
||||
ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08lx.\n", ret );
|
||||
ok( min_pos == 0, "got %ld\n", min_pos );
|
||||
todo_wine
|
||||
ok( max_pos == 0, "got %d\n", max_pos );
|
||||
ok( pos == 0, "got %d\n", pos );
|
||||
ok( page == client.bottom, "got %d\n", page );
|
||||
ok( max_pos == 0, "got %ld\n", max_pos );
|
||||
ok( pos == 0, "got %ld\n", pos );
|
||||
ok( page == client.bottom, "got %ld\n", page );
|
||||
ok( !enabled, "got %d\n", enabled );
|
||||
|
||||
DestroyWindow( host_impl->window );
|
||||
|
@ -1183,33 +1245,33 @@ static void test_notifications( void )
|
|||
0, 0, 400, 400, 0, 0, 0, NULL );
|
||||
host_impl->client_rect = client;
|
||||
hr = ITextServices_OnTxInPlaceActivate( txtserv, &client );
|
||||
ok( hr == S_OK, "got 0x%08x.\n", hr );
|
||||
ok( hr == S_OK, "got 0x%08lx.\n", hr );
|
||||
|
||||
hr = ITextServices_TxSendMessage( txtserv, EM_SETEVENTMASK, 0, ENM_SCROLL, &res );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
|
||||
/* check EN_VSCROLL notification is sent */
|
||||
en_vscroll_sent = 0;
|
||||
hr = ITextServices_TxSendMessage( txtserv, WM_VSCROLL, SB_LINEDOWN, 0, &res );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
ok( en_vscroll_sent == 1, "got %d\n", en_vscroll_sent );
|
||||
|
||||
hr = ITextServices_TxSendMessage( txtserv, WM_VSCROLL, SB_BOTTOM, 0, &res );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
ok( en_vscroll_sent == 2, "got %d\n", en_vscroll_sent );
|
||||
|
||||
/* but not when the thumb is moved */
|
||||
hr = ITextServices_TxSendMessage( txtserv, WM_VSCROLL, MAKEWPARAM( SB_THUMBTRACK, 0 ), 0, &res );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
hr = ITextServices_TxSendMessage( txtserv, WM_VSCROLL, MAKEWPARAM( SB_THUMBPOSITION, 0 ), 0, &res );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
ok( en_vscroll_sent == 2, "got %d\n", en_vscroll_sent );
|
||||
|
||||
/* EN_UPDATE is sent by TxDraw() */
|
||||
en_update_sent = 0;
|
||||
hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, 0, TXTVIEW_ACTIVE );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
ok( en_update_sent == 1, "got %d\n", en_update_sent );
|
||||
|
||||
DestroyWindow( host_impl->window );
|
||||
|
@ -1217,6 +1279,181 @@ static void test_notifications( void )
|
|||
ITextHost_Release( host );
|
||||
}
|
||||
|
||||
static void test_set_selection_message( void )
|
||||
{
|
||||
ITextServices *txtserv;
|
||||
ITextHost *host;
|
||||
CHARRANGE range;
|
||||
LRESULT result;
|
||||
HRESULT hr;
|
||||
|
||||
if (!init_texthost(&txtserv, &host))
|
||||
return;
|
||||
|
||||
ITextServices_TxSetText(txtserv, L"");
|
||||
|
||||
if (winetest_debug > 1) trace("TxSendMessage EM_SETEVENTMASK");
|
||||
|
||||
hr = ITextServices_TxSendMessage( txtserv, EM_SETEVENTMASK, 0, ENM_CHANGE | ENM_SELCHANGE, &result );
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
|
||||
if (winetest_debug > 1) trace("TxSendMessage EM_SETSEL 0 20");
|
||||
|
||||
CLEAR_COUNTER(ITextHostImpl_TxViewChange);
|
||||
en_change_sent = 0;
|
||||
en_selchange_sent = 0;
|
||||
|
||||
hr = ITextServices_TxSendMessage(txtserv, EM_SETSEL, 0, 20, &result);
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
|
||||
CHECK_CALLED(ITextHostImpl_TxViewChange);
|
||||
ok(en_change_sent == 0, "got %d\n", en_change_sent);
|
||||
todo_wine
|
||||
ok(en_selchange_sent == 0, "got %d\n", en_selchange_sent);
|
||||
|
||||
hr = ITextServices_TxSendMessage(txtserv, EM_EXGETSEL, 0, (LPARAM)&range, &result); ok( hr == S_OK, "got %08lx\n", hr ); trace("getsel: %lu, %lu\n", range.cpMin, range.cpMax);
|
||||
|
||||
if (winetest_debug > 1) trace("TxSendMessage EM_SETSELEX 0 20");
|
||||
|
||||
CLEAR_COUNTER(ITextHostImpl_TxViewChange);
|
||||
en_change_sent = 0;
|
||||
en_selchange_sent = 0;
|
||||
|
||||
range.cpMin = 0;
|
||||
range.cpMax = 20;
|
||||
hr = ITextServices_TxSendMessage(txtserv, EM_EXSETSEL, 0, (LPARAM)&range, &result);
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
|
||||
CHECK_CALLED(ITextHostImpl_TxViewChange);
|
||||
ok(en_change_sent == 0, "got %d\n", en_change_sent);
|
||||
ok(en_selchange_sent == 0, "got %d\n", en_selchange_sent);
|
||||
|
||||
if (winetest_debug > 1) trace("TxSetText");
|
||||
|
||||
CLEAR_COUNTER(ITextHostImpl_TxViewChange);
|
||||
en_change_sent = 0;
|
||||
en_selchange_sent = 0;
|
||||
|
||||
hr = ITextServices_TxSendMessage(txtserv, EM_EXGETSEL, 0, (LPARAM)&range, &result); ok( hr == S_OK, "got %08lx\n", hr ); trace("getsel: %lu, %lu\n", range.cpMin, range.cpMax);
|
||||
|
||||
ITextServices_TxSetText(txtserv, lorem);
|
||||
|
||||
hr = ITextServices_TxSendMessage(txtserv, EM_EXGETSEL, 0, (LPARAM)&range, &result); ok( hr == S_OK, "got %08lx\n", hr ); trace("getsel: %lu, %lu\n", range.cpMin, range.cpMax);
|
||||
|
||||
CHECK_CALLED(ITextHostImpl_TxViewChange);
|
||||
ok(en_change_sent == 1, "got %d\n", en_change_sent);
|
||||
todo_wine
|
||||
ok(en_selchange_sent == 0, "got %d\n", en_selchange_sent);
|
||||
|
||||
if (winetest_debug > 1) trace("TxSendMessage EM_SETSEL 0 20");
|
||||
|
||||
CLEAR_COUNTER(ITextHostImpl_TxViewChange);
|
||||
en_change_sent = 0;
|
||||
en_selchange_sent = 0;
|
||||
|
||||
hr = ITextServices_TxSendMessage(txtserv, EM_SETSEL, 0, 20, &result);
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
|
||||
CHECK_CALLED(ITextHostImpl_TxViewChange);
|
||||
ok(en_change_sent == 0, "got %d\n", en_change_sent);
|
||||
ok(en_selchange_sent == 1, "got %d\n", en_selchange_sent);
|
||||
|
||||
hr = ITextServices_TxSendMessage(txtserv, EM_EXGETSEL, 0, (LPARAM)&range, &result); ok( hr == S_OK, "got %08lx\n", hr ); trace("getsel: %lu, %lu\n", range.cpMin, range.cpMax);
|
||||
|
||||
if (winetest_debug > 1) trace("TxSendMessage EM_SETSELEX 0 20");
|
||||
|
||||
CLEAR_COUNTER(ITextHostImpl_TxViewChange);
|
||||
en_change_sent = 0;
|
||||
en_selchange_sent = 0;
|
||||
|
||||
range.cpMin = 0;
|
||||
range.cpMax = 20;
|
||||
hr = ITextServices_TxSendMessage(txtserv, EM_EXSETSEL, 0, (LPARAM)&range, &result);
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
|
||||
CHECK_CALLED(ITextHostImpl_TxViewChange);
|
||||
ok(en_change_sent == 0, "got %d\n", en_change_sent);
|
||||
ok(en_selchange_sent == 0, "got %d\n", en_selchange_sent);
|
||||
|
||||
hr = ITextServices_TxSendMessage(txtserv, EM_EXGETSEL, 0, (LPARAM)&range, &result); ok( hr == S_OK, "got %08lx\n", hr ); trace("getsel: %lu, %lu\n", range.cpMin, range.cpMax);
|
||||
|
||||
if (winetest_debug > 1) trace("release interfaces");
|
||||
|
||||
ITextServices_Release( txtserv );
|
||||
ITextHost_Release( host );
|
||||
}
|
||||
|
||||
static void test_scrollcaret( void )
|
||||
{
|
||||
ITextServices *txtserv;
|
||||
ITextHost *host;
|
||||
LRESULT result;
|
||||
HRESULT hr;
|
||||
|
||||
if (!init_texthost(&txtserv, &host))
|
||||
return;
|
||||
|
||||
hr = ITextServices_TxSendMessage(txtserv, EM_SCROLLCARET, 0, 0, &result);
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
|
||||
ITextServices_Release( txtserv );
|
||||
ITextHost_Release( host );
|
||||
}
|
||||
|
||||
static void test_inplace_active( BOOL active )
|
||||
{
|
||||
ITextServices *txtserv;
|
||||
ITextHost *host;
|
||||
LRESULT result;
|
||||
HRESULT hr;
|
||||
|
||||
ITextHostTestImpl *host_impl;
|
||||
if (!init_texthost(&txtserv, &host))
|
||||
return;
|
||||
|
||||
host_impl = impl_from_ITextHost( host );
|
||||
host_impl->window = CreateWindowExA( 0, "static", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 100, 100, 0, 0, 0, NULL );
|
||||
host_impl->client_rect = (RECT) { 0, 0, 150, 150 };
|
||||
host_impl->scrollbars = WS_VSCROLL | ES_AUTOVSCROLL;
|
||||
host_impl->props = TXTBIT_MULTILINE | TXTBIT_RICHTEXT | TXTBIT_WORDWRAP;
|
||||
ITextServices_OnTxPropertyBitsChange( txtserv, TXTBIT_SCROLLBARCHANGE | TXTBIT_MULTILINE | TXTBIT_RICHTEXT | TXTBIT_WORDWRAP, host_impl->props );
|
||||
|
||||
CLEAR_COUNTER(ITextHostImpl_TxScrollWindowEx);
|
||||
CLEAR_COUNTER(ITextHostImpl_TxGetClientRect);
|
||||
|
||||
if (active) {
|
||||
hr = ITextServices_OnTxInPlaceActivate( txtserv, &host_impl->client_rect );
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
}
|
||||
|
||||
hr = ITextServices_TxSendMessage(txtserv, EM_SETEVENTMASK, 0, ENM_REQUESTRESIZE, &result);
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
|
||||
hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, GetDC(host_impl->window), NULL, (RECTL *)&host_impl->client_rect, NULL, NULL, NULL, 0, TXTVIEW_INACTIVE );
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
|
||||
hr = ITextServices_TxSendMessage(txtserv, EM_SETSEL, 0, -1, &result);
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
|
||||
hr = ITextServices_TxSendMessage(txtserv, EM_REPLACESEL, TRUE, (LPARAM) lorem, &result);
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
|
||||
hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, GetDC(host_impl->window), NULL, (RECTL *)&host_impl->client_rect, NULL, NULL, NULL, 0, TXTVIEW_INACTIVE );
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
|
||||
if (active) {
|
||||
CHECK_CALLED(ITextHostImpl_TxScrollWindowEx);
|
||||
CHECK_CALLED(ITextHostImpl_TxGetClientRect);
|
||||
} else {
|
||||
CHECK_NOT_CALLED(ITextHostImpl_TxScrollWindowEx);
|
||||
CHECK_NOT_CALLED(ITextHostImpl_TxGetClientRect);
|
||||
}
|
||||
|
||||
DestroyWindow( host_impl->window );
|
||||
ITextServices_Release( txtserv );
|
||||
ITextHost_Release( host );
|
||||
}
|
||||
|
||||
START_TEST( txtsrv )
|
||||
{
|
||||
ITextServices *txtserv;
|
||||
|
@ -1250,6 +1487,10 @@ START_TEST( txtsrv )
|
|||
test_default_format();
|
||||
test_TxGetScroll();
|
||||
test_notifications();
|
||||
test_set_selection_message();
|
||||
test_scrollcaret();
|
||||
test_inplace_active(TRUE);
|
||||
test_inplace_active(FALSE);
|
||||
}
|
||||
if (wrapperCodeMem) VirtualFree(wrapperCodeMem, 0, MEM_RELEASE);
|
||||
}
|
||||
|
|
|
@ -23,43 +23,37 @@
|
|||
#ifndef __WINE_WINE_RBTREE_H
|
||||
#define __WINE_WINE_RBTREE_H
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define WINE_RB_ENTRY_VALUE(element, type, field) ({ \
|
||||
const typeof(((type *)0)->field) *__ptr = (element); \
|
||||
(type *)((char *)__ptr - offsetof(type, field)); })
|
||||
#else
|
||||
# define WINE_RB_ENTRY_VALUE(element, type, field) \
|
||||
#define RB_ENTRY_VALUE(element, type, field) \
|
||||
((type *)((char *)(element) - offsetof(type, field)))
|
||||
#endif
|
||||
|
||||
struct wine_rb_entry
|
||||
struct rb_entry
|
||||
{
|
||||
struct wine_rb_entry *parent;
|
||||
struct wine_rb_entry *left;
|
||||
struct wine_rb_entry *right;
|
||||
struct rb_entry *parent;
|
||||
struct rb_entry *left;
|
||||
struct rb_entry *right;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
typedef int (*wine_rb_compare_func_t)(const void *key, const struct wine_rb_entry *entry);
|
||||
typedef int (*rb_compare_func_t)(const void *key, const struct rb_entry *entry);
|
||||
|
||||
struct wine_rb_tree
|
||||
struct rb_tree
|
||||
{
|
||||
wine_rb_compare_func_t compare;
|
||||
struct wine_rb_entry *root;
|
||||
rb_compare_func_t compare;
|
||||
struct rb_entry *root;
|
||||
};
|
||||
|
||||
typedef void (wine_rb_traverse_func_t)(struct wine_rb_entry *entry, void *context);
|
||||
typedef void (rb_traverse_func_t)(struct rb_entry *entry, void *context);
|
||||
|
||||
#define WINE_RB_FLAG_RED 0x1
|
||||
#define RB_FLAG_RED 0x1
|
||||
|
||||
static inline int wine_rb_is_red(struct wine_rb_entry *entry)
|
||||
static inline int rb_is_red(struct rb_entry *entry)
|
||||
{
|
||||
return entry && (entry->flags & WINE_RB_FLAG_RED);
|
||||
return entry && (entry->flags & RB_FLAG_RED);
|
||||
}
|
||||
|
||||
static inline void wine_rb_rotate_left(struct wine_rb_tree *tree, struct wine_rb_entry *e)
|
||||
static inline void rb_rotate_left(struct rb_tree *tree, struct rb_entry *e)
|
||||
{
|
||||
struct wine_rb_entry *right = e->right;
|
||||
struct rb_entry *right = e->right;
|
||||
|
||||
if (!e->parent)
|
||||
tree->root = right;
|
||||
|
@ -75,9 +69,9 @@ static inline void wine_rb_rotate_left(struct wine_rb_tree *tree, struct wine_rb
|
|||
e->parent = right;
|
||||
}
|
||||
|
||||
static inline void wine_rb_rotate_right(struct wine_rb_tree *tree, struct wine_rb_entry *e)
|
||||
static inline void rb_rotate_right(struct rb_tree *tree, struct rb_entry *e)
|
||||
{
|
||||
struct wine_rb_entry *left = e->left;
|
||||
struct rb_entry *left = e->left;
|
||||
|
||||
if (!e->parent)
|
||||
tree->root = left;
|
||||
|
@ -93,42 +87,42 @@ static inline void wine_rb_rotate_right(struct wine_rb_tree *tree, struct wine_r
|
|||
e->parent = left;
|
||||
}
|
||||
|
||||
static inline void wine_rb_flip_color(struct wine_rb_entry *entry)
|
||||
static inline void rb_flip_color(struct rb_entry *entry)
|
||||
{
|
||||
entry->flags ^= WINE_RB_FLAG_RED;
|
||||
entry->left->flags ^= WINE_RB_FLAG_RED;
|
||||
entry->right->flags ^= WINE_RB_FLAG_RED;
|
||||
entry->flags ^= RB_FLAG_RED;
|
||||
entry->left->flags ^= RB_FLAG_RED;
|
||||
entry->right->flags ^= RB_FLAG_RED;
|
||||
}
|
||||
|
||||
static inline struct wine_rb_entry *wine_rb_head(struct wine_rb_entry *iter)
|
||||
static inline struct rb_entry *rb_head(struct rb_entry *iter)
|
||||
{
|
||||
if (!iter) return NULL;
|
||||
while (iter->left) iter = iter->left;
|
||||
return iter;
|
||||
}
|
||||
|
||||
static inline struct wine_rb_entry *wine_rb_tail(struct wine_rb_entry *iter)
|
||||
static inline struct rb_entry *rb_tail(struct rb_entry *iter)
|
||||
{
|
||||
if (!iter) return NULL;
|
||||
while (iter->right) iter = iter->right;
|
||||
return iter;
|
||||
}
|
||||
|
||||
static inline struct wine_rb_entry *wine_rb_next(struct wine_rb_entry *iter)
|
||||
static inline struct rb_entry *rb_next(struct rb_entry *iter)
|
||||
{
|
||||
if (iter->right) return wine_rb_head(iter->right);
|
||||
if (iter->right) return rb_head(iter->right);
|
||||
while (iter->parent && iter->parent->right == iter) iter = iter->parent;
|
||||
return iter->parent;
|
||||
}
|
||||
|
||||
static inline struct wine_rb_entry *wine_rb_prev(struct wine_rb_entry *iter)
|
||||
static inline struct rb_entry *rb_prev(struct rb_entry *iter)
|
||||
{
|
||||
if (iter->left) return wine_rb_tail(iter->left);
|
||||
if (iter->left) return rb_tail(iter->left);
|
||||
while (iter->parent && iter->parent->left == iter) iter = iter->parent;
|
||||
return iter->parent;
|
||||
}
|
||||
|
||||
static inline struct wine_rb_entry *wine_rb_postorder_head(struct wine_rb_entry *iter)
|
||||
static inline struct rb_entry *rb_postorder_head(struct rb_entry *iter)
|
||||
{
|
||||
if (!iter) return NULL;
|
||||
|
||||
|
@ -139,70 +133,65 @@ static inline struct wine_rb_entry *wine_rb_postorder_head(struct wine_rb_entry
|
|||
}
|
||||
}
|
||||
|
||||
static inline struct wine_rb_entry *wine_rb_postorder_next(struct wine_rb_entry *iter)
|
||||
static inline struct rb_entry *rb_postorder_next(struct rb_entry *iter)
|
||||
{
|
||||
if (!iter->parent) return NULL;
|
||||
if (iter == iter->parent->right || !iter->parent->right) return iter->parent;
|
||||
return wine_rb_postorder_head(iter->parent->right);
|
||||
return rb_postorder_head(iter->parent->right);
|
||||
}
|
||||
|
||||
/* iterate through the tree */
|
||||
#define WINE_RB_FOR_EACH(cursor, tree) \
|
||||
for ((cursor) = wine_rb_head((tree)->root); (cursor); (cursor) = wine_rb_next(cursor))
|
||||
#define RB_FOR_EACH(cursor, tree) \
|
||||
for ((cursor) = rb_head((tree)->root); (cursor); (cursor) = rb_next(cursor))
|
||||
|
||||
/* iterate through the tree using a tree entry */
|
||||
#define WINE_RB_FOR_EACH_ENTRY(elem, tree, type, field) \
|
||||
for ((elem) = WINE_RB_ENTRY_VALUE(wine_rb_head((tree)->root), type, field); \
|
||||
(elem) != WINE_RB_ENTRY_VALUE(0, type, field); \
|
||||
(elem) = WINE_RB_ENTRY_VALUE(wine_rb_next(&elem->field), type, field))
|
||||
#define RB_FOR_EACH_ENTRY(elem, tree, type, field) \
|
||||
for ((elem) = RB_ENTRY_VALUE(rb_head((tree)->root), type, field); \
|
||||
(elem) != RB_ENTRY_VALUE(0, type, field); \
|
||||
(elem) = RB_ENTRY_VALUE(rb_next(&elem->field), type, field))
|
||||
|
||||
/* iterate through the tree using using postorder, making it safe to free the entry */
|
||||
#define WINE_RB_FOR_EACH_DESTRUCTOR(cursor, cursor2, tree) \
|
||||
for ((cursor) = wine_rb_postorder_head((tree)->root); \
|
||||
(cursor) && (((cursor2) = wine_rb_postorder_next(cursor)) || 1); \
|
||||
#define RB_FOR_EACH_DESTRUCTOR(cursor, cursor2, tree) \
|
||||
for ((cursor) = rb_postorder_head((tree)->root); \
|
||||
(cursor) && (((cursor2) = rb_postorder_next(cursor)) || 1); \
|
||||
(cursor) = (cursor2))
|
||||
|
||||
/* iterate through the tree using a tree entry and postorder, making it safe to free the entry */
|
||||
#define WINE_RB_FOR_EACH_ENTRY_DESTRUCTOR(elem, elem2, tree, type, field) \
|
||||
for ((elem) = WINE_RB_ENTRY_VALUE(wine_rb_postorder_head((tree)->root), type, field); \
|
||||
(elem) != WINE_RB_ENTRY_VALUE(0, type, field) \
|
||||
&& (((elem2) = WINE_RB_ENTRY_VALUE(wine_rb_postorder_next(&(elem)->field), type, field)) || 1); \
|
||||
#define RB_FOR_EACH_ENTRY_DESTRUCTOR(elem, elem2, tree, type, field) \
|
||||
for ((elem) = RB_ENTRY_VALUE(rb_postorder_head((tree)->root), type, field); \
|
||||
(elem) != RB_ENTRY_VALUE(0, type, field) \
|
||||
&& (((elem2) = RB_ENTRY_VALUE(rb_postorder_next(&(elem)->field), type, field)) || 1); \
|
||||
(elem) = (elem2))
|
||||
|
||||
|
||||
static inline void wine_rb_postorder(struct wine_rb_tree *tree, wine_rb_traverse_func_t *callback, void *context)
|
||||
static inline void rb_postorder(struct rb_tree *tree, rb_traverse_func_t *callback, void *context)
|
||||
{
|
||||
struct wine_rb_entry *iter, *next;
|
||||
WINE_RB_FOR_EACH_DESTRUCTOR(iter, next, tree) callback(iter, context);
|
||||
struct rb_entry *iter, *next;
|
||||
RB_FOR_EACH_DESTRUCTOR(iter, next, tree) callback(iter, context);
|
||||
}
|
||||
|
||||
static inline void wine_rb_init(struct wine_rb_tree *tree, wine_rb_compare_func_t compare)
|
||||
static inline void rb_init(struct rb_tree *tree, rb_compare_func_t compare)
|
||||
{
|
||||
tree->compare = compare;
|
||||
tree->root = NULL;
|
||||
}
|
||||
|
||||
static inline void wine_rb_for_each_entry(struct wine_rb_tree *tree, wine_rb_traverse_func_t *callback, void *context)
|
||||
static inline void rb_for_each_entry(struct rb_tree *tree, rb_traverse_func_t *callback, void *context)
|
||||
{
|
||||
struct wine_rb_entry *iter;
|
||||
WINE_RB_FOR_EACH(iter, tree) callback(iter, context);
|
||||
struct rb_entry *iter;
|
||||
RB_FOR_EACH(iter, tree) callback(iter, context);
|
||||
}
|
||||
|
||||
static inline void wine_rb_clear(struct wine_rb_tree *tree, wine_rb_traverse_func_t *callback, void *context)
|
||||
static inline void rb_destroy(struct rb_tree *tree, rb_traverse_func_t *callback, void *context)
|
||||
{
|
||||
/* Note that we use postorder here because the callback will likely free the entry. */
|
||||
if (callback) wine_rb_postorder(tree, callback, context);
|
||||
if (callback) rb_postorder(tree, callback, context);
|
||||
tree->root = NULL;
|
||||
}
|
||||
|
||||
static inline void wine_rb_destroy(struct wine_rb_tree *tree, wine_rb_traverse_func_t *callback, void *context)
|
||||
static inline struct rb_entry *rb_get(const struct rb_tree *tree, const void *key)
|
||||
{
|
||||
wine_rb_clear(tree, callback, context);
|
||||
}
|
||||
|
||||
static inline struct wine_rb_entry *wine_rb_get(const struct wine_rb_tree *tree, const void *key)
|
||||
{
|
||||
struct wine_rb_entry *entry = tree->root;
|
||||
struct rb_entry *entry = tree->root;
|
||||
while (entry)
|
||||
{
|
||||
int c = tree->compare(key, entry);
|
||||
|
@ -212,9 +201,9 @@ static inline struct wine_rb_entry *wine_rb_get(const struct wine_rb_tree *tree,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static inline int wine_rb_put(struct wine_rb_tree *tree, const void *key, struct wine_rb_entry *entry)
|
||||
static inline int rb_put(struct rb_tree *tree, const void *key, struct rb_entry *entry)
|
||||
{
|
||||
struct wine_rb_entry **iter = &tree->root, *parent = tree->root;
|
||||
struct rb_entry **iter = &tree->root, *parent = tree->root;
|
||||
|
||||
while (*iter)
|
||||
{
|
||||
|
@ -227,19 +216,19 @@ static inline int wine_rb_put(struct wine_rb_tree *tree, const void *key, struct
|
|||
else iter = &parent->right;
|
||||
}
|
||||
|
||||
entry->flags = WINE_RB_FLAG_RED;
|
||||
entry->flags = RB_FLAG_RED;
|
||||
entry->parent = parent;
|
||||
entry->left = NULL;
|
||||
entry->right = NULL;
|
||||
*iter = entry;
|
||||
|
||||
while (wine_rb_is_red(entry->parent))
|
||||
while (rb_is_red(entry->parent))
|
||||
{
|
||||
if (entry->parent == entry->parent->parent->left)
|
||||
{
|
||||
if (wine_rb_is_red(entry->parent->parent->right))
|
||||
if (rb_is_red(entry->parent->parent->right))
|
||||
{
|
||||
wine_rb_flip_color(entry->parent->parent);
|
||||
rb_flip_color(entry->parent->parent);
|
||||
entry = entry->parent->parent;
|
||||
}
|
||||
else
|
||||
|
@ -247,18 +236,18 @@ static inline int wine_rb_put(struct wine_rb_tree *tree, const void *key, struct
|
|||
if (entry == entry->parent->right)
|
||||
{
|
||||
entry = entry->parent;
|
||||
wine_rb_rotate_left(tree, entry);
|
||||
rb_rotate_left(tree, entry);
|
||||
}
|
||||
entry->parent->flags &= ~WINE_RB_FLAG_RED;
|
||||
entry->parent->parent->flags |= WINE_RB_FLAG_RED;
|
||||
wine_rb_rotate_right(tree, entry->parent->parent);
|
||||
entry->parent->flags &= ~RB_FLAG_RED;
|
||||
entry->parent->parent->flags |= RB_FLAG_RED;
|
||||
rb_rotate_right(tree, entry->parent->parent);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wine_rb_is_red(entry->parent->parent->left))
|
||||
if (rb_is_red(entry->parent->parent->left))
|
||||
{
|
||||
wine_rb_flip_color(entry->parent->parent);
|
||||
rb_flip_color(entry->parent->parent);
|
||||
entry = entry->parent->parent;
|
||||
}
|
||||
else
|
||||
|
@ -266,23 +255,23 @@ static inline int wine_rb_put(struct wine_rb_tree *tree, const void *key, struct
|
|||
if (entry == entry->parent->left)
|
||||
{
|
||||
entry = entry->parent;
|
||||
wine_rb_rotate_right(tree, entry);
|
||||
rb_rotate_right(tree, entry);
|
||||
}
|
||||
entry->parent->flags &= ~WINE_RB_FLAG_RED;
|
||||
entry->parent->parent->flags |= WINE_RB_FLAG_RED;
|
||||
wine_rb_rotate_left(tree, entry->parent->parent);
|
||||
entry->parent->flags &= ~RB_FLAG_RED;
|
||||
entry->parent->parent->flags |= RB_FLAG_RED;
|
||||
rb_rotate_left(tree, entry->parent->parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tree->root->flags &= ~WINE_RB_FLAG_RED;
|
||||
tree->root->flags &= ~RB_FLAG_RED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void wine_rb_remove(struct wine_rb_tree *tree, struct wine_rb_entry *entry)
|
||||
static inline void rb_remove(struct rb_tree *tree, struct rb_entry *entry)
|
||||
{
|
||||
struct wine_rb_entry *iter, *child, *parent, *w;
|
||||
struct rb_entry *iter, *child, *parent, *w;
|
||||
int need_fixup;
|
||||
|
||||
if (entry->right && entry->left)
|
||||
|
@ -302,7 +291,7 @@ static inline void wine_rb_remove(struct wine_rb_tree *tree, struct wine_rb_entr
|
|||
if (child) child->parent = iter->parent;
|
||||
parent = iter->parent;
|
||||
|
||||
need_fixup = !wine_rb_is_red(iter);
|
||||
need_fixup = !rb_is_red(iter);
|
||||
|
||||
if (entry != iter)
|
||||
{
|
||||
|
@ -321,32 +310,32 @@ static inline void wine_rb_remove(struct wine_rb_tree *tree, struct wine_rb_entr
|
|||
|
||||
if (need_fixup)
|
||||
{
|
||||
while (parent && !wine_rb_is_red(child))
|
||||
while (parent && !rb_is_red(child))
|
||||
{
|
||||
if (child == parent->left)
|
||||
{
|
||||
w = parent->right;
|
||||
if (wine_rb_is_red(w))
|
||||
if (rb_is_red(w))
|
||||
{
|
||||
w->flags &= ~WINE_RB_FLAG_RED;
|
||||
parent->flags |= WINE_RB_FLAG_RED;
|
||||
wine_rb_rotate_left(tree, parent);
|
||||
w->flags &= ~RB_FLAG_RED;
|
||||
parent->flags |= RB_FLAG_RED;
|
||||
rb_rotate_left(tree, parent);
|
||||
w = parent->right;
|
||||
}
|
||||
if (wine_rb_is_red(w->left) || wine_rb_is_red(w->right))
|
||||
if (rb_is_red(w->left) || rb_is_red(w->right))
|
||||
{
|
||||
if (!wine_rb_is_red(w->right))
|
||||
if (!rb_is_red(w->right))
|
||||
{
|
||||
w->left->flags &= ~WINE_RB_FLAG_RED;
|
||||
w->flags |= WINE_RB_FLAG_RED;
|
||||
wine_rb_rotate_right(tree, w);
|
||||
w->left->flags &= ~RB_FLAG_RED;
|
||||
w->flags |= RB_FLAG_RED;
|
||||
rb_rotate_right(tree, w);
|
||||
w = parent->right;
|
||||
}
|
||||
w->flags = (w->flags & ~WINE_RB_FLAG_RED) | (parent->flags & WINE_RB_FLAG_RED);
|
||||
parent->flags &= ~WINE_RB_FLAG_RED;
|
||||
w->flags = (w->flags & ~RB_FLAG_RED) | (parent->flags & RB_FLAG_RED);
|
||||
parent->flags &= ~RB_FLAG_RED;
|
||||
if (w->right)
|
||||
w->right->flags &= ~WINE_RB_FLAG_RED;
|
||||
wine_rb_rotate_left(tree, parent);
|
||||
w->right->flags &= ~RB_FLAG_RED;
|
||||
rb_rotate_left(tree, parent);
|
||||
child = NULL;
|
||||
break;
|
||||
}
|
||||
|
@ -354,45 +343,79 @@ static inline void wine_rb_remove(struct wine_rb_tree *tree, struct wine_rb_entr
|
|||
else
|
||||
{
|
||||
w = parent->left;
|
||||
if (wine_rb_is_red(w))
|
||||
if (rb_is_red(w))
|
||||
{
|
||||
w->flags &= ~WINE_RB_FLAG_RED;
|
||||
parent->flags |= WINE_RB_FLAG_RED;
|
||||
wine_rb_rotate_right(tree, parent);
|
||||
w->flags &= ~RB_FLAG_RED;
|
||||
parent->flags |= RB_FLAG_RED;
|
||||
rb_rotate_right(tree, parent);
|
||||
w = parent->left;
|
||||
}
|
||||
if (wine_rb_is_red(w->left) || wine_rb_is_red(w->right))
|
||||
if (rb_is_red(w->left) || rb_is_red(w->right))
|
||||
{
|
||||
if (!wine_rb_is_red(w->left))
|
||||
if (!rb_is_red(w->left))
|
||||
{
|
||||
w->right->flags &= ~WINE_RB_FLAG_RED;
|
||||
w->flags |= WINE_RB_FLAG_RED;
|
||||
wine_rb_rotate_left(tree, w);
|
||||
w->right->flags &= ~RB_FLAG_RED;
|
||||
w->flags |= RB_FLAG_RED;
|
||||
rb_rotate_left(tree, w);
|
||||
w = parent->left;
|
||||
}
|
||||
w->flags = (w->flags & ~WINE_RB_FLAG_RED) | (parent->flags & WINE_RB_FLAG_RED);
|
||||
parent->flags &= ~WINE_RB_FLAG_RED;
|
||||
w->flags = (w->flags & ~RB_FLAG_RED) | (parent->flags & RB_FLAG_RED);
|
||||
parent->flags &= ~RB_FLAG_RED;
|
||||
if (w->left)
|
||||
w->left->flags &= ~WINE_RB_FLAG_RED;
|
||||
wine_rb_rotate_right(tree, parent);
|
||||
w->left->flags &= ~RB_FLAG_RED;
|
||||
rb_rotate_right(tree, parent);
|
||||
child = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
w->flags |= WINE_RB_FLAG_RED;
|
||||
w->flags |= RB_FLAG_RED;
|
||||
child = parent;
|
||||
parent = child->parent;
|
||||
}
|
||||
if (child) child->flags &= ~WINE_RB_FLAG_RED;
|
||||
if (child) child->flags &= ~RB_FLAG_RED;
|
||||
}
|
||||
|
||||
if (tree->root) tree->root->flags &= ~WINE_RB_FLAG_RED;
|
||||
if (tree->root) tree->root->flags &= ~RB_FLAG_RED;
|
||||
}
|
||||
|
||||
static inline void wine_rb_remove_key(struct wine_rb_tree *tree, const void *key)
|
||||
static inline void rb_remove_key(struct rb_tree *tree, const void *key)
|
||||
{
|
||||
struct wine_rb_entry *entry = wine_rb_get(tree, key);
|
||||
if (entry) wine_rb_remove(tree, entry);
|
||||
struct rb_entry *entry = rb_get(tree, key);
|
||||
if (entry) rb_remove(tree, entry);
|
||||
}
|
||||
|
||||
static inline void rb_replace(struct rb_tree *tree, struct rb_entry *dst, struct rb_entry *src)
|
||||
{
|
||||
if (!(src->parent = dst->parent))
|
||||
tree->root = src;
|
||||
else if (dst->parent->left == dst)
|
||||
dst->parent->left = src;
|
||||
else
|
||||
dst->parent->right = src;
|
||||
|
||||
if ((src->left = dst->left))
|
||||
src->left->parent = src;
|
||||
if ((src->right = dst->right))
|
||||
src->right->parent = src;
|
||||
src->flags = dst->flags;
|
||||
}
|
||||
|
||||
/* old names for backwards compatibility */
|
||||
#define wine_rb_entry rb_entry
|
||||
#define wine_rb_tree rb_tree
|
||||
#define wine_rb_init rb_init
|
||||
#define wine_rb_for_each_entry rb_for_each_entry
|
||||
#define wine_rb_destroy rb_destroy
|
||||
#define wine_rb_get rb_get
|
||||
#define wine_rb_put rb_put
|
||||
#define wine_rb_remove rb_remove
|
||||
#define wine_rb_remove_key rb_remove_key
|
||||
#define wine_rb_replace rb_replace
|
||||
#define WINE_RB_ENTRY_VALUE RB_ENTRY_VALUE
|
||||
#define WINE_RB_FOR_EACH_ENTRY RB_FOR_EACH_ENTRY
|
||||
#define WINE_RB_FOR_EACH_ENTRY_DESTRUCTOR RB_FOR_EACH_ENTRY_DESTRUCTOR
|
||||
#ifdef __REACTOS__
|
||||
#define wine_rb_clear rb_destroy
|
||||
#endif
|
||||
|
||||
#endif /* __WINE_WINE_RBTREE_H */
|
||||
|
|
6
sdk/tools/winesync/riched20.cfg
Normal file
6
sdk/tools/winesync/riched20.cfg
Normal file
|
@ -0,0 +1,6 @@
|
|||
directories:
|
||||
dlls/riched20: dll/win32/riched20
|
||||
dlls/riched20/tests: modules/rostests/winetests/riched20
|
||||
files: null
|
||||
tags:
|
||||
wine: wine-10.0
|
Loading…
Add table
Add a link
Reference in a new issue