Led 3.0 Class Library Documentation

Module TextImager


Classes and Global Functions Index

Module Description:

The TextImager class is one of central importance in Led. It is the (abstract) class which does all the imaging - drawing of text to an output device.


Class: TextImager [public]

Base Classes: virtual MarkerOwner
Description:

The TextImager class is one of central importance in Led. TextImagers are responsable for imaging to a Led_Tablet the contents of a particular TextStore. A TextImager (except in the degenerate case) is always associated with one TextStore (though a single TextStore can have multiple TextImagers displaying its contents). This long-term relationship allows the TextImagers to keep track of cached data like word-wrapping information etc. TextStores have a flexable notification mechanism so that TextImagers get notifed when 'interesting' modications are made to the text (or Markers) in the TextStore a TextImager is pointing to.

A particular TextImager subclass takes the given text, and figures out how to compute metrics on it, lay it out, cache layout information, and then finally display the text. Different subclasses will apply different sorts of rules (and perhaps keep track of additional information) to render the text differently. For example - a WordWrappedTextImager will apply word-wrapping rules to display the text differently than a SimpleTextImager would.

A TextImager has no notion of 'windows' - in the sense of a UI. It has no notion of user interaction, screen updates, etc. It has no notion of style runs, paragraph formatting etc. It is a generic API for getting text (in a TextStore) imaged onto a some output Led_Tablet.

Interesting subclasses of TextImager include PartitioningTextImager, SimpleTextImager, StyledTextImager, StandardStyledTextImager, and TextInteractor.

Future enhancments:
Member Details

TextImager::AcquireTablet [public]

virtual Led_Tablet AcquireTablet () const = 0;

By "Tablet" I mean on the mac a grafport, or on windows a CDC (Led_Tablet). Something we can draw into, and calculate text metrics with.

Sometimes Led is lucky enough to find itself in a position where it is handed a tabet (drawing). But sometimes it isn't so luck. Conisider if someone asks for a row number, and this causes a complex chain of events resulting in an attempt to word-wrap, which, in turn, requires a tablet. We need some API in the Imager to request a tablet. This API MUST return the appropriate tablet for the view, appropriately prepared for drawing/text metric calculations.

Calls to TextImager::AcquireTablet must ALWAYS be balanced with calls to TextImager::ReleaseTablet () (including in the prescence of exceptions).

For windows, TextImager::AcquireTablet () must return the current PaintDC used in the PaintDC call (if we are in the context of a paint).

For Mac, we must not only return the grafPort, but be sure it is prepared.

TextImager::AcquireTablet () only fail by throwing - typically NoTabletAvailable (Led 2.1 and earlier didn't allow failure).

Calls to TextImager::AcquireTablet ()/TextImager::ReleaseTablet () can be nested.

Also, sometimes something happens which causes all text metrics to become

invalid (say we are about to image to a print port). In this case, the imager needs to be notified that all its text metrics are invalid. Call TextImager::TabletChangedMetrics () in this case.

TextImager::AssureWholeWindowUsedIfNeeded [protected]

virtual void AssureWholeWindowUsedIfNeeded () = 0;

TextImager::CalcSegmentSize [public]

virtual Led_Distance CalcSegmentSize (size_t from, size_t to) const = 0;

Measures the distance in pixels from 'from' to 'to'. This function requires that 'from' and 'to' are on the same row.

TextImager::CalculateCharDeltaFromRowDeltaFromTopOfWindow [public]

virtual long CalculateCharDeltaFromRowDeltaFromTopOfWindow (long deltaRows) const = 0;

TextImager::CalculateLongestRowInWindowPixelWidth [public]

Led_Distance TextImager::CalculateLongestRowInWindowPixelWidth () const

This is a utility methods, very handy for implementing horizontal scrolling. It can (and should be) overriden in certain subclasses for efficiency. But the default implementation will work.

TextImager::CalculateRowDeltaFromCharDeltaFromTopOfWindow [public]

virtual long CalculateRowDeltaFromCharDeltaFromTopOfWindow (long deltaChars) const = 0;

TextImager::ClearDefaultTextColor [public]

void TextImager::ClearDefaultTextColor (DefaultColorIndex dci)

Nulls out the given default color attribute, which means TextImager::GetEffectiveDefaultTextColor will use the system default for each color value.

See also

TextImager::ComputeMaxHScrollPos [public]

Led_Distance TextImager::ComputeMaxHScrollPos () const

This routine is used for horizontal scrolling (though not from within this class). It is mainly called by TextInteractor or Led_MFC etc methods to handle display/positioning of the scrollbar. Subclasses can override this to implement whatever horizontal scrolling they might want to. But a plausible override of this routine might return (roughly - taking care of min'ing out to zero) CalculateLongestRowInWindowPixelWidth () - GetWindowRect ().GetWidth ()

TextImager::ContainsMappedDisplayCharacters [public]

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

Override this to specify if any of the given characters should be hidden, removed, or mapped to some other display character. You can change the behavior of this function at runtime (depending on user settings). But when its changed - you should invalidate all cached information, since cached font metrics will we invalid (often with MultiRowTextImager::InvalidateAllCaches ()).

Note - this function doesn't REPLACE the given character from the text. Instead - it merely causes the TextImager::ReplaceMappedDisplayCharacters, TextImager::RemoveMappedDisplayCharacters, and TextImager::RemoveMappedDisplayCharacters () methods to get called.

Note also that this function takes an array of characters as a performance optimization (so it doesn't need to be called too many times, and to avoid copying buffers when nothing need be done). It could have been more logically (though less efficeintly) implemented as bool IsMappedDisplayCharacter (Led_tChar).

If you override this - you may find it handy to call TextImager::ContainsMappedDisplayCharacters_HelperForChar to do most of the work.

TextImager::ContainsMappedDisplayCharacters_HelperForChar [public]

bool TextImager::ContainsMappedDisplayCharacters_HelperForChar (const Led_tChar* text, size_t nTChars, Led_tChar charToMap)

Simple implementation of See also TextImager::ContainsMappedDisplayCharacters which is frequently applicable. Just specify the special character you are looking for.

TextImager::CopyOut [public]

void TextImager::CopyOut (size_t from, size_t byteCount, Led_tChar* buffer) const

Calls the associated TextStore::CopyOut ().

TextImager::DefaultColorIndex [public]

enum DefaultColorIndex { eDefaultTextColor, eDefaultBackgroundColor, eDefaultSelectedTextColor, eDefaultSelectedTextBackgroundColor, eMaxDefaultColorIndex };

Enumerator of different color-table default names used by these routines:

The values are:

Name Default Description
eDefaultTextColor Led_GetTextColor () Color used for plain text. This color choice is frequently overriden elsewhere.
eDefaultBackgroundColor Led_GetTextBackgroundColor () The background color which the text is drawn against. This is mainly used in TextImager::EraseBackground. NB: since TextImager::EraseBackground is frequently overriden - setting this value could have no effect.
eDefaultSelectedTextColor Led_GetSelectedTextColor () The color used to display selected text. This would typically by used by TextImager::HilightARectangle - but depending on the style of hilight it uses - this color maybe ignonred.
eDefaultSelectedTextBackgroundColorLed_GetSelectedTextBackgroundColor () The background color for hilighted (selected) text. Depending on the style of hilight it uses - this color maybe ignonred.

TextImager::Draw [public]

virtual void Draw (const Led_Rect& subsetToDraw, bool printing) = 0;

This is the API called by the underlying window system (or wrappers) to get the imager to draw its currently displayed window

TextImager::DrawSegment_ [public]

void TextImager::DrawSegment_ (Led_Tablet tablet, const Led_FontSpecification& fontSpec,

Helper function to access tablet text drawing. This function takes care of setting the background/foreground colors, and setting up a font object to be used in the Led_Tablet_::TabbedTextOut calls (maybe can go away if we do better integrating font code into Led_Tablet/LedGDI and out of TextImager).

The 'from' marker position must be legit, since it is used to grab the tabstop list. The 'end' marker position is OK to fake (passing in other text), as it is just used to determine the string length. Note text in 'text' argument need not match the REAL text in the TextStore buffer.

See also TextImager::MeasureSegmentWidth_.

TextImager::EraseBackground [public]

void TextImager::EraseBackground (Led_Tablet tablet, const Led_Rect& subsetToDraw, bool printing)

EraseBackground () is called internally by TextImagers to get arbitrary subsets of the current window being drawn to erased. This erasure must only apply to the argument 'subsetToDraw'. Clipping is not used to gaurantee this. Failure to follow that rule can produce undesirably results where other bits of surrounding text get erased.

The erasebackground call is made virtual so that you can use this as a hook to provide some sort of multi-media, picture or whatever as your background. Note that the is called during the draw process as a side-effect. So to have a changing background, you would need to both force periodic updates, and override this routine.

NB: the argument 'subsetToDraw' can occasionally be outside of the WindowRect. If so - then DO draw where this function says to draw. This is because you maybe asked to erase window margins/borders outside the Led 'WindowRect' using the same color/algorithm as that used inside the Led WindowRect.

By default - this simply calls Led_Tablet_::EraseBackground_SolidHelper with Led_GetTextBackgroundColor ().

Note - typically when you override this - you will want to override TextImager::HilightARectangle to change its implementation to specify a new background color (so inverting works properly). Perhaps see SPR#0708 for details.

TextImager::FindNextCharacter [public]

size_t TextImager::FindNextCharacter (size_t afterPos) const

Return the associated TextStore::FindNextCharacter ().

TextImager::FindPreviousCharacter [public]

size_t TextImager::FindPreviousCharacter (size_t beforePos) const

Return the associated TextStore::FindPreviousCharacter ().

TextImager::GetCharAtLocation [public]

virtual size_t GetCharAtLocation (const Led_Point& where) const = 0;

Always returns a valid location, though it might not make a lot of since if it is outside the ImageRect.

TextImager::GetCharAtWindowLocation [public]

virtual size_t GetCharAtWindowLocation (const Led_Point& where) const = 0;

Like TextImager::GetCharAtLocation but assumes 'where' is presented window-relative.

TextImager::GetCharLocation [public]

virtual Led_Rect GetCharLocation (size_t afterPosition) const = 0;

Returns the (document relative) pixel location (rectangle) of the character after the given marker position.

GetCharLocation () returns the rectangle bounding the character after marker-position 'afterPosition'. The position MUST be a valid one (1..GetLength()+1), but could refer to the end of the buffer - and so there would be no character width in this case.

TextImager::GetCharLocationRowRelativeByPosition [public]

virtual Led_Rect GetCharLocationRowRelativeByPosition (size_t afterPosition, size_t positionOfTopRow, size_t maxRowsToCheck) const = 0;

TextImager::GetCharWindowLocation [public]

virtual Led_Rect GetCharWindowLocation (size_t afterPosition) const = 0;

Like TextImager::GetCharLocation but returns things relative to the start of the window.

NB: if the location is outside of the current window, then the size/origin maybe pinned to some arbitrary value, which is pixelwise above (or beleow according to before or after window start/end) the window.

TextImager::GetDefaultFont [public]

Led_FontSpecification TextImager::GetDefaultFont () const

Returns the default font used to image new text. The exact meaning and use of this default font will depend some on the particular TextImager subclass you are using.

TextImager::GetDefaultTextColor [public]

Led_Color* TextImager::GetDefaultTextColor (DefaultColorIndex dci) const

Returns the value of the given indexed color attribute. These colors values default to NULL, which means TextImager::GetEffectiveDefaultTextColor will use the system default for each color value.

See also

TextImager::GetEffectiveDefaultTextColor [public]

Led_Color TextImager::GetEffectiveDefaultTextColor (DefaultColorIndex dci) const

Returns either the effective color corresponding to the given TextImager::DefaultColorIndex, or its default value.

See also

TextImager::GetEnd [public]

size_t TextImager::GetEnd () const

Return the associated TextStore::GetEnd ().

TextImager::GetEndOfRow [public]

virtual size_t GetEndOfRow (size_t rowNumber) const = 0;

GetEndOfRow () returns the position AFTER the last displayed character in the row. Note that this can differ from the end of row returned by TextImager::GetRealEndOfRow because of characters removed by @TextImager::RemoveMappedDisplayCharacters'.

See also TextImager::GetRealEndOfRow.

TextImager::GetEndOfRowContainingPosition [public]

virtual size_t GetEndOfRowContainingPosition (size_t charPosition) const = 0;

TextImager::GetForceAllRowsShowing [public]

bool TextImager::GetForceAllRowsShowing () const

Return the ForceAllRowsShowing flag. If this flag is true, then the TextImager will never allow scrolling so that the last row doesn't reach the end of the buffer. This is useful primarily for printing. Because otherwise, you would probably always want to disable scrolling past the point where the last row is showing.

But thats a UI choice we allow you to make if you like (or if you have some other application like printing where it makes sense).

Call TextImager::SetForceAllRowsShowing () to set the value.

TextImager::GetHScrollPos [public]

Led_Coordinate TextImager::GetHScrollPos () const

Returns the horizontal offset the image is scrolled to. If this is zero, then no horizontal scrolling has taken place. Call TextImager::SetHScrollPos () to set where you have horizontally scrolled to.

TextImager::GetImageUsingOffscreenBitmaps [public]

bool TextImager::GetImageUsingOffscreenBitmaps () const

Led already has very little flicker. This is because we are very careful to draw as little as possible, and to draw quickly. But some cases still exist. Like large pictures being drawn are flicker, cuz we must erase the bounds and then draw the picture.

Using this gets rid of these few cases of flicker, but at a small performance cost in overall draw speed.

This value defaults to true (temporarily defaulting to qUseOffscreenBitmapsToReduceFlicker).

See @TextImager::SetImageUsingOffscreenBitmaps'.

TextImager::GetIntraRowTextWindowBoundingRect [public]

Led_Rect TextImager::GetIntraRowTextWindowBoundingRect (size_t fromMarkerPos, size_t toMarkerPos) const

Similar to TextImager::GetTextWindowBoundingRect, except that this only wraps the text itself - and doesn't take into account any hilighting from the end of the text to the right hand side of the window.

TextImager::GetLastRowInWindow [public]

virtual size_t GetLastRowInWindow () const = 0;

Returns the row number of the bottom row visible in the scrolled display window. This is a generally ineffient routine to call. It is generally much better to call TextImager::GetMarkerPositionOfEndOfWindow

TextImager::GetLength [public]

size_t TextImager::GetLength () const

Return the associated TextStore::GetLength ().

TextImager::GetMarkerPositionOfEndOfWindow [public]

virtual size_t GetMarkerPositionOfEndOfWindow () const = 0;

This function returns the marker position of the end of the display window. The display window here refers to the area which is currently visible though scrolling.

This doc should be clarified!

See also TextImager::GetMarkerPositionOfStartOfWindow

TextImager::GetMarkerPositionOfStartOfLastRowOfWindow [public]

virtual size_t GetMarkerPositionOfStartOfLastRowOfWindow () const = 0;

TextImager::GetMarkerPositionOfStartOfWindow [public]

virtual size_t GetMarkerPositionOfStartOfWindow () const = 0;

This function returns the marker position of the start of the display window. The display window here refers to the area which is currently visible though scrolling.

This doc should be clarified!

See also TextImager::GetMarkerPositionOfStartOfWindow

TextImager::GetRealEndOfRow [public]

virtual size_t GetRealEndOfRow (size_t rowNumber) const = 0;

GetRealEndOfRow () returns the position AFTER the last character in the row. See TextImager::GetEndOfRow.

TextImager::GetRealEndOfRowContainingPosition [public]

virtual size_t GetRealEndOfRowContainingPosition (size_t charPosition) const = 0;

TextImager::GetRowContainingPosition [public]

virtual size_t GetRowContainingPosition (size_t charPosition) const = 0;

TextImager::GetRowCount [public]

virtual size_t GetRowCount () const = 0;

TextImager::GetRowHeight [public]

virtual Led_Distance GetRowHeight (size_t rowNumber) const = 0;

This API is redundent, but can be much more efficient to get at this information than GetCharLocation() - especially in subclasses like MultiRowImager using RowRefernces.

TextImager::GetRowLength [public]

size_t TextImager::GetRowLength (size_t rowNumber) const

Returns the number of tChars within the given row (by row index). This method's use is discouraged when word-wrapping is present, because it forces word-wrapping up to the given row # in the buffer.

TextImager::GetRowRelativeBaselineOfRowContainingPosition [public]

virtual Led_Distance GetRowRelativeBaselineOfRowContainingPosition (size_t charPosition) const = 0;

Returns the number of pixels from the top of the given row, to the baseline. The 'charPosition' is a markerPosition just before any character in the row.

TextImager::GetStableTypingRegionContaingMarkerRange [public]

virtual void GetStableTypingRegionContaingMarkerRange (size_t fromMarkerPos, size_t toMarkerPos,

OK, this is a little obscure. But - believe me - it does make sense. When doing updates to the text (say typing) the impact if the typing (in terms of visual display) typically only extends over a narrow region of the screen. If we are using a non-word-wrapped text editor, then this is typically a line. If it is a word-wrapped text editor, then it is typically a paragraph (or perhaps something less than that). This routine allows communication from the imager to higher-level interactor software about what areas of the text will need to be redrawn when changes to localized regions of the text occur.

TextImager::GetStartOfNextRowFromRowContainingPosition [public]

size_t TextImager::GetStartOfNextRowFromRowContainingPosition (size_t charPosition) const

Returns the marker position of the start of the row following the row which contains the given marker position. If the given marker position is already in the last row, then it returns the start of that last row. So the result could posibly be less than the initial value.

The reason for this apparantly obscure API is that marker positions allow you to name rows in a way which doesn't involve word-wrapping (row numbers would). And yet this code doesn't assume use of MultiRowTextImager, or any of its data structures (so these APIs can be used in things like TextInteractor).

TextImager::GetStartOfPrevRowFromRowContainingPosition [public]

size_t TextImager::GetStartOfPrevRowFromRowContainingPosition (size_t charPosition) const

Returns the marker position of the start of the row preceeding the row which contains the given marker position, or the beginning of the buffer, if none preceed it.

See the docs for TextImager::GetStartOfNextRowFromRowContainingPosition for insight into how to use this API.

TextImager::GetStartOfRow [public]

virtual size_t GetStartOfRow (size_t rowNumber) const = 0;

GetStartOfRow () returns the position BEFORE the first displayed character in the row.

TextImager::GetStartOfRowContainingPosition [public]

virtual size_t GetStartOfRowContainingPosition (size_t charPosition) const = 0;

TextImager::GetTabStopList [public]

const TextImager::TabStopList& TextImager::GetTabStopList (size_t /*containingPos*/) const

Return the tabstop list (TextImager::TabStopList) active at a particular position in the text. Typically this will apply to an entire region (often a paragraph/partitionmarker). And we only need specify one point in that range.

Override this to provide a different tabstop list. The default is a TextImager::SimpleTabStopList of width roughly 1/3 of an inch.

TextImager::GetTextBoundingRect [public]

Led_Rect TextImager::GetTextBoundingRect (size_t fromMarkerPos, size_t toMarkerPos) const

GetTextBoundingRect () return a Rect which bounds the characters defined by the given marker positions. The will fit nicely around the characters if they all fit in one row, but may have sluff around the left/right sides if the range crosses row boundaries (since the shape wouldn't be a rectangle, but a region - try GetSelectionWindowRegion () for that).

This function operates in GLOBAL coordinates (ie not window relative, calling TextImager::GetCharLocation).

This function operates on CharacterCells.

See TextImager::GetTextWindowBoundingRect

TextImager::GetTextWindowBoundingRect [public]

Led_Rect TextImager::GetTextWindowBoundingRect (size_t fromMarkerPos, size_t toMarkerPos) const

GetTextWindowBoundingRect () return a Rect which bounds the characters defined by the given marker positions. The will fit nicely around the characters if they all fit in one row, but may have sluff around the left/right sides if the range crosses row boundaries (since the shape wouldn't be a rectangle, but a region - try GetSelectionWindowRegion () for that).

This function operates on CharacterCells.

This function operates in Window coordinates (ie window relative, calling TextImager::GetCharWindowLocation).

See also TextImager::GetTextBoundingRect, and TextImager::GetIntraRowTextWindowBoundingRect

TextImager::GetTopRowInWindow [public]

virtual size_t GetTopRowInWindow () const = 0;

Returns the row number of the top row visible in the scrolled display window. This is a generally ineffient routine to call. It is generally much better to call TextImager::GetMarkerPositionOfStartOfWindow

TextImager::GetTotalRowsInWindow [public]

virtual size_t GetTotalRowsInWindow () const = 0;

TextImager::GetWindowRect [public]

Led_Rect TextImager::GetWindowRect () const

Returns the WindowRect associated with this TextImager. The WindowRect is essentially two things. Its origin specifies the offset mapping applied to all coordinate transformations before GDI output (and typically in TextInteractors UI input). And its Size dictate the size of the current window, used for deciding how much to draw, and scrolling operations.

You can logically think of this - in Win32 SDK terminology - as the 'client rect'. In MacOS SDK terms, its close to the 'portRect' - its the same if you presume you are already focused, or that your text editor view takes up the entire window.

TextImager::HilightARectangle [public]

void TextImager::HilightARectangle (Led_Tablet tablet, Led_Rect hiliteRect)

Hilight the given rectangle of the screen, after its been drawn. This is typically done via some sort of pixel or color invesion. The default implemtation uses Led_Tablet_::HilightARectangle_SolidHelper.

Override this mostly if you want different hilighting behavior, or if you want your hilighting behavior to remain in sync with other changes to the EraseBackground behavior.

TextImager::MeasureSegmentWidth_ [public]

void TextImager::MeasureSegmentWidth_ (const Led_FontSpecification& fontSpec, size_t from, size_t to,

Helper function to access tablet text measurement.

The 'from' and 'to' marker positions are ignored, except to compute the width. There is no requirement that the 'text' argument refer to the same text as that stored in the TextStore object.

See also TextImager::DrawSegment_.

TextImager::PatchWidthRemoveMappedDisplayCharacters [public]

void TextImager::PatchWidthRemoveMappedDisplayCharacters (const Led_tChar* /*srcText*/, Led_Distance* /*distanceResults*/, size_t /*nTChars*/) const

Override this to specify any characters which should be removed at the last minute for display purposes only. This particular function patches the distanceResults to zero out the removed characters. This can be used to give a (simple to implement) way to hide some special characters.

For example, this technique can be used to implement SHIFT-RETURN soft line breaks (as is done in WordWrappedTextImager::RemoveMappedDisplayCharacters).

If you override this - you may find it handy to call TextImager::PatchWidthRemoveMappedDisplayCharacters_HelperForChar to do most of the work.

See also TextImager::ContainsMappedDisplayCharacters.

TextImager::PatchWidthRemoveMappedDisplayCharacters_HelperForChar [public]

void TextImager::PatchWidthRemoveMappedDisplayCharacters_HelperForChar (const Led_tChar* srcText, Led_Distance* distanceResults, size_t nTChars, Led_tChar charToRemove)

Simple implementation of See also TextImager::PatchWidthRemoveMappedDisplayCharacters which is frequently applicable. Just specify the special character you are looking to remove.

See also TextImager::ContainsMappedDisplayCharacters.

TextImager::PeekAtTextStore_ [public]

TextStore* TextImager::PeekAtTextStore_ () const

Return the TextStore associated with the given TextImager. Can return NULL.

TextImager::ReleaseTablet [public]

virtual void ReleaseTablet (Led_Tablet tablet) const = 0;

Tablet API

See TextImager::AcquireTablet. Generally don't call this directly - but instead use the TextImager::Tablet_Acquirer class.

TextImager::RemoveMappedDisplayCharacters [public]

size_t TextImager::RemoveMappedDisplayCharacters (Led_tChar* /*copyText*/, size_t nTChars) const

Override this to specify any characters which should be removed at the last minute for display purposes only. This can be used to give a (simple to implement) way to hide some special characters. For example, this technique can be used to implement SHIFT-RETURN soft line breaks (as is done in WordWrappedTextImager::RemoveMappedDisplayCharacters).

If you override this - you may find it handy to call TextImager::RemoveMappedDisplayCharacters_HelperForChar to do most of the work.

See also TextImager::ContainsMappedDisplayCharacters.

TextImager::RemoveMappedDisplayCharacters_HelperForChar [public]

size_t TextImager::RemoveMappedDisplayCharacters_HelperForChar (Led_tChar* copyText, size_t nTChars, Led_tChar charToRemove)

Simple implementation of See also TextImager::RemoveMappedDisplayCharacters which is frequently applicable. Just specify the special character you are looking to remove.

See also TextImager::ContainsMappedDisplayCharacters.

TextImager::ReplaceMappedDisplayCharacters [public]

void TextImager::ReplaceMappedDisplayCharacters (const Led_tChar* srcText, Led_tChar* copyText, size_t nTChars) const

Override this to specify any characters which should be mapped to different values at the last minute for display purposes only. This can be used to give a (simple to implement) funny display for particular special characters. For example, this technique can be used to make a NEWLINE character display as a special end-of-paragraph marker.

If you override this - you may find it handy to call TextImager::ReplaceMappedDisplayCharacters_HelperForChar to do most of the work.

See also TextImager::ContainsMappedDisplayCharacters.

TextImager::ReplaceMappedDisplayCharacters_HelperForChar [public]

void TextImager::ReplaceMappedDisplayCharacters_HelperForChar (Led_tChar* copyText, size_t nTChars, Led_tChar charToMap, Led_tChar charToMapTo)

Simple implementation of See also TextImager::ReplaceMappedDisplayCharacters_HelperForChar which is frequently applicable. Just specify the special character you are looking for, and the one you are mapping to.

See also TextImager::ContainsMappedDisplayCharacters.

TextImager::ScrollByIfRoom [public]

virtual void ScrollByIfRoom (long downByRows) = 0;

If downBy negative then up OK to ask to scroll further than allowed - return true if any scrolling (not necesarily same amont requested) done

TextImager::ScrollSoShowing [public]

virtual void ScrollSoShowing (size_t markerPos, size_t andTryToShowMarkerPos = 0) = 0;

If andTryToShowMarkerPos == 0, then just try to show the characters after markerPos. If it is NOT zero, then try to show the characters BETWEEN the two marker positions (note they might not be in ascending order). The (argument) order of the two marker positions determines PREFERENCE. That is - if there is no room to show both, be sure the first is showing.

TextImager::ScrollSoShowingHHelper [public]

void TextImager::ScrollSoShowingHHelper (size_t markerPos, size_t andTryToShowMarkerPos)

You probably should NOT call this directly. This is a helper to share code in implementing TextImager::ScrollSoShowing in subclasses.

TextImager::SetDefaultTextColor [public]

void TextImager::SetDefaultTextColor (DefaultColorIndex dci, const Led_Color& textColor)

Sets the given indexed default text color attribute. The effect of this is to override the behavior of TextImager::GetEffectiveDefaultTextColor.

See also

TextImager::SetForceAllRowsShowing [public]

void TextImager::SetForceAllRowsShowing (bool forceAllRowsShowing)

See TextImager::GetForceAllRowsShowing.

TextImager::SetImageUsingOffscreenBitmaps [public]

void TextImager::SetImageUsingOffscreenBitmaps (bool imageUsingOffscreenBitmaps)

See TextImager::GetForceAllRowsShowing.

TextImager::SetTopRowInWindow [public]

virtual void SetTopRowInWindow (size_t newTopRow) = 0;

TextImager::SpecifyTextStore [public]

void TextImager::SpecifyTextStore (TextStore* useTextStore)

Associate this TextImager with the given TextStore.

Note that this will - as a side-effect - call TextStore::AddMarkerOwner. So be sure that this TextImager has not yet been added as a MarkerOwner for any other (or this given) TextStore.

TextImager::TabletChangedMetrics [public]

void TextImager::TabletChangedMetrics ()

Call this method when something external, Led cannot detect, has happened to the tablet which would invalidate any information the TextImager has cached. This is called automaticly, internal to Led, by anything Led knows about which would change the metrics (eg. MultiRowTextImager::SetDefaultFont_).


Class: TextImager::NoTabletAvailable [public]

Base Classes: TextImager::NotFullyInitialized
Description:

Thrown by TextImager::AcquireTablet when no tablet available. See that method docs for more details.


Class: TextImager::NotFullyInitialized [public]

Description:

Led requires a complex of objects to all be setup, and hooked together in order to perform several operations correctly. E.G. to invalidate part of the screen, it must indirectly call on code to check the TextStore, or the Partition.

As part of code re-use, during the setup process, and part of the mechanism of providing default objects for many of these peices, we call SetThisOrThat() methods which invoke various InvalidateThisOrThat() methods, which in turn may occasionally try to compute something (like the max# of rows in a line). These sorts of errors are innocuous, but must be handled somehow. We could either write the code to be friendly of such uninitiualized variables/values, or to throw like this. My inclination is that throwing will be a more robust solution, since it will prevent an further use of a guessed value (and maybe prevent its being cached).


Class: TextImager::SimpleTabStopList [public]

Base Classes: TextImager::TabStopList
Description:

A simple tabstop implementation in which all tabstops are equidistant from each other, and start at position zero. This is commonly used as the default tabstop object.


Class: TextImager::StandardTabStopList [public]

Base Classes: TextImager::TabStopList
Description:

A simple tabstop implementation in the caller specifies the exact position of each tabstop. This is most directly ananogous to the Win32SDK GetTabbedTextExtent () API apporach.


Class: TextImager::TabStopList [public]

Description:

See Led_TabStopList

Member Details

TextImager::TabStopList::ComputeIthTab [public]

virtual Led_TWIPS ComputeIthTab (size_t i) const = 0;

Compute where the 'ith' tabstop lies (i >= 0, and can be arbitrarily high). Note that though tabstop i=0 is the first tabstop (which by convention is usually NOT at the left margin - but is really the logically 'first' one).

Note - this used to return Led_Distance - but in Led 3.0 - it changed to returning TWIPS (see SPR#0767);

TextImager::TabStopList::ComputeTabStopAfterPosition [public]

virtual Led_TWIPS ComputeTabStopAfterPosition (Led_TWIPS afterPos) const = 0;

Given a distance from the left margin, find the immediately following tabstops position. This is what is actaully used in the imagers to compute where to draw text. It can logically be implemented by walking the tabstoplist and calling TextImager::TabStopList::ComputeIthTab, and returning the next one after the one past(or equal to) afterPos.

Note - this used to take/return Led_Distance - but in Led 3.0 - it changed to take/return TWIPS (see SPR#0767);

Now there is an overloaded version using Led_Distance that takes a Led_Tablet as argument.


Class: TextImager::Tablet_Acquirer [public]

Description:

Stack-based resource allocation/deallocation. See TextImager::AcquireTablet.


Class: TrivialImager < TEXTSTORE,IMAGER > [public]

Description:

Handy little template, if you want to use the power of Led, but just to wrap a particular imager, in a localized, one-time fasion, say todo printing, or some such. Not for interactors.

Depending on the IMAGER you wish to use, you may want to try TrivialImager_Interactor or TrivialWordWrappedImager - both of which come with examples of their use.

Member Details

TrivialImager < TEXTSTORE,IMAGER > ::SnagAttributesFromTablet [public]

void TrivialImager < TEXTSTORE,IMAGER > ::SnagAttributesFromTablet ()

Snag font, background color etc, from the currently associated tablet.

Since this calls virtual methods of the imager (this) - it must be called in the final CTOR (most specific type). Really it shouldnt need to be THE most specific - just enough specific to get the right vritual methods called. But because of MSVC compiler bugs - its generally best to be THE final CTOR.

TrivialImager < TEXTSTORE,IMAGER > ::TrivialImager [public]

TrivialImager < TEXTSTORE,IMAGER > ::TrivialImager (Led_Tablet t):

Two overloaded versions - one protected, and the other public. The protected one does NOT call TrivialImager::SnagAttributesFromTablet - so you must in your subclass.


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