home *** CD-ROM | disk | FTP | other *** search
-
- /* Generated by Interface Builder */
-
- #import "NewScottView.h"
- #import <appkit/appkit.h>
- #import <appkit/Control.h>
- #import <dpsclient/wraps.h>
- #import <appkit/Application.h>
- #import <appkit/Responder.h>
-
- @implementation NewScottView
-
- - setPenColorCtrl:anObject
- {
- penColorCtrl = anObject;
- return self;
- }
-
- - setPenWidthCtrl:anObject
- {
- penWidthCtrl = anObject;
- return self;
- }
-
- - setBackColorCtrl:anObject
- {
- backColorCtrl = anObject;
- return self;
- }
-
- - setPenWidth:sender
- {
- penWidth = [sender floatValue];
- return self;
- }
-
- - clearView:sender
- {
- [self display];
- return self;
- }
-
- - setBackColor:sender
- {
- backColor = [sender floatValue];
- return self;
- }
-
- - setPenColor:sender
- {
- penColor = [sender floatValue];
- return self;
- }
- + newFrame: (NXRect *)nf
- {
- self = [super newFrame:nf];
- backColor = 1.0;
- penColor = 0.0;
- penWidth = 1.0;
- return self;
- }
-
- - drawSelf:(NXRect *)list:(int)count
- {
- [self lockFocus];
- PSsetgray(backColor);
- NXRectFill(&bounds);
- [self unlockFocus];
- return self;
- }
-
-
- - mouseDown: (NXEvent *)ptr
- {
- NXPoint mLoc, oldLoc;
- NXEvent *nextEvent;
- BOOL looping = YES;
- int oldMask;
- int checkMask;
-
- oldMask = [window eventMask];
- checkMask = NX_MOUSEUPMASK | NX_MOUSEDRAGGEDMASK;
- [window setEventMask:( oldMask|checkMask)];
- [self lockFocus];
- oldLoc = ptr->location;
- [self convertPoint:&oldLoc fromView:nil];
- PSsetgray(penColor);
- PSsetlinewidth(penWidth);
- while (looping) {
- nextEvent = [NXApp getNextEvent:checkMask];
- looping = (nextEvent->type != NX_MOUSEUP);
- if (looping) {
- mLoc = nextEvent->location;
- [self convertPoint:&mLoc fromView:nil];
- if ((mLoc.x != oldLoc.x) | (mLoc.y != oldLoc.y)) {
- PSnewpath();
- PSmoveto(oldLoc.x,oldLoc.y);
-
- PSlineto(mLoc.x,mLoc.y);
- PSclosepath();
- PSstroke();
- [window flushWindow];
- oldLoc = mLoc;
- }
- }
- }
- [self unlockFocus];
- [window setEventMask:oldMask];
- return self;
- }
- @end
-