This is CubeView.m in view mode; [Download] [Up]
/* Generated by Interface Builder */ #import "CubeView.h" #import "CubePlane.h" #import "AliceDoc.h" #import "AliceApp.h" extern "Objective-C" { #import <objc/List.h> } extern "C" { #import <nextdev/event.h> } #define SIZE 500.0 @implementation CubeView /* Setup */ - init { NXRect frameRect; NXSetRect(&frameRect, 0.0, 0.0, SIZE, SIZE); [super initFrame:&frameRect]; return self; } - resize:sender { int n = [subviews count]; NXPoint unit; unit.x = NX_WIDTH(&bounds)/4.0; unit.y = NX_HEIGHT(&bounds)/3.0; /* Preserve Aspect Ratio & margins */ if (unit.y > 1.5*unit.x) { unit.y = (3.0/2.0)*unit.x; [self setDrawOrigin:0.0 :-(NX_HEIGHT(&frame)-3.0*unit.y)/2.0]; } else { unit.x = (2.0/3.0)*unit.y; [self setDrawOrigin:-(NX_WIDTH(&frame)-4.0*unit.x)/2.0 :0.0]; } /* Size Plane Subviews Properly */ while (n--) { [[subviews objectAt:n] resizeTo:unit]; } return [self update]; } /* Keyboard Events */ - keyDown:(NXEvent *)theEvent { short dir = (theEvent->flags & NX_SHIFTMASK) ? 1 : 0; short rotate = (theEvent->flags & NX_CONTROLMASK) ? 1 : 0; if (theEvent->flags & NX_COMMANDMASK) return nil; if (rotate) { [[NXApp currentDocument] doRotate:theEvent->data.key.charCode :dir]; } else { [[NXApp currentDocument] doTwist:theEvent->data.key.charCode :dir]; } return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.