Changeset 18
- Timestamp:
- 10/24/08 12:12:09 (3 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
