home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Graphics / Gnuplot / Source / OptionsPanel.m < prev    next >
Encoding:
Text File  |  1993-03-18  |  2.2 KB  |  144 lines

  1.  
  2. static char RCSId[]="$Id: OptionsPanel.m,v 1.1.1.1 1993/03/18 03:34:41 davis Exp $";
  3.  
  4.  
  5.  
  6. #import <appkit/Application.h>
  7. #import <appkit/Cell.h>
  8. #import <appkit/Matrix.h>
  9. #import <appkit/Panel.h>
  10. #import <appkit/Text.h>
  11.  
  12. #import "GnuplotPlot.h"
  13. #import "OptionsPanel.h"
  14.  
  15.  
  16. @interface OptionsPanel (Private)
  17.  
  18. - _updatePanel;
  19.  
  20. @end
  21.  
  22.  
  23. @implementation OptionsPanel
  24.  
  25. - init
  26. {
  27.     [super init];
  28.     status = nil;
  29.  
  30.     return self;
  31. }
  32.  
  33.  
  34. - panel
  35. {
  36.     return panel;
  37. }
  38.  
  39.  
  40.  
  41. - showPanel:sender
  42. {
  43.     [panel makeKeyAndOrderFront:self];
  44.     return self;
  45. }
  46.  
  47.  
  48. - forceUpdate;
  49. {
  50.     id mainWindow = [NXApp mainWindow];
  51.  
  52.     if (mainWindow)
  53.     status = [[mainWindow delegate] status];
  54.     else
  55.     status = nil;
  56.  
  57.     [self _updatePanel];
  58.  
  59.     return self;
  60. }
  61.  
  62.  
  63. - windowDidUpdate:sender
  64. {
  65.     id mainWindow = [NXApp mainWindow];
  66.     id newStatus;
  67.  
  68.     if (mainWindow)
  69.     newStatus = [[mainWindow delegate] status];
  70.     else
  71.     newStatus = nil;
  72.  
  73.     if (newStatus != status) {
  74.     status = newStatus;
  75.     [self _updatePanel];
  76.     }
  77.  
  78.     return self;
  79. }
  80.  
  81.  
  82. // Shuts up the compiler about unused RCSId
  83. - (const char *) rcsid
  84. {
  85.     return RCSId;
  86. }
  87.  
  88.  
  89. - textDidEnd:textObject endChar:(unsigned short)whyEnd
  90. {
  91.     /*  
  92.      *  Under most circumstances, the superview of the textObject is 
  93.      *  the Cell that was being edited.  All of the TextFieldCells in 
  94.      *  the OptionPanels, however, are assumed to be scrollable (so 
  95.      *  the user can enter numbers larger than the space that I've 
  96.      *  allowed), so the superview of the textObject is a ClipView.  
  97.      *  The Cell we want is the super view of the ClipView.
  98.      */
  99.     id matrix = [[textObject superview] superview];
  100.     id editCell = [matrix selectedCell];
  101.  
  102.     if (_textCellChanged && ((whyEnd == NX_TAB) || (whyEnd == NX_BACKTAB)))  {
  103.  
  104.     if ([editCell action])    /* If cell has its own action, do it    */
  105.         [[editCell controlView]
  106.         sendAction:[editCell action] to:[editCell target]];
  107.  
  108.     else            /* Otherwise, do the matrix's action    */
  109.         [matrix sendAction:[matrix action] to:[matrix target]];
  110.  
  111.     _textCellChanged = NO;
  112.  
  113.     }
  114.  
  115.     return self;
  116. }
  117.  
  118.  
  119.  
  120. - (BOOL) textWillChange:textObject
  121. {
  122.     _textCellChanged = YES;
  123.     return NO;        /* NO means it's okay for the text to change    */
  124. }
  125.  
  126.  
  127. @end
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134. @implementation OptionsPanel (Private)
  135.  
  136.  
  137. - _updatePanel
  138. {
  139.     return self;
  140. }
  141.  
  142.  
  143. @end
  144.