Commit Graph

131 Commits

Author SHA1 Message Date
Huw Davies 86f077b163 riched20: Add an explicit run length member and use it rather than accessing the string length. 2013-01-31 16:32:12 +01:00
Huw Davies 27578f8bb6 riched20: Add a helper to retrieve the run text. 2013-01-30 17:19:31 +01:00
Huw Davies c17af77b5c riched20: Add a helper to debug the run text. 2013-01-30 17:19:28 +01:00
Dylan Smith 10d800b6b8 richedit: Invalidate a range of paragraphs without marking them. 2012-05-18 18:10:27 +02:00
Dylan Smith 1f8cbe1645 richedit: Avoid scanning all text for paragraphs to invalidate. 2012-05-09 11:55:58 +02:00
Dylan Smith 18fa3287f6 richedit: Remove always FALSE parameter from ME_PaintContent. 2012-05-08 09:42:16 +02:00
Thomas Faber 791d000f96 riched20: Simplify ME_PrepareParagraphForWrapping. 2011-10-24 19:54:02 +02:00
Thomas Faber f3a3ce8a51 riched20: Avoid a forward declaration. 2011-10-24 19:37:08 +02:00
Dylan Smith c0ee555e8f richedit: Avoid redundant calls to ME_CalcRunExtent.
ME_SplitRun is only called by wrapping code. In all but one call the
returned second half of the split run will be returned, get passed back
to ME_WrapHandleRun, then ME_CalcRunExtent will be called at the start of
ME_WrapHandleRun through ME_WrapSizeRun.
2010-07-30 11:36:02 +02:00
Dylan Smith 4c174fc845 richedit: Removed unused run flags values.
The only place MERF_SKIPPED was in debug code, and MERF_CALCBYWRAP was only
used to clear this unused flag value, so I got rid of both of them.
2010-07-29 10:28:29 +02:00
Dylan Smith 15251ad84b richedit: Removed redundant variable ptLastSplittableRun. 2010-07-29 10:28:06 +02:00
Dylan Smith b88b007d95 richedit: Fix assignment to wrong variable (LLVM/Clang). 2010-05-25 12:02:28 +02:00
Gerald Pfeifer 14ef0fed9c riched20: Remove variable changed which is not really used from ME_PrepareParagraphForWrapping. 2010-05-03 15:40:04 +02:00
Dylan Smith 1f2575ba7c richedit: Documented paragraph border widths are in points not pixels.
The border widths documented by msdn are in points which are 72 dpi, which
is not equivalent to pixels (normally 96 dpi). I pre-converted all the
border widths to 96 dpi resolution since this avoids needed to store
fractions, and often avoids the need for convertion to the displays
resolution.
2010-03-01 11:32:18 +01:00
Dylan Smith 535afbd3aa richedit: Move function ME_GetParaLineSpace to make it static. 2010-02-10 11:32:31 +01:00
Dylan Smith e9693d6272 richedit: Removed unused local variable yStart. 2010-02-05 10:06:30 +01:00
Dylan Smith 0342ab0df1 richedit: Use ITextHost interface in ME_LinkNotify.
Using the ITextHost interface allows this notification to be received
for windowless richedit controls.  Windowed richedit conrols have an
ITextHost implementation that will fill in hwndFrom and idFrom, but
these should probably be initialized to 0 for windowless richedit
controls.
2009-09-28 12:54:16 +02:00
Dylan Smith 1a2ccfe9c7 richedit: Count graphics towards line width.
Images that are inserted into richedit controls store a space for the
text, since that is the character returned when getting the plain text
from the control.

When calculating the width of a line, the space character is skipped,
but images should not be skipped.  This can be seen by inserting an
image into wordpad on a line by it's own, then centering the line.  The
image will start from the center rather than being centered in the
control.
2009-03-11 13:03:30 +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 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 e082dd3042 richedit: Add paragraph field to wrap context to avoid searching for it.
More case of searching for the paragraph through the linked list when
is was already previously available.  Since each wrap context is used
for wrapping each paragraph, I decided to add the reference to the
paragarph in the structure.
2009-02-06 14:50:27 +01:00
Dylan Smith 1a3551b630 richedit: Use width from EM_SETTARGETDEVICE for wrapping.
The width for EM_SETTARGETDEVICE is used by some applications to set the
wrapping width to a certain distance in twips.  This can be used even
though the target device is ignored.
2009-02-02 15:21:44 +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 e6fedf879c richedit: Implemented the horizontal scrollbar. 2009-01-15 14:13:38 +01:00
Dylan Smith 97a83147b3 richedit: Avoid re-calculating positions found in wrapping for painting.
When the text is wrapped, the positions for all the runs, paragraphs,
and cells are already calculated and stored.  The only thing left to do
for painting is to offset them by the formatting rectangle and the
scroll position.
2008-12-20 11:43:29 +01:00
Dylan Smith dc03b6b2f2 richedit: Removed redundant editor height variables and calculations.
During wrapping there were three different heights that were being
stored, with only one of them being done correctly.  The other ones
failed to incorporate the height of the paragraph or row, so ended up
being incorrect.
2008-12-20 11:43:09 +01:00
Dylan Smith 297716e01c richedit: Made sure text is offset by formatting rectangle.
The formatting rectangle is set with EM_SETRECT, and retrieved with
EM_GETRECT, so it corresponds to rcFormat in the code.  This defines the
area that the richedit control should draw the text so that it is
offset by the top-left corner of the formatting rectangle, and clipped
so that it doesn't draw past the bottom or right hand side.  Thus this
is important for implementing windowless richedit controls to not
interfere with the rest of the window.
2008-12-18 14:19:40 +01:00
Dylan Smith c70f6a3933 richedit: Use the DefWindowProc to implement WM_SETREDRAW. 2008-10-20 11:37:27 +02:00
Dylan Smith 1ed84f0dcc richedit: Fixed centering and right align with word wrap disabled. 2008-10-13 13:17:53 +02:00
Dylan Smith a32f1f2c1c richedit: Account for selection bar in calculating available width. 2008-10-13 13:17:42 +02:00
Dylan Smith 930f8f5af6 richedit: Removed invalid assertion.
The assertion was not valid, because it neglected to take into account
the situation where a line break is forced with a MERF_ENDROW run
(caused by \line control word or pressing Shift-Enter).  This means
that spaces can cause a line wrap after a forced line break as well as
after a paragraph break, so we cannot assert that it is the first row
in the paragraph.
2008-10-06 13:06:24 +02:00
Dylan Smith b5e9aed268 richedit: Prevent integer overflow in wrapping code with no wrap. 2008-09-02 11:57:14 +02:00
Dylan Smith 421c5b0e02 richedit: Borders are now drawn for tables and nested tables. 2008-08-18 17:15:57 +02:00
Dylan Smith 967c148a68 richedit: Borders are drawn for simple tables. 2008-08-18 17:15:57 +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 300db3765f richedit: Each cell can contain multiple paragraphs in msftedit. 2008-08-18 14:34:11 +02:00
Dylan Smith e86a1d623a richedit: Fixed regression that caused endless loop. 2008-07-18 11:32:38 +02:00
Dylan Smith db3991257f richedit: Handle overflow of only spaces on first line of paragraph.
The uncommon case that this patch handles is enough whitespace being
on the first line of a paragraph to cause it to wrap.  In this case the
first non-space character will be wrapped onto the next line.
2008-07-10 18:13:38 +02:00
Dylan Smith feda29bb0c richedit: Fixed position of runs in some situations during wrapping.
Runs that are skipped over still need to affect the wrapping position,
otherwise they won't affect further run positions.
2008-07-10 18:13:25 +02:00
Dylan Smith 49468e1824 richedit: Tabs cause lines to wrap but not end of paragraph run. 2008-07-10 18:13:13 +02:00
Dylan Smith e4007e9f97 richedit: Removed redundant wrapping code.
Lines in ME_WrapHandleRun were removed because ME_CalcRunExtent is
already called unconditionally just before it in the call to
ME_WrapSizeRun.
2008-07-10 18:12:48 +02:00
Dylan Smith c8e2552ad9 richedit: Trailing spaces should not affect alignment shift length. 2008-06-25 11:23:45 +02:00
Alex Villacís Lasso 3cc6e2365a richedit: When returning position through wParam pointer, EM_POSFROMCHAR must return 0 as LRESULT.
Add tests for EM_POSFROMCHAR for 1.0 and 2.0.
2008-06-24 11:43:42 +02:00
Dylan Smith 6f11b1b354 richedit: Removed useless code. 2008-05-05 21:18:13 +02:00
Alex Villacís Lasso d2a8461585 richedit: Paragraph may have multiple rows, which should possibly update nHeight.
Otherwise, a paragraph with multiple rows might fail to make the
scrollbar appear when displaying text.
2008-04-29 14:57:13 +02:00
Andrew Talbot 0ba8677430 riched20: Remove unused variables. 2008-04-24 11:49:53 +02:00
Eric Pouech df7ab004ce richedit: Fixed a bogus computation of paragraph indentation. 2008-03-24 12:12:11 +01:00
Eric Pouech 5d36c47e1f richedit: Fixed object leaks generated by context creation & destruction. 2008-03-17 14:37:58 +01:00
Eric Pouech 33d7cea120 richedit: Added support for EM_SETTARGETDEVICE with a NULL DC. 2008-03-17 14:37:43 +01:00
Eric Pouech a86d7bdcea richedit: Pass left margin around when computing the size of a run, so that a tab will get a correct size. 2008-03-17 14:36:06 +01:00
Eric Pouech 4fb2dfc9f0 richedit: Added support for end of line inside paragraphs. 2008-03-17 14:34:24 +01:00
Eric Pouech d014db68d4 riched20: Correctly handle the wrapping when graphics are used.
Get rid of infinite loops when run's width was larger than the global
available width.
2008-02-05 11:12:18 +01:00
Eric Pouech f43570cbf0 richedit: Optimizations for the style selection.
Use a ME_Context for style selection/unselection.
Store the (x,y) dpi information for a given DC in the corresponding ME_Context structure.
2008-01-02 13:57:37 +01:00
Eric Pouech 475b45d8ab richedit: Don't recreate the DC all the time, but use uniformely a ME_Context structure where needed. 2008-01-02 13:56:02 +01:00
Eric Pouech 4cecb5dc70 richedit: Move init code after some sanity checks to avoid unneeded computations. 2008-01-02 13:55:53 +01:00
Eric Pouech e9be142d78 richedit: Rewrote FindPixelPos so that it always return something.
Made the function static as well.
2008-01-02 13:55:14 +01:00
Eric Pouech d319033a97 richedit: Added support for intra-paragraph line space. 2008-01-02 13:54:49 +01:00
Eric Pouech f1b029ef6a richedit: Added support for spaces above & below paragraphs. 2008-01-02 13:54:25 +01:00
Eric Pouech caa37c749a richedit: Now drawing the paragraph borders (if any) from paraformat2. 2008-01-02 13:54:01 +01:00
Eric Pouech 28cc0f9e69 richedit: Fix the para computation when zoom is used. 2008-01-02 13:52:52 +01:00
Eric Pouech f4fd063101 richedit: Enforce usage of paraformat2 fields instead of homegrown ones for paragraphs. 2008-01-02 13:52:10 +01:00
Eric Pouech 13f86afe1f richedit: Don't allow recursive EN_REQUESTRESIZE notifications. 2008-01-02 13:47:41 +01:00
Maarten Lankhorst b81335501f riched20: Implement ECO/EM SELECTIONBAR. 2007-12-17 11:34:40 +01:00
Maarten Lankhorst 4637a4ef49 riched20: Make some functions static. 2007-12-14 12:26:48 +01:00
Andrew Talbot b150ea67a9 riched20: Constify some variables. 2007-08-17 12:01:37 +02:00
Lei Zhang 0d4707c284 riched20: Properly calculate control display height. 2007-08-16 11:35:06 +02:00
Krzysztof Foltman bad844d0a9 riched20: New, clean, simple selection repaint logic - should fix all outstanding refresh issues. 2006-08-07 19:59:58 +02:00
Jonathan Ernst 360a3f9142 Update the address of the Free Software Foundation. 2006-05-23 14:11:13 +02:00
Phil Krylov 325e06d2c1 riched20: Removed an unused parameter. 2006-02-04 17:00:18 +01:00
Phil Krylov 6818762a6e riched20: Reduced screen flicker by using proper update region invalidation. 2006-01-10 20:41:23 +01:00
Phil Krylov a91ba787e2 Added support for EM_REQUESTRESIZE message, EN_REQUESTRESIZE
notification, and ENM_REQUESTRESIZE event mask.
2005-11-03 09:52:29 +00:00
Stefan Huehner 70c80fb430 Make functions static to fix -Wmissing-declarations warnings. 2005-07-06 15:53:04 +00:00
Phil Krylov e6cee96df8 Fixed an off-by-one error in EM_GETLINECOUNT handler. 2005-07-05 20:56:14 +00:00
Phil Krylov eb1c6657f7 Implemented EM_GETLINECOUNT RichEdit message. 2005-06-30 18:10:22 +00:00
Krzysztof Foltman 13578c8602 - removed trailing spaces from some files
- tab support
- indent support
2005-04-16 10:48:35 +00:00
Krzysztof Foltman 810b261175 - made string operations consistent wrt whitespace handling (which
should greatly improve stability of the wrap code and eliminate
  regressions of the most recent versions)
- completely new scrollbar handling (much more reliable) and related
  redraw fixes
- Page Down handler (no Page Up yet, fixing wrap/redraw/scrollbar bugs
  was of higher priority)
2005-03-19 17:06:17 +00:00
Krzysztof Foltman f089de1f4d - RTF reader doesn't use RichEdit messages anymore (which saves on
unnecessary repaints)
- added unicode character support to RTF import (like: \u12345 ?)
- small fixes
- fixed whitespace identification bug
- removed drawing of paragraph marks
- improved stub implementations for IRichEditOle
2005-03-17 10:23:40 +00:00
Krzysztof Foltman f7e0f7cabe - Optimized repaint of the area below the text.
- ME_JoinRuns didn't mark the paragraph for rewrapping, fixed.
- Removed PostQuitMessage(0) from WM_DESTROY handler (duh!).
- Use of EM_GETOLEINTERFACE is reported with FIXME instead of TRACE
  (any app using this message is likely to encounter major problems).
2005-03-09 18:43:18 +00:00
Krzysztof Foltman 89075fb429 The meaning of the rewrap flag got inverted (MEPF_REWRAP instead of
MEPF_WRAPPED) for consistency.
Major code cleanups in rewrap/repaint code, leading to "smarter"
behaviour wrt repainting selections.
2005-03-09 11:48:59 +00:00
Krzysztof Foltman 300f684053 Old font management replaced by the cache-based one, which keeps
maximum of 10 HFONTs at once, instead of one per a couple of runs.
2005-03-08 16:26:23 +00:00
Krzysztof Foltman d488f3f1de Initial implementation of riched20. 2005-03-05 11:19:14 +00:00