/*
 * $Id: debug.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
 *
 */

/* GNUPLOT - debug.trm */
/*
 * Copyright (C) 1990   
 *
 * Permission to use, copy, and distribute this software and its
 * documentation for any purpose with or without fee is hereby granted, 
 * provided that the above copyright notice appear in all copies and 
 * that both that copyright notice and this permission notice appear 
 * in supporting documentation.
 *
 * Permission to modify the software is granted, but not the right to
 * distribute the modified code.  Modifications are to be distributed 
 * as patches to released version.
 *  
 * This software  is provided "as is" without express or implied warranty.
 * 
 * This file is included by ../term.c.
 *
 * This terminal driver supports:
 *  DEBUG
 *
 * AUTHORS
 *    luecken@udel.edu
 * 
 * send your comments or suggestions to (luecken@udel.edu).
 * 
 */


#define DEBUG_XMAX 512 
#define DEBUG_YMAX 390

#define DEBUG_XLAST (DEBUG_XMAX - 1)
#define DEBUG_YLAST (DEBUG_XMAX - 1)

/* Assume a character size of 1, or a 7 x 10 grid. */
#define DEBUG_VCHAR	10
#define DEBUG_HCHAR	7
#define DEBUG_VTIC	(DEBUG_YMAX/70)		
#define DEBUG_HTIC	(DEBUG_XMAX/75)		
int DEBUG_linetype_last;
int DEBUG_xlast;
int DEBUG_ylast;

DEBUG_init()
{
	fprintf(outfile,"init\n");
	DEBUG_linetype_last = -3;
}


DEBUG_graphics()
{
	DEBUG_xlast = DEBUG_ylast=0;
	fprintf(outfile,"graphics\n");
}


DEBUG_text()
{
	fprintf(outfile,"text\n");
}


DEBUG_linetype(linetype)
int linetype;
{
	/*
	if (linetype != DEBUG_linetype_last){
		fprintf(outfile,"l%d",linetype);
		DEBUG_linetype_last = linetype;
	}
	*/
	fprintf(outfile,"line %d\n",linetype);
}


DEBUG_move(x,y)
int x,y;
{
	/*
	if (x != DEBUG_xlast || y != DEBUG_ylast){
		fprintf(outfile,"mm");
		DEBUG_xlast = x;
		DEBUG_ylast = y;
	}
	*/
	fprintf(outfile,"move %d, %d\t(%d, %d)\n",x,y,x-DEBUG_xlast,y-DEBUG_ylast);
	DEBUG_xlast = x;
	DEBUG_ylast = y;
}


DEBUG_vector(x,y)
int x,y;
{
	/*
	if (x != DEBUG_xlast || y != DEBUG_ylast){
		fprintf(outfile,"vv");
		DEBUG_xlast = x;
		DEBUG_ylast = y;
	}
	*/
	fprintf(outfile,"vect %d, %d\t(%d, %d)\n",x,y,x-DEBUG_xlast,y-DEBUG_ylast);
	DEBUG_xlast = x;
	DEBUG_ylast = y;
}


DEBUG_put_text(x,y,str)
int x, y;
char *str;
{
	/*
	DEBUG_move(x,y);
	fprintf(outfile,"tx%s\r",str);
	*/
	fprintf(outfile,"put_text calls:");
	DEBUG_move(x,y);
	fprintf(outfile,"put_text '%s'\n",str);
}



DEBUG_reset()
{
	fprintf(outfile,"reset");
}

DEBUG_justify_text(mode)
int mode;
{
	fprintf(outfile,"justify ");
	switch(mode){
		case (CENTRE):
			fprintf(outfile,"centre");
			break;
		case (RIGHT):
			fprintf(outfile,"right");
			break;
		default:
		case (LEFT):
			fprintf(outfile,"left");
			break;
	}
	fprintf(outfile,"\n");
	return(TRUE);
}

