Newsgroups: comp.sources.unix
From: stevegru@welchlink.welch.jhu.edu (STEPHEN C GRUBB)
Subject: v29i088: copa - gui control panel kit for shell, C, perl - V1.0, Part01/08
Message-id: <1.823324036.2981@gw.home.vix.com>
Sender: unix-sources-moderator@gw.home.vix.com
Approved: vixie@gw.home.vix.com

Submitted-By: stevegru@welchlink.welch.jhu.edu (STEPHEN C GRUBB)
Posting-Number: Volume 29, Issue 88
Archive-Name: copa/part01

DESCRIPTION
     Copa (control panel kit) is an attempt to  reduce  a  useful
     amount  of graphical user interface (GUI) functionality down
     to a small self-contained command set which can be used pro-
     cedurally.   Copa includes mechanisms such as buttons, slid-
     ers, text/list boxes, data entry areas,  and  various  data-
     driven  plots;  and  may  be  used  from shell scripts, perl
     scripts, C programs, and other languages. It is optimized to
     easily  issue  and capture the output of system commands for
     browsing or point/click selection.  Copa may be  useful  for
     tasks  such  as adding gui control functionality to existing
     programs, and creating quick gui-based  help  systems,  data
     browsing/analysis tools, or system administration utilities.
     It is intended to be small and  easy  to  use  but  flexible
     enough to be useful for many situations, so that interactive
     point-and-click applications can  be  prototyped  and  built
     quickly  in  the  user's language of choice, without windows
     programming expertise.

	Stephen C. Grubb            stevegru@welchlink.welch.jhu.edu
	Wilmer Ophthalmological Institute
	Clinical Trials and Biometry Division
	Johns Hopkins University School of Medicine
	550 North Broadway, Ninth Floor
	Baltimore, Maryland,  21205  U.S.A.

#	This is a shell archive.
#	Remove everything above and including the cut line.
#	Then run the rest of the file through sh.
# - - - - - - C U T   H E R E - - - - - - - - - - - - - - -
#!/bin/sh
#
# Part 1.  Do this one first.
# 
# shar:	Shell Archiver
#	Run the following text with /bin/sh to create:
#		Abstract
#		Copyright
#		Manifest
#		README
#		gui.def
#		plot.def
#		presets.pan
#		src/Makefile

mkdir bin src man examples

echo Abstract
cat << \SHAR_EOF > Abstract
NAME
     copa - 1.0 gui control panel / graph kit for shell, C, perl,
     etc.
 
SYNOPSIS
     copa_window [win_x win_y width height title bkclr]
 
     copa [command] [args]
 
DESCRIPTION
     Copa (control panel kit) is an attempt to  reduce  a  useful
     amount  of graphical user interface (GUI) functionality down
     to a small self-contained command set which can be used pro-
     cedurally.   Copa includes mechanisms such as buttons, slid-
     ers, text/list boxes, data entry areas,  and  various  data-
     driven  plots;  and  may  be  used  from shell scripts, perl
     scripts, C programs, and other languages. It is optimized to
     easily  issue  and capture the output of system commands for
     browsing or point/click selection.  Copa may be  useful  for
     tasks  such  as adding gui control functionality to existing
     programs, and creating quick gui-based  help  systems,  data
     browsing/analysis tools, or system administration utilities.
     It is intended to be small and  easy  to  use  but  flexible
     enough to be useful for many situations, so that interactive
     point-and-click applications can  be  prototyped  and  built
     quickly  in  the  user's language of choice, without windows
     programming expertise.
 
ENVIRONMENT
     Copa can be used from shell scripts, perl programs,  or  any
     language  environment  which  can  execute  (and capture the
     standard output of) system commands.  This man  page  covers
     the  use  of  copa  in this mode.  For use within C programs
     compiled using the copa.a library, see the copa(3) man page.
 
     Copa requires X windows (xlib), and  was  developed  on  Sun
     Solaris 2.x and SunOX 4.x environments.
 
     The environment variable COPA_HOME must be defined  to  hold
     the  full  name  of  the  directory  where  copa  files  are
     installed. In order to handle multiple sessions by the  same
     userid,  the variable COPA_PIPE must be defined uniquely for
     each session.
 
EXAMPLE
	#!/bin/sh
	
	copa_window &
	sleep 1
	
	ANS=`copa pop "Do you like my hat?" "I Do,I Do Not"`
	echo $ANS
	
	ANS=`copa poplist "Select a file:" "!ls" "Cancel" `
	echo $ANS
	
	copa panload examples/examp1.pan e1
	
	ANS=`copa get`
	echo $ANS
	
	copa quit


     Some examples in C, bourne sh, and perl are in ./examples.

AUTHOR
     Stephen C. Grubb, The Johns Hopkins University
SHAR_EOF
############################

echo Copyright
cat << \SHAR_EOF > Copyright
COPA 1.0 - gui control panel kit for shell, C, perl etc.  
*              **      **                              *
Copyright 1991-1996 by Stephen C. Grubb.
---------------------------------------------------------

Please do not install or use this software unless you have
read and agree to abide by the following provisions:

Permission is hereby granted to USE this software for free.
Permission is hereby granted to MODIFY and/or REDISTRIBUTE 
this software for free, provided that: 1) no monetary gain is 
realized, 2) this file and all other attached authorship 
and copyright notices are preserved.

Inclusion of any portion (or derivation) of this software, 
including ancillary files, in any product to be sold or
distributed for monetary gain is not allowed without prior 
written permission of the author.  

If REDISTRIBUTING A MODIFIED VERSION, please add a one-line 
description of modifications under the ruled line above
and add it to version.c; also please append a brief summary 
of the purpose of modifications, including who made them, 
to the end of this file; finally, a courtesy email 
notification of the above to me (Steve G.) would be 
appreciated.

This software was written to assist in the author's work, 
and is made available without any warranty or claim of 
suitability for any particular use or purpose.  Although 
significant effort has gone into making this software reliable 
and useful, the user bears sole responsibility for all 
results or consequences derived from the use of this software.  
This software is a production solely of the author and is not 
endorsed by any organization mentioned in this notice.

Feedback regarding use of this software (or lack thereof) is 
solicited.  The amount of support that I will be able to 
give to this software is unknown and may be none at all.

Portions of this software are an indirect by-product of 
research sponsored by the National Eye Institute and the 
National Institutes of Health (U.S. Dept. of Health and 
Human Services).

Stephen C. Grubb            stevegru@welchlink.welch.jhu.edu
Wilmer Ophthalmological Institute
Clinical Trials and Biometry Division
Johns Hopkins University School of Medicine
550 North Broadway, Ninth Floor
Baltimore, Maryland,  21205  U.S.A.
------------------------------------------------------------
SHAR_EOF
############################

echo Manifest
cat << \SHAR_EOF > Manifest
      68     341    2404 Abstract
      52     341    2317 Copyright
       0       0       0 Manifest
      23     103     620 README
       0       1     512 bin
       8      15    1024 examples
     712    3604   21508 gui.def
       1       3     512 man
     911    5897   32687 plot.def
      92     283    1725 presets.pan
    2019   11154   66526 shar.1
       9      15    1536 src
    3895   21757  131371 total
      48     139     874 examples/Makefile
      67     352    2277 examples/README
      79     340    1845 examples/alarm.c
     147     839    5878 examples/basic.pan
      13      12     124 examples/blank.dta
      81     245    1641 examples/browser.sh
     330    1434    9393 examples/demo.c
     339    1331    8024 examples/demo.sh
      13      25     190 examples/doe.dta
     253     739    4620 examples/examp1.pan
     152     453    3054 examples/examp2.pan
       8      25     170 examples/exitb.pan
     249     571    3882 examples/form.pan
     103     338    2267 examples/form.sh
      25      78     436 examples/hello.perl
      29      74     412 examples/hello.sh
     166     442    2503 examples/legend.pan
      23      52     305 examples/list.pan
     748     748    2992 examples/mapdata
     314     313     762 examples/month.stubs
      13      26     210 examples/mva.dta
     116     587    3333 examples/oneplot.pan
      69     207    1469 examples/page.sh
     274     661    4259 examples/plots.pan
      77     220    1673 examples/preview.c
      73     246    1660 examples/preview.perl
      66     183    1302 examples/preview.sh
     132     385    2691 examples/slider.pan
      13      26     212 examples/smith.dta
     141     487    3279 examples/thplot.pan
     966    5432   35234 man/copa.1
      92     402    2538 man/copa.3
      51     363    2116 man/copa_mget.3
     123     807    4949 man/copadef.txt
     281    1784   11404 man/copapan.4
     106     546    3490 man/copaplot.4
      82     295    2042 src/Makefile
     440    2553   12625 src/Paxes.c
     191     953    5025 src/Pbargraph.c
     158     883    4583 src/Pdistribution.c
      47     289    1302 src/Pdraw.c
      52     235    1288 src/Perrorbars.c
      64     321    1591 src/Pfilld.c
      83     412    2295 src/Pgen.c
     158     807    4161 src/Phorizbar.c
     199     939    5342 src/Plegend.c
     221    1043    5592 src/Plineplot.c
     174     971    4923 src/Pmap.c
     109     578    3066 src/Ppgraphic.c
      92     401    2046 src/Ppie.c
      30      96     572 src/Ppinit.c
     162     734    3669 src/Pplib.c
      23      95     451 src/Ppstub.c
      45     176     861 src/Prect.c
      76     295    1499 src/Putil.c
     145     801    4155 src/align.c
      44     229     989 src/arrow.c
       7      73     377 src/bigbuf.h
      80     380    2186 src/block.c
    1067    5295   30556 src/copa_api.c
     213     943    5152 src/copa_button.c
     231    1068    5835 src/copa_cli.c
     294    1523    8670 src/copa_entry.c
     140     668    3734 src/copa_exec.c
     469    1933   10744 src/copa_gen.c
     123     538    3284 src/copa_init.c
     254    1176    6446 src/copa_pop.c
     254    1071    5946 src/copa_scroll.c
     125     603    3290 src/copa_setsel.c
     153     706    3776 src/copa_slider.c
     514    2109   12554 src/copa_srv.c
     832    4455   24823 src/copa_textbox.c
     203     944    5106 src/copa_txt.c
       3       8      45 src/copa_value.c
     229     987    5518 src/edit.c
     169     871    5157 src/elib.d
      75     360    2255 src/elib.h
      75     284    2022 src/elib.x
      13      47     287 src/err.c
     128     677    3708 src/graphic.c
     143     630    4169 src/init.c
     201     845    4471 src/interact.c
      84     428    2575 src/ipl.d
      79     480    3042 src/ipl.h
      60     318    2098 src/ipl.x
     337    1557    8118 src/lib.c
    1011    1173   10802 src/mapdata.h
     162     817    4205 src/mark.c
     249    1275    6556 src/obj.c
     394    1865   10763 src/pcode.c
     322    1481    8546 src/ps.c
      29      96     525 src/sleep.c
     112     358    2444 src/stub.c
      21      80     621 src/version.c
     128     674    3284 src/wild.c
      49     148     870 src/winscale.c
     647    2854   18028 src/x11.c
      86     241    2822 src/x11shades.h
    1824    8952   54457 src/zood.c
   19964   85009  499412 total
SHAR_EOF
############################

echo README
cat << \SHAR_EOF > README
copa 1.0- gui COntrol PAnel kit for shell, C, perl, etc.

This directory contains files for copa.  Before copa can be used,
an environment variable named COPA_HOME should be set to contain
the pathname of this directory.  

To read the short abstract:	more Abstract

To view the primary man page:	cd man
				nroff -man copa.1 | more

To print the primary man page:	cd man
				troff -man copa.1  (or groff, etc.)

To try the examples:		cd examples
				more README
				demo

To install: 		(read the file Copyright)
			cd src
			(check the Makefile - select system)
			make 
			move (or make links to) executables in ./bin
SHAR_EOF
############################

echo gui.def
cat << \SHAR_EOF > gui.def
# COPA 1.0 - gui control panel kit for shell, C, perl etc.  
# *              **      **                              *
# Copyright 1991-1996 by Stephen C. Grubb.
# 
# Permission is hereby granted to USE this software for free.
# Permission is hereby granted to MODIFY and/or REDISTRIBUTE 
# this software for free, provided that no monetary gain is 
# realized, and all attached authorship and copyright notices 
# are preserved.
# 
# Inclusion of any portion (or derivation) of this software, 
# including ancillary files, in any commercial product is not 
# allowed without prior written permission of the author.  
# 
# See also the file 'Copyright'. 

@@package std
 
##########################################################################
# STD - This file contains definitions of copa gui mechanisms, including 
# attributes and default values.
#
# Format is:
#
# attr-name    type             : def-val   :flags: constraint : desc 
#
# note: flags are used only by the standard attributes.
#  for descriptions of the various constraints see man page copapan(4)
#
# note: all distances are in inches from lower left of window.
#
# note: attributes of type X have secondary attributes available; for
#  example, in textb, the size of text can be controlled via attribute
#  text/size
###########################################################################




#--------|---------|---------|---------|---------|---------|---------|---------|
# SECONDARY ATTRIBUTE SETS
#--------|---------|---------|---------|---------|---------|---------|---------|

### * (STANDARD) - bounding box, alignment, etc. 
###              - used by all mechanisms which have a "X *-" line

@@begin *-

bb		D 4		:           :HU	: bbox      	: -
###  bounding box (internal) (coords of lower left, upper right)

bbt		C 1		: B	    :HU	: B,L	       	: -
###  bounding zone type (internal) (B=box, L=line)

trl             D 2 		: 0 0 	    :U  : coordpair     : -
###  translation vector (internal) (set by alignment)

display         C 1		: x  	    :U  : checkoff      : -
###  display it or not (x=yes blank=no)

tag             C 		:	    :U  : token         : -
###  identifier string

inherit         C		:	    :   : tag        	: -
###  tag of mechanism to inherit attributes from

align_h		C 		: 	    :U  : alex		: -
###  horizontal alignment expression

align_v		C 		: 	    :U  : alex		: -
###  vertical alignment expression

parent		I 1		:	    :HU : id		: -
###  id of parent mec (internal) (grouped mechanisms, not used)
@@end
 

#--------|---------|---------|---------|---------|---------|---------|---------|
### LINE PROPERTIES - used by attributes with basic type = X line_props- 

@@begin line_props-

thick 		D 1		: 1.0	       : : linethick     : -
###  line thickness 

dash 		I 1		: 0	       : : dashstyle     : -
###  dashstyle selector

dashdens 	D 1		: 1.0	       : : dashdens      : -
###  dash density selector

pen		C 6		: black	       : : pencolor      : -
###  color of line (black,white)
@@end
 

#--------|---------|---------|---------|---------|---------|---------|---------|
### TEXT PROPERTIES - used by attributes with basic type = X text_props-

@@begin text_props-

size		I 1		: 10	      : : textsize      : -
###  size of text in points

font		C 30		: /Helvetica  : : fontname      : -
###  postscript font name (not really used in this package)

pen		C 6		: black	      : : pencolor      : -
###  color of text (black,white)
@@end
 
#--------|---------|---------|---------|---------|---------|---------|---------|
### RECTANGLE DECORATION PROPERTIES - used by attributes with basic 
### type = X rect_dress-

@@begin rect_dress-

outline         X line_props-	: x    	      : : checkoff      : -
###  Outline the rectangle? (x=yes blank=no)

shadow 	 	D 1		: 0.0 	      : : color	        : -
###  Color of backdrop shadow 

shadow.size 	D 1		: 0.08	      : : distance      : -
###  Width of backdrop shadow

3d.upper	D 1		: -1.0        : : color	        : -
###  Color of 3d-effect shadow, upper-left (-1 = don't do)

3d.lower	D 1		: -1.0 	      : : color	        : -
###  Color of 3d-effect shadow, lower-right (-1 = don't do)

3d.size 	D 1		: 0.08	      : : distance      : -
###  Width of 3d-effect shadow
@@end
 
#--------|---------|---------|---------|---------|---------|---------|---------|
# SINGLE-SELECTION PROPERTIES - used by attributes with basic type = X pick_props-
@@begin 1_pick_props-

hzones		D 1		:	     :HU: number	: -
###  horizontal pick zone info (internal)

vzones		D 1		:	     :HU: number	: -
###  vertical pick zone info (internal)

hselect		I 2		: -1 -1	     :HU: int		: -
###  current horizontal pick (range) (-1 = off)

vselect		I 1		: 0	     :HU: int		: -
###  current vertical pick (range) (-1 = off)
###  first textb line is 1.

value		C 1		:	     :U : text		: -
###  contents of most recently picked line.  
@@end



#--------|---------|---------|---------|---------|---------|---------|---------|
# USER INTERFACE MECHANISMS
#--------|---------|---------|---------|---------|---------|---------|---------|




#--------|---------|---------|---------|---------|---------|---------|---------|
# BACKING - Set panel background.
# If used, it must appear in the .pan file before the definitions of any other 
# displayable mechanisms.
# 
# If backing is not used, the new control panel will appear on top of the
# old, if any (the old will still be visible as a remnant but may disappear
# if display is redrawn or the display is reexposed).
#
# If no box.width or box.height are specified, the whole window is cleared 
# before the panel is displayed.  No selection value is generated.  
# -1 is interpreted by the software to mean don't change the current value.

@@begin backing

*		X *-		:	      : : void		: -
###  include standard attrs

nobacking	C 1		:	      : : checkoff	: -
###  if set, prevents clearing of window (x=set blank=not set)

color		D 1		: -1.0	      : : color		: -
###  color of background

box.width	D 1		:             : : distance	: -
###  width of backing box

box.height	D 1		:             : : distance	: -
###  height of backing box

dress		X rect_dress-	: x	      : : checkoff	: -
###  rectangle decoration
@@end	





#--------|---------|---------|---------|---------|---------|---------|---------|
# TEXTB - This is used to present text.  Options include scrolling capability, 
# boxing, and various appearance-related options.   Mouse selection may be done
# on lines, words, or individual characters.

# Scrolling: Vertical scrolling capability will automatically be switched on 
# when there are more lines of text than 'nlines'.  Horizontal scrolling 
# will be enabled when there are more characters than 'box.width'.

# Selection value: When a user clicks on a textb, the selection is highlighted, 
# and a selection value is generated, according to this chart:
#   pick.mode       result.format      selection value
#   L (line)		  A		The entire selected line 
#   L (line)              F		The 1st token of selected line
#   L (line)		  3		The 3rd (or whatever) token
#		  (Delimitation of words is controlled by result.delim.list)
#   W (word)	    doesn't matter	The word which the user selected.  
#   C (char) 	    doesn't matter	The character which the user selected.  
#
# reminder: attributes of type X have secondary attributes available; for
#  example, the size of text can be controlled via attribute
#  text/size
#

@@begin textb

*		X *-		:	      : : void	        : -
###  include standard mec attributes

text 		X text_props-   :             : : text          : -
###  The literal text (if not coming from a file) 

file		C		:	      : : pathname	: -
###  Text can come from this file (this doesn't work for plot data)

position 	D 2 		: -1 -1       : : coordpair     : -
###  Position of beginning of text (default is middle of drawing area)
###  Rarely specified since it is almost always overridden by alignment.

align           C 6		: L	      : : L,C,R         : -
###  Align text context along L=left or R=right margins, or C=center it
###  (This has nothing to do with MECHANISM alignment)

spacing		D 1		: 0.0	      : : distance	: -
###  distance between lines of text. 0.0 results in "normal" spacing.

ruled		C 1		:  	      : : L,B     	: -
###  L=lines or B=boxes to separate text lines

numbered	C 1		:   	      : : checkoff	: -
###  show line numbers along the left margin (x=yes blank=no)

pick		X 1_pick_props-	:  	      : : checkoff	: -
###  enable mouse selections (x=yes blank=no)

pick.mode	C 1		: L	      : : L,W,C,0        : -
###  mouse selection mode L=line, W=word, C=char, 0=object

flashpick       C 1             :             : : checkoff      : -
###  if enabled, selected area stays highlighted only for an instant.
###  (x=enable blank=disable)

unpick		C 1		: 	      : : checkoff	: -
###  if enabled, clicking on a selected line (or whatever) does an 
###  "unselect", and the string ".!none" is the result.  
###  Otherwise, it "re-selects".  Useful only when flashpick is off.

result.format   C 1		: A	      : : token		: -
###  format of the mouse selection.  A=all.  This can be used to
###  extract only a desired part of the line, by giving an integer, 
###  e.g. 3  will cause only the 3rd token of the line to be returned.

result.delim.list C 15	        : ./ ,	;'"   : : text		: -
###  list of characters which will be considered token delimiters
###  by the result.format operation.

firstline	I 1		: 1	      : : int		: -
###  text line to start with

nlines		I 1		: 0   	      : : int		: -
###  number of lines to display.  If there are less lines of text 
###  than this, the box will be padded with space.  If there are
###  more lines than this, vertical scrolling will be enabled.
###  A value of 0 results in auto-sized length with no scrolling)

scrollcon	C 1		: F	      : : F,M		: -
###  scroll control style F=full  M=mini 
###  Useful for situations where the full scroll control is a bit much.

totallines	I 1		: 0	      :H: int 		: -
###  total number of text lines (internal)

longest		I 1		: 0	      :H: int 		: -
###  length of longest line (internal)

startcol	I 1		: 0	      : : int		: -
###  display text beginning with this character column.
###  useful for 'hiding' the first few characters of each line.

box		C 1		: x	      : : checkoff      : -
###  Generate backing box? (x=yes blank=no)

box.width    	I 1		: 0	      : : int           : -
###  Width of box (# of chars) (a value of 0 results in auto-sized 
###  width, no scrolling).  Margins are additional to this.

box.margin	D 1		: 0.1	      : : distance      : -
###  width of margin on all four sides.  Any explicit margins
###  (below) are additional.

box.marg_l	D 1		: 0.0         : : distance	: -
###  explicit margin, left side

box.marg_r	D 1		: 0.0         : : distance	: -
###  explicit margin, right side

box.marg_b	D 1		: 0.0         : : distance	: -
###  explicit margin, bottom side

box.marg_t	D 1		: 0.0         : : distance	: -
###  explicit margin, top side

box.color      	D 1 		: 1 	      : : color	        : -
###  color of backing box

dress		X rect_dress-   : x  	      : : checkoff      : -
###  rectangle dressing (x=yes  blank=no)
@@end






#--------|---------|---------|---------|---------|---------|---------|---------|
### DATAENTRY - This is a mechanism which allows the user to type in 
# (or change) one line of text.  The line of text should be terminated by 
# the user by typing a return, tab, or escape, or sometimes, a mouse
# click.
#
# For numeric input, individual digits can be decremented by pointing to
# the digit and pressing the middle mouse button, or incremented using
# the right mouse button (tweakmode).
#
# Selection value: the final contents of the field.  The selection value is 
# generated when the user terminates the string.

@@begin dataentry

*		X *-		:	      : : void		: -
###  include standard attributes

active		C 1		: 	      :U: checkoff	: -
###  is the region ready to recieve chars? (internal) (x=yes blank=no)

position	D 2		: 1 1	      : : coordpair	: -
###  location of left bottom - rarely used

text		X text_props-	: 	      : : void		: -
###  text properties of entered text.  The entered text is not here;
###  it is found in pick/value.

maxlength    	I 1		: 10	      : : distance      : -
###  Max # of chars that may be entered.

prompt		C 1		: 	      : : text		: -
###  Optional prompt string

box.margin	D 1		: 0.1	      : : distance      : -
###  width of margin on all four sides

box.color      	D 1 		: 1.0 	      : : color	        : -
###  color of backing box

dress		X rect_dress-   : x  	      : : checkoff      : -
###  rectangle decoration (x=yes blank=no)

pick		X 1_pick_props- :	      : : void		: -
###  user input 

cursor.color  	D 1 		: 0.0 	      : : color	        : -
###  color of cursor

showicur	C 1		: 	      : : checkoff	: -
###  x=show a hollow cursor when d.e. area is inactive
###  blank= no cursor when d.e. area is inactive

mousemode       C 1		: T	      : : T,R,I		: -
###  effect of a mouse click on an active dataentry area.  
###  T=terminate on any mouse click
###  R=terminate on a mouse click if within the mechanism bounding box
###  I=ignore mouse clicks

tweakmode	C 1		: x	      : : checkoff	: -
###  allow middle mouse button to increment, right mouse button to decrement.

next		C 1		: .!none      : : tag		: -
previous	C 1		: .!none      : : tag		: -
info		C 1		:	      : : text		: -
###  These three attributes are not used by copa but are for the
###  convenience of the application.  Suggested use: next = tag of next
###  data entry field to jump to; previous = tag of previous data entry
###  field; info = template or range/type checking information

@@end






#--------|---------|---------|---------|---------|---------|---------|---------|
# BUTTON - This mechanism displays one or more rectangular buttons, in a 
horizontal row.  The buttons have text labels.  The labels are supplied in 
the 'text' attribute, as a comma separated list (there is no way to make
a button contain a comma).  An empty string "" is ok.

Selection value is the label of the chosen button.  The selection value is 
generated at the time the user clicks on a button.
 

@@begin button

*		X *-		:	      : : void		: -
###  include standard attributes 
text/size       I 1		: 12

text		X text_props-	: 	      : : text		: -
###  button label(s), comma-separated list.

position	D 2		: 1 1	      : : coordpair	: -
###  location of upper-left - rarely used

box.margin	D 1		: 0.13        : : distance	: -
###  width of margin

box.color	D 1		: 1.0	      : : color		: -
###  color of box

width		D 1		: -1.0	      : : distance      : -
###  explicit width of buttons (margin additional).  If -1, buttons'
###  width will be auto-sized based on the contained text.

dress/3d.upper  D 1 		: 0.9	
dress/3d.lower  D 1 		: 0.7
###  These control the shading of the button shadows

dress		X rect_dress-   : x  	      : : checkoff      : -
###  rectangle decoration (x=yes blank=no)

unpick		C 1		: x	      : : checkoff      : -
###  if enabled, clicking on a highlighted button will unselect it,
### and the string ".!none" is returned.
### Otherwise, it "re-selects" it.  Useful only when flashpick is off.

flashpick       C 1             :             : : checkoff      : -
###  if enabled, selected area stays highlighted only for an instant.
###  (x=enable blank=disable)

pick		X 1_pick_props-	: 	      : : void		: -
###  user mouse selection info

message		C 1		: 	      : : text		: -
###  message(s) to be sent when button pressed - not used.
@@end





#--------|---------|---------|---------|---------|---------|---------|---------|
# SLIDER - This is a mechanism which allows the user to enter numeric values 
# by clicking on a sliding scale.
#
# The selection value is a string containing the numeric value.  It is 
# generated at the time the user clicks on the slider.


@@begin slider

*		X *-		:	      : : void		: -
###  standard

position	D 2		: 1 1         : : coordpair     : -
###  location of upper-left corner - rarely used

prompt		X text_props-	: slider      : : text		: -
###  prompt string

width		D 1		: 3.0	      : : distance	: -
###  width of the slider area in inches

height		D 1		: 0.3	      : : distance	: -
###  height of the slider area in inches

dress		X rect_dress-	: x	      : : checkoff	: -
###  rectangle dressing (x=yes blank=no)

text  		X text_props-   : x	      : : checkoff	: -
###  slider label text properties

min		D 1		: 0	      : : number	: -
###  min value

max		D 1		: 10          : : number	: -
###  max value

format		C 6		: %g	      : : text		: -
###  format for the numeric display, and the result (printf style)

left		D 1		: 	      : : distance	: -
###  location of slider left min (internal)

scalefact	D 1		: 	      : : number	: -
###  scale factor of the slider (internal)

increment	D 1		: 1	      : : number	: -
###  increment (resolution) of user input

pick		X 1_pick_props- : 	      : : void		: -
###  pick info
@@end	





#--------|---------|---------|---------|---------|---------|---------|---------|
# SCALEZONE - This mechanism sets up an area where plotting can take place.  
# A scalezone is defined before using plot mechanism.  For the available
# plotting mechanisms, see plot.def and man page copaplot(4).
# Currently, scalezones do not respond to user input.

@@begin scalezone

*		X *-		:	      : : void		: -
###  standard

position	D 2		: 1 1	      : : coordpair	: -
###  location of lower left - rarely used

width		D 1		: 3.0	      : : distance	: -
###  width of the scalezone in inches

height		D 1		: 3.0	      : : distance	: -
###  height of the scalezone in inches

xrange		D 2		: 	      : : number	: -
###  data range in x, e.g 0 33

yrange		D 2		: 	      : : number	: -
###  data range in y, e.g. 0 100

xscaletype	C 8		: linear      : : text		: -
###  type of scaling in x (log, yymm)

yscaletype	C 8		: linear      : : text		: -
###  type of scaling in y (log, yymm)

pick		C 1		: x	      : : checkoff	: -
###  make it pickable (currently not supported)

color		D 1		: 1.0	      : : color		: -
###  color to fill the zone (-1.0 = no fill)
@@end




#--------|---------|---------|---------|---------|---------|---------|---------|
# RECTANGLE - Produces a rectangle.  
# Selection value is a null string ("") but only if "pick" is 
# enabled.  
#
@@begin rectangle

*		X *-		:	      : : void		: -
###  standard

position	D 2		: 4 2         : : box		: -
###  center of rectangle

horiz		D 1		: 2.0         : : distance	: -
###  distance from center to side

vert		D 1		: 1.0	      : : distance	: -
###  distance from center to top or bottom

color		D 1		: 1.0         : : color		: -
###  color of fill (-1.0 = no fill)

outline		X line_props-	: x 	      : : checkoff	: -
###  outline the rectangle

text		X text_props-	: 	      : : text		: -
###  text to appear within rectangle

pick		C 1		:	      : : checkoff	: -
###  make it pickable
@@end





#--------|---------|---------|---------|---------|---------|---------|---------|
# ELLIPSE - Produces an ellipse or circle.
# Selection value is a null string ("") but only if "pick" is enabled.  
#
@@begin ellipse

*		X *-		:	      : : void		: -
###  standard

position	D 2		: 2 2         : : coordpair	: -
###  center of ellipse/circle

hradius		D 1		: 2.0         : : distance	: -
###  radius in the horizontal direction

vradius		D 1		: 1.0	      : : distance	: -
###  radius in the vertical direction

color		D 1		: 1.0 	      : : color		: -
###  color of fill (-1.0 = no fill)

outline		X line_props-	: x	      : : checkoff	: -
###  outline the ellipse/circle

text		X text_props-	: 	      : : text		: -
###  text to appear in ellipse/circle

pick		C 1		:	      : : checkoff	: -
###  make it pickable
@@end





#--------|---------|---------|---------|---------|---------|---------|---------|
# LINE - Produces a line.

@@begin line

*		X *-		:	      : : void	        : -
###  standard

props		X line_props-	: x	      : : checkoff      : -
###  line properties

end1		D 2		: 1 1	      : : coordpair     : -
###  endpoint 1

end2		D 2		: 2 1	      : : coordpair     : -
###  endpoint 2
@@end





#--------|---------|---------|---------|---------|---------|---------|---------|
# ELIB_JOURNAL - This is a mec which is made up of a journal of elib draw 
# operations.  Not currently used.

@@begin elib_journal		#elib drawing operations log

*		X *-		:	      : : void		: -
###  standard

text		C		:	      : : text		: -
###  journal text
@@end



#--------|---------|---------|---------|---------|---------|---------|---------|
# GROUP - this is a mechanism which is a group of mechanisms

@@begin group_begin		#object grouping, begin

*		X *-		:	      : : void		: -
###  standard

endid		I 1		:	    :HU : int		: -
###  object id of matching end
@@end


@@begin group_end		#object grouping, end
@@end

#COPA 1.0 - gui control panel kit for shell, C, perl etc.  
#*              **      **                              *
#Copyright 1991-1996 by Stephen C. Grubb.
#
#Permission is hereby granted to USE this software for free.
#Permission is hereby granted to MODIFY and/or REDISTRIBUTE 
#this software for free, provided that no monetary gain is 
#realized, and all attached authorship and copyright notices 
#are preserved.
#
#Inclusion of any portion (or derivation) of this software, 
#including ancillary files, in any commercial product is not 
#allowed without prior written permission of the author.  
#
#See also the file 'Copyright'. 
SHAR_EOF
############################

echo plot.def
cat << \SHAR_EOF > plot.def
# COPA 1.0 - gui control panel kit for shell, C, perl etc.  
# *              **      **                              *
# Copyright 1991-1996 by Stephen C. Grubb.
# 
# Permission is hereby granted to USE this software for free.
# Permission is hereby granted to MODIFY and/or REDISTRIBUTE 
# this software for free, provided that no monetary gain is 
# realized, and all attached authorship and copyright notices 
# are preserved.
# 
# Inclusion of any portion (or derivation) of this software, 
# including ancillary files, in any commercial product is not 
# allowed without prior written permission of the author.  
# 
# See also the file 'Copyright'. 

@@package plot
##############################################################################
# PLOT - This package defines mechanisms for data plotting.
#
# All of these objects need to have a scalezone already defined (see gui.def).
# The plot mechanism is linked to the scalezone via the Plot/Zone attribute.
#
# Plot data should be loaded into a textbox.  The textbox's tag should be
# given as the Plot/Datasource attribute in any plot mechanism which will
# use the data.
#
#
#
# Format is:
# attr-name    type             : def-val   :flags: constraint : desc 
#
#      note: flags are used only by the standard attributes.
#         for descriptions of the various constraints see man page copapan(4)
#
#      note: all distances are in inches from lower left of window.
#         unless in data units
#
#      note: attributes of type X have secondary attributes available
##############################################################################


#  ------|---------|---------|---------|---------|---------|---------|---------|
# SECONDARY ATTRIBUTES
#  ------|---------|---------|---------|---------|---------|---------|---------|


# * (STANDARD)
@@begin *-

display         C 1		: x  	    :U  : checkoff      : -
###  display the object or not

tag             C 		:	    :U  : token         : -
###  instance identifier

inherit         C		:	    :   : tag        	: -
###  inheritance 
@@end



#  ------|---------|---------|---------|---------|---------|---------|---------|
# COPA/IPL INTERFACE PROPERTIES
@@begin plot-

Zone		C 1		:	    :   : tag		: -
###  Tag of the scalezone (see gui.def) where the plot object should be placed.

Datasource      C 1		:           :   : tag           : -
###  Tag of the object (usually a textb) which holds tabular data.
@@end



#  ------|---------|---------|---------|---------|---------|---------|---------|
# PLOT MECHANISMS
#  ------|---------|---------|---------|---------|---------|---------|---------|


# AXES - draws axes, labels, and other plot area decoration.
 
@@begin Axes

*               X *-            :           :   : void          : -
###  standard obj attributes

Plot            X plot-         :           :   : void          : -
###  plot interface attributes

Xinc		D 1		: 1		: : number	: -
###  This is the increment between which stubs will be placed along
###  the X axis.  For example, a value of 5 would give: 0, 5, 10..

Xstub 		C 1		: num		: : text	: -
### This parameter determines the text for the X axis stubs.  It may
#   be the text itself (one line per stub); or it may be "num" 
#   which turns on numeric stubs; or it may be the name of a file 
#   which contains stub text; or it may indicate that the stub text
#   should come from a field in the data.  Also available are month/
#   year stubs, which are invoked by using Xstub: month.

Yinc		D 1		: 1		: : number	: -
### Increment in Y. (See Xinc, above)

Ystub 		C 1 		: num		: : text	: -
###  Stubs in Y.  (See Xstub)  Same as Xstub except that there are no
#  month/year stubs, and there can be no multiple line stubs.  In the Y
#  direction, numeric stubs ("num") are the most often used.

Font		C 1		:		: : token	: -
###  Font to be used on axis labels etc.

Frame		C 6		: none		: : token	: -
###  Either none, single, or double. Specifies a frame of graphic area 

# Shade		D 1		: 1.0		: : color	: -
###  Shade of graphic area.  While usually white, graphic area
# # is sometimes also shaded light gray.
#

Subtitle	C 1		:		: : text	: -
###  Title for the graphic area.  

Subtitle.above	D 1		: 0.02		: : distance	: -
###  Distance of 1st subtitle line above window top in inches.

Subtitle.font	C 1		:		: : token	: -
###  Font for area title.

Subtitle.justify C 6		: left		: : token	: -
###  either center, left, or right
#  Causes subtitle to be centered, or left or right justified.

Subtitle.size	I 1		: 10		: : textsize    : -
###  Char size of subtitle.

Xaxis		C 6		: bottom	: : token	: -
###  either top, bottom, or none
#  This specifies where the x axis is to be drawn.  While usually
#  drawn at the bottom of the graphics area, it can be drawn at
#  the top, or both, or not at all.

Xlabel.position D 1		: 0.6		: : distance	: -
### Distance of X axis identifier text from window bottom, in inches.

Xlabel.size 	I 1		: 10		: : textsize	: -
###  Char size for x axis identifier text.

Xlabel		C 1		: 		: : text	: -
###  The actual X axis identifier text is given here.

Xstart.0or1	I 1		: 0		: : int		: -
###  This is set to "1" when doing bar graphs, other times, it is "0".

Xstub.fileline  I 1		: 0		: : int		: -
###  Line in a stub text file to start with.

Xstub.grid	C 5 		: none		: : token	: -
###  either line,shade,none,wline (wline=white lines)
#  This is a stylistic parameter which allows you to set up a grid of 
#  lines or shaded blocks.

Xstub.minor	I 1		: 0		: : int		: -
###  Create minor tics forming this many divisions between regular tics.
#  For example, a value of 2 will cause one minor tick between every 
#  major tick.

Xstub.nolonetics C 1		: y		: : y,n		: -
### If y, no tics will be produced where there are no stubs. 

Xstub.shade	D 1		: 0.98		: : color	: -
### Shade for the shaded blocks if Xstub.grid is set to "shade".

Xstub.size 	I 1 		: 7		: : textsize    : -
### Char size for stubs.

Xstub.startmonth I 1 		:		: : int		: -
### For month stubs, leftmost month.  (See Xstub).

Xstub.startyear  I 1 		:		: : int		: -
### For month stubs, leftmost year.  (See Xstub). 

Xstub.stubs	C 6		: bottom	: : token	: -
###  either bottom,top,both,none
#  This parameter controls the placement of stubs.  While usually
#  placed along the bottom, they can also be placed along the top,
#  or both, or none at all.

Xstub.ticlen.minor  D 1		: .035		: : distance	: -
###  Length of minor tics in inches.  Positive values cause tics to point
#  away from the graphic area, while negative values cause tics to point 
#  into the graphic area. 

Xstub.ticlen	D 1		: 0.08		: : distance	: -
###  Length of minor tics in inches.  Positive values cause tics to point
#  away from the graphic area, while negative values cause tics to point 
#  into the graphic area. 

Xstub.tics	C 6 		: bottom	: : token	: -
###  bottom,top,both,none
#  This parameter controls the placement of tics.  While usually
#  placed along the bottom, they can also be placed along the top,
#  or both, or none at all.

Xstub.yofs	D 1		: 0.2		: : distance   : -
###  Distance of stub text from x axis in inches.  Positive values cause
#  stubs to be placed away from the graphics area, while negative 
#  values cause stubs to be placed into the graphics area.

Xticfmt	     C 1		: %4.0f		: : token	: -
###  This parameter controls the precision of numeric stubs in X, and any
#  other labels in X (such as lineplot labels).  It uses the convention
#  of the C printf(3) routines.  For example, %4.0f would give 10;
#  %4.1f would give 10.0; %4.2f would give 10.00, etc.

Yaxis		C 5		: left		: : token 	: -
###  either left,right,both,none
#  Where to draw Y axis. (See Xaxis, above)

Ylabel.position D 1		: 0.6		: : distance	: -
###  Position of Y identifying label text from Y axis.  Positive values
#  cause text to be placed away from graphic area; negative values 
#  cause it to be placed in the graphics area.

Ylabel.size  	I 1		: 10		: : textsize	: -
###  Size of Y label identifying text. (See Xlabel.size)

Ylabel		C 1		:		: : text	: -
###  The Y label identifying text itself.  This text is rotated 90 
#  degrees (shown as a shaded block on windows displays).

Ystart.0or1	I 1		: 0		: : int		: -
###  Should be set to "1" for Vbargraph; "0" otherwise.

Ystub.fileline	I 1		: 0		: : int		: -
###  Line in a stub text file to start at (See Xstub.fileline).

Ystub.grid	C 5		: none 		: : token 	: -
###  either line,shade,none,wline
#  Style parameter.  (see Xstub.grid).

Ystub.minor	I 1		: 0		: : int 	: -
###  Make minor stubs, creating this many divisions.  (See Xstub.minor)

Ystub.nolonetics C 1		: y		: : y,n		: -
###  If y, no tics will be produced where there are no stubs.

Ystub.shade	D 1		: 0.98		: : color	: -
###  Shade for the shaded blocks if Ystub.grid is set to "shade".

Ystub.size 	I 1		: 7		: : textsize	: -
### Char size for stubs.

Ystub.stubs 	C 5		: left		: : token	: -
###  either left,right,both,none
#  Produce stubs on left, right, both or niether sides (see Xstub.stubs)

Ystub.ticlen.minor D 1		: 0.035		: : distance    : -
###  Length of minor tics (See Xstub.ticlen.minor)

Ystub.ticlen	D 1		: 0.08		: : distance	: -
###  Length of major tics (See Xstub.ticlen)

Ystub.tics	C 5		: left		: : token	: -
###  either left,right,both,none
#  Which side(s) to put tics on. 

Ystub.xofs	D 1		: 0.1		: : distance	: -
### Distance from y axis to right side of y stub.  Positive values move
#  away from graphics area; negative values move into graphics area.

Yticfmt	        C 1		: %4.0f		: : token	: -
###  Format for display of numbers in Y (See Xticfmt).
 
#  More info on stubs:
#   When giving text, remember to use one line per stub.
#  Multi-line stubs are possible using '~' to symbolize newline,
#  for example "Ford~Motor~Company" would occupy three lines.  It
#  is also possible to do irregular tic placement by prefacing
#  numeric stubs with a '!', which will cause the stub to be placed
#  at the stub value.  For example "!3" will cause the stub "3" to
#  be placed at X=3.  It is also OK to use blank lines, which will
#  cause a tic to be produced, but no stub (but see Xstub.nolonetics).
#   Numeric stubs will be placed from Xmin to Xmax, based on Xinc.  
#  Precision will be based on the Xstub.ticfmt parameter, which 
#  defaults to no digits to the right of the decimal point.
#   If stubs are to come from a data field, use '@' followed by
#  the field number.  For example, @4 would use the 4th field in
#  the data for stubs.  Of course, data must already have been read
#  using Proc Getdata.
#   If using month stubs with yymm scaling, Xmin and Xmax determine
#  the range in months.  Otherwise, Xstub.startmonth and Xstub.startyear
#  must be given.
@@end


#--------|---------|---------|---------|---------|---------|---------|---------|
# PIE - produces a pie graph.  Uses absolute (inch) units rather than 
# data units (a scalezone still needs to be set up to define position).  
# Expects data which is expressed as percentages, e.g., 34 will correspond 
# to 34%.

@@begin Pie

*               X *-            :           :   : void          : -
###  standard obj attributes

Plot            X plot-         :           :   : void          : -
###  plot interface attributes

Field           I 1             : 1         :   : datafield     : -
###  Field containing the data.

Center          D 2             : 3 3       :   : coordpair     : -
###  Location (x,y) of center, in inches. - rarely used

Radius          D 1             : 2         :   : distance      : -
###  Radius, in inches.

Shade           D 8             : 0.8 0.2 1 0 0.5 0.9   :   : color         : -
###  Shades of pie sections, one per section.

Linethick       D 1             : 1         :   : linethick    : -
###  Line thickness.

Explode         D 1             : 0.1       :   : distance      : -
###  Amount that sections are 'exploded' in inches

Rotate          I 1             : 0         :   : number        : -
###  Number of degrees to rotate final pie.
@@end




#  ------|---------|---------|---------|---------|---------|---------|---------|
# LINEPLOT - produces a line plot
#
@@begin Lineplot

*               X *-            :           :   : void          : -
###  standard obj attributes

Plot            X plot-         :           :   : void          : -
###  plot interface attributes

Yfield		I 8		:		:  :  datafield : -
### This should contain the data field where the Y component can
#  be found.  One should be given for each curve.

Xfield		I 1		:		:  :  datafield : -
###  This should contain the data field containing the X component
#  of the line.  Note that although multiple curves can be generated,
#  only one set of X components is used.  This parameter can be
#  omitted, causing X to default to ordinal (X=0, X=1, X=2..).

Accum		C 1		: n		: : y,n : -
###  Allows accumulation of yalues of y, for cumulative curves.

Label 		C		:		: : text	: -
###  This allows one line of text to be placed at the end of
# (each) curve, for identification.  Use one line of text per 
# curve.

Label.size 	I 1		: 8		: : textsize		: -
###  Char size for line identifier (see Label).

Linetype 	I 8		: 0 1 2 3 4 5 6 7 : : dashstyle	: -
###  Line dash type.  See the legend example for a display of
#  available line types.  Specify one value for each curve.

Linetype.magnify  I 8		: 3 3 3 3 3 3 3 3 : : dashdens	: -
###  Line dash magnification factor.  Increasing this number will 
#  make each segment of the dash pattern longer.  Specify one
#  value per curve.

Linethick 	I 8		: 1 1 1 1 1 1 1 1 : : linethick	: -
### Line thickness.  Increasing this value will make the line
#  thicker.  Specify one value per curve.

Mark		C		:		:  :  mark     : -
###  It is possible to overlay point markers for each data point.
#  Each point marker can be a character eg P, or a symbol name
#  such as sym6e.  Specify one per curve. 

Mark.size	I 1		: 7		:  :  textsize  : -
###  Size for mark chars in points.

Numberfinal	C 1		: n		:  :  y,n	: -
###  Allows the final Y value to be printed near the end of the curve.

Numbers		C 1		: n		:  :  y,n	: -
###  Allows the Y value of every data point to be displayed.  For
#  stairstep curves, this value is centered between X locations.

Numbers.offset  D 1		: 0.015		:  :  distance	: -
###  Allows control of the numbers generated when Numbers is in 
#  effect.  Distance of numbers (+) above or (-)below line, in 
#  inches.

Shade		D 8		:		:  :  color  : -
### It is possible to shade the area below the curve.  This will
#  happen when a shade is specified here.  There should be one
#  shade given for each line.

Stairstep	C 1		: n		:  :  y,n	: -
###  Causes lines to form steps rather than diagonals, like square
#  waves.  Note: shading and marking don't work when this is on.

Stairstep.bars  C 1		: n		:  :  y,n	: -
### This is used when superimposing a stairstep line plot over a
#  bargraph.  It has the effect of moving the line plot over a
#  half unit.

Taillen		D 1		:		:  :  distance	: -
### Can be used for stairstep style plots.  Controls length of final
#  segment, in data units.  If this parameter is omitted, the segment 
#  will be about 2/3 of the X increment. (v1.1)

Xstart.0or1	C 1		:		:  :  0,1	: -
###  If X is defaulting to ordinal (see Xfield) this parameter 
#  adjusts the starting point (either 0 or 1).

Zeroat		D 1		: 0		:  :  num	: -
### This allows setting the value in Y where a "zero crossing"
#  takes place.  See the lineplot example.

@@end




#  ------|---------|---------|---------|---------|---------|---------|---------|
# BARGRAPH - produce a bar graph (vertical bars).  
# Produces single, clustered or stacked bar graphs.
# Format parameter can be used to select which one.  If clustered or stacked
# format is being done, data for each sub-bar must come from a different
# field.  The Field parameter should contain the field or fields in the
# order that they are to appear, from left to right. Each line of data 
# produces one major bar (a bar or set of sub-bars).
#
#   Unless Xfield is specified, bars will be drawn starting at the left
# and moving to the right, one per data unit.  For example, if the X axis
# is scaled from 0 to 10, 9 bars will be produced at X=1 through X=9, assuming
# there are 9 or more lines of data.  Xstart.0or1 can be set to 0 to have
# the bars start at 0 instead of 1.
#
#   If Xfield is specified, that field will be used as the X location of
# the center of the bar or sub-bars.  Zeros set to n will supress the 
# printing of value labels equal to 0.
#
#   Bars can be outlined (using Outlinebars), shaded (using Shade), or labeled
# (using Idfield).  Shading and labeling require one value for each sub-bar,
# if doing clustered or stacked bars.  Labeling is done by specifying field(s)
# from the data.

@@begin Bargraph

*               X *-            :           :   : void          : -
###  standard obj attributes

Plot            X plot-         :           :   : void          : -
###  plot interface attributes

Field           I 1		: 1	    :   : datafield     : -
###  Field(s) containing the data. For single bars, one field should be 
#  specified, for stacked or clustered, multple fields should be given.

Format		C 6             : single    :   : token		: -
###  Dictates the format: can be one of: single,cluster,stack 

Idfield		I 1		:	    :   : datafield     : -
###  Bars can be labeled from this field(s).

Idfield.position D 1		: 0.02      :   : distance      : -
###  distance of label above (or below if negative) top of bar (inches).

Idfield.size 	I 1             : 6         :   : textsize : -
###  Char size of bar labels.

Idfield.top     C 1             : n	    :   : y,n           : -
### When bars are stacked, labels can be confined to printing on the top
#  bar.  You must specify an Idfield for all bars, however only the 
#  first one will be used for printing.   (v1.1)

Idfield.zeros	C 1		: n	    :   : y,n           : -
###  This option when set to "no" will supress the printing of bar 
#  labels equal to 0.

Killwild	D 1             :           :   : number        : -
###  This is used to automatically terminate a bargraph when a data value 
#  exceeds this number.  This is desirable, say, for percentage 
#  distributions when N gets too low.

Outlinebars	C 1             : y         :   : y,n           : -
###  If y, surround each bar with a line.

Segment		C 1		: n	    :   : y,n           : -
###  This is a stylistic parameter which segments bars at axis tics 
# with white lines.

Separation      D 1             : 0.2       :   : distance      : -
###  This parameter specifies the amount of separation between bars (not
#  sub-bars in a cluster, though).  If Xfield is being used, this
#  parameter controls the width of the bars.

Separation.sub  D 1          	: 0.03      :   : distance      : -
###  This parameter specifies the amount of separation between sub-bars 
#  in a cluster.

Shade 		D 5             : .2 .9 .8 1 0 : : color   : -
###  This specifies the shading for the bars. For stacked or clustered
#  bars, several values should be given.  The defaults work well.

Xstart.0or1	I 1 		: 1	       : : 0,1          : -
###  Usually, bars look best when the first on is placed at X=1.  
# However, it is possible to start them at X=0.

Xfield		I 1             :	       : : datafield    : -
###  X position of bars can be determined by this data field.  Usually,
# they are done ordinally, that is with the first at X=1, the second
# at X=2, and so on, in which case Xfield does not have to be supplied.  

Zeroat          D 1		:		: : number	: -
###  Places the "zero" line at this location in Y.  Values less than this
# will cause bars to go downward.

@@end


#  ------|---------|---------|---------|---------|---------|---------|---------|
# HORIZBAR - bargraph with the bars displayed horizontally.
#
# Exactly the same as Bargraph except that bars grow from left to right.
# Format parameter can be used to select which type of bargraph.  If 
# clustered or stacked, data for each sub-bar must come from a different
# field.  The Field parameter should contain the field or fields in the
# order that they are to appear, from left to right. Each line of data 
# produces one major bar (a bar or set of sub-bars).
#
#   Unless Yfield is specified, bars will be drawn starting at the bottom
# and moving to the top, one per data unit.  For example, if the Y axis
# is scaled from 0 to 10, 9 bars will be produced at Y=1 through Y=9, 
# assuming there are 9 or more lines of data.  Ystart.0or1 can be set 
# to 0 to have the bars start at 0 instead of 1.
#
#   If Yfield is specified, that field will be used as the Y location of
# the center of the bar or sub-bars.
#
#   Bars can be outlined (using Outlinebars), shaded (using Shade), or 
# labeled# (using Idfield).  Shading and labeling require one value for 
# each sub-bar, if doing clustered or stacked bars.  Labeling is done 
# by specifying field(s) from the data.


@@begin Horizbar

*               X *-            :           :   : void          : -
###  standard obj attributes

Plot            X plot-         :           :   : void          : -
###  plot interface attributes

Field		I 1		: 1	      : : datafield	: -
###  -
#  This specifies the data field which should contain the values
#  to be plotted.  If doing stacked or clustered bars, one field
#  for every sub-bar should be given.

Format		C 7		: single	: : token	: -
###  either single,cluster,stack
#  Selects either single bars, clusters, or bars stacked up.

Idfield		I 1		: 		: : datafield	: -
###  It is possible for an identifier to come from the data.  This
#  indicates the field where that identifier can be found.  Again,
#  if doing stacked or clustered bars, one field for every sub-bar
#  should be given.

Idfield.size 	I 1		: 6		: : textsize : -
###  Char size of labels.

Idfield.position D 1		: 0.02		: : distance	: -
###  Distance of label above (or below) top of bar (inches).

Killwild	 D 1		:		: : number	: -
###  If a data value greater than this is found, abort.  Typically 
# used for low N on percentage distributions. 

Outlinebars	 C 1		: y		: : y,n		: -
###  Allows bars to be outlined.

Segment		 C 1		: b		: : y,n		: -
###  Style parameter causing bars to be segmented by white lines.

Separation	 D 1		: 0.2		: : distance	: -
###  This controls the distance between bars.  If Yfield is 
# being used, this controls the width of the bars.

Separation.sub   D 1		: 0.03		: : distance	: -
###  Distance between sub-bars in cluster.

Shade 		 D 5		: .2 .9 .8 1 0  : : color	: -
###  A shade for each bar (sub-bar).

Ystart.0or1	 I 1		: 1		: : int		: -
###  Start bars at Y=0 or Y=1.  Almost always, bars work better 
# when started at Y=1.

Yfield		 I 1		:		: : datafield	: -
###  Y position of bars (optional).

Zeroat		 D 1		: 		: : number	: -
###  Bars point left at values less than this (usually 0)

@@end



#  ------|---------|---------|---------|---------|---------|---------|---------|
# DISTRIBUTION
#
#   Produces either scatter plots (2-way) or bar distributions (1-way).
# For scatter plots, Xfield and Yfield must be specified.  For bar 
# distributions, only Xfield need be specified.  If Axdist=y, little bar
# distributions will be put on each axis along with the scatter plot.
# Idfield can be used to print identifiers from the data as the scatter points.
#   The size, color, position, and dot marker can all be controlled from
# various data fields, allowing a number of multi-variate views.

@@begin Distribution

*               X *-            :           :   : void          : -
###  standard obj attributes

Plot            X plot-         :           :   : void          : -
###  plot interface attributes

Axdist		C 1		: n		: : y,n		: -
###  This parameter turns on axes distributions for scatterplots.  Axes
#  distributions are little bar distributions on each of the axes.

Axdist.length 	D 1		: 0.08		: : distance	: -
###  If Axdist is turned on, this sets length of the little bars. 

Cluster		C 1		: y		: : y,n		: -
###  If y, overlapping points are slightly offset to show duplicity.

Mark		C 7		: sym6e		: : mark : -
###  Symbol code such as sym6e or character such as P for dots.
###  See copapan(4) for more on symbol codes.

Mark.field	I 1		:  		: : datafield   : -
###  If specified, mark is contents of this field.  This is a handy 
# way to show multi-variate distributions.

Mark.font	C 1		:		: : token	: -
###  Font for points, if using characters.

Mark.size	I 1 		: 6		: : textsize  : -
###  Size (in points) for dots.

Shadefield	I 1		:		: : datafield	: -
### It is possible to display an additional variable as dot color.  To do
#  this, specify the data field number here, and specify a scaling factor in
#  Shadescale.

Shadescale	D 1		:		: : color	: -
### Factor for scaling data to acceptable shade range (0..1).

Sizefield	I 1		: 		: : datafield	: -
### It is possible to display an additional variable as dot diameter.  To do
#  this, specify the data field number here, and specify a scaling factor in
#  Sizescale.

Sizescale	D 1		:		: : number	: -
###  Factor for scaling data to acceptable size (4..20) for use with size field.

Xfield		I 1		: 		: : datafield	: -
### X data comes from this field. 

Yfield		I 1		:		: : datafield	: -
###  Y data field.  If Yfield ommitted, a bar distribution is done.

@@end





#  ------|---------|---------|---------|---------|---------|---------|---------|
# ERRORBARS
#
#  Errorbars produces bars around a point, given the (x,y) location 
# of a point, as well as the error amount.  These come from the data,
# in fields specified in the parameters Xfield, Yfield, and Errfieldm
# respectively.  Offset can be used if multiple curves are close
# together.

@@begin Errorbars

*               X *-            :           :   : void          : -
###  standard obj attributes

Plot            X plot-         :           :   : void          : -
###  plot interface attributes

Double		C 1		: y		: : y,n		: -
###  display 2 times the error amount? (y=yes n=no)

Errfield	I 1		: 1		: : datafield	: -
###  field containing error amount in y

Linethick	D 1		: 0.3		: : distance	: -
###  line thickness for error bars

Offset		D 1		:		: : distance	: -
###  amount of offset in X, in inches

Taillen		D 1		: 0.04		: : distance	: -
###  width of tails at the end of the bars

Xfield		I 1		:		: : datafield	: -
###  field containing point x location

Yfield		I 1		:		: : datafield	: -
###  field containing point y location
@@end




#  ------|---------|---------|---------|---------|---------|---------|---------|
# MAP
#
# USA maps and state distributions
# For best results, scale the scalezone to 40x40.
#
@@begin Map

*               X *-            :           :   : void          : -
###  standard obj attributes

Plot            X plot-         :           :   : void          : -
###  plot interface attributes

Country		C 3		: usa+canada	: : token	: -
###  Selects the overall format: USA only, or USA and Canada.

Country.linethick D 1		: 1.0		: : linethick   : -
###  Thickness for country boundary lines.

List		C 1		: y		: : y,n		: -
###  Allows text listing of state tabulations (to the right of the map).

Mode		C 5		: state		: : token	: -
###  one of country,state,statedist
#  Selects the overall mode.  For country outlines use "country";
#  for country and state outlines use "state"; for shaded state
#  distribution based on data, use "statedist".

Shade		D 6		: 1 .9 .8 .6 .4 .2 : : color   : -
###  When doing shaded state distribution, use this parameter to
#  select shades for the breakdowns.

Statefield	I 1		: 1		: : datafield	: -
###  When doing shaded state distribution, this selects which field
#  in the data contains the identifying state abbreviation.  
#  Abbreviations must be the standard Postal Service state
#  abbreviations, in lower case.

State.linethick D 1		: 0.7		: : linethick  : -
###  Thickness for state boundary lines.

Threshold	D 1		: 		: : number	: -
###  This sets up a list of thresholds for determining shading break-
#  down when doing a state distribution.  They should be in increasing
#  order.  For example, "1 10 20 30 40 50" will set up 6 categories
#  (1-9, 10-19, 20-29, 30-39, 40-49, >50) and produce states with 6 
#  different shades based on the value totals associated with each state.  

Valfield	I 1		:		: : datafield	: -
###  This allows specification of a field in the data containing values
#  which will be added up.  If not specified, each record will add
#  one to its state's total.
@@end



#  ------|---------|---------|---------|---------|---------|---------|---------|
# LEGEND
#
# Produces a legend.  For lineplots, you will want to show lines, 
# parameters such as Linetype should be specified.  For bargraphs,
# you will want to show swaths of grey, and Shade should be specified.
# For 2-way distributions, you will want marks, and Mark
# should be specified.  Mark and Linetype can be combined.  Shaded
# squares, lines, and marks can not be intermixed on different
# lines.  Currently there is a maximum of 10 entries.

@@begin Legend

*               X *-            :           :   : void          : -
###  standard obj attributes

Plot            X plot-         :           :   : void          : -
###  plot interface attributes

Backshade	D 1		:		: : color	: -
###  This allows a shade (usually white or light gray) to be 
#  specified for the legend background. 

Entry		C 1		: 		: : text	: -
###  Text for legend entries, one per line 

Entry.size	C 1		: 7		: : textsize	: -
###  Char size for legend entries

Entry.font	C 1		: 		: : token	: -
###  Font for legend entries.

Linetype	I 1		:		: : dashstyle	: -
###  Line dash type.  One should be specified for each legend entry.

Linetype.magnify D 8		: 3 3 3 3 3 3 3 3   : : dashdens : -
###  Mag. factor for dash pattern.  One should be specified for each
#  legend entry.

Linethick	D 8		: 1 1 1 1 1 1 1 1  : : linethick : -
###  Thickness of line.  One should be specified for each legend
#  entry.

Mark		C 6		: 		: : mark   : -
###  Marks for legend entries (symNS or chars).  One should be
#  specified for each legend entry.

Mark.font	C 6		:		: : text	: -
###  Font(s) for marks.  One should be specified for each legend
#  entry, if they are to be different.  Otherwise, just one can
#  be specified.

Mark.size	I 1		: 7		: : textsize    : -
###  Size for marks in points.

Outlinebars	C 1		: n		: : y,n		: -
###  To save a set of parms for cloning

Shade		D 1		:		: : color	: -
###  If doing a legend for some type of bar graph, each entry should
#  have a shading value given here.

Title		C 1		:		: : text	: -
###  Legend title text, which will be centered over the legend.

Title.size	I 1		: 10		: : textsize    : -
###  Char size for legend title.
@@end




#  ------|---------|---------|---------|---------|---------|---------|---------|
@@begin Draw
#
# DRAW - produce lines in absolute or data coordinates.
# Draws a line(s) of specified type, thickness.  Points 
# should be specified as coordinate pairs.  Either on or two pairs 
# should be used per line.  If two pairs are used, the point described 
# by the first pair will be moved to, and a connecting line will be 
# drawn to the point described by the other pair.  If one pair is given,
# a line will be continued from the previous point to the point 
# described by the pair. 

*               X *-            :           :   : void          : -
###  standard obj attributes

Plot            X plot-         :           :   : void          : -
###  plot interface attributes

Linetype	I 1		: 0 		: : dashstyle  : -
###  Line dash pattern

Linetype.magnify	D 1	: 1 		: : dashdens : -
###  Magnification of line patterns

Linethick	D 1		: 1		: : linethick  	: -
###  Thickness of line

Points		C 1		:		: : text	: -
###  List of coord pairs, 2 per line (move+draw) or 1 per line (draw)

System		C 8		: data 		: : text	: -
### Which coord system points are in, 'data' or 'absolute
 
@@end
#COPA 1.0 - gui control panel kit for shell, C, perl etc.  
#*              **      **                              *
#Copyright 1991-1996 by Stephen C. Grubb.
#
#Permission is hereby granted to USE this software for free.
#Permission is hereby granted to MODIFY and/or REDISTRIBUTE 
#this software for free, provided that no monetary gain is 
#realized, and all attached authorship and copyright notices 
#are preserved.
#
#Inclusion of any portion (or derivation) of this software, 
#including ancillary files, in any commercial product is not 
#allowed without prior written permission of the author.  
#
#See also the file 'Copyright'. 
SHAR_EOF
############################

echo presets.pan
cat << \SHAR_EOF > presets.pan
# 
# COPA 1.0 - gui control panel kit for shell, C, perl etc.  
# *              **      **                              *
# Copyright 1991-1996 by Stephen C. Grubb.
# 
# Permission is hereby granted to USE this software for free.
# Permission is hereby granted to MODIFY and/or REDISTRIBUTE 
# this software for free, provided that no monetary gain is 
# realized, and all attached authorship and copyright notices 
# are preserved.
# 
# Inclusion of any portion (or derivation) of this software, 
# including ancillary files, in any commercial product is not 
# allowed without prior written permission of the author.  
# 
# See also the file 'Copyright'. 
# 

#
# PRESETS.PAN - popup mechanisms defined
#
#


# Text message box
#
# note: the message box is responsive (eg for scrolling) with
#       pop and poplist, but not for popentry and popmsg.
Proc textb
*/tag: _POP
*/display: 
*/align_h: C root C
*/align_v: C root C
text:
align: C
text/size: 12
box.marg_t: 0.5
box.marg_l: 0.5
box.marg_r: 0.5
box.marg_b: 0.8
## box.width: 30
## nlines: 3
dress/shadow.size: 0.4
scrollcon: M

# First row of buttons
Proc button
*/tag: _POPB1
*/display:
*/align_h: C _POP C
*/align_v: B _POP B+0.2
text:
text/size: 12
flashpick:

# Second row of buttons
Proc button
*/tag: _POPB2
*/display:
*/align_h: C _POP C
*/align_v: T _POPB1 B
text:
text/size: 12
flashpick:

# Dataentry area
Proc dataentry
*/tag: _POPD1
*/display:
*/align_h: C _POP C
*/align_v: T _POP B+0.5
text/size: 12
maxlength: 30
dress: x
prompt: 

# Vertical listbox
Proc textb
*/tag: _POPL1
*/display:
*/align_h: C _POP C
*/align_v: B _POP B+0.58
text/size: 10
align: L
ruled: L
spacing: 0.28
pick: x
nlines: 8
box.width: 28
# box.margin: 0.2
dress: x
scrollcon: M
SHAR_EOF
############################

echo src/Makefile
cat << \SHAR_EOF > src/Makefile
# Makefile for copa.a, copa_window, copa, ../examples/demo
# SCG 12-29-95
#
# Porting notes: * all x11 calls are in x11.c and come via pcode.c
#		 * sleep.c has system dependencies 
# 


CC = cc
BIN = ./../bin

## SunOS 4.x (BSD)
##
# SYSTEM = -DSUNOS4			# Sunos 4
# AR = /usr/bin/ar			# Sunos 4
# RANLIB = ranlib ./../copa.a
# XINCLUDES = /usr/include/X11		# Sunos 4
# XLIBEDIR = -L/usr/lib/X11		# Sunos 4
# LIB = ./../copa.a  -lX11 -lm	   	# Sunos 4


## Solaris 2.x 
##
SYSTEM = -DSOLARIS2			# Solaris 2
AR = /usr/ccs/bin/ar			# Solaris 2
RANLIB = 
XINCLUDES = /usr/openwin/include   	# Solaris 2
XLIBEDIR = -L/usr/openwin/lib		# Solaris 2
SLEEPLIB = -lposix4			# Solaris 2 only
LIB = ./../copa.a  -lX11 $(SLEEPLIB) -lm  # Solaris 2

 
# To include plotting capability, use these..
PLOTTARG = plot
PLOTFLAG = -DPLOT

# To disenable plotting capability, use these..
# PLOTTARG = 
# PLOTFLAG =


CFLAGS = -I$(XINCLUDES) -I../src $(SYSTEM) $(PLOTFLAG)


OBJ = align.o arrow.o block.o copa_api.o copa_button.o \
  copa_entry.o copa_exec.o copa_gen.o copa_init.o \
  copa_pop.o copa_scroll.o copa_setsel.o copa_slider.o copa_textbox.o \
  copa_txt.o edit.o err.o graphic.o init.o interact.o lib.o \
  mark.o obj.o pcode.o ps.o sleep.o stub.o version.o wild.o winscale.o x11.o zood.o


POBJ = Pgen.o Pfilld.o Ppie.o Ppgraphic.o Pbargraph.o Pplib.o Prect.o Ppstub.o \
	Paxes.o Putil.o Ppinit.o Phorizbar.o \
	Plegend.o Pdistribution.o Pmap.o Perrorbars.o Plineplot.o Pdraw.o



all: copalib $(PLOTTARG) copasrv copa demo 

install: all

copalib: $(OBJ) elib.d elib.h elib.x
	$(AR) r ./../copa.a $(OBJ); $(RANLIB)

plot: $(POBJ)
	$(AR) r ../copa.a $(POBJ); $(RANLIB)

copasrv: copalib copa_srv.o copalib
	$(CC) copa_srv.o $(XLIBEDIR) $(LIB) -o $(BIN)/copa_window

copa: copa_cli.o copa_txt.o sleep.o err.o
	$(CC) copa_cli.o copa_txt.o sleep.o err.o $(SLEEPLIB) -o $(BIN)/copa

demo: 
	cd ../examples; make demo.obj; $(CC) demo.o $(XLIBEDIR) $(LIB) -o demo\

clean:
	rm $(OBJ)
	rm $(POBJ)
	rm copa_cli.o 
	rm copa_srv.o
	cd ../examples; make clean
SHAR_EOF
############################




