home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.mdf / Apps / DevTools / MachOViewer / Source / RCS / Controller.m,v < prev    next >
Encoding:
Text File  |  1994-05-29  |  2.9 KB  |  194 lines

  1. head     1.4;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ediger:1.4;
  6. comment  @@;
  7.  
  8.  
  9. 1.4
  10. date     94.05.29.20.14.32;  author ediger;  state Exp;
  11. branches ;
  12. next     1.3;
  13.  
  14. 1.3
  15. date     94.05.29.14.59.51;  author ediger;  state Exp;
  16. branches ;
  17. next     1.2;
  18.  
  19. 1.2
  20. date     94.02.03.19.54.34;  author ediger;  state Exp;
  21. branches ;
  22. next     1.1;
  23.  
  24. 1.1
  25. date     93.12.19.13.02.54;  author ediger;  state Exp;
  26. branches ;
  27. next     ;
  28.  
  29.  
  30. desc
  31. @NXApp's delegate object implementation for the MachOViewer app
  32. @
  33.  
  34.  
  35. 1.4
  36. log
  37. @help/explanation panel support
  38. @
  39. text
  40. @#import "Controller.h"
  41.  
  42. @@implementation Controller
  43.  
  44. /* $Log:    Controller.m,v $
  45. Revision 1.3  94/05/29  14:59:51  ediger
  46. cleanup to eliminate compiler warning
  47.  
  48. Revision 1.2  94/02/03  19:54:34  ediger
  49. cleanup of commented out code
  50.  
  51. Revision 1.1  93/12/19  13:02:54  ediger
  52. Initial revision
  53.  
  54.  */
  55.  
  56. static char rcsident[] = "$Id: Controller.m,v 1.3 94/05/29 14:59:51 ediger Exp Locker: ediger $";
  57.  
  58. static BOOL
  59. fGetOpenPath(char *pcName, int iBufferLength, char *pcType)
  60. {
  61.     BOOL fSuccess = NO;
  62.     static char *ppcFileTypes[2] = {NULL, NULL};
  63.     static id openPanel = Nil;
  64.  
  65.     assert(pcName != NULL);
  66.     
  67.     if (openPanel == Nil)
  68.         openPanel = [OpenPanel new];
  69.  
  70.     assert(openPanel != Nil);
  71.     
  72.     if (pcType != NULL && *pcType != '\0')
  73.         ppcFileTypes[0] = pcType;
  74.     
  75.     [NXApp setAutoupdate:NO];
  76.     
  77.     if ([openPanel runModalForTypes:ppcFileTypes])
  78.     {    const char *pcNameTmp = [openPanel filename];
  79.         strncpy(pcName, pcNameTmp, iBufferLength);
  80.         fSuccess = YES;
  81.     }
  82.     
  83.     [NXApp setAutoupdate:YES];
  84.  
  85.     return fSuccess;
  86. }
  87.  
  88.  
  89. - init
  90. {
  91.     infoPanel = Nil;
  92.     return self;
  93. }
  94.  
  95. - closeFile:sender
  96. {
  97.     id oCurrentMainWindow;
  98.  
  99.     oCurrentMainWindow = [NXApp mainWindow];
  100.     [oCurrentMainWindow close];
  101.     [oCurrentMainWindow free];
  102.  
  103.     return self;
  104. }
  105.  
  106. - openNewFile:sender
  107. {
  108.     char pcPath[1024];
  109.  
  110.     if (fGetOpenPath(pcPath, 1024, NULL))
  111.     {    id p = [[Document alloc] init];
  112.         [p openFileNamed:pcPath];
  113.         [p show:self];
  114.     }
  115.  
  116.     return self;
  117. }
  118.  
  119. - showInfoPanel:sender
  120. {
  121.     if (infoPanel == nil)
  122.         if (![NXApp loadNibSection:"Info.nib" owner:self])
  123.             return nil;
  124.     
  125.     [infoPanel makeKeyAndOrderFront:self];
  126.     return self;
  127. }
  128.  
  129. - showHelpPanel:sender
  130. {
  131.     if (helpPanel == nil)
  132.         if (![NXApp loadNibSection:"HelpPanel.nib" owner:self])
  133.             return nil;
  134.     
  135.     [helpPanel makeKeyAndOrderFront:self];
  136.     return self;
  137. }
  138.  
  139.  
  140. @@end
  141. @
  142.  
  143.  
  144. 1.3
  145. log
  146. @cleanup to eliminate compiler warning
  147. @
  148. text
  149. @d6 3
  150. d17 1
  151. a17 1
  152. static char rcsident[] = "$Id: Controller.m,v 1.2 94/02/03 19:54:34 ediger Exp Locker: ediger $";
  153. a52 1
  154.     openFiles = [[List alloc] init];
  155. d87 10
  156. @
  157.  
  158.  
  159. 1.2
  160. log
  161. @cleanup of commented out code
  162. @
  163. text
  164. @d6 3
  165. d14 1
  166. a14 1
  167. static char rcsident[] = "$Id: Controller.m,v 1.1 93/12/19 13:02:54 ediger Exp Locker: ediger $";
  168. d36 1
  169. a36 1
  170.     {    char *pcNameTmp = [openPanel filename];
  171. @
  172.  
  173.  
  174. 1.1
  175. log
  176. @Initial revision
  177. @
  178. text
  179. @d5 4
  180. a8 1
  181. /* $Log$
  182. d11 1
  183. a11 1
  184. static char rcsident[] = "$Id$";
  185. a67 1
  186.         //printf("Should open \"%s\"\n", pcPath);
  187. d70 1
  188. a70 2
  189.     } //else
  190.     //    printf("Shouldn't open any damn file\n");
  191. a76 1
  192.     //printf("Controller -showInfoPanel:\n");
  193. @
  194.