#if !defined(__GraphWindow_h)
#define __GraphWindow_h


#include "_synth.h"

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>


#define DEFAULT_SIZE 1000
#define TINY_FONT "-adobe-courier-bold-r-normal--10-100-75-75-m-60-iso8859-1"

#define WMAX 2048
#define CMAX 8
#define MAXWIN 32768
#define LABEL_SIZE 64

class GraphWindow
{
  protected:
	Display *myDisplay ;
	Window myWindow ;
	XWindowAttributes wind_att;
 	int Screen ; 
 	Boolean getattr; /* get window attributes */
	unsigned long Foreground, Background ;
	Colormap cmap;
	unsigned long pixel[CMAX];
	XEvent Event ;
	XSizeHints *xsh;
	GC gc ;
	XFontStruct *fontstructT;
	XColor color[CMAX];
	float spec[2*WMAX];
	float disp[WMAX];
	XPoint p[WMAX];
	XSegment s[WMAX];
	int current;
	float from, to;
	float srate;
	Boolean time, spect;
	float *fftwindow;
	int npoints;
	Boolean lines;
	float bh[MAXWIN];
	int count;
	int samps;
	Boolean dodisp;
	int jumps;
	Boolean axes;
        int lastMark ;
        char Xlabel[LABEL_SIZE], Ylabel[LABEL_SIZE];
	
  public:
	void markGraph(int n);
  	void markOnGraph(int n);
  	void markOffGraph(int n);
  	
        GraphWindow(float Srate, char *Title, float From, float To,
		    int Width, int X0 = 80, int Y0 = 100, int HEIGHT = 200);
	~GraphWindow();
	void Graph(int n, float *d, int stride);
        void cGraph(int n, float *d, int stride, int colorindex);
	void GraphSpect(float *wind, int npoints);
	void GraphTimemode(Boolean time);
	void GraphBang(float *count);
	void labelGraph(char *Xl, char *Yl);
        void OutText(char *string, int X, int Y);
        void dispGraph(float *buf, int n, float from, float to, int colorindex);
};


#endif
