home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: Graphics
/
Graphics.zip
/
pgpro40.zip
/
GreetingCard.cwx
< prev
next >
Wrap
Text File
|
1999-08-04
|
9KB
|
277 lines
/*
GreetingCard.cwx
PGPro Scripts v3.0 - by Don Eitner, 1999
Lays out an 8x10 inch greeting card which the user then modifies, prints,
and folds.
This code is neither supported nor under warranty. Feel free to
examine and modify this script for your own purposes. See the
included readme.txt for additional information.
*/
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
/* Make sure the user wants to do this */
if RxMessageBox("This script will replace any current project. Do you wish to continue?", ,
"New Project?","yesno","warning") \= 6 then
exit
Handle = CwNewProject()
/* Set initial variables */
Output = CwGetAppHandle("Output Settings")
Measure = CwGetProperty(Output, "Unit")
Embo = "No"
/* Set project to 8x10 inches and 150dpi */
call CwSetProperty Output, Unit, "Inches"
call CwSetProperty Output, 'Output Size:Width', "8"
call CwSetProperty Output, 'Output Size:Height', "10"
call CwSetProperty Output, 'DPI', '150'
call CwSetViewZoom 4.5, 4, 10, 12
/* Set additional variables */
oWidth = CwGetProperty(Output, "Output Size:Width")
oHeight = CwGetProperty(Output, "Output Size:Height")
/* Prompt user for card front text */
call Prompt "Out"
call Wait
/* Prompt user for card inside text */
call Prompt "In"
call Wait
/* Create the front and inside of the card */
Face1 = CwCreateEffect("Headline Text", "Solid Color")
call CwSetPosition Face1, 6, 2.5, 3.5, 4.5, 0, 0
Textobj = CwGetRegion(Face1)
call CwSetProperty Textobj, "Caption", FT
call CwSetProperty Textobj, "Font", FTF
call CwSetProperty Textobj, "Justification", FTJ
call CwSetProperty Textobj, "Line Spacing", FTL
Textobj = CwGetTool(Face1)
call CwSetProperty Textobj, "Color", FTC
if FTE = "Yes" then
do
Face1Emb = CwCreateEffect("Rectangle", "Emboss")
call CwSetPosition Face1Emb, 6, 2.5, 4, 5, 0, 0
Textobj = CwGetTool(Face1Emb)
call CwSetProperty Textobj, "Color", "(225,225,225)"
end
Face2 = CwCreateEffect("Headline Text", "Solid Color")
call CwSetPosition Face2, 2, 7.5, 3.5, 4.5, 180, 0
Textobj = CwGetRegion(Face2)
call CwSetProperty Textobj, "Caption", IT
call CwSetProperty Textobj, "Font", ITF
call CwSetProperty Textobj, "Justification", ITJ
call CwSetProperty Textobj, "Line Spacing", ITL
Textobj = CwGetTool(Face2)
call CwSetProperty Textobj, "Color", ITC
if ITE = "Yes" then
do
Face1Emb = CwCreateEffect("Rectangle", "Emboss")
call CwSetPosition Face1Emb, 2, 7.5, 4, 5, 180, 0
Textobj = CwGetTool(Face1Emb)
call CwSetProperty Textobj, "Color", "(225,225,225)"
end
Face3 = CwCreateEffect("Headline Text", "Solid Color")
call CwSetPosition Face3, 2, 2, 3, 1, 0, 0
Textobj = CwGetRegion(Face3)
call CwSetProperty Textobj, "Caption", "Greetings by Freiheit"
call CwSetProperty Textobj, "Font", "Times New Roman"
Textobj = CwGetTool(Face3)
call CwSetProperty Textobj, "Color", "(0,0,192)"
call CwSetProperty Face3, "Translucency", "75"
/* Create the lines on which to fold the card */
Fold1 = CwCreateEffect("Rectangle", "Solid Color")
Lineobj = CwGetTool(Fold1)
call CwSetProperty Lineobj, "Color", "(0,0,0)"
call CwSetPosition Fold1, 4, 5, 8, 0.03, 0, 0
Fold1Text = CwCreateEffect("Headline Text", "Solid Color")
Textobj = CwGetRegion(Fold1Text)
call CwSetProperty Textobj, "Caption", "<= Fold 1st."
Textobj = CwGetTool(Fold1Text)
call CwSetProperty Textobj, "Color", "(192,0,192)"
call CwSetPosition Fold1Text, 9, 5, 1.5, 0.5, 0, 0
Fold2 = CwCreateEffect("Rectangle", "Solid Color")
Lineobj = CwGetTool(Fold2)
call CwSetProperty Lineobj, "Color", "(0,0,0)"
call CwSetPosition Fold2, 4, 5, 0.03, 10, 0, 0
Fold2Text = CwCreateEffect("Headline Text", "Solid Color")
Textobj = CwGetRegion(Fold2Text)
call CwSetProperty Textobj, "Caption", "<= Fold 2md."
Textobj = CwGetTool(Fold2Text)
call CwSetProperty Textobj, "Color", "(192,0,192)"
call CwSetPosition Fold2Text, 4, -1, 1.5, 0.5, -90, 0
exit
/* Prompt user for card front text */
Prompt:
parse arg InOut
/* Stop drawing until we've setup the display */
call CwClearSelectionRectangle
Window=CwGetCurrentView()
call CwStopRender window
/* Drop a white box over everything so we can see our prompts */
Boxeffect = CwCreateEffect('Rectangle', 'Solid Color')
call CwSetPosition Boxeffect, oWidth/2, oHeight/2, oWidth, oHeight, 0, 0
call CwSetName Boxeffect, "DIALOG"
Whitebox = CwGetTool(Boxeffect)
call CwSetProperty Whitebox, "Color", "(255,255,255)"
/* Show the prompts */
Text1effect = CwCreateEffect('Headline Text', 'Solid Color')
call CwSetPosition Text1effect, oWidth/2, oHeight-oHeight/12, oWidth, oHeight/6, 0, 0
call CwSetName Text1effect, "INSTRUCTIONS"
Textobj = CwGetTool(Text1effect)
call CwSetProperty Textobj, "Color", "(0,0,0)"
Text2effect = CwCreateEffect('Headline Text', 'Solid Color')
call CwSetPosition Text2effect, oWidth/2, (3*oHeight/5), 3.5, 4.5, 0, 0
call CwSetName Text2effect, "USERTEXT"
Textobj = CwGetTool(Text2effect)
call CwSetProperty Textobj, "Color", "(0,0,255)"
if InOut = "Out" then
do
Textobj = CwGetRegion(Text1effect)
call CwSetProperty Textobj, "Caption", "Edit blue text below for card front."
Textobj = CwGetRegion(Text2effect)
call CwSetProperty Textobj, "Caption", "Card front"||'0d0a'x||"text here."
end
else
do
Textobj = CwGetRegion(Text1effect)
call CwSetProperty Textobj, "Caption", "Edit blue text below for card inside."
Textobj = CwGetRegion(Text2effect)
call CwSetProperty Textobj, "Caption", "Card inside"||'0d0a'x||"text here."
end
Embosseffect = CwCreateEffect('Headline Text', 'Solid Color')
call CwSetPosition Embosseffect, oWidth/2, oHeight/4, oWidth, oHeight/6, 0, 0
call CwSetName Embosseffect, "EMBOSS"
Textobj = CwGetRegion(Embosseffect)
call CwSetProperty Textobj, "Caption", "Click here to emboss this text."
Textobj = CwGetTool(Embosseffect)
call CwSetProperty Textobj, "Color", "(192,0,0)"
Text3effect = CwCreateEffect('Headline Text', 'Solid Color')
call CwSetPosition Text3effect, oWidth/2, oHeight/12, oWidth/4, oHeight/6, 0, 0
call CwSetName Text3effect, "NEXT"
Textobj = CwGetRegion(Text3effect)
call CwSetProperty Textobj, "Caption", "OK"
Textobj = CwGetTool(Text3effect)
call CwSetProperty Textobj, "Color", "(0,255,0)"
/* Now render the screen for the user */
call CwStartRender window
return
Wait:
/* Begin loop to wait for button selection */
if RxFuncQuery('SysLoadFuncs') then
do
call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
call SysLoadFuncs
end
do forever
/* sleep */
rc = SysSleep 5
/* see what (if anything) is selected */
Obj = CwGetSelectedObject()
/* nothing selected? Continue */
if \CwIsHandleValid(Obj) then iterate
/* Something selected. What is it? */
Name = CwGetName(Obj)
/* if it is a button then go on */
if Name = "NEXT" then
select
when InOut = "Out" then
do
o = CwGetRegion(text2effect)
FT = CwGetProperty(o,"Caption")
FTF = CwGetProperty(o, "Font")
FTJ = CwGetProperty(o, "Justification")
FTL = CwGetProperty(o, "Line Spacing")
if Embo = "Yes" then
do
FTE ="Yes"
Embo = "No"
end
o = CwGetTool(text2effect)
FTC = CwGetProperty(o, "Color")
leave
end
when InOut = "In" then
do
o = CwGetRegion(text2effect)
IT = CwGetProperty(o,"Caption")
ITF = CwGetProperty(o, "Font")
ITJ = CwGetProperty(o, "Justification")
ITL = CwGetProperty(o, "Line Spacing")
if Embo = "Yes" then
do
ITE ="Yes"
Embo = "No"
end
o = CwGetTool(text2effect)
ITC = CwGetProperty(o, "Color")
leave
end
end
if Name = "EMBOSS" then
select
when Embo = "No" then
do
Embo = "Yes"
call CwDeselectObject(obj)
Textobj = CwGetRegion(Embosseffect)
call CwSetProperty Textobj, "Caption", "Click here to turn off embossing."
signal Wait
end
when Embo = "Yes" then
do
Embo = "No"
call CwDeselectObject(obj)
Textobj = CwGetRegion(Embosseffect)
call CwSetProperty Textobj, "Caption", "Click here to emboss this text."
signal Wait
end
end
end
/* delete all the prompting stuff before continuing */
rc = CwDeleteObject(Text1effect)
rc = CwDeleteObject(Text2effect)
rc = CwDeleteObject(Text3effect)
rc = CwDeleteObject(Embosseffect)
rc = CwDeleteObject(Boxeffect)
return