Path: utzoo!utgpu!watserv1!watmath!att!att!pacbell.com!ucsd!swrinde!zaphod.mps.ohio-state.edu!rpi!dali.cs.montana.edu!milton!wjs From: wjs@milton.u.washington.edu (William Jon Shipley) Newsgroups: comp.sys.next Subject: Re: dspwrap without the appkit Message-ID: <11902@milton.u.washington.edu> Date: 29 Nov 90 03:13:38 GMT References: <1990Nov28.234910.28347@murdoch.acc.Virginia.EDU> Distribution: na Organization: University of Washington, Seattle Lines: 64 Paul T. Shannon writes: >I'm looking for a simple program which shows how to use pswraps >*outside* of the application kit and Interface Builder. I understand >how to write postScript code, convert it to C using pswrap, and then >compile and link to form an executable file. What I don't understand, >however, is how to establish the proper context, which (I guess) >is a connection between my program and the Display Postscript Interpreter. > >For those curious, or skeptical, I want to do this so that I can >use the entire display, with as little interference and overhead as >possible, to present full-screen visual stimuli for experiments in >perceptual psychology. Well, I hate to sound like the NeXT Thought Police (TM), but I wouldn't recommend you go outside the appkit for this project. Why? Because it's much cleaner and easier to do it inside the appkit. I don't think you will gain any speed going around the appkit, either. Following is a description of how to make your window the size of the whole screen, and titlebarless. This will have the same effect as being able to write to the screen itself, except you'll have the convienience of using a Window. What I think you want to do is go ahead and use the IB to get a nice shell of a program, but create a new subclass of window in IB, calling it, say, "BigWindow". Make your main window (called MyWindow, probably) an instance of class BigWindow in the Inspector panel (select the window down amongst the icons in the lower right, hit command-1, change class). Unparse your BigWindow class in IB, then get into Edit (or emacs) and edit BigWindow.m. Rewrite the newContent:... method as follows: + newContent:(const NXRect *)contentRect style:(int)aStyle backing:(int)bufferingType buttonMask:(int)mask defer:(BOOL)flag { NXRect cRect, fRect; // We want our new window to be the size of the whole screen. [NXApp getScreenSize:&fRect.size]; // But we create a window by specifying the content size, so we get that. [BigWindow getContentRect:&cRect forFrameRect:&fRect style:NX_PLAINSTYLE]; // Create an untitled window the size of the screen return [super newContent:&cRect style:NX_PLAINSTYLE backing:bufferingType buttonMask:mask defer:flag]; } Now your main window will cover the whole screen, and not have an annoying (to you) title bar, and yet you still get to use the appkit (big win!) and not try to create your own context with the window server (big win too!). Warning: I'm just writing this off the top of my head, I haven't tried any of it. -william shipley just a regular guy who really wouldn't mind working for NeXT developer support