Commit Graph

103 Commits

Author SHA1 Message Date
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 a5bfa1a2ab richedit: Properly destroy context in two places.
Whenever ME_InitContext is called, ME_DestroyContext should be used to
clean it up.  This way the context can be extended easily by modifying
those two functions.  Instead, these two places of code just released
the DC, without using ME_DestroyContext, so the created brush for the
margin was not deleted.
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 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 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
Francois Gouget b3bf746ff9 Straighten out some ellipses. 2008-11-26 12:33:34 +01:00
Dylan Smith df6e47e3a7 richedit: Removed useless lines in ME_GetDefaultCharFormat. 2008-11-17 13:58:03 +01: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 11c8039699 richedit: Use tabstops to store cell positions. 2008-08-05 14:09:37 +02:00
Dylan Smith e3efa88c45 richedit: Cannot undo setting of default character format.
This also reverts commit 2b52dd845097f16076c0185b02a003f63898dcab:
wordpad: Empty the richedit undo buffer on creation.

The reverted commit I created to fix an issue that only applied to Wine,
but it just masked the issue which was in richedit controls.  The
default character format was set in two places while wordpad was
starting up, and caused wordpad to have two undo items at startup.
2008-07-14 12:22:44 +02:00
Dylan Smith 1bec9bb440 richedit: Calculate tab positions relative to end of selection bar. 2008-06-30 12:10:18 +02:00
Dylan Smith 903423286c richedit: Added tests reveal a problem with EM_SETCHARFORMAT's affect on the undo stack. 2008-06-26 21:17:44 +02:00
Dylan Smith 6f9f01f28f richedit: bCaretAtEnd should not be reset from rewrapping text.
The bCaretAtEnd value in ME_TextEditor is used to identify that the
caret is at the end of a wrapped line instead of the start of the next
line in the paragraph since both these positions correspond to the
same position in the document. The bCaretAtEnd value was previously
being set back to FALSE whenever the window was resized.
2008-06-25 11:24:13 +02:00
Alex Villacís Lasso f213af3795 richedit: Fix for the semantics of the flags for some effects reported by EM_GETCHARFORMAT.
Remove workaround put in place by a previous patch, due to buggy flag reporting.
Tests to verify fixed behavior.
2008-06-19 12:08:30 +02:00
Alex Villacís Lasso 8d37388fe7 richedit: Fixups to move over to reliance on CR and LF counters.
Text streamout now honors CR and LF counters.
Tests to pin down required EM_STREAMOUT behavior.
2008-04-29 14:54:05 +02:00
Eric Pouech 5d36c47e1f richedit: Fixed object leaks generated by context creation & destruction. 2008-03-17 14:37:58 +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 9c20cdfea8 riched20: Make use of the size info in REOBJECT if present. 2008-02-05 11:13:33 +01:00
Eric Pouech 00de77517a riched20: Start handling OLE objects inside richedit. 2008-02-05 11:11:32 +01:00
Eric Pouech d65daea454 richedit: Uniformly handle the bPitchAndFamily field out of CHARFORMAT. 2008-01-07 12:14:24 +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 6b591ef23a richedit: Extend the usage of underlinetype from charformat2 in richedit. 2008-01-02 13:48:11 +01:00
Andrew Talbot 291dd7a090 riched20: Constify some variables. 2007-08-16 11:35:06 +02:00
Andrew Talbot 166b3a6cdb riched20: Declare some functions static. 2007-01-24 12:31:29 +01:00
Hans Leidekker 177350d087 riched20: Win64 printf format warning fixes. 2006-10-14 20:16:56 +02:00
Matt Finnicum cba3b122ed riched20: Modify ME_CharFromPoint to work properly with password controls. 2006-08-08 19:35:44 +02:00
Matt Finnicum 2b92bf78d1 riched20: Implement EM_SETPASSWORDCHAR and EM_GETPASSWORDCHAR. 2006-08-05 11:25:34 +02:00
Krzysztof Foltman 9dd276bfd1 riched20: Added short descriptions to functions in run.c, just in case
anybody had any doubts about what they actually do.
2006-08-02 22:01:10 +02:00
Jonathan Ernst 360a3f9142 Update the address of the Free Software Foundation. 2006-05-23 14:11:13 +02:00
Phil Krylov 08bf7180f3 riched20: Initial support for simple tables. 2006-02-04 17:01:01 +01:00
Phil Krylov 325e06d2c1 riched20: Removed an unused parameter. 2006-02-04 17:00:18 +01:00
Phil Krylov 65fdee73b9 riched20: Fixed undo stack corruption. 2006-02-04 16:59:37 +01:00
Phil Krylov f0d6519ef5 riched20: Added support for hidden text. 2006-01-31 13:01:26 +01:00
Phil Krylov d82af6f711 riched20: Speed up text insertion.
Optimized reading large texts into RichEdit to be an O(n) order
algorythm instead of O(n^2) by removing extraneous conversions of
character offsets to run offsets.
2006-01-10 12:10:49 +01:00
Krzysztof Foltman 24a0f15b29 Fixed EOL detection in ME_RunOfsFromCharOfs in 1.0 emulation mode
(necessary for a non-workaround version of EM_POSFROMCHAR).
2005-10-10 11:18:29 +00:00
Krzysztof Foltman 2489dd212b Send verbose info to different debug channels (richedit_check for
output from offset checker, richedit_lists for the document list
dumps).
2005-10-08 10:33:44 +00:00
Phil Krylov 8a36f2a325 Fixed EM_GETCHARFORMAT for selection containing a single character. 2005-07-22 18:27:26 +00:00
Phil Krylov 84bb372239 Added emulation of RichEdit 1.0 behaviour when the 1.0 window class is
being used. This emulation (introduced in M$ RichEdit 3.0) counts
paragraph endings as 2 characters (CR+LF) instead of 1 (CR).
2005-07-21 10:33:32 +00:00
Michael Stefaniuc 3cf8d37067 Change an assert to a WARN. 2005-05-16 09:14:50 +00:00
Ivan Leo Puoti 327b1632e5 Fix crash in ME_GetRunSizeCommon(). Turn a FIXME into a TRACE. 2005-05-11 15:56:34 +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 898068f3ce - EM_STREAMIN can now deal with undo in a reasonable manner (no
multiple undo actions in one EM_STREAMIN).
- Related changes to undo code (umIgnore mode is now handled
  correctly).
- Numerous improvements in the RTF reader: it reads some character
  attributes now (you will have proper small print in license agreements
  now).
- Fixed a memory overwrite bug in conversion from CHARFORMAT2A to
  CHARFORMAT2W.
2005-03-11 10:24:56 +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