home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.x
- Path: uunet!think.com!mips!msi!dcmartin
- From: mab@ecmwf.co.uk (Baudouin Raoult)
- Subject: v16i148: hyperwidget & manual browser, Part06/06
- Message-ID: <1992Mar6.204910.8897@msi.com>
- Originator: dcmartin@fascet
- Sender: dcmartin@msi.com (David C. Martin - Moderator)
- Organization: Molecular Simulations, Inc.
- References: <csx-16i143-hman@uunet.UU.NET>
- Date: Fri, 6 Mar 1992 20:49:10 GMT
- Approved: dcmartin@msi.com
-
- Submitted-by: mab@ecmwf.co.uk (Baudouin Raoult)
- Posting-number: Volume 16, Issue 148
- Archive-name: hman/part06
-
- #!/bin/sh
- # this is part 5 of a multipart archive
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file Imakefile continued
- #
- CurArch=5
- if test ! -r s2_seq_.tmp
- then echo "Please unpack part 1 first!"
- exit 1; fi
- ( read Scheck
- if test "$Scheck" != $CurArch
- then echo "Please unpack part $Scheck next!"
- exit 1;
- else exit 0; fi
- ) < s2_seq_.tmp || exit 1
- echo "x - Continuing file Imakefile"
- sed 's/^X//' << 'SHAR_EOF' >> Imakefile
- X
- X# If you use an ANSI compiler, you can remove this line
- X
- XPROTO_DEFINES=-D_NO_PROTO
- X
- XPROGRAMS = hman
- XSRCS = Hyper.c cbacks.c hman.c lex.yy.c
- XOBJS = Hyper.o cbacks.o hman.o lex.yy.o
- X
- XMOTIF_INCS=$(MOTIF_HOME)/include
- XMOTIF_LIBS=$(MOTIF_HOME)/lib
- X
- XEXTRA_LOAD_FLAGS=-L$(MOTIF_LIBS)
- XEXTRA_LIBRARIES=-lMrm -lXm -lXt -lX11
- XEXTRA_INCLUDES = -I$(MOTIF_INCS)
- X
- X
- X
- XComplexProgramTarget(hman)
- XInstallAppDefaults(HMan)
- X
- Xlex.yy.c: hman.lex
- X $(LEX) hman.lex
- X
- Xclean::
- X $(RM) lex.yy.c
- X
- SHAR_EOF
- echo "File Imakefile is complete"
- chmod 0644 Imakefile || echo "restore of Imakefile fails"
- set `wc -c Imakefile`;Sum=$1
- if test "$Sum" != "598"
- then echo original size 598, current size $Sum;fi
- echo "x - extracting Makefile.noimake (Text)"
- sed 's/^X//' << 'SHAR_EOF' > Makefile.noimake &&
- X#
- X# Edit these variables
- X#
- X
- XMOTIF_CFLAGS=-D_NO_PROTO -I/vol/motif/include -I/usr/local/include
- X
- XCFLAGS=-O -DUSE_REGEXP -DMOTIF $(MOTIF_CFLAGS)
- XLDFLAGS=-L/vol/motif/lib
- XLIB=-lMrm -lXm -lXt -lX11
- X
- XOBJ = hman.o cbacks.o lex.yy.o Hyper.o
- X
- Xhman : $(OBJ)
- X $(CC) -o hman $(OBJ) $(LDFLAGS) $(LIB)
- X
- Xlex.yy.c : hman.lex
- X lex hman.lex
- X
- SHAR_EOF
- chmod 0644 Makefile.noimake || echo "restore of Makefile.noimake fails"
- set `wc -c Makefile.noimake`;Sum=$1
- if test "$Sum" != "326"
- then echo original size 326, current size $Sum;fi
- echo "x - extracting README (Text)"
- sed 's/^X//' << 'SHAR_EOF' > README &&
- XThis package contains two products:
- X
- X- The HyperWidget, a hypertext-like widget that displays
- Xtext with highlighted text. Clicking on highlighted text will
- Xcall a callback function of the application using the widget.
- X
- X- hman, a unix manual using the HyperWidget to browse through
- Xthe manual pages.
- X
- XFeel free to use the widget in any application. I use it
- Xfor the on-line help of my applications.
- X
- XThe HyperWidget is using regexp. If you don't have it
- Xremove the USE_REGEXP flag when compiling.
- X
- X
- XB.Raoult ( mab@ecmwf.co.uk )
- X
- XFri Nov 22 1991
- SHAR_EOF
- chmod 0644 README || echo "restore of README fails"
- set `wc -c README`;Sum=$1
- if test "$Sum" != "545"
- then echo original size 545, current size $Sum;fi
- echo "x - extracting HMan.ad (Text)"
- sed 's/^X//' << 'SHAR_EOF' > HMan.ad &&
- X! Generated by X-Designer
- X
- X! find
- XHMan*find.title: Find...
- X
- X! find_form
- X
- X! close
- XHMan*close.labelString: Close
- X
- X! find_next
- XHMan*find_next.labelString: Find next
- X
- X
- X! selection
- XHMan*selection.title: Choose a manual file
- X
- X
- X! top
- X
- X! form
- XHMan*form.width: 526
- XHMan*form.height: 668
- X
- X! scrollw
- X
- X! widget27
- X
- X! keyword
- XHMan*keyword.labelString: Key word:
- X
- X! section
- XHMan*section.labelString: Section:
- X
- X! section_text
- X
- X! in_index
- XHMan*in_index.labelString: In index
- X
- X! previous
- XHMan*previous.labelString: <<
- X
- X! next
- XHMan*next.labelString: >>
- X
- X! quit
- XHMan*quit.labelString: Quit
- X
- X! clone
- XHMan*clone.labelString: Clone
- X
- X! other
- XHMan*other.labelString: Other...
- X
- X! search
- X
- SHAR_EOF
- chmod 0644 HMan.ad || echo "restore of HMan.ad fails"
- set `wc -c HMan.ad`;Sum=$1
- if test "$Sum" != "663"
- then echo original size 663, current size $Sum;fi
- echo "x - extracting hman.man (Text)"
- sed 's/^X//' << 'SHAR_EOF' > hman.man &&
- X.\" @(#)hman.1 1.0 91/10/20
- X.TH HMAN 1
- X
- X.SH NAME
- X hman - hypertext like manual.
- X.SH SYNOPSIS
- X hman [xtoolkit-options] [-file fname] [man-options]
- X.SH DESCRIPTION
- XI wrote this piece of software just to give show how
- Xto use the HyperWidget(3X).
- XIt displays an manual page and highlight the
- Xreferences to other Unix commands. Clicking on the highlighted text will
- Xdisplay the new manual page.
- X.LP
- XYou can type the key word/section you are looking for in the appropriate text field.
- XPressing the enter key will then display the new manual page.
- XIf
- X.I In index
- Xtoggle is on, the display is the output of the man -k .. command.
- X.LP
- XAn history of the 100 last pages displayed is kept in memory and you
- Xcan recall theses pages with the "<<" and ">>" buttons.
- X.LP
- XThe
- X.I Other
- Xbutton opens a file as a manual page.
- X.LP
- XThe
- X.I Clone
- Xbutton starts a new copy of hman.
- X.LP
- XThe
- X.I Search
- Xbutton searches a regular expression in the text.
- X.SH OPTIONS
- X.IR xtoolkit-options :
- Xthe standard X/Motif stuff (-display, -xrm ...)
- X.LP
- X.IR man-options:
- Xuse the same option as your local
- X.BR man (1)
- Xcommand.
- X.LP
- X.IR -file
- Xfilename : reads manual page from file.
- X.SH X RESOURCES
- X.IR HMan*Hyper*zoomEffect:
- X(on/off, default on) open a new page with a "zoom" effect.
- X.LP
- X.IR HMan*Hyper*zoomSpeed:
- X(integer, default 4) the speed of the zoom effect.
- X.LP
- X.IR HMan*Hyper*highlightFont:
- X(default "fixed") the font used for the highlighted text.
- X.LP
- X.IR HMan*Hyper*normalFont:
- X(default "fixed") the font used for the normal text.
- X.LP
- X.IR HMan*Hyper*highlightColor:
- X(default "red") the color used for the highlighted text.
- X.LP
- X.IR HMan*Hyper*normalColor:
- X(default "black") the color used for the normal text.
- X.LP
- X.IR HMan*Hyper*selectColor:
- X(default "blue") the color used to select text.
- X.LP
- X.IR HMan*Hyper*margin:
- X(integer, default 10) the text margins.
- X.LP
- XAnd the usual Motif resources.
- X.SH SEE ALSO
- X.BR man (1),
- X.BR nroff (1),
- X.BR troff (1),
- X.BR whatis (1)
- X.SH BUGS
- XIf the man command split a reference over two lines, hman does not recognize it.
- Xhman was only tested on a Sun.
- X.SH AUTHOR
- XBaudouin Raoult (mab@ecmwf.co.uk) October 91, with the help of XDesigner 1.2
- X.SH NOTE
- XThere is no warranty for this program.
- Xhman is in the public domain.
- X
- SHAR_EOF
- chmod 0644 hman.man || echo "restore of hman.man fails"
- set `wc -c hman.man`;Sum=$1
- if test "$Sum" != "2226"
- then echo original size 2226, current size $Sum;fi
- echo "x - extracting hman.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > hman.h &&
- X/*
- X chars used to tell the HyperWidget the start
- X and end of highlited words
- X*/
- X
- X#define START_OF_HIGHLIGHT 1
- X#define END_OF_HIGHLIGHT 2
- SHAR_EOF
- chmod 0644 hman.h || echo "restore of hman.h fails"
- set `wc -c hman.h`;Sum=$1
- if test "$Sum" != "147"
- then echo original size 147, current size $Sum;fi
- echo "x - extracting HyperWidget.3x (Text)"
- sed 's/^X//' << 'SHAR_EOF' > HyperWidget.3x &&
- X.\" @(#)HyperWidget.3x 1.0 91/10/20
- X.TH HyperWidget 3X
- X
- X.SH NAME
- X HyperWidget - hypertext widget.
- X.SH SYNOPSIS
- X #include "Hyper.h"
- X.SH DESCRIPTION
- XHyperWidget is a widget that can display a text and
- Xhighlight some part of this text. The user can click on the
- Xhighlighted parts. An activate callback is then called, reporting
- Xto the application the text selected.
- X.LP
- XHyperWidget inherits behavior and resources from Core(3X) and XmPrimitive(3X).
- X.LP
- XThe class pointer is hyperWidgetClass.
- X.LP
- XThe class name is Hyper.
- X.LP
- X.SH RESOURCES
- X.LP
- X.SS "New resources"
- X.ft B
- X.IR XtNzoomEffect - XtCZoom - XtRBoolean:
- X.LP
- X(on/off, default on) "zoom" effect when a word is selected.
- X.ft R
- X.LP
- X.ft B
- X.IR XtNzoomSpeed - XtCZoomSpeed - XtRInt:
- X.LP
- X(integer, default 4) the speed of the zoom effect.
- X.ft R
- X.LP
- X.ft B
- X.IR XtNhighlightFont - XtCFont - XtRFontStruct:
- X.LP
- X(default "fixed") the font used for the highlighted text.
- X.ft R
- X.LP
- X.ft B
- X.IR XtNnormalFont - XtCFont - XtRFontStruct:
- X.LP
- X(default "fixed") the font used for the normal text.
- X.ft R
- X.LP
- X.ft B
- X.IR XtNhighlightColor - XtCColor - XtRPixel:
- X.LP
- X(default "red") the color used for the highlighted text.
- X.ft R
- X.LP
- X.ft B
- X.IR XtNselectColor - XtCColor - XtRPixel:
- X.LP
- X(default "blue") the color used to select text.
- X.ft R
- X.LP
- X.ft B
- X.IR XtNnormalColor - XtCColor - XtRPixel:
- X.LP
- X(default "black") the color used for the normal text.
- X.ft R
- X.LP
- X.ft B
- X.IR XtNmargin - XtCMargin - XtRInt:
- X.LP
- X(integer, default 10) the text margins.
- X.ft R
- X.LP
- X.ft B
- X.IR XtNstartHighlight - XtCTagChar - XtRUnsignedChar:
- X.LP
- X(unsigned char, default '{') the character that marks
- Xthe start of the highlighted text.
- X.ft R
- X.LP
- X.ft B
- X.IR XtNendHighlight - XtCTagChar - XtRUnsignedChar:
- X.LP
- X(unsigned char, default '}') the character that marks
- Xthe end of the highlighted text.
- X.ft R
- X.LP
- X.ft B
- X.IR XtNactivateCallback - XtCCallback - XtRCallback:
- X.LP
- X(callback, default none) the callback to call when a word is selected.
- X.ft R
- X.LP
- X.SS "New resources"
- X.LP
- XAll resources from Core(3X) and XmPrimitive(3X).
- X.SH CALLBACK
- X.LP
- X.ft B
- X.nf
- X#define HYPER_REASON 1
- X
- Xtypedef struct {
- X int reason; /* always = HYPER_REASON */
- X XEvent *event; /* event */
- X char *text; /* pointer on highlighted text */
- X int length; /* length of selected text */
- X} hyperCallbackStruct;
- X.ft R
- X
- X.SH FUNCTIONS
- X.LP
- X.nf
- X.ft B
- X- Widget CreateHyper(Widget parent,
- X char *name,
- X ArgList al,
- X int ac);
- X.fi
- X.LP
- X.I CreateHyper
- Xcreates an new HyperWidget.
- X.ft R
- X.LP
- X.nf
- X.ft B
- X- void HyperLoadFile(Widget widget,
- X char *fname);
- X.fi
- X.LP
- X.I HyperSetText
- Xsets the widget text from a file.
- X.ft R
- X.LP
- X.nf
- X.ft B
- X- void HyperSetText(Widget widget,
- X char *text);
- X.fi
- X.LP
- X.I HyperSetText
- Xsets the widget text from a memory buffer.
- X.ft R
- X.LP
- X.nf
- X.ft B
- X- void HyperSetTags(Widget widget,
- X unsigned char start_highlight,
- X unsigned char end_highlight);
- X.fi
- X.LP
- X.I HyperSetTags
- Xsets the start of highlight and end of highlight characters.
- X.ft R
- X.LP
- X.nf
- X.ft B
- X- char *HyperGetText(Widget widget,
- X Boolean include_tags)
- X.fi
- X.LP
- X.I HyperGetText
- Xreturns the text of the HyperWidget. The pointer must be
- Xfreed by the application. If
- X.I include_tags
- Xis TRUE, the text includes the start of highlight and
- Xend of highlight characters.
- X.ft R
- X.LP
- X.nf
- X.ft B
- X- Boolean HyperGrep (Widget widget,
- X char *word,
- X Boolean ignore_case,
- X Boolean from_start,
- X Boolean wrap)
- X.fi
- X.LP
- X.I HyperGrep
- Xsearch for a pattern in the text.
- X.I word
- Xis the regular expression to look for.
- X.I ignore_case
- Xis TRUE, the routine ignores the case of letters
- Xin making comparisons. If
- X.I from_start is TRUE, the routine searches from the start of the text,
- Xotherwise it searches from the current selection. If
- X.I wrap
- Xis TRUE, the search continues from the beginning of the text if the
- Xend of the text was reached.
- X.ft R
- X.LP
- X.SH RELATED INFORMATION
- X.BR Core (3X),
- X.BR XmPrimitive (3X)
- X.SH BUGS
- XOnly tested on a Sun with Motif1.1.2
- X.SH AUTHOR
- XBaudouin Raoult (mab@ecmwf.co.uk) October 91.
- X.SH NOTE
- XThere is no warranty for this program.
- XHyperWidget is in the public domain.
- SHAR_EOF
- chmod 0644 HyperWidget.3x || echo "restore of HyperWidget.3x fails"
- set `wc -c HyperWidget.3x`;Sum=$1
- if test "$Sum" != "4143"
- then echo original size 4143, current size $Sum;fi
- echo "x - extracting patchlevel.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > patchlevel.h &&
- X#define PATCHLEVEL 0
- SHAR_EOF
- chmod 0644 patchlevel.h || echo "restore of patchlevel.h fails"
- set `wc -c patchlevel.h`;Sum=$1
- if test "$Sum" != "21"
- then echo original size 21, current size $Sum;fi
- rm -f s2_seq_.tmp
- echo "You have unpacked the last part"
- exit 0
- --
- --
- Molecular Simulations, Inc. mail: dcmartin@msi.com
- 796 N. Pastoria Avenue uucp: uunet!dcmartin
- Sunnyvale, California 94086 at&t: 408/522-9236
-