Changeset 18
- Timestamp:
- 10/24/08 12:12:09 (4 years ago)
- Location:
- trunk/lingosource
- Files:
-
- 26 edited
-
castlib1/memberInfo.xml (modified) (6 diffs)
-
castlib2/ButtonManagerHost.ls (modified) (3 diffs)
-
castlib2/HierarchicalMenuManager_1.ls (modified) (2 diffs)
-
castlib2/ToolTipBeaver_1Host.ls (modified) (2 diffs)
-
castlib2/ToolTipSpriteBehavior_1.ls (modified) (3 diffs)
-
castlib2/aleXtraLoader.ls (modified) (1 diff)
-
castlib2/aleXtrasMovieScript.ls (modified) (8 diffs)
-
castlib2/memberInfo.xml (modified) (18 diffs)
-
castlib2/newResizableStageBehavior.ls (modified) (7 diffs)
-
castlib2/resizeWindowScripts.ls (modified) (4 diffs)
-
castlib2/simpletooltip_1.ls (modified) (8 diffs)
-
castlib3/Alex_HierMenuParent.ls (modified) (10 diffs)
-
castlib3/ButtonImageCreator.ls (modified) (22 diffs)
-
castlib3/ButtonManager.ls (modified) (38 diffs)
-
castlib3/DropShadowPScript.ls (modified) (13 diffs)
-
castlib3/FileIOFunktionen.ls (modified) (13 diffs)
-
castlib3/GenericButtonPS.ls (modified) (12 diffs)
-
castlib3/GetSetPrefs.ls (modified) (6 diffs)
-
castlib3/ImageUtilityScripts.ls (modified) (11 diffs)
-
castlib3/PseudoXMLPS.ls (modified) (19 diffs)
-
castlib3/SliderScrollbarMenuParent.ls (modified) (5 diffs)
-
castlib3/SpriteNameBeaver.ls (modified) (1 diff)
-
castlib3/ToolTipBeaver_1.ls (modified) (12 diffs)
-
castlib3/commonMovieScript.ls (modified) (25 diffs)
-
castlib3/dreiD_Utility_Scripts.ls (modified) (23 diffs)
-
castlib3/memberInfo.xml (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lingosource/castlib1/memberInfo.xml
r14 r18 5 5 <comments>~/Documents/Scripts/lingo/defaultLayoutDefinitions.ls</comments> 6 6 <memberName>defaultLayoutDefinitions</memberName> 7 <f Name>defaultLayoutDefinitions</fName>7 <fname>defaultLayoutDefinitions</fname> 8 8 </defaultLayoutDefinitions> 9 9 <thisMovieScript> … … 11 11 <comments></comments> 12 12 <memberName>thisMovieScript</memberName> 13 <f Name>thisMovieScript</fName>13 <fname>thisMovieScript</fname> 14 14 </thisMovieScript> 15 15 <tempTextMem> … … 17 17 <comments></comments> 18 18 <memberName>tempTextMem</memberName> 19 <f Name>tempTextMem</fName>19 <fname>tempTextMem</fname> 20 20 </tempTextMem> 21 21 <sceneGraphExplorer> … … 23 23 <comments></comments> 24 24 <memberName>sceneGraphExplorer</memberName> 25 <f Name>sceneGraphExplorer</fName>25 <fname>sceneGraphExplorer</fname> 26 26 </sceneGraphExplorer> 27 27 <renamerField> … … 29 29 <comments></comments> 30 30 <memberName>renamerField</memberName> 31 <f Name>renamerField</fName>31 <fname>renamerField</fname> 32 32 </renamerField> 33 33 <unfloatBeaver> … … 35 35 <comments></comments> 36 36 <memberName>unfloatBeaver</memberName> 37 <f Name>unfloatBeaver</fName>37 <fname>unfloatBeaver</fname> 38 38 </unfloatBeaver> 39 39 </Untitled> -
trunk/lingosource/castlib2/ButtonManagerHost.ls
r14 r18 1 -- Button Behavior by Alex da Franca ©2003 da.Franca@online.de1 -- Button Behavior by Alex da Franca c2003 da.Franca@online.de 2 2 -------------------------------------------------------------------- 3 3 … … 83 83 on beginSprite me 84 84 85 -- includes = (mGetAleXtras()).getaprop(#scripts)86 --87 -- ancestor = rawnew(includes.getaprop(#ButtonManager))88 89 85 90 86 scr = mGetXScript(#ButtonManager) 91 87 92 if voidP(scr) then exit 88 if listP(scr) then exit 89 if ilk(scr) = #script then ancestor = rawnew(scr) 90 else ancestor = rawnew(scr.script) 93 91 94 ancestor = rawnew(scr)95 92 96 93 callAncestor(#new, me) … … 137 134 liste = [:] 138 135 139 -- includes = (mGetAleXtras()).getaprop(#scripts) 140 -- if voidP(includes) then 141 -- li = mGetAleXtras() 142 -- includes = [:] 143 -- li.setaprop(#scripts, includes) 144 -- end if 145 cmonm = mGetXScript(#commonmoviescript) 146 if not voidP(cmonm) then fontliste = call(#InitFonts, [cmonm]) 136 cmonm = mGetXScript() 137 if not voidP(cmonm) then fontliste = call(#InitFonts, cmonm) 147 138 148 139 if not listP(fontliste) then fontliste = ["Arial"] -
trunk/lingosource/castlib2/HierarchicalMenuManager_1.ls
r15 r18 1 -- Manager Behavior for Hierarchical Menu by Alex da Franca ©2004 da.Franca@online.de1 -- Manager Behavior for Hierarchical Menu by Alex da Franca c2004 da.Franca@online.de 2 2 ----------------------------------------------------------------------------------- 3 3 -- … … 1308 1308 1309 1309 tscr = mGetXScript(#Alex_HierMenuParent) 1310 if not(voidP(tscr)) then pMyHierMenu = new(tscr) 1310 if not(listP(tscr)) then 1311 if ilk(tscr) = #instance then tscr = tscr.script 1312 pMyHierMenu = new(tscr) 1313 end if 1311 1314 1312 1315 end if -
trunk/lingosource/castlib2/ToolTipBeaver_1Host.ls
r14 r18 1 1 -- ToolTip Behavior 2 -- by Alex da Franca ©2001 da.franca@online.de2 -- by Alex da Franca c2001 da.franca@online.de 3 3 -- drag this behavior onto any sprite with the provided "ttimageSave" bitmap member 4 4 -- customize the background color and the frame color of the tooltip by altering "ttimageSave" … … 53 53 on beginsprite me 54 54 55 includes = (mGetAleXtras()).getaprop(#scripts) 56 57 ancestor = rawnew(includes.getaprop(#ToolTipBeaver_1)) 55 scr = xscr(#ToolTipBeaver_1) 56 if listP(scr) then exit 57 if ilk(scr) = #instance then scr = scr.script 58 ancestor = rawnew(scr) 58 59 callAncestor(#new, me) 59 60 -
trunk/lingosource/castlib2/ToolTipSpriteBehavior_1.ls
r14 r18 13 13 on beginSprite me 14 14 15 pIncludes = (mGetAleXtras()).getaprop(#scripts) 15 pIncludes = [:] 16 pIncludes.setaprop(#commonmoviescript, xscr()) 16 17 17 18 pKanal = sprite(me.spritenum) … … 66 67 67 68 on mouseLeave me 68 spr = call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)], #tooltipHG)69 spr = call(#mGetKanal, pIncludes.getaprop(#commonmoviescript), #tooltipHG) 69 70 if spr > 0 then ro = rollover(spr) 70 71 else ro = 0 … … 94 95 95 96 on mHideMyTT me 96 sendSprite(call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)], #tooltipHG), #mHideToolTip)97 sendSprite(call(#mGetKanal, pIncludes.getaprop(#commonmoviescript), #tooltipHG), #mHideToolTip) 97 98 end 98 99 -
trunk/lingosource/castlib2/aleXtraLoader.ls
r14 r18 68 68 else 69 69 70 mediaList = mGetAleXtras() 71 72 theScripts = mediaList.getaprop(#scripts) 73 if ilk(theScripts) <> #proplist then 74 theScripts = [:] 75 mediaList.setaprop(#scripts, theScripts) 76 end if 77 78 theBitmaps = mediaList.getaprop(#bitmaps) 79 if ilk(theBitmaps) <> #proplist then 80 theBitmaps = [:] 81 mediaList.setaprop(#bitmaps, theBitmaps) 82 end if 83 84 tell sprite(me.spritenum) 85 cl = the number of castlibs 86 repeat with n = 1 to cl 87 num = the number of members of castlib cl 88 repeat with m = 1 to num 89 mem = member(m,n) 90 if length(mem.name) > 0 then 91 if mem.type = #script then 92 theScripts.setaProp(symbol(mem.name), mem.script) 93 else if mem.type = #bitmap then 94 theBitmaps.setaProp(symbol(mem.name), mem.image.duplicate()) 95 end if 96 end if 97 end repeat 98 end repeat 99 end tell 100 101 -- ----------------------------------------------------------- 102 -- -- -- -- Debugging mode: 103 -- 104 -- mLoadScripts 105 -- 106 -- -- // Debugging mode 107 -- ----------------------------------------------------------- 70 mLoadScriptsFromLDM me.spritenum 108 71 109 72 pLoaded = 1 110 111 112 73 113 74 end if -
trunk/lingosource/castlib2/aleXtrasMovieScript.ls
r14 r18 1 -- LDM Xtras Moviescript -- ©05 Alex da Franca -- alex@farbflash.de1 -- aleXtrasMovieScript 2 2 --------------------------------------------------------------------- 3 4 -- Requires: 5 -- nothing 6 7 -- Purpose: 3 -- CREATED: 4 -- 2005 5 -- 6 -- PROPERTIES: 7 --!memberProperties: [#name: "aleXtrasMovieScript", #scripttype: #movie, #scriptSyntax: #lingo, #comments:"~/Documents/Scripts/lingo/aleXtrasMovieScript.ls"] 8 -- 9 -- DESCRIPTION: 10 -- -- LDM Xtras Moviescript -- c05 Alex da Franca -- alex@farbflash.de 8 11 -- store instances of scripts and bitmaps in a 'global' list (-> property pAleXtras) 9 12 -- and provide access to them for all scripts 10 11 -- Usage: 12 -- put it in one of your castlib, DON'T RENAME MEMBER !! 13 -- 14 -- REQUIRES: 15 -- script "commonmoviescript" 16 -- 17 -- USAGE: 18 -- put it in one of your castlib, DON'T RENAME THIS MEMBER !! 19 -- use xscr(<name of script as symbol>) to get a reference to the script from 20 -- every script of the movie. It will return an instance of the script 21 -- 22 -- PARAMS: 23 -- - 24 -- 25 -- RETURNS: 26 -- - 27 -- 28 -- WARNINGS: 29 -- - 30 -- 31 -- TODO: 32 -- - 33 ----------------------------------- 13 34 14 35 property pAleXtras 15 36 16 37 on mGetAleXtras 38 39 alextras = (script "aleXtrasMovieScript").pAleXtras 40 if not(objectP(alextras)) then 41 42 cms = member("commonMovieScript") 43 if ilk(cms) <> #member then 44 alert "Script commonMovieScript missing, can't proceed" 45 halt 46 end if 47 if cms.type <> #script then 48 alert "Script commonMovieScript missing, can't proceed" 49 halt 50 end if 51 alextras = rawnew(cms.script) 52 if ilk(alextras) <> #instance then 53 alert "Script" & QUOTE & "commonMovieScript" & QUOTE && "is missing. This movie can't proceed!" 54 halt 55 end if 56 (script "aleXtrasMovieScript").pAleXtras = alextras 57 end if 58 return alextras 59 ----------------------------- 60 17 61 alextras = (script "aleXtrasMovieScript").pAleXtras 18 62 if voidP(alextras) then … … 26 70 27 71 on xscr scrName 72 ----------------------------------- 73 -- CREATED: 11.02.2008 74 -- ACTION: Description 75 -- INPUT: - 76 -- RETURNS: - 77 -- CALLER: - 78 -- DEBUG: - 79 -- TODO: - 80 ----------------------------------- 81 28 82 return mGetXScript(scrName) 29 83 end … … 32 86 33 87 on mGetXScript scrName 88 ----------------------------------- 89 -- CREATED: 11.02.2008 90 -- ACTION: Description 91 -- INPUT: - 92 -- RETURNS: - 93 -- CALLER: - 94 -- DEBUG: - 95 -- TODO: - 96 ----------------------------------- 97 98 alextras = mGetAleXtras() 99 scrName = string(scrName) 100 if length(scrName) < 1 then return alextras 101 if scrName = "commonMovieScript" then return alextras 102 103 inst = alextras.mGetInstance(scrName, 1) 104 if ilk(inst) <> #instance then 105 if the runmode contains "aut" then 106 put "Script" && QUOTE & scrName & QUOTE && "is missing! This may cause unwanted behavior" 107 end if 108 inst = [] 109 end if 110 return inst 111 ---------------------- 112 113 34 114 scrName = symbol(scrName) 35 115 if ilk(scrName) <> #symbol then scrName = #commonmoviescript … … 61 141 62 142 on mLoadScripts cls 143 ----------------------------------- 144 -- CREATED: 11.02.2008 145 -- ACTION: Description 146 -- INPUT: - 147 -- RETURNS: - 148 -- CALLER: - 149 -- DEBUG: - 150 -- TODO: - 151 ----------------------------------- 152 exit 153 63 154 64 155 mediaList = mGetAleXtras() … … 106 197 on mLoadXScript whichName 107 198 199 exit 200 201 108 202 whichName = string(whichName) 109 203 if length(whichName) < 1 then return 0 … … 130 224 131 225 on mLoadScriptsFromLDM whichSprite 226 227 includes = [:] 228 229 tell sprite(whichSprite) 230 cl = the number of castlibs 231 repeat with n = 1 to cl 232 num = the number of members of castlib cl 233 repeat with m = 1 to num 234 mem = member(m,n) 235 if length(mem.name) > 0 then 236 if mem.type = #script then 237 includes.setaProp(symbol(mem.name), rawNew(mem.script)) 238 end if 239 end if 240 end repeat 241 end repeat 242 end tell 243 244 cms = includes.getaprop(#commonMovieScript) 245 if not(objectP(cms)) then 246 cms = member("commonMovieScript") 247 if ilk(cms) <> #member then 248 alert "Script commonMovieScript missing, can't proceed" 249 halt 250 end if 251 if cms.type <> #script then 252 alert "Script commonMovieScript missing, can't proceed" 253 halt 254 end if 255 cms = rawnew(cms.script) 256 end if 257 258 (script "aleXtrasMovieScript").pAleXtras = cms 259 260 globs = cms.mGetGlobalList() 261 incl = globs[#gParentScriptInstances] 262 if not(objectP(incl)) then 263 incl = [:] 264 globs[#gParentScriptInstances] = incl 265 end if 266 267 repeat with n = count(incl) down to 1 268 includes.setaprop(incl.getPropAt(n), incl[n]) 269 end repeat 270 includes.deleteOne(#commonMovieScript) 271 globs[#gParentScriptInstances] = includes 272 273 exit 274 ------------------------------ 132 275 133 276 mediaList = mGetAleXtras() … … 166 309 167 310 on mListAleXtras 311 put "Handler mListAleXtras deprecated" 312 exit 313 168 314 alextras = (script "aleXtrasMovieScript").pAleXtras 169 315 if voidP(alextras) then mLoadScripts … … 215 361 sel = the selection of castlib cl 216 362 217 delim = the last char of the applicationpath 363 364 mp = the moviepath 365 if length(mp) < 1 then 366 if the runmode contains "plug" then 367 mp = "/" 368 else 369 mp = the applicationpath 370 end if 371 end if 372 delim = the last char of mp 218 373 219 374 the itemdelimiter = "/" -
trunk/lingosource/castlib2/memberInfo.xml
r14 r18 5 5 <comments>~/Documents/Scripts/lingo/frameloop.ls</comments> 6 6 <memberName>frameloop</memberName> 7 <f Name>frameloop</fName>7 <fname>frameloop</fname> 8 8 </frameloop> 9 9 <aleXtrasMovieScript> … … 11 11 <comments>~/Documents/Scripts/lingo/aleXtrasMovieScript.ls</comments> 12 12 <memberName>aleXtrasMovieScript</memberName> 13 <f Name>aleXtrasMovieScript</fName>13 <fname>aleXtrasMovieScript</fname> 14 14 </aleXtrasMovieScript> 15 15 <aleXtraLoader> … … 17 17 <comments>~/Documents/Scripts/lingo/aleXtraLoader.ls</comments> 18 18 <memberName>aleXtraLoader</memberName> 19 <f Name>aleXtraLoader</fName>19 <fname>aleXtraLoader</fname> 20 20 </aleXtraLoader> 21 21 <HierarchicalMenuManager_1> … … 23 23 <comments>~/Documents/Scripts/lingo/HierarchicalMenuManager_1.ls</comments> 24 24 <memberName>HierarchicalMenuManager_1</memberName> 25 <f Name>HierarchicalMenuManager_1</fName>25 <fname>HierarchicalMenuManager_1</fname> 26 26 </HierarchicalMenuManager_1> 27 27 <HierMenu_DragNDrop> … … 29 29 <comments>~/Documents/Scripts/lingo/HierMenu_DragNDrop.ls</comments> 30 30 <memberName>HierMenu_DragNDrop</memberName> 31 <f Name>HierMenu_DragNDrop</fName>31 <fname>HierMenu_DragNDrop</fname> 32 32 </HierMenu_DragNDrop> 33 33 <HierMenu_KeyboardControl> … … 35 35 <comments>~/Documents/Scripts/lingo/HierMenu_KeyboardControl.ls</comments> 36 36 <memberName>HierMenu_KeyboardControl</memberName> 37 <f Name>HierMenu_KeyboardControl</fName>37 <fname>HierMenu_KeyboardControl</fname> 38 38 </HierMenu_KeyboardControl> 39 39 <HierMenu_Renamer> … … 41 41 <comments>~/Documents/Scripts/lingo/HierMenu_Renamer.ls</comments> 42 42 <memberName>HierMenu_Renamer</memberName> 43 <f Name>HierMenu_Renamer</fName>43 <fname>HierMenu_Renamer</fname> 44 44 </HierMenu_Renamer> 45 45 <HierMenu_TextInputField> … … 47 47 <comments>~/Documents/Scripts/lingo/HierMenu_TextInputField.ls</comments> 48 48 <memberName>HierMenu_TextInputField</memberName> 49 <f Name>HierMenu_TextInputField</fName>49 <fname>HierMenu_TextInputField</fname> 50 50 </HierMenu_TextInputField> 51 51 <simpletooltip_1> … … 53 53 <comments>~/Documents/Scripts/lingo/simpletooltip_1.ls</comments> 54 54 <memberName>simpletooltip_1</memberName> 55 <f Name>simpletooltip_1</fName>55 <fname>simpletooltip_1</fname> 56 56 </simpletooltip_1> 57 57 <ButtonManagerHost> … … 59 59 <comments>~/Documents/Scripts/lingo/ButtonManagerHost.ls</comments> 60 60 <memberName>ButtonManagerHost</memberName> 61 <f Name>ButtonManagerHost</fName>61 <fname>ButtonManagerHost</fname> 62 62 </ButtonManagerHost> 63 63 <ToolTipBeaver_1Host> … … 65 65 <comments>~/Documents/Scripts/lingo/ToolTipBeaver_1Host.ls</comments> 66 66 <memberName>ToolTipBeaver_1Host</memberName> 67 <f Name>ToolTipBeaver_1Host</fName>67 <fname>ToolTipBeaver_1Host</fname> 68 68 </ToolTipBeaver_1Host> 69 69 <TTipTemplate> … … 71 71 <comments></comments> 72 72 <memberName>TTipTemplate</memberName> 73 <f Name>TTipTemplate</fName>73 <fname>TTipTemplate</fname> 74 74 </TTipTemplate> 75 75 <ToolTipSpriteBehavior_1> … … 77 77 <comments>~/Documents/Scripts/lingo/ToolTipSpriteBehavior_1.ls</comments> 78 78 <memberName>ToolTipSpriteBehavior_1</memberName> 79 <f Name>ToolTipSpriteBehavior_1</fName>79 <fname>ToolTipSpriteBehavior_1</fname> 80 80 </ToolTipSpriteBehavior_1> 81 81 <creditBeaver> … … 83 83 <comments>~/Documents/Scripts/lingo/creditBeaver.ls</comments> 84 84 <memberName>creditBeaver</memberName> 85 <f Name>creditBeaver</fName>85 <fname>creditBeaver</fname> 86 86 </creditBeaver> 87 87 <newResizableStageBehavior> … … 89 89 <comments>/Users/alex/Documents/ALIEN/myLinkedScripts/newResizableStageBehavior.ls</comments> 90 90 <memberName>newResizableStageBehavior</memberName> 91 <f Name>newResizableStageBehavior</fName>91 <fname>newResizableStageBehavior</fname> 92 92 </newResizableStageBehavior> 93 93 <resizeWindowScripts> … … 95 95 <comments>~/Documents/Scripts/lingo/resizeWindowScripts.ls</comments> 96 96 <memberName>resizeWindowScripts</memberName> 97 <f Name>resizeWindowScripts</fName>97 <fname>resizeWindowScripts</fname> 98 98 </resizeWindowScripts> 99 99 <LinkScriptsMScript> … … 101 101 <comments>/Users/alex/Documents/ALIEN/myLinkedScripts/LinkScriptsMScript.ls</comments> 102 102 <memberName>LinkScriptsMScript</memberName> 103 <f Name>LinkScriptsMScript</fName>103 <fname>LinkScriptsMScript</fname> 104 104 </LinkScriptsMScript> 105 105 <CastLabelsMScript> … … 107 107 <comments>/Users/alex/Documents/ALIEN/myLinkedScripts/CastLabelsMScript.ls</comments> 108 108 <memberName>CastLabelsMScript</memberName> 109 <f Name>CastLabelsMScript</fName>109 <fname>CastLabelsMScript</fname> 110 110 </CastLabelsMScript> 111 111 </Untitled> -
trunk/lingosource/castlib2/newResizableStageBehavior.ls
r14 r18 1 1 -- xxxx reposition or resize sprites for scalable movies 2 2 -- New Version -> more simple -> just takes relative values for distances to the screen bound 3 -- Alex da Franca ©2002 da.franca@online.de3 -- Alex da Franca c2002 da.franca@online.de 4 4 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 5 5 … … 15 15 property pPreserveAspect 16 16 property pCurrentRect 17 18 property pResizeListenerList 17 19 18 20 on beginsprite me … … 20 22 pOldrect = pKanal.rect 21 23 pCurrentRect = duplicate(pOldrect) 24 25 pResizeListenerList = [] 22 26 23 27 pCenterV = 0 … … 67 71 68 72 on endsprite me 73 pResizeListenerList = [] 69 74 theMember = pKanal.member 70 75 if theMember.type = #text then … … 91 96 retlist[#pPreserveAspect] = [#format:#boolean, #default:0, #comment:"Preserve initial aspect ratio when scaling:"] 92 97 return retlist 98 end 99 100 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 101 102 on RegisterForResizeEvent me, listenerList 103 104 if not(objectP(listenerList)) then return 0 105 if not(symbolP(listenerList[#handler])) then return 0 106 theTarget = listenerList[#target] 107 if not(objectP(theTarget)) then return 0 108 109 UnRegisterForResizeEvent me, theTarget 110 111 pResizeListenerList.add(listenerList) 112 113 end 114 115 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 116 117 on UnRegisterForResizeEvent me, atarget 118 repeat with n = count(pResizeListenerList) down to 1 119 if pResizeListenerList[n][#target] = atarget then 120 pResizeListenerList.deleteAt(n) 121 exit repeat 122 end if 123 end repeat 124 end 125 126 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 127 128 on mSendResizeEventToListeners me, newRect, oldRect 129 repeat with n = count(pResizeListenerList) down to 1 130 if objectP(pResizeListenerList[n][#target]) then 131 pResizeListenerList[n][#newRect] = newRect 132 pResizeListenerList[n][#oldRect] = oldRect 133 call(pResizeListenerList[n][#handler], [pResizeListenerList[n][#target]], pResizeListenerList[n]) 134 else 135 pResizeListenerList.deleteAt(n) 136 end if 137 end repeat 93 138 end 94 139 … … 195 240 pCurrentRect = newR 196 241 end if 242 197 243 sendSprite(me.spritenum, #mRefreshSpriteRectAfterStageChange, newR, r) 244 245 mSendResizeEventToListeners me, newR, r 198 246 199 247 end if … … 290 338 mRefreshResizeTargetRect me, newRect 291 339 end 340 292 341 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 293 342 -
trunk/lingosource/castlib2/resizeWindowScripts.ls
r14 r18 1 1 -- resizeWindowScripts 2 ----------------------------------- 3 -- CREATED: 4 -- 2008-04-17 at 01:54 5 -- 6 -- PROPERTIES: 7 --!memberProperties: [#name: "resizeWindowScripts", #scripttype: #movie, #scriptSyntax: #lingo, #comments:"~/Documents/Scripts/lingo/resizeWindowScripts.ls"] 8 -- 9 -- DESCRIPTION: 10 -- moviescript to handle the resizeWindow event and send it to all sprites 11 -- the sprites can have the "newResizableStageBehavior" in order to act according 12 -- to their gpdl settings 13 -- 14 -- REQUIRES: 15 -- (Prerequisites) 16 -- 17 -- USAGE: 18 -- in order to make this script work initialize it as soon as possible (for example startmovie) 19 -- and set the minimum and maximum sizes for the window 20 -- 2 21 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 3 22 -- xxxxxxxxxxxxxxxxxx add the following call to startmovie 4 5 23 -- 6 24 --on startmovie 7 25 -- ... 8 26 -- 9 27 -- xxxxxxxxxxxxxxxxxx 10 28 -- edit the min and max sizes for the window here: … … 13 31 -- mInitResizeWindowSystem minmaxSize 14 32 -- ... 15 33 -- 16 34 -- end 35 ----------------------------------- 36 17 37 18 38 … … 167 187 newRect = aw.rect 168 188 169 glob = call(#mGetGlobalList, [mGetXScript(#commonmoviescript)])189 glob = call(#mGetGlobalList, mGetXScript()) 170 190 oldar = glob.getaprop(#gCurrentStageRect) 171 191 … … 218 238 else 219 239 220 theRect = call(#mGetPrefValue, [mGetXScript(#GetSetPrefs)], #gWindowRect)240 theRect = call(#mGetPrefValue, mGetXScript(#GetSetPrefs), #gWindowRect) 221 241 222 242 if ilk(theRect) = #rect then -
trunk/lingosource/castlib2/simpletooltip_1.ls
r14 r18 14 14 property pThreedChannelName, pOverlayCreated 15 15 16 property pIncludes17 18 16 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 19 17 -- DIRECTOR EVENTS … … 21 19 22 20 on beginsprite me 23 24 pIncludes = (mGetAleXtras()).getaprop(#scripts)25 21 26 22 pSavedMem = sprite(me.spritenum).member … … 31 27 pOverlayCreated = 0 32 28 33 call(#mMeldeKanalname, [pIncludes.getaprop(#commonmoviescript)],#tooltipHG, me.spritenum)29 xscr().mMeldeKanalname(#tooltipHG, me.spritenum) 34 30 end 35 31 … … 37 33 38 34 on endsprite me 39 call(#mMeldeAbKanalname, [pIncludes.getaprop(#commonmoviescript)],#tooltipHG, me.spritenum)35 xscr().mMeldeAbKanalname(#tooltipHG, me.spritenum) 40 36 mTTverschwinde me 41 37 sprite(me.spritenum).member = pSavedMem … … 66 62 theSprite = sprite(me.spritenum) 67 63 68 derkanal = call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)],pThreedChannelName)64 derkanal = xscr().mGetKanal(pThreedChannelName) 69 65 if derkanal > 0 then 70 66 trect = rect(theLoc[1], theLoc[2], (theLoc[1] + theImg.width), (theLoc[2] + theImg.height)) … … 129 125 130 126 on mCreateOverlay me, spritename, whichImg, theLoc, maskImg 131 132 kanal = call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)],spritename)127 xscr = xscr() 128 kanal = xscr.mGetKanal(spritename) 133 129 if kanal < 1 then return 0 134 130 kanal = sprite(kanal) … … 145 141 breite = whichImg.width 146 142 hoehe = whichImg.height 147 powerbreite = call(#mGetNextPowerOfTwo, [pIncludes.getaprop(#commonmoviescript)],breite)148 powerhoehe = call(#mGetNextPowerOfTwo, [pIncludes.getaprop(#commonmoviescript)],hoehe)143 powerbreite = xscr.mGetNextPowerOfTwo(breite) 144 powerhoehe = xscr.mGetNextPowerOfTwo(hoehe) 149 145 150 146 if ilk(maskImg) = #image then … … 190 186 on mDeleteOverlay me, spritename 191 187 192 kanal = call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)],spritename)188 kanal = xscr().mGetKanal(spritename) 193 189 if kanal < 1 then return 0 194 190 kanal = sprite(kanal) -
trunk/lingosource/castlib3/Alex_HierMenuParent.ls
r15 r18 1 -- Hierarchisches Menu by Alex da Franca ©2001 da.Franca@online.de1 -- Hierarchisches Menu by Alex da Franca c2001 da.Franca@online.de 2 2 ------------------------------------------------------------------ 3 3 … … 212 212 213 213 pMyScrollBarScript = mGetXScript(#SliderScrollbarMenuParent) 214 if not voidP(pMyScrollBarScript) then pMyScrollBarScript = new(pMyScrollBarScript) 214 if not listP(pMyScrollBarScript) then 215 if ilk(pMyScrollBarScript) = #instance then pMyScrollBarScript = pMyScrollBarScript.script 216 pMyScrollBarScript = new(pMyScrollBarScript) 217 else 218 pMyScrollBarScript = 0 219 end if 215 220 216 221 pShadowScript = mGetXScript(#DropShadowPScript) 217 if not voidP(pShadowScript) then pShadowScript = new(pShadowScript) 222 if not listP(pShadowScript) then 223 if ilk(pShadowScript) = #instance then pShadowScript = pShadowScript.script 224 pShadowScript = new(pShadowScript) 225 else 226 pShadowScript = 0 227 end if 218 228 219 229 return me … … 1606 1616 1607 1617 -- properties dieses behviors global speichern, damit beim naechsten beginsprite dieses behaviors der alte zustand wieder hergestellt wird (z.B. bei einem sprung in ein anderes movie) 1618 if objectP(pMenuProps) then 1608 1619 if pMenuProps.getaprop(#saveProps) then 1609 1620 global gSicherprop … … 1617 1628 end if 1618 1629 -- (the actorlist).deleteOne(me) 1630 end if 1619 1631 1620 1632 -- aufraeumen … … 1891 1903 if pMyScrollBarScript.mGetEnabled() <> 1 then 1892 1904 mUpdateScrollBarRect me 1893 pMyScrollBarScript.SetEnabled(1)1905 pMyScrollBarScript.SetEnabled(1) 1894 1906 end if 1895 1907 … … 1972 1984 if ilk(pShadowScript) <> #instance then 1973 1985 pShadowScript = mGetXScript(#DropShadowPScript) 1974 if not voidP(pShadowScript) then pShadowScript = new(pShadowScript) 1986 if not listP(pShadowScript) then 1987 if ilk(pShadowScript) = #instance then pShadowScript = pShadowScript.script 1988 pShadowScript = new(pShadowScript) 1989 else 1990 pShadowScript = 0 1991 end if 1975 1992 end if 1976 1993 … … 2121 2138 2122 2139 if ilk(hgfarbe) = #color then 2123 ttimg.fill(ttimg.rect, hgfarbe)2140 ttimg.fill(ttimg.rect, hgfarbe) 2124 2141 else if hgfarbe = #image then 2125 2142 ttimg.copypixels(hgfarbe, ttimg.rect, hgfarbe.rect) … … 3171 3188 dertimer = the ticks 3172 3189 -- dieAnimTime = min((abs(pAnimStart) * max(2,(15 / abs(pAnimStart)))), 40) 3173 dieAnimTime = min((abs(pAnimStart) * 5), 40) -- animationszeit abhaengig von der hoehe des stuecks, das animiert wird,, jedoch maximal 40 ms3190 dieAnimTime = min((abs(pAnimStart) * 5), 25) -- animationszeit abhaengig von der hoehe des stuecks, das animiert wird,, jedoch maximal 40 ms 3174 3191 diebeschl = 12.0 3175 3192 … … 3501 3518 --------------------------------- 3502 3519 3503 if usealternateColor then3504 if n mod 2 then3505 derlocVHL = pZeilenhoehe * (n - pScrollOffset)3506 tr = rect(0, (derlocVHL + obenoffset + 1), (pBuffImg.rect.right - 1), (derlocV + 1 + obenoffset - pMenuProps.getaprop(#myLineWidth)))3507 pBuffImg.fill(tr, alternateColor)3508 if usealph then3509 pAlphaImage.fill(tr, rgb(0,0,0))3510 end if3511 treeviewdata.setaprop(#alternatecolor, 1)3512 else3513 treeviewdata.setaprop(#alternatecolor, 0)3514 end if3515 end if3516 3520 if usealternateColor then 3521 if n mod 2 then 3522 derlocVHL = pZeilenhoehe * (n - pScrollOffset) 3523 tr = rect(0, (derlocVHL + obenoffset + 1), (pBuffImg.rect.right - 1), (derlocV + 1 + obenoffset - pMenuProps.getaprop(#myLineWidth))) 3524 pBuffImg.fill(tr, alternateColor) 3525 if usealph then 3526 pAlphaImage.fill(tr, rgb(0,0,0)) 3527 end if 3528 treeviewdata.setaprop(#alternatecolor, 1) 3529 else 3530 treeviewdata.setaprop(#alternatecolor, 0) 3531 end if 3532 end if 3533 3517 3534 end if 3518 3535 … … 3733 3750 if ilk(pStrichel) = #image then 3734 3751 3735 -- strichellinie:3736 -- strichzahl = templiste.stelleH - 13737 strichzahl = stelleH - 13738 3739 oben = derlocV + obenoffset - pZeilenhoehe3740 unten = oben + pStrichel.rect.height3741 links = STRlinks3742 3743 if ilk(pAlphaImage) = #image then3744 3745 repeat with z = 1 to strichzahl3746 pBuffImg.copyPixels(pStrichel, rect(links, oben, (links + 1), unten), pStrichel.rect)3747 pAlphaImage.copyPixels(pStrichelAlpha, rect(links, oben, (links + 1), unten), pStrichel.rect, [#ink:#darkest])3748 links = links + tabAbstand3749 end repeat3750 3751 else3752 repeat with z = 1 to strichzahl3753 pBuffImg.copyPixels(pStrichel, rect(links, oben, (links + 1), unten), pStrichel.rect)3754 links = links + tabAbstand3755 end repeat3756 end if3757 3752 -- strichellinie: 3753 -- strichzahl = templiste.stelleH - 1 3754 strichzahl = stelleH - 1 3755 3756 oben = derlocV + obenoffset - pZeilenhoehe 3757 unten = oben + pStrichel.rect.height 3758 links = STRlinks 3759 3760 if ilk(pAlphaImage) = #image then 3761 3762 repeat with z = 1 to strichzahl 3763 pBuffImg.copyPixels(pStrichel, rect(links, oben, (links + 1), unten), pStrichel.rect) 3764 pAlphaImage.copyPixels(pStrichelAlpha, rect(links, oben, (links + 1), unten), pStrichel.rect, [#ink:#darkest]) 3765 links = links + tabAbstand 3766 end repeat 3767 3768 else 3769 repeat with z = 1 to strichzahl 3770 pBuffImg.copyPixels(pStrichel, rect(links, oben, (links + 1), unten), pStrichel.rect) 3771 links = links + tabAbstand 3772 end repeat 3773 end if 3774 3758 3775 end if 3759 3776 -
trunk/lingosource/castlib3/ButtonImageCreator.ls
r15 r18 3 3 -- xxxxxxxxxxxxxxxxxx global handlers to create images for widgets 4 4 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 5 -- Alex da Franca ©2003 da.franca@online.de5 -- Alex da Franca c2003 da.franca@online.de 6 6 7 7 … … 38 38 --------------------------------- 39 39 -- Scriptmarker: changes alex (24.07.2006 at 09:32 Uhr) // Scriptmarker 40 40 41 41 42 -- added support for a proplist as #buttonIcon, so that different icons for the different button states can be used … … 99 100 templateTextMember.text = "MM" 100 101 th = templateTextMember.charPosToLoc(2) 101 textimg = image( th[1],th[2],8,0,#grayscale)102 textimg = image(max(1, th[1]),max(1, th[2]),8,0,#grayscale) 102 103 end if 103 104 … … 258 259 end if 259 260 260 buttonIconW = hoehe - marginV*2 261 buttonIconW = min(breite, hoehe) - marginV*2 262 buttonIconW = min(16, buttonIconW) 261 263 buttonIcon = image(buttonIconW, buttonIconW, 32, 1) 262 264 … … 279 281 if noText = 1 then breite = max(marginH, myRect.width) 280 282 281 dasRect = rect(0, 0, breite + buttonIconW, hoehe + buttonIconH) 283 if noText <> 1 then 284 dasRect = rect(0, 0, breite + buttonIconW, hoehe + buttonIconH) 285 else 286 dasRect = rect(0, 0, breite, hoehe) 287 end if 282 288 283 289 -- offset: … … 343 349 end if 344 350 351 alteMaske = 0 345 352 if img.depth = 32 then alteMaske = img.extractAlpha() 346 353 … … 388 395 else buffsH = textbreite - buttonIconW + shadowOffs[1] 389 396 390 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 397 buffsV = (dasRect.height - buttonIcon.height) / 2 + shadowOffs[2] 398 399 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 391 400 end if 392 401 … … 401 410 else buffsH = textbreite - buttonIconW + shadowOffs[1] 402 411 403 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 412 buffsV = (dasRect.height - buttonIcon.height) / 2 + shadowOffs[2] 413 414 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 404 415 end if 405 416 … … 409 420 410 421 if noText = 1 then 411 if buttonIconAlign = #right then buffsH = dasRect.width - buttonIconW + shadowOffs[1] 412 else buffsH = marginH + shadowOffs[1] 413 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 422 -- if buttonIconAlign = #right then buffsH = dasRect.width - buttonIconW + shadowOffs[1] 423 -- else buffsH = marginH + shadowOffs[1] 424 ----------- just align center 425 426 buffsH = (dasRect.width - buttonIcon.width) / 2 + shadowOffs[1] 427 buffsV = (dasRect.height - buttonIcon.height) / 2 + shadowOffs[2] 428 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 429 414 430 else 415 431 if buttonIconAlign = #right then buffsH = dasRect.width - buttonIconW + shadowOffs[1] … … 488 504 end if 489 505 506 alteMaske = 0 490 507 if img.depth = 32 then alteMaske = img.extractAlpha() 491 508 … … 563 580 if noText = 1 then 564 581 565 if buttonIconAlign = #right then buffsH = dasRect.width - buttonIconW + shadowOffs[1] 566 else buffsH = marginH + shadowOffs[1] 567 568 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 582 -- if buttonIconAlign = #right then buffsH = dasRect.width - buttonIconW + shadowOffs[1] 583 -- else buffsH = marginH + shadowOffs[1] 584 ----------- just align center 585 586 buffsH = (dasRect.width - buttonIcon.width) / 2 + shadowOffs[1] 587 buffsV = (dasRect.height - buttonIcon.height) / 2 + shadowOffs[2] 588 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 589 590 591 -- img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 569 592 else 570 593 … … 572 595 else buffsH = textbreite - buttonIconW + shadowOffs[1] 573 596 574 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 597 buffsV = (dasRect.height - buttonIcon.height) / 2 + shadowOffs[2] 598 599 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 575 600 end if 576 601 end if … … 639 664 end if 640 665 666 alteMaske = 0 641 667 if img.depth = 32 then alteMaske = img.extractAlpha() 642 668 … … 686 712 -- else buffsH = marginH + shadowOffs[1] 687 713 688 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 714 -- img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 715 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 689 716 else 690 717 … … 692 719 -- else buffsH = textbreite - buttonIconW + shadowOffs[1] 693 720 694 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect)721 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 695 722 end if 696 723 end if … … 760 787 end if 761 788 789 alteMaske = 0 762 790 if img.depth = 32 then alteMaske = img.extractAlpha() 763 791 … … 807 835 if noText = 1 then 808 836 809 -- img.copyPixels(buttonIcon, buttonIcon.rect.offset(marginH + shadowOffs[1], marginV + shadowOffs[2]), buttonIcon.rect) 810 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 837 -- -- img.copyPixels(buttonIcon, buttonIcon.rect.offset(marginH + shadowOffs[1], marginV + shadowOffs[2]), buttonIcon.rect) 838 -- img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 839 840 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 811 841 812 842 else 813 843 -- img.copyPixels(buttonIcon, buttonIcon.rect.offset(textbreite - buttonIconW + shadowOffs[1], marginV + shadowOffs[2]), buttonIcon.rect) 814 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect)844 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 815 845 end if 816 846 end if … … 886 916 end if 887 917 918 alteMaske = 0 888 919 if img.depth = 32 then alteMaske = img.extractAlpha() 889 920 … … 921 952 if noText = 1 then 922 953 923 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 954 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 955 -- img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 924 956 else 925 957 926 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect)958 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 927 959 end if 928 960 end if … … 1211 1243 1212 1244 -- -- museum hack fuer zweifarbige rahmen: 1213 if call(#mGetThisMovieName, mGetXScript( #commonMovieScript)) = "Kindermuseum" then trect = trect.inflate(-1, -1) -- weisser 1-pixel rahmen1245 if call(#mGetThisMovieName, mGetXScript()) = "Kindermuseum" then trect = trect.inflate(-1, -1) -- weisser 1-pixel rahmen 1214 1246 1215 1247 tempImg.fill(trect, rahmenfarbe) … … 1396 1428 1397 1429 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1430 1398 1431 on mCreateDropDownTriangle me, rHeight 1399 1432 … … 1431 1464 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1432 1465 1466 on mCreateCheckBoxButton me, theLabel, options, retlist 1467 1468 if ilk(options) <> #proplist then options = [:] 1469 1470 textimg = theLabel 1471 1472 cms = mGetXScript() 1473 ius = mGetXScript(#imageUtilityScripts) 1474 1475 if ilk(textimg) <> #image then 1476 theString = call(#mTranslate, cms, string(textimg)) 1477 if theString.length then 1478 maxW = options.getaprop(#maxWidth) 1479 if ilk(maxW) <> #integer then maxW = 500 1480 textimg = call(#mGetTextImage, ius, theString, options, maxW, member("buttontexttempl"), options.getaprop(#dontwrap)) 1481 1482 else 1483 -- no text and no image ?! just return 1484 if ilk(retlist) <> #proplist then return [:] 1485 return retlist 1486 1487 end if 1488 end if 1489 1490 myRect = options.getaprop(#myRect) 1491 if ilk(myRect) <> #rect then myRect = rect(0,0,2,2) 1492 1493 texthoehe = textimg.height 1494 textbreite = textimg.width 1495 1496 marginH = options.getaprop(#marginH) 1497 marginV = options.getaprop(#marginV) 1498 1499 hoehe = max((texthoehe + (marginV * 2)), myRect.height) 1500 breite = max((textbreite + (marginH * 2)), myRect.width) 1501 1502 1503 if (textimg.depth = 1) or ((textimg.depth = 8) and (textimg.paletteref = #grayscale)) then 1504 temp = image(textbreite, texthoehe, 32) 1505 fontfarbe = options.getaprop(#myFontcolor) 1506 if ilk(fontfarbe) <> #color then 1507 fontfarbe = rgb(0,0,0) 1508 options[#myFontcolor] = fontfarbe 1509 end if 1510 temp.fill(temp.rect, fontfarbe) 1511 1512 temp2 = textimg 1513 1514 else 1515 temp = textimg 1516 1517 if temp.depth = 32 then 1518 temp.useAlpha = 0 1519 temp2 = temp.extractAlpha() 1520 else 1521 temp2 = image(temp.width, temp.height, 8, 0, #grayscale) 1522 temp2.fill(temp2.rect, rgb(0,0,0)) 1523 end if 1524 1525 end if 1526 1527 1528 1529 buttonIconType = options.getaprop(#buttonIcon) 1530 1531 1532 buttonIconList = [:] 1533 1534 hlfarbe = options.getaprop(#pressedColor) 1535 if ilk(hlfarbe) <> #color then hlfarbe = options.getaprop(#selectedColor) 1536 if ilk(hlfarbe) <> #color then hlfarbe = options.getaprop(#myFontColor) 1537 1538 if ilk(buttonIconType) = #image then 1539 buttonIcon = buttonIconType 1540 buttonIconW = buttonIcon.width + marginH 1541 buttonIconH = max(0, (buttonIcon.height + marginV*2) - hoehe) 1542 1543 buttonIconList.setaprop(#normal, buttonIcon) 1544 1545 else if ilk(buttonIconType) = #proplist then 1546 buttonIcon = buttonIconType.getaprop(#normal) 1547 if ilk(buttonIcon) = #image then 1548 buttonIconList = buttonIconType 1549 buttonIconW = buttonIcon.width + marginH 1550 buttonIconH = max(0, (buttonIcon.height + marginV*2) - hoehe) 1551 else 1552 buttonIconW = 0 1553 buttonIconH = 0 1554 end if 1555 1556 else 1557 case buttonIconType of 1558 #checkbox: 1559 1560 if ilk(fontfarbe) <> #color then 1561 fontfarbe = options.getaprop(#myFontcolor) 1562 if ilk(fontfarbe) <> #color then 1563 fontfarbe = rgb(0,0,0) 1564 options[#myFontcolor] = fontfarbe 1565 end if 1566 end if 1567 1568 buttonIconW = hoehe - marginV*2 1569 buttonIcon = image(buttonIconW, buttonIconW, 32, 1) 1570 buttonIcon.fill(buttonIcon.rect, fontfarbe) 1571 buttonIconM = image(buttonIconW, buttonIconW, 8, 0, #grayscale) 1572 buttonIconM.draw(buttonIconM.rect, [#linesize:1, #shapetype:#rect, #color:rgb(0,0,0)]) 1573 buttonIcon.setAlpha(buttonIconM) 1574 1575 buttonIconW = buttonIconW + marginH 1576 buttonIconH = 0 1577 1578 buttonIconList.setaprop(#normal, buttonIcon.duplicate()) 1579 1580 1581 1582 if ilk(hlfarbe) = #color then buttonIcon.fill(buttonIcon.rect, hlfarbe) 1583 buttonIconM.draw(point(0, 0), point(buttonIconM.width, buttonIconM.height), [#linesize:1, #shapetype:#line, #color:rgb(0,0,0)]) 1584 buttonIconM.draw(point(0, buttonIconM.height), point(buttonIconM.width, 0), [#linesize:1, #shapetype:#line, #color:rgb(0,0,0)]) 1585 buttonIcon.setAlpha(buttonIconM) 1586 1587 buttonIconList.setaprop(#pressed, buttonIcon) 1588 1589 #radiobutton: 1590 1591 if ilk(fontfarbe) <> #color then 1592 fontfarbe = options.getaprop(#myFontcolor) 1593 if ilk(fontfarbe) <> #color then 1594 fontfarbe = rgb(0,0,0) 1595 options[#myFontcolor] = fontfarbe 1596 end if 1597 end if 1598 1599 buttonIconW = hoehe - marginV*2 1600 buttonIcon = image(buttonIconW, buttonIconW, 32, 1) 1601 buttonIcon.fill(buttonIcon.rect, fontfarbe) 1602 buttonIconM = image(buttonIconW, buttonIconW, 8, 0, #grayscale) 1603 buttonIconM.draw(buttonIconM.rect, [#linesize:1, #shapetype:#oval, #color:rgb(0,0,0)]) 1604 buttonIcon.setAlpha(buttonIconM) 1605 1606 buttonIconW = buttonIconW + marginH 1607 buttonIconH = 0 1608 1609 buttonIconList.setaprop(#normal, buttonIcon.duplicate()) 1610 1611 if ilk(hlfarbe) = #color then buttonIcon.fill(buttonIcon.rect, hlfarbe) 1612 buttonIconM.fill(buttonIconM.rect.inflate(-3, -3), [#shapetype:#oval, #color:rgb(0,0,0)]) 1613 buttonIcon.setAlpha(buttonIconM) 1614 1615 buttonIconList.setaprop(#pressed, buttonIcon) 1616 1617 #dropdown: 1618 1619 if ilk(fontfarbe) <> #color then 1620 fontfarbe = options.getaprop(#myFontcolor) 1621 if ilk(fontfarbe) <> #color then 1622 fontfarbe = rgb(0,0,0) 1623 options[#myFontcolor] = fontfarbe 1624 end if 1625 end if 1626 1627 buttonIconW = min(breite, hoehe) - marginV*2 1628 buttonIconW = min(16, buttonIconW) 1629 buttonIcon = image(buttonIconW, buttonIconW, 32, 1) 1630 1631 buttonIcon.fill(buttonIcon.rect, fontfarbe) 1632 1633 buttonIconM = mCreateDropDownTriangle(me, buttonIconW) 1634 buttonIcon.setAlpha(buttonIconM) 1635 1636 buttonIconW = buttonIconW + marginH 1637 buttonIconH = 0 1638 1639 buttonIconList.setaprop(#normal, buttonIcon) 1640 1641 otherwise 1642 buttonIconW = 0 1643 buttonIconH = 0 1644 buttonIcon = 0 1645 1646 buttonIconList = [:] 1647 1648 end case 1649 end if 1650 1651 dasRect = rect(0, 0, breite + buttonIconW, hoehe + buttonIconH) 1652 1653 texthoehe = (dasRect.height - texthoehe) / 2 1654 textbreite = marginH + buttonIconW 1655 1656 ----------------------------- 1657 textoffset = options.getaprop(#textoffset) 1658 if ilk(textoffset) = #point then 1659 textbreite = textbreite + textoffset[1] 1660 texthoehe = texthoehe + textoffset[2] 1661 end if 1662 ----------------------------- 1663 1664 if ilk(retlist) <> #proplist then 1665 retlist = [:] 1666 retlist[#normal] = 1 1667 retlist[#pressed] = 1 1668 retlist[#hilite] = 1 1669 retlist[#disabled] = 1 1670 retlist[#selected] = 1 1671 end if 1672 1673 1674 1675 buffsH = textbreite - buttonIconW 1676 if ilk(buttonIcon) = #image then 1677 buffsV = (dasRect.height - buttonIcon.height) / 2 1678 else 1679 buffsV = 0 1680 end if 1681 1682 img = image(dasrect.width, dasrect.height, 32, 1) 1683 aImg = image(img.width, img.height, 8, 0, #grayscale) 1684 img.useAlpha = 0 1685 1686 img.copyPixels(temp, temp.rect.offset(textbreite, texthoehe), temp.rect) 1687 aImg.copyPixels(temp2, temp2.rect.offset(textbreite, texthoehe), temp2.rect) 1688 1689 buttonIcon = buttonIconList.getaprop(#normal) 1690 if ilk(buttonIcon) = #image then 1691 if buttonIcon.depth = 32 then 1692 buttonIcon.useAlpha = 0 1693 buttonIconA = buttonIcon.extractAlpha() 1694 else 1695 buttonIconA = image(buttonIcon.width, buttonIconA.height, 8, 0, #grayscale) 1696 buttonIconA.fill(buttonIconA.rect, rgb(0,0,0)) 1697 end if 1698 1699 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 1700 aImg.copyPixels(buttonIconA, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 1701 end if 1702 1703 img.setAlpha(aImg) 1704 img.useAlpha = 1 1705 1706 retlist[#normal] = img 1707 1708 ------------------------------- 1709 1710 if not(voidP(retlist.getaprop(#pressed))) then 1711 1712 hlfarbe = options.getaprop(#pressedColor) 1713 if ilk(hlfarbe) = #color then temp.fill(temp.rect, hlfarbe) 1714 1715 img = image(dasrect.width, dasrect.height, 32, 1) 1716 aImg = image(img.width, img.height, 8, 0, #grayscale) 1717 img.useAlpha = 0 1718 1719 img.copyPixels(temp, temp.rect.offset(textbreite, texthoehe), temp.rect) 1720 aImg.copyPixels(temp2, temp2.rect.offset(textbreite, texthoehe), temp2.rect) 1721 1722 buttonIcon = buttonIconList.getaprop(#pressed) 1723 if ilk(buttonIcon) <> #image then buttonIcon = buttonIconList.getaprop(#normal) 1724 if ilk(buttonIcon) = #image then 1725 if buttonIcon.depth = 32 then 1726 buttonIcon.useAlpha = 0 1727 buttonIconA = buttonIcon.extractAlpha() 1728 else 1729 buttonIconA = image(buttonIcon.width, buttonIconA.height, 8, 0, #grayscale) 1730 buttonIconA.fill(buttonIconA.rect, rgb(0,0,0)) 1731 end if 1732 1733 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 1734 aImg.copyPixels(buttonIconA, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 1735 end if 1736 1737 img.setAlpha(aImg) 1738 img.useAlpha = 1 1739 1740 retlist[#pressed] = img 1741 1742 end if 1743 1744 1745 ------------------------------- 1746 1747 if not(voidP(retlist.getaprop(#hilite))) then 1748 1749 hlfarbe = options.getaprop(#hiliteColor) 1750 if ilk(hlfarbe) = #color then temp.fill(temp.rect, hlfarbe) 1751 1752 img = image(dasrect.width, dasrect.height, 32, 1) 1753 aImg = image(img.width, img.height, 8, 0, #grayscale) 1754 img.useAlpha = 0 1755 1756 img.copyPixels(temp, temp.rect.offset(textbreite, texthoehe), temp.rect) 1757 aImg.copyPixels(temp2, temp2.rect.offset(textbreite, texthoehe), temp2.rect) 1758 1759 buttonIcon = buttonIconList.getaprop(#hilite) 1760 if ilk(buttonIcon) <> #image then buttonIcon = buttonIconList.getaprop(#normal) 1761 if ilk(buttonIcon) = #image then 1762 if buttonIcon.depth = 32 then 1763 buttonIcon.useAlpha = 0 1764 buttonIconA = buttonIcon.extractAlpha() 1765 else 1766 buttonIconA = image(buttonIcon.width, buttonIconA.height, 8, 0, #grayscale) 1767 buttonIconA.fill(buttonIconA.rect, rgb(0,0,0)) 1768 end if 1769 1770 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 1771 aImg.copyPixels(buttonIconA, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 1772 end if 1773 1774 img.setAlpha(aImg) 1775 img.useAlpha = 1 1776 1777 retlist[#hilite] = img 1778 1779 end if 1780 1781 1782 1783 ------------------------------- 1784 1785 if not(voidP(retlist.getaprop(#disabled))) then 1786 1787 hlfarbe = options.getaprop(#disabledColor) 1788 if ilk(hlfarbe) = #color then temp.fill(temp.rect, hlfarbe) 1789 1790 img = image(dasrect.width, dasrect.height, 32, 1) 1791 aImg = image(img.width, img.height, 8, 0, #grayscale) 1792 img.useAlpha = 0 1793 1794 img.copyPixels(temp, temp.rect.offset(textbreite, texthoehe), temp.rect) 1795 aImg.copyPixels(temp2, temp2.rect.offset(textbreite, texthoehe), temp2.rect) 1796 1797 buttonIcon = buttonIconList.getaprop(#disabled) 1798 if ilk(buttonIcon) <> #image then buttonIcon = buttonIconList.getaprop(#normal) 1799 if ilk(buttonIcon) = #image then 1800 if buttonIcon.depth = 32 then 1801 buttonIcon.useAlpha = 0 1802 buttonIconA = buttonIcon.extractAlpha() 1803 else 1804 buttonIconA = image(buttonIcon.width, buttonIconA.height, 8, 0, #grayscale) 1805 buttonIconA.fill(buttonIconA.rect, rgb(0,0,0)) 1806 end if 1807 1808 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 1809 aImg.copyPixels(buttonIconA, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 1810 end if 1811 1812 img.setAlpha(aImg) 1813 img.useAlpha = 1 1814 1815 retlist[#disabled] = img 1816 end if 1817 1818 1819 1820 ------------------------------- 1821 1822 if not(voidP(retlist.getaprop(#selected))) then 1823 1824 hlfarbe = options.getaprop(#selectedColor) 1825 if ilk(hlfarbe) = #color then temp.fill(temp.rect, hlfarbe) 1826 1827 img = image(dasrect.width, dasrect.height, 32, 1) 1828 aImg = image(img.width, img.height, 8, 0, #grayscale) 1829 img.useAlpha = 0 1830 1831 img.copyPixels(temp, temp.rect.offset(textbreite, texthoehe), temp.rect) 1832 aImg.copyPixels(temp2, temp2.rect.offset(textbreite, texthoehe), temp2.rect) 1833 1834 buttonIcon = buttonIconList.getaprop(#selected) 1835 if ilk(buttonIcon) <> #image then buttonIcon = buttonIconList.getaprop(#normal) 1836 if ilk(buttonIcon) = #image then 1837 if buttonIcon.depth = 32 then 1838 buttonIcon.useAlpha = 0 1839 buttonIconA = buttonIcon.extractAlpha() 1840 else 1841 buttonIconA = image(buttonIcon.width, buttonIconA.height, 8, 0, #grayscale) 1842 buttonIconA.fill(buttonIconA.rect, rgb(0,0,0)) 1843 end if 1844 1845 img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 1846 aImg.copyPixels(buttonIconA, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 1847 end if 1848 1849 img.setAlpha(aImg) 1850 img.useAlpha = 1 1851 1852 retlist[#selected] = img 1853 end if 1854 1855 1856 return retlist 1857 end 1858 1859 1860 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1861 1433 1862 on interface me 1434 str = "Button Image Creator Script by alex da franca ©2003 -- alex@farbflash.de -- all rigths reserved"1863 str = "Button Image Creator Script by alex da franca c2003 -- alex@farbflash.de -- all rigths reserved" 1435 1864 1436 1865 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str -
trunk/lingosource/castlib3/ButtonManager.ls
r15 r18 1 -- Manager for DrawTable Parentscript used on Bitmap sprites and 3-D Sprites 2 -- Alex da Franca ©2002 da.franca@online.de 1 -- ButtonManager 2 ----------------------------------- 3 -- CREATED: 4 -- Alex da Franca c2002 alex@farbflash.de 5 -- 6 -- DESCRIPTION: 7 -- Manager for GenericButtonPS Parentscript used on Bitmap sprites and 3-D Sprites 8 -- 3 9 -- Use this behavior on any dummy sprite to display a scrolling table with selectable items, text (fixed and editable) and images. 4 10 -- It creates a temporary bitmap member, which is used to display the table on the stage. 5 11 -- Specify the contents and appearance of the table in two property lists, which you pass to the mShowTable handler 6 12 -- Use a copy of the parentscript "TableOptionsliste" to build these two lists and receive events from the table 7 8 13 -- 14 -- REQUIRES: 15 -- script "GenericButtonPS" 16 -- 17 -- USAGE: 18 -- - 19 -- 20 -- HISTORY: 21 -- 9 22 -- alex am Freitag, 23. April 2004 10 23 -- added mRefreshSpriteRectAfterStageChange() handler to refresh the rect after a stage resize, sent from behavior "resizeStageBehavior" … … 60 73 61 74 75 --------------------------------- 76 -- Scriptmarker (18.09.2008 at 12:06 Uhr): alex changes // Scriptmarker 77 -- added handler mSetBroadcastlist to SET the ENTIRE list of callback instances 78 -- it now also supports callBackObjects a la [#target, #handler, ...] as callback objects, 79 -- which allows for additional parameters in that callbackObject, which gets send as parameter 80 81 -- added three new handlers: mSetEventsToProcessList, mAddToEventsToProcessList, mRemoveFromEventsToProcessList 82 -- use these handlers to change the events which shall be processed (which trigger events to the event listeners) 83 -- -- mSetEventsToProcessList sets the entire list 84 -- -- mAddToEventsToProcessList adds an event to the list of events which will be processed 85 -- -- mRemoveFromEventsToProcessList removes an event from the list of events which will be processed 86 -- -- -- possible events are: #mouseUp, #mouseDown, #mouseEnter, #mouseLeave 87 88 ----------------------------------- 89 90 91 92 property pKanal, pMember 93 62 94 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 63 95 -- xxxxxxxxxxxxxxxxxx PROPERTIES 64 96 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 65 97 66 property pKanal, pMember67 98 property pOldKeyDown 68 99 property pMyScriptObject … … 116 147 117 148 on interface me 118 str = "Button Script by alex da franca ©2005 -- alex@farbflash.de -- all rigths reserved"149 str = "Button Script by alex da franca c2005 -- alex@farbflash.de -- all rigths reserved" 119 150 put RETURN & "version 1.0" after str 120 151 put RETURN & "--------------------------------------------------------" after str … … 238 269 on mInitProperties me, pipeline 239 270 240 pIncludes = (mGetAleXtras()).getaprop(#scripts)271 pIncludes = xscr() 241 272 242 273 pKeyboardshortcutList = [:] … … 276 307 -- alex am 8. Oktober 2004 um 10:32 277 308 -- pMember = new(#bitmap) 278 pMember = call(#mGetNewMember, [pIncludes.getaprop(#commonmoviescript)],#bitmap)309 pMember = pIncludes.mGetNewMember(#bitmap) 279 310 --/ alex am 8. Oktober 2004 um 10:32 280 311 … … 364 395 -- alex am 8. Oktober 2004 um 10:32 365 396 -- pMember.erase() 366 call(#mEraseMember, [pIncludes.getaprop(#commonmoviescript)],pMember)397 pIncludes.mEraseMember(pMember) 367 398 -- alex am 8. Oktober 2004 um 10:32 368 399 end if … … 735 766 736 767 on mAddButton me, options 768 ----------------------------------- 769 -- ACTION: Add a new button. When used on a 2-D sprite, we will always have only one button per behavior 770 -- But if this is used on a 3-D sprite, we have only one behavior hosting different buttons as overlays on the 3-D sprite 771 -- Therefore we have a list of button objects 772 -- INPUT: <options> ; property list ; huge number of properties describing the button, most of which comes from mGetDefaultButtonList() 773 -- see script "defaultLayoutDefinitions" for all properties, which are available for the layout of the button 774 -- see the below example for the porperties concerning this script: 775 -- RETURNS: - 776 -- CALLER: - 777 -- EXAMPLE: 778 -- 779 -- buttonmembername = "buttonImage" 780 -- options = mGetDefaultButtonList() 781 -- options[#label] = "Choose new model" 782 -- i = member(buttonmembername).image.duplicate() 783 -- options[#myName] = "versionInfoIcon" 784 -- options[#myRect] = rect(0, 0, i.width, i.height) 785 -- options[#marginH] = 0 786 -- options[#marginV] = 0 787 -- options[#broadcastSprites] = [me] 788 -- options[#callFunction] = #mVersionInfoIconClicked 789 -- options[#myName] = buttonmembername 790 -- options[#normalImage] = buttonmembername 791 -- options[#eventsToProcess] = [#mouseDown, #mouseUp] 792 -- options[#disableBlend] = 0 793 -- options[#enabled] = 1 794 -- options[#recalcPosition] = point(0, 0) -- reposition the button on window resize (requires script "resizeWindowScripts" to get resize event) 795 -- 796 -- spr = xscr().mGetKanal(#sceneSprite) 797 -- sendSprite(spr, #mAddButton, options) 798 ----------------------------------- 737 799 738 800 if not(listP(pButtonList)) then mInitProperties me … … 744 806 options = pOptionsListe 745 807 746 if call(#mGetMemType, [pIncludes.getaprop(#commonmoviescript)],pMember) = #shockwave3d then -- 3-D mode808 if pIncludes.mGetMemType(pMember) = #shockwave3d then -- 3-D mode 747 809 r = options[#myRect] 748 810 … … 833 895 834 896 GenericButtonPS = mGetXScript(#GenericButtonPS) 835 if voidP(GenericButtonPS) then exit 836 837 if not objectP(theObject.getaprop(#myScriptObject)) then theObject[#myScriptObject] = new(GenericButtonPS) 897 if listP(GenericButtonPS) then exit 898 899 if not objectP(theObject.getaprop(#myScriptObject)) then 900 if ilk(GenericButtonPS) = #instance then GenericButtonPS = GenericButtonPS.script 901 theObject[#myScriptObject] = new(GenericButtonPS) 902 end if 838 903 839 904 if objectP(theObject.getaprop(#myScriptObject)) then -- if we succeded in initializing a button parent script (only fails if script "GenericButtonPS" isn't present)) … … 871 936 mo = pMember.model(val) 872 937 if not(voidP(mo)) then 873 scr = call(#mGetParentScriptList, [pIncludes.getaprop(#commonmoviescript)],mo)938 scr = pIncludes.mGetParentScriptList(mo) 874 939 875 940 repeat with n = scr.count down to 1 … … 900 965 901 966 on mRemoveButton me, tabname 967 ----------------------------------- 968 -- ACTION: Remove the specified button 969 -- INPUT: string ; button name 970 -- RETURNS: - 971 -- DEBUG: 972 -- spr = xscr().mGetKanal(#sceneSprite) 973 -- sendSprite(spr, #mRemoveButton, "versionInfoIcon") 974 ----------------------------------- 975 902 976 if not(pButtonList.count) then exit 903 977 … … 981 1055 -- instead put the removal into a seperate, indepandant event 982 1056 983 dto = call(#mCreateTimeout, [pIncludes.getaprop(#commonmoviescript)], pTextureBaseName&"_cleanup", 100, #mRemoveEmptyListEntries, me) 984 -- if mCheckWoody() = 1 then 985 -- dto = timeout().new(pTextureBaseName&"_cleanup", 100, #mRemoveEmptyListEntries, me) 986 -- else 987 -- dto = timeout(pTextureBaseName&"_cleanup").new(100, #mRemoveEmptyListEntries, me) 988 -- end if 1057 dto = pIncludes.mCreateTimeout(pTextureBaseName&"_cleanup", 100, #mRemoveEmptyListEntries, me) 989 1058 990 1059 end if … … 998 1067 end 999 1068 1000 1001 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1002 -- comes from the drop down menu, if any 1069 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1070 -- -- comes from the drop down menu, if any 1003 1071 1004 1072 on mHiliteMenu me, val … … 1006 1074 end 1007 1075 1008 1009 1010 1011 1076 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1012 1077 -- xxxxxxxxxxxxxxxxxx Public Handlers to change, control or get the button contents and properties … … 1014 1079 1015 1080 1016 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1017 -- check if a button is present -> this script normally simply applies all to the first button in the list, if tabname is unknown/undefined1018 -- sometimes, this is NOT what I want...1019 1020 1081 on mIsButtonPresent me, tabname 1082 ----------------------------------- 1083 -- ACTION: check if a button is present -> this script normally simply applies all to the first button in the list, if tabname is unknown/undefined 1084 -- sometimes, this is NOT what I want, therefore I needed a handler to tell, if a given button is present 1085 -- INPUT: <tabname> ; string ; name of the button we want to check 1086 -- RETURNS: boolean ; true, if button exists, false otherwise 1087 ----------------------------------- 1021 1088 1022 1089 if not(pButtonList.count) then return 0 1023 1090 1024 return (ilk(pButtonList.getaprop(tabname)) = #proplist) 1025 1026 end 1027 1028 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1029 -- get the propertylist of the button; e.g. to query the label etc. 1030 -- returns: #property list 1091 return objectP(pButtonList.getaprop(tabname)) 1092 1093 end 1094 1095 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1096 1031 1097 1032 1098 on mGetButtonProps me, tabname 1099 ----------------------------------- 1100 -- ACTION: get the propertylist of the button; e.g. to query the label etc. 1101 -- INPUT: <tabname> ; string ; name of the button we want to address 1102 -- RETURNS: #property list ; all button properties 1103 ----------------------------------- 1033 1104 1034 1105 if not(pButtonList.count) then return [:] … … 1045 1116 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1046 1117 1047 -- change the text:1048 -- accepts: #string1049 1118 on mChangeLabel me, newLabel, tabname 1119 ----------------------------------- 1120 -- ACTION: change the button label text => re-render the text and redraw the images 1121 -- INPUT: <newLabel> ; string ; new label 1122 -- <tabname> ; string ; name of the button we want to address 1123 -- RETURNS: - 1124 ----------------------------------- 1125 1050 1126 if ilk(newLabel) <> #string then exit 1051 1127 … … 1060 1136 1061 1137 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1062 -- special case of label change 1138 1139 on mChangeLanguage me, tabname 1140 ----------------------------------- 1141 -- ACTION: special case of label change 1063 1142 -- if mTranslate() yields another result the labels will change 1064 -- accepts: #string 1065 on mChangeLanguage me, tabname 1143 -- the new label will be determined by the "global" handler mTranslate() 1144 -- mTranslate is a handler of "commonMovieScript" 1145 -- INPUT: <tabname> ; string ; name of the button we want to address 1146 -- RETURNS: - 1147 ----------------------------------- 1066 1148 1067 1149 if not(pButtonList.count) then exit … … 1074 1156 1075 1157 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1076 -- ullala changed 05 1158 1077 1159 on mPause me, tValue 1160 ----------------------------------- 1161 -- ACTION: disable ALL events of this script, if pPause is true 1162 -- (can't remember why ulla put that here, normally we would to enable/disable specific buttons) 1163 -- this property disables ALL events for ALL buttons, 1164 -- I guess it is only useful, if we have only one button => 2-D sprite 1165 -- INPUT: <tValue> ; boolean (integer) 1166 -- RETURNS: - 1167 ----------------------------------- 1168 1078 1169 pPause = tValue 1079 1170 end 1080 1171 1081 1172 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1082 -- toggle the enabled state of the button; 1 = enable, 0 = disable 1083 -- accepts: #integer 1173 1084 1174 on mEnableButton me, val, tabname, alleAusser 1175 ----------------------------------- 1176 -- ACTION: toggle the enabled state of the button 1177 -- 1178 -- INPUT: <val> ; boolean (integer) ; 1 = enable, 0 = disable 1179 -- <tabname> ; string OR list ; name of the button we want to address or linear list of names of buttons we want to address 1180 -- <alleAusser> ; boolean (integer) ; reverse the action if true not the addressed buttons are toggled, but rather 1181 -- all buttons EXCEPT the ones specified in <tabname> 1182 -- RETURNS: - 1183 ----------------------------------- 1085 1184 1086 1185 if not(pButtonList.count) then exit … … 1118 1217 1119 1218 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1120 -- get the enabled state of the button; 1 = enabled, 0 = disabled1121 -- returns: #integer1122 1219 1123 1220 on mGetButtonEnabledState me, tabname 1221 ----------------------------------- 1222 -- ACTION: get the enabled state of the button 1223 -- 1224 -- INPUT: <tabname> ; string ; name of the button we want to address 1225 -- RETURNS: boolean (integer) 1226 ----------------------------------- 1124 1227 1125 1228 if not(pButtonList.count) then return 0 … … 1134 1237 1135 1238 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1136 -- change the event which shall be sent on mouseUp1239 -- 1137 1240 -- accepts: #symbol, #string 1241 1138 1242 on mSetButtonFunction me, newFunction, tabname 1243 ----------------------------------- 1244 -- ACTION: change the event which shall be sent to the lsiteners 1245 -- 1246 -- INPUT: <newFunction> ; symbol or string ; name of the event to send to the listeners 1247 -- Note, that a listener can define itself via a callbackObject, 1248 -- which is made of a #target and a #handler, in that case #handler overrides this functionname 1249 -- and every button can define its own handlernames to call on events 1250 -- <tabname> ; string ; name of the button we want to address 1251 -- RETURNS: - 1252 ----------------------------------- 1139 1253 1140 1254 if not(pButtonList.count) then exit … … 1151 1265 1152 1266 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1153 -- add a reference to an instance or sprite to the list of instances that get sent the event 1154 -- accepts: #object, #integer 1155 on mAddToButtonBroadcastlist me, referenz, tabname 1267 -- 1268 -- accepts: #list 1269 1270 on mSetBroadcastlist me, newBroadCastList, tabname 1271 ----------------------------------- 1272 -- ACTION: set the entire list of broadcastsprites 1273 -- (list with references to an instance or sprite from the list of instances that get sent the event) 1274 -- 1275 -- INPUT: <newBroadCastList> ; linear list ; list of event listeners 1276 -- (event listeners can be objects, strings, integers, symbols, callBackObjects [#handler:#buttonEvent, #target:me]) 1277 -- <tabname> ; string ; name of the button we want to address 1278 -- RETURNS: - 1279 ----------------------------------- 1280 1281 if not(listP(newBroadCastList)) then exit 1156 1282 1157 1283 if not(pButtonList.count) then exit … … 1163 1289 theObject = theObject.getaprop(#myScriptObject) 1164 1290 1165 if not(theObject.pOptions.broadcastSprites).getPos(referenz) then theObject.pOptions.broadcastSprites.add(referenz) 1166 end 1167 1168 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1169 -- remove a reference to an instance or sprite from the list of instances that get sent the event 1170 -- accepts: #object, #integer 1171 on mRemoveFromButtonBroadcastlist me, referenz, tabname 1291 theObject.pOptions[#broadcastSprites] = newBroadCastList 1292 1293 end 1294 1295 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1296 -- 1297 -- accepts: 1298 1299 on mAddToButtonBroadcastlist me, referenz, tabname 1300 ----------------------------------- 1301 -- ACTION: add a reference to an instance or sprite to the list of instances that get sent the event 1302 -- 1303 -- INPUT: <referenz> ; #object, #integer, #string, #symbol, callBackObject 1304 -- <tabname> ; string ; name of the button we want to address 1305 -- RETURNS: - 1306 ----------------------------------- 1172 1307 1173 1308 if not(pButtonList.count) then exit … … 1179 1314 theObject = theObject.getaprop(#myScriptObject) 1180 1315 1316 if not(theObject.pOptions.broadcastSprites).getPos(referenz) then theObject.pOptions.broadcastSprites.add(referenz) 1317 end 1318 1319 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1320 1321 on mRemoveFromButtonBroadcastlist me, referenz, tabname 1322 ----------------------------------- 1323 -- ACTION: remove a reference to an instance or sprite from the list of instances that get sent the event 1324 -- 1325 -- INPUT: <referenz> ; #object, #integer, #string, #symbol, callBackObject 1326 -- <tabname> ; string ; name of the button we want to address 1327 -- RETURNS: - 1328 ----------------------------------- 1329 1330 if not(pButtonList.count) then exit 1331 1332 if not voidP(tabname) then theObject = pButtonList.getaprop(tabname) 1333 else theObject = 0 1334 if ilk(theObject) <> #proplist then theObject = pButtonList[1] 1335 1336 theObject = theObject.getaprop(#myScriptObject) 1337 1181 1338 theObject.pOptions.broadcastSprites.deleteOne(referenz) 1182 1339 … … 1184 1341 1185 1342 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1186 -- get the enabled state of the button; 1 = enabled, 0 = disabled 1187 -- returns: #integer 1343 -- 1344 1345 -- accepts: #list 1346 1347 on mSetEventsToProcessList me, newEventList, tabname 1348 ----------------------------------- 1349 -- ACTION: set the entire list of events, which will be processed 1350 -- 1351 -- INPUT: <newEventList> ; linear list ; list of events to process for a specific button 1352 -- events which can be processed are: #mouseUp, #mouseDown, #mouseEnter, #mouseLeave 1353 -- <tabname> ; string ; name of the button we want to address 1354 -- RETURNS: - 1355 ----------------------------------- 1356 1357 if not(listP(newEventList)) then exit 1358 1359 if not(pButtonList.count) then exit 1360 1361 if not voidP(tabname) then theObject = pButtonList.getaprop(tabname) 1362 else theObject = 0 1363 if ilk(theObject) <> #proplist then theObject = pButtonList[1] 1364 1365 theObject = theObject.getaprop(#myScriptObject) 1366 1367 theObject.pOptions[#eventsToProcess] = newEventList 1368 1369 end 1370 1371 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1372 -- 1373 -- -- -- events which can be processed are: #mouseUp, #mouseDown, #mouseEnter, #mouseLeave 1374 -- accepts: #symbol 1375 1376 on mAddToEventsToProcessList me, theEvent, tabname 1377 ----------------------------------- 1378 -- ACTION: add an event to the list of processed events 1379 -- 1380 -- INPUT: <theEvent> ; symbol 1381 -- events which can be processed are: #mouseUp, #mouseDown, #mouseEnter, #mouseLeave 1382 -- <tabname> ; string ; name of the button we want to address 1383 -- RETURNS: - 1384 ----------------------------------- 1385 1386 if not(pButtonList.count) then exit 1387 1388 if not voidP(tabname) then theObject = pButtonList.getaprop(tabname) 1389 else theObject = 0 1390 if ilk(theObject) <> #proplist then theObject = pButtonList[1] 1391 1392 theObject = theObject.getaprop(#myScriptObject) 1393 1394 eventsToProcess = theObject.pOptions[#eventsToProcess] 1395 if not(listP(eventsToProcess)) then 1396 theObject.pOptions[#eventsToProcess] = [theEvent] 1397 else 1398 eventsToProcess.deleteOne(theEvent) 1399 eventsToProcess.add(theEvent) 1400 end if 1401 1402 end 1403 1404 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1405 1406 on mRemoveFromEventsToProcessList me, theEvent, tabname 1407 ----------------------------------- 1408 -- ACTION: remove an event from the list of processed events 1409 -- 1410 -- INPUT: <theEvent> ; symbol 1411 -- events which can be processed are: #mouseUp, #mouseDown, #mouseEnter, #mouseLeave 1412 -- <tabname> ; string ; name of the button we want to address 1413 -- RETURNS: - 1414 ----------------------------------- 1415 1416 if not(pButtonList.count) then exit 1417 1418 if not voidP(tabname) then theObject = pButtonList.getaprop(tabname) 1419 else theObject = 0 1420 if ilk(theObject) <> #proplist then theObject = pButtonList[1] 1421 1422 theObject = theObject.getaprop(#myScriptObject) 1423 1424 eventsToProcess = theObject.pOptions[#eventsToProcess] 1425 if not(listP(eventsToProcess)) then 1426 theObject.pOptions[#eventsToProcess] = [] 1427 else 1428 eventsToProcess.deleteOne(theEvent) 1429 end if 1430 1431 end 1432 1433 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1434 1188 1435 on mGetButtonState me, tabname 1436 ----------------------------------- 1437 -- ACTION: get the selected state of the button (radio or toggle button - checkbox) 1438 -- INPUT: <tabname> ; string ; name of the button we want to address 1439 -- RETURNS: boolean (integer) 1440 ----------------------------------- 1189 1441 1190 1442 if not(pButtonList.count) then return 0 … … 1198 1450 1199 1451 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1200 -- set the enabled state of the button; 1 = enabled, 0 = disabled 1201 -- accepts: #integer 1452 1202 1453 on mSetButtonState me, selState, tabname 1454 ----------------------------------- 1455 -- ACTION: set the selected state of the button (radio or toggle button - checkbox) 1456 -- 1457 -- INPUT: <selState> ; boolean (integer) ; true => selected, false => not selected 1458 -- <tabname> ; string ; name of the button we want to address 1459 -- RETURNS: - 1460 ----------------------------------- 1203 1461 1204 1462 if not(pButtonList.count) then exit … … 1227 1485 1228 1486 on mTranslateAllButtonRects me, delta 1487 ----------------------------------- 1488 -- ACTION: move all buttons by point <delta> 1489 -- 1490 -- INPUT: <delta> ; point ; offset x and offset y to move the button sprite/overlay 1491 -- RETURNS: - 1492 ----------------------------------- 1493 1229 1494 repeat with n = count(pButtonList) down to 1 1230 1495 mTranslateButtonRect me, delta, pButtonList.getPropAt(n) … … 1236 1501 1237 1502 on mTranslateButtonRect me, trans, tabname 1503 ----------------------------------- 1504 -- ACTION: move a single button by point <trans> 1505 -- 1506 -- INPUT: <trans> ; point ; offset x and offset y to move the button sprite/overlay 1507 -- <tabname> ; string ; name of the button we want to address 1508 -- RETURNS: - 1509 ----------------------------------- 1510 1238 1511 if not(pButtonList.count) then exit 1239 1512 … … 1249 1522 1250 1523 on mSetCurrentButtonRect me, newRect, tabname 1524 ----------------------------------- 1525 -- ACTION: set the rect of the specified button to absolut stage coordinates 1526 -- (this may distort the button, so best is to use the rect you get from mGetCurrentButtonRect()) 1527 -- 1528 -- INPUT: <newRect> ; rect ; new button rect 1529 -- <tabname> ; string ; name of the button we want to address 1530 -- RETURNS: - 1531 ----------------------------------- 1532 1251 1533 if not(pButtonList.count) then exit 1252 1534 … … 1263 1545 1264 1546 on mGetCurrentButtonRect me, tabname 1547 ----------------------------------- 1548 -- ACTION: get the rect of the specified button in absolut stage coordinates 1549 -- 1550 -- INPUT: <tabname> ; string ; name of the button we want to address 1551 -- RETURNS: rect 1552 ----------------------------------- 1553 1265 1554 if not(pButtonList.count) then return 0 1266 1555 … … 1274 1563 end 1275 1564 1276 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1565 1566 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1567 on _____SEMI_PUBLIC_HANDLERS 1568 -- handlers from other scripts, in this case from the resize stage behavior 1569 end 1570 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1571 1277 1572 -- event from the resize bar behavior 1278 1573 … … 1414 1709 1415 1710 1416 blenderTO = call(#mCreateTimeout, [pIncludes.getaprop(#commonmoviescript)],"ButtonManager_BlenderTimeout", 30, #mDoBlendAnimation, me)1711 blenderTO = pIncludes.mCreateTimeout("ButtonManager_BlenderTimeout", 30, #mDoBlendAnimation, me) 1417 1712 -- if mCheckWoody() = 1 then 1418 1713 -- blenderTO = timeout().new("ButtonManager_BlenderTimeout", 30, #mDoBlendAnimation, me) … … 1445 1740 1446 1741 callFunction = eventList.getaprop(#callFunction) 1447 if ilk(callFunction) = #symbol then1448 anz = eventList[#broadcastSprites].count1742 -- if ilk(callFunction) = #symbol then 1743 anz = count(eventList[#broadcastSprites]) 1449 1744 eventList[#secondEvent] = secondEvent 1450 1745 if not(anz) then 1746 if ilk(callFunction) = #symbol then 1451 1747 sendAllSprites(callFunction, whichEvent, eventList, me, callerObject) 1748 end if 1452 1749 else if eventList[#broadcastSprites][1] = -1 then 1750 if ilk(callFunction) = #symbol then 1453 1751 str = string(callFunction)&&"#"&whichEvent&","&"E&eventList.getaprop(#label)"E&","&&eventList.getaprop(#selected)&","&&secondEvent 1454 1752 do str 1753 end if 1455 1754 else if eventList[#broadcastSprites][1] = 0 then 1755 if ilk(callFunction) = #symbol then 1456 1756 sendSprite(me.spritenum, callFunction, whichEvent, eventList, me, callerObject) 1757 end if 1457 1758 else 1458 1759 repeat with n = 1 to anz 1459 1760 this = eventList[#broadcastSprites][n] 1460 1761 if integerP(this) then 1762 if ilk(callFunction) = #symbol then 1461 1763 sendSprite(this, callFunction, whichEvent, eventList, me, callerObject) 1764 end if 1462 1765 else if ilk(this) = #instance then 1766 if ilk(callFunction) = #symbol then 1463 1767 call(callFunction, [this], whichEvent, eventList, me, callerObject) 1768 end if 1464 1769 else if ilk(this) = #script then 1770 if ilk(callFunction) = #symbol then 1465 1771 call(callFunction, [this], whichEvent, eventList, me, callerObject) 1466 else 1467 derkanal = call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)], this) 1772 end if 1773 else if ilk(this) = #proplist then 1774 cfunc = this[#handler] 1775 if ilk(cfunc) <> #symbol then cfunc = callFunction 1776 if ilk(cfunc) = #symbol then 1777 tgt = this[#target] 1778 if objectP(tgt) then 1779 call(cfunc, [tgt], whichEvent, eventList, me, callerObject, this) 1780 else 1781 derkanal = pIncludes.mGetKanal(tgt) 1782 if derkanal > 0 then sendSprite(derkanal, cfunc, whichEvent, eventList, me, callerObject, this) 1783 end if 1784 end if 1785 else 1786 if ilk(callFunction) = #symbol then 1787 derkanal = pIncludes.mGetKanal(this) 1468 1788 if derkanal > 0 then sendSprite(derkanal, callFunction, whichEvent, eventList, me, callerObject) 1469 1789 end if 1470 end repeat 1471 end if 1790 end if 1791 end repeat 1792 -- end if 1472 1793 end if 1473 1794 … … 2018 2339 retval = 1 2019 2340 2341 thisButton.setaprop(#currentPressed, 0) 2342 2020 2343 exit repeat 2021 2344 … … 2028 2351 end if 2029 2352 end if 2353 2030 2354 end if 2031 2355 end if … … 2034 2358 end if 2035 2359 2360 if count(pButtonList) > 0 then 2036 2361 repeat with n = n down to 1 2037 2362 thisButton = pButtonList[n] 2038 2363 if thisButton.getaprop(#currentPressed) = 1 then 2039 2364 call(#myMouseUpOutside, [thisButton.getaprop(#myScriptObject)]) 2365 thisButton.setaprop(#currentPressed, 0) 2040 2366 end if 2041 2367 end repeat 2368 end if 2042 2369 2043 2370 return retval … … 2154 2481 on myKeyDown me, tk, kc, theName 2155 2482 2156 if call(#mHandleKeyEvent, [pIncludes.getaprop(#commonmoviescript)],tk, kc) then exit -- this is a movielevel handler, which gets keyevents first for example to quit the movie2483 if pIncludes.mHandleKeyEvent(tk, kc) then exit -- this is a movielevel handler, which gets keyevents first for example to quit the movie 2157 2484 2158 2485 if not pAktiv then exit … … 2164 2491 else 2165 2492 theObject = pButtonList.getaprop(theName) 2166 if ilk(theObject) = #proplistthen2493 if objectP(theObject) then 2167 2494 call(#mKeyDown, [theObject.getaprop(#myScriptObject)], tk, kc) 2168 2495 end if … … 2200 2527 breite = whichImg.width 2201 2528 hoehe = whichImg.height 2202 powerbreite = call(#mGetNextPowerOfTwo, [pIncludes.getaprop(#commonmoviescript)],breite)2203 powerhoehe = call(#mGetNextPowerOfTwo, [pIncludes.getaprop(#commonmoviescript)],hoehe)2529 powerbreite = pIncludes.mGetNextPowerOfTwo(breite) 2530 powerhoehe = pIncludes.mGetNextPowerOfTwo(hoehe) 2204 2531 2205 2532 if (powerbreite <> breite) or (powerhoehe <> hoehe) then -
trunk/lingosource/castlib3/DropShadowPScript.ls
r14 r18 1 -- Drop Shadow and Cutout 2 -- Alex da Franca ©2002 3 -- da.franca@online.de 4 1 -- DropShadowPScript 2 ----------------------------------- 3 -- CREATED: 4 -- Alex da Franca c2002 - alex@farbflash.de 5 -- 6 -- DESCRIPTION: 7 -- Apply a Drop Shadow or Cutout to an image object. 8 -- It started as drop shadow for rectangles using plain lingo. 9 -- In D10.1 Flash filters appeared and since then we can do much faster 10 -- and much better blur and therefore drop shadows. 11 -- My frontend to flash filters is the script "FlashBitmapFilterPS" 12 -- So as soon as this script is found in one of the castlibs, the flash bitmap filters are used 13 -- instead of the slower and limited to rects lingo solution. 14 -- 15 -- REQUIRES: 16 -- script "commonMovieScript" 17 -- optional: script "FlashBitmapFilterPS" 18 -- 19 -- USAGE: 20 -- There is only one single function: mGetShadowImage 21 -- Use that function to pply a shadow to an image object. 22 -- EXAMPLE: 23 -- 24 -- imgList = xscr(#DropShadowPScript).mGetShadowImage(myImageObject, rgb(0,0,0), 6, 55, 18, 1, #shadow) 25 -- newShadowImage = imgList[1] 26 -- maskeImage = imgList[2] 27 -- shadowOffset = imgList[3] 28 -- 29 -- HISTORY: 30 -- 5 31 -- change 22.08.03 6 32 -- existing alphachannel now will be preserved … … 9 35 -- New Flash Bitmap filter if script "FlashBitmapFilterPS" is present and version > 10.10 => flash bitmap filter was introduced with 10.11 10 36 11 ----------- 12 -- Accepts: 13 ----------- 14 -- theImg = [#format:#imageObject, #comment:"source image"] 15 -- shadowColor = [#format:#color, #default:rgb(0,0,0), #comment:"Shadow Color"] 16 -- shadowDistance = [#format:#integer, #default:14, #range:[#min:2, #max:40], #comment:"Schattenhoehe:"] 17 -- winkel = [#format:#integer, #default:45, #range:[#min:0, #max:360], #comment:"Winkel:"] 18 -- blur = [#format:#integer, #default:14, #range:[#min:2, #max:40], #comment:"Schatten Blur:"] 19 -- exponent = [#format:#boolean, #default:1, #comment:"exponentiale grauverteilung:"] 20 -- theStyle = [#format:#symbol, #default:#shadow, #range:[#shadow, #cutout], #comment:"Shadow style:"] 21 -- returnMask = [#format:#boolean, #default:0, #comment:"if style = #cutout return image and mask instead of drawing into iamge"] 22 -- alphaLevel = [#format:#float #integer, #default:1.0, #range:[#min:0.0, #max:1.0], #comment:"Only used for flash filters: alphalevel (if integer is used -> range => 0 - 100)"] 23 24 ----------- 25 -- Returns: 26 ----------- 27 -- if <theStyle> = #shadow then returns linear list with: 28 -- imageObject, the original image copied onto a border for the drop shadow 29 -- imageObject (8-bit #grayscale), to use as mask for the shadow 30 -- point, the offset of the returned image from top left 31 32 -- if <theStyle> = #cutout then returns nothing, but rather draws the shadow directly into the imageObject <theImg>, which was passed to the function 33 -- except when <returnMask> is true 34 35 36 ----------- 37 -- Requires: 38 ----------- 39 -- script "commonMovieScript" 40 -- optional: script "FlashBitmapFilterPS" 41 42 43 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 37 -- Scriptmarker (15.10.2008 at 10:34 Uhr): alex changes // Scriptmarker 38 -- added paramater to prevent trimwhitespace, when using flash bitmap filters for drop shadows 39 ----------------------------------- 40 41 44 42 45 43 on new me … … 51 49 52 50 on interface me 53 str = "DropShadowPScript by alex da franca ©2003 -- alex@farbflash.de -- all rigths reserved"51 str = "DropShadowPScript by alex da franca c2003 -- alex@farbflash.de -- all rigths reserved" 54 52 55 53 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 56 54 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 57 put RETURN & "on mGetShadowImage me, theIm g, shadowColor, shadowDistance, winkel, blur, exponent, theStyle, returnMask, alphaLevel" after str55 put RETURN & "on mGetShadowImage me, theImage, shadowColor, shadowDistance, shadowAngle, blur, exponent, theStyle, returnMask, alphaLevel, dontTrimWhiteSpace" after str 58 56 put RETURN & "" after str 59 57 … … 64 62 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 65 63 66 on mGetShadowImage me, theImg, shadowColor, shadowDistance, winkel, blur, exponent, theStyle, returnMask, alphaLevel 67 68 if ilk(theImg) <> #image then return [] 64 on mGetShadowImage me, theImage, shadowColor, shadowDistance, shadowAngle, blur, exponent, theStyle, returnMask, alphaLevel, dontTrimWhiteSpace 65 ----------------------------------- 66 -- ACTION: Apply a Drop Shadow or Cutout to an image object. 67 -- As soon as this script is found in one of the castlibs, the flash bitmap filters are used 68 -- instead of the slower and limited to rects lingo solution. 69 -- INPUT: 70 -- <theImage> = [#format:#imageObject, #comment:"source image"] 71 -- <shadowColor> = [#format:#color, #default:rgb(0,0,0), #comment:"Shadow Color"] 72 -- <shadowDistance> = [#format:#integer, #default:14, #range:[#min:2, #max:40], #comment:"Schattenhoehe:"] 73 -- <shadowAngle> = [#format:#integer, #default:45, #range:[#min:0, #max:360], #comment:"shadowAngle:"] 74 -- <blur> = [#format:#integer, #default:14, #range:[#min:2, #max:40], #comment:"Schatten Blur:"] 75 -- <exponent> = [#format:#boolean, #default:1, #comment:"exponentiale grauverteilung:"] 76 -- <theStyle> = [#format:#symbol, #default:#shadow, #range:[#shadow, #cutout], #comment:"Shadow style:"] 77 -- <returnMask> = [#format:#boolean, #default:0, #comment:"if style = #cutout return image and mask instead of drawing into image"] 78 -- <alphaLevel> = [#format:#float #integer, #default:1.0, #range:[#min:0.0, #max:1.0], #comment:"Only used for flash filters: alphalevel (if integer is used -> range => 0 - 100)"] 79 -- <dontTrimWhiteSpace> = [#format:#boolean, #default:0, #comment:"If using flash bitmap filters, flag to NOT trimwhitespace, so that the image object will retain its size"] 80 -- RETURNS: 81 -- if <theStyle> = #shadow then returns linear list with: 82 -- imageObject, the original image copied onto a border for the drop shadow 83 -- imageObject (8-bit #grayscale), to use as mask for the shadow 84 -- point, the offset of the returned image from top left 85 -- 86 -- if <theStyle> = #cutout then returns nothing, but rather draws the shadow directly into the imageObject <theImage>, which was passed to the function 87 -- except when <returnMask> is true 88 -- EXAMPLE: 89 -- imgList = xscr(#DropShadowPScript).mGetShadowImage(myImageObject, rgb(0,0,0), 6, 55, 18, 1, #shadow) 90 -- newShadowImage = imgList[1] 91 -- maskeImage = imgList[2] 92 -- shadowOffset = imgList[3] 93 ----------------------------------- 94 95 if ilk(theImage) <> #image then return [] 69 96 if ilk(shadowColor) <> #color then shadowColor = rgb(0,0,0) 70 97 if ilk(shadowDistance, #number) = 0 then shadowDistance = 14 71 98 if ilk(blur, #number) = 0 then blur = 14 72 if ilk( winkel, #number) = 0 then winkel= 4599 if ilk(shadowAngle, #number) = 0 then shadowAngle = 45 73 100 74 101 … … 82 109 if theStyle <> #cutout then 83 110 cms = mGetXscript() 84 if voidP(cms) then scr = mGetInstance("FlashBitmapFilterPS")111 if listP(cms) then scr = mGetInstance("FlashBitmapFilterPS") 85 112 else scr = call(#mGetInstance, cms, "FlashBitmapFilterPS") 86 113 if ilk(scr) = #instance then … … 96 123 if xlist[n].getaprop(#name) = #ActionScriptObjects then 97 124 prodVers = xlist[n].getaprop(#version) 98 vn = call(#mGetFloatVersionNumber, [mGetXscript()], prodVers)125 vn = call(#mGetFloatVersionNumber, mGetXscript(), prodVers) 99 126 if ilk(vn, #number) = 1 then flash8XtraPresent = (vn > 10.1) 100 127 exit repeat … … 112 139 -- if theStyle = #cutout then 113 140 -- if not(returnMask) then 114 -- winkel = winkel+ 180115 -- shdparams = [#distance: shadowDistance, #angle: winkel, #alpha: alphaLevel, #quality: 3, #blurX: blur, #blurY: blur, #shadowcolor: shadowColor, #highlightalpha:0.0, #type:"inner"]116 -- i = call(#mBevel, [scr], theImg, shdparams)141 -- shadowAngle = shadowAngle + 180 142 -- shdparams = [#distance: shadowDistance, #angle: shadowAngle, #alpha: alphaLevel, #quality: 3, #blurX: blur, #blurY: blur, #shadowcolor: shadowColor, #highlightalpha:0.0, #type:"inner"] 143 -- i = call(#mBevel, [scr], theImage, shdparams) 117 144 -- -- call(#mPut, [mGetXScript()], i) 118 -- theImg.copyPixels(i, i.rect, i.rect)145 -- theImage.copyPixels(i, i.rect, i.rect) 119 146 -- exit 120 147 -- end if 121 148 -- else 122 149 123 rAlt = theImg.rect150 rAlt = theImage.rect 124 151 125 152 blur = blur/3.0 126 153 shadowDistance = shadowDistance / 3. 127 154 128 shdparams = [#distance: shadowDistance, #angle: winkel, #alpha: alphaLevel, #quality: 3, #blurX: blur, #blurY: blur, #color: shadowColor]129 i = call(#mDropShadow, scr, theImg, shdparams)155 shdparams = [#distance: shadowDistance, #angle: shadowAngle, #alpha: alphaLevel, #quality: 3, #blurX: blur, #blurY: blur, #color: shadowColor] 156 i = call(#mDropShadow, scr, theImage, shdparams) 130 157 131 158 rNeu = i.rect … … 134 161 135 162 163 if dontTrimWhiteSpace then 164 165 m = i.extractAlpha() 166 return [i, m, point(0,0)] 167 168 else 136 169 -- get the cropped rect: 137 170 -- croprect = call(#mGetCropRect, [mGetXscript(#ImageUtilityScripts)], i.extractAlpha()) … … 158 191 return [i2, m, vers] 159 192 160 --end if193 end if 161 194 162 195 end if … … 175 208 176 209 -- blur = min(blur, shadowDistance) 177 theRect = theIm g.rect210 theRect = theImage.rect 178 211 179 212 -- radialer verlauf … … 235 268 pSchatten.fill(rect(blur, blur, (breite - blur), (hoehe - blur)), col) 236 269 237 rad = pi()/180 * winkel270 rad = pi()/180 * shadowAngle 238 271 halbesblur = blur/2.0 239 272 … … 297 330 t2.copyPixels(tempimg, theRect, theRect.offset(vhBild, vvBild), [#ink:2]) 298 331 t2 = t2.createMask() 299 -- i2 = theIm g.duplicate()300 -- i3 = image(theRect.width, theRect.height, theIm g.depth, 0)332 -- i2 = theImage.duplicate() 333 -- i3 = image(theRect.width, theRect.height, theImage.depth, 0) 301 334 -- i3.fill(i3.rect, shadowColor) 302 335 -- i2.copyPixels(i3, theRect, theRect, [#maskImage:t2]) 303 336 -- return i2 304 337 305 i3 = image(theRect.width, theRect.height, theIm g.depth, 0)338 i3 = image(theRect.width, theRect.height, theImage.depth, 0) 306 339 i3.fill(i3.rect, shadowColor) 307 340 … … 309 342 return [t2, i3] 310 343 else 311 theIm g.copyPixels(i3, theRect, theRect, [#maskImage:t2])344 theImage.copyPixels(i3, theRect, theRect, [#maskImage:t2]) 312 345 end if 313 346 314 347 else 315 if theIm g.depth = 32 and theImg.useAlpha = 1 then316 tempimg.copyPixels(theIm g.extractalpha(), theRect.offset(vhBild, vvBild), theRect)348 if theImage.depth = 32 and theImage.useAlpha = 1 then 349 tempimg.copyPixels(theImage.extractalpha(), theRect.offset(vhBild, vvBild), theRect) 317 350 else 318 351 tempimg.fill(theRect.offset(vhBild, vvBild), rgb(0,0,0)) 319 352 end if 320 353 321 t2 = image((theRect.width + imgW), (theRect.height + imgH), theIm g.depth, 0)354 t2 = image((theRect.width + imgW), (theRect.height + imgH), theImage.depth, 0) 322 355 t2.fill(t2.rect, shadowColor) 323 t2.copyPixels(theIm g, theImg.rect.offset(vhBild, vvBild), theImg.rect)356 t2.copyPixels(theImage, theImage.rect.offset(vhBild, vvBild), theImage.rect) 324 357 return [t2, tempimg, point(vhBild, vvBild)] 325 358 end if -
trunk/lingosource/castlib3/FileIOFunktionen.ls
r15 r18 1 -- FileIO Handlers -- ©03 Alex da Franca -- alex@farbflash.de1 -- FileIO Handlers -- c03 Alex da Franca -- alex@farbflash.de 2 2 --------------------------------------------------------------------- 3 3 … … 63 63 if not(internetLink) then internetLink = (fname starts "www.") 64 64 if the runmode contains "plugin" or internetLink then 65 scr = xscr().mGetInstance("NetLingoManagerPS__")66 if ilk(scr) = #instance then67 scr.mStartNetOP(paramList)68 else65 -- scr = xscr().mGetInstance("NetLingoManagerPS__") 66 -- if ilk(scr) = #instance then 67 -- scr.mStartNetOP(paramList) 68 -- else 69 69 scr = xscr().mGetInstance("NetTextReaderPS") 70 70 if ilk(scr) = #instance then … … 75 75 call(paramList.getaprop(#handler), [paramList.getaprop(#target)], paramList) 76 76 end if 77 end if77 -- end if 78 78 else 79 79 paramList.setaprop(#theTextResult, mGetTextFromFile(me, paramList.getaprop(#theURL))) … … 106 106 if call(#mCheckForXtra, mGetXScript(), "BudAPI") = 1 then 107 107 startfolder = string(startfolder) 108 109 resetUNames = 0 110 if the platform contains "mac" then 111 if baSysFolder("prefs") starts "/" then 112 baReturnUnixNames(0) 113 resetUNames = 1 114 end if 115 end if 108 116 if length(startfolder) > 0 then 109 117 pfad = baGetFilename("save", startfolder, theDefaultName, "", 524288+2+4+4194304, theTitle, false, -1, -1) … … 111 119 pfad = baGetFilename("save", "", theDefaultName, "", 524288+2+4+4194304, theTitle, false, -1, -1) 112 120 end if 121 122 if resetUNames = 1 then baReturnUnixNames(1) 123 113 124 else 114 125 pfad = fio.displaySave(theTitle, theDefaultName) … … 275 286 if call(#mCheckForXtra, mGetXScript(), "BudAPI") = 1 then 276 287 288 resetUNames = 0 289 if the platform contains "mac" then 290 if baSysFolder("prefs") starts "/" then 291 baReturnUnixNames(0) 292 resetUNames = 1 293 end if 294 end if 295 277 296 startDir = string(startDir) 278 297 defaultName = string(defaultName) … … 281 300 prompt = string(prompt) 282 301 283 return baGetFilename("open", startDir, defaultName, filetypes, 524288+4+2+4194304, prompt, false, -2, -1) 302 retval = baGetFilename("open", startDir, defaultName, filetypes, 524288+4+2+4194304, prompt, false, -2, -1) 303 304 if resetUNames = 1 then baReturnUnixNames(1) 305 306 return retval 284 307 285 308 else … … 307 330 308 331 if xscr().mCheckForXtra("BudAPI") = 1 then -- if buddy is present... 332 333 resetUNames = 0 334 if the platform contains "mac" then 335 if baSysFolder("prefs") starts "/" then 336 baReturnUnixNames(0) 337 resetUNames = 1 338 end if 339 end if 340 309 341 retval = baGetFolder( "", "Select a folder", 3, "", 50, 50 ) 342 343 if resetUNames = 1 then baReturnUnixNames(1) 344 310 345 else if xscr().mCheckForXtra("FileXtra4") = 1 then -- if not buddy then try filextra 311 346 fx = (xtra "filextra4").new() … … 340 375 341 376 if xscr().mCheckForXtra("BudAPI") then -- if buddy is present... 377 342 378 -- -- budApi version: 343 379 retval = baFileList(folderpath, "*.*") … … 349 385 retval = fx.fx_FolderToList(folderpath) 350 386 delim = the last char of the moviepath 351 if length(delim) < 1 then delim = the last char of the applicationpath 387 if length(delim) < 1 then 388 if not(the runmode contains "plug") then 389 delim = the last char of the applicationpath 390 end if 391 end if 352 392 if length(delim) < 1 then delim = "/" 353 393 repeat with n = count(retval) down to 1 … … 390 430 retval = fx.fx_FolderToList(folderpath) 391 431 delim = the last char of the moviepath 392 if length(delim) < 1 then delim = the last char of the applicationpath 432 if length(delim) < 1 then 433 if not(the runmode contains "plug") then 434 delim = the last char of the applicationpath 435 end if 436 end if 393 437 if length(delim) < 1 then delim = "/" 394 438 repeat with n = count(retval) down to 1 … … 416 460 this = getnthfilenameinfolder(folderpath, n) 417 461 end repeat 462 end if 463 464 return retval 465 466 end 467 468 469 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 470 471 on mGetFileAndFolderList me, folderpath 472 if the runmode contains "plugin" then return [] 473 474 if length(string(folderpath)) < 1 then folderpath = mGetFolderPathFromUser(me) 475 if length(folderpath) < 1 then return [] 476 477 if xscr().mCheckForXtra("BudAPI") then -- if buddy is present... 478 -- -- budApi version: 479 retval = baFolderList(folderpath) 480 filelist = baFileList(folderpath, "*.*") 481 repeat with f in filelist 482 retval.add(f) 483 end repeat 484 485 else if xscr().mCheckForXtra("FileXtra4") then -- if not buddy then try filextra 486 -- -- filextra4 version: 487 fx = (xtra "filextra4").new() 488 if objectP(fx) then 489 retval = fx.fx_FolderToList(folderpath) 490 end if 491 fx = 0 492 493 else 494 495 retval = [] 496 n = 1 497 this = getnthfilenameinfolder(folderpath, n) 498 repeat while length(this) > 0 499 retval.add(this) 500 n = n + 1 501 this = getnthfilenameinfolder(folderpath, n) 502 end repeat 503 418 504 end if 419 505 … … 570 656 571 657 on interface me 572 str = "FileIO Scripts by alex da franca ©2003 -- alex@farbflash.de -- all rigths reserved"658 str = "FileIO Scripts by alex da franca c2003 -- alex@farbflash.de -- all rigths reserved" 573 659 574 660 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str -
trunk/lingosource/castlib3/GenericButtonPS.ls
r15 r18 1 -- xxxxxxxxx STANDARD GENERIC BUTTON 2 -- by Alex da Franca da.franca@online.de 3 4 -- created: 31.08.03 5 1 -- GenericButtonPS 2 ----------------------------------- 3 -- CREATED: 31.08.03 - by Alex da Franca alex@farbflash.de 4 -- 5 -- DESCRIPTION: STANDARD GENERIC BUTTON 6 -- abstract button script. This script just outputs an image object for a button. 7 -- It receives the events for mouse interaction and changes the images accordingly and sends events 8 -- So it can be used in an abstarct manner as button on a sprite as well as as overlay or texture 9 -- Use script "ButtonManager" as interface for this script. "ButtonManager" will send/receive the events 10 -- and updatethe sprite or overlay 11 -- - 12 -- 13 -- REQUIRES: 14 -- (Prerequisites) 15 -- 16 -- USAGE: 17 -- - 18 -- 19 -- PARAMS: 20 -- - 21 -- 22 -- RETURNS: 23 -- - 24 -- 25 -- WARNINGS: 26 -- - 27 -- 28 -- CHANGELOG: 6 29 -- alex am Freitag, 23. April 2004 7 30 -- added mTranslateRect and mSetCurrentRect in order to be able to move the button rect, in case the button moves (-> i.e. stage resize) … … 18 41 -- alex am 1. August 2004 um 10:55 19 42 -- fixed bug with radio buttons 43 ----------------------------------------- 44 45 46 property pRect 20 47 21 48 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx … … 28 55 property pDown, pIsInside 29 56 property pKlickSound 30 property pRect 57 31 58 32 59 -- gpdls: … … 45 72 46 73 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 47 -- xxxxxxxxxxxxxxxxxx DIRECTOR EVENTS 74 on _____________DIRECTOR_EVENTS me 75 end 48 76 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 49 77 … … 57 85 58 86 if ilk(caller) = #instance then 59 if ilk(options) = #proplistthen87 if objectP(options) then 60 88 mCreate me, caller, options, theName 61 89 end if … … 67 95 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 68 96 97 on mDestroy me 98 pCallerRef = 0 -- break the circular reference !! 99 end 100 101 102 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 103 on _____________PUBLIC_EVENTS me 104 end 105 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 106 69 107 on mCreate me, caller, options, theName 108 ----------------------------------- 109 -- ACTION: create a new button 110 -- INPUT: <caller> ; object ; communication pipeline -- circular reference !!! Careful with that!! 111 -- <options> ; property list with all props describing the button. Most of which comes from mGetDefaultButtonList() 112 -- see script "defaultLayoutDefinitions" for all properties, which are available for the layout of the button 113 -- <theName> ; string ; name for the button 114 -- RETURNS: - 115 ----------------------------------- 116 70 117 if ilk(caller) <> #instance then exit 71 118 … … 100 147 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 101 148 102 on mDestroy me 103 pCallerRef = 0 104 end 105 106 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 107 108 on mSendUpdate me 109 call(#mUpdateImage, [pCallerRef], pImg, me, pMyName) 110 end 111 149 on mGetOptionsList me 150 ----------------------------------- 151 -- ACTION: get the options list of the button 152 -- INPUT: - 153 -- RETURNS: property list 154 ----------------------------------- 155 156 if ilk(pOptions) <> #proplist then return [:] 157 return pOptions 158 end 159 160 161 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 162 163 on mChangeLabel me, newLabel 164 ----------------------------------- 165 -- ACTION: change the text on the button -> label 166 -- INPUT: <newLabel> ; string ; new label 167 -- RETURNS: - 168 ----------------------------------- 169 170 if ilk(newLabel) <> #string then exit 171 pOptions[#label] = newLabel 172 mInitImgs me 173 end 174 175 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 176 177 on mChangeLanguage me 178 ----------------------------------- 179 -- ACTION: special case of label change 180 -- if mTranslate() yields another result the labels will change 181 -- the new label will be determined by the "global" handler mTranslate() 182 -- mTranslate is a handler of "commonMovieScript" 183 -- INPUT: - 184 -- RETURNS: - 185 ----------------------------------- 186 187 mInitImgs me 188 end 189 190 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 191 192 on mEnableMe me, val 193 ----------------------------------- 194 -- ACTION: toggle the enabled state of the button 195 -- INPUT: <val> ; boolean (integer) ; 1 = enable, 0 = disable 196 -- RETURNS: - 197 ----------------------------------- 198 199 if voidP(val) then val = not(pOptions.getaprop(#enabled)) 200 if pOptions.getaprop(#enabled) = val then exit 201 202 pOptions[#enabled] = val 203 doUpd = 0 204 if val then 205 if pImg <> pOffImg then 206 pImg = pOffImg 207 doUpd = 1 208 end if 209 else 210 if pImg <> pDisabledImg then 211 pImg = pDisabledImg 212 doUpd = 1 213 end if 214 end if 215 216 mSendEvent me, #enable 217 if doUpd = 1 then mSendUpdate me 218 end 219 220 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 221 222 on mGetEnabled me 223 ----------------------------------- 224 -- ACTION: get the enabled state of the button 225 -- INPUT: <val> ; boolean (integer) ; 1 = enable, 0 = disable 226 -- RETURNS: boolean (integer) ; 1 = enabled, 0 = disabled 227 ----------------------------------- 228 229 return pOptions[#enabled] 230 end 231 232 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 233 234 on mSetFunction me, newFunction 235 ----------------------------------- 236 -- ACTION: change the event which shall be sent to the listener 237 -- INPUT: <newFunction> ; symbol or string ; name of the event to send to the listeners 238 -- Note, that a listener can define itself via a callbackObject, 239 -- which is made of a #target and a #handler, in that case #handler overrides this functionname 240 -- and every button can define its own handlernames to call on events 241 -- RETURNS: - 242 ----------------------------------- 243 244 newFunction = symbol(newFunction) 245 pOptions[#callFunction] = newFunction 246 end 247 248 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 249 250 on mAddToBroadcastlist me, referenz 251 ----------------------------------- 252 -- ACTION: add a reference to an instance or sprite to the list of instances that get sent the event 253 -- 254 -- INPUT: <referenz> ; #object, #integer, #string, #symbol, callBackObject 255 -- RETURNS: - 256 ----------------------------------- 257 258 if not pOptions[#broadcastSprites].getPos(referenz) then pOptions[#broadcastSprites].add(referenz) 259 end 260 261 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 262 263 on mRemoveFromBroadcastlist me, referenz 264 ----------------------------------- 265 -- ACTION: remove a reference to an instance or sprite from the list of instances that get sent the event 266 -- 267 -- INPUT: <referenz> ; #object, #integer, #string, #symbol, callBackObject 268 -- RETURNS: - 269 ----------------------------------- 270 271 pOptions[#broadcastSprites].deleteOne(referenz) 272 end 273 274 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 275 276 on mGetState me 277 ----------------------------------- 278 -- ACTION: get the selected state of the button (radio or toggle button - checkbox) 279 -- INPUT: <tabname> ; string ; name of the button we want to address 280 -- RETURNS: boolean (integer) 281 ----------------------------------- 282 283 return pOptions[#selected] 284 end 285 286 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 287 288 on mSetState me, selState 289 ----------------------------------- 290 -- ACTION: set the selected state of the button (radio or toggle button - checkbox) 291 -- 292 -- INPUT: <selState> ; boolean (integer) ; true => selected, false => not selected 293 -- RETURNS: - 294 ----------------------------------- 295 296 if selState = pOptions.getaprop(#selected) then exit 297 pOptions[#selected] = selState 298 299 pDown = 0 300 301 if not(mGetEnabled(me)) then exit 302 303 if (pOptions.getaprop(#toggle) = 1) and (pOptions.getaprop(#selected) = 1) then 304 if pImg <> pSelectedImg then 305 pImg = pSelectedImg 306 mSendUpdate me 307 end if 308 309 else if length(string(pOptions.getaprop(#groupname))) and (pOptions.getaprop(#selected) = 1) then 310 if pImg <> pSelectedImg then 311 pImg = pSelectedImg 312 mSendUpdate me 313 end if 314 315 else 316 if pImg <> pOffImg then 317 pImg = pOffImg 318 mSendUpdate me 319 end if 320 end if 321 end 322 323 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 324 325 on mGetCurrentRect me 326 ----------------------------------- 327 -- ACTION: get the rect of the button in absolut stage coordinates 328 -- 329 -- INPUT: - 330 -- RETURNS: rect 331 ----------------------------------- 332 333 return pRect 334 end 335 336 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 337 338 on mTranslateRect me, trans 339 ----------------------------------- 340 -- ACTION: move a single button by point <trans> 341 -- 342 -- INPUT: <trans> ; point ; offset x and offset y to move the button sprite/overlay 343 -- RETURNS: - 344 ----------------------------------- 345 346 if ilk(trans) = #point then pRect = pRect.offset(trans[1], trans[2]) 347 pOptions[#myRect] = pRect 348 pCallerRef.mForceRectUpdate(me, pMyName) 349 mSendUpdate me 350 end 351 352 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 353 354 on mSetCurrentRect me, newRect 355 ----------------------------------- 356 -- ACTION: set the rect of the specified button to absolut stage coordinates 357 -- (this may distort the button, so best is to use the rect you get from mGetCurrentButtonRect()) 358 -- 359 -- INPUT: <newRect> ; rect ; new button rect 360 -- RETURNS: - 361 ----------------------------------- 362 363 if ilk(newRect) = #rect then pRect = newRect 364 pOptions[#myRect] = pRect 365 pCallerRef.mForceRectUpdate(me, pMyName) 366 mSendUpdate me 367 end 368 369 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 370 371 on interface me 372 ----------------------------------- 373 -- ACTION: get the interface of this script 374 -- 375 -- INPUT: - 376 -- RETURNS: string 377 ----------------------------------- 378 379 str = "" 380 381 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 382 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 383 put RETURN & "on mGetOptionsList me" after str 384 put RETURN & "-- get the options list of the button" after str 385 put RETURN & "-- returns: #property list" after str 386 put RETURN & "" after str 387 388 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 389 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 390 put RETURN & "on mChangeLabel me, newLabel" after str 391 put RETURN & "-- change the text:" after str 392 put RETURN & "-- accepts: #string" after str 393 put RETURN & "" after str 394 395 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 396 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 397 put RETURN & "on mChangeLanguage me" after str 398 put RETURN & "-- special case of label change" after str 399 put RETURN & "-- if mTranslate() yields another result the labels will change" after str 400 put RETURN & "-- accepts: #string" after str 401 put RETURN & "" after str 402 403 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 404 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 405 put RETURN & "on mEnableMe me, val" after str 406 put RETURN & "-- toggle the enabled state of the button; 1 = enable, 0 = disable" after str 407 put RETURN & "-- accepts: #integer" after str 408 put RETURN & "" after str 409 410 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 411 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 412 put RETURN & "on mGetEnabled me" after str 413 put RETURN & "-- get the enabled state of the button; 1 = enabled, 0 = disabled" after str 414 put RETURN & "-- returns: #integer" after str 415 put RETURN & "" after str 416 417 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 418 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 419 put RETURN & "on mSetFunction me, newFunction" after str 420 put RETURN & "-- change the event which shall be sent on mouseUp" after str 421 put RETURN & "-- accepts: #symbol, #string" after str 422 put RETURN & "" after str 423 424 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 425 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 426 put RETURN & "on mAddToBroadcastlist me, referenz" after str 427 put RETURN & "-- add a reference to an instance or sprite to the list of instances that get sent the event" after str 428 put RETURN & "-- accepts: #object, #integer" after str 429 put RETURN & "" after str 430 431 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 432 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 433 put RETURN & "on mRemoveFromBroadcastlist me, referenz" after str 434 put RETURN & "-- remove a reference to an instance or sprite from the list of instances that get sent the event" after str 435 put RETURN & "-- accepts: #object, #integer" after str 436 put RETURN & "" after str 437 438 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 439 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 440 put RETURN & "on mGetState me" after str 441 put RETURN & "-- get the selected state of the button; 1 = selected, 0 = not selected" after str 442 put RETURN & "-- returns: #integer" after str 443 put RETURN & "" after str 444 445 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 446 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 447 put RETURN & "on mSetState me, selState" after str 448 put RETURN & "-- set the selected state of the button; 1 = enabled, 0 = disabled" after str 449 put RETURN & "-- accepts: #integer" after str 450 put RETURN & "" after str 451 452 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 453 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 454 put RETURN & "on mGetCurrentRect me" after str 455 put RETURN & "" after str 456 457 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 458 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 459 put RETURN & "on mTranslateRect me, trans" after str 460 put RETURN & "" after str 461 462 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 463 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 464 put RETURN & "on mSetCurrentRect me, newRect" after str 465 put RETURN & "" after str 466 467 return str 468 469 end 470 471 472 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 473 on _____________INCOMING_MOUSE_EVENTS me 474 end 112 475 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 113 476 … … 117 480 118 481 mDoMouseDownAction me 119 end120 121 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx122 123 on mDoMouseDownAction me124 125 -- if (pOptions.getaprop(#toggle) = 1) and (pOptions.getaprop(#selected) = 1) then126 -- -- pImg = pOffImg127 -- pImg = pOverImg128 -- else129 -- pImg = pPressImg130 -- end if131 132 -- alex am 1. August 2004 um 10:59133 if length(string(pOptions.getaprop(#groupname))) then134 135 if not pOptions.getaprop(#selected) then136 137 if pKlickSound.length then138 puppetsound pKlickSound139 updatestage140 pZeiter = the ticks141 end if142 143 if pImg <> pPressImg then144 pImg = pPressImg145 mSendUpdate me146 end if147 148 end if149 150 mSendEvent me, #mouseDown151 152 else153 -- alex am 1. August 2004 um 10:59154 155 if pImg <> pPressImg then156 pImg = pPressImg157 mSendUpdate me158 end if159 160 if pKlickSound.length then161 puppetsound pKlickSound162 updatestage163 pZeiter = the ticks164 end if165 166 mSendEvent me, #mouseDown167 end if168 169 482 end 170 483 … … 177 490 178 491 mDoMouseUpAction me 179 end180 181 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx182 183 on mDoMouseUpAction me184 185 -- alex am 1. August 2004 um 10:59186 if length(string(pOptions.getaprop(#groupname))) then187 188 if not pOptions.getaprop(#selected) then189 pOptions[#selected] = 1190 191 if pKlickSound.length then192 if (pZeiter + 20) < the ticks then193 puppetsound pKlickSound194 updatestage195 end if196 end if197 198 -- if pImg <> pPressImg then199 -- pImg = pPressImg200 -- mSendUpdate me201 -- end if202 if pImg <> pSelectedImg then203 pImg = pSelectedImg204 mSendUpdate me205 end if206 207 mSendEvent me, #mouseUp208 209 else210 211 mSendEvent me, #mouseUp, 1212 end if213 214 else215 -- alex am 1. August 2004 um 10:59216 217 if pKlickSound.length then218 if (pZeiter + 20) < the ticks then219 puppetsound pKlickSound220 updatestage221 end if222 end if223 224 225 pOptions[#selected] = not pOptions.getaprop(#selected)226 227 if (pOptions.getaprop(#toggle) = 1) and (pOptions.getaprop(#selected) = 1) then228 if pImg <> pSelectedImg then229 pImg = pSelectedImg230 mSendUpdate me231 end if232 else233 if pImg <> pOverImg then234 pImg = pOverImg235 mSendUpdate me236 end if237 end if238 239 mSendEvent me, #mouseUp240 241 end if242 243 492 end 244 493 … … 322 571 end 323 572 324 --on mKeyDown me, tk, kc 325 -- put kc 326 -- end 327 328 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 329 -- xxxxxxxxxxxxxxxxxx Public Handlers 330 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 331 332 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 333 334 -- get the options list of the button 335 -- returns: #property list 336 on mGetOptionsList me 337 if ilk(pOptions) <> #proplist then return [:] 338 return pOptions 339 end 340 341 342 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 343 -- change the text: 344 -- accepts: #string 345 on mChangeLabel me, newLabel 346 if ilk(newLabel) <> #string then exit 347 pOptions[#label] = newLabel 348 mInitImgs me 349 end 350 351 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 352 353 -- special case of label change 354 -- if mTranslate() yields another result the labels will change 355 -- accepts: #string 356 on mChangeLanguage me 357 mInitImgs me 358 end 359 360 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 361 362 -- toggle the enabled state of the button; 1 = enable, 0 = disable 363 -- accepts: #integer 364 on mEnableMe me, val 365 if voidP(val) then val = not(pOptions.getaprop(#enabled)) 366 if pOptions.getaprop(#enabled) = val then exit 367 368 pOptions[#enabled] = val 369 doUpd = 0 370 if val then 371 if pImg <> pOffImg then 372 pImg = pOffImg 373 doUpd = 1 374 end if 375 else 376 if pImg <> pDisabledImg then 377 pImg = pDisabledImg 378 doUpd = 1 379 end if 380 end if 381 382 mSendEvent me, #enable 383 if doUpd = 1 then mSendUpdate me 384 end 385 386 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 387 388 -- get the enabled state of the button; 1 = enabled, 0 = disabled 389 -- returns: #integer 390 on mGetEnabled me 391 return pOptions[#enabled] 392 end 393 394 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 395 396 -- change the event which shall be sent on mouseUp 397 -- accepts: #symbol, #string 398 on mSetFunction me, newFunction 399 newFunction = symbol(newFunction) 400 pOptions[#callFunction] = newFunction 401 end 402 403 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 404 405 -- add a reference to an instance or sprite to the list of instances that get sent the event 406 -- accepts: #object, #integer 407 on mAddToBroadcastlist me, referenz 408 if not pOptions[#broadcastSprites].getPos(referenz) then pOptions[#broadcastSprites].add(referenz) 409 end 410 411 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 412 413 -- remove a reference to an instance or sprite from the list of instances that get sent the event 414 -- accepts: #object, #integer 415 on mRemoveFromBroadcastlist me, referenz 416 pOptions[#broadcastSprites].deleteOne(referenz) 417 end 418 419 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 420 421 -- get the selected state of the button; 1 = selected, 0 = not selected 422 -- returns: #integer 423 on mGetState me 424 return pOptions[#selected] 425 end 426 427 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 428 429 -- set the selected state of the button; 1 = enabled, 0 = disabled 430 -- accepts: #integer 431 on mSetState me, selState 432 if selState = pOptions.getaprop(#selected) then exit 433 pOptions[#selected] = selState 434 435 pDown = 0 436 437 if not(mGetEnabled(me)) then exit 438 439 if (pOptions.getaprop(#toggle) = 1) and (pOptions.getaprop(#selected) = 1) then 440 if pImg <> pSelectedImg then 441 pImg = pSelectedImg 442 mSendUpdate me 443 end if 444 445 else if length(string(pOptions.getaprop(#groupname))) and (pOptions.getaprop(#selected) = 1) then 446 if pImg <> pSelectedImg then 447 pImg = pSelectedImg 448 mSendUpdate me 449 end if 450 451 else 452 if pImg <> pOffImg then 453 pImg = pOffImg 454 mSendUpdate me 455 end if 456 end if 457 end 458 459 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 460 461 on mGetCurrentRect me 462 return pRect 463 end 464 465 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 466 467 on mTranslateRect me, trans 468 if ilk(trans) = #point then pRect = pRect.offset(trans[1], trans[2]) 469 pOptions[#myRect] = pRect 470 pCallerRef.mForceRectUpdate(me, pMyName) 471 mSendUpdate me 472 end 473 474 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 475 476 on mSetCurrentRect me, newRect 477 if ilk(newRect) = #rect then pRect = newRect 478 pOptions[#myRect] = pRect 479 pCallerRef.mForceRectUpdate(me, pMyName) 480 mSendUpdate me 481 end 482 483 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 484 485 on interface me 486 str = "" 487 488 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 489 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 490 put RETURN & "on mGetOptionsList me" after str 491 put RETURN & "-- get the options list of the button" after str 492 put RETURN & "-- returns: #property list" after str 493 put RETURN & "" after str 494 495 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 496 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 497 put RETURN & "on mChangeLabel me, newLabel" after str 498 put RETURN & "-- change the text:" after str 499 put RETURN & "-- accepts: #string" after str 500 put RETURN & "" after str 501 502 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 503 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 504 put RETURN & "on mChangeLanguage me" after str 505 put RETURN & "-- special case of label change" after str 506 put RETURN & "-- if mTranslate() yields another result the labels will change" after str 507 put RETURN & "-- accepts: #string" after str 508 put RETURN & "" after str 509 510 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 511 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 512 put RETURN & "on mEnableMe me, val" after str 513 put RETURN & "-- toggle the enabled state of the button; 1 = enable, 0 = disable" after str 514 put RETURN & "-- accepts: #integer" after str 515 put RETURN & "" after str 516 517 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 518 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 519 put RETURN & "on mGetEnabled me" after str 520 put RETURN & "-- get the enabled state of the button; 1 = enabled, 0 = disabled" after str 521 put RETURN & "-- returns: #integer" after str 522 put RETURN & "" after str 523 524 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 525 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 526 put RETURN & "on mSetFunction me, newFunction" after str 527 put RETURN & "-- change the event which shall be sent on mouseUp" after str 528 put RETURN & "-- accepts: #symbol, #string" after str 529 put RETURN & "" after str 530 531 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 532 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 533 put RETURN & "on mAddToBroadcastlist me, referenz" after str 534 put RETURN & "-- add a reference to an instance or sprite to the list of instances that get sent the event" after str 535 put RETURN & "-- accepts: #object, #integer" after str 536 put RETURN & "" after str 537 538 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 539 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 540 put RETURN & "on mRemoveFromBroadcastlist me, referenz" after str 541 put RETURN & "-- remove a reference to an instance or sprite from the list of instances that get sent the event" after str 542 put RETURN & "-- accepts: #object, #integer" after str 543 put RETURN & "" after str 544 545 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 546 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 547 put RETURN & "on mGetState me" after str 548 put RETURN & "-- get the selected state of the button; 1 = selected, 0 = not selected" after str 549 put RETURN & "-- returns: #integer" after str 550 put RETURN & "" after str 551 552 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 553 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 554 put RETURN & "on mSetState me, selState" after str 555 put RETURN & "-- set the selected state of the button; 1 = enabled, 0 = disabled" after str 556 put RETURN & "-- accepts: #integer" after str 557 put RETURN & "" after str 558 559 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 560 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 561 put RETURN & "on mGetCurrentRect me" after str 562 put RETURN & "" after str 563 564 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 565 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 566 put RETURN & "on mTranslateRect me, trans" after str 567 put RETURN & "" after str 568 569 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 570 put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 571 put RETURN & "on mSetCurrentRect me, newRect" after str 572 put RETURN & "" after str 573 574 return str 575 576 end 577 578 579 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 580 -- xxxxxxxxxxxxxxxxxx Private Handlers 573 574 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 575 on _____________PRIVATE_EVENTS me 576 end 581 577 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 582 578 … … 600 596 -- end if 601 597 602 buttonImgs = call(#mGetButtonImages, [mGetXScript(#ButtonImageCreator)], pOptions.getaprop(#label), pOptions)598 buttonImgs = call(#mGetButtonImages, mGetXScript(#ButtonImageCreator), pOptions.getaprop(#label), pOptions) 603 599 if not(listP(buttonImgs)) then 604 600 alert "You need the ButtonImageCreator script in order to run this script" … … 641 637 642 638 end 639 640 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 641 642 on mSendUpdate me 643 call(#mUpdateImage, [pCallerRef], pImg, me, pMyName) 644 end 645 646 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 647 on _____________MOUSE_EVENT_HANDLING me 648 end 649 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 650 651 on mDoMouseDownAction me 652 653 -- if (pOptions.getaprop(#toggle) = 1) and (pOptions.getaprop(#selected) = 1) then 654 -- -- pImg = pOffImg 655 -- pImg = pOverImg 656 -- else 657 -- pImg = pPressImg 658 -- end if 659 660 -- alex am 1. August 2004 um 10:59 661 if length(string(pOptions.getaprop(#groupname))) then 662 663 if not pOptions.getaprop(#selected) then 664 665 if pKlickSound.length then 666 puppetsound pKlickSound 667 updatestage 668 pZeiter = the ticks 669 end if 670 671 if pImg <> pPressImg then 672 pImg = pPressImg 673 mSendUpdate me 674 end if 675 676 end if 677 678 mSendEvent me, #mouseDown 679 680 else 681 -- alex am 1. August 2004 um 10:59 682 683 if pImg <> pPressImg then 684 pImg = pPressImg 685 mSendUpdate me 686 end if 687 688 if pKlickSound.length then 689 puppetsound pKlickSound 690 updatestage 691 pZeiter = the ticks 692 end if 693 694 mSendEvent me, #mouseDown 695 end if 696 697 end 698 699 700 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 701 702 on mDoMouseUpAction me 703 704 -- alex am 1. August 2004 um 10:59 705 if length(string(pOptions.getaprop(#groupname))) then 706 707 if not pOptions.getaprop(#selected) then 708 pOptions[#selected] = 1 709 710 if pKlickSound.length then 711 if (pZeiter + 20) < the ticks then 712 puppetsound pKlickSound 713 updatestage 714 end if 715 end if 716 717 -- if pImg <> pPressImg then 718 -- pImg = pPressImg 719 -- mSendUpdate me 720 -- end if 721 if pImg <> pSelectedImg then 722 pImg = pSelectedImg 723 mSendUpdate me 724 end if 725 726 mSendEvent me, #mouseUp 727 728 else 729 730 mSendEvent me, #mouseUp, 1 731 end if 732 733 else 734 -- alex am 1. August 2004 um 10:59 735 736 if pKlickSound.length then 737 if (pZeiter + 20) < the ticks then 738 puppetsound pKlickSound 739 updatestage 740 end if 741 end if 742 743 744 pOptions[#selected] = not pOptions.getaprop(#selected) 745 746 if (pOptions.getaprop(#toggle) = 1) and (pOptions.getaprop(#selected) = 1) then 747 if pImg <> pSelectedImg then 748 pImg = pSelectedImg 749 mSendUpdate me 750 end if 751 else 752 if pImg <> pOverImg then 753 pImg = pOverImg 754 mSendUpdate me 755 end if 756 end if 757 758 mSendEvent me, #mouseUp 759 760 end if 761 762 end -
trunk/lingosource/castlib3/GetSetPrefs.ls
r14 r18 12 12 13 13 on interface me 14 str = "Handle preferences by alex da franca ©2003 -- alex@farbflash.de -- all rigths reserved"14 str = "Handle preferences by alex da franca c2003 -- alex@farbflash.de -- all rigths reserved" 15 15 16 16 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str … … 85 85 thePrefs = "" 86 86 else 87 88 resetUNames = 0 89 if the platform contains "mac" then 90 if baSysFolder("prefs") starts "/" then 91 baReturnUnixNames(0) 92 resetUNames = 1 93 end if 94 end if 95 87 96 prefspath = baSysFolder("prefs") 97 98 if resetUNames = 1 then baReturnUnixNames(1) 99 88 100 thePath = prefspath & prefsname 89 101 fio.openfile(thePath, 1) … … 165 177 166 178 if offset("<?xml", prefsText.line[1]) > 0 then 167 delete line 1 of prefsText168 169 gPrefs = call(#mGetListFromXMLString, [mGetXScript(#PseudoXMLPS)], prefsText)170 if ilk(gPrefs) = #proplistthen globs[#gPrefs] = gPrefs179 -- delete line 1 of prefsText 180 181 gPrefs = call(#mGetListFromXMLString, mGetXScript(#PseudoXMLPS), prefsText) 182 if objectP(gPrefs) then globs[#gPrefs] = gPrefs 171 183 172 184 else … … 249 261 if objectP(fio) then 250 262 263 resetUNames = 0 264 if the platform contains "mac" then 265 if baSysFolder("prefs") starts "/" then 266 baReturnUnixNames(0) 267 resetUNames = 1 268 end if 269 end if 270 251 271 prefpfad = baSysFolder("prefs")&prefsname 272 273 if resetUNames = 1 then baReturnUnixNames(1) 252 274 253 275 fio.openfile(prefpfad, 1) … … 302 324 303 325 if useAleXML then 304 prefStr = call(#mGetXMLStringFromList, [mGetXScript(#PseudoXMLPS)], prefliste, prefsname)326 prefStr = call(#mGetXMLStringFromList, mGetXScript(#PseudoXMLPS), prefliste, prefsname) 305 327 -- put "<? alexml ?>"&RETURN before prefStr 306 328 -- put "<?xml version=""E&"1.0""E&"?>"&RETURN before prefStr … … 313 335 repeat with n = 1 to anz 314 336 315 if ilk(prefliste) = #proplistthen prefStr = string(prefliste.getPropAt(n))&"À"337 if objectP(prefliste) then prefStr = string(prefliste.getPropAt(n))&"À" 316 338 317 339 dieserWert = prefliste[n] -
trunk/lingosource/castlib3/ImageUtilityScripts.ls
r15 r18 1 1 -- xxxxx IMAGING UTILS 2 -- Alex da Franca ©2002 da.franca@online.de2 -- Alex da Franca c2002 da.franca@online.de 3 3 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 4 4 … … 19 19 20 20 on mDrehImg me, img, deg, tws 21 22 if deg mod 90 = 0 then tws = 0 23 21 24 deg = (pi()/180) * deg 22 25 … … 81 84 links = 0 82 85 83 cms = mGetXScript( #commonMovieScript)84 h = c all(#mGetNextLowerPowerOfTwo, [cms], (hoehe - oben))86 cms = mGetXScript() 87 h = cms.mGetNextLowerPowerOfTwo(hoehe - oben) 85 88 86 89 unten = oben + h … … 232 235 233 236 -- maskImg = image(breite, hoehe, maske.depth, 0, maske.paletteref) 234 maskImg = image(breite, hoehe, 32) -- 32 bit is twice as fast on the mac ???!!! and can be used as mask also 237 -- maskImg = image(breite, hoehe, 32) -- 32 bit is twice as fast on the mac ???!!! and can be used as mask also 238 maskImg = image(breite, hoehe, 8, 0, #grayscale) 235 239 236 240 usemask = 1 … … 397 401 -- spiegelt ein image horizontal 398 402 on mSpiegelHoriz me, img 399 temp = img.duplicate() 400 dasRect = img.rect 401 breite = dasRect.width 402 hoehe = dasRect.height 403 404 if (img.useAlpha and img.depth = 32) then 405 maske = mSpiegelHoriz(me, img.extractalpha()) 406 oldUse = img.useAlpha 407 img.useAlpha = 0 408 end if 409 410 temp.copyPixels(img, [point(0, hoehe), point(breite, hoehe), point(breite,0), point(0, 0)], img.rect, [#dither:1]) 411 412 if ilk(maske) = #image then 413 img.useAlpha = oldUse 414 temp.setAlpha(maske) 415 temp.useAlpha = 1 416 end if 417 418 return temp 403 return mFlipImage(me, img, #horizontal) 419 404 end 420 405 … … 423 408 -- spiegelt ein image vertikal 424 409 on mSpiegelVerti me, img 425 temp = img.duplicate() 426 dasRect = img.rect 427 breite = dasRect.width 428 hoehe = dasRect.height 429 430 if (img.useAlpha and img.depth = 32) then 431 maske = mSpiegelVerti(me, img.extractalpha()) 432 oldUse = img.useAlpha 433 img.useAlpha = 0 434 end if 435 436 temp.copyPixels(img, [point(breite, 0), point(0, 0), point(0,hoehe), point(breite, hoehe)], img.rect, [#dither:1]) 437 438 if ilk(maske) = #image then 439 img.useAlpha = oldUse 440 temp.setAlpha(maske) 441 temp.useAlpha = 1 410 return mFlipImage(me, img, #vertical) 411 end 412 413 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 414 415 on mFlipImage me, theImage, theMode 416 417 temp = theImage.duplicate() 418 theRect = theImage.rect 419 theWidth = theRect.width 420 theHeight = theRect.height 421 422 if (theImage.useAlpha and theImage.depth = 32) then 423 theMask = mFlipImage(me, theImage.extractalpha(), theMode) 424 oldUse = theImage.useAlpha 425 theImage.useAlpha = 0 426 end if 427 428 if theMode = #horizontal then 429 theQuad = [point(theWidth, 0), point(0, 0), point(0, theHeight), point(theWidth, theHeight)] 430 else 431 theQuad = [point(0, theHeight), point(theWidth, theHeight), point(theWidth,0), point(0, 0)] 432 end if 433 434 temp.copyPixels(theImage, theQuad, theImage.rect, [#dither:1969]) 435 436 if ilk(theMask) = #image then 437 theImage.useAlpha = oldUse 438 temp.setAlpha(theMask) 439 temp.useAlpha = oldUse 442 440 end if 443 441 … … 600 598 -- theImage = mGetTextImage("theString", [#font:"Geneva", #fontsize:36]) 601 599 602 on mGetTextImage me, theString, options, maxWidth, templateTextMember, dontwrap 600 on mGetTextImage me, theString, options, maxWidth, templateTextMember, dontwrap, dontCrop 603 601 604 602 if ilk(options) <> #proplist then options = [:] … … 613 611 bm = member(saveName, castlib(saveImages)) 614 612 -- alex changed for woody - mb -- 615 cms = mGetXScript( #commonMovieScript)616 if c all(#mGetMemType, [cms],bm) = #bitmap then return bm.image.duplicate()613 cms = mGetXScript() 614 if cms.mGetMemType(bm) = #bitmap then return bm.image.duplicate() 617 615 -- alex changed for woody - mb end -- 618 616 end if … … 628 626 if ilk(fontsize) <> #integer then fontsize = 12 629 627 fontsize = abs(fontsize) 630 cms = mGetXScript( #commonMovieScript)631 templateTextMember = c all(#mGetATextMem, [cms], call(#mGetAFont, [cms],string(options.getaprop(#myFont))), fontsize, options.getaprop(#myAntialias))632 end if 633 634 templateTextMember.text = theString&" "628 cms = mGetXScript() 629 templateTextMember = cms.mGetATextMem(cms.mGetAFont(string(options.getaprop(#myFont))), fontsize, options.getaprop(#myAntialias)) 630 end if 631 632 if options.getaprop(#dontSetText) <> 1 then templateTextMember.text = theString&" " 635 633 636 634 if ilk(maxWidth) <> #integer then maxWidth = 350 … … 651 649 if templateTextMember.fontstyle <> theFontstyle then templateTextMember.fontstyle = theFontstyle 652 650 653 654 textbreite = templateTextMember.charPosToLoc((theString.length + 1)).locH 655 templateTextMember.char[theString.length + 1].delete() 651 oldboxType = templateTextMember.boxtype 652 templateTextMember.boxtype = #adjust 653 textbreite = 1 654 len = 0 655 lc = templateTextMember.line.count 656 repeat with n = 1 to lc 657 len = len + theString.line[n].length + 1 658 textbreite = max(textbreite, templateTextMember.charPosToLoc(len).locH) 659 end repeat 660 -- textbreite = templateTextMember.charPosToLoc((theString.length + 1)).locH 661 if options.getaprop(#dontSetText) <> 1 then templateTextMember.char[theString.length + 1].delete() 662 if oldboxType <> #adjust then templateTextMember.boxtype = oldboxType 656 663 657 664 textimg = templateTextMember.image.extractalpha() 658 textimg = textimg.crop(rect(0, 0, textbreite, textimg.height)) 665 666 if dontCrop <> 1 then textimg = textimg.crop(rect(0, 0, textbreite, textimg.height)) 659 667 660 668 … … 1185 1193 on interface me 1186 1194 1187 str = "IMAGING LINGO UTILS by alex da franca ©2003 -- alex@farbflash.de -- all rigths reserved"1195 str = "IMAGING LINGO UTILS by alex da franca c2003 -- alex@farbflash.de -- all rigths reserved" 1188 1196 1189 1197 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str -
trunk/lingosource/castlib3/PseudoXMLPS.ls
r15 r18 1 -- Pseudo XML by Alex da Franca ©2003 1 -- PseudoXMLPS 2 ----------------------------------- 3 -- CREATED: 4 -- 06.03.2008 5 -- 6 -- DESCRIPTION: 7 -- Pseudo XML by Alex da Franca c2003 2 8 -- Convert a lingo list to a XML like string and back 3 9 4 -- alex am Freitag 21.April.2006 16:31:57 5 -------------------------------------------------------- 6 -- fixed a bug in "mBuildXMLString" many thanks to Olaf Schliesing for pointing this out 7 8 -- alex am 28.11.06 um 16:41:00 9 -------------------------------------------------------- 10 -- finally added a tag property, when writing xml, so the ilk of the object gets stored 11 -- so, when reading back the xml file, we do not convert a node by accident to a value 12 -- when a string evaluates to a value "by accident" 13 14 --------------------------------- 15 -- Scriptmarker: changes alex (04.04.2007 at 10:22 Uhr) // Scriptmarker 16 -- added escaping of: 17 -- & -> & 18 -- ' -> ' 19 -- " -> " 20 -- and vice versa. Until now I only escaped < and >, but ampersand, apostrophe and quote must also be escaped for proper xml 21 22 -- I als added "support" for the CData tag, which allows you to escape the whole contents of a node. 23 -- support is only done through ignoring esaping the special characters, wehn BUILDING the xml string. 24 -- So the user can decide on his own, which nodes s/he wants to be masked inside a CData section 25 -- (otherwise I'd have to mask EVERY string and try to unmask EVERY node. Now the user is on his own) 26 27 -- Example: 10 -- 11 -- REQUIRES: 12 -- (Prerequisites) 13 -- 14 -- USAGE: 28 15 -- myList = [#stringWithInvalidChars:"A string with invalid chars like <> and & and ' and " & QUOTE] 29 16 -- myList[#stringWithInvalidChars] = "<![CDATA[" & myList[#stringWithInvalidChars] & "]]>" … … 41 28 -- end if 42 29 -- end repeat 43 44 45 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 46 -- xxxxxxxxxxxxxxxxxx Public Handlers 30 -- 31 -- HISTORY: 32 33 -- alex am Freitag 21.April.2006 16:31:57 34 -- fixed a bug in "mBuildXMLString" many thanks to Olaf Schliesing for pointing this out 35 -- 36 -- alex am 28.11.06 um 16:41:00 37 -- finally added a tag property, when writing xml, so the ilk of the object gets stored 38 -- so, when reading back the xml file, we do not convert a node by accident to a value 39 -- when a string evaluates to a value "by accident" 40 -- 41 -- Scriptmarker: changes alex (04.04.2007 at 10:22 Uhr) // Scriptmarker 42 -- added escaping of: 43 -- & -> & 44 -- ' -> ' 45 -- " -> " 46 -- and vice versa. Until now I only escaped < and >, but ampersand, apostrophe and quote must also be escaped for proper xml 47 -- I als added "support" for the CData tag, which allows you to escape the whole contents of a node. 48 -- support is only done through ignoring esaping the special characters, wehn BUILDING the xml string. 49 -- So the user can decide on his own, which nodes s/he wants to be masked inside a CData section 50 -- (otherwise I'd have to mask EVERY string and try to unmask EVERY node. Now the user is on his own) 51 -- TODO: 52 -- - 53 ----------------------------------- 54 55 56 57 on ___________PUBLIC_EVENTS me 58 end 47 59 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 48 60 … … 60 72 61 73 on interface me 62 str = "Pseudo XML Script by alex da franca ©2003 -- alex@farbflash.de -- all rigths reserved"74 str = "Pseudo XML Script by alex da franca c2003 -- alex@farbflash.de -- all rigths reserved" 63 75 put RETURN & "version 1" after str 64 76 … … 112 124 -- xxxxxxxxxxxxxxxxxx Convert lingo list (also nested lists) to XML stylish string 113 125 114 -- Parameters: 126 on mGetXMLStringFromList me, listref, docName, strict, dontReplaceGT, withParams 127 ----------------------------------- 128 -- CREATED: 06.03.2008 129 -- ACTION: Convert lingo list (also nested lists) to XML stylish string 130 -- INPUT: 115 131 -- <listref> format: property list or linear list 116 132 -- <docName> format: #string; optional. if omitted "Untitled" is used for the XML document name 117 -- strict=> boolean; avoid spaces in tag names118 -- dontReplaceGT=> boolean; dont replace < and >119 -- withParams=> boolean; write attribute in tag for the lingo ilk => bigger xml files and unfortunately it is slower to parse133 -- <strict> => boolean; avoid spaces in tag names 134 -- <dontReplaceGT> => boolean; dont replace < and > 135 -- <withParams> => boolean; write attribute in tag for the lingo ilk => bigger xml files and unfortunately it is slower to parse 120 136 ----------------------------- (I thought avoiding value() would help, but in this case the additional text parsing of the attributes tag slows down) 121 122 -- Example: 123 -- saveString = mGetXMLStringFromList(me, lingo_list, "documentName") 124 125 on mGetXMLStringFromList me, listref, docName, strict, dontReplaceGT, withParams 137 -- RETURNS: string 138 -- EXAMPLE: saveString = mGetXMLStringFromList(me, lingo_list, "documentName") 139 ----------------------------------- 140 126 141 -- ms = the milliseconds 127 142 if voidP(strict) then strict = 0 … … 152 167 -- xxxxxxxxxxxxxxxxxx Convert XML stylish string to lingo list 153 168 154 -- Parameters: 169 170 on mGetListFromXMLString me, str, convertValues, withParams 171 ----------------------------------- 172 -- CREATED: 06.03.2008 173 -- ACTION: Description 174 -- INPUT: 155 175 -- <str> format: #string; split a string using <> and </> tags into lingo list 156 176 -- <convertValues> #integer 0=>don't convert (fast, all values are strings), 1 => convert only numbers (slower); 2 => try to convert all data, even colors (slow) 157 158 -- Example: 159 --lingo_list = mGetListFromXMLString(me, saveString)160 161 on mGetListFromXMLString me, str, convertValues, withParams 177 -- <withParams> : #boolean : parse parameters too. new, not very well tested 178 -- RETURNS: property list 179 -- EXAMPLE: lingo_list = mGetListFromXMLString(me, saveString) 180 -- CHANGES: implemented parameter parsing 181 ----------------------------------- 162 182 163 183 ms = the milliseconds … … 193 213 194 214 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 195 -- MUCH FASTER than the above: Use the XML xtra to parse the string 196 -- BUT it must be a valid xml string, the above is slower but allows more malformed xml 197 198 -- Parameters: 215 216 217 property pXmlxtraversion 218 219 on mGetListFromXMLStringX me, str, convertValues, withParams 220 ----------------------------------- 221 -- CREATED: 06.03.2008 222 -- ACTION: Convert xml string to lingo list using the xmlparser xtra, if possible 223 -- MUCH FASTER than the above: Use the XML xtra to parse the string 224 -- BUT it must be a valid xml string, the above is slower but allows more malformed xml 225 -- INPUT: 199 226 -- <str> format: #string; split a string using <> and </> tags into lingo list 200 227 -- <convertValues> #integer … … 202 229 -- -- -- 1 => convert only integer() and float() (slower) 203 230 -- -- -- 2 => try to convert all data with value(), even parse for colors in hexstring format (slow) 204 205 -- Example: 206 -- lingo_list = mGetListFromXMLStringX(me, saveString) 207 208 property pXmlxtraversion 209 210 on mGetListFromXMLStringX me, str, convertValues, withParams 231 -- RETURNS: property list 232 -- EXAMPLE: lingo_list = mGetListFromXMLStringX(me, saveString) 233 -- CHANGES: resorts to the slower lingo function on xml parser error. So this handler can always be used. 234 ----------------------------------- 211 235 212 236 if ilk(str) <> #string then str = string(str) … … 251 275 end if 252 276 253 if pXmlxtraversion < 10 then return mGetListFromXMLString(me, str, convertValues )277 if pXmlxtraversion < 10 then return mGetListFromXMLString(me, str, convertValues, withParams) 254 278 ------------------ end XML Parser xtra version 10 check 255 279 … … 275 299 if not(voidP(xt.getError())) then 276 300 put "Script: PseudoXMLPS; Handler: mGetListFromXMLStringX; error:" && xt.getError() 277 return [:]301 return mGetListFromXMLString(me, str, convertValues, withParams) 278 302 end if 279 303 280 304 xx = xt.makePropList() 281 li = mConvertXMLPropList(me, [xx], convertValues) 282 283 -- put the milliseconds - ms 305 dontEscapeSpecialChars = 1 -- we do not need to do this, as the xmlparser xtra already did it for us 306 li = mConvertXMLPropList(me, [xx], convertValues, dontEscapeSpecialChars) 307 308 -- put "x" && the milliseconds - ms 284 309 285 310 if not(listP(li)) then return [:] … … 288 313 289 314 end 315 316 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 317 on _______________READ_WRITE_EXTERNAL_FILES 318 end 319 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 320 321 on mReadXML_2_List me, thePath 322 ----------------------------------- 323 -- CREATED: 06.03.2008 324 -- ACTION: read external xml file to lingo list 325 -- INPUT: <thePath> : string ; optional pathname. if no pathname or "", then a file save dialog is shown 326 -- RETURNS: property list 327 ----------------------------------- 328 329 dertext = xscr(#FileIOFunktionen).mGetTextFromFile(thePath) 330 if length(dertext) > 0 then return xscr(#PseudoXMLPS).mGetListFromXMLStringX(dertext) 331 return [:] 332 end 333 334 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 335 336 on mSaveList_2_XML me, theList, thePath 337 ----------------------------------- 338 -- CREATED: 06.03.2008 339 -- ACTION: write liongo list to external xml file 340 -- INPUT: 341 -- <theList> : linear or property list 342 -- <thePath> : string ; optional pathname. if no pathname or "", then a file selection dialog is shown 343 -- RETURNS: full pathname of newly created file, if successful, otherwise 0 344 ----------------------------------- 345 346 if not(listP(theList)) then return 0 347 theResult = xscr(#PseudoXMLPS).mGetXMLStringFromList(theList) 348 return xscr(#FileIOFunktionen).mSaveToTextFile(theResult, thePath) 349 end 350 290 351 291 352 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx … … 843 904 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 844 905 845 on mConvertXMLPropList me, inputlist, convertValues 906 on mConvertXMLPropList me, inputlist, convertValues, dontEscapeSpecialChars 846 907 retlist = [:] 847 908 anz = count(inputlist) … … 860 921 if count(val) then 861 922 if ilk(retlist) = #proplist then 862 retlist.addProp(symbol(inputlist[n].getaprop(#name)), mConvertXMLPropList(me, val, convertValues ))923 retlist.addProp(symbol(inputlist[n].getaprop(#name)), mConvertXMLPropList(me, val, convertValues, dontEscapeSpecialChars)) 863 924 else 864 retlist.add(mConvertXMLPropList(me, val, convertValues ))925 retlist.add(mConvertXMLPropList(me, val, convertValues, dontEscapeSpecialChars)) 865 926 end if 866 927 else … … 882 943 883 944 -- unescape <>&'" 884 val = mUnEscapeSpecialChars(me, val)945 if dontEscapeSpecialChars <> 1 then val = mUnEscapeSpecialChars(me, val) 885 946 886 947 #integer: … … 903 964 904 965 -- unescape <>&'" 905 val = mUnEscapeSpecialChars(me, val)966 if dontEscapeSpecialChars <> 1 then val = mUnEscapeSpecialChars(me, val) 906 967 907 968 else … … 917 978 918 979 -- unescape <>&'" 919 val = mUnEscapeSpecialChars(me, val)980 if dontEscapeSpecialChars <> 1 then val = mUnEscapeSpecialChars(me, val) 920 981 921 982 else … … 927 988 928 989 -- unescape <>&'" 929 val = mUnEscapeSpecialChars(me, val)990 if dontEscapeSpecialChars <> 1 then val = mUnEscapeSpecialChars(me, val) 930 991 931 992 … … 993 1054 994 1055 else 995 call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: Row "&n&" Cell "&m&" is not a property list")1056 call(#mPut, mGetXScript(), "mParseExcelXML: Row "&n&" Cell "&m&" is not a property list") 996 1057 end if -- if ilk(thisCell) = #proplist then 997 1058 … … 999 1060 1000 1061 else 1001 call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: Row "&n&" is not a list")1062 call(#mPut, mGetXScript(), "mParseExcelXML: Row "&n&" is not a list") 1002 1063 end if -- if listP(currRow) then 1003 1064 … … 1005 1066 1006 1067 else 1007 call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: Table not found")1068 call(#mPut, mGetXScript(), "mParseExcelXML: Table not found") 1008 1069 end if -- if listP(xmlList) then 1009 1070 1010 1071 else 1011 call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: Worksheet not found")1072 call(#mPut, mGetXScript(), "mParseExcelXML: Worksheet not found") 1012 1073 end if -- if ilk(xmlList) = #proplist then 1013 1074 1014 1075 else 1015 call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: Workbook not found")1076 call(#mPut, mGetXScript(), "mParseExcelXML: Workbook not found") 1016 1077 end if -- if ilk(xmlList) = #proplist then 1017 1078 1018 1079 else 1019 call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: ROOT is not a property list")1080 call(#mPut, mGetXScript(), "mParseExcelXML: ROOT is not a property list") 1020 1081 end if --if ilk(xmlList) = #proplist then 1021 1082 1022 1083 else 1023 call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: Xml parser makelist() returned empty list")1084 call(#mPut, mGetXScript(), "mParseExcelXML: Xml parser makelist() returned empty list") 1024 1085 end if -- if count(xmlList) > 0 then 1025 1086 1026 1087 else 1027 call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: Xml parser makelist() failed")1088 call(#mPut, mGetXScript(), "mParseExcelXML: Xml parser makelist() failed") 1028 1089 end if -- if listP(xmlList) then 1029 1090 1030 1091 else 1031 call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: Xml parser error: "&xmlp.getError())1092 call(#mPut, mGetXScript(), "mParseExcelXML: Xml parser error: "&xmlp.getError()) 1032 1093 end if -- if voidP(xmlp.getError()) then 1033 1094 -
trunk/lingosource/castlib3/SliderScrollbarMenuParent.ls
r15 r18 1 1 -- Scrollbar Parentscript for vertical and horizontal scrollbars 2 -- Alex da Franca ©2002 da.franca@online.de2 -- Alex da Franca c2002 da.franca@online.de 3 3 4 4 -- version 31.05.03 … … 96 96 97 97 if not objectP(caller) then return 0 98 if ilk(options) <> #proplistthen return 098 if not(objectP(options)) then return 0 99 99 100 100 pScrollerProps = options.duplicate() -- auf diese weise werden die einfachen werte dupliziert, aber die farben nur referenziert … … 123 123 124 124 commonMovieScript = mGetXScript() 125 if not(objectP(commonMovieScript)) then125 if listP(commonMovieScript) then 126 126 put "Can not use custom images for scrollbars because commonMovieScript is missing" 127 127 exit … … 1072 1072 end if 1073 1073 1074 if ilk(alpImg) = #image then pSavedimg.useAlpha = 1 1074 if ilk(alpImg) = #image then 1075 pSavedimg.setAlpha(alpImg) 1076 pSavedimg.useAlpha = 1 1077 end if 1075 1078 1076 1079 -- call(#mPut, mGetXScript(), pSavedimg, 0, "pSavedimg danach") … … 1564 1567 1565 1568 on interface me 1566 str = "Scrollbar Script by ullalal + alex da franca ©2002 -- alex@farbflash.de -- all rigths reserved"1569 str = "Scrollbar Script by ullalal + alex da franca c2002 -- alex@farbflash.de -- all rigths reserved" 1567 1570 1568 1571 put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str -
trunk/lingosource/castlib3/SpriteNameBeaver.ls
r14 r18 1 1 -- SPRITENAMEN 2 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3 2 -- sprite naming behavior 3 ----------------------------------- 4 -- CREATED: 5 -- 6 -- PROPERTIES: 7 --!memberProperties: [#name: "SpriteNameBeaver", #scripttype: #score, #scriptSyntax: #lingo, #comments:"~/Documents/Scripts/lingo/SpriteNameBeaver.ls"] 8 -- 9 -- DESCRIPTION: 10 -- lingo scripts to handle movies in a window 11 -- director movies running in their own window -> new player instance 12 -- authoring and runtime only, as in shockwave we can't open and communicate 13 -- with other windows. 14 ----------------------------------- 15 4 16 5 17 property pKanalname -
trunk/lingosource/castlib3/ToolTipBeaver_1.ls
r14 r18 1 1 -- ToolTip Behavior 2 -- by Alex da Franca ©2001 da.franca@online.de2 -- by Alex da Franca c2001 da.franca@online.de 3 3 -- drag this behavior onto any sprite with the provided "ttimageSave" bitmap member 4 4 -- customize the background color and the frame color of the tooltip by altering "ttimageSave" … … 52 52 53 53 on interface me 54 str = "Mneu Script by alex da franca ©2004 -- alex@farbflash.de -- all rigths reserved"54 str = "Mneu Script by alex da franca c2004 -- alex@farbflash.de -- all rigths reserved" 55 55 put RETURN & "version 1.0" after str 56 56 put RETURN & "--------------------------------------------------------" after str … … 91 91 pSavedImg = pMember.image.duplicate() 92 92 pSavedMask = pMaskMember.image.duplicate() 93 if pKanalname <> #kanalname then call(#mMeldeKanalname, [pIncludes.getaprop(#commonmoviescript)], pKanalname, me.spritenum)93 if pKanalname <> #kanalname then call(#mMeldeKanalname, pIncludes.getaprop(#commonmoviescript), pKanalname, me.spritenum) 94 94 95 95 pOnScreen = 0 … … 104 104 105 105 on new me 106 pIncludes = (mGetAleXtras()).getaprop(#scripts) 106 pIncludes = [:] 107 pIncludes.setaprop(#commonmoviescript, xscr()) 107 108 return me 108 109 end … … 127 128 end repeat 128 129 129 if pKanalname <> #kanalname then call(#mMeldeAbKanalname, [pIncludes.getaprop(#commonmoviescript)], pKanalname, me.spritenum)130 if pKanalname <> #kanalname then call(#mMeldeAbKanalname, pIncludes.getaprop(#commonmoviescript), pKanalname, me.spritenum) 130 131 end 131 132 … … 420 421 421 422 422 derkanal = call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)], pThreedChannelName)423 derkanal = call(#mGetKanal, pIncludes.getaprop(#commonmoviescript), pThreedChannelName) 423 424 if derkanal > 0 then 424 425 trect = rect(theLoc[1], theLoc[2], (theLoc[1] + theImg.width), (theLoc[2] + theImg.height)) … … 482 483 on mCreateOverlay me, spritename, whichImg, theLoc, maskImg 483 484 484 kanal = call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)], spritename)485 kanal = call(#mGetKanal, pIncludes.getaprop(#commonmoviescript), spritename) 485 486 if kanal < 1 then return 0 486 487 kanal = sprite(kanal) … … 497 498 breite = whichImg.width 498 499 hoehe = whichImg.height 499 powerbreite = call(#mGetNextPowerOfTwo, [pIncludes.getaprop(#commonmoviescript)], breite)500 powerhoehe = call(#mGetNextPowerOfTwo, [pIncludes.getaprop(#commonmoviescript)], hoehe)500 powerbreite = call(#mGetNextPowerOfTwo, pIncludes.getaprop(#commonmoviescript), breite) 501 powerhoehe = call(#mGetNextPowerOfTwo, pIncludes.getaprop(#commonmoviescript), hoehe) 501 502 502 503 if ilk(maskImg) = #image then … … 542 543 on mDeleteOverlay me, spritename 543 544 544 kanal = call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)], spritename)545 kanal = call(#mGetKanal, pIncludes.getaprop(#commonmoviescript), spritename) 545 546 if kanal < 1 then return 0 546 547 kanal = sprite(kanal) … … 611 612 612 613 memref = member(ttipname) 613 theType = call(#mGetMemType, [pIncludes.getaprop(#commonmoviescript)], memref)614 theType = call(#mGetMemType, pIncludes.getaprop(#commonmoviescript), memref) 614 615 if theType <> #empty then 615 616 if theType = #bitmap then … … 623 624 624 625 tMember = member("TTipTemplate") 625 if call(#mGetMemType, [pIncludes.getaprop(#commonmoviescript)], tMember) <> #text then626 if call(#mGetMemType, pIncludes.getaprop(#commonmoviescript), tMember) <> #text then 626 627 627 628 neuer = mCreateNewMember(me, #Text, 0) 628 629 neuer.name = "TTipTemplate" 629 neuer.font = call(#mGetAFont, [pIncludes.getaprop(#commonmoviescript)], "Arial")630 neuer.font = call(#mGetAFont, pIncludes.getaprop(#commonmoviescript), "Arial") 630 631 631 632 neuer.text = tooltiptext … … 638 639 639 640 -- polen problem: 640 thePrefs = (call(#mGetGlobalList, [pIncludes.getaprop(#commonmoviescript)])).getaprop(#gPrefs)641 thePrefs = (call(#mGetGlobalList, pIncludes.getaprop(#commonmoviescript))).getaprop(#gPrefs) 641 642 if ilk(thePrefs) = #proplist then 642 643 textAA = thePrefs.getaprop(#textAA) -
trunk/lingosource/castlib3/commonMovieScript.ls
r15 r18 1 -- Shared Global Handlers ©03 Alex da Franca -- alex@farbflash.de 2 --------------------------------------------------------------------- 3 4 5 -- these handlers are shared between all of my scripts Alex da Franca ©2003 alex@farbflash.de 6 -- for private use of my scripts -> poor documentation -> use at own risk ;-) 7 8 -- geaendert am 21.06.03 9 -- mGetInstance 0 -- clears all stored instances -> same as recompile all scripts, but that would clear all contents of (script "commonMovieScript").pGList 10 -- mApplyDynamic 11 12 -- alex am 13.03.2004 um 13:49 13 -- added DEBUG_FUNCTIONS 14 15 -- alex am 15.03.2004 um 08:50 16 -- added mGetPlatform() to get OSX 17 -- alex am 31.03.2004 um 11:42 18 -- added clearglobals to mDestroy handler 19 20 -- added support for new director MX2004 sprite names in my handlers by changing mGetKanal() to accept strings 21 22 -- alex am Freitag, 4. Juni 2004 23 -- took care about missing font asset xtra, if it isn't present, we'll get not a script error anymore 24 -- but rather the presence of the font is not checked instead, but rather assumed 25 26 -- alex am 16. Juni 2004 um 10:12 27 -- added mGetNextLowerPowerOfTwo 28 29 -- alex am 18. Juli 2004 um 08:02 30 -- added mMyClearGlobals() to erase the faked globals and get the new globallist 31 32 -- alex am 8. Oktober 2004 um 10:31 33 -- new tempmember handling due to a bug in director 34 35 -- alex am 23. November 2004 um 10:59 36 -- added mGetThisMovieName() and mSetThisMovieName() to identify the movie independant of the filename 37 -- this is needed for some places, where the standard scripts act differently in the different movies 38 39 -- Scriptmarker (21.07.2005 at 11:55 Uhr): changes // Scriptmarker 40 -- added mSplitPath 41 42 43 44 45 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 46 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 47 48 -- IMPORTANT NOTE !! 49 -- if you use my scripts you MUST call 'mCallDestroy()' at stopmovie in order to clean up temporary members used by my scripts 50 -- due to a bug in director I had to change the old behaavior of erasing the members on endsprite, when I was done with it ! 51 -- so now I use a list of temporary members, which is maintained during runtime, but must be processed when the movie is stopped 52 -- (unless you want to fill up your castlib with temporary members :-) 53 54 -- NOW: 55 -- if this script is NOT the first moviescript in your movie containing a stopmovie handler this one gets overriddden and 56 -- you must call 'mCallDestroy()' in your stopmovie handler. 57 -- otherwise when it this script comes before your script with the stopmovie handler your handler will never be called 58 -- since the stopmovie event is caught here... 59 -- in that case just comment it out here and add the 'mCallDestroy()' to your own stopmovie handler 60 61 --on stopmovie me 62 -- mCallDestroy 63 --end 1 -- commonMovieScript 2 ----------------------------------- 3 -- CREATED: 4 -- 11.02.2008 5 -- 6 -- DESCRIPTION: 7 -- Shared Global Handlers c03 Alex da Franca -- alex@farbflash.de 8 -- ------------------------------------------------------------------- 9 -- these handlers are shared between all of my scripts Alex da Franca c2003 alex@farbflash.de 10 -- for private use of my scripts -> poor documentation -> use at own risk ;-) 11 12 -- HISTORY: 13 -- geaendert am 21.06.03 14 -- mGetInstance 0 -- clears all stored instances -> same as recompile all scripts, but that would clear all contents of (script "commonMovieScript").pGList 15 -- mApplyDynamic 16 17 -- alex am 13.03.2004 um 13:49 18 -- added DEBUG_FUNCTIONS 19 20 -- alex am 15.03.2004 um 08:50 21 -- added mGetPlatform() to get OSX 22 -- alex am 31.03.2004 um 11:42 23 -- added clearglobals to mDestroy handler 24 25 -- added support for new director MX2004 sprite names in my handlers by changing mGetKanal() to accept strings 26 27 -- alex am Freitag, 4. Juni 2004 28 -- took care about missing font asset xtra, if it isn't present, we'll get not a script error anymore 29 -- but rather the presence of the font is not checked instead, but rather assumed 30 31 -- alex am 16. Juni 2004 um 10:12 32 -- added mGetNextLowerPowerOfTwo 33 34 -- alex am 18. Juli 2004 um 08:02 35 -- added mMyClearGlobals() to erase the faked globals and get the new globallist 36 37 -- alex am 8. Oktober 2004 um 10:31 38 -- new tempmember handling due to a bug in director 39 40 -- alex am 23. November 2004 um 10:59 41 -- added mGetThisMovieName() and mSetThisMovieName() to identify the movie independant of the filename 42 -- this is needed for some places, where the standard scripts act differently in the different movies 43 44 -- Scriptmarker (21.07.2005 at 11:55 Uhr): changes // Scriptmarker 45 -- added mSplitPath 46 47 -- 48 -- WARNINGS: 49 -- IMPORTANT NOTE !! 50 -- if you use my scripts you MUST call 'mCallDestroy()' at stopmovie in order to clean up temporary members used by my scripts 51 -- due to a bug in director I had to change the old behaavior of erasing the members on endsprite, when I was done with it ! 52 -- so now I use a list of temporary members, which is maintained during runtime, but must be processed when the movie is stopped 53 -- (unless you want to fill up your castlib with temporary members :-) 54 55 -- If this script is NOT the first moviescript in your movie containing a stopmovie handler this one gets overriddden and 56 -- you must call 'mCallDestroy()' in your stopmovie handler. 57 -- otherwise when it this script comes before your script with the stopmovie handler your handler will never be called 58 -- since the stopmovie event is caught here... 59 -- in that case just comment it out here and add the 'mCallDestroy()' to your own stopmovie handler 60 61 -- on stopmovie me 62 -- mCallDestroy 63 -- end 64 -- TODO: 65 -- - 66 ----------------------------------- 64 67 65 68 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx … … 72 75 73 76 on mGetGlobalList me 77 ----------------------------------- 78 -- ACTION: We keep a list of "faked global variables" 79 -- Using real global variables has the drawback, 80 -- that they may clash with the host movies globals 81 -- and even worse: all movie instances running in the same player 82 -- instance -> MIAWs share only one global space 83 -- Since these scripts are also used in my authoring tools 84 -- they can behave nicely, if running as miaws in any environment 85 -- INPUT: - 86 -- RETURNS: property list with global variables 87 -- NOTES: If possible only use the set and get handlers (mSetGlobalValue, mGetGlobalValue) 88 ----------------------------------- 89 74 90 if voidP(pGList) then 75 91 pGList = [:] 76 92 scr = mGetXScript(#regisx) 77 if not voidP(scr) then93 if not listP(scr) then 78 94 if mCheckForXtra(me, "BudAPI") = 1 then call(#regisb, scr) 79 95 if mCheckForXtra(me, "vList") = 1 then call(#regisv, scr) … … 86 102 87 103 on mMyClearGlobals me 104 ----------------------------------- 105 -- CREATED: 11.02.2008 106 -- ACTION: Clear the global list at runtime (at authortime a "Recompile all scripts" does the same) 107 -- See description for "Faked globals" at handler [#mGetGlobalList_commonMovieScript mGetGlobalList] 108 -- INPUT: - 109 -- RETURNS: - 110 ----------------------------------- 111 88 112 pGList = [:] 89 113 return pGList … … 94 118 95 119 on mSetGlobalValue me, propName, newValue 120 ----------------------------------- 121 -- ACTION: Set the value for a "global" variable 122 -- If the "global" with the name #propname doesn't exits it gets created 123 124 -- Interface to the "private globals" stored in this uninstatiated script as property 125 -- See description for "Faked globals" at handler [#mGetGlobalList_commonMovieScript mGetGlobalList] 126 127 -- INPUT: propName: symbol; name of global value 128 -- newValue: any value 129 -- RETURNS: - 130 ----------------------------------- 131 96 132 g = mGetGlobalList(me) 97 133 g.setaprop(propName, newValue) … … 102 138 103 139 on mGetGlobalValue me, propName 140 ----------------------------------- 141 -- ACTION: Get the value for a "global" variable 142 -- If the "global" with the name #propname doesn't exits it returns void 143 144 -- Interface to the "private globals" stored in this uninstatiated script as property 145 -- See description for "Faked globals" at handler [#mGetGlobalList_commonMovieScript mGetGlobalList] 146 147 -- INPUT: propName: symbol; name of global value 148 -- RETURNS: - 149 ----------------------------------- 150 104 151 g = mGetGlobalList(me) 105 152 return g.getaprop(propName) … … 109 156 110 157 on mCallDestroy me 158 ----------------------------------- 159 -- CREATED: 12.02.2008 160 -- ACTION: Call to clean everything up on stopmovie 161 -- INPUT: - 162 -- RETURNS: - 163 ----------------------------------- 164 111 165 112 166 sendAllSprites(#mStopMovieWasCalled) … … 154 208 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 155 209 -- xxxxxxxxxxxxxxxxxx color( -> rgb( 156 -- fix the score data which has #color instead of #rgb when authored with D10, which fails with the older player210 -- 157 211 158 212 on Authoring_ExchangeScriptListColorsToRGBs me 213 ----------------------------------- 214 -- CREATED: 12.02.2008 215 -- ACTION: fix the score data which has #color instead of #rgb when authored with D10 216 -- which fails with the older player (AUTHORING ONLY!) 217 -- INPUT: - 218 -- RETURNS: - 219 ----------------------------------- 220 159 221 theLastFrame = the lastFrame 160 222 theLastChannel = the lastChannel … … 213 275 214 276 on mGetVersionNumber me 277 ----------------------------------- 278 -- CREATED: 12.02.2008 279 -- ACTION: Get player veersion number as float, so that proper maths can be made 280 -- INPUT: - 281 -- RETURNS: float => director player version number 282 ----------------------------------- 215 283 216 284 glob = mGetGlobalList(me) … … 251 319 252 320 on mGetPlatform me 321 ----------------------------------- 322 -- CREATED: 12.02.2008 323 -- ACTION: Get the platform as symbol 324 -- the advantage is that the result is cached in the global list 325 -- and the distinction between OS9 and OSX is made 326 -- INPUT: - 327 -- RETURNS: symbol => platform identifier; range: #os9, #osx, #win 328 ----------------------------------- 253 329 254 330 glob = mGetGlobalList(me) … … 276 352 277 353 on mCheckMemberType me, memref, aType 354 ----------------------------------- 355 -- CREATED: 12.02.2008 356 -- ACTION: Check if the member reference <memref> is of type <aType> 357 -- This handler works in D<10 and D>=10 358 -- INPUT: member reference 359 -- symbol 360 -- RETURNS: boolean (integer) 361 ----------------------------------- 362 278 363 if voidP(memref) then return 0 279 364 return (memref.type = aType) … … 283 368 284 369 on mGetMemType me, memref 370 ----------------------------------- 371 -- CREATED: 12.02.2008 372 -- ACTION: Return the type of member <memref> 373 -- This handler works in D<10 and D>=10 374 -- If memref is not a valid member this handler returns #empty, like D<10 used to 375 -- INPUT: member reference 376 -- RETURNS: symbol => member type; range: every member type and #empty 377 ----------------------------------- 285 378 if ilk(memref) <> #member then return #empty 286 379 return memref.type … … 290 383 291 384 on mCreateTimeout me, theName, theDuration, theHandler, theTarget 385 ----------------------------------- 386 -- CREATED: 12.02.2008 387 -- ACTION: Create/Get timeout object 388 -- This handler works the same with the old player <10 and the new player >=10 389 -- INPUT: ||ÊtheName || string || name for new timeout object|| 390 -- ||ÊtheDuration || integer || timeout perios in milliseconds|| 391 -- || theHandler || symbol || handler to be called on each timepout event|| 392 -- || theTarget || object || object to be sent the timeout event <theHandler>|| 393 -- RETURNS: timeout object 394 ----------------------------------- 292 395 293 396 dto = timeout(theName) … … 393 496 on mGetThisMovieName me 394 497 glob = mGetGlobalList(me) 395 return string(glob.getaprop(#movieIdentifier)) 498 str = string(glob.getaprop(#movieIdentifier)) 499 if length(str) > 0 then return str 500 str = mSplitPath(me, the moviename).basename 501 mSetThisMovieName me, str 502 return str 396 503 end 397 504 … … 1093 1200 -- xxxxxxxxxxxxxxxxxx stored script instances: 1094 1201 1095 on mGetInstance me, instName 1202 on mGetInstance me, instName, useRawNew 1203 1204 if ilk(instName) = #string then instName = symbol(instName) 1205 1096 1206 theGlobs = mGetGlobalList(me) 1097 1207 gParentScriptInstances = theGlobs.getaprop(#gParentScriptInstances) … … 1105 1215 if ilk(saveScr) = #instance then return saveScr 1106 1216 1107 if mGetMemType(me, member(instName)) = #script then 1108 saveScr = new(script instName) 1217 if mGetMemType(me, member(string(instName))) = #script then 1218 if useRawNew = 1 then saveScr = rawnew(script string(instName)) 1219 else saveScr = new(script string(instName)) 1109 1220 gParentScriptInstances.setaprop(instName, saveScr) 1110 1221 return saveScr 1111 1222 end if 1112 1223 1113 1114 inst = mGetXScript(symbol(instName)) 1115 if objectP(inst) then 1116 saveScr = new(inst) 1224 if saveScr = -1 then return 0 1225 gParentScriptInstances.setaprop(instName, -1) 1226 inst = mGetXScript(instName) 1227 if not(listP(inst)) then 1228 if ilk(inst) = #instance then inst = inst.script 1229 if useRawNew = 1 then saveScr = rawnew(inst) 1230 else saveScr = new(inst) 1117 1231 gParentScriptInstances.setaprop(instName, saveScr) 1118 1232 return saveScr … … 1142 1256 1143 1257 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1144 -- xxxxxxxxxxxxxxxxxx reloada stored script instance:1145 1146 on m ReloadInstance me, instName1258 -- xxxxxxxxxxxxxxxxxx delete a stored script instance: 1259 1260 on mDeleteInstance me, instName, dontCallDestroyHandler 1147 1261 theGlobs = mGetGlobalList(me) 1148 1262 gParentScriptInstances = theGlobs.getaprop(#gParentScriptInstances) 1149 1150 1263 if ilk(gParentScriptInstances) <> #proplist then exit 1151 1264 if dontCallDestroyHandler <> 1 then 1265 saveScr = gParentScriptInstances.getaprop(instName) 1266 if ilk(saveScr) = #instance then call(#mDestroy, [saveScr]) 1267 end if 1152 1268 gParentScriptInstances.deleteprop(instName) 1269 end 1270 1271 1272 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1273 -- xxxxxxxxxxxxxxxxxx reload a stored script instance: 1274 1275 on mReloadInstance me, instName, useRawNew, dontCallDestroyHandler 1276 mDeleteInstance me, instName, dontCallDestroyHandler 1277 return mGetInstance(me, instName, useRawNew) 1278 end 1279 1280 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1281 -- xxxxxxxxxxxxxxxxxx replace a stored script instance: 1282 1283 on mReplaceInstance me, instName, scriptInstance, dontCallDestroyHandler 1284 if not(objectP(scriptInstance)) then exit 1285 theGlobs = mGetGlobalList(me) 1286 gParentScriptInstances = theGlobs.getaprop(#gParentScriptInstances) 1287 if ilk(gParentScriptInstances) <> #proplist then exit 1288 if dontCallDestroyHandler <> 1 then 1289 saveScr = gParentScriptInstances.getaprop(instName) 1290 if ilk(saveScr) = #instance then call(#mDestroy, [saveScr]) 1291 end if 1292 gParentScriptInstances.setaprop(instName, scriptInstance) 1153 1293 end 1154 1294 … … 1253 1393 delim = the last char of the moviepath 1254 1394 if length(delim) < 1 then 1255 delim = the last char of the applicationpath 1395 1396 if the runmode contains "plug" then 1397 delim = "/" 1398 else 1399 delim = the last char of the applicationpath 1400 end if 1401 1402 1256 1403 if length(delim) < 1 then delim = "/" 1257 1404 end if … … 1293 1440 mp = the moviepath 1294 1441 if length(mp) < 1 then 1442 if the runmode contains "plug" then 1443 mp = "" 1444 else 1295 1445 mp = the applicationpath 1446 end if 1296 1447 if length(mp) < 1 then 1297 1448 mp = "@/" … … 1309 1460 delim = the last char of the moviepath 1310 1461 if length(delim) < 1 then 1311 delim = the last char of the applicationpath 1462 1463 if the runmode contains "plug" then 1464 mp = "" 1465 else 1466 delim = the last char of the applicationpath 1467 end if 1468 1469 1312 1470 if length(delim) < 1 then delim = "/" 1313 1471 end if … … 1379 1537 delim = the last char of the moviepath 1380 1538 if length(delim) < 1 then 1381 delim = the last char of the applicationpath 1539 if not(the runmode contains "plug") then 1540 delim = the last char of the applicationpath 1541 end if 1382 1542 if length(delim) < 1 then delim = "/" 1383 1543 end if … … 1392 1552 1393 1553 if delim = "\" then 1554 if length(thePath) > 1 then 1394 1555 if thePath.char[2] = ":" then 1395 1556 num = charToNum(thePath.char[1]) … … 1400 1561 praef = "" 1401 1562 end if 1563 else 1564 praef = "" 1565 end if 1402 1566 else 1403 1567 praef = "" … … 1723 1887 end 1724 1888 1889 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1890 -- the naming convention used throughout all my movies for names, filename etc.: 1891 -- Names must be only alphanumeric chars and the underscore and should not start with a number 1892 -- As a rule of thumb: every string which can be made into a symbol is valid. 1893 1894 on mValidateName me, str 1895 if ilk(str) <> #string then return 0 1896 if length(str) < 1 then return 0 1897 if "0123456789" contains char 1 of str then return 0 1898 return string(symbol(str)) = str 1899 end 1725 1900 1726 1901 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx … … 1820 1995 end 1821 1996 1997 1998 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1999 2000 on mFormatdate me, theFormat, theDate 2001 theFormat = string(theFormat) 2002 if length(theFormat) < 1 then theFormat = "yyyy/mm/dd" 2003 if ilk(theDate) <> #date then theDate = the systemdate 2004 2005 offs = offset("y", theFormat) 2006 if offs > 0 then 2007 ende = offs+1 2008 repeat while char ende of theFormat = "y" 2009 if ende > length(theFormat) then exit repeat 2010 ende = ende+1 2011 end repeat 2012 len = ende - offs 2013 if len < 3 then theYear = char 3 to 4 of string(theDate.year) 2014 else theYear = string(theDate.year) 2015 put theYear into char offs to offs + len -1 of theFormat 2016 end if 2017 2018 theFormat = mReplaceCharWithNumber(me, theFormat, "m", theDate.month) 2019 2020 theFormat = mReplaceCharWithNumber(me, theFormat, "d", theDate.day) 2021 2022 return theFormat 2023 end 2024 2025 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2026 2027 on mReplaceCharWithNumber me, theString, theChar, theNumber 2028 offs = offset(theChar, theString) 2029 if offs > 0 then 2030 ende = offs+1 2031 repeat while char ende of theString = theChar 2032 if ende > length(theString) then exit repeat 2033 ende = ende+1 2034 end repeat 2035 len = ende - offs 2036 theNumber = string(theNumber) 2037 repeat while length(theNumber) < len 2038 put "0" before theNumber 2039 end repeat 2040 put theNumber into char offs to offs + len -1 of theString 2041 end if 2042 return theString 2043 end 2044 1822 2045 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1823 2046 … … 1871 2094 1872 2095 on interface me 1873 str = "Common Movie Script by alex da franca ©2003 -- alex@farbflash.de -- all rigths reserved"2096 str = "Common Movie Script by alex da franca c2003 -- alex@farbflash.de -- all rigths reserved" 1874 2097 put RETURN & "Shared Global Handlers" after str 1875 2098 -
trunk/lingosource/castlib3/dreiD_Utility_Scripts.ls
r15 r18 1 2 1 -- alex am Samstag, 22. Mai 2004 3 2 -- tex = mGetTexture(memref, texname) … … 233 232 else 234 233 235 -- pos = findPos(pCameraInfos, cam)236 -- if pos then237 -- center2D = pCameraInfos[cam][#center2D]238 -- SC3 = pCameraInfos[cam][#center3D]239 -- camTransorm = pCameraInfos[cam][#transform]240 -- else241 -- put "cam infos not found"242 R = cam.rect243 center2D = point(R.width/2, R.height/2)244 SC3 = cam.spriteSpaceToWorldSpace(center2D)245 camTransorm = cam.getWorldTransform()246 -- end if247 248 camPos = camTransorm.position249 if camPos = P then RETURN center2D250 251 if voidIfBehind then252 -- if point is behind camera return void234 -- pos = findPos(pCameraInfos, cam) 235 -- if pos then 236 -- center2D = pCameraInfos[cam][#center2D] 237 -- SC3 = pCameraInfos[cam][#center3D] 238 -- camTransorm = pCameraInfos[cam][#transform] 239 -- else 240 -- put "cam infos not found" 241 R = cam.rect 242 center2D = point(R.width/2, R.height/2) 243 SC3 = cam.spriteSpaceToWorldSpace(center2D) 244 camTransorm = cam.getWorldTransform() 245 -- end if 246 247 camPos = camTransorm.position 248 if camPos = P then RETURN center2D 249 250 if voidIfBehind then 251 -- if point is behind camera return void 253 252 if (SC3-camPos).angleBetween(P-camPos) > 90 then 254 253 … … 264 263 return void 265 264 end if 266 end if267 268 a = (SC3 - camPos).angleBetween(P - camPos) -- angle between straithforwoard view and view to point269 Pdistance = (P - camPos).length -- distance from point to camera270 Pl = cos(a*pi()/180.0) * Pdistance -- distance from camera to straithforwoard point, that is in the Ebene of point271 Cl = (SC3-camPos).length -- distance from camera to straightforwoard viewpoint272 relation = Pl / Cl -- factor for multiplying spriteSpaceToWorldSpace result273 274 SC3P = camPos + (relation*(SC3-camPos)) -- point straightforwoard in Ebene of point275 dist = (P-SC3P).magnitude -- distance from point to SC3P276 camX = camTransorm.xAxis277 ax = camX.angleBetween(P-SC3P)278 x = cos(ax*pi()/180.0) * dist279 camY = camTransorm.yAxis280 ay = camY.angleBetween(P-SC3P)281 y = cos(ay*pi()/180.0) * dist282 265 end if 266 267 a = (SC3 - camPos).angleBetween(P - camPos) -- angle between straithforwoard view and view to point 268 Pdistance = (P - camPos).length -- distance from point to camera 269 Pl = cos(a*pi()/180.0) * Pdistance -- distance from camera to straithforwoard point, that is in the Ebene of point 270 Cl = (SC3-camPos).length -- distance from camera to straightforwoard viewpoint 271 relation = Pl / Cl -- factor for multiplying spriteSpaceToWorldSpace result 272 273 SC3P = camPos + (relation*(SC3-camPos)) -- point straightforwoard in Ebene of point 274 dist = (P-SC3P).magnitude -- distance from point to SC3P 275 camX = camTransorm.xAxis 276 ax = camX.angleBetween(P-SC3P) 277 x = cos(ax*pi()/180.0) * dist 278 camY = camTransorm.yAxis 279 ay = camY.angleBetween(P-SC3P) 280 y = cos(ay*pi()/180.0) * dist 281 283 282 ---------------------------------------- 284 283 -- scale correction reset … … 291 290 ---------------------------------------- 292 291 293 RETURN (point(x, -y)/relation) + center2D 294 end if 292 RETURN (point(x, -y)/relation) + center2D 293 end if 294 end 295 296 297 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 298 -- xxxxxxxxxxxxxxxxxx map clickloc to 2-D image coordinates: 299 300 on mMapPointToTexture me, iSectList, anImage, tTextureLayer -------------------------------------- 301 -- Many Thanks to James Newton <james.newton@openspark.com> for sharing this handler ! 302 303 -- RETURNS the point in the Bitmap member used by the texture 304 -- defined implicitly in <iSectList> 305 -- 306 -- INPUT: 307 -- <iSectList> should be a property list of the format: 308 -- [#model: model("model name"), 309 -- #distance: <float>, 310 -- #isectPosition: <vector>, 311 -- #isectNormal: <vector>, 312 -- #meshID: <integer>, 313 -- #faceID: <integer>, 314 -- #vertices: [<vector>, <vector>, <vector>], 315 -- #uvCoord: [#u: <float>, #v: <float>]] 316 -- 317 -- When you use aCamera.modelsUnderLoc(aLoc, #detailed) or 318 -- aMember.modelsUnderRay(aPoint, aVector, #detailed), the result is 319 -- a linear list of lists with this format. 320 --------------------------------------------------------------------- 321 322 tModel = iSectList.model 323 if voidP(tModel) then return #modelWasDeleted 324 325 326 tResource = tModel.resource 327 328 isMesh = (tResource.type = #mesh) 329 330 if not isMesh then 331 -- We need to use the mesh deform modifier to get texture data 332 if not((tModel.modifier).getPos(#meshdeform))then 333 -- Add mesh deform modifier... but remember to remove it later 334 tModel.addModifier(#meshdeform) 335 isModified = TRUE 336 end if 337 end if 338 339 tShader = tModel.shaderList[iSectList.meshID] 340 341 if voidP(tTextureLayer) then tTextureLayer = 1 342 tTexture = tShader.textureList[tTextureLayer] 343 344 if voidP(tTexture) then 345 return 0 346 end if 347 348 case tTexture.type of 349 #importedFromFile: 350 -- Exercise left to the reader 351 return #importedFromFile 352 353 #fromImageObject: 354 -- You may be able to continue if you have kept a copy of the 355 -- image, or, at the very least, its initial dimensions 356 case ilk(anImage) of 357 #image: 358 tWidth = anImage.width 359 tHeight = anImage.height 360 361 #propList, #instance: 362 -- Check whether we can extract width and height properties 363 tWidth = anImage[#width] 364 if integerP(tWidth) then 365 tHeight = anImage[#height] 366 end if 367 368 if not integerP(tHeight) then 369 -- No width or height data is available 370 return #fromImageObject 371 end if 372 373 otherwise: 374 return #fromImageObject 375 end case 376 377 378 #fromCastMember: 379 tMember = tTexture.member 380 tWidth = tMember.width 381 tHeight = tMember.height 382 end case 383 384 tFace = iSectList.faceID 385 tUVCoord = iSectList.uvCoord 386 387 -- Determine how the iSect data maps to this particular face 388 if isMesh then 389 tCoordList = tResource.textureCoordinateList 390 tFaceList = tResource.face[tFace].textureCoordinates 391 392 else 393 -- tCoordList = tModel.meshdeform.mesh[iSectList.meshID].textureCoordinateList 394 tCoordList = tModel.meshdeform.mesh[iSectList.meshID].textureLayer[tTextureLayer].textureCoordinateList 395 tFaceList = tModel.meshdeform.mesh[iSectList.meshID].face[tFace] 396 if isModified then 397 -- Remove the modifier now that it has done its job 398 tModel.removeModifier(#meshdeform) 399 end if 400 end if 401 402 -- tCoordList will be a list of lists, each containing two floating- 403 -- point numbers between 0.0 and 1.0. The first number defines the 404 -- relative horizontal position of a point in the texture, the 405 -- second number defines the relative vertical point. The origin 406 -- point [0.0, 0.0] is in the bottom left hand corner. 407 -- 408 -- tFaceList will be a list with three integer values [a, b, c] 409 -- These values determine which entry in tCoordList is used by the 410 -- chosen face. The first entry <a> defines the origin. The u 411 -- value increases from <a> to <b>. Any point on the line between 412 -- <a> and <b> will have a v value of zero. The v value increases 413 -- from <a> to <c>. Any point on the line between <a> and <b> will 414 -- have a v value of zero. 415 416 -- Calculate the position of the points <a>, <b> and <c> within the 417 -- Bitmap member. 418 419 tLocA = tCoordList[tFaceList[1]] -- [<float>, <float>] 420 tLocA = point(tLocA[1] * tWidth, (1 - tLocA[2]) * tHeight) 421 422 tLocB = tCoordList[tFaceList[2]] -- [<float>, <float>] 423 tLocB = point(tLocB[1] * tWidth, (1 - tLocB[2]) * tHeight) 424 425 tLocC = tCoordList[tFaceList[3]] -- [<float>, <float>] 426 tLocC = point(tLocC[1] * tWidth, (1 - tLocC[2]) * tHeight) 427 428 tUVector = (tLocB - tLocA) * tUVCoord.u -- actually a 2D point... 429 tVVector = (tLocC - tLocA) * tUVCoord.v -- ... rather than a vector 430 431 -- Start from the origin <a>, move first in the u direction then in 432 -- the v direction to end up at the point in the texture 433 434 -- return tLocA + tUVector + tVVector 435 P = tLocA + tUVector + tVVector 436 repeat while P[1] > tWidth 437 P[1] = P[1] - tWidth 438 end repeat 439 repeat while P[2] > tHeight 440 P[2] = P[2] - tHeight 441 end repeat 442 return P 295 443 end 296 444 … … 313 461 if ilk(theEvent) <> #symbol then exit 314 462 463 resultlist = [] 464 315 465 repeat with n = memref.model.count down to 1 316 466 scrili = mGetParentScriptList(me, memref.model[n]) 317 call(theEvent, scrili, memref.model[n], param1, param2, param3) 467 repeat with this in scrili 468 res = call(theEvent, [this], param1, param2, param3, memref.model[n]) 469 if not(voidP(res)) then 470 if ilk(res, #void) <> 1 then resultlist.add(res) 471 end if 472 end repeat 318 473 end repeat 319 474 320 475 repeat with n = memref.group.count down to 1 321 476 scrili = mGetParentScriptList(me, memref.group[n]) 322 call(theEvent, scrili, memref.group[n], param1, param2, param3) 477 repeat with this in scrili 478 res = call(theEvent, [this], param1, param2, param3, memref.group[n]) 479 if not(voidP(res)) then 480 if ilk(res, #void) <> 1 then resultlist.add(res) 481 end if 482 end repeat 323 483 end repeat 324 484 325 485 repeat with n = memref.camera.count down to 1 326 486 scrili = mGetParentScriptList(me, memref.camera[n]) 327 call(theEvent, scrili, memref.camera[n], param1, param2, param3) 487 repeat with this in scrili 488 res = call(theEvent, [this], param1, param2, param3, memref.camera[n]) 489 if not(voidP(res)) then 490 if ilk(res, #void) <> 1 then resultlist.add(res) 491 end if 492 end repeat 328 493 end repeat 329 494 330 495 repeat with n = memref.light.count down to 1 331 496 scrili = mGetParentScriptList(me, memref.light[n]) 332 call(theEvent, scrili, memref.light[n], param1, param2, param3) 333 end repeat 334 497 repeat with this in scrili 498 res = call(theEvent, [this], param1, param2, param3, memref.light[n]) 499 if not(voidP(res)) then 500 if ilk(res, #void) <> 1 then resultlist.add(res) 501 end if 502 end repeat 503 end repeat 504 505 if count(resultlist) = 1 then resultlist = resultlist[1] 506 return resultlist 507 end 508 509 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 510 -- send Event to a Node 511 -- xscr(#dreiD_Utility_Scripts).mSendEventToNode(theNode, #theEvent) 512 513 on mSendEventToNode me, theNode, theEvent, bool_Recursion, bool_ReturnSingleResult, param1, param2, param3 514 515 if ilk(theEvent) <> #symbol then exit 516 if voidP(theNode) then exit 517 518 resultlist = [] 519 520 scrili = mGetParentScriptList(me, theNode) 521 522 repeat with this in scrili 523 res = call(theEvent, [this], param1, param2, param3, theNode) 524 if not(voidP(res)) then 525 if ilk(res, #void) <> 1 then resultlist.add(res) 526 end if 527 end repeat 528 529 530 if bool_Recursion = 1 then 531 repeat with n = theNode.child.count down to 1 532 res = mSendEventToNode(me, theNode.child[n], theEvent, bool_Recursion, param1, param2, param3) 533 if listP(res) then 534 repeat with this in res 535 resultlist.add(this) 536 end repeat 537 else 538 if not(voidP(res)) then 539 if ilk(res, #void) <> 1 then resultlist.add(res) 540 end if 541 end if 542 end repeat 543 end if 544 545 cnt = count(resultlist) 546 if cnt > 0 then 547 if count(resultlist) = 1 then 548 return resultlist[1] 549 else 550 if bool_ReturnSingleResult = 1 then return resultlist[1] 551 return resultlist 552 end if 553 end if 554 555 return void 335 556 336 557 end … … 363 584 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 364 585 -- access a specific script instance by name 586 -- if the script has a handler "mGetScriptInstance" we are set 587 -- otherwise we try it via "mGetScriptInstanceList" 365 588 366 589 on mGetParentScriptInstance me, theModel, theName … … 368 591 li = [] 369 592 call(#mGetScriptInstance, scrili, theName, li) 370 if count(li) then return li[1] 371 else return 0 593 if count(li) then 594 return li[1] 595 else 596 repeat with n = count(scrili) down to 1 597 li = [] 598 call(#mGetScriptInstanceList, [scrili[n]], li) 599 if li.getPos(theName) then return scrili[n] 600 end repeat 601 return 0 602 end if 372 603 end 373 604 … … 406 637 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 407 638 408 on mGetGroup me, memref, theName 639 on mGetGroup me, memref, theName, unique 409 640 410 641 theName = string(theName) 411 if length(theName) < 1 then theName = mGetUniqueNodeName(me, memref, "UntitledGroup") 642 if length(theName) < 1 then 643 theName = mGetUniqueNodeName(me, memref, "UntitledGroup") 644 else 645 if unique = 1 then theName = mGetUniqueNodeName(me, memref, theName) 646 end if 412 647 413 648 mo = mGetNode(me, memref, theName, #group) … … 419 654 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 420 655 421 on mGetModel me, memref, theName 656 on mGetModel me, memref, theName, unique 422 657 423 658 theName = string(theName) 424 if length(theName) < 1 then theName = mGetUniqueNodeName(me, memref, "UntitledModel") 659 if length(theName) < 1 then 660 theName = mGetUniqueNodeName(me, memref, "UntitledModel") 661 else 662 if unique = 1 then theName = mGetUniqueNodeName(me, memref, theName) 663 end if 425 664 426 665 mo = mGetNode(me, memref, theName, #model) … … 432 671 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 433 672 434 on mGetModelResource me, memref, theName, theType 673 on mGetModelResource me, memref, theName, theType, unique 435 674 436 675 theName = string(theName) 437 if length(theName) < 1 then theName = mGetUniqueModelResourceName(me, memref, "UntitledModelResource") 676 if length(theName) < 1 then 677 theName = mGetUniqueModelResourceName(me, memref, "UntitledModelResource") 678 else 679 if unique = 1 then theName = mGetUniqueModelResourceName(me, memref, theName) 680 end if 438 681 439 682 if [#plane, #box, #sphere, #cylinder, #particle, #mesh].getPos(theType) < 1 then theType = #box … … 446 689 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 447 690 448 on mGetShader me, memref, theName 691 on mGetShader me, memref, theName, unique 449 692 450 693 theName = string(theName) 451 if length(theName) < 1 then theName = mGetUniqueShaderName(me, memref, "UntitledShader") 694 if length(theName) < 1 then 695 theName = mGetUniqueShaderName(me, memref, "UntitledShader") 696 else 697 if unique = 1 then theName = mGetUniqueShaderName(me, memref, theName) 698 end if 452 699 453 700 shd = memref.shader(theName) … … 459 706 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 460 707 461 on mGetLight me, memref, theName, theType 708 on mGetLight me, memref, theName, theType, unique 462 709 463 710 theName = string(theName) 464 if length(theName) < 1 then theName = mGetUniqueNodeName(me, memref, "UntitledLight") 711 if length(theName) < 1 then 712 theName = mGetUniqueNodeName(me, memref, "UntitledLight") 713 else 714 if unique = 1 then theName = mGetUniqueNodeName(me, memref, theName) 715 end if 465 716 466 717 if [#directional, #ambient, #point, #spot].getPos(theType) < 1 then theType = #directional … … 635 886 636 887 on mSetLOD me, memref, newLod, lodAuto 637 if call(#mGetMemType, [mGetXScript()], memref) = #shockwave3d then888 if call(#mGetMemType, mGetXScript(), memref) = #shockwave3d then 638 889 if voidP(lodAuto) then lodAuto = 1 639 890 repeat with r = memref.modelresource.count down to 1 … … 690 941 691 942 on mBatchRemoveModifiers me, memref, whichModifier 692 if call(#mGetMemType, [mGetXScript()], memref) = #shockwave3d then943 if call(#mGetMemType, mGetXScript(), memref) = #shockwave3d then 693 944 if ilk(whichModifier) <> #list then whichModifier = [whichModifier] 694 945 mdfCnt = whichModifier.count … … 722 973 723 974 724 -- Node Functions -- Movie Script Handler -- Alex da Franca ©2002 da.franca@online.de975 -- Node Functions -- Movie Script Handler -- Alex da Franca c2002 da.franca@online.de 725 976 726 977 … … 1491 1742 if count(teli) > 7 then 1492 1743 1493 repeat with l = count(teli) down to 11494 if not(voidP(teli[l])) then1495 thisTex = teli[l]1496 1497 -- thisTexname = thisTex.name1498 1499 if thisShaderTextures.getPos(thisTex) < 1 then1500 thisShaderTextures.add(thisTex)1501 1502 li = texli.getaprop(thisTex)1503 if not listP(li) then1504 li = []1505 texli.setaprop(thisTex, li)1506 end if1507 if li.getPos(thisShd) < 1 then li.add(thisShd)1508 1509 end if1744 repeat with l = count(teli) down to 1 1745 if not(voidP(teli[l])) then 1746 thisTex = teli[l] 1747 1748 -- thisTexname = thisTex.name 1749 1750 if thisShaderTextures.getPos(thisTex) < 1 then 1751 thisShaderTextures.add(thisTex) 1752 1753 li = texli.getaprop(thisTex) 1754 if not listP(li) then 1755 li = [] 1756 texli.setaprop(thisTex, li) 1757 end if 1758 if li.getPos(thisShd) < 1 then li.add(thisShd) 1759 1760 end if 1510 1761 end if 1511 1762 end repeat … … 1674 1925 if count(TL) > 7 then 1675 1926 1676 repeat with r = 1 to 81677 thisTex = thisShd.texturelist[r]1678 if not voidP(thisTex) then1679 repeat with l = 1 to anzShd1680 1681 -- thisTexli = memref.shader[l].texturelist1682 -- if thisTexli.getPos(thisTex) > 0 then1683 -- if memref.shader[l] <> thisShd then exit repeat1684 -- end if1685 gefunden = 01927 repeat with r = 1 to 8 1928 thisTex = thisShd.texturelist[r] 1929 if not voidP(thisTex) then 1930 repeat with l = 1 to anzShd 1931 1932 -- thisTexli = memref.shader[l].texturelist 1933 -- if thisTexli.getPos(thisTex) > 0 then 1934 -- if memref.shader[l] <> thisShd then exit repeat 1935 -- end if 1936 gefunden = 0 1686 1937 1687 1938 TL = getPropRef(memref.shader[l], #textureList) 1688 1939 if listP(TL) then 1689 1940 if count(TL) > 7 then 1690 repeat with rrr = 1 to 81691 if memref.shader[l].texturelist[rrr] = thisTex then1692 if memref.shader[l] <> thisShd then1693 gefunden = 11694 exit repeat1695 end if1696 end if1697 end repeat1941 repeat with rrr = 1 to 8 1942 if memref.shader[l].texturelist[rrr] = thisTex then 1943 if memref.shader[l] <> thisShd then 1944 gefunden = 1 1945 exit repeat 1946 end if 1947 end if 1948 end repeat 1698 1949 end if 1699 1950 end if 1700 1951 1701 if gefunden then exit repeat 1702 1952 if gefunden then exit repeat 1953 1954 end repeat 1955 if l > anzShd then 1956 thisShd.texturelist[r] = void 1957 1958 --------------------------------------------- delete the fake userdata, which is saved seperately, in order to free memory 1959 if ilk(sceneManager) = #instance then 1960 1961 textureFromFile = 1 1962 -- in case we are still loading the image for this texture, we may want to stop the loading: 1963 sourcePath = string(sceneManager.mGetUserdata(#texture, thisTex.name, #sourcePath)) 1964 if length(sourcePath) > 0 then 1965 loadJob = loadMediaAsynchPS.mGetJobReference(sourcePath) 1966 if objectP(loadJob) then 1967 if count(loadJob) > 0 then 1968 call(#mAbortTextureLoad, loadJob.getaprop(#pCallerref), thisTex, sourcePath) 1969 textureFromFile = 0 1970 end if 1971 end if 1972 end if 1973 1974 1975 1976 -- if textureFromFile = 0 then 1977 -- sceneManager.mRemoveUserdata(#texture, thisTex.name) 1978 -- memref.deleteTexture(thisTex.name) 1979 -- 1980 -- else 1981 1982 ------------- we do NOT delete the resources here, if there is a sceneManager, it cares for the resource management 1983 sceneManager.mMarkForDeletion(#texture, thisTex.name) 1984 1985 -- end if 1986 1987 else 1988 1989 memref.deleteTexture(thisTex.name) 1990 1991 end if 1992 --------------------------------------------- 1993 1994 end if 1995 end if 1703 1996 end repeat 1704 if l > anzShd then 1705 thisShd.texturelist[r] = void 1706 1707 --------------------------------------------- delete the fake userdata, which is saved seperately, in order to free memory 1708 if ilk(sceneManager) = #instance then 1709 1710 textureFromFile = 1 1711 -- in case we are still loading the image for this texture, we may want to stop the loading: 1712 sourcePath = string(sceneManager.mGetUserdata(#texture, thisTex.name, #sourcePath)) 1713 if length(sourcePath) > 0 then 1714 loadJob = loadMediaAsynchPS.mGetJobReference(sourcePath) 1715 if ilk(loadJob) = #proplist then 1716 if count(loadJob) > 0 then 1717 call(#mAbortTextureLoad, loadJob.getaprop(#pCallerref), thisTex, sourcePath) 1718 textureFromFile = 0 1719 end if 1720 end if 1721 end if 1722 1723 1724 1725 -- if textureFromFile = 0 then 1726 -- sceneManager.mRemoveUserdata(#texture, thisTex.name) 1727 -- memref.deleteTexture(thisTex.name) 1728 -- 1729 -- else 1730 1731 ------------- we do NOT delete the resources here, if there is a sceneManager, it cares for the resource management 1732 sceneManager.mMarkForDeletion(#texture, thisTex.name) 1733 1734 -- end if 1735 1736 else 1737 1738 memref.deleteTexture(thisTex.name) 1739 1740 end if 1741 --------------------------------------------- 1742 1743 end if 1744 end if 1745 end repeat 1746 1997 1747 1998 end if 1748 1999 end if … … 1837 2088 -- 1838 2089 -- if listP(theTexturelist) then 1839 repeat with r = count(theTexturelist) down to 1 1840 thisTex = theTexturelist[r] 1841 1842 if not voidP(thisTex) then 2090 repeat with r = count(theTexturelist) down to 1 2091 thisTex = theTexturelist[r] 1843 2092 1844 usedList = txtrs.getaprop(thisTex) 1845 1846 if listP(usedList) then 1847 usedList.deleteOne(thisShd) 1848 deleteTex = (count(usedList) = 0) 1849 else 1850 deleteTex = 0 1851 end if 1852 1853 if deleteTex = 1 then 1854 thisShd.texturelist[r] = void 2093 if not voidP(thisTex) then 1855 2094 2095 usedList = txtrs.getaprop(thisTex) 1856 2096 1857 --------------------------------------------- delete the fake userdata, which is saved seperately, in order to free memory 1858 if ilk(sceneManager) = #instance then 2097 if listP(usedList) then 2098 usedList.deleteOne(thisShd) 2099 deleteTex = (count(usedList) = 0) 2100 else 2101 deleteTex = 0 2102 end if 2103 2104 if deleteTex = 1 then 2105 thisShd.texturelist[r] = void 1859 2106 1860 textureFromFile = 1 1861 -- in case we are still loading the image for this texture, we may want to stop the loading: 1862 sourcePath = string(sceneManager.mGetUserdata(#texture, thisTex.name, #sourcePath)) 1863 if length(sourcePath) > 0 then 1864 loadJob = loadMediaAsynchPS.mGetJobReference(sourcePath) 1865 if ilk(loadJob) = #proplist then 1866 if count(loadJob) > 0 then 1867 call(#mAbortTextureLoad, loadJob.getaprop(#pCallerref), thisTex) 1868 textureFromFile = 0 2107 2108 --------------------------------------------- delete the fake userdata, which is saved seperately, in order to free memory 2109 if ilk(sceneManager) = #instance then 2110 2111 textureFromFile = 1 2112 -- in case we are still loading the image for this texture, we may want to stop the loading: 2113 sourcePath = string(sceneManager.mGetUserdata(#texture, thisTex.name, #sourcePath)) 2114 if length(sourcePath) > 0 then 2115 loadJob = loadMediaAsynchPS.mGetJobReference(sourcePath) 2116 if objectP(loadJob) then 2117 if count(loadJob) > 0 then 2118 call(#mAbortTextureLoad, loadJob.getaprop(#pCallerref), thisTex) 2119 textureFromFile = 0 2120 end if 1869 2121 end if 1870 2122 end if 2123 2124 2125 if not(voidP(thisTex)) then -- the above #mAbortTextureLoad may have get rid of the texture and thus it is not present anymore 2126 2127 -- if textureFromFile = 0 then 2128 -- sceneManager.mRemoveUserdata(#texture, thisTex.name) 2129 -- 2130 -- else 2131 sceneManager.mMarkForDeletion(#texture, thisTex.name) 2132 2133 -- end if 2134 2135 end if 2136 2137 2138 else 2139 2140 memref.deleteTexture(thisTex.name) 2141 1871 2142 end if 2143 --------------------------------------------- 1872 2144 1873 2145 1874 if not(voidP(thisTex)) then -- the above #mAbortTextureLoad may have get rid of the texture and thus it is not present anymore1875 1876 -- if textureFromFile = 0 then1877 -- sceneManager.mRemoveUserdata(#texture, thisTex.name)1878 --1879 -- else1880 sceneManager.mMarkForDeletion(#texture, thisTex.name)1881 1882 -- end if1883 1884 end if1885 1886 1887 else1888 1889 memref.deleteTexture(thisTex.name)1890 1891 2146 end if 1892 ---------------------------------------------1893 1894 2147 1895 2148 end if 1896 1897 end if 1898 end repeat 1899 end if 1900 2149 end repeat 2150 end if 2151 1901 2152 end if 1902 2153 … … 1976 2227 if length(sourcePath) > 0 then 1977 2228 loadJob = loadMediaAsynchPS.mGetJobReference(sourcePath) 1978 if ilk(loadJob) = #proplistthen2229 if objectP(loadJob) then 1979 2230 if count(loadJob) > 0 then 1980 2231 call(#mAbortTextureLoad, loadJob.getaprop(#pCallerref), thisTex) … … 2239 2490 else 2240 2491 2241 if ilk(newName) <> #string then newName = shadRef.name&"_Clone"2242 if newName.length = 0 then newName = shadRef.name&"_Clone"2243 2244 dername = mGetUniqueShaderName(me, memref, newName)2245 2246 dertyp = shadRef.type2247 2248 sClone = memref.newShader(dername, dertyp)2249 2492 if ilk(newName) <> #string then newName = shadRef.name&"_Clone" 2493 if newName.length = 0 then newName = shadRef.name&"_Clone" 2494 2495 dername = mGetUniqueShaderName(me, memref, newName) 2496 2497 dertyp = shadRef.type 2498 2499 sClone = memref.newShader(dername, dertyp) 2500 2250 2501 end if 2251 2502 … … 2611 2862 2612 2863 2613 on mRotateShader me, aShader, aRotation----------------------------- 2864 on mRotateShader me, aShader, aRotation, aTextureIndex 2865 ----------------------------- 2614 2866 -- INPUT: <aShader> must be a shader object 2615 2867 -- <aRotation> must be a float or integer angle in degrees 2868 -- <aTextureIndex> the textureindex on the shader, defaults to 1 2616 2869 -- ACTION: Rotates the shader around its center to the given angle 2617 2870 -------------------------------------------------------------------- 2618 2871 2872 aTextureIndex = max(1, min(8, integer(aTextureIndex))) 2873 2619 2874 -- Take a copy of the shader's current transform 2620 tTransform = aShader.textureTransform 2875 tTransform = aShader.textureTransformList[aTextureIndex] 2621 2876 2622 2877 -- Rotate the texture around its bottom right corner … … 2626 2881 -- still centered. 2627 2882 tRotation = 45 + aRotation 2628 tTransform.position.x = cos(tRotation * pi / 180) / sqrt(2.0) + 0.52629 tTransform.position.y = sin(tRotation * pi / 180) / sqrt(2.0) + 0.52883 tTransform.position.x = (cos(tRotation * pi / 180) / sqrt(2.0)) * tTransform.scale.x + 0.5-- * (tTransform.scale.x) 2884 tTransform.position.y = (sin(tRotation * pi / 180) / sqrt(2.0)) * tTransform.scale.x + 0.5-- * (tTransform.scale.y) 2630 2885 2631 2886 -- Apply the modified transform 2632 aShader.textureTransform = tTransform2887 aShader.textureTransformlist[aTextureIndex] = tTransform 2633 2888 end 2634 2889 … … 2964 3219 end 2965 3220 3221 2966 3222 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2967 3223 -
trunk/lingosource/castlib3/memberInfo.xml
r14 r18 5 5 <comments>~/Documents/Scripts/lingo/Alex_HierMenuParent.ls</comments> 6 6 <memberName>Alex_HierMenuParent</memberName> 7 <f Name>Alex_HierMenuParent</fName>7 <fname>Alex_HierMenuParent</fname> 8 8 </Alex_HierMenuParent> 9 9 <SliderScrollbarMenuParent> … … 11 11 <comments>~/Documents/Scripts/lingo/SliderScrollbarMenuParent.ls</comments> 12 12 <memberName>SliderScrollbarMenuParent</memberName> 13 <f Name>SliderScrollbarMenuParent</fName>13 <fname>SliderScrollbarMenuParent</fname> 14 14 </SliderScrollbarMenuParent> 15 15 <DropShadowPScript> … … 17 17 <comments>~/Documents/Scripts/lingo/DropShadowPScript.ls</comments> 18 18 <memberName>DropShadowPScript</memberName> 19 <f Name>DropShadowPScript</fName>19 <fname>DropShadowPScript</fname> 20 20 </DropShadowPScript> 21 21 <ButtonImageCreator> … … 23 23 <comments>~/Documents/Scripts/lingo/ButtonImageCreator.ls</comments> 24 24 <memberName>ButtonImageCreator</memberName> 25 <f Name>ButtonImageCreator</fName>25 <fname>ButtonImageCreator</fname> 26 26 </ButtonImageCreator> 27 27 <ButtonManager> … … 29 29 <comments>~/Documents/Scripts/lingo/ButtonManager.ls</comments> 30 30 <memberName>ButtonManager</memberName> 31 <f Name>ButtonManager</fName>31 <fname>ButtonManager</fname> 32 32 </ButtonManager> 33 33 <GenericButtonPS> … … 35 35 <comments>~/Documents/Scripts/lingo/GenericButtonPS.ls</comments> 36 36 <memberName>GenericButtonPS</memberName> 37 <f Name>GenericButtonPS</fName>37 <fname>GenericButtonPS</fname> 38 38 </GenericButtonPS> 39 39 <commonmoviescript> … … 41 41 <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 42 42 <memberName>commonMovieScript</memberName> 43 <f Name>commonMovieScript</fName>43 <fname>commonMovieScript</fname> 44 44 </commonmoviescript> 45 45 <imageUtilityScripts> … … 47 47 <comments>~/Documents/Scripts/lingo/ImageUtilityScripts.ls</comments> 48 48 <memberName>ImageUtilityScripts</memberName> 49 <f Name>ImageUtilityScripts</fName>49 <fname>ImageUtilityScripts</fname> 50 50 </imageUtilityScripts> 51 51 <GetSetPrefs> … … 53 53 <comments>~/Documents/Scripts/lingo/GetSetPrefs.ls</comments> 54 54 <memberName>GetSetPrefs</memberName> 55 <f Name>GetSetPrefs</fName>55 <fname>GetSetPrefs</fname> 56 56 </GetSetPrefs> 57 57 <PseudoXMLPS> … … 59 59 <comments>~/Documents/Scripts/lingo/PseudoXMLPS.ls</comments> 60 60 <memberName>PseudoXMLPS</memberName> 61 <f Name>PseudoXMLPS</fName>61 <fname>PseudoXMLPS</fname> 62 62 </PseudoXMLPS> 63 63 <ToolTipBeaver_1> … … 65 65 <comments>~/Documents/Scripts/lingo/ToolTipBeaver_1.ls</comments> 66 66 <memberName>ToolTipBeaver_1</memberName> 67 <f Name>ToolTipBeaver_1</fName>67 <fname>ToolTipBeaver_1</fname> 68 68 </ToolTipBeaver_1> 69 69 <SpriteNameBeaver> … … 71 71 <comments>~/Documents/Scripts/lingo/SpriteNameBeaver.ls</comments> 72 72 <memberName>SpriteNameBeaver</memberName> 73 <f Name>SpriteNameBeaver</fName>73 <fname>SpriteNameBeaver</fname> 74 74 </SpriteNameBeaver> 75 75 <FileIOFunktionen> … … 77 77 <comments>~/Documents/Scripts/lingo/FileIOFunktionen.ls</comments> 78 78 <memberName>FileIOFunktionen</memberName> 79 <f Name>FileIOFunktionen</fName>79 <fname>FileIOFunktionen</fname> 80 80 </FileIOFunktionen> 81 81 <dreiD_Utility_Scripts> 82 82 <scriptType>#parent</scriptType> 83 <comments>~/Documents/Scripts/lingo/ 3-D_Utility_Scripts.ls</comments>83 <comments>~/Documents/Scripts/lingo/dreiD_Utility_Scripts.ls</comments> 84 84 <memberName>dreiD_Utility_Scripts</memberName> 85 <f Name>dreiD_Utility_Scripts</fName>85 <fname>dreiD_Utility_Scripts</fname> 86 86 </dreiD_Utility_Scripts> 87 87 </Untitled>
Note: See TracChangeset
for help on using the changeset viewer.
