/* This is the private .h file for the chart widget       */
/*  Created by Lisa N. Paradis for Project Athena         */
#ifndef _At_StripchartP_h
#define _At_StripchartP_h
#include <X11/IntrinsicP.h>
#include <X11/ConstrainP.h>
#include "Stripchart.h"

typedef struct {
  double xdivpix;  /** gives the division sz in pixels **/
  double ydivpix;  
  short	 num_segs;    /* number of segments to make the grid on the screen */
  short x1;      /** gives the start and end positions of the xaxis */
  short x2; 
  short y1;      /* gives the start and end positions of the yaxis */
  short y2;
  short width, height;
  double xpix_per_mm; /* conversion factor for pixels per mm */
  double ypix_per_mm;
} ScreenLayout;

typedef struct {
  int		xband, yband;		/* gives static corner of rectangle */
  int		bandwdth;		/* gives changing wdth & hgt of rect */
  int           bandhgt;
  Boolean	banded;			/* are we already rubber-banding?? */
  GC		bandGC;			/* GC to draw the rubber-band */
} rubber;			     /* humor is a valuable programming tool */

typedef struct {

/** resources **/
 /* 	AtFontSize	ft_size; */	/* size of the font */

	Boolean		force_square;	/*does user square divisions?? */
	Boolean         timer_on;       /* usr wants internal timer to run*/

	Pixel           foreground;        /* foreground color */

	int             xdivmm;    /* size of the divisions in mm */
	int		ydivmm;
	
	int             margin_height;     /* height of the margin in pixels*/
	int             margin_width;    /* width of the margin in pixels */
	int             percent_shift;  /* percent of scrn shft when data*/
                                        /* reaches the end of the screen */
	int		sample_interval; /* used to divide the axis into time*/
	int             timer_interval;
	int		xdivs;    	/* number of divisions on an axis */
	int             ydivs;

	double          xdiv_units;     /* units per division */
        double          ydiv_units;
 
	String		font;		/* font family for titles, etc */
	String          xunits;         /* name of units for axes */
	String          yunits;

	XtCallbackList  click_callback;   /* callbacks */
	XtCallbackList  drag_callback;
	XtCallbackList  drag_grip_callback;
	XtCallbackList  select_callback;

	/** private stuff **/
	AtFontFamily	*ff;  	/* font family to use */
/*	AtText          *text;*/
	GC              gridGC;         /* for grid */
	short		select_mode;	/* mode for mouse buttons - plot,*/
	                                /* pens, or none                 */
	rubber          elastic;        /* to keep track of motion things*/
	  				/* for rubber-banding, etc.      */
	ScreenLayout    lo;             /* layout of the screen */
	XSegment        *grid_lines;    /* array of lines for the grid */
	XtIntervalId	interval_id;    /* for internal timer */
} AtStripchartPart; 


/* Full instance record declaration */

typedef struct _AtStripchartRec {
  CorePart core;
  CompositePart composite;
  ConstraintPart constraint;
  AtStripchartPart stripchart;
} AtStripchartRec;

/* New fields for the AtStripchart widget class record */

typedef struct {int dummy;} AtStripchartClassPart;


/* Full class record declaration */

typedef struct _AtStripchartClassRec {
  CoreClassPart core_class;
  CompositeClassPart composite_class;
  ConstraintClassPart constraint_class;
  AtStripchartClassPart atstripchart_class;
} AtStripchartClassRec;

/* The Class pointer... */

extern AtStripchartClassRec atStripchartClass;

typedef struct _AtStripchartConstraintsPart {
    /* resources */
    Boolean displayed;
    double baseline;
    String name;
    /* private state */
    short pixbaseline;
    AtText nameText;
} AtStripchartConstraintsPart;

typedef struct {
    AtStripchartConstraintsPart stripchart;
} AtStripchartConstraintsRec, *AtStripchartConstraints;

#define NUMCHILDREN(w) (w->composite.num_children)
#define CHILD(w,i) (w->composite.children[i])
#define CONSTRAINT(w,i) ((AtPlotterConstraints)(CHILD(w,i)->core.constraints))
#define PIXBASELINE(w,i) CONSTRAINT(w,i)->stripchart.pixbaseline


#endif _At_StripchartP_h
