// FILE:      BrailleConverter.m
// AUTHOR:    Daniel Lee
// PURPOSE:   
// REFERENCE: None. 
// COMMENTS:  
// REQUIRES: BrailleConverter.h 
// Last Mod:  06-04-2006




#import "BrailleConverter.h"

@implementation BrailleConverter


// NAME: awakefromNIB
// PURPOSE: To initilise the view for use
// IMPORTS: nil
// EXPORTS: nil
// AUTHOR: Daniel Lee
// REMARKS: 
// LAST MODIFIED: 06-04-2006

- (void) awakefromNIB
{
    // Set the boxes to set the delegate to this object
    [inputTextView setDelegate: self];
	[asciiTextView setDelegate: self];

	// asciiTextView does not needs a delegate since only braille is being sent there
	// There is no input that is allowed to be placed in that box

	NSFont* braille = [NSFont fontWithName: @"Braille" size: 16];
	[asciiTextView setFont: braille];
    [brailleTextView setFont: braille];
	// Set the font of the asciiTextView to braille, size 16

}


// NAME: textDidChange
// PURPOSE: A delegate function to do the translation when the text is edited
// IMPORTS: NSNotification
// EXPORTS: nil
// AUTHOR: Daniel Lee
// REMARKS: 
// LAST MODIFIED: 06-04-2006

- (void) textDidChange: (NSNotification *) aNotification
{

    NSString *tempOutput, *tempInput;
	id *input, *output;
	BOOL tempTranslateToBraille = [configObject translateToBraile];

    // Set the input and output variables to the respective ones which are to be used
	// This is done because the code is very similar on a lot of places and that the
	// program should be a s compact as possible.

    if( tempTranslateToBraille )
	{
        input = &brailleTextView;
        output = &inputTextView;
	}
	else
	{
        input = &inputTextView;
        output = &brailleTextView;
	}
	
	// Essentially both should grab the text that was changed from the input
    // Convert the text into a C string and pass it through shannons's code
	// Find the same range from the output box as the changed box and overwrite
	// the text

	// make sure text is pasted to the ascii view
}


// NAME: 
// PURPOSE: 
// IMPORTS: 
// EXPORTS: 
// AUTHOR: 
// REMARKS: 
// LAST MODIFIED: 


@end
