This is KeyInspector.m in view mode; [Download] [Up]
#import "KeyInspector.h"
#import "MyBox.h"
#import "Note.h"
@implementation KeyInspector
- awakeFromNib;
{
MyBox *myBox;
View *sv = [box superview];
[box getFrame:&theFrame];
[noteButton getFrame:&buttonFrame];
myBox = [[MyBox alloc]initFrame:&theFrame];
[myBox setOffsets:0:0];
[myBox setContentView:[box contentView]];
[myBox setTitle:[box title]];
[myBox setController:self];
[sv addSubview:myBox];
[noteButton setTransparent:YES];
[noteButton moveTo:41 :30];
box = myBox;
[self refresh];
[sv display];
return self;
}
- setX:(float)xc andY:(float)yc andFlags:(int)flags;
{
int x = xc -theFrame.origin.x -buttonFrame.size.width/2;
int y = yc-theFrame.origin.y - buttonFrame.size.height/2 -3;
float z,r;
int a;
notationT not;
Note *myNote;
if(!isEditable)return self;
if(31<x && x < 71){
x = 41;
z = y - 30;
if(z<0)z=0;
if(z>27*6.5)z=27*6.5;
a=z/6.5;
r =z/6.5 - a;
if(r>=.5)a++;
not.nr = a;
if(NX_COMMANDMASK & flags){
not.vorz = VORZK;
goto ende;
}
if(NX_ALTERNATEMASK & flags){
not.vorz = VORZB;
goto ende;
}
not.vorz = VORZ_;
ende:
if(myNote = [myNR noteByNot:¬]){
if(not.vorz == VORZB){
[myNote setB:YES];
}else{
[myNote setB:NO];
}
[self displayNote:myNote];
[client newNote:myNote from:self];
}else{
NXBeep();
}
}
return self;
}
- clear:sender
{
[noteButton setTransparent:YES];
[self refresh];
return self;
}
- (void)displayNote:(Note *)note;
{
notationT *nP;
if(!note)return;
if([note b]){
nP = [note not2];
}else{
nP = [note not1];
}
[noteButton moveTo:41 :30+6.5*(nP->nr)];
[noteButton setTransparent:NO];
switch(nP->vorz){
case VORZ_: [noteButton setTitle:" "];
break;
case VORZB: [noteButton setTitle:"b"];
break;
case VORZK: [noteButton setTitle:"#"];
break;
}
[self refresh];
}
- (void)refresh;
{
[noteButton display];
[box display];
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.