Cocoa Animation class for API 2.0

Has anyone converted this class to API 2.0?

Cocoa Animation Class

I have tried, but there are these errors:

// Now we have all target objs in objs.Keys - we can create the array now and add the parameters
dim dictArray as Ptr = nsarray (NSClassFromString("NSMutableArray"))
for each o as Object in objs.Keys
  dim hdl as Ptr // was Integer, but API 2.0 Handle is Ptr
  if o isA DesktopWindow then
    hdl = DesktopWindow(o).Handle
  else
    hdl = DesktopUIControl(o).Handle
  end if
  dim dict as Ptr = init (alloc (NSClassFromString ("NSMutableDictionary")))
  setObjectIntegerForKeyString dict, hdl, "NSViewAnimationTargetKey"
  addObject dictArray, dict
....  

TTsCocoaAnimationPrivate.StartAnimation, line 103
Parameter "obj" expects type Integer, but this is type Ptr.
setObjectIntegerForKeyString dict, hdl, "NSViewAnimationTargetKey"

TTsCocoaAnimationPrivate.StartAnimation, line 124
Parameter "self_ptr" expects type Integer, but this is type Ptr.
dim startingFrame as NSRect = frame (hdl)

TTsCocoaAnimationPrivate.StartAnimation, line 124
Type mismatch error.  Expected structure TTsCocoaAnimationPrivate.NSRect, but got Int32
dim startingFrame as NSRect = frame (hdl)

You need to find the declare for this function and change the Integer to Ptr.

You would also have to ensure that “init”, “alloc” and “NSClassFromString” all return Ptr and that “alloc” and “Init” also take Ptr as a parameter.

Basically, anything that is an Object reference needs to be a Ptr rather than an Integer. Values however, need to stay as Integer.

Since the type of “hdl” has changed from Integer to Ptr, you also need to adjust the declares where you pass hdl - those arguments used Integer before and need to be changed to Ptr accordingly.

I.e. old:

declare sub setObjectIntegerForKeyString lib "Cocoa" selector "setObject:forKey:" (self_ptr as Ptr, obj as Integer, key as CFStringRef)
declare function frame lib "Cocoa" selector "frame" (self_ptr as Integer) as NSRect

new:

declare sub setObjectIntegerForKeyString lib "Cocoa" selector "setObject:forKey:" (self_ptr as Ptr, obj as Ptr, key as CFStringRef)
declare function frame lib "Cocoa" selector "frame" (self_ptr as Ptr) as NSRect