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

Changeset 18


Ignore:
Timestamp:
10/24/08 12:12:09 (4 years ago)
Author:
alex
Message:

updated movie to incorporate new version of library scripts

Location:
trunk/lingosource
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/lingosource/castlib1/memberInfo.xml

    r14 r18  
    55                <comments>~/Documents/Scripts/lingo/defaultLayoutDefinitions.ls</comments> 
    66                <memberName>defaultLayoutDefinitions</memberName> 
    7                 <fName>defaultLayoutDefinitions</fName> 
     7                <fname>defaultLayoutDefinitions</fname> 
    88        </defaultLayoutDefinitions> 
    99        <thisMovieScript> 
     
    1111                <comments></comments> 
    1212                <memberName>thisMovieScript</memberName> 
    13                 <fName>thisMovieScript</fName> 
     13                <fname>thisMovieScript</fname> 
    1414        </thisMovieScript> 
    1515        <tempTextMem> 
     
    1717                <comments></comments> 
    1818                <memberName>tempTextMem</memberName> 
    19                 <fName>tempTextMem</fName> 
     19                <fname>tempTextMem</fname> 
    2020        </tempTextMem> 
    2121        <sceneGraphExplorer> 
     
    2323                <comments></comments> 
    2424                <memberName>sceneGraphExplorer</memberName> 
    25                 <fName>sceneGraphExplorer</fName> 
     25                <fname>sceneGraphExplorer</fname> 
    2626        </sceneGraphExplorer> 
    2727        <renamerField> 
     
    2929                <comments></comments> 
    3030                <memberName>renamerField</memberName> 
    31                 <fName>renamerField</fName> 
     31                <fname>renamerField</fname> 
    3232        </renamerField> 
    3333        <unfloatBeaver> 
     
    3535                <comments></comments> 
    3636                <memberName>unfloatBeaver</memberName> 
    37                 <fName>unfloatBeaver</fName> 
     37                <fname>unfloatBeaver</fname> 
    3838        </unfloatBeaver> 
    3939</Untitled> 
  • trunk/lingosource/castlib2/ButtonManagerHost.ls

    r14 r18  
    1 -- Button Behavior by Alex da Franca ©2003 da.Franca@online.de 
     1-- Button Behavior by Alex da Franca c2003 da.Franca@online.de 
    22-------------------------------------------------------------------- 
    33 
     
    8383on beginSprite me 
    8484   
    85   --  includes = (mGetAleXtras()).getaprop(#scripts) 
    86   --   
    87   --  ancestor = rawnew(includes.getaprop(#ButtonManager)) 
    88    
    8985   
    9086  scr = mGetXScript(#ButtonManager) 
    9187   
    92   if voidP(scr) then exit 
     88  if listP(scr) then exit 
     89  if ilk(scr) = #script then ancestor = rawnew(scr) 
     90  else ancestor = rawnew(scr.script) 
    9391   
    94   ancestor = rawnew(scr) 
    9592   
    9693  callAncestor(#new, me) 
     
    137134  liste = [:] 
    138135   
    139   --  includes = (mGetAleXtras()).getaprop(#scripts) 
    140   --  if voidP(includes) then 
    141   --    li = mGetAleXtras() 
    142   --    includes = [:] 
    143   --    li.setaprop(#scripts, includes) 
    144   --  end if 
    145   cmonm = mGetXScript(#commonmoviescript) 
    146   if not voidP(cmonm) then fontliste = call(#InitFonts, [cmonm]) 
     136  cmonm = mGetXScript() 
     137  if not voidP(cmonm) then fontliste = call(#InitFonts, cmonm) 
    147138   
    148139  if not listP(fontliste) then fontliste = ["Arial"] 
  • trunk/lingosource/castlib2/HierarchicalMenuManager_1.ls

    r15 r18  
    1 -- Manager Behavior for Hierarchical Menu by Alex da Franca ©2004 da.Franca@online.de 
     1-- Manager Behavior for Hierarchical Menu by Alex da Franca c2004 da.Franca@online.de 
    22----------------------------------------------------------------------------------- 
    33-- 
     
    13081308     
    13091309    tscr = mGetXScript(#Alex_HierMenuParent) 
    1310     if not(voidP(tscr)) then pMyHierMenu =  new(tscr) 
     1310    if not(listP(tscr)) then 
     1311      if ilk(tscr) = #instance then tscr = tscr.script 
     1312      pMyHierMenu =  new(tscr) 
     1313    end if 
    13111314     
    13121315  end if 
  • trunk/lingosource/castlib2/ToolTipBeaver_1Host.ls

    r14 r18  
    11-- ToolTip Behavior 
    2 -- by Alex da Franca ©2001   da.franca@online.de 
     2-- by Alex da Franca c2001   da.franca@online.de 
    33-- drag this behavior onto any sprite with the provided "ttimageSave" bitmap member 
    44-- customize the background color and the frame color of the tooltip by altering "ttimageSave" 
     
    5353on beginsprite me 
    5454   
    55   includes = (mGetAleXtras()).getaprop(#scripts) 
    56    
    57   ancestor = rawnew(includes.getaprop(#ToolTipBeaver_1)) 
     55  scr = xscr(#ToolTipBeaver_1) 
     56  if listP(scr) then exit 
     57  if ilk(scr) = #instance then scr = scr.script 
     58  ancestor = rawnew(scr) 
    5859  callAncestor(#new, me) 
    5960   
  • trunk/lingosource/castlib2/ToolTipSpriteBehavior_1.ls

    r14 r18  
    1313on beginSprite me 
    1414   
    15   pIncludes = (mGetAleXtras()).getaprop(#scripts) 
     15  pIncludes = [:] 
     16  pIncludes.setaprop(#commonmoviescript, xscr()) 
    1617   
    1718  pKanal = sprite(me.spritenum) 
     
    6667 
    6768on mouseLeave me 
    68   spr = call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)], #tooltipHG) 
     69  spr = call(#mGetKanal, pIncludes.getaprop(#commonmoviescript), #tooltipHG) 
    6970  if spr > 0 then ro = rollover(spr) 
    7071  else ro = 0 
     
    9495 
    9596on mHideMyTT me 
    96   sendSprite(call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)], #tooltipHG), #mHideToolTip) 
     97  sendSprite(call(#mGetKanal, pIncludes.getaprop(#commonmoviescript), #tooltipHG), #mHideToolTip) 
    9798end 
    9899 
  • trunk/lingosource/castlib2/aleXtraLoader.ls

    r14 r18  
    6868      else 
    6969         
    70         mediaList = mGetAleXtras() 
    71          
    72         theScripts = mediaList.getaprop(#scripts) 
    73         if ilk(theScripts) <> #proplist then 
    74           theScripts = [:] 
    75           mediaList.setaprop(#scripts, theScripts) 
    76         end if 
    77          
    78         theBitmaps = mediaList.getaprop(#bitmaps) 
    79         if ilk(theBitmaps) <> #proplist then 
    80           theBitmaps = [:] 
    81           mediaList.setaprop(#bitmaps, theBitmaps) 
    82         end if 
    83          
    84         tell sprite(me.spritenum) 
    85           cl = the number of castlibs 
    86           repeat with n = 1 to cl 
    87             num = the number of members of castlib cl 
    88             repeat with m = 1 to num 
    89               mem = member(m,n) 
    90               if length(mem.name) > 0 then 
    91                 if mem.type = #script then 
    92                   theScripts.setaProp(symbol(mem.name), mem.script) 
    93                 else if mem.type = #bitmap then 
    94                   theBitmaps.setaProp(symbol(mem.name), mem.image.duplicate()) 
    95                 end if 
    96               end if 
    97             end repeat 
    98           end repeat 
    99         end tell 
    100          
    101         --        ----------------------------------------------------------- 
    102         --        -- -- -- Debugging mode: 
    103         --         
    104         --                    mLoadScripts 
    105         --         
    106         --        -- // Debugging mode 
    107         --        ----------------------------------------------------------- 
     70        mLoadScriptsFromLDM me.spritenum 
    10871         
    10972        pLoaded = 1 
    110          
    111          
    11273         
    11374      end if 
  • trunk/lingosource/castlib2/aleXtrasMovieScript.ls

    r14 r18  
    1 -- LDM Xtras Moviescript -- ©05 Alex da Franca -- alex@farbflash.de 
     1-- aleXtrasMovieScript 
    22--------------------------------------------------------------------- 
    3  
    4 -- Requires: 
    5 -- nothing 
    6  
    7 -- Purpose: 
     3-- CREATED: 
     4-- 2005 
     5-- 
     6-- PROPERTIES: 
     7--!memberProperties: [#name: "aleXtrasMovieScript", #scripttype: #movie, #scriptSyntax: #lingo, #comments:"~/Documents/Scripts/lingo/aleXtrasMovieScript.ls"] 
     8-- 
     9-- DESCRIPTION: 
     10--             -- LDM Xtras Moviescript -- c05 Alex da Franca -- alex@farbflash.de 
    811-- store instances of scripts and bitmaps in a 'global' list (-> property pAleXtras) 
    912-- and provide access to them for all scripts 
    10  
    11 -- Usage: 
    12 -- put it in one of your castlib, DON'T RENAME MEMBER !! 
     13-- 
     14-- REQUIRES: 
     15--            script "commonmoviescript" 
     16-- 
     17-- USAGE: 
     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-- - 
     30-- 
     31-- TODO: 
     32--              - 
     33----------------------------------- 
    1334 
    1435property pAleXtras 
    1536 
    1637on mGetAleXtras 
     38   
     39  alextras = (script "aleXtrasMovieScript").pAleXtras 
     40  if not(objectP(alextras)) then 
     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) 
     52    if ilk(alextras) <> #instance then 
     53      alert "Script" & QUOTE & "commonMovieScript" & QUOTE && "is missing. This movie can't proceed!" 
     54      halt 
     55    end if 
     56    (script "aleXtrasMovieScript").pAleXtras = alextras 
     57  end if 
     58  return alextras 
     59  ----------------------------- 
     60   
    1761  alextras = (script "aleXtrasMovieScript").pAleXtras 
    1862  if voidP(alextras) then 
     
    2670 
    2771on xscr scrName 
     72  ----------------------------------- 
     73  --         CREATED: 11.02.2008 
     74  --         ACTION: Description 
     75  --         INPUT: - 
     76  --         RETURNS: - 
     77  --         CALLER: - 
     78  --         DEBUG: - 
     79  --         TODO: - 
     80  ----------------------------------- 
     81   
    2882  return mGetXScript(scrName) 
    2983end 
     
    3286 
    3387on mGetXScript scrName 
     88  ----------------------------------- 
     89  --         CREATED: 11.02.2008 
     90  --         ACTION: Description 
     91  --         INPUT: - 
     92  --         RETURNS: - 
     93  --         CALLER: - 
     94  --         DEBUG: - 
     95  --         TODO: - 
     96  ----------------------------------- 
     97   
     98  alextras = mGetAleXtras() 
     99  scrName = string(scrName) 
     100  if length(scrName) < 1 then return alextras 
     101  if scrName = "commonMovieScript" then return alextras 
     102   
     103  inst = alextras.mGetInstance(scrName, 1) 
     104  if ilk(inst) <> #instance then 
     105    if the runmode contains "aut" then 
     106      put "Script" && QUOTE & scrName & QUOTE && "is missing! This may cause unwanted behavior" 
     107    end if 
     108      inst = [] 
     109    end if 
     110  return inst 
     111  ---------------------- 
     112   
     113   
    34114  scrName = symbol(scrName) 
    35115  if ilk(scrName) <> #symbol then scrName = #commonmoviescript 
     
    61141 
    62142on mLoadScripts cls 
     143  ----------------------------------- 
     144  --         CREATED: 11.02.2008 
     145  --         ACTION: Description 
     146  --         INPUT: - 
     147  --         RETURNS: - 
     148  --         CALLER: - 
     149  --         DEBUG: - 
     150  --         TODO: - 
     151  ----------------------------------- 
     152  exit 
     153   
    63154   
    64155  mediaList = mGetAleXtras() 
     
    106197on mLoadXScript whichName 
    107198   
     199  exit 
     200   
     201   
    108202  whichName = string(whichName) 
    109203  if length(whichName) < 1 then return 0 
     
    130224 
    131225on mLoadScriptsFromLDM whichSprite 
     226   
     227  includes = [:]  
     228   
     229  tell sprite(whichSprite) 
     230    cl = the number of castlibs 
     231    repeat with n = 1 to cl 
     232      num = the number of members of castlib cl 
     233      repeat with m = 1 to num 
     234        mem = member(m,n) 
     235        if length(mem.name) > 0 then 
     236          if mem.type = #script then 
     237            includes.setaProp(symbol(mem.name), rawNew(mem.script)) 
     238          end if 
     239        end if 
     240      end repeat 
     241    end repeat 
     242  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 
     272   
     273  exit 
     274  ------------------------------ 
    132275   
    133276  mediaList = mGetAleXtras() 
     
    166309 
    167310on mListAleXtras 
     311  put "Handler mListAleXtras deprecated" 
     312  exit 
     313   
    168314  alextras = (script "aleXtrasMovieScript").pAleXtras 
    169315  if voidP(alextras) then mLoadScripts 
     
    215361  sel = the selection of castlib cl 
    216362   
    217   delim = the last char of the applicationpath 
     363   
     364  mp = the moviepath 
     365  if length(mp) < 1 then 
     366    if the runmode contains "plug" then 
     367      mp = "/" 
     368    else 
     369      mp = the applicationpath 
     370    end if 
     371  end if 
     372  delim = the last char of mp 
    218373   
    219374  the itemdelimiter = "/" 
  • trunk/lingosource/castlib2/memberInfo.xml

    r14 r18  
    55                <comments>~/Documents/Scripts/lingo/frameloop.ls</comments> 
    66                <memberName>frameloop</memberName> 
    7                 <fName>frameloop</fName> 
     7                <fname>frameloop</fname> 
    88        </frameloop> 
    99        <aleXtrasMovieScript> 
     
    1111                <comments>~/Documents/Scripts/lingo/aleXtrasMovieScript.ls</comments> 
    1212                <memberName>aleXtrasMovieScript</memberName> 
    13                 <fName>aleXtrasMovieScript</fName> 
     13                <fname>aleXtrasMovieScript</fname> 
    1414        </aleXtrasMovieScript> 
    1515        <aleXtraLoader> 
     
    1717                <comments>~/Documents/Scripts/lingo/aleXtraLoader.ls</comments> 
    1818                <memberName>aleXtraLoader</memberName> 
    19                 <fName>aleXtraLoader</fName> 
     19                <fname>aleXtraLoader</fname> 
    2020        </aleXtraLoader> 
    2121        <HierarchicalMenuManager_1> 
     
    2323                <comments>~/Documents/Scripts/lingo/HierarchicalMenuManager_1.ls</comments> 
    2424                <memberName>HierarchicalMenuManager_1</memberName> 
    25                 <fName>HierarchicalMenuManager_1</fName> 
     25                <fname>HierarchicalMenuManager_1</fname> 
    2626        </HierarchicalMenuManager_1> 
    2727        <HierMenu_DragNDrop> 
     
    2929                <comments>~/Documents/Scripts/lingo/HierMenu_DragNDrop.ls</comments> 
    3030                <memberName>HierMenu_DragNDrop</memberName> 
    31                 <fName>HierMenu_DragNDrop</fName> 
     31                <fname>HierMenu_DragNDrop</fname> 
    3232        </HierMenu_DragNDrop> 
    3333        <HierMenu_KeyboardControl> 
     
    3535                <comments>~/Documents/Scripts/lingo/HierMenu_KeyboardControl.ls</comments> 
    3636                <memberName>HierMenu_KeyboardControl</memberName> 
    37                 <fName>HierMenu_KeyboardControl</fName> 
     37                <fname>HierMenu_KeyboardControl</fname> 
    3838        </HierMenu_KeyboardControl> 
    3939        <HierMenu_Renamer> 
     
    4141                <comments>~/Documents/Scripts/lingo/HierMenu_Renamer.ls</comments> 
    4242                <memberName>HierMenu_Renamer</memberName> 
    43                 <fName>HierMenu_Renamer</fName> 
     43                <fname>HierMenu_Renamer</fname> 
    4444        </HierMenu_Renamer> 
    4545        <HierMenu_TextInputField> 
     
    4747                <comments>~/Documents/Scripts/lingo/HierMenu_TextInputField.ls</comments> 
    4848                <memberName>HierMenu_TextInputField</memberName> 
    49                 <fName>HierMenu_TextInputField</fName> 
     49                <fname>HierMenu_TextInputField</fname> 
    5050        </HierMenu_TextInputField> 
    5151        <simpletooltip_1> 
     
    5353                <comments>~/Documents/Scripts/lingo/simpletooltip_1.ls</comments> 
    5454                <memberName>simpletooltip_1</memberName> 
    55                 <fName>simpletooltip_1</fName> 
     55                <fname>simpletooltip_1</fname> 
    5656        </simpletooltip_1> 
    5757        <ButtonManagerHost> 
     
    5959                <comments>~/Documents/Scripts/lingo/ButtonManagerHost.ls</comments> 
    6060                <memberName>ButtonManagerHost</memberName> 
    61                 <fName>ButtonManagerHost</fName> 
     61                <fname>ButtonManagerHost</fname> 
    6262        </ButtonManagerHost> 
    6363        <ToolTipBeaver_1Host> 
     
    6565                <comments>~/Documents/Scripts/lingo/ToolTipBeaver_1Host.ls</comments> 
    6666                <memberName>ToolTipBeaver_1Host</memberName> 
    67                 <fName>ToolTipBeaver_1Host</fName> 
     67                <fname>ToolTipBeaver_1Host</fname> 
    6868        </ToolTipBeaver_1Host> 
    6969        <TTipTemplate> 
     
    7171                <comments></comments> 
    7272                <memberName>TTipTemplate</memberName> 
    73                 <fName>TTipTemplate</fName> 
     73                <fname>TTipTemplate</fname> 
    7474        </TTipTemplate> 
    7575        <ToolTipSpriteBehavior_1> 
     
    7777                <comments>~/Documents/Scripts/lingo/ToolTipSpriteBehavior_1.ls</comments> 
    7878                <memberName>ToolTipSpriteBehavior_1</memberName> 
    79                 <fName>ToolTipSpriteBehavior_1</fName> 
     79                <fname>ToolTipSpriteBehavior_1</fname> 
    8080        </ToolTipSpriteBehavior_1> 
    8181        <creditBeaver> 
     
    8383                <comments>~/Documents/Scripts/lingo/creditBeaver.ls</comments> 
    8484                <memberName>creditBeaver</memberName> 
    85                 <fName>creditBeaver</fName> 
     85                <fname>creditBeaver</fname> 
    8686        </creditBeaver> 
    8787        <newResizableStageBehavior> 
     
    8989                <comments>/Users/alex/Documents/ALIEN/myLinkedScripts/newResizableStageBehavior.ls</comments> 
    9090                <memberName>newResizableStageBehavior</memberName> 
    91                 <fName>newResizableStageBehavior</fName> 
     91                <fname>newResizableStageBehavior</fname> 
    9292        </newResizableStageBehavior> 
    9393        <resizeWindowScripts> 
     
    9595                <comments>~/Documents/Scripts/lingo/resizeWindowScripts.ls</comments> 
    9696                <memberName>resizeWindowScripts</memberName> 
    97                 <fName>resizeWindowScripts</fName> 
     97                <fname>resizeWindowScripts</fname> 
    9898        </resizeWindowScripts> 
    9999        <LinkScriptsMScript> 
     
    101101                <comments>/Users/alex/Documents/ALIEN/myLinkedScripts/LinkScriptsMScript.ls</comments> 
    102102                <memberName>LinkScriptsMScript</memberName> 
    103                 <fName>LinkScriptsMScript</fName> 
     103                <fname>LinkScriptsMScript</fname> 
    104104        </LinkScriptsMScript> 
    105105        <CastLabelsMScript> 
     
    107107                <comments>/Users/alex/Documents/ALIEN/myLinkedScripts/CastLabelsMScript.ls</comments> 
    108108                <memberName>CastLabelsMScript</memberName> 
    109                 <fName>CastLabelsMScript</fName> 
     109                <fname>CastLabelsMScript</fname> 
    110110        </CastLabelsMScript> 
    111111</Untitled> 
  • trunk/lingosource/castlib2/newResizableStageBehavior.ls

    r14 r18  
    11-- xxxx reposition or resize sprites for scalable movies 
    22-- New Version -> more simple -> just takes relative values for distances to the screen bound 
    3 -- Alex da Franca ©2002  da.franca@online.de 
     3-- Alex da Franca c2002  da.franca@online.de 
    44-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    55 
     
    1515property pPreserveAspect 
    1616property pCurrentRect 
     17 
     18property pResizeListenerList 
    1719 
    1820on beginsprite me 
     
    2022  pOldrect = pKanal.rect 
    2123  pCurrentRect = duplicate(pOldrect) 
     24   
     25  pResizeListenerList = [] 
    2226   
    2327  pCenterV = 0 
     
    6771 
    6872on endsprite me 
     73  pResizeListenerList = [] 
    6974  theMember = pKanal.member 
    7075  if theMember.type = #text then 
     
    9196  retlist[#pPreserveAspect] = [#format:#boolean, #default:0, #comment:"Preserve initial aspect ratio when scaling:"] 
    9297  return retlist 
     98end 
     99 
     100-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     101 
     102on RegisterForResizeEvent me, listenerList 
     103   
     104  if not(objectP(listenerList)) then return 0 
     105  if not(symbolP(listenerList[#handler])) then return 0 
     106  theTarget = listenerList[#target] 
     107  if not(objectP(theTarget)) then return 0 
     108   
     109  UnRegisterForResizeEvent me, theTarget 
     110   
     111  pResizeListenerList.add(listenerList) 
     112   
     113end 
     114 
     115-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     116 
     117on UnRegisterForResizeEvent me, atarget 
     118  repeat with n = count(pResizeListenerList) down to 1 
     119    if pResizeListenerList[n][#target] = atarget then 
     120      pResizeListenerList.deleteAt(n) 
     121      exit repeat 
     122    end if 
     123  end repeat 
     124end 
     125 
     126-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     127 
     128on mSendResizeEventToListeners me, newRect, oldRect 
     129  repeat with n = count(pResizeListenerList) down to 1 
     130    if objectP(pResizeListenerList[n][#target]) then 
     131      pResizeListenerList[n][#newRect] = newRect 
     132      pResizeListenerList[n][#oldRect] = oldRect 
     133      call(pResizeListenerList[n][#handler], [pResizeListenerList[n][#target]], pResizeListenerList[n]) 
     134    else 
     135      pResizeListenerList.deleteAt(n) 
     136    end if 
     137  end repeat 
    93138end 
    94139 
     
    195240      pCurrentRect = newR     
    196241    end if 
     242     
    197243    sendSprite(me.spritenum, #mRefreshSpriteRectAfterStageChange, newR, r) 
     244     
     245    mSendResizeEventToListeners me, newR, r 
    198246     
    199247  end if 
     
    290338  mRefreshResizeTargetRect me, newRect 
    291339end 
     340 
    292341-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    293342 
  • trunk/lingosource/castlib2/resizeWindowScripts.ls

    r14 r18  
    1  
     1-- resizeWindowScripts 
     2----------------------------------- 
     3-- CREATED: 
     4-- 2008-04-17 at 01:54 
     5-- 
     6-- PROPERTIES: 
     7--!memberProperties: [#name: "resizeWindowScripts", #scripttype: #movie, #scriptSyntax: #lingo, #comments:"~/Documents/Scripts/lingo/resizeWindowScripts.ls"] 
     8-- 
     9-- DESCRIPTION: 
     10--             moviescript to handle the resizeWindow event and send it to all sprites 
     11--             the sprites can have the "newResizableStageBehavior" in order to act according 
     12--             to their gpdl settings 
     13-- 
     14-- REQUIRES: 
     15-- (Prerequisites) 
     16-- 
     17-- USAGE: 
     18--             in order to make this script work initialize it as soon as possible (for example startmovie) 
     19--             and set the minimum and maximum sizes for the window 
     20-- 
    221-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    322-- xxxxxxxxxxxxxxxxxx add the following call to startmovie 
    4  
    5  
     23-- 
    624--on startmovie 
    725--  ... 
    8  
     26-- 
    927-- xxxxxxxxxxxxxxxxxx 
    1028-- edit the min and max sizes for the window here: 
     
    1331-- mInitResizeWindowSystem minmaxSize 
    1432-- ... 
    15  
     33-- 
    1634--  end 
     35----------------------------------- 
     36 
    1737 
    1838 
     
    167187    newRect = aw.rect 
    168188     
    169     glob = call(#mGetGlobalList, [mGetXScript(#commonmoviescript)]) 
     189    glob = call(#mGetGlobalList, mGetXScript()) 
    170190    oldar = glob.getaprop(#gCurrentStageRect) 
    171191     
     
    218238  else 
    219239     
    220     theRect = call(#mGetPrefValue, [mGetXScript(#GetSetPrefs)], #gWindowRect) 
     240    theRect = call(#mGetPrefValue, mGetXScript(#GetSetPrefs), #gWindowRect) 
    221241     
    222242    if ilk(theRect) = #rect then 
  • trunk/lingosource/castlib2/simpletooltip_1.ls

    r14 r18  
    1414property pThreedChannelName, pOverlayCreated 
    1515 
    16 property pIncludes 
    17  
    1816-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    1917-- DIRECTOR EVENTS 
     
    2119 
    2220on beginsprite me 
    23    
    24   pIncludes = (mGetAleXtras()).getaprop(#scripts) 
    2521   
    2622  pSavedMem = sprite(me.spritenum).member 
     
    3127  pOverlayCreated = 0 
    3228   
    33   call(#mMeldeKanalname, [pIncludes.getaprop(#commonmoviescript)], #tooltipHG, me.spritenum) 
     29  xscr().mMeldeKanalname(#tooltipHG, me.spritenum) 
    3430end 
    3531 
     
    3733 
    3834on endsprite me 
    39   call(#mMeldeAbKanalname, [pIncludes.getaprop(#commonmoviescript)], #tooltipHG, me.spritenum) 
     35  xscr().mMeldeAbKanalname(#tooltipHG, me.spritenum) 
    4036  mTTverschwinde me 
    4137  sprite(me.spritenum).member = pSavedMem 
     
    6662  theSprite = sprite(me.spritenum) 
    6763   
    68   derkanal = call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)], pThreedChannelName) 
     64  derkanal = xscr().mGetKanal(pThreedChannelName) 
    6965  if derkanal > 0 then 
    7066    trect = rect(theLoc[1], theLoc[2], (theLoc[1] + theImg.width), (theLoc[2] + theImg.height)) 
     
    129125 
    130126on mCreateOverlay me, spritename, whichImg, theLoc, maskImg 
    131    
    132   kanal = call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)], spritename) 
     127  xscr = xscr() 
     128  kanal = xscr.mGetKanal(spritename) 
    133129  if kanal < 1 then return 0 
    134130  kanal = sprite(kanal) 
     
    145141  breite = whichImg.width 
    146142  hoehe = whichImg.height 
    147   powerbreite = call(#mGetNextPowerOfTwo, [pIncludes.getaprop(#commonmoviescript)], breite) 
    148   powerhoehe = call(#mGetNextPowerOfTwo, [pIncludes.getaprop(#commonmoviescript)], hoehe) 
     143  powerbreite = xscr.mGetNextPowerOfTwo(breite) 
     144  powerhoehe = xscr.mGetNextPowerOfTwo(hoehe) 
    149145   
    150146  if ilk(maskImg) = #image then 
     
    190186on mDeleteOverlay me, spritename 
    191187   
    192   kanal = call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)], spritename) 
     188  kanal = xscr().mGetKanal(spritename) 
    193189  if kanal < 1 then return 0 
    194190  kanal = sprite(kanal) 
  • trunk/lingosource/castlib3/Alex_HierMenuParent.ls

    r15 r18  
    1 -- Hierarchisches Menu by Alex da Franca ©2001 da.Franca@online.de 
     1-- Hierarchisches Menu by Alex da Franca c2001 da.Franca@online.de 
    22------------------------------------------------------------------ 
    33 
     
    212212   
    213213  pMyScrollBarScript = mGetXScript(#SliderScrollbarMenuParent) 
    214   if not voidP(pMyScrollBarScript) then pMyScrollBarScript = new(pMyScrollBarScript) 
     214  if not listP(pMyScrollBarScript) then 
     215    if ilk(pMyScrollBarScript) = #instance then pMyScrollBarScript = pMyScrollBarScript.script 
     216    pMyScrollBarScript = new(pMyScrollBarScript) 
     217  else 
     218    pMyScrollBarScript = 0 
     219  end if 
    215220   
    216221  pShadowScript = mGetXScript(#DropShadowPScript) 
    217   if not voidP(pShadowScript) then pShadowScript = new(pShadowScript) 
     222  if not listP(pShadowScript) then 
     223    if ilk(pShadowScript) = #instance then pShadowScript = pShadowScript.script 
     224    pShadowScript = new(pShadowScript) 
     225  else 
     226    pShadowScript = 0 
     227  end if 
    218228   
    219229  return me 
     
    16061616   
    16071617  -- properties dieses behviors global speichern, damit beim naechsten beginsprite dieses behaviors der alte zustand wieder hergestellt wird (z.B. bei einem sprung in ein anderes movie) 
     1618  if objectP(pMenuProps) then 
    16081619  if pMenuProps.getaprop(#saveProps) then 
    16091620    global gSicherprop 
     
    16171628  end if 
    16181629  --  (the actorlist).deleteOne(me) 
     1630  end if 
    16191631   
    16201632  -- aufraeumen 
     
    18911903      if pMyScrollBarScript.mGetEnabled() <> 1 then 
    18921904        mUpdateScrollBarRect me 
    1893         pMyScrollBarScript.SetEnabled(1) 
     1905      pMyScrollBarScript.SetEnabled(1) 
    18941906      end if 
    18951907       
     
    19721984    if ilk(pShadowScript) <> #instance then 
    19731985      pShadowScript = mGetXScript(#DropShadowPScript) 
    1974       if not voidP(pShadowScript) then pShadowScript = new(pShadowScript) 
     1986      if not listP(pShadowScript) then 
     1987        if ilk(pShadowScript) = #instance then pShadowScript = pShadowScript.script 
     1988        pShadowScript = new(pShadowScript) 
     1989      else 
     1990        pShadowScript = 0 
     1991      end if 
    19751992    end if 
    19761993     
     
    21212138       
    21222139      if ilk(hgfarbe) = #color then 
    2123         ttimg.fill(ttimg.rect, hgfarbe) 
     2140      ttimg.fill(ttimg.rect, hgfarbe) 
    21242141      else if hgfarbe = #image then 
    21252142        ttimg.copypixels(hgfarbe, ttimg.rect, hgfarbe.rect) 
     
    31713188      dertimer = the ticks 
    31723189      --    dieAnimTime = min((abs(pAnimStart) * max(2,(15 / abs(pAnimStart)))), 40) 
    3173       dieAnimTime = min((abs(pAnimStart) * 5), 40) -- animationszeit abhaengig von der hoehe des stuecks, das animiert wird,, jedoch maximal 40 ms 
     3190      dieAnimTime = min((abs(pAnimStart) * 5), 25) -- animationszeit abhaengig von der hoehe des stuecks, das animiert wird,, jedoch maximal 40 ms 
    31743191      diebeschl = 12.0 
    31753192       
     
    35013518      --------------------------------- 
    35023519       
    3503       if usealternateColor then 
    3504         if n mod 2 then 
    3505           derlocVHL = pZeilenhoehe * (n - pScrollOffset) 
    3506           tr = rect(0, (derlocVHL + obenoffset + 1), (pBuffImg.rect.right - 1), (derlocV + 1 + obenoffset - pMenuProps.getaprop(#myLineWidth))) 
    3507           pBuffImg.fill(tr, alternateColor) 
    3508           if usealph then 
    3509             pAlphaImage.fill(tr, rgb(0,0,0)) 
    3510           end if 
    3511           treeviewdata.setaprop(#alternatecolor, 1) 
    3512         else 
    3513           treeviewdata.setaprop(#alternatecolor, 0) 
    3514         end if 
    3515       end if 
    3516        
     3520    if usealternateColor then 
     3521      if n mod 2 then 
     3522        derlocVHL = pZeilenhoehe * (n - pScrollOffset) 
     3523        tr = rect(0, (derlocVHL + obenoffset + 1), (pBuffImg.rect.right - 1), (derlocV + 1 + obenoffset - pMenuProps.getaprop(#myLineWidth))) 
     3524        pBuffImg.fill(tr, alternateColor) 
     3525        if usealph then 
     3526          pAlphaImage.fill(tr, rgb(0,0,0)) 
     3527        end if 
     3528        treeviewdata.setaprop(#alternatecolor, 1) 
     3529      else 
     3530        treeviewdata.setaprop(#alternatecolor, 0) 
     3531      end if 
     3532    end if 
     3533     
    35173534    end if 
    35183535     
     
    37333750    if ilk(pStrichel) = #image then 
    37343751       
    3735       -- strichellinie: 
    3736       --    strichzahl = templiste.stelleH - 1 
    3737       strichzahl = stelleH - 1 
    3738        
    3739       oben = derlocV + obenoffset - pZeilenhoehe 
    3740       unten = oben + pStrichel.rect.height 
    3741       links = STRlinks 
    3742        
    3743       if ilk(pAlphaImage) = #image then 
    3744          
    3745         repeat with z = 1 to strichzahl 
    3746           pBuffImg.copyPixels(pStrichel, rect(links, oben, (links + 1), unten), pStrichel.rect) 
    3747           pAlphaImage.copyPixels(pStrichelAlpha, rect(links, oben, (links + 1), unten), pStrichel.rect, [#ink:#darkest]) 
    3748           links = links + tabAbstand 
    3749         end repeat 
    3750          
    3751       else 
    3752         repeat with z = 1 to strichzahl 
    3753           pBuffImg.copyPixels(pStrichel, rect(links, oben, (links + 1), unten), pStrichel.rect) 
    3754           links = links + tabAbstand 
    3755         end repeat 
    3756       end if 
    3757        
     3752    -- strichellinie: 
     3753    --    strichzahl = templiste.stelleH - 1 
     3754    strichzahl = stelleH - 1 
     3755     
     3756    oben = derlocV + obenoffset - pZeilenhoehe 
     3757    unten = oben + pStrichel.rect.height 
     3758    links = STRlinks 
     3759     
     3760    if ilk(pAlphaImage) = #image then 
     3761       
     3762      repeat with z = 1 to strichzahl 
     3763        pBuffImg.copyPixels(pStrichel, rect(links, oben, (links + 1), unten), pStrichel.rect) 
     3764        pAlphaImage.copyPixels(pStrichelAlpha, rect(links, oben, (links + 1), unten), pStrichel.rect, [#ink:#darkest]) 
     3765        links = links + tabAbstand 
     3766      end repeat 
     3767       
     3768    else 
     3769      repeat with z = 1 to strichzahl 
     3770        pBuffImg.copyPixels(pStrichel, rect(links, oben, (links + 1), unten), pStrichel.rect) 
     3771        links = links + tabAbstand 
     3772      end repeat 
     3773    end if 
     3774     
    37583775    end if 
    37593776     
  • trunk/lingosource/castlib3/ButtonImageCreator.ls

    r15 r18  
    33-- xxxxxxxxxxxxxxxxxx global handlers to create images for widgets 
    44-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    5 -- Alex da Franca ©2003 da.franca@online.de 
     5-- Alex da Franca c2003 da.franca@online.de 
    66 
    77 
     
    3838--------------------------------- 
    3939-- Scriptmarker: changes alex (24.07.2006 at 09:32 Uhr) // Scriptmarker 
     40 
    4041 
    4142-- added support for a proplist as #buttonIcon, so that different icons for the different button states can be used 
     
    99100        templateTextMember.text = "MM" 
    100101        th = templateTextMember.charPosToLoc(2) 
    101         textimg = image(th[1],th[2],8,0,#grayscale) 
     102        textimg = image(max(1, th[1]),max(1, th[2]),8,0,#grayscale) 
    102103      end if 
    103104       
     
    258259        end if 
    259260         
    260         buttonIconW = hoehe - marginV*2 
     261        buttonIconW = min(breite, hoehe) - marginV*2 
     262        buttonIconW = min(16, buttonIconW) 
    261263        buttonIcon = image(buttonIconW, buttonIconW, 32, 1) 
    262264         
     
    279281  if noText = 1 then breite = max(marginH, myRect.width) 
    280282   
    281   dasRect = rect(0, 0, breite + buttonIconW, hoehe + buttonIconH) 
     283  if noText <> 1 then 
     284    dasRect = rect(0, 0, breite + buttonIconW, hoehe + buttonIconH) 
     285  else 
     286    dasRect = rect(0, 0, breite, hoehe) 
     287  end if 
    282288   
    283289  -- offset: 
     
    343349  end if 
    344350   
     351  alteMaske = 0 
    345352  if img.depth = 32 then alteMaske = img.extractAlpha() 
    346353   
     
    388395      else buffsH = textbreite - buttonIconW + shadowOffs[1] 
    389396       
    390       img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 
     397      buffsV = (dasRect.height - buttonIcon.height) / 2 + shadowOffs[2] 
     398       
     399      img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
    391400    end if 
    392401     
     
    401410        else buffsH = textbreite - buttonIconW + shadowOffs[1] 
    402411         
    403         img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 
     412        buffsV = (dasRect.height - buttonIcon.height) / 2 + shadowOffs[2] 
     413         
     414        img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
    404415      end if 
    405416       
     
    409420         
    410421        if noText = 1 then 
    411           if buttonIconAlign = #right then buffsH = dasRect.width - buttonIconW + shadowOffs[1] 
    412           else buffsH = marginH + shadowOffs[1] 
    413           img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 
     422          --          if buttonIconAlign = #right then buffsH = dasRect.width - buttonIconW + shadowOffs[1] 
     423          --          else buffsH = marginH + shadowOffs[1] 
     424          ----------- just align center 
     425           
     426          buffsH = (dasRect.width - buttonIcon.width) / 2 + shadowOffs[1] 
     427          buffsV = (dasRect.height - buttonIcon.height) / 2 + shadowOffs[2] 
     428          img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
     429           
    414430        else 
    415431          if buttonIconAlign = #right then buffsH = dasRect.width - buttonIconW + shadowOffs[1] 
     
    488504    end if 
    489505     
     506    alteMaske = 0 
    490507    if img.depth = 32 then alteMaske = img.extractAlpha() 
    491508     
     
    563580      if noText = 1 then 
    564581         
    565         if buttonIconAlign = #right then buffsH = dasRect.width - buttonIconW + shadowOffs[1] 
    566         else buffsH = marginH + shadowOffs[1] 
    567          
    568         img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 
     582        --          if buttonIconAlign = #right then buffsH = dasRect.width - buttonIconW + shadowOffs[1] 
     583        --          else buffsH = marginH + shadowOffs[1] 
     584        ----------- just align center 
     585         
     586        buffsH = (dasRect.width - buttonIcon.width) / 2 + shadowOffs[1] 
     587        buffsV = (dasRect.height - buttonIcon.height) / 2 + shadowOffs[2] 
     588        img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
     589         
     590         
     591        -- img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 
    569592      else 
    570593         
     
    572595        else buffsH = textbreite - buttonIconW + shadowOffs[1] 
    573596         
    574         img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 
     597        buffsV = (dasRect.height - buttonIcon.height) / 2 + shadowOffs[2] 
     598         
     599        img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
    575600      end if 
    576601    end if 
     
    639664    end if 
    640665     
     666    alteMaske = 0 
    641667    if img.depth = 32 then alteMaske = img.extractAlpha() 
    642668     
     
    686712        --        else buffsH = marginH + shadowOffs[1] 
    687713         
    688         img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 
     714        -- img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 
     715        img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
    689716      else 
    690717         
     
    692719        --        else buffsH = textbreite - buttonIconW + shadowOffs[1] 
    693720         
    694         img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 
     721        img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
    695722      end if 
    696723    end if 
     
    760787    end if 
    761788     
     789    alteMaske = 0 
    762790    if img.depth = 32 then alteMaske = img.extractAlpha() 
    763791     
     
    807835      if noText = 1 then 
    808836         
    809         --        img.copyPixels(buttonIcon, buttonIcon.rect.offset(marginH + shadowOffs[1], marginV + shadowOffs[2]), buttonIcon.rect) 
    810         img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 
     837        --        --        img.copyPixels(buttonIcon, buttonIcon.rect.offset(marginH + shadowOffs[1], marginV + shadowOffs[2]), buttonIcon.rect) 
     838        --        img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 
     839         
     840        img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
    811841         
    812842      else 
    813843        --        img.copyPixels(buttonIcon, buttonIcon.rect.offset(textbreite - buttonIconW + shadowOffs[1], marginV + shadowOffs[2]), buttonIcon.rect) 
    814         img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 
     844        img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
    815845      end if 
    816846    end if 
     
    886916    end if 
    887917     
     918    alteMaske = 0 
    888919    if img.depth = 32 then alteMaske = img.extractAlpha() 
    889920     
     
    921952      if noText = 1 then 
    922953         
    923         img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 
     954        img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
     955        --        img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 
    924956      else 
    925957         
    926         img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, marginV + shadowOffs[2]), buttonIcon.rect) 
     958        img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
    927959      end if 
    928960    end if 
     
    12111243             
    12121244            --          -- museum hack fuer zweifarbige rahmen: 
    1213             if call(#mGetThisMovieName, mGetXScript(#commonMovieScript)) = "Kindermuseum" then trect = trect.inflate(-1, -1) -- weisser 1-pixel rahmen 
     1245            if call(#mGetThisMovieName, mGetXScript()) = "Kindermuseum" then trect = trect.inflate(-1, -1) -- weisser 1-pixel rahmen 
    12141246             
    12151247            tempImg.fill(trect, rahmenfarbe) 
     
    13961428 
    13971429-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1430 
    13981431on mCreateDropDownTriangle me, rHeight 
    13991432   
     
    14311464-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    14321465 
     1466on mCreateCheckBoxButton me, theLabel, options, retlist 
     1467   
     1468  if ilk(options) <> #proplist then options = [:] 
     1469   
     1470  textimg = theLabel 
     1471   
     1472  cms = mGetXScript() 
     1473  ius = mGetXScript(#imageUtilityScripts) 
     1474   
     1475  if ilk(textimg) <> #image then 
     1476    theString = call(#mTranslate, cms, string(textimg)) 
     1477    if theString.length then 
     1478      maxW = options.getaprop(#maxWidth) 
     1479      if ilk(maxW) <> #integer then maxW = 500 
     1480      textimg = call(#mGetTextImage, ius, theString, options, maxW, member("buttontexttempl"), options.getaprop(#dontwrap)) 
     1481       
     1482    else 
     1483      -- no text and no image ?! just return 
     1484      if ilk(retlist) <> #proplist then return [:] 
     1485      return retlist 
     1486       
     1487    end if 
     1488  end if 
     1489   
     1490  myRect = options.getaprop(#myRect) 
     1491  if ilk(myRect) <> #rect then myRect = rect(0,0,2,2) 
     1492   
     1493  texthoehe = textimg.height 
     1494  textbreite = textimg.width 
     1495   
     1496  marginH = options.getaprop(#marginH) 
     1497  marginV = options.getaprop(#marginV) 
     1498   
     1499  hoehe = max((texthoehe + (marginV * 2)), myRect.height) 
     1500  breite = max((textbreite + (marginH * 2)), myRect.width) 
     1501   
     1502   
     1503  if (textimg.depth = 1) or ((textimg.depth = 8) and (textimg.paletteref = #grayscale)) then 
     1504    temp = image(textbreite, texthoehe, 32) 
     1505    fontfarbe = options.getaprop(#myFontcolor) 
     1506    if ilk(fontfarbe) <> #color then 
     1507      fontfarbe = rgb(0,0,0) 
     1508      options[#myFontcolor] = fontfarbe 
     1509    end if 
     1510    temp.fill(temp.rect, fontfarbe) 
     1511     
     1512    temp2 = textimg 
     1513     
     1514  else 
     1515    temp = textimg 
     1516     
     1517    if temp.depth = 32 then 
     1518      temp.useAlpha = 0 
     1519      temp2 = temp.extractAlpha() 
     1520    else 
     1521      temp2 = image(temp.width, temp.height, 8, 0, #grayscale) 
     1522      temp2.fill(temp2.rect, rgb(0,0,0)) 
     1523    end if 
     1524     
     1525  end if 
     1526   
     1527   
     1528   
     1529  buttonIconType = options.getaprop(#buttonIcon) 
     1530   
     1531   
     1532  buttonIconList = [:] 
     1533   
     1534  hlfarbe = options.getaprop(#pressedColor) 
     1535  if ilk(hlfarbe) <> #color then hlfarbe = options.getaprop(#selectedColor) 
     1536  if ilk(hlfarbe) <> #color then hlfarbe = options.getaprop(#myFontColor) 
     1537   
     1538  if ilk(buttonIconType) = #image then 
     1539    buttonIcon = buttonIconType 
     1540    buttonIconW = buttonIcon.width + marginH 
     1541    buttonIconH = max(0, (buttonIcon.height + marginV*2) - hoehe) 
     1542     
     1543    buttonIconList.setaprop(#normal, buttonIcon) 
     1544     
     1545  else if ilk(buttonIconType) = #proplist then 
     1546    buttonIcon = buttonIconType.getaprop(#normal) 
     1547    if ilk(buttonIcon) = #image then 
     1548      buttonIconList = buttonIconType 
     1549      buttonIconW = buttonIcon.width + marginH 
     1550      buttonIconH = max(0, (buttonIcon.height + marginV*2) - hoehe) 
     1551    else 
     1552      buttonIconW = 0 
     1553      buttonIconH = 0 
     1554    end if 
     1555     
     1556  else 
     1557    case buttonIconType of 
     1558      #checkbox: 
     1559         
     1560        if ilk(fontfarbe) <> #color then 
     1561          fontfarbe = options.getaprop(#myFontcolor) 
     1562          if ilk(fontfarbe) <> #color then 
     1563            fontfarbe = rgb(0,0,0) 
     1564            options[#myFontcolor] = fontfarbe 
     1565          end if 
     1566        end if 
     1567         
     1568        buttonIconW = hoehe - marginV*2 
     1569        buttonIcon = image(buttonIconW, buttonIconW, 32, 1) 
     1570        buttonIcon.fill(buttonIcon.rect, fontfarbe) 
     1571        buttonIconM = image(buttonIconW, buttonIconW, 8, 0, #grayscale) 
     1572        buttonIconM.draw(buttonIconM.rect, [#linesize:1, #shapetype:#rect, #color:rgb(0,0,0)]) 
     1573        buttonIcon.setAlpha(buttonIconM) 
     1574         
     1575        buttonIconW = buttonIconW + marginH 
     1576        buttonIconH = 0 
     1577         
     1578        buttonIconList.setaprop(#normal, buttonIcon.duplicate()) 
     1579         
     1580         
     1581         
     1582        if ilk(hlfarbe) = #color then buttonIcon.fill(buttonIcon.rect, hlfarbe) 
     1583        buttonIconM.draw(point(0, 0), point(buttonIconM.width, buttonIconM.height), [#linesize:1, #shapetype:#line, #color:rgb(0,0,0)]) 
     1584        buttonIconM.draw(point(0, buttonIconM.height), point(buttonIconM.width, 0), [#linesize:1, #shapetype:#line, #color:rgb(0,0,0)]) 
     1585        buttonIcon.setAlpha(buttonIconM) 
     1586         
     1587        buttonIconList.setaprop(#pressed, buttonIcon) 
     1588         
     1589      #radiobutton: 
     1590         
     1591        if ilk(fontfarbe) <> #color then 
     1592          fontfarbe = options.getaprop(#myFontcolor) 
     1593          if ilk(fontfarbe) <> #color then 
     1594            fontfarbe = rgb(0,0,0) 
     1595            options[#myFontcolor] = fontfarbe 
     1596          end if 
     1597        end if 
     1598         
     1599        buttonIconW = hoehe - marginV*2 
     1600        buttonIcon = image(buttonIconW, buttonIconW, 32, 1) 
     1601        buttonIcon.fill(buttonIcon.rect, fontfarbe) 
     1602        buttonIconM = image(buttonIconW, buttonIconW, 8, 0, #grayscale) 
     1603        buttonIconM.draw(buttonIconM.rect, [#linesize:1, #shapetype:#oval, #color:rgb(0,0,0)]) 
     1604        buttonIcon.setAlpha(buttonIconM) 
     1605         
     1606        buttonIconW = buttonIconW + marginH 
     1607        buttonIconH = 0 
     1608         
     1609        buttonIconList.setaprop(#normal, buttonIcon.duplicate()) 
     1610         
     1611        if ilk(hlfarbe) = #color then buttonIcon.fill(buttonIcon.rect, hlfarbe) 
     1612        buttonIconM.fill(buttonIconM.rect.inflate(-3, -3), [#shapetype:#oval, #color:rgb(0,0,0)]) 
     1613        buttonIcon.setAlpha(buttonIconM) 
     1614         
     1615        buttonIconList.setaprop(#pressed, buttonIcon) 
     1616         
     1617      #dropdown: 
     1618         
     1619        if ilk(fontfarbe) <> #color then 
     1620          fontfarbe = options.getaprop(#myFontcolor) 
     1621          if ilk(fontfarbe) <> #color then 
     1622            fontfarbe = rgb(0,0,0) 
     1623            options[#myFontcolor] = fontfarbe 
     1624          end if 
     1625        end if 
     1626         
     1627        buttonIconW = min(breite, hoehe) - marginV*2 
     1628        buttonIconW = min(16, buttonIconW) 
     1629        buttonIcon = image(buttonIconW, buttonIconW, 32, 1) 
     1630         
     1631        buttonIcon.fill(buttonIcon.rect, fontfarbe) 
     1632         
     1633        buttonIconM = mCreateDropDownTriangle(me, buttonIconW) 
     1634        buttonIcon.setAlpha(buttonIconM) 
     1635         
     1636        buttonIconW = buttonIconW + marginH 
     1637        buttonIconH = 0 
     1638         
     1639        buttonIconList.setaprop(#normal, buttonIcon) 
     1640         
     1641      otherwise 
     1642        buttonIconW = 0 
     1643        buttonIconH = 0 
     1644        buttonIcon = 0 
     1645         
     1646        buttonIconList = [:] 
     1647         
     1648    end case 
     1649  end if 
     1650   
     1651  dasRect = rect(0, 0, breite + buttonIconW, hoehe + buttonIconH) 
     1652   
     1653  texthoehe = (dasRect.height - texthoehe) / 2 
     1654  textbreite = marginH + buttonIconW 
     1655   
     1656  ----------------------------- 
     1657  textoffset = options.getaprop(#textoffset) 
     1658  if ilk(textoffset) = #point then 
     1659    textbreite = textbreite + textoffset[1] 
     1660    texthoehe = texthoehe + textoffset[2] 
     1661  end if 
     1662  ----------------------------- 
     1663   
     1664  if ilk(retlist) <> #proplist then 
     1665    retlist = [:] 
     1666    retlist[#normal] = 1 
     1667    retlist[#pressed] = 1 
     1668    retlist[#hilite] = 1 
     1669    retlist[#disabled] = 1 
     1670    retlist[#selected] = 1 
     1671  end if 
     1672   
     1673   
     1674   
     1675  buffsH = textbreite - buttonIconW 
     1676  if ilk(buttonIcon) = #image then 
     1677    buffsV = (dasRect.height - buttonIcon.height) / 2 
     1678  else 
     1679    buffsV = 0 
     1680  end if 
     1681   
     1682  img = image(dasrect.width, dasrect.height, 32, 1) 
     1683  aImg = image(img.width, img.height, 8, 0, #grayscale) 
     1684  img.useAlpha = 0 
     1685   
     1686  img.copyPixels(temp, temp.rect.offset(textbreite, texthoehe), temp.rect) 
     1687  aImg.copyPixels(temp2, temp2.rect.offset(textbreite, texthoehe), temp2.rect) 
     1688   
     1689  buttonIcon = buttonIconList.getaprop(#normal) 
     1690  if ilk(buttonIcon) = #image then 
     1691    if buttonIcon.depth = 32 then 
     1692      buttonIcon.useAlpha = 0 
     1693      buttonIconA = buttonIcon.extractAlpha() 
     1694    else 
     1695      buttonIconA = image(buttonIcon.width, buttonIconA.height, 8, 0, #grayscale) 
     1696      buttonIconA.fill(buttonIconA.rect, rgb(0,0,0)) 
     1697    end if 
     1698     
     1699    img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
     1700    aImg.copyPixels(buttonIconA, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
     1701  end if 
     1702   
     1703  img.setAlpha(aImg) 
     1704  img.useAlpha = 1 
     1705   
     1706  retlist[#normal] = img 
     1707   
     1708  ------------------------------- 
     1709   
     1710  if not(voidP(retlist.getaprop(#pressed))) then 
     1711     
     1712    hlfarbe = options.getaprop(#pressedColor) 
     1713    if ilk(hlfarbe) = #color then temp.fill(temp.rect, hlfarbe) 
     1714     
     1715    img = image(dasrect.width, dasrect.height, 32, 1) 
     1716    aImg = image(img.width, img.height, 8, 0, #grayscale) 
     1717    img.useAlpha = 0 
     1718     
     1719    img.copyPixels(temp, temp.rect.offset(textbreite, texthoehe), temp.rect) 
     1720    aImg.copyPixels(temp2, temp2.rect.offset(textbreite, texthoehe), temp2.rect) 
     1721     
     1722    buttonIcon = buttonIconList.getaprop(#pressed) 
     1723    if ilk(buttonIcon) <> #image then buttonIcon = buttonIconList.getaprop(#normal) 
     1724    if ilk(buttonIcon) = #image then 
     1725      if buttonIcon.depth = 32 then 
     1726                buttonIcon.useAlpha = 0 
     1727                buttonIconA = buttonIcon.extractAlpha() 
     1728      else 
     1729                buttonIconA = image(buttonIcon.width, buttonIconA.height, 8, 0, #grayscale) 
     1730                buttonIconA.fill(buttonIconA.rect, rgb(0,0,0)) 
     1731      end if 
     1732       
     1733      img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
     1734      aImg.copyPixels(buttonIconA, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
     1735    end if 
     1736     
     1737    img.setAlpha(aImg) 
     1738    img.useAlpha = 1 
     1739     
     1740    retlist[#pressed] = img 
     1741     
     1742  end if 
     1743   
     1744   
     1745  ------------------------------- 
     1746   
     1747  if not(voidP(retlist.getaprop(#hilite))) then 
     1748     
     1749    hlfarbe = options.getaprop(#hiliteColor) 
     1750    if ilk(hlfarbe) = #color then temp.fill(temp.rect, hlfarbe) 
     1751     
     1752    img = image(dasrect.width, dasrect.height, 32, 1) 
     1753    aImg = image(img.width, img.height, 8, 0, #grayscale) 
     1754    img.useAlpha = 0 
     1755     
     1756    img.copyPixels(temp, temp.rect.offset(textbreite, texthoehe), temp.rect) 
     1757    aImg.copyPixels(temp2, temp2.rect.offset(textbreite, texthoehe), temp2.rect) 
     1758     
     1759    buttonIcon = buttonIconList.getaprop(#hilite) 
     1760    if ilk(buttonIcon) <> #image then buttonIcon = buttonIconList.getaprop(#normal) 
     1761    if ilk(buttonIcon) = #image then 
     1762      if buttonIcon.depth = 32 then 
     1763                buttonIcon.useAlpha = 0 
     1764                buttonIconA = buttonIcon.extractAlpha() 
     1765      else 
     1766                buttonIconA = image(buttonIcon.width, buttonIconA.height, 8, 0, #grayscale) 
     1767                buttonIconA.fill(buttonIconA.rect, rgb(0,0,0)) 
     1768      end if 
     1769       
     1770      img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
     1771      aImg.copyPixels(buttonIconA, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
     1772    end if 
     1773     
     1774    img.setAlpha(aImg) 
     1775    img.useAlpha = 1 
     1776     
     1777    retlist[#hilite] = img 
     1778     
     1779  end if 
     1780   
     1781   
     1782   
     1783  ------------------------------- 
     1784   
     1785  if not(voidP(retlist.getaprop(#disabled))) then 
     1786     
     1787    hlfarbe = options.getaprop(#disabledColor) 
     1788    if ilk(hlfarbe) = #color then temp.fill(temp.rect, hlfarbe) 
     1789     
     1790    img = image(dasrect.width, dasrect.height, 32, 1) 
     1791    aImg = image(img.width, img.height, 8, 0, #grayscale) 
     1792    img.useAlpha = 0 
     1793     
     1794    img.copyPixels(temp, temp.rect.offset(textbreite, texthoehe), temp.rect) 
     1795    aImg.copyPixels(temp2, temp2.rect.offset(textbreite, texthoehe), temp2.rect) 
     1796     
     1797    buttonIcon = buttonIconList.getaprop(#disabled) 
     1798    if ilk(buttonIcon) <> #image then buttonIcon = buttonIconList.getaprop(#normal) 
     1799    if ilk(buttonIcon) = #image then 
     1800      if buttonIcon.depth = 32 then 
     1801                buttonIcon.useAlpha = 0 
     1802                buttonIconA = buttonIcon.extractAlpha() 
     1803      else 
     1804                buttonIconA = image(buttonIcon.width, buttonIconA.height, 8, 0, #grayscale) 
     1805                buttonIconA.fill(buttonIconA.rect, rgb(0,0,0)) 
     1806      end if 
     1807       
     1808      img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
     1809      aImg.copyPixels(buttonIconA, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
     1810    end if 
     1811     
     1812    img.setAlpha(aImg) 
     1813    img.useAlpha = 1 
     1814     
     1815    retlist[#disabled] = img 
     1816  end if 
     1817   
     1818   
     1819   
     1820  ------------------------------- 
     1821   
     1822  if not(voidP(retlist.getaprop(#selected))) then 
     1823     
     1824    hlfarbe = options.getaprop(#selectedColor) 
     1825    if ilk(hlfarbe) = #color then temp.fill(temp.rect, hlfarbe) 
     1826     
     1827    img = image(dasrect.width, dasrect.height, 32, 1) 
     1828    aImg = image(img.width, img.height, 8, 0, #grayscale) 
     1829    img.useAlpha = 0 
     1830     
     1831    img.copyPixels(temp, temp.rect.offset(textbreite, texthoehe), temp.rect) 
     1832    aImg.copyPixels(temp2, temp2.rect.offset(textbreite, texthoehe), temp2.rect) 
     1833     
     1834    buttonIcon = buttonIconList.getaprop(#selected) 
     1835    if ilk(buttonIcon) <> #image then buttonIcon = buttonIconList.getaprop(#normal) 
     1836    if ilk(buttonIcon) = #image then 
     1837      if buttonIcon.depth = 32 then 
     1838                buttonIcon.useAlpha = 0 
     1839                buttonIconA = buttonIcon.extractAlpha() 
     1840      else 
     1841                buttonIconA = image(buttonIcon.width, buttonIconA.height, 8, 0, #grayscale) 
     1842                buttonIconA.fill(buttonIconA.rect, rgb(0,0,0)) 
     1843      end if 
     1844       
     1845      img.copyPixels(buttonIcon, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
     1846      aImg.copyPixels(buttonIconA, buttonIcon.rect.offset(buffsH, buffsV), buttonIcon.rect) 
     1847    end if 
     1848     
     1849    img.setAlpha(aImg) 
     1850    img.useAlpha = 1 
     1851     
     1852    retlist[#selected] = img 
     1853  end if 
     1854   
     1855   
     1856  return retlist 
     1857end 
     1858 
     1859 
     1860-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1861 
    14331862on interface me 
    1434   str = "Button Image Creator Script  by alex da franca ©2003 -- alex@farbflash.de -- all rigths reserved" 
     1863  str = "Button Image Creator Script  by alex da franca c2003 -- alex@farbflash.de -- all rigths reserved" 
    14351864   
    14361865  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
  • trunk/lingosource/castlib3/ButtonManager.ls

    r15 r18  
    1 -- Manager for DrawTable Parentscript used on Bitmap sprites and 3-D Sprites 
    2 -- Alex da Franca ©2002  da.franca@online.de 
     1-- ButtonManager 
     2----------------------------------- 
     3-- CREATED: 
     4--             Alex da Franca c2002  alex@farbflash.de 
     5-- 
     6-- DESCRIPTION: 
     7--             Manager for GenericButtonPS Parentscript used on Bitmap sprites and 3-D Sprites 
     8-- 
    39-- Use this behavior on any dummy sprite to display a scrolling table with selectable items, text (fixed and editable) and images. 
    410-- It creates a temporary bitmap member, which is used to display the table on the stage. 
    511-- Specify the contents and appearance of the table in two property lists, which you pass to the mShowTable handler 
    612-- Use a copy of the parentscript "TableOptionsliste" to build these two lists and receive events from the table 
    7  
    8  
     13-- 
     14-- REQUIRES: 
     15--             script "GenericButtonPS" 
     16-- 
     17-- USAGE: 
     18-- - 
     19-- 
     20-- HISTORY: 
     21-- 
    922-- alex am Freitag, 23. April 2004 
    1023-- added mRefreshSpriteRectAfterStageChange() handler to refresh the rect after a stage resize, sent from behavior "resizeStageBehavior" 
     
    6073 
    6174 
     75--------------------------------- 
     76-- Scriptmarker (18.09.2008 at 12:06 Uhr): alex changes // Scriptmarker 
     77-- added handler mSetBroadcastlist to SET the ENTIRE list of callback instances 
     78-- it now also supports callBackObjects a la [#target, #handler, ...] as callback objects, 
     79-- which allows for additional parameters in that callbackObject, which gets send as parameter 
     80 
     81-- added three new handlers: mSetEventsToProcessList, mAddToEventsToProcessList, mRemoveFromEventsToProcessList 
     82-- use these handlers to change the events which shall be processed (which trigger events to the event listeners) 
     83-- -- mSetEventsToProcessList sets the entire list 
     84-- -- mAddToEventsToProcessList adds an event to the list of events which will be processed 
     85-- -- mRemoveFromEventsToProcessList removes an event from the list of events which will be processed 
     86-- -- -- possible events are: #mouseUp, #mouseDown, #mouseEnter, #mouseLeave 
     87 
     88----------------------------------- 
     89 
     90 
     91 
     92property pKanal, pMember 
     93 
    6294-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    6395-- xxxxxxxxxxxxxxxxxx PROPERTIES 
    6496-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    6597 
    66 property pKanal, pMember 
    6798property pOldKeyDown 
    6899property pMyScriptObject 
     
    116147 
    117148on interface me 
    118   str = "Button Script  by alex da franca ©2005 -- alex@farbflash.de -- all rigths reserved" 
     149  str = "Button Script  by alex da franca c2005 -- alex@farbflash.de -- all rigths reserved" 
    119150  put RETURN & "version 1.0" after str 
    120151  put RETURN & "--------------------------------------------------------" after str 
     
    238269on mInitProperties me, pipeline 
    239270   
    240   pIncludes = (mGetAleXtras()).getaprop(#scripts) 
     271  pIncludes = xscr() 
    241272   
    242273  pKeyboardshortcutList = [:] 
     
    276307      -- alex am 8. Oktober 2004 um 10:32 
    277308      --      pMember = new(#bitmap) 
    278       pMember = call(#mGetNewMember, [pIncludes.getaprop(#commonmoviescript)], #bitmap) 
     309      pMember = pIncludes.mGetNewMember(#bitmap) 
    279310      --/ alex am 8. Oktober 2004 um 10:32 
    280311       
     
    364395      -- alex am 8. Oktober 2004 um 10:32 
    365396      --      pMember.erase() 
    366       call(#mEraseMember, [pIncludes.getaprop(#commonmoviescript)], pMember) 
     397      pIncludes.mEraseMember(pMember) 
    367398      -- alex am 8. Oktober 2004 um 10:32 
    368399    end if 
     
    735766 
    736767on mAddButton me, options 
     768  ----------------------------------- 
     769  -- ACTION: Add a new button. When used on a 2-D sprite, we will always have only one button per behavior 
     770  --         But if this is used on a 3-D sprite, we have only one behavior hosting different buttons as overlays on the 3-D sprite 
     771  --         Therefore we have a list of button objects 
     772  -- INPUT: <options> ; property list ; huge number of properties describing the button, most of which comes from mGetDefaultButtonList() 
     773  --                    see script "defaultLayoutDefinitions" for all properties, which are available for the layout of the button 
     774  --                see the below example for the porperties concerning this script: 
     775  -- RETURNS: - 
     776  -- CALLER: - 
     777  -- EXAMPLE:  
     778  -- 
     779  --    buttonmembername = "buttonImage" 
     780  --    options = mGetDefaultButtonList() 
     781  --    options[#label] = "Choose new model" 
     782  --    i = member(buttonmembername).image.duplicate() 
     783  --    options[#myName] = "versionInfoIcon" 
     784  --    options[#myRect] = rect(0, 0, i.width, i.height) 
     785  --    options[#marginH] = 0 
     786  --    options[#marginV] = 0 
     787  --    options[#broadcastSprites] = [me] 
     788  --    options[#callFunction] = #mVersionInfoIconClicked 
     789  --    options[#myName] = buttonmembername 
     790  --    options[#normalImage] = buttonmembername 
     791  --    options[#eventsToProcess] = [#mouseDown, #mouseUp] 
     792  --    options[#disableBlend] = 0 
     793  --    options[#enabled] = 1 
     794  --    options[#recalcPosition] = point(0, 0) -- reposition the button on window resize (requires script "resizeWindowScripts" to get resize event) 
     795  --     
     796  --    spr = xscr().mGetKanal(#sceneSprite) 
     797  --    sendSprite(spr, #mAddButton, options) 
     798  ----------------------------------- 
    737799   
    738800  if not(listP(pButtonList)) then mInitProperties me 
     
    744806    options = pOptionsListe 
    745807     
    746     if call(#mGetMemType, [pIncludes.getaprop(#commonmoviescript)], pMember) = #shockwave3d then -- 3-D mode 
     808    if pIncludes.mGetMemType(pMember) = #shockwave3d then -- 3-D mode 
    747809      r = options[#myRect] 
    748810       
     
    833895   
    834896  GenericButtonPS = mGetXScript(#GenericButtonPS) 
    835   if voidP(GenericButtonPS) then exit 
    836    
    837   if not objectP(theObject.getaprop(#myScriptObject)) then theObject[#myScriptObject] = new(GenericButtonPS) 
     897  if listP(GenericButtonPS) then exit 
     898   
     899  if not objectP(theObject.getaprop(#myScriptObject)) then 
     900    if ilk(GenericButtonPS) = #instance then GenericButtonPS = GenericButtonPS.script 
     901    theObject[#myScriptObject] = new(GenericButtonPS) 
     902  end if 
    838903   
    839904  if objectP(theObject.getaprop(#myScriptObject)) then -- if we succeded in initializing a button parent script (only fails if script "GenericButtonPS" isn't present)) 
     
    871936      mo = pMember.model(val) 
    872937      if not(voidP(mo)) then 
    873         scr = call(#mGetParentScriptList, [pIncludes.getaprop(#commonmoviescript)], mo) 
     938        scr = pIncludes.mGetParentScriptList(mo) 
    874939         
    875940        repeat with n = scr.count down to 1 
     
    900965 
    901966on mRemoveButton me, tabname 
     967  ----------------------------------- 
     968  -- ACTION: Remove the specified button 
     969  -- INPUT: string ; button name 
     970  -- RETURNS: - 
     971  -- DEBUG: 
     972  --    spr = xscr().mGetKanal(#sceneSprite) 
     973  --    sendSprite(spr, #mRemoveButton, "versionInfoIcon") 
     974  ----------------------------------- 
     975   
    902976  if not(pButtonList.count) then exit 
    903977   
     
    9811055    -- instead put the removal into a seperate, indepandant event 
    9821056     
    983     dto = call(#mCreateTimeout, [pIncludes.getaprop(#commonmoviescript)], pTextureBaseName&"_cleanup", 100, #mRemoveEmptyListEntries, me) 
    984     --    if mCheckWoody() = 1 then 
    985     --      dto = timeout().new(pTextureBaseName&"_cleanup", 100, #mRemoveEmptyListEntries, me) 
    986     --    else 
    987     --      dto = timeout(pTextureBaseName&"_cleanup").new(100, #mRemoveEmptyListEntries, me) 
    988     --    end if 
     1057    dto = pIncludes.mCreateTimeout(pTextureBaseName&"_cleanup", 100, #mRemoveEmptyListEntries, me) 
    9891058     
    9901059  end if 
     
    9981067end 
    9991068 
    1000  
    1001 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    1002 -- comes from the drop down menu, if any 
     1069-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1070-- -- comes from the drop down menu, if any 
    10031071 
    10041072on mHiliteMenu me, val 
     
    10061074end 
    10071075 
    1008  
    1009  
    1010  
    10111076-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    10121077-- xxxxxxxxxxxxxxxxxx Public Handlers to change, control or get the button contents and properties 
     
    10141079 
    10151080 
    1016 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    1017 -- check if a button is present -> this script normally simply applies all to the first button in the list, if tabname is unknown/undefined 
    1018 -- sometimes, this is NOT what I want... 
    1019  
    10201081on mIsButtonPresent me, tabname 
     1082  ----------------------------------- 
     1083  -- ACTION:   check if a button is present -> this script normally simply applies all to the first button in the list, if tabname is unknown/undefined 
     1084  --           sometimes, this is NOT what I want, therefore I needed a handler to tell, if a given button is present 
     1085  -- INPUT:   <tabname> ; string ; name of the button we want to check 
     1086  -- RETURNS:  boolean ; true, if button exists, false otherwise 
     1087  ----------------------------------- 
    10211088   
    10221089  if not(pButtonList.count) then return 0 
    10231090   
    1024   return (ilk(pButtonList.getaprop(tabname)) = #proplist) 
    1025    
    1026 end 
    1027  
    1028 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    1029 -- get the propertylist of the button; e.g. to query the label etc. 
    1030 -- returns: #property list 
     1091  return objectP(pButtonList.getaprop(tabname)) 
     1092   
     1093end 
     1094 
     1095-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1096 
    10311097 
    10321098on mGetButtonProps me, tabname 
     1099  ----------------------------------- 
     1100  -- ACTION:   get the propertylist of the button; e.g. to query the label etc. 
     1101  -- INPUT:    <tabname> ; string ; name of the button we want to address 
     1102  -- RETURNS:  #property list ; all button properties 
     1103  ----------------------------------- 
    10331104   
    10341105  if not(pButtonList.count) then return [:] 
     
    10451116-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    10461117 
    1047 -- change the text: 
    1048 -- accepts: #string 
    10491118on mChangeLabel me, newLabel, tabname 
     1119  ----------------------------------- 
     1120  -- ACTION:   change the button label text => re-render the text and redraw the images 
     1121  -- INPUT:    <newLabel> ; string ; new label 
     1122  --           <tabname> ; string ; name of the button we want to address 
     1123  -- RETURNS: - 
     1124  ----------------------------------- 
     1125   
    10501126  if ilk(newLabel) <> #string then exit 
    10511127   
     
    10601136 
    10611137-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    1062 -- special case of label change 
     1138 
     1139on mChangeLanguage me, tabname 
     1140  ----------------------------------- 
     1141  -- ACTION:   special case of label change 
    10631142-- if mTranslate() yields another result the labels will change 
    1064 -- accepts: #string 
    1065 on mChangeLanguage me, tabname 
     1143  --           the new label will be determined by the "global" handler mTranslate() 
     1144  --           mTranslate is a handler of "commonMovieScript" 
     1145  -- INPUT:    <tabname> ; string ; name of the button we want to address 
     1146  -- RETURNS: - 
     1147  ----------------------------------- 
    10661148   
    10671149  if not(pButtonList.count) then exit 
     
    10741156 
    10751157-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    1076 -- ullala changed 05 
     1158 
    10771159on mPause me, tValue 
     1160  ----------------------------------- 
     1161  -- ACTION:   disable ALL events of this script, if pPause is true 
     1162  --           (can't remember why ulla put that here, normally we would to enable/disable specific buttons) 
     1163  --           this property disables ALL events for ALL buttons, 
     1164  --           I guess it is only useful, if we have only one button => 2-D sprite 
     1165  -- INPUT: <tValue> ; boolean (integer) 
     1166  -- RETURNS: - 
     1167  ----------------------------------- 
     1168   
    10781169  pPause = tValue 
    10791170end 
    10801171 
    10811172-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    1082 -- toggle the enabled state of the button; 1 = enable, 0 = disable 
    1083 -- accepts: #integer 
     1173 
    10841174on mEnableButton me, val, tabname, alleAusser 
     1175  ----------------------------------- 
     1176  -- ACTION:   toggle the enabled state of the button 
     1177  -- 
     1178  -- INPUT:    <val> ; boolean (integer) ; 1 = enable, 0 = disable 
     1179  --           <tabname> ; string OR list ; name of the button we want to address or linear list of names of buttons we want to address 
     1180  --           <alleAusser> ; boolean (integer) ; reverse the action if true not the addressed buttons are toggled, but rather 
     1181  --                           all buttons EXCEPT the ones specified in <tabname> 
     1182  -- RETURNS: - 
     1183  ----------------------------------- 
    10851184   
    10861185  if not(pButtonList.count) then exit 
     
    11181217 
    11191218-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    1120 -- get the enabled state of the button; 1 = enabled, 0 = disabled 
    1121 -- returns: #integer 
    11221219 
    11231220on mGetButtonEnabledState me, tabname 
     1221  ----------------------------------- 
     1222  -- ACTION:   get the enabled state of the button 
     1223  -- 
     1224  -- INPUT:    <tabname> ; string ; name of the button we want to address 
     1225  -- RETURNS:  boolean (integer) 
     1226  ----------------------------------- 
    11241227   
    11251228  if not(pButtonList.count) then return 0 
     
    11341237 
    11351238-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    1136 -- change the event which shall be sent on mouseUp 
     1239--  
    11371240-- accepts: #symbol, #string 
     1241 
    11381242on mSetButtonFunction me, newFunction, tabname 
     1243  ----------------------------------- 
     1244  -- ACTION:   change the event which shall be sent to the lsiteners 
     1245  -- 
     1246  -- INPUT:   <newFunction> ; symbol or string ; name of the event to send to the listeners 
     1247  --                          Note, that a listener can define itself via a callbackObject, 
     1248  --                          which is made of a #target and a #handler, in that case #handler overrides this functionname 
     1249  --                          and every button can define its own handlernames to call on events 
     1250  --          <tabname> ; string ; name of the button we want to address 
     1251  -- RETURNS:  - 
     1252  ----------------------------------- 
    11391253   
    11401254  if not(pButtonList.count) then exit 
     
    11511265 
    11521266-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    1153 -- add a reference to an instance or sprite to the list of instances that get sent the event 
    1154 -- accepts: #object, #integer 
    1155 on mAddToButtonBroadcastlist me, referenz, tabname 
     1267--  
     1268-- accepts: #list 
     1269 
     1270on mSetBroadcastlist me, newBroadCastList, tabname 
     1271  ----------------------------------- 
     1272  -- ACTION:   set the entire list of broadcastsprites 
     1273  --          (list with references to an instance or sprite from the list of instances that get sent the event) 
     1274  -- 
     1275  -- INPUT:   <newBroadCastList> ; linear list ; list of event listeners 
     1276  --          (event listeners can be objects, strings, integers, symbols, callBackObjects [#handler:#buttonEvent, #target:me]) 
     1277  --          <tabname> ; string ; name of the button we want to address 
     1278  -- RETURNS:  - 
     1279  ----------------------------------- 
     1280   
     1281  if not(listP(newBroadCastList)) then exit 
    11561282   
    11571283  if not(pButtonList.count) then exit 
     
    11631289  theObject = theObject.getaprop(#myScriptObject) 
    11641290   
    1165   if not(theObject.pOptions.broadcastSprites).getPos(referenz) then theObject.pOptions.broadcastSprites.add(referenz) 
    1166 end 
    1167  
    1168 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    1169 -- remove a reference to an instance or sprite from the list of instances that get sent the event 
    1170 -- accepts: #object, #integer 
    1171 on mRemoveFromButtonBroadcastlist me, referenz, tabname 
     1291  theObject.pOptions[#broadcastSprites] = newBroadCastList 
     1292   
     1293end 
     1294 
     1295-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1296--  
     1297-- accepts:  
     1298 
     1299on mAddToButtonBroadcastlist me, referenz, tabname 
     1300  ----------------------------------- 
     1301  -- ACTION:   add a reference to an instance or sprite to the list of instances that get sent the event 
     1302  -- 
     1303  -- INPUT:   <referenz> ; #object, #integer, #string, #symbol, callBackObject 
     1304  --          <tabname> ; string ; name of the button we want to address 
     1305  -- RETURNS:  - 
     1306  ----------------------------------- 
    11721307   
    11731308  if not(pButtonList.count) then exit 
     
    11791314  theObject = theObject.getaprop(#myScriptObject) 
    11801315   
     1316  if not(theObject.pOptions.broadcastSprites).getPos(referenz) then theObject.pOptions.broadcastSprites.add(referenz) 
     1317end 
     1318 
     1319-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1320 
     1321on mRemoveFromButtonBroadcastlist me, referenz, tabname 
     1322  ----------------------------------- 
     1323  -- ACTION:   remove a reference to an instance or sprite from the list of instances that get sent the event 
     1324  -- 
     1325  -- INPUT:   <referenz> ; #object, #integer, #string, #symbol, callBackObject 
     1326  --          <tabname> ; string ; name of the button we want to address 
     1327  -- RETURNS:  - 
     1328  ----------------------------------- 
     1329   
     1330  if not(pButtonList.count) then exit 
     1331   
     1332  if not voidP(tabname) then theObject = pButtonList.getaprop(tabname) 
     1333  else theObject = 0 
     1334  if ilk(theObject) <> #proplist then theObject = pButtonList[1] 
     1335   
     1336  theObject = theObject.getaprop(#myScriptObject) 
     1337   
    11811338  theObject.pOptions.broadcastSprites.deleteOne(referenz) 
    11821339   
     
    11841341 
    11851342-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    1186 -- get the enabled state of the button; 1 = enabled, 0 = disabled 
    1187 -- returns: #integer 
     1343--  
     1344 
     1345-- accepts: #list 
     1346 
     1347on mSetEventsToProcessList me, newEventList, tabname 
     1348  ----------------------------------- 
     1349  -- ACTION:   set the entire list of events, which will be processed 
     1350  -- 
     1351  -- INPUT:   <newEventList> ; linear list ; list of events to process for a specific button 
     1352  --               events which can be processed are: #mouseUp, #mouseDown, #mouseEnter, #mouseLeave 
     1353  --          <tabname> ; string ; name of the button we want to address 
     1354  -- RETURNS:  - 
     1355  ----------------------------------- 
     1356   
     1357  if not(listP(newEventList)) then exit 
     1358   
     1359  if not(pButtonList.count) then exit 
     1360   
     1361  if not voidP(tabname) then theObject = pButtonList.getaprop(tabname) 
     1362  else theObject = 0 
     1363  if ilk(theObject) <> #proplist then theObject = pButtonList[1] 
     1364   
     1365  theObject = theObject.getaprop(#myScriptObject) 
     1366   
     1367  theObject.pOptions[#eventsToProcess] = newEventList 
     1368   
     1369end 
     1370 
     1371-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1372--  
     1373-- -- -- events which can be processed are: #mouseUp, #mouseDown, #mouseEnter, #mouseLeave 
     1374-- accepts: #symbol 
     1375 
     1376on mAddToEventsToProcessList me, theEvent, tabname 
     1377  ----------------------------------- 
     1378  -- ACTION:   add an event to the list of processed events 
     1379  -- 
     1380  -- INPUT:   <theEvent> ; symbol 
     1381  --               events which can be processed are: #mouseUp, #mouseDown, #mouseEnter, #mouseLeave 
     1382  --          <tabname> ; string ; name of the button we want to address 
     1383  -- RETURNS:  - 
     1384  ----------------------------------- 
     1385   
     1386  if not(pButtonList.count) then exit 
     1387   
     1388  if not voidP(tabname) then theObject = pButtonList.getaprop(tabname) 
     1389  else theObject = 0 
     1390  if ilk(theObject) <> #proplist then theObject = pButtonList[1] 
     1391   
     1392  theObject = theObject.getaprop(#myScriptObject) 
     1393   
     1394  eventsToProcess = theObject.pOptions[#eventsToProcess] 
     1395  if not(listP(eventsToProcess)) then 
     1396    theObject.pOptions[#eventsToProcess] = [theEvent] 
     1397  else 
     1398    eventsToProcess.deleteOne(theEvent) 
     1399    eventsToProcess.add(theEvent) 
     1400  end if 
     1401   
     1402end 
     1403 
     1404-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1405 
     1406on mRemoveFromEventsToProcessList me, theEvent, tabname 
     1407  ----------------------------------- 
     1408  -- ACTION:   remove an event from the list of processed events 
     1409  -- 
     1410  -- INPUT:   <theEvent> ; symbol 
     1411  --               events which can be processed are: #mouseUp, #mouseDown, #mouseEnter, #mouseLeave 
     1412  --          <tabname> ; string ; name of the button we want to address 
     1413  -- RETURNS:  - 
     1414  ----------------------------------- 
     1415   
     1416  if not(pButtonList.count) then exit 
     1417   
     1418  if not voidP(tabname) then theObject = pButtonList.getaprop(tabname) 
     1419  else theObject = 0 
     1420  if ilk(theObject) <> #proplist then theObject = pButtonList[1] 
     1421   
     1422  theObject = theObject.getaprop(#myScriptObject) 
     1423   
     1424  eventsToProcess = theObject.pOptions[#eventsToProcess] 
     1425  if not(listP(eventsToProcess)) then 
     1426    theObject.pOptions[#eventsToProcess] = [] 
     1427  else 
     1428    eventsToProcess.deleteOne(theEvent) 
     1429  end if 
     1430   
     1431end 
     1432 
     1433-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1434 
    11881435on mGetButtonState me, tabname 
     1436  ----------------------------------- 
     1437  -- ACTION:   get the selected state of the button (radio or toggle button - checkbox) 
     1438  -- INPUT:   <tabname> ; string ; name of the button we want to address 
     1439  -- RETURNS:  boolean (integer) 
     1440  ----------------------------------- 
    11891441   
    11901442  if not(pButtonList.count) then return 0 
     
    11981450 
    11991451-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    1200 -- set the enabled state of the button; 1 = enabled, 0 = disabled 
    1201 -- accepts: #integer 
     1452 
    12021453on mSetButtonState me, selState, tabname 
     1454  ----------------------------------- 
     1455  -- ACTION:   set the selected state of the button (radio or toggle button - checkbox) 
     1456  -- 
     1457  -- INPUT:    <selState> ; boolean (integer) ; true => selected, false => not selected 
     1458  --           <tabname> ; string ; name of the button we want to address 
     1459  -- RETURNS:  - 
     1460  ----------------------------------- 
    12031461   
    12041462  if not(pButtonList.count) then exit 
     
    12271485 
    12281486on mTranslateAllButtonRects me, delta 
     1487  ----------------------------------- 
     1488  -- ACTION:   move all buttons by point <delta> 
     1489  -- 
     1490  -- INPUT:    <delta> ; point ; offset x and offset y to move the button sprite/overlay 
     1491  -- RETURNS:  - 
     1492  ----------------------------------- 
     1493   
    12291494  repeat with n = count(pButtonList) down to 1 
    12301495    mTranslateButtonRect me, delta, pButtonList.getPropAt(n) 
     
    12361501 
    12371502on mTranslateButtonRect me, trans, tabname 
     1503  ----------------------------------- 
     1504  -- ACTION:   move a single button by point <trans> 
     1505  -- 
     1506  -- INPUT:    <trans> ; point ; offset x and offset y to move the button sprite/overlay 
     1507  --           <tabname> ; string ; name of the button we want to address 
     1508  -- RETURNS:  - 
     1509  ----------------------------------- 
     1510   
    12381511  if not(pButtonList.count) then exit 
    12391512   
     
    12491522 
    12501523on mSetCurrentButtonRect me, newRect, tabname 
     1524  ----------------------------------- 
     1525  -- ACTION:   set the rect of the specified button to absolut stage coordinates 
     1526  --          (this may distort the button, so best is to use the rect you get from mGetCurrentButtonRect()) 
     1527  -- 
     1528  -- INPUT:    <newRect> ; rect ; new button rect 
     1529  --           <tabname> ; string ; name of the button we want to address 
     1530  -- RETURNS:  - 
     1531  ----------------------------------- 
     1532   
    12511533  if not(pButtonList.count) then exit 
    12521534   
     
    12631545 
    12641546on mGetCurrentButtonRect me, tabname 
     1547  ----------------------------------- 
     1548  -- ACTION:   get the rect of the specified button in absolut stage coordinates 
     1549  -- 
     1550  -- INPUT:    <tabname> ; string ; name of the button we want to address 
     1551  -- RETURNS:  rect 
     1552  ----------------------------------- 
     1553   
    12651554  if not(pButtonList.count) then return 0 
    12661555   
     
    12741563end 
    12751564 
    1276 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1565 
     1566-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1567on _____SEMI_PUBLIC_HANDLERS 
     1568  -- handlers from other scripts, in this case from the resize stage behavior 
     1569end 
     1570-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1571 
    12771572-- event from the resize bar behavior 
    12781573 
     
    14141709         
    14151710         
    1416         blenderTO = call(#mCreateTimeout, [pIncludes.getaprop(#commonmoviescript)], "ButtonManager_BlenderTimeout", 30, #mDoBlendAnimation, me) 
     1711        blenderTO = pIncludes.mCreateTimeout("ButtonManager_BlenderTimeout", 30, #mDoBlendAnimation, me) 
    14171712        --          if mCheckWoody() = 1 then 
    14181713        --            blenderTO = timeout().new("ButtonManager_BlenderTimeout", 30, #mDoBlendAnimation, me) 
     
    14451740     
    14461741    callFunction = eventList.getaprop(#callFunction) 
    1447     if ilk(callFunction) = #symbol then 
    1448       anz = eventList[#broadcastSprites].count 
     1742    --    if ilk(callFunction) = #symbol then 
     1743    anz = count(eventList[#broadcastSprites]) 
    14491744      eventList[#secondEvent] = secondEvent 
    14501745      if not(anz) then 
     1746      if ilk(callFunction) = #symbol then 
    14511747        sendAllSprites(callFunction, whichEvent, eventList, me, callerObject) 
     1748      end if 
    14521749      else if eventList[#broadcastSprites][1] = -1 then 
     1750      if ilk(callFunction) = #symbol then 
    14531751        str = string(callFunction)&&"#"&whichEvent&","&&QUOTE&eventList.getaprop(#label)&QUOTE&","&&eventList.getaprop(#selected)&","&&secondEvent 
    14541752        do str 
     1753      end if 
    14551754      else if eventList[#broadcastSprites][1] = 0 then 
     1755      if ilk(callFunction) = #symbol then 
    14561756        sendSprite(me.spritenum, callFunction, whichEvent, eventList, me, callerObject) 
     1757      end if 
    14571758      else 
    14581759        repeat with n = 1 to anz 
    14591760          this = eventList[#broadcastSprites][n] 
    14601761          if integerP(this) then 
     1762          if ilk(callFunction) = #symbol then 
    14611763            sendSprite(this, callFunction, whichEvent, eventList, me, callerObject) 
     1764          end if 
    14621765          else if ilk(this) = #instance then 
     1766          if ilk(callFunction) = #symbol then 
    14631767            call(callFunction, [this], whichEvent, eventList, me, callerObject) 
     1768          end if 
    14641769          else if ilk(this) = #script then 
     1770          if ilk(callFunction) = #symbol then 
    14651771            call(callFunction, [this], whichEvent, eventList, me, callerObject) 
    1466           else 
    1467             derkanal = call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)], this) 
     1772          end if 
     1773        else if ilk(this) = #proplist then 
     1774          cfunc = this[#handler] 
     1775          if ilk(cfunc) <> #symbol then cfunc = callFunction 
     1776          if ilk(cfunc) = #symbol then 
     1777            tgt = this[#target] 
     1778            if objectP(tgt) then 
     1779              call(cfunc, [tgt], whichEvent, eventList, me, callerObject, this) 
     1780            else 
     1781              derkanal = pIncludes.mGetKanal(tgt) 
     1782              if derkanal > 0 then sendSprite(derkanal, cfunc, whichEvent, eventList, me, callerObject, this) 
     1783            end if 
     1784          end if 
     1785        else 
     1786          if ilk(callFunction) = #symbol then 
     1787            derkanal = pIncludes.mGetKanal(this) 
    14681788            if derkanal > 0 then sendSprite(derkanal, callFunction, whichEvent, eventList, me, callerObject) 
    14691789          end if 
    1470         end repeat 
    1471       end if 
     1790        end if 
     1791      end repeat 
     1792      --      end if 
    14721793    end if 
    14731794     
     
    20182339              retval = 1 
    20192340               
     2341              thisButton.setaprop(#currentPressed, 0) 
     2342               
    20202343              exit repeat 
    20212344               
     
    20282351            end if 
    20292352          end if 
     2353           
    20302354        end if 
    20312355      end if 
     
    20342358  end if 
    20352359   
     2360  if count(pButtonList) > 0 then 
    20362361  repeat with n = n down to 1 
    20372362    thisButton = pButtonList[n] 
    20382363    if thisButton.getaprop(#currentPressed) = 1 then 
    20392364      call(#myMouseUpOutside, [thisButton.getaprop(#myScriptObject)]) 
     2365        thisButton.setaprop(#currentPressed, 0) 
    20402366    end if 
    20412367  end repeat 
     2368  end if 
    20422369   
    20432370  return retval 
     
    21542481on myKeyDown me, tk, kc, theName 
    21552482   
    2156   if call(#mHandleKeyEvent, [pIncludes.getaprop(#commonmoviescript)], tk, kc) then exit -- this is a movielevel handler, which gets keyevents first for example to quit the movie 
     2483  if pIncludes.mHandleKeyEvent(tk, kc) then exit -- this is a movielevel handler, which gets keyevents first for example to quit the movie 
    21572484   
    21582485  if not pAktiv then exit 
     
    21642491  else 
    21652492    theObject = pButtonList.getaprop(theName) 
    2166     if ilk(theObject) = #proplist then 
     2493    if objectP(theObject) then 
    21672494      call(#mKeyDown, [theObject.getaprop(#myScriptObject)], tk, kc) 
    21682495    end if 
     
    22002527  breite = whichImg.width 
    22012528  hoehe = whichImg.height 
    2202   powerbreite = call(#mGetNextPowerOfTwo, [pIncludes.getaprop(#commonmoviescript)], breite) 
    2203   powerhoehe = call(#mGetNextPowerOfTwo, [pIncludes.getaprop(#commonmoviescript)], hoehe) 
     2529  powerbreite = pIncludes.mGetNextPowerOfTwo(breite) 
     2530  powerhoehe = pIncludes.mGetNextPowerOfTwo(hoehe) 
    22042531   
    22052532  if (powerbreite <> breite) or (powerhoehe <> hoehe) then 
  • trunk/lingosource/castlib3/DropShadowPScript.ls

    r14 r18  
    1 -- Drop Shadow and Cutout 
    2 -- Alex da Franca ©2002 
    3 -- da.franca@online.de 
    4  
     1-- DropShadowPScript 
     2----------------------------------- 
     3-- CREATED: 
     4-- Alex da Franca c2002 - alex@farbflash.de 
     5-- 
     6-- DESCRIPTION: 
     7--                Apply a Drop Shadow or Cutout to an image object. 
     8--                It started as drop shadow for rectangles using plain lingo. 
     9--                In D10.1 Flash filters appeared and since then we can do much faster 
     10--                and much better blur and therefore drop shadows. 
     11--                My frontend to flash filters is the script "FlashBitmapFilterPS" 
     12--                So as soon as this script is found in one of the castlibs, the flash bitmap filters are used 
     13--                instead of the slower and limited to rects lingo solution. 
     14-- 
     15-- REQUIRES: 
     16--                script "commonMovieScript" 
     17--                optional: script "FlashBitmapFilterPS" 
     18-- 
     19-- USAGE: 
     20--                There is only one single function: mGetShadowImage 
     21--                Use that function to pply a shadow to an image object. 
     22-- EXAMPLE: 
     23--               
     24--               imgList = xscr(#DropShadowPScript).mGetShadowImage(myImageObject, rgb(0,0,0), 6, 55, 18, 1, #shadow) 
     25--               newShadowImage = imgList[1] 
     26--               maskeImage = imgList[2] 
     27--               shadowOffset = imgList[3] 
     28-- 
     29-- HISTORY: 
     30--  
    531-- change 22.08.03 
    632-- existing alphachannel now will be preserved 
     
    935-- New Flash Bitmap filter if script "FlashBitmapFilterPS" is present and version > 10.10 => flash bitmap filter was introduced with 10.11 
    1036 
    11 ----------- 
    12 -- Accepts: 
    13 ----------- 
    14 -- theImg = [#format:#imageObject, #comment:"source image"] 
    15 -- shadowColor = [#format:#color, #default:rgb(0,0,0), #comment:"Shadow Color"] 
    16 -- shadowDistance = [#format:#integer, #default:14, #range:[#min:2, #max:40], #comment:"Schattenhoehe:"] 
    17 -- winkel = [#format:#integer, #default:45, #range:[#min:0, #max:360], #comment:"Winkel:"] 
    18 -- blur = [#format:#integer, #default:14, #range:[#min:2, #max:40], #comment:"Schatten Blur:"] 
    19 -- exponent = [#format:#boolean, #default:1, #comment:"exponentiale grauverteilung:"] 
    20 -- theStyle = [#format:#symbol, #default:#shadow, #range:[#shadow, #cutout], #comment:"Shadow style:"] 
    21 -- returnMask = [#format:#boolean, #default:0, #comment:"if style = #cutout return image and mask instead of drawing into iamge"] 
    22 -- alphaLevel = [#format:#float #integer, #default:1.0, #range:[#min:0.0, #max:1.0], #comment:"Only used for flash filters: alphalevel (if integer is used -> range => 0 - 100)"] 
    23  
    24 ----------- 
    25 -- Returns: 
    26 ----------- 
    27 -- if <theStyle> = #shadow then returns linear list with: 
    28 -- imageObject, the original image copied onto a border for the drop shadow 
    29 -- imageObject (8-bit #grayscale), to use as mask for the shadow 
    30 -- point, the offset of the returned image from top left 
    31  
    32 -- if <theStyle> = #cutout then returns nothing, but rather draws the shadow directly into the imageObject <theImg>, which was passed to the function 
    33 -- except when <returnMask> is true 
    34  
    35  
    36 ----------- 
    37 -- Requires: 
    38 ----------- 
    39 -- script "commonMovieScript" 
    40 -- optional: script "FlashBitmapFilterPS" 
    41  
    42  
    43 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     37-- Scriptmarker (15.10.2008 at 10:34 Uhr): alex changes // Scriptmarker 
     38-- added paramater to prevent trimwhitespace, when using flash bitmap filters for drop shadows 
     39----------------------------------- 
     40 
     41 
    4442 
    4543on new me 
     
    5149 
    5250on interface me 
    53   str = "DropShadowPScript  by alex da franca ©2003 -- alex@farbflash.de -- all rigths reserved" 
     51  str = "DropShadowPScript  by alex da franca c2003 -- alex@farbflash.de -- all rigths reserved" 
    5452   
    5553  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
    5654  put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
    57   put RETURN & "on mGetShadowImage me, theImg, shadowColor, shadowDistance, winkel, blur, exponent, theStyle, returnMask, alphaLevel" after str 
     55  put RETURN & "on mGetShadowImage me, theImage, shadowColor, shadowDistance, shadowAngle, blur, exponent, theStyle, returnMask, alphaLevel, dontTrimWhiteSpace" after str 
    5856  put RETURN & "" after str 
    5957   
     
    6462-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    6563 
    66 on mGetShadowImage me, theImg, shadowColor, shadowDistance, winkel, blur, exponent, theStyle, returnMask, alphaLevel 
    67    
    68   if ilk(theImg) <> #image then return [] 
     64on mGetShadowImage me, theImage, shadowColor, shadowDistance, shadowAngle, blur, exponent, theStyle, returnMask, alphaLevel, dontTrimWhiteSpace 
     65  ----------------------------------- 
     66  -- ACTION:       Apply a Drop Shadow or Cutout to an image object. 
     67  --               As soon as this script is found in one of the castlibs, the flash bitmap filters are used 
     68  --               instead of the slower and limited to rects lingo solution. 
     69  -- INPUT:  
     70  --               <theImage>           = [#format:#imageObject, #comment:"source image"] 
     71  --               <shadowColor>        = [#format:#color, #default:rgb(0,0,0), #comment:"Shadow Color"] 
     72  --               <shadowDistance>     = [#format:#integer, #default:14, #range:[#min:2, #max:40], #comment:"Schattenhoehe:"] 
     73  --               <shadowAngle>        = [#format:#integer, #default:45, #range:[#min:0, #max:360], #comment:"shadowAngle:"] 
     74  --               <blur>               = [#format:#integer, #default:14, #range:[#min:2, #max:40], #comment:"Schatten Blur:"] 
     75  --               <exponent>           = [#format:#boolean, #default:1, #comment:"exponentiale grauverteilung:"] 
     76  --               <theStyle>           = [#format:#symbol, #default:#shadow, #range:[#shadow, #cutout], #comment:"Shadow style:"] 
     77  --               <returnMask>         = [#format:#boolean, #default:0, #comment:"if style = #cutout return image and mask instead of drawing into image"] 
     78  --               <alphaLevel>         = [#format:#float #integer, #default:1.0, #range:[#min:0.0, #max:1.0], #comment:"Only used for flash filters: alphalevel (if integer is used -> range => 0 - 100)"] 
     79  --               <dontTrimWhiteSpace> = [#format:#boolean, #default:0, #comment:"If using flash bitmap filters, flag to NOT trimwhitespace, so that the image object will retain its size"] 
     80  -- RETURNS:  
     81  --               if <theStyle> = #shadow then returns linear list with: 
     82  --               imageObject, the original image copied onto a border for the drop shadow 
     83  --               imageObject (8-bit #grayscale), to use as mask for the shadow 
     84  --               point, the offset of the returned image from top left 
     85  -- 
     86  --               if <theStyle> = #cutout then returns nothing, but rather draws the shadow directly into the imageObject <theImage>, which was passed to the function 
     87  --               except when <returnMask> is true 
     88  -- EXAMPLE:  
     89  --              imgList = xscr(#DropShadowPScript).mGetShadowImage(myImageObject, rgb(0,0,0), 6, 55, 18, 1, #shadow) 
     90  --              newShadowImage = imgList[1] 
     91  --              maskeImage = imgList[2] 
     92  --              shadowOffset = imgList[3] 
     93  ----------------------------------- 
     94   
     95  if ilk(theImage) <> #image then return [] 
    6996  if ilk(shadowColor) <> #color then shadowColor = rgb(0,0,0) 
    7097  if ilk(shadowDistance, #number) = 0 then shadowDistance = 14 
    7198  if ilk(blur, #number) = 0 then blur = 14 
    72   if ilk(winkel, #number) = 0 then winkel = 45 
     99  if ilk(shadowAngle, #number) = 0 then shadowAngle = 45 
    73100   
    74101   
     
    82109  if theStyle <> #cutout then 
    83110    cms = mGetXscript() 
    84     if voidP(cms) then scr = mGetInstance("FlashBitmapFilterPS") 
     111    if listP(cms) then scr = mGetInstance("FlashBitmapFilterPS") 
    85112    else scr = call(#mGetInstance, cms, "FlashBitmapFilterPS") 
    86113    if ilk(scr) = #instance then 
     
    96123            if xlist[n].getaprop(#name) = #ActionScriptObjects then 
    97124              prodVers = xlist[n].getaprop(#version) 
    98               vn = call(#mGetFloatVersionNumber, [mGetXscript()], prodVers) 
     125              vn = call(#mGetFloatVersionNumber, mGetXscript(), prodVers) 
    99126              if ilk(vn, #number) = 1 then flash8XtraPresent = (vn > 10.1) 
    100127              exit repeat 
     
    112139        --      if theStyle = #cutout then 
    113140        --        if not(returnMask) then 
    114         --          winkel = winkel + 180 
    115         --          shdparams = [#distance: shadowDistance, #angle: winkel, #alpha: alphaLevel, #quality: 3, #blurX: blur, #blurY: blur, #shadowcolor: shadowColor, #highlightalpha:0.0, #type:"inner"] 
    116         --          i = call(#mBevel, [scr], theImg, shdparams) 
     141          --          shadowAngle = shadowAngle + 180 
     142          --          shdparams = [#distance: shadowDistance, #angle: shadowAngle, #alpha: alphaLevel, #quality: 3, #blurX: blur, #blurY: blur, #shadowcolor: shadowColor, #highlightalpha:0.0, #type:"inner"] 
     143          --          i = call(#mBevel, [scr], theImage, shdparams) 
    117144        --          -- call(#mPut, [mGetXScript()], i) 
    118         --          theImg.copyPixels(i, i.rect, i.rect) 
     145          --          theImage.copyPixels(i, i.rect, i.rect) 
    119146        --          exit 
    120147        --        end if 
    121148        --      else 
    122149         
    123         rAlt = theImg.rect 
     150          rAlt = theImage.rect 
    124151         
    125152        blur = blur/3.0 
    126153        shadowDistance = shadowDistance / 3. 
    127154         
    128         shdparams = [#distance: shadowDistance, #angle: winkel, #alpha: alphaLevel, #quality: 3, #blurX: blur, #blurY: blur, #color: shadowColor] 
    129         i = call(#mDropShadow, scr, theImg, shdparams) 
     155          shdparams = [#distance: shadowDistance, #angle: shadowAngle, #alpha: alphaLevel, #quality: 3, #blurX: blur, #blurY: blur, #color: shadowColor] 
     156          i = call(#mDropShadow, scr, theImage, shdparams) 
    130157         
    131158        rNeu = i.rect 
     
    134161         
    135162         
     163          if dontTrimWhiteSpace then 
     164             
     165            m  = i.extractAlpha() 
     166            return [i, m, point(0,0)] 
     167             
     168          else 
    136169        -- get the cropped rect: 
    137170        --        croprect = call(#mGetCropRect, [mGetXscript(#ImageUtilityScripts)], i.extractAlpha()) 
     
    158191        return [i2, m, vers] 
    159192         
    160         --      end if 
     193          end if 
    161194         
    162195      end if 
     
    175208   
    176209  --  blur = min(blur, shadowDistance) 
    177   theRect = theImg.rect 
     210  theRect = theImage.rect 
    178211   
    179212  -- radialer verlauf 
     
    235268  pSchatten.fill(rect(blur, blur, (breite - blur), (hoehe - blur)), col) 
    236269   
    237   rad = pi()/180 * winkel 
     270  rad = pi()/180 * shadowAngle 
    238271  halbesblur = blur/2.0 
    239272   
     
    297330    t2.copyPixels(tempimg, theRect, theRect.offset(vhBild, vvBild), [#ink:2]) 
    298331    t2 = t2.createMask() 
    299     --    i2 = theImg.duplicate() 
    300     --    i3 = image(theRect.width, theRect.height, theImg.depth, 0) 
     332    --    i2 = theImage.duplicate() 
     333    --    i3 = image(theRect.width, theRect.height, theImage.depth, 0) 
    301334    --    i3.fill(i3.rect, shadowColor) 
    302335    --    i2.copyPixels(i3, theRect, theRect, [#maskImage:t2]) 
    303336    --    return i2 
    304337     
    305     i3 = image(theRect.width, theRect.height, theImg.depth, 0) 
     338    i3 = image(theRect.width, theRect.height, theImage.depth, 0) 
    306339    i3.fill(i3.rect, shadowColor) 
    307340     
     
    309342      return [t2, i3] 
    310343    else 
    311       theImg.copyPixels(i3, theRect, theRect, [#maskImage:t2]) 
     344      theImage.copyPixels(i3, theRect, theRect, [#maskImage:t2]) 
    312345    end if 
    313346     
    314347  else 
    315     if theImg.depth = 32 and theImg.useAlpha = 1 then 
    316       tempimg.copyPixels(theImg.extractalpha(), theRect.offset(vhBild, vvBild), theRect) 
     348    if theImage.depth = 32 and theImage.useAlpha = 1 then 
     349      tempimg.copyPixels(theImage.extractalpha(), theRect.offset(vhBild, vvBild), theRect) 
    317350    else 
    318351      tempimg.fill(theRect.offset(vhBild, vvBild), rgb(0,0,0)) 
    319352    end if 
    320353     
    321     t2 = image((theRect.width + imgW), (theRect.height + imgH), theImg.depth, 0) 
     354    t2 = image((theRect.width + imgW), (theRect.height + imgH), theImage.depth, 0) 
    322355    t2.fill(t2.rect, shadowColor) 
    323     t2.copyPixels(theImg, theImg.rect.offset(vhBild, vvBild), theImg.rect) 
     356    t2.copyPixels(theImage, theImage.rect.offset(vhBild, vvBild), theImage.rect) 
    324357    return [t2, tempimg, point(vhBild, vvBild)] 
    325358  end if 
  • trunk/lingosource/castlib3/FileIOFunktionen.ls

    r15 r18  
    1 -- FileIO Handlers -- ©03 Alex da Franca -- alex@farbflash.de 
     1-- FileIO Handlers -- c03 Alex da Franca -- alex@farbflash.de 
    22--------------------------------------------------------------------- 
    33 
     
    6363  if not(internetLink) then internetLink = (fname starts "www.") 
    6464  if the runmode contains "plugin" or internetLink then 
    65     scr = xscr().mGetInstance("NetLingoManagerPS__") 
    66     if ilk(scr) = #instance then 
    67       scr.mStartNetOP(paramList) 
    68     else 
     65    --    scr = xscr().mGetInstance("NetLingoManagerPS__") 
     66    --    if ilk(scr) = #instance then 
     67    --      scr.mStartNetOP(paramList) 
     68    --    else 
    6969      scr = xscr().mGetInstance("NetTextReaderPS") 
    7070    if ilk(scr) = #instance then 
     
    7575      call(paramList.getaprop(#handler), [paramList.getaprop(#target)], paramList) 
    7676    end if 
    77     end if 
     77    --    end if 
    7878  else 
    7979    paramList.setaprop(#theTextResult, mGetTextFromFile(me, paramList.getaprop(#theURL))) 
     
    106106      if call(#mCheckForXtra, mGetXScript(), "BudAPI") = 1 then 
    107107        startfolder = string(startfolder) 
     108         
     109        resetUNames = 0 
     110        if the platform contains "mac" then 
     111        if baSysFolder("prefs") starts "/" then 
     112          baReturnUnixNames(0) 
     113          resetUNames = 1 
     114        end if 
     115        end if 
    108116        if length(startfolder) > 0 then 
    109117          pfad = baGetFilename("save", startfolder, theDefaultName, "", 524288+2+4+4194304, theTitle, false, -1, -1) 
     
    111119        pfad = baGetFilename("save", "", theDefaultName, "", 524288+2+4+4194304, theTitle, false, -1, -1) 
    112120        end if 
     121         
     122        if resetUNames = 1 then baReturnUnixNames(1) 
     123         
    113124      else 
    114125        pfad = fio.displaySave(theTitle, theDefaultName) 
     
    275286  if call(#mCheckForXtra, mGetXScript(), "BudAPI") = 1 then 
    276287     
     288    resetUNames = 0 
     289    if the platform contains "mac" then 
     290    if baSysFolder("prefs") starts "/" then 
     291      baReturnUnixNames(0) 
     292      resetUNames = 1 
     293    end if 
     294    end if 
     295     
    277296    startDir = string(startDir) 
    278297    defaultName = string(defaultName) 
     
    281300    prompt = string(prompt) 
    282301     
    283     return baGetFilename("open", startDir, defaultName, filetypes, 524288+4+2+4194304, prompt, false, -2, -1) 
     302    retval = baGetFilename("open", startDir, defaultName, filetypes, 524288+4+2+4194304, prompt, false, -2, -1) 
     303     
     304    if resetUNames = 1 then baReturnUnixNames(1) 
     305     
     306    return retval 
    284307     
    285308  else 
     
    307330   
    308331  if xscr().mCheckForXtra("BudAPI") = 1 then -- if buddy is present... 
     332     
     333    resetUNames = 0 
     334    if the platform contains "mac" then 
     335    if baSysFolder("prefs") starts "/" then 
     336      baReturnUnixNames(0) 
     337      resetUNames = 1 
     338    end if 
     339    end if 
     340     
    309341    retval = baGetFolder( "", "Select a folder", 3, "", 50, 50 ) 
     342     
     343    if resetUNames = 1 then baReturnUnixNames(1) 
     344     
    310345  else if xscr().mCheckForXtra("FileXtra4") = 1 then -- if not buddy then try filextra 
    311346    fx = (xtra "filextra4").new() 
     
    340375   
    341376  if xscr().mCheckForXtra("BudAPI") then -- if buddy is present... 
     377     
    342378    --  -- budApi version: 
    343379    retval = baFileList(folderpath, "*.*") 
     
    349385      retval = fx.fx_FolderToList(folderpath) 
    350386      delim = the last char of the moviepath 
    351       if length(delim) < 1 then delim = the last char of the applicationpath 
     387      if length(delim) < 1 then 
     388        if not(the runmode contains "plug") then 
     389          delim = the last char of the applicationpath 
     390        end if 
     391      end if 
    352392      if length(delim) < 1 then delim = "/" 
    353393      repeat with n = count(retval) down to 1 
     
    390430      retval = fx.fx_FolderToList(folderpath) 
    391431      delim = the last char of the moviepath 
    392       if length(delim) < 1 then delim = the last char of the applicationpath 
     432      if length(delim) < 1 then 
     433        if not(the runmode contains "plug") then 
     434          delim = the last char of the applicationpath 
     435        end if 
     436      end if 
    393437      if length(delim) < 1 then delim = "/" 
    394438      repeat with n = count(retval) down to 1 
     
    416460      this = getnthfilenameinfolder(folderpath, n) 
    417461    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     
    418504  end if 
    419505   
     
    570656 
    571657on interface me 
    572   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" 
    573659   
    574660  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
  • trunk/lingosource/castlib3/GenericButtonPS.ls

    r15 r18  
    1 -- xxxxxxxxx STANDARD GENERIC BUTTON 
    2 -- by Alex da Franca da.franca@online.de 
    3  
    4 -- created: 31.08.03 
    5  
     1-- GenericButtonPS 
     2----------------------------------- 
     3-- CREATED:      31.08.03 - by Alex da Franca alex@farbflash.de 
     4-- 
     5-- DESCRIPTION:  STANDARD GENERIC BUTTON 
     6--               abstract button script. This script just outputs an image object for a button. 
     7--               It receives the events for mouse interaction and changes the images accordingly and sends events 
     8--               So it can be used in an abstarct manner as button on a sprite as well as as overlay or texture 
     9--               Use script "ButtonManager" as interface for this script. "ButtonManager" will send/receive the events 
     10--               and updatethe sprite or overlay 
     11-- - 
     12-- 
     13-- REQUIRES: 
     14-- (Prerequisites) 
     15-- 
     16-- USAGE: 
     17-- - 
     18-- 
     19-- PARAMS: 
     20-- - 
     21-- 
     22-- RETURNS: 
     23-- - 
     24-- 
     25-- WARNINGS: 
     26-- - 
     27-- 
     28-- CHANGELOG: 
    629-- alex am Freitag, 23. April 2004 
    730-- added mTranslateRect and mSetCurrentRect in order to be able to move the button rect, in case the button moves (-> i.e. stage resize) 
     
    1841-- alex am 1. August 2004 um 10:55 
    1942-- fixed bug with radio buttons 
     43----------------------------------------- 
     44 
     45 
     46property pRect 
    2047 
    2148-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     
    2855property pDown, pIsInside 
    2956property pKlickSound 
    30 property pRect 
     57 
    3158 
    3259-- gpdls: 
     
    4572 
    4673-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    47 -- xxxxxxxxxxxxxxxxxx DIRECTOR EVENTS 
     74on _____________DIRECTOR_EVENTS me 
     75end 
    4876-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    4977 
     
    5785   
    5886  if ilk(caller) = #instance then 
    59     if ilk(options) = #proplist then 
     87    if objectP(options) then 
    6088      mCreate me, caller, options, theName 
    6189    end if 
     
    6795-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    6896 
     97on mDestroy me 
     98  pCallerRef = 0 -- break the circular reference !! 
     99end 
     100 
     101 
     102-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     103on _____________PUBLIC_EVENTS me 
     104end 
     105-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     106 
    69107on mCreate me, caller, options, theName 
     108  ----------------------------------- 
     109  -- ACTION: create a new button 
     110  -- INPUT:  <caller>  ; object ; communication pipeline -- circular reference !!! Careful with that!! 
     111  --         <options> ; property list with all props describing the button. Most of which comes from mGetDefaultButtonList() 
     112  --                    see script "defaultLayoutDefinitions" for all properties, which are available for the layout of the button 
     113  --         <theName> ; string ; name for the button 
     114  -- RETURNS: - 
     115  ----------------------------------- 
     116   
    70117  if ilk(caller) <> #instance then exit 
    71118   
     
    100147-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    101148 
    102 on mDestroy me 
    103   pCallerRef = 0 
    104 end 
    105  
    106 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    107  
    108 on mSendUpdate me 
    109   call(#mUpdateImage, [pCallerRef], pImg, me, pMyName) 
    110 end 
    111  
     149on mGetOptionsList me 
     150  ----------------------------------- 
     151  -- ACTION: get the options list of the button 
     152  -- INPUT:   - 
     153  -- RETURNS: property list 
     154  ----------------------------------- 
     155   
     156  if ilk(pOptions) <> #proplist then return [:] 
     157  return pOptions 
     158end 
     159 
     160 
     161-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     162 
     163on mChangeLabel me, newLabel 
     164  ----------------------------------- 
     165  -- ACTION: change the text on the button -> label 
     166  -- INPUT:   <newLabel> ; string ; new label 
     167  -- RETURNS: - 
     168  ----------------------------------- 
     169   
     170  if ilk(newLabel) <> #string then exit 
     171  pOptions[#label] = newLabel 
     172  mInitImgs me 
     173end 
     174 
     175-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     176 
     177on mChangeLanguage me 
     178  ----------------------------------- 
     179  -- ACTION: special case of label change 
     180  --         if mTranslate() yields another result the labels will change 
     181  --         the new label will be determined by the "global" handler mTranslate() 
     182  --         mTranslate is a handler of "commonMovieScript" 
     183  -- INPUT:   - 
     184  -- RETURNS: - 
     185  ----------------------------------- 
     186   
     187  mInitImgs me 
     188end 
     189 
     190-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     191 
     192on mEnableMe me, val 
     193  ----------------------------------- 
     194  -- ACTION: toggle the enabled state of the button 
     195  -- INPUT:   <val> ; boolean (integer) ; 1 = enable, 0 = disable 
     196  -- RETURNS: - 
     197  ----------------------------------- 
     198   
     199  if voidP(val) then val = not(pOptions.getaprop(#enabled)) 
     200  if pOptions.getaprop(#enabled) = val then exit 
     201   
     202  pOptions[#enabled] = val 
     203  doUpd = 0 
     204  if val then 
     205    if pImg <> pOffImg then 
     206      pImg = pOffImg 
     207      doUpd = 1 
     208    end if 
     209  else 
     210    if pImg <> pDisabledImg then 
     211      pImg = pDisabledImg 
     212      doUpd = 1 
     213    end if 
     214  end if 
     215   
     216  mSendEvent me, #enable 
     217  if doUpd = 1 then mSendUpdate me 
     218end 
     219 
     220-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     221 
     222on mGetEnabled me 
     223  ----------------------------------- 
     224  -- ACTION: get the enabled state of the button 
     225  -- INPUT:   <val> ; boolean (integer) ; 1 = enable, 0 = disable 
     226  -- RETURNS: boolean (integer) ; 1 = enabled, 0 = disabled 
     227  ----------------------------------- 
     228   
     229  return pOptions[#enabled] 
     230end 
     231 
     232-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     233 
     234on mSetFunction me, newFunction 
     235  ----------------------------------- 
     236  -- ACTION: change the event which shall be sent to the listener 
     237  -- INPUT:   <newFunction> ; symbol or string ; name of the event to send to the listeners 
     238  --                          Note, that a listener can define itself via a callbackObject, 
     239  --                          which is made of a #target and a #handler, in that case #handler overrides this functionname 
     240  --                          and every button can define its own handlernames to call on events 
     241  -- RETURNS: - 
     242  ----------------------------------- 
     243   
     244  newFunction = symbol(newFunction) 
     245  pOptions[#callFunction] = newFunction 
     246end 
     247 
     248-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     249 
     250on mAddToBroadcastlist me, referenz 
     251  ----------------------------------- 
     252  -- ACTION:   add a reference to an instance or sprite to the list of instances that get sent the event 
     253  -- 
     254  -- INPUT:   <referenz> ; #object, #integer, #string, #symbol, callBackObject 
     255  -- RETURNS:  - 
     256  ----------------------------------- 
     257   
     258  if not pOptions[#broadcastSprites].getPos(referenz) then pOptions[#broadcastSprites].add(referenz) 
     259end 
     260 
     261-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     262 
     263on mRemoveFromBroadcastlist me, referenz 
     264  ----------------------------------- 
     265  -- ACTION:   remove a reference to an instance or sprite from the list of instances that get sent the event 
     266  -- 
     267  -- INPUT:   <referenz> ; #object, #integer, #string, #symbol, callBackObject 
     268  -- RETURNS:  - 
     269  ----------------------------------- 
     270   
     271  pOptions[#broadcastSprites].deleteOne(referenz) 
     272end 
     273 
     274-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     275 
     276on mGetState me 
     277  ----------------------------------- 
     278  -- ACTION:   get the selected state of the button (radio or toggle button - checkbox) 
     279  -- INPUT:   <tabname> ; string ; name of the button we want to address 
     280  -- RETURNS:  boolean (integer) 
     281  ----------------------------------- 
     282   
     283  return pOptions[#selected] 
     284end 
     285 
     286-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     287 
     288on mSetState me, selState 
     289  ----------------------------------- 
     290  -- ACTION:   set the selected state of the button (radio or toggle button - checkbox) 
     291  -- 
     292  -- INPUT:    <selState> ; boolean (integer) ; true => selected, false => not selected 
     293  -- RETURNS:  - 
     294  ----------------------------------- 
     295   
     296  if selState = pOptions.getaprop(#selected) then exit 
     297  pOptions[#selected] = selState 
     298   
     299  pDown = 0 
     300   
     301  if not(mGetEnabled(me)) then exit 
     302   
     303  if (pOptions.getaprop(#toggle) = 1) and (pOptions.getaprop(#selected) = 1) then 
     304    if pImg <> pSelectedImg then 
     305      pImg = pSelectedImg 
     306      mSendUpdate me 
     307    end if 
     308     
     309  else if length(string(pOptions.getaprop(#groupname))) and (pOptions.getaprop(#selected) = 1) then 
     310    if pImg <> pSelectedImg then 
     311      pImg = pSelectedImg 
     312      mSendUpdate me 
     313    end if 
     314     
     315  else 
     316    if pImg <> pOffImg then 
     317      pImg = pOffImg 
     318      mSendUpdate me 
     319    end if 
     320  end if 
     321end 
     322 
     323-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     324 
     325on mGetCurrentRect me 
     326  ----------------------------------- 
     327  -- ACTION:   get the rect of the button in absolut stage coordinates 
     328  -- 
     329  -- INPUT:    - 
     330  -- RETURNS:  rect 
     331  ----------------------------------- 
     332   
     333  return pRect 
     334end 
     335 
     336-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     337 
     338on mTranslateRect me, trans 
     339  ----------------------------------- 
     340  -- ACTION:   move a single button by point <trans> 
     341  -- 
     342  -- INPUT:    <trans> ; point ; offset x and offset y to move the button sprite/overlay 
     343  -- RETURNS:  - 
     344  ----------------------------------- 
     345   
     346  if ilk(trans) = #point then pRect = pRect.offset(trans[1], trans[2]) 
     347  pOptions[#myRect] = pRect 
     348  pCallerRef.mForceRectUpdate(me, pMyName) 
     349  mSendUpdate me 
     350end 
     351 
     352-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     353 
     354on mSetCurrentRect me, newRect 
     355  ----------------------------------- 
     356  -- ACTION:   set the rect of the specified button to absolut stage coordinates 
     357  --          (this may distort the button, so best is to use the rect you get from mGetCurrentButtonRect()) 
     358  -- 
     359  -- INPUT:    <newRect> ; rect ; new button rect 
     360  -- RETURNS:  - 
     361  ----------------------------------- 
     362   
     363  if ilk(newRect) = #rect then pRect = newRect 
     364  pOptions[#myRect] = pRect 
     365  pCallerRef.mForceRectUpdate(me, pMyName) 
     366  mSendUpdate me 
     367end 
     368 
     369-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     370 
     371on interface me 
     372  ----------------------------------- 
     373  -- ACTION:   get the interface of this script 
     374  -- 
     375  -- INPUT:    - 
     376  -- RETURNS:  string 
     377  ----------------------------------- 
     378   
     379  str = "" 
     380   
     381  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
     382  put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
     383  put RETURN & "on mGetOptionsList me" after str 
     384  put RETURN & "-- get the options list of the button" after str 
     385  put RETURN & "-- returns: #property list" after str 
     386  put RETURN & "" after str 
     387   
     388  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
     389  put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
     390  put RETURN & "on mChangeLabel me, newLabel" after str 
     391  put RETURN & "-- change the text:" after str 
     392  put RETURN & "-- accepts: #string" after str 
     393  put RETURN & "" after str 
     394   
     395  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
     396  put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
     397  put RETURN & "on mChangeLanguage me" after str 
     398  put RETURN & "-- special case of label change" after str 
     399  put RETURN & "-- if mTranslate() yields another result the labels will change" after str 
     400  put RETURN & "-- accepts: #string" after str 
     401  put RETURN & "" after str 
     402   
     403  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
     404  put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
     405  put RETURN & "on mEnableMe me, val" after str 
     406  put RETURN & "-- toggle the enabled state of the button; 1 = enable, 0 = disable" after str 
     407  put RETURN & "-- accepts: #integer" after str 
     408  put RETURN & "" after str 
     409   
     410  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
     411  put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
     412  put RETURN & "on mGetEnabled me" after str 
     413  put RETURN & "-- get the enabled state of the button; 1 = enabled, 0 = disabled" after str 
     414  put RETURN & "-- returns: #integer" after str 
     415  put RETURN & "" after str 
     416   
     417  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
     418  put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
     419  put RETURN & "on mSetFunction me, newFunction" after str 
     420  put RETURN & "-- change the event which shall be sent on mouseUp" after str 
     421  put RETURN & "-- accepts: #symbol, #string" after str 
     422  put RETURN & "" after str 
     423   
     424  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
     425  put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
     426  put RETURN & "on mAddToBroadcastlist me, referenz" after str 
     427  put RETURN & "-- add a reference to an instance or sprite to the list of instances that get sent the event" after str 
     428  put RETURN & "-- accepts: #object, #integer" after str 
     429  put RETURN & "" after str 
     430   
     431  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
     432  put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
     433  put RETURN & "on mRemoveFromBroadcastlist me, referenz" after str 
     434  put RETURN & "-- remove a reference to an instance or sprite from the list of instances that get sent the event" after str 
     435  put RETURN & "-- accepts: #object, #integer" after str 
     436  put RETURN & "" after str 
     437   
     438  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
     439  put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
     440  put RETURN & "on mGetState me" after str 
     441  put RETURN & "-- get the selected state of the button; 1 = selected, 0 = not selected" after str 
     442  put RETURN & "-- returns: #integer" after str 
     443  put RETURN & "" after str 
     444   
     445  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
     446  put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
     447  put RETURN & "on mSetState me, selState" after str 
     448  put RETURN & "-- set the selected state of the button; 1 = enabled, 0 = disabled" after str 
     449  put RETURN & "-- accepts: #integer" after str 
     450  put RETURN & "" after str 
     451   
     452  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
     453  put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
     454  put RETURN & "on mGetCurrentRect me" after str 
     455  put RETURN & "" after str 
     456   
     457  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
     458  put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
     459  put RETURN & "on mTranslateRect me, trans" after str 
     460  put RETURN & "" after str 
     461   
     462  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
     463  put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
     464  put RETURN & "on mSetCurrentRect me, newRect" after str 
     465  put RETURN & "" after str 
     466   
     467  return str 
     468   
     469end 
     470 
     471 
     472-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     473on _____________INCOMING_MOUSE_EVENTS me 
     474end 
    112475-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    113476 
     
    117480   
    118481  mDoMouseDownAction me 
    119 end 
    120  
    121 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    122  
    123 on mDoMouseDownAction me 
    124    
    125   --  if (pOptions.getaprop(#toggle) = 1) and (pOptions.getaprop(#selected) = 1) then 
    126   --    --    pImg = pOffImg 
    127   --    pImg = pOverImg 
    128   --  else 
    129   --  pImg = pPressImg 
    130   --  end if 
    131    
    132   -- alex am 1. August 2004 um 10:59 
    133   if length(string(pOptions.getaprop(#groupname))) then 
    134      
    135     if not pOptions.getaprop(#selected) then 
    136        
    137       if pKlickSound.length then 
    138         puppetsound pKlickSound 
    139         updatestage 
    140         pZeiter = the ticks 
    141       end if 
    142        
    143       if pImg <> pPressImg then 
    144         pImg = pPressImg 
    145         mSendUpdate me 
    146       end if 
    147        
    148     end if 
    149      
    150     mSendEvent me, #mouseDown 
    151      
    152   else 
    153     -- alex am 1. August 2004 um 10:59 
    154      
    155     if pImg <> pPressImg then 
    156       pImg = pPressImg 
    157       mSendUpdate me 
    158     end if 
    159      
    160     if pKlickSound.length then 
    161       puppetsound pKlickSound 
    162       updatestage 
    163       pZeiter = the ticks 
    164     end if 
    165      
    166     mSendEvent me, #mouseDown 
    167   end if 
    168    
    169482end 
    170483 
     
    177490   
    178491  mDoMouseUpAction me 
    179 end 
    180  
    181 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    182  
    183 on mDoMouseUpAction me 
    184    
    185   -- alex am 1. August 2004 um 10:59 
    186   if length(string(pOptions.getaprop(#groupname))) then 
    187      
    188     if not pOptions.getaprop(#selected) then 
    189       pOptions[#selected] = 1 
    190        
    191       if pKlickSound.length then 
    192         if (pZeiter + 20) < the ticks then 
    193           puppetsound pKlickSound 
    194           updatestage 
    195         end if 
    196       end if 
    197        
    198       --      if pImg <> pPressImg then 
    199       --        pImg = pPressImg 
    200       --        mSendUpdate me 
    201       --      end if 
    202       if pImg <> pSelectedImg then 
    203         pImg = pSelectedImg 
    204         mSendUpdate me 
    205       end if 
    206        
    207       mSendEvent me, #mouseUp 
    208        
    209     else 
    210        
    211       mSendEvent me, #mouseUp, 1 
    212     end if 
    213      
    214   else 
    215     -- alex am 1. August 2004 um 10:59 
    216      
    217     if pKlickSound.length then 
    218       if (pZeiter + 20) < the ticks then 
    219         puppetsound pKlickSound 
    220         updatestage 
    221       end if 
    222     end if 
    223      
    224      
    225     pOptions[#selected] = not pOptions.getaprop(#selected) 
    226      
    227     if (pOptions.getaprop(#toggle) = 1) and (pOptions.getaprop(#selected) = 1) then 
    228       if pImg <> pSelectedImg then 
    229         pImg = pSelectedImg 
    230         mSendUpdate me 
    231       end if 
    232     else 
    233       if pImg <> pOverImg then 
    234         pImg = pOverImg 
    235         mSendUpdate me 
    236       end if 
    237     end if 
    238      
    239     mSendEvent me, #mouseUp 
    240      
    241   end if 
    242    
    243492end 
    244493 
     
    322571end 
    323572 
    324 --on mKeyDown me, tk, kc 
    325 --  put kc 
    326 --  end 
    327  
    328 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    329 -- xxxxxxxxxxxxxxxxxx Public Handlers 
    330 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    331  
    332 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    333  
    334 -- get the options list of the button 
    335 -- returns: #property list 
    336 on mGetOptionsList me 
    337   if ilk(pOptions) <> #proplist then return [:] 
    338   return pOptions 
    339 end 
    340  
    341  
    342 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    343 -- change the text: 
    344 -- accepts: #string 
    345 on mChangeLabel me, newLabel 
    346   if ilk(newLabel) <> #string then exit 
    347   pOptions[#label] = newLabel 
    348   mInitImgs me 
    349 end 
    350  
    351 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    352  
    353 -- special case of label change 
    354 -- if mTranslate() yields another result the labels will change 
    355 -- accepts: #string 
    356 on mChangeLanguage me 
    357   mInitImgs me 
    358 end 
    359  
    360 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    361  
    362 -- toggle the enabled state of the button; 1 = enable, 0 = disable 
    363 -- accepts: #integer 
    364 on mEnableMe me, val 
    365   if voidP(val) then val = not(pOptions.getaprop(#enabled)) 
    366   if pOptions.getaprop(#enabled) = val then exit 
    367    
    368   pOptions[#enabled] = val 
    369   doUpd = 0 
    370   if val then 
    371     if pImg <> pOffImg then 
    372       pImg = pOffImg 
    373       doUpd = 1 
    374     end if 
    375   else 
    376     if pImg <> pDisabledImg then 
    377       pImg = pDisabledImg 
    378       doUpd = 1 
    379     end if 
    380   end if 
    381    
    382   mSendEvent me, #enable 
    383   if doUpd = 1 then mSendUpdate me 
    384 end 
    385  
    386 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    387  
    388 -- get the enabled state of the button; 1 = enabled, 0 = disabled 
    389 -- returns: #integer 
    390 on mGetEnabled me 
    391   return pOptions[#enabled] 
    392 end 
    393  
    394 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    395  
    396 -- change the event which shall be sent on mouseUp 
    397 -- accepts: #symbol, #string 
    398 on mSetFunction me, newFunction 
    399   newFunction = symbol(newFunction) 
    400   pOptions[#callFunction] = newFunction 
    401 end 
    402  
    403 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    404  
    405 -- add a reference to an instance or sprite to the list of instances that get sent the event 
    406 -- accepts: #object, #integer 
    407 on mAddToBroadcastlist me, referenz 
    408   if not pOptions[#broadcastSprites].getPos(referenz) then pOptions[#broadcastSprites].add(referenz) 
    409 end 
    410  
    411 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    412  
    413 -- remove a reference to an instance or sprite from the list of instances that get sent the event 
    414 -- accepts: #object, #integer 
    415 on mRemoveFromBroadcastlist me, referenz 
    416   pOptions[#broadcastSprites].deleteOne(referenz) 
    417 end 
    418  
    419 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    420  
    421 -- get the selected state of the button; 1 = selected, 0 = not selected 
    422 -- returns: #integer 
    423 on mGetState me 
    424   return pOptions[#selected] 
    425 end 
    426  
    427 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    428  
    429 -- set the selected state of the button; 1 = enabled, 0 = disabled 
    430 -- accepts: #integer 
    431 on mSetState me, selState 
    432   if selState = pOptions.getaprop(#selected) then exit 
    433   pOptions[#selected] = selState 
    434    
    435   pDown = 0 
    436    
    437   if not(mGetEnabled(me)) then exit 
    438    
    439   if (pOptions.getaprop(#toggle) = 1) and (pOptions.getaprop(#selected) = 1) then 
    440     if pImg <> pSelectedImg then 
    441       pImg = pSelectedImg 
    442       mSendUpdate me 
    443     end if 
    444      
    445   else if length(string(pOptions.getaprop(#groupname))) and (pOptions.getaprop(#selected) = 1) then 
    446     if pImg <> pSelectedImg then 
    447       pImg = pSelectedImg 
    448       mSendUpdate me 
    449     end if 
    450      
    451   else 
    452     if pImg <> pOffImg then 
    453       pImg = pOffImg 
    454       mSendUpdate me 
    455     end if 
    456   end if 
    457 end 
    458  
    459 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    460  
    461 on mGetCurrentRect me 
    462   return pRect 
    463 end 
    464  
    465 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    466  
    467 on mTranslateRect me, trans 
    468   if ilk(trans) = #point then pRect = pRect.offset(trans[1], trans[2]) 
    469   pOptions[#myRect] = pRect 
    470   pCallerRef.mForceRectUpdate(me, pMyName) 
    471   mSendUpdate me 
    472 end 
    473  
    474 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    475  
    476 on mSetCurrentRect me, newRect 
    477   if ilk(newRect) = #rect then pRect = newRect 
    478   pOptions[#myRect] = pRect 
    479   pCallerRef.mForceRectUpdate(me, pMyName) 
    480   mSendUpdate me 
    481 end 
    482  
    483 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    484  
    485 on interface me 
    486   str = "" 
    487    
    488   put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
    489   put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
    490   put RETURN & "on mGetOptionsList me" after str 
    491   put RETURN & "-- get the options list of the button" after str 
    492   put RETURN & "-- returns: #property list" after str 
    493   put RETURN & "" after str 
    494    
    495   put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
    496   put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
    497   put RETURN & "on mChangeLabel me, newLabel" after str 
    498   put RETURN & "-- change the text:" after str 
    499   put RETURN & "-- accepts: #string" after str 
    500   put RETURN & "" after str 
    501    
    502   put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
    503   put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
    504   put RETURN & "on mChangeLanguage me" after str 
    505   put RETURN & "-- special case of label change" after str 
    506   put RETURN & "-- if mTranslate() yields another result the labels will change" after str 
    507   put RETURN & "-- accepts: #string" after str 
    508   put RETURN & "" after str 
    509    
    510   put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
    511   put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
    512   put RETURN & "on mEnableMe me, val" after str 
    513   put RETURN & "-- toggle the enabled state of the button; 1 = enable, 0 = disable" after str 
    514   put RETURN & "-- accepts: #integer" after str 
    515   put RETURN & "" after str 
    516    
    517   put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
    518   put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
    519   put RETURN & "on mGetEnabled me" after str 
    520   put RETURN & "-- get the enabled state of the button; 1 = enabled, 0 = disabled" after str 
    521   put RETURN & "-- returns: #integer" after str 
    522   put RETURN & "" after str 
    523    
    524   put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
    525   put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
    526   put RETURN & "on mSetFunction me, newFunction" after str 
    527   put RETURN & "-- change the event which shall be sent on mouseUp" after str 
    528   put RETURN & "-- accepts: #symbol, #string" after str 
    529   put RETURN & "" after str 
    530    
    531   put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
    532   put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
    533   put RETURN & "on mAddToBroadcastlist me, referenz" after str 
    534   put RETURN & "-- add a reference to an instance or sprite to the list of instances that get sent the event" after str 
    535   put RETURN & "-- accepts: #object, #integer" after str 
    536   put RETURN & "" after str 
    537    
    538   put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
    539   put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
    540   put RETURN & "on mRemoveFromBroadcastlist me, referenz" after str 
    541   put RETURN & "-- remove a reference to an instance or sprite from the list of instances that get sent the event" after str 
    542   put RETURN & "-- accepts: #object, #integer" after str 
    543   put RETURN & "" after str 
    544    
    545   put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
    546   put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
    547   put RETURN & "on mGetState me" after str 
    548   put RETURN & "-- get the selected state of the button; 1 = selected, 0 = not selected" after str 
    549   put RETURN & "-- returns: #integer" after str 
    550   put RETURN & "" after str 
    551    
    552   put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
    553   put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
    554   put RETURN & "on mSetState me, selState" after str 
    555   put RETURN & "-- set the selected state of the button; 1 = enabled, 0 = disabled" after str 
    556 put RETURN & "-- accepts: #integer" after str 
    557   put RETURN & "" after str 
    558    
    559   put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
    560   put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
    561   put RETURN & "on mGetCurrentRect me" after str 
    562   put RETURN & "" after str 
    563    
    564   put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
    565   put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
    566   put RETURN & "on mTranslateRect me, trans" after str 
    567   put RETURN & "" after str 
    568    
    569   put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
    570   put RETURN & "-- xxxxxxxxxxxxxxxxxx Description" after str 
    571   put RETURN & "on mSetCurrentRect me, newRect" after str 
    572   put RETURN & "" after str 
    573    
    574   return str 
    575    
    576 end 
    577  
    578  
    579 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    580 -- xxxxxxxxxxxxxxxxxx Private Handlers 
     573 
     574-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     575on _____________PRIVATE_EVENTS me 
     576end 
    581577-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    582578 
     
    600596  --  end if 
    601597   
    602   buttonImgs = call(#mGetButtonImages, [mGetXScript(#ButtonImageCreator)], pOptions.getaprop(#label), pOptions) 
     598  buttonImgs = call(#mGetButtonImages, mGetXScript(#ButtonImageCreator), pOptions.getaprop(#label), pOptions) 
    603599  if not(listP(buttonImgs)) then 
    604600    alert "You need the ButtonImageCreator script in order to run this script" 
     
    641637   
    642638end 
     639 
     640-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     641 
     642on mSendUpdate me 
     643  call(#mUpdateImage, [pCallerRef], pImg, me, pMyName) 
     644end 
     645 
     646-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     647on _____________MOUSE_EVENT_HANDLING me 
     648end 
     649-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     650 
     651on mDoMouseDownAction me 
     652   
     653  --  if (pOptions.getaprop(#toggle) = 1) and (pOptions.getaprop(#selected) = 1) then 
     654  --    --    pImg = pOffImg 
     655  --    pImg = pOverImg 
     656  --  else 
     657  --  pImg = pPressImg 
     658  --  end if 
     659   
     660  -- alex am 1. August 2004 um 10:59 
     661  if length(string(pOptions.getaprop(#groupname))) then 
     662     
     663    if not pOptions.getaprop(#selected) then 
     664       
     665      if pKlickSound.length then 
     666        puppetsound pKlickSound 
     667        updatestage 
     668        pZeiter = the ticks 
     669      end if 
     670       
     671      if pImg <> pPressImg then 
     672        pImg = pPressImg 
     673        mSendUpdate me 
     674      end if 
     675       
     676    end if 
     677     
     678    mSendEvent me, #mouseDown 
     679     
     680  else 
     681    -- alex am 1. August 2004 um 10:59 
     682     
     683    if pImg <> pPressImg then 
     684      pImg = pPressImg 
     685      mSendUpdate me 
     686    end if 
     687     
     688    if pKlickSound.length then 
     689      puppetsound pKlickSound 
     690      updatestage 
     691      pZeiter = the ticks 
     692    end if 
     693     
     694    mSendEvent me, #mouseDown 
     695  end if 
     696   
     697end 
     698 
     699 
     700-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     701 
     702on mDoMouseUpAction me 
     703   
     704  -- alex am 1. August 2004 um 10:59 
     705  if length(string(pOptions.getaprop(#groupname))) then 
     706     
     707    if not pOptions.getaprop(#selected) then 
     708      pOptions[#selected] = 1 
     709       
     710      if pKlickSound.length then 
     711        if (pZeiter + 20) < the ticks then 
     712          puppetsound pKlickSound 
     713          updatestage 
     714        end if 
     715      end if 
     716       
     717      --      if pImg <> pPressImg then 
     718      --        pImg = pPressImg 
     719      --        mSendUpdate me 
     720      --      end if 
     721      if pImg <> pSelectedImg then 
     722        pImg = pSelectedImg 
     723        mSendUpdate me 
     724      end if 
     725       
     726      mSendEvent me, #mouseUp 
     727       
     728    else 
     729       
     730      mSendEvent me, #mouseUp, 1 
     731    end if 
     732     
     733  else 
     734    -- alex am 1. August 2004 um 10:59 
     735     
     736    if pKlickSound.length then 
     737      if (pZeiter + 20) < the ticks then 
     738        puppetsound pKlickSound 
     739        updatestage 
     740      end if 
     741    end if 
     742     
     743     
     744    pOptions[#selected] = not pOptions.getaprop(#selected) 
     745     
     746    if (pOptions.getaprop(#toggle) = 1) and (pOptions.getaprop(#selected) = 1) then 
     747      if pImg <> pSelectedImg then 
     748        pImg = pSelectedImg 
     749        mSendUpdate me 
     750      end if 
     751    else 
     752      if pImg <> pOverImg then 
     753        pImg = pOverImg 
     754        mSendUpdate me 
     755      end if 
     756    end if 
     757     
     758    mSendEvent me, #mouseUp 
     759     
     760  end if 
     761   
     762end 
  • trunk/lingosource/castlib3/GetSetPrefs.ls

    r14 r18  
    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 
     
    8585        thePrefs = "" 
    8686      else 
     87         
     88        resetUNames = 0 
     89        if the platform contains "mac" then 
     90        if baSysFolder("prefs") starts "/" then 
     91          baReturnUnixNames(0) 
     92          resetUNames = 1 
     93        end if 
     94        end if 
     95         
    8796        prefspath = baSysFolder("prefs") 
     97         
     98        if resetUNames = 1 then baReturnUnixNames(1) 
     99         
    88100        thePath = prefspath & prefsname 
    89101        fio.openfile(thePath, 1) 
     
    165177   
    166178  if offset("<?xml", prefsText.line[1]) > 0 then 
    167     delete line 1 of prefsText 
    168      
    169     gPrefs = call(#mGetListFromXMLString, [mGetXScript(#PseudoXMLPS)], prefsText) 
    170     if ilk(gPrefs) = #proplist then globs[#gPrefs] = gPrefs 
     179--    delete line 1 of prefsText 
     180     
     181    gPrefs = call(#mGetListFromXMLString, mGetXScript(#PseudoXMLPS), prefsText) 
     182    if objectP(gPrefs) then globs[#gPrefs] = gPrefs 
    171183     
    172184  else 
     
    249261      if objectP(fio) then 
    250262         
     263        resetUNames = 0 
     264        if the platform contains "mac" then 
     265        if baSysFolder("prefs") starts "/" then 
     266          baReturnUnixNames(0) 
     267          resetUNames = 1 
     268        end if 
     269        end if 
     270         
    251271        prefpfad = baSysFolder("prefs")&prefsname 
     272         
     273        if resetUNames = 1 then baReturnUnixNames(1) 
    252274         
    253275        fio.openfile(prefpfad, 1) 
     
    302324   
    303325  if useAleXML then 
    304     prefStr = call(#mGetXMLStringFromList, [mGetXScript(#PseudoXMLPS)], prefliste, prefsname) 
     326    prefStr = call(#mGetXMLStringFromList, mGetXScript(#PseudoXMLPS), prefliste, prefsname) 
    305327    --    put "<? alexml ?>"&RETURN before prefStr 
    306328    -- put "<?xml version="&QUOTE&"1.0"&QUOTE&"?>"&RETURN before prefStr 
     
    313335    repeat with n = 1 to anz 
    314336       
    315       if ilk(prefliste) = #proplist then prefStr = string(prefliste.getPropAt(n))&"À" 
     337      if objectP(prefliste) then prefStr = string(prefliste.getPropAt(n))&"À" 
    316338       
    317339      dieserWert = prefliste[n] 
  • trunk/lingosource/castlib3/ImageUtilityScripts.ls

    r15 r18  
    11-- xxxxx IMAGING UTILS 
    2 -- Alex da Franca ©2002  da.franca@online.de 
     2-- Alex da Franca c2002  da.franca@online.de 
    33-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    44 
     
    1919 
    2020on mDrehImg me, img, deg, tws 
     21   
     22  if deg mod 90 = 0 then tws = 0 
     23   
    2124  deg = (pi()/180) * deg 
    2225   
     
    8184    links = 0 
    8285     
    83     cms = mGetXScript(#commonMovieScript) 
    84     h = call(#mGetNextLowerPowerOfTwo, [cms], (hoehe - oben)) 
     86    cms = mGetXScript() 
     87    h = cms.mGetNextLowerPowerOfTwo(hoehe - oben) 
    8588     
    8689    unten = oben + h 
     
    232235     
    233236    --    maskImg = image(breite, hoehe, maske.depth, 0, maske.paletteref) 
    234     maskImg = image(breite, hoehe, 32) -- 32 bit is twice as fast on the mac ???!!! and can be used as mask also 
     237    -- maskImg = image(breite, hoehe, 32) -- 32 bit is twice as fast on the mac ???!!! and can be used as mask also 
     238    maskImg = image(breite, hoehe, 8, 0, #grayscale) 
    235239     
    236240    usemask = 1 
     
    397401-- spiegelt ein image horizontal 
    398402on mSpiegelHoriz me, img 
    399   temp = img.duplicate() 
    400   dasRect = img.rect 
    401   breite = dasRect.width 
    402   hoehe = dasRect.height 
    403    
    404   if (img.useAlpha and img.depth = 32) then 
    405     maske = mSpiegelHoriz(me, img.extractalpha()) 
    406     oldUse = img.useAlpha 
    407     img.useAlpha = 0 
    408   end if 
    409    
    410   temp.copyPixels(img, [point(0, hoehe), point(breite, hoehe), point(breite,0), point(0, 0)], img.rect, [#dither:1]) 
    411    
    412   if ilk(maske) = #image then 
    413     img.useAlpha = oldUse 
    414     temp.setAlpha(maske) 
    415     temp.useAlpha = 1 
    416   end if 
    417    
    418   return temp 
     403  return mFlipImage(me, img, #horizontal) 
    419404end 
    420405 
     
    423408-- spiegelt ein image vertikal 
    424409on mSpiegelVerti me, img 
    425   temp = img.duplicate() 
    426   dasRect = img.rect 
    427   breite = dasRect.width 
    428   hoehe = dasRect.height 
    429    
    430   if (img.useAlpha and img.depth = 32) then 
    431     maske = mSpiegelVerti(me, img.extractalpha()) 
    432     oldUse = img.useAlpha 
    433     img.useAlpha = 0 
    434   end if 
    435    
    436   temp.copyPixels(img, [point(breite, 0), point(0, 0), point(0,hoehe), point(breite, hoehe)], img.rect, [#dither:1]) 
    437    
    438   if ilk(maske) = #image then 
    439     img.useAlpha = oldUse 
    440     temp.setAlpha(maske) 
    441     temp.useAlpha = 1 
     410  return mFlipImage(me, img, #vertical) 
     411end 
     412 
     413-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     414 
     415on mFlipImage me, theImage, theMode 
     416 
     417  temp = theImage.duplicate() 
     418  theRect = theImage.rect 
     419  theWidth = theRect.width 
     420  theHeight = theRect.height 
     421   
     422  if (theImage.useAlpha and theImage.depth = 32) then 
     423    theMask = mFlipImage(me, theImage.extractalpha(), theMode) 
     424    oldUse = theImage.useAlpha 
     425    theImage.useAlpha = 0 
     426  end if 
     427 
     428  if theMode = #horizontal then 
     429    theQuad = [point(theWidth, 0), point(0, 0), point(0, theHeight), point(theWidth, theHeight)] 
     430  else 
     431    theQuad = [point(0, theHeight), point(theWidth, theHeight), point(theWidth,0), point(0, 0)] 
     432  end if 
     433 
     434  temp.copyPixels(theImage, theQuad, theImage.rect, [#dither:1969]) 
     435   
     436  if ilk(theMask) = #image then 
     437    theImage.useAlpha = oldUse 
     438    temp.setAlpha(theMask) 
     439    temp.useAlpha = oldUse 
    442440  end if 
    443441   
     
    600598-- theImage = mGetTextImage("theString", [#font:"Geneva", #fontsize:36]) 
    601599 
    602 on mGetTextImage me, theString, options, maxWidth, templateTextMember, dontwrap 
     600on mGetTextImage me, theString, options, maxWidth, templateTextMember, dontwrap, dontCrop 
    603601   
    604602  if ilk(options) <> #proplist then options = [:] 
     
    613611      bm = member(saveName, castlib(saveImages)) 
    614612      -- alex changed for woody - mb -- 
    615       cms = mGetXScript(#commonMovieScript) 
    616       if call(#mGetMemType, [cms], bm) = #bitmap then return bm.image.duplicate() 
     613      cms = mGetXScript() 
     614      if cms.mGetMemType(bm) = #bitmap then return bm.image.duplicate() 
    617615      -- alex changed for woody - mb end -- 
    618616    end if 
     
    628626    if ilk(fontsize) <> #integer then fontsize = 12 
    629627    fontsize = abs(fontsize) 
    630     cms = mGetXScript(#commonMovieScript) 
    631     templateTextMember = call(#mGetATextMem, [cms], call(#mGetAFont, [cms], string(options.getaprop(#myFont))), fontsize, options.getaprop(#myAntialias)) 
    632   end if 
    633    
    634   templateTextMember.text = theString&" " 
     628    cms = mGetXScript() 
     629    templateTextMember = cms.mGetATextMem(cms.mGetAFont(string(options.getaprop(#myFont))), fontsize, options.getaprop(#myAntialias)) 
     630  end if 
     631   
     632  if options.getaprop(#dontSetText) <> 1 then templateTextMember.text = theString&" " 
    635633   
    636634  if ilk(maxWidth) <> #integer then maxWidth = 350 
     
    651649  if templateTextMember.fontstyle <> theFontstyle then templateTextMember.fontstyle = theFontstyle 
    652650   
    653    
    654   textbreite = templateTextMember.charPosToLoc((theString.length + 1)).locH 
    655   templateTextMember.char[theString.length + 1].delete() 
     651  oldboxType = templateTextMember.boxtype 
     652  templateTextMember.boxtype = #adjust 
     653  textbreite = 1 
     654  len = 0 
     655  lc = templateTextMember.line.count 
     656  repeat with n = 1 to lc 
     657    len = len + theString.line[n].length + 1 
     658    textbreite = max(textbreite, templateTextMember.charPosToLoc(len).locH) 
     659  end repeat 
     660  -- textbreite = templateTextMember.charPosToLoc((theString.length + 1)).locH 
     661  if options.getaprop(#dontSetText) <> 1 then templateTextMember.char[theString.length + 1].delete() 
     662  if oldboxType <> #adjust then templateTextMember.boxtype = oldboxType 
    656663   
    657664  textimg = templateTextMember.image.extractalpha() 
    658   textimg = textimg.crop(rect(0, 0, textbreite, textimg.height)) 
     665   
     666  if dontCrop <> 1 then textimg = textimg.crop(rect(0, 0, textbreite, textimg.height)) 
    659667   
    660668   
     
    11851193on interface me 
    11861194   
    1187   str = "IMAGING LINGO UTILS by alex da franca ©2003 -- alex@farbflash.de -- all rigths reserved" 
     1195  str = "IMAGING LINGO UTILS by alex da franca c2003 -- alex@farbflash.de -- all rigths reserved" 
    11881196   
    11891197  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
  • trunk/lingosource/castlib3/PseudoXMLPS.ls

    r15 r18  
    1 -- Pseudo XML by Alex da Franca ©2003 
     1-- PseudoXMLPS 
     2----------------------------------- 
     3-- CREATED: 
     4-- 06.03.2008 
     5-- 
     6-- DESCRIPTION: 
     7--              Pseudo XML by Alex da Franca c2003 
    28-- Convert a lingo list to a XML like string and back 
    39 
    4 -- alex am Freitag 21.April.2006 16:31:57 
    5 -------------------------------------------------------- 
    6 -- fixed a bug in "mBuildXMLString" many thanks to Olaf Schliesing for pointing this out 
    7  
    8 -- alex am 28.11.06 um 16:41:00 
    9 -------------------------------------------------------- 
    10 -- finally added a tag property, when writing xml, so the ilk of the object gets stored 
    11 -- so, when reading back the xml file, we do not convert a node by accident to a value 
    12 -- when a string evaluates to a value "by accident" 
    13  
    14 --------------------------------- 
    15 -- Scriptmarker: changes alex (04.04.2007 at 10:22 Uhr) // Scriptmarker 
    16 -- added  escaping of:  
    17 --                     & -> &amp; 
    18 --                     ' -> &apos; 
    19 --                     " -> &quot; 
    20 -- and vice versa. Until now I only escaped < and >, but ampersand, apostrophe and quote must also be escaped for proper xml 
    21  
    22 -- I als added "support" for the CData tag, which allows you to escape the whole contents of a node. 
    23 -- support is only done through ignoring esaping the special characters, wehn BUILDING the xml string. 
    24 -- So the user can decide on his own, which nodes s/he wants to be masked inside a CData section 
    25 -- (otherwise I'd have to mask EVERY string and try to unmask EVERY node. Now the user is on his own) 
    26  
    27 -- Example: 
     10-- 
     11-- REQUIRES: 
     12-- (Prerequisites) 
     13-- 
     14-- USAGE: 
    2815-- myList = [#stringWithInvalidChars:"A string with invalid chars like <> and & and ' and " & QUOTE] 
    2916-- myList[#stringWithInvalidChars] = "<![CDATA[" & myList[#stringWithInvalidChars] & "]]>" 
     
    4128--   end if 
    4229-- end repeat 
    43  
    44  
    45 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    46 -- xxxxxxxxxxxxxxxxxx Public Handlers 
     30-- 
     31-- HISTORY: 
     32 
     33--              alex am Freitag 21.April.2006 16:31:57 
     34--              fixed a bug in "mBuildXMLString" many thanks to Olaf Schliesing for pointing this out 
     35-- 
     36--              alex am 28.11.06 um 16:41:00 
     37--              finally added a tag property, when writing xml, so the ilk of the object gets stored 
     38--              so, when reading back the xml file, we do not convert a node by accident to a value 
     39--              when a string evaluates to a value "by accident" 
     40-- 
     41--              Scriptmarker: changes alex (04.04.2007 at 10:22 Uhr) // Scriptmarker 
     42--              added  escaping of:  
     43--                                   & -> &amp; 
     44--                                   ' -> &apos; 
     45--                                   " -> &quot; 
     46--              and vice versa. Until now I only escaped < and >, but ampersand, apostrophe and quote must also be escaped for proper xml 
     47--              I als added "support" for the CData tag, which allows you to escape the whole contents of a node. 
     48--              support is only done through ignoring esaping the special characters, wehn BUILDING the xml string. 
     49--              So the user can decide on his own, which nodes s/he wants to be masked inside a CData section 
     50--              (otherwise I'd have to mask EVERY string and try to unmask EVERY node. Now the user is on his own) 
     51-- TODO: 
     52-- - 
     53----------------------------------- 
     54 
     55 
     56 
     57on ___________PUBLIC_EVENTS me 
     58end 
    4759-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    4860 
     
    6072 
    6173on interface me 
    62   str = "Pseudo XML Script  by alex da franca ©2003 -- alex@farbflash.de -- all rigths reserved" 
     74  str = "Pseudo XML Script  by alex da franca c2003 -- alex@farbflash.de -- all rigths reserved" 
    6375  put RETURN & "version 1" after str 
    6476   
     
    112124-- xxxxxxxxxxxxxxxxxx Convert lingo list (also nested lists) to XML stylish string 
    113125 
    114 -- Parameters: 
     126on mGetXMLStringFromList me, listref, docName, strict, dontReplaceGT, withParams 
     127  ----------------------------------- 
     128  -- CREATED: 06.03.2008 
     129  -- ACTION: Convert lingo list (also nested lists) to XML stylish string 
     130  -- INPUT:  
    115131-- <listref> format: property list or linear list 
    116132-- <docName> format: #string; optional. if omitted "Untitled" is used for the XML document name 
    117 -- strict        => boolean; avoid spaces in tag names 
    118 -- dontReplaceGT => boolean; dont replace < and > 
    119 -- withParams    => boolean; write attribute in tag for the lingo ilk => bigger xml files and unfortunately it is slower to parse 
     133  --              <strict>        => boolean; avoid spaces in tag names 
     134  --              <dontReplaceGT> => boolean; dont replace < and > 
     135  --              <withParams>    => boolean; write attribute in tag for the lingo ilk => bigger xml files and unfortunately it is slower to parse 
    120136----------------------------- (I thought avoiding value() would help, but in this case the additional text parsing of the attributes tag slows down) 
    121  
    122 -- Example: 
    123 -- saveString = mGetXMLStringFromList(me, lingo_list, "documentName") 
    124  
    125 on mGetXMLStringFromList me, listref, docName, strict, dontReplaceGT, withParams 
     137  -- RETURNS: string 
     138  -- EXAMPLE: saveString = mGetXMLStringFromList(me, lingo_list, "documentName") 
     139  ----------------------------------- 
     140   
    126141  --  ms = the milliseconds 
    127142  if voidP(strict) then strict = 0 
     
    152167-- xxxxxxxxxxxxxxxxxx Convert XML stylish string to lingo list 
    153168 
    154 -- Parameters: 
     169 
     170on mGetListFromXMLString me, str, convertValues, withParams 
     171  ----------------------------------- 
     172  -- CREATED: 06.03.2008 
     173  -- ACTION: Description 
     174  -- INPUT: 
    155175-- <str> format: #string; split a string using <> and </> tags into lingo list 
    156176-- <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) 
    157  
    158 -- Example: 
    159 -- lingo_list = mGetListFromXMLString(me, saveString) 
    160  
    161 on mGetListFromXMLString me, str, convertValues, withParams 
     177  --          <withParams> : #boolean : parse parameters too. new, not very well tested 
     178  -- RETURNS: property list 
     179  -- EXAMPLE: lingo_list = mGetListFromXMLString(me, saveString) 
     180  -- CHANGES: implemented parameter parsing 
     181  ----------------------------------- 
    162182   
    163183  ms = the milliseconds 
     
    193213 
    194214-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    195 -- MUCH FASTER than the above: Use the XML xtra to parse the string 
    196 -- BUT it must be a valid xml string, the above is slower but allows more malformed xml 
    197  
    198 -- Parameters: 
     215 
     216 
     217property pXmlxtraversion 
     218 
     219on mGetListFromXMLStringX me, str, convertValues, withParams 
     220  ----------------------------------- 
     221  -- CREATED: 06.03.2008 
     222  -- ACTION: Convert xml string to lingo list using the xmlparser xtra, if possible 
     223  --         MUCH FASTER than the above: Use the XML xtra to parse the string 
     224  --         BUT it must be a valid xml string, the above is slower but allows more malformed xml 
     225  -- INPUT:  
    199226-- <str> format: #string; split a string using <> and </> tags into lingo list 
    200227-- <convertValues> #integer 
     
    202229-- -- -- 1 => convert only integer() and float() (slower) 
    203230-- -- -- 2 => try to convert all data with value(), even parse for colors in hexstring format (slow) 
    204  
    205 -- Example: 
    206 -- lingo_list = mGetListFromXMLStringX(me, saveString) 
    207  
    208 property pXmlxtraversion 
    209  
    210 on mGetListFromXMLStringX me, str, convertValues, withParams 
     231  -- RETURNS: property list 
     232  -- EXAMPLE: lingo_list = mGetListFromXMLStringX(me, saveString) 
     233  -- CHANGES: resorts to the slower lingo function on xml parser error. So this handler can always be used. 
     234  ----------------------------------- 
    211235   
    212236  if ilk(str) <> #string then str = string(str) 
     
    251275  end if 
    252276   
    253   if pXmlxtraversion < 10 then return mGetListFromXMLString(me, str, convertValues) 
     277  if pXmlxtraversion < 10 then return mGetListFromXMLString(me, str, convertValues, withParams) 
    254278  ------------------ end XML Parser xtra version 10 check 
    255279   
     
    275299  if not(voidP(xt.getError())) then 
    276300    put "Script: PseudoXMLPS; Handler: mGetListFromXMLStringX; error:" && xt.getError() 
    277     return [:] 
     301    return mGetListFromXMLString(me, str, convertValues, withParams) 
    278302  end if 
    279303   
    280304  xx = xt.makePropList() 
    281   li = mConvertXMLPropList(me, [xx], convertValues) 
    282    
    283   --  put the milliseconds - ms 
     305  dontEscapeSpecialChars = 1 -- we do not need to do this, as the xmlparser xtra already did it for us 
     306  li = mConvertXMLPropList(me, [xx], convertValues, dontEscapeSpecialChars) 
     307   
     308 -- put "x" && the milliseconds - ms 
    284309   
    285310  if not(listP(li)) then return [:] 
     
    288313   
    289314end 
     315 
     316-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     317on _______________READ_WRITE_EXTERNAL_FILES 
     318end 
     319-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     320 
     321on mReadXML_2_List me, thePath 
     322  ----------------------------------- 
     323  -- CREATED: 06.03.2008 
     324  -- ACTION: read external xml file to lingo list 
     325  -- INPUT: <thePath> : string ; optional pathname. if no pathname or "", then a file save dialog is shown 
     326  -- RETURNS: property list 
     327  ----------------------------------- 
     328   
     329  dertext = xscr(#FileIOFunktionen).mGetTextFromFile(thePath) 
     330  if length(dertext) > 0 then return xscr(#PseudoXMLPS).mGetListFromXMLStringX(dertext) 
     331  return [:] 
     332end 
     333 
     334-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     335 
     336on mSaveList_2_XML me, theList, thePath 
     337  ----------------------------------- 
     338  -- CREATED: 06.03.2008 
     339  -- ACTION: write liongo list to external xml file 
     340  -- INPUT:  
     341  --          <theList> : linear or property list 
     342  --          <thePath> : string ; optional pathname. if no pathname or "", then a file selection dialog is shown 
     343  -- RETURNS: full pathname of newly created file, if successful, otherwise 0 
     344  ----------------------------------- 
     345   
     346  if not(listP(theList)) then return 0 
     347  theResult = xscr(#PseudoXMLPS).mGetXMLStringFromList(theList) 
     348  return xscr(#FileIOFunktionen).mSaveToTextFile(theResult, thePath) 
     349end 
     350 
    290351 
    291352-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     
    843904-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    844905 
    845 on mConvertXMLPropList me, inputlist, convertValues 
     906on mConvertXMLPropList me, inputlist, convertValues, dontEscapeSpecialChars 
    846907  retlist = [:] 
    847908  anz = count(inputlist) 
     
    860921      if count(val) then 
    861922        if ilk(retlist) = #proplist then 
    862         retlist.addProp(symbol(inputlist[n].getaprop(#name)), mConvertXMLPropList(me, val, convertValues)) 
     923        retlist.addProp(symbol(inputlist[n].getaprop(#name)), mConvertXMLPropList(me, val, convertValues, dontEscapeSpecialChars)) 
    863924      else 
    864           retlist.add(mConvertXMLPropList(me, val, convertValues)) 
     925          retlist.add(mConvertXMLPropList(me, val, convertValues, dontEscapeSpecialChars)) 
    865926        end if 
    866927      else 
     
    882943               
    883944              -- unescape <>&'" 
    884               val = mUnEscapeSpecialChars(me, val) 
     945               if dontEscapeSpecialChars <> 1 then val = mUnEscapeSpecialChars(me, val) 
    885946               
    886947            #integer: 
     
    903964               
    904965              -- unescape <>&'" 
    905               val = mUnEscapeSpecialChars(me, val) 
     966              if dontEscapeSpecialChars <> 1 then val = mUnEscapeSpecialChars(me, val) 
    906967               
    907968            else 
     
    917978               
    918979              -- unescape <>&'" 
    919               val = mUnEscapeSpecialChars(me, val) 
     980              if dontEscapeSpecialChars <> 1 then val = mUnEscapeSpecialChars(me, val) 
    920981               
    921982            else 
     
    927988             
    928989            -- unescape <>&'" 
    929             val = mUnEscapeSpecialChars(me, val) 
     990           if dontEscapeSpecialChars <> 1 then val = mUnEscapeSpecialChars(me, val) 
    930991             
    931992             
     
    9931054                         
    9941055                      else 
    995                         call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: Row "&n&" Cell "&m&" is not a property list") 
     1056                        call(#mPut, mGetXScript(), "mParseExcelXML: Row "&n&" Cell "&m&" is not a property list") 
    9961057                      end if -- if ilk(thisCell) = #proplist then 
    9971058                       
     
    9991060                     
    10001061                  else 
    1001                     call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: Row "&n&" is not a list") 
     1062                    call(#mPut, mGetXScript(), "mParseExcelXML: Row "&n&" is not a list") 
    10021063                  end if -- if listP(currRow) then 
    10031064                   
     
    10051066                 
    10061067              else 
    1007                 call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: Table not found") 
     1068                call(#mPut, mGetXScript(), "mParseExcelXML: Table not found") 
    10081069              end if -- if listP(xmlList) then 
    10091070               
    10101071            else 
    1011               call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: Worksheet not found") 
     1072              call(#mPut, mGetXScript(), "mParseExcelXML: Worksheet not found") 
    10121073            end if -- if ilk(xmlList) = #proplist then 
    10131074             
    10141075          else 
    1015             call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: Workbook not found") 
     1076            call(#mPut, mGetXScript(), "mParseExcelXML: Workbook not found") 
    10161077          end if -- if ilk(xmlList) = #proplist then 
    10171078           
    10181079        else 
    1019           call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: ROOT is not a property list") 
     1080          call(#mPut, mGetXScript(), "mParseExcelXML: ROOT is not a property list") 
    10201081        end if --if ilk(xmlList) = #proplist then 
    10211082         
    10221083      else 
    1023         call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: Xml parser makelist() returned empty list") 
     1084        call(#mPut, mGetXScript(), "mParseExcelXML: Xml parser makelist() returned empty list") 
    10241085      end if -- if count(xmlList) > 0 then 
    10251086       
    10261087    else 
    1027       call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: Xml parser makelist() failed") 
     1088      call(#mPut, mGetXScript(), "mParseExcelXML: Xml parser makelist() failed") 
    10281089    end if -- if listP(xmlList) then 
    10291090     
    10301091  else 
    1031     call(#mPut, [mGetXScript(#commonmoviescript)], "mParseExcelXML: Xml parser error: "&xmlp.getError()) 
     1092    call(#mPut, mGetXScript(), "mParseExcelXML: Xml parser error: "&xmlp.getError()) 
    10321093  end if -- if voidP(xmlp.getError()) then 
    10331094   
  • trunk/lingosource/castlib3/SliderScrollbarMenuParent.ls

    r15 r18  
    11-- Scrollbar Parentscript for vertical and horizontal scrollbars 
    2 -- Alex da Franca ©2002  da.franca@online.de 
     2-- Alex da Franca c2002  da.franca@online.de 
    33 
    44-- version 31.05.03 
     
    9696   
    9797  if not objectP(caller) then return 0 
    98   if ilk(options) <> #proplist then return 0 
     98  if not(objectP(options)) then return 0 
    9999   
    100100  pScrollerProps = options.duplicate() -- auf diese weise werden die einfachen werte dupliziert, aber die farben nur referenziert 
     
    123123   
    124124  commonMovieScript = mGetXScript() 
    125   if not(objectP(commonMovieScript)) then 
     125  if listP(commonMovieScript) then 
    126126    put "Can not use custom images for scrollbars because commonMovieScript is missing" 
    127127    exit 
     
    10721072    end if 
    10731073     
    1074     if ilk(alpImg) = #image then pSavedimg.useAlpha = 1 
     1074    if ilk(alpImg) = #image then 
     1075      pSavedimg.setAlpha(alpImg) 
     1076      pSavedimg.useAlpha = 1 
     1077    end if 
    10751078     
    10761079--    call(#mPut, mGetXScript(), pSavedimg, 0, "pSavedimg danach") 
     
    15641567 
    15651568on interface me 
    1566   str = "Scrollbar Script  by ullalal + alex da franca ©2002 -- alex@farbflash.de -- all rigths reserved" 
     1569  str = "Scrollbar Script  by ullalal + alex da franca c2002 -- alex@farbflash.de -- all rigths reserved" 
    15671570   
    15681571  put RETURN & "-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" after str 
  • trunk/lingosource/castlib3/SpriteNameBeaver.ls

    r14 r18  
    11-- SPRITENAMEN 
    2 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    32-- sprite naming behavior 
     3----------------------------------- 
     4-- CREATED: 
     5-- 
     6-- PROPERTIES: 
     7--!memberProperties: [#name: "SpriteNameBeaver", #scripttype: #score, #scriptSyntax: #lingo, #comments:"~/Documents/Scripts/lingo/SpriteNameBeaver.ls"] 
     8-- 
     9-- DESCRIPTION: 
     10--             lingo scripts to handle movies in a window 
     11--             director movies running in their own window -> new player instance 
     12--             authoring and runtime only, as in shockwave we can't open and communicate 
     13--             with other windows. 
     14----------------------------------- 
     15 
    416 
    517property pKanalname 
  • trunk/lingosource/castlib3/ToolTipBeaver_1.ls

    r14 r18  
    11-- ToolTip Behavior 
    2 -- by Alex da Franca ©2001   da.franca@online.de 
     2-- by Alex da Franca c2001   da.franca@online.de 
    33-- drag this behavior onto any sprite with the provided "ttimageSave" bitmap member 
    44-- customize the background color and the frame color of the tooltip by altering "ttimageSave" 
     
    5252 
    5353on interface me 
    54   str = "Mneu Script  by alex da franca ©2004 -- alex@farbflash.de -- all rigths reserved" 
     54  str = "Mneu Script  by alex da franca c2004 -- alex@farbflash.de -- all rigths reserved" 
    5555  put RETURN & "version 1.0" after str 
    5656  put RETURN & "--------------------------------------------------------" after str 
     
    9191  pSavedImg = pMember.image.duplicate() 
    9292  pSavedMask = pMaskMember.image.duplicate() 
    93   if pKanalname <> #kanalname then call(#mMeldeKanalname, [pIncludes.getaprop(#commonmoviescript)], pKanalname, me.spritenum) 
     93  if pKanalname <> #kanalname then call(#mMeldeKanalname, pIncludes.getaprop(#commonmoviescript), pKanalname, me.spritenum) 
    9494   
    9595  pOnScreen = 0 
     
    104104 
    105105on new me 
    106   pIncludes = (mGetAleXtras()).getaprop(#scripts) 
     106  pIncludes = [:] 
     107  pIncludes.setaprop(#commonmoviescript, xscr()) 
    107108  return me 
    108109end 
     
    127128  end repeat 
    128129   
    129   if pKanalname <> #kanalname then call(#mMeldeAbKanalname, [pIncludes.getaprop(#commonmoviescript)], pKanalname, me.spritenum) 
     130  if pKanalname <> #kanalname then call(#mMeldeAbKanalname, pIncludes.getaprop(#commonmoviescript), pKanalname, me.spritenum) 
    130131end 
    131132 
     
    420421   
    421422   
    422   derkanal = call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)], pThreedChannelName) 
     423  derkanal = call(#mGetKanal, pIncludes.getaprop(#commonmoviescript), pThreedChannelName) 
    423424  if derkanal > 0 then 
    424425    trect = rect(theLoc[1], theLoc[2], (theLoc[1] + theImg.width), (theLoc[2] + theImg.height)) 
     
    482483on mCreateOverlay me, spritename, whichImg, theLoc, maskImg 
    483484   
    484   kanal = call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)], spritename) 
     485  kanal = call(#mGetKanal, pIncludes.getaprop(#commonmoviescript), spritename) 
    485486  if kanal < 1 then return 0 
    486487  kanal = sprite(kanal) 
     
    497498  breite = whichImg.width 
    498499  hoehe = whichImg.height 
    499   powerbreite = call(#mGetNextPowerOfTwo, [pIncludes.getaprop(#commonmoviescript)], breite) 
    500   powerhoehe = call(#mGetNextPowerOfTwo, [pIncludes.getaprop(#commonmoviescript)], hoehe) 
     500  powerbreite = call(#mGetNextPowerOfTwo, pIncludes.getaprop(#commonmoviescript), breite) 
     501  powerhoehe = call(#mGetNextPowerOfTwo, pIncludes.getaprop(#commonmoviescript), hoehe) 
    501502   
    502503  if ilk(maskImg) = #image then 
     
    542543on mDeleteOverlay me, spritename 
    543544   
    544   kanal = call(#mGetKanal, [pIncludes.getaprop(#commonmoviescript)], spritename) 
     545  kanal = call(#mGetKanal, pIncludes.getaprop(#commonmoviescript), spritename) 
    545546  if kanal < 1 then return 0 
    546547  kanal = sprite(kanal) 
     
    611612   
    612613  memref = member(ttipname) 
    613   theType = call(#mGetMemType, [pIncludes.getaprop(#commonmoviescript)], memref) 
     614  theType = call(#mGetMemType, pIncludes.getaprop(#commonmoviescript), memref) 
    614615  if theType <> #empty then 
    615616    if theType = #bitmap then 
     
    623624   
    624625  tMember = member("TTipTemplate") 
    625   if call(#mGetMemType, [pIncludes.getaprop(#commonmoviescript)], tMember) <> #text then 
     626  if call(#mGetMemType, pIncludes.getaprop(#commonmoviescript), tMember) <> #text then 
    626627         
    627628    neuer = mCreateNewMember(me, #Text, 0) 
    628629    neuer.name = "TTipTemplate" 
    629     neuer.font = call(#mGetAFont, [pIncludes.getaprop(#commonmoviescript)], "Arial") 
     630    neuer.font = call(#mGetAFont, pIncludes.getaprop(#commonmoviescript), "Arial") 
    630631     
    631632    neuer.text = tooltiptext 
     
    638639     
    639640    -- polen problem: 
    640     thePrefs = (call(#mGetGlobalList, [pIncludes.getaprop(#commonmoviescript)])).getaprop(#gPrefs) 
     641    thePrefs = (call(#mGetGlobalList, pIncludes.getaprop(#commonmoviescript))).getaprop(#gPrefs) 
    641642    if ilk(thePrefs) = #proplist then 
    642643      textAA = thePrefs.getaprop(#textAA) 
  • trunk/lingosource/castlib3/commonMovieScript.ls

    r15 r18  
    1 -- Shared Global Handlers ©03 Alex da Franca -- alex@farbflash.de 
    2 --------------------------------------------------------------------- 
    3  
    4  
    5 -- these handlers are shared between all of my scripts Alex da Franca ©2003 alex@farbflash.de 
    6 -- for private use of my scripts -> poor documentation -> use at own risk ;-) 
    7  
    8 -- geaendert am 21.06.03 
    9 -- mGetInstance 0 -- clears all stored instances -> same as recompile all scripts, but that would clear all contents of (script "commonMovieScript").pGList 
    10 -- mApplyDynamic 
    11  
    12 -- alex am 13.03.2004 um 13:49 
    13 -- added DEBUG_FUNCTIONS 
    14  
    15 -- alex am 15.03.2004 um 08:50 
    16 -- added mGetPlatform() to get OSX 
    17 -- alex am 31.03.2004 um 11:42 
    18 -- added clearglobals to mDestroy handler 
    19  
    20 -- added support for new director MX2004 sprite names in my handlers by changing mGetKanal() to accept strings 
    21  
    22 -- alex am Freitag, 4. Juni 2004 
    23 -- took care about missing font asset xtra, if it isn't present, we'll get not a script error anymore 
    24 -- but rather the presence of the font is not checked instead, but rather assumed 
    25  
    26 -- alex am 16. Juni 2004 um 10:12 
    27 -- added mGetNextLowerPowerOfTwo 
    28  
    29 -- alex am 18. Juli 2004 um 08:02 
    30 -- added mMyClearGlobals() to erase the faked globals and get the new globallist 
    31  
    32 -- alex am 8. Oktober 2004 um 10:31 
    33 -- new tempmember handling due to a bug in director 
    34  
    35 -- alex am 23. November 2004 um 10:59 
    36 -- added mGetThisMovieName() and mSetThisMovieName() to identify the movie independant of the filename 
    37 -- this is needed for some places, where the standard scripts act differently in the different movies 
    38  
    39 -- Scriptmarker (21.07.2005 at 11:55 Uhr): changes // Scriptmarker 
    40 -- added mSplitPath 
    41  
    42  
    43  
    44  
    45 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    46 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    47  
    48 -- IMPORTANT NOTE !! 
    49 -- if you use my scripts you MUST call 'mCallDestroy()' at stopmovie in order to clean up temporary members used by my scripts 
    50 -- due to a bug in director I had to change the old behaavior of erasing the members on endsprite, when I was done with it ! 
    51 -- so now I use a list of temporary members, which is maintained during runtime, but must be processed when the movie is stopped 
    52 -- (unless you want to fill up your castlib with temporary members :-) 
    53  
    54 -- NOW: 
    55 -- if this script is NOT the first moviescript in your movie containing a stopmovie handler this one gets overriddden and 
    56 -- you must call 'mCallDestroy()' in your stopmovie handler. 
    57 -- otherwise when it this script comes before your script with the stopmovie handler your handler will never be called 
    58 -- since the stopmovie event is caught here... 
    59 -- in that case just comment it out here and add the 'mCallDestroy()' to your own stopmovie handler 
    60  
    61 --on stopmovie me 
    62 --  mCallDestroy 
    63 --end 
     1-- commonMovieScript 
     2----------------------------------- 
     3-- CREATED: 
     4--              11.02.2008 
     5-- 
     6-- DESCRIPTION:       
     7--              Shared Global Handlers c03 Alex da Franca -- alex@farbflash.de 
     8--              ------------------------------------------------------------------- 
     9--              these handlers are shared between all of my scripts Alex da Franca c2003 alex@farbflash.de 
     10--              for private use of my scripts -> poor documentation -> use at own risk ;-) 
     11 
     12-- HISTORY: 
     13--              geaendert am 21.06.03 
     14--              mGetInstance 0 -- clears all stored instances -> same as recompile all scripts, but that would clear all contents of (script "commonMovieScript").pGList 
     15--              mApplyDynamic 
     16 
     17--              alex am 13.03.2004 um 13:49 
     18--              added DEBUG_FUNCTIONS 
     19 
     20--              alex am 15.03.2004 um 08:50 
     21--              added mGetPlatform() to get OSX 
     22--              alex am 31.03.2004 um 11:42 
     23--              added clearglobals to mDestroy handler 
     24 
     25--              added support for new director MX2004 sprite names in my handlers by changing mGetKanal() to accept strings 
     26 
     27--              alex am Freitag, 4. Juni 2004 
     28--              took care about missing font asset xtra, if it isn't present, we'll get not a script error anymore 
     29--              but rather the presence of the font is not checked instead, but rather assumed 
     30 
     31--              alex am 16. Juni 2004 um 10:12 
     32--              added mGetNextLowerPowerOfTwo 
     33 
     34--              alex am 18. Juli 2004 um 08:02 
     35--              added mMyClearGlobals() to erase the faked globals and get the new globallist 
     36 
     37--              alex am 8. Oktober 2004 um 10:31 
     38--              new tempmember handling due to a bug in director 
     39 
     40--              alex am 23. November 2004 um 10:59 
     41--              added mGetThisMovieName() and mSetThisMovieName() to identify the movie independant of the filename 
     42--              this is needed for some places, where the standard scripts act differently in the different movies 
     43 
     44--              Scriptmarker (21.07.2005 at 11:55 Uhr): changes // Scriptmarker 
     45--              added mSplitPath 
     46 
     47-- 
     48-- WARNINGS: 
     49--              IMPORTANT NOTE !! 
     50--              if you use my scripts you MUST call 'mCallDestroy()' at stopmovie in order to clean up temporary members used by my scripts 
     51--              due to a bug in director I had to change the old behaavior of erasing the members on endsprite, when I was done with it ! 
     52--              so now I use a list of temporary members, which is maintained during runtime, but must be processed when the movie is stopped 
     53--              (unless you want to fill up your castlib with temporary members :-) 
     54 
     55--              If this script is NOT the first moviescript in your movie containing a stopmovie handler this one gets overriddden and 
     56--              you must call 'mCallDestroy()' in your stopmovie handler. 
     57--              otherwise when it this script comes before your script with the stopmovie handler your handler will never be called 
     58--              since the stopmovie event is caught here... 
     59--              in that case just comment it out here and add the 'mCallDestroy()' to your own stopmovie handler 
     60 
     61--              on stopmovie me 
     62--              mCallDestroy 
     63--              end 
     64-- TODO: 
     65--              - 
     66----------------------------------- 
    6467 
    6568-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     
    7275 
    7376on mGetGlobalList me 
     77  ----------------------------------- 
     78  --         ACTION: We keep a list of "faked global variables" 
     79  --                 Using real global variables has the drawback, 
     80  --                 that they may clash with the host movies globals 
     81  --                 and even worse: all movie instances running in the same player 
     82  --                 instance -> MIAWs share only one global space 
     83  --                 Since these scripts are also used in my authoring tools 
     84  --                 they can behave nicely, if running as miaws in any environment 
     85  --         INPUT: - 
     86  --         RETURNS: property list with global variables 
     87  --         NOTES: If possible only use the set and get handlers (mSetGlobalValue, mGetGlobalValue) 
     88  ----------------------------------- 
     89   
    7490  if voidP(pGList) then 
    7591    pGList = [:] 
    7692    scr = mGetXScript(#regisx) 
    77     if not voidP(scr) then 
     93    if not listP(scr) then 
    7894      if mCheckForXtra(me, "BudAPI") = 1 then call(#regisb, scr) 
    7995      if mCheckForXtra(me, "vList") = 1 then call(#regisv, scr) 
     
    86102 
    87103on mMyClearGlobals me 
     104  ----------------------------------- 
     105  --         CREATED: 11.02.2008 
     106  --         ACTION: Clear the global list at runtime (at authortime a "Recompile all scripts" does the same) 
     107  --                 See description for "Faked globals" at handler [#mGetGlobalList_commonMovieScript mGetGlobalList] 
     108  --         INPUT: - 
     109  --         RETURNS: - 
     110  ----------------------------------- 
     111   
    88112  pGList = [:] 
    89113  return pGList 
     
    94118 
    95119on mSetGlobalValue me, propName, newValue 
     120  ----------------------------------- 
     121  --         ACTION: Set the value for a "global" variable 
     122  --                 If the "global" with the name #propname doesn't exits it gets created 
     123   
     124  --                 Interface to the "private globals" stored in this uninstatiated script as property 
     125  --                 See description for "Faked globals" at handler [#mGetGlobalList_commonMovieScript mGetGlobalList] 
     126   
     127  --         INPUT: propName: symbol; name of global value 
     128  --                newValue: any value 
     129  --         RETURNS: - 
     130  ----------------------------------- 
     131   
    96132  g = mGetGlobalList(me) 
    97133  g.setaprop(propName, newValue) 
     
    102138 
    103139on mGetGlobalValue me, propName 
     140  ----------------------------------- 
     141  --         ACTION: Get the value for a "global" variable 
     142  --                 If the "global" with the name #propname doesn't exits it returns void 
     143   
     144  --                 Interface to the "private globals" stored in this uninstatiated script as property 
     145  --                 See description for "Faked globals" at handler [#mGetGlobalList_commonMovieScript mGetGlobalList] 
     146   
     147  --         INPUT: propName: symbol; name of global value 
     148  --         RETURNS: - 
     149  ----------------------------------- 
     150   
    104151  g = mGetGlobalList(me) 
    105152  return g.getaprop(propName) 
     
    109156 
    110157on mCallDestroy me 
     158  ----------------------------------- 
     159  --         CREATED: 12.02.2008 
     160  --         ACTION: Call to clean everything up on stopmovie 
     161  --         INPUT: - 
     162  --         RETURNS: - 
     163  ----------------------------------- 
     164   
    111165   
    112166  sendAllSprites(#mStopMovieWasCalled) 
     
    154208-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    155209-- xxxxxxxxxxxxxxxxxx color( -> rgb( 
    156 -- fix the score data which has #color instead of #rgb when authored with D10, which fails with the older player 
     210--  
    157211 
    158212on Authoring_ExchangeScriptListColorsToRGBs me 
     213  ----------------------------------- 
     214  --         CREATED: 12.02.2008 
     215  --         ACTION: fix the score data which has #color instead of #rgb when authored with D10 
     216  --                 which fails with the older player (AUTHORING ONLY!) 
     217  --         INPUT: - 
     218  --         RETURNS: - 
     219  ----------------------------------- 
     220   
    159221  theLastFrame = the lastFrame 
    160222  theLastChannel = the lastChannel 
     
    213275 
    214276on mGetVersionNumber me 
     277  ----------------------------------- 
     278  --         CREATED: 12.02.2008 
     279  --         ACTION: Get player veersion number as float, so that proper maths can be made 
     280  --         INPUT: - 
     281  --         RETURNS: float => director player version number 
     282  ----------------------------------- 
    215283   
    216284  glob = mGetGlobalList(me) 
     
    251319 
    252320on mGetPlatform me 
     321  ----------------------------------- 
     322  --         CREATED: 12.02.2008 
     323  --         ACTION: Get the platform as symbol 
     324  --                 the advantage is that the result is cached in the global list 
     325  --                 and the distinction between OS9 and OSX is made 
     326  --         INPUT: - 
     327  --         RETURNS: symbol => platform identifier; range: #os9, #osx, #win 
     328  ----------------------------------- 
    253329   
    254330  glob = mGetGlobalList(me) 
     
    276352 
    277353on mCheckMemberType me, memref, aType 
     354  ----------------------------------- 
     355  --         CREATED: 12.02.2008 
     356  --         ACTION: Check if the member reference <memref> is of type <aType> 
     357  --                 This handler works in D<10 and D>=10 
     358  --         INPUT: member reference 
     359  --                symbol 
     360  --         RETURNS: boolean (integer) 
     361  ----------------------------------- 
     362   
    278363  if voidP(memref) then return 0 
    279364  return (memref.type = aType) 
     
    283368 
    284369on mGetMemType me, memref 
     370  ----------------------------------- 
     371  --         CREATED: 12.02.2008 
     372  --         ACTION: Return the type of member <memref> 
     373  --                 This handler works in D<10 and D>=10 
     374  --                 If memref is not a valid member this handler returns #empty, like D<10 used to 
     375  --         INPUT: member reference 
     376  --         RETURNS: symbol => member type; range: every member type and #empty 
     377  ----------------------------------- 
    285378  if ilk(memref) <> #member then return #empty 
    286379  return memref.type 
     
    290383 
    291384on mCreateTimeout me, theName, theDuration, theHandler, theTarget 
     385  ----------------------------------- 
     386  --         CREATED: 12.02.2008 
     387  --         ACTION: Create/Get timeout object 
     388  --                 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|| 
     391  --                || theHandler  || symbol  || handler to be called on each timepout event|| 
     392  --                || theTarget   || object  || object to be sent the timeout event <theHandler>|| 
     393  --         RETURNS: timeout object 
     394  ----------------------------------- 
    292395   
    293396  dto = timeout(theName) 
     
    393496on mGetThisMovieName me 
    394497  glob = mGetGlobalList(me) 
    395   return string(glob.getaprop(#movieIdentifier)) 
     498  str = string(glob.getaprop(#movieIdentifier)) 
     499  if length(str) > 0 then return str 
     500  str = mSplitPath(me, the moviename).basename 
     501  mSetThisMovieName me, str 
     502  return str 
    396503end 
    397504 
     
    10931200-- xxxxxxxxxxxxxxxxxx stored script instances: 
    10941201 
    1095 on mGetInstance me, instName 
     1202on mGetInstance me, instName, useRawNew 
     1203   
     1204  if ilk(instName) = #string then instName = symbol(instName) 
     1205   
    10961206  theGlobs = mGetGlobalList(me) 
    10971207  gParentScriptInstances = theGlobs.getaprop(#gParentScriptInstances) 
     
    11051215  if ilk(saveScr) = #instance then return saveScr 
    11061216   
    1107   if mGetMemType(me, member(instName)) = #script then 
    1108     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)) 
    11091220    gParentScriptInstances.setaprop(instName, saveScr) 
    11101221    return saveScr 
    11111222  end if 
    11121223   
    1113    
    1114   inst = mGetXScript(symbol(instName)) 
    1115   if objectP(inst) then 
    1116     saveScr = new(inst) 
     1224  if saveScr = -1 then return 0 
     1225  gParentScriptInstances.setaprop(instName, -1) 
     1226  inst = mGetXScript(instName) 
     1227  if not(listP(inst)) then 
     1228    if ilk(inst) = #instance then inst = inst.script 
     1229    if useRawNew = 1 then saveScr = rawnew(inst) 
     1230    else saveScr = new(inst) 
    11171231    gParentScriptInstances.setaprop(instName, saveScr) 
    11181232    return saveScr 
     
    11421256 
    11431257-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    1144 -- xxxxxxxxxxxxxxxxxx reload a stored script instance: 
    1145  
    1146 on mReloadInstance me, instName 
     1258-- xxxxxxxxxxxxxxxxxx delete a stored script instance: 
     1259 
     1260on mDeleteInstance me, instName, dontCallDestroyHandler 
    11471261  theGlobs = mGetGlobalList(me) 
    11481262  gParentScriptInstances = theGlobs.getaprop(#gParentScriptInstances) 
    1149    
    11501263  if ilk(gParentScriptInstances) <> #proplist then exit 
    1151    
     1264  if dontCallDestroyHandler <> 1 then 
     1265    saveScr = gParentScriptInstances.getaprop(instName) 
     1266    if ilk(saveScr) = #instance then call(#mDestroy, [saveScr]) 
     1267  end if 
    11521268  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) 
    11531293end 
    11541294 
     
    12531393    delim =  the last char of the moviepath 
    12541394    if length(delim) < 1 then 
    1255       delim = the last char of the applicationpath 
     1395       
     1396      if the runmode contains "plug" then 
     1397        delim = "/" 
     1398      else 
     1399        delim = the last char of the applicationpath 
     1400      end if 
     1401       
     1402       
    12561403      if length(delim) < 1 then delim = "/" 
    12571404    end if 
     
    12931440    mp = the moviepath 
    12941441    if length(mp) < 1 then 
     1442      if the runmode contains "plug" then 
     1443        mp = "" 
     1444      else 
    12951445      mp = the applicationpath 
     1446      end if 
    12961447      if length(mp) < 1 then 
    12971448        mp = "@/" 
     
    13091460    delim =  the last char of the moviepath 
    13101461    if length(delim) < 1 then 
    1311       delim = the last char of the applicationpath 
     1462       
     1463      if the runmode contains "plug" then 
     1464        mp = "" 
     1465      else 
     1466        delim = the last char of the applicationpath 
     1467      end if 
     1468       
     1469       
    13121470      if length(delim) < 1 then delim = "/" 
    13131471    end if 
     
    13791537    delim = the last char of the moviepath 
    13801538    if length(delim) < 1 then 
    1381       delim = the last char of the applicationpath 
     1539      if not(the runmode contains "plug") then 
     1540        delim = the last char of the applicationpath 
     1541      end if 
    13821542      if length(delim) < 1 then delim = "/" 
    13831543    end if 
     
    13921552   
    13931553  if delim = "\" then 
     1554    if length(thePath) > 1 then 
    13941555    if thePath.char[2] = ":" then 
    13951556      num = charToNum(thePath.char[1]) 
     
    14001561        praef = "" 
    14011562      end if 
     1563    else 
     1564      praef = "" 
     1565    end if 
    14021566    else 
    14031567      praef = "" 
     
    17231887end 
    17241888 
     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 
    17251900 
    17261901-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     
    18201995end 
    18211996 
     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 
    18222045-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    18232046 
     
    18712094 
    18722095on interface me 
    1873   str = "Common Movie Script  by alex da franca ©2003 -- alex@farbflash.de -- all rigths reserved" 
     2096  str = "Common Movie Script  by alex da franca c2003 -- alex@farbflash.de -- all rigths reserved" 
    18742097  put RETURN & "Shared Global Handlers" after str 
    18752098   
  • trunk/lingosource/castlib3/dreiD_Utility_Scripts.ls

    r15 r18  
    1  
    21-- alex am Samstag, 22. Mai 2004 
    32-- tex = mGetTexture(memref, texname) 
     
    233232  else 
    234233     
    235   --  pos = findPos(pCameraInfos, cam) 
    236   --  if pos then 
    237   --    center2D = pCameraInfos[cam][#center2D] 
    238   --    SC3 = pCameraInfos[cam][#center3D] 
    239   --    camTransorm = pCameraInfos[cam][#transform] 
    240   --  else 
    241   --    put "cam infos not found" 
    242   R = cam.rect 
    243   center2D = point(R.width/2, R.height/2) 
    244   SC3 = cam.spriteSpaceToWorldSpace(center2D) 
    245   camTransorm = cam.getWorldTransform() 
    246   --  end if 
    247    
    248   camPos = camTransorm.position 
    249   if camPos = P then RETURN center2D 
    250    
    251   if voidIfBehind then 
    252     -- if point is behind camera return void 
     234    --  pos = findPos(pCameraInfos, cam) 
     235    --  if pos then 
     236    --    center2D = pCameraInfos[cam][#center2D] 
     237    --    SC3 = pCameraInfos[cam][#center3D] 
     238    --    camTransorm = pCameraInfos[cam][#transform] 
     239    --  else 
     240    --    put "cam infos not found" 
     241    R = cam.rect 
     242    center2D = point(R.width/2, R.height/2) 
     243    SC3 = cam.spriteSpaceToWorldSpace(center2D) 
     244    camTransorm = cam.getWorldTransform() 
     245    --  end if 
     246     
     247    camPos = camTransorm.position 
     248    if camPos = P then RETURN center2D 
     249     
     250    if voidIfBehind then 
     251      -- if point is behind camera return void 
    253252      if (SC3-camPos).angleBetween(P-camPos) > 90 then  
    254253         
     
    264263        return void 
    265264      end if 
    266   end if 
    267    
    268   a = (SC3 - camPos).angleBetween(P - camPos)  -- angle between straithforwoard view and view to point 
    269   Pdistance = (P - camPos).length         -- distance from point to camera 
    270   Pl = cos(a*pi()/180.0) * Pdistance      -- distance from camera to straithforwoard point, that is in the Ebene of point 
    271   Cl = (SC3-camPos).length                -- distance from camera to straightforwoard viewpoint 
    272   relation = Pl / Cl                      -- factor for multiplying spriteSpaceToWorldSpace result 
    273    
    274   SC3P = camPos + (relation*(SC3-camPos)) -- point straightforwoard in Ebene of point 
    275   dist = (P-SC3P).magnitude               -- distance from point to SC3P 
    276   camX = camTransorm.xAxis  
    277   ax = camX.angleBetween(P-SC3P) 
    278   x = cos(ax*pi()/180.0) * dist 
    279   camY = camTransorm.yAxis 
    280   ay = camY.angleBetween(P-SC3P) 
    281   y = cos(ay*pi()/180.0) * dist 
    282    
     265    end if 
     266     
     267    a = (SC3 - camPos).angleBetween(P - camPos)  -- angle between straithforwoard view and view to point 
     268    Pdistance = (P - camPos).length         -- distance from point to camera 
     269    Pl = cos(a*pi()/180.0) * Pdistance      -- distance from camera to straithforwoard point, that is in the Ebene of point 
     270    Cl = (SC3-camPos).length                -- distance from camera to straightforwoard viewpoint 
     271    relation = Pl / Cl                      -- factor for multiplying spriteSpaceToWorldSpace result 
     272     
     273    SC3P = camPos + (relation*(SC3-camPos)) -- point straightforwoard in Ebene of point 
     274    dist = (P-SC3P).magnitude               -- distance from point to SC3P 
     275    camX = camTransorm.xAxis  
     276    ax = camX.angleBetween(P-SC3P) 
     277    x = cos(ax*pi()/180.0) * dist 
     278    camY = camTransorm.yAxis 
     279    ay = camY.angleBetween(P-SC3P) 
     280    y = cos(ay*pi()/180.0) * dist 
     281     
    283282    ---------------------------------------- 
    284283    -- scale correction reset 
     
    291290    ---------------------------------------- 
    292291     
    293   RETURN (point(x, -y)/relation) + center2D 
    294   end if 
     292    RETURN (point(x, -y)/relation) + center2D 
     293  end if 
     294end 
     295 
     296 
     297-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     298-- xxxxxxxxxxxxxxxxxx map clickloc to 2-D image coordinates: 
     299 
     300on mMapPointToTexture me, iSectList, anImage, tTextureLayer -------------------------------------- 
     301  -- Many Thanks to James Newton <james.newton@openspark.com> for sharing this handler ! 
     302   
     303  -- RETURNS the point in the Bitmap member used by the texture 
     304  -- defined implicitly in <iSectList> 
     305  -- 
     306  -- INPUT: 
     307  -- <iSectList> should be a property list of the format: 
     308  --   [#model:         model("model name"), 
     309  --    #distance:      <float>, 
     310  --    #isectPosition: <vector>, 
     311  --    #isectNormal:   <vector>, 
     312  --    #meshID:        <integer>, 
     313  --    #faceID:        <integer>, 
     314  --    #vertices:     [<vector>, <vector>, <vector>], 
     315  --    #uvCoord:      [#u: <float>, #v: <float>]] 
     316  -- 
     317  -- When you use aCamera.modelsUnderLoc(aLoc, #detailed) or 
     318  -- aMember.modelsUnderRay(aPoint, aVector, #detailed), the result is 
     319  -- a linear list of lists with this format. 
     320  --------------------------------------------------------------------- 
     321   
     322  tModel    = iSectList.model 
     323  if voidP(tModel) then return #modelWasDeleted 
     324   
     325   
     326  tResource = tModel.resource 
     327   
     328  isMesh = (tResource.type = #mesh) 
     329   
     330  if not isMesh then 
     331    -- We need to use the mesh deform modifier to get texture data 
     332    if not((tModel.modifier).getPos(#meshdeform))then 
     333      -- Add mesh deform modifier... but remember to remove it later 
     334      tModel.addModifier(#meshdeform) 
     335      isModified = TRUE 
     336    end if 
     337  end if 
     338   
     339  tShader  = tModel.shaderList[iSectList.meshID] 
     340   
     341  if voidP(tTextureLayer) then tTextureLayer = 1 
     342  tTexture = tShader.textureList[tTextureLayer] 
     343   
     344  if voidP(tTexture) then 
     345    return 0 
     346  end if 
     347   
     348  case tTexture.type of 
     349    #importedFromFile: 
     350      -- Exercise left to the reader 
     351      return #importedFromFile 
     352       
     353    #fromImageObject: 
     354      -- You may be able to continue if you have kept a copy of the 
     355      -- image, or, at the very least, its initial dimensions 
     356      case ilk(anImage) of 
     357        #image: 
     358          tWidth  = anImage.width 
     359          tHeight = anImage.height 
     360           
     361        #propList, #instance: 
     362          -- Check whether we can extract width and height properties 
     363          tWidth  = anImage[#width] 
     364          if integerP(tWidth) then 
     365            tHeight = anImage[#height] 
     366          end if 
     367           
     368          if not integerP(tHeight) then 
     369            -- No width or height data is available 
     370            return #fromImageObject 
     371          end if 
     372           
     373        otherwise: 
     374          return #fromImageObject 
     375      end case 
     376       
     377       
     378    #fromCastMember: 
     379      tMember = tTexture.member 
     380      tWidth  = tMember.width 
     381      tHeight = tMember.height 
     382  end case 
     383   
     384  tFace      = iSectList.faceID 
     385  tUVCoord   = iSectList.uvCoord 
     386   
     387  -- Determine how the iSect data maps to this particular face 
     388  if isMesh then 
     389    tCoordList = tResource.textureCoordinateList 
     390    tFaceList  = tResource.face[tFace].textureCoordinates 
     391     
     392  else 
     393    -- tCoordList = tModel.meshdeform.mesh[iSectList.meshID].textureCoordinateList 
     394    tCoordList = tModel.meshdeform.mesh[iSectList.meshID].textureLayer[tTextureLayer].textureCoordinateList 
     395    tFaceList  = tModel.meshdeform.mesh[iSectList.meshID].face[tFace] 
     396    if isModified then 
     397      -- Remove the modifier now that it has done its job 
     398      tModel.removeModifier(#meshdeform) 
     399    end if 
     400  end if 
     401   
     402  -- tCoordList will be a list of lists, each containing two floating- 
     403  -- point numbers between 0.0 and 1.0.  The first number defines the 
     404  -- relative horizontal position of a point in the texture, the 
     405  -- second number defines the relative vertical point.  The origin 
     406  -- point [0.0, 0.0] is in the bottom left hand corner. 
     407  -- 
     408  -- tFaceList will be a list with three integer values [a, b, c] 
     409  -- These values determine which entry in tCoordList is used by the 
     410  -- chosen face.  The first entry <a> defines the origin.  The u 
     411  -- value increases from <a> to <b>.  Any point on the line between 
     412  -- <a> and <b> will have a v value of zero.  The v value increases 
     413  -- from <a> to <c>.  Any point on the line between <a> and <b> will 
     414  -- have a v value of zero. 
     415   
     416  -- Calculate the position of the points <a>, <b> and <c> within the 
     417  -- Bitmap member. 
     418   
     419  tLocA = tCoordList[tFaceList[1]] -- [<float>, <float>] 
     420  tLocA = point(tLocA[1] * tWidth, (1 - tLocA[2]) * tHeight) 
     421   
     422  tLocB = tCoordList[tFaceList[2]] -- [<float>, <float>] 
     423  tLocB = point(tLocB[1] * tWidth, (1 - tLocB[2]) * tHeight) 
     424   
     425  tLocC = tCoordList[tFaceList[3]] -- [<float>, <float>] 
     426  tLocC = point(tLocC[1] * tWidth, (1 - tLocC[2]) * tHeight) 
     427   
     428  tUVector = (tLocB - tLocA) * tUVCoord.u -- actually a 2D point... 
     429  tVVector = (tLocC - tLocA) * tUVCoord.v -- ... rather than a vector 
     430   
     431  -- Start from the origin <a>, move first in the u direction then in 
     432  -- the v direction to end up at the point in the texture 
     433   
     434  --  return tLocA + tUVector + tVVector 
     435  P = tLocA + tUVector + tVVector 
     436  repeat while P[1] > tWidth 
     437    P[1] = P[1] - tWidth 
     438  end repeat 
     439  repeat while P[2] > tHeight 
     440    P[2] = P[2] - tHeight 
     441  end repeat 
     442  return P 
    295443end 
    296444 
     
    313461  if ilk(theEvent) <> #symbol then exit 
    314462   
     463  resultlist = [] 
     464   
    315465  repeat with n = memref.model.count down to 1 
    316466    scrili = mGetParentScriptList(me, memref.model[n]) 
    317     call(theEvent, scrili, memref.model[n], param1, param2, param3) 
     467    repeat with this in scrili 
     468      res = call(theEvent, [this], param1, param2, param3, memref.model[n]) 
     469      if not(voidP(res)) then 
     470        if ilk(res, #void) <> 1 then resultlist.add(res) 
     471      end if 
     472    end repeat 
    318473  end repeat 
    319474   
    320475  repeat with n = memref.group.count down to 1 
    321476    scrili = mGetParentScriptList(me, memref.group[n]) 
    322     call(theEvent, scrili, memref.group[n], param1, param2, param3) 
     477    repeat with this in scrili 
     478      res = call(theEvent, [this], param1, param2, param3, memref.group[n]) 
     479      if not(voidP(res)) then 
     480        if ilk(res, #void) <> 1 then resultlist.add(res) 
     481      end if 
     482    end repeat 
    323483  end repeat 
    324484   
    325485  repeat with n = memref.camera.count down to 1 
    326486    scrili = mGetParentScriptList(me, memref.camera[n]) 
    327     call(theEvent, scrili, memref.camera[n], param1, param2, param3) 
     487    repeat with this in scrili 
     488      res = call(theEvent, [this], param1, param2, param3, memref.camera[n]) 
     489      if not(voidP(res)) then 
     490        if ilk(res, #void) <> 1 then resultlist.add(res) 
     491      end if 
     492    end repeat 
    328493  end repeat 
    329494   
    330495  repeat with n = memref.light.count down to 1 
    331496    scrili = mGetParentScriptList(me, memref.light[n]) 
    332     call(theEvent, scrili, memref.light[n], param1, param2, param3) 
    333   end repeat 
    334    
     497    repeat with this in scrili 
     498      res = call(theEvent, [this], param1, param2, param3, memref.light[n]) 
     499      if not(voidP(res)) then 
     500        if ilk(res, #void) <> 1 then resultlist.add(res) 
     501      end if 
     502    end repeat 
     503  end repeat 
     504   
     505  if count(resultlist) = 1 then resultlist = resultlist[1] 
     506  return resultlist 
     507end 
     508 
     509-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     510-- send Event to a Node 
     511-- xscr(#dreiD_Utility_Scripts).mSendEventToNode(theNode, #theEvent) 
     512 
     513on mSendEventToNode me, theNode, theEvent, bool_Recursion, bool_ReturnSingleResult, param1, param2, param3 
     514   
     515  if ilk(theEvent) <> #symbol then exit 
     516  if voidP(theNode) then exit 
     517   
     518  resultlist = [] 
     519   
     520  scrili = mGetParentScriptList(me, theNode) 
     521   
     522  repeat with this in scrili 
     523    res = call(theEvent, [this], param1, param2, param3, theNode) 
     524    if not(voidP(res)) then 
     525      if ilk(res, #void) <> 1 then resultlist.add(res) 
     526    end if 
     527  end repeat 
     528   
     529   
     530  if bool_Recursion = 1 then 
     531    repeat with n = theNode.child.count down to 1 
     532      res = mSendEventToNode(me, theNode.child[n], theEvent, bool_Recursion, param1, param2, param3) 
     533      if listP(res) then 
     534        repeat with this in res 
     535          resultlist.add(this) 
     536        end repeat 
     537      else 
     538        if not(voidP(res)) then 
     539          if ilk(res, #void) <> 1 then resultlist.add(res) 
     540        end if 
     541      end if 
     542    end repeat 
     543  end if 
     544   
     545  cnt = count(resultlist) 
     546  if cnt > 0 then 
     547    if count(resultlist) = 1 then 
     548      return resultlist[1] 
     549    else 
     550      if bool_ReturnSingleResult = 1 then return resultlist[1] 
     551      return resultlist 
     552    end if 
     553  end if 
     554   
     555  return void 
    335556   
    336557end 
     
    363584-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    364585-- access a specific script instance by name 
     586-- if the script has a handler "mGetScriptInstance" we are set 
     587-- otherwise we try it via "mGetScriptInstanceList" 
    365588 
    366589on mGetParentScriptInstance me, theModel, theName 
     
    368591  li = [] 
    369592  call(#mGetScriptInstance, scrili, theName, li) 
    370   if count(li) then return li[1] 
    371   else return 0 
     593  if count(li) then 
     594    return li[1] 
     595  else 
     596    repeat with n = count(scrili) down to 1 
     597      li = [] 
     598      call(#mGetScriptInstanceList, [scrili[n]], li) 
     599      if li.getPos(theName) then return scrili[n] 
     600    end repeat 
     601    return 0 
     602  end if 
    372603end 
    373604 
     
    406637-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    407638 
    408 on mGetGroup me, memref, theName 
     639on mGetGroup me, memref, theName, unique 
    409640   
    410641  theName = string(theName) 
    411   if length(theName) < 1 then theName = mGetUniqueNodeName(me, memref, "UntitledGroup") 
     642  if length(theName) < 1 then 
     643    theName = mGetUniqueNodeName(me, memref, "UntitledGroup") 
     644  else 
     645    if unique = 1 then theName = mGetUniqueNodeName(me, memref, theName) 
     646  end if 
    412647   
    413648  mo = mGetNode(me, memref, theName, #group) 
     
    419654-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    420655 
    421 on mGetModel me, memref, theName 
     656on mGetModel me, memref, theName, unique 
    422657   
    423658  theName = string(theName) 
    424   if length(theName) < 1 then theName = mGetUniqueNodeName(me, memref, "UntitledModel") 
     659  if length(theName) < 1 then 
     660    theName = mGetUniqueNodeName(me, memref, "UntitledModel") 
     661  else 
     662    if unique = 1 then theName = mGetUniqueNodeName(me, memref, theName) 
     663  end if 
    425664   
    426665  mo = mGetNode(me, memref, theName, #model) 
     
    432671-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    433672 
    434 on mGetModelResource me, memref, theName, theType 
     673on mGetModelResource me, memref, theName, theType, unique 
    435674   
    436675  theName = string(theName) 
    437   if length(theName) < 1 then theName = mGetUniqueModelResourceName(me, memref, "UntitledModelResource") 
     676  if length(theName) < 1 then 
     677    theName = mGetUniqueModelResourceName(me, memref, "UntitledModelResource") 
     678  else 
     679    if unique = 1 then theName = mGetUniqueModelResourceName(me, memref, theName) 
     680  end if 
    438681   
    439682  if [#plane, #box, #sphere, #cylinder, #particle, #mesh].getPos(theType) < 1 then theType = #box 
     
    446689-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    447690 
    448 on mGetShader me, memref, theName 
     691on mGetShader me, memref, theName, unique 
    449692   
    450693  theName = string(theName) 
    451   if length(theName) < 1 then theName = mGetUniqueShaderName(me, memref, "UntitledShader") 
     694  if length(theName) < 1 then 
     695    theName = mGetUniqueShaderName(me, memref, "UntitledShader") 
     696  else 
     697    if unique = 1 then theName = mGetUniqueShaderName(me, memref, theName) 
     698  end if 
    452699   
    453700  shd = memref.shader(theName) 
     
    459706-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    460707 
    461 on mGetLight me, memref, theName, theType 
     708on mGetLight me, memref, theName, theType, unique 
    462709   
    463710  theName = string(theName) 
    464   if length(theName) < 1 then theName = mGetUniqueNodeName(me, memref, "UntitledLight") 
     711  if length(theName) < 1 then 
     712    theName = mGetUniqueNodeName(me, memref, "UntitledLight") 
     713  else 
     714    if unique = 1 then theName = mGetUniqueNodeName(me, memref, theName) 
     715  end if 
    465716   
    466717  if [#directional, #ambient, #point, #spot].getPos(theType) < 1 then theType = #directional 
     
    635886 
    636887on mSetLOD me, memref, newLod, lodAuto 
    637   if call(#mGetMemType, [mGetXScript()], memref) = #shockwave3d then 
     888  if call(#mGetMemType, mGetXScript(), memref) = #shockwave3d then 
    638889    if voidP(lodAuto) then lodAuto = 1 
    639890    repeat with r = memref.modelresource.count down to 1 
     
    690941 
    691942on mBatchRemoveModifiers me, memref, whichModifier 
    692   if call(#mGetMemType, [mGetXScript()], memref) = #shockwave3d then 
     943  if call(#mGetMemType, mGetXScript(), memref) = #shockwave3d then 
    693944    if ilk(whichModifier) <> #list then whichModifier = [whichModifier] 
    694945    mdfCnt = whichModifier.count 
     
    722973 
    723974 
    724 -- Node Functions -- Movie Script Handler -- Alex da Franca ©2002  da.franca@online.de 
     975-- Node Functions -- Movie Script Handler -- Alex da Franca c2002  da.franca@online.de 
    725976 
    726977 
     
    14911742      if count(teli) > 7 then 
    14921743         
    1493     repeat with l = count(teli) down to 1 
    1494       if not(voidP(teli[l])) then 
    1495         thisTex = teli[l] 
    1496          
    1497         --            thisTexname = thisTex.name 
    1498          
    1499         if thisShaderTextures.getPos(thisTex) < 1 then 
    1500           thisShaderTextures.add(thisTex) 
    1501            
    1502           li = texli.getaprop(thisTex) 
    1503           if not listP(li) then 
    1504             li = [] 
    1505             texli.setaprop(thisTex, li) 
    1506           end if 
    1507           if li.getPos(thisShd) < 1 then li.add(thisShd) 
    1508            
    1509         end if 
     1744        repeat with l = count(teli) down to 1 
     1745          if not(voidP(teli[l])) then 
     1746            thisTex = teli[l] 
     1747             
     1748            --            thisTexname = thisTex.name 
     1749             
     1750            if thisShaderTextures.getPos(thisTex) < 1 then 
     1751              thisShaderTextures.add(thisTex) 
     1752               
     1753              li = texli.getaprop(thisTex) 
     1754              if not listP(li) then 
     1755                li = [] 
     1756                texli.setaprop(thisTex, li) 
     1757              end if 
     1758              if li.getPos(thisShd) < 1 then li.add(thisShd) 
     1759               
     1760            end if 
    15101761          end if 
    15111762        end repeat 
     
    16741925                    if count(TL) > 7 then 
    16751926                       
    1676                   repeat with r = 1 to 8 
    1677                     thisTex = thisShd.texturelist[r] 
    1678                     if not voidP(thisTex) then 
    1679                       repeat with l = 1 to anzShd 
    1680                          
    1681                         --                  thisTexli = memref.shader[l].texturelist 
    1682                         --                  if thisTexli.getPos(thisTex) > 0 then 
    1683                         --                    if memref.shader[l] <> thisShd then exit repeat 
    1684                         --                  end if 
    1685                         gefunden = 0 
     1927                      repeat with r = 1 to 8 
     1928                        thisTex = thisShd.texturelist[r] 
     1929                        if not voidP(thisTex) then 
     1930                          repeat with l = 1 to anzShd 
     1931                             
     1932                            --                  thisTexli = memref.shader[l].texturelist 
     1933                            --                  if thisTexli.getPos(thisTex) > 0 then 
     1934                            --                    if memref.shader[l] <> thisShd then exit repeat 
     1935                            --                  end if 
     1936                            gefunden = 0 
    16861937                             
    16871938                            TL = getPropRef(memref.shader[l], #textureList) 
    16881939                            if listP(TL) then 
    16891940                              if count(TL) > 7 then 
    1690                         repeat with rrr = 1 to 8 
    1691                           if memref.shader[l].texturelist[rrr] = thisTex then 
    1692                             if memref.shader[l] <> thisShd then 
    1693                               gefunden = 1 
    1694                               exit repeat 
    1695                             end if 
    1696                           end if 
    1697                         end repeat 
     1941                                repeat with rrr = 1 to 8 
     1942                                  if memref.shader[l].texturelist[rrr] = thisTex then 
     1943                                    if memref.shader[l] <> thisShd then 
     1944                                      gefunden = 1 
     1945                                      exit repeat 
     1946                                    end if 
     1947                                  end if 
     1948                                end repeat 
    16981949                              end if 
    16991950                            end if 
    17001951                             
    1701                         if gefunden then exit repeat 
    1702                          
     1952                            if gefunden then exit repeat 
     1953                             
     1954                          end repeat 
     1955                          if l > anzShd then 
     1956                            thisShd.texturelist[r] = void 
     1957                             
     1958                            --------------------------------------------- delete the fake userdata, which is saved seperately, in order to free memory 
     1959                            if ilk(sceneManager) = #instance then 
     1960                               
     1961                              textureFromFile = 1 
     1962                              -- in case we are still loading the image for this texture, we may want to stop the loading: 
     1963                              sourcePath = string(sceneManager.mGetUserdata(#texture, thisTex.name, #sourcePath)) 
     1964                              if length(sourcePath) > 0 then 
     1965                                loadJob = loadMediaAsynchPS.mGetJobReference(sourcePath) 
     1966                                if objectP(loadJob) then 
     1967                                  if count(loadJob) > 0 then 
     1968                                    call(#mAbortTextureLoad, loadJob.getaprop(#pCallerref), thisTex, sourcePath) 
     1969                                    textureFromFile = 0 
     1970                                  end if 
     1971                                end if 
     1972                              end if 
     1973                               
     1974                               
     1975                               
     1976                              --                        if textureFromFile = 0 then 
     1977                              --                          sceneManager.mRemoveUserdata(#texture, thisTex.name) 
     1978                              --                          memref.deleteTexture(thisTex.name) 
     1979                              --                           
     1980                              --                        else 
     1981                               
     1982                              ------------- we do NOT delete the resources here, if there is a sceneManager, it cares for the resource management 
     1983                              sceneManager.mMarkForDeletion(#texture, thisTex.name) 
     1984                               
     1985                              --                        end if 
     1986                               
     1987                            else 
     1988                               
     1989                              memref.deleteTexture(thisTex.name) 
     1990                               
     1991                            end if 
     1992                            --------------------------------------------- 
     1993                             
     1994                          end if 
     1995                        end if 
    17031996                      end repeat 
    1704                       if l > anzShd then 
    1705                         thisShd.texturelist[r] = void 
    1706                          
    1707                         --------------------------------------------- delete the fake userdata, which is saved seperately, in order to free memory 
    1708                         if ilk(sceneManager) = #instance then 
    1709                            
    1710                           textureFromFile = 1 
    1711                           -- in case we are still loading the image for this texture, we may want to stop the loading: 
    1712                           sourcePath = string(sceneManager.mGetUserdata(#texture, thisTex.name, #sourcePath)) 
    1713                           if length(sourcePath) > 0 then 
    1714                             loadJob = loadMediaAsynchPS.mGetJobReference(sourcePath) 
    1715                             if ilk(loadJob) = #proplist then 
    1716                               if count(loadJob) > 0 then 
    1717                                 call(#mAbortTextureLoad, loadJob.getaprop(#pCallerref), thisTex, sourcePath) 
    1718                                 textureFromFile = 0 
    1719                               end if 
    1720                             end if 
    1721                           end if 
    1722                            
    1723                            
    1724                            
    1725                           --                        if textureFromFile = 0 then 
    1726                           --                          sceneManager.mRemoveUserdata(#texture, thisTex.name) 
    1727                           --                          memref.deleteTexture(thisTex.name) 
    1728                           --                           
    1729                           --                        else 
    1730                            
    1731                           ------------- we do NOT delete the resources here, if there is a sceneManager, it cares for the resource management 
    1732                           sceneManager.mMarkForDeletion(#texture, thisTex.name) 
    1733                            
    1734                           --                        end if 
    1735                            
    1736                         else 
    1737                            
    1738                           memref.deleteTexture(thisTex.name) 
    1739                            
    1740                         end if 
    1741                         --------------------------------------------- 
    1742                          
    1743                       end if 
    1744                     end if 
    1745                   end repeat 
    1746                    
     1997                       
    17471998                    end if 
    17481999                  end if 
     
    18372088                      --                   
    18382089                      --                  if listP(theTexturelist) then 
    1839                     repeat with r = count(theTexturelist) down to 1 
    1840                       thisTex = theTexturelist[r] 
    1841                        
    1842                       if not voidP(thisTex) then 
     2090                      repeat with r = count(theTexturelist) down to 1 
     2091                        thisTex = theTexturelist[r] 
    18432092                         
    1844                         usedList = txtrs.getaprop(thisTex) 
    1845                          
    1846                         if listP(usedList) then 
    1847                           usedList.deleteOne(thisShd) 
    1848                           deleteTex = (count(usedList) = 0) 
    1849                         else 
    1850                           deleteTex = 0 
    1851                         end if 
    1852                          
    1853                         if deleteTex = 1 then 
    1854                           thisShd.texturelist[r] = void 
     2093                        if not voidP(thisTex) then 
    18552094                           
     2095                          usedList = txtrs.getaprop(thisTex) 
    18562096                           
    1857                           --------------------------------------------- delete the fake userdata, which is saved seperately, in order to free memory 
    1858                           if ilk(sceneManager) = #instance then 
     2097                          if listP(usedList) then 
     2098                            usedList.deleteOne(thisShd) 
     2099                            deleteTex = (count(usedList) = 0) 
     2100                          else 
     2101                            deleteTex = 0 
     2102                          end if 
     2103                           
     2104                          if deleteTex = 1 then 
     2105                            thisShd.texturelist[r] = void 
    18592106                             
    1860                             textureFromFile = 1 
    1861                             -- in case we are still loading the image for this texture, we may want to stop the loading: 
    1862                             sourcePath = string(sceneManager.mGetUserdata(#texture, thisTex.name, #sourcePath)) 
    1863                             if length(sourcePath) > 0 then 
    1864                               loadJob = loadMediaAsynchPS.mGetJobReference(sourcePath) 
    1865                               if ilk(loadJob) = #proplist then 
    1866                                 if count(loadJob) > 0 then 
    1867                                   call(#mAbortTextureLoad, loadJob.getaprop(#pCallerref), thisTex) 
    1868                                   textureFromFile = 0 
     2107                             
     2108                            --------------------------------------------- delete the fake userdata, which is saved seperately, in order to free memory 
     2109                            if ilk(sceneManager) = #instance then 
     2110                               
     2111                              textureFromFile = 1 
     2112                              -- in case we are still loading the image for this texture, we may want to stop the loading: 
     2113                              sourcePath = string(sceneManager.mGetUserdata(#texture, thisTex.name, #sourcePath)) 
     2114                              if length(sourcePath) > 0 then 
     2115                                loadJob = loadMediaAsynchPS.mGetJobReference(sourcePath) 
     2116                                if objectP(loadJob) then 
     2117                                  if count(loadJob) > 0 then 
     2118                                    call(#mAbortTextureLoad, loadJob.getaprop(#pCallerref), thisTex) 
     2119                                    textureFromFile = 0 
     2120                                  end if 
    18692121                                end if 
    18702122                              end if 
     2123                               
     2124                               
     2125                              if not(voidP(thisTex)) then -- the above #mAbortTextureLoad may have get rid of the texture and thus it is not present anymore 
     2126                                 
     2127                                --                          if textureFromFile = 0 then 
     2128                                --                            sceneManager.mRemoveUserdata(#texture, thisTex.name) 
     2129                                --                             
     2130                                --                          else 
     2131                                sceneManager.mMarkForDeletion(#texture, thisTex.name) 
     2132                                 
     2133                                --                          end if 
     2134                                 
     2135                              end if 
     2136                               
     2137                               
     2138                            else 
     2139                               
     2140                              memref.deleteTexture(thisTex.name) 
     2141                               
    18712142                            end if 
     2143                            --------------------------------------------- 
    18722144                             
    18732145                             
    1874                             if not(voidP(thisTex)) then -- the above #mAbortTextureLoad may have get rid of the texture and thus it is not present anymore 
    1875                                
    1876                               --                          if textureFromFile = 0 then 
    1877                               --                            sceneManager.mRemoveUserdata(#texture, thisTex.name) 
    1878                               --                             
    1879                               --                          else 
    1880                               sceneManager.mMarkForDeletion(#texture, thisTex.name) 
    1881                                
    1882                               --                          end if 
    1883                                
    1884                             end if 
    1885                              
    1886                              
    1887                           else 
    1888                              
    1889                             memref.deleteTexture(thisTex.name) 
    1890                              
    18912146                          end if 
    1892                           --------------------------------------------- 
    1893                            
    18942147                           
    18952148                        end if 
    1896                          
    1897                       end if 
    1898                     end repeat 
    1899                   end if 
    1900                    
     2149                      end repeat 
     2150                    end if 
     2151                     
    19012152                  end if 
    19022153                   
     
    19762227                          if length(sourcePath) > 0 then 
    19772228                            loadJob = loadMediaAsynchPS.mGetJobReference(sourcePath) 
    1978                             if ilk(loadJob) = #proplist then 
     2229                            if objectP(loadJob) then 
    19792230                              if count(loadJob) > 0 then 
    19802231                                call(#mAbortTextureLoad, loadJob.getaprop(#pCallerref), thisTex) 
     
    22392490  else 
    22402491     
    2241   if ilk(newName) <> #string then newName = shadRef.name&"_Clone" 
    2242   if newName.length = 0 then newName = shadRef.name&"_Clone" 
    2243    
    2244   dername = mGetUniqueShaderName(me, memref, newName) 
    2245    
    2246   dertyp = shadRef.type 
    2247    
    2248   sClone = memref.newShader(dername, dertyp) 
    2249    
     2492    if ilk(newName) <> #string then newName = shadRef.name&"_Clone" 
     2493    if newName.length = 0 then newName = shadRef.name&"_Clone" 
     2494     
     2495    dername = mGetUniqueShaderName(me, memref, newName) 
     2496     
     2497    dertyp = shadRef.type 
     2498     
     2499    sClone = memref.newShader(dername, dertyp) 
     2500     
    22502501  end if 
    22512502   
     
    26112862 
    26122863 
    2613 on mRotateShader me, aShader, aRotation----------------------------- 
     2864on mRotateShader me, aShader, aRotation, aTextureIndex 
     2865  ----------------------------- 
    26142866  -- INPUT: <aShader> must be a shader object 
    26152867  --        <aRotation> must be a float or integer angle in degrees 
     2868  --        <aTextureIndex> the textureindex on the shader, defaults to 1 
    26162869  -- ACTION: Rotates the shader around its center to the given angle 
    26172870  -------------------------------------------------------------------- 
    26182871   
     2872  aTextureIndex = max(1, min(8, integer(aTextureIndex))) 
     2873   
    26192874  -- Take a copy of the shader's current transform 
    2620   tTransform = aShader.textureTransform 
     2875  tTransform = aShader.textureTransformList[aTextureIndex] 
    26212876   
    26222877  -- Rotate the texture around its bottom right corner 
     
    26262881  -- still centered. 
    26272882  tRotation = 45 + aRotation 
    2628   tTransform.position.x = cos(tRotation * pi / 180) / sqrt(2.0) + 0.5 
    2629   tTransform.position.y = sin(tRotation * pi / 180) / sqrt(2.0) + 0.5 
     2883  tTransform.position.x = (cos(tRotation * pi / 180) / sqrt(2.0)) * tTransform.scale.x + 0.5-- * (tTransform.scale.x) 
     2884  tTransform.position.y = (sin(tRotation * pi / 180) / sqrt(2.0)) * tTransform.scale.x + 0.5-- * (tTransform.scale.y) 
    26302885   
    26312886  -- Apply the modified transform 
    2632   aShader.textureTransform = tTransform 
     2887  aShader.textureTransformlist[aTextureIndex] = tTransform 
    26332888end 
    26342889 
     
    29643219end 
    29653220 
     3221 
    29663222-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    29673223 
  • trunk/lingosource/castlib3/memberInfo.xml

    r14 r18  
    55                <comments>~/Documents/Scripts/lingo/Alex_HierMenuParent.ls</comments> 
    66                <memberName>Alex_HierMenuParent</memberName> 
    7                 <fName>Alex_HierMenuParent</fName> 
     7                <fname>Alex_HierMenuParent</fname> 
    88        </Alex_HierMenuParent> 
    99        <SliderScrollbarMenuParent> 
     
    1111                <comments>~/Documents/Scripts/lingo/SliderScrollbarMenuParent.ls</comments> 
    1212                <memberName>SliderScrollbarMenuParent</memberName> 
    13                 <fName>SliderScrollbarMenuParent</fName> 
     13                <fname>SliderScrollbarMenuParent</fname> 
    1414        </SliderScrollbarMenuParent> 
    1515        <DropShadowPScript> 
     
    1717                <comments>~/Documents/Scripts/lingo/DropShadowPScript.ls</comments> 
    1818                <memberName>DropShadowPScript</memberName> 
    19                 <fName>DropShadowPScript</fName> 
     19                <fname>DropShadowPScript</fname> 
    2020        </DropShadowPScript> 
    2121        <ButtonImageCreator> 
     
    2323                <comments>~/Documents/Scripts/lingo/ButtonImageCreator.ls</comments> 
    2424                <memberName>ButtonImageCreator</memberName> 
    25                 <fName>ButtonImageCreator</fName> 
     25                <fname>ButtonImageCreator</fname> 
    2626        </ButtonImageCreator> 
    2727        <ButtonManager> 
     
    2929                <comments>~/Documents/Scripts/lingo/ButtonManager.ls</comments> 
    3030                <memberName>ButtonManager</memberName> 
    31                 <fName>ButtonManager</fName> 
     31                <fname>ButtonManager</fname> 
    3232        </ButtonManager> 
    3333        <GenericButtonPS> 
     
    3535                <comments>~/Documents/Scripts/lingo/GenericButtonPS.ls</comments> 
    3636                <memberName>GenericButtonPS</memberName> 
    37                 <fName>GenericButtonPS</fName> 
     37                <fname>GenericButtonPS</fname> 
    3838        </GenericButtonPS> 
    3939        <commonmoviescript> 
     
    4141                <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 
    4242                <memberName>commonMovieScript</memberName> 
    43                 <fName>commonMovieScript</fName> 
     43                <fname>commonMovieScript</fname> 
    4444        </commonmoviescript> 
    4545        <imageUtilityScripts> 
     
    4747                <comments>~/Documents/Scripts/lingo/ImageUtilityScripts.ls</comments> 
    4848                <memberName>ImageUtilityScripts</memberName> 
    49                 <fName>ImageUtilityScripts</fName> 
     49                <fname>ImageUtilityScripts</fname> 
    5050        </imageUtilityScripts> 
    5151        <GetSetPrefs> 
     
    5353                <comments>~/Documents/Scripts/lingo/GetSetPrefs.ls</comments> 
    5454                <memberName>GetSetPrefs</memberName> 
    55                 <fName>GetSetPrefs</fName> 
     55                <fname>GetSetPrefs</fname> 
    5656        </GetSetPrefs> 
    5757        <PseudoXMLPS> 
     
    5959                <comments>~/Documents/Scripts/lingo/PseudoXMLPS.ls</comments> 
    6060                <memberName>PseudoXMLPS</memberName> 
    61                 <fName>PseudoXMLPS</fName> 
     61                <fname>PseudoXMLPS</fname> 
    6262        </PseudoXMLPS> 
    6363        <ToolTipBeaver_1> 
     
    6565                <comments>~/Documents/Scripts/lingo/ToolTipBeaver_1.ls</comments> 
    6666                <memberName>ToolTipBeaver_1</memberName> 
    67                 <fName>ToolTipBeaver_1</fName> 
     67                <fname>ToolTipBeaver_1</fname> 
    6868        </ToolTipBeaver_1> 
    6969        <SpriteNameBeaver> 
     
    7171                <comments>~/Documents/Scripts/lingo/SpriteNameBeaver.ls</comments> 
    7272                <memberName>SpriteNameBeaver</memberName> 
    73                 <fName>SpriteNameBeaver</fName> 
     73                <fname>SpriteNameBeaver</fname> 
    7474        </SpriteNameBeaver> 
    7575        <FileIOFunktionen> 
     
    7777                <comments>~/Documents/Scripts/lingo/FileIOFunktionen.ls</comments> 
    7878                <memberName>FileIOFunktionen</memberName> 
    79                 <fName>FileIOFunktionen</fName> 
     79                <fname>FileIOFunktionen</fname> 
    8080        </FileIOFunktionen> 
    8181        <dreiD_Utility_Scripts> 
    8282                <scriptType>#parent</scriptType> 
    83                 <comments>~/Documents/Scripts/lingo/3-D_Utility_Scripts.ls</comments> 
     83                <comments>~/Documents/Scripts/lingo/dreiD_Utility_Scripts.ls</comments> 
    8484                <memberName>dreiD_Utility_Scripts</memberName> 
    85                 <fName>dreiD_Utility_Scripts</fName> 
     85                <fname>dreiD_Utility_Scripts</fname> 
    8686        </dreiD_Utility_Scripts> 
    8787</Untitled> 
Note: See TracChangeset for help on using the changeset viewer.