wxwidgets/src/richtext
Vadim Zeitlin 6655f6e41c Fix wrong uses of wxBitmap::CreateWithDIPSize()
In portable code CreateWithLogicalSize() must be used when its arguments
are logical coordinates, e.g. window sizes, so using CreateWithDIPSize()
was wrong and resulted in missized bitmaps in high DPI under MSW.
2024-01-09 15:09:31 +01:00
..
descrip.mms define WXBUILDING when compiling the library on OpenVMS 2020-03-05 08:15:04 +01:00
readme Merge of SOC2010_RTC_IMAGES branch. 2010-09-30 10:27:07 +00:00
richtextbackgroundpage.cpp Remove all blank "Modified by:" lines from top comment blocks 2023-10-22 01:22:48 +02:00
richtextborderspage.cpp Remove all blank "Modified by:" lines from top comment blocks 2023-10-22 01:22:48 +02:00
richtextbuffer.cpp Remove all blank "Modified by:" lines from top comment blocks 2023-10-22 01:22:48 +02:00
richtextbulletspage.cpp Remove all blank "Modified by:" lines from top comment blocks 2023-10-22 01:22:48 +02:00
richtextctrl.cpp Fix wrong uses of wxBitmap::CreateWithDIPSize() 2024-01-09 15:09:31 +01:00
richtextdialogs.pjd Replace tabs with spaces 2020-12-23 17:03:10 +01:00
richtextfontpage.cpp Remove all blank "Modified by:" lines from top comment blocks 2023-10-22 01:22:48 +02:00
richtextformatdlg.cpp Remove all blank "Modified by:" lines from top comment blocks 2023-10-22 01:22:48 +02:00
richtexthtml.cpp Remove all blank "Modified by:" lines from top comment blocks 2023-10-22 01:22:48 +02:00
richtextimagedlg.cpp Remove BCC-specific hdrstop pragma from everywhere 2020-10-12 21:58:37 +02:00
richtextindentspage.cpp Remove all blank "Modified by:" lines from top comment blocks 2023-10-22 01:22:48 +02:00
richtextliststylepage.cpp Remove all blank "Modified by:" lines from top comment blocks 2023-10-22 01:22:48 +02:00
richtextmarginspage.cpp Remove all blank "Modified by:" lines from top comment blocks 2023-10-22 01:22:48 +02:00
richtextprint.cpp Use nullptr instead of NULL in the code and documentation 2022-10-18 01:25:25 +02:00
richtextsizepage.cpp Remove all blank "Modified by:" lines from top comment blocks 2023-10-22 01:22:48 +02:00
richtextstyledlg.cpp Remove all blank "Modified by:" lines from top comment blocks 2023-10-22 01:22:48 +02:00
richtextstylepage.cpp Remove all blank "Modified by:" lines from top comment blocks 2023-10-22 01:22:48 +02:00
richtextstyles.cpp Remove all blank "Modified by:" lines from top comment blocks 2023-10-22 01:22:48 +02:00
richtextsymboldlg.cpp Remove all blank "Modified by:" lines from top comment blocks 2023-10-22 01:22:48 +02:00
richtexttabspage.cpp Remove all blank "Modified by:" lines from top comment blocks 2023-10-22 01:22:48 +02:00
richtextxml.cpp Deprecate "encoding" parameter of wxXmlDocument ctor and Load() 2024-01-01 22:08:28 +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.