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

Changeset 2


Ignore:
Timestamp:
08/29/07 17:16:14 (4 years ago)
Author:
alex
Message:

finished first set of svn handlers -- added handler to search all put statements, ugly and slow, but authoring only and so I dont care

Location:
trunk/lingosource
Files:
3 edited

Legend:

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

    r1 r2  
    133133   
    134134  subli.add("GetScriptlines me") 
     135  subli.add("mListallPuts me") 
    135136   
    136137  --------------------------------------------------- 
     
    169170  subli = [] 
    170171  li.add(subli) 
    171   subli.add("mExportAllScriptsToDisk me, skipIcons, selectionOnly, convertLineBreaksToUnix") 
     172  subli.add("mExportScriptsToFolder me, skipIcons, selectionOnly, convertLineBreaksToUnix") 
    172173  subli.add("mImportScriptWithThumbnail me, thePath, castlibNumber, dontWarn, infolist") 
    173   subli.add("mUpdateScriptsFromRepository me, thePath, selectionOnly") 
     174  subli.add("mUpdateScriptsFromFolder me, thePath, selectionOnly") 
     175  subli.add("") 
    174176  subli.add("mSVN_Update_Working_Copy me, chooseNewPath") 
    175177  subli.add("mSVN_Commit_CurrentScripts me, selected_Members_Only") 
  • trunk/lingosource/castlib1/alexUtilities.ls

    r1 r2  
    975975end 
    976976 
     977 
     978-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     979 
     980on mListallPuts me 
     981  cnum = the number of castlibs 
     982  repeat with l = 1 to cnum 
     983    mnum = the number of members of castlib l 
     984    repeat with n = 1 to mnum 
     985      memref = member(n, l) 
     986      if memref.type = #script then 
     987        st = memref.scripttext 
     988        nl = the number of lines of st 
     989        numlines = the number of lines of st 
     990        repeat with r = 1 to numlines 
     991           
     992          lin = line r of st 
     993           
     994          offs = offset("put ", lin) 
     995           
     996          if offs > 0 then 
     997             
     998            theLine = lin 
     999             
     1000             
     1001             
     1002            if ((offs = 1) or (char offs-1 of lin = " ")) then 
     1003               
     1004              linWOQuote = "" 
     1005              offs = offset(QUOTE, lin) 
     1006              repeat while offs > 0 
     1007                put char 1 to offs-1 of lin & " " after linWOQuote 
     1008                delete char 1 to offs of lin 
     1009                offs = offset(QUOTE, lin) 
     1010                if offs > 0 then 
     1011                  delete char 1 to offs of lin 
     1012                end if 
     1013                offs = offset(QUOTE, lin) 
     1014              end repeat 
     1015              put lin after linWOQuote 
     1016               
     1017              offs = offset("--", linWOQuote) 
     1018              if offs > 0 then 
     1019                delete char offs to length(linWOQuote) of linWOQuote 
     1020              end if 
     1021               
     1022              offs = offset("put ", linWOQuote) 
     1023               
     1024              if offs > 0 then 
     1025                 
     1026                 
     1027                if not(linWOQuote contains " into ") then 
     1028                  if not(linWOQuote contains " after ") then 
     1029                    if not(linWOQuote contains " before ") then 
     1030                      put "-----------" 
     1031                      le = length(st.line[1 .. r-1]) 
     1032                      put memref & ": line" && r & ":" && theLine & RETURN & "activateScriptEditor" && n & "," && l & "," && le & "," && le+1 & RETURN & "-----------" 
     1033                    end if 
     1034                  end if 
     1035                end if 
     1036              end if 
     1037            end if 
     1038          end if 
     1039           
     1040        end repeat 
     1041      end if 
     1042    end repeat 
     1043  end repeat 
     1044end 
    9771045 
    9781046 
     
    30223090-- export all scripts into a folder (I use this to compare to versions of a movie, open movie 1, export all scripts, open movie 2 and export all scripts and then compare with bbdiff both folders) 
    30233091 
    3024 on mExportAllScriptsToDisk me, skipIcons, selectionOnly, convertLineBreaksToUnix 
    3025    
    3026   theFolder = mGetFolderPathFromUser(me) 
     3092on mExportScriptsToFolder me, skipIcons, selectionOnly, convertLineBreaksToUnix, theFolder 
     3093  mExportAllScriptsToDiskWithFolder me, skipIcons, selectionOnly, convertLineBreaksToUnix 
     3094end 
     3095 
     3096-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     3097 
     3098on mExportAllScriptsToDiskWithFolder me, skipIcons, selectionOnly, convertLineBreaksToUnix, theFolder 
     3099   
     3100  theFolder = string(theFolder) 
     3101  if length(theFolder) < 1 then 
     3102    theFolder = mGetFolderPathFromUser(me) 
     3103  end if 
    30273104   
    30283105  if length(theFolder) < 1 then exit 
     
    32563333-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    32573334 
    3258 on mUpdateScriptsFromRepository me, thePath, selectionOnly 
     3335on mUpdateScriptsFromFolder me, thePath, selectionOnly 
    32593336   
    32603337  if selectionOnly = 1 then 
    3261     mUpdateSelectedScriptsFromRepository me, thePath 
     3338    mUpdateSelectedScriptsFromFolder me, thePath 
    32623339    exit 
    32633340  end if 
     
    32723349     
    32733350    if baFileExists(thePath & "memberInfo.xml") then 
    3274       mUpdateScriptCastlibFromRepository me, thePath 
     3351      mUpdateScriptCastlibFromFolder me, thePath 
    32753352    else 
    32763353      folderlist = bafolderlist(thePath) 
     
    32793356      repeat with n = 1 to cnt 
    32803357        if folderlist[n] starts "castlib" then 
    3281           mUpdateScriptCastlibFromRepository me, thePath & folderlist[n] & delim 
     3358          mUpdateScriptCastlibFromFolder me, thePath & folderlist[n] & delim 
    32823359        end if 
    32833360      end repeat 
     
    32953372-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    32963373 
    3297 on mUpdateScriptCastlibFromRepository me, thePath 
     3374on mUpdateScriptCastlibFromFolder me, thePath 
    32983375   
    32993376  infoList = mReadXML_2_List(me, thePath & "memberInfo.xml") 
     
    33453422-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    33463423 
    3347 on mUpdateSelectedScriptsFromRepository me, thePath 
     3424on mUpdateSelectedScriptsFromFolder me, thePath 
    33483425   
    33493426  thePath = string(thePath) 
     
    36723749on mSVN_Update_Working_Copy me, chooseNewPath 
    36733750   
    3674   svnBinary = mGetSVNBinaryPath(me) 
     3751  workingCopies = value(getPref("svn_workingCopies_paths.txt")) 
     3752  if ilk(workingCopies) <> #proplist then workingCopies = [:] 
     3753   
     3754  svnBinary = mGetSVNBinaryPath(me, workingCopies) 
    36753755  if length(svnBinary) < 1 then exit 
    36763756   
    3677   workingFolder = mGetWorkingCopyPath(me, the moviepath & the moviename, chooseNewPath) 
     3757  workingFolder = mGetWorkingCopyPath(me, the moviepath & the moviename, chooseNewPath, workingCopies) 
    36783758  if length(workingFolder) < 1 then exit 
    36793759   
     
    36903770  end if 
    36913771   
    3692 end 
    3693  
    3694 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    3695  
    3696 on mGetSVNBinaryPath me 
     3772  setPref("svn_workingCopies_paths.txt", string(workingCopies)) 
     3773   
     3774end 
     3775 
     3776 
     3777 
     3778-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     3779 
     3780on mSVN_Commit_CurrentScripts me, selected_Members_Only, chooseNewPath 
     3781   
     3782  workingCopies = value(getPref("svn_workingCopies_paths.txt")) 
     3783  if ilk(workingCopies) <> #proplist then workingCopies = [:] 
     3784   
     3785   
     3786  svnBinary = mGetSVNBinaryPath(me, workingCopies) 
     3787  if length(svnBinary) < 1 then exit 
     3788   
     3789  workingFolder = mGetWorkingCopyPath(me, the moviepath & the moviename, chooseNewPath, workingCopies) 
     3790  if length(workingFolder) < 1 then exit 
     3791   
     3792  msg = baPrompt("Commit message", "Enter commit message", "Commitmessage", 0, -2, -2) 
     3793   
     3794  if length(msg) < 1 then 
     3795    alert "You must enter a message for the commit action." 
     3796    exit 
     3797  end if 
     3798   
     3799  if workingCopies.getaprop(#dontWarnWhenSaving) <> 1 then 
     3800    answer = baMsgBoxEx("The movie will be saved before committing.", "Save movie?", "Save", "Cancel", "Always save", "Question", 1, "left", "Arial", 14, 4, -2, -2) 
     3801    if answer = "Cancel" then exit 
     3802    if answer = "Always save" then workingCopies.setaprop(#dontWarnWhenSaving, 1) 
     3803  end if 
     3804  saveMovie() 
     3805   
     3806  mExportAllScriptsToDiskWithFolder me, 1, selected_Members_Only, 1, workingFolder 
     3807   
     3808   
     3809   
     3810  if the platform contains "mac" then 
     3811    svnBinary = baUnixName(svnBinary) 
     3812    workingFolder = baUnixName(workingFolder) 
     3813  end if 
     3814   
     3815  theresult = shell_cmd_list(svnBinary && "status" && QUOTE & workingFolder & QUOTE) 
     3816   
     3817  cnt = count(theresult) 
     3818  if cnt < 1 then 
     3819    alert "Apparently there are no changes to the most recent version in the svn repository" 
     3820    exit 
     3821  end if 
     3822   
     3823  repeat with n = 1 to cnt 
     3824    answ = theresult[n] 
     3825    meth = word 1 of answ 
     3826    delete word 1 of answ 
     3827     
     3828    case meth of 
     3829      "!": -- deleted file (missing here, but in the repository present) 
     3830        -- I don't think, it is a good idea to delete the file in the repository in this case 
     3831        -- as it may also be the case, that we only have a subset of the castlibs/scripts 
     3832        -- therefore I just skip these files and leave it to the user what to do with them in his svn client application 
     3833        -- we only put a message, so the user is made aware of this fact 
     3834        put "Missing file!" && answ && "is missing here, but present in the repository" 
     3835         
     3836      "?": -- newly added file 
     3837        shell_cmd_list(svnBinary && "add" && QUOTE & answ & QUOTE) 
     3838         
     3839        put "Added file" && answ && "to the repository" 
     3840         
     3841      "m": 
     3842        -- just log the changes: 
     3843        put "Update file:" && answ 
     3844         
     3845    end case 
     3846     
     3847  end repeat 
     3848   
     3849  theresult = shell_cmd_list(svnBinary && "ci --message" && QUOTE & msg & QUOTE && QUOTE & workingFolder & QUOTE) 
     3850   
     3851   
     3852  if count(theresult) > 0 then 
     3853    alert "svn response:" && theresult[1] 
     3854  else 
     3855    alert "svn application did not respond, something seems to have failed. :-(" 
     3856  end if 
     3857   
     3858   
     3859  setPref("svn_workingCopies_paths.txt", string(workingCopies)) 
     3860   
     3861end 
     3862 
     3863 
     3864-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     3865---------- svn helper handlers 
     3866 
     3867on mGetSVNBinaryPath me, workingCopies 
    36973868   
    36983869  if (mCheckForXtra(me, "budapi") + mCheckForXtra(me, "shell")) < 2 then 
     
    37013872  end if 
    37023873   
    3703   workingCopies = value(getPref("svn_workingCopies_paths.txt")) 
    3704   if ilk(workingCopies) <> #proplist then workingCopies = [:] 
     3874  savePrefs = 0 
     3875  if ilk(workingCopies) <> #proplist then 
     3876    workingCopies = value(getPref("svn_workingCopies_paths.txt")) 
     3877    if ilk(workingCopies) <> #proplist then workingCopies = [:] 
     3878    savePrefs = 1 
     3879  end if 
     3880   
    37053881   
    37063882  if the platform contains "mac" then 
     
    37103886  end if 
    37113887   
    3712   if baFileExists(svnBinary) <> 1 then svnBinary = "" 
    3713    
    3714    
    3715   if length(svnBinary) < 1 then 
    3716      
    3717     svnBinary = [] 
    3718     if the platform contains "mac" then 
     3888  if the platform contains "mac" then -- dunno how to check on windows, if svn is installed, anyone ? 
     3889     
     3890    if baFileExists(svnBinary) <> 1 then svnBinary = "" 
     3891     
     3892     
     3893    if length(svnBinary) < 1 then 
     3894       
     3895      svnBinary = [] 
     3896       
    37193897      svnBinary = shell_cmd_list("for thisBinPath in /usr/bin /bin /usr/sbin /sbin /usr/local/sbin /usr/local/bin /opt/sbin /opt/bin /opt/local/sbin /opt/local/bin /sw/bin /sw/sbin ; do find $thisBinPath -name svn ; done") 
    3720     end if 
    3721      
    3722     if count(svnBinary) < 1 then 
    3723       alert "svn binary not found in your binaries folder. Where is the svn binary?" 
    3724       svnBinary = mGetFilePathFromUser(me) 
    3725       if length(svnBinary) < 1 then return "" 
    3726        
    3727     else 
    3728       svnBinary = baHFSName(svnBinary[1]) 
    3729        
    3730     end if 
    3731      
    3732   end if 
    3733    
    3734   if baFileExists(svnBinary) <> 1 then 
    3735     alert "The path to the svn binary seems to have changed. Please try again in order to search the path." 
    3736     svnBinary = "" 
    3737   end if 
     3898      -- end if 
     3899       
     3900      if count(svnBinary) < 1 then 
     3901        alert "svn binary not found in your binaries folder. Where is the svn binary?" 
     3902        svnBinary = mGetFilePathFromUser(me) 
     3903        if length(svnBinary) < 1 then return "" 
     3904         
     3905      else 
     3906        svnBinary = baHFSName(svnBinary[1]) 
     3907         
     3908      end if 
     3909       
     3910       
     3911    end if 
     3912     
     3913    if baFileExists(svnBinary) <> 1 then 
     3914      alert "The path to the svn binary seems to have changed. Please try again in order to search the path." 
     3915      svnBinary = "" 
     3916    end if 
     3917     
     3918     
     3919  else 
     3920    -- dunno how to check on windows, if svn is installed, anyone ? 
     3921    svnBinary = "svn" 
     3922  end if 
     3923   
    37383924   
    37393925  workingCopies.setaprop(#svnBinary, svnBinary) 
    3740   setPref("svn_workingCopies_paths.txt", string(workingCopies)) 
     3926   
     3927  if savePrefs = 1 then setPref("svn_workingCopies_paths.txt", string(workingCopies)) 
    37413928   
    37423929  return svnBinary 
     
    37463933-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    37473934 
    3748 on mGetWorkingCopyPath me, movieIdentifier, chooseNewPath 
     3935on mGetWorkingCopyPath me, movieIdentifier, chooseNewPath, workingCopies 
    37493936   
    37503937  movieIdentifier = string(movieIdentifier) 
     
    37533940  end if 
    37543941   
    3755   workingCopies = value(getPref("svn_workingCopies_paths.txt")) 
    3756   if ilk(workingCopies) <> #proplist then workingCopies = [:] 
     3942  savePrefs = 0 
     3943  if ilk(workingCopies) <> #proplist then 
     3944    workingCopies = value(getPref("svn_workingCopies_paths.txt")) 
     3945    if ilk(workingCopies) <> #proplist then workingCopies = [:] 
     3946    savePrefs = 1 
     3947  end if 
    37573948   
    37583949  workingFolder = string(workingCopies.getaprop(movieIdentifier)) 
     
    37893980  workingCopies.setaprop(movieIdentifier, workingFolder) 
    37903981   
    3791   setPref("svn_workingCopies_paths.txt", string(workingCopies)) 
     3982  if savePrefs = 1 then setPref("svn_workingCopies_paths.txt", string(workingCopies)) 
    37923983   
    37933984  return workingFolder 
     
    37953986end 
    37963987 
    3797  
    3798  
    3799 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    3800  
    3801 on mSVN_Commit_CurrentScripts me, selected_Members_Only, chooseNewPath 
    3802    
    3803   svnBinary = mGetSVNBinaryPath(me) 
    3804   if length(svnBinary) < 1 then exit 
    3805    
    3806   workingFolder = mGetWorkingCopyPath(me, the moviepath & the moviename, chooseNewPath) 
    3807   if length(workingFolder) < 1 then exit 
    3808    
    3809   msg = baPrompt("string Caption", "string Instruction", "string DefaultText", 0, -2, -2) 
    3810    
    3811   saveMovie() 
    3812    
    3813   if the platform contains "mac" then 
    3814     theresult = shell_cmd_list(baUnixName(svnBinary) && "ci" && QUOTE & msg & QUOTE && QUOTE & baUnixName(workingFolder) & QUOTE) 
    3815   else 
    3816     theresult = shell_cmd_list(svnBinary && "ci" && QUOTE & msg & QUOTE && QUOTE & workingFolder & QUOTE) 
    3817   end if 
    3818    
    3819   if count(theresult) > 0 then 
    3820     alert "svn response:" && theresult[1] 
    3821   else 
    3822     alert "svn application did not respond, something seems to have failed. :-(" 
    3823   end if 
    3824    
    3825 end 
    38263988 
    38273989 
  • trunk/lingosource/castlib2/memberInfo.xml

    r1 r2  
    11<?xml version="1.0" encoding="ISO-8859-1" ?> 
    22<Untitled> 
    3         <commonMovieScript> 
     3        <commonmoviescript> 
    44                <scriptType>#parent</scriptType> 
    55                <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 
    66                <memberName>commonMovieScript</memberName> 
    7         </commonMovieScript> 
     7        </commonmoviescript> 
    88        <FileIOFunktionen> 
    99                <scriptType>#parent</scriptType> 
     
    3636                <memberName>SpriteNameBeaver</memberName> 
    3737        </SpriteNameBeaver> 
     38        <commonmoviescript> 
     39                <scriptType>#parent</scriptType> 
     40                <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 
     41                <memberName>commonMovieScript</memberName> 
     42        </commonmoviescript> 
     43        <commonmoviescript> 
     44                <scriptType>#parent</scriptType> 
     45                <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 
     46                <memberName>commonMovieScript</memberName> 
     47        </commonmoviescript> 
     48        <commonmoviescript> 
     49                <scriptType>#parent</scriptType> 
     50                <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 
     51                <memberName>commonMovieScript</memberName> 
     52        </commonmoviescript> 
     53        <commonmoviescript> 
     54                <scriptType>#parent</scriptType> 
     55                <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 
     56                <memberName>commonMovieScript</memberName> 
     57        </commonmoviescript> 
     58        <commonmoviescript> 
     59                <scriptType>#parent</scriptType> 
     60                <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 
     61                <memberName>commonMovieScript</memberName> 
     62        </commonmoviescript> 
     63        <commonMovieScript> 
     64                <scriptType>#parent</scriptType> 
     65                <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 
     66                <memberName>commonMovieScript</memberName> 
     67        </commonMovieScript> 
    3868</Untitled> 
Note: See TracChangeset for help on using the changeset viewer.