home *** CD-ROM | disk | FTP | other *** search
- {\rtf0\ansi{\fonttbl\f0\fmodern Courier;\f1\ftech Symbol;\f2\fmodern Ohlfs;}
- \paperw11640
- \paperh18320
- \margl120
- \margr120
- {\colortbl;\red0\green0\blue0;}
- \pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\f0\b0\i0\ulnone\fs24\fc0\cf0 //—————————————————————————————————————————————————————————————————————————————\
- //
- \i
- \b FILENAME
- \b0 :
- \b\i0 eText.XText.h \
-
- \b0 //
- \i
- \b SUMMARY
- \b0 :
- \b\i0 Interface for the XText keybinding subsystem of eText
- \b0 \
- //
- \b\i CATEGORY
- \b0 :
- \i0
- \b XText
- \b0 \
- //
- \b\i PROTOCOLS
- \b0 :
- \i0
- \b Uses XTActions
- \b0 \
- //
- \b\i INTERFACE
- \b0 :
- \i0
- \b None
- \b0 \
- //
- \b\i AUTHOR
- \b0 :
- \b\i0 Rohit Khare, portions by Mike Dixon
- \b0 \
- //
- \b\i COPYRIGHT
- \b0 :
- \f1\i0 ½
- \f0\b 1993,94 California Institure of Technology, eText Project\
-
- \b0 //—————————————————————————————————————————————————————————————————————————————\
- //
- \b\i Description
- \b0\i0 \
- // These methods deal with Mike Dixon's XText and XTActions.\
- //—————————————————————————————————————————————————————————————————————————————\
- //
- \b\i History
- \b0\i0 \
- // 10/18/94:
- \b Cleaned up for eText5.
- \b0 \
- // 08/05/94:
- \b Completely Rearchitected for 5.0. RK
- \b0 \
- //—————————————————————————————————————————————————————————————————————————————\
- //
- \b Imported Interfaces
- \b0 \
- //\
- #import "
- \b eText.Class.h
- \b0 "\
- #import "
- \b Kludges
- \b0 .subproj/
- \b ErrorStream.h
- \b0 "\
- #import "
- \b XTAction.h
- \b0 "\
- \
- extern void
- \b initbase_emacs
- \b0 (
- \b actionTbl
- \b0 actions,
- \b NXZone
- \b0 *zone);\
- #define
- \b BOF
- \b0 255
- \i // begining of file (new in 0.9b2)
- \i0 \
- \
-
- \i @interface eText(XText)\
-
- \i0 //—————————————————————————————————————————————————————————————————————————————\
- //
- \b XText0 Management
- \b0 \
- //\
- -
- \b setErrorStream
- \b0 :errs;\
- -
- \b errorStream
- \b0 ;\
- \
- -
- \b setInitialAction
- \b0 :action;\
- -
- \b initialAction
- \b0 ;\
- -
- \b setNextAction
- \b0 :action;\
- \
- -
- \b unboundKey
- \b0 ;\
- -
- \b keyDown
- \b0 :(
- \b NXEvent
- \b0 *) event;\
- \
- //—————————————————————————————————————————————————————————————————————————————\
- //
- \b XText Operations (emacs)
- \b0 \
- //\
- -
- \b goto
- \b0 :(int)pos
- \b end
- \b0 :(int)end
- \b mode
- \b0 :(int)mode;\
- -
- \b moveWord
- \b0 :(int)cnt
- \b mode
- \b0 :(int)mode;\
- -
- \b moveChar
- \b0 :(int)cnt
- \b mode
- \b0 :(int)mode;\
- -
- \b moveLine
- \b0 :(int)cnt
- \b mode
- \b0 :(int)mode;\
- -
- \b lineBegin
- \b0 :(int)mode;\
- -
- \b lineEnd
- \b0 :(int)mode;\
- -
- \b docBegin
- \b0 :(int)mode;\
- -
- \b docEnd
- \b0 :(int)mode;\
- -
- \b collapseSel
- \b0 :(int)dir;\
- -
- \b transChars
- \b0 ;\
- -
- \b openLine
- \b0 ;\
- -
- \b scroll
- \b0 :(int)
- \b pages
- \b0 :(int)
- \b lines
- \b0 ;\
- -
- \b scrollIfRO
- \b0 :(int)
- \b pages
- \b0 :(int)
- \b lines
- \b0 ;\
- -
- \b insertChar
- \b0 :(
- \b NXEvent
- \b0 *)event;\
- -
- \b insertNextChar
- \b0 ;\
-
- \i\fc1\cf1 // new to XText 0.9b2\
-
- \i0 -
- \b autoIndent
- \b0 ;\
- -
- \b match
- \b0 :(unsigned char *)
- \b LR
- \b0 ;\
-
- \i // useful methods to display character codes\
-
- \i0 -
- \b insertKeyCombination
- \b0 :(
- \b NXEvent
- \b0 *)event;\
- -
- \b insertKeyCombOfNextKey
- \b0 ;\
-
- \i\fc0\cf0 \
- @end\
-
- \i0 \
- //—————————————————————————————————————————————————————————————————————————————\
- //
- \b Original Header Comments Follow
- \b0 \
- //\
- \
-
- \i /* This file is part of XText (version 0.9)\
- Paul Griffin July 1995 No copyright. Use at your own discretion. \
- \
- Based on XText 0.8\
- Mike Dixon, April 1992 \
- Copyright (c) 1992 Xerox Corporation. All rights reserved.\
- \
- */\
- /* This file is part of the XText package (version 0.8)\
- Mike Dixon, April 1992\
- \
- Copyright (c) 1992 Xerox Corporation. All rights reserved.\
- \
- Use and copying of this software and preparation of derivative works based\
- upon this software are permitted. This software is made available AS IS,\
- and Xerox Corporation makes no warranty about the software or its\
- performance.\
- */\
- \
- #import <appkit/Text.h>\
- \
- /* XText0 is the 'bare' extensible Text class; it provides the support for\
- key bindings, but doesn't provide any of the useful methods you're likely\
- to want to bind them to.\
- \
- The instance variables are\
- nextAction the action that will interpret the next key\
- initialAction the basic action used to interpret keys (generally\
- an XTDispatchAction)\
- errorStream used to report errors\
- \
- In normal operation nextAction == initialAction, but an action may\
- change nextAction to cause the next key to be interpreted specially.\
- For example, this is used to implement ctrl-q (quote next char), and\
- could also be used to implement emacs-style prefix maps.\
- \
- Most of the methods are all self-explanatory; the ones that might not\
- be are\
- newFieldEditorFor:initialAction:estream:\
- should be called from a window's delegate's\
- getFieldEditor:for: method; returns an XText\
- for editing the window's fields\
- unboundKey just beeps\
- disableAutodisplay like setAutodisplay:NO, except that it does\
- nothing if this is a field editor (to work\
- around a bug in text fields)\
- \
- The default initialAction is nil, which just causes all key events to\
- be handled by the superclass (i.e. Text).\
- */\
- /* XText augments XText0 with a bunch of useful methods for emacs-like\
- key bindings.\
- \
- All of the cursor-movement methods take a 'mode' argument, which may\
- be\
- 0 just move the point to new location\
- 1 delete to new location\
- 2 cut to new location\
- 3 extend selection to new location\
- \
- The methods are\
- goto:end:mode: implements all movement; second argument specifies\
- the other end of the selection when mode != 0\
- moveWord:mode: move n words forward from point (back if n<0)\
- moveChar:mode: move n chars forward from point (back if n<0)\
- moveLine:mode: move n lines down from point (up if n<0)\
- lineBegin: move to beginning of current line\
- lineEnd: move to end of current line\
- docBegin: move to beginning of document\
- docEnd: move to end of document\
- collapseSel: move to beginning of selection (dir<0), end of\
- selection (dir>0), or active end of sel (dir=0)\
- transChars transpose characters around point\
- openLine insert new line after point\
- scroll:: scroll window n pages + m lines\
- scrollIfRO:: scroll window n pages + m lines if doc is\
- read-only; returns nil if doc is editable\
- insertChar: inserts the character associated with a key event\
- insertNextChar sets nextAction so that the next key event will be\
- interpreted as a character\
- \
- autoIndent creates a new line with space and tab indentation\
- equal to the current line \
- match:"LR" Finds previous correctly nested matched character\
- L and briefly displays it; then prints R. \
- Useful for "()" "\{\}" and "[]". \
- \
- \
- \
- When there is a non-empty selection, we keep track of which end is active\
- (further movement commands will be relative to that end). When we move\
- up or down lines, we keep track of which column we started in and try to\
- stick to it. XText's instance variables are used to implement this\
- behavior:\
- posHint the cp of the point; if this doesn't correspond to either\
- end of the selection, we put the point after the selection\
- xHint the column we're trying to keep the point in during\
- vertical movement\
- xHintPos xHint is only valid if this is the cp of the point\
- ("cp" == character position)\
- \
- This file also includes initbase_emacs, called by XTDispatchAction's\
- initBase:estream: method when base == "emacs" to set up the default\
- key bindings.\
- */
- }
-