#import "AppDelegate.h"
#import "Text.HTMLExtensions.h"


@implementation AppDelegate

- appWillTerminate:sender
{
	return self;
}

- setTitle:(const char *) aTitle
{	[window setTitle:aTitle];
	return self;
}

#if 0
-(BOOL) respondsTo:(SEL)theSel
{	if(sel_getName(theSel)) puts(sel_getName(theSel));
	return [super respondsTo:theSel];
}
#endif

- showHTML
{	MiscString *loadStr=[[MiscString alloc] init];
	[loadStr loadFromFile:[NXApp defaultValue:"TestFile"]];
	[text setDelegate:self];
	[window disableDisplay];
	[text setFromHTML:[loadStr stringValueAndFree]];
	[text setEditable:NO];
	[text setSel:0:0];[text makeSelectionVisible];
	[[window reenableDisplay] display];

	return self;
}
- showFile:(const char *) file atMarker:(const char *) markerName openInNewWin:(BOOL) flag
{	if(strcmp("///SameFile///", file))
	{	MiscString *loadStr=[[MiscString alloc] init];
		if([loadStr loadFromFile:file])
			[text setFromHTML:[loadStr stringValueAndFree]];
		else NXBeep();
	} if(markerName && strlen(markerName))
	{	[text findMarker:markerName];
		[text makeSelectionVisible];
	} return self;
}

- appDidInit:sender
{	[self showHTML];
	return self;
}

- showHTML:sender
{	[self showHTML];
	return self;
}

@end