Led 3.0 Class Library Documentation

Module SimpleTextImager

Classes and Global Functions Index

Module Description:

The SimpleTextImager module provides a very fast, lightweight text imaging implementation. This implementation does not support wordwrapping (or multiple rows per line (Partition element)

Class: SimpleTextImager [public]

Base Classes: PartitioningTextImager

SimpleTextImager is a simple subclass of PartitioningTextImager. NB: this is a change from Led 2.2, when as an implementation detail, it subclassed from MultiRowTextImager.

SimpleTextImager assumes that all rows have the same height (specified by ReCalcRowHeight) and that all lines (paragraphs) are displayed in a single row. It is these assumptions that allow this class to display text with much less runtime overhead (both memory and time).

You should be able to assign an arbitrary partition object to a SimpleTextImager via the SimpleTextImager::SetPartition function. And these partition objects should be sharable among multiple SimpleTextImager's.

NB: Much of this class is subject to change (mostly simplication). This code was originally based on the code for MultiRowTextImager, and as such, it has alot of generality built in which isn't appropriate (like assuming rows all same height allows alot to be simplfied in computations etc).

Unless you must, avoid counting too much on the internals and details of this class.

Member Details

SimpleTextImager::ChangedInterLineSpace [public]

void SimpleTextImager::ChangedInterLineSpace (PartitionMarker* /*pm*/)

If you override the virtual, one-arg version of SimpleTextImager::GetInterLineSpace, you must call this method whenever the interline space value changes, for a given PM. This method will clear any caches associated with that PM. And refresh the screen, as needed (in some subclass).

See the one-arg SimpleTextImager::GetInterLineSpace for more details.

SimpleTextImager::ContainsMappedDisplayCharacters [public]

bool SimpleTextImager::ContainsMappedDisplayCharacters (const Led_tChar* text, size_t nTChars) const

Override TextImager::ContainsMappedDisplayCharacters to hide '\n' characters. See qDefaultLedSoftLineBreakChar.

SimpleTextImager::DrawInterLineSpace [public]

void SimpleTextImager::DrawInterLineSpace (PartitionMarker* pm, Led_Tablet tablet, Led_Coordinate vPosOfTopOfInterlineSpace, bool segmentHilighted, bool printing)

Called by SimpleTextImager::DrawRow to draw space between paragraphs (lines). Typically this is nothing. But this hook can be used to draw various sorts of annotations on paragraphs (as in LECs LVEJ side-by-side mode).

SimpleTextImager::DrawRow [public]

void SimpleTextImager::DrawRow (const RowReference& row, Led_Tablet tablet, const Led_Rect& currentRowRect, const Led_Rect& invalidRowRect,

Draw the given row of text. Erase the background (by calling TextImager::EraseBackground), and then draw the segments of the row by calling SimpleTextImager::DrawRowSegments. Then draw any hilighting. This routine CAN cause flicker. Flicker is eliminated at a higher level (caller) by using offscreen bitmaps.

NB: This bit about flicker changed in Led 2.2. Earlier Led versions tried to elminate flicker at all levels and avoid offscreen bitmaps. But problems with kerning made this difficult.

SimpleTextImager::DrawRowHilight [public]

void SimpleTextImager::DrawRowHilight (const RowReference& row, Led_Tablet tablet, const Led_Rect& currentRowRect, const Led_Rect& /*invalidRowRect*/,

Called by SimpleTextImager::DrawRow to draw any necessary hilighting for the current selection for the given row.

SimpleTextImager::DrawRowSegments [public]

void SimpleTextImager::DrawRowSegments (Led_Tablet tablet, const Led_Rect& currentRowRect, const Led_Rect& invalidRowRect,

Called by SimpleTextImager::DrawRow to draw (in or mode - don't worry about erasing) all the segments which make up the row of text. Here, we take care of any sort of justification, or indending (in subclasses which override this method). Its rowRect its called with represents the entire row. Subclasses can call DrawSegment () with adjusted row-rects taking into account indents, etc.

SimpleTextImager::GetInterLineSpace [public]

Led_Distance SimpleTextImager::GetInterLineSpace () const

Get the interline space associated with a SimpleTextImager. Set the per-buffer value with SimpleTextImager::GetInterLineSpace.

NB: There is also a one-arg version of SimpleTextImager::GetInterLineSpace which takes a PM as arg. See its docs, or SimpleTextImager::ChangedInterLineSpace for more details.

SimpleTextImager::GetInterLineSpace (overload 1) [public]

Led_Distance SimpleTextImager::GetInterLineSpace (PartitionMarker* /*pm*/) const

Get the interline space associated with a particular partition element. This method is virtual so that subclassers can provide a different interline space for each partition element. But the default behavior is to simply use the global - buffer value - specified by SimpleTextImager::SetInterLineSpace and returned by the no-arg version of SimpleTextImager::GetInterLineSpace.

SimpleTextImager::GetIthRowReference [public]

SimpleTextImager::RowReference SimpleTextImager::GetIthRowReference (size_t ith) const

Get the ith row reference in the document. Asserts value ith refers to a valid row number.

It calls SimpleTextImager::GetIthRowReferenceFromHere todo its work (which returns a bool rather than asserting).

SimpleTextImager::GetIthRowReferenceFromHere [public]

SimpleTextImager::RowReference SimpleTextImager::GetIthRowReferenceFromHere (RowReference fromHere, long ith) const

Adjust fromHere by ith rows. If ith is zero, then this returns fromHere. It asserts there are at least ith rows from the given one to retrieve. It calls SimpleTextImager::GetIthRowReferenceFromHere todo its work (which returns a bool rather than asserting).

See also SimpleTextImager::GetNextRowReference, SimpleTextImager::GetPreviousRowReference.

SimpleTextImager::GetLastRowReferenceInWindow [public]

SimpleTextImager::RowReference SimpleTextImager::GetLastRowReferenceInWindow () const

Returns the last row-reference in the window (end of window).

SimpleTextImager::GetNextRowReference [public]

bool SimpleTextImager::GetNextRowReference (RowReference* adjustMeInPlace) const

Advance the given row reference argument to the next row. Return true if there is a valid next row. And false if adjustMeInPlace was already on the last row.

See also SimpleTextImager::GetPreviousRowReference.

SimpleTextImager::GetPreviousRowReference [public]

bool SimpleTextImager::GetPreviousRowReference (RowReference* adjustMeInPlace) const

Retreat the given row reference argument to the previous row. Return true if there is a valid previous row. And false if adjustMeInPlace was already on the first row.

See also SimpleTextImager::GetNextRowReference.

SimpleTextImager::GetRowHeight [public]

Led_Distance SimpleTextImager::GetRowHeight () const

Gets the row height for all rows in the Imager. Note that for SimpleTextImager, all rows have the same height. This function caches the value (computed by SimpleTextImager::ReCalcRowHeight ()). To cause the value to be recomputed, call SimpleTextImager::InvalidateRowHeight (). This is automatically done for you from

SimpleTextImager::GetRowLength [public]

size_t SimpleTextImager::GetRowLength (RowReference row) const

Gets the length of the given row (in Led_tChars).

See also SimpleTextImager::GetStartOfRow and SimpleTextImager::GetEndOfRow.

SimpleTextImager::GetRowRelativeBaselineOfRowContainingPosition [public]

Led_Distance SimpleTextImager::GetRowRelativeBaselineOfRowContainingPosition (size_t charPosition) const

Override/implement TextImager::GetRowRelativeBaselineOfRowContainingPosition.

SimpleTextImager::InvalidateRowHeight [public]

void SimpleTextImager::InvalidateRowHeight ()

Note that the rowHeight associated with this TextImager is invalid. Next time the value is requested (via SimpleTextImager::GetRowHeight ()), recalculate it first.

SimpleTextImager::ReCalcRowHeight [public]

Led_Distance SimpleTextImager::ReCalcRowHeight () const

Called by SimpleTextImager::GetRowHeight on an as-needed basis (when invalidated by SimpleTextImager::InvalidateRowHeight). All rows in a SimpleTextImager are the same height. By default this simple uses MeasureSegmentHeight_ (GetDefaultFont (), 0, 0) to establish the per-row height. You can override this to provide whatever height you wish. But anything smaller will look cut-off.

SimpleTextImager::RemoveMappedDisplayCharacters [public]

size_t SimpleTextImager::RemoveMappedDisplayCharacters (Led_tChar* copyText, size_t nTChars) const

Override TextImager::RemoveMappedDisplayCharacters to hide '\n' characters.

SimpleTextImager::ScrollSoShowing [public]

void SimpleTextImager::ScrollSoShowing (size_t markerPos, size_t andTryToShowMarkerPos)

Implement TextImager::ScrollSoShowing API.

SimpleTextImager::SetInterLineSpace [public]

void SimpleTextImager::SetInterLineSpace (Led_Distance interlineSpace)

Set the interline space associated for the entire text buffer. Call the no-arg version of SimpleTextImager::GetInterLineSpace to get the currently set value.

SimpleTextImager::SetPartition [public]

void SimpleTextImager::SetPartition (const PartitionPtr& partitionPtr)

See PartitioningTextImager::SetPartition. Same, but if called with NULL (and we have a TextStore) then make a default partition.

Class: SimpleTextImager::RowReference [public]


A utility class to represent a row. It is a struct with a parition marker, and a row number. These things are NOT long-lived. And shouldn't be saved anyplace, as no attempt is made to keep them automaticlly up to date as the text is modified. They are just a convenient, short-hand way to navigate through rows of text.

NOTE - this RowReference stuff is just a design vestige from an earlier implementation. At some point, this module should be rewritten/cleaned up to eliminate this (LGP - 2001-10-20).

Return to Led Page Return to Led ClassLib Documentation Index Return to Led Reference Manual Index
Last Updated 2001-10-20