c************
c  Description:	Included by xplot, contains structures and flags
c
c  Author:	Scott Schoen
c
c  $Revision: 1.1 $
c  $Modtime:   01 May 1996 16:01:44  $
c  
c************

	implicit none
	include 'primitive.inc'
	include 'xprimitive.inc'
	include 'xfacilities.inc'
	include 'msgmask.inc'
c
	integer*4 L_XPlotLayers, L_XPlotNote
	parameter (L_XPlotLayers=16, L_XPlotNote=50)

	integer*4 s_get_data, s_xmin, s_xmax
	parameter (s_get_data=1, s_xmin=2, s_xmax=4)

	integer*4 t_all, t_bs, t_bufsize, t_cntrls, t_cross, t_grid, t_index
	integer*4 t_legend, t_mimic, t_msgid, t_pan, t_plabel, t_specs
	integer*4 t_xdivisions, t_xlabel, t_ydivisions, t_yinv, t_ylabel
	integer*4 t_sections, t_hold, t_segment
	parameter (t_all	= 1)
	parameter (t_bs		= t_all+1)
	parameter (t_bufsize	= t_bs+1)
	parameter (t_cntrls	= t_bufsize+1)
	parameter (t_cross	= t_cntrls+1)
	parameter (t_grid	= t_cross+1)
	parameter (t_hold	= t_grid+1)
	parameter (t_index	= t_hold+1)
	parameter (t_legend	= t_index+1)
	parameter (t_mimic	= t_legend+1)
	parameter (t_msgid	= t_mimic+1)
	parameter (t_pan	= t_msgid+1)
	parameter (t_plabel	= t_pan+1)
	parameter (t_sections	= t_plabel+1)
	parameter (t_segment	= t_sections+1)
	parameter (t_specs	= t_segment+1)
	parameter (t_xdivisions	= t_specs+1)
	parameter (t_xlabel	= t_xdivisions+1)
	parameter (t_ydivisions	= t_xlabel+1)
	parameter (t_yinv	= t_ydivisions+1)
	parameter (t_ylabel	= t_yinv+1)

	STRUCTURE /XPLOTLAYER/
	  record/M_PTR/	xbuf	! location of ABSC raw data buffer
	  record/M_PTR/	ybuf	! location of ORD raw data buffer
	  real*8	offset	! double prec GRAB offset into file
	  real*8	xstart	! abscissa start of raw data buffer
	  real*8	xdelta	! abscissa delta of raw data buffer
	  real*8	imin	! file index of start of raw data buffer
	  real*8	xmin	! min absc value of entire file
	  real*8	xmax	! max absc value of entire file
	  character*14	name	! file name for legend
	  logical*2	cx	! TRUE: ord data is complex double
	  integer*4	hcb	! index of header structure
	  integer*4	xbufn	! size of raw data buffer in bytes
	  integer*4	ybufn	! size of raw data buffer in bytes
	  integer*4	size	! number of elements in data buffer

	  logical*4	display ! TRUE: draw plot line
	  integer*4	color	! color of data layer (<0 toggle off display)
	  integer*4	line	! line type (1=line, -1=dashed line, 0=none)
	  integer*4	thick	! line thickness
	  integer*4	symbol	! type of symbols
	  integer*4	radius	! radius of symbols

	  integer*4	skip	! number of elements between ord values
	  integer*4	xsub	! offset in elements of 1st X value
	  integer*4	ysub	! offset in elements of 1st Y value
	  logical*4	xdata	! TRUE if X data is data from file
	END STRUCTURE

	STRUCTURE /GX/
	  record /M_PTR/ xptr	! ptr to buffer for formatted data
	  record /M_PTR/ yptr	! ptr to buffer for formatted data

	  real*8 retx, rety	! absc coordinates at current mouse location
	  real*8 xmrk, ymrk	! absc coordinates of mark for dx,dy readings
	  real*8 aretx, arety	! retx,rety adjusted for absc mode
	  real*8 dretx, drety	! retx,rety adjusted for absc mode
	  real*8 xstart		! start and abscissa values of 1st base file
	  real*8 xdelta		! used by DISPLAY_SPECS to convert to (index)

	  real*8 panxmin, panxmax	! real X panning bounds for all files
	  real*8 panymin, panymax	! real Y panning bounds for all files
	  real*8 xmin, xmax	! real X bounds for initial plot field
	  real*8 ymin, ymax	! real Y bounds for initial plot field
	  real*8 dbmin		! min value used in LOG calculations
	  real*8 pxscl,pyscl	! scales to convert pixel <-> real pan coords
	  real*8 pmt		! Pan Mode Threshold (seconds):
				! if (latest plot refresh time) > pmt then
				!   panning is not repeated
				! else panning is repeated

	  character*(L_XPlotNote) note	! plot note
	  character*20 mouse		! results name prefix for X,Y absc crds
	  character*2 format		! format code for 1st base file

	  integer*4 l,r		! specifies plotting field
	  integer*4 t,b		! specifies plotting field
	  integer*4 pl,pr	! left and right edge of X pan symbols
	  integer*4 pt,pb	! top and bottom edge of X pan symbols
	  integer*4 px1,px2	! left and right edge of X pan drag box
	  integer*4 py1,py2	! top and bottom edge of Y pan drag box

	  integer*4 pyl		! left edge of Y pan bar
	  integer*4 pthk	! thickness of pan drag box

	  integer*4 modlayer	! layer w/ modified data
	  integer*4 modsource	! layer being modified
	  logical*4 modified	! TRUE if modify layer has been altered
	  integer*4 modmode	! modify mode (1=ASSIGN, 2=AVERAGE, 3=MEDIAN)

	  integer*4 nmark	! current number of modify marks
	  integer*4 marks(5)	! (1-4) pixel coords for marks, (5)=modify width

	  integer*4 autox,autoy	! autoscaling for axes (1=min,2=max,3=both)
	  integer*4 xlab,ylab	! 1st base file x and y labels for display over
	  integer*4 xdiv,ydiv	! number of grid divisions for x, y axis
	  integer*4 ixlab,iylab	! 1st base file x and y labels (actual)
	  character*20 xfmt,yfmt	! user specs format

	  integer*4 bslyr(L_zoommax) ! number of layers plotted in BS pixmaps

	  integer*4 basemode	! mode base bounds were calculated in
	  integer*4 bs		! > 0, enact backing store for those levels
	  integer*4 cmode	! current default complex mode
	  integer*4 cntrls	! controls mode (neg=disabled) (-2,-1,0,1,2)
	  integer*4 hold	! hold flag: 0=normal, 1=norefresh, 2=noevents
	  integer*4 iabsc	! abscissa mode (0=absc, 1=index, 2=1/absc)
	  integer*4 mimic	! id of primitive to mimic
	  integer*4 plab	! phase units (23=rad, 24=deg, 25=cyc)
	  integer*4 panmode	! mode parameter to MX$SCROLLBAR
	  integer*4 panning	! !=0 we're doing repeated pan operations

	  logical*1 all		! TRUE: if file > 32K, reread until done
	  logical*1 cross	! TRUE: indicates crosshairs are in use
	  logical*1 grid	! TRUE: display dashed grid in plotting field
	  logical*1 index	! TRUE: plot files by index, not abscissa
	  logical*1 pan		! TRUE: show scrollbars
	  logical*1 specs	! TRUE: display specs, scrollbars
	  logical*1 legend	! TRUE: if legend is up
	  logical*1 xdata	! TRUE: at least one file get X's from data
	  logical*4 segment	! TRUE: if 3000 absc non-contig don't connect
c DR 5566 SAR 10/1/02
c Added forcelab flag.
          logical*4 forcelab    ! TRUE: force use of /xlab & /ylab regardless
c                               !       of the mode.
c	  logical*4 pad
c end DR 5566

	  record /MAPSTRUCT/ lmap	! Legend background pixmap
	  integer*4 lbtn	! size of legend button

	  integer*4 nfiles		! current number of open files
	  integer*4 pointbufsize	! size of point buffer in bytes
	  integer*4 bufmax		! max buffer size in elements
	  integer*4 layers		! # of valid layer structures

	  integer*4 sections		! # of plot sections (-1 = Gx.layers)
	  integer*4 iysec		! size in pixels of section
	  integer*4 nsec		! actual number of sections
	  integer*4 isec		! current sections

	  record /XFACILITIES/ xf		! structure for ann,bxs,pts
	  record /M_PTR/ HCB(L_XPlotLayers)	! array of HCB's of open files
	  character*80 filestring(L_XPlotLayers) ! cmd line args for REREAD
	  record /XPLOTLAYER/ lyr(L_XPlotLayers)! data layer structures

	END STRUCTURE
	record /GX/ Gx
	common /xplot/ Gx

	logical*4 XPLOT_MSG,XPLOT_PAN
	integer*4 XPLOT_PREP

	record /HEADER/ HCB
	pointer (hcb_ptr, HCB)
