# OK-2007-07-05: Rewrote revRotatePoly and revPoints to fix bug 4882
# Parameters
# pGraphic : A reference to a graphic
# pAngle : The angle to rotate the graphic by
# Description
# Performs a rotation transformation whose origin is the loc of the graphic and
# whose magnitude is pAngle degrees. Preserves the topLeft of the graphic, but may
# cause distortion due to rounding errors.
command revRotatePoly pGraphic, pAngle
local tPoints, tFinalPoints
local tLoc
local tSinAngle, tCosAngle
local tCurrentH, tCurrentV, tTransformedH, tTransformedV
local tOrigLeft, tOrigTop
lock screen
lock messages
if the realPoints of pGraphic is empty then
put the effective points of pGraphic into tPoints
else
put the realPoints of pGraphic into tPoints
end if
put the loc of pGraphic into tLoc
put item 1 of tLoc into tOrigLeft
put item 2 of tLoc into tOrigTop
put sin(pi*pAngle/180) into tSinAngle
put cos(pi*pAngle/180) into tCosAngle
repeat for each line tPoint in tPoints
if tPoint is not empty then
put item 1 of tPoint into tCurrentH
put item 2 of tPoint into tCurrentV
put (tOrigLeft+(tCosAngle*tCurrentH)-(tSinAngle*tCurrentV), tOrigTop+(tCosAngle*tCurrentV)+(tSinAngle*tCurrentH) ) after tFinalPoints
end if
put cr after tFinalPoints
end repeat
delete char -1 of tFinalPoints -- is CR
if the style of pGraphic is among the items of "oval,rectangle,roundrect,regular" then
set the style of pGraphic to "polygon"
end if
set points of pGraphic to tFinalPoints
set the realPoints of pGraphic to tFinalPoints
set loc of pGraphic to tLoc
unlock messages
unlock screen
end revRotatePoly
command revRotatePolygonOld pGraphic, pAngle
local tTopLeft
put the topLeft of pGraphic into tTopLeft
local tPoints
put revPoints(pGraphic) into tPoints
local tLoc
put the loc of pGraphic into tLoc
local tSinAngle
put sin(pAngle * (pi / 180)) into tSinAngle
local tCosAngle
put cos(pAngle * (pi / 180)) into tCosAngle
local tLineCount
put (the number of lines of tPoints) into tLineCount
local tCurrentH, tCurrentV, tTransformedH, tTransformedV, tFinalPoints
repeat for each line tPoint in tPoints
if tPoint is empty then
put empty & return after tFinalPoints
next repeat
end if
put item 1 of tPoint into tCurrentH
put item 2 of tPoint into tCurrentV
put trunc((tCosAngle * tCurrentH) - (tSinAngle * tCurrentV)) into tTransformedH
put trunc((tSinAngle * tCurrentH) + (tCosAngle * tCurrentV)) into tTransformedV
put tTransformedH + (item 1 of line 1 of tPoints) into tCurrentH
put tTransformedV + (item 2 of line 1 of tPoints) into tCurrentV
put tCurrentH,tCurrentV & return after tFinalPoints
end repeat
delete the last char of tFinalPoints
set the points of pGraphic to tFinalPoints
set the topLeft of pGraphic to tTopLeft
end revRotatePolygonOld
Richard Gaskin LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Maybe what is confusing me is that with version 7 you could hack stacks and the
hacks would "stay there" between boots, but, subsequently, with stacks generated
on the fly from obscure locations that seems no longer possible.
It's possible to save changes in script-only stacks. Either save normally in the IDE, or find them in the system file manager. On Mac the scripts are inside the app bundle.
Before adaptive Android icons were implemented I routinely changed the library that manages Android standalone builds.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
Any stack file, whether traditional binary or GitHub-focused script-only, can be saved to disk. Nothing has changed with that.
But it's never been a good idea to directly modify IDE stacks. Doing so creates a form of technical debt for yourself by forcing you to continually ask yourself whether you want to stop using new versions, ditch fixes in new versions so you can keep using your modified copies, or take on the onerous task of reimplantating your modifications with every release.
Much more efficient to change the IDE on the fly from scripts in an auto-start plugin.
devolution does that, if a living example would be helpful.
Richard Gaskin LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn