/* $XConsortium: README /main/3 1996/07/15 14:10:29 drk $ */ XmdTextEditor v2.0 ------------------ ************************************************************************** * This demo only works with Motif 2.0. It does not work with Motif 2.1. * ************************************************************************** XmdTextEditor is a primitive text editor, based on Motif 2.0's XmCSText widget, which makes use of its XmNsource resource to allow multiple views on the same underlying text. In addition it uses the rendition features of XmString to allow the modification of the rendition of pieces of text, and the conversion functions of XmString to read and write different file formats. This version of XmdTextEditor will work only with Motif 2.0. The View menu includes Split Pane -- to add a new independently scrollable view of the text Remove Pane -- to remove a designated pane One Pane -- to remove all panes except the designated pane The designated pane is determined in the following way: -- Using an explicit focus policy, it is the last view which had focus -- Using a pointer focus policy, it is the last view which the user interacted with. The Renditions menu provides a limited set of commands for changing the font and color of text and for underlining or striking through it. XmdTextEditor is also an example of how to write code that is as independent of other layers as possible. The various files have the following roles: file.c -- code to read, write, and remove files. Hides any OS/filesystem dependencies. app.c -- Uses file.c to provide all the code to manipulate files and their related buffers. This is all toolkit-dependent. tk.c -- Isolates dependencies on the Xm toolkit. The first half of the file provides utility routines and a toolkit-independent (but application-specific) interface that can be used by the toolkit-independent dialogue layer of the application. The second half of the file defines all the callback routines and registers the callbacks in Mrm. Many of these simply update state internal to this layer; others perform additional actions. Where those actions unambiguously correspond to toolkit-specific action, routines defined in the first half of the file are called. Otherwise, an upcall is made to the toolkit- independent dialogue layer to decide what to do. dlg.c -- This code manages the dialogue with the user. By using tk.c, it is toolkit-independent. texteditor.c -- Used to initialize the application and instantiates widget hierarchies. Hides the use of UIL and Mrm from the rest of the application. textedit.uil -- Contains the descriptions of the widget hierarchy of the application, and descriptions of menu items and widgets to be fetched later. It includes strings.uil and menus.uih. strings.uil -- Contains applications specific strings to be localized. In addition, XmdTextEditor uses a standardized uil include file, demos/lib/uil/menus.uih, to generate it's initial set of style-guide compliant menus. The initialization code in texteditor.c then unmanages unneeded menu items and fetches and manages additional menu items from textedit.uil. menus.uih itself includes menu_strings.uih which allows easy localization of menu strings, and menu_cbs.uih which allows the addition of non-standard callbacks to menu items. Additional Translations ----------------------- Users familiar with emacs may want to add the following translations to their .Xdefaults files: *XmText.translations: #override\n\ Mod1<Btn3Down>: scroll-cursor-vertically()\n\ Mod1<Btn3Motion>: scroll-cursor-vertically()\n\ Ctrl<Key>a: beginning-of-line()\n\ Ctrl<Key>b: backward-character()\n\ Ctrl<Key>d: delete-next-character()\n\ Ctrl<Key>e: end-of-line()\n\ Ctrl<Key>f: forward-character()\n\ Ctrl<Key>g: beep()\n\ Ctrl<Key>h: delete-previous-character()\n\ Ctrl<Key>i: cut-primary()\n\ Ctrl<Key>j: newline-and-indent()\n\ Ctrl<Key>k: set-anchor() end-of-line() key-select() cut-clipboard()\n\ Ctrl<Key>l: redraw-display()\n\ Ctrl<Key>m: newline()\n\ Ctrl<Key>n: next-line()\n\ Ctrl<Key>o: newline-and-backup()\n\ Ctrl<Key>p: previous-line()\n\ Ctrl<Key>v: next-page()\n\ Ctrl<Key>w: cut-clipboard()\n\ Ctrl<Key>y: paste-clipboard()\n\ Ctrl<Key>z: scroll-one-line-up()\n\ Mod1<Key>b: backward-word()\n\ Mod1<Key>d: delete-next-word()\n\ Mod1<Key>f: forward-word()\n\ Mod1<Key>h: delete-previous-word()\n\ Mod1<Key>i: copy-primary()\n\ Mod1<Key>k: delete-to-end-of-line()\n\ Mod1<Key>v: previous-page()\n\ Mod1<Key>w: copy-clipboard()\n\ Mod1<Key>z: scroll-one-line-down()\n\ Mod1 Shift<Key>greater: end-of-file()\n\ Mod1<Key>less: beginning-of-file()\n\ Mod1<Key>]: forward-paragraph()\n\ Mod1<Key>[: backward-paragraph() Known Bugs ---------- Moving and removing files is not currently implemented. The following menu items are not implemented: Print, Print Setup..., Close, Undo, Repeat, Select All, Deselect All, and all the Help menu items. Changing the rendition of text contained within another rendition change can sometimes cause renditions to "bleed" into the following text. Changing the rendition of a line selected by a triple-click will cause all lines until the next rendition change to also get the selected rendition. Missing Features ---------------- Zillions of features could be added (and would need to be added) to make this a truly usable text editor rather than a demo. In particular, WYSIWYG editing and saving of XmdHelp Markup format is not supported and the selection of renditions is limited. Have fun! W. Scott Meeks meeks@osf.org