#!/bin/sh
# MetaCard 2.4 stack
# The following is not ASCII text,
# so now would be a good time to q out of more
exec mc $0 "$@"
revHappySnap Pon preOpenStack
put stackList() into btn "Stack" of stack "revHappySnap"
end preOpenStack
function stackList
put the openStacks into tStacks
if not (the hilite of btn "show revolution stacks" of stack "revPreferences") then
repeat with i=the number of lines of tStacks down to 1
if char 1 to 3 of line i of tStacks is "rev" then delete line i of tStacks
end repeat
end if
return tStacks
end stackList
on hideRev
put the openStacks into tStacks
if (the hilite of btn "hide") then
repeat with i=the number of lines of tStacks down to 1
if char 1 to 3 of line i of tStacks is "rev" and \
the visible of stack line i of tStacks then
hide stack line i of tStacks
put line i of tStacks & cr after tHiddenList
end if
end repeat
set the cHiddenList of this stack to tHiddenList
end if
end hideRev
on showRev
repeat for each line tLine in the cHiddenList of this stack
show stack tLine
end repeat
end showRev
on newImage
repeat with X=1 to the number of images
put the short name of image X into tName
put tName & cr after tImageList
end repeat
delete the last char of tImageList
put tImageList into fld "image list" of stack "revHappySnap"
set the hilitedLine of fld "image list" of stack "revHappySnap" to 1
send mouseUp to fld "image list" of stack "revHappySnap"
updateImagePanel line 1 of tImageList
end newImage
on upDateImagePanel tImage
if tImage <> "" then
set the useSystemDate to true
put word -1 of tImage into tImageDate
convert tImageDate to abbrev date and time
put "
" into tXML
set the xmlText of fld "display" of stack "revHappySnap" to tXML
else
put "" into fld "display" of stack "revHappySnap"
end if
end upDateImagePanel
on resizeStack
if the width of this stack < 495 then
set the topLeft of group "stack" to the bottomLeft of group "card"
else
set the topLeft of group "stack" to the topRight of group "Card"
end if
revUpdateGeometry
end resizeStack
on revPreOpenStack
put stackList() into btn "Stack"
end revPreOpenStack
on revCloseStack
put stackList() into btn "Stack"
end revCloseStack
on revResumeStack
put stackList() into btn "Stack"
end revResumeStack
revstack falsecHiddenList