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

Changeset 228 for trunk/lingosource


Ignore:
Timestamp:
03/20/09 18:08:22 (3 years ago)
Author:
alex
Message:

added handler to export only scripttext with metadata for the member and added new handler to svn quicklinks to update all castlibs

Location:
trunk/lingosource
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/lingosource/castlib1/OSCmenu_Utilities.ls

    r221 r228  
    186186  li.add(subli) 
    187187   
    188   subli.add("Export selcetd text as...") 
    189   pLookUpCommandList.setaprop("Export selcetd text as...", ["mExportSelectedText me, theType_optional", "alexUtilities"]) 
     188  subli.add("Export selected text as...") 
     189  pLookUpCommandList.setaprop("Export selected text as...", ["mExportSelectedText me, theType_optional", "alexUtilities"]) 
    190190   
    191191  subli.add("") 
     
    196196  pLookUpCommandList.setaprop("Export to bitmap...", ["mExportBM me, theMember, thePath_optional, theType_optional, compr_optional", "alexUtilities"]) 
    197197   
     198  subli.add("Export script-, text-, fieldmember...") 
     199  pLookUpCommandList.setaprop("Export script-, text-, fieldmember...", ["mExportScripttext me, skipIcons_optional, convertLineBreaksToUnix_optional, theFolder_optional", "alexUtilities"]) 
    198200   
    199201   
     
    312314  subli = [] 
    313315  svn_subli.add(subli) 
     316   
     317  subli.add("SVN Update all castlibs") 
     318  pLookUpCommandList.setaprop("SVN Update all castlibs", ["mSVN_Update_AllCastlib_and_source me, chooseNewPath_optional, onlyUpdate_SVN_WorkingFolder_optional, revisionNumber_optional", "svn_Utilities"]) 
    314319   
    315320  subli.add("SVN Update selected castlib(s)...") 
  • trunk/lingosource/castlib1/alexUtilities.ls

    r221 r228  
    24322432end 
    24332433 
    2434  
     2434-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     2435 
     2436on mExportScripttext me, skipIcons, convertLineBreaksToUnix, theFolder 
     2437   
     2438   
     2439  theFolder = string(theFolder) 
     2440  if length(theFolder) < 1 then theFolder = mGetFolderPathFromUser(me) 
     2441  if length(theFolder) < 1 then exit 
     2442   
     2443  if the last char of theFolder <> the last char of the moviepath then put the last char of the moviepath after theFolder 
     2444   
     2445   
     2446  cl = the activecastlib 
     2447  sel = the selection of castlib cl 
     2448  firstCastNum = cl 
     2449  lastCastNum = cl 
     2450   
     2451   
     2452  DirectImageInstance = 0 
     2453  if skipIcons <> 1 then 
     2454    if mCheckForXtra(me, "SharpExport") = 1 then 
     2455      SharpExportInst = new(xtra "SharpExport") 
     2456    else 
     2457      skipIcons = 1 
     2458    end if 
     2459  end if 
     2460   
     2461   
     2462  isMac = (the platform contains "mac") -- we need the differentiation because of the dreaded 31 char limit 
     2463   
     2464  ----------------------- 
     2465  resetUNames = 0 
     2466  if isMac then 
     2467    if baSysFolder("prefs") starts "/" then 
     2468      baReturnUnixNames(0) 
     2469      resetUNames = 1 
     2470    end if 
     2471  end if 
     2472  ----------------------- 
     2473   
     2474  doit = 0 
     2475  versionNum = mGetFloatVersionNumber(me, the productversion) 
     2476   
     2477  repeat with m = firstCastNum to lastCastNum 
     2478     
     2479    listOfAllFiles = [] 
     2480     
     2481    thisFolder = theFolder 
     2482     
     2483    doit = 0 
     2484     
     2485    sel = the selection of castlib m 
     2486     
     2487    repeat with sub in sel 
     2488      repeat with n = sub[1] to sub[2]    
     2489         
     2490        memref = member(n, m) 
     2491        memtype = memref.type 
     2492         
     2493        convertLineBreaksToUnixT = 0 
     2494         
     2495        if [#script, #field, #text].getPos(memtype) > 0 then 
     2496           
     2497          case memtype of 
     2498               
     2499              ----------------------- 
     2500            #script: 
     2501              ext = ".ls" 
     2502              scrText = memref.scripttext 
     2503              scrtype = memref.scripttype 
     2504               
     2505              ------------------------------ meta data 
     2506              infolist = [:] 
     2507              infolist[#name] = memref.name 
     2508              infolist[#scripttype] = memref.scripttype 
     2509              if versionNum >= 10 then infolist[#scriptSyntax] = memref.scriptSyntax 
     2510              comm = memref.comments 
     2511              offs = offset(RETURN, comm) 
     2512              repeat while offs 
     2513                put QUOTE & " & RETURN & " & QUOTE into char offs of comm 
     2514              end repeat 
     2515              infolist[#comments] = comm 
     2516               
     2517              offs2 = 0 
     2518              export_meta_data = scrText&"" 
     2519              offs = offset("--!memberProperties:", export_meta_data) 
     2520              if offs > 0 then 
     2521                delete char 1 to offs of export_meta_data 
     2522                offs2 = offset("]", export_meta_data) 
     2523              end if 
     2524               
     2525              if offs2 > 0 then 
     2526                put "--!memberProperties:" && infolist into char offs to offs + offs2 of scrText 
     2527              else 
     2528                put "--!memberProperties:" && infolist & RETURN before scrText 
     2529              end if 
     2530               
     2531              ------------------------------ 
     2532               
     2533              ----------------------- 
     2534            #field: 
     2535              ext = ".txt" 
     2536              scrText = memref.text 
     2537              scrtype = #field 
     2538              ----------------------- 
     2539            #text: 
     2540              ext = ".html" 
     2541              scrText = memref.html 
     2542              convertLineBreaksToUnixT = 0 
     2543              scrtype = #text 
     2544              ----------------------- 
     2545            otherwise: 
     2546              ext = ".txt" 
     2547              scrText = memref.text 
     2548              scrtype = #field 
     2549          end case 
     2550           
     2551          memname = memref.name 
     2552           
     2553          theDefaultName = memname 
     2554           
     2555          doit = 1 
     2556           
     2557          if length(theDefaultName) < 1 then 
     2558            theDefaultName =  "member" & n & "_" & m 
     2559            memref.name = theDefaultName 
     2560            put "renamed member" && memref && "to member(" & QUOTE & theDefaultName & QUOTE & ") as member without names are not supported" 
     2561          end if 
     2562           
     2563          theDefaultName = mStripFunnyCharsFromFileName(me, theDefaultName) 
     2564           
     2565          origname = theDefaultName&"" 
     2566          if length(theDefaultName) > 25 and isMac then 
     2567             
     2568            ms = string(the milliseconds) 
     2569            mlen = length(ms) 
     2570            ms = char mlen - 6 to mlen of ms 
     2571             
     2572            theDefaultName = char 1 to 18 of theDefaultName 
     2573            theDefaultName = theDefaultName & ms -- trim filenames as the mac version of fileio wants to deal with 31 chars 
     2574             
     2575          end if 
     2576           
     2577           
     2578           
     2579          ------------------------------------------ trac subversion support works better with unix linebreaks... 
     2580          if voidP(convertLineBreaksToUnix) then convertLineBreaksToUnix = 1 
     2581          if convertLineBreaksToUnix = "" then convertLineBreaksToUnix = 1 
     2582           
     2583          if convertLineBreaksToUnix = 1 then 
     2584            if convertLineBreaksToUnixT <> 1 then 
     2585              if mCheckForXtra(me, "Pregex") = 1 then 
     2586                 
     2587                scrTextLi = [scrText] 
     2588                pregex_replace(scrTextLi, "\x0D\x0A?", "g", "\x0A") 
     2589                scrText = scrTextLi[1] 
     2590                 
     2591              else 
     2592                 
     2593                fndStr = numToChar(13) & numToChar(10) 
     2594                offs = offset(fndStr, scrText) 
     2595                repeat while offs > 0 
     2596                  delete char offs of scrText 
     2597                  offs = offset(fndStr, scrText) 
     2598                end repeat 
     2599                 
     2600                fndStr = numToChar(13) 
     2601                offs = offset(fndStr, scrText) 
     2602                repeat while offs > 0 
     2603                  put numToChar(10) into char offs of scrText 
     2604                  offs = offset(fndStr, scrText) 
     2605                end repeat 
     2606              end if  
     2607            end if 
     2608          end if 
     2609          ----------------------------------------- 
     2610           
     2611          if theDefaultName <> origname then 
     2612            alterText = "" 
     2613            snam = baShortFileName(thisFolder & origname & ext) 
     2614            if length(snam) > 0 then 
     2615              alterText = mGetTextFromFile(me, snam) 
     2616            else 
     2617              alterText = mGetTextFromFile(me, thisFolder & origname & ext) 
     2618            end if 
     2619          else 
     2620            alterText = mGetTextFromFile(me, thisFolder & theDefaultName & ext) 
     2621          end if 
     2622           
     2623          listOfAllFiles.add(mLowerCase(me, origname)) 
     2624           
     2625          if alterText <> scrText then 
     2626             
     2627            --------------------- compare without whitespaces: 
     2628            noChanges = (mRemoveWhiteSpaces(me, scrText&"") = mRemoveWhiteSpaces(me, alterText&"")) 
     2629             
     2630             
     2631            if noChanges = 0 then 
     2632               
     2633              mSaveToTextFile me, scrText, thisFolder & theDefaultName & ext 
     2634               
     2635              bmexp = 0 
     2636              if skipIcons <> 1 then 
     2637                 
     2638                thumbmember = new(#bitmap) 
     2639                thumbmember.picture = memref.thumbnail 
     2640                 
     2641                if thumbmember.width > 0 then 
     2642                  bmexp = 1 
     2643                  if baFileExists(thisFolder & theDefaultName & ".png") then baDeleteFile(thisFolder & theDefaultName & ".png") 
     2644                   
     2645                  if objectP(DirectImageInstance) then 
     2646                     
     2647                    DirectImageInstance.imageLoadFromMember(thumbmember) 
     2648                    DirectImageInstance.imageSaveToFile(thisFolder & theDefaultName & ".png", 100, 1,1) 
     2649                     
     2650                  else if objectP(SharpExportInst) then 
     2651                    mExportBM me, thumbmember, thisFolder & theDefaultName & ".png", "png", 100, SharpExportInst 
     2652                     
     2653                  end if 
     2654                end if 
     2655                 
     2656                thumbmember.erase() 
     2657                 
     2658              end if 
     2659               
     2660               
     2661              if theDefaultName <> origname then 
     2662                 
     2663                snam = baShortFileName(thisFolder & origname & ext) 
     2664                if length(snam) > 0 then baDeleteFile(snam) 
     2665                erg = baRenameFile(thisFolder & theDefaultName & ext, thisFolder & origname & ext) 
     2666                if erg <> 1 then put "Couldn't rename file " & thisFolder & theDefaultName & ext & " to " & thisFolder & origname & ext 
     2667                if bmexp = 1 then 
     2668                  snam = baShortFileName(thisFolder & origname & ".png") 
     2669                  if length(snam) > 0 then baDeleteFile(snam) 
     2670                  erg = baRenameFile(thisFolder & theDefaultName & ".png", thisFolder & origname & ".png") 
     2671                  if erg <> 1 then put "Couldn't rename file " & thisFolder & theDefaultName & ".png to " & thisFolder & origname & ".png" 
     2672                end if 
     2673                 
     2674              end if 
     2675               
     2676              if origname <> memname then 
     2677                put "Renamed member" && memref && "to" && origname & ". Scriptmember names must not be emoty or contain illegal characters (SPACE, /, :, \, &)" 
     2678              end if 
     2679               
     2680            end if 
     2681          end if 
     2682           
     2683        end if 
     2684      end repeat 
     2685    end repeat 
     2686     
     2687  end repeat 
     2688   
     2689  if resetUNames = 1 then baReturnUnixNames(1) 
     2690   
     2691  DirectImageInstance = 0 
     2692  SharpExportInst = 0 
     2693   
     2694end 
    24352695 
    24362696-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
  • trunk/lingosource/castlib1/memberInfo.xml

    r223 r228  
    55                <comments>http://www.farbflash.de/cgi-bin/versionChecker.pl?movieName=HandlerMenu_OSC</comments> 
    66                <memberName>subversion_version_field</memberName> 
    7                 <fName>subversion_version_field</fName> 
     7                <fname>subversion_version_field</fname> 
    88        </subversion_version_field> 
    99        <doCommandMovieScript> 
     
    1111                <comments></comments> 
    1212                <memberName>doCommandMovieScript</memberName> 
    13                 <fName>doCommandMovieScript</fName> 
     13                <fname>doCommandMovieScript</fname> 
    1414        </doCommandMovieScript> 
    1515        <thisMoviesScript> 
     
    1717                <comments></comments> 
    1818                <memberName>thisMoviesScript</memberName> 
    19                 <fName>thisMoviesScript</fName> 
     19                <fname>thisMoviesScript</fname> 
    2020        </thisMoviesScript> 
    2121        <keyboardNavigation_FrameLoop> 
     
    2323                <comments></comments> 
    2424                <memberName>keyboardNavigation_FrameLoop</memberName> 
    25                 <fName>keyboardNavigation_FrameLoop</fName> 
     25                <fname>keyboardNavigation_FrameLoop</fname> 
    2626        </keyboardNavigation_FrameLoop> 
    2727        <menu1_button> 
     
    2929                <comments></comments> 
    3030                <memberName>menu1_button</memberName> 
    31                 <fName>menu1_button</fName> 
     31                <fname>menu1_button</fname> 
    3232        </menu1_button> 
    3333        <menu2_button> 
     
    3535                <comments></comments> 
    3636                <memberName>menu2_button</memberName> 
    37                 <fName>menu2_button</fName> 
     37                <fname>menu2_button</fname> 
    3838        </menu2_button> 
    3939        <simpleBMMenu> 
     
    4141                <comments></comments> 
    4242                <memberName>simpleBMMenu</memberName> 
    43                 <fName>simpleBMMenu</fName> 
     43                <fname>simpleBMMenu</fname> 
    4444        </simpleBMMenu> 
    4545        <OSCmenu_Utilities> 
     
    4747                <comments></comments> 
    4848                <memberName>OSCmenu_Utilities</memberName> 
    49                 <fName>OSCmenu_Utilities</fName> 
     49                <fname>OSCmenu_Utilities</fname> 
    5050        </OSCmenu_Utilities> 
    5151        <alexUtilities> 
     
    5353                <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 
    5454                <memberName>alexUtilities</memberName> 
    55                 <fName>alexUtilities</fName> 
     55                <fname>alexUtilities</fname> 
    5656        </alexUtilities> 
    5757        <bbedit_Utilities> 
     
    5959                <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 
    6060                <memberName>bbedit_Utilities</memberName> 
    61                 <fName>bbedit_Utilities</fName> 
     61                <fname>bbedit_Utilities</fname> 
    6262        </bbedit_Utilities> 
    6363        <svn_Utilities> 
     
    6565                <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 
    6666                <memberName>svn_Utilities</memberName> 
    67                 <fName>svn_Utilities</fName> 
     67                <fname>svn_Utilities</fname> 
    6868        </svn_Utilities> 
    6969        <custom_Utilities> 
     
    7171                <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 
    7272                <memberName>custom_Utilities</memberName> 
    73                 <fName>custom_Utilities</fName> 
     73                <fname>custom_Utilities</fname> 
    7474        </custom_Utilities> 
    7575        <convert_Lingo_2_CSS_Html> 
     
    7777                <comments>~/Documents/Scripts/lingo/convert_Lingo_2_CSS_Html.ls</comments> 
    7878                <memberName>convert_Lingo_2_CSS_Html</memberName> 
    79                 <fName>convert_Lingo_2_CSS_Html</fName> 
     79                <fname>convert_Lingo_2_CSS_Html</fname> 
    8080        </convert_Lingo_2_CSS_Html> 
    8181        <OSCmenu_Handlers> 
     
    8383                <comments></comments> 
    8484                <memberName>OSCmenu_Handlers</memberName> 
    85                 <fName>OSCmenu_Handlers</fName> 
     85                <fname>OSCmenu_Handlers</fname> 
    8686        </OSCmenu_Handlers> 
    8787        <pastefeld> 
     
    8989                <comments></comments> 
    9090                <memberName>pastefeld</memberName> 
    91                 <fName>pastefeld</fName> 
     91                <fname>pastefeld</fname> 
    9292        </pastefeld> 
    9393        <oldclipboard> 
     
    9595                <comments></comments> 
    9696                <memberName>oldclipboard</memberName> 
    97                 <fName>oldclipboard</fName> 
     97                <fname>oldclipboard</fname> 
    9898        </oldclipboard> 
    9999        <searchword> 
     
    101101                <comments></comments> 
    102102                <memberName>searchword</memberName> 
    103                 <fName>searchword</fName> 
     103                <fname>searchword</fname> 
    104104        </searchword> 
    105105        <resizewindowfs> 
     
    107107                <comments></comments> 
    108108                <memberName>resizewindowfs</memberName> 
    109                 <fName>resizewindowfs</fName> 
     109                <fname>resizewindowfs</fname> 
    110110        </resizewindowfs> 
    111111        <showHideHelp> 
     
    113113                <comments></comments> 
    114114                <memberName>showHideHelp</memberName> 
    115                 <fName>showHideHelp</fName> 
     115                <fname>showHideHelp</fname> 
    116116        </showHideHelp> 
    117117        <helptext> 
     
    122122rtf</comments> 
    123123                <memberName>helptext</memberName> 
    124                 <fName>helptext</fName> 
     124                <fname>helptext</fname> 
    125125        </helptext> 
    126126        <texthyperlinkBehavior> 
     
    128128                <comments>/Users/alex/Documents/ALIEN/myLinkedScripts/texthyperlinkBehavior.ls</comments> 
    129129                <memberName>texthyperlinkBehavior</memberName> 
    130                 <fName>texthyperlinkBehavior</fName> 
     130                <fname>texthyperlinkBehavior</fname> 
    131131        </texthyperlinkBehavior> 
    132132        <statusOutput> 
     
    137137rtf</comments> 
    138138                <memberName>statusOutput</memberName> 
    139                 <fName>statusOutput</fName> 
     139                <fname>statusOutput</fname> 
    140140        </statusOutput> 
    141141</Untitled> 
  • trunk/lingosource/castlib1/subversion_version_field.txt

    r225 r228  
    1 r227 
     1r230 
  • trunk/lingosource/castlib1/svn_Utilities.ls

    r225 r228  
    13931393   
    13941394  if ilk(infolist) <> #proplist then 
    1395     infolistPath = thePath & "memberInfo.xml" 
    1396     infolist = mReadXML_2_List(me, infolistPath) 
    1397     if ilk(infolist) <> #proplist then infolist = [:] 
    1398      
    1399     infolist = infolist.getaprop(symbol(fname)) 
    1400     if ilk(infolist) <> #proplist then infolist = [:] 
     1395     
     1396    offs = offset("--!memberProperties:", scrtext) 
     1397     
     1398    if offs > 0 then 
     1399      infolist = scrtext.char[offs + 20 .. length(scrtext)] 
     1400      offs = offset("]", infolist) 
     1401      if offs > 0 then 
     1402        infolist = value(infolist.char[1 .. offs]) 
     1403      end if 
     1404    end if 
     1405     
     1406    if ilk(infolist) <> #proplist then 
     1407      infolistPath = thePath & "memberInfo.xml" 
     1408      infolist = mReadXML_2_List(me, infolistPath) 
     1409      if ilk(infolist) <> #proplist then infolist = [:] 
     1410       
     1411      infolist = infolist.getaprop(symbol(fname)) 
     1412      if ilk(infolist) <> #proplist then infolist = [:] 
     1413    end if 
     1414     
    14011415  end if 
    14021416   
     
    25492563-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    25502564 
     2565on mSVN_Update_AllCastlibs_and_source me, chooseNewPath, onlyUpdate_SVN_WorkingFolder, selectionList, revisionNumber, dontShowAlert 
     2566  mSVN_Update_Working_Copy_ScriptText me, revisionNumber, void, #all, 1 
     2567  mSVN_Update_SelectedCastlib me, chooseNewPath, onlyUpdate_SVN_WorkingFolder, #all, revisionNumber, dontShowAlert 
     2568end 
     2569 
     2570-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     2571 
    25512572on mSVN_Update_SelectedCastlib_and_source me, chooseNewPath, onlyUpdate_SVN_WorkingFolder, selectionList, revisionNumber, dontShowAlert 
    25522573  mSVN_Update_Working_Copy_ScriptText me, revisionNumber, void, selectionList, 1 
     
    25602581  castlibList = 0 
    25612582   
    2562   selectionList = string(selectionList) 
    2563   if length(selectionList) > 0 then 
    2564      
    2565     offs = offset("'", selectionList) 
    2566     repeat while offs > 0 
    2567       put QUOTE into char offs of selectionList 
     2583  if symbolP(selectionList) then 
     2584    -- #all 
     2585    clnum = the number of castlibs 
     2586    castlibList = [] 
     2587    repeat with n = 1 to clnum 
     2588      castlibList.add(n) 
     2589    end repeat 
     2590     
     2591  else 
     2592     
     2593    selectionList = string(selectionList) 
     2594    if length(selectionList) > 0 then 
     2595       
    25682596      offs = offset("'", selectionList) 
    2569     end repeat 
    2570      
    2571     if char 1 of selectionList <> "[" then put "[" before selectionList 
    2572     if the last char of selectionList <> "]" then put "]" after selectionList 
    2573      
    2574     selectionList = value(selectionList) 
    2575     if listP(selectionList) then 
    2576       clnum = the number of castlibs + 1 
    2577       castlibList = [] 
    2578       selectionListCnt = count(selectionList) 
    2579       repeat with n = 1 to selectionListCnt 
    2580          
    2581         cl = castlib(selectionList[n]) 
    2582         if ilk(cl) = #castlib then 
    2583           int = cl.number 
    2584           if castlibList.getPos(int) < 1 then 
    2585             castlibList.add(int) 
    2586           end if 
    2587         else 
    2588           int = integer(selectionList[n]) 
    2589           if integerP(int) then 
    2590             if clnum > int then 
    2591               if castlibList.getPos(int) < 1 then castlibList.add(int) 
     2597      repeat while offs > 0 
     2598        put QUOTE into char offs of selectionList 
     2599        offs = offset("'", selectionList) 
     2600      end repeat 
     2601       
     2602      if char 1 of selectionList <> "[" then put "[" before selectionList 
     2603      if the last char of selectionList <> "]" then put "]" after selectionList 
     2604       
     2605      selectionList = value(selectionList) 
     2606      if listP(selectionList) then 
     2607        clnum = the number of castlibs + 1 
     2608        castlibList = [] 
     2609        selectionListCnt = count(selectionList) 
     2610        repeat with n = 1 to selectionListCnt 
     2611           
     2612          cl = castlib(selectionList[n]) 
     2613          if ilk(cl) = #castlib then 
     2614            int = cl.number 
     2615            if castlibList.getPos(int) < 1 then 
     2616              castlibList.add(int) 
     2617            end if 
     2618          else 
     2619            int = integer(selectionList[n]) 
     2620            if integerP(int) then 
     2621              if clnum > int then 
     2622                if castlibList.getPos(int) < 1 then castlibList.add(int) 
     2623              end if 
    25922624            end if 
    25932625          end if 
    2594         end if 
    2595       end repeat 
     2626        end repeat 
     2627      end if 
    25962628    end if 
    25972629  end if 
  • trunk/lingosource/castlib2/GetSetPrefs.ls

    r186 r228  
    179179--    delete line 1 of prefsText 
    180180     
    181     gPrefs = call(#mGetListFromXMLString, mGetXScript(#PseudoXMLPS), prefsText) 
     181    gPrefs = call(#mGetListFromXMLStringX, mGetXScript(#PseudoXMLPS), prefsText) 
    182182    if objectP(gPrefs) then globs[#gPrefs] = gPrefs 
    183183     
  • trunk/lingosource/castlib2/PseudoXMLPS.ls

    r215 r228  
    22----------------------------------- 
    33-- CREATED: 
    4 -- 06.03.2008 
     4-- 2002 
    55-- 
    66-- DESCRIPTION: 
    77--              Pseudo XML by Alex da Franca c2003 
    8 -- Convert a lingo list to a XML like string and back 
     8--              Convert a lingo list to a XML like string and back 
    99 
    1010-- 
    1111-- REQUIRES: 
    12 -- (Prerequisites) 
     12--              only the functions mSaveList_2_XML() and mReadXML_2_List() require my system of library scripts 
     13--              in order to write and read text with fileio. All other functions have no dependencies 
     14--              Either get these scripts from my website, or replace the write/read stuff with your own fileIO handlers 
     15--                    That is: 
     16--                            * movie script "aleXtrasMovieScript" 
     17--                            * parent script "commonMovieScript" 
     18--                            * parent script "FileIOFunktionen" 
    1319-- 
    1420-- USAGE: 
     21--              ---------- please see the comments for each handler for a how-to. 
     22--              ---------- nonetheless here are some fast start comments with the minimum amount of parameters 
     23--              PseudoXMLPS = new(script "PseudoXMLPS") 
     24--              -- Convert a list to an xml string: 
     25--              xmlString = PseudoXMLPS.mGetXMLStringFromList(["one", "two", [#prop: 3]]) 
     26--              lingolist = PseudoXMLPS.mGetListFromXMLStringX(xmlString) 
     27--              ---------- basically that's it 
     28-- 
     29--              ---------- another "hack" to be aware of is the following: 
     30--              ---------- linear lists get identified by having a nodename which starts with the exact string "item" 
     31--              ---------- so if an xml node like <item1>one</item1> is encountered, it is treated as linear list: ["one"] 
     32--              ---------- and NOT as [#item1:"one"] 
     33-- 
     34--              ---------- the mGetXMLStringFromList() function escapes the reserved xml chars <> and & and ' and " by default 
     35--              ---------- if for some reason you rather want to enclose the contents in a <![CDATA[ tag, use the dontReplaceGT flag. 
     36--------------------------------------------- EXAMPLE for <dontReplaceGT = 1> (dontReplaceGT means don't replace "greater than" btw...): 
     37-- 
    1538-- myList = [#stringWithInvalidChars:"A string with invalid chars like <> and & and ' and " & QUOTE] 
    1639-- myList[#stringWithInvalidChars] = "<![CDATA[" & myList[#stringWithInvalidChars] & "]]>" 
     
    2851--   end if 
    2952-- end repeat 
     53--------------------------------------------- please note, that the above example is ONLY needed, if you use dontReplaceGT = 1 !! 
    3054-- 
    3155-- HISTORY: 
     
    129153  -- ACTION: Convert lingo list (also nested lists) to XML stylish string 
    130154  -- INPUT:  
    131 -- <listref> format: property list or linear list 
    132 -- <docName> format: #string; optional. if omitted "Untitled" is used for the XML document name 
     155  --              <listref> format: property list or linear list 
     156  --              <docName> format: #string; optional. if omitted "Untitled" is used for the XML document name 
    133157  --              <strict>        => boolean; avoid spaces in tag names 
    134158  --              <dontReplaceGT> => boolean; dont replace < and > 
    135159  --              <withParams>    => boolean; write attribute in tag for the lingo ilk => bigger xml files and unfortunately it is slower to parse 
    136 ----------------------------- (I thought avoiding value() would help, but in this case the additional text parsing of the attributes tag slows down) 
     160  ----------------------------- (I thought avoiding value() would help, but in this case the additional text parsing of the attributes tag slows down) 
    137161  -- RETURNS: string 
    138162  -- EXAMPLE: saveString = mGetXMLStringFromList(me, lingo_list, "documentName") 
     
    173197  -- ACTION: Description 
    174198  -- INPUT: 
    175 -- <str> format: #string; split a string using <> and </> tags into lingo list 
    176 -- <convertValues> #integer 0=>don't convert (fast, all values are strings), 1 => convert only numbers (slower); 2 => try to convert all data, even colors (slow) 
     199  --          <str> format: #string; split a string using <> and </> tags into lingo list 
     200  --          <convertValues> #integer 0=>don't convert (fast, all values are strings), 1 => convert only numbers (slower); 2 => try to convert all data, even colors (slow) 
    177201  --          <withParams> : #boolean : parse parameters too. new, not very well tested 
    178202  -- RETURNS: property list 
     
    224248  --         BUT it must be a valid xml string, the above is slower but allows more malformed xml 
    225249  -- INPUT:  
    226 -- <str> format: #string; split a string using <> and </> tags into lingo list 
    227 -- <convertValues> #integer 
    228 -- -- -- 0 => don't convert (fast, all values are strings) 
    229 -- -- -- 1 => convert only integer() and float() (slower) 
    230 -- -- -- 2 => try to convert all data with value(), even parse for colors in hexstring format (slow) 
     250  --        <str> format: #string; split a string using <> and </> tags into lingo list 
     251  --        <convertValues> #integer 
     252  --          -- -- 0 => don't convert (fast, all values are strings) 
     253  --          -- -- 1 => convert only integer() and float() (slower) 
     254  --          -- -- 2 => try to convert all data with value(), even parse for colors in hexstring format (slow) 
    231255  -- RETURNS: property list 
    232256  -- EXAMPLE: lingo_list = mGetListFromXMLStringX(me, saveString) 
     
    306330  li = mConvertXMLPropList(me, [xx], convertValues, dontEscapeSpecialChars) 
    307331   
    308  -- put "x" && the milliseconds - ms 
     332  -- put "PseudoXMLPS: mGetListFromXMLStringX:" && the milliseconds - ms 
    309333   
    310334  if not(listP(li)) then return [:] 
     
    328352   
    329353  dertext = xscr(#FileIOFunktionen).mGetTextFromFile(thePath) 
    330   if length(dertext) > 0 then return xscr(#PseudoXMLPS).mGetListFromXMLStringX(dertext) 
     354  if length(dertext) > 0 then return mGetListFromXMLStringX(me, dertext) 
    331355  return [:] 
    332356end 
     
    345369   
    346370  if not(listP(theList)) then return 0 
    347   theResult = xscr(#PseudoXMLPS).mGetXMLStringFromList(theList) 
     371  theResult = mGetXMLStringFromList(me, theList) 
    348372  return xscr(#FileIOFunktionen).mSaveToTextFile(theResult, thePath) 
    349373end 
     
    757781   
    758782  if val.length = 7 then 
    759     if (val.char[1] = "#") and (offset(val.char[2], "abcdef0123456789") > 0) then return rgb(val) 
     783    if (val.char[1] = "#") then 
     784      isColor = 1 
     785      repeat with n = 2 to 7 
     786        if (offset(val.char[n], "abcdef0123456789") < 1) then 
     787          isColor = 0 
     788          exit repeat 
     789        end if 
     790      end repeat 
     791      if isColor = 1 then return rgb(val) 
     792    end if 
    760793  end if  
    761794   
     
    921954      if count(val) then 
    922955        if ilk(retlist) = #proplist then 
    923         retlist.addProp(symbol(inputlist[n].getaprop(#name)), mConvertXMLPropList(me, val, convertValues, dontEscapeSpecialChars)) 
    924       else 
     956          retlist.addProp(symbol(inputlist[n].getaprop(#name)), mConvertXMLPropList(me, val, convertValues, dontEscapeSpecialChars)) 
     957        else 
    925958          retlist.add(mConvertXMLPropList(me, val, convertValues, dontEscapeSpecialChars)) 
    926959        end if 
     
    943976               
    944977              -- unescape <>&'" 
    945                if dontEscapeSpecialChars <> 1 then val = mUnEscapeSpecialChars(me, val) 
     978              if dontEscapeSpecialChars <> 1 then val = mUnEscapeSpecialChars(me, val) 
    946979               
    947980            #integer: 
     
    9881021             
    9891022            -- unescape <>&'" 
    990            if dontEscapeSpecialChars <> 1 then val = mUnEscapeSpecialChars(me, val) 
     1023            if dontEscapeSpecialChars <> 1 then val = mUnEscapeSpecialChars(me, val) 
    9911024             
    9921025             
     
    10001033         
    10011034        if ilk(retlist) = #proplist then 
    1002         retlist.addProp(symbol(inputlist[n].getaprop(#name)), val) 
     1035          retlist.addProp(symbol(inputlist[n].getaprop(#name)), val) 
    10031036        else 
    10041037          retlist.add(val) 
     
    10221055  -- INPUT: <theText> ; string ; required => xml formatted string 
    10231056  -- RETURNS: property list 
    1024   -- EXAMPLE: plist = xscr(#PseudoXMLPS).mParseExcelXML(xscr(#FileIOFunktionen).mGetTextFromFile()) 
     1057  -- EXAMPLE: plist = new(script "PseudoXMLPS").mParseExcelXML(xscr(#FileIOFunktionen).mGetTextFromFile()) 
    10251058  ----------------------------------- 
    10261059   
     
    10611094                         
    10621095                      else 
    1063                         call(#mPut, mGetXScript(), "mParseExcelXML: Row "&n&" Cell "&m&" is not a property list") 
     1096                        put "mParseExcelXML: Row "&n&" Cell "&m&" is not a property list" 
    10641097                      end if -- if ilk(thisCell) = #proplist then 
    10651098                       
     
    10671100                     
    10681101                  else 
    1069                     call(#mPut, mGetXScript(), "mParseExcelXML: Row "&n&" is not a list") 
     1102                    put "mParseExcelXML: Row "&n&" is not a list" 
    10701103                  end if -- if listP(currRow) then 
    10711104                   
     
    10731106                 
    10741107              else 
    1075                 call(#mPut, mGetXScript(), "mParseExcelXML: Table not found") 
     1108                put "mParseExcelXML: Table not found" 
    10761109              end if -- if listP(xmlList) then 
    10771110               
    10781111            else 
    1079               call(#mPut, mGetXScript(), "mParseExcelXML: Worksheet not found") 
     1112              put "mParseExcelXML: Worksheet not found" 
    10801113            end if -- if ilk(xmlList) = #proplist then 
    10811114             
    10821115          else 
    1083             call(#mPut, mGetXScript(), "mParseExcelXML: Workbook not found") 
     1116            put "mParseExcelXML: Workbook not found" 
    10841117          end if -- if ilk(xmlList) = #proplist then 
    10851118           
    10861119        else 
    1087           call(#mPut, mGetXScript(), "mParseExcelXML: ROOT is not a property list") 
     1120          put "mParseExcelXML: ROOT is not a property list" 
    10881121        end if --if ilk(xmlList) = #proplist then 
    10891122         
    10901123      else 
    1091         call(#mPut, mGetXScript(), "mParseExcelXML: Xml parser makelist() returned empty list") 
     1124        put "mParseExcelXML: Xml parser makelist() returned empty list" 
    10921125      end if -- if count(xmlList) > 0 then 
    10931126       
    10941127    else 
    1095       call(#mPut, mGetXScript(), "mParseExcelXML: Xml parser makelist() failed") 
     1128      put "mParseExcelXML: Xml parser makelist() failed" 
    10961129    end if -- if listP(xmlList) then 
    10971130     
    10981131  else 
    1099     call(#mPut, mGetXScript(), "mParseExcelXML: Xml parser error: "&xmlp.getError()) 
     1132    put "mParseExcelXML: Xml parser error: "&xmlp.getError() 
    11001133  end if -- if voidP(xmlp.getError()) then 
    11011134   
     
    11131146  -- INPUT: <pfad> ; string ; full pathname to plist file. This is optional, if it is void or "" a file selection dialog is displayed  
    11141147  -- RETURNS: property list 
    1115   -- EXAMPLE: plist = xscr(#PseudoXMLPS).mReadPList() 
     1148  -- EXAMPLE: plist = new(script "PseudoXMLPS").mReadPList() 
    11161149  ----------------------------------- 
    11171150   
     
    11861219 
    11871220on mGetListFromPListString me, str 
    1188   return mConvertKeyList(me, mGetListFromXMLString(me, str, 0)) 
     1221  return mConvertKeyList(me, mGetListFromXMLStringX(me, str, 0)) 
    11891222end 
    11901223 
  • trunk/lingosource/castlib2/aleXtrasMovieScript.ls

    r186 r228  
    4949      halt 
    5050    end if 
     51     
     52    if voidP(cms.script) then -- strangely enough this happened suddenly, dunno why... 
     53      -- until now it happened only in authoring with the stopped movie 
     54      -- therefore I just exit here without alert 
     55      halt 
     56    end if 
     57     
    5158    alextras = rawnew(cms.script) 
    5259    if ilk(alextras) <> #instance then 
     
    5562    end if 
    5663    (script "aleXtrasMovieScript").pAleXtras = alextras 
     64     
    5765  end if 
    5866  return alextras 
  • trunk/lingosource/castlib2/commonMovieScript.ls

    r215 r228  
    387387  --         ACTION: Create/Get timeout object 
    388388  --                 This handler works the same with the old player <10 and the new player >=10 
    389   --         INPUT: ||ÊtheName     || string  || name for new timeout object|| 
    390   --                ||ÊtheDuration || integer || timeout perios in milliseconds|| 
     389  --         INPUT: || theName     || string  || name for new timeout object|| 
     390  --                || theDuration || integer || timeout perios in milliseconds|| 
    391391  --                || theHandler  || symbol  || handler to be called on each timepout event|| 
    392392  --                || theTarget   || object  || object to be sent the timeout event <theHandler>|| 
     
    17051705-- dummy handler for translate function 
    17061706 
    1707 on mTranslate me, aString 
     1707on mTranslate me, aString, variablesList 
    17081708  theGlobs = mGetGlobalList(me) 
    17091709  uebersetzungsListe = theGlobs.getaprop(#gUebersetzung) 
     
    17111711  uebersetzung = uebersetzungsListe.getaprop(aString) 
    17121712  if voidP(uebersetzung) then 
     1713    if listP(variablesList) then return mReplacePlaceHoldersInString(me, aString, variablesList) 
    17131714    return aString 
    17141715  else 
     
    17251726end 
    17261727 
     1728-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1729 
     1730on mReplacePlaceHoldersInString me, aString, variablesList 
     1731  if ilk(variablesList) = #proplist then 
     1732    cnt = count(variablesList) 
     1733    if cnt > 0 then 
     1734      repeat with n = 1 to cnt 
     1735        str = string(variablesList[n]) 
     1736        prop = variablesList.getPropAt(n) 
     1737        srchStr = "%%" & prop & "%%" 
     1738        len = length(srchStr) - 1 
     1739        offs = offset(srchStr, aString) 
     1740        repeat while offs > 0 
     1741          put str into char offs to offs + len of aString 
     1742          offs = offset(srchStr, aString) 
     1743        end repeat 
     1744      end repeat         
     1745    end if 
     1746  else if ilk(variablesList) = #list then -- printf like replacement 
     1747    if count(variablesList) > 0 then 
     1748      offs = offset("%s", aString) 
     1749      str = string(variablesList[1]) 
     1750      repeat while offs > 0 
     1751        put str into char offs to offs + 1 of aString 
     1752        if count(variablesList) > 1 then variablesList.deleteAt(1) 
     1753        offs = offset("%s", aString) 
     1754      end repeat 
     1755    end if 
     1756  end if 
     1757  return aString 
     1758end 
    17271759 
    17281760-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
  • trunk/lingosource/castlib2/memberInfo.xml

    r198 r228  
    55                <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 
    66                <memberName>commonMovieScript</memberName> 
    7                 <fName>commonMovieScript</fName> 
     7                <fname>commonMovieScript</fname> 
    88        </commonmoviescript> 
    99        <FileIOFunktionen> 
     
    1111                <comments>~/Documents/Scripts/lingo/FileIOFunktionen.ls</comments> 
    1212                <memberName>FileIOFunktionen</memberName> 
    13                 <fName>FileIOFunktionen</fName> 
     13                <fname>FileIOFunktionen</fname> 
    1414        </FileIOFunktionen> 
    1515        <GetSetPrefs> 
     
    1717                <comments>~/Documents/Scripts/lingo/GetSetPrefs.ls</comments> 
    1818                <memberName>GetSetPrefs</memberName> 
    19                 <fName>GetSetPrefs</fName> 
     19                <fname>GetSetPrefs</fname> 
    2020        </GetSetPrefs> 
    2121        <aleXtrasMovieScript> 
     
    2323                <comments>~/Documents/Scripts/lingo/aleXtrasMovieScript.ls</comments> 
    2424                <memberName>aleXtrasMovieScript</memberName> 
    25                 <fName>aleXtrasMovieScript</fName> 
     25                <fname>aleXtrasMovieScript</fname> 
    2626        </aleXtrasMovieScript> 
    2727        <PseudoXMLPS> 
     
    2929                <comments>~/Documents/Scripts/lingo/PseudoXMLPS.ls</comments> 
    3030                <memberName>PseudoXMLPS</memberName> 
    31                 <fName>PseudoXMLPS</fName> 
     31                <fname>PseudoXMLPS</fname> 
    3232        </PseudoXMLPS> 
    3333        <simpleGoToAction> 
     
    3535                <comments>/Users/alex/Documents/ALIEN/myLinkedScripts/simpleGoToAction.ls</comments> 
    3636                <memberName>simpleGoToAction</memberName> 
    37                 <fName>simpleGoToAction</fName> 
     37                <fname>simpleGoToAction</fname> 
    3838        </simpleGoToAction> 
    3939        <SpriteNameBeaver> 
     
    4141                <comments>~/Documents/Scripts/lingo/SpriteNameBeaver.ls</comments> 
    4242                <memberName>SpriteNameBeaver</memberName> 
    43                 <fName>SpriteNameBeaver</fName> 
     43                <fname>SpriteNameBeaver</fname> 
    4444        </SpriteNameBeaver> 
    4545        <subversionVersionChecker> 
     
    4747                <comments>~/Documents/Scripts/lingo/subversionVersionChecker.ls</comments> 
    4848                <memberName>subversionVersionChecker</memberName> 
    49                 <fName>subversionVersionChecker</fName> 
     49                <fname>subversionVersionChecker</fname> 
    5050        </subversionVersionChecker> 
    5151</Untitled> 
Note: See TracChangeset for help on using the changeset viewer.