Changeset 241 for trunk/lingosource/castlib2
- Timestamp:
- 12/18/09 15:27:43 (2 years ago)
- Location:
- trunk/lingosource/castlib2
- Files:
-
- 5 edited
-
FileIOFunktionen.ls (modified) (8 diffs)
-
GetSetPrefs.ls (modified) (3 diffs)
-
PseudoXMLPS.ls (modified) (12 diffs)
-
aleXtrasMovieScript.ls (modified) (5 diffs)
-
commonMovieScript.ls (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lingosource/castlib2/FileIOFunktionen.ls
r186 r241 7 7 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 8 8 9 on mGetTextFromFile me, pfad 9 on mGetTextFromFile me, pfad, readByteArray, useCharSet 10 10 retval = "" 11 12 11 if the runmode contains "Plugin" then return retval 13 12 14 13 fio = new(xtra "fileio") 15 16 14 if not objectP(fio) then return retval 15 16 useCharSet = string(useCharSet) 17 if length(useCharSet) > 0 then 18 if xscr().mGetVersionNumber() > 11.4 then 19 ------------- don't need to check whether the given charset is supported 20 ------------- as it is simply ignored, if it isn't 21 ------------- and it also gets reset so that the next instance of fileio 22 ------------- uses the default utf-8 again 23 -- installedCharSets = _system.getInstalledCharSets() 24 -- if installedCharSets.getPos(useCharSet) > 0 then fio.setCharSet(useCharSet) 25 fio.setCharSet(useCharSet) 26 end if 27 end if 17 28 18 29 if (voidP(pfad) or (pfad = "")) then pfad = mGetFilePathFromUser(me) … … 20 31 if ilk(pfad) = #string then 21 32 if pfad.length > 0 then 22 23 33 fio.openFile(pfad, 1) 24 34 if fio.status() = 0 then 25 26 retval = fio.readFile()35 if readByteArray = 1 then retval = fio.readByteArray(fio.getlength()) 36 else retval = fio.readFile() 27 37 fio.closeFile() 28 38 end if … … 33 43 end 34 44 45 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 46 47 on mGetByteArrayFromFile me, thePath 48 return mGetTextFromFile(me, thePath, (xscr().mGetVersionNumber() > 11.49)) 49 end 35 50 36 51 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx … … 44 59 -- paramList[#target] = instance 45 60 -- -- optional: 46 -- params[#theTimeOut] = 4000 -- milliseconds until operation times out 47 -- params[#progressHandler] = #progresscallbackFromGetText -- event sent whenever the percent done changes 61 -- paramList[#theTimeOut] = 4000 -- milliseconds until operation times out 62 -- paramList[#progressHandler] = #progresscallbackFromGetText -- event sent whenever the percent done changes 63 -- paramList[#isByteArray] = 0 -- boolean value, only D11 64 -- paramList[#charset] = "windows-1252" -- string, only D11 48 65 -- -- paramList[#customdata] = "whatever you need" 66 -- xscr(#FileIOFunktionen).mGetTextFromFileAsync(paramList) 67 49 68 -- 50 69 --on callbackFromGetText me, paramList … … 63 82 if not(internetLink) then internetLink = (fname starts "www.") 64 83 if the runmode contains "plugin" or internetLink then 65 -- scr = xscr().mGetInstance("NetLingoManagerPS__") 84 85 -- scr = xscr().mGetInstance("NetLingoManagerPS") 66 86 -- if ilk(scr) = #instance then 67 87 -- scr.mStartNetOP(paramList) … … 77 97 -- end if 78 98 else 79 paramList.setaprop(#theTextResult, mGetTextFromFile(me, paramList.getaprop(#theURL) ))99 paramList.setaprop(#theTextResult, mGetTextFromFile(me, paramList.getaprop(#theURL), paramList[#isByteArray], paramList[#charset])) 80 100 call(paramList.getaprop(#handler), [paramList.getaprop(#target)], paramList) 81 101 end if … … 83 103 84 104 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 105 106 on mGetByteArrayFromFileAsync me, paramList 107 paramList[#isByteArray] = 1 108 mGetTextFromFileAsync me, paramList 109 end 110 111 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 85 112 -- xxxxxxxxxxxxxxxxxx Write text out to a file 86 113 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 87 114 88 on mSaveToTextFile me, theText, pfad, theTitle, theDefaultName, startfolder 115 on mSaveToTextFile me, theText, pfad, theTitle, theDefaultName, startfolder, useCharSet 89 116 retval = 0 90 117 … … 98 125 fio = new(xtra "fileio") 99 126 if not objectP(fio) then return retval 127 128 useCharSet = string(useCharSet) 129 if length(useCharSet) > 0 then 130 if xscr().mGetVersionNumber() > 11.4 then 131 ------------- don't need to check whether the given charset is supported 132 ------------- as it is simply ignored, if it isn't 133 ------------- and it also gets reset so that the next instance of fileio 134 ------------- uses the default utf-8 again 135 -- installedCharSets = _system.getInstalledCharSets() 136 -- if installedCharSets.getPos(useCharSet) > 0 then fio.setCharSet(useCharSet) 137 fio.setCharSet(useCharSet) 138 end if 139 end if 140 100 141 101 142 if ilk(theTitle) <> #string then theTitle = "Save File" -
trunk/lingosource/castlib2/GetSetPrefs.ls
r228 r241 184 184 else 185 185 olddelim = the itemdelimiter 186 the itemdelimiter = " À"186 the itemdelimiter = "¿" 187 187 188 188 anz = prefsText.line.count … … 335 335 repeat with n = 1 to anz 336 336 337 if objectP(prefliste) then prefStr = string(prefliste.getPropAt(n))&" À"337 if objectP(prefliste) then prefStr = string(prefliste.getPropAt(n))&"¿" 338 338 339 339 dieserWert = prefliste[n] … … 342 342 343 343 repeat with m = 1 to count(dieserWert) 344 put dieserWert[m]&" À" after prefStr344 put dieserWert[m]&"¿" after prefStr 345 345 end repeat 346 346 347 347 else 348 put prefliste[n]&" À" after prefStr348 put prefliste[n]&"¿" after prefStr 349 349 end if 350 350 -
trunk/lingosource/castlib2/PseudoXMLPS.ls
r228 r241 77 77 ----------------------------------- 78 78 79 80 79 on _____________________PROPERTY_DECLARATION me 80 end 81 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 82 property pXMLParserXtra 83 property pXmlxtraversion, pVersionNumber 84 85 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 81 86 on ___________PUBLIC_EVENTS me 82 87 end … … 87 92 end 88 93 94 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 95 96 on mDestroy me 97 pXMLParserXtra = void 98 end 99 100 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 89 101 90 102 … … 174 186 175 187 if not(string(docName).length) then docName = "Untitled" 188 if not("abcdefghijklmnopqrstuvwxyz_" contains char 1 of docname) then put "a" before docname 176 189 put "<" & docName & ">" & RETURN after str 177 190 … … 238 251 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 239 252 240 241 property pXmlxtraversion242 253 243 254 on mGetListFromXMLStringX me, str, convertValues, withParams … … 318 329 end if 319 330 320 xt= new(xtra "XmlParser")321 xt.parseString(str)322 323 if not(voidP( xt.getError())) then324 put "Script: PseudoXMLPS; Handler: mGetListFromXMLStringX; error:" && xt.getError()331 if not(objectP(pXMLParserXtra)) then pXMLParserXtra = new(xtra "XmlParser") 332 pXMLParserXtra.parseString(str) 333 334 if not(voidP(pXMLParserXtra.getError())) then 335 put "Script: PseudoXMLPS; Handler: mGetListFromXMLStringX; error:" && pXMLParserXtra.getError() 325 336 return mGetListFromXMLString(me, str, convertValues, withParams) 326 337 end if 327 338 328 xx = xt.makePropList()339 xx = pXMLParserXtra.makePropList() 329 340 dontEscapeSpecialChars = 1 -- we do not need to do this, as the xmlparser xtra already did it for us 330 341 li = mConvertXMLPropList(me, [xx], convertValues, dontEscapeSpecialChars) … … 351 362 ----------------------------------- 352 363 353 dertext = xscr(#FileIOFunktionen).mGetTextFromFile(thePath )364 dertext = xscr(#FileIOFunktionen).mGetTextFromFile(thePath, void, "windows-1252") 354 365 if length(dertext) > 0 then return mGetListFromXMLStringX(me, dertext) 355 366 return [:] … … 800 811 v2 = value(val) 801 812 802 if ilk(v2) = #vectorthen return v2813 if [#vector, #rect, #point, #float].getPos(ilk(v2)) then return v2 803 814 804 815 if abs(length(string(v2)) - length(val)) > 1 then return void -- in case of symbols the # gets stripped, when we use the string() function … … 1295 1306 end if 1296 1307 1297 alreadyProcessed = [] 1308 if getVersionNumber(me) > 10.99 then 1309 -- director 11 will have unicode numbers for the chars 1310 indFrom = 3 1311 end if 1312 1298 1313 1299 1314 newStr = str … … 1301 1316 tstr = str 1302 1317 vers = 0 1303 rmac= numToChar(repl[indFrom])1304 r win= numToChar(repl[indTo])1305 offs = offset( rmac, tstr)1318 searchChar = numToChar(repl[indFrom]) 1319 replaceChar = numToChar(repl[indTo]) 1320 offs = offset(searchChar, tstr) 1306 1321 repeat while offs > 0 1307 1322 ctn = charToNum(char offs of tstr) 1308 1323 delete char 1 to offs of tstr 1309 1324 vers = vers + offs 1310 if ctn = repl[ 1] then1311 put r wininto char vers of newStr1325 if ctn = repl[indFrom] then 1326 put replaceChar into char vers of newStr 1312 1327 end if 1313 offs = offset( rmac, tstr)1328 offs = offset(searchChar, tstr) 1314 1329 end repeat 1315 1330 end repeat … … 1323 1338 end repeat 1324 1339 1325 1326 1340 return newStr 1327 1341 end … … 1354 1368 fromStr = "" 1355 1369 toStr = "" 1370 1371 if getVersionNumber(me) > 10.99 then 1372 -- director 11 will have unicode numbers for the chars 1373 fromIndex = 3 1374 else 1375 fromIndex = 1 1376 end if 1377 1356 1378 repeat with repl in replLi 1357 put numToChar(repl[ 1]) after fromStr1379 put numToChar(repl[fromIndex]) after fromStr 1358 1380 put numToChar(repl[2]) after toStr 1359 1381 end repeat … … 1367 1389 on mGetCharMapList me 1368 1390 li = [] 1369 li.add([128, 196 ])1370 li.add([129, 197 ])1371 li.add([130, 199 ])1372 li.add([131, 201 ])1373 li.add([132, 209 ])1374 li.add([133, 214 ])1375 li.add([134, 220 ])1376 li.add([135, 225 ])1377 li.add([136, 224 ])1378 li.add([137, 226 ])1379 li.add([138, 228 ])1380 li.add([139, 227 ])1381 li.add([140, 229 ])1382 li.add([141, 231 ])1383 li.add([142, 233 ])1384 li.add([143, 232 ])1385 li.add([144, 234 ])1386 li.add([145, 235 ])1387 li.add([146, 237 ])1388 li.add([147, 236 ])1389 li.add([148, 238 ])1390 li.add([149, 239 ])1391 li.add([150, 241 ])1392 li.add([151, 243 ])1393 li.add([152, 242 ])1394 li.add([153, 244 ])1395 li.add([154, 246 ])1396 li.add([155, 245 ])1397 li.add([156, 250 ])1398 li.add([157, 249 ])1399 li.add([158, 251 ])1400 li.add([159, 252 ])1401 li.add([160, 134 ])1402 li.add([161, 176 ])1403 li.add([164, 167 ])1404 li.add([165, 149 ])1405 li.add([166, 182 ])1406 li.add([167, 223 ])1407 li.add([168, 174 ])1408 li.add([170, 153 ])1409 li.add([171, 180 ])1410 li.add([172, 168 ])1411 li.add([173, 141 ])1412 li.add([174, 198 ])1413 li.add([175, 216 ])1414 li.add([176, 144 ])1415 li.add([178, 143 ])1416 li.add([179, 142 ])1417 li.add([180, 165 ])1418 li.add([182, 240 ])1419 li.add([183, 221 ])1420 li.add([184, 222 ])1421 li.add([185, 254 ])1422 li.add([186, 138 ])1423 li.add([187, 170 ])1424 li.add([188, 186 ])1425 li.add([189, 253 ])1426 li.add([190, 230 ])1427 li.add([191, 248 ])1428 li.add([192, 191 ])1429 li.add([193, 161 ])1430 li.add([194, 172 ])1431 li.add([195, 175 ])1432 li.add([196, 131 ])1433 li.add([197, 188 ])1434 li.add([198, 208 ])1435 li.add([199, 171 ])1436 li.add([200, 187 ])1437 li.add([201, 133 ])1438 li.add([202, 160 ])1439 li.add([203, 192 ])1440 li.add([204, 195 ])1441 li.add([205, 213 ])1442 li.add([206, 140 ])1443 li.add([207, 156 ])1444 li.add([208, 173 ])1445 li.add([209, 151 ])1446 li.add([210, 147 ])1447 li.add([211, 148 ])1448 li.add([212, 145 ])1449 li.add([213, 146 ])1450 li.add([214, 247 ])1451 li.add([216, 255 ])1452 li.add([217, 159 ])1453 li.add([218, 158 ])1454 li.add([219, 128 ])1455 li.add([220, 139 ])1456 li.add([221, 155 ])1457 li.add([222, 128 ])1458 li.add([223, 129 ])1459 li.add([224, 135 ])1460 li.add([225, 183 ])1461 li.add([226, 130 ])1462 li.add([227, 132 ])1463 li.add([228, 137 ])1464 li.add([229, 194 ])1465 li.add([230, 202 ])1466 li.add([231, 193 ])1467 li.add([232, 203 ])1468 li.add([233, 200 ])1469 li.add([234, 205 ])1470 li.add([235, 206 ])1471 li.add([236, 207 ])1472 li.add([237, 204 ])1473 li.add([238, 211 ])1474 li.add([239, 212 ])1475 li.add([240, 157 ])1476 li.add([241, 210 ])1477 li.add([242, 218 ])1478 li.add([243, 219 ])1479 li.add([244, 217 ])1480 li.add([245, 166 ])1481 li.add([246, 136 ])1482 li.add([247, 152 ])1483 li.add([248, 150 ])1484 li.add([249, 154 ])1485 li.add([250, 178 ])1486 li.add([251, 190 ])1487 li.add([252, 184 ])1488 li.add([253, 189 ])1489 li.add([254, 179 ])1490 li.add([255, 185 ])1391 li.add([128, 196, 402]) 1392 li.add([129, 197, 8776]) 1393 li.add([130, 199, 171]) 1394 li.add([131, 201, 8230]) 1395 li.add([132, 209, 8212]) 1396 li.add([133, 214, 247]) 1397 li.add([134, 220, 8249]) 1398 li.add([135, 225, 183]) 1399 li.add([136, 224, 8225]) 1400 li.add([137, 226, 8218]) 1401 li.add([138, 228, 8240]) 1402 li.add([139, 227, 8222]) 1403 li.add([140, 229, 194]) 1404 li.add([141, 231, 193]) 1405 li.add([142, 233, 200]) 1406 li.add([143, 232, 203]) 1407 li.add([144, 234, 205]) 1408 li.add([145, 235, 206]) 1409 li.add([146, 237, 204]) 1410 li.add([147, 236, 207]) 1411 li.add([148, 238, 211]) 1412 li.add([149, 239, 212]) 1413 li.add([150, 241, 210]) 1414 li.add([151, 243, 219]) 1415 li.add([152, 242, 218]) 1416 li.add([153, 244, 217]) 1417 li.add([154, 246, 710]) 1418 li.add([155, 245, 305]) 1419 li.add([156, 250, 729]) 1420 li.add([157, 249, 728]) 1421 li.add([158, 251, 730]) 1422 li.add([159, 252, 184]) 1423 li.add([160, 134, 220]) 1424 li.add([161, 176, 8734]) 1425 li.add([164, 167, 223]) 1426 li.add([165, 149, 239]) 1427 li.add([166, 182, 8706]) 1428 li.add([167, 223, 64258]) 1429 li.add([168, 174, 198]) 1430 li.add([170, 153, 244]) 1431 li.add([171, 180, 165]) 1432 li.add([172, 168, 174]) 1433 li.add([173, 141, 231]) 1434 li.add([174, 198, 8710]) 1435 li.add([175, 216, 255]) 1436 li.add([176, 144, 234]) 1437 li.add([178, 143, 232]) 1438 li.add([179, 142, 233]) 1439 li.add([180, 165, 8226]) 1440 li.add([182, 240, 63743]) 1441 li.add([183, 221, 8250]) 1442 li.add([184, 222, 64257]) 1443 li.add([185, 254, 731]) 1444 li.add([186, 138, 228]) 1445 li.add([187, 170, 8482]) 1446 li.add([188, 186, 8747]) 1447 li.add([189, 253, 733]) 1448 li.add([190, 230, 202]) 1449 li.add([191, 248, 175]) 1450 li.add([192, 191, 248]) 1451 li.add([193, 161, 176]) 1452 li.add([194, 172, 168]) 1453 li.add([195, 175, 216]) 1454 li.add([196, 131, 201]) 1455 li.add([197, 188, 186]) 1456 li.add([198, 208, 8211]) 1457 li.add([199, 171, 180]) 1458 li.add([200, 187, 170]) 1459 li.add([201, 133, 214]) 1460 li.add([202, 160, 8224]) 1461 li.add([203, 192, 191]) 1462 li.add([204, 195, 8730]) 1463 li.add([205, 213, 8217]) 1464 li.add([206, 140, 229]) 1465 li.add([207, 156, 250]) 1466 li.add([208, 173, 8800]) 1467 li.add([209, 151, 243]) 1468 li.add([210, 147, 236]) 1469 li.add([211, 148, 238]) 1470 li.add([212, 145, 235]) 1471 li.add([213, 146, 237]) 1472 li.add([214, 247, 732]) 1473 li.add([216, 255, 711]) 1474 li.add([217, 159, 252]) 1475 li.add([218, 158, 251]) 1476 li.add([219, 128, 196]) 1477 li.add([220, 139, 227]) 1478 li.add([221, 155, 245]) 1479 li.add([222, 128, 196]) 1480 li.add([223, 129, 197]) 1481 li.add([224, 135, 225]) 1482 li.add([225, 183, 8721]) 1483 li.add([226, 130, 199]) 1484 li.add([227, 132, 209]) 1485 li.add([228, 137, 226]) 1486 li.add([229, 194, 172]) 1487 li.add([230, 202, 160]) 1488 li.add([231, 193, 161]) 1489 li.add([232, 203, 192]) 1490 li.add([233, 200, 187]) 1491 li.add([234, 205, 213]) 1492 li.add([235, 206, 338]) 1493 li.add([236, 207, 339]) 1494 li.add([237, 204, 195]) 1495 li.add([238, 211, 8221]) 1496 li.add([239, 212, 8216]) 1497 li.add([240, 157, 249]) 1498 li.add([241, 210, 8220]) 1499 li.add([242, 218, 8260]) 1500 li.add([243, 219, 8364]) 1501 li.add([244, 217, 376]) 1502 li.add([245, 166, 182]) 1503 li.add([246, 136, 224]) 1504 li.add([247, 152, 242]) 1505 li.add([248, 150, 241]) 1506 li.add([249, 154, 246]) 1507 li.add([250, 178, 8804]) 1508 li.add([251, 190, 230]) 1509 li.add([252, 184, 8719]) 1510 li.add([253, 189, 937]) 1511 li.add([254, 179, 8805]) 1512 li.add([255, 185, 960]) 1491 1513 return li 1492 1514 end 1515 1516 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1517 1518 on getVersionNumber me 1519 if voidP(pVersionNumber) then 1520 pVersionNumber = getFloatVersionNumber(me, the productVersion) 1521 end if 1522 return pVersionNumber 1523 end 1524 1525 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1526 1527 on getFloatVersionNumber me, prodVers 1528 offs = offset(".", prodVers) 1529 if offs > 0 then 1530 intVers = char 1 to offs of prodVers 1531 delete char 1 to offs of prodVers 1532 else 1533 intVers = "" 1534 end if 1535 cnt = length(prodVers) 1536 repeat with n = 1 to cnt 1537 c = prodVers.char[n] 1538 if integerP(integer(c)) then 1539 put c after intVers 1540 else if c <> "." then 1541 exit repeat 1542 end if 1543 end repeat 1544 return value(intVers) 1545 end -
trunk/lingosource/castlib2/aleXtrasMovieScript.ls
r228 r241 2 2 --------------------------------------------------------------------- 3 3 -- CREATED: 4 -- 20054 -- 2005 5 5 -- 6 6 -- PROPERTIES: … … 158 158 -- TODO: - 159 159 ----------------------------------- 160 160 161 exit 161 162 162 163 mediaList = mGetAleXtras() 164 165 theScripts = mediaList.getaprop(#scripts) 166 if ilk(theScripts) <> #proplist then 167 theScripts = [:] 168 mediaList.setaprop(#scripts, theScripts) 169 end if 170 171 if voidP(cls) then 172 cls = [] 173 cl = the number of castlibs 174 repeat with n = 1 to cl 175 cls.add(n) 176 end repeat 177 end if 178 179 if not listP(cls) then 180 cls = [cls] 181 end if 182 183 cl = count(cls) 184 repeat with n = 1 to cl 185 thisCL = castlib(cls[n]) 186 if not voidP(thisCL) then 187 clnum = thisCL.number 188 num = the number of members of castlib clnum 189 repeat with m = 1 to num 190 mem = member(m,clnum) 191 if length(mem.name) > 0 then 192 if mem.type = #script then 193 theScripts.setaProp(symbol(mem.name), mem.script) 194 end if 195 end if 196 end repeat 197 end if 198 end repeat 199 200 end 201 202 203 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 204 205 on mLoadXScript whichName 206 207 exit 208 209 210 whichName = string(whichName) 211 if length(whichName) < 1 then return 0 212 scr = member(whichName) 213 if ilk(scr) <> #member then return 0 214 if scr.type <> #script then return 0 215 216 scr = script(whichName) 217 218 mediaList = mGetAleXtras() 219 220 theScripts = mediaList.getaprop(#scripts) 221 if ilk(theScripts) <> #proplist then 222 theScripts = [:] 223 mediaList.setaprop(#scripts, theScripts) 224 end if 225 theScripts.setaProp(symbol(whichName), scr) 226 227 return scr 163 -- deprecated handler 164 -- only here for bakcward compatibility 165 -- the system is now built to load scripts only on demand 166 -- exception is mLoadScriptsFromLDM() which needs to grab all scripts 167 -- from the ldm and uses them. 168 -- be aware of the fact, that rawnew() is used on these scripts, so the ones of the LDM 169 -- won't have their new() handler called. I take care about that for you, though... 170 171 end 172 173 174 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 175 176 on mLoadXScript whichName, dontCallDestroyHandler 177 -- overload a script, e.g. after changing at during the movie runs 178 179 if not(symbolP(whichName)) then whichName = symbol(whichName) 180 if voidP(dontCallDestroyHandler) then dontCallDestroyHandler = 1 181 xscr().mDeleteInstance(whichName, dontCallDestroyHandler) 182 183 return xscr(whichName) 228 184 229 185 end … … 233 189 on mLoadScriptsFromLDM whichSprite 234 190 235 includes = [:]191 includes = [:] 236 192 237 193 tell sprite(whichSprite) … … 280 236 281 237 exit 282 ------------------------------ 238 ------------------------------ deprecated: 283 239 284 240 mediaList = mGetAleXtras() … … 317 273 318 274 on mListAleXtras 319 put "Handler mListAleXtras deprecated" 275 276 put "This handler used to put the alextras scripts only, now it puts all singletons instead" 277 278 globs = xscr().mGetGlobalList() 279 incl = globs[#gParentScriptInstances] 280 if not(objectP(incl)) then 281 put "No scriptinstances stored" 320 282 exit 321 322 alextras = (script "aleXtrasMovieScript").pAleXtras 323 if voidP(alextras) then mLoadScripts 324 scripts = (mGetAleXtras()).getaprop(#scripts) 325 anz = count(scripts) 283 end if 284 285 anz = count(incl) 326 286 repeat with n = 1 to anz 327 put RETURN & "scr = mGetXScript(#"& scripts.getPropAt(n)&")" & RETURN287 put RETURN & "scr = mGetXScript(#"&incl.getPropAt(n)&")" & RETURN 328 288 end repeat 329 289 put RETURN & "put scr.handlers()" & RETURN 330 put RETURN & "put scr.interface()" & RETURN290 put RETURN & "put call(#interface, [scr])" & RETURN 331 291 end 332 292 -
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.
