home *** CD-ROM | disk | FTP | other *** search
-
- /* Generated by Interface Builder */
-
- #import "Document.h"
-
- @implementation Document
-
- +new
- {
- self = [super new];
- [NXApp setDelegate:self];
- openReq = [OpenPanel new];
- return self;
- }
-
- - setDocument:anObject
- {
- document = anObject;
- return self;
- }
-
- - showError: (char *)errorMessage
- {
- NXAlert(errorMessage, "OK", NULL, NULL);
- }
-
- - openRequest:sender
- {
- const char *fileName;
- const char *const types[3] = {"m", "h", NULL};
- NXStream *stream;
-
- if ([openReq runModalForTypes: types] && (fileName = [openReq filename])) {
- if (stream = NXMapFile(fileName, NX_READONLY)) {
- [self showError:"Could not open file"];
- return;
- }
- [[document docView] readText:stream];
- [[document window] setTitle: fileName];
- [document display];
- } else {
- [self showError: "Unable to open file"];
- }
- return self;
- }
-
-
- @end
-