home *** CD-ROM | disk | FTP | other *** search
- /* Generated by Interface Builder */
-
- #import "TeXviewApp.h"
- #import <appkit/nextstd.h>
- #import "PageView.h"
- #import "ComScroll.h"
- #import <appkit/Listener.h>
-
- int myargc = 1 ;
- char *myargv[3] = { "TeXview", 0, 0 } ;
- extern PageView *myPageView ;
- Window *tvWindow ;
- extern FILE *dvifile ;
-
- @implementation TeXviewApp
-
- int we_are_alive ;
- void ipc_open_in(), ipc_shutdown(), ipc_msg_handler() ;
- extern void todpi() ;
-
- extern Boolean initialfile ;
- extern char realname[] ;
-
- void unhide() {
- if ([NXApp isHidden])
- [NXApp unhide:nil] ;
- }
-
- void add_fd(fd)
- int fd ;
- {
- DPSAddFD(fd, ipc_msg_handler, 0, NX_BASETHRESHOLD) ;
- }
-
- void delete_fd(fd)
- int fd ;
- {
- DPSRemoveFD(fd) ;
- }
-
- void more_main() ;
-
- - (BOOL)appAcceptsAnotherFile:sender
- {
- return YES;
- }
-
- - (int)appOpenFile:(const char *)filename type:(const char *)aType
- {
- if (!we_are_alive) {
- more_main(myargc, myargv) ;
- we_are_alive = 1 ;
- }
- [self unhide:self] ; // just in case
- return (!dviOpenFile((char *)filename)) ;
- }
-
- - appDidInit:(id)sender
- {
- const char *recserve[10] ;
- const char *sndserve[10] ;
-
- recserve[0] = 0 ;
- sndserve[0] = NXFilenamePboardType ;
- sndserve[1] = 0 ;
- if (! we_are_alive) {
- more_main(myargc, myargv) ;
- we_are_alive = 1 ;
- }
- [self setDelegate:myPageView] ;
- [[self appListener] setServicesDelegate:myPageView] ;
- [self registerServicesMenuSendTypes:sndserve andReturnTypes:recserve] ;
- NXUpdateDynamicServices() ;
- ipc_open_in() ;
- return self ;
- }
-
- - applicationDefined:(NXEvent *)theEvent;
- {
- todpi(theEvent->data.compound.misc.C) ;
- return self ;
- }
-
- - appWillTerminate:sender
- {
- while (wait3(0, WNOHANG, 0) > 0) ; /* allow zombies to go away */
- [[myPageView getConsole] killOff] ;
- [[myPageView getTeX] killOff] ;
- return self;
- }
-
- @end
-