/* ColorType Amiga Rexx script - Copyright © 1996 Cloanto Italia srl */

/* $VER: DViewText.ctrx 1.0 */

/**
 This script fills the Dynamic View area with all of the font's characters.
 This is useful to preview editing effects in real time. Undefined
 characters and characters switched to "Off" are skipped.
*/

IF ARG(1, EXISTS) THEN
	PARSE ARG CTPORT
ELSE
	CTPORT = 'COLORTYPE'

IF ~SHOW('P', CTPORT) THEN DO
	IF EXISTS('ColorType:ColorType') THEN DO
		ADDRESS COMMAND 'Run >NIL: ColorType:ColorType'
		DO 30 WHILE ~SHOW('P',CTPORT)
			 ADDRESS COMMAND 'Wait >NIL: 1 SEC'
		END
	END
	ELSE DO
		SAY "ColorType could not be loaded."
		EXIT 10
	END
END

IF ~SHOW('P', CTPORT) THEN DO
	SAY 'ColorType Rexx port could not be opened.'
	EXIT 10
END

ADDRESS VALUE CTPORT
OPTIONS RESULTS
OPTIONS FAILAT 10000


LockGUI
len = 0
DO cn = 0 to 255
	GetActivation cn
	IF RESULT = 1 THEN DO
		IF len = 0 THEN
			dvtext = D2C(cn)
		ELSE
			dvtext = dvtext || D2C(cn)
		IF cn = 34 THEN
			dvtext = dvtext || D2C(cn)	/* '"' -> '""' */
		len = len + 1
	END
END

IF len > 0 THEN
	DynamicView '"'dvtext'"'

UnlockGUI
