Commit Graph

126 Commits

Author SHA1 Message Date
Dylan Smith 3fe20bdc7e richedit: Handle to parent window is cached.
The parent window for the richedit control on creation is the one that
receives notify messages, even after the parent has been changed using
SetParent.
2009-09-30 17:41:06 +02:00
Francois Gouget 6e80d875d4 riched20: Make ME_SetCursorToEnd() static. 2009-08-26 13:09:27 +02:00
Dylan Smith 54b53b6018 richedit: Use ME_Cursor instead of offsets for stream out functions. 2009-08-13 15:35:28 +02:00
Dylan Smith bd4704280d richedit: Replace offsets arg with ME_Cursor for ME_InternalDeleteText.
Offsets are still used within the function, but this patch reduces the
use of it at the entry to the function.
2009-08-13 15:35:17 +02:00
Dylan Smith 8f0dfaba30 richedit: Removed ME_InsertRun since it uses character offsets.
The function was used in one place, and was simply a wrapper around a
call to ME_InsertRunAtCursor, so I removed it to avoids it use in other
parts of the code.
2009-08-13 15:35:07 +02:00
Dylan Smith 02228ee176 richedit: Use ME_Cursor instead of offsets for ME_CharFromPos. 2009-08-13 15:35:01 +02:00
Dylan Smith a69ef26599 richedit: Use ME_Cursor instead of offsets for copying text. 2009-08-13 15:34:54 +02:00
Dylan Smith 27c28ab292 richedit: Modified ME_MoveCursorsChars to move multiple chars.
Previously the function was only used to move a single character in
either direction, so I made the function more general so that it could
be used in more places.
2009-08-13 15:34:39 +02:00
Dylan Smith 2da0d8e933 richedit: Use ME_Cursor instead of offsets for ME_SetCharFormat.
The test that succeeded from this change was as a result of allowing the
end of the character format change be specified using NULL as the rest
of the text.  Before, the end paragraph run at the end of the text was
not being set for this case, when all the text was supposed to have its
character format changed.
2009-08-12 17:35:50 +02:00
Dylan Smith ade37203a5 richedit: Use ME_Cursor instead of offsets for ME_GetCharFormat.
Prevent extra conversions from character offset to ME_Cursor.
2009-08-12 17:35:42 +02:00
Dylan Smith 2bc726930f richedit: Add helpers for setting cursor to start/end of text. 2009-08-12 17:35:30 +02:00
Dylan Smith 32dcd3bbe1 richedit: Created functions to move between runs and track paragraphs.
Plenty of places in the code find following or preceding runs, then
afterwards find the paragraph from the run.  This is inefficient because
the same linked list is used for both runs and paragraphs, so changes in
paragraphs can be detected while returning the next or previous run.
2009-08-12 17:35:24 +02:00
Dylan Smith 82e102107c richedit: ME_GetTextW must use source and destination lengths.
Before a single length was used for the number of characters to retrieve
from the text, and to keep track of the size of the buffer.  These are
not equivalent, since there is a possible end of line conversion.
2009-08-12 17:32:16 +02:00
Dylan Smith 46b84aed4a richedit: Added function to get selection cursors in order.
Previously the only convenient way to get the start and end of the
selection was through offsets, which eventually need to get converted
back into items in the linked list storing the text.  The new function
will help with eliminating these inefficiencies.
2009-08-12 17:29:30 +02:00
Dylan Smith be0fb1ef5d richedit: Make the ME_GetCursorOfs function more flexible.
This function will make it easier to work with ME_Cursor objects, which
should be used in a lot of places instead of character offsets (which
often require seeking through the linked lists to perform operations
with).
2009-08-12 17:29:20 +02:00
Dylan Smith 832ffe108c richedit: Remove header function declarations with no definition. 2009-08-10 17:09:53 +02:00
Francois Gouget 3d6c53b972 riched20: Make ME_GetCursorCoordinates() static and remove ME_MustBeWrapped() as it is unused. 2009-05-26 14:10:32 +02:00
Francois Gouget 61a8b94634 riched20: ME_MakeString() is unused so remove it. 2009-05-15 10:28:20 +02:00
Andrew Talbot edca49f6aa riched20: Remove unused functions. 2009-02-09 13:21:21 +01:00
Dylan Smith c8b4455565 richedit: Removed ME_StrRelPos, ME_StrRelPos2, & ME_PosToVPos functions.
These functions were just being used for addition, so it was simpler to
remove the functions and modify the places it was used.

The ME_StrRelPos2 and ME_PosToVPos were just simple wrappers around
ME_StrRelPos, and ME_PosToVPos wasn't being used.
2009-02-09 13:05:13 +01:00
Dylan Smith 1eb0f73ab0 richedit: Got rid of ME_GetCharFwd and ME_GetCharBack.
These two functions were being used for simple operations, to get the
first or last character when pre-computing flags for splitting runs.

The call to ME_GetCharBack wasn't even giving the correct result, it
would always return -1 since it is being called with nPos of 0.

This patch simplifies the code by removing the functions and getting the
characters directly from the string.
2009-02-09 13:05:13 +01:00
Dylan Smith 5f15de0690 richedit: Removed ME_StrLen and ME_StrVLen field access functions.
These functions were probably previously needed because of some wierd
special handling of backspace characters, but currently there is no
reason why the nLen field can't be accessed directly.

Having to functions that just access the string length field just causes
slightly more effort for someone to look at the code, because they need
to enter the function to find out what it actually is doing.
2009-02-09 13:05:13 +01:00
Dylan Smith f148d82093 richedit: Got rid of useless function ME_VPosToPos.
The function was just returning the second parameter.  It had some
commented out code that indicated that previously backslashes weren't
included in the length.  Native wordpad doesn't handle backspaces in a
special way, so this must have been an internal representation that
complicated finding the position of characters.
2009-02-09 13:05:12 +01:00
Dylan Smith 4b7e8f185b richedit: Avoid duplication in make string functions using ME_MakeStringB.
I found that ME_MakeStringB was previously unused, and that the other
ME_MakeString functions repeated code that was already in ME_MakeStringB.
Making ME_MakeStringB static and using it to avoid duplicate code seemed
like a better idea than removing the function.
2009-02-09 13:05:12 +01:00
Dylan Smith f53f40bcb3 richedit: Prevent string trunction due to NULL characters. 2009-02-09 13:05:12 +01:00
Dylan Smith d20e057d8e richedit: Accept paragraph as parameter for ME_CharOfsFromRunOfs.
Rather than get the paragraph from the run, the function allows the
caller to provide the paragraph, since it is already available.  This
reduces unnecessary traversals of lists that take longer as more runs
and rows are in the paragraph.
2009-02-06 14:50:27 +01:00
Dylan Smith 12ca50db7a richedit: Get the paragraph with ME_RunOfsFromCharOfs.
The ME_RunOfsFromCharOfs function finds the paragraph before finding the
run and offset within the run, so the function may as well be able to
return this paragraph to the caller.  Many callers to the function
instead find the paragraph from the run, which ends up unnecessarily
traversing a linked list of runs within the paragraph.
2009-02-06 14:50:27 +01:00
Dylan Smith 5d74f58382 richedit: Actually store end of line string for end paragraph runs.
Previously a count of the carraige returns and line feeds were stored
for end of paragraph runs, and a paragraph sign was stored as the actual
string.  This was causing many special cases where the length of the
run needed to be determined differently if the run was or wasn't an
end of paragraph run.

There wasn't any use for storing the paragraph sign unless some drawing
code gets commented out to allow the end paragraphs to be shown,
therefore I changed the code to store the actual string that gets
retrieved by WM_GETTEXT.
2009-01-28 12:11:36 +01:00
Dylan Smith 61308257f2 richedit: Removed redundant ME_FindItemAtOffset using ME_RunOfsFromCharOfs.
The two functions ME_FindItemAtOffset and ME_RunOfsFromCharOfs were almost
identically used, since ME_FindItemAtOffset was always used to find a run.
The only difference was how they returned the offset within the run for an
end of paragraph run.

For ME_FindItemAtOffset it would return the next run if it was in between \r
and \n. ME_RunOfsFromCharOfs would instead return an nOffset of 0 for end
paragraph runs.  This subtle difference introduced bugs, so I decided to
avoid having special case in this function when creating this patch, and
instead let the caller handle this case.
2009-01-27 11:21:33 +01:00
Dylan Smith 94146a72ad richedit: Removed some unused invalidation code.
The ME_InvalidateFromOfs and ME_QueueInvalidateFromCursor functions are
never called, and the nInvalidOfs variable had its value set but never
used.
2009-01-22 15:28:22 +01:00
Dylan Smith e7b68a20fd richedit: Implemented ITextServices_TxSendMessage. 2009-01-21 11:55:22 +01:00
Dylan Smith 05c788ac6f richedit: Used ITextHost methods to avoid using window handle directly.
The methods in ITextHost are mostly thin wrappers around functions that
take a handle to a window as their first parameter.  This patch just
uses the wrapper functions provided by ITextHost instead of using the
functions that require a handle to a window that the editor might now
have (for windowless richedit controls).
2009-01-21 11:54:43 +01:00
Dylan Smith 6c4dda009e richedit: Implemented ITextHost for windowed richedit controls. 2009-01-21 11:54:26 +01:00
Andrew Talbot b53d7d3295 riched20: Declare some functions static. 2009-01-19 13:36:26 +01:00
Dylan Smith e6fedf879c richedit: Implemented the horizontal scrollbar. 2009-01-15 14:13:38 +01:00
Andrew Talbot d287e88691 riched20: Declare some functions static. 2009-01-14 12:40:40 +01:00
Andrew Talbot 8ddf6c0a25 riched20: Declare some functions static. 2009-01-13 15:53:43 +01:00
Dylan Smith 8089d980d1 richedit: Set bEmulateVersion10 initially to avoid retroactive changes.
Previously the WM_NCCREATE was handled by the as if it was always for
later versions, then the window proc for version 1.0 would make
appropriate changes afterwards.  Instead both versions should call the
same function (e.g. ME_MakeEditor) and provide the value for
bEmulateVersion10 to make the code clearer.
2009-01-12 14:40:11 +01:00
Dylan Smith 5dc1271ba6 richedit: Move message handling to function callable without window.
In order to make the message handling available to windowless richedit
controls, the message handling must be in a function that can be
called from the ITextServices_TxSendMessage method.  This method will
never have a handle to a window to pass to RichEditWndProc_common in
order to get the editor with GetWindowLongPtrW, but passing the editor
will work (even if hWnd is NULL).
2008-12-20 11:43:44 +01:00
Dylan Smith 1e8df4351d richedit: Removed unused ME_AutoURLDetect function. 2008-11-17 13:57:56 +01:00
Dylan Smith f9b31fc964 richedit: Removed comment in header for non-existent wintest.c. 2008-11-17 13:12:12 +01:00
Detlef Riekenberg 9593c9e6f5 dlls: Do not use __WINE_ALLOC_SIZE between void and *. 2008-09-19 11:41:25 +02:00
Dylan Smith 88a3a8a9c0 richedit: Don't put cursor in the table row start paragraph. 2008-09-12 11:55:08 +02:00
Dylan Smith 9a7d475db8 richedit: Avoid acting on control words in skipped RTF groups.
Previously the control words in skipped groups were being processed by
the read hook on the RTF parser.  By moving this code into the class
callbacks for the parser, the skipped groups actually remain skipped.
2008-09-11 12:38:20 +02:00
Marcus Meissner 96412ee564 Annotate with allocation size attribute. 2008-09-05 11:22:26 +02:00
Dylan Smith f11fe1c7a9 richedit: Prevent typing text at end of table row. 2008-08-29 13:42:47 +02:00
Dylan Smith a47d4a4c3a richedit: Adjust table spacing with horizontal gap and left edge. 2008-08-18 17:15:57 +02:00
Dylan Smith a382e35600 richedit: EM_[SG]ETPARAFORMAT returned the wrong value.
The values returned by EM_SETPARAFORMAT and EM_GETPARAFORMAT previously
indicated an error, and the included tests shows that Windows behaves as
documented.
2008-08-18 17:15:57 +02:00
Dylan Smith 300db3765f richedit: Each cell can contain multiple paragraphs in msftedit. 2008-08-18 14:34:11 +02:00
Dylan Smith d29f671d1a richedit: Protect deletion of cell boundaries when not deleting row. 2008-08-18 14:34:10 +02:00