#!/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 "$@"
revAltPlugin 1 local lAltChecking
on preOpenStack
if the short name of the owner of the target is "revAltPlugin" then
#clearIcons
checkForLibURL
start using stack "revAltLib"
initSnictRect
#openStack
end if
end preOpenStack
on openStack
--breakpoint
if the short name of the owner of the target is "revAltPlugin" then
--hide stack altPlugin
initStackRect
if there is a stack "revMenubar" then
if the platform is "MacOS" then
send "setMacProfile true" to stack "revAltPlugin" in 30 milliseconds
else
send "setMacProfile false" to stack "revAltPlugin" in 30 milliseconds
end if
end if
loadInterfaceSettings
send initIcons to me in 30 milliseconds
end if
end openStack
on checkForLibURL
try
get libURLVersion()
catch tErr
start using stack "libURL"
end try
end checkForLibURL
on loadInterfaceSettings
put getPrefsFile() into tPrefs
put getTagData(tPrefs,"interface") into tPrefs
if tPrefs contains tab then
replace tab with cr in tPrefs
put last line of tPrefs into tAutoUpdate
if tAutoUpdate contains "true" then
put true into tAutoUpdate
else
put false into tAutoUpdate
end if
delete last line of tPrefs
lock messages
set the hilite of btn "autoUpdate" of stack "revAltPluginPrefs" to tAutoUpdate
set the altAutoUpdate of stack "revAltPlugin" to tAutoUpdate
unlock messages
put last line of tPrefs into tAutoResizeFlag
if tAutoResizeFlag contains "false" then
put false into tAutoResizeFlag
else
put true into tAutoResizeFlag
end if
delete last line of tPrefs
lock messages
set the hilite of btn "auto-size window" of stack "revAltPluginPrefs" to tAutoResizeFlag
set the altAutoSize of stack "revAltPlugin" to tAutoResizeFlag
unlock messages
repeat for each line L in tPrefs
put item 1 of L into tPropName
put item 2 of L into tPropVal
put "set the " & tPropName & " of stack " "e& "revAltPlugin" "e& " to " & tPropVal into tDo
do tDo
end repeat
end if
end loadInterfaceSettings
on saveInterfaceSettings
put "" into tPref
put "altIconHeight," & the altIconHeight of stack "revAltPlugin" & "|" after tPref
put "altIconWidth," & the altIconWidth of stack "revAltPlugin" & "|" after tPref
put "altLeftBorder," & the altLeftBorder of stack "revAltPlugin" & "|" after tPref
put "altTopBorder," & the altTopBorder of stack "revAltPlugin" & "|" after tPref
put "altRightBorder," & the altRightBorder of stack "revAltPlugin" & "|" after tPref
put "altBotBorder," & the altBotBorder of stack "revAltPlugin" & "|" after tPref
put "altIconHpad," & the altIconHpad of stack "revAltPlugin" & "|" after tPref
put "altIconVpad," & the altIconVpad of stack "revAltPlugin" & "|" after tPref
put "altHiliteButtonBorderSize," & the altHiliteButtonBorderSize of stack "revAltPlugin" & "|" after tPref
put "altAutoSize," & the altAutoSize of stack "revAltPlugin" & "|" after tPref
put "altAutoUpdate," & the altAutoUpdate of stack "revAltPlugin" & "|" after tPref
delete last char of tPref
put "" after tPref
put getPrefsFile() into tPrefs2
filter tPrefs2 without "*"
put cr & tPref after tPrefs2
put the altPlugsFolderPath of stack "revAltPlugin" & "/altPrefs.txt" into tURL
put tPrefs2 into URL ("file:" & tURL)
end saveInterfaceSettings
on setStackRect pRect
if pRect is empty then
put the rect of stack "revAltPlugin" into pRect
end if
--> NEED TO LOCK MESSAGES SO THE resizeStack HANDLER IS NOT CALLED
lock messages
set the rect of stack "revAltPlugin" to pRect
calculateIconPositions
SizeStackToContents
resizeInterface
unlock messages
end setStackRect
function getPrefsFile
--> NEED TO GET THE RECT OF THIS STACK FROM THE PREFS
-- put the altPlugsFolderPath of stack "revAltPlugin" into tPath
-- put tPath & "/altPrefs.txt" into tPath
-- return URL ("file:" & tPath)
get the effective filename of stack "revAltPlugin"
set itemDel to "/"
delete last item of it
put it into tPath
put tPath & "/altPlugs" into tPath
if there is not a folder tPath then
create folder tPath
set the altPlugsFolderPath of stack "revAltPlugin" to tPath
end if
put tPath & "/altPrefs.txt" into tPath
if there is a file tPath then
put URL ("file:" & tPath) into tPrefs
put getTagData(tPrefs,"version") into tVersion
--> CHECK TO SEE IF NEW VERSION
--> IF IT IS, THEN NEED TO SAVE THE STACK IN
--> ORDER FOR IT TO REMEMBER THE RESIZE
if tVersion <> fld "Vers" of stack "revAltPlugin" then
save stack "revAltPlugin"
end if
return tPrefs
else
return ""
end if
-- put it into tNewDF
-- put the defaultFolder into tOldDF
-- set the defaultFolder to tNewDF
--
-- if there is not a folder "altPlugs" then create folder "altPlugs"
-- set the defaultFolder to tNewDF & "/altPlugs"
--
-- set the altPlugsFolderPath of stack "revAltPlugin" to the defaultFolder
--
-- --> CHECK TO SEE IF A PREFS FILE EXISTS
-- if there is a file "altPrefs.txt" then
-- set the defaultFolder to tOldDF
-- return URL "file:altPrefs.txt" into tPrefs
-- else
-- set the defaultFolder to tOldDF
-- return ""
-- end if
end getPrefsFile
on initStackRect
put getTagData(getPrefsFile(),"rect") into tTL
if tTL contains "," then
set the altStartupRect of stack "revAltPlugin" to tTL
else
set the altStartupRect of stack "revAltPlugin" to ""
end if
set the defaultFolder to tOldDF
end initStackRect
on blinkLight p
if p is true then
set the repeatCount of img "update.gif" of stack "revAltPlugin"to -1
show img "update.gif" of stack "revAltPlugin"
else
hide img "update.gif" of stack "revAltPlugin"
set the repeatCount of img "update.gif" of stack "revAltPlugin" to 0
end if
end blinkLight
on closeStack
--put the short name of the owner of the target
if the short name of the owner of the target is "revAltPlugin" then
saveStackRect
saveInterfaceSettings
blinkLight false
stripAndShip
clearAltLib
stop using stack "revAltLib"
close stack "revAltPluginPrefs"
--save stack "revAltPlugin"
--> THIS KEEPS THE IDE FROM CRASHING!!!!
set the breakpoints to empty
end if
end closeStack
on saveStackRect
--> WRITE THE STACK TOPLEFT TO PREFS
put the rect of stack "revAltPlugin" into tRect
put the altPlugsFolderPath of stack "revAltPlugin" into tPath
put tPath & "/altPrefs.txt" into tPath
put URL ("file:" & tPath) into tPrefs
filter tPrefs without "*"
put cr & "" & tRect & "" after tPrefs
put tPrefs into URL("file:" & tPath)
end saveStackRect
on checkForUpdates
blinkLight false
--put "checking for updates to altPlugin"
set cursor to busy
--> FIRST CHECK FOR UPDATE TO altPlugin
put fld "vers" of stack "revAltPlugin" into tVers
--> GET THE EXISTING PLUGIN LIST DATA
put fld "pluginList" of stack "revAltPluginPrefs" into tPluginListData
put the altUpdateURL of stack "revAltPlugin" into tUpdateURL
put altGetURL(tUpdateURL) into tData
if line 1 of tData contains " GOT GOOD DATA
put getTagData(tData,"Version") into tVers2
switch
case tVers2 <> tVers
put the altUpdateMsg of stack "revAltPlugin" into tMsg
go inv stack "answer Dialog"
set the loc of stack "answer Dialog" to the screenloc
show stack "answer Dialog"
answer information tMsg with "Not Now" or "Get It"
if it is "Get It" then
put getTagData(tData,"UpdateURL") into UpdateURL
put the effective filename of stack "revAltPlugin" into tPath
--> DOWNLOAD NEW VERSION OF ALTPLUGIN
downloadToolbar UpdateURL,tPath
-- put URL UpdateURL into URL ("binfile:" & tPath)
-- revGoURL UpdateURL
-- set the destroyStack of stack "revAltPlugin" to true
-- set the destroyWindow of stack "revAltPlugin" to true
--send closestack to stack "revAltPlugin" in 2 seconds
exit to top
end if
break
case tVers2 = tVers
--put "Current" into item 4 of L
break
end switch
else
--> NO GOOD URL
--put "Error" into item 4 of L
end if
--> ITEM 1 IS SHORT NAME OF PLUGIN
--> ITEM 2 IS ON/OFF
--> ITEM 3 IS VERSION
--> ITEM 4 IS UPDATE STATUS
--> ITEM 5 IS LONG NAME OF PLUGIN
--> ITEM 6 IS UPDATE URL
set itemDel to tab
--> WALK THRU EACH PLUGIN AND CHECK TO SEE IF IT HAS AN UpdateURL
repeat for each line L in tPluginListData
set cursor to busy
put item 6 of L into tUpdateURL
if tUpdateURL is not empty and char 1 to 7 of tUpdateURL is "http://" then
--> UpdateURL EXISTS, NOW CHECK IT AGAINST THE VERSION
put item 3 of L into tVers
put altGetURL(tUpdateURL) into tData
#replace numTochar(13) with "" in tData
if line 1 of tData contains " GOT GOOD DATA
put getTagData(tData,"Version") into tVers2
switch
case tVers2 = ""
put "?" into item 4 of L
break
case tVers2 <> tVers
put "Available" into item 4 of L
blinkLight true
break
case tVers2 = tVers
put "Current" into item 4 of L
break
end switch
else
--> NO GOOD URL
put "Error" into item 4 of L
end if
else
--> THIS PLUGIN IS NOT UPDATABLE
put "N/A" into item 4 of L
end if
put L & cr after tList
end repeat
delete last char of tList
put tList into fld "pluginList" of stack "revAltPluginPrefs"
--> CHECK TO SEE IF THIS IS A MANUAL UPDATE FROM THE MENU
if the vis of img "update.gif" of stack "revAltPlugin" then
if "altMenu" is in the target then
put "showtab " & quote & "Plugins" & quote into tDo
send tDo to cd 1 of stack "revAltPluginPrefs"
palette stack "revAltPluginPrefs"
end if
end if
end checkForUpdates
on downloadToolbar pURL,pFilePath
put "Trying to download new update...please wait"
blinkLight true
put the altNumTry of stack "revAltLib" into tNumTrys
put pFilePath & ".1" into tPath
repeat tNumTrys times
put URL pURL into URL ("binfile:"& tPath)
if there is a file tPath then
put true into tSuccessDL
--> CHECK THE SIZE OF A FILE
--> SOMETIMES IT WILL DOWNLOAD A FILE BUT IT WILL BE TOO SMALL
if altFileSize(tPath) > 500 then
blinkLight false
go inv stack "answer Dialog"
set the loc of stack "answer Dialog" to the screenloc
show stack "answer Dialog"
answer information " altPlugin successfully downloaded to:" &cr& pFilePath
put URL ("binfile:" & tPath) into URL ("binfile:" & pFilePath)
delete file tPath
go inv stack "answer Dialog"
set the loc of stack "answer Dialog" to the screenloc
show stack "answer Dialog"
answer information "Please Quit RunRev and relaunch to see changes."
revert
exit to top
else
--> DELETE THE 'TOO SMALL' FILE
delete file tPath
end if
end if
altDebug "Could not Download Application...Try:" && tNumTrys
end repeat
blinkLight false
if tSuccessDL is not true then
go inv stack "answer Dialog"
set the loc of stack "answer Dialog" to the screenloc
show stack "answer Dialog"
answer warning "Could not download "& pFilePath &" Plugin. Try Again."
end if
put ""
end downloadToolBar
function altFileSize pPath
if there is a file pPath then
put the defaultFolder into tOldDF
if pPath contains "/" then --need to set the defaultFolder
get matchText(pPath,"(.*\/)",tFolderPath) -- gets the folderpath
get matchText(pPath,".*\/(.*?)$",pPath) -- gets the file name
set the defaultFolder to tFolderPath
end if
put the detailed files into tList
set the defaultFolder to tOldDF
put lineOffset(cr&pPath&",",cr&tList) into tLineNum
return (item 2 of line tLineNum of tList)
else
return "Error: File does not exist: " & pPath
end if
end altFileSize
on setMacProfile p
if p is true then
revSetStackProfile "mac","revAltPlugin"
revSetStackProfile "mac","revAltPluginPrefs"
#put " Mac profile SET!!"
else
revSetStackProfile "Master","revAltPlugin"
revSetStackProfile "Master","revAltPluginPrefs"
#put " PC profile SET!!"
end if
end setMacProfile
on initSnictRect
if version() < "2.7.0" then
put item 1 of the windowBoundingRect into tLeft
put item 2 of the windowBoundingRect into tTop
put item 3 of the windowBoundingRect into tRight
put item 4 of the windowBoundingRect into tBottom
if the platform is "MacOS" then
set the altScreenRect of this stack to \
0,22,tRight,tBottom
else --> WINDOWS
set the altScreenRect of this stack to \
0,0,item 3 of the screenrect,item 4 of the screenrect - 34
end if
else
put 0 into tLeft
put 0 into tRight
put 0 into tTop
put 0 into tBottom
do "put the screenRects into tRects"
repeat for each line L in tRects
put min(tLeft,item 1 of L) into tLeft
put min(tTop,item 2 of L) into tTop
put max(tRight,item 3 of L) into tRight
put max(tBottom,item 4 of L) into tBottom
end repeat
if the platform is "MacOS" then
set the altScreenRect of this stack to \
tLeft,tTop+22,tRight,tBottom
else --> WINDOWS
set the altScreenRect of this stack to \
tLeft,tTop,tRight,tBottom - 34
end if
end if
end initSnictRect
on resetPlugins
put the defaultFolder into tOldDF
set the defaultFolder to the altPlugsFolderPath of stack "revAltPlugin"
if there is a file "altPrefs.txt" then delete file "altPrefs.txt"
set the defaultFolder to tOldDF
initIcons
end resetPlugins
on clearIcons
repeat with x = the number of imgs on this cd down to 1
if the short name of img x is "altPlug.png" then delete img x
end repeat
end clearIcons
function getTagData theTagData,theTagName
filter theTagData with "<" & theTagName & ">*"
replace "<" & theTagName & ">" with "" in theTagData
replace "" & theTagName & "> " with "" in theTagData
replace "" & theTagName & ">" with "" in theTagData
replace "|" with tab in theTagData
replace "\" with return in theTagData
replace "/***---***/" with "" in theTagData
replace "
" with "" in theTagData
return theTagData
end getTagData
on parsePrefs pPrefs
--> CALLED FROM initIcons WHEN PREFS FILE IS PRESENT
get the effective filename of stack "revAltPlugin"
set itemDel to "/"
delete last item of it
put it into tNewDF
put the defaultFolder into tOldDF
set the defaultFolder to tNewDF
if there is not a folder "altPlugs" then create folder "altPlugs"
set the defaultFolder to tNewDF & "/altPlugs"
put getTagData(pPrefs,"stack") into tPrefList
put the altStartPrefs of stack "revAltPlugin" & cr into tPrefs
set itemDel to tab
--> WALK THE LIST OF STACKS, VERSION...
lock screen
repeat for each line L in tPrefList
put item 1 of L into tStackName
put item 2 of L into tVers
delete char 1 to 8 of tVers
put item 3 of L into tIsEnabled
delete char 1 to 10 of tIsEnabled
put item 4 of L into tUpdateURL
delete char 1 to 10 of tUpdateURL
-- --> BUILD VARIABLE WITH ALL OF THE UPDATE URLs
-- if tUpdateURL is not among the lines of the altURLupdates of stack "revAltPlugin" then
-- get the altURLupdates of stack "revAltPlugin"
-- put cr & tUpdateURL after it
-- set the altURLupdates of stack "revAltPlugin" to it
-- end if
lock messages
if there is a stack tStackName then
put tStackName & cr after tStackList
if tIsEnabled is not false then
--> SHOW THIS STACK ICON
if there is a img "altPlug.png" of stack tStackName then
--> IT IS AN ALTPLUGIN
--> DOES AN ICON FILE EXIST FOR THIS PLUGIN?
--> IF SO, THEN USE IT INSTEAD OF altPlug.png
set itemDel to "/"
put last item of tStackName into tImgFile
set itemDel to "."
put item 1 of tImgFile & ".png" into tImgFile
set itemDel to tab
if there is a file tImgFile then
--> USE THE FILE ICON
import paint from file tImgFile
set the name of last img to "altPlug.png"
set the customProperties of last img to the customProperties of img "altPlug.png" of stack tStackName
--> SOMETIMES AN altPlugin DOESN'T RESIDE IN THE PLUGIN FOLDER SO
--> WE NEED TO SET THE CORRECT PATH ON THE TOOLBAR ICON
set the altPlugFileName of last img to tStackName
#set the altOpenVisible of last img to true
else
--> USE THE altPlug.png ICON
copy img "altPlug.png" of stack tStackName to stack "revAltPlugin"
--> SOMETIMES AN altPlugin DOESN'T RESIDE IN THE PLUGIN FOLDER SO
--> WE NEED TO SET THE CORRECT PATH ON THE TOOLBAR ICON
set the altPlugFileName of last img to tStackName
end if
put the altVers of img "altPlug.png" of stack tStackName into tVers
if tVers is empty then put "N/A" into tVers
put the altUpdateURL of img "altPlug.png" of stack tStackName into tUpdateURL
if tUpdateURL is empty then put "N/A" into tUpdateURL
-- if there is a fld "vers" of stack tStackName then put fld "vers" of stack tStackName into tVers
-- if there is a fld "UpdateURL" of stack tStackName then put fld "UpdateURL" of stack tStackName into tUpdateURL
--> BUILD tPrefs VARIABLE
put "" &tStackName & "|Version:" & tVers & "|IsEnabled:true" & "|UpdateURL:" & tUpdateURL & "" & cr after tPrefs
else
--> NOT SURE WHERE IT HAS COME FROM, SO MAKE AN ICON FOR IT ANYWAY
set itemDel to "/"
put last item of tStackName into tToolTip
set itemDel to tab
--> CHECK TO SEE IF AN ICON ALREADY EXISTS FOR THIS STACK
set itemDel to "."
put item 1 of tToolTip & ".png" into tImgFile
set itemDel to tab
if there is a file tImgFile then
import paint from file tImgFile
else
copy img "templateAltPlug.png" of cd "resources" of stack "revAltPlugin" to this cd
end if
set the name of last img to "altPlug.png"
set the altPlugFileName of last img to tStackName
set the altOpenVisible of last img to true
-->SET THE TOOLTIP FOR THIS ICON
put tStackName into tToolTip
set the tooltip of last img to tToolTip
--> BUILD tPrefs VARIABLE
put "" &tStackName& "|" & "Version:" & "N/A|" & "IsEnabled:"&tIsEnabled & "|UpdateURL:N/A" & "" & cr after tPrefs
end if
else
--> NOT ENABLED, BUT WE STILL NEED TO ADD IT TO THE PREFS FILE
put "" &tStackName& "|" & "Version:" & tVers & "|" & "IsEnabled:false|UpdateURL:N/A" & "" & cr after tPrefs
end if
set the destroyStack of stack tStackName to true
set the destroyWindow of stack tStackName to true
delete stack tStackName
unlock messages
end if
end repeat
--> NOW CHECK TO SEE IF THERE ARE ANY NEW STACKS IN THE altPlugs FOLDER
put the files into tFiles
sort lines of tFiles
repeat for each line L in tFiles
--> CHECK TO SEE IF THIS STACK IS ALREADY IN altPrefs.txt
if L is among the lines of tStackList then next repeat
#if char -4 to -1 of L is ".rev" then
if isStack(L) then
if there is a img "altPlug.png" of stack L then
--> IT'S A PLUGIN
lock messages
copy img "altPlug.png" of stack L to stack "revAltPlugin"
if there is a fld "vers" of stack L then put fld "vers" of stack L into tVers
delete stack L
unlock messages
--> BUILD tPrefs VARIABLE
put "" &L& "|" & "Version:" & tVers & "" & cr after tPrefs
else
--> NOT SURE WHERE IT HAS COME FROM, SO MAKE AN ICON FOR IT ANYWAY
copy img "templatealtPlug.png" of cd "resources" of stack "revAltPlugin" to this cd
set the name of last img to "altPlug.png"
set the altPlugFileName of last img to L
set the altOpenVisible of last img to true
set the tooltip of last img to L
--> BUILD tPrefs VARIABLE
put "" &L& "|" & "Version:" & "" & cr after tPrefs
end if
end if
end repeat
unlock screen
set the defaultFolder to tOldDF
put the rect of stack "revAltPlugin" into tRect
put "" & fld "Vers" of stack "revAltPlugin" & "" & cr after tPrefs
put "" & tRect & "" after tPrefs
#delete last char of tPrefs
put tPrefs into URL "file:altPrefs.txt"
set the layer of btn "btnBorder" to top
hide btn "btnBorder"
get the altIconWidth of stack "revAltPlugin"
set the altIconWidth of stack "revAltPlugin" to it
get the altIconHeight of stack "revAltPlugin"
set the altIconHeight of stack "revAltPlugin" to it
setStackRect the altStartupRect of stack "revAltPlugin"
set the altStartupRect of stack "revAltPlugin" to ""
saveStackRect
saveInterfaceSettings
-- calculateIconPositions
-- sizeStackToContents
-- resizeInterface
end parsePrefs
on buildPrefs
--> CALLED FROM initIcons WHEN NO PREFS FILE IS PRESENT
--> NEED TO SAVE STACK FIRST TIME BECAUSE IT NEEDS TO BE SAVED IN
--> NATIVE FORMAT FOR MAC AND PC IN ORDER TO RESIZE PROPERLY
save stack "revAltPlugin"
put the defaultFolder into tOldDF
set the defaultFolder to the altPlugsFolderPath of stack "revAltPlugin"
put the altStartPrefs of stack "revAltPlugin" & cr into tPrefs
--> GET THE PLUGINS FROM THE FILE FOLDER
put the files into tFiles
sort lines of tFiles
repeat for each line L in tFiles
#if char -4 to -1 of L is ".rev" then
if isStack(L) then
if there is a img "altPlug.png" of stack L then
--> IT'S A WELL FORMED altPlugin PLUGIN
lock messages
--> DOES AN ICON FILE EXIST FOR THIS PLUGIN?
--> IF SO, THEN USE IT INSTEAD OF altPlug.png
set itemDel to "."
put item 1 of L & ".png" into tImgFile
if there is a file tImgFile then
--> USE THE FILE ICON
import paint from file tImgFile
set the name of last img to "altPlug.png"
set the customProperties of last img to the customProperties of img "altPlug.png" of stack L
else
--> USE THE altPlug.png ICON
copy img "altPlug.png" of stack L to stack "revAltPlugin"
end if
put the altVers of img "altPlug.png" of stack L into tVers
if tVers is empty then put "N/A" into tVers
put the altUpdateURL of img "altPlug.png" of stack L into tUpdateURL
if tUpdateURL is empty then put "N/A" into tUpdateURL
-- if there is a fld "vers" of stack L then
-- put fld "vers" of stack L into tVers
-- else
-- put "N/A" into tVers
-- end if
-- if there is a fld "updateURL" of stack L then
-- put fld "updateURL" of stack L into tUpdateURL
-- else
-- put "N/A" into tUpdateURL
-- end if
delete stack L
unlock messages
--> BUILD tPrefs VARIABLE
put "" &L& "|" & "Version:" & tVers & "|IsEnabled:true|UpdateURL:" & tUpdateURL & "" & cr after tPrefs
else
--> NOT SURE WHERE IT HAS COME FROM, SO MAKE AN ICON FOR IT ANYWAY
--> DOES AN ICON ALREADY EXIST?
set itemDel to "."
put item 1 of L & ".png" into tImgFile
if there is a file tImgFile then
import paint from file tImgFile
else
copy img "templateAltPlug.png" of cd "resources" of stack "revAltPlugin" to this cd
end if
set the name of last img to "altPlug.png"
set the altPlugFileName of last img to L
set the altOpenVisible of last img to true
set the tooltip of last img to L
--> BUILD tPrefs VARIABLE
put "" &L& "|" & "Version:N/A" & "|IsEnabled:true|UpdateURL:N/A" & "" & cr after tPrefs
end if
end if
end repeat
set the defaultFolder to tOldDF
put "" & fld "Vers" of stack "revAltPlugin" & "" after tPrefs
put tPrefs into URL "file:altPrefs.txt"
end buildPrefs
on initIcons
if there is not a stack "revMenuBar" then palette "revAltPlugin"
set the defaultStack to "revAltPlugin"
clearIcons
get the effective filename of stack "revAltPlugin"
set itemDel to "/"
delete last item of it
put it into tNewDF
put the defaultFolder into tOldDF
set the defaultFolder to tNewDF
if there is not a folder "altPlugs" then create folder "altPlugs"
set the defaultFolder to tNewDF & "/altPlugs"
set the altPlugsFolderPath of stack "revAltPlugin" to the defaultFolder
--> CHECK TO SEE IF A PREFS FILE EXISTS
if there is a file "altPrefs.txt" then
put URL "file:altPrefs.txt" into tPrefs
parsePrefs tPrefs
else
--> NO PREFS FILE
buildPrefs
get the altIconWidth of stack "revAltPlugin"
set the altIconWidth of stack "revAltPlugin" to it
get the altIconHeight of stack "revAltPlugin"
set the altIconHeight of stack "revAltPlugin" to it
set the layer of btn "btnBorder" to top
hide btn "btnBorder"
--set the rect of stack "revAltPlugin" to the altStartupRect of of stack "revAltPlugin"
calculateIconPositions
sizeStackToContents
resizeInterface
end if
set the defaultFolder to tOldDF
-- if the hilite of btn "autoUpdate" of stack "revAltPluginPrefs" then
-- checkForUpdates
-- end if
send "getPluginInfo" to card 1 of stack "revaltPluginPrefs"
--show stack "revAltPlugin"
end initIcons
on stripAndShip pVal
answer "After this, resize the width to this stack to ~300 pixels, with the shiftKey down to keep from snapping back to minimum size"
set the width of img "titlebar.jpg" to the width of this cd
set the right of img "rightBorder.png" to the right of this cd
set the width of img "whiteSurfaceMask.png" to the width of this cd
set the height of img "whiteSurfaceMask.png" to the height of this cd
set the topLeft of img "whiteSurfaceMask.png" to the topLeft of this cd
blinkLight false
put "" into fld "pluginList" of stack "revAltPluginPrefs"
if pVal then
unhilite btn "autoUpdate" of stack "revAltPluginPrefs"
hilite btn "auto-size window" of stack "revAltPluginPrefs"
end if
clearIcons
clearAltLib
doneResizing
end stripAndShip
on doneResizing
put false into lAltChecking
SizeStackToContents
resizeInterface
end doneResizing
on CheckMouseState
put true into lAltChecking
if the mouse is up then
doneResizing
else
send CheckMouseState to me in 10 milliseconds
end if
end CheckMouseState
on resizeStack
if the short name of the owner of the target is "revAltPlugin" then
resizeInterface
calculateIconPositions
if lAltChecking <> true then
CheckMouseState
end if
end if
pass resizeStack
end resizeStack
on resizeInterface
--> MOVE STACK INTERFACE ELEMENTS
get the rect of this cd
set the width of img "titlebar.jpg" to item 3 of it
set the rect of img "leftBorder.png" to \
1,13,11,item 4 of it
set the rect of img "rightBorder.png" to \
item 3 of it - 11,13,item 3 of it -1,item 4 of it
set the rect of img "whiteSurfaceMask.png" to \
0,13,item 3 of it, item 4 of it
if the width of this cd > 200 then
show fld "vers"
set the right of fld "vers" to max(the right of this cd - 5,60)
else
hide fld "vers"
end if
set the bottomRight of img "dragWd.png" to item 3 of it -1, item 4 of it -1
end resizeInterface
on SizeStackToContents
if the shiftKey is down then exit SizeStackToContents
if the altAutoSize of stack "revAltPlugin" is true then
put the altIconVpad of stack "revAltPlugin" into tIconVpad
put the altIconHpad of stack "revAltPlugin" into tIconHpad
put the altLeftBorder of stack "revAltPlugin" into tLeftBorder
put the altRightBorder of stack "revAltPlugin" into tRightBorder
put the altTopBorder of stack "revAltPlugin" into tTopBorder
put the altBotBorder of stack "revAltPlugin" into tBotBorder
put the altIconHeight of stack "revAltPlugin" into tIconHeight
put the altIconWidth of stack "revAltPlugin" into tIconWidth
put 20 into tRight
put 20 into tBot
repeat with x = 1 to the number of imgs on this cd
if the short name of img x is "altPlug.png" then
if the right of img x > tRight then put the right of img x into tRight
if the bottom of img x > tBot then put the bottom of img x into tBot
end if
end repeat
get the rect of stack "revAltPlugin"
--> NEED TO LOCK MESSAGES SO NO MORE resizeStack MESSAGES ARE SENT
lock messages
set the rect of stack "revAltPlugin" to \
item 1 of it, \
item 2 of it, \
item 1 of it + max(the minWidth of stack "revAltPlugin",tRight + tIconHpad + tRightBorder), \
item 2 of it + max(the minHeight of stack "revAltPlugin",tBot + tIconVpad + tBotBorder)
unlock messages
end if
end SizeStackToContents
on calculateIconPositions
--> CALCULATE ICON POSITIONS
put the altIconVpad of stack "revAltPlugin" into tIconVpad
put the altIconHpad of stack "revAltPlugin" into tIconHpad
put the altLeftBorder of stack "revAltPlugin" into tLeftBorder
put the altRightBorder of stack "revAltPlugin" into tRightBorder
put the altTopBorder of stack "revAltPlugin" into tTopBorder
put the altBotBorder of stack "revAltPlugin" into tBotBorder
put the altIconHeight of stack "revAltPlugin" into tIconHeight
put the altIconWidth of stack "revAltPlugin" into tIconWidth
put the width of stack "revAltPlugin" into tStackWidth
put the height of stack "revAltPlugin" into tHeightWidth
--> CALCULATE THE MINIMUM AND CURRENT ROW WIDTH
put tLeftBorder + tRightBorder + (tIconHpad*2) into tCurrentRowWidth
put tLeftBorder + tRightBorder + (tIconHpad*2) into tMinimumRowWidth
--> POINTER TO LEFT POSITION
put tLeftBorder + tIconHPad into tLeftPos
put tLeftPos into tBeginLeftPos
--> POINTER TO TOP POSITION
put tTopBorder + tIconVpad into tTopPos
repeat with x = 1 to the number of imgs on this cd
if the short name of img x is "altPlug.png" then
--> SET THE ICON HEIGHT AND WIDTH
set the height of img x to tIconHeight
set the width of img x to tIconWidth
--> TRY AND PUT ALL ICONS ON FIRST ROW
if tCurrentRowWidth + tIconWidth <= tStackWidth or tCurrentRowWidth = tMinimumRowWidth then
--> PLACE AN ICON ON THIS ROW
set the topLeft of img x to tLeftPos,tTopPos
--> UPDATE tLeftPos AND tCurrentRowWidth
put tLeftPos + tIconWidth + tIconHpad into tLeftPos
put tCurrentRowWidth + tIconWidth + tIconHpad into tCurrentRowWidth
else
--> ALL ICONS CANNOT FIT ON THIS ROW, SO PUT THEM ON THE NEXT ROW
put tTopPos + tIconVpad + tIconHeight into tTopPos
put tMinimumRowWidth into tCurrentRowWidth
put tBeginLeftPos into tLeftPos
--> PLACE AN ICON ON THIS ROW
set the topLeft of img x to tLeftPos,tTopPos
--> UPDATE tLeftPos AND tCurrentRowWidth
put tLeftPos + tIconWidth + tIconHpad into tLeftPos
put tCurrentRowWidth + tIconWidth + tIconHpad into tCurrentRowWidth
end if
end if
end repeat
end calculateIconPositions
on refreshIcons
--> CALLED WHEN NOT RESIZING THE WINDOW...USED FOR PREFS SETTINGS
calculateIconPositions
set the altHiliteButtonBorderSize of stack "revAltPlugin" to the altHiliteButtonBorderSize of stack "revAltPlugin"
end refreshIcons
setProp altHiliteButtonBorderSize pVal
set the width of btn "btnBorder" to the altIconWidth of stack "revAltPlugin" + 2*pVal
set the height of btn "btnBorder" to the altIconHeight of stack "revAltPlugin" + 2*pVal
pass altHiliteButtonBorderSize
end altHiliteButtonBorderSize
setProp altAutoUpdate pVal
if pVal is true then
set the hilite of btn "autoUpdate" of stack "revAltPluginPrefs" to true
else
set the hilite of btn "autoUpdate" of stack "revAltPluginPrefs" to false
end if
pass altAutoUpdate
end altAutoUpdate
setProp altIconWidth pVal
repeat with x = 1 to the number of imgs on this cd
if the short name of img x is "altPlug.png" then
set the resizeQuality of img x to "best"
set the width of img x to pVal
end if
end repeat
setMinMaxStackSize
pass altIconWidth
end altIconWidth
setProp altIconHeight pVal
repeat with x = 1 to the number of imgs on this cd
if the short name of img x is "altPlug.png" then
set the resizeQuality of img x to "best"
set the height of img x to pVal
end if
end repeat
setMinMaxStackSize
pass altIconHeight
end altIconHeight
on setMinMaxStackSize
put the altIconVpad of stack "revAltPlugin" into tIconVpad
put the altIconHpad of stack "revAltPlugin" into tIconHpad
put the altLeftBorder of stack "revAltPlugin" into tLeftBorder
put the altRightBorder of stack "revAltPlugin" into tRightBorder
put the altTopBorder of stack "revAltPlugin" into tTopBorder
put the altBotBorder of stack "revAltPlugin" into tBotBorder
put the altIconHeight of stack "revAltPlugin" into tIconHeight
put the altIconWidth of stack "revAltPlugin" into tIconWidth
set the minHeight of stack "revAltPlugin" to \
max(40,tTopBorder + tIconVpad + tIconHeight + tIconVpad +tBotBorder)
set the minWidth of stack "revAltPlugin" to \
max(40,tLeftBorder + tIconHpad + tIconWidth + tIconHpad + tRightBorder)
end setMinMaxStackSize
on answerVersion pWhere
if exists(stack "revMenuBar") then
put "RunRev version: " & revAppVersion() & return & "MetaCard engine version: " & the version & return & "Build Number: " & the buildNumber into theMsg
else
put "MetaCard engine version: " & the version & return & "Build Number: " & the buildNumber into theMsg
end if
if pWhere is empty then
--put theMsg
else
go inv stack "answer Dialog"
set the loc of stack "answer Dialog" to the screenloc
show stack "answer Dialog"
answer information theMsg
end if
end answerVersion
function isStack tFile
lock messages
if exists(cd 1 of stack tFile) then
return true
else
return false
end if
end isStack
9 altURLupdates
N/A
altIconWidth 32altLeftBorder 4
altSnickt 14altScreenRect
0,0,1680,1016altDefaultInterfaceSettings altIconHeight,32
altIconWidth,32
altLeftBorder,4
altTopBorder,17
altRightBorder,4
altBotBorder,8
altIconHpad,4
altIconVpad,0
altHiliteButtonBorderSize,1
auto-size window,true
autoUpdate,truealtStartupRect
altUpdateMsg
There is an update to the altPlugin toolbar available.
You should install it.
If you chose to download it, please wait while the new version is downloaded. You will see a blinking light in the titlebar of altPluginToolbar.
Once downloaded, you will need to restart RunRev in order to use the new version.
altBotBorder 8altAutoUpdate falsealtStartPrefs
altUpdateURL 8http://www.gadgetplugins.com/altplugins/revAltPlugin.txtaltAutoSize truealtRightBorder 4
altTopBorder 17altIconHeight 32 altAbout @altPlugin
Created by Chipp Walters
Altuit, inc.
Version: *vers*altHiliteButtonBorderSize 1altIconVpad 0altPlugsFolderPath 2C:/Program Files/Revolution 2.6.1/plugins/altPlugsaltIconHpad 4 0 9
U ms sans serif U Webdings
U Tahoma U Tahoma U Lucida Grande U Tahoma U Webdings U Webdings U Tahoma cREVTempMaster +windowManagerPlace falsemenubar linkHiliteColor
cantAbort false maxWidth 65535rect 181,252,409,335 patterns
colors
decorations iconic falselinkVisitedColor shadow truecantDelete falseid 6645altId 0
hcAddressing falsestartUpIconic falsewindowShape 0title
linkColor cantModify false
textStyle plain
maxHeight 65535underlineLinks style topleveldestroyWindow true
liveresizing false password scroll 0passkey icon 0name revAltPlugin
resizable true
alwaysBuffer trueformatForPrinting falsevisible truemetal false minWidth 48
destroyStack true textSize 10 textFont Tahoma
dynamicPaths false
minHeight 57 cREVGeometryCache stackID 6545 cREVGeneral
debugObjects
cREVLoadInfo load startup main pon openCard
end openCard
on mouseMove
if the short name of the target is "altPlug.png" then
set the loc of btn "btnborder" to the loc of the target
show btn "btnborder"
else
hide btn "btnborder"
end if
end mouseMove
on mouseDown theButton
lock messages
if the short name of the target is "altPlug.png" then
set the topColor of btn "btnborder" to 0,0,55
set the bottomColor of btn "btnborder" to 0,204,255
-- if theButton is 3 then
-- --set the altRightClick of me to true
-- set the altTargetID of me to the id of the target
-- set the text of btn "altPlugMenu" to the altMenu of the target
-- show btn "altPlugMenu"
-- popup btn "altPlugMenu"
-- end if
end if
unlock messages
end mouseDown
on mouseDoubleDown
mouseDown
end mouseDoubleDown
on mouseUp theButton
if the short name of the target is "altPlug.png" then
set the topColor of btn "btnborder" to 0,204,255
set the bottomColor of btn "btnborder" to 0,0,55
--> CALCULATE PLUGIN STACK FILEPATH
put the altOpenVisible of the target into tShowStack
put the altPlugFileName of the target into tStackName
put the altOpenMode of the target into tShowMode
if tStackName contains "/" then
put tStackName into tFile
else
put the altPlugsFolderPath of this stack &"/"& tStackName into tFile
end if
--> CHECK FOR PLUGIN TYPE
put the altOnClickMe of the target into tToDoScript
if tToDoScript is not empty then
--> THIS IS AN altPlugin COMPATIBLE PLUGIN
put "send " & tToDoScript & " to stack " & quote & tFile & quote into tDo
switch
case tShowStack is true
--> SHOW THE PLUGIN STACK
switch tShowMode
case "modal"
modal stack tfile
break
case "modeless"
modeless stack tFile
break
default
palette stack tFile
end switch
set the destroyStack of stack tFile to true
set the destroyWindow of stack tFile to true
do tDo
break
case theButton is 3
--> RIGHT-CLICK SO TOPLEVEL THE STACK
switch tShowMode
case "modal"
modal stack tfile
break
case "modeless"
modeless stack tFile
break
default
palette stack tFile
end switch
set the destroyStack of stack tFile to true
set the destroyWindow of stack tFile to true
break
default
--> DON'T SHOW THE STACK BUT EXECUTE THE tDo
hide stack tFile
do tDo
delete stack tFile
end switch
else
--> THIS IS NOT A COMPATIBLE PLUGIN
switch
case theButton is 3
--> RIGHT-CLICK SO TOPLEVEL THE STACK
palette stack tFile
set the destroyStack of stack tFile to true
set the destroyWindow of stack tFile to true
break
case tShowStack is true
--> SHOW THE PLUGIN STACK
palette stack tFile
set the destroyStack of stack tFile to true
set the destroyWindow of stack tFile to true
break
default
--> DON'T SHOW THE STACK
hide stack tFile
delete stack tFile
end switch
end if
end if
end mouseUp
on mouseDoubleUp
mouseUp
end mouseDoubleUp
on mouseLeave
if the short name of the target is "altPlug.png" then
set the topColor of btn "btnborder" to 0,204,255
set the bottomColor of btn "btnborder" to 0,0,55
end if
end mouseLeave
9 cREVTempMaster dontSearch falsemark falsethreeD falserect
0,0,228,83defaultButton patterns
1004
colors
cantDelete falseid 1002altId 0
textStyle name mainlayer 1borderWidth 1showBorder true textSize textFont cREVGeometryCacheIDs 1094624006907 14881042863728115 65411073217855747 65291094624006908 14891094624006910 14911094624006909 14901094624006911 65281080977464842 65271076563635864 65331094624006912 65361042874011522 65301094624006913 65371078221181007 65311043057004383 65351094624006914 65381094624006915 10241042870520939 65341077737134130 65431079516919941 65421073544156263 65321073605252603 65391087516840010 65261094169363209 65451094624006901 10081094624006902 10341094624006903 10101094624006904 10111094624006905 10121094624006906 10331072785373732 65401085607553430 6544 cREVGeometryCache total 31order cREVGeneral breakPoints showAsHandlers false
resources @ 0 cREVTempMaster dontSearch falsemark falsethreeD truerect
0,0,48,249defaultButton patterns
colors
cantDelete falseid 1003altId 0
textStyle name resourceslayer 2borderWidth 2showBorder false textSize textFont , graphitepattern2.png @ 6<