This is LocationInspector.m in view mode; [Download] [Up]
#import "MyBox.h"
#import "LocationInspector.h"
#import "Note.h"
@implementation LocationInspector
- awakeFromNib;
{
MyBox *myBox;
View *sv = [box superview];
[box getFrame:&theFrame];
[fingerButton1 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];
box = myBox;
[self clear:self];
return self;
}
- setX:(float)xc andY:(float)yc andFlags:(int)flags;
{
int x = xc -theFrame.origin.x -buttonFrame.size.width/2 -4;
int y = yc-theFrame.origin.y - buttonFrame.size.height/2 -3;
float z,r;
int a;
locationT loc;
Note *myNote;
if(!isEditable)return self;
if(x < 18) x = 18;
if(x > 483) x = 483;
if(y < 12) y = 12;
if(y > 97) y = 97;
z = y - 12;
if(z<0)z=0;
if(z>5*17)z=5*17;
a=z/17;
r =z/17 - a;
if(r>=.5)a++;
loc.string = a;
z = x - 18;
if(z<0)z=0;
if(z>22*(21 + 1/7))z=22*(21 + 1/7);
a=z/(21 + 1/7);
r =z/(21 + 1/7) - a;
if(r>=.5)a++;
loc.fret = a;
if(myNote = [myNR noteByLoc:&loc]){
[self displayNote:myNote];
[client newNote:myNote from:self];
}else{
NXBeep();
}
return self;
}
- (void)displayNote:(Note *)note;
{
id *idp;
int i;
locationT *l;
if(!note)return;
for(idp = &fingerButton1,i=0;idp <= &fingerButton5;idp++,i++){
l = [note loc:i];
if(l->string == -1){
[*idp setTransparent:YES];
}else{
[*idp moveTo:18+l->fret*21+l->fret/7 :12+l->string*17];
[*idp setTransparent:NO];
}
[*idp display];
}
[self refresh];
}
- clear:sender
{
id *idp;
for(idp = &fingerButton1;idp <= &fingerButton5;idp++){
[*idp setTransparent:YES];
[*idp display];
}
[self refresh];
return self;
}
- (void)refresh;
{
[box display];
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.