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

source: trunk/lingosource/castlib1/TableManager.ls

Last change on this file was 71, checked in by alex, 4 months ago

updated scripts

File size: 168.7 KB
Line 
1-- Manager for DrawTable Parentscript used on Bitmap sprites and 3-D Sprites
2-- Alex da Franca c2002  alex@farbflash.de
3-- Use this behavior on any dummy sprite to display a scrolling table with selectable items, text (fixed and editable) and images.
4-- It creates a temporary bitmap member, which is used to display the table on the stage.
5-- Specify the contents and appearance of the table in two property lists, which you pass to the mShowTable handler
6-- Use a copy of the parentscript "TableOptionsliste" to build these two lists and receive events from the table
7
8
9-- Version 19.06.03
10-- mit blend anim =>itanium CD
11
12-- 21.06.03
13-- added mTableCellHighLightEvent() and mDeselectTableCell()
14
15-- 04.08.03
16-- added functionality to handle submenus
17-- unlimited hierarchical depth in case of 3-D,
18-- in case of seperate sprites -> 2-D => hierarchical depth limited by the number of sprites with this behavior attached
19-- if you want to have 6 levels depth you have to provide 6 dummy sprites with this "TableManager" behavior attached in higher channels
20
21
22-- Version 14.08.03
23-- added column sorting and filtering stuff:
24-- sendSprite(mGetKanal(#tabelle), #mChangeSortBy, 1) --> sort alphabetically with column <col> as base according to the sortorder stored in <pSortOrder>
25-- sendSprite(mGetKanal(#tabelle), #mReverse) --> reverse alphabetical ordering top -> bottom (pSortOrder = 0 => default) / bottom -> top (pSortOrder = 1)
26-- sendSprite(mGetKanal(#tabelle), #mFilterColumn, [[1, "b"], [3, "2"]])
27
28
29-- Version 01.09.03
30-- -- changed the following point later again back (it has shown to be better to always add the name for the sprite instead of defaulting):
31-- the name of the sprite (mGetKanal()) is now always #tablekanal, so that related scripts, will always find it.
32-- this works with 3-D sprites, which may have already another name as well as with more than one table sprite (2-D with submenus)
33
34
35-- Version 12.09.03:
36-- added handler to get tab delimited text from current view (fuer rainer) mGetCurrentViewList()
37
38-- Version 13.09.03
39-- added the handlers to insert and delete rows and columns and reposition and resize columns
40
41-- Version 19.09.03:
42-- fixed a bug with mousUpOutside not being called
43-- -- mouseUp after a 'repeat while the mousedown' loop is called even if a mouseUpOutside would be appropriate ?!
44-- added new accessor handlers:
45-- mGetCurrentLinesList() -- get a list with only the lines which are really shown after constraining and sorting
46-- mGetCurrentColumnWidths()
47-- mSelectCell() -- 'mimic' mouse selection by script
48-- mHighLightCell() -- 'mimic' mouse rollover by script
49-- mGetCellByIndex()
50
51-- mInsertCol() and mInsertRow() now return success status
52
53-- version 24.10.03:
54-- added resizing handler (mSendResizeEvent) to be notified when the table is resized by dragging the lower right corner
55-- it is only needed, if other tables (header table) or sprites (e.g. titlebar or dragthumb) depend of the tables rect
56
57-- version 25.10.03
58-- added mGetLineByIndex(lineNum) to get the whole list of an entire line
59
60-- 03.11.03
61-- added new method: mConvertToConstrained(absline) to get the current visible position of a line, when it is constrained or sorted
62
63-- 21.12.03
64-- doofe woody function reingeschrieben, wegen der timeouts (MX 2004 compatibility with timeouts... ;-)
65
66-- 29.12.03
67-- do not set the regpoint on image refresh, since it causes a huge delay for updatestage. simply setting the sprite rect is enough
68
69-- 16.01.04
70-- added <recalc> parameter to the mSetCellContent() function for faster cell content replacement without recalculating the whole table, if recalc = 0
71
72-- 19.01.04
73-- added 'if voidP(pKanal) then mInitProperties me' to prevent errors when using this behavior before it got its beginsprite
74
75
76-- 22.01.04
77-- added mHideTableEvent sent to caller (for menu sprites to be aware when to unhilite the button, which triggers the menu and may want to stay hilited uintil the dismiss of the menu)
78
79-- 23.02.04
80-- added additional parameter to mSuspendMouseEvents() => exception to disable mouseevents on all tables EXCEPT sprite(<exception>) => modal menus
81
82-- alex am 29.03.2004 um 01:15
83-- added handler: mGetScriptObject() to get a reference to the scriptobject
84
85-- alex am Dienstag, 11. Mai 2004
86-- refined the submenuhandling in the enterframe event and the mStopEvent event
87
88-- alex am Donnerstag, 13. Mai 2004
89-- in case mInitProperties() is called before the beginsprite it now checks if it has already been called before beginsprite
90-- so that the variable set do not get overwritten
91
92-- alex am Sonntag, 16. Mai 2004
93-- added the missing fade out, the missing reverse animation is still missing, too lazy today... :-(
94
95-- alex am Montag, 24. Mai 2004
96-- keydownscript now gets set right after showing the table and not on mouseDown
97
98-- alex am Montag, 31. Mai 2004
99-- this script now can be used as parent script to render the image for use in a VM environment
100-- just pass a reference to the instance you want the image to be sent to to the handler "mInitProperties" in the parameter "pipeline"
101-- then this reference gets the updated image objects with the event: "mUpdateVMImage me, theImage, theRect, theName"
102-- the event "mRemoveTableFromScreen me, tabname" tells when the table has to be deleted from the image
103-- sure the mouseEvents (mouseDown, mouseUp and mouseWithin) must be called from outside with the corrected (translated to local) mouse coordinates
104-- also provide the handler mGetAbsolutMouse in your instance to pass the corrected mouselocation here into
105-- this whole implementation seems complicated, but allows to use a table on any image for example for a texture...
106
107-- alex am Mittwoch, 2. Juni 2004
108-- fixed some problems with animations
109
110
111-- alex am 2. August 2004 um 08:04
112-- added mEnableCell() to enable/disable cells => button cells
113
114-- alex am 3. August 2004 um 09:03
115-- added handler: mForceKeyDownScript
116
117
118-- alex am 6. August 2004 um 07:42
119-- added mGetCurrentTargRect() to get the rect of the table without the scrollbars
120-- unfortunately the scrollbars get appended to the initial defined rect, that was not very clever from little alex
121-- so I must always subtract the width of the scrollbars IF ANY :-(
122
123
124---------------------------------
125-- alex am 27. August 2004 um 09:37
126-- added mDeSelectSingleCell me, whichCell to deselect a specific cell 'by hand'
127
128
129-- alex am 8. Oktober 2004 um 10:31
130-- new tempmember handling due to a bug in director
131
132
133---------------------------------
134-- alex am 13. Januar 2005 um 09:38
135-- mSelectCell now accepts another parameter: whichModifier to mimic shift select. can be: #commandselect and #shiftselect
136-- (note that multiple selection must be enabled, which can be enabled temporarely also)
137
138-- added new function: #mSetSelection me, newSelection, tabname
139-- accepts a linear list with cells to be selected
140
141
142---------------------------------
143-- alex am 18. Januar 2005 um 11:54
144-- added handler: mCheckIfMouseIsOverAnyTable, which return true or false and if provided with a tablename checks if the mouse is over a table
145-- and if called without parameter checks if the mouse is over any table
146-- useful to prevent mouse events below a table
147
148
149---------------------------------
150-- Scriptmarker (04.04.2005 at 19:14 Uhr): Alex da Franca: Aenderung // Scriptmarker
151-- added property #texrenderformat to override the standard rgba4444
152-- use r.g. tableformatlist[#texrenderformat] = #rgba8888
153
154
155---------------------------------
156-- Scriptmarker (04.11.2005 at 10:48 Uhr): Alex da Franca: Change // Scriptmarker
157-- added property: pStageRectMargin
158
159
160---------------------------------
161-- Scriptmarker (13.04.2006 at 17:23 Uhr): changes alex // Scriptmarker
162-- in 2-D mode we remove the dummy sprite from the stage
163-- sometimes it is nice to be able to define the rect via the sprite rect
164-- so here the original can be looked up
165
166-- added new public handler:  mGetOriginalSpriteRect
167
168-- // changes  from 13.04.2006 at 17:23)
169---------------------------------
170
171---------------------------------
172-- Scriptmarker (14.04.2006 at 18:31 Uhr): changes alex // Scriptmarker
173-- added property pSeeThru to handle mouseOver events even, when another sprite is obscuring the table
174-- the default is false, as the default should be to NOT receive the events if something other is over the table
175-- // changes  from 14.04.2006 at 18:31)
176---------------------------------
177
178--  ---------------------------------
179--  -- Scriptmarker (15.04.2006 at 07:51 Uhr): changes alex // Scriptmarker
180-- removed the keydownscript forcing on showtable
181-- now it gets the key focus only if clicked on. I can't remember why I had set it up like so.
182
183
184---------------------------------
185-- Scriptmarker (10.05.2006 at 09:50 Uhr): changes alex // Scriptmarker
186-- added method "mMapPointToStage" to "translate" local coords to absolute coords
187
188---------------------------------
189-- Scriptmarker (19.05.2006 at 19:29 Uhr): changes alex // Scriptmarker
190-- added #readyToGo property for tables, as the Rect sometimes get set to 0 in order to force an update
191
192---------------------------------
193-- Scriptmarker: changes alex (24.07.2006 at 09:19 Uhr) // Scriptmarker
194
195-- added mRemoveTableFromScreen event
196-- added property isModal for modal tables to surpress further key and mouse eventy for other tables (in case of using in 3-D)
197-- added property to specify the 3-D camera to use for the overlays
198
199
200---------------------------------
201-- Scriptmarker: changes alex (24.08.2006 at 09:47 Uhr) // Scriptmarker
202-- added a new property "pDontReplaceMember" to draw into the sprite member in case of running as sprite
203-- so the image of the table can persist, if the movie is stopped, instead of deleting it
204-- in the default case you don't see a table, when the movie is not running,
205-- but all scripts can share a tiny 1 bit 1 pixel bitmap as the image will be created at runtime
206-- this is a tad annoying in authoring, because you don't see things, if the movie is not running
207-- but it yields very small movies, when publishing
208
209-- if you want to keep the image of the table after stopping the movie set this property to true
210-- and make sure, that each table sprite uses its own member.
211
212
213-- added handler: mAXTable_GetCurrentRadioGroupSelection(me, groupname, tabname) in order to get the current selection of a given radio group
214
215
216---------------------------------
217-- Scriptmarker (15.04.2008 at 11:44 Uhr): changes alex // Scriptmarker
218-- added property #animationStatusCallBack to TableFormatlist to store informations for animation callback objects
219-- (actually this has been in here for quite some time, but was not used appearantly)
220-- add a linear list to TableFormatlist[#animationStatusCallBack] with callback objects with the following properties:
221-- #calltime => #float => percent done of animation ; required ; so in order to receive an event at 50% of the animation specify 0.5 for #calltime
222-- #callHandler => #symbol ; required ; handler to be called in callback object
223-- #callback => #object ; required ; object the event #callHandler is sent to
224-- #params => any type ; optional ; optional paremeters
225
226
227---------------------------------
228-- Scriptmarker (17.09.2008 at 14:25 Uhr): changes alex  // Scriptmarker
229-- added new public handler to temporarely disable/enable the table => mEnableTable. It has three modi:
230-- -- 0 => disabled
231-- -- 1 => enabled
232-- -- 2 => only user interaction disabled, but still script interaction working
233
234---------------------------------
235-- Scriptmarker (16.10.2008): changes alex  // Scriptmarker
236-- added handler "mGetOverallScrollDistance" to get the distance in pixels, which is hidden and can be scrolled
237-- this is the difference between the width/height of the entire table and the width/height of the visible area
238
239-- added handler "mGetOverallTableRect" to get the overall rect of the table including the parts, which are not visible
240
241
242---------------------------------
243-- Scriptmarker (27.10.2008 at 11:40 Uhr): changes alex // Scriptmarker
244
245-- added support for ease settings using EasingTweenPS
246-- changed the easeMode to use my script "EasingTweenPS" to do the easing, as long as it is present.
247-- if it isn't it falls back to the old version of easing
248-- #animationDynamic can now be a value, which script "EasingTweenPS" "understands" and
249-- there can now be additional #easeParam1 and #easeParam2 parameters
250
251
252---------------------------------
253-- Scriptmarker (31.10.2008 um 8:57 Uhr): changes alex  // Scriptmarker
254-- added new function: mSetAutoHide
255-- enable, disable or change the autohide value after the tablke was created
256-- takes an integer as parameter:
257--       0 or void means "disable autohide function"
258--       negativ values mean "there is no timeout, but a click outside the table dismisses it"
259--       other values are the time in milliseconds without interaction until the table is automatically dismissed
260
261---------------------------------
262-- Scriptmarker: changes alex (18.09.2009 at 10:00 Uhr) // Scriptmarker
263-- added handler mChangeTableBackGroundImage to change the background image of a showing table. (experimental, I'd rather suggest to build a new table, which is much safer)
264
265
266-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
267-- xxxxxxxxxxxxxxxxxx PROPERTIES
268-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
269
270property pKanal, pMember
271property pOldKeyDown
272property pMyScriptObject
273property pAktiv
274property pDreiDModus
275
276property pSuspendMouseEvents
277
278-- 2-D properties:
279property pSavedMember, pSavedRect
280--
281property pSubmenuHandling -- How do we handle submenus in 2-D ?
282-- there are 3 options:
283-- 1.) display them in another sprite, which can
284-- -- a.) be predefined with a dummy sprite for each possible submenu -> submenu depth
285-- -- b.) allocated at runtime into any empty sprite (but since dynamically allocated sprites may cause problems, I vote for a.))
286-- 2.) extending this sprites image to display all submenus in one big image with alpha
287-- 3.) draw to the stage directly without the need of a sprite (I don't know why, but I try to avoid this option after all the mouseevent handling is much more difficult)
288
289
290-- 3-D properties:
291property pTableList, pTextureBaseName
292
293property pAnimationList
294
295-- stopevent for enterframe-ish rollover test :-(
296-- needed for eventhandling of menus, which cover each others
297property pStopOverEvent
298
299
300property pWoody -- flag for new timeout syntax in woody
301
302-- Scriptmarker (04.11.2005 at 10:48 Uhr): Alex da Franca: Change // Scriptmarker
303-- define via gpdl the "available" stage area -> it only applies if the table is set to "forceToStage" -> default
304-- this property is sunstracted form the stage.rect => (the stage).rect.inflate(-pStageRectMargin, -pStageRectMargin)
305property pStageRectMargin
306
307property pSeeThru
308
309property pPowerOfTwoList
310
311
312property pDontReplaceMember
313
314property pTweenScript
315
316
317-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
318on _____INTERFACE
319end
320-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
321
322-- on handler me
323--end
324
325-- on handlers me
326--end
327
328on interface me
329  str = "TableManager Script  by alex da franca c2003 -- alex@farbflash.de -- all rigths reserved"
330  put RETURN & "version 3.0" after str
331  put RETURN & "Please refer to the docs for information on the usage" after str
332  put RETURN & "--------------------------------------------------------" after str
333  put RETURN & "--------------------------------------------------------" after str
334 
335  put RETURN after str
336 
337  put RETURN & "----- invoke the table by calling the handler mShowTable" after str
338  put " <itemlist> and <tableformatlist> specify the values and properties of the table. these lists can be composed on the fly" after str
339  put " or the values can be stored in a container (see my script 'sampleTableList' for details)" after str
340 
341 
342  put RETURN & "----- if you want to compose the table only without to show it right away => prepare or preprocess it, then set the onlyPrepare flag" after str
343  put " since it can take some time to compose huge tables, especially if the text must be renderend, instead of images" after str
344  put " or if you need to know the dimension of the table in case of setting  the #adjustToFit property to #none" after str
345  put " (which may change the dimension of the displayrect according to the contents), before displaying the table" after str
346 
347  put RETURN & "----- optional you can specify a callbackhandler to get an event as soon as the table is prepared," after str
348  put " if left out, the mTablePrepared() handler of this script receives the event, which then can be changed by you" after str
349 
350  put RETURN & "----- if you have specified a callbackhandler you can also specify an instance which receives the call" after str
351  put " if left out, the callbackhandler is called on moviescript level with 'do'" after str
352  put " so if you specify a custom callbackhandler without callbackInstance, make sure the handler does exist to avoid script errors" after str
353  put " as soon as callbackInstance is specified, a missing callBackHandler won't cause errors, but just fails silently" after str
354 
355  put RETURN & "on mShowTable object me, list_itemlist, list_tableformatlist, string_tabname, boolean_onlyPrepare, symbolOrString_callBackHandler, instance_callbackInstance, boolean_dontForceToStage" after str
356  put RETURN & "------------------- RETURNS integer spritenum" after str
357 
358  put RETURN & " - display a table which was composed/prepared before with mShowTable() and the <onlyPrepare> flag set" after str
359  put RETURN & "on mShowPreparedTable me, string_tabname" after str
360  put RETURN & "on mHideTable me, string_tabname" after str
361  put RETURN & "-- -- Hide the table" after str
362  put RETURN & " mSuspendMouseEvents me, boolean_val, exception" after str
363  put RETURN & " mSuspendMouseEvents2 me, val" after str
364  put RETURN & "on mResetAutoHide me, string_tabname, object_senderTable" after str
365 
366  put RETURN after str
367  put RETURN & " -- in 2-D mode we remove the dummy sprite from the stage" after str
368  put RETURN & " -- sometimes it is nice to be able to define the rect via the sprite rect" after str
369  put RETURN & " -- so here the original can be looked up" after str
370  put RETURN & "on mGetOriginalSpriteRect me" after str
371  put RETURN after str
372 
373  put RETURN after str
374  put RETURN & " -- set property pSeeThru to handle mouseOver events even, when another sprite is obscuring the table" after str
375  put RETURN & " -- the default is false, as the default should be to NOT receive the events if something other is over the table" after str
376  put RETURN & "on mSetSeeThru me, boolean_val" after str
377  put RETURN after str
378 
379 
380  put RETURN & "on mGetScriptObject me, string_tabname" after str
381  put RETURN & "on mSetCellContent me, integer_row, integer_column, stringORimage_newVal, booelan_relativ, boolean_recalc, string_tabname" after str
382  put RETURN & "on mGetCellContent me, integer_row, integer_column, string_tabname" after str
383  put RETURN & "on mGetCellByName me, string_aName, string_tabname" after str
384  put RETURN & "on mGetCurrentSelection me, string_tabname" after str
385  put RETURN & "on mAXTable_GetCurrentRadioGroupSelection me, groupname, tabname" after str
386  put RETURN & "on mGetLineByIndex me, integer_lineNum, string_tabname" after str
387  put RETURN & "on mSetSelection me, list_newSelection, string_tabname" after str
388  put RETURN & "on mDeSelectSingleCell me, proplist_whichCell, string_tabname" after str
389  put RETURN & "on mSelectCell me, proplist_whichCell, integer_scrollToTop, string_tabname, symbol_whichModifier" after str
390  put RETURN & " - values for 'scrolltop' are: 0 = dont scroll, 1 = scroll only vertical to top or bottom, 2 = scroll only horizontal to left or right, 3 = scroll vertical AND horizontal to top or bottom and left opr right" after str
391  put RETURN & " - 4 = scroll only vertical to centerV, 5 = scroll only horizontal to centerH, 6 = scroll vertical AND horizontal to center" after str
392  put RETURN & " - <whichModifier> to mimic shift select. can be: #commandselect or #shiftselect or <void> (any other value)" after str
393  put RETURN & " - (note that multiple selection must be enabled, which can be enabled temporarely also -> mGetScriptObject(me).pTableformatlist.setaprop(#multipleSelection, <1 or 2>))" after str
394  put RETURN & "on mHighLightCell me, proplist_whichCell, string_tabname" after str
395  put RETURN & "on mEnableCell me, proplist_whichCell, booelan_enabledState, string_tabname" after str
396  put RETURN & "on mGetCellByIndex me, list_indexList, string_tabname" after str
397  put RETURN & "on mGetCurrentPrintListe me, string_tabname" after str
398  put RETURN & "on mGetCurrentRect me, string_tabname, boolean_withoutShadow" after str
399  put RETURN & "on mGetCurrentTargRect me, string_tabname" after str
400  put RETURN & "on mSetCurrentRect me, rect_newRect, string_tabname, boolean_relativ, boolean_forceUpdate" after str
401  put RETURN & "on mMoveTable me, point_delta, string_tabname" after str
402  put RETURN & "on mReverse me, boolean_sortOrder, string_tabname" after str
403  put RETURN & "on mChangeSortBy me, integer_column, string_tabname" after str
404  put RETURN & "on mFilterColumn me, list_filterListe, string_tabname" after str
405  put RETURN & "on mChangeScrollOffset me, point_relVal, string_tabname" after str
406  put RETURN & "on mSetScrollOffset me, point_absVal, string_tabname" after str
407  put RETURN & "on mGetCurrentViewList me, string_tabname" after str
408  put RETURN & "-- -- -- tab delimted text of current view" after str
409  put RETURN & "on mInsertRow me, list_newValueList, integer_posIndex, string_tabname" after str
410  put RETURN & "on mDeleteRow me, integer_posIndex, integer_toPos, boolean_relativ, string_tabname" after str
411  put RETURN & "on mInsertCol me, integer_posIndex, list_colList, list_newValueList, string_tabname" after str
412  put RETURN & "on mDeleteCol me, integer_whichCol, string_tabname" after str
413  put RETURN & "on mChangeColumnWidth me, integer_col, integer_neuebreite, string_tabname, boolean_dontUpdate" after str
414  put RETURN & "on mChangeColumnPosition me, integer_fromPos, integer_toPos, string_tabname" after str
415  put RETURN & "on mGetCurrentLinesList me, string_tabname" after str
416  put RETURN & "on mGetCurrentColumnWidths me, string_tabname" after str
417  put RETURN & "on mConvertToConstrained me, integer_absLine, string_tabname" after str
418  put RETURN & "on mMapPointToStage me, integer_thePoint, string_tabname" after str
419  put RETURN & " -- -- translate local coords to absolute coords" after str
420  put RETURN & " _____INCOMING_EVENTS_FROM_TABLESCRIPT" after str
421  put RETURN & " mTableCellHighLightEvent me, targrect, whichMode, string_tabname, callerRef, whichcell" after str
422  put RETURN & " mTableBlur me, targrect, whichMode, string_tabname, callerRef, whichcell" after str
423  put RETURN & " mDeselectTableCell me, whichMode, string_tabname, replaced, callerRef, whichcell" after str
424  put RETURN & " mCharAddEvent me, cellRef, caller, string_tabname" after str
425  put RETURN & " mTableScrollEvent me, newScrollOffset, relativ, string_tabname, caller" after str
426  put RETURN & " mSendColResize me, whichColumn, string_tabname, caller" after str
427  put RETURN & " mSendColDrag me, whichColumn, allowDelete, string_tabname, caller" after str
428  put RETURN & " mSendColChange me, oldPos, newPos, string_tabname, caller" after str
429  put RETURN & " mTableFinishEvent me, string_tabname, caller" after str
430  put RETURN & " mSendResizeEvent me, lastrect, newRect, string_tabname, caller" after str
431  put RETURN & " mRefreshSpriteRectAfterStageChange me, newSpriteRect, recentrect" after str
432 
433 
434  return str
435end
436
437-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
438on _____EVENTS
439end
440-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
441
442
443on beginsprite me
444  mInitProperties me
445end
446
447-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
448
449on new me
450  return me
451end
452
453-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
454
455on mInitProperties me, pipeline
456 
457  -- alex am Donnerstag, 13. Mai 2004
458  if not voidP(pKanal) then exit
459  --/ alex am Donnerstag, 13. Mai 2004
460 
461  pSeeThru = 0
462 
463  if voidP(pipeline) then
464    pKanal = sprite(me.spritenum)
465  else
466    pKanal = 0
467  end if
468 
469  pAnimationList = []
470 
471  --  if mGetKanal(#tablekanal) < 1 then mMeldeKanalname(#tablekanal, me.spritenum)
472 
473  pStopOverEvent = 0
474 
475  pSuspendMouseEvents = 0
476 
477  pTextureBaseName = mGetTexname(me)
478 
479  if voidP(pipeline) then
480    if pKanal.member.type = #shockwave3d then -- 3-D mode
481      pDreiDModus = 1
482     
483      pMember = pKanal.member
484     
485      pSubmenuHandling = #dreiD
486     
487    else
488     
489      pSubmenuHandling = #seperateSprites
490     
491      pSavedMember = pKanal.member
492      pSavedRect = pKanal.rect
493     
494      if pDontReplaceMember then
495        pMember = pSavedMember
496      else
497        -- alex am 8. Oktober 2004 um 10:32
498        --      pMember = new(#bitmap)
499        pMember = call(#mGetNewMember, mGetXScript(), #bitmap)
500        --/ alex am 8. Oktober 2004 um 10:32
501      end if
502     
503      pKanal.member = pMember
504      pKanal.locV = -1000
505    end if
506   
507  else
508   
509    pDreiDModus = 0
510   
511    pMember = pipeline
512   
513    pSubmenuHandling = #dreiD
514   
515  end if
516 
517  pTableList = [:]
518  pAktiv = 0
519end
520
521-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
522
523on mStopMovieWasCalled me
524  if the runmode <> #author then pAktiv = 0
525end
526
527-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
528
529
530on endsprite me
531 
532  --  if mGetKanal(#tablekanal) = me.spritenum then mMeldeAbKanalname(#tablekanal, me.spritenum)
533 
534  -- first kill hide animations if there are any -- the hard way
535  repeat with n = pAnimationList.count down to 1
536    -- alex am Mittwoch, 2. Juni 2004
537    thisAnim = pAnimationList[n].getaprop(#myAnimation)
538    --/ alex am Mittwoch, 2. Juni 2004
539    if thisAnim.getaprop(#animationType) = #dissappear then
540     
541      if thisAnim.getaprop(#dreiDmode) = 1 or pAnimationList[n].getaprop(#dreiDmode) = 1 then
542        moname = string(pAnimationList[n].getaprop(#useModel))
543        if moname.length then
544          mRemove3DModel me, moname, pAnimationList[n]
545        else
546          mRemove3DOverlay me, pAnimationList[n].getaprop(#myName), pAnimationList[n].getaprop(#myCamera)
547        end if
548       
549        if (count(pTableList) < 1) then
550          if pKanal <> 0 then sendSprite(me.spritenum, #mRemoveFromEventList, me)
551        end if
552       
553      else
554       
555        if ilk(pMember) = #instance then
556          call(#mRemoveTableFromScreen, [pMember], pAnimationList[n].getaprop(#myName))
557         
558        else if thisAnim.getaprop(#removeAll) or (count(pTableList) < 1) then
559         
560          if pKanal <> 0 then
561            pKanal.locV = -1000
562            pKanal.blend = 100
563          end if
564         
565          -- release the memory for the #bitmap:
566          if ilk(pMember) = #member then
567            if pMember.type = #bitmap then
568              pMember.image = image(1,1,1)
569            end if
570          end if
571         
572        end if
573       
574      end if
575     
576     
577      pAnimationList.deleteAt(n)
578    end if
579  end repeat
580  pAnimationList = []
581  --/ hide animations
582 
583  (the actorlist).deleteOne(me)
584 
585  -- ullala changed for Woody - to
586  if ilk(timeOut(pTextureBaseName&"_cleanup")) = #timeout then timeout(pTextureBaseName&"_cleanup").forget()
587  -- ullala changed for woody - to end --
588 
589  if not voidP(pOldKeyDown) then the keyDownscript = pOldKeyDown
590 
591  if pDreiDModus then
592   
593    repeat with n = pTableList.count down to 1
594     
595      if ilk(pTableList[n].getaprop(#myScriptObject)) = #instance then call(#mDestroy, pTableList[n].getaprop(#myScriptObject))
596     
597      if pAktiv <> 0 then
598        camObj = pTableList[n].getaprop(#myCamera)
599        if voidP(camObj) then camObj = pKanal.camera
600        tex = pMember.texture(pTextureBaseName&"_"&pTableList[n].getaprop(#myName))
601        olayIndex = mGetOlayIndex(me, camObj, tex)
602        if olayIndex > 0 then
603          camObj.removeoverlay(olayIndex)
604          pMember.deleteTexture(tex.name)
605        end if
606      end if
607     
608    end repeat
609   
610    sendSprite(me.spritenum, #mRemoveFromEventList, me)
611   
612  else
613   
614    repeat with n = pTableList.count down to 1
615      if ilk(pTableList[n].getaprop(#myScriptObject)) = #instance then call(#mDestroy, pTableList[n].getaprop(#myScriptObject))
616    end repeat
617   
618    if pKanal <> 0 then
619     
620      if pSavedMember <> pMember then
621        pKanal.member = pSavedMember
622        pKanal.rect = pSavedRect
623       
624        -- alex am 8. Oktober 2004 um 10:32
625        --      pMember.erase()
626        call(#mEraseMember, mGetXScript(), pMember)
627        -- alex am 8. Oktober 2004 um 10:32
628       
629      end if
630     
631    end if
632   
633  end if
634 
635  pTableList = [:]
636end
637
638-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
639
640
641on mouseDown me
642  if pDreiDModus or (pKanal = 0) then
643    pass
644    exit
645  end if
646 
647  if not pAktiv then exit
648 
649  if pSuspendMouseEvents then exit
650 
651  sendAllSprites(#mResetKeyDownScript)
652 
653  ml = the clickloc
654 
655  if (pTableList.count > 1) and (pSubmenuHandling = #singleSprite) then
656    repeat with n = pTableList.count down to 1
657      theRect = pTableList[n].getaprop(#myRect)
658      if ilk(theRect) = #rect then
659        if (ml).inside(theRect) then
660         
661          if  the keyDownscript <> "sendSprite("&me.spritenum&", #myKeyDown, the key, the keycode, "&QUOTE&pTableList[n].getaprop(#myName)&QUOTE&")" then
662            pOldKeyDown = the keyDownscript
663          end if
664          the keyDownscript = "sendSprite("&me.spritenum&", #myKeyDown, the key, the keycode, "&QUOTE&pTableList[n].getaprop(#myName)&QUOTE&")"
665         
666          if ilk(pTableList[n].getaprop(#myScriptObject)) = #instance then call(#myMouseDown, pTableList[n].getaprop(#myScriptObject), ml)
667          exit repeat
668        end if
669      end if
670    end repeat
671   
672  else
673   
674    if the keyDownscript <> "sendSprite("&me.spritenum&", #myKeyDown, the key, the keycode)" then
675      pOldKeyDown = the keyDownscript
676    end if
677    the keyDownscript = "sendSprite("&me.spritenum&", #myKeyDown, the key, the keycode)"
678   
679    if ilk(pTableList[1].getaprop(#myScriptObject)) = #instance then call(#myMouseDown, pTableList[1].getaprop(#myScriptObject), ml)
680  end if
681 
682end
683
684-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
685
686
687on mouseUp me
688  if pDreiDModus or (pKanal = 0) then
689    pass
690    exit
691  end if
692 
693  if not pAktiv then exit
694  if pSuspendMouseEvents then exit
695 
696  ml = the mouseloc
697 
698  if (pTableList.count > 1) and (pSubmenuHandling = #singleSprite) then
699    repeat with n = pTableList.count down to 1
700      theRect = pTableList[n].getaprop(#myRect)
701      if ilk(theRect) = #rect then
702        if (ml).inside(theRect) then
703          if ilk(pTableList[n].getaprop(#myScriptObject)) = #instance then call(#myMouseUp, pTableList[n].getaprop(#myScriptObject), ml)
704          exit repeat
705        end if
706      end if
707    end repeat
708   
709  else
710   
711    -- mouseUp after a 'repeat while the mousedown' loop is called even if a mouseUpOutside would be appropriate ?!
712   
713    theRect = pTableList[1].getaprop(#myRect)
714    if ilk(theRect) = #rect then
715      if (ml).inside(theRect) then
716        if ilk(pTableList[1].getaprop(#myScriptObject)) = #instance then
717          call(#myMouseUp, pTableList[1].getaprop(#myScriptObject), ml)
718        end if
719      else
720        if ilk(pTableList[1].getaprop(#myScriptObject)) = #instance then call(#myMouseUpOutside, pTableList[1].getaprop(#myScriptObject))
721      end if
722    end if
723   
724  end if
725end
726
727-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
728
729on mouseUpOutside me
730  if pDreiDModus or (pKanal = 0) then
731    pass
732    exit
733  end if
734 
735  if not pAktiv then exit
736  if pSuspendMouseEvents then exit
737 
738  if (pTableList.count > 1) and (pSubmenuHandling = #singleSprite) then
739    repeat with n = pTableList.count down to 1
740      if ilk(pTableList[n].getaprop(#myScriptObject)) = #instance then call(#myMouseUpOutside, pTableList[n].getaprop(#myScriptObject))
741    end repeat
742   
743  else
744   
745    if ilk(pTableList[1].getaprop(#myScriptObject)) = #instance then call(#myMouseUpOutside, pTableList[1].getaprop(#myScriptObject))
746  end if
747end
748
749-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
750
751on rightMouseUp me
752  if pDreiDModus or (pKanal = 0) then
753    pass
754    exit
755  end if
756 
757  if not pAktiv then exit
758  if pSuspendMouseEvents then exit
759 
760  ml = the mouseloc
761 
762  if (pTableList.count > 1) and (pSubmenuHandling = #singleSprite) then
763    repeat with n = pTableList.count down to 1
764      theRect = pTableList[n].getaprop(#myRect)
765      if ilk(theRect) = #rect then
766        if (ml).inside(theRect) then
767          if ilk(pTableList[n].getaprop(#myScriptObject)) = #instance then call(#myMouseUp, pTableList[n].getaprop(#myScriptObject), ml, 1)
768          exit repeat
769        end if
770      end if
771    end repeat
772   
773  else
774   
775    if ilk(pTableList[1].getaprop(#myScriptObject)) = #instance then call(#myMouseUp, pTableList[1].getaprop(#myScriptObject), ml, 1)
776  end if
777end
778
779-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
780
781
782-- used for mouseOver/enter/leave tracking, if necessary -> pSuspendMouseEvents <> 1
783on enterframe me
784  if pKanal <> 0 then mMyEnterFrame me
785end
786
787-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
788
789on mMyEnterFrame me, cl
790  if pSuspendMouseEvents then exit
791 
792  if not pStopOverEvent then
793    repeat with n = pTableList.count down to 1
794      scr = pTableList[n].getaprop(#myScriptObject)
795      if ilk(scr) = #instance then
796        if ilk(cl) <> #point then ml = mGetAbsolutMouse(me, scr, 0, pTableList.getPropAt(n))
797        else ml = cl
798       
799       
800        if (pSubmenuHandling = #seperateSprites) and (pKanal <> 0) then
801          if pSeeThru then
802            erg = rollover(me.spritenum)
803          else
804            erg = (the rollover = me.spritenum)
805          end if
806        else
807          erg = 1
808        end if
809        if erg = 1 then erg = call(#mMausOver, scr, ml)
810        else erg = call(#mMausOver, scr, ml, 1) -- with <forceOut> set to true, just to handle mouseLeave events in the object
811       
812        if listP(erg) then
813         
814          if pSubmenuHandling = #seperateSprites then
815            sendAllSprites(#mStopEvent, erg)
816            pStopOverEvent = 0
817          else
818           
819            if count(erg) > 1 then
820              dername = erg[2]
821              table = pTableList.getaprop(dername)
822              if objectP(table) then
823                scr = table.getaprop(#myScriptObject)
824                if ilk(scr) = #instance then
825                  if ilk(cl) <> #point then ml = mGetAbsolutMouse(me, scr, 0, dername)
826                  else ml = cl
827                  erg = call(#mMausOver, scr, ml)
828                end if
829              end if
830            end if
831           
832          end if
833         
834          exit repeat
835        else
836          if erg > 0 then
837            if pSubmenuHandling = #seperateSprites then
838              sendAllSprites(#mStopEvent, erg)
839              pStopOverEvent = 0
840            end if
841           
842            exit repeat
843          end if
844        end if
845       
846      end if
847     
848      if pTableList[n].getaprop(#isModal) then exit
849     
850    end repeat
851  else
852    pStopOverEvent = 0
853  end if
854end
855
856
857-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
858
859on mStopEvent me, ausnahme
860 
861  if listP(ausnahme) then
862    if count(ausnahme) > 1 then ausnahme = ausnahme[1]
863  end if
864 
865  if pKanal <> 0 then sprnum = me.spritenum
866  else sprnum = 0
867 
868  if sprnum <> ausnahme then
869    pStopOverEvent = 1
870  else
871    repeat with n = pTableList.count down to 1
872      scr = pTableList[n].getaprop(#myScriptObject)
873      if ilk(scr) = #instance then
874        ml = mGetAbsolutMouse(me, scr, 0, pTableList.getPropAt(n))
875        erg = call(#mMausOver, scr, ml)
876        -- alex am Mittwoch, 2. Juni 2004
877        if listP(erg) then exit repeat
878        --/ alex am Mittwoch, 2. Juni 2004
879        if erg > 0 then
880          exit repeat
881        end if
882      end if
883    end repeat
884    pStopOverEvent = 1
885    --    put "ausnahme" && ausnahme
886  end if
887 
888end
889
890-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
891
892-- used for the animation on show or hide
893on stepframe me
894  if not pAnimationList.count then (the actorlist).deleteOne(me)
895 
896  repeat with n = pAnimationList.count down to 1
897    if pAnimationList[n].getaprop(#myAnimation).getaprop(#animationType) = #dissappear then mProcessHideAnimation me, pAnimationList[n]
898    else mProcessAnimation me, pAnimationList[n]
899  end repeat
900end
901
902
903-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
904
905on getPropertyDescriptionList
906 
907  retliste = [:]
908 
909  retliste[#pStageRectMargin] = [#format:#integer, #default:0, comment:"Margin for visible stage area"]
910  retliste[#pDontReplaceMember] = [#format:#boolean, #default:0, comment:"Keep image (each sprite has own member)"]
911 
912  return retliste
913end
914
915
916
917-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
918on _____PUBIC_HANDLERS
919end
920-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
921
922
923
924-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
925-- xxxxxxxxxxxxxxxxxx Invoke the table    (STARTING POINT)
926-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
927
928-- invoke the table by calling the following handler:
929-- <itemlist> and <tableformatlist> specify the values and properties of the table. these lists can be composed on the fly
930-- or the values can be stored in a container (see my script "sampleTableList" for details)
931
932
933-- if you want to compose the table only without to show it right away => prepare or preprocess it, then set the onlyPrepare flag
934-- since it can take some time to compose huge tables, especially if the text must be renderend, instead of images
935-- or if you need to know the dimension of the table in case of setting  the #adjustToFit property to #none
936-- (which may change the dimension of the displayrect according to the contents), before displaying the table
937
938-- optional you can specify a callbackhandler to get an event as soon as the table is prepared,
939-- if left out, the mTablePrepared() handler of this script receives the event, which then can be changed by you
940
941-- if you have specified a callbackhandler you can also specify an instance which receives the call
942-- if left out, the callbackhandler is called on moviescript level with 'do'
943-- so if you specify a custom callbackhandler without callbackInstance, make sure the handler does exist to avoid script errors
944-- as soon as callbackInstance is specified, a missing callBackHandler won't cause errors, but just fails silently
945
946
947on mShowTable me, itemlist, tableformatlist, tabname, onlyPrepare, callBackHandler, callbackInstance, dontForceToStage, isModal, instantRender
948 
949  if voidP(pKanal) then mInitProperties me
950 
951  if ilk(tableformatlist) <> #proplist then
952    put "Script: TableManager ; Handler: mShowTable ; WARNING: Something is wrong here: tableformatlist is not a property list"
953    exit
954  end if
955 
956  targrect = tableformatlist.getaprop(#targrect)
957  if ilk(targrect) <> #rect then
958    put "Script: TableManager ; Handler: mShowTable ; WARNING: Something is wrong here: tableformatlist.targrect is not a rect"
959    exit
960  end if
961  if targrect.width < 1 then
962    put "Script: TableManager ; Handler: mShowTable ; WARNING: Something is wrong here: tableformatlist.targrect.width < 1"
963    exit
964  end if
965  if targrect.height < 1 then
966    put "Script: TableManager ; Handler: mShowTable ; WARNING: Something is wrong here: tableformatlist.targrect.height < 1"
967    exit
968  end if
969 
970 
971  -- first kill hide animations if there are any -- the hard way
972  repeat with n = pAnimationList.count down to 1
973    -- alex am Mittwoch, 2. Juni 2004
974    thisAnim = pAnimationList[n].getaprop(#myAnimation)
975   
976    if thisAnim.getaprop(#animationType) = #dissappear then
977     
978      if thisAnim.getaprop(#dreiDmode) = 1 or pAnimationList[n].getaprop(#dreiDmode) = 1 then
979        moname = string(pAnimationList[n].getaprop(#useModel))
980        if moname.length then
981          mRemove3DModel me, moname, pAnimationList[n]
982        else
983          mRemove3DOverlay me, pAnimationList[n].getaprop(#myName), pAnimationList[n].getaprop(#myCamera)
984        end if
985       
986        if (count(pTableList) < 1) then
987          if pKanal <> 0 then sendSprite(me.spritenum, #mRemoveFromEventList, me)
988        end if
989       
990      else
991       
992        if ilk(pMember) = #instance then
993          call(#mRemoveTableFromScreen, [pMember], pAnimationList[n].getaprop(#myName))
994         
995          --/ alex am Mittwoch, 2. Juni 2004
996         
997        else if thisAnim.getaprop(#removeAll) or (count(pTableList) < 1) then
998          if pKanal <> 0 then
999            pKanal.locV = -1000
1000            pKanal.blend = 100
1001          end if
1002         
1003          -- release the memory for the #bitmap:
1004          if ilk(pMember) = #member then
1005            if pMember.type = #bitmap then
1006              pMember.image = image(1,1,1)
1007            end if
1008          end if
1009         
1010        end if
1011       
1012      end if
1013     
1014      callback = pAnimationList[n].getaprop(#callbackinstance)
1015      if ilk(callback) = #instance then call(#mRemoveTableFromScreen, [callback], pAnimationList[n].getaprop(#myName))
1016     
1017      pAnimationList.deleteAt(n)
1018    end if
1019  end repeat
1020  --/ hide animations
1021 
1022 
1023  if voidP(tabname) then -- Sonderfall: ohne name loescht ALLE vorherigen tabellen
1024    tabname = "tabelle1"
1025    ind = 1
1026   
1027    --    if pDreiDModus then camObj = pKanal.camera
1028   
1029    repeat with n = pTableList.count down to 2
1030      if ilk(pTableList[n].getaprop(#myScriptObject)) = #instance then call(#mDismissTable, pTableList[n].getaprop(#myScriptObject))
1031     
1032      if pDreiDModus then
1033       
1034        tex = pMember.texture(pTextureBaseName&"_"&pTableList[n].getaprop(#myName))
1035        moname = string(pTableList[n].getaprop(#useModel))
1036        if moname = "" then
1037         
1038          camObj = pTableList[n].getaprop(#myCamera)
1039          if voidP(camObj) then camObj = pKanal.camera
1040         
1041          olayIndex = mGetOlayIndex(me, camObj, tex)
1042          if olayIndex > 0 then
1043            camObj.removeoverlay(olayIndex)
1044            pMember.deleteTexture(tex.name)
1045          end if
1046         
1047        else
1048         
1049          theModel = pMember.model(moname)
1050          if not voidP(theModel) then
1051            if not voidP(tex) then
1052              repeat with m = theModel.shaderlist.count down to 1
1053                if theModel.shaderlist[m].texture = tex then pMember.deleteShader(theModel.shaderlist[m].name)
1054              end repeat
1055              pMember.deleteTexture(tex.name)
1056            end if
1057            if theModel.name = pTextureBaseName&"_"&pTableList[n].getaprop(#myName) then pMember.deleteModel(theModel.name)
1058          end if
1059        end if
1060       
1061      end if
1062     
1063    end repeat
1064   
1065  else
1066    if (pSubmenuHandling = #seperateSprites) and (pAktiv = 1) and (voidP(pTableList.getaprop(tabname))) then
1067      letzter = the lastchannel
1068      repeat with spr = (me.spritenum + 1) to letzter
1069        erg = sendSprite(spr, #mShowTable, itemlist, tableformatlist, tabname, onlyPrepare, callBackHandler, callbackInstance, dontForceToStage, isModal, instantRender)
1070        if not voidP(erg) then return erg
1071      end repeat
1072      return 0
1073     
1074    end if
1075   
1076  end if
1077 
1078  --  if count(pTableList) < 1 then
1079  if pDreiDModus then
1080    moname = string(tableformatlist.getaprop(#useModel))
1081    if length(moname) < 1 then
1082      sendSprite(me.spritenum, #mAddToEventList, me, 1)
1083    else
1084     
1085      theModel = pMember.model(moname)
1086      if not voidP(theModel) then sendSprite(me.spritenum, #mEventRouter_AddToRollOverList, theModel)
1087     
1088    end if
1089  else
1090    tableformatlist.setaprop(#useModel, "")
1091  end if
1092  --  end if
1093 
1094  thisTable = pTableList.getaprop(tabname)
1095  if ilk(thisTable) <> #proplist and ilk(thisTable) <> #instance then
1096    thisTable = [:]
1097    pTableList.setaprop(tabname, thisTable)
1098  end if
1099 
1100  if not objectP(thisTable.getaprop(#myScriptObject)) then
1101   
1102    tscr = mGetXScript(#DrawTableParent)
1103    if not(listP(tscr)) then
1104      if ilk(tscr) = #instance then tscr = tscr.script
1105      tscr =  new(tscr)
1106    end if
1107   
1108    thisTable[#myScriptObject] = tscr
1109  end if
1110 
1111 
1112  if ilk(thisTable.getaprop(#myScriptObject)) <> #instance then
1113    -- we did not succed in initializing a table parent script (only fails if the LDM tableScripts.dcr isn't present at this time in the score))
1114    put "Unable to create required scriptobject (DrawTableParent). Make sure the LDM tableScripts.dcr is present as sprite in the score"
1115    return 0
1116  end if
1117 
1118 
1119  thisTable[#myRect] = 0
1120  thisTable[#myName] = tabname
1121  thisTable[#readyToGo] = 0
1122  thisTable[#myImg] = 0
1123  thisTable[#deletionMark] = 0
1124 
1125  if onlyPrepare then
1126    thisTable[#prepareFlag] = 1
1127   
1128    thisTable[#callBackHandler] = callBackHandler
1129   
1130    if voidP(callbackInstance) then callbackInstance = #moviescript
1131    thisTable[#callbackInstance] = callbackInstance
1132   
1133  else
1134    if ilk(callbackInstance) = #instance then thisTable[#callbackInstance] = callbackInstance
1135    thisTable[#prepareFlag] = 0
1136  end if
1137 
1138 
1139  val = string(tableformatlist.getaprop(#useModel))
1140  thisTable.setaprop(#useModel, val)
1141  thisTable.setaprop(#isModal, isModal)
1142 
1143  if pDreiDModus then
1144   
1145    texrenderformat = tableformatlist.getaprop(#texrenderformat)
1146    if not voidP(texrenderformat) then thisTable[#texrenderformat] = texrenderformat
1147   
1148    mo = pMember.model(val)
1149    if not(voidP(mo)) then
1150     
1151      thisTable.setaprop(#shaderListIndex, tableformatlist.getaprop(#shaderListIndex))
1152      thisTable.setaprop(#textureListIndex, tableformatlist.getaprop(#textureListIndex))
1153      thisTable.setaprop(#textureblendfunction, tableformatlist.getaprop(#textureblendfunction))
1154      thisTable.setaprop(#blendsourcelist, tableformatlist.getaprop(#blendsourcelist))
1155     
1156     
1157      scrili = xscr().mGetParentScriptList(mo)
1158      if scrili.getPos(me) < 1 then scrili.add(me)
1159     
1160     
1161    else
1162      thisTable.setaprop(#useModel, "")
1163      tableformatlist.setaprop(#useModel, "")
1164     
1165      myCamera = tableformatlist.getaprop(#overlayCameraObject)
1166     
1167      if stringP(myCamera) then
1168        myCamera = pKanal.member.camera(myCamera)
1169      end if
1170      if voidP(myCamera) then myCamera = pKanal.camera
1171      if not voidP(myCamera) then thisTable[#myCamera] = myCamera
1172     
1173    end if
1174   
1175   
1176    -- if we are in 3-D mode, we don't want to exceed 504 pixels:
1177    r = tableformatlist.getaprop(#targrect)
1178    if ilk(r) = #rect then
1179      if tableformatlist.getaprop(#shadowStyle) = #shadow then
1180        shdow = (tableformatlist[#shadowDistance] + tableformatlist[#shadowBlur]) * 2
1181      else
1182        shdow = 0
1183      end if
1184     
1185      maxW = mGetNextPowerOfTwo(me, the maxinteger) - shdow
1186      animstyle = tableformatlist.getaprop(#animationStyle)
1187      if r.width > maxW then
1188        case animstyle of
1189          #wipeRL, #pushRL, #scaleRL, #scaleRT, #scaleRB:
1190            tableformatlist.setaprop(#targrect, rect(r.right-maxW, r.top, r.right, r.bottom))
1191          otherwise
1192            tableformatlist.setaprop(#targrect, rect(r.left, r.top, r.left + maxW, r.bottom))
1193        end case
1194       
1195      end if
1196     
1197      r = tableformatlist.getaprop(#targrect)
1198      if r.height > maxW then
1199        case animstyle of
1200          #wipeBT, #pushBT, #scaleBT, #scaleLB, #scaleRB, #zoomBT:
1201            tableformatlist.setaprop(#targrect, rect(r.left, r.bottom-maxW, r.right, r.bottom))
1202          otherwise
1203            tableformatlist.setaprop(#targrect, rect(r.left, r.top, r.right, r.top+maxW))
1204        end case
1205      end if
1206     
1207    end if
1208   
1209   
1210  end if
1211 
1212 
1213  -- setup animation properties:
1214  doAnim = 0
1215  animList = [:]
1216 
1217  animationTime = tableformatlist.getaprop(#animationTime)
1218  if ilk(animationTime) <> #integer then animationTime = 300
1219 
1220  if animationTime > 0 then
1221   
1222    animationStyle = tableformatlist.getaprop(#animationStyle)
1223    if ilk(animationStyle) = #symbol then
1224      if [#incremental, #threadRendering, #threadRenderingDeep, #none].getPos(animationStyle) < 1 then
1225        animList[#animationStyle] = animationStyle
1226       
1227        animList[#animationTime] = animationTime
1228       
1229        animList[#animationDynamic] = tableformatlist.getaprop(#animationDynamic)
1230        animList[#easeParam1] = tableformatlist.getaprop(#easeParam1)
1231        animList[#easeParam2] = tableformatlist.getaprop(#easeParam2)
1232        animList[#animationOnHide] = tableformatlist.getaprop(#animationOnHide)
1233       
1234        if animationStyle = #transition then
1235          val = tableformatlist.getaprop(#startpoint)
1236          if ilk(val) = #point then animList[#startwert] = val
1237          else animList[#startwert] = #linksoben
1238        end if
1239       
1240        doAnim = 1
1241      end if
1242    end if
1243   
1244    theFadeIn = tableformatlist.getaprop(#fadeIn)
1245    if listP(theFadeIn) then
1246      if theFadeIn.count > 1 then
1247        animList[#startBlend] = min(100, max(0, theFadeIn[1]))
1248        animList[#fullBlend] = min(100, max(0, theFadeIn[2]))
1249       
1250        if not doAnim then
1251          animList[#animationTime] = animationTime
1252        end if
1253       
1254        doAnim = 1
1255      end if
1256    end if
1257   
1258    theFadeOut = tableformatlist.getaprop(#fadeOut)
1259    if ilk(theFadeOut) = #integer then
1260      if theFadeOut >= 0 then animList[#endBlend] = min(100, max(0, theFadeOut))
1261     
1262      if not doAnim then
1263        animList[#animationTime] = animationTime
1264      end if
1265     
1266    end if
1267   
1268  end if
1269 
1270  if animList.count then
1271    animationStatusCallBack = tableformatlist.getaprop(#animationStatusCallBack)
1272    if listP(animationStatusCallBack) then
1273      tableformatlist.deleteProp(#animationStatusCallBack)
1274      animList[#callList] = animationStatusCallBack
1275    end if
1276   
1277    thisTable[#myAnimation] = animList
1278  end if
1279 
1280  --    if doAnim then onlyPrepare = 1
1281 
1282  --/animation
1283 
1284  pAktiv = 1
1285 
1286  if not dontForceToStage then 
1287    sr = mGetStageBoundRect(me, string(tableformatlist.getaprop(#useModel)))
1288    tr = tableformatlist.getaprop(#targrect)
1289    if ilk(tr) = #rect then
1290     
1291      offsH = sr.right - tr.right
1292      if offsH > 0 then
1293        offsH = max(0, (sr.left - tr.left))
1294      end if
1295     
1296      offsV = (sr.bottom - tr.top)
1297      if offsV > 0 then
1298        offsV = max(0, (sr.top - tr.top))
1299      end if
1300     
1301      if ((offsH <> 0) or (offsV <> 0)) then tableformatlist[#targrect] = tableformatlist.targrect.offset(offsH, offsV)
1302      tableformatlist[#targrect][4] = min(tableformatlist[#targrect][4], sr.bottom)
1303    end if
1304  end if
1305 
1306 
1307  call(#mDisplayTable, thisTable.myScriptObject, itemlist, tableformatlist, me, onlyPrepare, tabname, instantRender)
1308 
1309 
1310  --  ---------------------------------
1311  --  -- Scriptmarker (15.04.2006 at 07:51 Uhr): changes alex // Scriptmarker
1312  --  pOldKeyDown = the keyDownscript
1313  --  if pKanal <> 0 then
1314  --    the keyDownscript = "sendSprite("&me.spritenum&", #myKeyDown, the key, the keycode, "&QUOTE&tabname&QUOTE&")"
1315  --  end if
1316  --  -- // changes  from 15.04.2006 at 07:51)
1317  --  ---------------------------------
1318 
1319 
1320  if pKanal <> 0 then return me.spritenum
1321  else return me
1322 
1323end
1324
1325
1326-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1327-- display a table which was composed/prepared before with mShowTable() and the <onlyPrepare> flag set
1328
1329on mShowPreparedTable me, tabname
1330  if count(pTableList) < 1 then return 0
1331 
1332  if not voidP(tabname) then
1333    table = pTableList.getaprop(tabname)
1334  else
1335    table = pTableList[1]
1336  end if
1337  if ilk(table) <> #proplist then return 0
1338 
1339  if table.getaprop(#prepareFlag) then
1340    table[#prepareFlag] = 0
1341    call(#mDisplayPreparedTable, table.getaprop(#myScriptObject))
1342    return 1
1343  end if
1344 
1345  return 0
1346end
1347
1348
1349
1350-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1351-- xxxxxxxxxxxxxxxxxx Hide the table
1352-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1353
1354on mHideTable me, tabname, instantHide
1355  if not listP(pTableList) then exit
1356  if count(pTableList) < 1 then exit
1357 
1358  tabname = string(tabname)
1359  theTable = pTableList.getaprop(tabname)
1360 
1361  if ilk(theTable) <> #proplist then
1362    if length(tabname) > 1 then exit
1363    theTable = pTableList[1]
1364    tabname = theTable.getaprop(#myName)
1365    removeAll = 1
1366  else
1367    removeAll = 0
1368  end if
1369 
1370  tblcnt = 0
1371  repeat with n = pTableList.count down to 1
1372    if (pTableList[n].count) and (pTableList[n].getaprop(#myName) <> tabname) then tblcnt = tblcnt + 1
1373  end repeat
1374 
1375  if removeAll or (tblcnt = 0) then
1376    removeAll = 1
1377  end if
1378 
1379  if not voidP(pOldKeyDown) then
1380    the keyDownscript = pOldKeyDown
1381    pOldKeyDown = void
1382  end if
1383 
1384  --end if
1385 
1386  pos = pAnimationList.getPos(theTable)
1387  if pos > 0 then pAnimationList.deleteAt(pos)
1388 
1389 
1390  ---------------------------------
1391  -- Scriptmarker: changes alex (25.08.2006 at 15:27 Uhr) // Scriptmarker
1392 
1393  if not(instantHide) then
1394    -- alex am Sonntag, 16. Mai 2004
1395    animation = theTable.getaprop(#myAnimation)
1396    if not voidP(animation) then
1397      if animation.getaprop(#animationOnHide) or (animation.getaprop(#endblend) > -1) then
1398        animation[#starttime] = the milliseconds
1399        animation[#animationType] = #dissappear
1400        --      animation[#endRect] = theRect
1401       
1402        -- alex am Mittwoch, 2. Juni 2004
1403        pAnimationList.add(theTable)
1404        --/ alex am Mittwoch, 2. Juni 2004
1405       
1406        if ((the actorlist).getPos(me) < 1) then (the actorlist).add(me)
1407        doAnim = 1
1408      end if
1409    end if
1410    --/ alex am Sonntag, 16. Mai 2004
1411  end if
1412  -- // changes  from 25.08.2006 at 15:27)
1413  ---------------------------------
1414 
1415  theTable[#deletionMark] = 1
1416 
1417  if ilk(theTable.getaprop(#myScriptObject)) = #instance then call(#mDismissTable, theTable.getaprop(#myScriptObject))
1418 
1419  if (tblcnt = 0) then pAktiv = 0
1420 
1421  if doAnim then
1422   
1423    if pDreiDModus then
1424      animation[#dreiDmode] = 1
1425     
1426      moname = string(theTable.getaprop(#useModel))
1427     
1428      if moname.length then
1429        animation[#useModel] = moname
1430      else
1431        animation[#myName] = theTable.getaprop(#myName)
1432      end if
1433     
1434    else -- 2-D mode
1435      animation[#removeAll] = removeAll
1436    end if
1437   
1438    callback = theTable.getaprop(#callbackInstance)
1439    if ilk(callback) = #instance then
1440      call(#mHideTableEvent, [callback], tabname)
1441    end if
1442   
1443  else -- no animation to dissapear
1444   
1445    if pDreiDModus then
1446      moname = string(theTable.getaprop(#useModel))
1447     
1448      if moname.length then
1449       
1450        mRemove3DModel me, moname, theTable
1451       
1452      else
1453       
1454        mRemove3DOverlay me, theTable.getaprop(#myName), theTable.getaprop(#myCamera)
1455       
1456      end if
1457     
1458      if (tblcnt = 0) then sendSprite(me.spritenum, #mRemoveFromEventList, me)
1459     
1460      callback = theTable.getaprop(#callbackInstance)
1461      if ilk(callback) = #instance then
1462        call(#mHideTableEvent, [callback], tabname)
1463        call(#mRemoveTableFromScreen, [callback], tabname)
1464      end if
1465     
1466    else
1467      if ilk(pMember) = #instance then
1468       
1469        callback = theTable.getaprop(#callbackInstance)
1470        if ilk(callback) = #instance then
1471          call(#mHideTableEvent, [callback], tabname)
1472        end if
1473       
1474        call(#mRemoveTableFromScreen, [pMember], theTable.getaprop(#myName))
1475       
1476      else if removeAll or (tblcnt = 0) then
1477        if pKanal <> 0 then
1478          pKanal.locV = -1000
1479          pKanal.blend = 100
1480        end if
1481       
1482        -- release the memory for the #bitmap:
1483        if ilk(pMember) = #member then
1484          if pMember.type = #bitmap then
1485            pMember.image = image(1,1,1)
1486          end if
1487        end if
1488       
1489        callback = theTable.getaprop(#callbackInstance)
1490        if ilk(callback) = #instance then
1491          call(#mHideTableEvent, [callback], tabname)
1492          call(#mRemoveTableFromScreen, [callback], tabname)
1493        end if
1494       
1495      end if
1496     
1497    end if
1498   
1499  end if
1500 
1501 
1502  if not voidP(pTableList.getaprop(tabname)) then
1503   
1504    --    if theTable[#deletionMark] = 1 then
1505    --      -- this is just a flag, as sometimes the end event of one table leads to create a new one instead with the same name
1506    --      -- that would mean, that we now deleted the newly created table
1507    --      pTableList.deleteprop(tabname)
1508    --    end if
1509    --   
1510    --    exit
1511   
1512   
1513    if theTable[#deletionMark] = 1 then
1514      pTableList.setaprop(tabname, [:]) -- don't remove it from within this event, it may be invoked by a chain of the same handler and may break a repeat loop
1515      -- (although I don't believe there are scenarios where this could happen, but one never knows...)
1516      -- instead put the removal into a seperate, indepandant event
1517     
1518    end if
1519   
1520    dto = mCreateTimeout(me, pTextureBaseName&"_cleanup", 10, #mRemoveEmptyListEntries, me)
1521   
1522  end if
1523end
1524
1525-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1526-- this is on old handler which is left here for compatibility reasons for my own old movies
1527-- use mHideTable() instead
1528on mABoxVerschwinde me
1529  mHideTable me
1530end
1531
1532
1533
1534-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1535-- xxxxxxxxxxxxxxxxxx Public Handlers to change, control or get the table contents and properties
1536-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1537
1538-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1539
1540on mSuspendMouseEvents me, val, exception
1541 
1542  if pKanal <> 0 then
1543    if me.spritenum = exception then exit
1544  end if
1545 
1546 
1547  pSuspendMouseEvents = val
1548 
1549  repeat with n = pTableList.count down to 1
1550    scr = pTableList[n].getaprop(#myScriptObject)
1551    if objectP(scr) then call(#mPauseTable, scr, not(val))
1552  end repeat
1553end
1554
1555-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1556
1557on mSuspendMouseEvents2 me, val
1558 
1559  pSuspendMouseEvents = val
1560end
1561
1562-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1563-- val => integer can be 0 => disable table, 1 => enable table or 2 => disable only user interaction
1564
1565on mEnableTable me, val, tabname
1566  if count(pTableList) < 1 then exit
1567 
1568  if not voidP(tabname) then
1569    table = pTableList.getaprop(tabname)
1570  else
1571    table = pTableList[1]
1572  end if
1573  if ilk(table) <> #proplist then return 0
1574  scr = table.getaprop(#myScriptObject)
1575  if objectP(scr) then call(#mEnableTable, scr, val)
1576end
1577
1578-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1579
1580on mResetAutoHide me, tabname, senderTable
1581  if count(pTableList) < 1 then exit
1582 
1583  if not voidP(tabname) then
1584    table = pTableList.getaprop(tabname)
1585  else
1586    table = pTableList[1]
1587  end if
1588  if ilk(table) <> #proplist then return 0
1589  scr = table.getaprop(#myScriptObject)
1590  if objectP(scr) then
1591    if scr <> senderTable then
1592      retval = call(#mResetAutoHide, scr)
1593    end if
1594  end if
1595end
1596
1597-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1598
1599on mSetAutoHide me, autoHideValue, tabname
1600  -----------------------------------
1601  -- CREATED: 31.10.2008
1602  -- ACTION:  enable, disable or change the autohide value after the table was created
1603  --          takes an integer as parameter:
1604  --            * 0 or void means "disable autohide function"
1605  --            * negativ values mean "there is no timeout, but a click outside the table dismisses it"
1606  --            * other values are the time in milliseconds without interaction until the table is automatically dismissed
1607  -- INPUT: <autoHideValue> ; integer ; time in milliseconds ; 0 => disable ; optional, if void then 0 is assumed
1608  --        <tabname> ; string ; name of the table, which shall be addressed,
1609  --                              if empty, the first table in the list of tables is used
1610  -- RETURNS: -
1611  -- EXAMPLE: sendSprite(xscr().mGetKanal(#tableSprite), #mSetAutoHide, 3000, "myTable")
1612  -----------------------------------
1613 
1614  if count(pTableList) < 1 then exit
1615 
1616  if not voidP(tabname) then
1617    table = pTableList.getaprop(tabname)
1618  else
1619    table = pTableList[1]
1620  end if
1621  if ilk(table) <> #proplist then return 0
1622  scr = table.getaprop(#myScriptObject)
1623  if objectP(scr) then call(#mSetAutoHide, scr, autoHideValue)
1624end
1625
1626-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1627-- in 2-D mode we remove the dummy sprite from the stage
1628-- sometimes it is nice to be able to define the rect via the sprite rect
1629-- so here the original can be looked up
1630
1631on mGetOriginalSpriteRect me
1632  return pSavedRect
1633end
1634
1635-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1636-- set property pSeeThru to handle mouseOver events even, when another sprite is obscuring the table
1637-- the default is false, as the default should be to NOT receive the events if something other is over the table
1638
1639on mSetSeeThru me, val
1640  pSeeThru = (val=1)
1641end
1642
1643-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1644-- just get a reference to this scriptinstance, so we can communicate
1645-- implemented for script "ILT_TableBuilder"
1646
1647on mGetTableManagerObject me
1648  return me
1649end
1650
1651-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1652
1653on mGetScriptObject me, tabname
1654  if count(pTableList) < 1 then return ""
1655 
1656  if not voidP(tabname) then
1657    table = pTableList.getaprop(tabname)
1658  else
1659    table = pTableList[1]
1660  end if
1661  if ilk(table) <> #proplist then return ""
1662  return table.getaprop(#myScriptObject)
1663 
1664end
1665
1666-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1667-- replace a whole cell instead of the content only => we need this to exchange objectcells
1668
1669-- this handler does not yet work.
1670-- I've left it here for later review...
1671-- meanwhile I prefer to mDeleteRow and mInsertRow in order to replace whole cells
1672
1673--on mReplaceEntireCell me, whichCell, newCell, keepOldCell, tabname
1674
1675--  if count(pTableList) < 1 then exit
1676-- 
1677--  if not voidP(tabname) then
1678--    table = pTableList.getaprop(tabname)
1679--  else
1680--    table = pTableList[1]
1681--  end if
1682--  if ilk(table) <> #proplist then return 0
1683-- 
1684--  scr = table.getaprop(#myScriptObject)
1685--  if objectP(scr) then return call(#mReplaceEntireCell, scr, whichCell, newCell, keepOldCell)
1686--  else return 0
1687-- 
1688--end
1689
1690-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1691
1692on mSetCellContent me, row, column, newVal, relativ, recalc, tabname
1693  -----------------------------------
1694  -- ACTION: Replace the content of a single cell
1695  -- INPUT: <row> ; integer or object ; can be either the row number (see comments for <relativ>)
1696  --                                    or a cell object itself
1697  --                                    or a linear list of two integers => [row, column]
1698  --                                    or a string => name of the cell
1699  --        <column> ; integer ; integer for the column number, only if <row> is an integer, otherwise ignored.
1700  --        <newVal> ; <any> ; the new content of the cell. if the cell is a buttoncell it may have different images
1701  --                           for different states, rollover etc. In that case provide a list of images like in the below example
1702  --        <relativ> ; boolean (integer) ; defines if <row> and <column> are treated:
1703  --                                          a) absolut (all rows, no sortorder) or
1704  --                                          b.) relativ (visible rows, defined by filter in the current sort order)
1705  --                                     however, if you have a reference to the cell you wish to change you can pass 0 or void as <relativ>
1706  --                                     and take the values from the cell reference:
1707  --                                     sendSprite(x, #mSetCellContent, cellref.row, cellref.column, "newVal" {, 0, "tabname"})
1708  --        <recalc> ; boolean (integer) ; whether the column widths shall be re calculated to match the new content (in case of an image e.g.)
1709  --                                       defaults to false, as it is time consumptive. It only makes sense, if you replace an image cell
1710  --                                            and have the image cell properties set to adjust the column width
1711  --        <tabname> ; string ; name of the table, which shall be addressed,
1712  --                              if empty, the first table in the list of tables is used
1713  -- RETURNS: returns 1 for success and 0 for failure
1714  -- EXAMPLES: success = sendSprite(xscr().mGetKanal(#tableSprite), #mSetCellContent, 2, 3, "new content", 0, 0, "myTable")
1715  --                         -- set the content of cell 3 in row 2 to "new content"
1716  --           success = sendSprite(xscr().mGetKanal(#tableSprite), #mSetCellContent, [2,3], void, "new content", 0, 0, "myTable")
1717  --                         -- the same as above
1718  --           success = sendSprite(xscr().mGetKanal(#tableSprite), #mSetCellContent, cellReference, void, "new content", 0, 0, "myTable")
1719  --                         -- set the content of cell <cellReference> to "new content"
1720  --
1721  --           butList = mGetDefaultButtonList("Layout")
1722  --           buttonImgs = call(#mGetButtonImages, xscr(#ButtonImageCreator), "new content", butList)
1723  --           success = sendSprite(xscr().mGetKanal(#tableSprite), #mSetCellContent, cellReference, void, buttonImgs, 0, 0, "myTable")
1724  --                         -- set the content of the button cell <cellReference> to "new content"
1725 
1726  -----------------------------------
1727 
1728  if count(pTableList) < 1 then exit
1729 
1730  if not voidP(tabname) then
1731    table = pTableList.getaprop(tabname)
1732  else
1733    table = pTableList[1]
1734  end if
1735  if ilk(table) <> #proplist then return 0
1736 
1737  scr = table.getaprop(#myScriptObject)
1738  if objectP(scr) then return call(#mSetCellContent, scr, row, column, newVal, relativ, recalc)
1739  else return 0
1740end
1741
1742
1743-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1744
1745on mGetCellContent me, row, column, tabname
1746  if count(pTableList) < 1 then return ""
1747 
1748  if not voidP(tabname) then
1749    table = pTableList.getaprop(tabname)
1750  else
1751    table = pTableList[1]
1752  end if
1753  if ilk(table) <> #proplist then return ""
1754  scr = table.getaprop(#myScriptObject)
1755  if objectP(scr) then retval = call(#mGetCellContent, scr, row, column)
1756 
1757  if voidP(retval) then retval = ""
1758  return retval
1759end
1760
1761
1762-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1763
1764on mGetCellByName me, aName, tabname
1765  if count(pTableList) < 1 then return []
1766 
1767  if not voidP(tabname) then
1768    table = pTableList.getaprop(tabname)
1769  else
1770    table = pTableList[1]
1771  end if
1772  if ilk(table) <> #proplist then return []
1773  scr = table.getaprop(#myScriptObject)
1774  if objectP(scr) then retval = call(#mGetCellByName, scr, aName)
1775 
1776  if voidP(retval) then retval = []
1777  return retval
1778end
1779
1780
1781-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1782
1783on mGetCurrentSelection me, tabname
1784  if count(pTableList) < 1 then return []
1785 
1786  if not voidP(tabname) then
1787    table = pTableList.getaprop(tabname)
1788  else
1789    table = pTableList[1]
1790  end if
1791  if ilk(table) <> #proplist then return []
1792  scr = table.getaprop(#myScriptObject)
1793  if objectP(scr) then retval = call(#mGetCurrentSelection, scr)
1794 
1795  if voidP(retval) then retval = []
1796  return retval
1797end
1798
1799-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1800
1801on mAXTable_GetCurrentRadioGroupSelection me, groupname, tabname
1802  if count(pTableList) < 1 then return [:]
1803 
1804  if not voidP(tabname) then
1805    table = pTableList.getaprop(tabname)
1806  else
1807    table = pTableList[1]
1808  end if
1809  if ilk(table) <> #proplist then return [:]
1810  scr = table.getaprop(#myScriptObject)
1811  if objectP(scr) then retval = call(#mGetCurrentRadioGroupSelection, scr, groupname)
1812 
1813  if voidP(retval) then retval = [:]
1814  return retval
1815end
1816
1817-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1818
1819on mAXTable_RefreshItem me, cellObject, refreshBackGround, tabname
1820    -----------------------------------
1821  -- ACTION: Render a single cell
1822  --         render only one single cell, after changing its properties (e.g. #selected) NOT the #content property !!!
1823  --         ALWAYS change the content of a cell ONLY with the handler: mSetCellContent()
1824  --            to take a change of lineheight into consideration
1825  --         of course, if you change the content of a cell and don't want the dimension of the cell to change
1826  --            you can go with this function, much faster..
1827  -- INPUT: <cellObject> ; object ; can be:
1828  --                                    a cell object itself
1829  --                                    or a linear list of two integers => [row, column]
1830  --                                    or a string => name of the cell
1831  --        <refreshBackGround> ; boolean (integer) ; whether to referesh the background as well
1832  --                                                  (only relevant for cells with a transparent background e.g. an image for the whole table)
1833  --        <tabname> ; string ; name of the table, which shall be addressed,
1834  --                              if empty, the first table in the list of tables is used
1835  -- RETURNS: -
1836  -- EXAMPLES: sendSprite(xscr().mGetKanal(#tableSprite), #mAXTable_RefreshItem, cellRef, 0, "myTable")
1837  --                         -- refresh cell 3 in row 2
1838  --           sendSprite(xscr().mGetKanal(#tableSprite), #mAXTable_RefreshItem, [2, 3], 0, "myTable")
1839  --                         -- the same as above
1840  --           sendSprite(xscr().mGetKanal(#tableSprite), #mAXTable_RefreshItem, "cellName", 0, "myTable")
1841  --                         -- the same as above
1842  -----------------------------------
1843 
1844  if count(pTableList) < 1 then exit
1845 
1846  if not voidP(tabname) then
1847    table = pTableList.getaprop(tabname)
1848  else
1849    table = pTableList[1]
1850  end if
1851  if ilk(table) <> #proplist then exit
1852  scr = table.getaprop(#myScriptObject)
1853 
1854  if objectP(scr) then
1855    if ilk(cellObject) = #string then
1856      cellObject = mGetCellByName(me, cellObject, tabname)
1857    else
1858      if ilk(cellObject) = #list then cellObject = mGetCellByIndex(me, cellObject, tabname)
1859    end if
1860 
1861    if objectP(cellObject) then call(#mRefreshItem, scr, cellObject, refreshBackGround)
1862  end if
1863end
1864
1865-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1866
1867on mSetCellProperty me, cellObject, symbol_propname, any_propvalue, tabname
1868  -----------------------------------
1869  -- ACTION: Change a property (e.g. #myFontColor) NOT the #content of a single cell and render that single cell
1870  --         ALWAYS change the content of a cell ONLY with the handler: mSetCellContent()
1871  --            to take a change of lineheight into consideration
1872  --         of course, if you change the content of a cell and don't want the dimension of the cell to change
1873  --            you can go with this function, much faster..
1874  --         If you use mSetCellContent, you can change any other cell property before that call,
1875  --            as it will re-render the whole cell anyway
1876  -- INPUT: <cellObject> ; object ; can be:
1877  --                                    a cell object itself
1878  --                                    or a linear list of two integers => [row, column]
1879  --                                    or a string => name of the cell
1880  --        <symbol_propname> ; symbol ; one of several cell properties EXCEPT #content
1881  --        <any_propvalue> ; new value for the above property
1882  --        <tabname> ; string ; name of the table, which shall be addressed,
1883  --                              if empty, the first table in the list of tables is used
1884  -- RETURNS: -
1885  -- EXAMPLES: sendSprite(xscr().mGetKanal(#tableSprite), #mSetCellProperty, cellRef, #myBGColor, rgb(200, 200, 220), "myTable")
1886  --                         -- refresh cell 3 in row 2
1887  --           sendSprite(xscr().mGetKanal(#tableSprite), #mSetCellProperty, [2, 3], #myBGColor, rgb(200, 200, 220), "myTable")
1888  --                         -- the same as above
1889  --           sendSprite(xscr().mGetKanal(#tableSprite), #mSetCellProperty, "cellName", #myBGColor, rgb(200, 200, 220), "myTable")
1890  --                         -- the same as above
1891  -----------------------------------
1892
1893
1894  if ilk(cellObject) = #string then
1895    cellObject = mGetCellByName(me, cellObject, tabname)
1896  else
1897    if ilk(cellObject) = #list then cellObject = mGetCellByIndex(me, cellObject, tabname)
1898  end if
1899
1900  if objectP(cellObject) then
1901    cellObject[symbol_propname] = any_propvalue
1902    mAXTable_RefreshItem(me, cellObject, 1, tabname)
1903  end if
1904end
1905
1906-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1907
1908on mSetCellProperties me, cellObject, proplist_newProps, tabname
1909  -----------------------------------
1910  -- ACTION: Bulk change several properties (e.g. #myFontColor, NOT the #content or font properties, size and font and antialias)
1911  --            of a single cell and render that single cell
1912  --         ALWAYS change the content of a cell ONLY with the handler: mSetCellContent()
1913  --            to take a change of lineheight into consideration
1914  --         of course, if you change the content of a cell and don't want the dimension of the cell to change
1915  --            you can go with this function, much faster..
1916  --         If you use mSetCellContent, you can change any other cell property before that call,
1917  --            as it will re-render the whole cell anyway
1918  -- INPUT: <cellObject> ; object ; can be:
1919  --                                    a cell object itself
1920  --                                    or a linear list of two integers => [row, column]
1921  --                                    or a string => name of the cell
1922  --        <proplist_newProps> ; proplist ; property list with new values for the specified properties
1923  --        <tabname> ; string ; name of the table, which shall be addressed,
1924  --                              if empty, the first table in the list of tables is used
1925  -- RETURNS: -
1926  -- EXAMPLES: sendSprite(xscr().mGetKanal(#tableSprite), #mSetCellProperties, cellRef, [#myBGColor: rgb(200, 200, 220), #myFontColor: rgb(20, 30, 40)], "myTable")
1927  --                         -- refresh cell 3 in row 2
1928  --           sendSprite(xscr().mGetKanal(#tableSprite), #mSetCellProperties, [2, 3], [#myBGColor: rgb(200, 200, 220), #myFontColor: rgb(20, 30, 40)], "myTable")
1929  --                         -- the same as above
1930  --           sendSprite(xscr().mGetKanal(#tableSprite), #mSetCellProperties, "cellName", [#myBGColor: rgb(200, 200, 220), #myFontColor: rgb(20, 30, 40)], "myTable")
1931  --                         -- the same as above
1932  -----------------------------------
1933 
1934  if not(objectP(proplist_newProps)) then exit
1935 
1936  if ilk(cellObject) = #string then
1937    cellObject = mGetCellByName(me, cellObject, tabname)
1938  else
1939    if ilk(cellObject) = #list then cellObject = mGetCellByIndex(me, cellObject, tabname)
1940  end if
1941
1942  if objectP(cellObject) then
1943    repeat with n = count(proplist_newProps) down to 1
1944      cellObject[proplist_newProps.getPropAt(n)] = proplist_newProps[n]
1945    end repeat
1946   
1947    mAXTable_RefreshItem(me, cellObject, 1, tabname)
1948  end if
1949end
1950
1951-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1952
1953on mGetLineByIndex me, lineNum, tabname
1954  if count(pTableList) < 1 then return []
1955 
1956  if not voidP(tabname) then
1957    table = pTableList.getaprop(tabname)
1958  else
1959    table = pTableList[1]
1960  end if
1961  if ilk(table) <> #proplist then return []
1962  scr = table.getaprop(#myScriptObject)
1963  if objectP(scr) then retval = call(#mGetLineByIndex, scr, lineNum)
1964 
1965  if voidP(retval) then retval = []
1966  return retval
1967end
1968
1969-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1970
1971on mSetSelection me, newSelection, tabname
1972  if count(pTableList) < 1 then exit
1973 
1974  if not voidP(tabname) then
1975    table = pTableList.getaprop(tabname)
1976  else
1977    table = pTableList[1]
1978  end if
1979  if ilk(table) <> #proplist then return 0
1980  scr = table.getaprop(#myScriptObject)
1981  if objectP(scr) then call(#mSetSelection, scr, newSelection)
1982end
1983
1984-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1985
1986on mDeSelectSingleCell me, whichCell, tabname
1987  if count(pTableList) < 1 then exit
1988 
1989  if not voidP(tabname) then
1990    table = pTableList.getaprop(tabname)
1991  else
1992    table = pTableList[1]
1993  end if
1994  if ilk(table) <> #proplist then return 0
1995  scr = table.getaprop(#myScriptObject)
1996  if objectP(scr) then call(#mDeSelectSingleCell, scr, whichCell)
1997end
1998
1999-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2000
2001-- changed the valuerange for scrollToTop in 'mSelectCell me, whichCell, sendEvent, scrollToTop'
2002-- values are: 0 = dont scroll, 1 = scroll only vertical to top or bottom, 2 = scroll only horizontal to left or right, 3 = scroll vertical AND horizontal to top or bottom and left opr right
2003-- 4 = scroll only vertical to centerV, 5 = scroll only horizontal to centerH, 6 = scroll vertical AND horizontal to center
2004
2005-- <whichModifier> to mimic shift select. can be: #commandselect or #shiftselect or <void> (any other value)
2006-- (note that multiple selection must be enabled, which can be enabled temporarely also -> mGetScriptObject(me).pTableformatlist.setaprop(#multipleSelection, <1 or 2>))
2007
2008on mSelectCell me, whichCell, scrollToTop, tabname, whichModifier
2009  if count(pTableList) < 1 then exit
2010 
2011  if not voidP(tabname) then
2012    table = pTableList.getaprop(tabname)
2013  else
2014    table = pTableList[1]
2015  end if
2016  if ilk(table) <> #proplist then return 0
2017  scr = table.getaprop(#myScriptObject)
2018  if objectP(scr) then call(#mSelectCell, scr, whichCell, 0, scrollToTop, whichModifier)
2019end
2020
2021-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2022
2023on mHighLightCell me, whichCell, tabname
2024  if count(pTableList) < 1 then exit
2025 
2026  if not voidP(tabname) then
2027    table = pTableList.getaprop(tabname)
2028  else
2029    table = pTableList[1]
2030  end if
2031  if ilk(table) <> #proplist then return 0
2032  scr = table.getaprop(#myScriptObject)
2033  if objectP(scr) then call(#mHighLightCell, scr, whichCell) 
2034end
2035
2036-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2037
2038on mEnableCell me, whichCell, enabledState, tabname
2039  if count(pTableList) < 1 then exit
2040 
2041  if not voidP(tabname) then
2042    table = pTableList.getaprop(tabname)
2043  else
2044    table = pTableList[1]
2045  end if
2046  if ilk(table) <> #proplist then return 0
2047  scr = table.getaprop(#myScriptObject)
2048  if objectP(scr) then call(#mEnableCell, scr, whichCell, enabledState)
2049end
2050
2051-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2052
2053on mGetCellByIndex me, indexList, tabname
2054  if count(pTableList) < 1 then return [:]
2055 
2056  if not voidP(tabname) then
2057    table = pTableList.getaprop(tabname)
2058  else
2059    table = pTableList[1]
2060  end if
2061  if ilk(table) <> #proplist then return [:]
2062  scr = table.getaprop(#myScriptObject)
2063  if objectP(scr) then return call(#mGetCellByIndex, scr, indexList)
2064  else return [:]
2065end
2066
2067-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2068
2069on mGetCurrentPrintListe me, tabname
2070  if count(pTableList) < 1 then return []
2071 
2072 
2073  if not voidP(tabname) then
2074    table = pTableList.getaprop(tabname)
2075  else
2076    table = pTableList[1]
2077  end if
2078  if ilk(table) <> #proplist then return []
2079  scr = table.getaprop(#myScriptObject)
2080  if objectP(scr) then retval = call(#mGetCurrentPrintListe, scr)
2081 
2082  if voidP(retval) then retval = []
2083  return retval
2084end
2085
2086
2087-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2088
2089on mGetCurrentRect me, tabname, withoutShadow
2090  if count(pTableList) < 1 then return 0
2091 
2092  if not voidP(tabname) then
2093    table = pTableList.getaprop(tabname)
2094  else
2095    table = pTableList[1]
2096  end if
2097  if ilk(table) <> #proplist then return 0
2098  scr = table.getaprop(#myScriptObject)
2099  if objectP(scr) then retval = call(#mGetCurrentRect, scr, withoutShadow)
2100 
2101  if voidP(retval) then retval = 0
2102  return retval
2103end
2104
2105
2106-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2107
2108on mGetCurrentTargRect me, tabname
2109  if count(pTableList) < 1 then return 0
2110 
2111  if not voidP(tabname) then
2112    table = pTableList.getaprop(tabname)
2113  else
2114    table = pTableList[1]
2115  end if
2116  if ilk(table) <> #proplist then return 0
2117  scr = table.getaprop(#myScriptObject)
2118  if objectP(scr) then retval = call(#mGetCurrentTargRect, scr)
2119 
2120  if voidP(retval) then retval = 0
2121  return retval
2122end
2123
2124
2125-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2126
2127on mSetCurrentRect me, newRect, tabname, relativ, forceUpdate, useInnerRect
2128  if count(pTableList) < 1 then return 1
2129 
2130  if not voidP(tabname) then
2131    table = pTableList.getaprop(tabname)
2132  else
2133    table = pTableList[1]
2134  end if
2135  if ilk(table) <> #proplist then return 0
2136 
2137  scr = table.getaprop(#myScriptObject)
2138  if objectP(scr) then call(#mSetCurrentRect, scr, newRect, useInnerRect, relativ, forceUpdate)
2139 
2140  return 1
2141 
2142end
2143
2144-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2145
2146on mGetOverallTableRect me, tabname
2147  -----------------------------------
2148  -- CREATED: 16.10.2008
2149  -- ACTION:  get the overall rect of the table including the parts, which are not visible
2150  -- INPUT:   <tabname> ; string ; name of the table, which shall be addressed,
2151  --                              if empty, the first table in the list of tables is used
2152  -- RETURNS: rect ; if tableFormatList[#noBuffer] = 0 then this is the rect of the image of the whole table
2153  --                 if tableFormatList[#noBuffer] = 1 there is not a big image holding the entire table
2154  --                   (-> which is recommende to save memory), so this is the rect, which WOULD be the entire image
2155  -- EXAMPLE: overallTableRect = sendSprite(xscr().mGetKanal(#tableSprite), #mGetOverallTableRect, "myTable")
2156  -----------------------------------
2157 
2158  if count(pTableList) < 1 then return 0
2159 
2160  if not voidP(tabname) then
2161    table = pTableList.getaprop(tabname)
2162  else
2163    table = pTableList[1]
2164  end if
2165  if ilk(table) <> #proplist then return 0
2166  scr = table.getaprop(#myScriptObject)
2167  if objectP(scr) then retval = call(#mGetOverallTableRect, scr)
2168 
2169  if voidP(retval) then retval = 0
2170  return retval
2171end
2172
2173-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2174
2175on mMoveAllTables me, delta
2176  repeat with n = count(pTableList) down to 1
2177    mMoveTable me, delta, pTableList.getPropAt(n)
2178  end repeat
2179end
2180
2181
2182-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2183
2184on mMoveTable me, delta, tabname
2185  if count(pTableList) < 1 then return 1
2186  if ilk(delta) <> #point then return 1
2187 
2188  if not voidP(tabname) then
2189    table = pTableList.getaprop(tabname)
2190  else
2191    table = pTableList[1]
2192  end if
2193  if ilk(table) <> #proplist then return 0
2194 
2195  if pDreiDModus then
2196    moname = string(table.getaprop(#useModel))
2197    if moname.length then
2198      mo = pMember.model(moname)
2199      if ilk(mo) = #model then
2200        shd = mo.shaderlist[1]
2201        shd.texturetransformlist[2].position = shd.texturetransformlist[2].position + vector(delta[1] / 10, delta[2] / 10, 0)
2202      end if
2203    else
2204     
2205      camObj = table.getaprop(#myCamera)
2206      if voidP(camObj) then camObj = pKanal.camera
2207     
2208      tex = pMember.texture(pTextureBaseName&"_"&table.getaprop(#myName))
2209      olayIndex = mGetOlayIndex(me, camObj, tex)
2210      if olayIndex > 0 then
2211        theRect = table.getaprop(#myRect)
2212        if (ilk(theRect) = #rect) then
2213          theRect = theRect.offset(delta[1], delta[2])
2214          table[#myRect] = theRect
2215          camObj.overlay[olayIndex].loc = point(theRect.left, theRect.top)
2216        else
2217          camObj.overlay[olayIndex].loc = camObj.overlay[olayIndex].loc + delta
2218        end if
2219      end if
2220     
2221    end if
2222   
2223  else
2224    if pKanal <> 0 then
2225      pKanal.loc = pKanal.loc + delta
2226    else
2227      if ilk(pMember) = #instance then call(#mMoveTable, [pMember], delta, tabname)
2228    end if
2229  end if
2230 
2231  doMoveChildObjectsAsWell = 1
2232  forceRectUpdate = 0
2233 
2234  scr = table.getaprop(#myScriptObject)
2235  if objectP(scr) then call(#mMoveTable, scr, delta, forceRectUpdate, doMoveChildObjectsAsWell)
2236  else return 0
2237 
2238  return 1 -- this is only, if the caller needs to know, if the move command was handled
2239end
2240
2241-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2242
2243on mReverse me, sortOrder, tabname
2244  if count(pTableList) < 1 then exit
2245 
2246  if not voidP(tabname) then
2247    table = pTableList.getaprop(tabname)
2248  else
2249    table = pTableList[1]
2250  end if
2251  if ilk(table) <> #proplist then return 0
2252  scr = table.getaprop(#myScriptObject)
2253  if objectP(scr) then call(#mReverse, scr, sortOrder)
2254end
2255
2256-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2257
2258on mChangeSortBy me, column, sortorder, tabname
2259  if count(pTableList) < 1 then exit
2260 
2261  if not voidP(tabname) then
2262    table = pTableList.getaprop(tabname)
2263  else
2264    table = pTableList[1]
2265  end if
2266  if ilk(table) <> #proplist then return 0
2267  scr = table.getaprop(#myScriptObject)
2268  if objectP(scr) then call(#mChangeSortBy, scr, column, sortorder)
2269end
2270
2271-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2272
2273on mFilterColumn me, filterListe, tabname
2274  if count(pTableList) < 1 then exit
2275 
2276  if not voidP(tabname) then
2277    table = pTableList.getaprop(tabname)
2278  else
2279    table = pTableList[1]
2280  end if
2281  if ilk(table) <> #proplist then return 0
2282  scr = table.getaprop(#myScriptObject)
2283  if objectP(scr) then call(#mFilterColumn, scr, filterListe)
2284end
2285
2286-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2287
2288on mChangeScrollOffset me, relVal, tabname
2289  if ilk(relVal) <> #point then exit
2290  if count(pTableList) < 1 then exit
2291 
2292  if not voidP(tabname) then
2293    table = pTableList.getaprop(tabname)
2294  else
2295    table = pTableList[1]
2296  end if
2297  if ilk(table) <> #proplist then return 0
2298  scr = table.getaprop(#myScriptObject)
2299  if objectP(scr) then call(#mChangeScrollOffset, scr, relVal)
2300end
2301
2302-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2303
2304on mSetScrollOffset me, absVal, tabname
2305  if ilk(absVal) <> #point then exit
2306  if count(pTableList) < 1 then exit
2307 
2308  if not voidP(tabname) then
2309    table = pTableList.getaprop(tabname)
2310  else
2311    table = pTableList[1]
2312  end if
2313  if ilk(table) <> #proplist then return 0
2314  scr = table.getaprop(#myScriptObject)
2315  if objectP(scr) then call(#mSetScrollOffset, scr, absVal)
2316end
2317
2318-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2319
2320on mAttemptToScroll me, relVal, doSendScrollEvent, tabname
2321  -----------------------------------
2322  -- CREATED: 2008-10-10 at 10:57
2323  -- ACTION: Try to scroll the table content by a relative scrollvalue
2324  -- INPUT:  <relVal> ; point (or integer) ; the relative values for horizontal and vertical scrollchange in pixels
2325  --                                         if an integer is used instead of a point only vertical scrolling happens
2326  --         <doSendScrollEvent> ; boolean (integer) ; whether the action shall trigger scrollvenets to the listeners
2327  --                                                   (an object can receive events, whenever the scrolloffset changed
2328  --                                                    in order to react on scroll events => e.g. enable/disable buttons)
2329  --         <tabname> ; string ; name of the table, which shall be addressed,
2330  --                              if empty, the first table in the list of tables is used
2331  -- RETURNS: point => the scroll change, which effectively took place, if it is point(0,0) no scroll change happened
2332  --                                if one of the values is smaller, than the value which was provided, then
2333  --                                the scroll-end in the given direction was reached
2334  -- EXAMPLE:  scrollChange = point(0, 10)
2335  --           RealScrollChange = sendSprite(xscr().mGetKanal(#tableSprite), #mAttemptToScroll, point(0, 10), 0, "myTable")
2336  --           if scrollChange[1] < 0 then disableHorizontal = (scrollChange[1] < RealScrollChange[1])
2337  --           else disableHorizontal = (scrollChange[1] > RealScrollChange[1])
2338  --          if scrollChange[2] < 0 then disableVertical = (scrollChange[2] < RealScrollChange[2])
2339  --           else disableVertical = (scrollChange[2] > RealScrollChange[2])
2340  -----------------------------------
2341 
2342  if count(pTableList) < 1 then return point(0,0)
2343 
2344  if not voidP(tabname) then
2345    table = pTableList.getaprop(tabname)
2346  else
2347    table = pTableList[1]
2348  end if
2349  if ilk(table) <> #proplist then return point(0,0)
2350  scr = table.getaprop(#myScriptObject)
2351  if objectP(scr) then return call(#mAttemptToScroll, scr, relVal, doSendScrollEvent)
2352end
2353
2354-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2355
2356on mGetCurrentScrollOffset me, tabname
2357  -----------------------------------
2358  -- CREATED: 2008-10-10 at 11:06
2359  -- ACTION: Get the current scrolloffset
2360  -- INPUT:  <tabname> ; string ; name of the table, which shall be addressed,
2361  --                              if empty, the first table in the list of tables is used
2362  -- RETURNS: point ; the current scrolloffset
2363  -- EXAMPLE: currentScrollOffset = sendSprite(xscr().mGetKanal(#tableSprite), #mGetCurrentScrollOffset, "myTable")
2364  -----------------------------------
2365 
2366  if count(pTableList) < 1 then return point(0,0)
2367 
2368  if not voidP(tabname) then
2369    table = pTableList.getaprop(tabname)
2370  else
2371    table = pTableList[1]
2372  end if
2373  if ilk(table) <> #proplist then return point(0,0)
2374  scr = table.getaprop(#myScriptObject)
2375  if objectP(scr) then return call(#mGetCurrentScrollOffset, scr)
2376end
2377
2378-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2379
2380on mGetCellUnderLoc me, theLoc, tabname
2381  -----------------------------------
2382  -- CREATED: 3.11.2009
2383  -- ACTION: Get the cell under loc
2384  -- INPUT:  <theLoc>  ; point  ; the loc at which we want to search the cell
2385  --         <tabname> ; string ; name of the table, which shall be addressed,
2386  --                              if empty, the first table in the list of tables is used
2387  -- RETURNS: proplist ; the cellref
2388  -- EXAMPLE: cellUnderLoc = sendSprite(xscr().mGetKanal(#tableSprite), #mGetCellUnderLoc, point(0, 100), "myTable")
2389  -----------------------------------
2390 
2391  if count(pTableList) < 1 then return [:]
2392 
2393  if not voidP(tabname) then
2394    table = pTableList.getaprop(tabname)
2395  else
2396    table = pTableList[1]
2397  end if
2398  if ilk(table) <> #proplist then return [:]
2399  scr = table.getaprop(#myScriptObject)
2400  if objectP(scr) then return call(#mGetCellUnderLoc, scr, theLoc)
2401  return [:]
2402end
2403
2404-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2405
2406on mGetLineNumberAtScrollTop me, absolute, tabname
2407  -----------------------------------
2408  -- CREATED: 3.11.2009
2409  -- ACTION: Get the line which is currently the first visible (at the scrolltop)
2410  -- INPUT:  <absolute> ; boolean (integer) ; if true the absolute linenumber is returned and NOT
2411  --                           the current relative line number (these both differ, if for example the sortorder
2412  --                           or a filter is applied), therefore relative is the default
2413  --         <tabname> ; string ; name of the table, which shall be addressed,
2414  --                              if empty, the first table in the list of tables is used
2415  -- RETURNS: integer ; linenumber
2416  -- EXAMPLE: topLineNumber = sendSprite(xscr().mGetKanal(#tableSprite), #mGetCellUnderLoc, point(0, 100), "myTable")
2417  -----------------------------------
2418 
2419  if count(pTableList) < 1 then return 1
2420 
2421  if not voidP(tabname) then
2422    table = pTableList.getaprop(tabname)
2423  else
2424    table = pTableList[1]
2425  end if
2426  if ilk(table) <> #proplist then return 1
2427  scr = table.getaprop(#myScriptObject)
2428 
2429  if objectP(scr) then
2430    scro = call(#mGetCurrentScrollOffset, scr)
2431    if ilk(scro) = #point then
2432      topCell = call(#mGetCellUnderLoc, scr, point(1, scro[2]))
2433      if objectP(topCell) then
2434        theRow = topCell[#row]
2435        if absolute = 1 then
2436          return theRow
2437        else
2438          lineList = call(#mGetCurrentLinesList, scr)
2439          return lineList.getPos(theRow)
2440        end if
2441      end if
2442    end if
2443  end if
2444 
2445  return 1
2446end
2447
2448-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2449
2450on mScrollToLine me, whichLineNumber, tabname
2451  -----------------------------------
2452  -- CREATED: 03.11.2009
2453  -- ACTION: Get the line which is currently the first visible (at the scrolltop)
2454  -- INPUT:  <whichLineNumber> ; integer line which shall appear at scrolltop
2455  --         <tabname> ; string ; name of the table, which shall be addressed,
2456  --                              if empty, the first table in the list of tables is used
2457  -- RETURNS: -
2458  -- EXAMPLE: sendSprite(xscr().mGetKanal(#tableSprite), #mScrollToLine, 4, "myTable")
2459  -----------------------------------
2460 
2461  if count(pTableList) < 1 then return 1
2462 
2463  if not voidP(tabname) then
2464    table = pTableList.getaprop(tabname)
2465  else
2466    table = pTableList[1]
2467  end if
2468  if ilk(table) <> #proplist then return 1
2469  scr = table.getaprop(#myScriptObject)
2470 
2471  if objectP(scr) then
2472    theLine = call(#mGetLineByIndex, scr, whichLineNumber)
2473   
2474    cnt = count(theLine)
2475    repeat with n = 1 to cnt
2476      rs = theLine[n][#rowspan]
2477      if voidP(rs) or rs = 1 then
2478        exit repeat
2479      end if
2480    end repeat
2481    n = min(cnt, n)
2482    theRect = theLine[n][#myRect]
2483   
2484    curr = call(#mGetCurrentScrollOffset, scr)
2485    call(#mSetScrollOffset, scr, point(curr[1], theRect.top))
2486   
2487  end if
2488 
2489end
2490
2491-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2492
2493on mScrollByLine me, howManyLines, tabname
2494  -----------------------------------
2495  -- CREATED: 03.11.2009
2496  -- ACTION: Get the line which is currently the first visible (at the scrolltop)
2497  -- INPUT:  <howManyLines> ; integer ; can be positive or negative
2498  --         <tabname> ; string ; name of the table, which shall be addressed,
2499  --                              if empty, the first table in the list of tables is used
2500  -- RETURNS: -
2501  -- EXAMPLE: sendSprite(xscr().mGetKanal(#tableSprite), #mScrollByLine, 3, "myTable")
2502  -----------------------------------
2503 
2504  toplineNum = mGetLineNumberAtScrollTop(me, 1, tabname)
2505  mScrollToLine me, toplineNum + howManyLines, tabname
2506 
2507end
2508
2509-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2510
2511on mGetOverallScrollDistance me, tabname
2512  -----------------------------------
2513  -- CREATED: 16.10.2008
2514  -- ACTION:  get the distance in pixels, which is hidden and can be scrolled
2515  --          this is the difference between the width/height of the entire table
2516  --          and the width/height of the visible area
2517  -- INPUT:   <tabname> ; string ; name of the table, which shall be addressed,
2518  --                              if empty, the first table in the list of tables is used
2519  -- RETURNS: point ; scrolldistance horizontal and scrolldistance vertical
2520  -- EXAMPLE: overallScrollDistance = sendSprite(xscr().mGetKanal(#tableSprite), #mGetOverallScrollDistance, "myTable")
2521  -----------------------------------
2522 
2523  if count(pTableList) < 1 then return point(0,0)
2524 
2525  if not voidP(tabname) then
2526    table = pTableList.getaprop(tabname)
2527  else
2528    table = pTableList[1]
2529  end if
2530  if ilk(table) <> #proplist then return point(0,0)
2531  scr = table.getaprop(#myScriptObject)
2532  if objectP(scr) then return call(#mGetOverallScrollDistance, scr)
2533end
2534
2535-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2536-- tab delimted text of current view:
2537
2538on mGetCurrentViewList me, tabname
2539  if count(pTableList) < 1 then exit
2540 
2541  if not voidP(tabname) then
2542    table = pTableList.getaprop(tabname)
2543  else
2544    table = pTableList[1]
2545  end if
2546  if ilk(table) <> #proplist then return 0
2547  scr = table.getaprop(#myScriptObject)
2548  if objectP(scr) then return call(#mGetCurrentViewList, scr)
2549  else return [:]
2550end
2551
2552-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2553
2554on mInsertRow me, newValueList, posIndex, tabname
2555  if count(pTableList) < 1 then return 0
2556 
2557  if not voidP(tabname) then
2558    table = pTableList.getaprop(tabname)
2559  else
2560    table = pTableList[1]
2561  end if
2562  if ilk(table) <> #proplist then return 0
2563 
2564  --  if ilk(table.getaprop(#myRect)) <> #rect then return 0
2565  if table.getaprop(#readyToGo) <> 1 then return 0
2566 
2567 
2568  scr = table.getaprop(#myScriptObject)
2569  if objectP(scr) then call(#mInsertRow, scr, newValueList, posIndex)
2570  else return 0
2571 
2572  return 1
2573end
2574
2575-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2576
2577on mDeleteRow me, posIndex, toPos, relativ, tabname
2578  if count(pTableList) < 1 then exit
2579 
2580  if not voidP(tabname) then
2581    table = pTableList.getaprop(tabname)
2582  else
2583    table = pTableList[1]
2584  end if
2585  if ilk(table) <> #proplist then return 0
2586  scr = table.getaprop(#myScriptObject)
2587  if objectP(scr) then call(#mDeleteRow, scr, posIndex, toPos, relativ)
2588end
2589
2590-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2591
2592on mInsertCol me, posIndex, colList, newValueList, tabname
2593  if count(pTableList) < 1 then return 0
2594 
2595  if not voidP(tabname) then
2596    table = pTableList.getaprop(tabname)
2597  else
2598    table = pTableList[1]
2599  end if
2600  if ilk(table) <> #proplist then return 0
2601 
2602  --  if ilk(table.getaprop(#myRect)) <> #rect then return 0