#include "Position.h"

#pragma warning( disable : 4244 ) 

Postion Pos;

Postion::Postion() {

	iWidth = 640;
	iHeight = 480;
	sx=60*iWidth/1000;
	sy=60*iHeight/1000;
	offx = 4;
	offy = 4;
	div_factor = 2.5;
	recDx = 300;
	recDy = 220;

	csx = 0;
	csy = 0;
}

void Postion::GetRectPos ( int & x1 , int & y1 , 
		int & x2 , int & y2 , int RectNo )
{
	int _sx = sx;
	int _sy = sy;

	if ( ( RectNo % 2 ) ) { // 1 or 3
		_sx += recDx;
	}
	if ( RectNo >= 2 ) { // 2 or 3 
		_sy += recDy;
	}
	
	x1 = _sx+0;
	y1 = _sy+0;
	x2 = (int)_sx+iWidth /div_factor + offx;
	y2 = (int)_sy+iHeight/div_factor + offy;
}
	
void Postion::GetCtrPos ( int & x , int & y , int & xSz , int & ySz ,
				int CtrNo )
{
	int _csx = csx;
	int _csy = csy;

	_csy += CtrNo*30;

	x   = _csx + 640;
	y   = _csy + 40;
	xSz = 150;
	ySz = 30;
}

void Postion::GetThumbSz ( int & Width , int & Height ) {
	Width  = (int)iWidth / div_factor;
	Height = (int)iHeight/ div_factor;
}

void Postion::GetThumbOffset( int & x , int & y ) {
	x = offx / 2;
	y = offy / 2;
}

float Postion::GetDivFac() {
	return div_factor;
}