home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / dragsprite / DragS_Info < prev    next >
Encoding:
Text File  |  1992-10-08  |  3.2 KB  |  106 lines

  1. Information about DragASprite gleaned from disassembling it!
  2.  
  3. Can now drag an icon about the desktop rather than the dash lines. 
  4. This is determined by bit 1 of byte 28 in the CMOS RAM.  The direct
  5. method is to use the following SWI's:
  6.  
  7. .DragASprite_Start      &42400
  8. ;
  9. ; In    R0 = flags
  10. ;               &03     x alignment of sprite in icon bbox:
  11. ;                       00 => left
  12. ;                       01 => middle
  13. ;                       10 => right
  14. ;                       11 => right (not faulted)
  15. ;               &0C     y alignment of sprite in icon bbox (values as x alignment)
  16. ;               &30     parent drag bbox set from:
  17. ;                       00 => screen
  18. ;                       01 => window under pointer
  19. ;                       10 => R4 points to user
  20. ;                       11 => illegal (faulted)
  21. ;               &40     0 => normal parent drag bbox
  22. ;                       1 => center parent drag bbox around pointer!
  23. ;               &80     1 => add an 8 OS unit shadow to the sprite
  24. ;                       0 => no shadow
  25. ;       R1 = pointer to sprite area (zero if system)
  26. ;       R2 = pointer to sprite (name only, not pointer)
  27. ;       R3 = pointer to icon bbox (sprite placed "in" this)
  28. ;       R4 = pointer to drag bbox (if flags in R0)
  29. ; Out   -
  30.  
  31. .DragASprite_Stop       &42401
  32. ; In    -
  33. ; Out   -
  34.  
  35. Here's how I've implemented it over the normal "drag" method
  36.  
  37.  
  38. : REM  Called when noticed a mouse click of a "drag" type over a valid
  39. : REM  icon, this will then cause "FN_Dragged_"+routine$ to be called
  40. : REM  when user stops the drag
  41. :
  42. DEF PROC_Initiate_Drag(window%, icon%, button%, routine$)
  43. LOCAL p%, q%, sx%, sy%
  44. LOCAL f%, area%, name%
  45.   p%  = FN_Claim_Stack(64)              :REM external
  46.   q% = FN_Claim_Stack(256)              :REM external
  47.   p%!0 = window%
  48.   p%!4 = icon%
  49.   SYS "Wimp_GetIconState",, p%
  50.   q%!0 = window%
  51.   SYS "Wimp_GetWindowState",, q%
  52.   sx%   = q%!20
  53.   sy%   = q%!24
  54.   p%!0  = window%
  55.   p%!4  = 5
  56.   p%!8  += q%!4  - sx%          :REM Min screen X
  57.   p%!12 += q%!16 - sy%          :REM Min screen Y
  58.   p%!16 += q%!4  - sx%          :REM Max X
  59.   p%!20 += q%!16 - sy%          :REM Max Y
  60.   IF DragASprite% THEN
  61.     SYS "OS_Byte", 161, 28 TO ,,f%
  62.     dragged_sprite% = ((f% AND 2) = 2)
  63.   ELSE
  64.     dragged_sprite% = FALSE
  65.   ENDIF
  66.   IF dragged_sprite% THEN
  67.     f% = p%!24
  68.     IF (f% AND 2)=0 THEN ERROR 1, "Not a sprite icon to Drag"
  69.     IF f% AND &80 THEN
  70.       name% = p%!28
  71.       area% = p%!32
  72.       IF f%!36 THEN ERROR 1, "Sprite icon name, not pointer to Drag"
  73.     ELSE
  74.       name% = p%+28
  75.       area% = 1                   :REM  Wimp pool
  76.     ENDIF
  77.     SYS "DragASprite_Start", %10000101, area%, name%, p%+8
  78.   ELSE
  79.     p%!24 = 0
  80.     p%!28 = 0
  81.     p%!32 = logmaxx%            :REM external
  82.     p%!36 = logmaxy%
  83.     SYS "Wimp_DragBox",, p%
  84.   ENDIF
  85.   PROC_Release_Stack(q%, 256)   :REM external
  86.   PROC_Release_Stack(p%, 64)    :REM external
  87.   dragged$ = routine$
  88.   dragged_button% = button%
  89. ENDPROC
  90. :
  91. DEF PROC_User_Drag_Box
  92. LOCAL x%
  93.   x% = FNeval("FN_Dragged_"+ dragged$)
  94.   IF dragged_button%<>(1*16) THEN
  95.     PROC_Close_All_Menus
  96.   ENDIF
  97.   IF dragged_sprite% THEN
  98.     SYS "DragASprite_Stop"
  99.   ELSE
  100.     SYS "Wimp_DragBox",, -1
  101.   ENDIF
  102.   dragged$ = ""
  103. ENDPROC
  104. :
  105.  
  106. by Cy Booker, 08.10.1992