Code Search for Developers
 
 
  

InterfaceObject.cs from MASE: Agile Software Engineering at Krugle


Show InterfaceObject.cs syntax highlighted

using System;
using System.Drawing;
using Tao.Platform.Windows;
using Tao.OpenGl;

using System.Drawing.Drawing2D;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

using Whiteboard;
using Whiteboard.MaseWS;
using Whiteboard.Business_Interfaces;

namespace New_Study_Project
{
	
	public class InterfaceObject : Object 
	{
		/* Definitions of the Program */

		public PointF CentrePoint; 

		//private webServicesService ws;

		/* calulating stuff */

		private enum State{Nothing, Moving, Resizing};

		private PointF TopLeft;
		private PointF TopRight;
		private PointF BottomRight;
		private PointF BottomLeft;

		private PointF UpLeft;
		private PointF UpRight;
		private PointF DownRight;
		private PointF DownLeft;

		private PointF resizePoint;
		private PointF lastMousePoint;

		private PointF vectorHORZONTAL;
		private PointF vectorVERTICALY;

		private float originalWidth; 
		private float originalHeight; 
		private float currentWidth; 
		private float currentHeight; 
		
		private float newWidth, newHeight; 
		private float fadeWidth, fadeHeight;
		private float difWidth, difHeight;
		private float difScale;

		private float borderSize;

		private State state;
		private ObjectButton resizeButton;

		public Spline ObjInArea;
		private int storedAreaPart;
		private IOSelectObject ObjBelongToSEL;

		private InterfaceGrid interfaceOBJ;
		private bool IObjectInsideSplineArea;
		
		private RNTObject RNTobj;

		private PointF slideVector;
		private float slideValue;

		/* Create drawing stuff */

		private int[] IconTextures;

		private ArrayList animateObjects;

		private int GLListObject;
		private int GLListCircleFilled;
		private int GLListCircleNoneFilled;

		private bool drawCircle;
		private bool fadeOutCircle;
		private bool rntCalculation;
		private bool waitOneStep;
		private bool isSelected;
		private bool deSelected;

		private float fadeOutCircleFilled;
		private float fadeOutCircleNoneFilled;
		private float zoomValue;

		private float lastScaleValue;

		private float[,] colorBorderArray;

		private float[] vertexArray_BorderInside;
		private float[] vertexArray_TriangleStrip;

		private int[] texture;
		private int[] normalTexture;
		private int[] foreignTexture;

		public Displayable_Interface displayObj;
		public bool initializationMovement = false;
		private System.Timers.Timer timer = null;
		private float angle;
		public static int picIndex = 0;
		public bool locked = false;

		/* End of Definitions of the Program */
		
		public void createCardImage()
		{
			Bitmap image = displayObj.getImage(ApplicationProperties.CardWidth, ApplicationProperties.CardHeight);			
			System.Drawing.Imaging.BitmapData bitmapdata;
			Rectangle rect = new Rectangle(0, 0, image.Width, image.Height);

			bitmapdata = image.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadOnly, 
				System.Drawing.Imaging.PixelFormat.Format24bppRgb);
			
			
			Gl.glGenTextures(1, this.texture);
			Gl.glBindTexture(Gl.GL_TEXTURE_2D, this.texture[0]);

			Gl.glTexParameteri(Gl.GL_TEXTURE_2D,Gl.GL_TEXTURE_MAG_FILTER,Gl.GL_LINEAR);
			Gl.glTexParameteri(Gl.GL_TEXTURE_2D,Gl.GL_TEXTURE_MIN_FILTER,Gl.GL_LINEAR_MIPMAP_LINEAR);
			Glu.gluBuild2DMipmaps(Gl.GL_TEXTURE_2D, Gl.GL_COMPRESSED_RGB , image.Width, image.Height, Gl.GL_BGR, Gl.GL_UNSIGNED_BYTE, bitmapdata.Scan0); 
			image.UnlockBits(bitmapdata);
			image.Dispose();
		}

//		public void createForeignCardImage()
//		{
//			Bitmap image = displayObj.getImage(ApplicationProperties.CardWidth, ApplicationProperties.CardHeight, true);			
//			System.Drawing.Imaging.BitmapData bitmapdata;
//			Rectangle rect = new Rectangle(0, 0, image.Width, image.Height);
//
//			bitmapdata = image.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadOnly, 
//				System.Drawing.Imaging.PixelFormat.Format24bppRgb);
//			
//			Gl.glGenTextures(1, this.foreignTexture);
//			Gl.glBindTexture(Gl.GL_TEXTURE_2D, this.foreignTexture[0]);
//			Gl.glTexParameteri(Gl.GL_TEXTURE_2D,Gl.GL_TEXTURE_MAG_FILTER,Gl.GL_LINEAR);
//			Gl.glTexParameteri(Gl.GL_TEXTURE_2D,Gl.GL_TEXTURE_MIN_FILTER,Gl.GL_LINEAR_MIPMAP_LINEAR);
//			Glu.gluBuild2DMipmaps(Gl.GL_TEXTURE_2D, Gl.GL_COMPRESSED_RGB , image.Width, image.Height, Gl.GL_BGR, Gl.GL_UNSIGNED_BYTE, bitmapdata.Scan0); 
//			image.UnlockBits(bitmapdata);
//			image.Dispose();
//		}

//		private void OnTimedEvent(object source, System.Timers.ElapsedEventArgs e)
//		{
//			timer.Stop();
//			timer.Enabled = false;
//			timer = null;
//			this.texture = this.normalTexture;
//		}

		public InterfaceObject(PointF center, Displayable_Interface displayObj, InterfaceGrid IG, float angle, ArrayList animate, int[] IT, bool foreignUpdate) 
		{
			int[] viewport;

			this.interfaceOBJ = IG;
			this.angle = angle;
			this.IconTextures = IT;
			this.texture =  new int[1];
			this.normalTexture = new int[1];
			this.foreignTexture = new int[1];
			this.CentrePoint = center;
			this.state = State.Nothing;
			this.borderSize = 5.5f;
			this.zoomValue = 25.0f;
			this.displayObj = displayObj;

			this.slideVector = new PointF(0.0f, 0.0f);
			this.slideValue = 0.0f;

			this.IObjectInsideSplineArea = false;
			this.resizeButton = null;
			this.ObjInArea = null;
			this.ObjBelongToSEL = null;
			this.storedAreaPart = 0;

			this.difScale = 0.0f;

			this.fadeOutCircle = false;
			this.drawCircle = false;
			this.rntCalculation = false;
			this.waitOneStep = false;
			this.isSelected = false;
			this.deSelected = false;

			this.fadeOutCircleFilled = 0.4f;
			this.fadeOutCircleNoneFilled = 0.8f;
			this.difWidth = 1.0f;
			this.difHeight = 1.0f;

			this.animateObjects = animate;
			
			createCardImage();
			//createForeignCardImage();

			//if(foreignUpdate == true)
			//{
				//timer = new System.Timers.Timer();
				//timer.Interval = 2000;
				//timer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimedEvent);
				//timer.Start();
				//this.texture = this.foreignTexture;
			//}
			//else
				//this.texture = this.normalTexture;
			
			/* calculate the corner points */
			
			this.originalWidth = (float)ApplicationProperties.CardWidth;
			this.originalHeight = (float)ApplicationProperties.CardHeight;

			this.currentWidth = this.originalWidth;
			this.currentHeight = this.originalHeight;

			this.newWidth = this.originalWidth;
			this.newHeight = this.originalHeight;

			this.fadeWidth = this.newWidth;
			this.fadeHeight = this.newHeight;

			this.lastScaleValue = 1.0f;
			this.TopLeft = new PointF(-this.originalWidth/2.0f+center.X, -this.originalHeight/2.0f+center.Y);
			this.TopRight = new PointF(this.originalWidth/2.0f+center.X, -this.originalHeight/2.0f+center.Y);
			this.BottomRight = new PointF(this.originalWidth/2.0f+center.X, this.originalHeight/2.0f+center.Y);
			this.BottomLeft = new PointF(-this.originalWidth/2.0f+center.X, this.originalHeight/2.0f+center.Y);
			
			this.RNTobj = new RNTObject(this.TopLeft, this.TopRight, this.BottomRight, this.BottomLeft, 50);
			this.RNTobj.SetRotationAngle(angle);

			this.CentrePoint = this.RNTobj.Center;
			this.TopLeft = this.RNTobj.TopLeft;
			this.TopRight = this.RNTobj.TopRight;
			this.BottomRight = this.RNTobj.BottomRight;
			this.BottomLeft = this.RNTobj.BottomLeft;

			this.lastMousePoint = this.RNTobj.Center;
			/* filling the colorArray */

			this.colorBorderArray = new float[10,4];
			for (int AColor=0; AColor < 10; AColor=AColor+2)
			{
				this.colorBorderArray[AColor,0] = 0.2f;
				this.colorBorderArray[AColor,1] = 0.4f;
				this.colorBorderArray[AColor,2] = 0.8f;
				this.colorBorderArray[AColor,3] = 1.0f;

				this.colorBorderArray[AColor+1,0] = 0.0f;
				this.colorBorderArray[AColor+1,1] = 0.0f;
				this.colorBorderArray[AColor+1,2] = 0.0f;
				this.colorBorderArray[AColor+1,3] = 0.0f;
			}

			/* create vertexArrays */

			this.vertexArray_BorderInside = new float[8];
			this.vertexArray_TriangleStrip = new float[20];

			/* calculate the border points */	
		
			this.computeBorder();

			this.resizeButton = new ObjectButton(this, this.resizePoint, ObjectButton.State.InterfaceObjectResize);
			this.interfaceOBJ.addObjectButton(this.resizeButton);

			this.createObjectList();
			this.createCircleList();

			viewport = new int[4];
			Gl.glGetIntegerv(Gl.GL_VIEWPORT,viewport);		
			this.RNTobj.setClientBorder((float) viewport[0], (float) viewport[1], (float) viewport[2], (float) viewport[3]);
		}


		public PointF[] BoundingBox()
		{
			float[] cornerX = {this.TopLeft.X, this.TopRight.X, this.BottomRight.X, this.BottomLeft.X};
			float[] cornerY = {this.TopLeft.Y, this.TopRight.Y, this.BottomRight.Y, this.BottomLeft.Y};

			cornerX = this.Sort(cornerX);
			cornerY = this.Sort(cornerY);
			
			PointF min = new PointF(cornerX[0], cornerY[0]);
			PointF max = new PointF(cornerX[cornerX.Length - 1], cornerY[cornerY.Length - 1]);
			
			PointF[] boundingBox = {new PointF(min.X, min.Y), new PointF(max.X, min.Y), new PointF(max.X, max.Y), new PointF(min.X, max.Y)};
			return boundingBox;
		}

		public bool InsideObject(PointF point)
		{
			PointF lpVector;
			float scalarX, scalarY;

			lpVector = new PointF(point.X-this.TopLeft.X, point.Y-this.TopLeft.Y);
			scalarX = lpVector.X*this.vectorHORZONTAL.X+lpVector.Y*this.vectorHORZONTAL.Y;
			scalarY = lpVector.X*this.vectorVERTICALY.X+lpVector.Y*this.vectorVERTICALY.Y;

			if ((scalarX >= 0.0f && scalarX <= this.RNTobj.Width && scalarY >= 0.0f && scalarY <= this.RNTobj.Height)) return true;
			else return false;
		}
	
		private void updateInterfaceObjConfiguration()
		{
			this.CentrePoint = RNTobj.Center;
			this.TopLeft = RNTobj.TopLeft;
			this.TopRight = RNTobj.TopRight;
			this.BottomRight = RNTobj.BottomRight;
			this.BottomLeft = RNTobj.BottomLeft;
			this.currentWidth = this.fadeWidth;
			this.currentHeight = this.fadeHeight;
		}

		private void revertInterfaceObjConfiguration()
		{
			RNTobj.Center = this.CentrePoint;
			RNTobj.TopLeft = this.TopLeft;
			RNTobj.TopRight = this.TopRight;
			RNTobj.BottomRight = this.BottomRight;
			RNTobj.BottomLeft = this.BottomLeft;
			this.fadeWidth = this.currentWidth;
			this.fadeHeight = this.currentHeight;
		}

		public void continueCalculateRNTObject()
		{
			if (this.state != State.Resizing && this.isSelected == false)
			{
				if (this.deSelected == true || this.slideValue > 0.15f || !(this.fadeWidth >= (this.currentWidth-0.001)  && this.fadeWidth <= (this.currentWidth+0.001) && this.fadeHeight >= (this.currentHeight-0.001)  && this.fadeHeight <= (this.currentHeight+0.001))) 
				{
					if (this.deSelected == true) this.RNTobj.RNTJustScale(this.lastMousePoint, this.fadeWidth, this.fadeHeight, this.originalWidth, this.originalHeight, this.currentWidth, this.currentHeight);
                    else this.RNTobj.RNTMoveNScale(this.lastMousePoint, this.fadeWidth, this.fadeHeight, this.originalWidth, this.originalHeight, this.currentWidth, this.currentHeight);
					updateInterfaceObjConfiguration();
					this.computeBorder();
				}
			} 
			else if (this.isSelected == true)
			{
				this.RNTobj.RNTOnlyScale(this.CentrePoint, this.fadeWidth, this.fadeHeight, this.originalWidth, this.originalHeight, this.currentWidth, this.currentHeight);
				updateInterfaceObjConfiguration();
				this.computeBorder();
			}

		}
		public void translateInterfaceObject(PointF translatePoint)
		{
			this.RNTobj.RNTTransalteMove(translatePoint);

			this.CentrePoint = this.RNTobj.Center;
			this.TopLeft = this.RNTobj.TopLeft;
			this.TopRight = this.RNTobj.TopRight;
			this.BottomRight = this.RNTobj.BottomRight;
			this.BottomLeft = this.RNTobj.BottomLeft;

			this.lastMousePoint = new PointF(this.lastMousePoint.X+translatePoint.X, this.lastMousePoint.Y+translatePoint.Y);
			this.computeBorder();
		}

		public void isIObjectInsideWorkspace()
		{
			PointF newPos;
			bool posChange = false;
			int[] viewport = new int[4];

			Gl.glGetIntegerv(Gl.GL_VIEWPORT,viewport);		
			newPos = this.CentrePoint;
			if (newPos.X < (((float) viewport[0])+13)) 
			{
				newPos.X = (((float) viewport[0])+15);
				posChange = true;
			}
			if (newPos.Y < (((float) viewport[1])+13)) 
			{
				newPos.Y = (((float) viewport[1])+15);
				posChange = true;
			}
			if (newPos.X > (((float) viewport[2])-13)) 
			{
				newPos.X = (((float) viewport[2])-15);
				posChange = true;
			}
			if (newPos.Y > (((float) viewport[3])-13)) 
			{
				newPos.Y = (((float) viewport[3])-15);
				posChange = true;
			}

			if (posChange == true)
			{
				this.removeThisInterfaceObjectFromGrid();
				this.translateInterfaceObject(new PointF(newPos.X-this.CentrePoint.X, newPos.Y-this.CentrePoint.Y));
				this.translateEndInterfaceObject();	
				this.lastMousePoint = this.CentrePoint;
				this.addThisInterfaceObjectToGrid();
			}
		}
		public void translateEndInterfaceObject()
		{
			this.RNTobj.RNTTransalteEnd();

			this.CentrePoint = this.RNTobj.Center;
			this.TopLeft = this.RNTobj.TopLeft;
			this.TopRight = this.RNTobj.TopRight;
			this.BottomRight = this.RNTobj.BottomRight;
			this.BottomLeft = this.RNTobj.BottomLeft;
			
			this.currentWidth = this.RNTobj.Width;
			this.currentHeight = this.RNTobj.Height;

			this.newWidth = this.currentWidth;
			this.newHeight = this.currentHeight;

			this.fadeWidth = this.newWidth;
			this.fadeHeight = this.newHeight;

			//this.computeBorder();

			this.createObjectList();
		}

		public RNTObject getRNTObj()
		{
			return RNTobj;
		}

		public void resizeSELInterfaceObject(PointF setTopLeft, PointF setTopRight, PointF setBottomRight, PointF setBottomLeft, float scale)
		{
			this.RNTobj.setNewCornerPoints(setTopLeft, setTopRight, setBottomRight, setBottomLeft, 0.0f, false);	
			
			this.CentrePoint = RNTobj.Center;
			this.TopLeft = RNTobj.TopLeft;
			this.TopRight = RNTobj.TopRight;
			this.BottomRight = RNTobj.BottomRight;
			this.BottomLeft = RNTobj.BottomLeft;

			this.currentWidth = this.RNTobj.Width;
			this.currentHeight = this.RNTobj.Height;

			this.newWidth = this.currentWidth;
			this.newHeight = this.currentHeight;

			this.fadeWidth = this.newWidth;
			this.fadeHeight = this.newHeight;

			this.originalWidth = this.currentWidth/scale;
			this.originalHeight = this.currentHeight/scale;

			this.computeBorder();
		}
	
		public void beforSEL(float scaleValue)
		{
			if (this.ObjInArea != null) 
			{
				this.IObjectInsideSplineArea = false;
				this.ObjInArea.removeInterfaceObjectFromSpline(this);
				this.ObjInArea = null;
			}

			this.setStepsToChange(scaleValue);
		}

		public void afterSELTest()
		{
			int hits = 0;
			int[] pickmod = new int[200];
			int[] viewport = new int[4];
			float[] pixel = new float[3];                                            
			bool newCalc;

			this.lastMousePoint = this.CentrePoint;
			
			Gl.glGetIntegerv(Gl.GL_VIEWPORT,viewport);		
			Gl.glSelectBuffer(200, pickmod);
			Gl.glRenderMode(Gl.GL_SELECT);
			Gl.glInitNames();
			Gl.glMatrixMode(Gl.GL_PROJECTION);
			Gl.glPushMatrix();				
			Gl.glLoadIdentity();
			Glu.gluPickMatrix (this.CentrePoint.X, viewport[3]-this.CentrePoint.Y, 1.0, 1.0,viewport);
			Glu.gluOrtho2D(0,(double) viewport[2], (double) viewport[3] , 0);
			Gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
			Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);	// Clear Screen And Depth Buffer
			Gl.glMatrixMode(Gl.GL_MODELVIEW);
			Gl.glPushMatrix();	
			Gl.glLoadIdentity();
			ArrayList MoveSplineList = this.interfaceOBJ.getAllGridMoveSplines();
			for (int names=0; names < MoveSplineList.Count; names++) 
			{
				Gl.glPushName(names);
				((Spline) MoveSplineList[names]).drawBackGround(false);
				Gl.glPopName();
			}	
			Gl.glPopMatrix();
			Gl.glMatrixMode(Gl.GL_PROJECTION);
			Gl.glPopMatrix();
			Gl.glFlush();
			hits = Gl.glRenderMode(Gl.GL_RENDER);
			if (hits > 0)
			{

				this.ObjInArea = (Spline) MoveSplineList[pickmod[(hits-1)*5+3]];
				this.ObjInArea.addInterfaceObjectToSpline(this);		
				this.IObjectInsideSplineArea = true;
				this.storedAreaPart = pickmod[(hits-1)*5+4];

				if (this.storedAreaPart != 99)
				{ 
					//Gl.glGetIntegerv(Gl.GL_VIEWPORT,viewport);							      
					Gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
					Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);	// Clear Screen And Depth Buffer
					Gl.glMatrixMode(Gl.GL_MODELVIEW);
					Gl.glLoadIdentity();
					this.ObjInArea.drawBackGround(false);
					Gl.glReadPixels((int) (this.CentrePoint.X),viewport[3]-((int) (this.CentrePoint.Y)),1,1,Gl.GL_RGB,Gl.GL_FLOAT,pixel);
					if (pixel[0] < this.ObjInArea.getObjectScaleValue()) pixel[0] = this.ObjInArea.getObjectScaleValue();
					this.newWidth = this.originalWidth*pixel[0];
					this.newHeight = this.originalHeight*pixel[0];
					if (pixel[0] >= (this.lastScaleValue-0.001)  && pixel[0] <= (this.lastScaleValue+0.001)) newCalc = false; else newCalc = true;
					this.lastScaleValue = pixel[0];
				}
				else
				{
					this.newWidth = this.originalWidth*this.ObjInArea.getObjectScaleValue();
					this.newHeight = this.originalHeight*this.ObjInArea.getObjectScaleValue();
					if (this.ObjInArea.getObjectScaleValue() != this.lastScaleValue) newCalc = true; else newCalc = false;
					this.lastScaleValue = this.ObjInArea.getObjectScaleValue();
				}

				if (this.newWidth < this.originalWidth*ApplicationProperties.shrink_ratio) this.newWidth = this.originalWidth*ApplicationProperties.shrink_ratio;
				if ( this.newHeight < this.originalHeight*ApplicationProperties.shrink_ratio) this.newHeight = this.originalHeight*ApplicationProperties.shrink_ratio;

				if (newCalc == true)
				{
					this.difWidth =  1.5f+((float) Math.Abs(this.newWidth-this.currentWidth))/this.zoomValue;
					this.difHeight =  1.5f+((float) Math.Abs(this.newHeight-this.currentHeight))/this.zoomValue;
				}	
			}
			else 
			{
				this.newWidth = this.originalWidth;
				this.newHeight = this.originalHeight;

				this.difWidth = 1.5f+((float) Math.Abs(this.newWidth-this.currentWidth))/this.zoomValue;
				this.difHeight = 1.5f+((float) Math.Abs(this.newHeight-this.currentHeight))/this.zoomValue;

				this.IObjectInsideSplineArea = false;
				this.ObjInArea = null;
				this.lastScaleValue = 1.0f;
			}

			this.deSelected = true;
			this.rntCalculation = true;
		}

		public void setCurrentSize(float scaleValue)
		{
			this.lastScaleValue = scaleValue;

			this.currentWidth = this.RNTobj.Width;
			this.currentHeight = this.RNTobj.Height;

			this.newWidth = this.currentWidth;
			this.newHeight = this.currentHeight;

			this.fadeWidth = this.newWidth;
			this.fadeHeight = this.newHeight;

			this.originalWidth = this.currentWidth/this.lastScaleValue;
			this.originalHeight = this.currentHeight/this.lastScaleValue;
		}
		public void onlySelScale(float scaleValue)
		{
			this.newWidth = this.originalWidth*scaleValue;
			this.newHeight = this.originalHeight*scaleValue;
			this.lastScaleValue = scaleValue;
			
			// Here is the place to keep selection card(s) in propotion to its original width and height
			if (this.newWidth < this.originalWidth*ApplicationProperties.shrink_ratio) this.newWidth = this.originalWidth*ApplicationProperties.shrink_ratio;
			if ( this.newHeight < this.originalHeight*ApplicationProperties.shrink_ratio) this.newHeight = this.originalHeight*ApplicationProperties.shrink_ratio;

			this.fadeWidth = this.newWidth;
			this.fadeHeight = this.newHeight;

			this.RNTobj.RNTOnlyScale(this.CentrePoint, this.fadeWidth, this.fadeHeight, this.originalWidth, this.originalHeight, this.currentWidth, this.currentHeight);

			this.CentrePoint = RNTobj.Center;
			this.TopLeft = RNTobj.TopLeft;
			this.TopRight = RNTobj.TopRight;
			this.BottomRight = RNTobj.BottomRight;
			this.BottomLeft = RNTobj.BottomLeft;

			this.currentWidth = this.fadeWidth;
			this.currentHeight = this.fadeHeight;

			this.computeBorder();	
		}

		private float[] Sort(float[]array)
		{
			int n = array.Length;
			int i, j;
			float t;

			for( i = 1; i < n; i++)
			{
				j = i;
				t = array[j];
				while(j > 0 && array[j - 1] > t)
				{
					array[j] = array[j - 1];
					j--;
				}
				array[j] = t;
			}
			return array;
		}
		
		private void fillVertexArrays()
		{
			/* filling the vertexarray_BorderInside */

			this.vertexArray_BorderInside[0] = this.TopLeft.X;
			this.vertexArray_BorderInside[1] = this.TopLeft.Y;
			this.vertexArray_BorderInside[2] = this.TopRight.X;
			this.vertexArray_BorderInside[3] = this.TopRight.Y;
			this.vertexArray_BorderInside[4] = this.BottomRight.X;
			this.vertexArray_BorderInside[5] = this.BottomRight.Y;
			this.vertexArray_BorderInside[6] = this.BottomLeft.X;
			this.vertexArray_BorderInside[7] = this.BottomLeft.Y;

			/* filling the vertexarray_TriangleStrip */
			
			this.vertexArray_TriangleStrip[0] = this.TopLeft.X;
			this.vertexArray_TriangleStrip[1] = this.TopLeft.Y;
			this.vertexArray_TriangleStrip[2] = this.UpLeft.X;
			this.vertexArray_TriangleStrip[3] = this.UpLeft.Y;
			this.vertexArray_TriangleStrip[4] = this.TopRight.X;
			this.vertexArray_TriangleStrip[5] = this.TopRight.Y;
			this.vertexArray_TriangleStrip[6] = this.UpRight.X;
			this.vertexArray_TriangleStrip[7] = this.UpRight.Y;
			this.vertexArray_TriangleStrip[8] = this.BottomRight.X;
			this.vertexArray_TriangleStrip[9] = this.BottomRight.Y;
			this.vertexArray_TriangleStrip[10] = this.DownRight.X;
			this.vertexArray_TriangleStrip[11] = this.DownRight.Y;
			this.vertexArray_TriangleStrip[12] = this.BottomLeft.X;
			this.vertexArray_TriangleStrip[13] = this.BottomLeft.Y;
			this.vertexArray_TriangleStrip[14] = this.DownLeft.X;
			this.vertexArray_TriangleStrip[15] = this.DownLeft.Y;
			this.vertexArray_TriangleStrip[16] = this.TopLeft.X;
			this.vertexArray_TriangleStrip[17] = this.TopLeft.Y;
			this.vertexArray_TriangleStrip[18] = this.UpLeft.X;
			this.vertexArray_TriangleStrip[19] = this.UpLeft.Y;
		}

	
		private void computeBorder()
		{
			this.vectorHORZONTAL = this.RNTobj.getVectorHorizontal();
			this.vectorVERTICALY = this.RNTobj.getVectorVerticaly();

			this.UpLeft = new PointF((this.TopLeft.X-this.borderSize*this.vectorHORZONTAL.X-this.borderSize*this.vectorVERTICALY.X), (this.TopLeft.Y-this.borderSize*this.vectorHORZONTAL.Y-this.borderSize*this.vectorVERTICALY.Y));
			this.UpRight = new PointF((this.TopRight.X+this.borderSize*this.vectorHORZONTAL.X-this.borderSize*this.vectorVERTICALY.X), (this.TopRight.Y+this.borderSize*this.vectorHORZONTAL.Y-this.borderSize*this.vectorVERTICALY.Y));
			this.DownRight = new PointF((this.BottomRight.X+this.borderSize*this.vectorHORZONTAL.X+this.borderSize*this.vectorVERTICALY.X), (this.BottomRight.Y+this.borderSize*this.vectorHORZONTAL.Y+this.borderSize*this.vectorVERTICALY.Y));
			this.DownLeft = new PointF((this.BottomLeft.X-this.borderSize*this.vectorHORZONTAL.X+this.borderSize*this.vectorVERTICALY.X), (this.BottomLeft.Y-this.borderSize*this.vectorHORZONTAL.Y+this.borderSize*this.vectorVERTICALY.Y));
			
			this.resizePoint = new PointF((this.BottomRight.X-2*this.vectorHORZONTAL.X-2*this.vectorVERTICALY.X), (this.BottomRight.Y-2*this.vectorHORZONTAL.Y-2*this.vectorVERTICALY.Y));
			if (this.resizeButton != null) this.resizeButton.setObjectButton(this.resizePoint);

			this.fillVertexArrays();
		}

		private bool outOfbounds = false;
		private void moveInterfaceObject(Point mousePoint)
		{
			this.RNTobj.RNTMoveNScale(mousePoint, this.fadeWidth, this.fadeHeight, this.originalWidth, this.originalHeight, this.currentWidth, this.currentHeight);
			if(Utility.checkPtWithBoundry(mousePoint))
			{
				updateInterfaceObjConfiguration();
				this.computeBorder();
			}
			else
			{
				outOfbounds = true;
				revertInterfaceObjConfiguration();
				mouseUP(mousePoint);
			}
		}

		private void moveNresizeInterfaceObject(Point mousePoint, Spline belowSpline)
		{
			/* When an iterfaceObject is moved without being resized/selected, this function will be called to calculate the size
			 * of the iterface object. In the case of an interface object inside of a moveable spline this funcaion will be 
			 * calculating the new width and height of the card.
			 */
			float[] pixel = new float[3];                                            
			int[] viewport = new int[4]; 
			bool newCalc;
			    
			if (this.storedAreaPart != 99)
			{ 
				Gl.glGetIntegerv(Gl.GL_VIEWPORT,viewport);							      
				Gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
				Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);	// Clear Screen And Depth Buffer
				Gl.glMatrixMode(Gl.GL_MODELVIEW);
				Gl.glLoadIdentity();
				belowSpline.drawBackGround(false);
				Gl.glReadPixels(mousePoint.X,viewport[3]-mousePoint.Y,1,1,Gl.GL_RGB,Gl.GL_FLOAT,pixel);
				// pixel[0] is scalevalue I get from the graycolor background (of the spline) at the current mousepoint
				if (pixel[0] < belowSpline.getObjectScaleValue()) pixel[0] = belowSpline.getObjectScaleValue();
				this.newWidth = this.originalWidth*pixel[0];
				this.newHeight = this.originalHeight*pixel[0];
				if (pixel[0] >= (this.lastScaleValue-0.001)  && pixel[0] <= (this.lastScaleValue+0.001)) newCalc = false; else newCalc = true;
				this.lastScaleValue = pixel[0];
			}
			else
			{
				this.newWidth = this.originalWidth*belowSpline.getObjectScaleValue();
				this.newHeight = this.originalHeight*belowSpline.getObjectScaleValue();
				if (belowSpline.getObjectScaleValue() != this.lastScaleValue) newCalc = true; else newCalc = false;
				this.lastScaleValue = belowSpline.getObjectScaleValue();
			}
			/*Do not allow a card to shrink lass than 1/4 of its original size. Whenever the calculated width and height is
			 *less than half of its original value, reset them to ba a half.
			 */
			if (this.newWidth < this.originalWidth*ApplicationProperties.shrink_ratio) this.newWidth = this.originalWidth*ApplicationProperties.shrink_ratio;
			if ( this.newHeight < this.originalHeight*ApplicationProperties.shrink_ratio) this.newHeight = this.originalHeight*ApplicationProperties.shrink_ratio;


			if (this.rntCalculation == false)
			{
				this.RNTobj.RNTMoveNScale(mousePoint, this.fadeWidth, this.fadeHeight, this.originalWidth, this.originalHeight, this.currentWidth, this.currentHeight);

				this.CentrePoint = RNTobj.Center;
				this.TopLeft = RNTobj.TopLeft;
				this.TopRight = RNTobj.TopRight;
				this.BottomRight = RNTobj.BottomRight;
				this.BottomLeft = RNTobj.BottomLeft;

				this.currentWidth = this.fadeWidth;
				this.currentHeight = this.fadeHeight;

				this.computeBorder();
			}

			if (newCalc == true)
			{
				this.difWidth =  1.5f+((float) Math.Abs(this.newWidth-this.currentWidth))/this.zoomValue;
				this.difHeight =  1.5f+((float) Math.Abs(this.newHeight-this.currentHeight))/this.zoomValue;
			}	

			if (this.IObjectInsideSplineArea == false)
			{
				this.ObjInArea = belowSpline;
				this.IObjectInsideSplineArea = true;
			}
			else if (this.IObjectInsideSplineArea == true && this.ObjInArea != belowSpline)
			{
				this.ObjInArea = belowSpline;	
			}
		}

		private void resizeOBJtoOriginalSize(Point mousePoint)
		{   
			
			this.newWidth = this.originalWidth;
			this.newHeight = this.originalHeight;

			this.difWidth = 1.5f+((float) Math.Abs(this.newWidth-this.currentWidth))/this.zoomValue;
			this.difHeight = 1.5f+((float) Math.Abs(this.newHeight-this.currentHeight))/this.zoomValue;

			this.IObjectInsideSplineArea = false;
			this.lastScaleValue = 1.0f;

			if (this.ObjInArea != null) 
			{
				this.ObjInArea = null;
			}
		}

		private void resizeInterfaceObject(PointF mousePoint)
		{
			this.RNTobj.RNTScaleMove(mousePoint);

			this.CentrePoint = this.RNTobj.Center;
			this.TopLeft = this.RNTobj.TopLeft;
			this.TopRight = this.RNTobj.TopRight;
			this.BottomRight = this.RNTobj.BottomRight;
			this.BottomLeft = this.RNTobj.BottomLeft;

			this.currentWidth = this.RNTobj.Width;
			this.currentHeight = this.RNTobj.Height;

			this.newWidth = this.currentWidth;
			this.newHeight = this.currentHeight;

			this.fadeWidth = this.newWidth;
			this.fadeHeight = this.newHeight;

			this.originalWidth = this.currentWidth/this.lastScaleValue;
			this.originalHeight = this.currentHeight/this.lastScaleValue;

			this.computeBorder();

		}



		/*******************************************************************/
		/* End of the head of this Object - now the user code stuff begins */
		/*******************************************************************/
		

		public void addOnlyButtonsToGrid()
		{
			this.interfaceOBJ.addObjectButton(this.resizeButton);
		}

		public void removeOnlyButtonsFromGrid()
		{
			this.interfaceOBJ.removeObjectButtons(this.resizeButton);
		}

		public void addThisInterfaceObjectToGrid()
		{
			this.interfaceOBJ.addObject(this);
			this.interfaceOBJ.addObjectButton(this.resizeButton);
		}

		public void removeThisInterfaceObjectFromGrid()
		{
			this.interfaceOBJ.removeObject(this);
			this.interfaceOBJ.removeObjectButtons(this.resizeButton);
		}

		public void computeAnimations()
		{
			if (this.drawCircle == true)
			{
				if (this.fadeOutCircle == true)
				{
					this.fadeOutCircleFilled = this.fadeOutCircleFilled - 0.004f;
					this.fadeOutCircleNoneFilled = this.fadeOutCircleNoneFilled - 0.008f;

					if (this.fadeOutCircleFilled <= 0 || this.fadeOutCircleNoneFilled <= 0)
					{
						this.drawCircle = false;
						this.fadeOutCircle = false;
					}
				}
			}


			/* Zooming of the InterfaceObjectsize */

			if (this.newWidth < this.currentWidth) 
			{
				this.fadeWidth = this.fadeWidth - this.difWidth; 
				if (this.fadeWidth < this.newWidth) this.fadeWidth = this.newWidth;
			
			}
			else if (this.newWidth > this.currentWidth)
			{
				this.fadeWidth = this.fadeWidth + this.difWidth; 
				if (this.fadeWidth > this.newWidth) this.fadeWidth = this.newWidth;
			}

			
			if (this.newHeight < this.currentHeight) 
			{
				this.fadeHeight = this.fadeHeight - this.difHeight; 
				if (this.fadeHeight < this.newHeight) this.fadeHeight = this.newHeight;
				
			}
			else if (this.newHeight > this.currentHeight)
			{
				this.fadeHeight = this.fadeHeight + this.difHeight; 
				if (this.fadeHeight > this.newHeight) this.fadeHeight = this.newHeight;
			}	

			if (this.rntCalculation == true) 
			{
			
				if (this.slideValue > 0.15)
				{
					int hits = 0;
					int[] pickmod = new int[200];
					int[] viewport = new int[4];

					this.lastMousePoint = new PointF(this.lastMousePoint.X+this.slideVector.X, this.lastMousePoint.Y+this.slideVector.Y);
					this.slideVector.X = this.slideVector.X*0.95f;
					this.slideVector.Y = this.slideVector.Y*0.95f;
					this.slideValue = this.slideValue*0.95f;

					Gl.glGetIntegerv(Gl.GL_VIEWPORT,viewport);	
					if (lastMousePoint.X < (((float) viewport[0]))) 
					{
						lastMousePoint.X = (((float) viewport[0]));
						this.slideValue = 0.001f;
					}
					if (lastMousePoint.Y < (((float) viewport[1]))) 
					{
						lastMousePoint.Y = (((float) viewport[1]));
						this.slideValue = 0.001f;
					}
					if (lastMousePoint.X > (((float) viewport[2]))) 
					{
						lastMousePoint.X = (((float) viewport[2]));
						this.slideValue = 0.001f;
					}
					if (lastMousePoint.Y > (((float) viewport[3]))) 
					{
						lastMousePoint.Y = (((float) viewport[3]));
						this.slideValue = 0.001f;
					}
				
					Gl.glSelectBuffer(200, pickmod);
					Gl.glRenderMode(Gl.GL_SELECT);
					Gl.glInitNames();
					Gl.glMatrixMode(Gl.GL_PROJECTION);
					Gl.glPushMatrix();				
					Gl.glLoadIdentity();
					Glu.gluPickMatrix ((int) this.lastMousePoint.X, viewport[3]-((int)this.lastMousePoint.Y), 1.0, 1.0,viewport);
					Glu.gluOrtho2D(0,(double) viewport[2], (double) viewport[3] , 0);
					Gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
					Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);	// Clear Screen And Depth Buffer
					Gl.glMatrixMode(Gl.GL_MODELVIEW);
					Gl.glPushMatrix();	
					Gl.glLoadIdentity();
					ArrayList SplineList = this.interfaceOBJ.getAllGridMoveSplines();
					for (int names=0; names < SplineList.Count; names++) 
					{
						Gl.glPushName(names);
						((Spline) SplineList[names]).drawBackGround(false);
						Gl.glPopName();
					}	
					Gl.glPopMatrix();
					Gl.glMatrixMode(Gl.GL_PROJECTION);
					Gl.glPopMatrix();
					Gl.glFlush();
					hits = Gl.glRenderMode(Gl.GL_RENDER);
				
					if (hits > 0) this.storedAreaPart = pickmod[(hits-1)*5+4]; else this.storedAreaPart = 0; 
					if (this.IObjectInsideSplineArea == true && hits == 0) resizeOBJtoOriginalSize(new Point((int) lastMousePoint.X, (int) lastMousePoint.Y));
					else if (hits > 0) this.moveNresizeInterfaceObject(new Point((int) lastMousePoint.X, (int) lastMousePoint.Y), (Spline) SplineList[pickmod[(hits-1)*5+3]]);

				}
	
				this.continueCalculateRNTObject();

				if (this.slideValue < 0.15 && !(this.newWidth < this.currentWidth) && !(this.newWidth > this.currentWidth) && !(this.newHeight < this.currentHeight) && !(this.newHeight > this.currentHeight))
				{
					if (this.waitOneStep == true)
					{
						if (this.state == State.Moving) this.RNTobj.RNTMouseUp();
						else if (this.state == State.Resizing) this.RNTobj.RNTScaleUp(this);

						if (this.deSelected == true) this.deSelected = false;
						
						this.continueCalculateRNTObject();
						this.rntCalculation = false;
						this.waitOneStep = false;
						this.state = State.Nothing;
						this.createObjectList();

						if (this.isSelected == false)
						{
							this.interfaceOBJ.addRealObject(this);
							this.interfaceOBJ.addObjectButton(this.resizeButton);
							if (this.ObjInArea != null) this.ObjInArea.addInterfaceObjectToSpline(this);
		
							this.animateObjects.Remove(this);
						}
						this.slideValue = 0.0f;
						this.slideVector = new PointF(0.0f, 0.0f);
						
						if(!initializationMovement)
						{
							MaseUpdate.registerUpdated(this);
						}
						else
						{
							initializationMovement = false;
						}
					} else this.waitOneStep = true;

				}
			}

		}

		public void endSlideBySelection()
		{
			if (this.rntCalculation == true)
			{
				this.RNTobj.RNTMouseUp();

				this.interfaceOBJ.removeObjectShadow(this);
				this.animateObjects.Remove(this);
			
				this.slideValue = 0.0f;
				this.slideVector = new PointF(0.0f, 0.0f);

				this.setCurrentSize(this.lastScaleValue);
				if (this.isSelected == false) this.interfaceOBJ.addObjectButton(this.resizeButton);
				this.continueCalculateRNTObject();
				this.rntCalculation = false;
				this.state = State.Nothing;
				this.createObjectList();

				this.state = State.Nothing;
			}
		}

		public void catchIT(Point catchPoint, int inputID)
		{
			this.RNTobj.RNTMouseUp();

			this.interfaceOBJ.removeObjectShadow(this);
			this.animateObjects.Remove(this);
			
			this.slideValue = 0.0f;
			this.slideVector = new PointF(0.0f, 0.0f);

			this.rntCalculation = false;
			this.state = State.Moving;
			this.lastMousePoint = catchPoint;

			this.RNTobj.RNTMouseDown(catchPoint);
			this.drawCircle = true;
			this.fadeOutCircle = false;
			this.fadeOutCircleFilled = 0.4f;
			this.fadeOutCircleNoneFilled = 0.8f;

		}



		/*******************************************************************/
		/*   This are the drawing Functions which draw MoveSpline stuff    */
		/*******************************************************************/


		public void drawInterfaceObject(bool MOVEObj)
		{ 
			MOVEObj = true;
			if (MOVEObj == true || this.rntCalculation == true)
			{			
				Gl.glPushMatrix();
				Gl.glEnable(Gl.GL_TEXTURE_2D);
				Gl.glBindTexture(Gl.GL_TEXTURE_2D, this.texture[0]);
				Gl.glColor4f(1.0f,1.0f,1.0f, 1.0f);
				Gl.glBegin(Gl.GL_QUADS);								
				Gl.glTexCoord2f(0.0f, 0.0f); Gl.glVertex2f(this.TopLeft.X, this.TopLeft.Y);				
				Gl.glTexCoord2f(0.0f, 1.0f); Gl.glVertex2f(this.BottomLeft.X, this.BottomLeft.Y);						
				Gl.glTexCoord2f(1.0f, 1.0f); Gl.glVertex2f(this.BottomRight.X, this.BottomRight.Y);				
				Gl.glTexCoord2f(1.0f, 0.0f); Gl.glVertex2f(this.TopRight.X, this.TopRight.Y);		
				Gl.glEnd();		
				Gl.glDisable(Gl.GL_TEXTURE_2D);	
				Gl.glPopMatrix();
			
				Gl.glEnableClientState(Gl.GL_VERTEX_ARRAY);
				Gl.glPushMatrix();
			
				if (this.isSelected == true)
				{
					Gl.glColor4f(this.colorBorderArray[0,0], this.colorBorderArray[0,1], this.colorBorderArray[0,2], 0.7f);
					Gl.glVertexPointer(2, Gl.GL_FLOAT, 0, this.vertexArray_BorderInside);
					Gl.glDrawArrays(Gl.GL_QUADS, 0, 4);
				}

				Gl.glLineWidth(1.5f);
				Gl.glColor4f(this.colorBorderArray[0,0], this.colorBorderArray[0,1], this.colorBorderArray[0,2], 1.0f);
				Gl.glVertexPointer(2, Gl.GL_FLOAT, 0, this.vertexArray_BorderInside);
				Gl.glDrawArrays(Gl.GL_LINE_LOOP, 0, 4);
			
				Gl.glEnableClientState(Gl.GL_COLOR_ARRAY);
				Gl.glColorPointer(4, Gl.GL_FLOAT, 0, this.colorBorderArray);
				Gl.glVertexPointer(2, Gl.GL_FLOAT, 0, this.vertexArray_TriangleStrip);
				Gl.glDrawArrays(Gl.GL_TRIANGLE_STRIP, 0, 10);
				Gl.glDisableClientState(Gl.GL_COLOR_ARRAY);

				Gl.glPopMatrix();
				Gl.glDisableClientState(Gl.GL_VERTEX_ARRAY);
			}
			else 
			{
				Gl.glPushMatrix();
				Gl.glCallList(this.GLListObject);
				Gl.glPopMatrix();
			}
	
			Gl.glPushMatrix();
			Gl.glTranslatef(this.resizePoint.X, this.resizePoint.Y, 0.0f);
			Gl.glRotatef(this.RNTobj.Angle, 0.0f, 0.0f, 1.0f);
			Gl.glEnable(Gl.GL_TEXTURE_2D);
			Gl.glBlendFunc(Gl.GL_DST_COLOR,Gl.GL_ZERO);// Blend Screen Color With Zero (Black)
			Gl.glBindTexture(Gl.GL_TEXTURE_2D, this.IconTextures[8]); 
			Gl.glColor4f(1.0f,1.0f,1.0f, 1.0f);
			Gl.glBegin(Gl.GL_QUADS);								
			Gl.glTexCoord2f(0.0f, 0.0f); Gl.glVertex2f(-8.0f, -8.0f);		// bottom Left					
			Gl.glTexCoord2f(0.0f, 1.0f); Gl.glVertex2f(-8.0f, +8.0f);		// top Left				
			Gl.glTexCoord2f(1.0f, 1.0f); Gl.glVertex2f(+8.0f, +8.0f);		// top Right			
			Gl.glTexCoord2f(1.0f, 0.0f); Gl.glVertex2f(+8.0f, -8.0f);		// bottom Right
			Gl.glEnd();				
			Gl.glBlendFunc(Gl.GL_ONE, Gl.GL_ONE);
			Gl.glBindTexture(Gl.GL_TEXTURE_2D, this.IconTextures[9]); 
			Gl.glColor4f(1.0f,1.0f,1.0f, 1.0f);
			Gl.glBegin(Gl.GL_QUADS);								
			Gl.glTexCoord2f(0.0f, 0.0f); Gl.glVertex2f(-8.0f, -8.0f);		// bottom Left					
			Gl.glTexCoord2f(0.0f, 1.0f); Gl.glVertex2f(-8.0f, +8.0f);		// top Left				
			Gl.glTexCoord2f(1.0f, 1.0f); Gl.glVertex2f(+8.0f, +8.0f);		// top Right			
			Gl.glTexCoord2f(1.0f, 0.0f); Gl.glVertex2f(+8.0f, -8.0f);		// bottom Right
			Gl.glEnd();
			Gl.glBlendFunc(Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA);
			Gl.glDisable(Gl.GL_TEXTURE_2D);	
			Gl.glPopMatrix();

			if (this.drawCircle == true)
			{
				Gl.glPushMatrix();
				Gl.glTranslatef(this.CentrePoint.X, this.CentrePoint.Y, 0.0f);
				Gl.glScalef(this.RNTobj.TranslateOnlyZoneRadius, this.RNTobj.TranslateOnlyZoneRadius, 1.0f);
				Gl.glColor4f(0.3f, 0.6f, 0.9f, this.fadeOutCircleFilled);
				Gl.glCallList(this.GLListCircleFilled);
				Gl.glColor4f(0.0f, 0.0f, 1.0f, this.fadeOutCircleNoneFilled);
				Gl.glCallList(this.GLListCircleNoneFilled);
				Gl.glPopMatrix();
			}
		}

		public void drawInterfaceShadow()
		{
			Gl.glColor3f(1.0f, 1.0f, 1.0f);
			Gl.glBegin(Gl.GL_QUADS);
			Gl.glVertex2f(this.TopLeft.X, this.TopLeft.Y);
			Gl.glVertex2f(this.TopRight.X, this.TopRight.Y);
			Gl.glVertex2f(this.BottomRight.X, this.BottomRight.Y);
			Gl.glVertex2f(this.BottomLeft.X, this.BottomLeft.Y);
			Gl.glEnd();
		}


		private void createObjectList()
		{
			this.GLListObject = Gl.glGenLists(1);
			Gl.glNewList(this.GLListObject, Gl.GL_COMPILE);
			
			Gl.glPushMatrix();
			Gl.glEnable(Gl.GL_TEXTURE_2D);
			Gl.glBindTexture(Gl.GL_TEXTURE_2D, this.texture[0]);
			Gl.glColor4f(1.0f,1.0f,1.0f, 1.0f);
			Gl.glBegin(Gl.GL_QUADS);								
			Gl.glTexCoord2f(0.0f, 0.0f); Gl.glVertex2f(this.TopLeft.X, this.TopLeft.Y);				
			Gl.glTexCoord2f(0.0f, 1.0f); Gl.glVertex2f(this.BottomLeft.X, this.BottomLeft.Y);						
			Gl.glTexCoord2f(1.0f, 1.0f); Gl.glVertex2f(this.BottomRight.X, this.BottomRight.Y);				
			Gl.glTexCoord2f(1.0f, 0.0f); Gl.glVertex2f(this.TopRight.X, this.TopRight.Y);		
			Gl.glEnd();		
			Gl.glDisable(Gl.GL_TEXTURE_2D);	
			Gl.glPopMatrix();
			
			Gl.glEnableClientState(Gl.GL_VERTEX_ARRAY);
			Gl.glPushMatrix();

			if (this.isSelected == true)
			{
				Gl.glColor4f(this.colorBorderArray[0,0], this.colorBorderArray[0,1], this.colorBorderArray[0,2], 0.7f);
				Gl.glVertexPointer(2, Gl.GL_FLOAT, 0, this.vertexArray_BorderInside);
				Gl.glDrawArrays(Gl.GL_QUADS, 0, 4);
			}

			Gl.glLineWidth(1.5f);
			Gl.glColor4f(this.colorBorderArray[0,0], this.colorBorderArray[0,1], this.colorBorderArray[0,2], 1.0f);
			Gl.glVertexPointer(2, Gl.GL_FLOAT, 0, this.vertexArray_BorderInside);
			Gl.glDrawArrays(Gl.GL_LINE_LOOP, 0, 4);
			
			Gl.glEnableClientState(Gl.GL_COLOR_ARRAY);
			Gl.glColorPointer(4, Gl.GL_FLOAT, 0, this.colorBorderArray);
			Gl.glVertexPointer(2, Gl.GL_FLOAT, 0, this.vertexArray_TriangleStrip);
			Gl.glDrawArrays(Gl.GL_TRIANGLE_STRIP, 0, 10);
			Gl.glDisableClientState(Gl.GL_COLOR_ARRAY);

			Gl.glPopMatrix();
			Gl.glDisableClientState(Gl.GL_VERTEX_ARRAY);
			Gl.glEndList();
		}

		private void createCircleList()
		{
			this.GLListCircleFilled = Gl.glGenLists(1);
			Gl.glNewList(this.GLListCircleFilled, Gl.GL_COMPILE);
			Gl.glBegin(Gl.GL_POLYGON);
			for(float run=0.0f; run<=2*Math.PI; run+=0.06282f)
			{
				Gl.glVertex2d(Math.Sin(run), Math.Cos(run));
			}
			Gl.glEnd(); 
			Gl.glEndList();

			this.GLListCircleNoneFilled = Gl.glGenLists(1);
			Gl.glNewList(this.GLListCircleNoneFilled, Gl.GL_COMPILE);
			Gl.glLineWidth(1.0f);
			Gl.glBegin(Gl.GL_LINE_LOOP);
			for(float run=0.0f; run<=2*Math.PI; run+=0.06282f)
			{
				Gl.glVertex2d(Math.Sin(run), Math.Cos(run));
			}
			Gl.glEnd(); 
			Gl.glEndList();
		}



		/*******************************************************************/
		/*                          Mouse Events                           */
		/*******************************************************************/


		public void mouseDOWN(Point DOWNPoint, int inputID)
		{
			ObjectButton objButton;

			objButton = this.interfaceOBJ.getAssociatedObjectButton(DOWNPoint);
			this.removeThisInterfaceObjectFromGrid();
			if (this.ObjInArea != null) this.ObjInArea.removeInterfaceObjectFromSpline(this);
			
			if (objButton != null && objButton.OwnObject == this) this.state = State.Resizing; else this.state = State.Moving;

			if (this.state == State.Moving) 
			{
				this.RNTobj.RNTMouseDown(DOWNPoint);
				this.lastMousePoint = DOWNPoint;
				this.slideVector = new PointF(0.0f, 0.0f);
				this.slideValue = 0.0f;
			}
			else if (this.state == State.Resizing) this.RNTobj.RNTScaleDown(DOWNPoint);

			this.drawCircle = true;
			this.rntCalculation = false;
			this.fadeOutCircle = false;
			this.fadeOutCircleFilled = 0.4f;
			this.fadeOutCircleNoneFilled = 0.8f;
		}

		public void mouseMOVE(Point MOVEPoint, bool isSplineBelow, Spline belowSpline, int ap)
		{
			if (this.state == State.Moving)
			{
				this.slideVector = new PointF(MOVEPoint.X-this.lastMousePoint.X, MOVEPoint.Y-this.lastMousePoint.Y);
				this.lastMousePoint = MOVEPoint;

				this.storedAreaPart = ap;
				if (this.IObjectInsideSplineArea == true && isSplineBelow == false) resizeOBJtoOriginalSize(MOVEPoint);
				else if (isSplineBelow == false) this.moveInterfaceObject(MOVEPoint); 
				else this.moveNresizeInterfaceObject(MOVEPoint, belowSpline);
			}
			else if (this.state == State.Resizing)
			{
				this.resizeInterfaceObject(MOVEPoint);
			}

		}

		public void mouseUP(Point UPPoint)
		{
			if (this.state == State.Moving)
			{	
				this.slideValue = (float) Math.Sqrt((this.slideVector.X*this.slideVector.X) + (this.slideVector.Y*this.slideVector.Y));
				if (this.slideValue < 12.5f)
				{
					this.slideVector = new PointF(0.0f, 0.0f);
					this.slideValue = 0.0f;
				}
			}
			else if(this.state == State.Resizing)
			{
				this.slideVector = new PointF(0.0f, 0.0f);
				this.slideValue = 0.0f;
			}

			this.animateObjects.Add(this);
			this.rntCalculation = true;
			this.interfaceOBJ.addObjectShadow(this);
			this.fadeOutCircle = true;
		}



		/*******************************************************************/
		/*               some function for returning values                */
		/*******************************************************************/


		public ObjectButton getResizeButton()
		{
			return this.resizeButton;
		}

		public PointF getTopLeft()
		{
			return this.TopLeft;
		}

		public PointF getTopRight()
		{
			return this.TopRight;
		}

		public PointF getBottomLeft()
		{
			return this.BottomLeft;
		}

		public PointF getBottomRight()
		{
			return this.BottomRight;
		}


		public PointF getVectorHorizontal()
		{
			return this.vectorHORZONTAL;
		}

		public PointF getVectorVerticaly()
		{
			return this.vectorVERTICALY;
		}

		public int getStoredAreaPart()
		{
			return this.storedAreaPart;
		}

		public PointF getLastMousePoint()
		{
			return this.lastMousePoint;
		}
		
		public void setLastMousePoint(PointF lp)
		{
			this.lastMousePoint = lp;
		}		

		public void setStepsToChange(float scValue)
		{
			this.difScale = 0.015f+((float) Math.Abs(scValue-this.lastScaleValue))/this.zoomValue;
		}

		public float getLastScaleValue()
		{
			return this.lastScaleValue;
		}

		public bool hasToChange(float scalevalue)
		{
			if (!(scalevalue < this.lastScaleValue) && !(scalevalue > this.lastScaleValue)) return false; else return true;
		}

		public float getNextStep(float scalevalue)
		{ float backValue;
			
			backValue = this.lastScaleValue;
			if (scalevalue < this.lastScaleValue) 
			{
				backValue = this.lastScaleValue - this.difScale; 
				if (backValue < scalevalue) backValue = scalevalue;
			}
			else if (scalevalue > this.lastScaleValue) 
			{
				backValue = this.lastScaleValue + this.difScale; 
				if (backValue > scalevalue) backValue = scalevalue;
			}

			return backValue;
		}

		public IOSelectObject getIOSelectObject()
		{
			return this.ObjBelongToSEL;
		}
		public void setIOSelectObject(IOSelectObject IObjSEL)
		{
			this.ObjBelongToSEL = IObjSEL;
		}


		public void setStatusSelected(float red, float green, float blue)
		{
			for (int AColor=0; AColor < 10; AColor=AColor+2)
			{
				this.colorBorderArray[AColor,0] = red;
				this.colorBorderArray[AColor,1] = green;
				this.colorBorderArray[AColor,2] = blue;
				this.colorBorderArray[AColor,3] = 1.0f;

				this.colorBorderArray[AColor+1,0] = 0.0f;
				this.colorBorderArray[AColor+1,1] = 0.0f;
				this.colorBorderArray[AColor+1,2] = 0.0f;
				this.colorBorderArray[AColor+1,3] = 0.0f;
			}
			this.isSelected = true;
			this.drawCircle = false;
			this.createObjectList();
		}
		public void setStatusUnselected()
		{
			this.isSelected = false;
			for (int AColor=0; AColor < 10; AColor=AColor+2)
			{
				this.colorBorderArray[AColor,0] = 0.2f;
				this.colorBorderArray[AColor,1] = 0.4f;
				this.colorBorderArray[AColor,2] = 0.8f;
				this.colorBorderArray[AColor,3] = 1.0f;

				this.colorBorderArray[AColor+1,0] = 0.0f;
				this.colorBorderArray[AColor+1,1] = 0.0f;
				this.colorBorderArray[AColor+1,2] = 0.0f;
				this.colorBorderArray[AColor+1,3] = 0.0f;
			}
			this.createObjectList();
		}


		public int setNewCornerPoints(PointF setTopLeft, PointF setTopRight, PointF setBottomRight, PointF setBottomLeft, float plusAngle, float scaleValue, bool computeNormals)
		{
			this.RNTobj.setNewCornerPoints(setTopLeft, setTopRight, setBottomRight, setBottomLeft, plusAngle, computeNormals);	
			
			this.CentrePoint = RNTobj.Center;
			this.TopLeft = RNTobj.TopLeft;
			this.TopRight = RNTobj.TopRight;
			this.BottomRight = RNTobj.BottomRight;
			this.BottomLeft = RNTobj.BottomLeft;

			this.computeBorder();

			return 2;
		
		}

		public bool getCalculations()
		{
			return this.rntCalculation;
		}

		public float getScaleValue()
		{
			return this.lastScaleValue;
		}

		public void setCalculations(bool setC)
		{
			this.rntCalculation = setC;
			this.slideVector = new PointF(0.0f, 0.0f);
			this.slideValue = 0.0f;
		}


		public bool pointInObj(PointF ptn)
		{
			bool inside;

			inside = this.RNTobj.Contains(ptn);
			if (inside == false)
			{
				if (ptn.X >= (this.resizeButton.LastLocation.X-20) && ptn.X <= (this.resizeButton.LastLocation.X+20) && ptn.Y >= (this.resizeButton.LastLocation.Y-20) && ptn.Y <= (this.resizeButton.LastLocation.Y+20)) inside = true;
			}
			return inside;
		}


		public float getWidth()
		{
			return this.RNTobj.Width;
		}

		public float getHeight()
		{
			return this.RNTobj.Height;
		}


		/*******************************************************************/
		/*   -----------------------------------------------------------   */
		/*******************************************************************/

	}
} 




See more files for this project here

MASE: Agile Software Engineering

The MASE project investigates methods to support the coordination and executable acceptance testing of software projects. Keywords: Agile methods, distributed teams, Extreme Programming. See http://ebe.cpsc.ucalgary.ca/ebe for more information.

Project homepage: http://sourceforge.net/projects/mase
Programming language(s): Java,XML
License: other

  ControlPoint.cs
  CustomTreeNode.cs
  CustomTreeView.cs
  Dashboard.cs
  Dashboard.resx
  EStoryForm.cs
  EStoryForm.resx
  IOSelectObject.cs
  InterfaceGrid.cs
  InterfaceObject.cs
  List.cs
  ListNode.cs
  LogFile.cs
  MenuForm.cs
  MenuForm.resx
  MoveAbleSpline.cs
  NonMoveAbleSpline.cs
  ObjectButton.cs
  Old_MoveAbleSpline.cs
  PenCalibration.cs
  PenCalibration.resx
  RNTObject.cs
  Spline.cs
  StartupScreen.cs
  StartupScreen.resx
  StorageButton.cs
  Study_Project.cs
  Study_Project.resx
  TabletUI.cs
  TabletUI.resx
  Workspace.cs
  Workspace.resx
  testCalibration.cs
  testCalibration.resx