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

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

updated movie to incorporate new version of library scripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 
Note: See TracChangeset for help on using the changeset viewer.