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

  1. Newsgroups: comp.sources.x
  2. Path: uunet!zaphod.mps.ohio-state.edu!mips!msi!dcmartin
  3. From: crowley@chaco.cs.unm.edu (Charlie Crowley)
  4. Subject: v17i005: point text editor (TCL and TK), Part04/16
  5. Message-ID: <1992Mar18.141358.26648@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:13:58 GMT
  11. Approved: dcmartin@msi.com
  12.  
  13. Submitted-by: crowley@chaco.cs.unm.edu (Charlie Crowley)
  14. Posting-number: Volume 17, Issue 5
  15. Archive-name: tcl-editor/part04
  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 3 (of 15)."
  24. # Contents:  Changes.doc ana.h cmdTable.c cursor.c pt.h spans.c
  25. #   tclLib/textMenu.tcl
  26. # Wrapped by crowley@chaco.cs.unm.edu on Tue Mar 10 15:05:36 1992
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'Changes.doc' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'Changes.doc'\"
  30. else
  31. echo shar: Extracting \"'Changes.doc'\" \(6474 characters\)
  32. sed "s/^X//" >'Changes.doc' <<'END_OF_FILE'
  33. X    Changes to Point
  34. X
  35. X        *** Chages in Version 1.2 ***
  36. X
  37. X*** Searching ***
  38. X
  39. Most searches are the same as before, that is, no regular expressions and
  40. no special characters are recognized in searches.  This includes the 
  41. searches from the ">>" and "<<" buttons in text window menus, the searches
  42. from F3 and F4 and most of the seaches in the GOTO/Search for String
  43. menu.  But there are four new entries on that menu ">> for selected RE",
  44. X"<< for selected RE", ">> for last RE" and "<< for last RE" that use
  45. a regular expression search.  In addition the search dialog box 
  46. X(available from the "For string ..." menu item or by clicking the middle
  47. mosue button on either the ">>" or "<<" buttons) has a switch labelled
  48. X"Regular expression search" which determined whether the search from
  49. the dialog box is a regular expression search or not.
  50. X
  51. In a regular expression search certain characters are treated specially.
  52. The format of the regular expressions is the same as found in the Unix
  53. programs: ed, ex, vi, sed and grep, that is, limited regular expressions
  54. where you can only the the Kleene star on a single character.  The form
  55. of the legal regular expressions is:
  56. X
  57. X[1]     char    matches itself, unless it is a special
  58. X                character (metachar): . \ [ ] * + ^ $
  59. X
  60. X[2]     .       matches any character.
  61. X
  62. X[3]     \       matches the character following it, except
  63. X        when followed by a left or right round bracket,
  64. X        a digit 1 to 9 or a left or right angle bracket. 
  65. X        (see [7], [8] and [9])
  66. X        It is used as an escape character for all 
  67. X        other meta-characters, and itself. When used
  68. X        in a set ([4]), it is treated as an ordinary
  69. X        character.
  70. X
  71. X[4]     [set]   matches one of the characters in the set.
  72. X                If the first character in the set is "^",
  73. X                it matches a character NOT in the set, i.e. 
  74. X        complements the set. A shorthand S-E is 
  75. X        used to specify a set of characters S upto 
  76. X        E, inclusive. The special characters "]" and 
  77. X        "-" have no special meaning if they appear 
  78. X        as the first chars in the set.
  79. X                examples:        match:
  80. X
  81. X                        [a-z]    any lowercase alpha
  82. X
  83. X                        [^]-]    any char except ] and -
  84. X
  85. X                        [^A-Z]   any char except uppercase
  86. X                                 alpha
  87. X
  88. X                        [a-zA-Z] any alpha
  89. X
  90. X[5]     *    any regular expression form [1] to [4], followed by
  91. X                closure char (*) matches zero or more matches of
  92. X                that form.
  93. X
  94. X[6]     +       same as [5], except it matches one or more.
  95. X
  96. X[7]     \(      a regular expression in the form [1] to [10], enclosed
  97. X        \)      as \(form\) matches what form matches. The enclosure
  98. X                creates a set of tags, used for [8] and for
  99. X                pattern substution. The tagged forms are numbered
  100. X        starting from 1.
  101. X
  102. X[8]     \N      a \ followed by a digit 1 to 9 matches whatever a
  103. X                previously tagged regular expression ([7]) matched.
  104. X
  105. X[9]    \<    a regular expression starting with a \< construct
  106. X    \>    and/or ending with a \> construct, restricts the
  107. X        pattern matching to the beginning of a word, and/or
  108. X        the end of a word. A word is defined to be a character
  109. X        string beginning and/or ending with the characters
  110. X        A-Z a-z 0-9 and _. It must also be preceded and/or
  111. X        followed by any character outside those mentioned.
  112. X
  113. X[10]            a composite regular expression xy where x and y
  114. X                are in the form [1] to [10] matches the longest
  115. X                match of x followed by a match for y.
  116. X
  117. X[11]    ^    a regular expression starting with a ^ character
  118. X    $    and/or ending with a $ character, restricts the
  119. X                pattern matching to the beginning of the line,
  120. X                or the end of line. [anchors] Elsewhere in the
  121. X        pattern, ^ and $ are treated as ordinary characters.
  122. X
  123. X
  124. X*** replacing ***
  125. X
  126. Once a string matching a regular expression has been found it can be
  127. replaced with another string that is made up of text and pieces of the
  128. string found.  The replacement expression is used to construct a string
  129. to replace as follows:
  130. X
  131. X[1]     char    puts itself into the replacement string, unless it is a
  132. X        special character (metachar): \ or &.
  133. X
  134. X[2]     &       puts the entire matched string into the replacement string.
  135. X
  136. X[3]     \N      Puts the Nth substring (defined by \( and \) in the 
  137. X        regular expression) into the replacement string.
  138. X
  139. Regular expression replace is accessed with the "Re Search and Replace ..."
  140. item on the EDIT menu.
  141. X
  142. X    *** Changes in Version 1.3 ***
  143. X
  144. X* The cursor keys for left and right motion now work more correctly
  145. X     and don't mess up the display.
  146. X
  147. X* Various bugs fixes as described in "Changes.log"
  148. X
  149. X* Triple clicking (to select a whole line) now prints the line number in
  150. X    the message area in the browsers.
  151. X
  152. X* Several of the menus have be rearranged
  153. X
  154. X*** Macintosh style select and replace ***
  155. X
  156. X* In the Macintosh, selected text is replaced by newly typed characters.
  157. X     This style is handy if you are used to it.  This cannot be easily
  158. X     implemented in Point since zero width selections are not allowed.
  159. X     But I added an option "insertReplaces" (default is False) which
  160. X     when True causes this Macintosh-like behavior if the selection
  161. X     contains two or more characters.
  162. X
  163. X*** User specified window and icon titles ***
  164. X
  165. X* You can now specify the contents of the title and icon name of point
  166. X     text windows.  There are two new options "titleFormat" and 
  167. X     "iconFormat" which are printf-like strings that specify the
  168. X     formats of these two strings.  The Changes file gives the exact
  169. X     specifications for the format strings.  The default title format is:
  170. X         Option set titleFormat "%n%r. readOnly. [%l-%L]%c. (modified)."
  171. X     which prints the name of the file (%n), " readOnly" if the file is
  172. X     read only (else nothing), fir line number of the first line (%l)
  173. X     and the last line (%L) in the window and " (modified)" if the
  174. X     file has been changed but not saved (else nothing).  The default
  175. X     icon name format is:
  176. X          Option set iconFormat "pt: %n"
  177. X     which prints the string "pt: " then the file name.
  178. X
  179. X* The pt program now uses the locationN geometries (see Changes).  It also
  180. X    uses its current directory for file names (rather than point's).
  181. X
  182. X* The global "lineNumbers" option has been eliminated and replaced
  183. X    with a line numbers flag for each window and a command to
  184. X    set, unset or toggle this flag (see Changes).
  185. X
  186. X*
  187. X
  188. END_OF_FILE
  189. if test 6474 -ne `wc -c <'Changes.doc'`; then
  190.     echo shar: \"'Changes.doc'\" unpacked with wrong size!
  191. fi
  192. # end of 'Changes.doc'
  193. fi
  194. if test -f 'ana.h' -a "${1}" != "-c" ; then 
  195.   echo shar: Will not clobber existing file \"'ana.h'\"
  196. else
  197. echo shar: Extracting \"'ana.h'\" \(6324 characters\)
  198. sed "s/^X//" >'ana.h' <<'END_OF_FILE'
  199. X/* $Header: /nfs/unmvax/faculty/crowley/x/pt/RCS/ana.h,v 1.2 1992/02/19 16:43:42 crowley Exp crowley $ */
  200. X
  201. X#ifdef HYPERTEXT
  202. X#include <ndbm.h>
  203. X#endif
  204. X
  205. X/************************************************************************/
  206. X/*  Format Characters                            */
  207. X/*  -- these are used in block and link map format strings        */
  208. X/************************************************************************/
  209. X#define FormatMarker        '$'
  210. X#define PutBlockContents    'b'
  211. X#define PutBlockID        'i'
  212. X#define PutBlockName        'n'
  213. X#define PutAttributeName    'a'
  214. X
  215. X/************************************************************************/
  216. X/*  Constants                                */
  217. X/*  -- many of these will change as the system develops            */
  218. X/************************************************************************/
  219. X#define NAME_SIZE    80
  220. X#define MAX_LINKS    5
  221. X#define MAX_ATTRIBUTES    5
  222. X#define MAP_SIZE    7
  223. X
  224. X#define NullObject 0
  225. X
  226. typedef enum {
  227. X    OBJECT_MARKER = (0x34343434)
  228. X} ObjectMarker;
  229. X
  230. X/************************************************************************/
  231. X/*  A DOCUMENT is a collection of text pieces, their hypertext links,    */
  232. X/*  -- and views (ways of looking at the text pieces).            */
  233. X/*  A VIEW is a display of some part of the document.            */
  234. X/*  -- A view starts with a block and includes mappings to determine    */
  235. X/*       how to handle the blocks and links it encounters.        */
  236. X/*  A VIEW STREAM is the stream of characters that constitute the view.    */
  237. X/*  -- A view stream is generated starting with the initial bloc of the    */
  238. X/*       view and expanding blocks and links as sources.        */
  239. X/*  A LOCATION is a source and an offset into that source.        */
  240. X/*  -- A location marks a place in a view stream            */
  241. X/************************************************************************/
  242. X
  243. X/************************************************************************/
  244. X/*  Allocation codes                            */
  245. X/************************************************************************/
  246. typedef enum {
  247. X    NO_ALLOCATE,
  248. X    ALLOCATE
  249. X} AllocationMode;
  250. X
  251. typedef enum {
  252. X    NO_RELEASE,
  253. X    RELEASE
  254. X} ReleaseMode;
  255. X
  256. X/************************************************************************/
  257. X/*  Typedefs for the ID types (all int in the end)            */
  258. X/************************************************************************/
  259. typedef int Offset;
  260. typedef unsigned int ID;
  261. typedef unsigned int BlockID;
  262. typedef unsigned int AttributeID;
  263. typedef unsigned int MapID;
  264. typedef unsigned int FileID;
  265. typedef unsigned int LinkID;
  266. typedef unsigned int TextID;
  267. typedef unsigned int ViewID;
  268. typedef unsigned int DocumentID;
  269. X
  270. X/* magic numbers for error checking */
  271. typedef enum {
  272. X    AttributeMagic = 1,
  273. X    BlockMagic = 2,
  274. X    DocumentMagic = 3,
  275. X    FileMagic = 4,
  276. X    LinkMagic = 5,
  277. X    MapMagic = 6,
  278. X    TextMagic = 7,
  279. X    ViewMagic = 8
  280. X} MagicNumber;
  281. X
  282. X/*
  283. X * All objects have a `magic' number as their first field.  This is strictly
  284. X *    for error checking and will be removed later.
  285. X * All objects contain their ID number in the `this_one' field.
  286. X *    This is for error checking.
  287. X * All items have a `next' field which is used to link together all items
  288. X *    of a particular type.  I know we need this for BlockTypes and LinkTypes
  289. X *    and we will probably want it for all types.
  290. X * Most items have a `name' field.  For now it is a fixed length string.
  291. X *    Later we will make it s TextID and allows strings of any length.
  292. X *    Later will will also add a longName.
  293. X */
  294. X
  295. typedef struct {
  296. X    ObjectMarker marker;    /* to verify that this is an object */
  297. X    int magic, this_one;
  298. X    ID next;
  299. X    char name[NAME_SIZE];
  300. X} AnaObjectStruct, *AnaObject;
  301. X
  302. typedef struct {
  303. X    /* things in every object */
  304. X    ObjectMarker marker;
  305. X    MagicNumber magic;
  306. X    LinkID this_one, next;
  307. X    char name[NAME_SIZE];
  308. X    /* Link specific data */
  309. X    AttributeID attribute[MAX_ATTRIBUTES];
  310. X    LinkID nextFromLink;
  311. X    BlockID from;    
  312. X    LinkID nextToLink;
  313. X    BlockID to;
  314. X        /* a link can only be on one from list and one to list */
  315. X        /* from and to fields link to the beginning of these lists */
  316. X} LinkStruct, *Link;
  317. X
  318. typedef struct {
  319. X    /* things in every object */
  320. X    ObjectMarker marker;
  321. X    MagicNumber magic;
  322. X    BlockID this_one, next;
  323. X    char name[NAME_SIZE];
  324. X    /* Block specific data */
  325. X    AttributeID attribute[MAX_ATTRIBUTES];
  326. X    Offset hint;
  327. X    FileID file;
  328. X    int numLinks;
  329. X    LinkID firstFromLink;
  330. X    LinkID firstToLink;
  331. X        /* these are linked lists of links. The `links' in the */
  332. X        /* linked list are object IDs not memory addresses */
  333. X} BlockStruct, *Block;
  334. X
  335. typedef struct {
  336. X    /* things in every object */
  337. X    ObjectMarker marker;
  338. X    MagicNumber magic;
  339. X    AttributeID this_one, next;
  340. X    char name[NAME_SIZE];
  341. X} AttributeStruct, *Attribute;
  342. X
  343. typedef struct {
  344. X    /* things in every object */
  345. X    ObjectMarker marker;
  346. X    MagicNumber magic;
  347. X    FileID this_one, next;
  348. X    char name[NAME_SIZE];
  349. X} FileStruct, *File;
  350. X
  351. typedef struct {
  352. X    /* things in every object */
  353. X    ObjectMarker marker;
  354. X    MagicNumber magic;
  355. X    TextID this_one, next;
  356. X    /* Text specific data */
  357. X    char s[NAME_SIZE];
  358. X} TextStruct, *Text;
  359. X
  360. typedef struct {
  361. X    /* things in every object */
  362. X    ObjectMarker marker;
  363. X    MagicNumber magic;
  364. X    MapID this_one, next;
  365. X    char name[NAME_SIZE];
  366. X    /* Map specific data */
  367. X    ID domain[MAP_SIZE];
  368. X    char range[MAP_SIZE][NAME_SIZE];
  369. X    char defaultRange[NAME_SIZE];
  370. X} MapStruct, *Map;
  371. X
  372. typedef struct {
  373. X    /* things in every object */
  374. X    ObjectMarker marker;
  375. X    MagicNumber magic;
  376. X    ViewID this_one, next;
  377. X    char name[NAME_SIZE];
  378. X    /* View specific data */
  379. X    BlockID blockID;
  380. X    MapID fromLinkMap;
  381. X    MapID toLinkMap;
  382. X    MapID blockMap;
  383. X} ViewStruct, *View;
  384. X
  385. typedef struct {
  386. X    /* things in every object */
  387. X    ObjectMarker marker;
  388. X    MagicNumber magic;
  389. X    DocumentID this_one, next;
  390. X    char name[NAME_SIZE];
  391. X    /* Document specific data */
  392. X    ID nextFreeID;
  393. X    ViewID initialView;
  394. X    /* beginning of chains for each type of object */
  395. X    BlockID firstBlock;
  396. X    AttributeID firstAttribute;
  397. X    LinkID firstLink;
  398. X    FileID firstFile;
  399. X    ViewID firstView;
  400. X    MapID firstMap;
  401. X    TextID firstText;
  402. X} DocumentStruct, *Document;
  403. X
  404. X#define MARKER_SIZE    10
  405. X#define DEFAULT_MARKER    0xFF
  406. X#define BeginBlockFlag    '1'
  407. X#define EndBlockFlag    '9'
  408. X
  409. typedef struct {
  410. X    char begin_marker;    /* always 0xFF */
  411. X    char blockNumber[6];
  412. X    char comma;    /* always ',' */
  413. X    char flags;    /* various type information */
  414. X        /* '1' --> begin block */
  415. X        /* '9' --> end block */
  416. X    char end_marker;    /* always 0xFF */
  417. X} BlockMarkerStruct, *BlockMarker;
  418. X
  419. typedef struct PickListItem_tag {
  420. X    ID id;
  421. X    char * name;
  422. X    struct PickListItem_tag * next;
  423. X} PickListItem;
  424. X
  425. X
  426. END_OF_FILE
  427. if test 6324 -ne `wc -c <'ana.h'`; then
  428.     echo shar: \"'ana.h'\" unpacked with wrong size!
  429. fi
  430. # end of 'ana.h'
  431. fi
  432. if test -f 'cmdTable.c' -a "${1}" != "-c" ; then 
  433.   echo shar: Will not clobber existing file \"'cmdTable.c'\"
  434. else
  435. echo shar: Extracting \"'cmdTable.c'\" \(5691 characters\)
  436. sed "s/^X//" >'cmdTable.c' <<'END_OF_FILE'
  437. X/* $Header: /nfs/unmvax/faculty/crowley/x/pt/RCS/cmdTable.c,v 1.12 1992/03/04 17:07:18 crowley Exp crowley $ */
  438. X
  439. X#include <ctype.h>
  440. X#include <stdlib.h>
  441. X#include "pt.h"
  442. X
  443. int commandTableSize;
  444. X
  445. struct commandTableEntry commandTable[] = {
  446. X
  447. X/* Editing commands */
  448. X    {"Barrier",            FBARRIER},
  449. X    {"InsertFromScrap",        FINSERT},
  450. X    {"ChangeCaseOfSel",        FCHANGECASE},
  451. X    {"JustifySel",            FJUSTIFY},
  452. X    {"DeleteToScrap",        FDELETE},
  453. X    {"ExchangeWithScrap",        FEXCHSCRAP},
  454. X    {"CopySelToScrap",        FCOPYSCRAP},
  455. X    {"CopySelToMouse",        FCOPYTO},
  456. X    {"MoveSelToMouse",        FMOVETO},
  457. X    {"CopyToHereMode",        FCOPYFROM},
  458. X    {"MoveToHereMode",        FMOVEFROM},
  459. X/* Undo, Redo, Again commands */
  460. X    {"Again",            FAGAIN},
  461. X    {"Redo",            FREDO},
  462. X    {"Undo",            FUNDO},
  463. X/* Search commands */
  464. X    {"Search",            FSEARCHFORS},
  465. X    {"RegexSearch",            FREGEXSEARCH},
  466. X    {"CTag",            FCTAG},
  467. X    {"RepeatSearch",        FREPEATSEARCH},
  468. X    {"RepeatRegexSearch",        FREPEATREGEXSEARCH},
  469. X    {"Replace",            FREPLACE},
  470. X    {"RegexReplaceOne",        FREGEXREPLACEONE},
  471. X    {"RegexReplaceAll",        FREGEXREPLACEALL},
  472. X    {"FindMatchingBracket",        FMATCHCHAR},
  473. X    {"SearchCharacter",        FSEARCHLETTER},
  474. X/* File positioning commands */
  475. X    {"MoveToEndFile",        FBOTFILE},
  476. X    {"ShowSelection",        FGOTOSELECTION},
  477. X    {"MoveToLastPlace",        FGOBACKTO},
  478. X    {"GotoLine",            FGOTOLINE},
  479. X    {"GotoDigit",            FGOTODIGIT},
  480. X/* Cursor positioning command */
  481. X    {"MoveSel",            FMOVESEL},
  482. X/* Window management commands */
  483. X    {"SetTextColor",        FSETTEXTCOLOR},
  484. X    {"Browser",            FBROWSER},
  485. X    {"TextFont",            FWINDOWFONT},
  486. X    {"BrowserFont",            FBROWSERFONT},
  487. X    {"RaiseWindow",            FRAISE},
  488. X    {"LowerWindow",            FLOWER},
  489. X    {"CD",                FCD},
  490. X    {"OpenWindow",            FOPENWINDOW},
  491. X    {"CloseWindow",            FCLOSEWINDOW},
  492. X    {"RaiseListWindow",        FRAISELISTWINDOW},
  493. X    {"CloseBrowser",        FCLOSEBROWSER},
  494. X    {"SaveAs",            FWRITEFILE},
  495. X    {"SaveFile",            FSAVEFILE},
  496. X    {"SaveAllFiles",        FSAVEALL},
  497. X    {"Zoom",            FZOOM},
  498. X/* Other commands */
  499. X    {"ShowUndoStack",        FSHOWUNDOS},
  500. X    {"DoNothing",            FDONOTHING},
  501. X    {"Help",            FHELP},
  502. X    {"Redraw",            FREDRAW},
  503. X    {"ToggleReadOnly",        FREADONLY},
  504. X    {"SetLineNumbers",        FLINENUMBERS},
  505. X    {"CancelModes",            FCANCEL},
  506. X    {"SendOnClose",            FINFORMONCLOSE},
  507. X    {"QuitPoint",            FQUITPOINT},
  508. X    {"PrintStats",            FPRINTSTATS},
  509. X    {"Option",            FOPTION},
  510. X/* Commands for use by event handlers */
  511. X    {"Configure",            FCONFIGURE},
  512. X    {"EnterText",            FENTERTEXT},
  513. X    {"EnterBrowser",        FENTERBROWSER},
  514. X    {"Expose",            FEXPOSE},
  515. X    {"HScroll",            FHSCROLL},
  516. X    {"Key",                FKEY},
  517. X    {"Mouse",            FMOUSE},
  518. X    {"VScroll",            FVSCROLL},
  519. X/* Commands primarily for use in macros */
  520. X    {"WaitForReturnString",        FWAITFORRETURNSTRING},
  521. X    {"Sel",                FPOINTSELECTION},
  522. X    {"GetFileChars",        FGETFILECHARS},
  523. X    {"ScrollWindow",        FSCROLLWINDOW},
  524. X    {"GetRowCol",            FGETROWCOL},
  525. X    {"WindowName",            FWINDOWNAME},
  526. X    {"GetWindowInfo",        FGETWINDOWINFO},
  527. X    {"GetFileInfo",            FGETFILEINFO},
  528. X    {"InsertString",        FINSERTSTRING},
  529. X/* Ana commands */
  530. X    {"InsertBlock",            FINSBLOCK},
  531. X    {"CreateBlock",            FCREATEBLOCK},
  532. X    {"CreateAttribute",        FCREATEATTRIBUTE},
  533. X    {"CreateLink",            FCREATELINK},
  534. X    {"CreateMap",            FCREATEMAP},
  535. X    {"CreateDocument",        FCREATEDOCUMENT},
  536. X    {"CreateView",            FCREATEVIEW},
  537. X    {"AddFileToDocument",        FADDFILETODOCUMENT},
  538. X    {"ShowAttributes",        FSHOWATTRIBUTES},
  539. X    {"ShowBlocks",            FSHOWBLOCKS},
  540. X    {"ShowDocuments",        FSHOWDOCUMENTS},
  541. X    {"ShowFiles",            FSHOWFILES},
  542. X    {"ShowLinks",            FSHOWLINKS},
  543. X    {"ShowMaps",            FSHOWMAPS},
  544. X    {"ShowTexts",            FSHOWTEXTS},
  545. X    {"ShowViews",            FSHOWVIEWS},
  546. X    {"ChangeMap",            FCHANGEMAP},
  547. X    {"CloseDocument",        FCLOSEDOCUMENT},
  548. X    {"zzzzzzzzz",            -2},
  549. X};
  550. X
  551. int
  552. XFindCommandInTable( s )
  553. X    char *s;
  554. X{
  555. X    extern struct commandTableEntry commandTable[];
  556. X    extern int commandTableSize;
  557. X
  558. X    int i, low, high, mid;
  559. X
  560. X    /* use a binary search on the command table */
  561. X    low = 0;
  562. X    high = commandTableSize - 1;
  563. X    while( low <= high ) {
  564. X        /* item in range low..high or not in commandTable */
  565. X        mid = (high+low)/2;
  566. X        i = striccmp( commandTable[mid].command_name, s );
  567. X        if( i == 0 )
  568. X            return mid;
  569. X        if( i < 0 )
  570. X            low = mid + 1;
  571. X        else
  572. X            high = mid - 1;
  573. X    }
  574. X    return -1;    /* failure return */
  575. X}
  576. X
  577. int
  578. GetCommandNumber( s )
  579. X    char *s;
  580. X{
  581. X    extern struct commandTableEntry commandTable[];
  582. X    extern int commandTableSize;
  583. X    
  584. X    int i;
  585. X    
  586. X    if( isdigit(s[0]) )
  587. X        return atoi(s);
  588. X    i = FindCommandInTable( s );
  589. X    if( i == -1 ) {
  590. X        i = 0;
  591. X        printf("Could not find command `%s' in command table\n", s);
  592. X    }
  593. X    return commandTable[i].command_number;
  594. X}
  595. X
  596. void
  597. AddPointCommands( interp )
  598. X    Tcl_Interp * interp;
  599. X{
  600. X        extern struct commandTableEntry commandTable[];
  601. X        extern int commandTableSize;
  602. X
  603. X    int i;
  604. X
  605. X    for( i = 0; i < commandTableSize; ++i )
  606. X        Tcl_CreateCommand(
  607. X            interp,
  608. X            commandTable[i].command_name,
  609. X            doPtCommand,
  610. X            (ClientData)(commandTable[i].command_number),
  611. X            NULL
  612. X        );
  613. X}
  614. X
  615. char *
  616. CommandNumberToName( command_number )
  617. X    int command_number;
  618. X{
  619. X    extern struct commandTableEntry commandTable[];
  620. X    extern int commandTableSize;
  621. X    int n;
  622. X
  623. X    for( n = 0; n < commandTableSize; ++n )
  624. X        if( commandTable[n].command_number == command_number )
  625. X            return commandTable[n].command_name;
  626. X    return "<unknown command number>";
  627. X}
  628. X
  629. static int
  630. commandTableCompare( i, j )
  631. X        char *i, *j;
  632. X{
  633. X        return striccmp( ((struct commandTableEntry *)i)->command_name,
  634. X                 ((struct commandTableEntry *)j)->command_name );
  635. X}
  636. X
  637. X/*SUPPRESS 544*/ /*SUPPRESS 68*/
  638. X
  639. void InitCommands()
  640. X{
  641. X        extern struct commandTableEntry commandTable[];
  642. X        extern int commandTableSize;
  643. X        
  644. X        int n;
  645. X
  646. X        /* sort the command table for easy lookup */
  647. X        /* first see how big it is */
  648. X        for( n = 0; commandTable[n].command_number != -2; ++n)
  649. X            /*EMPTY*/
  650. X            ;
  651. X        commandTableSize = n;
  652. X
  653. X        /* then sort it with qsort */
  654. X        qsort( (char *)commandTable, commandTableSize,
  655. X            sizeof(struct commandTableEntry), commandTableCompare);
  656. X
  657. X}
  658. END_OF_FILE
  659. if test 5691 -ne `wc -c <'cmdTable.c'`; then
  660.     echo shar: \"'cmdTable.c'\" unpacked with wrong size!
  661. fi
  662. # end of 'cmdTable.c'
  663. fi
  664. if test -f 'cursor.c' -a "${1}" != "-c" ; then 
  665.   echo shar: Will not clobber existing file \"'cursor.c'\"
  666. else
  667. echo shar: Extracting \"'cursor.c'\" \(7098 characters\)
  668. sed "s/^X//" >'cursor.c' <<'END_OF_FILE'
  669. X/* $Header: /nfs/unmvax/faculty/crowley/x/pt/RCS/cursor.c,v 1.6 1992/03/04 17:07:18 crowley Exp crowley $ */
  670. X
  671. X#include <ctype.h>
  672. X#include "pt.h"
  673. X
  674. X/* keep records so we can move cursor consistently in vertical direction */
  675. int lastColumn = -1;
  676. int lastFn = 0;
  677. X
  678. X#define FSELUP        1
  679. X#define FSELDOWN    2
  680. X#define FSELRIGHT    3
  681. X#define FSELLEFT    4
  682. X#define FWORDRIGHT    5
  683. X#define FWORDLEFT    6
  684. X#define FLINERIGHT    7
  685. X#define FLINELEFT    8
  686. X
  687. int
  688. cursor( how, direction, update )
  689. X    char * how;
  690. X    char * direction;
  691. X    int update;
  692. X{
  693. X    extern struct window *windowList;
  694. X    extern struct window *selWindow;
  695. X    extern Offset selBegin, selEnd;
  696. X    extern int selMode;
  697. X    extern char msgBuffer[];
  698. X    extern int debug;
  699. X    extern int lastColumn;
  700. X    extern int lastFn;
  701. X
  702. X    Offset cp;
  703. X    char ch;
  704. X    int uch;
  705. X    int row, col;
  706. X    int alphaNumeric;
  707. X    struct window *w = selWindow;
  708. X    int n;
  709. X    int fid = selWindow->fileId;
  710. X    int fn;
  711. X
  712. X    /* first erase the current selection since the cursor motion */
  713. X    /* will move the selection */
  714. X    drawSelection( 1 );
  715. X
  716. X    if( selWindow == NULL ) {
  717. X        /* get the mouse cursor position */
  718. X        printf("No selection\n");
  719. X        return 0;
  720. X    }
  721. X
  722. X    /* find the position of the current selection */
  723. X    cp = selBegin;
  724. X    OffsetToXY( selWindow, cp, &row, &col );
  725. X
  726. X    /* special case so that cursor up and down move */
  727. X    /* down the page in a straight line so as is */
  728. X    /* possible */
  729. X    if( (lastColumn != -1) && (lastFn==FSELUP || lastFn==FSELDOWN) )
  730. X            col = lastColumn;
  731. X
  732. X    /* adjust it according to the function invoked */
  733. X    if( strcmp(how,"char")==0 ) {
  734. X        if( strcmp(direction,"left")==0 ) {
  735. X            fn = FSELLEFT;
  736. X            switch( selMode ) {
  737. X                default:
  738. X                case SELCHAR:
  739. X                    break;
  740. X                case SELWORD:
  741. X                    goto doWordLeft;
  742. X                case SELLINE:
  743. X                    goto doCurUp;
  744. X            }
  745. X            if( col > 0 )
  746. X                --col;
  747. X            else if( row > 0 || selWindow->numTopline>1 ) {
  748. X                --row;
  749. X                col = selWindow->nCols - 1;
  750. X            }
  751. X        } else if( strcmp(direction,"right")==0 ) {
  752. X            fn = FSELRIGHT;
  753. X            switch( selMode ) {
  754. X                default:
  755. X                case SELCHAR:
  756. X                    break;
  757. X                case SELWORD:
  758. X                    goto doWordRight;
  759. X                case SELLINE:
  760. X                    goto doCurDown;
  761. X            }
  762. X            ch = getFileByte( fid, selBegin );
  763. X            if( ch != '\n' ) {
  764. X                if( col < selWindow->nCols )
  765. X                    ++col;
  766. X            } else {
  767. X                ++row;
  768. X                col = 0;
  769. X            }
  770. X        } else if( strcmp(direction,"up")==0 ) {
  771. doCurUp:
  772. X            fn = FSELUP;
  773. X            if( row > 0 || selWindow->numTopline>1 )
  774. X                --row;
  775. X        } else {    /* down */
  776. doCurDown:
  777. X            fn = FSELDOWN;
  778. X            if( row < selWindow->nRows )
  779. X                ++row;
  780. X        }
  781. X    } else if( strcmp(how,"word")==0 ) {
  782. X        if( strcmp(direction,"left")==0 ) {
  783. doWordLeft:
  784. X            fn = FWORDLEFT;
  785. X            cp = xyToOffset( w, row, col );
  786. X    
  787. X            /* skip the white space between words */
  788. X            uch = getFileByte( fid, cp );
  789. X            while( uch != BLOCK_EOF ) {
  790. X                uch = getFileByte( fid, --cp );
  791. X                if( !isspace(uch) )
  792. X                    break;
  793. X            }
  794. X    
  795. X            alphaNumeric = isalnum(uch);
  796. X            /* skip the characters in the word */
  797. X            while( 1 ) {
  798. X                ch = getFileByte( fid, --cp );
  799. X                /****** OLD VERSION.  vi "big" words *******/
  800. X                /*if(ch==' '||ch=='\t'||ch=='\n'||ch=='\0')*/
  801. X                /*******************************************/
  802. X                /* if we have switched from alphanumeric to */
  803. X                /* not alphanumeric or the reverse, then quit */
  804. X                if( alphaNumeric ) {
  805. X                    if( !isalnum(ch) && ch != '_' ) {
  806. X                        ++cp;
  807. X                        break;
  808. X                    }
  809. X                } else if(isalnum(ch)||isspace(ch)||ch=='_'){
  810. X                    ++cp;
  811. X                    break;
  812. X                }
  813. X            }
  814. finishUp:
  815. X            OffsetToXY( w, cp, &row, &col );
  816. X            selBegin = cp;
  817. X            selEnd = selBegin;
  818. X            n = -1;
  819. X            cp = prevLine( selWindow->fileId, selBegin, &n );
  820. X            modeExtend( selWindow, selBegin, row, col, cp );
  821. X            if( indentToShowSelection(-1) ) {
  822. X                OffsetToXY( w, cp, &row, &col );
  823. X            }
  824. X        } else {    /* "right" */
  825. doWordRight:
  826. X            fn = FWORDRIGHT;
  827. X            cp = xyToOffset( w, row, col );
  828. X    
  829. X            ch = (char)getFileByte( fid, cp );
  830. X            alphaNumeric = isalnum(ch);
  831. X    
  832. X            /* skip the characters in the word */
  833. X            while( 1 ) {
  834. X                ch = (char)getFileByte( fid, ++cp );
  835. X                /****** OLD VERSION.  vi "big" words *******/
  836. X                /***if( ch==' ' || ch=='\n' || ch=='\0' )***/
  837. X                /*******************************************/
  838. X                /* if we have switched from alphanumeric to */
  839. X                /* not alphanumeric or the reverse, then quit */
  840. X                if( alphaNumeric ) {
  841. X                    if( !isalnum(ch) && ch != '_' )
  842. X                        break;
  843. X                } else if( isalnum(ch)||isspace(ch)||ch=='_' )
  844. X                    break;
  845. X            }
  846. X    
  847. X            /* skip the white space between words */
  848. X            while( isspace(ch) )
  849. X                ch = (char)getFileByte( fid, ++cp );
  850. X    
  851. X            goto finishUp;
  852. X        }
  853. X    } else if( strcmp(how,"line")==0 ) {
  854. X        if( strcmp(direction,"right")==0 ) {
  855. X            fn = FLINERIGHT;
  856. X            cp = xyToOffset( w, row, col );
  857. X            while( 1 ) {
  858. X                ch = getFileByte( fid, cp++ );
  859. X                if( ch == '\n' || ch == '\0' )
  860. X                    break;
  861. X            }
  862. X            --cp;    /* we went one past the NL */
  863. X            goto finishUp;
  864. X        } else {
  865. X            fn = FLINELEFT;
  866. X            cp = xyToOffset( w, row, col );
  867. X            uch = getFileByte( fid, cp-- );
  868. X            while( uch != BLOCK_EOF ) {
  869. X                uch = getFileByte( fid, cp-- );
  870. X                if( (char)uch == '\n' )
  871. X                    break;
  872. X            }
  873. X            /* Move up to the first character of the line. */
  874. X            /* This is the first character past the '\n' */
  875. X            cp += 2;
  876. X            if( strcmp(direction,"left")==0 ) {
  877. X                /* skip tabs and blanks */
  878. X                while( 1 ) {
  879. X                    ch = getFileByte( fid, cp++ );
  880. X                    if( ch != ' ' && ch != '\t' )
  881. X                        break;
  882. X                }
  883. X                /* undo last increment scanning white space */
  884. X                --cp;
  885. X            } /* else "left0" */
  886. X            goto finishUp;
  887. X        }
  888. X    } else {
  889. X        printf("Unrecognized selection movement: %s\n", how);
  890. X        return 0;
  891. X    }
  892. X
  893. X    if( update )
  894. X        doScreenUpdate( fn, col, row );
  895. X    else {
  896. X        switch( fn ) {
  897. X            case FSELRIGHT:
  898. X            case FSELLEFT:
  899. X            case FSELUP:
  900. X            case FSELDOWN:
  901. X                selBegin = cp;
  902. X                selEnd = cp;
  903. X                break;
  904. X        }
  905. X    }
  906. X    return 0;
  907. X}
  908. X
  909. X
  910. void
  911. doScreenUpdate( fn, col, row )
  912. X    int fn, col, row;
  913. X{
  914. X    extern struct window *selWindow;
  915. X    extern struct window *windowList;
  916. X    extern Offset selBegin, selEnd;
  917. X    extern int selMode;
  918. X    extern char msgBuffer[];
  919. X    extern int debug;
  920. X    extern int lastColumn;
  921. X    extern int scrollDown;
  922. X    extern int intervalRows;
  923. X    extern struct window * scroll_window;
  924. X
  925. X    Offset cp;
  926. X    int n, y;
  927. X    register struct window *w = selWindow;
  928. X    struct fontDataStruct *font = &(w->font);
  929. X    int fid = selWindow->fileId;
  930. X    char ch;
  931. X
  932. X    lastFn = fn;
  933. X    lastColumn = col;
  934. X    cp = xyToOffset( w, row, col );
  935. X
  936. X    /* This is to prevent the right cursor movement from */
  937. X    /* getting stuck on a tab.  It should happen only when */
  938. X    /* the selection is on a tab. */
  939. X    ch = getFileByte( fid, cp );
  940. X    if( ch=='\t' && selBegin==cp && selEnd==cp && fn==FSELRIGHT )
  941. X        ++cp;
  942. X
  943. X    /* see if we scrolled off an edge of the window */
  944. X    if( row >= w->nRows ) {
  945. X        intervalRows = w->nRows/3;
  946. X        scrollDown = 1;
  947. X        scroll_window = w;
  948. X        n = DoOneVScroll();
  949. X        row -= n;
  950. X        cp = xyToOffset( w, row, col );
  951. X    } else if( row < 0 ) {
  952. X        intervalRows = w->nRows/3;
  953. X        scrollDown = 0;
  954. X        scroll_window = w;
  955. X        n = DoOneVScroll();
  956. X        row += n;
  957. X        cp = xyToOffset( w, row, col );
  958. X    }
  959. X
  960. X    switch( fn ) {
  961. X    case FSELRIGHT:
  962. X    case FSELLEFT:
  963. X    case FSELUP:
  964. X    case FSELDOWN:
  965. X        selBegin = cp;
  966. X        selEnd = cp;
  967. X        break;
  968. X    }
  969. X    n = -1;        /* find the beginning of the line */
  970. X    cp = prevLine( fid, cp, &n );
  971. X
  972. X    /* figure out where to write line 'row' */
  973. X    y = w->topMargin + font->ascent + row*font->height;
  974. X    (void) fillLine( w, cp, row, 0, w->nCols, y, 0 );
  975. X}
  976. X
  977. END_OF_FILE
  978. if test 7098 -ne `wc -c <'cursor.c'`; then
  979.     echo shar: \"'cursor.c'\" unpacked with wrong size!
  980. fi
  981. # end of 'cursor.c'
  982. fi
  983. if test -f 'pt.h' -a "${1}" != "-c" ; then 
  984.   echo shar: Will not clobber existing file \"'pt.h'\"
  985. else
  986. echo shar: Extracting \"'pt.h'\" \(6107 characters\)
  987. sed "s/^X//" >'pt.h' <<'END_OF_FILE'
  988. X/* $Header: /nfs/unmvax/faculty/crowley/x/pt/RCS/pt.h,v 1.8 1992/02/19 16:43:42 crowley Exp crowley $ */
  989. X
  990. X#include "ana.h"
  991. X#include "command.h"
  992. X#include "tcl.h"
  993. X#include "tk.h"
  994. X/**** #include "Intrinsic.h" -- just use a few typedefs ****/
  995. typedef short Position;
  996. typedef unsigned short  Dimension;
  997. typedef char * String;
  998. typedef unsigned long   Pixel;
  999. typedef unsigned int    Cardinal;
  1000. X/* "file.h" is included about 20 lines down */
  1001. X/* "funcdecl.h" is included at the end of this file (pt.h) */
  1002. X
  1003. X#define SCROLLBAR_LIMIT 10000
  1004. X
  1005. X#define BLOCK_EOF    256
  1006. X
  1007. X/******* parameters -- can be changed *****/
  1008. X#define NBUFFERS      300  /* buffers for file blocks (in address space) */
  1009. X#define NHISTORY      300  /* history kept in memory */
  1010. X#define NBUFHASH      512  /* buffer hash chains */
  1011. X#define MSGBUFFERSIZE 1024  /* size of two generally used buffers */
  1012. X#define STRINGSIZE    256  /* size of input strings for search */
  1013. X
  1014. X/****** constants that are rarely changed */
  1015. X#define BUFFERSIZE    1024    /* size of a buffer in bytes */
  1016. X#define BUFFERSHIFT    10    /* shift to convert: bytes<-->buffers */
  1017. X#define MAXCOLS        1024    /* max number of columns on the display */
  1018. X#define FILENAMESIZE    512
  1019. X
  1020. X#include "file.h"
  1021. X
  1022. X/* mouse menu data to keep */
  1023. struct mmData {
  1024. X    Cursor cursor;
  1025. X    char * tcl_command;
  1026. X    char * label;
  1027. X    int length;
  1028. X};
  1029. X
  1030. X/* browser related typedefs */
  1031. typedef struct {
  1032. X    char *name;
  1033. X    struct window *w;
  1034. X} OpenWindowStruct;
  1035. X
  1036. X#define SHOW_SIZES_FLAG        0x1
  1037. X#define SHOW_DIR_SLASHES_FLAG    0x2
  1038. X
  1039. X#define T_END_OF_TABLE    0
  1040. X#define T_INTEGER    1
  1041. X#define T_BOOLEAN    2
  1042. X#define T_STRING    3
  1043. X#define T_GEOMETRY    4
  1044. X
  1045. struct optionTableEntry {
  1046. X    char * option_name;
  1047. X    char * option_address;
  1048. X    int option_type;
  1049. X};
  1050. X
  1051. typedef struct {
  1052. X    char *fileNames;
  1053. X    char **listOfFilesShowing;
  1054. X    int numberOfFilesShowing;
  1055. X    int longestname;
  1056. X    int showSizes;
  1057. X    ino_t ino;
  1058. X    time_t mtime;
  1059. X    char *directoryName;
  1060. X    int age;
  1061. X    int use_count;
  1062. X    char filePattern[512];
  1063. X    char flags;
  1064. X} FileListData;
  1065. X
  1066. struct fontDataStruct {
  1067. X    int height, width, ascent;
  1068. X    char *name;
  1069. X    Font font;
  1070. X    GC gc_normal, gc_selected, gc_underline;
  1071. X};
  1072. X
  1073. X/* messageBits contains message producing flags */
  1074. X/* 0 => no messages */
  1075. X/* 1 => popup message windows */
  1076. X/* 2 => message line (if there is one) */
  1077. X/* 4 => on window headers */
  1078. X/* 8 => on the xterm that started Point */
  1079. X#define POPUP_MSGS    1
  1080. X#define LINE_MSGS    2
  1081. X#define WINDOW_MSGS    4
  1082. X#define PRINTF_MSGS    8
  1083. X
  1084. typedef struct browser_data {
  1085. X
  1086. X    /* Tk stuff */
  1087. X    Tk_Window tk_toplevel;
  1088. X    Tk_Uid tk_pathname;
  1089. X
  1090. X    struct fontDataStruct browserFont;
  1091. X
  1092. X    /* filename list data */
  1093. X    FileListData *fileListData;
  1094. X    char cwd[FILENAMESIZE];
  1095. X    struct browser_data *nextBrowser;
  1096. X    struct browser_data *prevBrowser;
  1097. X
  1098. X} BrowserData;
  1099. X
  1100. X/* string names */
  1101. typedef enum {
  1102. X    HANDLEMSG,
  1103. X    FULLMSG,
  1104. X    MENUSPMSG,
  1105. X    NOSPACEMSG,
  1106. X    LOWSPACEMSG,
  1107. X    OUTOFWINDOWS,
  1108. X    NOBUFFERMEMORY,
  1109. X    OUTOFFILESTRUCT,
  1110. X    CANNOTOPEN,
  1111. X    READONLYFILE,
  1112. X    WRITINGFILE,
  1113. X    CLOSEFAILED,
  1114. X    RENAMEFAILED,
  1115. X    DELETEFAILED,
  1116. X    RENAMEFAILED2,
  1117. X    WRITECANCELLED,
  1118. X    FILEEXISTS,
  1119. X    FILEWRITTEN,
  1120. X    WRITEFAILED,
  1121. X    CREATEFAILED,
  1122. X    WRITEPROGRESS,
  1123. X    WASREADONLY,
  1124. X    YTOSAVE,
  1125. X    CLOSECANCELLED,
  1126. X    NOTOPEN,
  1127. X    CLOSEFAILED2,
  1128. X    REANMEFAILED2,
  1129. X    DELETEFAILED2,
  1130. X    RENAMEFAILED3
  1131. X} StringNames;
  1132. X
  1133. X/* used in the piece table -- original or new characters file */
  1134. typedef enum {
  1135. X    ORIGFILE,
  1136. X    ADDFILE
  1137. X} WhichFile;
  1138. X
  1139. X/* deleteSelection update type */
  1140. typedef enum {
  1141. X    NOUPDATE,
  1142. X    UPDATEWINDOWS
  1143. X} DoUpdate;
  1144. X
  1145. X/* directions */
  1146. typedef enum {
  1147. X    FORWARD,
  1148. X    REVERSED
  1149. X} Direction;
  1150. X
  1151. X/* copyMove modes */
  1152. typedef enum {
  1153. X    COPY,
  1154. X    MOVE,
  1155. X    AGAIN
  1156. X} CopyMoveMode;
  1157. X
  1158. X/* selection modes */
  1159. typedef enum {
  1160. X    SELCHAR,
  1161. X    SELWORD,
  1162. X    SELLINE,
  1163. X    SELBLOCK
  1164. X} SelectionMode;
  1165. X
  1166. struct keyTableEntry {
  1167. X    char *key_name;
  1168. X    int key_sym_value;
  1169. X};
  1170. X
  1171. X/* change types */
  1172. enum ChangeType {
  1173. X    CNULL,
  1174. X    CINSERT,
  1175. X    CDELETE,
  1176. X    CMOVE,
  1177. X    CCOPY,
  1178. X    CMOTION,
  1179. X    CREPLACE
  1180. X};
  1181. X
  1182. X/* flags constants */
  1183. X#define    CHANGE_WAS_UNDONE    0x1
  1184. X#define FILE_WAS_CLOSED        0x2
  1185. X#define BLOCK_UNDO_BEGIN    0x4
  1186. X#define BLOCK_UNDO_END        0x8
  1187. X
  1188. X/* change history */
  1189. struct changeItem {
  1190. X    int fileId;
  1191. X    struct window *w;
  1192. X    Offset position;
  1193. X    int  lineNumber;
  1194. X    Offset length;
  1195. X    struct piece *firstPiece;
  1196. X    char type;
  1197. X    char flags;
  1198. X    struct changeItem * next;
  1199. X    struct changeItem * prev;
  1200. X};
  1201. X
  1202. X/* option type values */
  1203. typedef enum {
  1204. X    OBOOLEAN,
  1205. X    OINTEGER,
  1206. X    OOTHERS,
  1207. X    UBOOLEAN,
  1208. X    UINTEGER,
  1209. X    UOTHERS,
  1210. X    OSTRING,
  1211. X    USTRING
  1212. X} OptionType;
  1213. X
  1214. X/* option index values */
  1215. typedef enum {
  1216. X    OFILESORT,
  1217. X    OMSGCOLORS,
  1218. X    ONBUFFERS,
  1219. X    OTEXTCOLORS,
  1220. X    OBORDERCOLORS,
  1221. X    OFSDIRS,
  1222. X    OUNDOSIZE,
  1223. X    O43LINES,
  1224. X    OFSPATTERNS,
  1225. X    OBACKUPDEPTH,
  1226. X    OREDEFINE,
  1227. X    OLASTITEM
  1228. X} OptionIndex;
  1229. X
  1230. X/* the window structure */
  1231. struct window {
  1232. X    /* linked list of active windows */
  1233. X    struct window *nextWindow;
  1234. X    struct window *prevWindow;
  1235. X
  1236. X    /* cursor position and line number */
  1237. X    /* of the top and bottom lines in the window */
  1238. X    Offset posTopline, posBotline;
  1239. X    int numTopline, numBotline;
  1240. X    
  1241. X    /* display options */
  1242. X    int lineNumbers;
  1243. X
  1244. X    /* remember the line we last jumped from */
  1245. X    int rowLastline;
  1246. X    
  1247. X    /* remember the last line the found the mouse cursor on */
  1248. X    int rowCurLast;
  1249. X    Offset posCurLast, lastPosTop;
  1250. X
  1251. X    /* indent of the first character in each line visible */
  1252. X    int indent;
  1253. X    
  1254. X    /* name and internal (to this program) identifier */
  1255. X    /* of the file the window is displaying */
  1256. X    int fileId;    /* of the file or view in the window */
  1257. X    int realFileId;    /* of the file underlying the view */
  1258. X    int nameOffset;    /* into the file name in the backing file */
  1259. X
  1260. X    /* layout variables */
  1261. X    int topMargin;        /* space to leave before the first line */
  1262. X    int leftMargin;        /* space to leave left of each line */
  1263. X    int nRows, nCols;    /* number of rows and columns */
  1264. X    Position oldX, oldY;    /* before zooming */
  1265. X    Dimension oldWidth, oldHeight, oldBorderWidth;
  1266. X    
  1267. X    /* X stuff */
  1268. X    Window x_window_id;
  1269. X    
  1270. X    /* keep an image of the contents of the screen */
  1271. X    char * screen_image;
  1272. X
  1273. X    /* font information */
  1274. X    struct fontDataStruct font;
  1275. X
  1276. X    /* Tk and Tcl stuff */
  1277. X    Tk_Window tk_toplevel;
  1278. X    Tk_Window tk_text;
  1279. X    Tk_Uid tk_pathname;    /* interpreter name of the window */
  1280. X    char * closeInform;    /* 'send $closeInform on close */
  1281. X
  1282. X#ifdef HYPERTEXT
  1283. X    /* Anasazi stuff */
  1284. X    DBM *db;
  1285. X    Document document;
  1286. X    View view;
  1287. X    Block block;
  1288. X    Map blockMap;
  1289. X    Map fromLinkMap;
  1290. X    Map toLinkMap;
  1291. X    File file;
  1292. X#endif
  1293. X};
  1294. X
  1295. X#include "funcdecl.h"
  1296. END_OF_FILE
  1297. if test 6107 -ne `wc -c <'pt.h'`; then
  1298.     echo shar: \"'pt.h'\" unpacked with wrong size!
  1299. fi
  1300. # end of 'pt.h'
  1301. fi
  1302. if test -f 'spans.c' -a "${1}" != "-c" ; then 
  1303.   echo shar: Will not clobber existing file \"'spans.c'\"
  1304. else
  1305. echo shar: Extracting \"'spans.c'\" \(7629 characters\)
  1306. sed "s/^X//" >'spans.c' <<'END_OF_FILE'
  1307. X/* $Header: /nfs/unmvax/faculty/crowley/x/pt/RCS/spans.c,v 1.1 1991/07/05 16:34:41 crowley Exp crowley $ */
  1308. X
  1309. X#include <ctype.h>
  1310. X#include "pt.h"
  1311. X
  1312. Offset
  1313. searchSpans( fileId, startCp, stopCp, patString, patLength, linesPassed )
  1314. X    int fileId, patLength, *linesPassed;
  1315. X    Offset startCp, stopCp;
  1316. X    char *patString;
  1317. X{
  1318. X    extern char msgBuffer[];
  1319. X    extern int ignoreCase;
  1320. X    extern int findWholeWords;
  1321. X    extern int getSpanSize;
  1322. X    extern int debug;
  1323. X
  1324. X    char *pat;
  1325. X    unsigned char *firstChar;
  1326. X    unsigned char *lastChar;
  1327. X    unsigned char *p;
  1328. X    char ch1, ch2, ch3;
  1329. X    int matched, len, nLines;
  1330. X    Offset cp, plen;
  1331. X
  1332. X    /* find the upper and lower case character */
  1333. X    ch1 = *patString;
  1334. X    if( !ignoreCase )
  1335. X        ch2 = ch1;
  1336. X    else if( 'a' <= ch1 && ch1 <= 'z' )
  1337. X        ch2 = ch1 - 'a' + 'A';
  1338. X    else if( 'A' <= ch1 && ch1 <= 'Z' )
  1339. X        ch2 = ch1 - 'A' + 'a';
  1340. X    else
  1341. X        ch2 = ch1;
  1342. X
  1343. X    /* set up a long version of patLength-1 for comparisons */
  1344. X    plen = patLength - 1;
  1345. X    
  1346. X    nLines = 0;
  1347. X    
  1348. X    /* set things up so getSpan is called right away */
  1349. X    firstChar = (unsigned char *)1;
  1350. X    lastChar = (unsigned char *)0;
  1351. X
  1352. X    /* each iteration of this loop scans one span */
  1353. X    while( 1 ) {
  1354. X        /* see if there are enough characters left in the */
  1355. X        /* area we are searching to match the pattern */
  1356. X        if( (stopCp - startCp) < plen )
  1357. X            break;
  1358. X
  1359. X        /* find the first character of the string */
  1360. X        if( firstChar > lastChar ) {
  1361. X            if( getSpan(fileId, startCp, &firstChar, &lastChar, 0) )
  1362. X                /* getSpan says startCp at EOF */
  1363. X                break;
  1364. X            /* check to see if the span is longer than the */
  1365. X            /* area we are supposed to search */
  1366. X            if( (lastChar-firstChar) > (stopCp-startCp) ) {
  1367. X                /* if it is too long then adjust lastChar */
  1368. X                lastChar = firstChar + (stopCp - startCp);
  1369. X            }
  1370. X        }
  1371. X        len = (int)(lastChar - firstChar) + 1;
  1372. getSpanSize += len;
  1373. X        if( ch1 == ch2 )
  1374. X            p = match2dn(firstChar, len, ch1);
  1375. X        else
  1376. X            p = match1dn(firstChar, len, ch1, ch2);
  1377. X        if( p == NULL ) {
  1378. X            startCp += len;
  1379. X            nLines += countnl(firstChar, len);
  1380. X            firstChar = (unsigned char *)1;
  1381. X            lastChar = (unsigned char *)0;
  1382. X            continue;
  1383. X        }
  1384. X        /* move startCp up past the matched character */
  1385. X        len = p - firstChar;
  1386. X        nLines += countnl(firstChar, len);
  1387. X        startCp += len;
  1388. X        
  1389. X        firstChar = p;
  1390. X
  1391. X        /* start looking at the second character of the pattern */
  1392. X        pat = patString + 1;
  1393. X        matched = 1;    /* 1 character matched so far */
  1394. X        
  1395. X        /* search for a match at startCp */
  1396. X        cp = startCp;
  1397. X        while( matched < patLength ) {
  1398. X            /* see if we are still in the span */
  1399. X            if( firstChar > lastChar ) {
  1400. X                if(getSpan(fileId,cp,&firstChar,&lastChar,0))
  1401. X                    /* at EOF so not found */
  1402. X                    break;
  1403. X            }
  1404. X            /* stop at a mismatch */
  1405. X            ch3 = *firstChar++;
  1406. X++getSpanSize;
  1407. X            ++cp;
  1408. X            if( ignoreCase && 'A' <= ch3 && ch3 <= 'Z' )
  1409. X                ch3 = ch3 - 'A' + 'a';
  1410. X            if( *pat++ != ch3 )
  1411. X                break;
  1412. X            if( ch3 == '\n' )
  1413. X                ++nLines;
  1414. X            ++matched;
  1415. X        }
  1416. X        if( matched == patLength ) {
  1417. X            /* we found the string */
  1418. X            /* now does it have to be a whole word? */
  1419. X            if( findWholeWords ) {
  1420. X                /* make sure the character before it is */
  1421. X                /* not alphanumeric or "_" */
  1422. X                ch3 = (char)getFileByte(fileId, startCp-2);
  1423. X                matched = !isalnum(ch3) && ch3 != '_';
  1424. X                if( matched ) {
  1425. X                    /* and the char after it also */
  1426. X                    ch3 = (char)getFileByte(fileId,
  1427. X                        startCp+patLength-1);
  1428. X                    matched = !isalnum(ch3) && ch3 != '_';
  1429. X                }
  1430. X            } else
  1431. X                matched = 1;
  1432. X            if( matched ) {
  1433. X                *linesPassed = nLines;
  1434. X                return startCp - 1;
  1435. X            }
  1436. X        }
  1437. X        firstChar = (unsigned char *)1;
  1438. X        lastChar = (unsigned char *)0;
  1439. X    }
  1440. X    *linesPassed = nLines;
  1441. X    return (Offset)(-1);
  1442. X}
  1443. X
  1444. Offset
  1445. searchReverseSpans(fileId, startCp, stopCp, patString, patLength, linesPassed)
  1446. X    int fileId, patLength, *linesPassed;
  1447. X    Offset startCp, stopCp;
  1448. X    char *patString;
  1449. X{
  1450. X    extern char msgBuffer[];
  1451. X    extern int ignoreCase;
  1452. X    extern int debug;
  1453. X    extern int findWholeWords;
  1454. X    extern int getSpanSize;
  1455. X
  1456. X    char *pat;
  1457. X    unsigned char *firstChar;
  1458. X    unsigned char *lastChar;
  1459. X    unsigned char *p;
  1460. X    char ch1, ch2, ch3;
  1461. X    int matched, len, nLines;
  1462. X    Offset cp;
  1463. X
  1464. X    /* find the upper and lower case character */
  1465. X    ch1 = *patString;
  1466. X    if( !ignoreCase )
  1467. X        ch2 = ch1;
  1468. X    else if( 'a' <= ch1 && ch1 <= 'z' )
  1469. X        ch2 = ch1 - 'a' + 'A';
  1470. X    else if( 'A' <= ch1 && ch1 <= 'Z' )
  1471. X        ch2 = ch1 - 'A' + 'a';
  1472. X    else
  1473. X        ch2 = ch1;
  1474. X
  1475. X    /* set up nLines correctly */
  1476. X    nLines = 0;
  1477. X    len = patLength - 1;
  1478. X
  1479. X    /* set things up so getSpan is called right away */
  1480. X    firstChar = (unsigned char *)1;
  1481. X    lastChar = (unsigned char *)0;
  1482. X
  1483. X    /* each iteration of this loop scans one span */
  1484. X    while( stopCp >= startCp ) {
  1485. X
  1486. X        /* find the first character of the string */
  1487. X        if( firstChar > lastChar ) {
  1488. X            /* '1' (last argument) means get a reversed span */
  1489. X            if(getSpan(fileId, stopCp, &firstChar, &lastChar, 1))
  1490. X                /* at EOF */
  1491. X                break;
  1492. X        }
  1493. X        len = (int)(lastChar - firstChar) + 1;
  1494. getSpanSize += len;
  1495. X        p = match1up(lastChar, len, ch1, ch2);
  1496. X        if( p == NULL ) {
  1497. X            stopCp -= len;
  1498. X            nLines += countnl(firstChar, len);
  1499. X            firstChar = (unsigned char *)1;
  1500. X            lastChar = (unsigned char *)0;
  1501. X            continue;
  1502. X        }
  1503. X        /* move stopCp up past the matched character */
  1504. X        /* (remember that match1up returns a pointer to the */
  1505. X        /* character BEFORE the one matched) */
  1506. X        len = lastChar - p;
  1507. X        stopCp -= len;
  1508. X
  1509. X        /* p is one before the found character */
  1510. X        /* we want to match starting one character after */
  1511. X        /* the found character, so we add 2 */
  1512. X        firstChar = p + 2;
  1513. X        nLines += countnl(firstChar, len);
  1514. X        firstChar = (unsigned char *)1;
  1515. X        lastChar = (unsigned char *)0;
  1516. X
  1517. X        /* start looking at the second character of the pattern */
  1518. X        pat = patString + 1;
  1519. X        matched = 1;    /* 1 matched character so */
  1520. X        
  1521. X        /* search for a match at startCp */
  1522. X        cp = stopCp + 2;
  1523. X        while( matched < patLength ) {
  1524. X            /* see if we are still in the span */
  1525. X            if( firstChar > lastChar ) {
  1526. X                if(getSpan(fileId,cp,&firstChar,&lastChar,0))
  1527. X                    /* at EOF so not found */
  1528. X                    break;
  1529. X            }
  1530. X            /* stop at a mismatch */
  1531. X            ch3 = *firstChar++;
  1532. X++getSpanSize;
  1533. X            ++cp;
  1534. X            if( ignoreCase && 'A' <= ch3 && ch3 <= 'Z' )
  1535. X                ch3 = ch3 - 'A' + 'a';
  1536. X            if( *pat++ != ch3 )
  1537. X                break;
  1538. X            ++matched;
  1539. X        }
  1540. X        if( matched == patLength ) {
  1541. X            /* we found the string */
  1542. X            /* now does it have to be a whole word? */
  1543. X            if( findWholeWords ) {
  1544. X                /* make sure the character before it is */
  1545. X                /* not alphanumeric or "_" */
  1546. X                ch3 = (char)getFileByte(fileId, stopCp);
  1547. X                matched = !isalnum(ch3) && ch3 != '_';
  1548. X                if( matched ) {
  1549. X                    /* and the char after it also */
  1550. X                    ch3 = (char)getFileByte(fileId,
  1551. X                        stopCp+patLength+1);
  1552. X                    matched =
  1553. X                        !isalnum(ch3) && ch3 != '_';
  1554. X                }
  1555. X            } else
  1556. X                matched = 1;
  1557. X            if( matched ) {
  1558. X                *linesPassed = nLines;
  1559. X                return stopCp + 1;
  1560. X            }
  1561. X        }
  1562. X        firstChar = (unsigned char *)1;
  1563. X        lastChar = (unsigned char *)0;
  1564. X    }
  1565. X    *linesPassed = nLines;
  1566. X    return (Offset)(-1);
  1567. X}
  1568. X
  1569. unsigned char *
  1570. match1up( start, len, ch1, ch2 )
  1571. X    unsigned char *start;
  1572. X    int len;
  1573. X    int ch1, ch2;
  1574. X{
  1575. X    unsigned char ch;
  1576. X
  1577. X    while( len-- > 0 ) {
  1578. X        ch = *start--;
  1579. X        if( ch == ch1 || ch == ch2 )
  1580. X            return start;
  1581. X    }
  1582. X    return (unsigned char *)NULL;
  1583. X}
  1584. X
  1585. unsigned char *
  1586. match1dn( start, len, ch1, ch2 )
  1587. X    unsigned char *start;
  1588. X    int len;
  1589. X    int ch1, ch2;
  1590. X{
  1591. X    unsigned char ch;
  1592. X
  1593. X    while( len-- > 0 ) {
  1594. X        ch = *start++;
  1595. X        if( ch == (unsigned char)ch1 || ch == (unsigned char)ch2 )
  1596. X            return start;
  1597. X    }
  1598. X    return (unsigned char *)NULL;
  1599. X}
  1600. X
  1601. unsigned char *
  1602. match2dn( start, len, ch1 )
  1603. X    unsigned char *start;
  1604. X    int len;
  1605. X    int ch1;
  1606. X{
  1607. X    unsigned char ch;
  1608. X
  1609. X    while( len-- > 0 ) {
  1610. X        ch = *start++;
  1611. X        if( ch == (unsigned char)ch1 )
  1612. X            return start;
  1613. X    }
  1614. X    return (unsigned char *)NULL;
  1615. X}
  1616. X
  1617. int
  1618. countnl( start, len )
  1619. X    unsigned char *start;
  1620. X    int len;
  1621. X{
  1622. X    unsigned char ch;
  1623. X    int count = 0;
  1624. X
  1625. X    while( len-- > 0 ) {
  1626. X        ch = *start++;
  1627. X        if( ch == '\n' )
  1628. X            ++count;
  1629. X    }
  1630. X    return count;
  1631. X}
  1632. END_OF_FILE
  1633. if test 7629 -ne `wc -c <'spans.c'`; then
  1634.     echo shar: \"'spans.c'\" unpacked with wrong size!
  1635. fi
  1636. # end of 'spans.c'
  1637. fi
  1638. if test -f 'tclLib/textMenu.tcl' -a "${1}" != "-c" ; then 
  1639.   echo shar: Will not clobber existing file \"'tclLib/textMenu.tcl'\"
  1640. else
  1641. echo shar: Extracting \"'tclLib/textMenu.tcl'\" \(7815 characters\)
  1642. sed "s/^X//" >'tclLib/textMenu.tcl' <<'END_OF_FILE'
  1643. X#
  1644. X#
  1645. X# The text menu bar specification
  1646. X#
  1647. X#
  1648. X
  1649. set QuitMenu {
  1650. X    {command "And save all" {QuitPoint save}}
  1651. X    {command "And ask" {MakeQuitBox}}
  1652. X    {command "And discard edits" {QuitPoint discard}}
  1653. X}
  1654. X
  1655. set HelpMenu {
  1656. X    {command "Function keys" {HelpWindow "function keys"}}
  1657. X    {command "General" {HelpWindow general}}
  1658. X    {command "Mouse menus" {HelpWindow "mouse menus"}}
  1659. X    {command "Scrolling" {HelpWindow scroll}}
  1660. X    {command "Options" {HelpWindow options}}
  1661. X}
  1662. X
  1663. set FileMenu {
  1664. X    {command "Select text colors ..." {MakeColorBox}}
  1665. X    {cascade "Select text font =>" {
  1666. X        {command "6x13" {TextFont "6x13"}}
  1667. X        {command "6x10" {TextFont "6x10"}}
  1668. X        {command "5x8" {TextFont "5x8"}}
  1669. X        {command "*clean-medium-r*6*50*"
  1670. X                {TextFont "*clean-medium-r*6*50*"}}
  1671. X        {command "7x13" {TextFont "7x13"}}
  1672. X        {command "8x13" {TextFont "8x13"}}
  1673. X        {command "9x15" {TextFont "9x15"}}
  1674. X        {command "10x20" {TextFont "10x20"}}
  1675. X        {command "6x13bold" {TextFont "6x13bold"}}
  1676. X        {command "7x13bold" {TextFont "7x13bold"}}
  1677. X        {command "8x13bold" {TextFont "8x13bold"}}
  1678. X    }}
  1679. X    {cascade "PREFS" PREFS}
  1680. X    {separator}
  1681. X    {command "Zoom vertical" {Zoom}}
  1682. X    {command "Zoom full" {Zoom {} full}}
  1683. X    {cascade "Move Window =>" {
  1684. X        {command "Move to NW" {MoveWindow 502x410+0+0}}
  1685. X        {command "Move to NE" {MoveWindow 502x390+530+0}}
  1686. X        {command "Move to SE" {MoveWindow 502x390+530+415}}
  1687. X        {command "Move to SW" {MoveWindow 502x390+0+415}}
  1688. X    }}
  1689. X    {separator}
  1690. X    {command "Save file" {SaveFile}}
  1691. X    {command "Save as ..." {SaveAs}}
  1692. X    {separator}
  1693. X    {command "Open selection" {OpenWindow [selection get]}}
  1694. X    {command "Open ..." {Browser 490x415+656+0}}
  1695. X    {cascade "Close window =>" {
  1696. X        {command "and save" {CloseWindow save}}
  1697. X        {command "and ask" {CloseWindow ask}}
  1698. X        {command "and discard edits" {CloseWindow nosave}}
  1699. X    }}
  1700. X    {command "About Point ..." {MakeAboutBox}}
  1701. X    {cascade "Quit Point =>" {
  1702. X        {command "And save all" {QuitPoint save}}
  1703. X        {command "And ask" {MakeQuitBox}}
  1704. X        {command "And discard edits" {QuitPoint discard}}
  1705. X    }}
  1706. X}
  1707. X
  1708. set EditMenu {
  1709. X    {command "Insert X selection" {InsertSelectedString}}
  1710. X    {command "Cancel copy mode" {CancelModes}}
  1711. X    {separator}
  1712. X    {command "Indent selected lines" {IndentSelection}}
  1713. X    {command "Outdent selected lines" {IndentSelection 1}}
  1714. X    {separator}
  1715. X    {command "Search and Replace..." {MakeReplaceBox}}
  1716. X    {command "RE Search and Replace..." {MakeRegexReplaceBox}}
  1717. X    {separator}
  1718. X    {command "Define Selected Macro" {DefineMacro}}
  1719. X    {command "Execute Macro" {ExecMacro}}
  1720. X    {command "Execute Selection as Tcl" {ExecSel}}
  1721. X    {separator}
  1722. X    {cascade "Scrap =>" {
  1723. X        {command "Insert from" {InsertFromScrap}}
  1724. X        {command "Delete sel to" {DeleteToScrap}}
  1725. X        {command "Copy sel to" {CopySelToScrap}}
  1726. X        {command "Exchange sel with" {ExchangeWithScrap}}
  1727. X    }}
  1728. X    {cascade "Copy =>" {
  1729. X        {command "Note destination" {CopyToHereMode}}
  1730. X        {command "Sel to destination" {CopyToHereMode}}
  1731. X        {command "Cancel copy mode" {CancelModes}}
  1732. X    }}
  1733. X    {cascade "Change Case =>" {
  1734. X        {command "To upper" {ChangeCaseOfSel toupper}}
  1735. X        {command "To lower" {ChangeCaseOfSel tolower}}
  1736. X        {command "Toggle case" {ChangeCaseOfSel toggle}}
  1737. X    }}
  1738. X    {cascade "Undo/Again/Redo =>" {
  1739. X        {command "Repeat last edit" {Again mostrecent}}
  1740. X        {command "Last edit (this file)" {Again thisfile}}
  1741. X        {command "Undo one edit" {Undo 1}}
  1742. X        {command "Redo one edit" {Redo 1}}
  1743. X        {command "Begin block undo" {Undo begin}}
  1744. X        {command "End block undo" {Undo end}}
  1745. X        {command "Show command history" {ShowUndoStack}}
  1746. X    }}
  1747. X    {command "Redraw window" {Redraw}}
  1748. X}
  1749. X
  1750. set GotoMenu {
  1751. X    {command "Goto Selected Line #" {GotoLine [selection get] lof}}
  1752. X    {command "Goto Line # ..." {MakeGotoBox}}
  1753. X    {command "Goto Selection" {ShowSelection}}
  1754. X    {separator}
  1755. X    {command "Find Selected Ctag" {CTag [selection get]}}
  1756. X    {command "Find Ctag ..." {MakeCtagBox}}
  1757. X    {command "Find Selected Keyword" {GetSelectedKeyword}}
  1758. X    {command "Find Keyword ..." {MakeKeywordBox}}
  1759. X    {command "Find Matching bracket" {FindMatchingBracket}}
  1760. X    {separator}
  1761. X    {cascade "Search for string =>" {
  1762. X        {command ">> for selected RE" {SearchForSel 1 forward}}
  1763. X        {command "<< for selected RE" {SearchForSel 1 backward}}
  1764. X        {command ">> for last RE" {RegexSearch \{\} forward}}
  1765. X        {command "<< for last RE" {RegexSearch \{\} backward}}
  1766. X        {command ">> for last string" {RepeatSearch forward}}
  1767. X        {command "<< for last string" {RepeatSearch backward}}
  1768. X        {command ">> for selection" {SearchForSel 0 forward}}
  1769. X        {command "<< for selection" {SearchForSel 0 backward}}
  1770. X        {command "For string ..." {MakeSearchBox normal}}
  1771. X    }}
  1772. X    {cascade "Move in file to =>" {
  1773. X        {command "Beginning" {GotoLine 1 top}}
  1774. X        {command "End" {MoveToEndFile}}
  1775. X        {command "Last place" {MoveToLastPlace}}
  1776. X    }}
  1777. X}
  1778. X
  1779. set TextMenuSpec {
  1780. X    {menu   FILE  "FILE"   FileMenu}
  1781. X    {menu   EDIT  "EDIT"   EditMenu}
  1782. X    {menu   GOTO  "GOTO"   GotoMenu}
  1783. X    {button << " << "   {
  1784. X        {SearchForSel 0 backward} 
  1785. X        {MakeSearchBox normal}
  1786. X        {RepeatSearch backward}
  1787. X    }}
  1788. X    {button >> " >> "   {
  1789. X        {SearchForSel 0 forward} 
  1790. X        {MakeSearchBox regex}
  1791. X        {RepeatSearch forward}
  1792. X    }}
  1793. X    {button Close "Close"   {
  1794. X        {CloseWindow save}
  1795. X        {CloseWindow ask}
  1796. X        {CloseWindow nosave}
  1797. X    }}
  1798. X    {button Save " Sv "   {
  1799. X        {SaveFile}
  1800. X        {SaveAs}
  1801. X        Redraw
  1802. X    }}
  1803. X    {button Jump "Jump"   {
  1804. X        {GotoLine 1 top}
  1805. X        MoveToLastPlace
  1806. X        MoveToEndFile
  1807. X    }}
  1808. X    {button Tag " Tag "    {
  1809. X        {CTag [selection get]}
  1810. X        MakeKeywordBox
  1811. X        GetSelectedKeyword
  1812. X    }}
  1813. X    {button Dos "+Do-"    {
  1814. X        {Redo 1}
  1815. X        {Again}
  1816. X        {Undo 1}
  1817. X    }}
  1818. X    {button Zz " Zz "   {
  1819. X        {ChangeCaseOfSel toupper}
  1820. X        {ChangeCaseOfSel toggle}
  1821. X        {ChangeCaseOfSel tolower}
  1822. X    }}
  1823. X    {button MoveW "MoveW"   {
  1824. X        {MoveWindow 502x410+0+0}
  1825. X        {MoveWindow 502x390+530+0}
  1826. X        {MoveWindow 502x390+530+415}
  1827. X    }}
  1828. X    {button Line "Line#"   {
  1829. X        {GotoLine [selection get] lof}
  1830. X        MakeGotoBox
  1831. X        {SetLineNumbers}
  1832. X    }}
  1833. X    {menu   HELP  "HELP"   HelpMenu}
  1834. X}
  1835. X
  1836. X#    {button InsDel "insDel"   {
  1837. X#        {InsertFromScrap} 
  1838. X#        {InsertSelectedString}
  1839. X#        {DeleteToScrap}
  1840. X#    }}
  1841. X#
  1842. X#
  1843. X# The text menu bindings
  1844. X#
  1845. X#
  1846. proc TextMenuBindings {w} {
  1847. X    bind $w.<<     <Any-Key>   {+SearchCharacter %N %s}
  1848. X    bind $w.>>     <Any-Key>   {+SearchCharacter %N %s}
  1849. X    bind $w.GOTO   <Key>       {+GotoDigit %A}
  1850. X    bind $w.Line   <Key>       {+GotoDigit %A}
  1851. X}
  1852. X
  1853. proc TextBindings {w name} {
  1854. X    bind $w <Expose>        "Expose $name %x %y %w %h %c"
  1855. X    bind $w <Configure>        "Configure $name"
  1856. X
  1857. X    bind $w <Any-ButtonPress-1>     "Mouse $name BeginSelection %x %y"
  1858. X    bind $w <Any-B1-Motion>         "Mouse $name ExtendSelection %x %y"
  1859. X    bind $w <Any-ButtonRelease-1>     "Mouse $name EndExtending %x %y"
  1860. X
  1861. X    bind $w <Any-ButtonPress-2>     "Mouse $name BeginMouseMenu2 %x %y"
  1862. X    bind $w <Any-B2-Motion>         "Mouse $name ContinueMouseMenu %x %y"
  1863. X    bind $w <Any-ButtonRelease-2>     "Mouse $name EndMouseMenu %x %y"
  1864. X    bind $w <Any-B2-ButtonRelease-1> "Mouse $name CancelMouseMenu %x %y"
  1865. X    bind $w <Any-B2-ButtonRelease-3> "Mouse $name CancelMouseMenu %x %y"
  1866. X
  1867. X    bind $w <Any-ButtonPress-3>     "Mouse $name BeginMouseMenu1 %x %y"
  1868. X    bind $w <Any-B3-Motion>         "Mouse $name ContinueMouseMenu %x %y"
  1869. X    bind $w <Any-ButtonRelease-3>     "Mouse $name EndMouseMenu %x %y"
  1870. X    bind $w <Any-B3-ButtonRelease-1> "Mouse $name CancelMouseMenu %x %y"
  1871. X    bind $w <Any-B3-ButtonRelease-2> "Mouse $name CancelMouseMenu %x %y"
  1872. X
  1873. X    bind $w <F1>        {DeleteToScrap}
  1874. X    bind $w <F2>        {InsertFromScrap}
  1875. X    bind $w <F3>        {RepeatSearch backward}
  1876. X    bind $w <F4>        {RepeatSearch forward}
  1877. X    bind $w <F5>        {Again}
  1878. X    bind $w <F6>        {Redo 1}
  1879. X    bind $w <F7>        {ScrollWindow up page}
  1880. X    bind $w <F8>        {ScrollWindow down page}
  1881. X    bind $w <F9>        {Undo 1}
  1882. X    
  1883. X    bind $w <Up>        {MoveSel char up}
  1884. X    bind $w <Down>        {MoveSel char down}
  1885. X    bind $w <Left>        {MoveSel char left}
  1886. X    bind $w <Shift-Left>    {MoveSel word left}
  1887. X    bind $w <Control-Left>    {MoveSel word left}
  1888. X    bind $w <Right>        {MoveSel char right}
  1889. X    bind $w <Shift-Right>    {MoveSel word right}
  1890. X    bind $w <Control-Right>    {MoveSel word right}
  1891. X
  1892. X    bind $w <Home>        {MoveSel line left}
  1893. X    bind $w <End>        {MoveSel line right}
  1894. X    bind $w <Prior>        {ScrollWindow up page}
  1895. X    bind $w <Next>        {ScrollWindow down page}
  1896. X    bind $w <Any-Key>       {Key %N %s}
  1897. X}
  1898. X
  1899. END_OF_FILE
  1900. if test 7815 -ne `wc -c <'tclLib/textMenu.tcl'`; then
  1901.     echo shar: \"'tclLib/textMenu.tcl'\" unpacked with wrong size!
  1902. fi
  1903. # end of 'tclLib/textMenu.tcl'
  1904. fi
  1905. echo shar: End of archive 3 \(of 15\).
  1906. cp /dev/null ark3isdone
  1907. MISSING=""
  1908. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do
  1909.     if test ! -f ark${I}isdone ; then
  1910.     MISSING="${MISSING} ${I}"
  1911.     fi
  1912. done
  1913. if test "${MISSING}" = "" ; then
  1914.     echo You have unpacked all 15 archives.
  1915.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1916. else
  1917.     echo You still need to unpack the following archives:
  1918.     echo "        " ${MISSING}
  1919. fi
  1920. ##  End of shell archive.
  1921. exit 0
  1922. -- 
  1923. --
  1924. Molecular Simulations, Inc.            mail: dcmartin@msi.com
  1925. 796 N. Pastoria Avenue                uucp: uunet!dcmartin
  1926. Sunnyvale, California 94086            at&t: 408/522-9236
  1927.