diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /lib/scr | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'lib/scr')
-rw-r--r-- | lib/scr/cursor.key | 56 | ||||
-rw-r--r-- | lib/scr/geomap.key | 23 | ||||
-rw-r--r-- | lib/scr/gkimosaic.key | 15 | ||||
-rw-r--r-- | lib/scr/gtools.key | 85 | ||||
-rw-r--r-- | lib/scr/gtwindow.key | 21 | ||||
-rw-r--r-- | lib/scr/help.gui | 3040 | ||||
-rw-r--r-- | lib/scr/help.html | 586 | ||||
-rw-r--r-- | lib/scr/imedit.key | 82 | ||||
-rw-r--r-- | lib/scr/imexamine.key | 165 | ||||
-rw-r--r-- | lib/scr/implot.key | 32 | ||||
-rw-r--r-- | lib/scr/inlgfit.key | 77 | ||||
-rw-r--r-- | lib/scr/tvmark.key | 54 | ||||
-rw-r--r-- | lib/scr/wcsedit.key | 24 | ||||
-rw-r--r-- | lib/scr/xgterm.gui | 14 | ||||
-rw-r--r-- | lib/scr/xxgterm.gui | 1523 |
15 files changed, 5797 insertions, 0 deletions
diff --git a/lib/scr/cursor.key b/lib/scr/cursor.key new file mode 100644 index 00000000..c1ea5ef6 --- /dev/null +++ b/lib/scr/cursor.key @@ -0,0 +1,56 @@ +Cursor Mode Keystrokes + + A draw and label the axes of current viewport + B backup over last instruction in frame buffer + C print the cursor position + D draw a line by marking the endpoints + E expand plot by setting window corners + F set fast cursor (for HJKL) + H step cursor left + J step cursor down + K step cursor up + L step cursor right + M move point under cursor to center of screen + P zoom out (restore previous expansion) + R redraw the screen + T draw a text string + U undo last frame buffer edit + V set slow cursor (for HJKL) + W select WCS at current position of cursor + X zoom in, X only + Y zoom in, Y only + Z zoom in, both X and Y + < set lower limit of plot to the cursor y value + > set upper limit of plot to the cursor y value + \ escape next character + : set cursor mode options + :! send a command to the host system + = shorthand for :.snap (make graphics hardcopy) + 0 reset and redraw + 1-9 roam + + +Cursor Mode Commands: + + :.axes[+-] draw axes of viewport whenever screen is redrawn + :.case[+-] enable case sensitivity for keystrokes + :.clear clear alpha memory (e.g, this text) + :.cursor n select cursor + :.gflush flush plotter output + :.help print help text for cursor mode + :.init initialize the graphics system + :.markcur[+-] mark cursor position after each cursor read + :.off [keys] disable selected cursor mode keys + :.on [keys] enable selected cursor mode keys + :.page[+-] enable screen clear before printing help text + :.read file fill frame buffer from a file + :.show print cursor mode and graphics kernel status + :.snap [device] make hardcopy of graphics display + :.txqual qual set character generator quality (normal,l,m,h) + :.txset format set text drawing parameters (size,up,hj,vj,etc) + :.xres=value set X resolution (stdgraph only) + :.yres=value set Y resolution (stdgraph only) + :.viewport x1 x2 y1 y2 set workstation viewport in world coordinates + :.write[!][+] file save frame buffer in a spool file + :.zero reset viewport and redraw frame + diff --git a/lib/scr/geomap.key b/lib/scr/geomap.key new file mode 100644 index 00000000..abced624 --- /dev/null +++ b/lib/scr/geomap.key @@ -0,0 +1,23 @@ + Interactive Geometric Distortion Correction + +? Print options +f Fit the data and graph with the current graph type (g, x, r, y, s) +g Graph the data and the current fit +x,r Graph the x(in) fit residuals versus x(ref) and y(ref) respectively +y,s Graph the y(in) fit residuals versus x(ref) and y(ref) respectively +d,u Delete or undelete the data point nearest the cursor +o Overplot the next graph +c Toggle the constant x(ref), y(ref) plotting option +t Plot a line of constant x(ref), y(ref) through nearest data point +l Print xshift, yshift, xscale, yscale, xrotate, yrotate +q Exit the interactive curve fitting + +The parameters are listed or set with the following commands which may be +abbreviated. To list the value of a parameter type the command alone. + +:show List parameters +:function [value] Fitting function (chebyshev, legendre) +:xxorder :xyorder [value] X fitting function xorder, yorder +:yxorder :yyorder [value] Y fitting function xorder, yorder +:xxterms :yxterms [y/n] Include cross-terms in X, Y fit +:reject [value] Rejection threshold diff --git a/lib/scr/gkimosaic.key b/lib/scr/gkimosaic.key new file mode 100644 index 00000000..cca3e010 --- /dev/null +++ b/lib/scr/gkimosaic.key @@ -0,0 +1,15 @@ +Gkimosaic Command Summary: + + return quit + q quit + r redraw screen with new parameters + spacebar continue + ? print help information + + :nx N change value of nx to N + :ny N change value of ny to N + :fill yes, :fill+, :fill sets fill = yes + :fill no, :fill- sets fill = no + :rotate yes, :rotate+, :rotate sets rotate = yes + :rotate no, :rotate- sets rotate = no + :skip +/-N skip forward/backward N plots diff --git a/lib/scr/gtools.key b/lib/scr/gtools.key new file mode 100644 index 00000000..9193c260 --- /dev/null +++ b/lib/scr/gtools.key @@ -0,0 +1,85 @@ + GRAPH FORMAT OPTIONS - Not all options work in all programs + +COLON COMMANDS: + +:/help Print help menu +:/redraw Redraw the graph + +:/drawtitle [yes|no] Draw title block? +:/sysid [yes|no] Include the standard IRAF user/date banner? +:/parameters string Parameter string (usual set by application) +:/title string Title +:/subtitle string Subtitle +:/comments string Comments + +:/type string Type of graph (line, hist, or mark) +:/mark string Mark type (point, box, plus, cross, diamond, + hline, vline, hebar, vebar, circle) +:/line [0-9] Line style +:/color [0-9] Line or mark color + +:/drawxlabels [yes|no] Draw X axis label? +:/xlabel string Label for X axis +:/xunits string Units for X axis +:/xsize size Size of marks along the X axis +:/xtransform type X coordinate transform type (linear or logrithmic) +:/xwindow x1 x2 X graph window (INDEF defaults to min or max) +:/xflip [yes|no] Flip X axis + +:/drawylabels [yes|no] Draw Y axis label? +:/ylabel string Label for Y axis +:/yunits string Units for Y axis +:/ysize size Size of marks along the Y axis +:/ytransform type Y coordinate transform type (linear or logrithmic) +:/ywindow y1 y2 Y graph window (INDEF defaults to min or max) +:/yflip [yes|no] Flip Y axis + +:/transpose Transpose the graph axes + +Format changes do not take effect until the graph is redrawn. + +CURSOR KEYS: + +a Autoscale x and y axes +b Set bottom edge of window +c Center window at cursor position +d Shift window down +e Expand window (mark lower left and upper right of new window) +f Flip x axis +g Flip y axis +j Set left edge of window +k Set right edge of window +l Shift window left +m Autoscale x axis +n Autoscale y axis +p Pan x and y axes about cursor +r Shift window right +t Set top edge of window +u Shift window up +x Zoom x axis about cursor +y Zoom y axis about cursor +z Zoom x and y axes about cursor + + +DESCRIPTION + +A number of application tasks use the graphics tools in the "gtools" +package. The graphics tools control labeling and titling of graphs and +interactive formatting. The user changes the defaults via colon commands +and with the window cursor keys. The windowing options are usually +entered with the 'w' key from an application program but other keys +may be used instead. Not all of the formating options may be available +in a particular application; for example the graph type and mark type +options. Check the documentation for the application program. +Some applications set the values every time the graph is redraw so any +user changes will be overridden. + +The title block consists of a system identification banner, a parameter +string, a title string, a subtitle string, and a comment string in +that order. The "notitle" parameter can be used to turn off all +the title block. There are parameters to control each of the +parts of the title block. The "subtitle" and "comments" +parameters are rarely used by applications and so may be used to +annotate graphs. The x and y labels consist of label and units strings. +The "drawxlabels" and "drawylabels" parameters can be used to +turn off both parts of the axis labels. diff --git a/lib/scr/gtwindow.key b/lib/scr/gtwindow.key new file mode 100644 index 00000000..2ddf02c7 --- /dev/null +++ b/lib/scr/gtwindow.key @@ -0,0 +1,21 @@ + SET GRAPH WINDOW + +a Autoscale x and y axes +b Set bottom edge of window +c Center window at cursor position +d Shift window down +e Expand window (mark lower left and upper right of new window) +f Flip x axis +g Flip y axis +j Set left edge of window +k Set right edge of window +l Shift window left +m Autoscale x axis +n Autoscale y axis +p Pan x and y axes about cursor +r Shift window right +t Set top edge of window +u Shift window up +x Zoom x axis about cursor +y Zoom y axis about cursor +z Zoom x and y axes about cursor diff --git a/lib/scr/help.gui b/lib/scr/help.gui new file mode 100644 index 00000000..a22c2a78 --- /dev/null +++ b/lib/scr/help.gui @@ -0,0 +1,3040 @@ +# XHELP.GUI -- Graphics user interface for the IRAF help browser. + +reset-server +appInitialize xhelp XHelp { + +XHelp*objects:\ + toplevel Layout helpLayout\ + helpLayout Group menubarGroup\ + helpLayout Paned helpPanes\ + menubarGroup Layout menubarLayout\ + menubarLayout MenuButton fileButton\ + menubarLayout MenuButton optionsButton\ + menubarLayout Command printButton\ + menubarLayout Command findButton\ + menubarLayout Command searchButton\ + menubarLayout MenuButton historyButton\ + menubarLayout Command helpButton\ + menubarLayout Command quitButton\ +\ + helpPanes Group topicGroup\ + topicGroup Layout topicLayout\ + topicLayout Label topicLabel\ + topicLayout Command reloadButton\ + topicLayout Frame topicFrame\ + topicFrame AsciiText topicEntry\ + topicLayout Command topicClear\ + topicLayout Frame listFrame\ + listFrame Viewport listView\ + listView List topicList\ +\ + helpPanes Group outputGroup\ + outputGroup Layout outputLayout\ + outputLayout Command htbButton\ + outputLayout Command htfButton\ + outputLayout Command htuButton\ + outputLayout Command hthButton\ + outputLayout MenuButton secButton\ + outputLayout MenuButton parButton\ + outputLayout TextToggle hlpOpt\ + outputLayout TextToggle srcOpt\ + outputLayout TextToggle sysOpt\ + outputLayout TextToggle filOpt\ + outputLayout Frame helpFrame\ + helpFrame HTML helpText\ +\ +\ + toplevel TopLevelShell printShell\ + printShell Layout prntLayout\ + prntLayout Group printGroup\ + prntLayout Group printCmdGroup\ +\ + printGroup Layout printLayout\ + printLayout Label toLabel\ + printLayout TextToggle toPrinter\ + printLayout TextToggle toFile\ + printLayout Label printLabel\ + printLayout Frame printFrame\ + printFrame AsciiText printEntry\ + printLayout Label pageLabel\ + printLayout TextToggle pageLetter\ + printLayout TextToggle pageLegal\ + printLayout TextToggle pageA4\ + printLayout TextToggle pageB5\ +\ + printCmdGroup Layout printCmdLayout\ + printCmdLayout Command printOkay\ + printCmdLayout Command printDismiss\ +\ +\ + toplevel TopLevelShell searchShell\ + searchShell Group searchGroup\ + searchGroup Layout searchLayout\ + searchLayout Label resLabel\ + searchLayout Frame resFrame\ + resFrame HTML resList\ + searchLayout Label searchLabel\ + searchLayout Frame searchFrame\ + searchFrame AsciiText searchEntry\ + searchLayout Command searchClear\ + searchLayout Command searchOkay\ + searchLayout Label searchStatus\ + searchLayout TextToggle exactMatch\ + searchLayout Command searchHelp\ + searchLayout Command searchDismiss\ +\ +\ + toplevel TransientShell findShell\ + findShell Layout fsLayout\ + fsLayout Group findGroup\ + fsLayout Group findCmdGroup\ +\ + findGroup Layout findLayout\ + findLayout Label findLabel\ + findLayout Frame findFrame\ + findFrame AsciiText findEntry\ + findLayout TextToggle findDir\ + findLayout TextToggle findCase\ +\ + findCmdGroup Layout findCmdLayout\ + findCmdLayout Command findOkay\ + findCmdLayout Command findClear\ + findCmdLayout Command findDismiss\ +\ +\ + toplevel TopLevelShell fileShell\ + fileShell Layout flist\ + flist Group flGroup\ + flGroup Layout flFrame\ + flFrame Label flistLabel\ + flFrame Frame flistFrame\ + flistFrame AsciiText flistText\ + flFrame Label flpkgLabel\ + flFrame Label flpkgVal\ + flFrame Command flDismiss\ +\ +\ + toplevel TopLevelShell fileBrowser\ + fileBrowser Layout fbLayout\ + fbLayout Group fnavGroup\ + fbLayout Group fbCmdGroup\ + fbLayout Parameter directory\ +\ + fnavGroup Layout fnavLayout\ + fnavLayout Command fnavHome\ + fnavLayout Command fnavUp\ + fnavLayout Command fnavRoot\ + fnavLayout Command fnavRescan\ + fnavLayout Label filterLabel\ + fnavLayout Frame filterFrame\ + filterFrame AsciiText filterEntry\ + fnavLayout Command filterClear\ + fnavLayout Group dirGroup\ + dirGroup Frame dirFrame\ + dirFrame Viewport dirView\ + dirView List dirList\ + fnavLayout Group fileGroup\ + fileGroup Frame fgFrame\ + fgFrame Viewport fileView\ + fileView List fileList\ + fnavLayout Label curdirLabel\ + fnavLayout Label curdirVal\ + fnavLayout Label fnameLabel\ + fnavLayout Frame fnameFrame\ + fnameFrame AsciiText fnameEntry\ + fnavLayout Command fnameClear\ +\ + fnavLayout Group fmtGroup\ + fmtGroup Layout fmtLayout\ + fmtLayout Label fmtLabel\ + fmtLayout TextToggle fmtSrc\ + fmtLayout TextToggle fmtText\ + fmtLayout TextToggle fmtHTML\ + fmtLayout TextToggle fmtPS\ + fmtLayout Label owLabel\ + fmtLayout TextToggle overwrite\ +\ + fbCmdGroup Layout fbCmdLayout\ + fbCmdLayout Command fbcOkay\ + fbCmdLayout Command fbcHelp\ + fbCmdLayout Command fbcDismiss\ +\ +\ + toplevel TopLevelShell doc_source\ + doc_source Layout srcLayout\ + srcLayout Frame srcMenuFrame\ + srcMenuFrame Layout srcMenuBar\ + srcMenuBar Command srcDismiss\ + srcLayout Frame srcFrame\ + srcFrame AsciiText srcText\ +\ +\ + toplevel TopLevelShell hlpShell\ + hlpShell Layout hlpLayout\ + hlpLayout Group hlpMenuGroup\ + hlpMenuGroup Layout hlpMenu\ + hlpMenu Command hlpBack\ + hlpMenu Command hlpForward\ + hlpMenu Command hlpHome\ + hlpMenu Command hlpTutorial\ + hlpMenu Command hlpDismiss\ + hlpLayout Frame hlpTextFrame\ + hlpTextFrame HTML hlpText\ + hlpLayout Label hfLabel\ + hlpLayout Frame hfFrame\ + hfFrame AsciiText hfEntry\ + hlpLayout Command hfFind\ + hlpLayout Command hfClear\ + hlpLayout TextToggle hfDir\ + hlpLayout TextToggle hfCase\ + hlpShell Parameter help\ +\ +\ + toplevel TransientShell warning\ + warning Layout warn\ + warn Frame warnFrame\ + warnFrame Layout WFlayout\ + WFlayout Icon warnIcon\ + WFlayout TextBox warnText\ + warn Frame warnBtnFrame\ + warnBtnFrame Command warnDismiss\ +\ +\ + toplevel TopLevelShell tclShell\ + tclShell Layout tclLayout\ + tclLayout Group tclCmdGroup\ + tclCmdGroup Layout tclCmd\ + tclCmd Command tclClear\ + tclCmd Command tclExecute\ + tclCmd Toggle tclLogging\ + tclCmd Command tclDismiss\ + tclLayout Frame tclFrame\ + tclFrame AsciiText tclEntry\ +\ +\ + toplevel Parameter xhelp\ + xhelp Parameter textout\ + xhelp Parameter alert\ + xhelp Parameter apropos\ + xhelp Parameter pkglist\ + xhelp Parameter helpres\ + xhelp Parameter helpfiles\ + xhelp Parameter printer\ + xhelp Parameter curpack\ + xhelp Parameter curtask\ + xhelp Parameter history\ + xhelp Parameter showtype\ + xhelp Parameter type + + + + !------------------------------------------------------- + ! Define some global resources for the main menu panels. + !------------------------------------------------------- + *shadowWidth: 1 + *background: gray75 + *Arrow.width: 16 + *Arrow.height: 25 + *Text*height: 21 + *Command.height: 21 + *Command.highlightThickness: 1 + *Command.internalHeight: 4 + *MenuButton.height: 21 + *MenuButton.highlightThickness: 1 + *Label.borderWidth: 0 + *Label.shadowWidth: 0 + *TextButton.shadowWidth: 0 + *TextButton.highlightThickness: 1 + *TextToggle*borderWidth: 0 + *TextToggle.highlightThickness: 0 + *Toggle.highlightThickness: 1 + *Group.shrinkToFit: True + + *Arrow.foreground: gray72 + *Arrow.background: gray72 + *Text*background: gray72 + *AsciiText*background: gray72 + *TextBox.background: gray72 + *MultiList*background: gray72 + *List*background: gray72 + *Slider2d*thumbColor: gray75 + + + !------------------------------------------------------------- + ! Define resources to take advantage of the 3D scrollbar look. + !------------------------------------------------------------- + *Scrollbar*background: gray75 + *Scrollbar*width: 15 + *Scrollbar*height: 15 + *Scrollbar*shadowWidth: 1 + *Scrollbar*cursorName: top_left_arrow + *Scrollbar*pushThumb: true + + + !---------------------------------------- + ! Menu resources giving a shadow effect. + !---------------------------------------- + *SmeBSB.leftMargin: 10 + *SmeBSB.rightMargin: 5 + *SmeBSB.shadowWidth: 2 + *SmeBSB*background: SteelBlue + *SimpleMenu*background: gray77 + *SimpleMenu.borderWidth: 2 + *SimpleMenu.borderColor: Black + *SimpleMenu.shadowWidth: 2 + *SimpleMenu.line1.foreground: gray51 + *SimpleMenu.line2.foreground: gray91 + *SimpleMenu.line3.foreground: gray51 + *SimpleMenu.line4.foreground: gray91 + *SimpleMenu.line5.foreground: gray51 + *SimpleMenu.line6.foreground: gray91 + *SimpleMenu.line7.foreground: gray51 + *SimpleMenu.line8.foreground: gray91 + *SimpleMenu.line9.foreground: gray51 + *SimpleMenu.line10.foreground: gray91 + *SimpleMenu.line11.foreground: gray51 + *SimpleMenu.line12.foreground: gray91 + *SimpleMenu.line13.foreground: gray51 + *SimpleMenu.line14.foreground: gray91 + *SimpleMenu.line15.foreground: gray51 + *SimpleMenu.line16.foreground: gray91 + *SimpleMenu.line17.foreground: gray51 + *SimpleMenu.line18.foreground: gray91 + *SimpleMenu.line19.foreground: gray51 + *SimpleMenu.line20.foreground: gray91 + *SimpleMenu.line21.foreground: gray51 + *SimpleMenu.line22.foreground: gray91 + *SimpleMenu.line23.foreground: gray51 + *SimpleMenu.line24.foreground: gray91 + *SimpleMenu.line25.foreground: gray51 + *SimpleMenu.line26.foreground: gray91 + *SimpleMenu.line27.foreground: gray51 + *SimpleMenu.line28.foreground: gray91 + *SimpleMenu.line29.foreground: gray51 + *SimpleMenu.line30.foreground: gray91 + + + !---------------------------------------- + ! Define the default fonts to be used. + !---------------------------------------- + *font: -adobe-times-medium-r-normal-*-14-*-*-* + *Command.font: -adobe-times-bold-i-normal-*-12-*-*-* + *MenuButton.font: -adobe-times-bold-i-normal-*-12-*-*-* + *Toggle.font: -adobe-times-bold-i-normal-*-12-*-*-* + *Label.font: -adobe-times-bold-i-normal-*-12-*-*-* + *TextToggle.font: -adobe-times-bold-i-normal-*-12-*-*-* + *Group*SimpleMenu*font: 7x13 + *HTML*SimpleMenu*font: 7x13 + + *HTML.plainFont: -*-fixed-medium-r-*-*-13-*-*-* + *HTML.listingFont: -*-fixed-medium-r-*-*-13-*-*-* + *HTML.font: -adobe-times-medium-r-normal-*-14-*-*-* + *HTML.boldFont: -adobe-times-bold-r-normal-*-14-*-*-* + *HTML.plainboldFont: -adobe-times-bold-r-normal-*-14-*-*-* + *HTML.fixedboldFont: -adobe-times-bold-r-normal-*-14-*-*-* + *HTML.header1Font: -adobe-times-bold-r-normal-*-18-*-*-* + *HTML.header2Font: -adobe-times-bold-r-normal-*-14-*-*-* + *HTML.header3Font: -adobe-times-bold-r-normal-*-14-*-*-* + *HTML.header4Font: -adobe-times-bold-r-normal-*-14-*-*-* + *HTML.header5Font: -adobe-times-medium-i-normal-*-12-*-*-* + *HTML.header6Font: -adobe-times-bold-r-normal-*-10-*-*-* + *HTML.anchorUnderlines: 0 + *HTML.visitedAnchorUnderlines: 0 + *HTML.anchorColor: blue + *HTML.visitedAnchorColor: red3 + *HTML*background: gray72 + *HTML*Scrollbar.background: gray75 + *HTML*Scrollbar*width: 15 + *HTML*Scrollbar*height: 15 + + + !--------------------------- + ! Set the default resources. + !--------------------------- + *xhelp.title: IRAF Help Browser V1.0 - DEV + *xhelp.geometry: +0+0 + *xhelp.width: 625 + *xhelp.minWidth: 580 + *xhelp.minheight: 450 + *xhelp.height: 850 + + *helpLayout.geometry: 600x700+0+0 + *helpLayout*borderWidth: 0 + *helpLayout*Group.shrinkToFit: True + *helpLayout*Frame.frameType: sunken + *helpLayout*Frame.frameWidth: 1 + *helpLayout*Command.internalHeight: 2 + *helpLayout*MenuButton.internalHeight: 2 + *helpLayout*Label*highlightThickness: 0 + *helpLayout*List*shadeSurplus: False + *helpLayout*List.internalWidth: 10 + *helpLayout*Viewport.allowVert: True + *helpLayout*Viewport.forceBars: True + *helpLayout.width: 600 + *helpLayout.layout: vertical { \ + menubarGroup < +inf -inf * > \ + -1 \ + horizontal { \ + -1 \ + helpPanes < +inf -inf * +inf -inf > \ + -1 \ + } \ + -1 \ + } + *helpLayout*SimpleMenu.shadowWidth: 2 + *helpLayout*SimpleMenu.borderColor: Black + *helpLayout*SimpleMenu.borderWidth: 2 + + *menubarGroup.label: + *menubarGroup.outerOffset: 0 + *menubarGroup.innerOffset: 5 + *menubarGroup.frameType: raised + *menubarGroup.frameWidth: 2 + *menubarGroup*Command.shadowWidth: 0 + *menubarGroup*MenuButton.shadowWidth: 0 + *menubarLayout.layout: horizontal { \ + fileButton 5 \ + optionsButton 5 \ + printButton 5 \ + findButton 5 \ + searchButton 5 \ + historyButton 5 \ + 10 < +inf -inf > \ + helpButton 5 \ + quitButton \ + } + *fileButton.label: File + *fileButton.menuName: fileMenu + *optionsButton.label: Options + *optionsButton.menuName: optsMenu + *printButton.label: Print + *findButton.label: Find + *searchButton.label: Search + *historyButton.label: History + *historyButton.menuName: historyMenu + *helpButton.label: Help + *quitButton.label: Quit + + *topicGroup.label: + *topicGroup.outerOffset: 2 + *topicGroup.innerOffset: 2 + *topicGroup*frameType: chiseled + *topicGroup.frameWidth: 2 + *topicGroup*Label.shadowWidth: 0 + *topicGroup*Label.borderWidth: 1 + *topicGroup*Label.highlightThickness: 1 + *topicGroup*Viewport.useRight: True + *topicGroup*Viewport.useBottom: True + *topicLayout.layout: vertical { \ + 2 < +2 -2 > \ + horizontal { \ + 3 < +3 -3 > \ + topicLabel 2 topicFrame < +inf * > \ + 2 \ + topicClear 5 reloadButton \ + 1 \ + } \ + 4 \ + horizontal { \ + vertical { \ + -1 \ + listFrame < +inf -inf * +inf -inf > \ + -1 \ + } \ + } \ + 2 < +2 -2 > \ + } + *reloadButton.label: Reload + *topicLabel.label: Topic: + *topicLabel.justify: right + *topicEntry*width: 100 + *topicEntry*editType: edit + *topicEntry*font: 7x13 + *topicEntry*displayCaret: True + *topicClear.label: Clear + + *topicList.font: 7x13 + *topicList.width: 500 + *topicList.height: 100 + *topicList.columnSpacing: 20 + *topicList.verticalList: True + !*topicList.defaultColumns: 6 + !*topicList.forceColumns: True + + *outputGroup.label: + *outputGroup.outerOffset: 2 + *outputGroup.innerOffset: 2 + *outputGroup*frameType: chiseled + *outputGroup.frameWidth: 2 + *outputGrout*TextToggle*on: 0 + *outputGroup*TextToggle.frameWidth: 2 + *outputGroup*TextToggle.frameType: chiseled + *outputGroup*TextToggle.location: 0 0 65 25 + *outputGroup*TextToggle.leftMargin: 4 + *outputLayout.layout: vertical { \ + 2 \ + horizontal { \ + 5 \ + htbButton 2 htfButton 2 htuButton 2 hthButton 2 \ + 10 < +inf -10 > \ + secButton 2 parButton \ + 10 < +inf -10 > \ + hlpOpt -2 srcOpt -2 sysOpt 4 filOpt \ + 5 \ + } \ + 2 \ + horizontal { \ + 2 \ + helpFrame < +inf -inf * +inf -inf > \ + 2 \ + } \ + } + *htbButton.label: Back + *htbButton.sensitive: False + *htfButton.label: Forward + *htfButton.sensitive: False + *htuButton.label: Up + *htuButton.sensitive: False + *hthButton.label: Home + *printButton.label: Print + *secButton.label: Sections + *secButton.menuName: secMenu + *parButton.label: Parameters + *parButton.menuName: parMenu + *hlpOpt*label: Help + *hlpOpt*on: 1 + *hlpOpt*onIcon: diamond1s + *hlpOpt*offIcon: diamond0s + *hlpOpt*highlightColor: green + *srcOpt*label: Source + *srcOpt*on: 0 + *srcOpt*onIcon: diamond1s + *srcOpt*offIcon: diamond0s + *srcOpt*highlightColor: green + *sysOpt*label: Sysdoc + *sysOpt*on: 0 + *sysOpt*onIcon: diamond1s + *sysOpt*offIcon: diamond0s + *sysOpt*highlightColor: green + *filOpt*label: Files + *filOpt*on: 0 + *filOpt*onIcon: square1s + *filOpt*offIcon: square0s + *filOpt*highlightColor: yellow + + *helpText.width: 650 + *helpText.height: 620 + *helpText.anchorUnderlines: 1 + *helpText.visitedAnchorUnderlines: 1 + *helpText.verticalScrollOnRight: true + *helpText.translations: \ + <Btn2Down>: popup(secMenu) \n\ + <Btn2Up>: popdown(secMenu) \n\ + <Btn3Down>: popup(navMenu) \n\ + <Btn3Up>: popdown(navMenu) \n + + *helpText*navMenu.foreground: Black + *helpText*navMenu.background: gray75 + *helpText*secMenu.foreground: Black + *helpText*secMenu.background: gray75 + + + !--------------------------+ + ! Printer Shell resources. | + !--------------------------+ + *printShell.title: Printer Selection + *printShell.width: 300 + *printShell.height: 177 + *printShell.minHeight: 177 + *printShell.maxHeight: 177 + *printShell*borderWidth: 0 + *printShell*Group.frameType: chiseled + *printShell*Group.frameWidth: 2 + *printShell*Group.innerOffset: 5 + *printShell*Group.outerOffset: 2 + *printShell*Command.internalheight: 4 + *printShell*Text*editType: edit + *printShell*Text*height: 25 + *printShell*TextToggle.frameWidth: 0 + *printShell*Group.label: + *prntLayout.layout: vertical { \ + printGroup < +inf -inf * > \ + printCmdGroup < +inf -inf * > \ + } + + *printLayout*location: 0 0 70 25 + *printLayout*offIcon: diamond0s + *printLayout*onIcon: diamond1s + *printLayout*highlightColor: yellow + *printLayout*Label.height: 35 + *printLayout*Label.justify: right + *printLayout*TextToggle.frameWidth: 0 + *printLayout*TextToggle.leftMargin: 8 + *printLayout*TextToggle*highlightColor: yellow + *printLayout*TextToggle*onIcon: square1s + *printLayout*TextToggle*offIcon: square0s + *printLayout*TextToggle*alignment: left + *printLayout.layout: vertical { \ + 0 < +0 >\ + horizontal { toLabel 10 toPrinter 10 toFile 10 } \ + 5 < +inf -5 > \ + horizontal { \ + printLabel 5 printFrame < +inf -inf * > -1 \ + } \ + 5 < +inf -5 > \ + horizontal { \ + vertical { pageLabel 10 } \ + 12 \ + horizontal { \ + vertical { pageLetter -3 pageLegal } \ + 10 \ + vertical { pageA4 -3 pageB5 } \ + } \ + } \ + 0 < +0 >\ + } + *toLabel.label: Print to: + *toPrinter.label: Printer + *toPrinter.on: True + *toFile.label: File + *printLabel.label: Printer: + *printFrame.frameType: sunken + *printFrame.frameWidth: 1 + *printEntry*string: printer + *pageLabel.label: Page Size: + *pageLetter.label: Letter + *pageLetter.on: 1 + *pageLegal.label: Legal + *pageA4.label: A4 + *pageB5.label: B5 + + *printCmdLayout.layout: horizontal { \ + 3 \ + printOkay 20 < +inf -20 > printDismiss \ + 3 \ + } + *printOkay.label: Print + *printDismiss.label: Dismiss + + + !-------------------------+ + ! File Browser resources. | + !-------------------------+ + *fileBrowser.width: 450 + *fileBrowser.height: 375 + *fileBrowser.title: Open a New File... + *fileBrowser*borderWidth: 0 + *fileBrowser*Group.frameType: chiseled + *fileBrowser*Group.frameWidth: 2 + *fileBrowser*Group.innerOffset: 3 + *fileBrowser*Group.outerOffset: 3 + *fileBrowser*Group.label: + + *fbLayout.layout: vertical { \ + 2 \ + fnavGroup < +inf -inf * +inf -inf > \ + -2 \ + horizontal { \ + -5 \ + fbCmdGroup < +inf -inf * > \ + -5 } \ + -3 \ + } + + *fnavGroup*Frame.frameType: sunken + *fnavGroup*Frame.frameWidth: 1 + *fnavGroup*Text*editType: edit + *fnavGroup*Text*height: 25 + *fnavGroup*Text*font: 7x13 + *fnavGroup*List.verticalList: True + *fnavGroup*List.defaultColumns: 1 + *fnavGroup*List.forceColumns: True + *fnavGroup*List.font: 7x13 + *fnavGroup*Label.justify: left + *fnavGroup*Viewport.allowVert: True + *fnavGroup*Viewport.allowHoriz: False + *fnavGroup*Viewport.forceBars: True + *fnavGroup*Viewport.useRight: True + *fnavGroup*Group.outerOffset: 7 + *fnavGroup*Group.innerOffset: 3 + *fnavLayout.layout: vertical { \ + 5 \ + vertical { \ + -1 \ + horizontal { \ + 5 \ + fnavHome < +inf -inf * > 2 \ + fnavUp < +inf -inf * > 2 \ + fnavRoot < +inf -inf * > 2 \ + fnavRescan < +inf -inf * > \ + 10 \ + filterLabel 2 filterFrame < +inf -inf * > \ + 2 \ + filterClear \ + 5 \ + } \ + 3 \ + } \ + 5 \ + horizontal { \ + -5 \ + dirGroup < +inf -inf * +inf - inf > \ + -8 \ + fileGroup < +inf -inf * +inf - inf > \ + -5 \ + } \ + -3 \ + horizontal { \ + curdirLabel 5 curdirVal < +inf -inf * > 5 } \ + 5 \ + horizontal { \ + fnameLabel 2 fnameFrame < +inf -inf * > 2 fnameClear 5\ + } \ + 7 \ + fmtGroup < +inf -inf * > \ + -3 \ + } + *fileBrowser*fnavGroup*dirGroup.label: Directories + *fileBrowser*fnavGroup*fileGroup.label: Files + *fileBrowser*fnavGroup*dirGroup.innerOffset: 3 + *fileBrowser*fnavGroup*fileGroup.innerOffset: 3 + *fileBrowser*fnavGroup*dirGroup.outerOffset: 7 + *fileBrowser*fnavGroup*fileGroup.outerOffset: 7 + *fileBrowser*fnavGroup*dirGroup.font: 7x13bold + *fileBrowser*fnavGroup*fileGroup.font: 7x13bold + + *filterLabel.label: Filter + *filterClear.label: Clear + *curdirLabel.label: Directory: + *curdirVal.label: + *curdirVal.font: 7x13 + *fnameLabel.label: Selection\ \ + *fnameClear.label: Clear + *fnavHome.label: Home + *fnavUp.label: Up + *fnavRoot.label: Root + *fnavRescan.label: Rescan + + *fmtGroup*Group.outerOffset: 3 + *fmtGroup*Group.innerOffset: 3 + *fmtLayout*TextToggle.frameWidth: 0 + *fmtLayout*TextToggle.leftMargin: 4 + *fmtLayout*TextToggle.alignment: left + *fmtLayout*TextToggle*highlightColor: yellow + *fmtLayout*TextToggle*onIcon: square1s + *fmtLayout*TextToggle*offIcon: square0s + *fmtLayout.layout: vertical { \ + horizontal { 5 fmtLabel 10 fmtSrc 3 fmtText 3 fmtHTML 3 fmtPS 5 } \ + horizontal { 50 owLabel 10 overwrite 5 < +inf > } \ + } + *fmtLabel.label: Save As Format: + *fmtSrc.label: Source + *fmtSrc.on: 1 + *fmtSrc.location: 0 0 65 22 + *fmtText.label: Text + *fmtText.location: 0 0 65 22 + *fmtHTML.label: HTML + *fmtHTML.location: 0 0 65 22 + *fmtPS.label: PostScript + *fmtPS.location: 0 0 100 22 + *owLabel.label: Options: + *overwrite.label: Allow overwrite of existing files? + *overwrite.location: 0 0 200 22 + + *fbCmdLayout.outerOffset: 0 + *fbCmdLayout.layout: horizontal { \ + 5 \ + vertical { 2 fbcOkay 2 } \ + 20 < +inf -20 > \ + vertical { 2 fbcHelp 2 } \ + 2 \ + vertical { 2 fbcDismiss 2 } \ + 5 \ + } + *fbcOkay.label: Okay + *fbcHelp.label: Help + *fbcDismiss.label: Dismiss + + + !-----------------------+ + ! Find Shell resources. | + !-----------------------+ + *findShell.title: Find within a document... + *findShell.width: 365 + *findShell.height: 130 + *findShell*borderWidth: 0 + *findShell*Group.frameType: chiseled + *findShell*Group.frameWidth: 2 + *findShell*Group.innerOffset: 5 + *findShell*Group.outerOffset: 2 + *findShell*Command.internalheight: 4 + *findShell*Text*editType: edit + *findShell*Text*height: 25 + *findShell*TextToggle.frameWidth: 0 + *findShell*Group.label: + *fsLayout.layout: vertical { \ + findGroup < +inf -inf * > \ + findCmdGroup < +inf -inf * > \ + } + + *findLayout*location: 0 0 120 25 + *findLayout*offIcon: diamond0s + *findLayout*onIcon: diamond1s + *findLayout*highlightColor: yellow + *findLayout*Label.height: 35 + *findLayout*Label.justify: right + *findLayout*TextToggle.frameWidth: 0 + *findLayout*TextToggle.leftMargin: 4 + *findLayout*TextToggle*highlightColor: yellow + *findLayout*TextToggle*onIcon: square1s + *findLayout*TextToggle*offIcon: square0s + *findLayout.layout: vertical { \ + 5 \ + horizontal { \ + findLabel 7 findFrame < +inf -inf * > -1 \ + } \ + 5 \ + horizontal { \ + 20 < +inf -20 > \ + findDir 10 findCase \ + 20 < +inf -20 > \ + } \ + } + *findLabel.label: Find: + *findFrame.frameType: sunken + *findFrame.frameWidth: 1 + *findEntry*string: + *findDir.label: Find Backwards + *findCase.label: Case Sensitive + + *findCmdLayout.layout: horizontal { \ + 3 \ + findOkay \ + 20 < +inf -20 > \ + findClear \ + 20 < +inf -20 > \ + findDismiss \ + 3 \ + } + *findOkay.label: Find + *findClear.label: Clear + *findDismiss.label: Dismiss + + + !-------------------------------------------+ + ! Set the document source viewer resources. | + !-------------------------------------------+ + *doc_source.title: Page source + *doc_source.width: 575 + *doc_source.height: 450 + *srcLayout*borderWidth: 0 + *srcLayout.layout: vertical { \ + srcMenuFrame < +inf -inf * > \ + -2 \ + srcFrame < +inf -inf * +inf -inf > \ + -2 \ + } + + *srcMenuBar.layout: horizontal { 50 < +inf -inf > srcDismiss 5 } + *srcMenuFrame.height: 40 + *srcMenuFrame.outerOffset: 0 + *srcMenuFrame.innerOffset: 5 + *srcMenuFrame.frameType: chiseled + *srcMenuFrame.frameWidth: 2 + *srcFrame.frameType: sunken + *srcFrame.frameWidth: 1 + *srcFrame.outerOffset: 5 + *srcText*scrollVertical: always + *srcText*scrollHorizontal: always + *srcText*Scrollbar.width: 15 + *srcText*Scrollbar.height: 15 + *srcText*background: gray75 + *srcText*font: 7x13 + *srcText*editType: read + *srcText*displayCaret: False + *srcDismiss.label: Dismiss + *srcDismiss.width: 150 + + + !-------------------------+ + ! Search Shell resources. | + !-------------------------+ + *searchShell.title: Search for a topic... + *searchShell.width: 600 + *searchShell.height: 250 + *searchShell*borderWidth: 0 + *searchShell*Viewport.allowVert: True + *searchShell*Viewport.allowHoriz: True + *searchShell*Viewport.useBottom: True + *searchShell*Viewport.useRight: False + *searchShell*Viewport.forceBars: True + *searchGroup.frameType: chiseled + *searchGroup.frameWidth: 2 + *searchGroup.innerOffset: 7 + *searchGroup.outerOffset: 7 + *searchGroup.highlightThickness: 0 + *searchGroup.label: + *searchLayout.layout: vertical { \ + horizontal { \ + 45 < +45 -45 > \ + resLabel < +inf -inf * > \ + 5 < +inf -inf > \ + exactMatch \ + } \ + 2 < +2 - 2 > \ + resFrame < +inf -inf * +inf -inf > \ + 5 < +5 - 5 > \ + horizontal { \ + searchLabel 5 searchFrame \ + 5 \ + searchClear 2 searchOkay \ + 5 < +inf -inf > \ + searchStatus \ + 5 < +inf -inf > \ + searchHelp 2 searchDismiss \ + } \ + } + *resLabel.label: Task Package Description + *resLabel.justify: left + *resFrame.frameType: sunken + *resFrame.frameWidth: 1 + *resList.font: 7x13 + *resList.width: 100 + *resList.height: 100 + *resList.marginWidth: 5 + *resList.marginHeight: 5 + + *searchLabel.label: Topic: + *searchFrame.frameType: sunken + *searchFrame.frameWidth: 1 + *searchEntry*font: 7x13 + *searchEntry*displayCaret: True + *searchEntry*editType: edit + *searchEntry*height: 25 + *searchEntry*width: 150 + *searchClear.label: Clear + *searchOkay.label: Search + *searchStatus.label: + *exactMatch.label: Require Exact Match + *exactMatch*on: 1 + *exactMatch*onIcon: diamond1s + *exactMatch*offIcon: diamond0s + *exactMatch*highlightColor: green + *exactMatch.frameWidth: 2 + *exactMatch.frameType: chiseled + *exactMatch.location: 0 0 150 25 + *exactMatch.leftMargin: 4 + *searchHelp.label: Help + *searchDismiss.label: Dismiss + + + !---------------- + ! Help Window. + !---------------- + *hlpShell.title: Help + *hlpShell.width: 500 + *hlpShell.height: 620 + *hlpLayout*borderWidth: 0 + *hlpLayout*Frame*frameType: sunken + *hlpLayout*Frame*frameWidth: 1 + + *hlpMenuGroup.label: + *hlpMenuGroup.outerOffset: 0 + *hlpMenuGroup.innerOffset: 0 + *hlpLayout.layout: vertical { \ + hlpMenuGroup < +inf -inf * > \ + -3 \ + hlpTextFrame < +inf -inf * +inf -inf > \ + horizontal { \ + 5 \ + hfLabel 5 hfFrame < +inf -inf *> \ + 2 \ + hfFind 2 hfClear 5 hfDir 5 hfCase \ + 5 \ + } \ + 2 \ + } + *hlpLayout*TextToggle*location: 0 0 90 25 + *hlpLayout*TextToggle*offIcon: diamond0s + *hlpLayout*TextToggle*onIcon: diamond1s + *hlpLayout*TextToggle*highlightColor: yellow + *hlpLayout*TextToggle*frameType: chiseled + *hlpLayout*TextToggle*frameWidth: 2 + *hfEntry*editType: edit + *hfEntry*font: 7x13 + *hfEntry*displayCaret: True + *hfLabel.label: Find: + *hfFind.label: Find + *hfClear.label: Clear + *hfDir.label: Backwards + *hfCase.label: Caseless + *hfCase.on: true + + *hlpMenu*Command.internalHeight: 4 + *hlpMenu*Command.highlightThickness: 1 + *hlpMenu*Command.height: 20 + *hlpMenu.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + hlpBack 2 hlpForward 2 hlpHome 2 hlpTutorial \ + 20 < +inf -20 > \ + hlpDismiss \ + 5 \ + } \ + 5 \ + } + *hlpBack.label: Back + *hlpBack.sensitive: False + *hlpForward.label: Forward + *hlpHome.label: Home + *hlpTutorial.label: Tutorial + *hlpTutorial.sensitive: false + *hlpDismiss.label: Dismiss + + *hlpTextFrame.outerOffset: 2 + *hlpText.width: 500 + *hlpText.height: 500 + *hlpText.anchorUnderlines: 1 + *hlpText.visitedAnchorUnderlines: 1 + *hlpText.verticalScrollOnRight: true + + + !------------------+ + ! File List dialog. + !------------------+ + *fileShell.title: Help Files + *fileShell.geometry: 500x165 + *fileShell*borderWidth: 0 + *fileShell*Command.width: 90 + *fileShell*Command.height: 30 + *fileShell*Frame.frameType: sunken + *fileShell*Frame.frameWidth: 1 + *fileShell*Frame.innerOffset: 1 + *fileShell*Text*font: 7x13 + *flist.layout: vertical { \ + 1 \ + horizontal { 1 flGroup < +inf -inf * +inf -inf> 1 } \ + 1 \ + } + + *flGroup.frameType: chiseled + *flGroup.frameWidth: 2 + *flGroup.innerOffset: 5 + *flGroup.outerOffset: 5 + *flGroup.label: + *flFrame.layout: vertical { \ + 5 \ + horizontal { \ + 13 \ + flistLabel < +inf -inf * > \ + 5 < +inf -5 > \ + } \ + 2 \ + horizontal { 1 flistFrame < +inf -inf * +inf -inf > 1 } \ + 7 \ + horizontal { \ + 5 \ + flpkgLabel 2 flpkgVal < +inf -inf * > \ + 5 < +inf -5 > \ + flDismiss \ + 5 \ + } \ + } + *flDismiss.label: Dismiss + *flistLabel.label: Option Status Filename + *flistLabel.justify: left + *flpkgLabel.label: Task: + *flpkgLabel.justify: left + *flpkgVal.label: (Undefined) + *flpkgVal.justify: left + *flpkgVal*font: 7x13 + *flistText.label: + *flistText.scrollVertical: Never + *flistText.scrollHorizontal: whenNeeded + *flistText*displayCaret: False + *flistText*editType: edit + + + !----------------+ + ! WARNING dialog. + !----------------+ + *warning.geometry: +400+300 + *warning*borderWidth: 0 + *warning*TextBox.frameWidth: 0 + *warning*Command.width: 90 + *warning*Command.height: 30 + *warning*Frame.frameType: sunken + *warning*Frame.frameWidth: 1 + *warning*Frame.innerOffset: 3 + *warn.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + warnFrame < +inf * +inf > \ + 5 \ + } \ + 5 \ + horizontal { \ + 5 < +inf -5 > \ + warnBtnFrame \ + 5 < +inf -5 > \ + } \ + 5 \ + } + + *WFlayout.layout: horizontal { \ + 5 \ + vertical { \ + 5 < +inf -5 > \ + warnIcon \ + 5 < +inf -5 > \ + } \ + 5 \ + warnText < +inf -inf * +inf -inf > \ + 5 \ + } + *warnIcon.location: 0 0 40 40 + *warnIcon.image: WARNING + *warnText.label: generic warning text + *warnText.width: 270 + *warnText.height: 60 + *warnText*background: gray75 + *warnDismiss.label: Dismiss + + !-------------------------- + ! Define a Debug Tcl shell. + !-------------------------- + *tclShell.width: 550 + *tclShell.height: 180 + *tclShell.title: TCL Command Entry Shell + *tclLayout*borderWidth: 0 + *tclLayout*Frame.frameType: sunken + *tclLayout*Frame.frameWidth: 1 + *tclLayout.layout: vertical { \ + tclCmdGroup < +inf -inf * > \ + tclFrame < +inf -inf * +inf -inf> \ + } + *tclEntry*editType: edit + *tclEntry*type: string + *tclEntry*scrollVertical: Always + *tclEntry*scrollHorizontal: whenNeeded + + *tclCmdGroup.label: + *tclCmdGroup.outerOffset: 0 + *tclCmdGroup.innerOffset: 0 + *tclCmd.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + tclClear 3 tclExecute \ + 10 < +inf -10> \ + tclLogging 3 tclDismiss \ + 5 \ + } \ + 5 \ + } + *tclClear.label: Clear + *tclExecute.label: Execute + *tclLogging.label: Enable Logging + *tclDismiss.label: Dismiss +} + + + +################################################################################ + +createObjects + +# Define Bitmaps and Pixmaps to be used. +createBitmap null 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap check 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x60, + 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x08, 0x06, 0x18, 0x03, 0xb0, 0x01, + 0xe0, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap arrow 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x14, 0xf8, 0x27, + 0x08, 0x40, 0xf8, 0x27, 0x00, 0x14, 0x00, 0x0c, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +activate + +################################################################################ + + +################################################################################ +# Global variables. | +################################################################################ +set version "IRAF Help GUI V1.0" ;# version string +set curpack "" ;# current values +set curtask "" +set helpType "package" ;# type of help to get +set helpOption "help" ;# help option param +set fileManaged 0 ;# is fileShell mapped? +set pkgList { } +set visited(0) empty + +set listOrient 1 ;# options +set showType 0 +set showFiles 1 +set exactMatch 1 + +set MAX_MENU_SIZE 40 ;# what it says it is + +# History array initialization. +set HPkg(0) {Home} ;# package +set HOpt(0) {help} ;# option +set HTask(0) {Home} ;# task +set HUrl(0) {} ;# url +set HType(0) {task} ;# type (task|package|file) +set HFile(0) {} ;# filename +set htop 0 ;# top of array +set hcurrent 0 ;# current page + +# Panel mapping flags. +set search_mapped 0 ;# searchShell mapped? + + +################################################################################ +# Utility Callbacks +################################################################################ + +# Procedures for sending client cursor commands. +proc GKey { key args } { send client gkey $key } +proc GCmd { args } { send client gcmd $args } + +# Procedures to test True/False strings in resources. +proc true { v } \ + { expr { $v=="true" || $v=="True" || $v=="TRUE" || $v==1 || $v=="yes" } } +proc false { v } \ + { expr { $v=="false" || $v=="False" || $v=="FALSE" || $v==0 || $v=="no" } } + +# No-op procedure for text widgets with no callbacks to swallow newline. +proc noop { args } { } + +# Common functions. +proc min { a b } { expr {($a < $b) ? $a : $b} } +proc max { a b } { expr {($a > $b) ? $a : $b} } + + +#--------------------+ +# Debugging options. | +#--------------------+ +set debug 0 ;# debug flag +send tclLogging set state [min 1 $debug] + + +################################################################################ +# Initialize. | +################################################################################ +proc Init args { + global history curpack curtask debug + global secMenuDescription parMenuDescription + global HPkg HTask HUrl HOpt HFile HType + + if {$debug == 1} { send tclShell map } + + # Reinitialize global vars in case of a restart. + set curpack "" + set curtask "" + set helpType "package" + set helpOption "help" + + # Initialize the entry strings. + send printEntry set string "" + send topicEntry set string "" + + # Initialize the various lists. + send topicList setList "{ }" resize + + send secButton set sensitive False + send parButton set sensitive False + editMenu secMenu secButton $secMenuDescription + editMenu parMenu parButton $parMenuDescription + +} ; #send server postActivateCallback Init + + + +# Create the Navigation Menu. +set navMenuDescription { + { "Back " f.exec { Back } + sensitive {([send htbButton isSensitive]==1) ? "true" : "false" } + } + { "Forward " f.exec { Forward } + sensitive {([send htfButton isSensitive]==1) ? "true" : "false" } + } + { "Up " f.exec { Up } + sensitive {([send htuButton isSensitive]==1) ? "true" : "false" } + } + { "Home " f.exec { Home } } + { f.dblline } + { "Reload " f.exec { Reload } } + { "Open File... " f.exec { Open } } + { "Save As... " f.exec { SaveAs } } + { "View Page Source " f.exec { srcOpen } } + { f.dblline } + { "Find... " f.exec { Find } } + { "Search... " f.exec { Search } } + { "Print... " f.exec { Print } } +} ; createMenu navMenu helpText $navMenuDescription + +# Create the default Section Menu. +set secMenuDescription { + { " Top of Page " f.exec { send helpText gotoId 0 } } + { f.dblline } + { " " f.exec { noop } } + { " No Sections Found " f.exec { noop } } + { " " f.exec { noop } } +} ; createMenu secMenu secButton $secMenuDescription + +# Create the default Parameter Menu. +set parMenuDescription { + { " No Parameters Found" f.exec { noop } } +} ; createMenu parMenu parButton $parMenuDescription + + +# Initialize. +Init + + +################################################################################ +# Menubar command callbacks. +################################################################################ + +# File Menu +set fileMenuDescription { + { " Open File... " f.exec { Open } } + { " Save As... " f.exec { SaveAs } } + { " Print... " f.exec { Print } } + { f.dblline } + { " Reload... " f.exec { Reload } } + { " View Page Source " f.exec { srcOpen } } + { " Search... " f.exec { Search } } + { " Find... " f.exec { Find } } + { f.dblline } + { " Help " f.exec { Help } } + { " Quit " f.exec { Quit } } +} ; createMenu fileMenu fileButton $fileMenuDescription + + +# History Menu +set historyMenuDescription { + { " Back " f.exec { Back } + sensitive {([send htbButton isSensitive]==1) ? "true" : "false" } + } + { " Forward " f.exec { Forward } + sensitive {([send htfButton isSensitive]==1) ? "true" : "false" } + } + { " Up " f.exec { Up } + sensitive {([send htuButton isSensitive]==1) ? "true" : "false" } + } + { " Home " f.exec { Home } } + { f.dblline } + { " Clear History" f.exec { histClear } } + { f.dblline } +} ; createMenu historyMenu historyButton $historyMenuDescription + + +# Options Menu +set optsMenuDescription { + { " Show task type " f.exec { setOpts showType } + bitmap {($showType==1)? "check" : "null"} } + { " Show missing files " f.exec { setOpts showFiles } + bitmap {($showFiles==1)? "check" : "null"} } + { f.dblline } + { " Vertical task listing " f.exec { setOpts verticalList True } + bitmap {($listOrient==1)? "check" : "null"} + } + { " Horizontal task listing " f.exec { setOpts verticalList False } + bitmap {($listOrient==0)? "check" : "null"} + } + { f.dblline } + { " Tcl Command Shell " f.exec { tclOpen } } +} ; createMenu optsMenu optionsButton $optsMenuDescription + + +proc setOpts { opt args } { + global optsMenuDescription + global listOrient showType showFiles + global HTask HPkg HOpt hcurrent + + switch $opt { + showType { set showType [expr { ($showType == 1) ? 0 : 1 } ] + GCmd type $showType + set h $hcurrent + GCmd help $HTask($h) $HPkg($h) $HOpt($h) + } + showFiles { set showFiles [expr { ($showFiles == 1) ? 0 : 1 } ] + } + verticalList { set listOrient [expr { ($args == "False") ? 0 : 1 } ] + send topicList set verticalList $args + } + } + editMenu optsMenu optionsButton $optsMenuDescription +} + +proc Print args { + send printShell map +} ; send printButton addCallback Print + +proc Find { args } { + send findShell popup +} ; send findButton addCallback Find + +proc Search { args } { + global search_mapped + + send searchShell map + set search_mapped 1 +} ; send searchButton addCallback Search + +proc Reload args { + global HPkg HType HUrl HOpt HTask HFile hcurrent + + if { $HType($hcurrent) == "file"} { + if {[info exists HFile($hcurrent)] == 1} { + GCmd directory open $HFile($hcurrent) + } else { + setAlert param old [format "HFile param at %d not found" $hcurrent] + } + } else { + loadHistItem $hcurrent $HPkg($hcurrent) $HTask($hcurrent) \ + $HOpt($hcurrent) $HType($hcurrent) $HUrl($hcurrent) + } +} ; send reloadButton addCallback Reload + +proc Help args { + send hlpShell map +} ; send helpButton addCallback Help + +proc Open args { + send fmtGroup unmap + send fmtGroup set height 0 + send fbcOkay set label Load + send fileBrowser map +} + +proc SaveAs args { + global format + + # Reset the default format every time we open. + send $format set on 0 + set format fmtSrc + send $format set on 1 + + # If there's no filename specified set one as a default. + setDefaultFname + + send fmtGroup map + send fmtGroup set height 65 + send fbcOkay set label Save + send fileBrowser map +} + +proc Quit args { + GCmd quit + deactivate unmap +}; send quitButton addCallback Quit + + + +################################################################################ +# Callbacks for client state variables (UI parameter objects). When the +# client's state changes it updates a UI parameter to reflect the change. +# This produces a callback to one or more of the callbacks defined below, +# used to update the GUI to reflect the changing state of the client. +################################################################################ + +proc setShowType { param old new } { + global showType listOrient showFiles optsMenuDescription + set showType $new + editMenu optsMenu optionsButton $optsMenuDescription +}; send showtype addCallback setShowType + +proc setTopics { param old new } { + global pkgList + set pkgList $new + send topicList setList $new resize +}; send pkglist addCallback setTopics + +proc appendHist { param old new } { + global helpType helpOption curtask curpack + + if {$new == "package"} { + #addHistRecord $curpack $curpack "" $helpOption "" $helpType + addHistRecord $curpack $curpack "" $helpOption "" "package" + } elseif {$new == "append"} { + # We've got a result of some kind and all of the values have been + # set, so create a history record. + if {$curpack != "" && $curtask != ""} { + addHistRecord $curpack $curtask "" $helpOption "" $helpType + } + } +}; send history addCallback appendHist + +proc setCurpack { param old new } { + global curpack + + if { $new != [getPkgName $curpack] } { + if { $curpack != "" && \ + $curpack != "clpackage" && \ + [string match "root*" $new] != 1} { + set curpack [ format "%s.%s" $curpack $new] + send htuButton set sensitive true + } else { + set curpack $new + } + } +}; send curpack addCallback setCurpack + + +proc setCurtask { param old new } { + global curtask curpack helpType + + if {$helpType == "package"} { + send topicEntry set string $curpack + } else { + send topicEntry set string [ format "%s.%s" $curpack $new ] + } + + # Update the printer dialog so the filename defaults to the curtask. + if { [send toFile get on] } { + if {$HType($hcurrent) == "file" || [send srcOpt get on] == 1} { + send printEntry set string [format "%s" [fileSource] ] + } else { + if { $new == "" } { + send printEntry set string "help.ps" + } else { + send printEntry set string [format "%s.ps" $new] + } + } + } else { + send printEntry set string "printer" + } + set curtask $new +}; send curtask addCallback setCurtask + + +proc getPkgName { pkg } { + set last [ string last "." $pkg ] + if { $last > -1 } { + return [ string range $pkg [incr last] end ] + } else { + return $pkg + } +} + +proc getParentName { pkg } { + set last [ string last "." $pkg ] + if { $last > -1 } { + set root [ string range $pkg 0 [incr last -1] ] + } else { + set root $pkg + } + return [getPkgName $root] +} + + +# Topic list selection callback. +proc topicSelect { widget event args } { + global htop hcurrent curpack curtask helpOption helpType + global visited + + # If we're currently positioned somewhere in the middle of the + # history menu, push the current page to the history list before + # getting the next result. + if {$htop != $hcurrent} { + addHistRecord $curpack $curtask "" $helpOption "" $helpType + send htbButton set sensitive True + send htuButton set sensitive True + } + + set item [string trimright [send topicList getItem itemno] "."] + send topicList getItem itemno + if { $itemno != "none" } { + GCmd help $item $curpack $helpOption + set visited($item) 1 + } +} ; send topicList addEventHandler topicSelect buttonReleaseMask + +proc listViewResize { args } { + global pkglist + send topicList setList $pkglist resize +} ; send listView addEventHandler listViewResize ResizeRedirectMask + + +# Get help for a specific topic from the topic entry widget. +proc getTopicHelp { widget mode topic args } { + global curpack helpOption + + if { [string match "*\.*" $topic] == 1} { + set pkglist [ split $topic "." ] + set pack [lindex $pkglist [expr {[llength $pkglist] - 2}] ] + set task [lindex $pkglist [expr {[llength $pkglist] - 1}] ] + set curpack $pack + GCmd help $task $curpack $helpOption + } else { + set curtask "" + set curpack "" + GCmd help $topic $curpack $helpOption + } +} ; send topicEntry addCallback getTopicHelp + +proc topicClear { args } { + send topicEntry set string "" +} ; send topicClear addCallback topicClear + + + +################################################################################ +# Help text and HTML processing procedures. +################################################################################ + +proc setHelpResult { param old new } { + global helpType helpOption curtask curpack + global secMenuDescription parMenuDescription + global pkgList debug + + # Debug status + if {$debug == 1} { + send tclEntry append \ + [format "helpres: type=%1.1s opt=%4.4s curtask=%s curpack=%s\n" \ + $helpType $helpOption $curtask $curpack ] + print [format "helpres: type=%1.1s opt=%4.4s curtask=%s curpack=%s\n" \ + $helpType $helpOption $curtask $curpack ] + } + + if { [string match "*<HTML>*" $new] == 1} { + # Strip the header table. + if {[ string match "*TABLE*" $new] == 1 } { + set new_start [expr [string first "</TABLE>" $new] + 12] + set text [ filterBraces [string range $new $new_start end] ] + } else { + set text [ filterBraces $new ] + } + + # Got HTML directly from the client. + send helpText setText [format "<HTML><BODY>\n%s" $text ] + + # Save the source for the viewer + set docSrc \ + [ format "<HTML><BODY>\n%s\n</BODY></HTML>\n" $text] + + # Parse the file for menu items. + setSectionMenu $new + setParameterMenu $new + + } else { + # Disable help page content buttons for plain text. + send parButton set sensitive False + send secButton set sensitive False + editMenu secMenu secButton $secMenuDescription + editMenu parMenu parButton $parMenuDescription + + # Filter plaintext .men files into something with links, otherwise + # unescape the curly braces used to pass the text through Tcl. + if {$helpType == "package"} { + set str [ filterLinks [ filterTcl $new ] ] + } else { + set str [ filterTcl $new ] + } + + # Load the results + send helpText setText "<HTML><BODY><PRE>\n$str\n</PRE></BODY></HTML>" + + # Save the source for the viewer + set docSrc \ + [ format "<HTML><BODY><PRE>\n%s\n</PRE></BODY></HTML>\n" $str] + } + send helpText retestAnchors + send srcText set string $docSrc + + # See which files associated with this topic are available. We turn off + # the option toggles first so they can be reset as needed by the client. + if {$helpOption != "sysdoc"} {send sysOpt "set sensitive False ; set on 0" } + if {$helpOption != "source"} {send srcOpt "set sensitive False ; set on 0" } + + if {$helpType == "package"} { + set parent [getParentName $curpack] + if {$parent == "clpackage" || [string match "root*" $parent] == 1} { + GCmd files $curtask "clpackage" + } else { + GCmd files $curtask $parent + } + } else { + GCmd files $curtask [string range $curpack \ + [expr {[string last "." $curpack ] + 1}] end] + } + + # Highlight the package list item. + for {set i 0} {$i < [llength $pkgList]} {incr i} { + if {[lindex $pkgList $i] == $curtask } { + send topicList highlight $i + break + } + } + printHistStack "helpres " + +}; send helpres addCallback setHelpResult + + +# Set an arbitrary TextToggle widget highlight color. +proc setOptColor { widget color args } { + send $widget "set on 1 ; \ + set offIcon diamond0s ; \ + set highlightColor $color ; \ + set background gray75 ; \ + set onIcon diamond1s ; \ + set highlightColor $color ; \ + set background gray75" +} + + +# Set the file options for the files that were found to be valid (i.e. +# they're listed in the files output and actually exist). +proc setHelpFileOpts { param old new } { + global helpType helpOption curtask curpack + global showFiles + + set opt [lindex $new 0] + set val [lindex $new 1] + if {$opt != "file"} { set stat [lindex $new 2] } + + # Set the option toggles according to valid files. + if {$opt == "sys" && $stat == 0} { + send sysOpt set sensitive True + } elseif {$opt == "sys" && $stat == 1 && $showFiles == 1} { + setOptColor sysOpt yellow + } + if {$opt == "src" && $stat == 0} { + send srcOpt set sensitive True + } elseif {$opt == "src" && $stat == 1 && $showFiles == 1} { + setOptColor srcOpt yellow + } + + # Update the help files panel text. + if {$opt == "file"} { + set pkg [ string trimright $val ":"] + send flpkgVal set label [ format "%s" $pkg ] + send toplevel set title [format "XHelp: %s" $pkg ] + send flistText set string "" + } else { + send flistText append [ format " %5.5s %-7.7s %s\n" \ + $opt \ + [ expr { ($stat == 0) ? "Okay" : "Error" }] \ + $val] + } + +} ; send helpfiles addCallback setHelpFileOpts + + +# Process an HREF link selection. URLs are assumed to be of the form +# +# <pkgname>.<task> +# <task> +# '#'<hname> +# +# If an internal link is found as in the last case we ignore any defined +# package/task given, otherwise load the selected page. + +proc textAnchorSelected {widget cbtype event text href args} { + global HPkg HType HUrl HOpt HTask HFile hcurrent htop + global curpack helpOption visited + + set visited($href) 1 + send helpText retestAnchors + + if {[string match "*#*" $href] == 1} { + set link [string range $href [expr [string first "#" $href] + 1] end ] + set HUrl($hcurrent) $link + send helpText gotoId [ send helpText anchorToId $link ] + } else { + if { [string match "*\.*" $href] == 1} { + set pack [lindex [split $href "."] 0] + set task [lindex [split $href "."] 1] + set curpack $pack + GCmd help $task $curpack $helpOption + + } else { + GCmd help $href $curpack $helpOption + } + } + + if {$hcurrent <= $htop} { + set h $hcurrent + addHistRecord $HPkg($h) $HTask($h) $HUrl($h) $HOpt($h) \ + HFile($h) $HType($h) + } + +}; send helpText addCallback textAnchorSelected anchor + + +# Remove only the escaped curly braces. Used to filter HTML text passed to +# the GUI with escapes in it. + +proc filterBraces { istr args } { + if {$istr != ""} { + regsub -all {(\\\{)} $istr "\{" v1 + regsub -all {(\\\})} $v1 "\}" results + return $results + } +} + +# Remove the backslash escapes from source files, escape special chars for +# presentation on an HTML widget. + +proc filterTcl { istr args } { + if {$istr != ""} { + regsub -all {(\\\{)} $istr "\{" v1 + regsub -all {(\\\})} $v1 "\}" v2 + regsub -all {(\<)} $v2 "\\<" v3 + regsub -all {(\>)} $v3 "\\>" results + return $results + } +} + + +# Scan a plaintext doc to see if maybe this is a package help menu. We use +# some assumption that most of the lines will be of the form "task '-' desc" +# then parse the file resetting all of the 'task' names as HREFs for other +# tasks. + +proc filterLinks { istr args } { + + set lines [split $istr "\n"] + set blank " " + set results { } + lappend results "" + foreach i $lines { + set line [string trimleft [detab $i] ] + if {[regexp {(^[a-zA-Z0-9\ \_\(\)]+[\+|\-]*)} $line arg] == 1 && + ([string match "*\-*" $arg] == 1 || + [string first "\*" $line] > 0 || + [string match "*\+*" $arg] == 1) } { + + set task [string trim [string trimright $arg "-+"] ] + set l [string first "-" $line] + if {$l == -1} { + set l [string first "+" $line] + if {$l == -1} { + set l [string first "\*" $line] + } + } + set desc [ string range $line $l end ] + + # We now have the task name and the description string, format + # on output with the HREF defined. + set nblanks [expr 13 - [string length $task] ] + set fmtstr [format "%%%ds<A HREF=\"%%s\">%%s</A> %%s\n" $nblanks ] + set ostr [format $fmtstr $blank $task $task $desc] + + lappend results $ostr + + } elseif {[regexp {(^[a-zA-Z0-9\_]+\.[a-zA-Z0-9\_]+\:$)} $i val] == 1} { + + # Break out the task and package names. + regsub -all {[\.:]} $i " " val + scan $val "%s %s" parent child + + # Format a URL and append the results. + if { [ string match "*root*" $parent] == 0} { + set ref [format "<A HREF=\"%s\">%s</A>.<A HREF=\"%s\">%s</A>:\n"\ + $parent $parent $child $child ] + } else { + set ref [format "%s.<A HREF=\"%s\">%s</A>:\n"\ + $parent $child $child ] + } + lappend results $ref + + } else { + set nblanks [expr [string length $i] - [string length $line] ] + set fmtstr [format "%%%ds%%s\n" $nblanks ] + lappend results [format $fmtstr $blank $line ] + } + } + return [ join $results ] +} + + +# Generated a list of the lines and create the section menu. + +proc setSectionMenu { text args } { + global secMenuDescription + + # Break out the table of contents from the string. Note we're hard- + # wired here into the form of the comment string used to contain the + # section name. + set l [expr [string first "<! Contents: " $text] + 12] + if {$l == 0} { return } + set s [string range $text $l end] + set r [expr [string first ">" $s] - 4] + set t [string range $s 0 $r] + set lst [split $t '\''] + + # Now take the list generated and create the menu. + set items { } + lappend items " \"Top of Page\" f.exec \{ send helpText gotoId 0 \}" + lappend items " f.dblline " + foreach i $lst { + if {$i != " "} { + set i [ string trimright $i ] + regsub -all {[ ,.():;]} [string tolower $i] _ url + lappend items " \" $i \" f.exec \{ jumpToName #s_$url \}" + } + } + + if { [llength $items] == 3 } { + send secButton set sensitive False + editMenu secMenu secButton $secMenuDescription + } else { + editMenu secMenu secButton $items + send secButton set sensitive True + } +} + + +# Generated a list of the lines and create the parameter menu. +proc setParameterMenu { text args } { + global parMenuDescription + set items { } + foreach i [split $text "\n"] { + if {[string match "\<\! Sec*PARAMETERS*Level=0*" $i] == 1} { + set l [expr [string first "Line='" $i] + 6] + set s [string range $i $l end] + set r [expr [string first "\'" $s] - 1] + set t [string range $s 0 $r] + regsub -all {[\ ]} $t " " d ;# remove tabs + regsub -all {[\"]} $d "\\\"" entry + + set l [expr [string first "Label='" $i] + 7] + set s [string range $i $l end] + set r [expr [string first "\'" $s] - 1] + set t [string range $s 0 $r] + + lappend items " \"$entry\" f.exec \{ jumpToName #l_$t \}" + } + } + + if { [llength $items] == 0 } { + send parButton set sensitive False + editMenu parMenu parButton $parMenuDescription + } else { + editMenu parMenu parButton $items + send parButton set sensitive True + } +} + + +# Position the page to the requested href name. +proc jumpToName { name } { + global curtask curpack helpType helpOption + + send helpText gotoId [send helpText anchorToId $name] + send helpText retestAnchors + + # Now add a history record for the jump + addHistRecord $curpack $curtask $name $helpOption "" $helpType +} + + +# Utility routine to 'detab' a line and preserve format. +proc detab {str {tablen 8}} { + set a 0 + set i [string first "\t" $str] + while {$i != -1} { + set m { } + set j $i + while {[incr j] % $tablen} { append m { } } + set str [string range $str $a \ + [expr {$i-1}]]$m[string range $str [incr i] end] + set i [string first "\t" $str] + } + return $str +} + + +################################################################################ +# Navigation and History Callbacks +################################################################################ + +# Go back one page. +proc Back args { + global curtask curpack helpType helpOption + global HPkg HType HUrl HOpt HTask HFile htop hcurrent + + incr hcurrent -1 + if {$hcurrent >= 0} { + set item $HTask($hcurrent) + set pkg $HPkg($hcurrent) + set type $HType($hcurrent) + set h $hcurrent + + if { $item == "Home" } { + loadHomePage + } else { + if { $HType($h) == "file"} { + if {[info exists HFile($h)] == 1} { + loadHistItem $h pkg $HFile($h) help file + } else { + setAlert param old \ + [format "HFile param at %d not found" $hcurrent] + } + } else { + loadHistItem $h $HPkg($h) $HTask($h) $HOpt($h) \ + $HType($h) $HUrl($h) + } + } + + if {$hcurrent == 0} { + send htbButton set sensitive False + send htuButton set sensitive False + } + if {$hcurrent >= 0} { + send htfButton set sensitive True + send htuButton set sensitive True + } + } else { + set hcurrent 0 + } + editHistoryMenu + printHistStack "Back " +} ; send htbButton addCallback Back + + +# Go forward one page. +proc Forward args { + global curtask curpack helpType helpOption + global HPkg HType HUrl HOpt HTask HFile htop hcurrent + + incr hcurrent + if {$hcurrent <= $htop} { + set item $HTask($hcurrent) + set pkg $HPkg($hcurrent) + set type $HType($hcurrent) + set h $hcurrent + + if { $item == "Home" } { + loadHomePage + } else { + if { $HType($h) == "file"} { + if {[info exists HFile($h)] == 1} { + loadHistItem $h pkg $HFile($h) help file + } else { + setAlert param old \ + [format "HFile param at %d not found" $hcurrent] + } + } else { + loadHistItem $h $HPkg($h) $HTask($h) $HOpt($h) \ + $HType($h) $HUrl($h) + } + } + + if {$hcurrent == $htop } { + send htfButton set sensitive False + send htbButton set sensitive True + } else { + send htbButton set sensitive True + } + } else { + incr hcurrent -1 + } + editHistoryMenu + printHistStack "Forward " +} ; send htfButton addCallback Forward + + +# Go up to previous package, skipping over pages inbetween. +proc Up args { + global curtask curpack helpType helpOption + global HPkg HType HUrl HOpt HTask htop hcurrent + + # From the current page go back until we find a package + if {$HType($hcurrent) == "package"} { + set i [expr {$hcurrent-1} ] + } else { + set i $hcurrent + } + while {$HType($i) != "package" && $i >= 0} { + incr i -1 + } + + # Found package, go get it. + set hcurrent $i + if {$i == 0} { + loadHomePage ;# push a history record?? + } else { + GCmd load $HTask($i) [getPkgName $HPkg($i)] $HOpt($i) + } + + set curtask $HTask($hcurrent) ;# update the state of things + set curpack $HPkg($hcurrent) + set helpOption $HOpt($hcurrent) + set helpType $HType($hcurrent) + + send topicEntry set string $curpack ;# update topic entry string + + if {$hcurrent == 0} { ;# adjust navigation buttons + send htbButton set sensitive False + send htuButton set sensitive False + } + if {$hcurrent >= 0} { + send htfButton set sensitive True + send htuButton set sensitive True + } + editHistoryMenu + printHistStack "Forward " +} ; send htuButton addCallback Up + + +# Go straight to the homepage. +proc Home args { + global curtask curpack helpType helpOption + global HPkg HType HUrl HOpt HTask HFile htop hcurrent + + # Load the homepage. + loadHomePage + + # A Home command jumps over everything in the history list but we + # need to push a history record for it anyway. + addHistRecord $HPkg(0) $HTask(0) $HUrl(0) $HOpt(0) $HFile(0) $HType(0) + + send topicEntry set string "" + set curtask "" + set curpack "" + set helpType "package" + set helpType "help" +} ; send hthButton addCallback Home + + +# Load the homepage. +proc loadHomePage { args } { + global curtask curpack version showType + + GCmd help Home + + # Clean up. + set curtask "" + set curpack "" + send topicEntry set string "" + send toplevel set title $version +} + +# Clear all the history information. +proc histClear args { + global HPkg HType HUrl HOpt HTask HFile htop hcurrent + global visited + + # Clear the visited anchors list. + foreach i [array names visited] { + unset visited($i) + } + + # Clear the history stack. + for { set i [expr {$htop -1}] } { $i >= 0 } { incr i -1 } { + catch { + unset HType($i) + unset HOpt($i) + unset HTask($i) + unset HPkg($i) + unset HUrl($i) + unset HFile($i) + } + } + + # Reinitialize, but save the current page as the new history stack. + catch { + set HPkg(0) $HPkg($htop) ;# package + set HOpt(0) $HOpt($htop) ;# option + set HTask(0) $HTask($htop) ;# task + set HUrl(0) $HUrl($htop) ;# url + set HType(0) $HType($htop) ;# type + set HFile(0) $HFile($htop) ;# filename + } + set htop 0 + set hcurrent 0 + + # Update navigation options and history menu. + send htbButton set sensitive False + send htfButton set sensitive False + send htuButton set sensitive False + editHistoryMenu +} + + +# Push an item on the history stack. +proc addHistRecord { pkg task url opt file type } { + global HPkg HType HUrl HOpt HTask HFile htop hcurrent + global helpType helpOption + global historyMenuDescription + + # Push a new history record to the top of the stack and make that the + # current record. + incr htop + set HPkg($htop) $pkg + set HTask($htop) $task + set HUrl($htop) $url + set HOpt($htop) $opt + set HFile($htop) [ expr {($file == "") ? "none" : $file } ] + set HType($htop) $type + set hcurrent $htop + + # Activate the Back button. + if {$hcurrent == 1} { + send htbButton set sensitive True + if {$type == "package"} { + send htuButton set sensitive True + } + } + + # Edit the history menu. + editHistoryMenu + printHistStack "addHistRecord" +} + + +# Edit the history menu to reflect the current state. +proc editHistoryMenu { args } { + global HPkg HType HUrl HOpt HTask htop hcurrent + global helpType helpOption + global historyMenuDescription + global navMenuDescription + global MAX_MENU_SIZE + + set items $historyMenuDescription + set nitems 0 + if {$htop > $MAX_MENU_SIZE} { + set nstart [ min $htop [expr {$hcurrent + 3}] ] + } else { + set nstart $htop + } + for { set i $nstart } { $i >= 0 } { incr i -1 } { + set pkg $HPkg($i) + set task $HTask($i) + set type $HType($i) + set opt $HOpt($i) + set url $HUrl($i) + if {$pkg != "" || $type == "file"} { + if {$type == "task"} { + if {$url == ""} { + set entry [format "%-22.22s %4s" $task \ + [menuItemType $type $url $opt ] ] + } else { + set entry [format "%-22.22s %4s" \ + [ format "%s (%s)" $task [string trimleft $url "#"] ] \ + [menuItemType $type $url $opt ] ] + } + } elseif {$type == "package"} { + set entry [format "%-22.22s %4s" [getPkgName $pkg] \ + [menuItemType $type $url $opt ] ] + } elseif {$type == "file"} { + upvar #0 HFile file + set entry [format "%s" $file($i) ] + } else { + setAlert param old [format "Unknown help type: %s" $type] + } + + if {$type == "file"} { + lappend items " \" $entry \" f.exec \{ \ + loadHistItem $i pkg $entry help file \} \ + bitmap \{\($i==$hcurrent\) ? \"arrow\" : \"null\" \} " + } else { + lappend items " \" $entry \" f.exec \{ \ + loadHistItem $i [getPkgName $pkg] $task $opt $type $url \} \ + bitmap \{\($i==$hcurrent\) ? \"arrow\" : \"null\" \} " + } + } + + incr nitems 1 + if {$nitems > $MAX_MENU_SIZE} { + lappend items "f.dblline" + lappend items " \" History truncated... \" f.exec \{ \} " + break + } + } + editMenu historyMenu historyButton $items + + # Edit the navigation menu to get the sensitivities right for + # the current state. + editMenu navMenu helpText $navMenuDescription +} + + +# Utility routine to set the history item entry type. +proc menuItemType { type url opt } { + if {$url != ""} { + return [format "Link"] + } + + switch $opt { + "help" { return [format "%s" [expr {($type=="task")?"Task":"Pkg"} ]] } + "source" { return [format "(src)"] } + "sysdoc" { return [format "(sys)"] } + } +} + + +# Load a particular page/link from the history list. +proc loadHistItem { itemno pkg task opt type args } { + global HPkg HType HUrl HOpt HTask htop hcurrent + global curtask curpack helpType helpOption hcurrent + global version + + # Load the requested page. Check whether we just need to jump to + # the current page. + if {$task == "Home"} { + loadHomePage + + } elseif {$type == "file"} { + GCmd directory open $task + + } elseif {$itemno == $hcurrent || \ + ($pkg != $curpack || \ + $task != $curtask || \ + $type != $helpType || \ + $opt != $helpOption) } { + GCmd load $task $pkg $opt + } + + # If the history item included an internal link, jump to it. The + # 'args' value will either be the URL or an empty string. + if {$args != ""} { + send helpText gotoId [send helpText anchorToId $args] + send helpText retestAnchors + } + + # Update the topic entry string. + if { $type == "task" } { + send topicEntry set string [ format "%s.%s" $pkg $task ] + } elseif { $type == "file" } { + send topicEntry set string $task + } else { + send topicEntry set string $pkg + } + + # Change the options button if needed. + if {$HOpt($itemno) != $helpOption} { + send [ getOptWidget $helpOption ] set on 0 + setOptColor [ getOptWidget $HOpt($itemno) ] green + } + + # Update the current entry. + set hcurrent $itemno + + if { $type != "file" } { + set curtask $HTask($hcurrent) + set curpack $HPkg($hcurrent) + set helpOption $HOpt($hcurrent) + set helpType $HType($hcurrent) + } else { + set helpOption "help" + set helpType "file" + } + + # Tweak the navigation buttons. + if {$hcurrent == 0} { + send htbButton set sensitive False + send htuButton set sensitive False + } + if {$hcurrent >= 0} { + send htfButton set sensitive True + send htuButton set sensitive True + } + if {$hcurrent == $htop } { + send htfButton set sensitive False + send htbButton set sensitive True + } + + # Edit the history menu. + editHistoryMenu +} + +# Initialize the history menu. +editHistoryMenu + +# Given the option type return the widget name. +proc getOptWidget { opt } { + switch $opt { + "help" { return "hlpOpt" } + "source" { return "srcOpt" } + "sysdoc" { return "sysOpt" } + } +} + +# Debug utility to print the history stack. +proc printHistStack { where args } { + global HPkg HType HUrl HOpt HTask HFile htop hcurrent + global debug + + # Print the stack... + if {$debug > 0} { + print "_______________________________________________________________" + print $where + for { set i $htop } { $i >= 0 } { incr i -1 } { + if {$HType($i) == "file"} { + upvar #0 HFile file + print [format "%3s%d: type=%1.1s file=%s\n"\ + [ expr {($i==$hcurrent) ? ">>>" : "---"} ] \ + $i $HType($i) $file($i) ] + } else { + print [format "%3s%d: type=%1.1s opt=%4.4s task=%s pack=%s\n"\ + [ expr {($i==$hcurrent) ? ">>>" : "---"} ] \ + $i $HType($i) $HOpt($i) $HTask($i) $HPkg($i) $HUrl($i) ] + } + } + } +} + +# Test whether an anchor has been visited. +proc testAnchor {widget cbtype href} { + global visited + return [info exists visited($href)] +} +send hlpText addCallback testAnchor testAnchor +send helpText addCallback testAnchor testAnchor +send resList addCallback testAnchor testAnchor + + +################################################################################ +# Options Menu +################################################################################ + +proc setType { param old new } { + global helpType + set helpType [string tolower $new ] +} ; send type addCallback setType + +proc selectOption { widget type value args } { + global curtask curpack helpOption + + if { $curtask != "" } { + foreach i { hlpOpt srcOpt sysOpt } { send $i set on 0 } + setOptColor $widget green + send $widget set on 1 + switch $widget { + hlpOpt { set helpOption help + send fmtText setSensitive true + send fmtPS setSensitive true + } + srcOpt { set helpOption source + send fmtText setSensitive false + send fmtPS setSensitive false + } + sysOpt { set helpOption sysdoc + send fmtText setSensitive true + send fmtPS setSensitive true + } + } + GCmd help $curtask [getParentName $curpack] $helpOption + } +}; foreach i {hlpOpt srcOpt sysOpt } { send $i addCallback selectOption } + +proc toggleFileOption { args } { + if { [ send filOpt get on] == 1 } { + send fileShell map + } else { + send fileShell unmap + } +} ; send filOpt addCallback toggleFileOption + +send flDismiss addCallback "send fileShell unmap ; send filOpt set on 0" + + +################################################################################ +# Procedure used by the printer prompt box. +################################################################################ + +proc setPrinterName { param old new } { + send printEntry set string $new +}; send printer addCallback setPrinterName + +set page_size pageLetter + +proc pageRadio { widget type state args } { + global page_size + + if {$state == 0} { + # Don't allow a button to be turned off. + send $widget set on 1 + } else { + send $page_size set on 0 + set page_size $widget + } +} +foreach w {pageLetter pageLegal pageA4 pageB5} { send $w addCallback pageRadio } + +proc toPrinterToggle args { + global curtask HType hcurrent + if { [send toPrinter get on] } { + send toFile set on False + send printLabel set label "Printer: " + send printEntry set string "printer" + } else { + send toFile set on True + send printLabel set label "File Name: " + if {$HType($hcurrent) == "file" || [send srcOpt get on] == 1} { + send printEntry set string [format "%s" [fileSource] ] + } else { + if { $curtask == "" } { + send printEntry set string "help.ps" + } else { + send printEntry set string [format "%s.ps" $curtask] + } + } + } +} ; send toPrinter addCallback toPrinterToggle + +proc toFileToggle args { + global curtask HType hcurrent + if { [send toFile get on] } { + send toPrinter set on False + send printLabel set label "File Name: " + if {$HType($hcurrent) == "file" || [send srcOpt get on] == 1} { + send printEntry set string [format "%s" [fileSource] ] + } else { + if { $curtask == "" } { + send printEntry set string "help.ps" + } else { + send printEntry set string [format "%s.ps" $curtask] + } + } + } else { + send toPrinter set on True + send printLabel set label "Printer: " + send printEntry set string "printer" + } +} ; send toFile addCallback toFileToggle + +proc doPrintOkay { args } { + global curtask curpack HType hcurrent + + set device [ send printEntry get string ] + if { [send toPrinter get on] } { + GCmd print $curtask $curpack $device + } else { + set fname [send printEntry get string] + if {$HType($hcurrent) == "file" || [send srcOpt get on] == 1} { + GCmd directory save [fileSource] $fname 1 source + } else { + GCmd directory save [fileSource] $fname 1 postscript + } + } + send printShell unmap +} +send printOkay addCallback doPrintOkay +send printEntry addCallback doPrintOkay + +send printDismiss addCallback "send printShell unmap " + + +################################################################################ +# Procedures used by the fileBrowser. +################################################################################ + +# File browsing globals +set curdir "" ;# current directory +set pattern "*" ;# filename template +set format "fmtSrc" ;# SaveAs format + + +# Browser selection callback. +proc browserSelect { widget event args } { + global curdir helpOption + + set opt [expr {$widget == "dirList" ? "dirlist" : "loadfile"}] + set item [send $widget getItem itemno] + send $widget getItem itemno + set mode [send fbcOkay get label] + + if { $itemno != "none" } { + if { $mode == "Load"} { + if {$opt != "dirlist"} { + addHistRecord "" "" "" help [format "%s%s" $curdir $item] "file" + } + GCmd directory $opt $item + send flistText set string [format " file Okay %s%s\n" \ + $curdir $item] + } else { + if {$opt == "dirlist"} { + GCmd directory $opt $item + } else { + send fnameEntry set string [format "%s%s" $curdir $item] + } + } + } +} +send dirList addEventHandler browserSelect buttonReleaseMask +send fileList addEventHandler browserSelect buttonReleaseMask + + +# Client callback. +proc browserListing { param old new } { + global curdir pattern + + set option [ lindex $new 0 ] + switch $option { + dirlist { set list [lindex $new 1] + send dirList setList $list resize + } + filelist { set list [lindex $new 1] + send fileList setList $list resize + } + template { set pattern [lindex $new 1] + send filterEntry set string $pattern + } + curdir { set curdir [lindex $new 1] + send curdirVal set label $curdir + } + selection { send fnameEntry set string [lindex $new 1] } + } +} ; send directory addCallback browserListing + + +# Set the filename matching template. +proc setTemplate { widget mode pattern args } { + GCmd directory template $pattern +} ; send filterEntry addCallback setTemplate + + +# get the filename of the currently displayed page. +proc fileSource { args } { + global helpOption + + set str [ send flistText get string ] + + set fname "" + for {set i 0} {$i < [llength $str]} {incr i 3} { + set j [expr {$i + 2} ] + if {($helpOption == "source" && [lindex $str $i] == "src") || + ($helpOption == "sysdoc" && [lindex $str $i] == "sys") || + ($helpOption == "help" && [lindex $str $i] == "hlp") || + ($helpOption == "file" && [lindex $str $i] == "file")} { + set fname [lindex $str $j] + break + } + } + return $fname +} + +# Open a specific file, either to load a new page or save the current page. +proc openFile { widget args } { + global curdir helpOption + + set fname [send fnameEntry get string] + + if {$fname == ""} { + setAlert param old "No filename specified" + } else { + if { [send fbcOkay get label] == "Load"} { + addHistRecord "" "" "" "" [format "%s%s" $curdir $fname] "file" + GCmd directory open $fname + send flistText set string [format " file Okay %s\n" $fname] + } else { + set page [fileSource] + set ow [send overwrite get on] + if {[send fmtSrc get on] == 1} { + GCmd directory save $page $fname $ow source + } elseif {[send fmtText get on] == 1} { + GCmd directory save $page $fname $ow text + } elseif {[send fmtHTML get on] == 1} { + GCmd directory save $page $fname $ow html + } elseif {[send fmtPS get on] == 1} { + GCmd directory save $page $fname $ow postscript + } + } + } +} ; send fbcOkay addCallback openFile + + +# Make the SaveAs formats a radio box. +proc fmtRadio { widget type state args } { + global format + + if {$state == 0} { + # Don't allow a button to be turned off. + send $widget set on 1 + } else { + send $format set on 0 + set format $widget + } + + # If there's no filename specified set one as a default. + setDefaultFname + +} ; foreach w {fmtSrc fmtText fmtHTML fmtPS} { send $w addCallback fmtRadio } + + +# Set a default filename based on the selected format and task name +proc setDefaultFname args { + global format curtask curdir + + set fname [send fnameEntry get string] + if {$curtask != ""} { + switch $format { + fmtSrc { send fnameEntry \ + set string [format "%s%s" $curdir $curtask] } + fmtText { send fnameEntry \ + set string [format "%s%s.txt" $curdir $curtask] } + fmtHTML { send fnameEntry \ + set string [format "%s%s.html" $curdir $curtask] } + fmtPS { send fnameEntry \ + set string [format "%s%s.ps" $curdir $curtask] } + } + } +} + +proc browserHelp args { + if { [send fbcOkay get label] == "Load"} { + showHelp lfiles + } else { + showHelp sfiles + } +} ; send fbcHelp addCallback browserHelp + +send fnavHome addCallback "GCmd directory home" +send fnavUp addCallback "GCmd directory up" +send fnavRoot addCallback "GCmd directory root" +send fnavRescan addCallback "GCmd directory rescan" +send fnameClear addCallback "send fnameEntry set string \"\"" +send filterClear addCallback "send filterEntry set string \"\"" +send fbcDismiss addCallback "send fileBrowser unmap" + + + +################################################################################ +# Procedures used by the find box. +################################################################################ + +proc doFindOkay args { + set dir forward + set case caseless + set phrase [send findEntry get string] + + if { $phrase != "" } { + if { [send findDir get on] } { set dir backward } + if { [send findCase get on] } { set case caseSensitive } + + if { [send helpText searchText $phrase start end $dir $case] > 0 } { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + + send helpText gotoId $id + send helpText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { findOkay findEntry } { send $w addCallback doFindOkay } + +send findClear addCallback { send findEntry set string "" } +send findDismiss addCallback { send findShell popdown } + + +################################################################################ +# Procedures used by the apropos prompt box. +################################################################################ + +proc doSearchOkay args { + set phrase [send searchEntry get string] + if { $phrase != "" } { + send searchStatus set label "Searching..." + GCmd search [send exactMatch get on] $phrase + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { searchOkay searchEntry } { send $w addCallback doSearchOkay } + +proc searchResults { param old new } { + global search_mapped + + if {$search_mapped == 0} { + Search + } + send resList setText $new + send resList retestAnchors + send searchStatus set label "" +} ; send apropos addCallback searchResults + +# Selection callback. +proc searchAnchorSelected {widget cbtype event text href args} { + global helpOption helpType curpack curtask + global visited + + # Break out the task and package names. + set pack [lindex [split $href "."] 0] + set task [lindex [split $href "."] 1] + + # Set the state and load the page. + if {$helpOption != "help"} { + send [getOptWidget $helpOption] set on 0 + setOptColor hlpOpt green + } + set curtask $task + set curpack $pack + set helpOption "help" + set helpType [expr {($pack == $task) ? "package" : "task"}] + GCmd load $curtask $curpack $helpOption + + # Add the history record, one for the package and one for the task. + addHistRecord $curpack $curpack "" $helpOption "" "package" + if {$pack != $task} { + addHistRecord $curpack $curtask "" $helpOption "" "task" + } + send htbButton set sensitive True + send htuButton set sensitive True + editHistoryMenu + printHistStack "searchAnchorSelected" + + # Update the topic entry string. + if { $task == $pack } { + send topicEntry set string $pack + } else { + send topicEntry set string [ format "%s.%s" $pack $task ] + } + + set visited($href) 1 + send resList retestAnchors + +} ; send resList addCallback searchAnchorSelected anchor + +proc doSearchClear args { + send searchEntry set string "" +} ; send searchClear addCallback doSearchClear + +proc doSearchDismiss args { + global search_mapped + + set search_mapped 0 + send searchShell unmap +} ; send searchDismiss addCallback doSearchDismiss + +send searchHelp addCallback { showHelp search } + + +################################################################################ +# Define procedures for the help panel +################################################################################ + +# Stuff for keeping track of visited anchors. +set h_links { 0 } +set h_linkIndex 0 + +proc getHelpText { param old new } { + send hlpText setText $new +}; send help addCallback getHelpText + +proc anchorSelected {widget cbtype event text href args} { + global visited h_links h_linkIndex + set anchID [send hlpText anchorToId $href] + set visited($href) 1 + if {$h_linkIndex == 0} { + send hlpBack set sensitive True + if {[lindex $h_links 1] != $anchID} { + set h_links { 0 } + send hlpForward set sensitive False + } + } + if {$h_linkIndex > 0 && \ + [lindex $h_links [expr $h_linkIndex + 1]] != $anchID} { + #set h_links [lrange $h_links 0 $h_linkIndex] + set pos [send hlpText positionToId 0 0] + set h_links [lreplace $h_links $h_linkIndex end $pos] + } + if {[lindex $h_links [expr $h_linkIndex + 1]] != $anchID} { + lappend h_links $anchID + incr h_linkIndex + } else { + send hlpForward set sensitive False + incr h_linkIndex + } + if {$h_linkIndex == [expr [llength $h_links] - 1]} { + send hlpForward set sensitive False + } + send hlpText gotoId $anchID + send hlpText retestAnchors +}; send hlpText addCallback anchorSelected anchor + + +# Callbacks to position forwards and backwards in link list. +proc hlpForward args { + global h_links h_linkIndex + incr h_linkIndex + if {$h_linkIndex <= [llength $h_links]} { + set anchID [lindex $h_links $h_linkIndex] + send hlpText gotoId $anchID + send hlpText retestAnchors + if {$h_linkIndex == [expr [llength $h_links] - 1]} { + send hlpForward set sensitive False + send hlpBack set sensitive True + } else { + send hlpBack set sensitive True + } + } else { + incr h_linkIndex -1 + } +}; send hlpForward addCallback hlpForward + +proc hlpBack args { + global h_links h_linkIndex + incr h_linkIndex -1 + if {$h_linkIndex >= 0} { + set anchID [lindex $h_links $h_linkIndex] + send hlpText gotoId $anchID + send hlpText retestAnchors + if {$h_linkIndex == 0} { send hlpBack set sensitive False } + if {$h_linkIndex >= 0} { send hlpForward set sensitive True } + } else { + incr h_linkIndex 1 + } +}; send hlpBack addCallback hlpBack + +proc hlpHome args { + global h_links h_linkIndex + set h_links { 0 } + set h_linkIndex 0 + send hlpText gotoId 0 + send hlpForward set sensitive False + send hlpBack set sensitive False +}; send hlpHome addCallback hlpHome + +proc hlpTutorial args { + showHelp tutorial +}; send hlpTutorial addCallback hlpTutorial +send hlpTutorial unmap ;# NO TUTORIAL AT THE MOMENT + +proc showHelp {name args} { + anchorSelected widget cbtype event text #$name + send hlpShell map +} + +proc hlpFind args { + set phrase [send hfEntry get string] + set dir forward + set case caseless + + if { $phrase != "" } { + if { [send hfDir get on] } { set dir backward } + if { [send hfCase get on] } { set case caseSensitive } + if {[send hlpText searchText $phrase start end $dir $case ] > 0} { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + send hlpText gotoId $id + send hlpText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { hfEntry hfFind } { send $w addCallback hlpFind } + +send hfClear addCallback { send hfEntry set string "" } + +send hlpDismiss addCallback "send hlpShell unmap" + + +################################################################################ +# Document source viewer procedures. +################################################################################ + +proc srcOpen { args } { send doc_source map } +send srcDismiss addCallback "send doc_source unmap" + + +################################################################################ +# Define some TCL debug procedures +################################################################################ + +proc tclOpen {} { send tclShell map } + +proc tclCommandClear { widget args } { + send tclEntry set string "" +} ; send tclClear addCallback tclCommandClear + +proc tclCommandExecute { widget args } { \ + send server [send tclEntry {get string}] +} ; send tclExecute addCallback tclCommandExecute + +proc tclCommand { widget mode command args } { + send server $command +} ; send tclEntry addCallback tclCommand + +proc tclToggleLogging args { + global debug + if { [ send tclLogging get state] } { + set debug 1 + send tclLogging set label "Disable Logging" + } else { + set debug 0 + send tclLogging set label "Enable Logging" + } +} ; tclToggleLogging +send tclLogging addCallback tclToggleLogging + +send tclDismiss addCallback "send tclShell unmap" + +# Connect the 'textout' parameter so it appends messages from +# the client to the Tcl text window. +proc tclLogMessages { param old new } { + global debug + if {$debug == 1} { send tclEntry append [format "%s\n" $new ] } +} ; send textout addCallback tclLogMessages + + +################################################################################ +# Warning dialog. This pops up a dialog box with the given warning message. +################################################################################ + +proc warnOkay {widget args} { + global curpack curtask + + set label [send warnText get label] + if {[string match "No*" $label ] == 1} { + set topic [send topicEntry get string] + set last [string last "." $topic ] + send topicEntry set string [ string range $topic 0 [ incr last -1 ] ] + } + send warning unmap +}; send warnDismiss addCallback warnOkay + + +# The parameter "alert" is used to forward alerts from the client. The +# special 'dismiss' value can be used to shut down the alert from the +# client, the special "pop" value pops the last history elements from the +# stack (used in case of an error loading a file). + +proc setAlert {param old new} { + global HPkg HType HUrl HOpt HTask HFile htop hcurrent + + if {$new == "dismiss"} { + send warning unmap + } elseif {$new == "pop"} { + catch { + unset HType($hcurrent) + unset HOpt($hcurrent) + unset HTask($hcurrent) + unset HPkg($hcurrent) + unset HUrl($hcurrent) + unset HFile($hcurrent) + } + incr hcurrent -1 + } else { + send searchStatus set label "" + send warnText set label $new + send warning map + } +}; send alert addCallback setAlert + + diff --git a/lib/scr/help.html b/lib/scr/help.html new file mode 100644 index 00000000..46f584d7 --- /dev/null +++ b/lib/scr/help.html @@ -0,0 +1,586 @@ +<HTML> +<BODY> +<TITLE>IRAF Help GUI</TITLE> +<H1>Welcome to IRAF Help GUI V1.0</H1> +<P> +<B>Help</B> is a prototype GUI browser providing a familiar and +easy-to-use interface for the IRAF help system. Other features include +on-the-fly conversion of help documents to HTML for display and +fully formatted PostScript for hardcopy. +<P> +To begin, select a help topic from the top panel, enter a task or package +name in the <B>Topic</B> field, or hit the <B>Search</B> button to bring up +a panel allowing you to search the help system by keyword. +<P> +<HR> + +<H1>Table of Contents</H1> + +<UL> +<LI> <A HREF="#intro">Introduction</A> +<LI> <A HREF="#params">Task Parameters</A> +<LI> <A HREF="#nav">Navigating the IRAF Help System</A> +<LI> <A HREF="#browse">Browsing a Help Document</A> +<LI> <A HREF="#search">Searching</A> <UL> + <LI> <A HREF="#dbsearch">Searching the Help Database</A> </UL> <UL> + <LI> <A HREF="#find">Searching Within a Document</A> </UL> +<LI> <A HREF="#help">The On-Line Help Panel</A> +<LI> <A HREF="#homepage">User-Defined Homepages</A> +<LI> <A HREF="#lfiles">Loading Files</A> +<LI> <A HREF="#sfiles">Saving Files</A> +<LI> <A HREF="#out">Hardcopy Output</A> +<LI> <A HREF="#lroff">LROFF Directive Extensions for HTML</A> +</UL> + + +<A NAME=intro><HR><h1>Introduction</h1></A> +The <B>Help GUI</B> task is a front-end to the IRAF +<A HREF="system.help"><B>help</B></A> +task which provides on-the-fly conversion of help documents to HTML for +presentation in the GUI or formatted PostScript for hardcopy. +Help pages may be loaded on the command line, through use of a +file browser, or by navigating the help databases using a familiar CL +package menu scheme. It also features a search capability similar to the +<A HREF="system.references"><B>references</B></A> +task and a complete <A HREF=#hist>history mechanism</A>. +<P> +When invoked with no command line arguments (and the appropriate +<A HREF="#l_device">device</A> parameter setting of "gui") the task starts +as a browser and the user is presented with a GUI that has the toplevel CL +package menu in the upper navigation window. The main display window below +will contain any LROFF source file specified in the +<A HREF="#l_template">template</A> +parameter or loaded on +the command line by specifying the +<A HREF="#l_template">template</A> +and enabling the +<A HREF="#l_file_template">file_template</A> +parameters. If the +<A HREF="#l_search">search</A> +parameter is enabled the +<A HREF="#l_template">template</A> +is taken to be a search phrase and the database is searched for tasks +matching the keyword and the GUI will appear with the search panel mapped +so the user can select the task help to view. When no +<A HREF="#l_template">template</A> +is given the main display window will start with the page specified by the +<A HREF="#l_home">home</A> +parameter, this can be a user-defined HTML file giving links to specific tasks +(see below for details) or if +<A HREF="#l_home">home</A> +is empty the display will contain the online help for the task. +<P> +The first time the task is run, or whenever the help database is updated, +a quick reference file (specified by the task +<A HREF="#l_quickref">quickref </A> +parameter) and package menu file will be created in the user's <I>uparm</I> +directory to speed up help searching and subsequent startups of the task. + + +<A NAME=params><HR><h1>Task Parameters</h1></A> +<UL> +<DL> +<DT><B><A NAME="l_template">template</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='template' Line='template'> +<DD>A string listing the modules or packages for which help is desired. +Each list element may be a simple name or a pattern matching template. +Abbreviations are permitted. If <I>template</I> is omitted a long format +menu will be printed for the current package, listing each task (or +subpackage) and describing briefly what it is. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_file_template">file_template = no</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='file_template' Line='file_template = no'> +<DD>If this switch is set the template is interpreted as a filename matching +template, and all help blocks found in the named files are output. The help +database is not searched, hence manual pages can be printed or documents +may be formatted without entering the files into a help database. +In other words, "<TT>help file.hlp fi+</TT>" makes it possible to use <I>help</I> as +a conventional text formatter. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_all">all = no</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='all' Line='all = no'> +<DD>Print help for all help modules matching <I>template</I>, rather than only the +first one found. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_parameter">parameter = "<TT>all</TT>"</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='parameter' Line='parameter = "all"'> +<DD>If the value of this parameter is not "<TT>all</TT>", only the help text +for the given parameter will be printed. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_section">section = "<TT>all</TT>"</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='section' Line='section = "all"'> +<DD>If the value of this parameter is not "<TT>all</TT>", only the help text for the +given section (e.g. "<TT>usage</TT>", "<TT>description</TT>", "<TT>examples</TT>") will be printed. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_option">option = help</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='option' Line='option = help'> +<DD>The option parameter specifies the type of help desired, chosen from +the following: +<DL> +<DT><B><A NAME="l_help">help</A></B></DT> +<! Sec='PARAMETERS' Level=1 Label='help' Line='help'> +<DD>Print the full help block for the named module. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_source">source</A></B></DT> +<! Sec='PARAMETERS' Level=1 Label='source' Line='source'> +<DD>Print the source code for the module (which often contains additional +detailed comments). +</DD> +</DL> +<DL> +<DT><B><A NAME="l_sysdoc">sysdoc</A></B></DT> +<! Sec='PARAMETERS' Level=1 Label='sysdoc' Line='sysdoc'> +<DD>Print the technical system documentation for the named module. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_directory">directory</A></B></DT> +<! Sec='PARAMETERS' Level=1 Label='directory' Line='directory'> +<DD>Print a directory of all help blocks available for the named package. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_alldoc">alldoc</A></B></DT> +<! Sec='PARAMETERS' Level=1 Label='alldoc' Line='alldoc'> +<DD>Print all help blocks in the file containing the help block for +the named procedure (i.e., both the user and system documentation). +</DD> +</DL> +<DL> +<DT><B><A NAME="l_files">files</A></B></DT> +<! Sec='PARAMETERS' Level=1 Label='files' Line='files'> +<DD>Print the names of all help files associated with the named modules or +packages. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_summary">summary</A></B></DT> +<! Sec='PARAMETERS' Level=1 Label='summary' Line='summary'> +<DD>Print only the titles and sizes of help blocks in referenced help files. +The contents of the blocks are skipped. Titles are printed for <I>all</I> +help blocks found in the file containing the help block for the named module. +</DD> +</DL> +</DD> +</DL> +<DL> +<DT><B><A NAME="l_page">page = yes</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='page' Line='page = yes'> +<DD>Pause after every page of output text. Turning this off for large documents +speeds up output considerably. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_nlpp">nlpp = 59</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='nlpp' Line='nlpp = 59'> +<DD>The number of lines per page if output is redirected, e.g., to <I>lprint</I>. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_lmargin">lmargin = 1</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='lmargin' Line='lmargin = 1'> +<DD>Left margin on output. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_rmargin">rmargin = 72</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='rmargin' Line='rmargin = 72'> +<DD>Right margin on output. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_search">search = no</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='search' Line='search = no'> +<DD>If enabled the +<A HREF="#l_template">template</A> +is interpreted as a search string and the task +is started with the search panel open with the results of the search. The +<A HREF="#l_file_template">file_template</A> +parameter is ignored with search turned on. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_home">home = "<TT></TT>"</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='home' Line='home = ""'> +<DD>The home page for the task. If not set and no +<A HREF="#l_template">template</A> +is specified +the task will start with the online help in the main window, otherwise it +may be set to a filename to be displayed when the task starts. This file +may contain a text help block which will be formatted before display, or +it may be a valid HTML file. See below for a description of the format of +a homepage file which provides links to tasks. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_printer">printer = "<TT>printer</TT>"</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='printer' Line='printer = "printer"'> +<DD>Default hardcopy printer name. If the <I>value</I> of the parameter is the +reserved string "<TT>printer</TT>", the actual device is the value of the CL +environment variable <I>printer</I>. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_showtype">showtype = no</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='showtype' Line='showtype = no'> +<DD>Add task-type suffix in package menus? +</DD> +</DL> +<DL> +<DT><B><A NAME="l_quickref">quickref = "<TT>uparm$quick.ref</TT>"</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='quickref' Line='quickref = "uparm$quick.ref"'> +<DD>Name of the quick-reference file used for searching. This file is created +the first time the task is run in GUI mode or whenever it doesn't exist, +or when any help database file has been updated. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_uifname">uifname = "<TT>lib$scr/help.gui</TT>"</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='uifname' Line='uifname = "lib$scr/help.gui"'> +<DD>The user interface file. This file is what defines the look and behavior +of all the graphical user interface elements. Experts may create variants +of this file. +</DD> +</DL> +<P> +<DL> +<DT><B><A NAME="l_helpdb">helpdb = "<TT>helpdb</TT>"</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='helpdb' Line='helpdb = "helpdb"'> +<DD>The filename of the help database to be searched. If the <I>value</I> of the +parameter is the reserved string "<TT>helpdb</TT>", the actual filename is the value +of the CL environment variable <I>helpdb</I>. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_device">device = "<TT>terminal</TT>"</A></B></DT> +<! Sec='PARAMETERS' Level=0 Label='device' Line='device = "terminal"'> +<DD>Output device if the standard output is not redirected. Allowable values +include: +<DL> +<DT><B><A NAME="l_terminal">terminal</A></B></DT> +<! Sec='PARAMETERS' Level=1 Label='terminal' Line='terminal'> +<DD>If the <I>value</I> of +the parameter is the reserved string "<TT>terminal</TT>", the actual device name is +the value of the CL environment variable <I>terminal</I>. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_text">text</A></B></DT> +<! Sec='PARAMETERS' Level=1 Label='text' Line='text'> +<DD>Output the formatted help page as plain text. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_gui">gui</A></B></DT> +<! Sec='PARAMETERS' Level=1 Label='gui' Line='gui'> +<DD>Invoke the GUI for browsing the help system. This option will only work if +the <I>stdgraph</I> environment variable is set the <I>xgterm</I>, and the +user is running IRAF from an <I>XGterm</I> window. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_html">html</A></B></DT> +<! Sec='PARAMETERS' Level=1 Label='html' Line='html'> +<DD>Output the formatted help page as HTML text. +</DD> +</DL> +<DL> +<DT><B><A NAME="l_ps">ps (or postscript)</A></B></DT> +<! Sec='PARAMETERS' Level=1 Label='ps' Line='ps (or postscript)'> +<DD>Output the formatted help page as postscript. +</DD> +</DL> +</DD> +</DL> +</UL> + +<A NAME=nav><HR><h1>Navigating the IRAF Help System</h1></A> + + When run as a browser, <I>Help</I> works very much like any WWW browser. +The top panel is a list widget that will always contain a CL package listing, +at startup this will be the toplevel <I>"Home"</I> package menu one would see +when first logging into the CL containing the core system packages, NOAO +package, and any site-specific external package, or in the case of starting +with a specific task it will be the parent package for the task. +Additionally, system documents for the <A HREF="os"><B>os</B></A> +HSI routines and the <A HREF="sys.imfort"><B>imfort</B></A> and +<A HREF="math"><B>math</B></A> +interfaces will be available in the <I>Home</I> package although +these are programmatic interfaces and not tasks which can be executed. +<P> +New packages or task help pages are loaded by selecting an item from the +package menu list using the left mouse button. If the requested item is a +package, the menu listing will change as though the package were loaded in +the CL, and the help display panel will contain a listing of the package +tasks with a one-line description for each task such as would be seen with +a <I>"help <package>"</I> command using the standard task. New items +may then be selected using either the menu list or links in the display +panel. If the item is a task, the help page for the task will appear in the +display panel. In either case new pages may be selected from the menu listing. +<P> +Specific help documents may also be requested by entering the task/package +name in the <B>Topic</B> text widget above the menu list. As when selecting +from the package menu list, items selected this way will cause the menu +list to change to the package menu for the parent package if the item is a +task (displaying the help page in the display panel) or the package menu +if the item is a package (displaying the one-liner package listing in the +display panel). +<P> +Using the <B>Back</B> button will revert to the previous page in the history +list which will either be the previously loaded package or help page. +Similarly, selecting the <B>Forward</B> button will move the next page further +down in the history list, either button will become insensitive when the +end of the list on either end is reached. Selecting the <B>Up</B> button will +cause the browser to immediately jump up the previous package, skipping +over any help pages that were loaded in between. The <B>Home</B> button will +cause the default homepage (either the user-defined page if specified by the +task <I>home</I> parameter or the online help) to be displayed. Browsing +in this way can also be done using the navigation menu created by hitting +the right mouse button while in the main display panel. +<P> +Users can also jump to specific pages in the history list using the +<B>History</B> button on the main menubar. The right column of the menu +will indicate whether the item is a task, package, internal link or a text +file. The history list is truncated at about 40 entries in the menu but +the user may work back incrementally by selecting the last item of the +menu, after which the History button will display the previous 40 entries. +The history list may be cleared except for the current page by selecting +the <I>Clear History</I> menu item. + + +<A NAME=browse><HR><h1>Browsing a Help Document</h1></A> +Once a help page is loaded the middle menubar above the display panel +will change to activate widgets based on the position within the history +list and options available for a particular page. The left-most group +of buttons are the standard navigation buttons described above. +The middle group of buttons contains the <B>Sections</B> and +<B>Parameters</B> buttons which are used to browse within a help document. +The <I>Sections</I> button is a menu listing all of the sections found +within a help page, allowing the user to jump to a specific section +rather than scrolling through the entire document. The <I>Sections</I> +menu is also available using the middle mouse button from the +main display area. The <I>Parameters</I> button is similarly a menu +listing of all task parameter help sections found within the document. +Both or either of these buttons will become insensitive when no section +or parameter information is found in the document. +<P> +The right-most group of buttons represent the various help options available +for each page. The default is to get the task help, however help pages +may have an associated <B>source</B> file or <B>sysdoc</B> (e.g. if the task +is a CL script there may be a pointer to the script source itself, or a package +may have a general overview document listed as the system document). Once +a help page is loaded these buttons will change become sensitive if that option +is available, simply select the button to view the option. Selecting the +<B>Files</B> button will bring up a panel listing all the files associated +with a particular help topic. When a help topic is selected and an option is +defined but the file does not exist, the options button will display a yellow +diamond icon even if the button is insensitive, a green icon indicates the +currently selected option. This feature may be disabled by selecting the +"<TT>Show missing files</TT>" item from the main menubar <B>Options</B> menu. + + +<A NAME=search><HR><h1>Searching</h1></A> +<A NAME=dbsearch><h1>Searching the Help Database</h1></A> +Searching the help database is done by selecting the <B>Search</B> button +from the main menubar to bring up the search panel. Users may then enter +one or more keywords into the <B>Topic</B> field at the bottom of the panel +and initiate the search with either a carriage return or hitting the +<I>Search</I> button just beside it. The panel will then show a list of all +tasks and packages which match the search phrase along with a one-line +description of the task. Help pages may be displayed by selecting either the +task or package link with the left mouse button, in both case the package +menu list on the main help window will be updated to list the package +contents allowing other tasks from that package to be selected in the normal +way. +<P> +By default the exact phrase entered in the topic window will be used for the +search. This can be relaxed by toggling the "<TT>Require exact match</TT>" +button +at the top of the panel. For example, to search for all tasks matching +<I>either</I> the keyword "<TT>flat</TT>" or "<TT>field</TT>" turn off the +exact match +toggle and the search will return not only tasks matching "<TT>flat +field</TT>" +but also any task description containing only one of the words such as the +VELVECT task which plots velocity <I>field</I>s. +<P> +<A NAME=find><h1>Searching Within a Document</h1></A> +Within a help document itself one can search for a string by selecting +the <B>Find</B> button from the main menubar to bring up a panel used to +enter the search string. When the text is entered the main display +window will reposition itself and highlight the text found within the +document. Searches can be repeated and will wrap around the document +automatically, searches can be done either forward or backward through +the text and may be case insensitive. + + +<A NAME=help><HR><h1>The On-Line Help Panel</h1></A> +The help panel permits the user to view the on-line help document while +XHELP is running. The help panel can be activated by pressing the +help command button in any panel or by selecting the "Help ..." item from +the main <B>File</B> menu. The help panel consists of the the help command +button bar and the help display window which are described below. +<p> +<dl> +<dt><b>The Help Command Button Bar</b> +<dd>The command button bar contains the following command buttons. +<p> + +<dl> +<dt><b>The Back Command Button</b> +<dd>Pressing the Back command button moves backwards through the +previously visited links. +<p> +<dt><b>The Forward Button</b> +<dd>Pressing the Forward command button moves forward through the +list of visited links. +<p> +<dt><b>The Home Button</b> +<dd>Pressing the Home command button sets the help display window to +the top of the help document. +<p> +<dt><b>The Dismiss Button</b> +<dd>Pressing the Dismiss command button deactivates the help panel. +<p> +</dl> +</dl> + +The bottom of the help panel contains a text search entry widget allowing +for text searches of the documentation along with options for searching +in a forward or backward direction, and case sensitivity. When a search +phrase is entered the help document will be repositioned to the next +occcurrance of the search string if found, otherwise a dialog box will +appear to say the string was not found. Searches will wrap around the +document automatically. + + +<A NAME=homepage><HR><h1>User-Defined Homepages</h1></A> +By default <I>Xhelp</I> will start with the online help page displayed in the +main help window. The user can change this by setting the task <B>home</B> +parameter to be a path to any valid file. This file may be plain text, a +help document in LROFF format which will be converted to HTML for display, +or a native HTML document. +<P> +HTML files may contain URLs of the form +<UL> +<PRE> +<B><a href=</B><I>[package.]task</I><B>></B><I>url_text</I><B></a> +</PRE> +</UL> +<P> +where </B><I>url_text</I> is the text to appear in the window and the URL +itself +consists of an optional package and task name delimited by a period. For +example, to create a link to the +<A HREF="onedspec.splot"><B>splot</B></A> +task in a document one would use the URL +<UL> +<PRE> +<TT><a href=onedspec.splot>splot</a></TT> +</PRE> +</UL> +<P> +In this way users can create a homepage which serves as a <I>"bookmark"</I> +file or index of shortcuts to the most commonly accessed help pages. + + +<A NAME=lfiles><HR><h1>Loading Files</h1></A> +Text files may be loaded on the command line when starting the task by +specifying the filename and setting the +<A HREF=#l_file_template>file_template</A> task parameter. The named file +will be searched for a <I>.help</I> LROFF directing indicating it contains +a help block that will be converted to HTML for display. If no help +block is found the file will be displayed as-is, meaning existing +HTML documents can be loaded and will be formatted correctly. + +Once the task is running users may load a file by selecting the <B>Open +File...</B> menu item from the main menubar <B>File</B> menu or the +right-mouse-button menu from within the main display area. This will +open a file browser allowing users to change directories by using the +navigation buttons at the top of the panel, or selecting items from the +leftmost directory listing. Selecting a file on the rightmost list will +cause it to be loaded and automatically formatted if it contains a help +block. The file list may be filtered to select only those files matching +a particular template by changing the <B>Filter</B> box at the top of +the panel. Filenames or directories may be entered directly using the +<B>Selection</B> box at the bottom of the panel. + + +<A NAME=sfiles><HR><h1>Saving Files</h1></A> +Once a file has been loaded in the browser it may be saved to disk as +either <I>source</I> (i.e. the original LROFF file if that was converted +for the display, or whatever file is currently displayed regardless of +format), <I>text</I> to save formatted plain text such as that produced +by the standard <B>help</B> task, <I>HTML</I> to save the converted HTML +used in the display, or <I>PostScript</I> to save formatted PostScript of +the document such as that sent to the printer using the <B>Print</B> +button. Not all options will be available depending on the format of the +input text, unavailable options will be insensitive in the GUI. + +The <B>Save</B> panel is opened by selecting the <B>Save As...</B> menu +item from the main menubar <B>File</B> menu or the right-mouse-button +menu from within the main display area. The file browser operates the +same as when loading images, the only difference is that file selection +simply defines the filename to be used and does not cause the save to +occur automatically. Users can overwrite existing files by selecting the +<I>Options</I> toggle at the bottom of the panel. + + +<A NAME=out><HR><h1>Hardcopy Output</h1></A> +Help pages may be output to any configured iraf printer by selecting the +main menubar <B>Print</B> button to bring up the print panel. Task help +pages will be converted to formatted PostScript and may be sent to either a +printer or saved to disk depending on the selection made in the printer +panel. If the printer name is set to the special value <I>"printer"</I> then +the device named by the CL <I>printer</I> environment variable will be used. +When saving to disk files the default action is to save to a filename whose +name is the task name plus a "<TT>.ps</TT>" extension. Either of these are +changeable within the GUI as is the default page size to be used when +generating the PostScript. +<P> +The main menubar <B>File</B> button can also be used to bring up the file +browser in order to save the current document to disk. Help pages may be +saved as either the origin LROFF source for the file, formatted text as you +would get from the standard help task, HTML as is displayed in the GUI, or +formatted PostScript. The choice of formats is dictated by the type of file +being displayed (e.g. you cannot save PostScript of a program source). + +<HR> +<A NAME=lroff><h1>LROFF Extensions for HTML</h1></A> +To better support HTML links within documents and to other help pages two +new directives have been added to the LROFF text formatter. These are +<B>.hr</B> to specify a link (an HTML <I>HREF</I> directive) and <B>.hn</B> +to specify a name (an HTML <I>NAME</I> directive). The syntax for these are +as follows: +<PRE> + <B>.hn</B><I> <name></I> + <B>.hr</B><I> <link> <text> </I> +</PRE> +<P> +where <I><name></I> is the destination name of an internal link, +<I><link></I> +is the URL of the link to be created, and <I><text></I> is the text to +be displayed in the HTML. The URL syntax is either a <TT>'#'</TT> character +followed +by a destination name, a simple <I>task</I> name or <I>package</I> name, +or a <I>package.task</I> pair giving a more precise task. For internal links +the current document is repositioned so the name is at the top of the display, +for task help links new help pages will be loaded in the browser. +<P> +These directives are ignored when converting the LROFF to either formatted +plain text or PostScript. + +</BODY> +</HTML> diff --git a/lib/scr/imedit.key b/lib/scr/imedit.key new file mode 100644 index 00000000..1c1b7fa5 --- /dev/null +++ b/lib/scr/imedit.key @@ -0,0 +1,82 @@ + IMEDIT CURSOR KEYSTROKE COMMANDS + + ? Print help + : Colon commands (see below) + <space> Statistics + g Surface graph + i Initialize (start over without saving changes) + q Quit and save changes + p Print box of pixel values and statistics + r Redraw image display + s Surface plot at cursor + t Toggle between minimum and maximum search + + Increase radius by one + - Decrease radius by one + I Interrupt task immediately + Q Quit without saving changes + +The following editing options are available. Rectangular and line regions +are specified with two positions and aperture regions are specified by +one position. The current aperture type (circular or square) is used +in the latter case. The move option takes two positions, the position +to move from and the position to move to. + + a Background replacement (rectangle) + b Background replacement (aperture) + c Column interpolation (rectangle) + d Constant value substitution (rectangle) + e Constant value substitution (aperture) + f Interpolation across line (line) + j Replace with input data (rectangle) + k Replace with input data (aperture) + l Line interpolation (rectangle) + m Copy by replacement (aperture) + n Copy by addition (aperture) + u Undo last change (see also 'i', 'j', and 'k') + v Constant value substitution (vector) + = Constant value substitution of pixels equal + to pixel at the cursor position + < Constant value substitution of pixels less than or equal + to pixel at the cursor position + > Constant value substitution of pixels greater than or equal + to pixel at the cursor position + +When the image display provides a fill option then the effect of zoom +and roam is provided by loading image sections. This is a temporary +mechanism which will eventually be replaced by a more sophisticated +image display interface. + + E Exapnd image display + P Pan image display + R Redraw image display + Z Zoom image display + 0 Redraw image display with no zoom + 1-9 Shift display + + + IMEDIT COLON COMMANDS + +The colon either print the current value of a parameter when there is +no value or set the parameter to the specified value. + +angh [value] Horizontal viewing angle (degrees) for surface plots +angv [value] Vertical viewing angle (degrees) for surface plots +aperture [type] Aperture type (circular|square) +autodisplay [yes|no] Automatic image display? +autosurface [yes|no] Automatic surface plots? +buffer [value] Background buffer width +command [string] Display command +display [yes|no] Display image? +eparam Edit parameters +graphics [device] Graphics device +input [image] New input image to edit (output is same as input) +output [image] New output image name +radius [value] Aperture radius +search [value] Search radius +sigma [value] Noise sigma (INDEF for histrogram replacement) +value [value] Constant substitution value +width [value] Background annulus width +write [name] Write changes to name (default current output name) +xorder [value] X order for background fitting +yorder [value] Y order for background fitting + diff --git a/lib/scr/imexamine.key b/lib/scr/imexamine.key new file mode 100644 index 00000000..03ad7643 --- /dev/null +++ b/lib/scr/imexamine.key @@ -0,0 +1,165 @@ + -- IMEXAMINE COMMANDS -- + + CURSOR KEY COMMAND SUMMARY + +? Help h Histogram p Previous frame x Coordinates +a Aperture Sum i Image cursor q Quit y Set origin +b Box coords j Line gauss fit r Radial plot z Print grid +c Column plot k Col gauss fit s Surface plot , Quick phot +d Load display l Line plot t Output image . Quick prof fit +e Contour plot m Statistics u Vector plot +f Redraw n Next frame v Vector plot +g Graphics cursor o Overplot w Toggle logfile + + + COLON COMMAND SUMMARY + +allframes ceiling iterations naverage pointmode width +angh center label nbins radius x +angv constant logfile ncolumns round xformat +autoredraw dashpat logx ncontours rplot xlabel +autoscale defkey logy ncoutput select xorder +background eparam magzero ncstat szmarker y +banner fill majrx nhi ticklabel yformat +beta fitplot majry nlines title ylabel +boundary fittype marker nloutput top_closed yorder +box floor minrx nlstat unlearn z1,z2 +buffer interval minry output wcs zero + + + OUTPUT OF 'a' AND 'r' KEYS + +The 'a' key and logfile output has column labels and each object has one +line of measurements in the logfile and two lines on the terminal. The 'r' +key shows only the second line on the status line and the information from +the first line is in the graph title. The first line contains the x and y +center coordinates and optional world coordinates. The second line +contains the aperture magnitude and flux, the estimated background sky, the +profile fit peak, the ellipticity and position angle from the moment +analysis, and four estimates of the profile width. The four estimates are +from the moment analysis, the full-width enclosing half the flux, the +profile fit, and a direct estimate of the full width at half-maximum. + + + CURSOR KEY COMMANDS + +? Print help +a Aperture radial photometry measurement (see above for output) +b Box coordinates for two cursor positions - c1 c2 l1 l2 +c Column plot +d Load the image display +e Contour plot +f Redraw the last graph +g Graphics cursor +h Histogram plot +i Image cursor +j Fit 1D gaussian to image lines +k Fit 1D gaussian to image columns +l Line plot +m Statistics + image[section] npixels mean median stddev min max +n Next frame or image +o Overplot +p Previous frame or image +q Quit +r Radial profile plot (see above for output) +s Surface plot +t Output image centered on cursor (parameters output, ncoutput, nloutput) +u Centered vector plot from two cursor positions +v Vector plot between two cursor positions +w Toggle write to logfile +x Print coordinates + col line pixval [xorign yorigin dx dy r theta] +y Set origin for relative positions +z Print grid of pixel values - 10 x 10 grid +, Quick profile photometry measurement (Gaussian or Moffat) +. Quick radial profile plot and fit (Gaussian or Moffat) + + COLON COMMANDS + +Explicit image coordinates may be entered using the colon command syntax: + + :column line key + +where column and line are the image coordinates and the key is one +of the cursor keys. A special syntax for line or column plots is also +available as :c# or :l# where # is a column or line and no space is +allowed. + +Other colon commands set or show parameters governing the plots and other +features of the task. Each graph type has it's own set of parameters. +When a parameter applies to more than one graph the current graph is assumed. +If the current graph is not applicable then a warning is given. The +"eparam" and "unlearn" commands may be used to change many parameters and +without an argument the current graph parameters are modified while with +the graph key as an argument the appropriate parameter set is modified. +In the list below the graph key(s) to which a parameter applies are shown. + +allframes Cycle through all display frames to display images +angh s Horizontal angle for surface plot +angv s Vertical angle for surface plot +autoredraw cehlrsuv. Automatically redraw graph after colon command? +autoscale h Adjust number of histogram bins to avoid aliasing +axes s Draw axes in surface plot? +background jkr. Subtract background for radial plot and photometry? +banner cehjklrsuv. Include standard banner on plots? +beta ar Moffat beta parameter (INDEF to fit or value to fix) +boundary uv Boundary extension type for vector plots +box cehjklruv. Draw box around graph? +buffer r. Buffer distance for background subtraction +ceiling es Data ceiling for contour and surface plots +center jkr. Find center for radial plot and photometry? +constant uv Constant value for boundry extension in vector plots +dashpat e Dash pattern for contour plot +eparam cehjklrsuv. Edit parameters +fill e Fill viewport vs enforce unity aspect ratio? +fitplot r Overplot profile fit on data? +fittype ar Profile fitting type (gaussian|moffat) +floor es Data floor for contour and surface plots +interval e Contour interval (0 for default) +iterations ar Iterations on fitting radius +label e Draw axis labels for contour plot? +logfile Log file name +logx chjklruv. Plot x axis logrithmically? +logy chjklruv. Plot y axis logrithmically? +magzero r. Magnitude zero for photometry +majrx cehjklruv. Number of major tick marks on x axis +majry cehjklruv. Number of major tick marks on y axis +marker chjklruv. Marker type for graph +minrx cehjklruv. Number of minor tick marks on x axis +minry cehjklruv. Number of minor tick marks on y axis +naverage cjkluv Number of columns, lines, vectors to average +nbins h Number of histogram bins +ncolumns ehs Number of columns in contour, histogram, or surface plot +ncontours e Number of contours (0 for default) +ncoutput Number of columns in output image +ncstat Number of columns in statistics box +nhi e hi/low marking option for contours +nlines ehs Number of lines in contour, histogram, or surface plot +nloutput Number of lines in output image +nlstat Number of lines in statistics box +output Output image root name +pointmode chjkluv Plot points instead of lines? +radius r. Radius of object aperture for radial plot and photmetry +round cehjklruv. Round axes to nice values? +rplot jkr. Radius to plot in 1D and radial profile plots +select Select image or display frame +sigma jk Initial sigma for 1D gaussian fits +szmarker chjklruv. Size of marks for point mode +ticklabels cehjklruv. Label ticks? +title cehjklrsuv. Optional title for graph +top_closed h Close last bin of histogram +unlearn cehjklrsuv. Unlearn parameters to default values +wcs World coordinate system for axis labels and readback +width jkr. Width of background region +x [min max] chjklruv. Range of x to be plotted (no values for autoscaling) +xformat Coordinate format for column world coordinates +xlabel cehjklrsuv. Optional label for x axis +xorder jkr. X order of surface for background subtraction +y [min max] chjklruv. Range of y to be plotted (no values for autoscaling) +yformat Coordinate format for line world coordinates +ylabel cehjklrsuv. Optional label for y axis +yorder r. Y order of surface for background subtraction +z1 h Lower intensity value limit of histogram +z2 h Upper intensity value limit of histogram +zero e Zero level for contour plot diff --git a/lib/scr/implot.key b/lib/scr/implot.key new file mode 100644 index 00000000..68ce6d5e --- /dev/null +++ b/lib/scr/implot.key @@ -0,0 +1,32 @@ +Implot Command Summary: + + a mark a range of lines or columns to be averaged + c plot a column + e expand plot by marking corners of viewport + j move down without clearing and rescaling + k move up without clearing and rescaling + l plot a line + m go to the previous image in the input list + n go to the next image in the input list + o overplot next vector + p measure profile (mark region and background with 2 pos) + q quit + r redraw + s print statistics on a region + / scroll status line + <space> print coordinates and data value + + :a N set number of lines or columns to be averaged + :c M [N] plot column[s] M [to N] + :f format label format (%f %h %m %H %M) + :i image open a different image + :o overplot next vector + :l M [N] plot line[s] M [to N] + :log+, log- enable, disable log scaling in Y + :nxticks number of tick marks on X axis + :nyticks number of tick marks on Y axis + :solid use only solid linetypes when overplotting + :step N set step size for j,k + :w wcstype set wcs type (logical|physical|world) + :x x1 x2 fix plotting range in X (call with no args to unfix) + :y y1 y2 fix plotting range in Y (call with no args to unfix) diff --git a/lib/scr/inlgfit.key b/lib/scr/inlgfit.key new file mode 100644 index 00000000..c01f9a9d --- /dev/null +++ b/lib/scr/inlgfit.key @@ -0,0 +1,77 @@ +1. INTERACTIVE NONLINEAR LEAST SQUARES FITTING CURSOR OPTIONS + +? Print options +c Print coordinates and fit of point nearest the cursor +d Delete point nearest the cursor +f Do the fit and redraw or overplot the graph +g Redefine graph keys. The following data types may be along + either axis. + function Dependent variable, or function + fit Fitted value + residuals Residuals (function - fit) + ratio Ratio (function / fit) + nonlinear Nonlinear component of function + var n Independent variable number "n" + identifier Independent variable "identifier" (if defined) + user n User defined plot function (if defined) +h-l Graph keys. The defaults are the following. + h=(function, fit) + i=(function, residual) + j=(function, ratio) + k=(var 1, residual) + l=(user 1, user 2) +o Overplot the next graph +q Exit interactive curve fitting +r Redraw graph +t Overplot fit +u Undelete the deleted point nearest the cursor +w Set graph window. + For help type 'w' followed by '?' after the prompt. +I Interrupt task immediately + + +2. INTERACTIVE NONLINEAR LEAST SQUARES FITTING COLON COMMANDS + +The parameters are listed or set with the following commands which may be +abbreviated. To list the value of a parameter type the command alone. + +:show [file] Print the values of the task fitting parameters +:variables [file] Print the variable names, min and max values +:data [file] Print the values of all the variables +:errors [file] Print an error analysis of the fit +:results [file] Print the results of the fit +:vshow [file] Print an error analysis and results of the fit +:page file Page through a file +:const [param] [value] Change parameter to constant parameter +:fit [param] [value] Change parameter to fitting parameter +:tolerance [value] Show/set the convergence criteria +:maxiter [value] Show/set the maximum number of fitting iterations +:nreject [value] Show/set the maximum number of rejection iterations +:low_reject [value] Show/set the low rejection threshold +:high_reject [value] Show/set the high rejection threshold +:grow [value] Show/set the rejection growing radius + +Additional commands are available for setting graph formats and manipulating +the graphics. Use the following commands for help. + +:/help Print help for graph formatting option +:.help Print help for general graphics options + + +3. INTERACTIVE NONLINEAR LEAST SQUARES FITTING GRAPH KEYS + +The graph keys are h, i, j, k, and l. The graph keys may be redefined to +put any combination of axes types along either graph axis with the 'g' key. +To define a graph key select the desired key to redefine and then specify +the axes types for the horizontal and vertical axes by a pair of comma +separated types from the following (they may be abreviated up to three +characters, except for 'identifier'): + +function Dependent variable +fit Fitted value +ratio Ratio (function / fit) +residuuals Residuals of fit (function - fit) +nonlinear Nonlinear part of data (linear component of fit subtracted) +var [n] Indepedent variable number "n" +user [n] User defined plot equation "n" (if defined) +identifier Independent variable named "identifier" (if defined) diff --git a/lib/scr/tvmark.key b/lib/scr/tvmark.key new file mode 100644 index 00000000..9fc94e62 --- /dev/null +++ b/lib/scr/tvmark.key @@ -0,0 +1,54 @@ + Interactive TVMARK Keystroke/Colon Commands + +The following keystroke commands are available. + + + Mark the cursor position with + + x Mark the cursor position with x + . Mark the cursor position with a dot + c Draw defined concentric circles around the cursor position + r Draw defined concentric rectangles around the cursor position + s Draw line segments, 2 keystrokes + v Draw a circle, 2 keystrokes + b Draw a rectangle, 2 keystrokes + f Draw a filled rectangle, 2 keystrokes + e Mark region to be erased and restored, 2 keystrokes + + - Move to previous object in the coordinate list + m Move to next object in the coordinate list + p Mark the previous object in the coordinate list + n Mark next object in the coordinate list + l Mark all the objects in the coordinate list + o Rewind the coordinate list + a Append object at cursor position to coordinate list and mark + d Delete object nearest cursor position from coordinate list and + mark + + k Keep last cursor command + q Exit cursor loop + +The following colon commands are available. + + :show List the tvmark parameters + :move N Move to Nth object in coordinate list + :next N M Mark objects N to M in coordinate list + :text [string] Write text at the cursor position + :save Save the current contents of frame buffer + :restore Restore last saved frame buffer + :write [imagename] Write the contents of frame buffer to an image + +The following parameters can be shown or set with colon commands. + + :frame [number] + :outimage [imagename] + :coords [filename] + :logfile [filename] + :autolog [yes/no] + :mark [point|line|circle|rectangle|cross|plus] + :radii [r1,...,rN] + :lengths [l1,...,lN] [width/length ratio] + :font [raster] + :color [number] + :label [yes/no] + :number [yes/no] + :txsize [1,2,..] + :pointsize [1,3,5...] diff --git a/lib/scr/wcsedit.key b/lib/scr/wcsedit.key new file mode 100644 index 00000000..61d98ceb --- /dev/null +++ b/lib/scr/wcsedit.key @@ -0,0 +1,24 @@ + WCSEDIT COMMANDS + + BASIC COMMANDS + + +? Print the WCSEDIT commands +show Print out the current WCS +update Quit WCSEDIT and update the image WCS +quit Quit WCSEDIT without updating the image wcs + + + PARAMETER DISPLAY AND EDITING COMMANDS + +crval [value axes1] Show/set the FITS crval parameter(s) +crpix [value axes1] Show/set the FITS crpix parameter(s) +cd [value axes1 [axes2]] Show/set the FITS cd parameter(s) +ltv [value axes1] Show/set the IRAF ltv parameter(s) +ltm [value axes1 [axes2]] Show/set the IRAF ltm parameter(s) +wtype [value axes1] Show/set the FITS/IRAF axes transform(s) +axtype [value axes1] Show/set the FITS/IRAF axis type(s) +units [value axes1] Show/set the IRAF axes units(s) +label [value axes1] Show/set the IRAF axes label(s) +format [value axes1] Show/set the IRAF axes coordinate format(s) + diff --git a/lib/scr/xgterm.gui b/lib/scr/xgterm.gui new file mode 100644 index 00000000..1aae673c --- /dev/null +++ b/lib/scr/xgterm.gui @@ -0,0 +1,14 @@ +# XGTERM.GUI -- Default GUI for Xgterm, providing a standard graphics terminal +# emulation. + +reset-server +appInitialize irafterm IRAFterm { + IRAFterm.objects: toplevel Gterm gterm + *allowShellResize: true + *gterm.warpCursor: true + *gterm.raiseWindow: true + *gterm.deiconifyWindow: true +} +createObjects +send gterm setGterm +activate diff --git a/lib/scr/xxgterm.gui b/lib/scr/xxgterm.gui new file mode 100644 index 00000000..585a834a --- /dev/null +++ b/lib/scr/xxgterm.gui @@ -0,0 +1,1523 @@ +# XGTERM.GUI -- Default XGterm GUI with message panel for trapping debug +# output, or executing Tcl commands. + +# Reset the Widget Server. Must be the first command so we restart correctly. +reset-server + +# Set the widgets and resources to be used in the base GUI. +set UIObjects(Xgterm) { \ + toplevel Layout xgLayout\ + xgLayout Frame xgUBFrame\ + xgUBFrame Layout ugUserbar\ + xgLayout Group gtermGroup\ + xgLayout Layout xgConfigBar\ + gtermGroup Gterm gterm\ +\ + xgConfigBar TextToggle xgAltGraph\ + xgConfigBar Toggle cfgGcur\ + xgConfigBar Toggle cfgTask0\ + xgConfigBar Toggle cfgTask1\ + xgConfigBar Toggle cfgTask2\ + xgConfigBar Toggle cfgTask3\ + xgConfigBar Toggle cfgTask4\ + xgConfigBar Toggle cfgTask5\ + xgConfigBar Toggle cfgTask6\ + xgConfigBar Toggle cfgTask7\ + xgConfigBar Toggle cfgTask8\ + xgConfigBar Toggle cfgTask9\ + xgConfigBar Command cfgClose\ +\ + toplevel TopLevelShell altGraph\ + altGraph Layout agLayout\ + agLayout Layout agUserbar\ + agLayout Group agGraphGroup\ + agGraphGroup Gterm agGterm\ +\ + toplevel Parameter xgterm\ + xgterm Parameter configure\ + xgterm Parameter textout\ +} + + +set UIResources(Xgterm) { \ + + !####################################################### + ! Define some global resources for the main menu panels. + !####################################################### + *beNiceToColormap: false + *allowShellResize: true + + *background: gray80 + *Text*background: gray75 + *Command.background: gray80 + *Label.background: gray80 + *MenuButton.background: gray80 + *Toggle.background: gray80 + + *Command.foreground: black + *Label.foreground: black + *MenuButton.foreground: black + *Toggle.foreground: black + *SimpleMenu*foreground: black + + *Gterm.width: 640 + *Gterm.height: 480 + + *Command.highlightThickness: 2 + *Label.highlightThickness: 0 + *MenuButton.highlightThickness: 2 + *Toggle.highlightThickness: 2 + + *Label.borderWidth: 0 + *Label.shadowWidth: 0 + *Command.shadowWidth: 1 + *Toggle.shadowWidth: 1 + *MenuButton.shadowWidth: 1 + + *Arrow.width: 16 + *Arrow.height: 25 + *Arrow.foreground: gray70 + *Arrow.background: gray80 + + *TextToggle.frameType: chiseled + *TextToggle.frameWidth: 2 + *TextToggle.onIcon: square1s + *TextToggle.offIcon: square0s + + *SmeBSB.leftMargin: 10 + + *Group.shrinkToFit: True + + !------------------------------------------------------------ + ! Define resources to take advantage of the 3D scrollbar look + !------------------------------------------------------------ + *Scrollbar*background: gray80 + *Scrollbar*width: 15 + *Scrollbar*height: 15 + *Scrollbar*shadowWidth: 2 + *Scrollbar*cursorName: top_left_arrow + *Scrollbar*pushThumb: true + + !------------------------------------- + ! Define new fonts to use for the GUI. + !------------------------------------- + *font: 7x13bold + *Command.font: 7x13bold + *MenuButton.font: 7x13bold + *Toggle.font: 7x13bold + *Label.font: 7x13bold + *TextToggle.font: 7x13bold + *SimpleMenu*font: 7x13bold + + + !############################### + ! Define the main Xgterm window. + !############################### + *Xgterm.title: XGterm UberGUI + *Xgterm.geometry: +0+0 + *Xgterm.width: 640 + *Xgterm.height: 525 + + *xgUBFrame.height: 35 + *xgUBFrame.outerOffset: 0 + *xgUBFrame.innerOffset: 3 + *xgUBFrame.frameType: raised + *xgUBFrame.frameWidth: 2 + *xgLayout*borderWidth: 0 + *xgLayout.layout: vertical { \ + -1 \ + vertical { \ + horizontal { \ + -1 \ + xgUBFrame < +inf -inf * > \ + -1 \ + } \ + gtermGroup < +inf -inf * +inf -inf > \ + horizontal { \ + 5 \ + xgConfigBar < +inf -inf * > \ + 5 \ + } \ + 4 \ + } \ + -1 \ + } + + *gtermGroup.outerOffset: 2 + *gtermGroup.innerOffset: 0 + *gtermGroup.frameType: sunken + *gtermGroup.frameWidth: 2 + *gtermGroup.label: + *gtermGroup.layout: horizontal { \ + 2 < +0 -2 > \ + vertical { \ + 2 < +0 -2 > \ + gterm < +inf -inf * +inf -inf > \ + 2 < +0 -2 > \ + } \ + 2 < +0 -2 > \ + } + *gterm.width: 640 + *gterm.height: 480 + *gterm.borderColor: black + *gterm.resizable: True + *gterm.copyOnResize: False + *gterm.dialogBgColor: cyan + *gterm.dialogFgColor: black + *gterm.crosshairCursorColor: cyan + *gterm.translations: \ + !Ctrl <Key>c: call(openDialog,command) \n\ + !Ctrl <Key>l: call(openDialog,load) \n\ + !Ctrl <Key>n: call(altGraphToggle) \n\ + !Ctrl <Key>p: call(openDialog,print) \n\ + !Ctrl <Key>s: call(logOpen) \n\ + !Ctrl <Key>t: call(tclToggle) \n\ + !Ctrl <Key>w: call(openDialog,save) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Ctrl<Btn2Down>: call(trackEnable) \n\ + !Ctrl<Btn2Motion>: track-cursor() call(wcsUpdate,$x,$y) \n\ + !Ctrl<Btn2Up>: call(trackDisable) \n\ + !Shift<Btn1Down>: popup(fileMenu) \n\ + !Shift<Btn1Up>: popdown(fileMenu) \n\ + !Shift<Btn2Down>: popup(cmMenu) \n\ + !Shift<Btn2Up>: popdown(cmMenu) call(trackDisable) \n\ + !Shift<Btn3Down>: popup(configMenu) \n\ + !Shift<Btn3Up>: popdown(configMenu) \n\ + <Motion>: track-cursor() + + !----------------------------------------------------- + ! Menu resources giving a shadow effect on dividers. + !----------------------------------------------------- + *gterm*SimpleMenu*background: gray75 + *gterm*SimpleMenu*foreground: black + *gterm*SimpleMenu.borderWidth: 1 + *gterm*SimpleMenu.menuLabel.foreground: black + *gterm*SimpleMenu.line1.foreground: gray61 + *gterm*SimpleMenu.line2.foreground: gray91 + *gterm*SimpleMenu.line3.foreground: gray61 + *gterm*SimpleMenu.line4.foreground: gray91 + *gterm*SimpleMenu.line5.foreground: gray61 + *gterm*SimpleMenu.line6.foreground: gray91 + *gterm*SimpleMenu.line7.foreground: gray61 + *gterm*SimpleMenu.line8.foreground: gray91 + *gterm*SimpleMenu.line9.foreground: gray61 + *gterm*SimpleMenu.line10.foreground: gray91 + *gterm*SimpleMenu.line11.foreground: gray61 + *gterm*SimpleMenu.line12.foreground: gray91 + *gterm*SimpleMenu.line13.foreground: gray61 + *gterm*SimpleMenu.line14.foreground: gray91 + *gterm*SimpleMenu.line15.foreground: gray61 + + *xgConfigBar*Toggle.font: -*-times-bold-r-normal-*-10-* + *xgConfigBar*Toggle.font: 6x10 + *xgConfigBar.layout: horizontal { \ + xgAltGraph \ + 10 < +inf -inf > \ + cfgGcur \ + cfgTask0 cfgTask1 cfgTask2 cfgTask3 cfgTask4 \ + cfgTask5 cfgTask6 cfgTask7 cfgTask8 cfgTask9 \ + cfgClose \ + } + *xgAltGraph.label: Alt Graph + *xgAltGraph.location: 0 0 90 21 + *xgAltGraph.frameType: chiseled + *xgAltGraph.frameWidth: 2 + *xgAltGraph.innerOffset: 0 + *xgAltGraph.outerOffset: 0 + *xgAltGraph*font: 6x10 + *xgAltGraph.highlightColor: green + *xgAltGraph.onIcon: diamond1s + *xgAltGraph.offIcon: diamond0s + *cfgClose.label: + *cfgClose.shadowWidth: 0 + *cfgGcur.label: GCursor + + + !################################# + ! Define a alternate graph window. + !################################# + *altGraph.title: + *altGraph.width: 640 + + *agLayout*borderWidth: 0 + *agLayout.layout: vertical { \ + -1 \ + vertical { \ + horizontal { \ + 5 \ + agUserbar < +inf -inf * > \ + 5 \ + } \ + 2 \ + agGraphGroup < +inf -inf * +inf -inf > \ + 2 \ + } \ + -1 \ + } + + *agGraphGroup.outerOffset: 2 + *agGraphGroup.innerOffset: 0 + *agGraphGroup.frameType: sunken + *agGraphGroup.frameWidth: 2 + *agGraphGroup.label: + *agGraphLayout.layout: horizontal { \ + 2 < +0 -2 > \ + vertical { \ + 2 < +0 -2 > \ + agGterm < +inf -inf * +inf -inf > \ + 2 < +0 -2 > \ + } \ + 2 < +0 -2 > \ + } + *agGterm.translations: \ + !<Key>q: call(altGraphClose) \n\ + !Ctrl <Key>c: call(openDialog,command) \n\ + !Ctrl <Key>l: call(openDialog,load) \n\ + !Ctrl <Key>n: call(altGraphToggle) \n\ + !Ctrl <Key>p: call(openDialog,print) \n\ + !Ctrl <Key>s: call(logOpen) \n\ + !Ctrl <Key>t: call(tclToggle) \n\ + !Ctrl <Key>w: call(openDialog,save) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Ctrl<Btn2Down>: call(trackEnable) \n\ + !Ctrl<Btn2Motion>: track-cursor() call(wcsUpdate,$x,$y) \n\ + !Ctrl<Btn2Up>: call(trackDisable) \n\ + !Shift<Btn1Down>: popup(fileMenu) \n\ + !Shift<Btn1Up>: popdown(fileMenu) \n\ + !Shift<Btn2Down>: popup(cmMenu) \n\ + !Shift<Btn2Up>: popdown(cmMenu) call(trackDisable) \n\ + !Shift<Btn3Down>: popup(configMenu) \n\ + !Shift<Btn3Up>: popdown(configMenu) \n\ + <Motion>: track-cursor() +} + +set UIActCallbacks(Xgterm) { } +set UIDeactCallbacks(Xgterm) { } + + +################################################################################ +# Global Variables. +################################################################################ + +set track_coords 0 ;# track cursor coords in marker +set agMapped 0 ;# alt graph window is mapped +set ubMapped 1 ;# user config menubar is mapped +set curConfig none ;# current user config + +set xgtermrc "~/.xgtermrc" ;# startup config file +set winClose False ;# close window on shutdown +set configPath "./" ;# config file path +set defaultConfig none ;# startup default configuration +set cfgGcur GCursor +set cfgTask0 none +set cfgTask1 none +set cfgTask2 none +set cfgTask3 none +set cfgTask4 none +set cfgTask5 none +set cfgTask6 none +set cfgTask7 none +set cfgTask8 none +set cfgTask9 none + +set Module(arg) {} ;# user configuration files +set config(task) {} ;# task configuration array +set config(task,widget) {} ;# widget configuration array +set config(task,Realized) {} ;# module has been realized +set config(task,Activated) {} ;# module has been activated + +set gvar(var) {} ;# user-procedure global variables +set Arrow(task,N,dir) {} ;# Arrow widget configurations +set MenuButton(task,N,opt) {} ;# Menu widget configurations +set MenuItem(task,M,N,opt) {} ;# Menu widget configurations +set ToggleAction(task,M,N,opt) {} ;# Toggle widget configurations +set Toggle(task,N,opt) {} ;# Toggle widget configurations +set TextToggle(task,N,opt) {} ;# TextToggle widget configurations +set Command(task,N,opt) {} ;# Command widget configurations +set Label(task,N) {} ;# Label widget configurations +set ULayout(task) {} ;# userbar layout +set Hght(task) {} ;# userbar height + +set debug 0 ;# it ain't the same w/out a debug flag +set err_msgs "" + + +#------------ +# Constants +#------------ + +set UbarHeight 30 ;# user menubar height + +set NWidgets(Arrow) 0 ;# num of available Arrow widgets +set NWidgets(AsciiText) 1 ;# num of available Arrow widgets +set NWidgets(Label) 4 ;# num of available Label widgets +set NWidgets(MenuButton) 5 ;# num of available Menu widgets +set NWidgets(Toggle) 5 ;# num of available Toggle widgets +set NWidgets(TextToggle) 1 ;# num of available TextToggle widgets +set NWidgets(Command) 10 ;# num of available Command widgets + + +################################################################################ +# Bootstrap procedures used during the startup process. +################################################################################ + +# Given the max number of widgets we'll be using create the object definition +# for the GUI we can append to the UIObjects string before startup. + +proc BuildObjects args { + global NWidgets UIObjects UIResources + + set widgets "" + set u_layout "" + set a_layout "" + foreach B { u a } { + foreach W [ array names NWidgets ] { + for {set i 1} {$i <= $NWidgets($W) } {incr i} { + append widgets \ + [format "%sgUserbar\t%s\t%s%s%d\t" $B $W $B $W $i] + append ${B}_layout [format "%s%s%d " $B $W $i] + } + } + } + + # Append the objects to the xgterm object list. + append UIObjects(Xgterm) $widgets + + # Now add a dummy Layout for each userbar + append UIResources(Xgterm) \ + [format "*ugUserbar.layout: horizontal { %s }\n" $u_layout] + append UIResources(Xgterm) \ + [format "*agUserbar.layout: horizontal { %s }\n" $a_layout] + + # Add dummy menuName resources for each of the MenuButton widgets. + for {set i 1} {$i <= $NWidgets(MenuButton) } {incr i} { + append UIResources(Xgterm) \ + [format "*uMenuButton%d.menuName: menu%d\n" $i $i] + append UIResources(Xgterm) \ + [format "*aMenuButton%d.menuName: menu%d\n" $i $i] + } +} + + +# Load the .xgtermrc config file. +proc LoadXgtermrcFile args { + global xgtermrc defaultConfig configPath err_msgs + global cfgTask0 cfgTask1 cfgTask2 cfgTask3 cfgTask4 + global cfgTask5 cfgTask6 cfgTask7 cfgTask8 cfgTask9 + + # If we have a .xgtermrc file use it for the startup. + # the GUI resource values + set file $xgtermrc + if { [file exists $file] } { + if { [ catch {source $file} err] } { + print ".xgtermrc file read error\n$err" + append err_msgs ".xgtermrc file read error\n$err" + } + } +} + +# Read the named UI configuration file. +proc ReadConfigFile { fname args } { + + set fd [ open $fname r ] + + # Read the config file a line at a time so we can strip comments and + # blank lines to make the parsing easier. + set uidef "" + while { ! [ eof $fd ] } { + gets $fd line + + # Strip any comments and blank lines. + if { [ string first "#" $line ] >= 0 } { + set line [ string range $line 0 [ expr [string first "#" $line]-1] ] + set line [ string trimright $line ] + } + if { $line == "" } { continue } + + # Append the line to the output description. + set uidef [ format "%s\n%s" $uidef $line ] + } + + close $fd + return $uidef +} + +# Scan the config directories getting a list of User-UI files. +proc ScanConfigDirs args { + global Module configPath UIObjects UIResources UIActCallbacks + global gvar err_msgs + + set path [ format "./:%s" $configPath ] + foreach dir [ split $path : ] { + set ui_files [ glob -nocomplain [ format "%s/*.ui" $dir ] ] + foreach fil $ui_files { + set task [ file tail [ file rootname $fil ] ] + if { ! [info exists Module($task) ] } { + set Module($task) [ format "%s" $fil ] + + # Open the UI file to set any objects/resources defined. + # This will also pick up any callback procedures declared. + set text [ ReadConfigFile $fil ] + + if {[catch { eval $text } err] } { + print "'${task}.ui' file bootstrap error\n'$err'" + append err_msgs ".xgtermrc file read error\n$err" + } else { + if {[info exists Objects]} { + set UIObjects($task) $Objects + unset Objects + } + if {[info exists Resources]} { + set UIResources($task) $Resources + unset Resources + } + if {[info exists ActivateCallbacks]} { + set UIActCallbacks($task) $ActivateCallbacks + unset ActivateCallbacks + } + if {[info exists DeactivateCallbacks]} { + set UIDeactCallbacks($task) $DeactivateCallbacks + unset DeactivateCallbacks + } + } + } + } + set ui_files "" + } +} + +# Initialize the widget tree. +proc InitWidgetTree args { + global UIObjects UIResources + + # Initialize the string with the base GUI objects/resources. + set guiResources \ + [format "Xgterm*objects:%s\n%s" $UIObjects(Xgterm) $UIResources(Xgterm)] + + # Add a new objects description for each of the plugins found so we can + # create them by name later rather that with the defaults. + foreach task [array names UIObjects] { + if {$task != "Xgterm"} { + set guiResources \ + [ format "%s\n\n*%s_objects:%s\n%s" \ + $guiResources $task \ + $UIObjects($task) $UIResources($task) ] + } + } + + # Define all of the UI objects and resources. + appInitialize xgterm Xgterm $guiResources +} + +# Realize a plugin module, i.e. create it's objects and attach callbacks. +# We only do this once and set a flag to indicate the objects have been +# created so we don't do it on subsequent realizations. +proc Realize { module args } { + global config UIActCallbacks UIObjects + + if { [info exists config($module,Realized)] } { + return + } + + # Create any widgets for the module. We only do this once and set a + # flag to indicate the objects have been created so we don't do it on + # subsequent realizations. + if { [info exists UIObjects($module)] } { + createObjects [format "%s_objects" $module] + reset-server + } + + # Add any callback that are defined for procedures in the module. + if { [info exists UIActCallbacks($module)] } { + foreach cb $UIActCallbacks($module) { + eval $cb + } + } + + set config($module,Realized) 1 +} + + +# Increase the maximum number of userbar widgets to create. This procedure +# is essentially called from a UI file during the scanning and is a no-op if +# the value set is below the current max. + +proc SetMaxWidgets { type num args } { + global NWidgets + + if { [info exists NWidgets($type)]} { + if { $NWidgets($type) < $num } { + set NWidgets($type) $num + } + } else { + set NWidgets($type) $num + } +} + + + +################################################################################ +# Bootstrap the GUI. +################################################################################ + +# Load the .xgtermrc config file. +LoadXgtermrcFile + +# Scan the config directories getting a list of User-UI files. +ScanConfigDirs + +# Create the userbar widgets based on the number of widgets defined. +BuildObjects + +# Initialize the widget tree. +InitWidgetTree + +# Realize the plugins with widgets needed for the base GUI. All other +# modules have already loaded their procedures so we can automatically +# access e.g. debug print routines at this point. +Realize tclShell +Realize warning +Realize filename +Realize log + + +################################################################################ +# Crank it up... +################################################################################ + +# Create the objects and initialize the Gterm widgets in the main XGterm GUI. +# We will create the objects for plugin modules when they are realized to +# speed startup times. + +createObjects +send agGterm setGterm ; send agGterm activate +send gterm setGterm ; send gterm activate + + +# Setup the close-window button +createBitmap CloseBM 16 16 { + 0x00,0x00,0xfc,0x3f,0x02,0x60,0x02,0x50,0xf2,0x6f,0xf2,0x5f,0xf2,0x6f,0xf2, + 0x5f,0xf2,0x6f,0xf2,0x5f,0xf2,0x6f,0xf2,0x5f,0xaa,0x6a,0x54,0x55,0xfc,0x3f, + 0x00,0x00} + +send cfgClose "set bitmap CloseBM ; set foreground red4" +send cfgClose addCallback { GKey q ; deactivate unmap } + + +################################################################################ +# Menu Definitions +################################################################################ + +set fileMenuDescription { + {"File Options" f.title } + { f.dblline } + {"New Gterm window" f.exec { altGraphOpen } + sensitive {($agMapped==1) ? "false" : "true"} } + { f.dblline } + {"Print..." f.exec { Print } } + {"Print to device..." f.exec { openDialog print } } + { f.dblline } + {"Show message log" f.exec { send log map } } + {"Exec host command..." f.exec { openDialog command } } + {"Debug Tcl Shell" f.exec { tclOpen } } + { f.dblline } + {"Redraw" f.exec { GKey r } } + {"Help" f.exec { GKey ? } } + {"Quit" f.exec { Quit } } +} + +set cmMenuDescription { + {"Cursor Mode Commands" f.title } + { f.dblline } + {"Flush graphics output" f.exec { GCmd .gflush } } + {"Reset and Redraw" f.exec { GKey 0 } } + {"Draw/Label axes of viewport" f.exec { GKey A } } + { f.dblline } + {"Load metacode file" f.exec { openDialog load} } + {"Save to metacode file" f.exec { openDialog save} } + { f.dblline } + {"Backup over last instr in buffer" f.exec { GKey B } } + {"Undo last buffer edit" f.exec { GKey U } } + { f.dblline } + {"Mark cursor after read" f.exec { GCmd .markcur+ } } + {"Don't mark cursor after read" f.exec { GCmd .markcur- } } + { f.dblline } + {"Draw axes at redraw" f.exec { GCmd .axes+ } } + {"Don't draw axes at redraw" f.exec { GCmd .axes- } } + { f.dblline } + {"Show cursor mode help" f.exec { GCmd .? } } +} + +set configMenuDescription { + {"GUI Configuration Options" f.title } + { f.dblline } + {"Add current config to menubar" f.exec { } } + {"Rescan .xgtermrc file" f.exec { } } + {"Save to .xgtermrc file" f.exec { } } + {"Load UI config file" f.exec { } } +} + +createMenu fileMenu gterm $fileMenuDescription +createMenu fileMenu agGterm $fileMenuDescription +createMenu cmMenu gterm $cmMenuDescription +createMenu cmMenu agGterm $cmMenuDescription +createMenu configMenu gterm $configMenuDescription +createMenu configMenu agGterm $configMenuDescription + + + +################################################################################ +# Utility Callbacks +################################################################################ + +# Procedures for sending client cursor commands. +proc GKey { key args } { send client gkey $key } +proc GCmd args { send client gcmd $args } + +# Wrapper routine to execute a callback command while ignoring the extra +# arguments from the widget such as widget name, mode, etc. +proc Exec { cmd args } { eval $cmd } + +# Procedures to test True/False strings in resources. +proc true { v } \ + { expr { $v=="true" || $v=="True" || $v=="TRUE" || $v==1 || $v=="yes" } +} +proc false { v } \ + { expr { $v=="false" || $v=="False" || $v=="FALSE" || $v==0 || $v=="no" } +} + +# No-op procedure for text widgets with no callbacks to swallow newline. +proc noop args { } + +# Common functions. +proc min { a b } { expr {($a < $b) ? $a : $b} } +proc max { a b } { expr {($a > $b) ? $a : $b} } + +# Dereference a variable. E.g. in we define vars x[1-5] and want to use them +# in a loop later we can't simply access "$x$i" to get the value of '$x1', +# instead we use "[GetVal x$i]" to return the value of '$x1'. 'GV' is the +# shorthand version. + +proc GetVal { in } { upvar $in out ; return $out } +proc GV { in } { upvar #0 $in out ; return $out } + + + +################################################################################ +# Generic Menubar Widget Callbacks +################################################################################ + +proc CommandCB { widget args } { + global Command curConfig + + scan $widget "%1sCommand%d" bar num + set task [GV $curConfig] + eval $Command($task,$num,cmd) +} + +proc ToggleCB { widget type state args } { + global ToggleAction curConfig + + scan $widget "%1sToggle%d" bar num + set task [GV $curConfig] + if {$state == 1} { + eval $ToggleAction($task,Toggle$num,on,cmd) + } else { + eval $ToggleAction($task,Toggle$num,off,cmd) + } +} + +proc ArrowCB { widget args } { + global Arrow curConfig + + scan $widget "%1sArrow%d" bar num + set task [GV $curConfig] + eval $Arrow($task,$num,cmd) +} + +proc AsciiTextCB { widget mode text args } { +print $args +} + +proc TextToggleCB { widget type state args } { + global ToggleAction curConfig + + scan $widget "%1sToggle%d" bar num + set task [GV $curConfig] + if {$state == 1} { + eval $ToggleAction($task,Toggle$num,on,cmd) + } else { + eval $ToggleAction($task,Toggle$num,off,cmd) + } +} + + +# Now attach all the callbacks. +foreach w [ array names NWidgets ] { + for {set i 1} {$i <= $NWidgets($w)} {incr i} { + if {$w != "MenuButton"} { + send u$w$i addCallback ${w}CB ; send a$w$i addCallback ${w}CB + } + } +} + + + +################################################################################ +# Standard Keystroke Procedures +################################################################################ + +proc Print args { GKey = ; GCmd .gflush } +proc Redraw args { GKey r } +proc Help args { GKey ? } +proc Quit args { + global winClose + GKey q + if {$winClose == 1} { deactivate unmap } +} + + + +################################################################################ +# Initialize the XGterm GUI. +################################################################################ + +proc Initialize args { + global ubMapped UbarHeight + global xgtermrc defaultConfig configPath + global cfgTask0 cfgTask1 cfgTask2 cfgTask3 cfgTask4 + global cfgTask5 cfgTask6 cfgTask7 cfgTask8 cfgTask9 + + + # Edit the configuration menu. + editConfigMenu + + # If we're not starting up with a configuration unmap the userbar. The + # alt graph userbar is always unmapped at the start. + if { $defaultConfig == "none" } { + set h [ send toplevel get height ] + send toplevel set height [ expr {$h - $UbarHeight} ] + send xgUBFrame "unmap ; set height 0" + set ubMapped 0 + } + set h [ send altGraph get height ] + send altGraph set height [ expr {$h - $UbarHeight} ] + send agUserbar "unmap ; set height 0" + + # Initialize the rest of the GUI. + initConfigBar +} + + +# Save the .xgtermrc config file. +proc saveXgtermrcFile { cfname args } { + global defaultConfig configPath + global cfgTask0 cfgTask1 cfgTask2 cfgTask3 cfgTask4 + global cfgTask5 cfgTask6 cfgTask7 cfgTask8 cfgTask9 + + set fd [open $cfname w] + + puts fd "# .xgtermrc -- XGterm Uber-GUI configuration file." + puts fd "" + puts fd "# Set the config directory paths. This will always include the" + puts fd "# current directory by default, other directories are specified" + puts fd "# as a colon-delimited list of directories to be searched. " + puts fd "# Environment variables may be used in the specification of each" + puts fd "# path (e.g. $HOME/.xgterm)" + puts fd "" + puts fd "set configPath\t\t"$configPath + puts fd "set defaultConfig\t"$defaultConfig + puts fd "" + puts fd "# Define the tasks to be installed on the configuration bar. " + puts fd "# Up to 10 tasks may be specified in variables "cfgTask[0-9]"," + puts fd "# a value of "none" means that no task is configured on that" + puts fd "# widget and it will not be shown." + puts fd "" + for {set i 0} {$i < 10} {incr i} { + puts fd "set cfgTask$i\t" [send cfgTask$i get label] + } + close fd +} + + +################################################################################ +# Configure bar procedures. +################################################################################ + +# Initialize the config bar widgets. +proc initConfigBar args { + global cfgTask0 cfgTask1 cfgTask2 cfgTask3 cfgTask4 + global cfgTask5 cfgTask6 cfgTask7 cfgTask8 cfgTask9 + + for {set i 0} {$i < 10} {incr i} { + cfgButtonMap cfgTask$i [GetVal cfgTask$i] + } +} + +proc cfgButtonMap { w v args } { + global Module + + if { $v == "none" } { + send $w "unmap ; set width 0" + } else { + if { [info exists Module($v)] } { + send $w set label $v + } else { + send $w { set label " " ; setSensitive false } + } + } +} + +# Edit the user-GUI configuration menu. +proc editConfigMenu args { + global Module configMenuDescription + + set desc $configMenuDescription + + if { [ llength [ array names Module ] ] > 1 } { + lappend desc " f.dblline " + lappend desc " f.dblline " + lappend desc " \"Task UI File\" f.exec \{ \}" + lappend desc " f.dblline " + lappend desc " \"GCursor <builtin>\" f.exec \{ loadModule Gcur \}" + } + + foreach n [ lsort [ array names Module ] ] { + if { $n != "arg" } { + set lab [ format "%-10s %s" $n $Module($n) ] + lappend desc " \"$lab\" f.exec \{ loadModule $Module($n) \}" + } + } + editMenu configMenu gterm $desc + editMenu configMenu agGterm $desc +} + + +#----------------------- +# User-GUI command bar. +#----------------------- + +set configWidgets { + cfgGcur + cfgTask0 cfgTask1 cfgTask2 cfgTask3 cfgTask4 + cfgTask5 cfgTask6 cfgTask7 cfgTask8 cfgTask9 +} + +proc userbarCB { widget type state args } { + userbarToggle $widget $state +} ; foreach w $configWidgets { send $w addCallback userbarCB } + +proc userbarToggle { widget state args } { + global Module ubMapped curConfig UbarHeight + + set st $state + set task [GV $widget] + + # If state is 2 we're being called to toggle a specific widget and not + # as a callback for the toggle itself. + if { $state == 2 } { + if { ! [send $widget get sensitive] } { + return + } + if { $ubMapped == 1 } { + set st 0 + send $curConfig set state 0 + send $curConfig set background gray80 + send $curConfig set foreground black + set config($curConfig,Activated) 0 + } else { + set st 1 + send $widget set state on + } + } + + # We're switching toggles, so first turn off the existing button. + if { $curConfig != "none" && $curConfig != $widget} { + send $curConfig set state 0 + send $curConfig set background gray80 + send $curConfig set foreground black + set config($curConfig,Activated) 0 + } + + # If we're turning on a toggle configure the userbar and display it, + # otherwise close the userbar. + if { $st == 1 } { + if { $ubMapped == 0 } { + set h [ send toplevel get height ] + send toplevel set height [ expr {$h + $UbarHeight} ] + send xgUBFrame "map ; set height $UbarHeight" + } + + # Load the configuration file. + set task [ send $widget get label ] + if { [info exists Module($task)] } { + # Configure the uBFrame with the GUI. + Config $task ugUserbar + } else { + send $widget set state 0 + Wexec warning [ format "'%s' not defined" $task ] + } + + send $widget set background black + send $widget set foreground gray90 + set ubMapped 1 + + } elseif { $st == 0 } { + send xgUBFrame "unmap ; set height 0" + set h [ send toplevel get height ] + send toplevel set height [ expr {$h - $UbarHeight} ] + send $widget set background gray80 + send $widget set foreground black + set ubMapped 0 + } + set curConfig $widget +} + + + +################################################################################ +# Userbar Button Procedures. +################################################################################ + +# Callback for a GUI Parameter to automatically set the configuration from +# the client when available. + +proc setConfiguration { param old new } { + Config $new xgUserbar +} ; send configure addCallback setConfiguration + + +# Configure the user menubar for a particular UI definition. + +proc Config { task menubar args } { + global debug config curConfig + global Hght ULayout + + # If we haven't already loaded this configuration read it now and store + # it in the config struct. + if { ! [ info exists config($task) ] } { + ParseTaskConfig $task + } + + # Now map all of the widgets We will be using for this configuration, + # unmap the rest. + MapUserbarWidgets $task $menubar + + # Edit the Layout with the widget names + set layout [ EditLayout $task $menubar ] + send $menubar set layout $layout + + # Set all the callbacks associated with this menubar, and Realize + # any objects defined for the module. + BuildConfigMenus $task ugUserbar + Realize $task + + # Set the userbar Height. + send $menubar set height $Hght($task) + + # Finally, map the userbar to see what we get. + send $menubar map + + # Keep track that we're active. + set config($task,Activated) 1 +} + + +# Map all of the widgets for the given menubar. We also set any resources +# that were specified such as bg/fg colors, frame type/width, etc. + +proc MapUserbarWidgets { task bar args } { + global NWidgets config + + if {[catch { + if { $bar == "ugUserbar" } { set b u } else { set b a } + + foreach widget [ array names NWidgets ] { + global $widget + + for {set i 1} {$i <= $NWidgets($widget)} {incr i} { + if { [info exists config($task,${widget}${i})] } { + send ${b}${widget}${i} map + if { $widget != "Arrow" } { + send ${b}${widget}${i} \ + set label [GV ${widget}($task,$i,label)] + } + if { $widget == "TextToggle" } { + if {[info exists TextToggle($task,$i,ftype)]} { + send ${b}${widget}${i} \ + set frameType [GV ${widget}($task,$i,ftype)] + } + if {[info exists TextToggle($task,$i,fwidth)]} { + send ${b}${widget}${i} \ + set frameWidth [GV ${widget}($task,$i,fwidth)] + } + if {[info exists TextToggle($task,$i,icon)]} { + send ${b}${widget}${i} \ + set onIcon \ + [format "%s1s" [GV ${widget}($task,$i,icon)] ] + send ${b}${widget}${i} \ + set offIcon \ + [format "%s0s" [GV ${widget}($task,$i,icon)] ] + } + if {[info exists TextToggle($task,$i,width)]} { + send ${b}${widget}${i} \ + set width [GV ${widget}($task,$i,width)] + } else { + set width \ + [string length [GV ${widget}($task,$i,label)]] + set width [expr { 7 * $width + 35} ] + send ${b}${widget}${i} set width $width + } + } + if {[info exists ${widget}($task,$i,bg)]} { + send ${b}${widget}${i} \ + set background [GV ${widget}($task,$i,bg)] + } + if {[info exists ${widget}($task,$i,fg)]} { + send ${b}${widget}${i} \ + set foreground [GV ${widget}($task,$i,fg)] + } + if {[info exists ${widget}($task,$i,width)]} { + send ${b}${widget}${i} \ + set width [GV ${widget}($task,$i,width)] + } + if {[info exists ${widget}($task,$i,height)]} { + send ${b}${widget}${i} \ + set height [GV ${widget}($task,$i,height)] + } + } else { + send ${b}${widget}${i} unmap + } + } + } + } err]} { + print "MapUserbarWidgets: '$err'" + } +} + + +# Activate all callbacks associated with a particular userbar configuration. +proc BuildConfigMenus { task bar args } { + global NWidgets config debug + + if {[catch { + if { $bar == "ugUserbar" } { set b u } else { set b a } + + global MenuButton + + for {set i 1} {$i <= $NWidgets(MenuButton)} {incr i} { + if {[info exists MenuButton($task,$i,label)]} { + BuildUIMenu $b $i $task + } + } + } err]} { + print "BuildConfigmenus($task): '$err'" + } +} + + +# Build the menu for a particular widget from the UI configuration. +proc BuildUIMenu { bar N task args } { + global MenuButton MenuItem + + # Set the parent menu widget + set w MenuButton$N + + if {[info exists $MenuButton($task,$N,label)]} { + set label [GV $MenuButton($task,$N,label)] + send $bar$w set label $label + } + + set menu_items {} + for {set i 1} {[info exists MenuItem($task,$w,$i,label)]} {incr i} { + set line "" + set label $MenuItem($task,$w,$i,label) + set cmd $MenuItem($task,$w,$i,cmd) + if {[info exists MenuItem($task,$w,$i,sensitive)]} { + set sensitive $MenuItem($task,$w,$i,sensitive) + } + if {[info exists MenuItem($task,$w,$i,bitmap)]} { + set bitmap $MenuItem($task,$w,$i,bitmap) + } + + switch $cmd { + f.line { lappend menu_items " f.line " } + f.dblline { lappend menu_items " f.dblline " } + f.title { set title [ format " \"%s\" f.title " $label ] + lappend menu_items " f.dblline " } + default { lappend menu_items " \"$label\" f.exec \{ $cmd \}" + } + } + + # Reset so we don't keep a sensitive/bitmap on the next item. + catch { unset $label $cmd $sentive $bitmap } + } + + # Finally, attach the menu to the widget. + editMenu menu$N $bar$w $menu_items +} + + +# Edit the Layout for the configuration with the actual widget names to be used. +proc EditLayout { task bar args } { + global ULayout NWidgets + + if {[catch { + if { $bar == "ugUserbar" } { set b u } else { set b a } + + set layout $ULayout($task) + foreach widget [ array names NWidgets ] { + regsub -all $widget $layout ${b}${widget} layout + } + + # Kludge around the TextToggle which may have been changed because + # of editing Toggle. + regsub -all Text${b} $layout ${b}Text layout + + } err]} { + print "EditLayout: '$err'" + } + + return $layout +} + + +# Given the task name, read in the UI configuration and store it in the +# global structures. The 'config' struct defines which task/widgets are +# available but because of the need to access a global array by a known +# name the config values are stored according to widget type, indexed by +# the task. + +proc ParseTaskConfig { task args } { + global debug Module config UbarHeight NWidgets + global Hght ULayout gvar + + # Read in the UI configuration file and eval-uate it to define local + # variables for the widgets. We'll look through the list of variables + # defined and send those off to be parsed for the given configuration. + # The UI file may also contain user-defined procedures that will + # persist for the rest of the GUI and may be called as callbacks for + # the widgets. + + set err "" + if {[catch { eval [ ReadConfigFile $Module($task) ] } err] } { + Wexec warning "file '$Module($task)':\n$err'" + } + + + # We now have defined as local variables the Menu/Toggle/etc widgets. + # For each of these convert to an element in the config structs, trap + # any errors. + + if {[catch { + + foreach widget [ array names NWidgets ] { + for { set i 1 } { $i <= $NWidgets($widget) } { incr i } { + if { [ info exists $widget$i ] } { + setWidgetSpec $task $widget $i [GetVal $widget$i] + } + } + } + + # Lastly, get the userbar Layout and Height if specified. It is an + # error to not specify the Layout, Height will default to a one-row + # widget height. + + if { [ info exists Layout ] } { + set ULayout($task) $Layout + } else { + Wexec warning "Config Error:\n'$task': No Layout specified" + } + + if { [ info exists Height ] } { + set Hght($task) $Height + } else { + set Hght($task) $UbarHeight + } + + if { $debug == 1 } { ;# debug print + puts "${task}.Layout" + puts " $ULayout($task)" + puts "${task}.Height" + puts " $Hght($task)" + } + + } err] } { + Wexec warning "file '$Module($task)':\n$err'" + } + + set config($task) 1 +} + + +# Parse a widget definition. +proc setWidgetSpec { task widget indx args } { + global config + + # Let us know which button was defined. + set config($task,$widget$indx) 1 + + # Assume the command is the first string. + regsub -all "=" $args " " new + set entry [lindex $new 0] + + set w $widget ;# shorthad variables + set t $task + set nitems 0 ;# number of menu items + global $w + + # Loop through each of the items in the list which will be ordered as + # either a keyword or a value. The outer loop should reach only known + # keywords, within the case we pick up the optional value, otherwise + # we ignore it. For now we don't check that the keyword is correct for + # the widget, the space used should be negligible and won't be referenced + # anyway. + + for { set i 0 } { $i < [llength $entry] } { incr i } { + switch [lindex $entry $i] { + lab - + label { set ${w}($t,$indx,label) [lindex $entry [incr i] ] + } + cmd - + command { set ${w}($t,$indx,cmd) [lindex $entry [incr i] ] + } + alt - + altgraph { set ${w}($t,$indx,altgraph) 1 + } + close - + closeKeys { set ${w}($t,$indx,closeKeys) [lindex $entry $i ] + } + config { set ${w}($t,$indx,config) [lindex $entry [incr i] ] + } + prompt { set ${w}($t,$indx,prompt) [lindex $entry [incr i] ] + } + dir - + direction { set ${w}($t,$indx,dir) [lindex $entry [incr i] ] + } + item { set wn ${w}${indx} + setActionSpec $t $wn \ + [incr nitems] [lindex $entry [incr i] ] + } + onAct - + onAction { set wn ${w}${indx} + setActionSpec $t $wn on [lindex $entry [incr i] ] + } + offAct - + offAction { set wn ${w}${indx} + setActionSpec $t $wn off [lindex $entry [incr i] ] + } + ftype - + frameType { set ${w}($t,$indx,ftype) [lindex $entry [incr i] ] + } + fwidth - + frameWidth { set ${w}($t,$indx,fwidth) [lindex $entry [incr i] ] + } + bg - + background { set ${w}($t,$indx,bg) [lindex $entry [incr i] ] + } + fg - + foreground { set ${w}($t,$indx,fg) [lindex $entry [incr i] ] + } + width { set ${w}($t,$indx,width) [lindex $entry [incr i] ] + } + height { set ${w}($t,$indx,height) [lindex $entry [incr i] ] + } + icon { set ${w}($t,$indx,icon) [lindex $entry [incr i] ] + } + default { print "unknown entry: " [lindex $entry $i ] + } + } + } + printWidgetSpec $task $widget $indx ;# Debug print (temporary). +} + +# Parse a MenuItem or ToggleAction definition. +proc setActionSpec { task widget item args } { + global config + + # Let us know which button was defined. + set config($task,$widget$item) 1 + + # Assume the command is the first string. + regsub -all "=" $args " " new + set entry [lindex $new 0] + + set w $widget ;# shorthand variables + set t $task + if { [ string match Menu* $widget ] } { + set W MenuItem + } else { + set W ToggleAction + } + global $W + + for { set i 0 } { $i < [llength $entry] } { incr i } { + switch [lindex $entry $i] { + alt - + altgraph { set ${W}($t,$w,$item,altgraph) 1 + } + close - + closeKeys { set ${W}($t,$w,$item,closeKeys) [lindex $entry $i] + } + cmd - + command { set ${W}($t,$w,$item,cmd) [lindex $entry [incr i] ] + } + config { set ${W}($t,$w,$item,config) [lindex $entry [incr i] ] + } + lab - + label { set ${W}($t,$w,$item,label) [lindex $entry [incr i] ] + } + prompt { set ${W}($t,$w,$item,prompt) [lindex $entry [incr i] ] + } + sens - + sensitive { set ${W}($t,$w,$item,sensitive) [lindex $entry [incr i]] + } + bitmap { set ${W}($t,$w,$item,bitmap) [lindex $entry [incr i] ] + } + f.line - + f.dblline { set ${W}($t,$w,$item,label) "" + set ${W}($t,$w,$item,cmd) [lindex $entry $i] + } + f.title { set ${W}($t,$w,$item,cmd) [lindex $entry $i] + } + default { print "unknown item entry: " [lindex $entry $i] + } + } + } + printItemSpec $task $W $w $item ;# Debug print (temporary). +} + + + +################################################################################ +# Define a WCS box to track coords +################################################################################ + +proc trackEnable args { + global track_coords agMapped + set track_coords 1 + set parentGterm [ expr { ($agMapped == 1) ? "agGterm" : "gterm" } ] + + send $parentGterm set dialogBgColor black + send $parentGterm set dialogFgColor black + makeWCSMarker $parentGterm +} + +proc trackDisable args { + global track_coords agMapped + set track_coords 0 + set parentGterm [ expr { ($agMapped == 1) ? "agGterm" : "gterm" } ] + + send wcsbox destroy + send tclCoords set label "" + + send $parentGterm set dialogBgColor yellow + send $parentGterm set dialogFgColor black +} + +proc trackCoords { param old new } { + global track_coords + + if {$track_coords == 1} { + scan $new "%f %f" nx ny + set text [ format "x = %-7.2f y = %-7.2f " $nx $ny ] + send wcsbox "set text \{$text\}; redraw noerase" + } +} ; send textout addCallback trackCoords + +proc makeWCSMarker { parent args } { + send $parent createMarker wcsbox { + type text + createMode noninteractive + width 25ch + height 1ch + lineWidth 0 + imageText true + textBgColor black + textColor yellow + visible false + } + + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send $parent parseGeometry "-5-5" $defGeom x y width height + + send wcsbox setAttributes \ + x $x \ + y $y \ + activated true \ + visible true \ + sensitive true +} + +# Update the wcsbox marker with the current window position. +proc wcsUpdate {x y} \ +{ + global track_coords + + # Update Tcl coords box. + send tclCoords set label \ + [ format "Screen Cursor: x = %-7.2f y = %-7.2f " $x $y ] + + if {$track_coords == 1} { GKey C } +} + + +################################################################################ +# Procedures used by the alternate graph window. +################################################################################ + +proc altGraphOpen args { + global agMapped fileMenuDescription + + send gterm setSensitive false + send gterm setCursorType idle + send agGterm setCursorType ginMode + send agGterm setGterm + GKey 0 + send altGraph map + set agMapped 1 + + editMenu fileMenu gterm $fileMenuDescription + editMenu agFileMenu agGterm $fileMenuDescription +} + +proc altGraphClose args { + global agMapped fileMenuDescription + + send altGraph unmap + send gterm setSensitive true + send gterm setCursorType ginMode + send gterm setGterm + GKey 0 + set agMapped 0 + + editMenu fileMenu gterm $fileMenuDescription + editMenu agFileMenu agGterm $fileMenuDescription +} + +proc altGraphToggle args { + global agMapped + + if { $agMapped == 1 } { altGraphClose + } else { altGraphOpen } +} + +proc altGraphCB { widget type state args } { + global agMapped + + if { $state == 1 } { altGraphOpen + } else { altGraphClose } +} ; send xgAltGraph addCallback altGraphCB + + +################################################################################ +# Now that we've done it all, Initialize and start up the GUI. +################################################################################ +activate +Initialize |