home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / doc / Xaw / TextActions < prev    next >
Encoding:
Text File  |  1991-07-29  |  17.7 KB  |  480 lines

  1. .NH 2
  2. Text Widget Actions.
  3. .LP
  4. .IN "Text widget" "actions"
  5. .XS
  6.     Actions Supported by all Text Widgets
  7. .XE
  8. .IN "Text widget" "actions" "@DEF@"
  9.  
  10. All editing functions are performed by translation manager actions that may
  11. be specified through the \fBtranslations\fP resource in the Text widget.
  12. .LP
  13. .sp
  14. .Ds 0
  15. .TA .5i    2.5i 3i
  16. .ta .5i 2.5i 3i
  17. Insert Point Movement    Delete
  18.     forward-character        delete-next-character
  19.     backward-character        delete-previous-character
  20.     forward-word        delete-next-word
  21.     backward-word        delete-previous-word
  22.     forward-paragraph        delete-selection
  23.     backward-paragraph
  24.     beginning-of-line
  25.     end-of-line    Selection
  26.     next-line        select-word
  27.     previous-line        select-all
  28.     next-page        select-start
  29.     previous-page        select-adjust
  30.     beginning-of-file        select-end
  31.     end-of-file        extend-start
  32.     scroll-one-line-up        extend-adjust
  33.     scroll-one-line-down        extend-end
  34.             insert-selection
  35.  
  36.  
  37. Miscellaneous    New Line        
  38.     redraw-display        newline-and-indent
  39.     insert-file        newline-and-backup
  40.     insert-char        newline    
  41.     insert-string    
  42.     display-caret
  43.     focus-in    Kill
  44.     focus-in        kill-word
  45.     search            backward-kill-word
  46.     multiply        kill-selection
  47.     form-paragraph        kill-to-end-of-line
  48.     transpose-characters        kill-paragraph
  49.     no-op        kill-to-end-of-paragraph
  50.     XawWMProtocols
  51. .De
  52. .sp
  53. .LP
  54. Most of the actions take no arguments, and unless otherwise noted you
  55. may assume this to be the case.
  56. .LP
  57. .NH 3
  58. Cursor Movement Actions\fP
  59. .LP
  60. .sp
  61. .IP forward-character(\|) 2.0i
  62. .br
  63. .ns
  64. .IP backward-character(\|) 2.0i
  65. These actions move the insert point forward or backward one character in
  66. the buffer.  If the insert point is at the end or beginning of a line
  67. this action will move the insert point to the next (or previous) line.
  68. .IP forward-word(\|) 2.0i
  69. .br
  70. .ns
  71. .IP backward-word(\|) 2.0i
  72. These actions move the insert point to the next or previous word boundary.
  73. A word boundary is defined as a Space, Tab or Carriage Return.
  74. .IP forward-paragraph(\|) 2.0i
  75. .br
  76. .ns
  77. .IP backward-paragraph(\|) 2.0i
  78. These actions move the insert point to the next or previous paragraph boundary.
  79. A paragraph boundary is defined as two Carriage Returns in a row with only
  80. Spaces or Tabs between them.
  81. .IP beginning-of-line(\|) 2.0i
  82. .br
  83. .ns
  84. .IP end-of-line(\|) 2.0i
  85. These actions move to the beginning or end of the current line.  If the
  86. insert point is already at the end or beginning of the line then no action is taken.
  87. .IP next-line(\|) 2.0i
  88. .br
  89. .ns
  90. .IP previous-line(\|) 2.0i
  91. These actions move the insert point up or down one line.  If the insert
  92. point is currently N characters from the beginning of the line then it
  93. will be N characters from the beginning of the next or previous line.
  94. If N is past the end of the line, the insert point is placed at the end
  95. of the line.
  96. .IP next-page(\|) 2.0i
  97. .br
  98. .ns
  99. .IP previous-page(\|) 2.0i
  100. These actions move the insert point up or down one page in the file.
  101. One page is defined as the current height of the text widget.  The
  102. insert point is always placed at the first character of the top line by
  103. this action.
  104. .IP beginning-of-file(\|) 2.0i
  105. .br
  106. .ns
  107. .IP end-of-file(\|) 2.0i
  108. These actions place the insert point at the beginning or end of the
  109. current text buffer.  The text widget is then scrolled the minimum
  110. amount necessary to make the new insert point location visible.
  111. .IP scroll-one-line-up(\|) 2.0i
  112. .br
  113. .ns
  114. .IP scroll-one-line-down(\|) 2.0i
  115. These actions scroll the current text field up or down by one line.
  116. They do not move the insert point.  Other than the scrollbars this is
  117. the only way that the insert point may be moved off of the visible text
  118. area.  The widget will be scrolled so that the insert point is back on
  119. the screen as soon as some other action is executed.
  120. .NH 3
  121. Delete Actions
  122. .LP
  123. .sp
  124. .IP delete-next-character(\|) 2.0i
  125. .br
  126. .ns
  127. .IP delete-previous-character(\|) 2.0i
  128. These actions remove the character immediately before or after the 
  129. insert point.  If a Carriage Return is removed then the next line is
  130. appended to the end of the current line.
  131. .IP delete-next-word(\|) 2.0i
  132. .br
  133. .ns
  134. .IP delete-previous-word(\|) 2.0i
  135. These actions remove all characters between the insert point location and
  136. the next word boundary.  A word boundary is defined as a Space, Tab or
  137. Carriage Return.
  138. .IP delete-selection(\|) 2.0i
  139. This action removes all characters in the current selection.
  140. The selection can be set with the selection actions.
  141. .NH 3
  142. Selection Actions
  143. .LP
  144. .sp
  145. .IP select-word(\|) 2.0i
  146. This action selects the word in which the insert point is currently located.
  147. If the insert point is between words then it will select the previous word.
  148. .IP select-all(\|) 2.0i
  149. This action selects the entire text buffer.
  150. .IP select-start(\|) 2.0i
  151. This action sets the insert point to the current pointer location.  It
  152. will then begin a selection at this location.  If many of these
  153. selection actions occur quickly in succession then the selection count
  154. mechanism will be invoked (see the section titled \fBText Selections for
  155. Application Programmers\fP for details).
  156. .IP select-adjust(\|) 2.0i
  157. This action allows a selection started with the \fIselect-start\fP
  158. action to be modified, as described above.
  159. .IP select-end(\fIname\fP[,\fIname\fP,...]) 2.0i
  160. This action ends a text selection that began with the \fIselect-start\fP
  161. action, and asserts ownership of the selection or selections specified.
  162. A \fIname\fP can be a selection (e.g. \fBPRIMARY\fP) or a cut buffer
  163. (e.g \fBCUT_BUFFER0\fP).  Note that case is important.  If no
  164. \fInames\fP are specified, \fBPRIMARY\fP is asserted. 
  165. .IP extend-start(\|) 2.0i
  166. This action finds the nearest end of the current selection, and moves it
  167. to the current pointer location.
  168. .IP extend-adjust(\|) 2.0i
  169. This action allows a selection started with an \fIextend-start\fP action
  170. to be modified.
  171. .IP extend-end(\fIname\fP[,\fIname\fP,...]) 2.0i
  172. This action ends a text selection that began with the \fIextend-start\fP
  173. action, and asserts ownership of the selection or selections specified.
  174. A \fIname\fP can be a selection (e.g. \fBPRIMARY\fP) or a cut buffer
  175. (e.g \fBCUT_BUFFER0\fP).  Note that case is important.  If no names are
  176. given, \fBPRIMARY\fP is asserted.
  177. .IP insert-selection(\fIname\fP[,\fIname\fP,...]) 2.0i 
  178. This action retrieves the value of the first (left-most) named selection
  179. that exists or the cut buffer that is not empty and inserts it into the
  180. Text widget at the current insert point location. A \fIname\fP can be a
  181. selection (e.g. \fBPRIMARY\fP) or a cut buffer (e.g \fBCUT_BUFFER0\fP).
  182. Note that case is important.
  183. .NH 3
  184. The New Line Actions
  185. .LP
  186. .sp
  187. .IP newline-and-indent(\|) 2.0i
  188. This action inserts a newline into the text and adds spaces to
  189. that line to indent it to match the previous line.
  190. .IP newline-and-backup(\|) 2.0i
  191. This action inserts a newline into the text \fIafter\fP the insert point.
  192. .IP newline(\|) 2.0i
  193. This action inserts a newline into the text \fIbefore\fP the insert point.
  194. .NH 3
  195. Kill and Actions
  196. .LP
  197. .sp
  198. .IP kill-word(\|) 2.0i
  199. .br
  200. .ns
  201. .IP backward-kill-word(\|) 2.0i
  202. These actions act exactly like the \fIdelete-next-word\fP and
  203. \fIdelete-previous-word\fP actions, but they stuff the word that was
  204. killed into the kill buffer (\fBCUT_BUFFER_1\fP).
  205. .IP kill-selection(\|) 2.0i
  206. This action deletes the current selection and stuffs the deleted text into
  207. the kill buffer (\fBCUT_BUFFER_1\fP).
  208. .IP kill-to-end-of-line(\|) 2.0i
  209. This action deletes the entire line to the right of the insert point position,
  210. and stuffs the deleted text into the kill buffer (\fBCUT_BUFFER_1\fP).
  211. .IP kill-paragraph(\|) 2.0i
  212. This action deletes the current paragraph, if between paragraphs it deletes
  213. the paragraph above the insert point, and stuffs the deleted text into
  214. the kill buffer (\fBCUT_BUFFER_1\fP). 
  215. .IP kill-to-end-of-paragraph(\|) 2.0i
  216. This action deletes everything between the current insert point location and
  217. the next paragraph boundary, and stuffs the deleted text into the kill
  218. buffer (\fBCUT_BUFFER_1\fP). 
  219. .NH 3
  220. Miscellaneous Actions
  221. .LP
  222. .sp 1
  223. .IP redraw-display(\|) 2.0i
  224. This action recomputes the location of all the text lines on the
  225. display, scrolls the text to vertically center the line containing the insert point
  226. on the screen, clears the entire screen, and redisplays it.
  227. .IP insert-file([\fIfilename\fP]) 2.0i
  228. This action activates the insert file popup.  The \fIfilename\fP
  229. option specifies the default filename to put in the filename buffer of
  230. the popup.  If no \fIfilename\fP is specified the buffer is empty
  231. at startup.
  232. .IP insert-char(\|) 2.0i
  233. This action may only be attached to a key event. It
  234. calls XLookupString to translate the event into a (rebindable) Latin-1
  235. character (sequence) and inserts that sequence into the text at the 
  236. insert point position.
  237. .IP insert-string(\fIstring\fP[,\fIstring\fP,...]) 2.0i
  238. This action inserts each \fIstring\fP into the text at the insert point
  239. location.  Any \fIstring\fP beginning with the characters "0x" and
  240. containing only valid hexadecimal digits in the remainder is interpreted
  241. as a hexadecimal constant and the corresponding single character is
  242. inserted instead.
  243. .IP display-caret(\fIstate\fP,\fIwhen\fP) 2.0i
  244. This action allows the insert point to be turned on and off.
  245. The \fIstate\fP argument specifies the desired state of the insert point.
  246. This value may be any of the string
  247. values accepted for Boolean resources (e.g. \fBon\fP, \fBTrue\fP,
  248. \fBoff\fP, \fBFalse\fP, etc.).  If no arguments are specified, the
  249. default value is \fBTrue\fP. 
  250. The \fIwhen\fP argument specifies, for \fBEnterNotify\fP or \fBLeaveNotify\fP
  251. events whether or not the focus field in the event is to be examined.
  252. If the second argument is not specified, or specified as something other
  253. than \fBalways\fP then if the action is bound to an  \fBEnterNotify\fP
  254. or \fBLeaveNotify\fP event, the action will be taken only if the focus
  255. field is \fBTrue\fP.  An augmented binding that might be useful is:
  256. .LP
  257. .Ds 0
  258. .TA .2.0i 2.5i 4.0i
  259. .ta .2.0i 2.5i 4.0i
  260.     *Text.Translations: #override \\
  261.         <FocusIn>:    display-caret(on) \\n\\
  262.         <FocusOut>:    display-caret(off)
  263. .De
  264. .IP focus-in(\|) 2.0i
  265. .br
  266. .ns
  267. .IP focus-out(\|) 2.0i
  268. These actions do not currently do anything.
  269. .IP search(\fIdirection\fP,[\fIstring\fP]) 2.0i
  270. This action activates the search popup.  The \fIdirection\fP must be
  271. specified as either \fBforward\fP or \fBbackward\fP.  The string is
  272. optional and is used as an initial value for the \fISearch for\fP: string.
  273. For further explanation of the search widget see the section on
  274. \fBText Searches\fP.
  275. .IP multiply(\fIvalue\fP) 2.0i
  276. The multiply action allows the user to multiply the effects of many of
  277. the text actions.  Thus the following action sequence
  278. \fImultiply(10) delete-next-word()\fP will delete 10 words.  It does not
  279. matter whether these actions take place in one event or many events.
  280. Using the default translations the key sequence \fIControl-u,
  281. Control-d\fP will delete 4 characters.  
  282. Multiply actions can be chained, thus \fImultiply(5)
  283. multiply(5)\fP is the same as \fImultiply(25)\fP.  If the string
  284. \fBreset\fP is passed to the multiply action the effects of all previous
  285. multiplies are removed and a beep is sent to the display.
  286. .IP form-paragraph(\|) 2.0i
  287. This action removes all the Carriage Returns from the current
  288. paragraph and reinserts them so that each line is as long as possible, while
  289. still fitting on the current screen.  Lines are broken at word boundaries if 
  290. at all possible.  This action currently works only on Text widgets
  291. that use ASCII text.
  292. .IP transpose-characters(\|) 2.0i
  293. This action will swap the position of the character to the left of the
  294. insert point with the character to the right of the insert point.  The insert point will then
  295. be advanced one character.  
  296. .IP no-op([\fIaction\fP]) 2.0i
  297. The no-op action makes no change to the text widget, and is mainly used
  298. to override translations.  This action takes one optional argument.  If
  299. this argument is \fIRingBell\fP then a beep is sent to the display.
  300. .IP XawWMProtocols([\fIwm_protocol_name\fP]) 2.0i
  301. .IN "XawWMProtocols"
  302. .sp
  303. This action is written specifically for the transient shells instantiated by
  304. the Text widget, which are the file insertion and the search and replace
  305. dialog boxes.  This action is attached to those shells by the Text widget,
  306. in order to handle ClientMessage events with the WM_PROTOCOLS atom in the
  307. detail field.  This action supports WM_DELETE_WINDOW on the Text widget
  308. popups, and may support other window manager protocols if necessary in 
  309. the future.  The popup will be dismissed if the window manager sends
  310. a WM_DELETE_WINDOW request and there are no parameters in the action
  311. call, which is the default.  The popup will also be dismissed if the
  312. parameters include the string "wm_delete_window", and the event is a
  313. ClientMessage event requesting dismissal or is not a ClientMessage event.
  314. This action is not sensitive to the case of the strings passed as parameters.
  315. .NH 3
  316. Text Selections for Application Programmers
  317. .IN "Text widget" "Text Selections for Application Programmers"
  318. .LP
  319. The default behavior of the text selection array is described in the
  320. section called \fBText Selections for Users\fP.  To modify the selections
  321. a programmer must construct a \fBXawTextSelectType\fP array (called the
  322. selection array), containing the selections desired, and pass this as
  323. the new value for the \fBselectionTypes\fP resource.  The selection
  324. array may also be modified using the \fBXawTextSetSelectionArray\fP
  325. .IN "XawTextSetSelectionArray" ""
  326. function.  All selection arrays must end with the value
  327. \fBXawselectNull\fP.  The \fBselectionTypes\fP resource has no converter
  328. registered and cannot be modified through the resource manager.
  329. .LP
  330. The array contains a list of entries that will be called when the user
  331. attempts to select text in rapid succession with the \fIselect-start\fP
  332. action (usually by clicking a pointer button).  The first entry in the
  333. selection array will be used when the \fIselect-start\fP action is
  334. initially called.  The next entry will be used when \fIselect-start\fP
  335. is called again, and so on.  If a timeout value (1/10 of a second) is
  336. exceeded, the the next \fIselect-start\fP action will begin at the top
  337. of the selection array.  When \fBXawselectNull\fP is reached the array
  338. is recycled beginning with the first element.
  339. .TS
  340. lw(1.25i) lw(4.25i).
  341. T{
  342. \fBXawselectAll\fP
  343. .IN "XawselectAll" ""
  344. T}    T{
  345. Selects the contents of the entire buffer.
  346. T}
  347. .sp 6p
  348. T{
  349. \fBXawselectChar\fP
  350. .IN "XawselectChar" ""
  351. T}    T{
  352. Selects text characters as the pointer moves over them.
  353. T}
  354. .sp 6p
  355. T{
  356. \fBXawselectLine\fP
  357. .IN "XawselectLine" ""
  358. T}    T{
  359. Selects the entire line.
  360. T}
  361. .sp 6p
  362. T{
  363. \fBXawselectNull\fP
  364. .IN "XawselectNull" ""
  365. T}    T{
  366. Indicates the end of the selection array.
  367. T}
  368. .sp 6p
  369. T{
  370. \fBXawselectParagraph\fP
  371. .IN "XawselectParagraph" ""
  372. T}    T{
  373. Selects the entire paragraph.
  374. T}
  375. .sp 6p
  376. T{
  377. \fBXawselectPosition\fP
  378. .IN "XawselectPosition" ""
  379. T}    T{
  380. Selects the current pointer position.
  381. T}
  382. .sp 6p
  383. T{
  384. \fBXawselectWord\fP
  385. .IN "XawselectWord" ""
  386. T}    T{
  387. Selects whole words as the pointer moves onto them.
  388. T}
  389. .TE
  390. .LP
  391. The default selectType array is:
  392. .LP
  393. .sp
  394. .Ds 0
  395. {XawselectPosition, XawselectWord, XawselectLine, XawselectParagraph, XawselectAll, XawselectNull}
  396. .De
  397. .sp
  398. .LP
  399. The selection array is not copied by the text widgets.  The
  400. application must allocate space for the array and cannot deallocate or
  401. change it until the text widget is destroyed or until a new selection
  402. array is set.
  403. .NH 2
  404. Default Translation Bindings
  405. .LP
  406. .XS
  407.     Default Translation Bindings
  408. .XE
  409. .IN "Text widget" "default translations"
  410. The following translations are defaults built into every Text widget.
  411. They can be overridden, or replaced by specifying a new value for the
  412. Text widget's \fBtranslations\fP resource.
  413. .LP
  414. .sp
  415. .Ds 0
  416. .TA .5i 2.5i
  417. .ta .5i 2.5i
  418.     Ctrl<Key>A:    beginning-of-line(\|) \\n\\
  419.     Ctrl<Key>B:    backward-character(\|) \\n\\
  420.     Ctrl<Key>D:    delete-next-character(\|) \\n\\
  421.     Ctrl<Key>E:    end-of-line(\|) \\n\\
  422.     Ctrl<Key>F:    forward-character(\|) \\n\\
  423.     Ctrl<Key>G:    multiply(Reset) \\n\\
  424.     Ctrl<Key>H:    delete-previous-character(\|) \\n\\
  425.     Ctrl<Key>J:    newline-and-indent(\|) \\n\\
  426.     Ctrl<Key>K:    kill-to-end-of-line(\|) \\n\\
  427.     Ctrl<Key>L:    redraw-display(\|) \\n\\
  428.     Ctrl<Key>M:    newline(\|) \\n\\
  429.     Ctrl<Key>N:    next-line(\|) \\n\\
  430.     Ctrl<Key>O:    newline-and-backup(\|) \\n\\
  431.     Ctrl<Key>P:    previous-line(\|) \\n\\
  432.     Ctrl<Key>R:    search(backward) \\n\\
  433.     Ctrl<Key>S:    search(forward) \\n\\
  434.     Ctrl<Key>T:    transpose-characters(\|) \\n\\
  435.     Ctrl<Key>U:    multiply(4) \\n\\
  436.     Ctrl<Key>V:    next-page(\|) \\n\\
  437.     Ctrl<Key>W:    kill-selection(\|) \\n\\
  438.     Ctrl<Key>Y:    insert-selection(CUT_BUFFER1) \\n\\
  439.     Ctrl<Key>Z:    scroll-one-line-up(\|) \\n\\
  440.     Meta<Key>B:    backward-word(\|) \\n\\
  441.     Meta<Key>F:    forward-word(\|) \\n\\
  442.     Meta<Key>I:    insert-file(\|) \\n\\
  443.     Meta<Key>K:    kill-to-end-of-paragraph(\|) \\n\\
  444.     Meta<Key>Q:    form-paragraph(\|) \\n\\
  445.     Meta<Key>V:    previous-page(\|) \\n\\
  446.     Meta<Key>Y:    insert-selection(PRIMARY, CUT_BUFFER0) \\n\\
  447.     Meta<Key>Z:    scroll-one-line-down(\|) \\n\\
  448.     :Meta<Key>d:    delete-next-word(\|) \\n\\
  449.     :Meta<Key>D:    kill-word(\|) \\n\\
  450.     :Meta<Key>h:    delete-previous-word(\|) \\n\\
  451.     :Meta<Key>H:    backward-kill-word(\|) \\n\\
  452.     :Meta<Key>\\<:    beginning-of-file(\|) \\n\\
  453.     :Meta<Key>\\>:    end-of-file(\|) \\n\\
  454.     :Meta<Key>]:    forward-paragraph(\|) \\n\\
  455.     :Meta<Key>[:    backward-paragraph(\|) \\n\\
  456.     ~Shift Meta<Key>Delete:        delete-previous-word(\|) \\n\\
  457.     \ Shift Meta<Key>Delete:        backward-kill-word(\|) \\n\\
  458.     ~Shift Meta<Key>Backspace:    delete-previous-word(\|) \\n\\
  459.     \ Shift Meta<Key>Backspace:    backward-kill-word(\|) \\n\\
  460.     <Key>Right:    forward-character(\|) \\n\\
  461.     <Key>Left:    backward-character(\|) \\n\\
  462.     <Key>Down:    next-line(\|) \\n\\
  463.     <Key>Up:    previous-line(\|) \\n\\
  464.     <Key>Delete:    delete-previous-character(\|) \\n\\
  465.     <Key>BackSpace:    delete-previous-character(\|) \\n\\
  466.     <Key>Linefeed:    newline-and-indent(\|) \\n\\
  467.     <Key>Return:    newline(\|) \\n\\
  468.     <Key>:        insert-char(\|) \\n\\
  469.     <FocusIn>:    focus-in(\|) \\n\\
  470.     <FocusOut>:    focus-out(\|) \\n\\
  471.     <Btn1Down>:    select-start(\|) \\n\\
  472.     <Btn1Motion>:    extend-adjust(\|) \\n\\
  473.     <Btn1Up>:    extend-end(PRIMARY, CUT_BUFFER0) \\n\\
  474.     <Btn2Down>:    insert-selection(PRIMARY, CUT_BUFFER0) \\n\\
  475.     <Btn3Down>:    extend-start(\|) \\n\\
  476.     <Btn3Motion>:    extend-adjust(\|) \\n\\
  477.     <Btn3Up>:    extend-end(PRIMARY, CUT_BUFFER0) \\
  478. '';
  479. .De
  480.