Changeset 18 for trunk/lingosource/castlib3/ButtonManager.ls
- Timestamp:
- 10/24/08 12:12:09 (4 years ago)
- File:
-
- 1 edited
-
trunk/lingosource/castlib3/ButtonManager.ls (modified) (38 diffs)
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 -- 3 9 -- Use this behavior on any dummy sprite to display a scrolling table with selectable items, text (fixed and editable) and images. 4 10 -- It creates a temporary bitmap member, which is used to display the table on the stage. 5 11 -- Specify the contents and appearance of the table in two property lists, which you pass to the mShowTable handler 6 12 -- 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 -- 9 22 -- alex am Freitag, 23. April 2004 10 23 -- added mRefreshSpriteRectAfterStageChange() handler to refresh the rect after a stage resize, sent from behavior "resizeStageBehavior" … … 60 73 61 74 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 92 property pKanal, pMember 93 62 94 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 63 95 -- xxxxxxxxxxxxxxxxxx PROPERTIES 64 96 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 65 97 66 property pKanal, pMember67 98 property pOldKeyDown 68 99 property pMyScriptObject … … 116 147 117 148 on 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" 119 150 put RETURN & "version 1.0" after str 120 151 put RETURN & "--------------------------------------------------------" after str … … 238 269 on mInitProperties me, pipeline 239 270 240 pIncludes = (mGetAleXtras()).getaprop(#scripts)271 pIncludes = xscr() 241 272 242 273 pKeyboardshortcutList = [:] … … 276 307 -- alex am 8. Oktober 2004 um 10:32 277 308 -- pMember = new(#bitmap) 278 pMember = call(#mGetNewMember, [pIncludes.getaprop(#commonmoviescript)],#bitmap)309 pMember = pIncludes.mGetNewMember(#bitmap) 279 310 --/ alex am 8. Oktober 2004 um 10:32 280 311 … … 364 395 -- alex am 8. Oktober 2004 um 10:32 365 396 -- pMember.erase() 366 call(#mEraseMember, [pIncludes.getaprop(#commonmoviescript)],pMember)397 pIncludes.mEraseMember(pMember) 367 398 -- alex am 8. Oktober 2004 um 10:32 368 399 end if … … 735 766 736 767 on 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 ----------------------------------- 737 799 738 800 if not(listP(pButtonList)) then mInitProperties me … … 744 806 options = pOptionsListe 745 807 746 if call(#mGetMemType, [pIncludes.getaprop(#commonmoviescript)],pMember) = #shockwave3d then -- 3-D mode808 if pIncludes.mGetMemType(pMember) = #shockwave3d then -- 3-D mode 747 809 r = options[#myRect] 748 810 … … 833 895 834 896 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 838 903 839 904 if objectP(theObject.getaprop(#myScriptObject)) then -- if we succeded in initializing a button parent script (only fails if script "GenericButtonPS" isn't present)) … … 871 936 mo = pMember.model(val) 872 937 if not(voidP(mo)) then 873 scr = call(#mGetParentScriptList, [pIncludes.getaprop(#commonmoviescript)],mo)938 scr = pIncludes.mGetParentScriptList(mo) 874 939 875 940 repeat with n = scr.count down to 1 … … 900 965 901 966 on 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 902 976 if not(pButtonList.count) then exit 903 977 … … 981 1055 -- instead put the removal into a seperate, indepandant event 982 1056 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) 989 1058 990 1059 end if … … 998 1067 end 999 1068 1000 1001 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1002 -- comes from the drop down menu, if any 1069 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1070 -- -- comes from the drop down menu, if any 1003 1071 1004 1072 on mHiliteMenu me, val … … 1006 1074 end 1007 1075 1008 1009 1010 1011 1076 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1012 1077 -- xxxxxxxxxxxxxxxxxx Public Handlers to change, control or get the button contents and properties … … 1014 1079 1015 1080 1016 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1017 -- check if a button is present -> this script normally simply applies all to the first button in the list, if tabname is unknown/undefined1018 -- sometimes, this is NOT what I want...1019 1020 1081 on 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 ----------------------------------- 1021 1088 1022 1089 if not(pButtonList.count) then return 0 1023 1090 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 1093 end 1094 1095 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1096 1031 1097 1032 1098 on 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 ----------------------------------- 1033 1104 1034 1105 if not(pButtonList.count) then return [:] … … 1045 1116 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1046 1117 1047 -- change the text:1048 -- accepts: #string1049 1118 on 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 1050 1126 if ilk(newLabel) <> #string then exit 1051 1127 … … 1060 1136 1061 1137 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1062 -- special case of label change 1138 1139 on mChangeLanguage me, tabname 1140 ----------------------------------- 1141 -- ACTION: special case of label change 1063 1142 -- 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 ----------------------------------- 1066 1148 1067 1149 if not(pButtonList.count) then exit … … 1074 1156 1075 1157 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1076 -- ullala changed 05 1158 1077 1159 on 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 1078 1169 pPause = tValue 1079 1170 end 1080 1171 1081 1172 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1082 -- toggle the enabled state of the button; 1 = enable, 0 = disable 1083 -- accepts: #integer 1173 1084 1174 on 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 ----------------------------------- 1085 1184 1086 1185 if not(pButtonList.count) then exit … … 1118 1217 1119 1218 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1120 -- get the enabled state of the button; 1 = enabled, 0 = disabled1121 -- returns: #integer1122 1219 1123 1220 on 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 ----------------------------------- 1124 1227 1125 1228 if not(pButtonList.count) then return 0 … … 1134 1237 1135 1238 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1136 -- change the event which shall be sent on mouseUp1239 -- 1137 1240 -- accepts: #symbol, #string 1241 1138 1242 on 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 ----------------------------------- 1139 1253 1140 1254 if not(pButtonList.count) then exit … … 1151 1265 1152 1266 -- 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 1270 on 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 1156 1282 1157 1283 if not(pButtonList.count) then exit … … 1163 1289 theObject = theObject.getaprop(#myScriptObject) 1164 1290 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 1293 end 1294 1295 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1296 -- 1297 -- accepts: 1298 1299 on 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 ----------------------------------- 1172 1307 1173 1308 if not(pButtonList.count) then exit … … 1179 1314 theObject = theObject.getaprop(#myScriptObject) 1180 1315 1316 if not(theObject.pOptions.broadcastSprites).getPos(referenz) then theObject.pOptions.broadcastSprites.add(referenz) 1317 end 1318 1319 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1320 1321 on 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 1181 1338 theObject.pOptions.broadcastSprites.deleteOne(referenz) 1182 1339 … … 1184 1341 1185 1342 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1186 -- get the enabled state of the button; 1 = enabled, 0 = disabled 1187 -- returns: #integer 1343 -- 1344 1345 -- accepts: #list 1346 1347 on 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 1369 end 1370 1371 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1372 -- 1373 -- -- -- events which can be processed are: #mouseUp, #mouseDown, #mouseEnter, #mouseLeave 1374 -- accepts: #symbol 1375 1376 on 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 1402 end 1403 1404 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1405 1406 on 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 1431 end 1432 1433 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1434 1188 1435 on 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 ----------------------------------- 1189 1441 1190 1442 if not(pButtonList.count) then return 0 … … 1198 1450 1199 1451 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1200 -- set the enabled state of the button; 1 = enabled, 0 = disabled 1201 -- accepts: #integer 1452 1202 1453 on 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 ----------------------------------- 1203 1461 1204 1462 if not(pButtonList.count) then exit … … 1227 1485 1228 1486 on 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 1229 1494 repeat with n = count(pButtonList) down to 1 1230 1495 mTranslateButtonRect me, delta, pButtonList.getPropAt(n) … … 1236 1501 1237 1502 on 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 1238 1511 if not(pButtonList.count) then exit 1239 1512 … … 1249 1522 1250 1523 on 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 1251 1533 if not(pButtonList.count) then exit 1252 1534 … … 1263 1545 1264 1546 on 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 1265 1554 if not(pButtonList.count) then return 0 1266 1555 … … 1274 1563 end 1275 1564 1276 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1565 1566 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1567 on _____SEMI_PUBLIC_HANDLERS 1568 -- handlers from other scripts, in this case from the resize stage behavior 1569 end 1570 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1571 1277 1572 -- event from the resize bar behavior 1278 1573 … … 1414 1709 1415 1710 1416 blenderTO = call(#mCreateTimeout, [pIncludes.getaprop(#commonmoviescript)],"ButtonManager_BlenderTimeout", 30, #mDoBlendAnimation, me)1711 blenderTO = pIncludes.mCreateTimeout("ButtonManager_BlenderTimeout", 30, #mDoBlendAnimation, me) 1417 1712 -- if mCheckWoody() = 1 then 1418 1713 -- blenderTO = timeout().new("ButtonManager_BlenderTimeout", 30, #mDoBlendAnimation, me) … … 1445 1740 1446 1741 callFunction = eventList.getaprop(#callFunction) 1447 if ilk(callFunction) = #symbol then1448 anz = eventList[#broadcastSprites].count1742 -- if ilk(callFunction) = #symbol then 1743 anz = count(eventList[#broadcastSprites]) 1449 1744 eventList[#secondEvent] = secondEvent 1450 1745 if not(anz) then 1746 if ilk(callFunction) = #symbol then 1451 1747 sendAllSprites(callFunction, whichEvent, eventList, me, callerObject) 1748 end if 1452 1749 else if eventList[#broadcastSprites][1] = -1 then 1750 if ilk(callFunction) = #symbol then 1453 1751 str = string(callFunction)&&"#"&whichEvent&","&"E&eventList.getaprop(#label)"E&","&&eventList.getaprop(#selected)&","&&secondEvent 1454 1752 do str 1753 end if 1455 1754 else if eventList[#broadcastSprites][1] = 0 then 1755 if ilk(callFunction) = #symbol then 1456 1756 sendSprite(me.spritenum, callFunction, whichEvent, eventList, me, callerObject) 1757 end if 1457 1758 else 1458 1759 repeat with n = 1 to anz 1459 1760 this = eventList[#broadcastSprites][n] 1460 1761 if integerP(this) then 1762 if ilk(callFunction) = #symbol then 1461 1763 sendSprite(this, callFunction, whichEvent, eventList, me, callerObject) 1764 end if 1462 1765 else if ilk(this) = #instance then 1766 if ilk(callFunction) = #symbol then 1463 1767 call(callFunction, [this], whichEvent, eventList, me, callerObject) 1768 end if 1464 1769 else if ilk(this) = #script then 1770 if ilk(callFunction) = #symbol then 1465 1771 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) 1468 1788 if derkanal > 0 then sendSprite(derkanal, callFunction, whichEvent, eventList, me, callerObject) 1469 1789 end if 1470 end repeat 1471 end if 1790 end if 1791 end repeat 1792 -- end if 1472 1793 end if 1473 1794 … … 2018 2339 retval = 1 2019 2340 2341 thisButton.setaprop(#currentPressed, 0) 2342 2020 2343 exit repeat 2021 2344 … … 2028 2351 end if 2029 2352 end if 2353 2030 2354 end if 2031 2355 end if … … 2034 2358 end if 2035 2359 2360 if count(pButtonList) > 0 then 2036 2361 repeat with n = n down to 1 2037 2362 thisButton = pButtonList[n] 2038 2363 if thisButton.getaprop(#currentPressed) = 1 then 2039 2364 call(#myMouseUpOutside, [thisButton.getaprop(#myScriptObject)]) 2365 thisButton.setaprop(#currentPressed, 0) 2040 2366 end if 2041 2367 end repeat 2368 end if 2042 2369 2043 2370 return retval … … 2154 2481 on myKeyDown me, tk, kc, theName 2155 2482 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 movie2483 if pIncludes.mHandleKeyEvent(tk, kc) then exit -- this is a movielevel handler, which gets keyevents first for example to quit the movie 2157 2484 2158 2485 if not pAktiv then exit … … 2164 2491 else 2165 2492 theObject = pButtonList.getaprop(theName) 2166 if ilk(theObject) = #proplistthen2493 if objectP(theObject) then 2167 2494 call(#mKeyDown, [theObject.getaprop(#myScriptObject)], tk, kc) 2168 2495 end if … … 2200 2527 breite = whichImg.width 2201 2528 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) 2204 2531 2205 2532 if (powerbreite <> breite) or (powerhoehe <> hoehe) then
Note: See TracChangeset
for help on using the changeset viewer.
