home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
hypercrd
/
hc1_2_x
/
spiro.sit
/
uni_ogtahqo
/
ÁSpiro!
/
background_2777.txt
< prev
next >
Wrap
Text File
|
1989-09-13
|
10KB
|
408 lines
-- background: 2777 from stack: in
-- bmap block id: 2207
-- flags: 0000
-- background id: 0
-- name:
----- HyperTalk script -----
-------------SPIRO!© by andrew c stone ------------
-------------UUCP stone@hydra.unm.edu stone@sleepy.cs.unm.edu
on spiro
------ get the specifications:
------ have defaults for no-brainers
put (the commandkey is down) into useSpecial
put validate(fld "myangle") into angle
if angle is empty then
put 121 into angle
put 121 into fld "myangle"
end if
put validate(fld "mywidth") into lwidth
if lwidth is empty then
put 1 into lwidth
put 1 into fld "mywidth"
end if
set the linesize to lwidth
put validate(fld "mystartL") into Length
if Length is empty then
put 4 into Length
put 4 into fld "mystartL"
end if
put validate(fld "myendL") into endLength
if endLength is empty then
put 300 into endLength
put 300 into fld "myendL"
end if
put validate(fld "myincrement") into increment
if increment is empty then
put 4 into increment
put 4 into fld "myincrement"
end if
--------------------------
--convert angle to theta :
put (pi*angle)/180 into angle
---center the drawing:
put 217 into X
put 171 into Y
put angle into theta
choose line tool
if useSpecial then
specialSpiro X,Y,theta, Length,increment,endLength,angle
else
set the pattern to 1
repeat
set cursor to busy
put X + trunc(Length * cos(theta)) into newX
put Y + trunc(Length * sin(theta)) into newY
drag from X,Y to newX,newY
put newX into X
put newY into Y
put theta + angle into theta
add increment to Length
if Length > endLength then exit repeat
end repeat
end if
choose select tool
drag from 434,1 to 512,342
type numtochar(8)
choose browse tool
end spiro
on specialSpiro X,Y,theta,Length,increment,endLength,angle
set the pattern to 1
domenu "select all"
domenu "invert"
drag from 434,0 to 512,342
type numtochar(8)
choose line tool
repeat
set cursor to busy
put X + trunc(Length * cos(theta)) into newX
put Y + trunc(Length * sin(theta)) into newY
drag from X,Y to newX,newY with optionkey
put newX into X
put newY into Y
put theta + angle into theta
add increment to Length
if Length > endLength then exit repeat
end repeat
end specialSpiro
function validate var ---because we care
put var into temp
repeat with i = 1 to length of temp
if char i of temp is not in ".0123456789" then
answer "Bad Data: "&var&&" Now using defaults."
return empty
end if
end repeat
return temp
end validate
-- part 2 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=434 top=47 right=67 bottom=512
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 14
-- style flags: 256
-- line height: 18
-- part name: myangle
-- part 3 (button)
-- low flags: 00
-- high flags: C002
-- rect: left=434 top=29 right=49 bottom=512
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 12
-- style flags: 256
-- line height: 16
-- part name: Angle
----- HyperTalk script -----
on mousedown
put PopUpMenu("90;91;103;109;121;129;136;145;152;159;163;170,Other…", 0, the mouseV , the mouseH - 20) into which
if which is 0 then exit mousedown
if which is 1 then
put "90" into fld myangle
else if which is 2 then
put "91" into fld myangle
else if which is 3 then
put "103" into fld myangle
else if which is 4 then
put "109" into fld myangle
else if which is 5 then
put "121" into fld myangle
else if which is 6 then
put "129" into fld myangle
else if which is 7 then
put "136" into fld myangle
else if which is 8 then
put "145" into fld myangle
else if which is 9 then
put "152" into fld myangle
else if which is 10 then
put "159" into fld myangle
else if which is 11 then
put "163" into fld myangle
else if which is 12 then
put "170" into fld myangle
else if which is 13 then
ask "Please enter angle between 90 & 180:"
put it into fld myangle
end if
end mousedown
-- part 4 (button)
-- low flags: 00
-- high flags: C002
-- rect: left=434 top=80 right=100 bottom=512
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 12
-- style flags: 256
-- line height: 16
-- part name: Increment
----- HyperTalk script -----
on mousedown
put PopUpMenu("1;2;3;4;5;6;7;8;9;10;11;12,Other…", 0, the mouseV , the mouseH - 20) into which
if which is 0 then exit mousedown
if which is 13 then
ask "Please enter increment:"
put it into fld myincrement
else
put which into fld myincrement
end if
end mousedown
-- part 5 (button)
-- low flags: 00
-- high flags: C002
-- rect: left=434 top=131 right=150 bottom=512
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 12
-- style flags: 256
-- line height: 16
-- part name: Line Width
----- HyperTalk script -----
on mousedown
put PopUpMenu("1;2;3;4;5;6;7;8;Other…", 0, the mouseV , the mouseH - 20) into which
if which is 0 then exit mousedown
if which is 9 then
ask "Please enter line width [1 to 8]:"
put it into fld myWidth
else
put which into fld myWidth
end if
end mousedown
-- part 6 (button)
-- low flags: 00
-- high flags: C002
-- rect: left=434 top=231 right=251 bottom=512
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 12
-- style flags: 256
-- line height: 16
-- part name: Last Line
----- HyperTalk script -----
on mousedown
put PopUpMenu("150;200;250;300;350;400;450;550;650;Other…", 0, the mouseV , the mouseH - 20) into which
if which is 0 then exit mousedown
if which is 1 then
put "150" into fld myendL
else if which is 2 then
put "200" into fld myendL
else if which is 3 then
put "250" into fld myendL
else if which is 4 then
put "300" into fld myendL
else if which is 5 then
put "350" into fld myendL
else if which is 6 then
put "400" into fld myendL
else if which is 7 then
put "450" into fld myendL
else if which is 8 then
put "550" into fld myendL
else if which is 9 then
put "650" into fld myendL
else if which is 10 then
ask "Please enter length of longest line:"
put it into fld myendL
end if
end mousedown
-- part 7 (button)
-- low flags: 00
-- high flags: C002
-- rect: left=434 top=180 right=199 bottom=512
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 12
-- style flags: 256
-- line height: 16
-- part name: First Line
----- HyperTalk script -----
on mousedown
put PopUpMenu("1;2;3;4;5;6;7;8;9;10;20;30,Other…", 0, the mouseV , the mouseH - 20) into which
if which is 0 then exit mousedown
if which is 11 then
put "20" into fld mystartL
else if which is 12 then
put "30" into fld mystartL
else if which is 13 then
ask "Enter pixel length of first line:"
put it into fld mystartL
else
put which into fld mystartL
end if
end mousedown
-- part 8 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=434 top=100 right=120 bottom=512
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 14
-- style flags: 256
-- line height: 18
-- part name: myincrement
-- part 9 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=434 top=150 right=170 bottom=512
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 14
-- style flags: 256
-- line height: 18
-- part name: myWidth
-- part 10 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=434 top=199 right=218 bottom=512
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 14
-- style flags: 256
-- line height: 18
-- part name: mystartL
-- part 11 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=434 top=251 right=270 bottom=512
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 14
-- style flags: 256
-- line height: 18
-- part name: myEndL
-- part 12 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=437 top=277 right=310 bottom=509
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 18
-- style flags: 256
-- line height: 24
-- part name: SPIRO!
----- HyperTalk script -----
on mouseUp
set the hilite of me to true
spiro
set the hilite of me to false
end mouseUp
-- part 13 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=437 top=318 right=338 bottom=509
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Clear All
----- HyperTalk script -----
on mouseUp
set the hilite of me to true
if the commandkey is down then
choose select tool
domenu "select all"
domenu "invert"
drag from 434,1 to 512,342
type numtochar(8)
choose browse tool
else
choose select tool
domenu "select all"
type numtochar(8)
end if
set the hilite of me to false
choose browse tool
end mouseUp