Changeset 241 for trunk/lingosource/castlib2/commonMovieScript.ls
- Timestamp:
- 12/18/09 15:27:43 (2 years ago)
- File:
-
- 1 edited
-
trunk/lingosource/castlib2/commonMovieScript.ls (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lingosource/castlib2/commonMovieScript.ls
r228 r241 198 198 199 199 -- clearglobals 200 end 201 202 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 203 204 on mGetPlayBackModeValue me, symbol_Prop 205 if ilk(symbol_Prop) <> #symbol then symbol_Prop = #playBackMode 206 playBackModeValueList = mGetGlobalValue(me, #playBackModeValueList) 207 if not(objectP(playBackModeValueList)) then playBackModeValueList = [:] 208 return playBackModeValueList[symbol_Prop] 209 end 210 211 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 212 213 on mSetPlayBackModeValue me, symbol_Prop, any_value 214 if ilk(symbol_Prop) <> #symbol then exit 215 playBackModeValueList = mGetGlobalValue(me, #playBackModeValueList) 216 if not(objectP(playBackModeValueList)) then 217 playBackModeValueList = [:] 218 mSetGlobalValue(me, #playBackModeValueList, playBackModeValueList) 219 end if 220 return playBackModeValueList[symbol_Prop] = any_value 200 221 end 201 222 … … 296 317 297 318 on mGetFloatVersionNumber me, prodVers 298 offs = offset(".", prodVers)299 if offs > 0 then300 intVers = char 1 to offs of prodVers301 delete char 1 to offs of prodVers302 else303 intVers = ""304 end if305 cnt = length(prodVers)306 repeat with n = 1 to cnt307 c = prodVers.char[n]308 if integerP(integer(c)) then309 put c after intVers310 else if c <> "." then311 exit repeat312 end if313 end repeat314 319 offs = offset(".", prodVers) 320 if offs > 0 then 321 intVers = char 1 to offs of prodVers 322 delete char 1 to offs of prodVers 323 else 324 intVers = "" 325 end if 326 cnt = length(prodVers) 327 repeat with n = 1 to cnt 328 c = prodVers.char[n] 329 if integerP(integer(c)) then 330 put c after intVers 331 else if c <> "." then 332 exit repeat 333 end if 334 end repeat 335 315 336 return value(intVers) 337 end 338 339 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 340 341 on mGetEnvironment me 342 ----------------------------------- 343 -- CREATED: 18.05.2009 344 -- ACTION: Getting the environment properts list is very slow, 345 -- therefore we make sure to get it only once and store the rsult 346 -- INPUT: - 347 -- RETURNS: property list => the environment 348 ----------------------------------- 349 350 env = mGetGlobalValue(me, #theEnvironment) 351 if not(objectP(env)) then 352 353 if the runmode contains "aut" then 354 -- there is a really lame bug in the mac version 355 -- where querying the environment takes ages! 356 -- now it is only the first call, therefore we save the result 357 -- and in authoring we even save it in a global, so that we 358 -- do not have to wait on each moviestart! 359 global gLameAuthoringHack_forSlowEnvironment_onMac 360 if not(objectP(gLameAuthoringHack_forSlowEnvironment_onMac)) then 361 gLameAuthoringHack_forSlowEnvironment_onMac = the environment 362 end if 363 env = gLameAuthoringHack_forSlowEnvironment_onMac 364 else 365 env = the environment 366 end if 367 368 mSetGlobalValue(me, #theEnvironment, env) 369 end if 370 return env 316 371 end 317 372 … … 333 388 if voidP(gPlatform) then 334 389 335 isMac = the platform contains "Macintosh"336 if isMac then337 338 onX = value(char 1 of (the last word of ( the environment).osversion)) <= 5390 isMac = the platform contains "Macintosh" 391 if isMac then 392 393 onX = value(char 1 of (the last word of (mGetEnvironment(me)).osversion)) <= 5 339 394 if onX then gPlatform = #osx 340 395 else gPlatform = #os9 … … 480 535 end 481 536 537 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 538 on ____PROCESS_CALLBACK_EVENTS 539 end 540 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 541 542 on mDoCallBack me, callbackObject, p1, p2, p3 543 ----------------------------------- 544 -- CREATED: 22.07.2009 545 -- ACTION: This is the standard way to send callback events to callbackObjects of the format: 546 -- [#handler:symbol, #target:object] 547 -- NOTE: If the #handler property is NOT a symbol, then it is considered a special case 548 -- where the result will simply be "put" into the message window => suited for debugging 549 -- INPUT: <callbackObject> ; object (propertylist) ; required ; a callBack object of the format: 550 -- [#handler:symbol, #target:object], which can be any number of additional properties 551 -- since this object will be provided as parameter to the recipient 552 -- the recipient can access all these additional properties 553 -- <p1 - p3> ; arbitrary parameters ; just in case additional parameters are required, 554 -- which can not, for some reason, be stored in the object <callbackObject> itself 555 -- RETURNS: either a string or an integer. In case of 1 the callback was successfully called, otherwise 556 -- an errorstring is returned and the callback was NOT successfully called. 557 -- EXAMPLE: xscr().mDoCallBack(callBackObject) 558 ----------------------------------- 559 560 if not(objectP(callbackObject)) then return "Wrong paramater, callbackObject is not an object!" 561 562 hnd = callbackObject[#handler] 563 if not(symbolP(hnd)) then 564 put "Script 'commonMovieScript': Handler 'mDoCallBack':" 565 put "---------------------------" 566 put "callbackObject:" && callbackObject 567 put "------" 568 put "p1:" && p1 569 put "------" 570 put "p2:" && p2 571 put "------" 572 put "p3:" && p3 573 put "---------------------------" 574 return "callbackObject[#handler] is not a symbol" 575 end if 576 577 tgt = callbackObject[#target] 578 case ilk(tgt) of 579 #script, #instance: 580 call(hnd, [tgt], callbackObject, p1, p2, p3) 581 #list, #proplist: 582 if count(tgt) = 0 then 583 put "Script 'commonMovieScript': Handler 'mDoCallBack':" 584 put "---------------------------" 585 put "callbackObject:" && callbackObject 586 put "------" 587 put "p1:" && p1 588 put "------" 589 put "p2:" && p2 590 put "------" 591 put "p3:" && p3 592 put "---------------------------" 593 else 594 call(hnd, tgt, callbackObject, p1, p2, p3) 595 end if 596 597 otherwise: 598 spr = mGetKanal(me, tgt) 599 if spr < 1 then return "callbackObject[#target] is neither an object nor a spritenumber/name:" && callbackObject[#target] 600 sendSprite(spr, hnd, callbackObject, p1, p2, p3) 601 end case 602 603 return 1 604 end 482 605 483 606 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx … … 621 744 mDebugImage me, str, overwrite, dername 622 745 else 623 if overwrite = 64 then put str 746 if the runmode contains "aut" then 747 if overwrite = 64 then 748 put str 749 else 750 if debugFlags.getPos(1) then 751 put str 752 end if 753 end if 754 end if 624 755 end if 625 756 … … 634 765 if voidP(dername) then dername = "DebugImg" 635 766 636 if overwrite then767 if overwrite = 1 then 637 768 neuer = member(dername) 638 769 if mGetMemType(me, neuer) <> #bitmap then overwrite = 0 … … 655 786 f.name = "debuginfotextmember" 656 787 end if 788 789 if mGetVersionNumber(me) > 11 then 790 oldscrolltop = f.scrolltop 791 if oldscrolltop > f.height - f.pageheight - f.lineheight then 792 oldscrolltop = #unten 793 end if 794 end if 795 657 796 altertext = f.text 658 797 if the number of lines of altertext > 500 then put line 300 to 500 of altertext into field "debuginfotextmember" 659 798 put "------------------------"&RETURN&RETURN & str & return after field "debuginfotextmember" 799 800 if not voidP(oldscrolltop) then 801 if oldscrolltop = #unten then 802 f.scrolltop = f.height - f.pageheight + f.lineheight 803 else 804 f.scrolltop = oldscrolltop 805 end if 806 end if 660 807 end 661 808 … … 812 959 -- comment here to use a *real* global: 813 960 961 if not the runmode contains "aut" then return ["Arial"] -- just to be safe 962 -- this handler should not be called anymore in runtime 963 -- as mGetAFont() doesn't call it anymore 964 -- the lame reason is: 965 -- the new D11 player fucked up the unsupported function FontList() 966 -- :-( SHAME! 967 814 968 -- faked global: 815 969 globs = mGetGlobalList(me) … … 934 1088 -- if that fails also, takes the first installed font of the list of installed fonts 935 1089 on mGetAFont me, theFont 1090 1091 return theFont -- :-( the unsupported fontlist() method of font members now can crash the browser - tolle wurst! 1092 1093 936 1094 fontliste = InitFonts(me) 937 1095 if not (fontliste).getPos(theFont) then … … 1353 1511 gPowerList = theGlobs.getaprop(#gPowerList) 1354 1512 if ilk(gPowerList) <> #list then 1355 gPowerList = [2,4,8,16,32,64,128,256,512 ] --,1024]1513 gPowerList = [2,4,8,16,32,64,128,256,512,1024] 1356 1514 gPowerList.sort() 1357 1515 theGlobs[#gPowerList] = gPowerList … … 1367 1525 gPowerList = theGlobs.getaprop(#gPowerList) 1368 1526 if ilk(gPowerList) <> #list then 1369 gPowerList = [1,2,4,8,16,32,64,128,256,512 ] --,1024] -- mac openGL only does 5121527 gPowerList = [1,2,4,8,16,32,64,128,256,512,1024] -- mac openGL only does 512 1370 1528 gPowerList.sort() 1371 1529 theGlobs[#gPowerList] = gPowerList … … 1433 1591 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1434 1592 1435 1436 -- convert a relative path to an absolute path: 1593 on mConvertAbsolutePathToRelative me, aPath, newDelim, anAbsoluteBasedir 1594 1595 anAbsoluteBasedir = string(anAbsoluteBasedir) 1596 if length(anAbsoluteBasedir) < 1 then anAbsoluteBasedir = the moviepath 1597 if length(anAbsoluteBasedir) < 1 then return "" 1598 1599 delim = the last char of the moviepath 1600 if length(delim) < 1 then delim = the last char of the applicationpath 1601 1602 newDelim = string(newDelim) 1603 if length(newDelim) < 1 then newDelim = delim 1604 1605 offs = offset(anAbsoluteBasedir, aPath) 1606 if offs <> 1 then 1607 put "Script:commonMovieScript; Handler:mConvertAbsolutePathToRelative; The path:" &"E& aPath "E&& "is not inside the current path specified" &"E& anAbsoluteBasedir "E 1608 return "" 1609 end if 1610 delete char 1 to length(anAbsoluteBasedir) of aPath 1611 if delim = newDelim then return aPath 1612 1613 offs = offset(delim, aPath) 1614 repeat while offs > 0 1615 put newDelim into char offs of aPath 1616 offs = offset(delim, aPath) 1617 end repeat 1618 1619 return aPath 1620 end 1621 1622 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1623 1624 -- convert a relative path to an absolute path: (Sorry, the name of this handler couldn't be more stupid ;-) 1437 1625 on mGetRelativePath me, aPath, mp -- mp optional: default = the moviepath 1438 1626 … … 1461 1649 delim = the last char of the moviepath 1462 1650 if length(delim) < 1 then 1463 1464 1651 if the runmode contains "plug" then 1465 mp= ""1652 -- delim = "" 1466 1653 else 1467 1654 delim = the last char of the applicationpath 1468 1655 end if 1469 1470 1471 1656 if length(delim) < 1 then delim = "/" 1472 1657 end if … … 1708 1893 theGlobs = mGetGlobalList(me) 1709 1894 uebersetzungsListe = theGlobs.getaprop(#gUebersetzung) 1710 if ilk(uebersetzungsListe) <> #proplist then return aString 1895 if ilk(uebersetzungsListe) <> #proplist then return mReplacePlaceHoldersInString(me, aString, variablesList) 1896 1711 1897 uebersetzung = uebersetzungsListe.getaprop(aString) 1712 if voidP(uebersetzung) then 1713 if listP(variablesList) then return mReplacePlaceHoldersInString(me, aString, variablesList) 1714 return aString 1715 else 1898 if voidP(uebersetzung) then return mReplacePlaceHoldersInString(me, aString, variablesList) 1899 1716 1900 currLang = call(#mGetPrefValue, [mGetXScript(#GetSetPrefs)], #gLanguage) 1717 1901 if voidP(currLang) then … … 1722 1906 ind = currLang + 1 1723 1907 if ind > count(uebersetzung) then ind = 1 1724 return uebersetzung[ind]1725 end if1908 1909 return mReplacePlaceHoldersInString(me, uebersetzung[ind], variablesList) 1726 1910 end 1727 1911 … … 1729 1913 1730 1914 on mReplacePlaceHoldersInString me, aString, variablesList 1731 if ilk(variablesList) = #proplist then 1915 theIlk = ilk(variablesList) 1916 if theIlk = #proplist then 1732 1917 cnt = count(variablesList) 1733 1918 if cnt > 0 then … … 1744 1929 end repeat 1745 1930 end if 1746 else if ilk(variablesList)= #list then -- printf like replacement1931 else if theIlk = #list then -- printf like replacement 1747 1932 if count(variablesList) > 0 then 1748 1933 offs = offset("%s", aString) … … 1751 1936 put str into char offs to offs + 1 of aString 1752 1937 if count(variablesList) > 1 then variablesList.deleteAt(1) 1938 str = string(variablesList[1]) 1753 1939 offs = offset("%s", aString) 1754 1940 end repeat … … 1988 2174 end if 1989 2175 1990 -- pUPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZZ çË"&vA& "Ìéæèêíëìîñï1991 ÍòôÛ®¯ÎÙ"1992 -- pLowercase = "abcdefghijklmnopqrstuvwxyz "&""&"Ÿ¿ÏØ"1993 pCaseLists.setaprop(#uppercase, ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", " ç", "Ë", vA, "A", "", "Ì", "", "", "", "é", "æ", "è", "ê", "í", "ë", "ì", "", "î", "ñ", "ï", "1994 ", " Í", "ò", "ô", "U", "", "®", "¯", "Î", "Ù"])1995 pCaseLists.setaprop(#lowercase, ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", " ", "", vA, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Ÿ", "¿", "Ï", "Ø"])2176 -- pUPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZZÃÃ"&vA& "ÃÃà 2177 ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃâ¬ÃÃÃÅÅž" 2178 -- pLowercase = "abcdefghijklmnopqrstuvwxyzáà "&"â"&"ÀãåçéÚêëÃìîïñóòÎöõúùûÌÊÞÅÿ" 2179 pCaseLists.setaprop(#uppercase, ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "Ã", "Ã", vA, "A", "Ã", "Ã", "à 2180 ", "Ã", "Ã", "Ã", "Ã", "Ã", "Ã", "Ã", "Ã", "Ã", "Ã", "Ã", "Ã", "Ã", "Ã", "Ã", "Ã", "Ã", "U", "Ã", "Ã", "Ã", "Å", "Åž"]) 2181 pCaseLists.setaprop(#lowercase, ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "á", "à ", vA, "â", "À", "ã", "Ã¥", "ç", "é", "Ú", "ê", "ë", "Ã", "ì", "î", "ï", "ñ", "ó", "ò", "ÃŽ", "ö", "õ", "ú", "ù", "û", "ÃŒ", "Ê", "Þ", "Å", "ÿ"]) 1996 2182 1997 2183 end … … 2011 2197 li = ["Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag","Sonntag"] 2012 2198 "pt": 2013 li = ["Segunda-feira","Ter a-feira","Quarta-feira","Quinta-feira","Sexta-feira","Sbado","Domingo"]2199 li = ["Segunda-feira","Terça-feira","Quarta-feira","Quinta-feira","Sexta-feira","Sábado","Domingo"] 2014 2200 "fr": 2015 2201 li = ["Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi","Dimanche"] 2016 2202 "es": 2017 li = ["Lunes","Martes","Mi rcoles","Jueves","Viernes","Sbado","Domingo"]2203 li = ["Lunes","Martes","Miércoles","Jueves","Viernes","Sábado","Domingo"] 2018 2204 "it": 2019 li = ["Luned ","Marted","Mercoled","Gioved","Venerd","Sabato","Domenica"]2205 li = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato","Domenica"] 2020 2206 "nl": 2021 2207 li = ["Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag","Zondag"]
Note: See TracChangeset
for help on using the changeset viewer.
