home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Plotting / aa_Intel_Only / Gnuplot / GnuplotSource / DataFileThreeDPane.m < prev    next >
Encoding:
Text File  |  1995-06-12  |  3.6 KB  |  180 lines

  1. /*
  2.  *  Copyright (C) 1993  Robert Davis
  3.  *
  4.  *  This program is free software; you can redistribute it and/or
  5.  *  modify it under the terms of Version 2, or any later version, of 
  6.  *  the GNU General Public License as published by the Free Software 
  7.  *  Foundation.
  8.  */
  9.  
  10.  
  11. static char RCSId[]="$Id: DataFileThreeDPane.m,v 1.3 1993/05/30 09:10:10 davis Exp $";
  12.  
  13. #import <appkit/Application.h>
  14. #import <appkit/FormCell.h>
  15. #import <appkit/Matrix.h>
  16. #import <appkit/Panel.h>
  17. #import <appkit/TextFieldCell.h>
  18. #import <appkit/View.h>
  19.  
  20. #import <objc/NXStringTable.h>
  21.  
  22. #import "DataFileThreeDPane.h"
  23. #import "DataOptionsPanel.h"
  24. #import "FunctionObject.h"
  25. #import "Status.h"
  26.  
  27. @implementation DataFileThreeDPane
  28.  
  29. - init
  30. {
  31.     [super init];
  32.  
  33.     [NXApp loadNibSection: "DataFileThreeDPane.nib"
  34.             owner: self
  35.         withNames: NO
  36.          fromZone: [self zone]];
  37.  
  38.     return self;
  39. }
  40.  
  41.  
  42.  
  43. - setDetailed:sender
  44. {
  45.     struct coldat    *cd = [[doc function] columnData];
  46.     BOOL        isDetailed = [sender state];
  47.  
  48.     if (isDetailed != cd->isOn) {
  49.     BOOL    report = [status report];
  50.  
  51.     cd->isOn = isDetailed;
  52.  
  53.     [status setReport:NO];
  54.     [self setZOnly:zOnlyRadioMatrix];
  55.     [status setReport:report];
  56.     [status reportSettingsChange:self];
  57.  
  58.     }
  59.  
  60.     return self;
  61. }
  62.  
  63.  
  64.  
  65. - setColumnsData:sender
  66. {
  67.     FunctionObject    *f = [doc function];
  68.     struct coldat    *columnData = [f columnData];
  69.     int            value = [[sender selectedCell] intValue];
  70.  
  71.     if ((value <= columnData->number) && (value > 0)){
  72.  
  73.     switch ([sender selectedTag]) {
  74.  
  75.     case THREED_XCOL:    columnData->x = value; break;
  76.     case THREED_YCOL:    columnData->y = value; break;
  77.     case THREED_ZCOL:
  78.     case THREED_ZCOLONLY:    columnData->z = value; break;
  79.  
  80.     }
  81.  
  82.     [status reportSettingsChange:self];
  83.  
  84.     }
  85.  
  86.     if ([self forceUpdateStatus:status doc:doc])
  87.     [[infoField superview] display];    /* Display box */
  88.  
  89.     return self;
  90. }
  91.  
  92.  
  93. - setZOnly:sender;
  94. {
  95.     BOOL        useZOnly = ([sender selectedTag] == Z_ONLY);
  96.     FunctionObject    *f = [doc function];
  97.     struct coldat    *columnData = [f columnData];
  98.  
  99.     if (!useZOnly != columnData->useX) {
  100.     columnData->useX = !useZOnly;
  101.     columnData->useY = !useZOnly;
  102.     columnData->useZ = YES;
  103.  
  104.     /*  
  105.      *  Parametric mode should be on if using Z Only mode.  Off 
  106.      *  otherwise. 
  107.      */
  108.     if ([status parametric] == useZOnly)
  109.         [status setParametric:!useZOnly];
  110.     else
  111.         [status reportSettingsChange:self];
  112.     }
  113.  
  114.     if ([self forceUpdateStatus:status doc:doc])
  115.     [[infoField superview] display];    /* Display box */
  116.  
  117.     return self;
  118. }
  119.  
  120.  
  121. - (BOOL)updateStatus:aStatus doc:aDoc
  122. {
  123.     FunctionObject    *f;
  124.  
  125.     [super updateStatus:aStatus doc:aDoc];
  126.  
  127.     f = [doc function];
  128.  
  129.     if (f) {
  130.  
  131.     struct coldat    *c = [f columnData];
  132.     char        info[1023];
  133.     BOOL        enabled = c->isOn;
  134.     Window        *viewWindow;
  135.  
  136.     [(viewWindow = [view window]) disableDisplay];
  137.  
  138.     [detailedButton setState:enabled];
  139.  
  140.     if (c->number == 1)
  141.         strcpy (info, [stringSet valueForStringKey:"columnsInfoSingular"]);
  142.     else
  143.         sprintf (info, [stringSet valueForStringKey:"columnsInfoPlural"],
  144.              c->number);
  145.  
  146.     [infoField setStringValue: info];
  147.     [infoField setEnabled: enabled];
  148.     [infoLine2 setEnabled: enabled];
  149.  
  150.     [zOnlyRadioMatrix setEnabled:enabled];
  151.     [zOnlyRadioMatrix selectCellWithTag:c->useX ? !Z_ONLY : Z_ONLY];
  152.  
  153.     [xColField setEnabled:(enabled && c->useX)];
  154.     [xColField setIntValue:c->x];
  155.  
  156.     [yColField setEnabled:(enabled && c->useY)];
  157.     [yColField setIntValue:c->y];
  158.  
  159.     [zColField setEnabled:(enabled && c->useZ && c->useX)];
  160.     [zColField setIntValue:c->z];
  161.  
  162.     [zOnlyColField setEnabled:(enabled && c->useZ && !c->useX)];
  163.     [zOnlyColField setIntValue:c->z];
  164.  
  165.     [viewWindow reenableDisplay];
  166.  
  167.     }
  168.  
  169.     return YES;
  170. }
  171.  
  172.  
  173. // Shuts up the compiler about unused RCSId
  174. - (const char *) rcsid
  175. {
  176.     return RCSId;
  177. }
  178.  
  179. @end
  180.