
/* Generated by Interface Builder */

#import <appkit/Form.h>
#import "Converter.h"

extern double sqrt(double);

@implementation Converter

- init
{
   [super init];
   calcType = TEMP;
   return self;
 }
 
- closeInfo:sender
/* This method closes the Info panel and opens and displays the MoreInfo panel */
{
      [Info performClose:sender]; /* This closes the Info panel */
      [MoreInfo orderFront:sender]; /* This displays the MoreInfo panel */
      return self; /* End of closeInfo method */
 }

- calcInterpol:sender
/* This method calculates the interpolation in the panel */
{
      float OutputValue;
      float valueA;
      float valueB;
      float valueC;
      float valueD;
      float valueF;
     
     valueA = [formA floatValue];
     valueB = [formB floatValue];
     valueC = [formC floatValue];
     valueD = [formD floatValue];
     valueF = [formF floatValue];
     
      
     OutputValue = valueD+((valueF-valueD)*(valueB-valueA)/(valueC-valueA));      
     /* The formula above is OutputValue = D+((F-D)*(B-A)/(C-A))  */
  
      [formE setFloatValue:OutputValue];
      [formE display];
      return self; /* End of closeInfo method */
 }
 
 
 
 /* The Calculation occur here */
- calculate:sender
{
    [inputForm selectTextAt:0];

/*  TEMPERATURE */

/* Celsius to Fahrenheit */
    if (calcType == TEMP)  {
        float OutputValue;
	OutputValue = (([inputForm floatValue]*1.8)+32.0);
	[outputForm setFloatValue:OutputValue at:0];
	}

/* Fahrenheit to Celsius */
if (calcType == CELSIUS)
       {
        float OutputValue;
	OutputValue= (([inputForm floatValueAt:0]-32)/1.8);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

/* Celsius to Kelvin */
if (calcType == KELVIN)
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]+273);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

/* Kelvin to Celsius */
if (calcType == KELVINCELSIUS)
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]-273);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

/* LENGTH */

   if (calcType == CENTI)
       {
        float OutputValue;
	OutputValue= (2.54*[inputForm floatValueAt:0]);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

 if (calcType == INCH)
       {
        float OutputValue;
	OutputValue= (0.3937*[inputForm floatValueAt:0]);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

 if (calcType == METER)
       {
        float OutputValue;
	OutputValue= (0.3048*[inputForm floatValueAt:0]);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

 if (calcType == FOOT)
       {
        float OutputValue;
	OutputValue= (3.2808*[inputForm floatValueAt:0]);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

/* yard to meter */
if (calcType == YARDM)
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.9144);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

/* meter to yard */
if (calcType == METERYARD)
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*1.0936);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

 if (calcType == KILOMETER)
       {
        float OutputValue;
	OutputValue= (1.6093*[inputForm floatValueAt:0]);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

 if (calcType == MILE)
       {
        float OutputValue;
	OutputValue= (0.6214*[inputForm floatValueAt:0]);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == NAUTICAL)
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*1.852);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

/* Kilometer to Nautical miles */
if (calcType == KILOMNAUTICAL)
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.54);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}


/* AREA */

if (calcType == SCENTI)
       {
        float OutputValue;
	OutputValue= (6.4516*[inputForm floatValueAt:0]);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == SINCH)
       {
        float OutputValue;
	OutputValue= (0.155*[inputForm floatValueAt:0]);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == ACRESFOOT) /* Acre to Square Foot */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*43560);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == SFOOTACRE)
       {
        float OutputValue;
	OutputValue= (([inputForm floatValueAt:0]*2.29)*0.00001);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}


if (calcType == SMETER)
       {
        float OutputValue;
	OutputValue= (0.0929*[inputForm floatValueAt:0]);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == SFOOT)
       {
        float OutputValue;
	OutputValue= (10.7639*[inputForm floatValueAt:0]);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

/* Square Yard to Square Meter */
if (calcType == SYARDSMETER)
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*1.196);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

/* Square Meter to Square Yard */
if (calcType == SMETERSYARD)
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.836);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

/* Square Mile to Square Kilometer */
if (calcType == SMILESKILO)
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*2.59);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

/* Square Kilometer to Square Mile */
if (calcType == SKILOSMILE)
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.386);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == HECTARE)
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*4.0469);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == ACRE)
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*2.47106);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

/* Square Mile to Acre */
if (calcType == SMILEACRE)
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*640);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

/* Acre to Square Mile */
if (calcType == ACRESMILE)
       {
        float OutputValue;
	OutputValue= (([inputForm floatValueAt:0]*1.56)*0.001);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}



/* VOLUME (cubic) */

if (calcType == CINCHCMILL)  /* From Cubic Inch to Cubic Millimeter */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*16400);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == CMILLCINCH)  /* From Cubic Millimeter to Cubic Inch */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*6.1*0.00001);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == CINCHCCENTI)  /* From Cubic Inch to Cubic Centimeter */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*16.387);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == CCENTICINCH)  /* From Cubic Centimeter to Cubic Inch */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.061);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

 if (calcType == CFOOTCMETER)   /* From Cubic Foot to Cubic Meter */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.0283);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}
 
if (calcType == CYARDCMETER)   /* From Cubic Yard to Cubic Meter */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.7645);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == CMETERCYARD)   /* From Cubic Meter to Cubic Yard */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*1.308);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}
	
/* Volume (liquid)  */

if (calcType == FOUNCECMILL)   /* From Fluid Ounce to Cubic Millimeter */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*29600);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == FOUNCEMILLILITRES )   /* From Fluid Ounce to  Millilitres */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*28.413);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}



if (calcType == TEACMILL)   /* From Teaspoon to Cubic Millimeter*/
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*4930);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == TABLECMILL)   /* From Tablespoon to Cubic Millimeter */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*14800);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == CUPCMETER)   /* From Cup to Cubic Meter */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.000237);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == PINTCMETER)   /* From Pint to Cubic Meter */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.000473);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == PINTLITRE)   /* From Pint to Litre */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.5682);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == QUARTLITRE)   /* From Quarts to Litre */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*1.1365);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}


if (calcType == QUARTCMETER)   /* From Quart to Cubic Meter */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.000946);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == USQUARTLITRE)   /* From US Quart to Litre */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.946);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}
	
if (calcType == LITREUSQUART)   /* From Litre to US Quart */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*1.057);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == GALLONCMETER)   /* From Gallon to Cubic Meter */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.00379);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == GALLONLITER)   /* From US Gallon to Liter */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*3.7854);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}
	
if (calcType == LITERGALLON)   /* From Liter to US Gallon */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.264);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

/* MASS */

if (calcType == OUNCEGRAM)   /* From Ounce to Gram */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*28.35);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == GRAMOUNCE)   /* From Gram to Ounce */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.0353);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == POUNDGRAM)   /* From Pound to Gram */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*453);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == POUNDKILOGRAM)   /* From Pound to Kilogram */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.453);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == KILOGRAMPOUND)   /* From kilogram to Pound */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*2.2046);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == GRAMPOUND)   /* From Gram to Pound */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.0022046);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == MTONPOUND)   /* From Metric Ton to Pound */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*2204.6);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == POUNDMTON)   /* From Pound to Metric Ton */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.000453);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

/* FLOW */
 
 if (calcType == LITRESPSUSGPM)   /* From Litres per second to US Gallons per minute */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*15.850);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == USGPMLITRESPS)   /* From US Gallons per minute to Litres per second */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.06309);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == LITRESPSCFEETPM)   /* From Litres per second to Cubic Feet per minute */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*2.1189);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == CFEETPMLITRESPS)   /* From Cubic feet per minute to Litres per second */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.47195);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

/* PRESSURE */

if (calcType == FEETWKPASCAL)   /* From Feet of Water to Kilopascal */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*2.9861);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == KPASCALFEETW)   /* From Kilopascal to Feet of Water */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.33488);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == POUNDSSIKPASCAL)   /* From Pound per Square Inch to  Kilopascal */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*6.8948);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == KPASCALPOUNDSSI)   /* From Kilopascal  to Pound per Square Inch*/
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.145);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}



/* OTHER */

if (calcType == HPWATTS)   /* From Horsepower to Watts */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*745.7);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == WATTSHP)   /* From Watts to Horsepower */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.0013);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}
	
if (calcType == BTUKILO)   /* From British Thermal Unit to Kilojoules*/
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*1.055);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == BTUWATTS)   /* From British Thermal Unit to Watts*/
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.29307);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

	
if (calcType == KNOTSMPS)   /* From Knots to Meters per second */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*0.514444);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}

if (calcType == REFTONBTUH)   /* From Refrigeration ton to BTU per hour */
       {
        float OutputValue;
	OutputValue= ([inputForm floatValueAt:0]*12000);
	[outputForm setFloatValue:(float)OutputValue at:0];
	}
	return self;

     
}
/* ************************************** */
/* This is to label the Input and Output fields */
/* ************************************** */

/* TEMPERATURE */

/* Celsius to Fahrenheit */
- convertToTemp:sender
{
     calcType = TEMP;
     [inputForm setTitle:"Celsius:" at:0];
     [outputForm setTitle:"Fahrenheit:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
 }

/* Fahrenheit to Celsuis */
- convertToCelsius:sender
{
     calcType = CELSIUS;
     [inputForm setTitle:"Fahrenheit:" at:0];
     [outputForm setTitle:"Celsius:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
 }


/* Celsius to Kelvin */
- convertToKelvin:sender
 {
     calcType = KELVIN;
     [inputForm setTitle:"Celsius:" at:0];
     [outputForm setTitle:"Kelvin:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

/* Kelvin to Celsius */
- KelvinToCelsius:sender
 {
     calcType = KELVINCELSIUS;
     [inputForm setTitle:"Kelvin:" at:0];
     [outputForm setTitle:"Celsius:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }



/* LENGTH */

- convertToCenti:sender
 {
     calcType = CENTI;
     [inputForm setTitle:"inches:" at:0];
     [outputForm setTitle:"centimeters:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToInch:sender
 {
     calcType = INCH;
     [inputForm setTitle:"centimeters:" at:0];
     [outputForm setTitle:"inches:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToMeter:sender
 {
     calcType = METER;
     [inputForm setTitle:"foot:" at:0];
     [outputForm setTitle:"meter:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }


- convertToFoot:sender
 {
     calcType = FOOT;
     [inputForm setTitle:"meter:" at:0];
     [outputForm setTitle:"foot:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToYardm:sender
 {
     calcType = YARDM;
     [inputForm setTitle:"yard:" at:0];
     [outputForm setTitle:"meter:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- MeterToYard:sender
 {
     calcType = METERYARD;
     [inputForm setTitle:"meter:" at:0];
     [outputForm setTitle:"yard:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }


- convertToKilometer:sender
 {
     calcType = KILOMETER;
     [inputForm setTitle:"mile:" at:0];
     [outputForm setTitle:"kilometer:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }


- convertToMile:sender
 {
     calcType = MILE;
     [inputForm setTitle:"kilometer:" at:0];
     [outputForm setTitle:"mile:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToNautical:sender
 {
     calcType = NAUTICAL;
     [inputForm setTitle:"nautical mile:" at:0];
     [outputForm setTitle:"kilometer:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- KilomToNautical:sender
 {
     calcType = KILOMNAUTICAL;
     [inputForm setTitle:"kilometer:" at:0];
     [outputForm setTitle:"nautical mile:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

/* AREA */

- convertToSCenti:sender
 {
     calcType = SCENTI;
     [inputForm setTitle:"square inch:" at:0];
     [outputForm setTitle:"square centimeter:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToSInch:sender
 {
     calcType = SINCH;
     [inputForm setTitle:"square centimeter:" at:0];
     [outputForm setTitle:"square inch:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- AcreToSFoot:sender
 {
     calcType = ACRESFOOT;
     [inputForm setTitle:"acre:" at:0];
     [outputForm setTitle:"square foot:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- SFootToAcre:sender
 {
     calcType = SFOOTACRE;
     [inputForm setTitle:"square foot:" at:0];
     [outputForm setTitle:"acre:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToSMeter:sender
 {
     calcType = SMETER;
     [inputForm setTitle:"square foot:" at:0];
     [outputForm setTitle:"square meter:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToSFoot:sender
 {
     calcType = SFOOT;
     [inputForm setTitle:"square meter:" at:0];
     [outputForm setTitle:"square foot:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToSYardSMeter:sender
 {
     calcType = SYARDSMETER;
     [inputForm setTitle:"square yard:" at:0];
     [outputForm setTitle:"square meter:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- SMeterToSYard:sender
 {
     calcType = SMETERSYARD;
     [inputForm setTitle:"square meter:" at:0];
     [outputForm setTitle:"square yard:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToSMileSKilo:sender
 {
     calcType = SMILESKILO;
     [inputForm setTitle:"square mile:" at:0];
     [outputForm setTitle:"square kilometer:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- SKiloToSMile:sender
 {
     calcType = SKILOSMILE;
     [inputForm setTitle:"square kilometer:" at:0];
     [outputForm setTitle:"square mile:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToHectare:sender
 {
     calcType = HECTARE;
     [inputForm setTitle:"acre:" at:0];
     [outputForm setTitle:"hectare:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToAcre:sender
 {
     calcType = ACRE;
     [inputForm setTitle:"hectare:" at:0];
     [outputForm setTitle:"acre:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- SMileToAcre:sender
 {
     calcType = SMILEACRE;
     [inputForm setTitle:"square mile:" at:0];
     [outputForm setTitle:"acre:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- AcreToSMile:sender
 {
     calcType = ACRESMILE;
     [inputForm setTitle:"acre:" at:0];
     [outputForm setTitle:"square mile:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

/* VOLUME (cubic)*/

/* Cubic Inch to Cubic Millimeter */
- convertToCInchCMill:sender
 {
     calcType = CINCHCMILL;
     [inputForm setTitle:"cubic inch:" at:0];
     [outputForm setTitle:"cubic millimeter:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

/* Cubic Millimeter to Cubic Inch */
- CMillToCInch:sender
 {
     calcType = CMILLCINCH;
     [inputForm setTitle:"cubic millimeter:" at:0];
     [outputForm setTitle:"cubic inch:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

/* Cubic Inch to Cubic Centimeter */
- CInchToCCenti:sender
 {
     calcType = CINCHCCENTI;
     [inputForm setTitle:"cubic inch:" at:0];
     [outputForm setTitle:"cubic centimeter:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

/* Cubic Centimeter to Cubic Inch */
- CCentiToCInch:sender
 {
     calcType = CCENTICINCH;
     [inputForm setTitle:"cubic centimeter:" at:0];
     [outputForm setTitle:"cubic inch:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }


- convertToCFootCMeter:sender
 {
     calcType = CFOOTCMETER;
     [inputForm setTitle:"cubic foot:" at:0];
     [outputForm setTitle:"cubic meter:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

/*  Cubic Yard to Cubic Meter */
- convertToCYardCMeter:sender
 {
     calcType = CYARDCMETER;
     [inputForm setTitle:"cubic yard:" at:0];
     [outputForm setTitle:"cubic meter:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

/*  Cubic Meter to Cubic Yard */
- CMeterToCYard:sender
 {
     calcType = CMETERCYARD;
     [inputForm setTitle:"cubic meter:" at:0];
     [outputForm setTitle:"cubic yard:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }


/* Volume (liquid)  */

- convertToFOunceCMill:sender
 {
     calcType = FOUNCECMILL;
     [inputForm setTitle:"fluid ounce:" at:0];
     [outputForm setTitle:"cubic millimeter:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- FOunceToMillilitres:sender
 {
     calcType = FOUNCEMILLILITRES;
     [inputForm setTitle:"fluid ounce:" at:0];
     [outputForm setTitle:"milliltres:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }


- convertToTeaCMill:sender
 {
     calcType = TEACMILL;
     [inputForm setTitle:"teaspoon:" at:0];
     [outputForm setTitle:"cubic millimeter:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToTableCMill:sender
 {
     calcType = TABLECMILL;
     [inputForm setTitle:"tablespoon:" at:0];
     [outputForm setTitle:"cubic millimeter:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToCupCMeter:sender
 {
     calcType = CUPCMETER;
     [inputForm setTitle:"cup:" at:0];
     [outputForm setTitle:"cubic millimeter:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToPintCMeter:sender
 {
     calcType = PINTCMETER;
     [inputForm setTitle:"pint:" at:0];
     [outputForm setTitle:"cubic meter:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- PintToLitre:sender
 {
     calcType = PINTLITRE;
     [inputForm setTitle:"pint:" at:0];
     [outputForm setTitle:"litre:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- QuartToLitre:sender
 {
     calcType = QUARTLITRE;
     [inputForm setTitle:"quart:" at:0];
     [outputForm setTitle:"litre:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToQuartCMeter:sender
 {
     calcType = QUARTCMETER;
     [inputForm setTitle:"quart:" at:0];
     [outputForm setTitle:"cubic meter:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- USQuartToLitre:sender
 {
     calcType = USQUARTLITRE;
     [inputForm setTitle:"US quart:" at:0];
     [outputForm setTitle:"litre:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- LitreToUSQuart:sender
 {
     calcType = LITREUSQUART;
     [inputForm setTitle:"litre:" at:0];
     [outputForm setTitle:"US quart:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToGallonCMeter:sender
 {
     calcType = GALLONCMETER;
     [inputForm setTitle:"gallon:" at:0];
     [outputForm setTitle:"cubic meter:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToGallonLiter:sender
 {
     calcType = GALLONLITER;
     [inputForm setTitle:"US gallon:" at:0];
     [outputForm setTitle:"litre:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToLiterGallon:sender
 {
     calcType = LITERGALLON;
     [inputForm setTitle:"litre:" at:0];
     [outputForm setTitle:"US gallon:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

/* MASS */

- convertToOunceGram:sender
 {
     calcType = OUNCEGRAM;
     [inputForm setTitle:"ounce:" at:0];
     [outputForm setTitle:"gram:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToGramOunce:sender
 {
     calcType = GRAMOUNCE;
     [inputForm setTitle:"gram:" at:0];
     [outputForm setTitle:"ounce:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToPoundGram:sender
 {
     calcType = POUNDGRAM;
     [inputForm setTitle:"pound:" at:0];
     [outputForm setTitle:"gram:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToPoundKilogram:sender
 {
     calcType = POUNDKILOGRAM;
     [inputForm setTitle:"pound:" at:0];
     [outputForm setTitle:"kilogram:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToKilogramPound:sender
 {
     calcType = KILOGRAMPOUND;
     [inputForm setTitle:"kilogram:" at:0];
     [outputForm setTitle:"pound:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToGramPound:sender
 {
     calcType = GRAMPOUND;
     [inputForm setTitle:"gram:" at:0];
     [outputForm setTitle:"pound:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToMTonPound:sender
 {
     calcType = MTONPOUND;
     [inputForm setTitle:"metric ton:" at:0];
     [outputForm setTitle:"pound:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToPoundMTon:sender
 {
     calcType = POUNDMTON;
     [inputForm setTitle:"pound:" at:0];
     [outputForm setTitle:"metric ton:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

/* FLOW */
- LitresPStoUSGPM:sender
 {
     calcType = LITRESPSUSGPM;
     [inputForm setTitle:"litres per second:" at:0];
     [outputForm setTitle:"US gallons per minute:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- USGPMToLitresPS:sender
 {
     calcType = USGPMLITRESPS;
     [inputForm setTitle:"US gallons per minute:" at:0];
     [outputForm setTitle:"litres per second:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- LitresPSToCFeetPM:sender
 {
     calcType = LITRESPSCFEETPM;
     [inputForm setTitle:"litres per second:" at:0];
     [outputForm setTitle:"cubic feet per minute:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- CFeetPMToLitresPS:sender
 {
     calcType = CFEETPMLITRESPS;
     [inputForm setTitle:"cubic feet per minute:" at:0];
     [outputForm setTitle:"litres per second:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

/* PRESSURE */

- FeetWToKPascal:sender
 {
     calcType = FEETWKPASCAL;
     [inputForm setTitle:"feet of water:" at:0];
     [outputForm setTitle:"kilopascal:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- KPascalToFeetW:sender
 {
     calcType = KPASCALFEETW;
     [inputForm setTitle:"kilopascal:" at:0];
     [outputForm setTitle:"feet of water:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- PoundsSIToKPascal:sender
 {
     calcType = POUNDSSIKPASCAL;
     [inputForm setTitle:"pounds per square inch:" at:0];
     [outputForm setTitle:"kilopascal:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- KPascalToPoundsSI:sender
 {
     calcType = KPASCALPOUNDSSI;
     [inputForm setTitle:"kilopascal:" at:0];
     [outputForm setTitle:"pounds per square inch:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }



/* OTHER */

- convertToHpWatts:sender
 {
     calcType = HPWATTS;
     [inputForm setTitle:"horsepower:" at:0];
     [outputForm setTitle:"Watts:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- WattsToHp:sender
 {
     calcType = WATTSHP;
     [inputForm setTitle:"Watts:" at:0];
     [outputForm setTitle:"horsepower:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToBtuKilo:sender
 {
     calcType = BTUKILO;
     [inputForm setTitle:"btu:" at:0];
     [outputForm setTitle:"kilojoules:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- BTUToWatts:sender
 {
     calcType = BTUWATTS;
     [inputForm setTitle:"btu per hour:" at:0];
     [outputForm setTitle:"Watts:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- convertToKnotsMps:sender
 {
     calcType = KNOTSMPS;
     [inputForm setTitle:"knots:" at:0];
     [outputForm setTitle:"meters per second:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

- RefTonToBTUH:sender
 {
     calcType = REFTONBTUH;
     [inputForm setTitle:"refrigeration ton:" at:0];
     [outputForm setTitle:"b.t.u. per hour:" at:0];
     [outputForm setStringValue:"" at:0];
     [inputForm display];
     [outputForm display];
     [inputForm selectTextAt:0];
     return self;
  }

@end
