Farbflash projects: Imaging lingo table | 3-D scene list | Find all | Handler menu | Lingo message window

Changeset 186 for trunk


Ignore:
Timestamp:
09/17/08 20:50:38 (3 years ago)
Author:
alex
Message:

incorporated changes to library scripts

Location:
trunk/lingosource
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/lingosource/castlib1/subversion_version_field.txt

    r184 r186  
    1 r186 
     1r188 
  • trunk/lingosource/castlib2/FileIOFunktionen.ls

    r163 r186  
    1 -- FileIO Handlers -- ©03 Alex da Franca -- alex@farbflash.de 
     1-- FileIO Handlers -- c03 Alex da Franca -- alex@farbflash.de 
    22--------------------------------------------------------------------- 
    33 
     
    460460      this = getnthfilenameinfolder(folderpath, n) 
    461461    end repeat 
     462  end if 
     463   
     464  return retval 
     465   
     466end 
     467 
     468 
     469-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     470 
     471on mGetFileAndFolderList me, folderpath 
     472  if the runmode contains "plugin" then return [] 
     473   
     474  if length(string(folderpath)) < 1 then folderpath = mGetFolderPathFromUser(me) 
     475  if length(folderpath) < 1 then return [] 
     476   
     477  if xscr().mCheckForXtra("BudAPI") then -- if buddy is present... 
     478    --  -- budApi version: 
     479    retval = baFolderList(folderpath) 
     480    filelist = baFileList(folderpath, "*.*") 
     481    repeat with f in filelist 
     482      retval.add(f) 
     483    end repeat 
     484     
     485  else if xscr().mCheckForXtra("FileXtra4") then -- if not buddy then try filextra 
     486    --  -- filextra4 version: 
     487    fx = (xtra "filextra4").new() 
     488    if objectP(fx) then 
     489      retval = fx.fx_FolderToList(folderpath) 
     490    end if 
     491    fx = 0 
     492     
     493  else 
     494     
     495    retval = [] 
     496    n = 1 
     497    this = getnthfilenameinfolder(folderpath, n) 
     498    repeat while length(this) > 0 
     499      retval.add(this) 
     500      n = n + 1 
     501      this = getnthfilenameinfolder(folderpath, n) 
     502    end repeat 
     503     
    462504  end if 
    463505   
     
    614656 
    615657on interface me 
    616   str = "FileIO Scripts  by alex da franca ©2003 -- alex@farbflash.de -- all rigths reserved" 
     658  str = "FileIO Scripts  by alex da franca c2003 -- alex@farbflash.de -- all rigths reserved" 
    617659   
    618660  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
  • trunk/lingosource/castlib2/GetSetPrefs.ls

    r178 r186  
    1212 
    1313on interface me 
    14   str = "Handle preferences  by alex da franca ©2003 -- alex@farbflash.de -- all rigths reserved" 
     14  str = "Handle preferences  by alex da franca c2003 -- alex@farbflash.de -- all rigths reserved" 
    1515   
    1616  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
  • trunk/lingosource/castlib2/PseudoXMLPS.ls

    r163 r186  
    55-- 
    66-- DESCRIPTION: 
    7 -- Pseudo XML by Alex da Franca ©2003 
     7--              Pseudo XML by Alex da Franca c2003 
    88-- Convert a lingo list to a XML like string and back 
    99 
     
    7777 
    7878on interface me 
    79   str = "Pseudo XML Script  by alex da franca ©2003 -- alex@farbflash.de -- all rigths reserved" 
     79  str = "Pseudo XML Script  by alex da franca c2003 -- alex@farbflash.de -- all rigths reserved" 
    8080  put RETURN & "version 1" after str 
    8181   
  • trunk/lingosource/castlib2/aleXtrasMovieScript.ls

    r182 r186  
    1 -- LDM Xtras Moviescript -- ©05 Alex da Franca -- alex@farbflash.de 
     1-- aleXtrasMovieScript 
    22--------------------------------------------------------------------- 
    33-- CREATED: 
    44--              2005 
    55-- 
     6-- PROPERTIES: 
     7--!memberProperties: [#name: "aleXtrasMovieScript", #scripttype: #movie, #scriptSyntax: #lingo, #comments:"~/Documents/Scripts/lingo/aleXtrasMovieScript.ls"] 
     8-- 
    69-- DESCRIPTION: 
     10--             -- LDM Xtras Moviescript -- c05 Alex da Franca -- alex@farbflash.de 
    711-- store instances of scripts and bitmaps in a 'global' list (-> property pAleXtras) 
    812-- and provide access to them for all scripts 
    913-- 
    1014-- REQUIRES: 
    11 --              NONE 
     15--            script "commonmoviescript" 
    1216-- 
    1317-- USAGE: 
    14 -- put it in one of your castlib, DON'T RENAME MEMBER !! 
     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-- - 
    1530-- 
    1631-- TODO: 
     
    2439  alextras = (script "aleXtrasMovieScript").pAleXtras 
    2540  if not(objectP(alextras)) then 
    26     alextras = new(script "commonMovieScript") 
     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) 
    2752    if ilk(alextras) <> #instance then 
    28       alert "HandlerMenu: Script" & QUOTE & "commonMovieScript" & QUOTE && "is missing. This movie can't proceed!" 
     53      alert "Script" & QUOTE & "commonMovieScript" & QUOTE && "is missing. This movie can't proceed!" 
    2954      halt 
    3055    end if 
     
    79104  if ilk(inst) <> #instance then 
    80105    if the runmode contains "aut" then 
    81       put "HandlerMenu: Script" && QUOTE & scrName & QUOTE && "is missing! This may cause unwanted behavior" 
     106      put "Script" && QUOTE & scrName & QUOTE && "is missing! This may cause unwanted behavior" 
    82107    end if 
    83108      inst = [] 
     
    200225on mLoadScriptsFromLDM whichSprite 
    201226   
    202   cms = xscr() 
    203   globs = cms.mGetGlobalList() 
    204   includes = globs[#gParentScriptInstances] 
    205   if not(objectP(includes)) then 
    206227    includes = [:] 
    207     globs[#gParentScriptInstances] = includes 
    208   end if 
    209228   
    210229  tell sprite(whichSprite) 
     
    216235        if length(mem.name) > 0 then 
    217236          if mem.type = #script then 
    218             includes.setaProp(mem.name, mem.script) 
     237            includes.setaProp(symbol(mem.name), rawNew(mem.script)) 
    219238          end if 
    220239        end if 
     
    222241    end repeat 
    223242  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 
    224272   
    225273  exit 
     
    287335      memref = member(m, cl) 
    288336      if memref.type = #script then 
    289         put "Membername:" && memref.name & TAB & "(" & line 1 of memref.comments & ")" & Return after str 
     337        put "Membername:" && memref.name & TAB & "("&memref.comments&")" & Return after str 
    290338      end if 
    291339    end repeat 
     
    335383      if memref.type = #script then 
    336384        memname = memref.name 
    337         comm = line 1 of memref.comments 
     385        comm = memref.comments 
    338386        if comm.length then 
    339387           
  • trunk/lingosource/castlib2/commonMovieScript.ls

    r184 r186  
    11-- commonMovieScript 
    2 -- was anderes 
    32----------------------------------- 
    43-- CREATED: 
     
    65-- 
    76-- DESCRIPTION:       
    8 --              Shared Global Handlers ©03 Alex da Franca -- alex@farbflash.de 
     7--              Shared Global Handlers c03 Alex da Franca -- alex@farbflash.de 
    98--              ------------------------------------------------------------------- 
    10 --              these handlers are shared between all of my scripts Alex da Franca ©2003 alex@farbflash.de 
     9--              these handlers are shared between all of my scripts Alex da Franca c2003 alex@farbflash.de 
    1110--              for private use of my scripts -> poor documentation -> use at own risk ;-) 
    1211 
     
    12031202on mGetInstance me, instName, useRawNew 
    12041203   
     1204  if ilk(instName) = #string then instName = symbol(instName) 
     1205   
    12051206  theGlobs = mGetGlobalList(me) 
    12061207  gParentScriptInstances = theGlobs.getaprop(#gParentScriptInstances) 
     
    12141215  if ilk(saveScr) = #instance then return saveScr 
    12151216   
    1216   if mGetMemType(me, member(instName)) = #script then 
    1217     if useRawNew = 1 then saveScr = rawnew(script instName) 
    1218     else saveScr = new(script instName) 
     1217  if mGetMemType(me, member(string(instName))) = #script then 
     1218    if useRawNew = 1 then saveScr = rawnew(script string(instName)) 
     1219    else saveScr = new(script string(instName)) 
    12191220    gParentScriptInstances.setaprop(instName, saveScr) 
    12201221    return saveScr 
     
    12231224  if saveScr = -1 then return 0 
    12241225  gParentScriptInstances.setaprop(instName, -1) 
    1225   inst = mGetXScript(symbol(instName)) 
     1226  inst = mGetXScript(instName) 
    12261227  if not(listP(inst)) then 
    12271228    if ilk(inst) = #instance then inst = inst.script 
     
    12551256 
    12561257-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    1257 -- xxxxxxxxxxxxxxxxxx reload a stored script instance: 
    1258  
    1259 on mReloadInstance me, instName 
     1258-- xxxxxxxxxxxxxxxxxx delete a stored script instance: 
     1259 
     1260on mDeleteInstance me, instName, dontCallDestroyHandler 
    12601261  theGlobs = mGetGlobalList(me) 
    12611262  gParentScriptInstances = theGlobs.getaprop(#gParentScriptInstances) 
    1262    
    12631263  if ilk(gParentScriptInstances) <> #proplist then exit 
    1264    
     1264  if dontCallDestroyHandler <> 1 then 
     1265    saveScr = gParentScriptInstances.getaprop(instName) 
     1266    if ilk(saveScr) = #instance then call(#mDestroy, [saveScr]) 
     1267  end if 
    12651268  gParentScriptInstances.deleteprop(instName) 
     1269end 
     1270 
     1271 
     1272-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1273-- xxxxxxxxxxxxxxxxxx reload a stored script instance: 
     1274 
     1275on mReloadInstance me, instName, useRawNew, dontCallDestroyHandler 
     1276  mDeleteInstance me, instName, dontCallDestroyHandler 
     1277  return mGetInstance(me, instName, useRawNew) 
     1278end 
     1279 
     1280-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1281-- xxxxxxxxxxxxxxxxxx replace a stored script instance: 
     1282 
     1283on mReplaceInstance me, instName, scriptInstance, dontCallDestroyHandler 
     1284  if not(objectP(scriptInstance)) then exit 
     1285  theGlobs = mGetGlobalList(me) 
     1286  gParentScriptInstances = theGlobs.getaprop(#gParentScriptInstances) 
     1287  if ilk(gParentScriptInstances) <> #proplist then exit 
     1288  if dontCallDestroyHandler <> 1 then 
     1289    saveScr = gParentScriptInstances.getaprop(instName) 
     1290    if ilk(saveScr) = #instance then call(#mDestroy, [saveScr]) 
     1291  end if 
     1292  gParentScriptInstances.setaprop(instName, scriptInstance) 
    12661293end 
    12671294 
     
    18601887end 
    18611888 
     1889-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1890-- the naming convention used throughout all my movies for names, filename etc.: 
     1891-- Names must be only alphanumeric chars and the underscore and should not start with a number 
     1892-- As a rule of thumb: every string which can be made into a symbol is valid. 
     1893 
     1894on mValidateName me, str 
     1895  if ilk(str) <> #string then return 0 
     1896  if length(str) < 1 then return 0 
     1897  if "0123456789" contains char 1 of str then return 0 
     1898  return string(symbol(str)) = str 
     1899end 
    18621900 
    18631901-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     
    19571995end 
    19581996 
     1997 
     1998-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1999 
     2000on mFormatdate me, theFormat, theDate 
     2001  theFormat = string(theFormat) 
     2002  if length(theFormat) < 1 then theFormat = "yyyy/mm/dd" 
     2003  if ilk(theDate) <> #date then theDate = the systemdate 
     2004   
     2005  offs = offset("y", theFormat) 
     2006  if offs > 0 then 
     2007    ende = offs+1 
     2008    repeat while char ende of theFormat = "y" 
     2009      if ende > length(theFormat) then exit repeat 
     2010      ende = ende+1 
     2011    end repeat 
     2012    len = ende - offs 
     2013    if len < 3 then theYear = char 3 to 4 of string(theDate.year) 
     2014    else theYear = string(theDate.year) 
     2015    put theYear into char offs to offs + len -1 of theFormat 
     2016  end if 
     2017   
     2018  theFormat = mReplaceCharWithNumber(me, theFormat, "m", theDate.month) 
     2019   
     2020  theFormat = mReplaceCharWithNumber(me, theFormat, "d", theDate.day) 
     2021   
     2022  return theFormat 
     2023end 
     2024 
     2025-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     2026 
     2027on mReplaceCharWithNumber me, theString, theChar, theNumber 
     2028  offs = offset(theChar, theString) 
     2029  if offs > 0 then 
     2030    ende = offs+1 
     2031    repeat while char ende of theString = theChar 
     2032      if ende > length(theString) then exit repeat 
     2033      ende = ende+1 
     2034    end repeat 
     2035    len = ende - offs 
     2036    theNumber = string(theNumber) 
     2037    repeat while length(theNumber) < len 
     2038      put "0" before theNumber 
     2039    end repeat 
     2040    put theNumber into char offs to offs + len -1 of theString 
     2041  end if 
     2042  return theString 
     2043end 
     2044 
    19592045-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    19602046 
Note: See TracChangeset for help on using the changeset viewer.