home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3.4.17 [SPARC, PA-RISC] / nextstep33_risc.iso / NextLibrary / TeX / tex / src / texview / TeXviewApp.m < prev    next >
Encoding:
Text File  |  1993-01-27  |  1.8 KB  |  93 lines

  1. /* Generated by Interface Builder */
  2.  
  3. #import "TeXviewApp.h"
  4. #import <appkit/nextstd.h>
  5. #import "PageView.h"
  6. #import "ComScroll.h"
  7. #import <appkit/Listener.h>
  8.  
  9. int myargc = 1 ;
  10. char *myargv[3] = { "TeXview", 0, 0 } ;
  11. extern PageView *myPageView ;
  12. Window *tvWindow ;
  13. extern FILE *dvifile ;
  14.  
  15. @implementation TeXviewApp
  16.  
  17. int we_are_alive ;
  18. void ipc_open_in(), ipc_shutdown(), ipc_msg_handler() ;
  19. extern void todpi() ;
  20.  
  21. extern Boolean initialfile ;
  22. extern char realname[] ;
  23.  
  24. void unhide() {
  25.    if ([NXApp isHidden])
  26.       [NXApp unhide:nil] ;
  27. }
  28.  
  29. void add_fd(fd)
  30. int fd ;
  31. {
  32.    DPSAddFD(fd, ipc_msg_handler, 0, NX_BASETHRESHOLD) ;
  33. }
  34.  
  35. void delete_fd(fd)
  36. int fd ;
  37. {
  38.    DPSRemoveFD(fd) ;
  39. }
  40.  
  41. void more_main() ;
  42.  
  43. - (BOOL)appAcceptsAnotherFile:sender
  44. {
  45.     return YES;
  46. }
  47.  
  48. - (int)appOpenFile:(const char *)filename type:(const char *)aType
  49. {
  50.    if (!we_are_alive) {
  51.       more_main(myargc, myargv) ;
  52.       we_are_alive = 1 ;
  53.     }
  54.     [self unhide:self] ; // just in case
  55.     return (!dviOpenFile((char *)filename)) ;
  56. }
  57.  
  58. - appDidInit:(id)sender
  59. {
  60.    const char *recserve[10] ;
  61.    const char *sndserve[10] ;
  62.  
  63.    recserve[0] = 0 ;
  64.    sndserve[0] = NXFilenamePboardType ;
  65.    sndserve[1] = 0 ;
  66.    if (! we_are_alive) {
  67.       more_main(myargc, myargv) ;
  68.       we_are_alive = 1 ;
  69.    }
  70.    [self setDelegate:myPageView] ;
  71.    [[self appListener] setServicesDelegate:myPageView] ;
  72.    [self registerServicesMenuSendTypes:sndserve andReturnTypes:recserve] ;
  73.    NXUpdateDynamicServices() ;
  74.    ipc_open_in() ;
  75.    return self ;
  76. }
  77.  
  78. - applicationDefined:(NXEvent *)theEvent;
  79. {
  80.    todpi(theEvent->data.compound.misc.C) ;
  81.    return self ;
  82. }
  83.  
  84. - appWillTerminate:sender
  85. {
  86.    while (wait3(0, WNOHANG, 0) > 0) ; /* allow zombies to go away */
  87.    [[myPageView getConsole] killOff] ;
  88.    [[myPageView getTeX] killOff] ;
  89.    return self;
  90. }
  91.  
  92. @end
  93.