//--------------------------------------------------
// Title:		MyCoord
// Author:		Tony Kim 
// Date:		2006 Nov 10 
// Description: 
//		Allows drawing of multiple "graphs" in a 
//		window. Use by defining a new MyCoord class
//		for each graph.
//--------------------------------------------------
#pragma once

struct windowInfo
{
	int width, height;
	int anchor_x, anchor_y;
};

class MyCoord
{
private:
	int max_x, min_x;
	int max_y, min_y;
	int w_width, w_height;
	
	int w_anchor_x, w_anchor_y;

	windowInfo w_max, w_min;

public:
	MyCoord();
	MyCoord( int p_max_x, int p_min_x,
			 int p_max_y, int p_min_y,
			 int p_w_width, int p_w_height,
			 int p_anchor_x, int p_anchor_y,
			 int p_min_width = 200, int p_min_height = 200,
			 int p_min_anchor_x = -1, int p_min_anchor_y = -1);
	void Set(	 int p_max_x, int p_min_x,
			     int p_max_y, int p_min_y,
			     int p_w_width, int p_w_height,
			     int p_anchor_x, int p_anchor_y,
			     int p_min_width = 200, int p_min_height = 200,
				 int p_min_anchor_x = -1, int p_min_anchor_y = -1);
	
	//--------------------------------------------------
	// Accessor functions
	//--------------------------------------------------
	int GetAnchX() { return w_anchor_x; }
	int GetAnchY() { return w_anchor_y; }
	int GetWidth() { return w_width; }
	int GetHeight() { return w_height; }
	int GetMaxX() { return max_x; }
	int GetMinX() { return min_x; }
	int GetMaxY() { return max_y; }
	int GetMinY() { return min_y; }
	windowInfo GetMinInfo() { return w_min; }
	windowInfo GetMaxInfo() { return w_max; }

	void SetWidth( int p_width ) { w_width = p_width; }
	void SetHeight( int p_height ) { w_height = p_height; }
	void SetAnchorX( int p_anchor_x ) { w_anchor_x = p_anchor_x; }
	void SetAnchorY( int p_anchor_y ) { w_anchor_y = p_anchor_y; }
};

//--------------------------------------------------
// Exchanges mathematical and display coordinates
//--------------------------------------------------
int wx( double math_x, MyCoord frame );
int wy( double math_y, MyCoord frame );

double math_x( int wx, MyCoord frame );
double math_y( int wy, MyCoord frame );