home *** CD-ROM | disk | FTP | other *** search
- #import "Controller.h"
-
- @implementation Controller
-
- /* $Log: Controller.m,v $
- Revision 1.4 94/05/29 20:14:32 ediger
- help/explanation panel support
-
- Revision 1.3 94/05/29 14:59:51 ediger
- cleanup to eliminate compiler warning
-
- Revision 1.2 94/02/03 19:54:34 ediger
- cleanup of commented out code
-
- Revision 1.1 93/12/19 13:02:54 ediger
- Initial revision
-
- */
-
- static char rcsident[] = "$Id: Controller.m,v 1.4 94/05/29 20:14:32 ediger Exp Locker: ediger $";
-
- static BOOL
- fGetOpenPath(char *pcName, int iBufferLength, char *pcType)
- {
- BOOL fSuccess = NO;
- static char *ppcFileTypes[2] = {NULL, NULL};
- static id openPanel = Nil;
-
- assert(pcName != NULL);
-
- if (openPanel == Nil)
- openPanel = [OpenPanel new];
-
- assert(openPanel != Nil);
-
- if (pcType != NULL && *pcType != '\0')
- ppcFileTypes[0] = pcType;
-
- [NXApp setAutoupdate:NO];
-
- if ([openPanel runModalForTypes:ppcFileTypes])
- { const char *pcNameTmp = [openPanel filename];
- strncpy(pcName, pcNameTmp, iBufferLength);
- fSuccess = YES;
- }
-
- [NXApp setAutoupdate:YES];
-
- return fSuccess;
- }
-
-
- - init
- {
- infoPanel = Nil;
- return self;
- }
-
- - closeFile:sender
- {
- id oCurrentMainWindow;
-
- oCurrentMainWindow = [NXApp mainWindow];
- [oCurrentMainWindow close];
- [oCurrentMainWindow free];
-
- return self;
- }
-
- - openNewFile:sender
- {
- char pcPath[1024];
-
- if (fGetOpenPath(pcPath, 1024, NULL))
- { id p = [[Document alloc] init];
- [p openFileNamed:pcPath];
- [p show:self];
- }
-
- return self;
- }
-
- - showInfoPanel:sender
- {
- if (infoPanel == nil)
- if (![NXApp loadNibSection:"Info.nib" owner:self])
- return nil;
-
- [infoPanel makeKeyAndOrderFront:self];
- return self;
- }
-
- - showHelpPanel:sender
- {
- if (helpPanel == nil)
- if (![NXApp loadNibSection:"HelpPanel.nib" owner:self])
- return nil;
-
- [helpPanel makeKeyAndOrderFront:self];
- return self;
- }
-
-
- @end
-