Development: wxRichTextEditor

From WxWiki
Jump to navigation Jump to search

A place where work on wxRichTextCtrl is discussed.

wxRichTextCtrl Image Project

Achieved in the GSoC 2010 Project

In GSoC 2010 summer, we have achieved:

  • make image floating to left/right
  • change image's size
  • specify Y offset of floating image
  • move image between paragraphs
  • support HitTest for floating images

Plan for completing the image work

Thoughts from JACS:

We need to compare the current implementation with, in particular, the OpenOffice picture properties dialog. The current Alignment property in the wxRTC image dialog can probably go since it doesn't do anything and alignment is catered for by the Floating control. We should, if possible, add two further float modes:

  • centered (floating, with no text wrapping on either side)
  • distance from (a specified X distance from the left margin)

We should also add support for:

  • left, right, top and bottom spacing
  • a title for the image (equivalent to "Alt" attribute in HTML)
  • a caption for the image (a wxRichTextParagraph)

Some of the new image attributes are applicable to all kinds of floating objects, so we should generalise and derive wxRichTextImage from a general class representing floating objects. The floating implementation will operate on these objects, as much as possible, rather than specifically image objects.

Generalising even further, we could support objects that have custom code for layout, drawing, hit-testing, and property-editing, so that we can extend wxRTC with custom objects that are optionally floatable. An image could then be an example of this class. An example of another one might be a graph object, or a table.

The current floating image implementation makes use of place-holder objects and manipulates the buffer structure in order to avoid floating images being drawn inline at their actual positions. We should instead pass flags to content layout and drawing functions, so we don't have to change the structure but can treat floating objects as invisible when necessary (i.e. when laying out a portion of content containing floating objects, which will be drawn separately).

Other future wxRichTextCtrl features

Extensible object properties

If all objects have an attribute array associated with them, we can extend wxRTC's possibilities greatly according to application need. For example we could associate an identifier with each object and use it for applying specific styles to an individual object; or we could implement fields that are evaluated dynamically.

This would be just a few lines of code, plus input/output code in the XML handler.