wxWidgets/src/richtext
2016-10-17 12:42:00 +01:00
..
descrip.mms Include compilation of tests for OpenVMS (part1) 2010-12-15 09:51:48 +00:00
readme Merge of SOC2010_RTC_IMAGES branch. 2010-09-30 10:27:07 +00:00
richtextbackgroundpage.cpp Make wxWS_EX_VALIDATE_RECURSIVELY default (and only) behaviour 2016-02-09 23:38:23 +01:00
richtextborderspage.cpp Make wxWS_EX_VALIDATE_RECURSIVELY default (and only) behaviour 2016-02-09 23:38:23 +01:00
richtextbuffer.cpp Use correct selection after editing cell properties 2016-10-17 12:42:00 +01:00
richtextbulletspage.cpp Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
richtextctrl.cpp Avoid moving content onto part of itself and subsequent crash 2016-07-14 15:28:01 +01:00
richtextdialogs.pjd Added shadows to box attributes, and relevant controls in the Background page. 2014-12-17 16:04:03 +00:00
richtextfontpage.cpp Corrected wxRTC font dialog spin button behaviour 2015-08-18 16:36:16 +01:00
richtextformatdlg.cpp Make wxWS_EX_VALIDATE_RECURSIVELY default (and only) behaviour 2016-02-09 23:38:23 +01:00
richtexthtml.cpp Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
richtextimagedlg.cpp Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
richtextindentspage.cpp Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
richtextliststylepage.cpp Fixes for list style dialog and bullet drawing when no left subindent is specified 2015-11-14 18:37:12 +00:00
richtextmarginspage.cpp Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
richtextprint.cpp Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
richtextsizepage.cpp Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
richtextstyledlg.cpp Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
richtextstylepage.cpp Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
richtextstyles.cpp Fix MSVS 2015 warnings about hiding variables in wxRichText code 2016-02-05 22:43:23 +01:00
richtextsymboldlg.cpp Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
richtexttabspage.cpp Use wx-prefixed macros throughout the repository. 2015-04-23 22:00:35 +04:00
richtextxml.cpp Fix MSVS 2015 warnings about hiding variables in wxRichText code 2016-02-05 22:43:23 +01:00

Implement detail of floating layout

1. Data Structure

Mainly, we maintain two floating list data for a wxRichTextBuffer.
'struct FloatRectMap' is used to represent a floating object's region,
and 'class wxFloatCollector' is a container of all 'struct FloatRectMap'.
It maintains all the information of the positions of all the floating
objects with two list of 'struct FloatRectMap', one for objects floated
to left and the other for right.

wxRichTextAnchoredObject is introduced to represent a kind of objects
that can be floated. wxRichTextImage is made to be a child class of
this one. In future, we may introduce some other floating object type
like wxRichTextTable. And we also introduce a twin object of this one,
it is wxRichTextPlaceHoldingObject. When the object is set to be a
floating one, we will place a 'placing holding' object in its origin
position, this makes us to record the position of the object correctly
even if the containing paragraph change its content.

Also, along with wxRichTextAnchoredObject, we also introduce a 
wxRichTextAnchoredObjectAttr class, which contains the attributes of
floating direction, floating offset and etc. wxRichTextImageAttr is made
to be a subclass of this one.

Finally, wxRichTextImageDlg is a image control dialog, in which users can
set the alignment, floating direction, size, offset of the image, in addition,
users can also move the image between paragraph with this dialog.

2. Layout Algorithm

With floating objects, when we layout a paragraph, wxFloatCollector will
firstly collect all the floating objects of the paragraphs before this
one. And then, layout the floating objects of this paragraph, then layout
the normal objects using the available rect info according the floating
objects' state.

Generally, the basic paragraph layout algorithm:
1. All paragraphs before this one is layout well, so use wxFloatCollector
   to collect the floating objects state;
2. Collect all the 'place holding objects' of the paragraph, layout the
   floating objects with the space available for it;
3. For other objects left, make line break as:
   GetAvailableWidth with a <y, h> pair, where y is the vertical position
   of the line and h is the minimum height of the line.
   After we get the width, do line break and normal layout.

3. Some Note

If we use floating attributes with list style, it may cause some problems.
Something like image/text overlap may happen. Since, list style is applied
to the paragraph after its normal layout, in which phrase, floating layout
is done, list style will change the position of the paragraph and so may
cause some overlap.