home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilsf / jfshared / Modules / NoCoverIco / Source`v1, < prev    next >
Encoding:
Text File  |  1995-10-01  |  8.3 KB  |  196 lines

  1. App   NoCoverIconBar
  2. In    -
  3. Out   NoCoverIB
  4. Type  Module
  5. Ver   1.04e
  6.  
  7. Define Module
  8.  Name    NoCoverIB
  9.  Author  Justin Fletcher
  10.  WimpSWIs
  11.   SWI    Wimp_OpenWindow
  12.   Pre    openwin
  13.  End WimpSWIs
  14.  Commands
  15.   Name   NoCoverIB
  16.   Help   ...
  17.          The NoCoverIB module forces the Wimp to obey the 'don't cover
  18.          iconbar' flag in CMOS RAM. If you wish to cover the iconbar,
  19.          then hold shift whilst performing any drags.|M|M
  20.          Note: The toggle has had to be simulated, and therefore it does
  21.          not work totally correctly. I cannot (legally) code around this
  22.          as I do not know the how to read previous size. Sorry about that.
  23.  End Commands
  24.  Workspace *160
  25. End Module
  26.  
  27. Pre
  28.  ibtop=128
  29.  # Cond Inline
  30.  # Cond ctrl Do you want Ctrl-Shift to cancel Shift action
  31. End Pre
  32.  
  33. #Rem Off
  34. ; Replaces Wimp_OpenWindow
  35. .openwin
  36.    STMFD   (sp)!,{r0-r5,link}            ; Stack registers
  37.    REM     "%c04Open window, number = %&1"
  38.    LDR     r3,[r12,#124]                 ; get flag
  39.    ADD     r3,r3,#1                      ; increment flag
  40.    STR     r3,[r12,#124]                 ; store back
  41.    CMP     r3,#1                         ; is it 0 ? (process)
  42.    BNE     $exit                         ; if not, exit
  43.    MOV     r5,r1                         ; r5=pointer to window block
  44.    XSWI    "OS_Byte",161,28              ; get CMOS byte
  45.    TST     r2,#&10                       ; is bit set ?
  46.    BEQ     $exit                         ; if not, exit
  47.    XSWI    "OS_Byte",121,0 EOR &80       ; get shift status
  48.    CMP     r1,#&FF                       ; is it pressed ?
  49. # Cond Of Ctrl
  50.    BNE     $notshift
  51.    XSWI    "OS_Byte",121,1 EOR &80       ; get ctrl status
  52.    CMP     r1,#&FF                       ; is it also pressed ?
  53.    BNE     $exit                         ; if not, exit
  54. # Cond Else
  55.    BEQ     $exit
  56. # Cond EndIf
  57. $notshift
  58.    REM     "Can process"
  59.  
  60.    LDR     r2,[r5,#28]                   ; get window behind
  61.    CMN     r2,#3                         ; is it iconised ?
  62.    BEQ     $exit                         ; if so, exit
  63.    MOV     r1,r12                        ; r1=pointer to WS, and set b0
  64.    LDR     r2,[r5]                       ; get window handle
  65.    STR     r2,[r1]                       ; store in block
  66.    ORR     r1,r1,#1                      ; set b0
  67.    SWI     "Wimp_GetWindowInfo"          ; get data, bar icons
  68.    REM     "Got info"
  69.    LDR     r0,[r12,#32]                  ; get flags
  70.    STR     r0,[r12,#120]                 ; store flags for later
  71.    TST     r0,#1<<29                     ; has it got adjust size ?
  72.    TSTNE   r0,#1<<28                     ; if so, has it got vertical scroll?
  73.    BEQ     $exit                         ; if not, exit
  74.  
  75.    TST     r0,#1<<16                     ; is it open ?
  76.    BNE     $notopen
  77.    MOV     r1,r5                         ; no, re-get pointer to block,
  78.    REM     "Call second routine"
  79.    SWI     "Wimp_OpenWindow"             ; … open it as specifed,
  80.    REM     "Exitted second"
  81. ;    BL      Display
  82.    LDR     r4,[r5,#32]                   ; … read old offset 32
  83.    SWI     "Wimp_GetWindowState"         ; … get new location,
  84.    STR     r4,[r5,#32]                   ; … restore old offset 32
  85. ;    BL      Display
  86.    ORR     r1,r12,#1                     ; … set b0 to return just header,
  87.    SWI     "Wimp_GetWindowInfo"          ; … and get the info again
  88. $notopen
  89.    ADD     r1,r12,#96                    ; add#96 as offset for outline blk
  90.    STR     r2,[r1]                       ; store window handle
  91.    SWI     "Wimp_GetWindowOutline"       ; get outline
  92.    LDR     r0,[r12,#8]                   ; get VWA bottom
  93.    LDR     r2,[r12,#96+8]                ; get bottom of window
  94.    SUB     r0,r0,r2                      ; r0=size of scroll bar
  95.    ADD     r4,r0,#ibtop                  ; add to iconbar top
  96.    LDR     r0,[r5,#28]                   ; get position in stack
  97.    CMN     r0,#2                         ; is it at back ?
  98.    BEQ     $exit
  99.    LDR     r0,[r5,#8]                    ; get bottom
  100.    LDR     r1,[r5,#16]                   ; get top
  101.    CMP     r1,r4                         ; is top below iconbar ?
  102.    BLT     $exit                         ; if so, then skip
  103.    CMP     r0,r4                         ; is bottom below iconbar ?
  104.    MOVLT   r0,r4                         ; if so, move it above iconbar
  105.    STR     r0,[r5,#8]                    ; and store back in block
  106.    BL      checktoggle
  107.    LDR     r0,[r12,#120]                 ; get original flags
  108.    TST     r0,#1<<21                     ; did it need forcing to screen ?
  109.    BNE     $forcetoscreen                ; if so, make sure
  110.    TST     r0,#1<<16                     ; was it open before ?
  111.    BNE     $exit                         ; if not, then forget
  112.    LDR     r0,[r12,#32]                  ; get flags
  113.    TST     r0,#1<<6                      ; is it no bounds ?
  114.    BNE     $exit
  115. $forcetoscreen
  116.    LDR     r3,[r12,#16]                  ; get win top
  117.    LDR     r2,[r12,#96+16]               ; get outline top
  118.    SUB     r4,r2,r3                      ; r4=title bar height
  119.    LDR     r3,[r5,#16]                   ; get new win top
  120.    BL      keeponscreen
  121. $exit
  122.    REM     "End filter"
  123.    LDR     r0,[r12,#124]                 ; get flag
  124.    SUB     r0,r0,#1                      ; decrement flag
  125.    STR     r0,[r12,#124]                 ; store back
  126.  
  127.    LDMFD   (sp)!,{r0-r5,pc}^             ; Return from call
  128.  
  129. .checktoggle
  130.    STMFD   (sp)!,{r0-r6,link}            ; Stack registers
  131.    REM     "Toggle check"
  132.    LDR     r0,[r12,#32]                  ; get flags
  133.    TST     r0,#1<<27                     ; toggle icon ?
  134.    BEQ     $exit                         ; if not, exit
  135.    TST     r0,#1<<18                     ; already full size ?
  136.    BNE     $exit                         ; if so, exit
  137.    REM     "%c04Toggle icon?"
  138.    SWI     "OS_Mouse"                    ; get position
  139.    TST     r2,#%101                      ; is select or adjust pressed ?
  140.    BEQ     $exit                         ; if not, then just passing over - exit
  141.    LDR     r2,[r12,#12]                  ; get win right
  142.    LDR     r3,[r12,#96+12]               ; get outline right
  143.    CMP     r2,r0                         ; compare win right with mousex
  144.    BGT     $exit                         ; if >, exit
  145.    CMP     r3,r0                         ; compare outline right with mousex
  146.    BLT     $exit                         ; if <, exit
  147.    LDR     r2,[r12,#16]                  ; get win top
  148.    LDR     r3,[r12,#96+16]               ; get outline top
  149.    CMP     r2,r1                         ; compare win top with mousey
  150.    BGT     $exit                         ; if >, exit
  151.    CMP     r3,r1                         ; compare outline top with mousey
  152.    BLT     $exit                         ; if <, exit
  153.    REM     "Yes"
  154.    SUB     r4,r3,r2                      ; r4=title bar height
  155.    LDR     r2,[r12,#56]                  ; get maxy
  156.    LDR     r3,[r12,#48]                  ; get miny
  157.    SUB     r2,r2,r3                      ; r2=total height
  158.    LDR     r3,[r5,#8]                    ; get bottom of window
  159.    REM     "Bottom=%r3"
  160.    REM     "Total height=%r2"
  161.    ADD     r3,r3,r2                      ; add height
  162.    BL      keeponscreen
  163. $exit
  164.    LDMFD   (sp)!,{r0-r6,pc}              ; Return from call
  165.  
  166. ; > r3=win top
  167. ;   r4=title bar height
  168. .keeponscreen
  169.    STMFD   (sp)!,{r0-r6,link}            ; Stack registers
  170.    REM     "Keep on screen, top=%r3, %r4"
  171.    XSWI    "OS_ReadModeVariable",-1,12   ; get YWindLimit
  172.    MOV     r6,r2                         ; r6=YWindLimit
  173.    XSWI    "OS_ReadModeVariable",-1,5    ; get YEigFactor
  174.    MOV     r6,r6,LSL r2                  ; shift YWindLimit by YEigFactor
  175.    ADD     r0,r3,r4                      ; what will be location of titlebar?
  176.    CMP     r0,r6                         ; > top of screen ?
  177.    SUBGT   r3,r6,r4                      ; if so, top=scrtop-title height
  178.    MOVGT   r0,#1                         ; get 1 pixel to add to top
  179.    ADDGT   r3,r3,r0,LSL r2               ; add pixel to make title at top
  180.    STR     r3,[r5,#16]                   ; store back in block
  181.    REM     "Top=%r3"
  182. $exit
  183.    LDMFD   (sp)!,{r0-r6,pc}              ; Return from call
  184.  
  185. ; .Display
  186. ;    STMFD   (sp)!,{r0-r9,link}            ; Stack registers
  187. ;    LDMIA   r5,{r0-r8}                    ; read block
  188. ;    REM     "Display :"
  189. ;    REM     "%R"
  190. ;    LDMFD   (sp)!,{r0-r9,pc}              ; Return from call
  191.  
  192. #Post
  193. REM #Run <CODE>
  194. REM *Filer_Run Resources:$.Apps.!Draw
  195. REM *Son
  196.