Squeak Class Documentation category index | class index  
 
ParagraphEditor
  category: Kernel-ST80 Remnants
  superclass: ScrollController
  subclasses: TextMorphEditor StringHolderController

I am a Controller for editing a Paragraph. I am a kind of ScrollController, so that more text can be created for the Paragraph than can be viewed on the screen. Editing messages are sent by issuing commands from a yellow button menu or from keys on the keyboard. My instances keep control as long as the cursor is within the view when the red or yellow mouse button is pressed; they give up control if the blue button is pressed.

instance methods
  accessing
  initialText
replace:with:and:
replaceSelectionWith:
selection
selectionAsStream
selectionInterval
setSearch:
text
userHasEdited
zapSelectionWith:

  as yet unclassified
  totalTextHeight
visibleHeight

  controlling
  controlInitialize
controlTerminate
normalActivity

  current selection
  deselect
initializeSelection
recomputeInterval
recomputeSelection
reverseSelection
select
selectAndScroll
selectAndScrollToTop

  displaying
  display
flash

  do-its
  compileSelectionFor:in:
debug:receiver:in:
debugIt
doIt
evaluateSelection
exploreIt
inspectIt
objectsReferencingIt
printIt

  editing keys
  align:
browseIt:
browseItHere:
cancel:
changeEmphasis:
changeLfToCr:
chooseColor
compareToClipboard:
copyHiddenInfo
copySelection:
cut:
doIt:
duplicate:
enclose:
exchange:
exploreIt:
fileItIn:
hiddenInfo
implementorsOfIt:
inOutdent:delta:
indent:
inspectIt:
makeCapitalized:
makeLowercase:
makeProjectLink:
makeUppercase:
methodNamesContainingIt:
methodStringsContainingIt:
noop:
offerFontMenu
offerFontMenu:
outdent:
paste:
pasteInitials:
printIt:
recognizer:
referencesToIt:
save:
sendersOfIt:
setEmphasis:
shiftEnclose:
spawnIt:
swapChars:
tempCommand:
undo:

  explain
  explainAnySel:
explainChar:
explainClass:
explainCtxt:
explainDelimitor:
explainGlobal:
explainInst:
explainMySel:
explainNumber:
explainPartSel:
explainScan:
explainTemp:

  initialize-release
  changeParagraph:
resetState
stateArray
stateArrayPut:

  menu messages
  accept
again
align
browseChangeSetsWithSelector
browseClassFromIt
browseIt
browseItHere
cancel
changeAlignment
changeEmphasis
changeEmphasisOrAlignment
changeStyle
changeStyleTo:
chooseAlignment
classCommentsContainingIt
clipboardText
clipboardText:
clipboardTextPut:
compareToClipboard
copySelection
cut
exchange
experimentalCommand
explain
fileItIn
find
findAgain
fit
implementorsOfIt
languagePrefs
lineSelectAndEmptyCheck:
methodNamesContainingIt
methodSourceContainingIt
methodStringsContainingit
mvcRedisplay
paste
pasteRecent
performMenuMessage:
presentSpecialMenu
prettyPrint
prettyPrint:
prettyPrintWithColor
printerSetup
referencesToIt
saveContentsInFile
selectedSelector
selectedSymbol
selectionAsTiles
sendContentsToPrinter
sendersOfIt
setSearchString
spawn
spawnWorkspace
specialMenuItems
translateIt
undo
verifyWordSpelling
wordDefinition

  new selection
  afterSelectionInsertAndSelect:
computeIntervalFrom:to:
correctFrom:to:with:
insertAndSelect:at:
nextTokenFrom:direction:
notify:at:in:
selectAt:
selectFrom:to:
selectInterval:
selectInvisiblyFrom:to:
selectLine
selectPrecedingIdentifier
selectWord

  nonediting/nontyping keys
  comment
cursorDown:
cursorEnd:
cursorHome:
cursorLeft:
cursorPageDown:
cursorPageJump:down:
cursorPageUp:
cursorRight:
cursorUp:
escapeToDesktop:
raiseContextMenu:
selectCurrentTypeIn:
selectWord:
setSearchString:

  private
  againOnce:
againOrSame:
againOrSame:many:
completeSymbol:lastOffering:
exchangeWith:
getPluggableYellowButtonMenu:
indent:fromStream:toStream:
isDisjointFrom:
nextWord:
nullText
previousWord:

  scrolling
  computeMarkerRegion
markerDelta
scrollAmount
scrollBar
scrollBy:
scrollRectangleHeight
scrollToBottom
scrollToTop
scrollView:
updateMarker
viewDelta

  sensor access
  processBlueButton
processKeyboard
processMouseButtons
processRedButton
processYellowButton

  typing support
  backTo:
closeTypeIn
closeTypeIn:
dispatchOnCharacter:with:
dispatchOnEnterWith:
doneTyping
insertTypeAhead:
openTypeIn
readKeyboard
recognizeCharacters
recognizeCharactersWhileMouseIn:
setEmphasisHere
simulatedKeystroke:
startOfTyping

  typing/selecting keys
  argAdvance:
backWord:
backspace:
changeStyle:
crWithIndent:
cursorTopHome:
displayIfFalse:
displayIfTrue:
doAgainMany:
doAgainOnce:
find:
findAgain:
forwardDelete:
normalCharacter:
querySymbol:
search:
selectAll
selectAll:
simulatedBackspace

  undo support
  isDoing
isRedoing
isUndoing
noUndoer
undoMessage:forRedo:
undoer:
undoer:with:
undoer:with:with:
undoer:with:with:with:

  undoers
  undoAgain:andReselect:typedKey:
undoAndReselect:redoAndReselect:
undoCutCopy:
undoQuery:lastOffering:
undoReplace

class methods
  class initialization
  abandonChangeText
initialize
initializeTextEditorMenus
shiftedYellowButtonMenu
yellowButtonMenu
yellowButtonMessages

  clipboard access
 

  instance creation
  new
newParagraph:

  keyboard shortcut tables
  initializeCmdKeyShortcuts
initializeShiftCmdKeyShortcuts
specialShiftCmdKeys

instance methods
  accessing top  
 

initialText


 

replace:with:and:

Replace the text in oldInterval with newText and execute selectingBlock to establish the new selection. Create an undoAndReselect:redoAndReselect: undoer to allow perfect undoing.


 

replaceSelectionWith:

Remember the selection text in UndoSelection.
Deselect, and replace the selection text by aText.
Remember the resulting selectionInterval in UndoInterval and PriorInterval.
Set up undo to use UndoReplace.


 

selection

Answer the text in the paragraph that is currently selected.


 

selectionAsStream

Answer a ReadStream on the text in the paragraph that is currently
selected.


 

selectionInterval

Answer the interval that is currently selected.


 

setSearch:

Set the FindText and ChangeText to seek aString; except if already seeking aString, leave ChangeText alone so again will repeat last replacement.


 

text

Answer the text of the paragraph being edited.


 

userHasEdited

Note that the user has edited my text. Here it is just a noop so that the Character Recognizer won't fail when used with a vanilla ParagrahEditor.


 

zapSelectionWith:

Deselect, and replace the selection text by aText.
Remember the resulting selectionInterval in UndoInterval and otherInterval.
Do not set up for undo.


  as yet unclassified top  
 

totalTextHeight


 

visibleHeight


  controlling top  
 

controlInitialize

Recompute scroll bars. Save underlying image unless it is already saved.


 

controlTerminate

Provide a place in the standard control sequence for terminating the
receiver (taking into account the current state of its model and view). It
should be redefined in subclasses to perform some specific action.


 

normalActivity


  current selection top  
 

deselect

If the text selection is visible on the screen, reverse its highlight.


 

initializeSelection

Do the initial activity when starting up the receiver. For example, in the
ParagraphEditor highlight the current selection.


 

recomputeInterval

The same characters are selected but their coordinates may have changed.


 

recomputeSelection

Redetermine the selection according to the start and stop block indices;
do not highlight.


 

reverseSelection

Reverse the valence of the current selection highlighting.


 

select

If the text selection is visible on the screen, highlight it.


 

selectAndScroll

Scroll until the selection is in the view and then highlight it.


 

selectAndScrollToTop

Scroll until the selection is in the view and then highlight it.


  displaying top  
 

display

Redisplay the paragraph.


 

flash

Causes the view of the paragraph to complement twice in succession.


  do-its top  
 

compileSelectionFor:in:


 

debug:receiver:in:


 

debugIt


 

doIt

Set the context to include pool vars of the model. Then evaluate.


 

evaluateSelection

Treat the current selection as an expression; evaluate it and return the result


 

exploreIt


 

inspectIt

1/13/96 sw: minor fixup


 

objectsReferencingIt

Open a list inspector on all objects that reference the object that results when the current selection is evaluated.


 

printIt

Treat the current text selection as an expression; evaluate it. Insert the
description of the result of evaluation after the selection and then make
this description the new text selection.


  editing keys top  
 

align:

Triggered by Cmd-u; cycle through alignment alternatives. 8/11/96 sw


 

browseIt:

Triggered by Cmd-B; browse the thing represented by the current selection, if plausible. 1/18/96 sw


 

browseItHere:

Triggered by Cmd-shift-B; browse the thing represented by the current selection, if plausible, in the receiver's own window. 3/1/96 sw


 

cancel:

Cancel unsubmitted changes. Flushes typeahead. 1/12/96 sw
1/22/96 sw: put in control terminate/init


 

changeEmphasis:

Change the emphasis of the current selection or prepare to accept characters with the change in emphasis. Emphasis change amounts to a font change. Keeps typeahead.


 

changeLfToCr:

Replace all LFs by CRs.
Triggered by Cmd-U -- useful when getting code from FTP sites


 

chooseColor

Make a new Text Color Attribute, let the user pick a color, and return the attribute. This is the non-Morphic version.


 

compareToClipboard:

Compare the receiver to the text on the clipboard. Flushes typeahead. 5/1/96 sw


 

copyHiddenInfo

In TextLinks, TextDoits, TextColor, and TextURLs, there is hidden
info. Copy that to the clipboard. You can paste it and see what it is.
Usually enclosed in <>.


 

copySelection:

Copy the current text selection. Flushes typeahead.


 

cut:

Cut out the current text selection. Flushes typeahead.


 

doIt:

Called when user hits cmd-d. Select the current line, if relevant, then evaluate and execute. 2/1/96 sw.
2/29/96 sw: don't call selectLine; it's done by doIt now


 

duplicate:

Paste the current selection over the prior selection, if it is non-overlapping and
legal. Flushes typeahead. Undoer & Redoer: undoAndReselect.


 

enclose:

Insert or remove bracket characters around the current selection.
Flushes typeahead.


 

exchange:

Exchange the current and prior selections. Keeps typeahead.


 

exploreIt:

Explore the selection -- invoked via cmd-shift-I. If there is no current selection, use the current line.


 

fileItIn:

File in the selection; invoked via a keyboard shortcut, -- for now, cmd-shift-G.


 

hiddenInfo

In TextLinks, TextDoits, TextColor, and TextURLs, there is hidden info. Return the entire string that was used by Cmd-6 to create this text attribute. Usually enclosed in < >.


 

implementorsOfIt:

Triggered by Cmd-m; browse implementors of the selector represented by the current selection, if plausible. 2/1/96 sw


 

inOutdent:delta:

Add/remove a tab at the front of every line occupied by the selection. Flushes typeahead. Derived from work by Larry Tesler back in December 1985. Now triggered by Cmd-L and Cmd-R. 2/29/96 sw


 

indent:

Add a tab at the front of every line occupied by the selection. Flushes typeahead. Invoked from keyboard via cmd-shift-R. 2/29/96 sw


 

inspectIt:

Inspect the selection -- invoked via cmd-i. If there is no current selection, use the current line. 1/17/96 sw
2/29/96 sw: don't call selectLine; it's done by inspectIt now


 

makeCapitalized:

Force the current selection to uppercase. Triggered by Cmd-X.


 

makeLowercase:

Force the current selection to lowercase. Triggered by Cmd-X.


 

makeProjectLink:


 

makeUppercase:

Force the current selection to uppercase. Triggered by Cmd-X.


 

methodNamesContainingIt:

Browse methods whose selectors containing the selection in their names


 

methodStringsContainingIt:

Invoked from cmd-E -- open a browser on all methods holding string constants containing it. Flushes typeahead.


 

noop:

Unimplemented keyboard command; just ignore it.


 

offerFontMenu

Present a menu of available fonts, and if one is chosen, apply it to the current selection.
Use only names of Fonts of this paragraph


 

offerFontMenu:

The user typed the command key that requests a font change; Offer the font menu. 5/27/96 sw
Keeps typeahead. (?? should flush?)


 

outdent:

Remove a tab from the front of every line occupied by the selection. Flushes typeahead. Invoked from keyboard via cmd-shift-L. 2/29/96 sw


 

paste:

Replace the current text selection by the text in the shared buffer.
Keeps typeahead.


 

pasteInitials:

Replace the current text selection by an authorship name/date stamp; invoked by cmd-shift-v, easy way to put an authorship stamp in the comments of an editor.
Keeps typeahead.


 

printIt:

Print the results of evaluting the selection -- invoked via cmd-p. If there is no current selection, use the current line. 1/17/96 sw
2/29/96 sw: don't call selectLine now, since it's called by doIt


 

recognizer:

Invoke Alan's character recognizer from cmd-r 2/2/96 sw


 

referencesToIt:

Triggered by Cmd-N; browse references to the current selection


 

save:

Submit the current text. Equivalent to 'accept' 1/18/96 sw
Keeps typeahead.


 

sendersOfIt:

Triggered by Cmd-n; browse implementors of the selector represented by the current selection, if plausible. 2/1/96 sw


 

setEmphasis:

Change the emphasis of the current selection.


 

shiftEnclose:

Insert or remove bracket characters around the current selection.
Flushes typeahead.


 

spawnIt:

Triggered by Cmd-o; spawn a new code window, if it makes sense.


 

swapChars:

Triggered byCmd-Y;. Swap two characters, either those straddling the insertion point, or the two that comprise the selection. Suggested by Ted Kaehler.


 

tempCommand:

Experimental. Triggered by Cmd-t; put trial cmd-key commands here to see how they work, before hanging them on their own cmd accelerators.


 

undo:

Undo the last edit. Keeps typeahead, so undo twice is a full redo.


  explain top  
 

explainAnySel:

Is this any message selector?


 

explainChar:

Does string start with a special character?


 

explainClass:

Is symbol a class variable or a pool variable?


 

explainCtxt:

Is symbol a context variable?


 

explainDelimitor:

Is string enclosed in delimitors?


 

explainGlobal:

Is symbol a global variable?


 

explainInst:

Is string an instance variable of this class?


 

explainMySel:

Is symbol the selector of this method? Is it sent by this method? If
not, then expalin will call (explainPartSel:) to see if it is a fragment of a
selector sent here. If not, explain will call (explainAnySel:) to catch any
selector.


 

explainNumber:

Is string a Number?


 

explainPartSel:

Is this a fragment of a multiple-argument selector sent in this method?


 

explainScan:

Remove beginning and trailing space, tab, cr.
1/15/96 sw: copied intact from BrowserCodeController


 

explainTemp:

Is string the name of a temporary variable (or block argument variable)?


  initialize-release top  
 

changeParagraph:

Install aParagraph as the one to be edited by the receiver.


 

resetState

Establish the initial conditions for editing the paragraph: place caret
before first character, set the emphasis to that of the first character,
and save the paragraph for purposes of canceling.


 

stateArray


 

stateArrayPut:


  menu messages top  
 

accept

Save the current text of the text being edited as the current acceptable version for purposes of canceling.


 

again

Text substitution. If the left shift key is down, the substitution is made
throughout the entire Paragraph. Otherwise, only the next possible
substitution is made.
Undoer & Redoer: #undoAgain:andReselect:typedKey:.


 

align

Align text according to the next greater alignment value--cycling among
left flush, right flush, center, justified. No effect on the undoability of the pre
preceding command.


 

browseChangeSetsWithSelector

Determine which, if any, change sets have at least one change for the selected selector, independent of class


 

browseClassFromIt

Launch a hierarchy browser for the class indicated by the current selection. If multiple classes matching the selection exist, let the user choose among them.


 

browseIt

Launch a browser for the current selection, if appropriate


 

browseItHere

Retarget the receiver's window to look at the selected class, if appropriate. 3/1/96 sw


 

cancel

Restore the text of the paragraph to be the text saved since initialization
or the last accept. Undoer & Redoer: undoAndReselect:redoAndReselect:.
This used to call controlTerminate and controlInitialize but this seemed illogical.
Sure enough, nobody overrode them who had cancel in the menu, and if
anybody really cared they could override cancel.


 

changeAlignment


 

changeEmphasis


 

changeEmphasisOrAlignment


 

changeStyle

Let user change styles for the current text pane
Moved from experimentalCommand to its own method


 

changeStyleTo:


 

chooseAlignment


 

classCommentsContainingIt

Open a browser class comments which contain the current selection somewhere in them.


 

clipboardText


 

clipboardText:


 

clipboardTextPut:


 

compareToClipboard

Check to see if whether the receiver's text is the same as the text currently on the clipboard, and inform the user.


 

copySelection

Copy the current selection and store it in the paste buffer, unless a caret. Undoer & Redoer: undoCutCopy


 

cut

Cut out the current selection and redisplay the paragraph if necessary. Undoer & Redoer: undoCutCopy:


 

exchange

See comment in exchangeWith:


 

experimentalCommand

Use for experimental command-key implementation. Using this,
you can try things out without forever needing to reinitialize the
ParagraphEditor.


 

explain

Try to shed some light on what kind of entity the current selection
is.
The selection must be a single token or construct. Insert the answer
after
the selection. Send private messages whose names begin with 'explain'
that return a string if they recognize the selection, else nil.


 

fileItIn

Make a Stream on the text selection and fileIn it.
1/24/96 sw: moved here from FileController; this function can be useful from any text window that shows stuff in chunk format


 

find

Prompt the user for a string to search for, and search the receiver from the current selection onward for it. 1/26/96 sw


 

findAgain

Find the text-to-find again. 1/24/96 sw


 

fit

Make the bounding rectangle of the paragraph contain all the text while
not changing the width of the view of the paragraph. No effect on undoability
of the preceding command.


 

implementorsOfIt

Open an implementors browser on the selected selector


 

languagePrefs

Lets user set preference for primary natural language and languages to translate from and to. Preferences naturalLanguage. Preferences languageTranslateFrom.


 

lineSelectAndEmptyCheck:

If the current selection is an insertion point, expand it to be the entire current line; if after that's done the selection is still empty, then evaluate the returnBlock, which will typically consist of '[^ self]' in the caller -- check senders of this method to understand this.


 

methodNamesContainingIt

Open a browser on methods names containing the selected string


 

methodSourceContainingIt

Open a browser on methods which contain the current selection in their source (case-sensitive full-text search of source). EXTREMELY slow!


 

methodStringsContainingit

Open a browser on methods which contain the current selection as part of a string constant.


 

mvcRedisplay

Overridable by subclasses that do their own display


 

paste

Paste the text from the shared buffer over the current selection and
redisplay if necessary. Undoer & Redoer: undoAndReselect.


 

pasteRecent

Paste an item chose from RecentClippings.


 

performMenuMessage:

If a menu command is invoked, typeIn must be closed first, the selection
must be unhighlighted before and rehighlighted after, and the marker
must be updated.


 

presentSpecialMenu

Present a list of expressions, and if the user chooses one, evaluate it in the context of the receiver, a ParagraphEditor. Primarily for debugging, this provides a convenient way to talk to the various views, controllers, and models associated with any text pane


 

prettyPrint


 

prettyPrint:

Reformat the contents of the receiver's view (a Browser).


 

prettyPrintWithColor


 

printerSetup


 

referencesToIt

Open a references browser on the selected symbol


 

saveContentsInFile


 

selectedSelector

Try to make a selector out of the current text selection


 

selectedSymbol

Return the currently selected symbol, or nil if none. Spaces, tabs and returns are ignored


 

selectionAsTiles

Try to make new universal tiles from the selected text


 

sendContentsToPrinter


 

sendersOfIt

Open a senders browser on the selected selector


 

setSearchString

Make the current selection, if any, be the current search string.


 

spawn

Create and schedule a message browser for the code of the model's
selected message. Retain any edits that have not yet been accepted.


 

spawnWorkspace


 

specialMenuItems

Refer to comment under #presentSpecialMenu. .
: added objectsReferencingIt,


 

translateIt

Translate a passage of text and open its definition in a separate window. Use the FreeTranslation.com server. Requires internet access. Default is English-> Spanish, but set it with the 'choose language' menu item.


 

undo

Reset the state of the paragraph prior to the previous edit.
If another ParagraphEditor instance did that edit, UndoInterval is invalid;
just recover the contents of the undo-buffer at the start of the paragraph.


 

verifyWordSpelling

Look up a single word and inform the user if it was found. Use the WordNet server. Requires internet access. Default is English, but set it like this
Preferences setPreference: #naturalLanguage toValue: #Deutsch.


 

wordDefinition

Look up a single word and open its definition in a separate window. Use the WordNet server. Requires internet access. Default is English, but set it like this
Preferences setPreference: #naturalLanguage toValue: #Portuguese.


  new selection top  
 

afterSelectionInsertAndSelect:


 

computeIntervalFrom:to:

Select the designated characters, inclusive. Make no visual changes.


 

correctFrom:to:with:

Make a correction in the model that the user has authorised from somewhere else in the system (such as from the compilier). The user's selection is not changed, only corrected.


 

insertAndSelect:at:


 

nextTokenFrom:direction:

simple token-finder for compiler automated corrections


 

notify:at:in:

The compilation of text failed. The syntax error is noted as the argument,
aString. Insert it in the text at starting character position anInteger.


 

selectAt:

Deselect, then place the caret before the character at characterIndex.
Be sure it is in view.


 

selectFrom:to:

Deselect, then select the specified characters inclusive.
Be sure the selection is in view.


 

selectInterval:

Deselect, then select the specified characters inclusive.
Be sure the selection is in view.


 

selectInvisiblyFrom:to:

Select the designated characters, inclusive. Make no visual changes.


 

selectLine

Make the receiver's selection, if it currently consists of an insertion point only, encompass the current line.


 

selectPrecedingIdentifier

Invisibly select the identifier that ends at the end of the selection, if any.


 

selectWord

Select delimited text or word--the result of double-clicking.


  nonediting/nontyping keys top  
 

comment

All key actions that are neither editing nor typing actions have to
send closeTypeIn at first. See comment in openTypeIn closeTypeIn


 

cursorDown:

Private - Move cursor from position in current line to same position in
next line. If next line too short, put at end. If shift key down,
select.


 

cursorEnd:

Private - Move cursor end of current line. If cursor already at end of
line, put cursor at end of text


 

cursorHome:

Private - Move cursor from position in current line to beginning of
current line. If cursor already at beginning of line, put cursor at
beginning of text


 

cursorLeft:

Private - Move cursor left one character if nothing selected, otherwise
move cursor to beginning of selection. If the shift key is down, start
selecting or extending current selection. Don't allow cursor past
beginning of text


 

cursorPageDown:


 

cursorPageJump:down:

Private - Move cursor from position in current line to same position in the line on the next page up or down (direction is controlled by <aBoolean>. If next line too short, put at end. If shift key down, select. This method is similar to #cursorDown:. Haven't figured out how to intercept the shift key yet.

See Utilities createPageTestWorkspace to create a test MVC workspace.


 

cursorPageUp:


 

cursorRight:

Private - Move cursor right one character if nothing selected,
otherwise move cursor to end of selection. If the shift key is down,
start selecting characters or extending already selected characters.
Don't allow cursor past end of text


 

cursorUp:

Private - Move cursor from position in current line to same position in
prior line. If prior line too short, put at end


 

escapeToDesktop:

Pop up a morph to field keyboard input in the context of the desktop


 

raiseContextMenu:

AFAIK, this is never called in morphic, because a subclass overrides it. Which is good, because a ParagraphEditor doesn't know about Morphic and thus duplicates the text-editing actions that really belong in the specific application, not the controller. So the context menu this would raise is likely to be out of date.


 

selectCurrentTypeIn:

Select what would be replaced by an undo (e.g., the last typeIn).


 

selectWord:


 

setSearchString:

Establish the current selection as the current search string.


  private top  
 

againOnce:

Find the next occurrence of FindText. If none, answer false.
Append the start index of the occurrence to the stream indices, and, if
ChangeText is not the same object as FindText, replace the occurrence by it.
Note that the search is case-sensitive for replacements, otherwise not.


 

againOrSame:

Subroutine of search: and again. If useOldKeys, use same FindText and ChangeText as before.
1/26/96 sw: real worked moved to againOrSame:many:


 

againOrSame:many:

Subroutine of search: and again. If useOldKeys, use same FindText and ChangeText as before. If many is true, do it repeatedly. Created 1/26/96 sw by adding the many argument to #againOrSame.


 

completeSymbol:lastOffering:

Invoked by Ctrl-q when there is only a caret.
Do selector-completion, i.e., try to replace the preceding identifier by a
selector that begins with those characters & has as many keywords as possible.
Leave two spaces after each colon (only one after the last) as space for
arguments. Put the caret after the space after the first keyword. If the
user types Ctrl-q again immediately, choose a different selector.
Undoer: #undoQuery:lastOffering:; Redoer: itself.
If redoing, just redisplay the last offering, selector[OrNil].


 

exchangeWith:

If the prior selection is non-overlapping and legal, exchange the text of
it with the current selection and leave the currently selected text selected
in the location of the prior selection (or leave a caret after a non-caret if it was
exchanged with a caret). If both selections are carets, flash & do nothing.
Don't affect the paste buffer. Undoer: itself; Redoer: Undoer.


 

getPluggableYellowButtonMenu:


 

indent:fromStream:toStream:

Append the contents of inStream to outStream, adding or deleting delta or -delta
tabs at the beginning, and after every CR except a final CR. Do not add tabs
to totally empty lines, and be sure nothing but tabs are removed from lines.


 

isDisjointFrom:

Answer true if anInterval is a caret not touching or within the current
interval, or if anInterval is a non-caret that does not overlap the current
selection.


 

nextWord:


 

nullText


 

previousWord:


  scrolling top  
 

computeMarkerRegion

Refer to the comment in ScrollController|computeMarkerRegion.


 

markerDelta


 

scrollAmount

Refer to the comment in ScrollController|scrollAmount.


 

scrollBar


 

scrollBy:

Move the paragraph by heightToMove, and reset the text selection.


 

scrollRectangleHeight


 

scrollToBottom

Scroll so that the tail end of the text is visible in the view. 5/6/96 sw


 

scrollToTop

Scroll so that the paragraph is at the top of the view.


 

scrollView:

Paragraph scrolling uses opposite polarity


 

updateMarker

A variation of computeMarkerRegion--only redisplay the marker in the scrollbar if an actual change has occurred in the positioning of the paragraph.


 

viewDelta

Refer to the comment in ScrollController|viewDelta.


  sensor access top  
 

processBlueButton

The user pressed the blue button on the mouse. Determine what action
to take.


 

processKeyboard

Determine whether the user pressed the keyboard. If so, read the keys.


 

processMouseButtons

Determine whether the user pressed any mouse button. For each possible
button, determine what actions to take.


 

processRedButton

The user pressed a red mouse button, meaning create a new text
selection. Highlighting the selection is carried out by the paragraph
itself. Double clicking causes a selection of the area between the nearest
enclosing delimitors.


 

processYellowButton

User pressed the yellow button on the mouse. Determine what actions to
take.


  typing support top  
 

backTo:

During typing, backspace to startIndex. Deleted characters fall into three
clusters, from left to right in the text: (1) preexisting characters that were
backed over; (2) newly typed characters that were backed over (excluding
typeahead, which never even appears); (3) preexisting characters that
were highlighted before typing began. If typing has not yet been opened,
open it and watch for the first and third cluster. If typing has been opened,
watch for the first and second cluster. Save characters from the first and third
cluster in UndoSelection. Tally characters from the first cluster in UndoMessage's parameter.
Delete all the clusters. Do not alter Undoer or UndoInterval (except via
openTypeIn). The code is shorter than the comment.


 

closeTypeIn

See comment in openTypeIn. It is important to call closeTypeIn before executing
any non-typing key, making a new selection, etc. It is called automatically for
menu commands.
Typing commands can call 'closeTypeIn: aCharacterStream' instead of this to
save typeahead. Undoer & Redoer: undoAndReselect:redoAndReselect:.


 

closeTypeIn:

Call instead of closeTypeIn when you want typeahead to be inserted before the
control character is executed, e.g., from Ctrl-V.


 

dispatchOnCharacter:with:

Carry out the action associated with this character, if any.
Type-ahead is passed so some routines can flush or use it.


 

dispatchOnEnterWith:

Enter key hit. Treat is as an 'accept', viz a synonym for cmd-s. If cmd key is down, treat is as a synonym for print-it.


 

doneTyping


 

insertTypeAhead:


 

openTypeIn

Set up UndoSelection to null text (to be added to by readKeyboard and backTo:),
beginTypeInBlock to keep track of the leftmost backspace, and UndoParameter to tally
how many deleted characters were backspaced over rather than 'cut'.
You can't undo typing until after closeTypeIn.


 

readKeyboard

Key struck on the keyboard. Find out which one and, if special, carry
out the associated special action. Otherwise, add the character to the
stream of characters. Undoer & Redoer: see closeTypeIn.


 

recognizeCharacters

Recognize hand-written characters and put them into the receiving pane. Invokes Alan's character recognizer. 2/5/96 sw


 

recognizeCharactersWhileMouseIn:

Recognize hand-written characters and put them into the receiving pane. Invokes Alan's character recognizer. 2/5/96 sw


 

setEmphasisHere


 

simulatedKeystroke:

Accept char as if it were struck on the keyboard. This version does not yet deal with command keys, and achieves update in the receiver's typically inactive window via the sledge-hammer of uncache-bits.


 

startOfTyping

Compatibility during change from characterBlock to integer


  typing/selecting keys top  
 

argAdvance:

Invoked by Ctrl-a. Useful after Ctrl-q.
Search forward from the end of the selection for a colon followed by
a space. Place the caret after the space. If none are found, place the
caret at the end of the text. Does not affect the undoability of the
previous command.


 

backWord:

If the selection is not a caret, delete it and leave it in the backspace buffer.
Else if there is typeahead, delete it.
Else, delete the word before the caret.


 

backspace:

Backspace over the last character.


 

changeStyle:

Put up the style-change menu


 

crWithIndent:

Replace the current text selection with CR followed by as many tabs
as on the current line (+/- bracket count) -- initiated by Shift-Return.


 

cursorTopHome:

Put cursor at beginning of text -- invoked from cmd-H shortcut, useful for keyboards that have no home key.


 

displayIfFalse:

Replace the current text selection with the text 'ifFalse:'--initiated by
ctrl-f.


 

displayIfTrue:

Replace the current text selection with the text 'ifTrue:'--initiated by
ctrl-t.


 

doAgainMany:

Do the previous thing again repeatedly. 1/26/96 sw


 

doAgainOnce:

Do the previous thing again once. 1/26/96 sw


 

find:

Prompt the user for what to find, then find it, searching from the current selection onward. 1/24/96 sw


 

findAgain:

Find the desired text again. 1/24/96 sw


 

forwardDelete:

Delete forward over the next character.
Make Undo work on the whole type-in, not just the one char.
wod 11/3/1998: If there was a selection use #zapSelectionWith: rather than #backspace: which was 'one off' in deleting the selection. Handling of things like undo or typeIn area were not fully considered.


 

normalCharacter:

A nonspecial character is to be added to the stream of characters.


 

querySymbol:

Invoked by Ctrl-q to query the Symbol table and display alternate symbols.
See comment in completeSymbol:lastOffering: for details.


 

search:

Invoked by Ctrl-S. Same as 'again', but always uses the existing FindText
and ChangeText regardless of the last edit.


 

selectAll

Make the selection be all the characters of the receiver


 

selectAll:

select everything, invoked by cmd-a. 1/17/96 sw


 

simulatedBackspace

Backspace over the last character, derived from hand-char recognition. 2/5/96 sw


  undo support top  
 

isDoing

Call from a doer/undoer/redoer any time to see which it is.


 

isRedoing

Call from a doer/undoer/redoer any time to see which it is.


 

isUndoing

Call from a doer/undoer/redoer any time to see which it is.


 

noUndoer

The Undoer to use when the command can not be undone. Checked for
specially by readKeyboard.


 

undoMessage:forRedo:

Call this from an undoer/redoer to set up UndoMessage as the
corresponding redoer/undoer. Also set up UndoParagraph, as well
as the state variable Undone. It is assumed that UndoInterval has been
established (generally by zapSelectionWith:) and that UndoSelection has been
saved (generally by replaceSelectionWith: or replace:With:and:).


 

undoer:

See comment in undoMessage:. Use this version when aSelector has no arguments, and you are doing or redoing and want to prepare for undoing.


 

undoer:with:

See comment in undoMessage:. Use this version when aSelector has one argument, and you are doing or redoing and want to prepare for undoing.


 

undoer:with:with:

See comment in undoMessage:. Use this version when aSelector has two arguments, and you are doing or redoing and want to prepare for undoing.


 

undoer:with:with:with:

See comment in undoMessage:. Use this version when aSelector has three arguments, and you are doing or redoing and want to prepare for undoing.


  undoers top  
 

undoAgain:andReselect:typedKey:

The last command was again. Undo it. Redoer: itself.


 

undoAndReselect:redoAndReselect:

Undo typing, cancel, paste, and other operations that are like replaces
but the selection is not the whole restored text after undo, redo, or both.
undoHighlight is selected after this phase and redoHighlight after the next phase.
Redoer: itself.


 

undoCutCopy:

Undo of a cut, copy, or any edit that changed CurrentSelection. Be sure
undo-copy does not lock the model. Redoer: itself, so never isRedoing.


 

undoQuery:lastOffering:

Undo ctrl-q. selectorOrNil (if not nil) is the previously offered selector.
hintText is the original hint. Redoer: completeSymbol.


 

undoReplace

Undo of any command that replaced a selection by other text that it left
highlighted, and that is undone and redone by simple reversal of the
operation. This is the most common Undoer; call replaceSelectionWith:
to get this setup. Redoer: itself, so never isRedoing.


class methods
  class initialization top  
 

abandonChangeText

Call this to get out of the maddening situation in which the system keeps aggressively trying to do a replacement that you no longer wish to make, every time you make choose a new method in a list.


 

initialize

Initialize the keyboard shortcut maps and the shared buffers
for copying text across views and managing again and undo.
Marked this method changed to trigger reinit


 

initializeTextEditorMenus

Initialize the yellow button pop-up menu and corresponding messages.


 

shiftedYellowButtonMenu

Answer the menu to be presented when the yellow button is pressed while the shift key is down


 

yellowButtonMenu


 

yellowButtonMessages


  clipboard access top  

  instance creation top  
 

new

Answer a new instance of me with a null Paragraph to be edited.


 

newParagraph:

Answer an instance of me with aParagraph as the text to be edited.


  keyboard shortcut tables top  
 

initializeCmdKeyShortcuts

Initialize the (unshifted) command-key (or alt-key) shortcut table.


 

initializeShiftCmdKeyShortcuts

Initialize the shift-command-key (or control-key) shortcut table.


 

specialShiftCmdKeys

Private - return array of key codes that represent single keys acting
as if shift-command were also being pressed