home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume17 / tcleditr / part15 < prev    next >
Encoding:
Text File  |  1992-03-17  |  55.5 KB  |  1,521 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!think.com!mips!msi!dcmartin
  3. From: crowley@chaco.cs.unm.edu (Charlie Crowley)
  4. Subject: v17i016: point text editor (TCL and TK), Part15/16
  5. Message-ID: <1992Mar18.142016.27962@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. References: <csx-17i002-tcl-editor@uunet.UU.NET>
  10. Date: Wed, 18 Mar 1992 14:20:16 GMT
  11. Approved: dcmartin@msi.com
  12.  
  13. Submitted-by: crowley@chaco.cs.unm.edu (Charlie Crowley)
  14. Posting-number: Volume 17, Issue 16
  15. Archive-name: tcl-editor/part15
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then unpack
  19. # it by saving it into a file and typing "sh file".  To overwrite existing
  20. # files, type "sh file -c".  You can also feed this as standard input via
  21. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  22. # will see the following message at the end:
  23. #        "End of archive 14 (of 15)."
  24. # Contents:  doc/userman.2
  25. # Wrapped by crowley@chaco.cs.unm.edu on Tue Mar 10 15:05:51 1992
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. if test -f 'doc/userman.2' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'doc/userman.2'\"
  29. else
  30. echo shar: Extracting \"'doc/userman.2'\" \(53933 characters\)
  31. sed "s/^X//" >'doc/userman.2' <<'END_OF_FILE'
  32. Then execute the {\tt CopyToHereMode} command twice.
  33. The easiest why to do this is to click the middle mouse button twice
  34. X(if you click quickly the mouse menu will not come up).
  35. The first {\tt CopyToHereMode} sets the to location as the beginning of
  36. the selected lines.
  37. The second {\tt CopyToHereMode} moves the selection to that point.
  38. Selecting the lines serves the dual purpose of setting the insertion
  39. point (the copy destination) for the first {\tt CopyToHereMode}
  40. and setting the selection (the text to be copied) for the
  41. second {\tt CopyToHereMode}.
  42. X
  43. The other typical use of {\tt CopyToHereMode} is to copy in a word
  44. or phrase while you are typing.
  45. You are typing and you get to a point where you want to type a word that
  46. is already visible on the screen.
  47. Why type it again?
  48. Stop typing, click the middle mouse button (the first {\tt CopyToHereMode}),
  49. select the word (double click with the left mouse button), click
  50. the middle mouse button again (the second {\tt CopyToHereMode})
  51. and continue typing.
  52. Note that you do note lose the insertion point when you use
  53. X{\tt CopyToHereMode}.
  54. X
  55. The {\tt CopyToHereMode} command is, as the name implies,
  56. a moded command.
  57. It is executed in pairs and after the first execution you are in
  58. what is called ``copy mode'' or ``duplicate mode''.
  59. This is indicated by a pointing hand cursor (``hand1'')
  60. X(there is an option to
  61. set the copy mode cursor to any cursor font cursor you like,
  62. for example you might want to use ``gumby'').
  63. Being in copy mode does not restrict you in any way. 
  64. All Point commands work exactly the same and you could stay
  65. in copy mode for hours if you wanted or quite Point while in
  66. copy mode.
  67. The only effect of copy mode is that a second {\tt CopyToHereMode}
  68. will complete the copy and copy the selected text to the destination
  69. remembered when you executed the first {\tt CopyToHereMode}.
  70. X
  71. There is a {\tt MoveToHereMode} which works exactly the same
  72. except the text is moved rather than copied.
  73. I rarely use this command and you will note it is not
  74. on the menus.
  75. You might find a use for it.
  76. X
  77. The other type of copy I will call ``copy-from-to'' and it is
  78. implemented by the Point command {\tt CopySelToMouse}.
  79. It is attached to the move-right motion of the middle button
  80. mouse menu.
  81. To copy text: select the text to copy,
  82. move the mouse sprite over the destination,
  83. press the middle mouse button, move right a bit and then release
  84. to execute {\tt CopySelToMouse}.
  85. I use this to copy lines from one place to another.
  86. Note that if you select the text in line mode,
  87. the {\tt CopySelToMouse} command will insert the text in front of
  88. the line over which you execute the command.
  89. This means you don't have to be that accurate and select the very
  90. first character of the line.
  91. These comments also apply to word mode, {\it mutatis mutandis}.
  92. X
  93. Note that both ``copy''s are on mouse menus.
  94. This is because I copy things a lot and like to do it quickly
  95. and without thinking about how to do it
  96. or diverting my attention from the text.
  97. X
  98. There is also a {\tt MoveSelToMouse} which I use frequently
  99. but less often than {\tt CopySelToMouse}.
  100. It works just like {\tt CopySelToMouse} except the text is
  101. moved rather than copied.
  102. It is attached to the move-left motion of the middle mouse menu.
  103. I use it to rearrange text and I almost always use it on whole lines.
  104. X
  105. X
  106. X
  107. X\subsection{ Moving Windows Around and Screen Layout}
  108. X
  109. Your window manager allows you to move windows around.
  110. I have move window attached to the left mouse button on the
  111. title bar of my windows.\footnote{Actually it is a {\it twm}
  112. function containing the commands \{f.move f.deltastop f.raiselower\}.}
  113. But in practice I rarely move Point text windows around that way.
  114. I have fixed on a preferred screen layout and windows go in certain
  115. positions in that layout.
  116. It use Point's move window commands to move windows between set
  117. locations.
  118. Mainly I use three locations: NE, NW and SE.
  119. These correspond to left, right and middle button clicks on the
  120. X``MoveW'' command on the text window menu bar.
  121. X(They are also on the ``Move Window $=>$'' submenu of the FILE menu.)
  122. I move windows around in a single jump using a mouse click.
  123. X
  124. You will want to develop your own screen layouts but when you do
  125. I recommend using the move window commands to move windows
  126. between fixed window locations.
  127. X
  128. X
  129. X\subsection{Backup Files}
  130. X
  131. Backup files are great when you need then but a nuisance when you don't
  132. need them.
  133. The solution I have found is to store backups in a subdirectory out
  134. of the way.
  135. The option {\tt backupNameFormat} determines how the path names of
  136. the backup files will be determined.
  137. This is discussed in section \ref{sect:options}.
  138. This allows you to specify that backups go into a subdirectory.
  139. X
  140. The option {\tt backupDepth} determines the number of backups to keep.
  141. I use six and have often been glad I did.
  142. This does use up disk space but text files are typically not that
  143. large so it is not a major problem.
  144. X
  145. X
  146. X\subsection{Undo, Redo and Again}
  147. X
  148. XEach command is recorded in the command history.
  149. There is a pointer to the most recently executed
  150. X(and not undone) command.
  151. The undo command undoes that command and moves the
  152. pointer back to the previous command.
  153. Thus another undo will undo that previous command.
  154. You can continue this way and undo every command you have
  155. executed since the file was loaded or the last time
  156. the file was saved.\footnote{Sorry, you cannot undo past a save.
  157. but I am thinking of changing that.}
  158. X
  159. There is a separate command history for each file
  160. X(not each window, each file).
  161. This is most noticeable when undoing a move from one file to another.
  162. There delete is in the command history of the ``from'' file and the
  163. insert is in the command history of the ``to'' file.
  164. They must be undone separately.
  165. X
  166. Undo undoes the effect of the last command:
  167. deleted text is inserted again,
  168. copied text is deleted,
  169. moved text is moved back,
  170. changed text is changed back.
  171. If you select text, delete it and type in new text,
  172. this whole action is undone as a unit.
  173. X
  174. There are two cases when an single undo will undo more than
  175. one command.
  176. The first is a delete followed by an insert at the same location.
  177. This is taken to be a replace and is considered a single operation
  178. and so it undone (and redone) as a unit.
  179. The second case is when a sequence of edits has been grouped
  180. explicitly as a block command.
  181. There are commands to mark the beginning and the end of a block
  182. of commands.
  183. XFor example, one might consider a search and replace operation to be
  184. a single command and so they are blocked.
  185. X
  186. If you undo a command and decide you really didn't want
  187. to undo it you can use the redo command to redo (or un-undo) it.
  188. In terms of the command history,
  189. redo moves the pointer up to the next command and redoes that
  190. command.
  191. Thus undo moves backward in the command history list and
  192. redo moves forward in the command history list.
  193. X
  194. You can undo and redo and much as you want but as soon as you
  195. make an ordinary edit (not an undo or a redo),
  196. the edits that were undone but not redone are discarded.
  197. This is a bug (there is a lot of work to handle this case)
  198. that will be corrected in a future version.
  199. X
  200. Again repeats the last command (that has not been undone)
  201. in the current context.
  202. That is, if the last edit was to delete the selection and
  203. replace it with some other text, then redo will replace
  204. the current selection with that text.
  205. This is the most common use of the again command.
  206. Again is often used with search to get the effect of a
  207. replace with verification on each change command.
  208. X
  209. Again takes an optional argument that determines what
  210. X``last command'' actually means.
  211. You can choose the last command overall, the last command
  212. in the file in the selection window or the last command
  213. in the file in a named window.
  214. X
  215. X
  216. X
  217. X
  218. X\subsection{Line numbers}
  219. X
  220. The default window titles indicates the range of line number shown
  221. in the  window.
  222. If you triple click on the line, a message is displayed
  223. X(in the message line of the browser usually, although
  224. this can be controlled by the user with the {\it messageFlags} option)
  225. showing the line number.
  226. This is the fastest way to determine the line number of a line.
  227. X
  228. There is a command to turn line numbering on and off in a window.
  229. X
  230. There are commands to jump to a specified line number or to
  231. the selected line number.
  232. X
  233. X
  234. X
  235. X\subsection{Using the scrap}
  236. X
  237. Deleted text goes into a buffer called the {\it scrap buffer}.
  238. The insert command inserts the text in the scrap buffer.
  239. There are commands to copy the selection into the scrap buffer
  240. and to exchange the selection with the scrap buffer.
  241. You can use these command to exchange two strings.
  242. These commands are all on the ``Scrap $=>$'' submenu of the EDIT menu.
  243. X
  244. X
  245. X
  246. X\subsection{Searching, C tags, and keywords}
  247. X
  248. There are many searching commands in Point because searching
  249. is a common thing to do when looking at programs.
  250. X
  251. There are two general types of searches in Point.
  252. In this section we discuss string search which searches for
  253. the next instance of a specific string.
  254. There are no special characters and the search string can contain
  255. anything (including newlines) and it must be matched exactly.
  256. In the next section we will discuss regular expression searching where 
  257. you search for an instance of a string pattern that might match
  258. a large number of strings.
  259. X
  260. You can search forward (or backward) for the next (or previous)
  261. instance of the selected text.
  262. This is the most common form of searching and so is on a mouse menu
  263. X(right mouse button move-down is search forward for selection
  264. and right mouse menu move-up is search backward for selection)
  265. for quick access.
  266. These same commands are attached to the left mouse button click
  267. on the ``$<<$'' (for search backward) and ``$>>$'' (for search
  268. forward) buttons on the menu bar.
  269. The mouse menu is faster for a single search and the menu bar
  270. button is faster and easier for repeated searches for the same string.
  271. X
  272. Sometimes you search for something and then after you find it you
  273. change the selection.
  274. XFor example you might make a small edit.
  275. The {\tt RepeatSearch} command will search for the last string
  276. you searched for without you having to select it again.
  277. Indeed, the edit you made might mean that that exact string is
  278. no longer there to select anyway.
  279. The {\tt RepeatSearch} command is attached to the right mouse
  280. button click on the ``$<<$'' (for search backward)
  281. and ``$>>$'' (for search forward) buttons on the menu bar.
  282. These commands are also attached to the F3 (search backward)
  283. and F4 (search forward) keys.
  284. X
  285. I often use the F4 and F5 (repeat last edit) key together to do an
  286. impromptu, interactive search and replace.
  287. X
  288. There is a search dialogue box you can bring up and type in any string
  289. to search for.
  290. Click the middle mouse button on the ``$<<$'' or ``$>>$'' menu
  291. bar buttons to bring up the search dialogue box.
  292. XFrom the search dialogue box you can type in a search string
  293. and you can change the {\tt ignoreCase} and {\tt findWholeWords}
  294. searching options.
  295. X
  296. You can also type a search string directly into the ``$<<$'' or ``$>>$''
  297. menu bar buttons by moving the cursor to ``$<<$'' or ``$>>$'',
  298. pressing any function key (or any non-ASCII key) to
  299. clear the string, and typing the characters to search for.
  300. The search is ``incremental'' (like {\tt emacs} searches) in that it searches
  301. for the string typed in so far after each character is typed.
  302. X
  303. You can also search for a matching bracket.
  304. This command (and all search commands) is on the GOTO menu.
  305. X
  306. Point also implements Unix tags.
  307. You specify the tag by selecting it or entering it into a dialogue box.
  308. Point then finds the file the tag is in, opens a window on that file
  309. X(or tops an existing window on that file),
  310. positions the window at the tag and selects the tag.
  311. X
  312. A different sort of search is the keyword search which is an internal
  313. form of {\tt grep}.
  314. You can activate a keyword search using the selection as the keyword
  315. or you can bring up a dialogue box and type in the keyword
  316. to search for.
  317. The keyword search looks through all the {\tt *.c and *.h} files
  318. in the current directory\footnote{The files to be searched are
  319. changed via Point options.}
  320. and brings up a dialogue box with a scrolling list of all the
  321. files that contain the keyword at least once.
  322. When you click on a file name on this scrolling list three things happen:
  323. X\begin{enumerate}
  324. X\item A window containing the file is displayed.
  325. If the file is in an existing open window that window will be topped.
  326. Otherwise a new window will be created.
  327. X\item That window will be scrolled so that the first instance
  328. of the keyword is visible in the window and that instance will
  329. be selected (in character mode).
  330. X\item The file name in the scrolling list will have an asterisk
  331. prepended to it.
  332. This is done so you can easily keep track of the files you have
  333. already looked at.
  334. X\end{enumerate}
  335. X
  336. X
  337. X\subsection{Searching for regular expressions}
  338. X
  339. It is often useful to search for a string pattern rather than a
  340. specific string.
  341. XFor example, you might want to search for the next thing within
  342. parentheses.
  343. The regular expression for that would be:
  344. X\begin{verbatim}
  345. X     (.*)
  346. X\end{verbatim}
  347. X
  348. A regular expression is represented in a special notation that
  349. describes the pattern you wish to search for.
  350. Often most of the characters in the pattern are literal characters that
  351. you want to match exactly but some with be special codes that match
  352. a class of characters or special features in the string.
  353. X
  354. XFirst let us define what a regular expression is.
  355. A {\it regular expression} is one of:
  356. X
  357. X\begin{enumerate}
  358. X
  359. X\item {\bf char} matches itself, unless it is a special
  360. X                character (metachar): . \ [ ] * + \verb+^+ \$
  361. X
  362. X\item {\bf .} matches any character.
  363. X
  364. X\item {\bf \verb+\+} matches the character following it, except
  365. X        when followed by a left or right round bracket,
  366. X        a digit 1 to 9 or a left or right angle bracket. 
  367. X        (see [7], [8] and [9])
  368. X        It is used as an escape character for all 
  369. X        other meta-characters, and itself. When used
  370. X        in a set ([4]), it is treated as an ordinary
  371. X        character.
  372. X
  373. X\item {\bf [set]} matches one of the characters in the set.
  374. X                If the first character in the set is "\verb+^+",
  375. X                it matches a character NOT in the set, i.e. 
  376. X        complements the set. A shorthand S-E is 
  377. X        used to specify a set of characters S upto 
  378. X        E, inclusive. The special characters "]" and 
  379. X        "-" have no special meaning if they appear 
  380. X        as the first chars in the set.
  381. X                Some examples:
  382. X        \begin{itemize}
  383. X                \item {\bf [a-z]} any lowercase alpha
  384. X
  385. X                \item {\bf [\verb+^+]-]} any char except ] and -
  386. X
  387. X                \item {\bf [\verb+^+A-Z]} any char except uppercase alpha
  388. X
  389. X                \item {\bf [a-zA-Z]} any alpha
  390. X        \end{itemize}
  391. X
  392. X\item {\bf *} any regular expression form [1] to [4], followed by
  393. X                closure char (*) matches zero or more matches of
  394. X                that form.
  395. X
  396. X\item {\bf +} same as [5], except it matches one or more.
  397. X
  398. X\item a regular expression in the form [1] to [10], enclosed
  399. X                as \verb+\+(form\verb+\+) matches what form matches.
  400. X                The enclosure creates a set of tags, used for [8] and for
  401. X                pattern substitution. The tagged forms are numbered
  402. X        starting from 1.
  403. X
  404. X\item {\bf \verb+\+D} a \verb+\+ followed by a digit 1 to 9 matches
  405. X        whatever a
  406. X                previously tagged regular expression ([7]) matched.
  407. X
  408. X\item {\bf \verb+\+<} a regular expression starting with a \verb+\+<
  409. X        construct {\bf \verb+\+>} and/or ending with a \verb+\+>
  410. X        construct, restricts the
  411. X        pattern matching to the beginning of a word, and/or
  412. X        the end of a word. A word is defined to be a character
  413. X        string beginning and/or ending with the characters
  414. X        A-Z a-z 0-9 and \_. It must also be preceded and/or
  415. X        followed by any character outside those mentioned.
  416. X
  417. X\item a composite regular expression xy where x and y
  418. X                are in the form [1] to [10] matches the longest
  419. X                match of x followed by a match for y.
  420. X
  421. X\item {\bf \verb+^+} a regular expression starting with a \verb+^+ character
  422. X        {\bf \$} and/or ending with a \$ character, restricts the
  423. X                pattern matching to the beginning of the line,
  424. X                or the end of line. [anchors] Elsewhere in the
  425. X        pattern, \verb+^+ and \$ are treated as ordinary characters.
  426. X
  427. X\end{enumerate}
  428. X
  429. XEnter the regular expression as the search string and begin the search.
  430. In the next section we will discuss how to use regular expression to do
  431. search and replace operations.
  432. X
  433. X
  434. X\subsection{Regular expression search and replace}
  435. X
  436. This operation is done from a dialog box.
  437. You specify a regular expression to search for and a replacement pattern.
  438. The replacement pattern allows you to replace the matched string with
  439. a string composes of literal text and pieces of the matched string.
  440. XFor example to find two string inside curly braces and interchange
  441. them you would use the search pattern:
  442. X\begin{verbatim}
  443. X     {\([^)]*\)}\(.*\){\([^)]*\)}
  444. X\end{verbatim}
  445. and use the replacement pattern:
  446. X\begin{verbatim}
  447. X     {\3}\2{\1}
  448. X\end{verbatim}
  449. X
  450. The search patterns are the same as used in regular expression search.
  451. The replacement patterns describe how to construct the string that
  452. will replace the string that was matched.
  453. You can construct the replacement string using parts of the matched string.
  454. X
  455. The replacement string is constructed by reading the characters
  456. of the replacement pattern one and a time and interpreting them
  457. as follows:
  458. X
  459. X\begin{enumerate}
  460. X
  461. X\item {\bf char} put that character into the replacement string,
  462. X        unless it is a special character (metachar): \& or \verb+\+.
  463. X
  464. X\item {\bf \&} put the entire matched string into the replacement string.
  465. X
  466. X\item {\bf \verb+\+D} put the Dth matched substring into the replacement
  467. X    string.  A matched substring is a part of the search pattern
  468. X    enclosed in \verb+\+( and \verb+\+).
  469. X    D must be a digit from 1 to 9.
  470. X
  471. X\end{enumerate}
  472. X
  473. After a string is matched it is replaced by the replacement string
  474. constructed according the replacement pattern.
  475. You can decide whether you want to verify each replacement by
  476. setting a toggle in the dialog box.
  477. X
  478. X
  479. X
  480. X
  481. X\section{Customizing Point with Point Options} \label{sect:options}
  482. X
  483. The simplest way to customize Point is to change the values
  484. of the Point options.
  485. There are a number of Point options that affect the way
  486. things are done in Point.
  487. Most options can be changed from the ``PREFS'' menu on the
  488. file browser menu bar.
  489. In this section I will discuss each of the Point options.
  490. X
  491. Another way to customize Point is to change the Tcl code
  492. that controls how the windows look and interact.
  493. I will discuss that in  section \ref{sect:customize}.
  494. X
  495. X
  496. X
  497. X
  498. X\subsection{Point Options}
  499. X
  500. In the following subsections the name of the option is
  501. followed by a colon and its default value.
  502. X
  503. X
  504. X\subsubsection{Browser Appearance Related Options}
  505. X
  506. X\begin{description}
  507. X
  508. X\item[browserFont:fixed (or ``font'' from resource database)]
  509. This sets the font used to display file names in a file browser.
  510. This option is the default font used for new file browsers.
  511. The font of an individual file browser can be set with the
  512. X{\tt browserFont} command (several of which are available
  513. on the ``MISC'' menu on the browser menu bar).
  514. X
  515. X\item[browserGeometry:490x415+656+0]
  516. This is the default geometry for new file browsers.
  517. You can change the geometry of an existing window
  518. with the {\tt MoveWindow} command or with the window manager.
  519. X
  520. X\item[filePattern:*]
  521. This options sets the filter used in displaying file names
  522. in a file browser.
  523. X
  524. X\item[showDirsFirst:True]
  525. If this option is true, Point will list all directories first
  526. X(in alphabetical order) and then the ordinary files
  527. X(in alphabetical order).
  528. If this option is false the directories and files will
  529. be interspersed (in overall alphabetical order).
  530. X
  531. X\item[showSizes:False]
  532. If this option is true, the file browser will show file sizes
  533. next to file names.
  534. X
  535. X\end{description}
  536. X
  537. X
  538. X
  539. X\subsubsection{Text Appearance Related Options}
  540. X
  541. X\begin{description}
  542. X
  543. X\item[eofChar:1]
  544. This options determines which character is used to mark the end of
  545. the file in a text window.
  546. It is specified as the numerical equivalent of its ASCII code.
  547. The default is a small diamond in most fonts.
  548. X
  549. X\item[selectedTextBackground:white]
  550. The option determines the background color for selected text
  551. X(if underlineSelection is 0).
  552. The value must be a color name in the X color database.
  553. X
  554. X\item[selectedTextForeground:black]
  555. The option determines the foreground color for selected text
  556. X(if underlineSelection is 0).
  557. The value must be a color name in the X color database.
  558. X
  559. X\item[textBackground:white (or ``background'' from resource database)]
  560. The option determines the background color for text.
  561. The value must be a color name in the X color database.
  562. X
  563. X\item[textForeground:black (or ``foreground'' from resource database)]
  564. The option determines the foreground color for text.
  565. The value must be a color name in the X color database.
  566. X
  567. X\item[textFont:fixed or ``font'' from resource database]
  568. This options sets the default font used for newly created windows.
  569. You can set the font of an existing window with the {\tt textFont}
  570. command.
  571. It can be any font name that can be found in the X font directories.
  572. X
  573. X\end{description}
  574. X
  575. X
  576. X
  577. X
  578. X\subsubsection{Text Window Appearance Related Options}
  579. X
  580. X\begin{description}
  581. X
  582. X\item[autoZoom:False]
  583. This options causes new windows to be opened in the zoomed state.
  584. X
  585. X\item[copySpriteName:hand1]
  586. The shape of the mouse sprite in text windows to indicate
  587. that Point is in copy mode.
  588. It can be the name of any character in the X cursor font.
  589. X
  590. X
  591. X\item[iconFormat:"File: \%n"]
  592. This option determines the contents of the window icon name that
  593. Point gives the window.
  594. The window manager typically uses this name as the default icon.
  595. The {\it iconFormat} is in the same form as the {\it titleFormat}
  596. X(see below).
  597. X
  598. X\item[SetLineNumbers:Not an option]
  599. Line numbering is determined by window not by a global option.
  600. SetLineNumbers is really a command that changes the state
  601. of line number display in a window.
  602. See the SetLineNumbers for details.
  603. X
  604. X\item[mouseMenuFont:fixed]
  605. The font used in the popup mouse menus.
  606. It can be any font name that can be found in the X font directories.
  607. X
  608. X\item[messageFlags:2]
  609. This option determines how error messages are displayed.
  610. It can be any number from 0 to 15 and is the sum of:
  611. X1 if you want messages to appear in popup dialogue boxes,
  612. X2 if you want messages to appear in the message line of all file browsers,
  613. X4 if you want messages to appear in the title bar of the active window,
  614. X8 if you want messages to appear in the {\tt xterm} window for which Point
  615. was started.
  616. X
  617. X\item[pathNames:False]
  618. This options determines whether full path names are used in text window
  619. title bars and the open file list (if pathNames is True)
  620. or only the last component of the path name is used.
  621. X
  622. X\item[showPartialLines:False]
  623. If only part of a line will fit at the bottom of the window
  624. then the line is not drawn unless this option is true.
  625. X
  626. X\item[spriteBackground:white]
  627. The background color used for the mouse sprite in text windows.
  628. X
  629. X\item[spriteForeground:black]
  630. The foreground color used for the mouse sprite in text windows.
  631. X
  632. X\item[spriteName:left\_ptr]
  633. The shape of the mouse sprite in text windows.
  634. X
  635. X\item[textGeometry:500x400+0+0]
  636. The default geometry for new text windows
  637. X(if one is not specified in the new window command).
  638. The geometry of existing text windows can be changed with the
  639. window manager.
  640. X
  641. X\item[titleFormat:\%n\%r. readOnly. [\%l-\%L]\%c. (modified).]
  642. This option determines the contents of the window title that
  643. Point gives the window.
  644. The window manager typically displayed this title in the title bar.
  645. The {\it titleFormat} is in the form of a format string similar in spirit
  646. to the one given to the C {\tt printf} function.
  647. The title is generated by going through the {\it titleFormat} string
  648. character by character.
  649. All characters except '\%' and the character following it
  650. are copied literally to the title.
  651. A '\%' indicates that some specific string related to the window
  652. is to be copied into the title.
  653. The character after the '\%' determined which string.
  654. The possible values are (and I am including the '\%' here for clarity):
  655. X\begin{itemize}
  656. X\item {\bf \%n} --- the file name (affected by pathNames option).
  657. X\item {\bf \%N} --- the full path name of the file.
  658. X\item {\bf \%s} --- the final component of the file name.
  659. X\item {\bf \%c/modMsg/} --- "modMsg" if the file has changed and "" otherwise.
  660. X        The matching '/'s can be any character that does not
  661. X        appear in "modMsg".
  662. X\item {\bf \%r/readOnlyMsg/} --- "readOnlyMsg" if the file is read only
  663. X        and "" otherwise.
  664. X        The matching '/'s can be any character that does not
  665. X        appear in "readOnlyMsg".
  666. X\item {\bf \%o/overTypeMsg/} --- "overTypeMsg" if Point is in over type
  667. X        mode and "" otherwise.
  668. X        The matching '/'s can be any character that does not
  669. X        appear in "overTypeMsg".
  670. X\item {\bf \%l} --- the line number of the top line in the window.
  671. X\item {\bf \%L} --- the line number of the bottom line in the window.
  672. X\item {\bf \%p} --- the character number (position) of the first character
  673. X        in the window.
  674. X\item {\bf \%P} --- the character number (position) of the last character
  675. X        in the window.
  676. X\item {\bf \%S} --- the size of the file (in characters).
  677. X\item {\bf \%v} --- the column number of the leftmost column in the window.
  678. X\item {\bf \%V} --- the column number of the rightmost column in the window.
  679. X\end{itemize}
  680. X
  681. X\item[underlineSelection:0]
  682. This options determines how the selection is shown in text windows.
  683. A value of 0 causes Point to use the colors specified in the
  684. options {\tt [selected]text\{foreground$\mid$background\}}.
  685. A value of 1 causes selections to be underlined with a one pixel wide line.
  686. A value of 2 causes selections to be underlined with a two pixel wide line.
  687. X
  688. X\end{description}
  689. X
  690. X
  691. X\subsubsection{File and Backup Related Options}
  692. X
  693. X\begin{description}
  694. X
  695. X\item[backupByCopy:True]
  696. If this option is true, then backups will be made by copying the
  697. original file contents into a backup file and then copying the
  698. new contents into the original file.
  699. This way the original file contains the newest version and
  700. hard links are not lost.
  701. If this option is false, then the original file will be
  702. renamed to the backup file and the new contents written to
  703. a new file with the same name as the original file.
  704. This saves one copy but loses hard links.
  705. X
  706. X\item[backupDepth:1]
  707. This options determines how many levels of backup point maintains.
  708. If backupDepth is set to 0 then no backups are made.
  709. Otherwise it must be a value from 1 to 9.
  710. X
  711. X\item[backupNameFormat:\%n.\%v]
  712. This option controls how the path name of backup files is generated.
  713. It is like a {\tt printf} format string.
  714. The backup file path name is generated by reading this format string
  715. one character at a time.
  716. All characters except ``\%'' are copied to the path name unchanged.
  717. XEach ``\%'' is followed by a format character that indicates
  718. what string value should replace the \% and the format character.
  719. The following format characters are recognized:
  720. X    \begin{description}
  721. X    \item[n] Insert the name of the file (not the path name but
  722. X        just the last component of the path name).
  723. X    \item[b] Insert the base name of the file, that is, the name
  724. X        without the extension.
  725. X        The base name is the the name up but not including
  726. X        the last ``.'' in the name.
  727. X    \item[v] The version number.
  728. X        The most recent backup will be version 1, the next
  729. X        most recent version 2, etc.
  730. X        Only 9 versions are supported so this will always
  731. X        be a single digit (1 to 9).
  732. X    \item[other] Anything else will be passed through (without the \%).
  733. X    \end{description}
  734. This formats allows relative or absolute path names.
  735. XFor example you can have PC style backups with:
  736. X\begin{verbatim}
  737. X    set backupNameFormat %b.bak
  738. X\end{verbatim}
  739. You can have simple emacs style backups with:
  740. X\begin{verbatim}
  741. X    set backupNameFormat %n~
  742. X\end{verbatim}
  743. You can have complex emacs style backups with:
  744. X\begin{verbatim}
  745. X    set backupNameFormat %n~%v~
  746. X\end{verbatim}
  747. I use:
  748. X\begin{verbatim}
  749. X    set backupNameFormat bak/%n.%v
  750. X\end{verbatim}
  751. X
  752. X\item[maxFiles:200]
  753. The maximum number of files that can be edited at one time.
  754. This limit will be removed soon.
  755. X
  756. X\item[nBuffers:300]
  757. This options sets the number of internal buffers Point uses for text.
  758. XEach buffer is 1024 bytes long.
  759. This value must be 25 or greater.
  760. A small number of buffers means that Point does more I/O.
  761. If you have a large buffer cache in the operating system
  762. this will not slow you down very much and you will save
  763. redundant buffering.
  764. X
  765. X\item[readOnly:False]
  766. This option determines whether new windows will be marked as read-only.
  767. If so, no editing will be allowed.
  768. If the UNIX file permissions do not allow writing the file,
  769. the window will be marked read-only in any case.
  770. X
  771. X\end{description}
  772. X
  773. X
  774. X\subsubsection{Interaction Style Options}
  775. X
  776. X\begin{description}
  777. X
  778. X\item[autoIndent:True]
  779. This options determines whether autoindenting occurs when you
  780. start a new line (with the Return key).
  781. If set to True, it causes each new line to be spaced over by exactly the
  782. same spaces and tabs as the previous line.
  783. Point will not use tabs if the previous line used spaces.
  784. X
  785. X\item[button1ScrollsDown:False]
  786. If this option is True then the scrollbars work such that
  787. button 1 (the left mouse button) scrolls
  788. down (towards the end of the file) and button 3 (the right mouse
  789. button) scrolls up (towards the beginning of the file).
  790. Setting this options to False reverses the meaning of button 1
  791. and button 3.
  792. X
  793. X\item[insertReplaces:False]
  794. If this option is True and the selection contains more than one
  795. character, then a typed character will delete the selection
  796. before being inserted.
  797. If this option is false the selection is only used to determine
  798. the insertion point and is not replaced by the insertion.
  799. X
  800. X\item[menuDelay:600]
  801. This options determines the number of milliseconds of delay
  802. after a mouse menu button is pressed before the mouse menu
  803. comes up.
  804. X
  805. X\item[menuTolerance:10]
  806. This options sets the number of pixels you have to move (after pressing
  807. the mouse button and bringing up a mouse menu) before you leave the
  808. X``no motion'' menu item.
  809. X
  810. X\item[mouseSpriteMenu:False]
  811. This options determines whether mouse menus are displayed using
  812. the mouse cursor (if mouseSpriteMenu is True) or with a circular
  813. menu drawn over the text (if mouseSpriteMenu is False).
  814. There is a delay (determined by the {\tt menuDelay} option)
  815. before the menu comes up
  816. so that fast mouse menu commands will not bring up the menu.
  817. X
  818. X\item[overType:False]
  819. This options determines whether typed characters are inserted
  820. at the insertion point or whether they replace the first character
  821. of the selection.
  822. Setting this to True allows you to type over text instead of inserting
  823. in front of it.
  824. X
  825. X\item[returnString:""]
  826. This option is used to coordinate modal dialogue boxes.
  827. When Point puts up a dialogue box where it needs to wait for 
  828. an answer, it sets {\tt returnString} to the empty string and
  829. then processes events while waiting for it to become non-empty.
  830. The {\tt WaitForReturnString} command is used to wait until the
  831. X{\tt returnString} option is set to a non-empty value.
  832. X
  833. X\item[rightMargin:999]
  834. This option determines when typed lines will be automatically broken.
  835. The intention of the default of 999 is to not break lines but allow
  836. them to be long.
  837. This option also affects the margins used by the {\tt JustifySel} command.
  838. In fact, that command will only be useful if this option is set to the
  839. line length you want to justify to.
  840. X
  841. X\item[tabWidth:8]
  842. This options sets the location of the tab stops in the text.
  843. Tab stops are every {\tt tabWidth} characters.
  844. Tabs must be equally spaced.
  845. X
  846. X\item[tkScrolling:False]
  847. Determines the scrolling style in text window.
  848. If this option is true the ``Macintosh'' scrolling style is used.
  849. If this options is false the ``line to top'' scrolling style is used.
  850. X
  851. X\item[undoMotion:False]
  852. Point records motion in the file (scrolling and jumping) in its
  853. undo history but normally it is ignored.
  854. If this option is True then undo will undo motion as well
  855. as edits.
  856. X
  857. X\end{description}
  858. X
  859. X
  860. X
  861. X\subsubsection{Search Options}
  862. X
  863. X\begin{description}
  864. X
  865. X\item[findWholeWords:False]
  866. This options determines whether searched for strings can be surrounded
  867. by alphanumeric character.
  868. Setting {\tt findWholeWords} to True is useful when looking for variable
  869. names like {\it i} which occur frequently within other names.
  870. X
  871. X\item[ignoreCase:True]
  872. This options determined whether case is considered in searches.
  873. X
  874. X\item[keywordPattern:*.c *.h]
  875. This specifies the files that are scanned for keywords in the
  876. keyword search commands.
  877. X
  878. X\item[linesOverFind:999]
  879. When a string is searched for and the window must by jumped in
  880. order to show the string just found,
  881. Point needs to know how to position the window
  882. in relation to the line the found string is on.
  883. This option determines how many lines down from the top of the
  884. window a found string will be placed.
  885. A value of 0 means that it will be placed on the top line.
  886. If the value is greater than the number of lines in the window,
  887. the found string will be placed in the middle of the window
  888. X(this is the default case).
  889. This option also affects text positioning in the window after a
  890. X{\tt GotoLine} command if the {\tt lof} argument is specified.
  891. X
  892. X\item[wrapInSearches:False]
  893. If this option is set to True then forward searches will
  894. wrap around the end of the file, that is,
  895. a search started in the middle of a file will search
  896. to the end of the file then continue searching at the
  897. beginning of the file until it either finds the word
  898. or has searched the entire file.
  899. X
  900. X\end{description}
  901. X
  902. X
  903. X
  904. X\subsubsection{Mouse Menu Options}
  905. X
  906. X\begin{description}
  907. X
  908. X\item[lmm1: Ext]
  909. The text in the no-motion entry of mouse menu 1.
  910. X
  911. X\item[cmm1:ExtendSelection]
  912. X
  913. X\item[lmm1n: $<<$]
  914. The text in the move-north entry of mouse menu 1.
  915. X
  916. X\item[cmm1n:Search backward [selection get]]
  917. The command executed by the move-north entry of mouse menu 1.
  918. X
  919. X\item[lmm1e:Undo]
  920. The text in the move-east entry of mouse menu 1.
  921. X
  922. X\item[cmm1e:Undo]
  923. The command executed by the move-east entry of mouse menu 1.
  924. X
  925. X\item[lmm1s: $>>$]
  926. The text in the move-south entry of mouse menu 1.
  927. X
  928. X\item[cmm1s:Search forward [selection get]]
  929. The command executed by the move-south entry of mouse menu 1.
  930. X
  931. X\item[lmm1w:Again]
  932. The text in the move-west entry of mouse menu 1.
  933. X
  934. X\item[cmm1w:Again]
  935. The command executed by the move-west entry of mouse menu 1.
  936. X
  937. X\item[lmm2: Dup]
  938. The text in the no-motion entry of mouse menu 2.
  939. X
  940. X\item[cmm2:CopyToHereMode]
  941. The command executed by the no-motion entry of mouse menu 2.
  942. X
  943. X\item[lmm2n:Del ]
  944. The text in the move-north of mouse menu 2.
  945. X
  946. X\item[cmm2n:Delete]
  947. The command executed by the move-north of mouse menu 2.
  948. X
  949. X\item[lmm2e:Copy]
  950. The text in the move-east entry of mouse menu 2.
  951. X
  952. X\item[cmm2e:CopySelToMouse]
  953. The command executed by the move-east entry of mouse menu 2.
  954. X
  955. X\item[lmm2s:Ins ]
  956. The text in the move-south entry of mouse menu 2.
  957. X
  958. X\item[cmm2s:Insert]
  959. The command executed by the move-south entry of mouse menu 2.
  960. X
  961. X\item[lmm2w:Move]
  962. The text in the move-west entry of mouse menu 2.
  963. X
  964. X\item[cmm2w:MoveSelToMouse]
  965. The command executed by the move-west entry of mouse menu 2.
  966. X
  967. X\end{description}
  968. X
  969. X
  970. X
  971. X\subsection{Options you may want to change}
  972. X
  973. There are many Point options and in this section I want to list the ones
  974. that you are most likely to want to change.
  975. X
  976. X\begin{itemize}
  977. X
  978. X\item {\bf tkScrolling}
  979. I prefer line-to-top style scrolling myself since I use it to exactly
  980. position code where I can look at as much as possible.
  981. X
  982. X\item {\bf button1ScrollsDown}
  983. I learned this style of scrolling using line-to-top scrolling at Xerox.
  984. It depends in whether your mental model has the mouse rotated to 3
  985. o'clock or to 9 o'clock.
  986. X
  987. X\item {\bf backupNameFormat} and {\bf backupDepth}
  988. I like to put the backups in a subdirectory where they don't clutter
  989. up my directory but they are there when I need them.
  990. Since they are out of the way I keep six backups.
  991. This seems to be enough for almost all screw-ups.
  992. My format is ``bak/\%n.\%v''.
  993. X
  994. X\item {\bf textColors}
  995. What can I say?  Color is fun.
  996. X
  997. X\item {\bf textFont}
  998. I use {\tt 6x13} because I like to see as much as possible.
  999. If you use a larger font you will want to have some smaller fonts
  1000. on the menus so that you can temporarily change to a smaller font
  1001. to see more stuff.
  1002. X
  1003. X\item {\bf findWholeWords}
  1004. This is handy when you are looking for instance of the identifier
  1005. X{\it i} and in other similar cases.
  1006. X
  1007. X\item {\bf ignoreCase}
  1008. Normally I have this true since I hate to type shifted letters,
  1009. but once in a while you want case to matter to separate the wheat
  1010. from the chaff.
  1011. X
  1012. X\item {\bf linesOverFind}
  1013. Ordinarily you do not change this interactively but each person
  1014. has a different idea about where found string should be.
  1015. I use the middle of the window and so set this to 999.
  1016. X
  1017. X\end{itemize}
  1018. X
  1019. X
  1020. X
  1021. X\subsection{Setting local options by directory with .ptdirrc}
  1022. X
  1023. XEach time Point changes to a new directory it looks for a
  1024. file named {\tt .ptdirrc} in the new directory.
  1025. If there is one, it reads it in as a setup file.
  1026. This allows you to set options by directory.
  1027. X
  1028. XFor example you might want to change the option {\tt textForeground}.
  1029. Then you could tell by the color of the text which directory
  1030. it had come from.
  1031. X
  1032. Or you might want to have different {\tt backupDepth}s and
  1033. different {\tt backupNameFormat}s in different directories.
  1034. You might even want to have a message window pop up when
  1035. you change to a directory, an active reminder of something.
  1036. X
  1037. X
  1038. X
  1039. X\section{Customizing Point Using Tcl} \label{sect:customize}
  1040. X
  1041. Point is implemented using the Tcl command language and the Tk X toolkit.
  1042. This means that all user actions cause Tcl code to be interpreted.
  1043. All the Point commands are added to the Tcl interpreter hence all the
  1044. functionality of Point is available from Tcl
  1045. as well as  all of the Tk toolkit functionality.
  1046. Together these make a highly configurable text editor.
  1047. X
  1048. All the functionality described in this manual is achieved though
  1049. the Tcl code in {\tt ptsetup.tcl}.
  1050. You might want to look through that file (using Point for course!)
  1051. to get an idea of what is there.
  1052. X
  1053. All customization of Point is done by editing the {\tt ptsetup.tcl} file.
  1054. In this section we will describe what kinds of changes to make
  1055. to perform various levels of customization in Point.
  1056. X
  1057. X
  1058. X\subsection{Setting Point Options}
  1059. X
  1060. You will notice that the near the beginning of {\tt ptsetup.tcl}
  1061. there are a number of lines that set Point options that look like:
  1062. X\begin{verbatim}
  1063. X    Option set selectedTextBackground lawngreen
  1064. X\end{verbatim}
  1065. Any Point option can be set with a similar line.
  1066. The keywords ``Option set'' determines the command and is
  1067. always the same.
  1068. The fourth string is the name of the Point option.
  1069. These are listed in a section \ref{sect:options}.
  1070. The third string is the new value of the option.
  1071. That's all there is to it.
  1072. X
  1073. Another easy thing to do is to change the default geometries
  1074. used in various commands.
  1075. Above the {\tt Option set} lines you see three lines:
  1076. X\begin{verbatim}
  1077. X     set location1 "502x410+0+0"
  1078. X     set location2 "502x390+530+415"
  1079. X     set location3 "502x390+530+0"
  1080. X\end{verbatim}
  1081. By changing these geometries you can change where the command
  1082. place windows.
  1083. X
  1084. Unfortunately not all geometries are specified here
  1085. X(I'm working on changing that).
  1086. So you might search through {\tt ptsetup.tcl} for other
  1087. geometry specifications that you can change.
  1088. X
  1089. X
  1090. X
  1091. X\subsection{ Changing the Menus }
  1092. X
  1093. The next level of customization involves changing the menus.
  1094. I have set things up so the menus are specified using Tcl
  1095. lists which are structured a bit like Lisp lists except brackets
  1096. are used instead of parentheses.
  1097. Thus you can change the menus without having to learn too much about Tcl
  1098. and the Tk toolkit commands.
  1099. X
  1100. A word of warning: Tcl lists are fragile in the sense that a missing
  1101. bracket makes the list invalid.
  1102. The way Point is currently set up, if the Tcl menu list is invalid
  1103. than the menu doesn't get made and lots of bad things happen.
  1104. Thus you should always change a copy of {\tt ptsetup.tcl}.
  1105. I use {\tt egrep -n '\{|\}' ptsetup.tcl | more} to find sticky
  1106. problems with mismatched brackets.
  1107. I will try to make Point more robust in this respect in the future.
  1108. X
  1109. Let us look at the structure of menu specifications.
  1110. The browser menu bar is created using the Tcl variable {\tt BrowserMenuSpec}
  1111. and it is set as follows.
  1112. XFor this explanation I am using a reduced version of the 
  1113. distributed menu bar specification.
  1114. The full version can be found in {\tt ptsetup.tcl}.
  1115. It has more items on it but they are similar to these items.
  1116. X
  1117. X\begin{verbatim}
  1118. set BrowserMenuSpec {
  1119. X     {button New "  New  " {
  1120. X          {OpenFileOrCD 502x410+0+0}
  1121. X          {OpenFileOrCD 502x390+530+415}
  1122. X          {OpenFileOrCD 502x390+530+0}
  1123. X     }}
  1124. X     {menu   DIRS "DIRS"   DIRS}
  1125. X     {button DelFile "Del File" {
  1126. X          {exec rm [selection get];Option set filePattern "*"}
  1127. X          Bell
  1128. X          Bell
  1129. X     }}
  1130. X     {button Close "  Close  " {
  1131. X          CloseBrowser
  1132. X          Bell
  1133. X          Bell
  1134. X     }}
  1135. X     {menu   QUIT "QUIT"   QuitMenu}
  1136. X}
  1137. X\end{verbatim}
  1138. X
  1139. A {\it menu bar specification} is a list of items each of which is
  1140. also a list.
  1141. The specification above has four sublists
  1142. X(button, menu, button, button, menu).
  1143. XEach sublist will create one button on the menu bar.
  1144. The only two types allowed are ``button'' and ''menu''.
  1145. X
  1146. A ``button'' sublist starts with the keyword ``button''.
  1147. The second item is the name of the button.
  1148. This is used to bind other events to that button.
  1149. We will ignore it for now.
  1150. The third string is the text that will appear on the button.
  1151. You can put spaces here to space out the buttons.
  1152. The fourth item on the list is a sublist of three Tcl commands.
  1153. These are the commands that will be executed when the user clicks
  1154. the left, middle and right mouse buttons on this menu bar button.
  1155. The one for ``Close'' is the simplest.
  1156. Note that newlines can be used within bracketed lists for readability.
  1157. The left mouse button action is the Point command ``CloseBrowser''.
  1158. In general any Point command can be put here.
  1159. The Point command are all listed in section \ref{sect:commands}.
  1160. Note that we use default (ring the bell) actions for the middle
  1161. and right mouse buttons if we do not want to use them.
  1162. The command must be there and the list must have exactly three commands.
  1163. You can use ``Bell'' and ``DoNothing'' as dummy commands.
  1164. X
  1165. The ``DelFile'' button is a little more complicated.
  1166. Its left mouse button command consists of two Tcl commands.
  1167. Note that if the command is more than a single string it
  1168. must be a sublist and enclosed in brackets.
  1169. If several Tcl/Point commands are to be executed then they
  1170. must be separated by semicolons or newlines.
  1171. The phrase {\tt [selection get]} is a Tcl expression that inserts
  1172. the current X selection as that argument.
  1173. The {\tt exec} command is a Tcl command to execute a Unix command,
  1174. in this case the {\tt rm} command.
  1175. Thus the first command will delete the file that is named in the
  1176. XX selection.
  1177. The second command is a Point command to get the {\tt filePattern} option.
  1178. This will have the effect of forcing Point to reread the directory and
  1179. rewrite the list of files.
  1180. The ``New'' button has a different command for each mouse button.
  1181. XEach command has an argument so it must be enclosed in brackets
  1182. so that the command is a single item on the list.
  1183. XEach command is the Tcl procedure {\tt OpenFileOrCD} which is given below:
  1184. X\begin{verbatim}
  1185. proc OpenFileOrCD {geometry} {
  1186. X     set name [selection get]
  1187. X     if [file isdirectory $name] \
  1188. X          "CD $name" \
  1189. X          "OpenWindow $name $geometry"
  1190. X}
  1191. X\end{verbatim}
  1192. It gets the X selection and tests if it is a file or a directory.
  1193. If it is a directory to changed to it and if it is a file
  1194. it opens a window on that file.
  1195. X
  1196. A ``menu'' sublist starts with the keyword ``menu''.
  1197. The second string is the name of the button.
  1198. This is used to bind other events to that button.
  1199. The third string is the text that will appear on the button.
  1200. The forth string is the {\it name} of the string where
  1201. the submenu is specified.
  1202. Note that the submenu itself {\it cannot} appear here.
  1203. The submenu must be specified as another Tcl variable and
  1204. the name of that Tcl variable is put here.
  1205. X
  1206. Let's look at the specification of {\tt QuitMenu}:
  1207. X\begin{verbatim}
  1208. set QuitMenu {
  1209. X     {command "And save all" {QuitPoint save}}
  1210. X     {command "And ask" MakeQuitBox}
  1211. X     {command "And discard edits" {QuitPoint discard}}
  1212. X}
  1213. X\end{verbatim}
  1214. X
  1215. Menu specifications are similar to but a bit different from
  1216. menu bar specifications.
  1217. They also consist of a series of sublists,
  1218. each of which specifies one item on the menu.
  1219. There are five types of sublists,
  1220. but only the ``command'' type is used in {\tt QuitMenu}.
  1221. The ``command'' specification is similar to the ``button'' specification.
  1222. It starts with the keyword ``command'' and then the text of the
  1223. menu item.
  1224. X(No name is required as it is with a ``button''.)
  1225. The third item is a single command to execute when the button is selected.
  1226. X(You cannot give a command for each mouse buttons --- you should
  1227. use a submenu instead.)
  1228. X{\tt QuitPoint} is a Point command and {\tt MakeQuitBox} is a Tcl procedure.
  1229. You might look at {\tt MakeQuitBox} in {\tt ptsetup.tcl}
  1230. but to understand it requires familiarity with the Tk toolkit.
  1231. X
  1232. You can also look up the {\tt DIRS} menu specification string in
  1233. X{\tt ptsetup.tcl}.
  1234. It is not difficult to understand.
  1235. X
  1236. The Tcl variable {\tt TextMenuSpec} specifies
  1237. the text window menu bar.
  1238. It works just like the browser menu bar specification.
  1239. X
  1240. As a larger example of submenu specifications
  1241. let us look at the {\tt EditMenu} specification
  1242. used in {\tt TextMenuSpec}.
  1243. Below is an abbreviated version of it:
  1244. X\begin{verbatim}
  1245. set EditMenu {
  1246. X     {command "Redraw window" {Redraw}}
  1247. X     {cascade "Copy =>" {
  1248. X          {command "Note destination" {CopyToHereMode}}
  1249. X          {command "Sel to destination" {CopyToHereMode}}
  1250. X          {command "Cancel copy mode" {CancelModes}}
  1251. X     }}
  1252. X     {separator}
  1253. X     {command "Repeat last edit" {Again mostrecent}}
  1254. X}
  1255. X\end{verbatim}
  1256. This shows two more menu item types: ``separator'' and ``cascade''.
  1257. The ``separator'' one is obvious:
  1258. it generates a horizontal separator line in the menu.
  1259. The ``cascade'' type creates a pull-right (or walking) submenu.
  1260. The second string is the text to put in the menu item.
  1261. The third item in the sublist is yet another menu specification.
  1262. But this time the menu string itself must appear {\it not}
  1263. the name of a variable that it is set to as in menu bar specifications.
  1264. This is an admitted inconsistency based on the idea that these
  1265. submenus would be fairly small but menu bar menus would be larger.
  1266. You could have several levels of submenus but they get tedious for
  1267. the user if they are nested too deeply.
  1268. X
  1269. So that is the format of the menu strings.
  1270. To change the browser menu, change the value the Tcl variable
  1271. X{\tt BrowserMenuSpec} is set to and similarly for {\tt TextMenuSpec}.
  1272. You might try small changes in the existing menus as build up as you
  1273. gain confidence.
  1274. It is quite easy to remove or rearrange menu items
  1275. and it is fairly easy to add your own items.
  1276. Cascade submenus are also quite easy except for keeping
  1277. the brackets matched.
  1278. X
  1279. X
  1280. X
  1281. X\subsection{ Extending Point Using Tcl as a Macro Language }
  1282. X
  1283. Since Tcl is an interpreted language you can use it to write Point macros.
  1284. Let's look at a couple of examples.
  1285. X
  1286. This is a macro that indents each line that contains some
  1287. part of the selection:
  1288. X\begin{verbatim}
  1289. proc IndentSelection {} {
  1290. X     set sel [Sel get]
  1291. X     set here [lindex $sel 0]
  1292. X     set stop [lindex $sel 1]
  1293. X     for {} 1 {} {
  1294. X          MoveSel line left0
  1295. X          set here [lindex [Sel get] 0]
  1296. X          if {$here>$stop} \
  1297. X               break;
  1298. X          InsertString \t
  1299. X          set stop [expr $stop+1]
  1300. X          MoveSel char down
  1301. X     }
  1302. X}
  1303. X\end{verbatim}
  1304. X
  1305. The first three lines get the bounds of the selection.
  1306. The loop beginning in the fourth line continues until a {\tt break}
  1307. is executed.
  1308. We move the selection to the very first character of the line
  1309. and get its location.
  1310. If we are beyond the original selection then the loop is done.
  1311. Otherwise we insert a tab to indent the line.
  1312. Since we have added a character we have to adjust {\tt stop}.
  1313. XFinally we move down to the next line and repeat the loop.
  1314. X
  1315. This example sends the selection through a Unix command and
  1316. replaces it with the output of the Unix command.
  1317. this is analogous to the ``!'' command in {\tt vi}.
  1318. X\begin{verbatim}
  1319. proc Filter {{cmd fmt}} {
  1320. X     set s [Sel return]
  1321. X     set ret [catch {exec $cmd < $s} ns]
  1322. X     if {$ret==0} DeleteToScrap
  1323. X     InsertString $ns
  1324. X}
  1325. X\end{verbatim}
  1326. Note that {\tt fmt} is the default {\tt cmd}.
  1327. This fills the text to 72 character lines.
  1328. XFirst we get the selection and send it to the Unix command.
  1329. We use {\tt catch} in case the Unix command fails.
  1330. If the command succeeds we delete the selection
  1331. and replace it with the standard output of the command.
  1332. Otherwise we insert the error message in front of
  1333. the original selection.
  1334. X
  1335. The following three Tcl procedures make it easy to
  1336. experiment with macros:
  1337. X\begin{verbatim}
  1338. proc DefineMacro {{id 0}} {
  1339. X     set name Macro$id
  1340. X     global $name
  1341. X     set $name [selection get]
  1342. X}
  1343. X
  1344. proc ExecMacro {{id 0}} {
  1345. X     set name Macro$id
  1346. X     global $name
  1347. X     # Note the two levels of indirection on name
  1348. X     eval [set $name]
  1349. X}
  1350. X
  1351. proc ExecSel {{id 0}} {
  1352. X     eval [selection get]
  1353. X}
  1354. X\end{verbatim}
  1355. X``DefineMacro'' defines the selection as the name of the macro
  1356. and ``ExecMacro'' executes the macro with that name.
  1357. X``ExecSel'' is used to read in the macro definition.
  1358. As I was writing the above indenting macro I worked as follows.
  1359. XFirst I defined ``IndentSelection'' as the macro with ``DefineMacro''.
  1360. Then I wrote the ``proc'' definition of ``IndentSelection'', selected
  1361. it and entered the definition with ``ExecSel''.
  1362. Then I selected the sample text and executes ``ExecMacro''.
  1363. When there was an error, I corrected the definition,
  1364. entered it with ``ExecSel'' and retried it with ``ExecMacro''.
  1365. X
  1366. X
  1367. X
  1368. X
  1369. X
  1370. X\section{Hints For Using Point} \label{sect:hints}
  1371. X
  1372. In this section I will describe how a number of common
  1373. editing tasks are best performed in Point.
  1374. This is to give you an idea of some styles of editing
  1375. that the commands will support.
  1376. I will use the notations LMB, MMB and RMB for the left,
  1377. middle and right mouse buttons.
  1378. X
  1379. X{\bf To make many copies of a line(s):}
  1380. X\begin{enumerate}
  1381. X\item Select the line(s) to copy (triple click and drag while holding down
  1382. the third click for multiple lines).
  1383. X\item DeleteToScrap (F1) (to copy the lines into the scrap buffer).\footnote{
  1384. Copy to scrap would also work here but it is a less common command
  1385. and not as instinctive as delete for most people.}
  1386. X\item InsertFromScrap (F2) to replace the deleted copy.
  1387. X\item Select an insertion point and InsertFromScrap (F2).
  1388. X\item Repeat 4 as many times as necessary.
  1389. X\end{enumerate}
  1390. X
  1391. X{\bf To make one copy of a some line(s) right next to the line(s):}
  1392. X\begin{enumerate}
  1393. X\item Select the lines.
  1394. X\item Duplicate, duplicate (Click the MMB twice).
  1395. X\end{enumerate}
  1396. X
  1397. X{\bf To make one copy of a some line(s) somewhere else:}
  1398. X\begin{enumerate}
  1399. X\item Select at the location you want to copy the lines to.
  1400. X\item Duplicate (Click the MMB).
  1401. X\item Select the lines.
  1402. X\item Duplicate (Click the MMB).
  1403. X\end{enumerate}
  1404. X
  1405. X{\bf To make one copy of a some line(s) somewhere else (another method):}
  1406. X\begin{enumerate}
  1407. X\item Select the lines.
  1408. X\item Move the mouse to the location you want to copy the lines to.
  1409. X\item CopySelToMouse (press MMB and move right)
  1410. X\end{enumerate}
  1411. X
  1412. X{\bf To see more a file:}
  1413. X\begin{itemize}
  1414. X\item Zoom the window, or
  1415. X\item Change to a smaller font (File menu ``SetTextFont $=>$'' submenu).
  1416. X\end{itemize}
  1417. X
  1418. X{\bf Note:} I zoom any window that I am going to be using for more than
  1419. a minute or two.
  1420. And then I unzoom it when I am finished working with it.
  1421. I zoom and unzoom windows quite frequently.
  1422. X
  1423. X{\bf To look at two windows at the same time:}
  1424. X\begin{enumerate}
  1425. X\item Move them to different quadrants.
  1426. X\item Do this by clicking a mouse button on the ``MoveW'' menu bar item.
  1427. X(LMB for the NW quadrant, MMB for the SE quadrant, RMB for the NE quadrant)
  1428. X\end{enumerate}
  1429. X
  1430. X{\bf To switch between two places in a file:}
  1431. X\begin{enumerate}
  1432. X\item Jump to the other place.
  1433. X\item Use jump to last place to switch (click the MMB on ``Jump'')
  1434. X\end{enumerate}
  1435. X{\bf or}
  1436. X\begin{enumerate}
  1437. X\item Use forward and backward search to switch between two
  1438. instances of a name (such as the definition and a use of a procedure).
  1439. X\end{enumerate}
  1440. X
  1441. X{\bf To look at all instances of a name in a collection of files:}
  1442. X\begin{enumerate}
  1443. X\item Invoke search for selected keyword (RMB on the ``Tag'' menu bar item)
  1444. X\item Fill in the form and search.
  1445. X\end{enumerate}
  1446. X
  1447. X{\bf To move a procedure header to the top of the window:}
  1448. X\begin{enumerate}
  1449. X\item Click with the LMB on the scroll bar beside the top
  1450. line of the procedure.
  1451. X\end{enumerate}
  1452. X
  1453. X{\bf To replace words with nearby words:}
  1454. X\begin{enumerate}
  1455. X\item select the word to replace (double click with the LMB)
  1456. X\item delete (F1)
  1457. X\item duplicate (click the MMB) to mark the insertion point
  1458. X\item select the new word
  1459. X\item duplicate (click the MMB) to duplicate the selected word
  1460. to the remembered insertion point
  1461. X\end{enumerate}
  1462. X
  1463. X{\bf To insert a nearby word while typing:}
  1464. X\begin{enumerate}
  1465. X\item type up to the word
  1466. X\item duplicate
  1467. X\item select the word
  1468. X\item duplicate
  1469. X\item continue typing
  1470. X\end{enumerate}
  1471. X
  1472. X{\bf To do a search and replace:}
  1473. X\begin{enumerate}
  1474. X\item Use the replace command
  1475. X\end{enumerate}
  1476. X
  1477. X{\bf To do a search and replace (another method):}
  1478. X\begin{enumerate}
  1479. X\item Select the string to search for and search forward and then backward
  1480. X(this sets the remembered search string)
  1481. X\item search for the string until you find one you want to replace
  1482. X\item replace the string
  1483. X\item search for the next one with RepeatSearch (F4)
  1484. X\item optionally replace with Again (F5)
  1485. X\item repeat until done
  1486. X\end{enumerate}
  1487. X
  1488. X
  1489. X\input{cmds.tex}
  1490. X
  1491. X\end{document}
  1492. X
  1493. END_OF_FILE
  1494. if test 53933 -ne `wc -c <'doc/userman.2'`; then
  1495.     echo shar: \"'doc/userman.2'\" unpacked with wrong size!
  1496. fi
  1497. # end of 'doc/userman.2'
  1498. fi
  1499. echo shar: End of archive 14 \(of 15\).
  1500. cp /dev/null ark14isdone
  1501. MISSING=""
  1502. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do
  1503.     if test ! -f ark${I}isdone ; then
  1504.     MISSING="${MISSING} ${I}"
  1505.     fi
  1506. done
  1507. if test "${MISSING}" = "" ; then
  1508.     echo You have unpacked all 15 archives.
  1509.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1510. else
  1511.     echo You still need to unpack the following archives:
  1512.     echo "        " ${MISSING}
  1513. fi
  1514. ##  End of shell archive.
  1515. exit 0
  1516. -- 
  1517. --
  1518. Molecular Simulations, Inc.            mail: dcmartin@msi.com
  1519. 796 N. Pastoria Avenue                uucp: uunet!dcmartin
  1520. Sunnyvale, California 94086            at&t: 408/522-9236
  1521.