REVO2700
revAltPlugin 1 X --> TO REV
--> CHANGE THE TEXT IN FLD VERS
--> STRIP AND SHIP
--> TO EDIT: CHANGE THE LOCALS BELOW TO MATCH THE STACK NAMES
local lAltChecking
local lPluginStack="revAltPlugin"
local lLogStack = "revAltPluginLib"
local lPrefsStack = "revAltPluginPrefs"
function altPluginStack
return lPluginStack
end altPluginStack
function altLogStack
return lLogStack
end altLogStack
function altPrefsStack
return lPrefsStack
end altPrefsStack
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 altPrefsStack() to tAutoUpdate
set the altAutoUpdate of stack altPluginStack() 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 altPrefsStack() to tAutoResizeFlag
set the altAutoSize of stack altPluginStack() 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& altPluginStack() "e& " to " & tPropVal into tDo
do tDo
end repeat
end if
end loadInterfaceSettings
on saveInterfaceSettings
put "" into tPref
put "altIconHeight," & the altIconHeight of stack altPluginStack() & "|" after tPref
put "altIconWidth," & the altIconWidth of stack altPluginStack() & "|" after tPref
put "altLeftBorder," & the altLeftBorder of stack altPluginStack() & "|" after tPref
put "altTopBorder," & the altTopBorder of stack altPluginStack() & "|" after tPref
put "altRightBorder," & the altRightBorder of stack altPluginStack() & "|" after tPref
put "altBotBorder," & the altBotBorder of stack altPluginStack() & "|" after tPref
put "altIconHpad," & the altIconHpad of stack altPluginStack() & "|" after tPref
put "altIconVpad," & the altIconVpad of stack altPluginStack() & "|" after tPref
put "altHiliteButtonBorderSize," & the altHiliteButtonBorderSize of stack altPluginStack() & "|" after tPref
put "altAutoSize," & the altAutoSize of stack altPluginStack() & "|" after tPref
put "altAutoUpdate," & the altAutoUpdate of stack altPluginStack() & "|" 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 altPluginStack() & "/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 altPluginStack() into pRect
end if
--> NEED TO LOCK MESSAGES SO THE resizeStack HANDLER IS NOT CALLED
lock messages
set the rect of stack altPluginStack() 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 altPluginStack() into tPath
-- put tPath & "/altPrefs.txt" into tPath
-- return URL ("file:" & tPath)
get the effective filename of stack altPluginStack()
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 altPluginStack() 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 altPluginStack() then
save stack altPluginStack()
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 altPluginStack() 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 altPluginStack() to tTL
else
set the altStartupRect of stack altPluginStack() 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 altPluginStack()to -1
-- show img "update.gif" of stack altPluginStack()
-- else
-- hide img "update.gif" of stack altPluginStack()
-- set the repeatCount of img "update.gif" of stack altPluginStack() to 0
-- end if
--end blinkLight
on closeStack
if the short name of the owner of the target is altPluginStack() then
saveStackRect
saveInterfaceSettings
#stripAndShip
clearAltLib
close stack altPrefsStack()
end if
end closeStack
on saveStackRect
--> WRITE THE STACK TOPLEFT TO PREFS
put the rect of stack altPluginStack() into tRect
put the altPlugsFolderPath of stack altPluginStack() 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
answer question "This will check the server for updates to AltPlugin Toolbar." &cr& \
"Continue?" with "Cancel" or "OK"
if it is "Cancel" then exit to top
checkForPluginUpdate
end checkForUpdates
on downloadToolbar pURL,pFilePath
put "Trying to download new update...please wait"
blinkLight true
put the altNumTry of stack altLogStack() 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",altPluginStack()
revSetStackProfile "mac",altPrefsStack()
#put " Mac profile SET!!"
else
revSetStackProfile "Master",altPluginStack()
revSetStackProfile "Master",altPrefsStack()
#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 altPluginStack()
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
function altPluginFolder
get the effective filename of stack altPluginStack()
set itemDel to "/"
delete last item of it
put it & "/altPlugs" into tPlugFolder
if there is not a folder tPlugFolder then create folder tPlugFolder
return tPlugFolder
end altPluginFolder
on parsePrefs pPrefs
--> CALLED FROM initIcons WHEN PREFS FILE IS PRESENT
put the defaultFolder into tOldDF
set the defaultFolder to altPluginFolder()
put getTagData(pPrefs,"stack") into tPrefList
put the altStartPrefs of stack altPluginStack() & 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 altPluginStack() then
-- get the altURLupdates of stack altPluginStack()
-- put cr & tUpdateURL after it
-- set the altURLupdates of stack altPluginStack() 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
--> USE THE altPlug.png ICON
copy img "altPlug.png" of stack tStackName to stack altPluginStack()
--> 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 altPluginStack() 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 altPluginStack()
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 altPluginStack() 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
put the rect of stack altPluginStack() into tRect
put "" & fld "Vers" of stack altPluginStack() & "" & cr after tPrefs
put "" & tRect & "" after tPrefs
#delete last char of tPrefs
put tPrefs into URL "file:altPrefs.txt"
set the defaultFolder to tOldDF
set the layer of btn "btnBorder" to top
hide btn "btnBorder"
get the altIconWidth of stack altPluginStack()
set the altIconWidth of stack altPluginStack() to it
get the altIconHeight of stack altPluginStack()
set the altIconHeight of stack altPluginStack() to it
setStackRect the altStartupRect of stack altPluginStack()
set the altStartupRect of stack altPluginStack() 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 altPluginStack()
put the defaultFolder into tOldDF
set the defaultFolder to the altPlugsFolderPath of stack altPluginStack()
put the altStartPrefs of stack altPluginStack() & 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 altPluginStack()
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 altPluginStack() 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 altPluginStack() & "" after tPrefs
put tPrefs into URL "file:altPrefs.txt"
end buildPrefs
on initIcons
if there is not a stack "revMenuBar" then palette altPluginStack()
set the defaultStack to altPluginStack()
clearIcons
get the effective filename of stack altPluginStack()
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 altPluginStack() 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
calculateIconPositions
send "sizeStackToContents" to me in 50 millisecs
else
--> NO PREFS FILE
buildPrefs
get the altIconWidth of stack altPluginStack()
set the altIconWidth of stack altPluginStack() to it
get the altIconHeight of stack altPluginStack()
set the altIconHeight of stack altPluginStack() to it
set the layer of btn "btnBorder" to top
hide btn "btnBorder"
--set the rect of stack altPluginStack() to the altStartupRect of of stack altPluginStack()
sizeStackToContents
resizeInterface
setStackRect
end if
set the defaultFolder to tOldDF
end initIcons
on stripAndShip
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
put "" into fld "pluginList" of stack altPrefsStack()
#if pVal then
unhilite btn "autoUpdate" of stack altPrefsStack()
hilite btn "auto-size window" of stack altPrefsStack()
#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 altPluginStack() 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 > 100 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 altPluginStack() is true then
put the altIconVpad of stack altPluginStack() into tIconVpad
put the altIconHpad of stack altPluginStack() into tIconHpad
put the altLeftBorder of stack altPluginStack() into tLeftBorder
put the altRightBorder of stack altPluginStack() into tRightBorder
put the altTopBorder of stack altPluginStack() into tTopBorder
put the altBotBorder of stack altPluginStack() into tBotBorder
put the altIconHeight of stack altPluginStack() into tIconHeight
put the altIconWidth of stack altPluginStack() 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 altPluginStack()
--> NEED TO LOCK MESSAGES SO NO MORE resizeStack MESSAGES ARE SENT
lock messages
set the rect of stack altPluginStack() to \
item 1 of it, \
item 2 of it, \
item 1 of it + max(the minWidth of stack altPluginStack(),tRight + tIconHpad + tRightBorder), \
item 2 of it + max(the minHeight of stack altPluginStack(),tBot + tIconVpad + tBotBorder)
unlock messages
end if
end SizeStackToContents
on calculateIconPositions
--> CALCULATE ICON POSITIONS
put the altIconVpad of stack altPluginStack() into tIconVpad
put the altIconHpad of stack altPluginStack() into tIconHpad
put the altLeftBorder of stack altPluginStack() into tLeftBorder
put the altRightBorder of stack altPluginStack() into tRightBorder
put the altTopBorder of stack altPluginStack() into tTopBorder
put the altBotBorder of stack altPluginStack() into tBotBorder
put the altIconHeight of stack altPluginStack() into tIconHeight
put the altIconWidth of stack altPluginStack() into tIconWidth
put the width of stack altPluginStack() into tStackWidth
put the height of stack altPluginStack() 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 altPluginStack() to the altHiliteButtonBorderSize of stack altPluginStack()
end refreshIcons
setProp altHiliteButtonBorderSize pVal
set the width of btn "btnBorder" to the altIconWidth of stack altPluginStack() + 2*pVal
set the height of btn "btnBorder" to the altIconHeight of stack altPluginStack() + 2*pVal
pass altHiliteButtonBorderSize
end altHiliteButtonBorderSize
setProp altAutoUpdate pVal
if pVal is true then
set the hilite of btn "autoUpdate" of stack altPrefsStack() to true
else
set the hilite of btn "autoUpdate" of stack altPrefsStack() 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 altPluginStack() into tIconVpad
put the altIconHpad of stack altPluginStack() into tIconHpad
put the altLeftBorder of stack altPluginStack() into tLeftBorder
put the altRightBorder of stack altPluginStack() into tRightBorder
put the altTopBorder of stack altPluginStack() into tTopBorder
put the altBotBorder of stack altPluginStack() into tBotBorder
put the altIconHeight of stack altPluginStack() into tIconHeight
put the altIconWidth of stack altPluginStack() into tIconWidth
set the minHeight of stack altPluginStack() to \
max(40,tTopBorder + tIconVpad + tIconHeight + tIconVpad +tBotBorder)
set the minWidth of stack altPluginStack() 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
--> OLD LIB STUFF
function altAnswer pMsg,pBtn1,pBtn2,pBtn3
return the params
end altAnswer
on clearAltLib
put empty into fld "debug" of stack altLogStack()
end clearAltLib
on altDebug pTitle,pData
put "--------------------------------" & cr into tStr
put pTitle & cr & pData & cr & cr after tStr
put tStr after fld "debug" of stack altLogStack()
end altDebug
---------------------------------
-------INTERNET STUFF------------
---------------------------------
function altPostURL pURL,pData
put 3 into tNumTrys
put 1 into x
repeat tNumTrys times
altDebug "Trying to Post to URL:",pURL & "?" & pData && "try " & x
post pData to URL pURL
altDebug "Result from pURL:",it
if it is not empty then
switch
case "WatchGuard" is in it --WatchGuard firewall
break
default
return it
end switch
end if
add 1 to x
end repeat
altDebug "Could not connect to Server. tNumTrys =",tNumTrys
return "!!!Error: Cannot receive data from Server:"&&pURL
end altPostURL
function altGetURL pURL
put 3 into tNumTrys
put 1 into x
repeat tNumTrys times
set the cursor to watch
altDebug "Trying to Get URL:",pURL && "try " & x
get URL pURL
altDebug "Result from pURL:",it
if it is not empty then
switch
case "WatchGuard" is in it --WatchGuard firewall
break
default
return it
end switch
end if
add 1 to x
end repeat
unlock cursor
altDebug "Could not connect to Server. tNumTrys =",tNumTrys
return "!!!Error: Cannot receive data from Server:"&&pURL
end altGetURL
on altGoURL theURL
if char 1 to 7 of theURL is not "http://" then
put "http://" before theURL
end if
put the tempName into theLaunchPath
put the itemDel into theDelim
set the itemDel to "/"
put "temp_launch.html" into last item of theLaunchPath
set the itemDel to theDelim
put createHTML(theURL) into theHTML
if "Mac" is in platform() then
set the fileType to "????TEXT"
put theHTML into url ("file:" & theLaunchPath)
delete char 1 of theLaunchPath
replace "/" with ":" in theLaunchPath
put "tell application" && quote & "Finder" & quote & cr &\\
"open file" && quote & theLaunchPath & quote & cr &\\
"end tell" into theScript
do theScript as AppleScript
end if
if "Win" is in platform() then
put theHTML into url ("file:" & theLaunchPath)
set the hideConsoleWindows to true
put empty into theTitle
if "NT" is in systemVersion() then
set the shellCommand to "cmd.exe"
put quote & quote into theTitle
end if
get shell("start" && theTitle && quote & theURL & quote)
end if
end altGoURL
function createHTML theURL
put \
"" & return &\
"
" & return &\
"" & return &\
"Launcher" & return &\
"" & return &\
"" & return &\
"" & return &\
"
" & return &\
"Loading URL. One moment please..." & return &\
"" & return &\
"" & return &\
"" into theHTML
return theHTML
end createHTML
--> UPDATE STUFF
on checkForPluginUpdate
get altCheckInternetConnect()
put the text of fld "vers" into tVers
put the altUpdateURL of this stack into tURL
put URL tURL into tData
put getTagData(tData,"Version") into tVers2
if tVers2 <> tVers then
answer information "There is an update to this stack. Do you wish to retrieve it?" with "Cancel" or "OK"
if it is "Cancel" then
exit checkForPluginUpdate
end if
--> DOWNLOAD NEW STACK
put the filename of this stack into tPluginPath
put getTagData(tData,"UpdateURL") into tURL
put "Downloading file, please wait..."
put URL tURL into tBinData
put the result into tResult
if tResult is not "" then
answer information "Problem downloading stack." &cr&cr& tResult
altStatus ""
exit to top
end if
topLevel this stack
if char -3 to -1 of tURL is ".gz" then
--> NEED TO UNCOMPRESS
put "Decompressing Stack..."
put decompress(tBinData) into tBinData
end if
put tBinData into URL ("binfile:" & tPluginPath)
revert
palette this stack
put "revAltPlugin updated!" into msg
else
answer information "You are currently using the latest version of this stack"
end if
end checkForPluginUpdate
function altCheckInternetConnect
--> CHECK FOR INTERNET CONNECTION TO EXTERNALS SERVER
put "Checking for internet connection..."
get URL "http://www.gadgetplugins.com/RevAccessTest.txt"
put the result into tResult
put ""
if line 1 of it is not "GOOD" or tResult is not empty then
answer warning "Cannot connect with the Altuit Externals Server: Error" &cr& tResult
exit to top
else
return true
end if
end altCheckInternetConnect
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
x c | altURLupdates
N/A
altIconWidth 31altLeftBorder 4
altSnickt 14altScreenRect 0,0,1024,566altDefaultInterfaceSettings 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 30 altAbout @altPlugin
Created by Chipp Walters
Altuit, inc.
Version: *vers*altHiliteButtonBorderSize 1altIconVpad 0altPlugsFolderPath ^C:/Documents and Settings/Chipp Walters/My Documents/My Revolution Enterprise/Plugins/altPlugsaltIconHpad 4 / 7
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 blendLevel 0
cantAbort false maxWidth 65535rect 120,99,332,208 patterns
colors
decorations iconic falselinkVisitedColor shadow truecantDelete falseid 7819altId 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 47
destroyStack true textSize 10 textFont Tahoma
dynamicPaths false
minHeight 55 cREVGeometryCache stackID 7787 cREVGeneral scripteditorvscroll 14353breakpointconditions
debugObjects scripteditorselection 5834breakpoints breakpointstates stackfileversion 2.7
cREVLoadInfo load startup main p
--> SYSTEM HANDLERS
on preOpenStack
initSnictRect
end preOpenStack
on openStack
initStackRect
if there is a stack "revMenubar" then
if the platform is "MacOS" then
send "setMacProfile true" to stack altPluginStack() in 30 milliseconds
else
send "setMacProfile false" to stack altPluginStack() in 30 milliseconds
end if
end if
loadInterfaceSettings
send initIcons to this stack in 30 milliseconds
end openStack
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
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
try
do tDo
catch tErr
end try
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
| cREVTempMaster ink srcCopydontSearch falsemark falsethreeD falseblendLevel 0rect 0,0,212,109defaultButton patterns
1004
colors
cantDelete falseid 1002altId 0
textStyle name mainlayer 1borderWidth 1showBorder true textSize textFont cREVGeometryCacheIDs 1094624006907 14891094624006908 14901094624006909 14911094624006914 10241094624006900 10081094624006901 10341094624006902 10101094624006903 10111094624006904 10121094624006905 10331094624006906 1488 cREVGeometryCache total 11order cREVGeneral scripteditorvscroll 183scripteditorselection 338breakPoints showAsHandlers false
resources @ 0 cREVTempMaster ink srcCopydontSearch falsemark falsethreeD trueblendLevel 0rect
0,0,48,249defaultButton patterns
colors
cantDelete falseid 1003altId 0
textStyle name resourceslayer 2borderWidth 2showBorder false textSize textFont cREVGeometryCache order , graphitepattern2.png @ 6<