/*
	File:		Interface.h

	Contains:	Definitions for Interface.c

	Written by:	Ryan Robertson

	Copyright:	© 1996 by Apple Computer, Inc.  All rights reserved.

*/

#ifndef __INTERFACE_H
#define __INTERFACE_H

#include <StandardFile.h>

//------------------------------------------------------------------------
// TEXT FILE DEFINITIONS
//------------------------------------------------------------------------

#define kFileCreator			'ttxt'
#define kFileType				'TEXT'

//------------------------------------------------------------------------
// MENU DEFINITIONS
//------------------------------------------------------------------------

#define kMBarID					128

#define kAppleMenu				128
#define kAboutItem				1

#define kFileMenu				129
#define	kQuitItem				1

#define kEditMenu				130
#define kUndoItem				1
#define	kCutItem				3
#define	kPasteItem				4
#define	kClearItem				5

#define kConnectMenu			131
#define kConnectItem			1
#define	kFirstPortItem			3


//------------------------------------------------------------------------
// DIALOG DEFINITIONS
//------------------------------------------------------------------------

#define kAboutDialog			201
#define kInfoDialog				203

//------------------------------------------------------------------------
// STRING DEFINITIONS
//------------------------------------------------------------------------

#define kMenuInitErrorString		"\pThere was an error initializing the menus."
#define kCDILInitErrorString		"\pThere was an error initializing the CDIL library."
#define kInitPipeErrorString		"\pThere was an error initializing the pipe."
#define kConnectErrorString			"\pThere was an error waiting for the connection.  Check your cables and try again."
#define kAcceptFailedString			"\pThe connection was not accepted."

#define kWrongAppString				"\pThe wrong application is trying to connect."
#define kBufferReadErrorString 		"\pThere was a problem receiving data.  The connection has been closed."
#define kBufferWriteErrorString		"\pThere was a problem sending data.  The connection has been closed."
#define kNewtonCancelledString		"\pThe Newton has cancelled the transaction.  The connection has been closed."
#define kFileWriteErrorString		"\pThere was a problem writing to the file.  The connection has been closed."
#define kNoMemoryString				"\pThere was a problem allocating the buffer.  The connection has been closed."
#define kDownloadWasSuccessful		"\pThe export was successful."

//------------------------------------------------------------------------
// ERROR DEFINITIONS
//------------------------------------------------------------------------

#define kError_PortError		128
#define kError_InitFailed		129
#define kOpenFileCancelled		130
	
//------------------------------------------------------------------------
// INTERFACE PROTOTYPES
//------------------------------------------------------------------------

void 			SetupPortMenu( void );
void			ConductErrorDialog( StringPtr errorString );
OSErr			InitializeMyMenus( void );
void			AdjustMenus( void );
OSErr			DoInitialize( void );
CommErr 		InitializePipe( void );
OSErr 			CreateNOpenFile( char* fileName, StandardFileReply* fileReplyPtr, short* fileRefPtr );
OSErr			WriteToFile( short fileRef, long* lengthPtr, char* buffer );
OSErr 			UpdateNCloseFile( short fileRef, StandardFileReply* fileReplyPtr );
OSErr			DoTerminate( void );
void 			DoEventLoop( void );
OSErr			DoMenuItem( long val );

#endif
