[comp.sources.amiga] v90i203: ruler 4.0 - a ruler for the workbench, Part01/01

Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator) (07/08/90)

Submitted-by: davids@ucscb.UCSC.EDU (Dave Schreiber)
Posting-number: Volume 90, Issue 203
Archive-name: util/ruler-4.0/part01

[ uuencoded executables enclosed  ...tad ]

Ruler gives you a ruler in a window to help in aligning text, keeping
filenames from becoming too long, etc.  The author has given me
permission to submit it.

#!/bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 1)."
# Contents:  ArpRuler4.uu README Ruler4.doc Ruler4.uu arpruler4.c
#   makefile ruler4.c
# Wrapped by tadguy@xanth on Sun Jul  8 11:49:57 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'ArpRuler4.uu' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'ArpRuler4.uu'\"
else
echo shar: Extracting \"'ArpRuler4.uu'\" \(6750 characters\)
sed "s/^X//" >'ArpRuler4.uu' <<'END_OF_FILE'
Xbegin 664 ArpRuler4
XM```#\P`````````#``````````(```2`````+0````$```/I```$@$[Z"8X`\
XM`%1E>'0@4G5L97(@($%R<%]6-"XP("`@,CDM1&5C+3@Y(*DQ.3@Y(%1H860@`
XM1FQO<GEA;B!A;F0@0VAA9"!.971Z97(@("`@("`@("`@("`@("`@("`@("`@6
XM("`@("`@("``"B4T,',*3W!E;G,@82!B;W)D97)L97-S(%=O<FM"96YC:"!WE
XM:6YD;W<@:6X@=VAI8V@@:7,@8V]N=&%I;F5D(&$@<G5L97(*9F]R('1H92!PI
XM=7)P;W-E(&]F(&%L:6=N:6YG(&]R(&-O;G-T<F%I;FEN9R!T97AT.R!T:&4@-
XM9&5F875L="!R=6QE<@II<R`S,"!C:&%R86-T97)S('=I=&@@86X@."!P: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JR`BF<H,"R`B$C`+P`O+("*3KH!Y
XM'C`L@(920$C`Y8`O`"\L@().N@$*3^\`$&`.3KH`]"\L@'Y.N@$P6$\@+?_\7
XM+FR`:$YU*!].74YU3E4``$CG#B`X+0`(,`3!_``&)$#5[(!T2D1M"KAL@#IL&
XM!$J29A`Y?``"@+)P_TS?!'!.74YU""H`!P`$9@@O$DZZ``I83T*2<`!@XB(OW
XM``0L;(!P3N[_W"(O``0L;(!P3N[_@BQL@'!.[O_*3.\`!@`$+&R`<$[N_^(L@
XM;(!P3N[_Q$[Z``(B+P`$+&R`<$[N_Z9(YP$$3.\@@``,+&R`;$ZN_Y1,WR"`<
XM3G5.^@`"(F\`!"QL@&Q.[OYB3OH``DSO``,`!"QL@&Q.[O\Z(F\`!"QL@&Q.N
XM[O[:+&R`;$[N_WQ.^@`"(F\`!"`O``@L;(!L3N[_+D[Z``(@;P`$+&R`;$[N!
XM_HQ.^@`"+&R`;")O``0@+P`(3N[]V$[Z``(B;P`$+&R`;$[N_H8@+P`$+&R`C
XM;$[N_L(@;P`$+&R`;$[N_H`B;P`$3.\``P`(+&R`5D[N_PHB;P`$3.\``P`(B
XM+&R`5D[N_Q`B;P`$3.\`#P`(+&R`5D[N_LXB;P`$("\`""QL@%9.[OZJ(F\`E
XM!"!O``@@+P`,+&R`5B\'3J[_Q"X?3G5,[P,```0L;(".3N[_H"!O``0L;(".E
XM3N[_IB!O``0L;(".3N[_LB!O``0L;(!23N[_N"!O``1,[P(#``@L;(!23N[^V
XM5B!O``0L;(!23N[_-````^P````!`````0``"@0````````#\@```^H````1T
XM`/````#Q`!D``0```@(``P@/```````````````$````````````9```__\`_
XM```!````!@```&@`%`````````````````/L`````P`````````:````,```_
X6`#0````````#\@```^L````!```#\@``-
X``
Xend
Xsize 4792
END_OF_FILE
if test 6750 -ne `wc -c <'ArpRuler4.uu'`; then
    echo shar: \"'ArpRuler4.uu'\" unpacked with wrong size!
fi
# end of 'ArpRuler4.uu'
fi
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(718 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
X
X	There are two versions of the program included, Ruler4 and ArpRuler4.
XThey are functionally identical.  The only difference between the twoprograms
Xis that one uses the ARP (AmigaDos Replacement Project) library
X(libs:arp.library) and the other doesn't.  In any case, by using the
X"arp.library" the program is somewhat smaller (about 3K)...  Just copy
Xwhichever version is appropriate to your c: directory (or anywhere in your
XPath) as "Ruler" (or whatever you want to call it), and you'll be all set.
X 
X	Read the docs, or type "Ruler ?" to get help.
X
X
X	If you have have no idea what "arp.library" is all about, then
Xjust use the program titled "Ruler4" for now, since it will work for
Xeverybody.
X
X
X					Chad Netzer
END_OF_FILE
if test 718 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'Ruler4.doc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Ruler4.doc'\"
else
echo shar: Extracting \"'Ruler4.doc'\" \(3088 characters\)
sed "s/^X//" >'Ruler4.doc' <<'END_OF_FILE'
X  	RULER
X  
X        Opens a borderless WorkBench window in which is contained a ruler
X        for the purpose of aligning or constraining text; the default ruler
X        is 30 characters with an 8 pixel scale and is intended to help
X        prevent entering too-long filenames.
X      
X        Usage:
X        
X        	CLI> RUN  RULER  [ size ] [ scale ]
X        
X        where `size' is the number of ruler markings, and `scale' is the
X        width between each marking (a particular font width for example).
X        
X  	Evoking the command with an argument of "?", such as:
X  
X  		CLI> RULER ?
X  
X  	will print out a help message detailing what values are valid for
X  	your particular Workbench environment.
X        
X  
X  	The window, of course, can be moved to any convenient location on the
X  	screen, and resized with an invisible resizing gadget found in the
X  	lower right corner.
X  
X  	Version 4.0   29-Dec-1989  (copyright)1989  Chad Netzer and Thad Floryan
X  
X  		Based upon code, idea, and logic from:
X  
X  	Version 1.0   7-Nov-1988   (copyright)1988 Thad Floryan
X  
X  	Revision history:
X  	    29-December-1989 - (Ver. 4.0) - Added an offset so that you can
X  	        just stick the window on the left edge of the workbench screen,
X  		and it will automatically be lined up with the characters.
X  		Fixed some more minor bugs and rearranged the code a bit.
X  		Added ARP support for those who want it. (CFN)
X  
X  	    09-March-1989 - (Ver. 3.1) - Fixed a visual bug so that scale can
X  		no longer be less than eight. (CFN)
X  
X  	    06-Dec-1988 - (Ver. 3.0) - Added support for measuring fonts of
X  		varying widths (selectable scale). (CFN)
X  
X  	    22-Nov-1988 - (Ver. 2.2) - More adjustments to code, No major
X  	    	changes.  Program size is slightly smaller.  (CFN)
X  
X  	    14-Nov-1988 - (Ver. 2.1) - Fixed a few minor (harmless) bugs.  The
X  		right edge of the ruler is now always redrawn after resizing.
X  		I got rid of that GOTO statement (which in 'C', is considered a
X  		bug. :-)  Version 2.1 now lets you open a ruler to be as low as
X  		12 characters wide, which 2.0 only advertised. (CFN)
X  
X  	    13-Nov-1988 - (Ver. 2.0) - I added minor enhancements, most
X  		noteably, the ability to resize the window, and support for 
X  		overscanned screens.	(CFN)
X  
X  
X  	Feel welcome to use this program for any non-commercial purposes or
X  	for your personal learning.  Commercial users are requested to contact
X  	Thad at either:
X 
X  	UUCP:	thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad
X  	BBS:	BBS-JC, 415/961-7250 (300/1200/2400), "Thad Floryan" | "SYSOP"
X  
X  	or Chad at:
X  
X  	UUCP:	chad@ucscb.ucsc.edu	(during school term)
X  	UUCP:	chad@cup.portal.com	(holidays, summer, etc.)
X  	BBS:	BBS-JC, 415/961-7250 (300/1200/2400), "Chad Netzer"
X  
X  
X  	Building instructions (Manx Aztec C):
X  
X  			************************
X  			***  Non-ARP Version ***
X  			************************
X  
X  			cc ruler4
X  			ln ruler4 -lc
X  
X 
X 			*******************
X  			*** ARP Version ***
X  			*******************
X  
X  			cc arpruler4
X  			ln arpruler4 -la -lc
END_OF_FILE
if test 3088 -ne `wc -c <'Ruler4.doc'`; then
    echo shar: \"'Ruler4.doc'\" unpacked with wrong size!
fi
# end of 'Ruler4.doc'
fi
if test -f 'Ruler4.uu' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Ruler4.uu'\"
else
echo shar: Extracting \"'Ruler4.uu'\" \(11122 characters\)
sed "s/^X//" >'Ruler4.uu' <<'END_OF_FILE'
Xbegin 664 Ruler4
XM```#\P`````````#``````````(```;[````P0````$```/I```&^T[Z"DX`+
XM`%1E>'0@4G5L97(@("!6-"XP("`@,CDM1&5C+3@Y(*DQ.3@Y(%1H860@1FQO_
XM<GEA;B!A;F0@0VAA9"!.971Z97(@("`@("`@("`@("`@("`@("`@("`@("`@5
XM("`@("`@("``"B4T,',*3W!E;G,@82!B;W)D97)L97-S(%=O<FM"96YC:"!WE
XM:6YD;W<@:6X@=VAI8V@@:7,@8V]N=&%I;F5D(&$@<G5L97(*9F]R('1H92!PI
XM=7)P;W-E(&]F(&%L:6=N:6YG(&]R(&-O;G-T<F%I;FEN9R!T97AT.R!T:&4@-
XM9&5F875L="!R=6QE<@II<R`S,"!C:&%R86-T97)S('=I=&@@86X@."!P:7AE1
XM;"!S8V%L92!A;F0@:7,@:6YT96YD960@=&\@:&5L<`IP<F5V96YT(&5N=&5RF
XM:6YG('1O;RUL;VYG(&9I;&5N86UE<RX*"E5S86=E.@H*"4-,23X@4E5.("`E_
XM<R`@6R!S:7IE(%T@6R!S8V%L92!="@IW:&5R92!@<VEZ92<@:7,@=&AE(&YUW
XM;6)E<B!O9B!R=6QE<B!M87)K:6YG<RP@86YD(&!S8V%L92<@:7,@=&AE"G=I6
XM9'1H(&)E='=E96X@96%C:"!M87)K:6YG("AA('!A<G1I8W5L87(@9F]N="!WR
XM:61T:"!F;W(@97AA;7!L92DN"@I@<VEZ92<@;75S="!B92!B971W965N(#$RF
XM(&%N9"`E;&0@:6YC;'5S:79E+"!A;F0@9&5F875L=',@=&\@,S`N"F!S8V%L2
XM92<@8V%N;F]T(&)E(&=R96%T97(@=&AA;B`E;&0@;W(@;&5S<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!.[O_<(B\`!"QL@L!.[O^"(B\`!"QL@L!.[O^X+&R"P$[NL
XM_\HL;(+`3N[_?"(O``0L;(+`3N[_*$SO``8`!"QL@L!.[O_B+&R"P$[N_\1./
XM^@`"(B\`!"QL@L!.[O^F3.\`#@`$+&R"P$[N_]!(YP$$3.\@@``,+&R"O$ZNK
XM_Y1,WR"`3G5.^@`"(F\`!"QL@KQ.[OYB3OH``DSO``,`!"QL@KQ.[O\Z(F\`:
XM!"QL@KQ.[O[:+&R"O$[N_WQ.^@`"(F\`!"`O``@L;(*\3N[_+D[Z``(@;P`$-
XM+&R"O$[N_HQ.^@`"+&R"O")O``0@+P`(3N[]V$[Z``(B;P`$+&R"O$[N_H9,Z
XM[P`#``0L;(*\3N[^SB`O``0L;(*\3N[^PB!O``0L;(*\3N[^@")O``1,[P`#O
XM``@L;(*F3N[_"B)O``1,[P`#``@L;(*F3N[_$")O``1,[P`/``@L;(*F3N[^4
XMSB)O``0@+P`(+&R"ID[N_JHB;P`$(&\`""`O``PL;(*F+P=.KO_$+A].=4SOE
XM`P``!"QL@MY.[O^@(&\`!"QL@MY.[O^F(&\`!"QL@MY.[O^R(&\`!"QL@J).;
XM[O^X(&\`!$SO`@,`""QL@J).[OY6(&\`!"QL@J).[O\T```#[`````$````![
XM```*Q`````````/R```#Z@```*0`\````/$`&0`!```"`@`#"`\`````````M
XM``````0```````````!D``#__P````$````&````:#`Q,C,T-38W.#EA8F-DL
XM968````@("`@("`@("`P,#`P,"`@("`@("`@("`@("`@("`@()!`0$!`0$!`K
XM0$!`0$!`0$`,#`P,#`P,#`P,0$!`0$!`0`D)"0D)"0$!`0$!`0$!`0$!`0$!\
XM`0$!`0$!0$!`0$!`"@H*"@H*`@("`@("`@("`@("`@("`@("`@)`0$!`(```*
XM```````````````!``````$``````````````````````0$````!````````%
XM``````````````$"`````0``````````````````````````````````````$
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM```````````````````````````````````````````````4````````````4
XM`````^P````#`````````!H````P````-`````````/R```#ZP````$```/R)
X``
Xend
Xsize 7920
END_OF_FILE
if test 11122 -ne `wc -c <'Ruler4.uu'`; then
    echo shar: \"'Ruler4.uu'\" unpacked with wrong size!
fi
# end of 'Ruler4.uu'
fi
if test -f 'arpruler4.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'arpruler4.c'\"
else
echo shar: Extracting \"'arpruler4.c'\" \(12217 characters\)
sed "s/^X//" >'arpruler4.c' <<'END_OF_FILE'
X/*	RULER
X *
X *      Opens a borderless WorkBench window in which is contained a ruler
X *      for the purpose of aligning or constraining text; the default ruler
X *      is 30 characters with an 8 pixel scale and is intended to help
X *      prevent entering too-long filenames.
X *      
X *      Usage:
X *      
X *      	CLI> RUN  RULER  [ size ] [ scale ]
X *      
X *      where `size' is the number of ruler markings, and `scale' is the
X *      width between each marking (a particular font width for example).
X *      
X *	Evoking the command with an argument of "?", such as:
X *
X *		CLI> RULER ?
X *
X *	will print out a help message detailing what values are valid for
X *	your particular Workbench environment.
X *      
X *
X *	The window, of course, can be moved to any convenient location on the
X *	screen, and resized with an invisible resizing gadget found in the
X *	lower right corner.
X *
X *	Version 4.0   29-Dec-1989  (copyright)1989  Chad Netzer and Thad Floryan
X *
X *		Based upon code, idea, and logic from:
X *
X *	Version 1.0   7-Nov-1988   (copyright)1988 Thad Floryan
X *
X *	Revision history:
X *	    29-December-1989 - (Ver. 4.0) - Added an offset so that you can
X *	        just stick the window on the left edge of the workbench screen,
X *		and it will automatically be lined up with the characters.
X *		Fixed some more minor bugs and rearranged the code a bit.
X *		Added ARP support for those who want it. (CFN)
X *
X *	    09-March-1989 - (Ver. 3.1) - Fixed a visual bug so that scale can
X *		no longer be less than eight. (CFN)
X *
X *	    06-Dec-1988 - (Ver. 3.0) - Added support for measuring fonts of
X *		varying widths (selectable scale). (CFN)
X *
X *	    22-Nov-1988 - (Ver. 2.2) - More adjustments to code, No major
X *	    	changes.  Program size is slightly smaller.  (CFN)
X *
X *	    14-Nov-1988 - (Ver. 2.1) - Fixed a few minor (harmless) bugs.  The
X *		right edge of the ruler is now always redrawn after resizing.
X *		I got rid of that GOTO statement (which in 'C', is considered a
X *		bug. :-)  Version 2.1 now lets you open a ruler to be as low as
X *		12 characters wide, which 2.0 only advertised. (CFN)
X *
X *	    13-Nov-1988 - (Ver. 2.0) - I added minor enhancements, most
X *		noteably, the ability to resize the window, and support for 
X *		overscanned screens.	(CFN)
X *
X *
X *	Feel welcome to use this program for any non-commercial purposes or
X *	for your personal learning.  Commercial users are requested to contact
X *	Thad at either:
X *
X *	UUCP:	thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad
X *	BBS:	BBS-JC, 415/961-7250 (300/1200/2400), "Thad Floryan" | "SYSOP"
X *
X *	or Chad at:
X *
X *	UUCP:	chad@ucscb.ucsc.edu	(during school term)
X *	UUCP:	chad@cup.portal.com	(holidays, summer, etc.)
X *	BBS:	BBS-JC, 415/961-7250 (300/1200/2400), "Chad Netzer"
X *
X *
X *	Building instructions (Manx Aztec C):
X *
X *			*******************
X *			*** ARP Version ***
X *			*******************
X *
X *			cc arpruler4
X *			ln arpruler4 -la -lc
X */
X
X#include <exec/types.h>
X#include <exec/memory.h>
X#include <libraries/arpbase.h>
X#include <intuition/intuition.h>
X#include <intuition/intuitionbase.h>
X#include "arpfunctions.h"
X
X#define NEW(typ)		AllocMem((ULONG)sizeof(typ), MEMF_CLEAR)
X#define FREE(p,typ)		FreeMem(p,(ULONG)sizeof(typ))
X
X#define	ever (;;)	/* used for infinite loops */
X
X#define FATAL 20	/* exit code */
X#define WARN  10	/* exit code */
X#define NORMAL 0	/* exit code */
X
X#define LEFT_OFFSET 3L	/* "dead space" on left side of ruler margin */
X
Xextern void	*OpenLibrary();
Xextern void	*OpenWindow();
Xextern void	*GetMsg();
Xextern void	*AllocMem();
Xextern void	ReplyMsg();
Xvoid		release_resources();
Xvoid		error_exit();
X
Xstruct NewWindow window_def =
X{
X	240, 0,			/* Initial LeftEdge, TopEdge */
X	241, 25,		/* Default pixel-width, pixel-height */
X	0, 1,			/* DetailPen, BlockPen */
X	CLOSEWINDOW	|	/* IDCMP flags */
X	NEWSIZE,
X	WINDOWDRAG	|	/* window flags */
X	WINDOWDEPTH	|
X	WINDOWCLOSE	|
X	WINDOWSIZING	|
X	SMART_REFRESH	|
X	NOCAREREFRESH	|
X	BORDERLESS	|
X	RMBTRAP,
X	NULL,			/* Gadget list */
X	NULL,			/* checkmark stuff */
X	(UBYTE *)"",		/* window title (to be filled in later) */
X	NULL,			/* custom screen pointer */
X	NULL,			/* bitmap pointer */
X	97 + LEFT_OFFSET, 0,	/* Minwidth, no MinHeight */
X	-1, 0,			/* no MaxWidth, MaxHeight */
X	WBENCHSCREEN		/* screen type */
X};
X
Xstruct Window		*window;
Xstruct RastPort 	*rp;
Xstruct ArpBase		*ArpBase;
Xstruct Library		*IntuitionBase;
Xstruct Library		*GfxBase;
Xstruct Screen		*screen;
Xstruct IntuiMessage	*sys_message;
XULONG			class;
Xint			resource_state;
X
Xchar *version = 
X	"Text Ruler  Arp_V4.0   29-Dec-89 \xA91989 Thad Floryan and Chad Netzer"
X	"                              "; /* padding for "nice" title */
X
Xchar *help_text =				/* help message on startup */
X	"\n"
X	"%40s\n"
X	"Opens a borderless WorkBench window in which is contained a ruler\n"
X	"for the purpose of aligning or constraining text; the default ruler\n"
X	"is 30 characters with an 8 pixel scale and is intended to help\n"
X	"prevent entering too-long filenames.\n\n"
X	"Usage:\n\n\t"
X	"CLI> RUN  %s  [ size ] [ scale ]\n\n"
X	"where `size' is the number of ruler markings, and `scale' is the\n"
X	"width between each marking (a particular font width for example).\n\n"
X	"`size' must be between 12 and %ld inclusive, and defaults to 30.\n"
X	"`scale' cannot be greater than %ld or less than 8.  The default is 8."
X	"\n\n";
X
X/**********************************************************************/
X
Xmain (argc, argv)
X	int	argc;
X	char	*argv[];
X{
X
X	long	fivec;		/* pixel size of five chars	*/
X	long	fsize;		/* The font size of ruler scale */
X	long	max_scale;	/* The max scale size possible  */
X	long	max_width;	/* maximum size of ruler	*/
X	long	w;		/* character width of ruler	*/
X	long	w_lim;		/* pixel width (w * fsize)	*/
X	long	x;		/* present window x coordinate	*/
X	long	y;		/* present window y coordinate	*/
X	char	buf[5];
X
X	long	success;	/* indicates bad return values	*/
X
X	resource_state = 0;
X
X/*
X *	Open ARP_library, revision 39
X */
X	ArpBase = OpenLibrary ("arp.library", ArpVersion);
X	if (ArpBase == 0L)
X	{
X	    error_exit("?Cannot open arp.library\n");
X	}
X	++resource_state;
X
X/*
X *	Get IntuitionBase from ArpBase so we can get the screen size limits.
X */
X	IntuitionBase = ArpBase->IntuiBase;
X
X/*
X *	Get WorkBench screen information
X */
X	screen = NEW(struct Screen);	/* Allocate a buffer for screen data */
X	if (screen == 0L)
X	{
X	    release_resources();
X	    error_exit("?ran out of available memory\n");
X	}
X	++resource_state;
X	success = GetScreenData(screen, (ULONG) sizeof (struct Screen), 
X				WBENCHSCREEN, 0L);
X	if (success == FALSE)
X	{
X	    error_exit();
X	}
X/*
X *	Set up defaults...
X */
X	w = 30L;	/* default ruler is 30 chars for a filename */
X	fsize = 8L;	/* default font scale is 8 pixels per char  */
X
X/*
X *	find maximum values, adjusted for morerows
X */
X	max_width = (screen->Width - LEFT_OFFSET) / 8;
X	max_scale = (screen->Width - 2) / 12;
X
X/*
X *	Parse command line to obtain requested parameters.
X */
X	if (argc > 1)
X	{
X	    if (*argv[1] == '?' ||
X		*argv[1] == '-' ||
X		*argv[1] == 'h' ||
X		*argv[1] == 'H'   )
X	    {
X		Printf(	help_text,
X			version, argv[0], max_width, max_scale);
X
X		release_resources();
X		exit (NORMAL);
X	    }
X	}
X
X	if (argc > 3)
X	{
X	    Printf("?Too many arguments, ``%s ?'' for help\n", argv[0]);
X	    release_resources();
X	    exit (WARN);
X	}
X
X	if ((argc >= 2) && (argc <= 3))
X	{
X	    w = Atol(argv[1]);
X	    if ( w < 12L  ||  w > max_width )
X	    {
X	        Printf("?`size' must be >= 12 and <= %ld\n", max_width);
X	        release_resources();
X	        exit (WARN);
X	    }
X	}
X
X	if (argc == 3)
X	{ 
X	    fsize = Atol(argv[2]);
X	    if (fsize < 8)
X	    {
X	    	Printf("?Font scale must be at least 8!\n");
X		release_resources();
X		exit (WARN);
X	    }
X	    if (fsize > max_scale)
X	    {
X	        Printf("?Font size can be NO larger than %ld!\n", max_scale);
X	        release_resources();
X	        exit (WARN);
X	    }
X	}
X
X/*
X *	Now calculate window sizing and placement parameters and setup title.
X */
X	w_lim               = w * fsize;
X	window_def.Width    = w_lim + LEFT_OFFSET + 1;
X	window_def.LeftEdge = (window_def.Width > 300L) ? 0 : 240;
X	window_def.Title    = (UBYTE *)version;
X	fivec		    = 5L * fsize;
X/*
X *	Bomb out if requested ruler size would be larger than the screen.
X */
X	if (window_def.Width > screen -> Width )
X	{
X	    error_exit("?Ruler too large for WorkBench screen\n");
X	}
X
X/*
X *	Set up GfxBase from ArpBase.
X */
X	GfxBase = ArpBase->GfxBase;
X
X/*
X *	Open the ruler display window.
X */
X	window = OpenWindow (&window_def);
X	if (window == 0L)
X	{
X	    error_exit("?Cannot open window\n");
X	}
X	++resource_state;
X/*
X *	Get pointer to raster port.
X */
X	rp = window -> RPort;
X	SetAPen (rp, 0L);
X/*
X *	Use RectFill to blank the window area and set pen for drawing.
X */
X	for ever
X    	{
X	    SetAPen(rp, 0L);
X 	    RectFill(rp, 0L, 10L, w_lim + LEFT_OFFSET, 24L);
X/*
X *	Now set pen to draw.
X */
X	    SetAPen(rp, 1L);
X/*
X *	Because we've used a BORDERLESS window, must fill in some of the
X *	title-/drag-bar space near the lower left where the text starts.
X */
X	    Move(rp, 28L, 8L);
X	    Draw(rp, 31L, 8L);
X/*
X *	Because we've used a BORDERLESS window, must draw our own line beneath
X *	the title bar to make the bar the same height as the window gadgets.
X *	The `28' is the pixel position just to the right of the close gadget.
X *	The `53' is the pixel width of the depth-arranging gadgets in the upper
X *	right corner of the window.
X */
X	    Move(rp, 28L,           9L);
X	    Draw(rp, (w_lim + LEFT_OFFSET - 53L), 9L);
X
X/*
X *	When I use the ruler, I like to jam it up against the left hand side of
X *	my workbench screen, so that it to measure something on the CLI.
X *	However, the CLI is offset by a small amount, so I compensate by
X *	starting the "virtual" area of the ruler a little to the right...
X *
X *	Fill in the offset area that is unused.
X */
X 	    RectFill(rp, 0L, 9L, LEFT_OFFSET, 24L);
X
X/*
X *	Shorten virtual ruler size by subtracting LEFT_OFFSET from w_lim.
X */
X/* 	    w_lim -= LEFT_OFFSET;*/
X
X/*
X *	Draw ruler and text
X */
X	    for (x = 0L; x < (w_lim + fsize); x += fsize)
X	    {
X		if (x >= w_lim)		/* right edge		 */
X		    {
X			x = w_lim;
X			y = 10L;
X		    }
X		else if (x == 0L)	   y = 10L;	/* left edge		 */
X		else if ((x % fivec) == 0L)  y = 19L;	/* big tic every 5 chars */
X		else                       y = 22L;	/* small tic every char  */
X		Move (rp, x + LEFT_OFFSET, y);
X		Draw (rp, x + LEFT_OFFSET, 24L);
X/*
X *	Label ruler.
X *	The test for position `fivec' (in the Move()) is for centering ``5''
X *	differently than the centering for two-digit numbers.
X */
X		if ((x > 0L) && (x < w_lim) && ((x % fivec) == 0L))
X		{
X		    SPrintf (buf, "%2ld", (x / fsize));
X		    Move (rp, (x == fivec) ? (x - 12L + LEFT_OFFSET)
X		    			   : (x -  8L + LEFT_OFFSET), 17L);
X		    Text (rp, buf, (long) strlen (buf));
X		}
X	    }
X/*
X *	Wait for gadget activation.  No busy-/spin-/wait-loops here!
X */
X	    Wait (1L << window -> UserPort -> mp_SigBit);
X/*
X *	Retrieve LAST message in Message Port
X */
X	    sys_message = GetMsg(window -> UserPort);
X	    class = sys_message -> Class;
X	    ReplyMsg(sys_message);
X/*
X *	Dump uneeded messages (respond only to the last on LIFO queue).
X */
X	    while (sys_message = GetMsg(window -> UserPort))
X	    {
X		ReplyMsg(sys_message);
X	    }
X
X	    if (class == CLOSEWINDOW)
X	    {
X		release_resources();
X		exit (NORMAL);
X	    }
X
X	    if (class == NEWSIZE)
X	    {
X		w_lim = (window -> Width) - 1 - LEFT_OFFSET;
X	    }
X	}
X}
X
X/**********************************************************************
X *
X *	cleanup routine
X *
X *	The ``switch'' on resource_state is to assure we don't attempt to
X *	free something we don't have.  Items are released in the reverse
X *	order they were obtained (by "falling thru" the cases).
X */
Xvoid release_resources()
X{
X	switch (resource_state)
X	{
X	    case 3: CloseWindow (window);
X	    case 2: FREE (screen, struct Screen);
X	    case 1: CloseLibrary(ArpBase);
X	}
X}
X
X/**********************************************************************
X *
X *	error handler
X */
Xvoid error_exit(message)
X	char	*message;
X{
X	if (message == 0L)
X	{
X	    Printf("Internal failure, exiting gracefully...\n");
X	}
X	else
X	{
X	    Printf(message);
X	}
X	release_resources();
X	exit (FATAL);
X}
END_OF_FILE
if test 12217 -ne `wc -c <'arpruler4.c'`; then
    echo shar: \"'arpruler4.c'\" unpacked with wrong size!
fi
# end of 'arpruler4.c'
fi
if test -f 'makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'makefile'\"
else
echo shar: Extracting \"'makefile'\" \(162 characters\)
sed "s/^X//" >'makefile' <<'END_OF_FILE'
X# Ruler makefile
X#
X# Manx Aztec C
X
XArpRuler4:	arpruler4.c
X	cc arpruler4
X	ln -o ArpRuler4 arpruler4 -la -lc
X
XRuler4:		ruler4.c
X	cc ruler4
X	ln -o Ruler4 ruler4 -lc
END_OF_FILE
if test 162 -ne `wc -c <'makefile'`; then
    echo shar: \"'makefile'\" unpacked with wrong size!
fi
# end of 'makefile'
fi
if test -f 'ruler4.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'ruler4.c'\"
else
echo shar: Extracting \"'ruler4.c'\" \(12221 characters\)
sed "s/^X//" >'ruler4.c' <<'END_OF_FILE'
X/*	RULER
X *
X *      Opens a borderless WorkBench window in which is contained a ruler
X *      for the purpose of aligning or constraining text; the default ruler
X *      is 30 characters with an 8 pixel scale and is intended to help
X *      prevent entering too-long filenames.
X *      
X *      Usage:
X *      
X *      	CLI> RUN  RULER  [ size ] [ scale ]
X *      
X *      where `size' is the number of ruler markings, and `scale' is the
X *      width between each marking (a particular font width for example).
X *      
X *	Evoking the command with an argument of "?", such as:
X *
X *		CLI> RULER ?
X *
X *	will print out a help message detailing what values are valid for
X *	your particular Workbench environment.
X *      
X *
X *	The window, of course, can be moved to any convenient location on the
X *	screen, and resized with an invisible resizing gadget found in the
X *	lower right corner.
X *
X *	Version 4.0   29-Dec-1989  (copyright)1989  Chad Netzer and Thad Floryan
X *
X *		Based upon code, idea, and logic from:
X *
X *	Version 1.0   7-Nov-1988   (copyright)1988 Thad Floryan
X *
X *	Revision history:
X *	    29-December-1989 - (Ver. 4.0) - Added an offset so that you can
X *	        just stick the window on the left edge of the workbench screen,
X *		and it will automatically be lined up with the characters.
X *		Fixed some more minor bugs and rearranged the code a bit.
X *		Added ARP support for those who want it. (CFN)
X *
X *	    09-March-1989 - (Ver. 3.1) - Fixed a visual bug so that scale can
X *		no longer be less than eight. (CFN)
X *
X *	    06-Dec-1988 - (Ver. 3.0) - Added support for measuring fonts of
X *		varying widths (selectable scale). (CFN)
X *
X *	    22-Nov-1988 - (Ver. 2.2) - More adjustments to code, No major
X *	    	changes.  Program size is slightly smaller.  (CFN)
X *
X *	    14-Nov-1988 - (Ver. 2.1) - Fixed a few minor (harmless) bugs.  The
X *		right edge of the ruler is now always redrawn after resizing.
X *		I got rid of that GOTO statement (which in 'C', is considered a
X *		bug. :-)  Version 2.1 now lets you open a ruler to be as low as
X *		12 characters wide, which 2.0 only advertised. (CFN)
X *
X *	    13-Nov-1988 - (Ver. 2.0) - I added minor enhancements, most
X *		noteably, the ability to resize the window, and support for 
X *		overscanned screens.	(CFN)
X *
X *
X *	Feel welcome to use this program for any non-commercial purposes or
X *	for your personal learning.  Commercial users are requested to contact
X *	Thad at either:
X *
X *	UUCP:	thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad
X *	BBS:	BBS-JC, 415/961-7250 (300/1200/2400), "Thad Floryan" | "SYSOP"
X *
X *	or Chad at:
X *
X *	UUCP:	chad@ucscb.ucsc.edu	(during school term)
X *	UUCP:	chad@cup.portal.com	(holidays, summer, etc.)
X *	BBS:	BBS-JC, 415/961-7250 (300/1200/2400), "Chad Netzer"
X *
X *
X *	Building instructions (Manx Aztec C):
X *
X *			************************
X *			***  Non-ARP Version ***
X *			************************
X *
X *			cc ruler4
X *			ln ruler4 -lc
X */
X
X#include <exec/types.h>
X#include <exec/memory.h>
X#include <intuition/intuition.h>
X#include <intuition/intuitionbase.h>
X
X#define NEW(typ)		AllocMem((ULONG)sizeof(typ), MEMF_CLEAR)
X#define FREE(p,typ)		FreeMem(p,(ULONG)sizeof(typ))
X
X#define	ever (;;)	/* used for infinite loops */
X
X#define FATAL 20	/* exit code */
X#define WARN  10	/* exit code */
X#define NORMAL 0	/* exit code */
X
X#define LEFT_OFFSET 3L	/* "dead space" on left side of ruler margin */
X
Xextern void	*OpenLibrary();
Xextern void	*OpenWindow();
Xextern void	*GetMsg();
Xextern void	*AllocMem();
Xextern void	ReplyMsg();
Xvoid		release_resources();
Xvoid		error_exit();
X
Xstruct NewWindow window_def =
X{
X	240, 0,			/* Initial LeftEdge, TopEdge */
X	241, 25,		/* Default pixel-width, pixel-height */
X	0, 1,			/* DetailPen, BlockPen */
X	CLOSEWINDOW	|	/* IDCMP flags */
X	NEWSIZE,
X	WINDOWDRAG	|	/* window flags */
X	WINDOWDEPTH	|
X	WINDOWCLOSE	|
X	WINDOWSIZING	|
X	SMART_REFRESH	|
X	NOCAREREFRESH	|
X	BORDERLESS	|
X	RMBTRAP,
X	NULL,			/* Gadget list */
X	NULL,			/* checkmark stuff */
X	(UBYTE *)"",		/* window title (to be filled in later) */
X	NULL,			/* custom screen pointer */
X	NULL,			/* bitmap pointer */
X	97 + LEFT_OFFSET, 0,	/* Minwidth, no MinHeight */
X	-1, 0,			/* no MaxWidth, MaxHeight */
X	WBENCHSCREEN		/* screen type */
X};
X
Xstruct Window		*window;
Xstruct RastPort 	*rp;
Xstruct Library		*IntuitionBase;
Xstruct Library		*GfxBase;
Xstruct Screen		*screen;
Xstruct IntuiMessage	*sys_message;
XULONG			class;
Xint			resource_state;
X
Xchar *version = 
X	"Text Ruler   V4.0   29-Dec-89 \xA91989 Thad Floryan and Chad Netzer"
X	"                                 "; /* padding for "nice" title */
X
Xchar *help_text =				/* help message on startup */
X	"\n"
X	"%40s\n"
X	"Opens a borderless WorkBench window in which is contained a ruler\n"
X	"for the purpose of aligning or constraining text; the default ruler\n"
X	"is 30 characters with an 8 pixel scale and is intended to help\n"
X	"prevent entering too-long filenames.\n\n"
X	"Usage:\n\n\t"
X	"CLI> RUN  %s  [ size ] [ scale ]\n\n"
X	"where `size' is the number of ruler markings, and `scale' is the\n"
X	"width between each marking (a particular font width for example).\n\n"
X	"`size' must be between 12 and %ld inclusive, and defaults to 30.\n"
X	"`scale' cannot be greater than %ld or less than 8.  The default is 8."
X	"\n\n";
X
X/**********************************************************************/
X
Xmain (argc, argv)
X	int	argc;
X	char	*argv[];
X{
X
X	long	fivec;		/* pixel size of five chars	*/
X	long	fsize;		/* The font size of ruler scale */
X	long	max_scale;	/* The max scale size possible  */
X	long	max_width;	/* maximum size of ruler	*/
X	long	w;		/* character width of ruler	*/
X	long	w_lim;		/* pixel width (w * fsize)	*/
X	long	x;		/* present window x coordinate	*/
X	long	y;		/* present window y coordinate	*/
X	char	buf[5];
X
X	long	success;	/* indicates bad return values	*/
X
X	resource_state = 0;
X
X/*
X *	Open Intuition so we can get the screen size limits.
X */
X	IntuitionBase = OpenLibrary ("intuition.library", 0L);
X	if (IntuitionBase == 0L)
X	{
X	    error_exit("?Cannot open intuition.library\n");
X	}
X	++resource_state;
X
X/*
X *	Get WorkBench screen information
X */
X	screen = NEW(struct Screen);	/* Allocate a buffer for screen data */
X	if (screen == 0L)
X	{
X	    release_resources();
X	    error_exit("?ran out of available memory\n");
X	}
X	++resource_state;
X	success = GetScreenData(screen, (ULONG) sizeof (struct Screen), 
X				WBENCHSCREEN, 0L);
X	if (success == FALSE)
X	{
X	    error_exit();
X	}
X/*
X *	Set up defaults...
X */
X	w = 30L;	/* default ruler is 30 chars for a filename */
X	fsize = 8L;	/* default font scale is 8 pixels per char  */
X
X/*
X *	find maximum values, adjusted for morerows
X */
X	max_width = (screen->Width - LEFT_OFFSET) / 8;
X	max_scale = (screen->Width - 2) / 12;
X
X/*
X *	Parse command line to obtain requested parameters.
X */
X	if (argc > 1)
X	{
X	    if (*argv[1] == '?' ||
X		*argv[1] == '-' ||
X		*argv[1] == 'h' ||
X		*argv[1] == 'H'   )
X	    {
X		printf(	help_text,
X			version, argv[0], max_width, max_scale);
X
X		release_resources();
X		exit (NORMAL);
X	    }
X	}
X
X	if (argc > 3)
X	{
X	    printf("?Too many arguments, ``%s ?'' for help\n", argv[0]);
X	    release_resources();
X	    exit (WARN);
X	}
X
X	if ((argc >= 2) && (argc <= 3))
X	{
X	    w = atol(argv[1]);
X	    if ( w < 12L  ||  w > max_width )
X	    {
X	        printf("?`size' must be >= 12 and <= %ld\n", max_width);
X	        release_resources();
X	        exit (WARN);
X	    }
X	}
X
X	if (argc == 3)
X	{ 
X	    fsize = atol(argv[2]);
X	    if (fsize < 8)
X	    {
X	    	printf("?Font scale must be at least 8!\n");
X		release_resources();
X		exit (WARN);
X	    }
X	    if (fsize > max_scale)
X	    {
X	        printf("?Font size can be NO larger than %ld!\n", max_scale);
X	        release_resources();
X	        exit (WARN);
X	    }
X	}
X
X/*
X *	Now calculate window sizing and placement parameters and setup title.
X */
X	w_lim               = w * fsize;
X	window_def.Width    = w_lim + LEFT_OFFSET + 1;
X	window_def.LeftEdge = (window_def.Width > 300L) ? 0 : 240;
X	window_def.Title    = (UBYTE *)version;
X	fivec		    = 5L * fsize;
X/*
X *	Bomb out if requested ruler size would be larger than the screen.
X */
X	if (window_def.Width > screen -> Width )
X	{
X	    error_exit("?Ruler too large for WorkBench screen\n");
X	}
X
X/*
X *	Open up the graphics library.
X */
X	GfxBase = OpenLibrary ("graphics.library", 0L);
X	if (GfxBase == 0L)
X	{
X	    error_exit("?Cannot open graphics.library\n");
X	}
X	++resource_state;
X
X/*
X *	Open the ruler display window.
X */
X	window = OpenWindow (&window_def);
X	if (window == 0L)
X	{
X	    error_exit("?Cannot open window\n");
X	}
X	++resource_state;
X/*
X *	Get pointer to raster port.
X */
X	rp = window -> RPort;
X	SetAPen (rp, 0L);
X/*
X *	Use RectFill to blank the window area and set pen for drawing.
X */
X	for ever
X    	{
X	    SetAPen(rp, 0L);
X 	    RectFill(rp, 0L, 10L, w_lim + LEFT_OFFSET, 24L);
X/*
X *	Now set pen to draw.
X */
X	    SetAPen(rp, 1L);
X/*
X *	Because we've used a BORDERLESS window, must fill in some of the
X *	title-/drag-bar space near the lower left where the text starts.
X */
X	    Move(rp, 28L, 8L);
X	    Draw(rp, 31L, 8L);
X/*
X *	Because we've used a BORDERLESS window, must draw our own line beneath
X *	the title bar to make the bar the same height as the window gadgets.
X *	The `28' is the pixel position just to the right of the close gadget.
X *	The `53' is the pixel width of the depth-arranging gadgets in the upper
X *	right corner of the window.
X */
X	    Move(rp, 28L,           9L);
X	    Draw(rp, (w_lim + LEFT_OFFSET - 53L), 9L);
X
X/*
X *	When I use the ruler, I like to jam it up against the left hand side of
X *	my workbench screen, so that it to measure something on the CLI.
X *	However, the CLI is offset by a small amount, so I compensate by
X *	starting the "virtual" area of the ruler a little to the right...
X *
X *	Fill in the offset area that is unused.
X */
X 	    RectFill(rp, 0L, 9L, LEFT_OFFSET, 24L);
X
X/*
X *	Shorten virtual ruler size by subtracting LEFT_OFFSET from w_lim.
X */
X/* 	    w_lim -= LEFT_OFFSET;*/
X
X/*
X *	Draw ruler and text
X */
X	    for (x = 0L; x < (w_lim + fsize); x += fsize)
X	    {
X		if (x >= w_lim)		/* right edge		 */
X		    {
X			x = w_lim;
X			y = 10L;
X		    }
X		else if (x == 0L)	   y = 10L;	/* left edge		 */
X		else if ((x % fivec) == 0L)  y = 19L;	/* big tic every 5 chars */
X		else                       y = 22L;	/* small tic every char  */
X		Move (rp, x + LEFT_OFFSET, y);
X		Draw (rp, x + LEFT_OFFSET, 24L);
X/*
X *	Label ruler.
X *	The test for position `fivec' (in the Move()) is for centering ``5''
X *	differently than the centering for two-digit numbers.
X */
X		if ((x > 0L) && (x < w_lim) && ((x % fivec) == 0L))
X		{
X		    sprintf (buf, "%2ld", (x / fsize));
X		    Move (rp, (x == fivec) ? (x - 12L + LEFT_OFFSET)
X		    			   : (x -  8L + LEFT_OFFSET), 17L);
X		    Text (rp, buf, (long) strlen (buf));
X		}
X	    }
X/*
X *	Wait for gadget activation.  No busy-/spin-/wait-loops here!
X */
X	    Wait (1L << window -> UserPort -> mp_SigBit);
X/*
X *	Retrieve LAST message in Message Port
X */
X	    sys_message = GetMsg(window -> UserPort);
X	    class = sys_message -> Class;
X	    ReplyMsg(sys_message);
X/*
X *	Dump uneeded messages (respond only to the last on LIFO queue).
X */
X	    while (sys_message = GetMsg(window -> UserPort))
X	    {
X		ReplyMsg(sys_message);
X	    }
X
X	    if (class == CLOSEWINDOW)
X	    {
X		release_resources();
X		exit (NORMAL);
X	    }
X
X	    if (class == NEWSIZE)
X	    {
X		w_lim = (window -> Width) - 1 - LEFT_OFFSET;
X	    }
X	}
X}
X
X/**********************************************************************
X *
X *	cleanup routine
X *
X *	The ``switch'' on resource_state is to assure we don't attempt to
X *	free something we don't have.  Items are released in the reverse
X *	order they were obtained (by "falling thru" the cases).
X */
Xvoid release_resources()
X{
X	switch (resource_state)
X	{
X	    case 4: CloseWindow (window);
X	    case 3: CloseLibrary(GfxBase);
X	    case 2: FREE (screen, struct Screen);
X	    case 1: CloseLibrary(IntuitionBase);
X	}
X}
X
X/**********************************************************************
X *
X *	error handler
X */
Xvoid error_exit(message)
X	char	*message;
X{
X	if (message == 0L)
X	{
X	    printf("Internal failure, exiting gracefully...\n");
X	}
X	else
X	{
X	    printf(message);
X	}
X	release_resources();
X	exit (FATAL);
X}
END_OF_FILE
if test 12221 -ne `wc -c <'ruler4.c'`; then
    echo shar: \"'ruler4.c'\" unpacked with wrong size!
fi
# end of 'ruler4.c'
fi
echo shar: End of archive 1 \(of 1\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have the archive.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
-- 
Mail submissions (sources or binaries) to <amiga@cs.odu.edu>.
Mail comments to the moderator at <amiga-request@cs.odu.edu>.
Post requests for sources, and general discussion to comp.sys.amiga.