[comp.lang.smalltalk] Screen Print from ParcPlace Smalltalk-80 filein

new@ee.udel.edu (Darren New) (01/03/91)

'From Objectworks for Smalltalk-80(tm), Version 2.5 of 29 July 1989 on 2 January 1991 at 1:31:10 pm'!

!ScreenController methodsFor: 'menu messages'!

hardcopyDisplay
	"This will optionally wait ten seconds, then send a copy of the 
	display to the postscript printer. Fix ScreenController class>>initialize 
	to make a background menu to call this method, and put this method 
	in ScreenController>menu messages. The #GropeDisplay symbol is to 
	allow ease of finding this method when GROPE is filed out. You will 
	need to manually adjust the landscape mode and the scale for your 
	display, printer, and desired image size. Note that since this runs at 
	lowIOPriority, you should *NOT* attempt to edit the name of the 
	file that the postscript is going to, as you will hang and need to kill 
	the interpreter. I've done this so that one may snapshot a screen 
	with menus showing and/or graphics changing. Probably putting the 
	showWhile: message inside a process at the normal priority would fix 
	this, but I don't want to play with it lest it break. For an Apple 
	LaserWriter and a Sun-3 screen, scale 2.3 landscape gives me a full 
	page and scale 1.5 portrait gives me an image appropriate for 
	inclusion in other publications. A test program follows this method."

	| document scale form |
	document _ #GropeDisplay.
	
	[scale _ 2.3.
	scale _ 1.5.
	Sensor leftShiftDown ifFalse: [(Delay forSeconds: 10) wait].
	form _ Display copy.
	Cursor write
		showWhile: 
			[document _ Document new.
			"document setLandscape."
			document startParagraph.
			document addImageOneToN: (Array with: form with: scale).
			document close.
			document toPrinter]]
		forkAt: Processor lowIOPriority! !


'From Objectworks for Smalltalk-80(tm), Version 2.5 of 29 July 1989 on 2 January 1991 at 1:34:32 pm'!

!GropeSpec class methodsFor: 'examples'!

testScaling
	"GropeSpec testScaling"
	"This prints out a full screen box so that you can tell how many 
	pixels are on a page. The lines are 100 pixels apart. You can file 
	this into any convenient class, or just select from the temp vars on 
	down and DoIt."

	| f i l dot document |
	f _ Form extent: Display extent.
	dot _ Form dotOfSize: 1.
	f
		fill: f boundingBox
		rule: Form paint
		mask: Form white.
	i _ 0.
	[i <= f extent x]
		whileTrue: 
			[l _ Line
						from: i @ 0
						to: i @ f extent y
						withForm: dot.
			l displayOn: f.
			f display.
			i _ i + 20].
	i _ 0.
	[i <= f extent y]
		whileTrue: 
			[l _ Line
						from: 0 @ i
						to: f extent x @ i
						withForm: dot.
			l displayOn: f.
			f display.
			i _ i + 20].
	f display.
	Cursor write
		showWhile: 
			[document _ Document new.
			document setBottomMargin: 0.
			document setTopMargin: 0.
			document setLeftMargin: 0.
			document setRightMargin: 0.
			document addImageOneToN: (Array with: f with: 5).
			document close.
			document toPrinter].
	ScheduledControllers restore! !



-- 
--- Darren New --- Grad Student --- CIS --- Univ. of Delaware ---
----- Network Protocols, Graphics, Programming Languages, 
      Formal Description Techniques (esp. Estelle), Coffee, Amigas -----
              =+=+=+ Let GROPE be an N-tuple where ... +=+=+=