home *** CD-ROM | disk | FTP | other *** search
- /***** ButtonPresenter.m -- Button data display object implementation
- NeXTstep Measurement Kit
- by Alex Meyer <ameyer@phoenix.Princeton.EDU>
- for computer science senior thesis
- 17 April 1992 -- created
- 22 April 1992 -- incorporated structs.h & added identify
- *****/
-
- #import <stdlib.h>
- #import <stdio.h>
- #import <string.h>
- #import <appkit/Application.h>
- #import "Historian.h"
- #import "ButtonPresenter.h"
-
- @implementation ButtonPresenter
-
- static id instance = nil;
-
- + new
- {
- if (instance == nil) {
- instance = [self alloc];
- [NXApp loadNibSection:"ButtonPresenter.nib"
- owner:instance];
- }
- return (instance);
- }
-
-
- - showData:sender
- {
- NXAtom key;
- int i,tag;
- float x,y,width,height;
- char *p,*text;
-
- [sender copyDataTo:&rec];
- key = [sender getKey];
- for (p = key,i = 0;*p != '|';++p)
- ++i;
- text = malloc(i + 1);
- strncpy(text,key,i);
- text[i] = 0;
- sscanf(p,"|%d|%f|%f|%f|%f",&tag,&x,&y,&width,&height);
- [form setStringValue:text
- at:0];
- [form setIntValue:tag
- at:1];
- [form setFloatValue:x
- at:2];
- [form setFloatValue:y
- at:3];
- [form setFloatValue:width
- at:4];
- [form setFloatValue:height
- at:5];
- [form setIntValue:rec.numHits
- at:6]; /* should be unsigned */
- [form setIntValue:rec.numCancel
- at:7];
- [form setDoubleValue:rec.timeIn
- at:8];
- [form setDoubleValue:rec.timeBetween
- at:9];
- free(text);
- [window orderFront:self];
- return (self);
- }
-
-
- - hide:sender
- {
- [window orderOut:self];
- return (self);
- }
-
-
- - (NXAtom)identify
- {
- return (NXUniqueString("Buttons"));
- }
-
- @end
-