Squeak Class Documentation category index | class index  
 
CharacterBlockScanner
  category: Graphics-Text
  superclass: CharacterScanner
  subclasses:

My instances are used to scan text to compute the CharacterBlock for a character specified by its index in the text or its proximity to the cursor location.

instance methods
  private
  buildCharacterBlockIn:
characterPointSetX:
lastCharacterExtentSetX:
lastSpaceOrTabExtentSetX:

  scanning
  characterBlockAtPoint:in:
characterBlockAtPoint:index:in:
characterBlockForIndex:in:
characterNotInFont
indentationLevel:
placeEmbeddedObject:

  stop conditions
  cr
crossedX
endOfRun
paddedSpace
setFont
setStopConditions
tab

class methods
  no messages
 

instance methods
  private top  
 

buildCharacterBlockIn:

handle nullText


 

characterPointSetX:


 

lastCharacterExtentSetX:


 

lastSpaceOrTabExtentSetX:


  scanning top  
 

characterBlockAtPoint:in:

Answer a CharacterBlock for character in aParagraph at point aPoint. It
is assumed that aPoint has been transformed into coordinates appropriate
to the text's destination form rectangle and the composition rectangle.


 

characterBlockAtPoint:index:in:

This method is the Morphic characterBlock finder. It combines
MVC's characterBlockAtPoint:, -ForIndex:, and buildCharcterBlock:in:


 

characterBlockForIndex:in:

Answer a CharacterBlock for character in aParagraph at targetIndex. The
coordinates in the CharacterBlock will be appropriate to the intersection
of the destination form rectangle and the composition rectangle.


 

characterNotInFont

See the note in CharacterScanner>>characterNotInFont.
This does not handle character selection nicely, i.e., illegal characters are a
little tricky to select. Since the end of a run or line is subverted here by actually
having the scanner scan a different string in order to manage the illegal
character, things are not in an absolutely correct state for the character
location code. If this becomes too odious in use, logic will be added to accurately
manage the situation.


 

indentationLevel:

set the number of tabs to put at the beginning of each line


 

placeEmbeddedObject:

Place the anchoredMorph or return false if it cannot be placed.
In any event, advance destX by its width.


  stop conditions top  
 

cr

Answer a CharacterBlock that specifies the current location of the mouse
relative to a carriage return stop condition that has just been
encountered. The ParagraphEditor convention is to denote selections by
CharacterBlocks, sometimes including the carriage return (cursor is at
the end) and sometimes not (cursor is in the middle of the text).


 

crossedX

Text display has wrapping. The scanner just found a character past the x
location of the cursor. We know that the cursor is pointing at a character
or before one.


 

endOfRun

Before arriving at the cursor location, the selection has encountered an
end of run. Answer false if the selection continues, true otherwise. Set
up indexes for building the appropriate CharacterBlock.


 

paddedSpace

When the line is justified, the spaces will not be the same as the font's
space character. A padding of extra space must be considered in trying
to find which character the cursor is pointing at. Answer whether the
scanning has crossed the cursor.


 

setFont

Set the font and other emphasis.


 

setStopConditions

Set the font and the stop conditions for the current run.


 

tab


class methods
  no messages top