home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula
/
nebula.bin
/
SourceCode
/
LispExample
/
LispListener.m
< prev
next >
Wrap
Text File
|
1993-06-25
|
2KB
|
70 lines
/*
** LispListener.m
** A Scrollable LispText.
** Lee Boynton, NeXT, Inc., 1989
*/
#import "Lisp.h"
#import "LispText.h"
#import "LispListener.h"
#import <appkit/Application.h>
#import <defaults/defaults.h>
#import <stdlib.h>
@implementation LispListener
+ newFrame:(NXRect *)theFrame
{
id scroll, text;
float ascender, descender, lineHeight;
id font;
NXSize maxSize;
const char *imageName = NXGetDefaultValue([NXApp appName],"LispImage");
char initialText[1024];
sprintf(initialText,"Waiting for %s to launch...",imageName);
maxSize.width = 1.0e30;
maxSize.height = 1.0e30;
font = [Text getDefaultFont];
text = [LispText newFrame:NULL text:initialText alignment:NX_LEFTALIGNED];
NXTextFontInfo(font, &ascender, &descender, &lineHeight);
[text sizeTo:0.:lineHeight];
[text moveTo:0.:0.];
[text setMaxSize:&maxSize];
[text setVertResizable:YES];
[text setOverstrikeDiacriticals:NO];
[text setAutoresizeSubviews:YES];
[text setAutosizing:NX_WIDTHSIZABLE];
scroll = [super newFrame:NULL];
[scroll setVertScrollerRequired:YES];
[scroll setDynamicScrolling:YES];
[scroll setDocView:text];
[scroll setBackgroundGray:NX_WHITE];
[scroll setAutoresizeSubviews:YES];
[scroll setAutosizing:NX_WIDTHSIZABLE|NX_HEIGHTSIZABLE];
[scroll setBorderType:NX_NOBORDER];
[[text superview] setAutoresizeSubviews:YES];
[scroll moveTo:NX_X(theFrame):NX_Y(theFrame)];
[scroll sizeTo:NX_WIDTH(theFrame):NX_HEIGHT(theFrame)];
self = scroll;
theText = text;
[theText setDelegate:self];
return scroll;
}
- evaluate:(const char *)theString;
{
[theText inputLisp:theString];
return self;
}
@end