Home » Archimedes archive » Acorn User » AU 1998-05 B.adf » Freeware2 » xuen/!Xuen/!runimage
xuen/!Xuen/!runimage
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Acorn User » AU 1998-05 B.adf » Freeware2 |
Filename: | xuen/!Xuen/!runimage |
Read OK: | ✔ |
File size: | E6A8 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10REM *********************************************** 20REM Name : Xuen 30REM Version : 7.00 40REM Purpose : Make RiscOS Desktop more efficient 50REM Author : Barny Short 60REM Date : 08-Mar-1998 70REM *********************************************** 80REM Revision history : 90REM 24-Aug-1997 Added Quickfile Icon to iconbar. 100REM Clicking on icon open/closes. 110REM 25-Aug-1997 Added ShortCuts facility. 120REM Similar feature to Win95 tool. 130REM 04-Sep-1997 Added nested directories facility. 140REM Changed Shift+IconbarMenu to 150REM include EditLinks facility. 160REM Changed name to Start and changed 170REM shortcuts directory to Links 180REM 05-Sep-1997 Changed way window cache is 190REM administered. Became version 2.00 200REM 06-Sep-1997 Changed format of link files. 210REM Added entire boot at start up. 220REM 07-Sep-1997 Fixed a mother of a bug that 230REM probably has something to do with 240REM the pipeline. Also added much 250REM more intelligent file type 260REM checking. 270REM 14-Sep-1997 General improvements regarding 280REM drag'n'drop and tooltip. 290REM 04-Nov-1997 Changed icon bar icon 300REM 05-Nov-1997 Added the ~ history directory 310REM to catch all double clicks on 320REM file icons. 330REM Also added a ~~ directory. Can't 340REM think what for. 350REM Fixed the EMPTY directory bug. 360REM Changed action of TOOL_TIP when 370REM pointer moved over it so now it 380REM gets 'pushed' around. 390REM 06-Nov-1997 Changed how destination directory 400REM is selected for ADDNEWLINK. User 410REM now has to explicitly move to the 420REM required menu. 430REM Created system directorys that 440REM begin with a ~ symbol. These are 450REM updated with a history of the 460REM desktop filer usage. 470REM 07-Nov-1997 Built the Alias$Link run tool. 480REM Fixed a SysFilePrefix related 490REM shortcutmenuselect bug. 500REM Added icon bar toggle feature 510REM when mouse hits bottom of screen. 520REM Added ALT-START_MENU click to 530REM efficiently delete items in the 540REM startup menu. 550REM 09-Nov-1997 Added auto cascading for desktop 560REM windows. Some windows are never 570REM auto cascaded. These are: 580REM a) The Tooltip window 590REM b) Start's dummyback window 600REM c) Any window toggled full size, 610REM that has input focus, 620REM and a toggle size icon. 630REM 09-Nov-1997 Added animated iconbar icon and 640REM alternative tool tips. 650REM 11-Nov-1997 Added selective cascading of 660REM windows to reduce difficulty in 670REM using menus. Changed Iconbar 680REM button usage and 'alternative' 690REM tool tips. 700REM 19-Nov-1997 Added sensible task bar tool tip. 710REM Included AppPath$ to guard 720REM against the <Start$Dir> getting 730REM corrupted. 740REM Added extra checks before 750REM deleteing auto-create links. 760REM Auto ensure ~ directorys are 770REM there whenever they are needed. 780REM 21-Nov-1997 Disabled window repositioning 790REM when a menu is displayed with 800REM MenuIsOpenFlag%. 810REM 21-Nov-1997 Added window drifting. Added 820REM dragable yes/no icons to window 830REM cache management. 840REM 22-Nov-1997 Ensured all windows were 850REM properly cascaded, even if still 860REM waiting for a state to occur 870REM when they were allowed to be 880REM moved. 890REM 22-Feb-1998 Changed name of application to 900REM Xuen, and system variable to 910REM <Xuenbs$Dir> to reflect initials 920REM of programmer. A millenium of 930REM dire satanic consequences to 940REM anyone who changes this variable. 950REM 08-Mar-1998 Added 4s delay to writing of 960REM desktop filer grabbed links to 970REM disk. Forced new folder links to 980REM overwrite old ones if still in 990REM cache. Forced links still in 1000REM cache to be written to disc 1010REM forcefully if a new cache entry 1020REM appears (except folder links). 1021REM 08-Mar-1998 Changed tool tips again. 1030REM *********************************************** 1040REM Note: 1050REM When running this program, it is important 1060REM to ensure that the corresponding !Boot or 1070REM !run file is run at the same time because 1080REM they ensure the system variable is set 1090REM correctly. ie. Use the !Run file to run this 1100REM file. 1110REM *********************************************** 1120 1130PictureType%=&d94:REM Artworks 1140DocumentType%=&bc5:REM Impression Document 1150User$="Admin":REM User name is Admin 1160 1170app$="Xuen" 1180AppPath$="" 1190AppDate$="" 1200DIM apppath 255, apppathvar 32, appdatevar 32 1210$appdatevar="<Sys$Time> <Sys$Date>"+CHR$0 1220$apppathvar="<Xuenbs$Dir>"+CHR$0 1230 1240REM Aquire the start path to use for delete operations 1250SYS"OS_GSTrans",apppathvar,apppath,255 1260AppPath$=FNstring(apppath) 1270 1280DIM errorblock% 2048, block% 2048, block2% 2048, clistring 255 1290DIM winblock% 2048 1300 1310DIM InvalidDrive$(255) 1320InvalidDriveCount%=0 1330 1340DIM dragspritename% 32, boundspritebox% 32 1350 1360ON ERROR PROCerror(REPORT$+" at line "+STR$ERL):CLOSE#0:END 1370 1380REM Auto link buffer add stuff 1390alba_destinationdir$="" 1400alba_type%=-1:REM -1 means nothing in cache 1410alba_newlinkfile$="" 1420alba_newlinkleaf$="" 1430alba_time%=0 1440 1450CACHE_SIZE% = 4096 1460pause% = 200 1470open_type%=1 1480close_type%=2 1490add_window%=1 1500subtract_window%=2 1510drag_type%=5 1520adjust%=1 1530menu%=2 1540select%=4 1550iconbarhandle%=0 1560dircount%=0 1570linkloadaddr%=0 1580objecttype%=0 1590linkmenu%=0 1600addlink%=0 1610iconbar_timer%=TIME:iconbar_timerflag%=0 1620whandle_tooltip%=0:ToolTip%=0:tooltip_timer%=0 1630override_tooltip%=0:OldToolTip%=0 1640internalstackposition%=-2 1650oldstackposition%=0 1660currentwindow%=0 1670currentmenuhandle%=0 1680firstmenuhandle%=-3 1690IconBarMenuOpen%=0 1700StartMenuSeperator%=-1 1710SysFilePrefix%=126 1720BottomEdgeFlag=0 1730after%=0:cascade%=0 1740whandle_dummyback%=0 1750LastRightEdge%=0 1760CascadeRow%=0 1770RandTipMax%=13 1780DIM RandTip$(RandTipMax%) 1800RandTip$(1)="LSD" 1810RandTip$(2)="Opium" 1820RandTip$(3)="Magic Mushrooms" 1830RandTip$(4)="Mescaline" 1840RandTip$(5)="Peyote" 1850RandTip$(6)="Lophophora Williamsii" 1860RandTip$(7)="Trips" 1870RandTip$(8)="Acid" 1880RandTip$(9)="Speed" 1890RandTip$(10)="Mind Bending Drugs" 1900RandTip$(11)="Psychedelics" 1910RandTip$(12)="Fun" 1911RandTip$(13)="Cannabis" 1920 1930IconBarAnimSize%=11 1940DIM IconBarAnim$(IconBarAnimSize%) 1950IconBarAnim$(0)="Sxuen0" 1960IconBarAnim$(1)="Sxuen1" 1970IconBarAnim$(2)="Sxuen2" 1980IconBarAnim$(3)="Sxuen3" 1990IconBarAnim$(4)="Sxuen4" 2000IconBarAnim$(5)="Sxuen5" 2010IconBarAnim$(6)="Sxuen6" 2020IconBarAnim$(7)="Sxuen7" 2030IconBarAnim$(8)="Sxuen8" 2040IconBarAnim$(9)="Sxuen9" 2050IconBarAnim$(10)="Sxuen10" 2060IconBarAnimStep=0 2070IconBarAnimDir=0.5 2080 2090 2100MenuIsOpenFlag%=0 2110ReorganiseWindowStack=0 2120 2130DIM dblock% 1024, bootblock% 1024, shortcutmenu% 10192, shortcutmenudata% 20384 2140DIM main_menu% 256, typebuf% 256, iconbarlabel% 32, iconbardata% 32 2150DIM string% 1024, bootstring% 1024, infodata% 2048, tooltipdata% 2048, tooltipicon% 512 2160DIM cache% CACHE_SIZE% 2170DIM dirlist%(32), dirptr%(32) 2180 2190currentmenu%=main_menu% 2200cache_ext%=0 2210task_handle%=0 2220drag_button%=adjust% 2230DX%=0 2240drag_icon%=0 2250path$="" 2260in_leftregion=FALSE 2270in_rightregion=FALSE 2280qf_timer=TIME 2290regionxs%=16 2300regionys%=64 2310$iconbarlabel%="Xuen"+CHR$0 2320$iconbardata%="S!xuen"+CHR$0 2330globalmenuptr%=shortcutmenu% 2340 2350$iconbarlabel%=""+CHR$0 2360$iconbardata%=IconBarAnim$(0)+CHR$0 2370 2380 2390REM *************************************************** 2400 2410quit%=FALSE 2420 2430PROCinit 2440REMPROCerror("Xuen path = "+AppPath$+CHR$0) 2450PROCCreateToolTip 2460PROCloadcache 2470PROCDirectoryBoot(AppPath$+".Users."+User$+".Links") 2480 2490WHILE NOT quit% 2500PROCpoll 2510ENDWHILE 2520 2530PROCDestroyToolTip 2540SYS "Wimp_CloseDown" 2550END 2560 2570REM *************************************************** 2580 2590DEFPROCGetDate 2600REM Aquire date and time 2610SYS"OS_GSTrans",appdatevar,apppath,255 2620AppDate$=FNstring(apppath) 2630ENDPROC 2640 2650REM *************************************************** 2660 2670REM poll loop 2680DEFPROCpoll 2690SYS"Wimp_Poll",0,block% TO reason% 2700REM IF reason%<>0 PROCerror(STR$(reason%)+CHR$0) 2710CASE reason% OF 2720WHEN 0:PROCnull_reason 2730WHEN 2:PROCPollReason2 2740WHEN 3:SYS "Wimp_CloseWindow",,block% 2750WHEN 6:PROCclick(block%!12) 2760WHEN 7:PROCdragdrop 2770REM WHEN 8:PROCkeypressed 2780WHEN 9:PROCmenuselect 2790WHEN 17,18:PROCreceive(reason%) 2800REM WHEN 19:PROCerror("Unsupported window definition.") 2810ENDCASE 2820ENDPROC 2830 2840REM *************************************************** 2850 2860DEFPROCPollReason2 2870IF ((!block%) > &ffff) THEN 2880REM PROCerror("Window tobeopened:"+STR$~(!block%)+" behind: "+STR$~(block%!28)+CHR$0) 2890SYS "Wimp_OpenWindow",,block% 2900ELSE 2910REMcurrentwindow%=!block%:PROCOpenToolTip(2) 2920REM This is very wierd - the windowhandle is invalid and equals 2930REM the mouse pointer x position - must be a menu I reckon or 2940REM could be a bug in RISCOS. 2950MenuIsOpenFlag%=1 2960ENDIF 2970 2980ENDPROC 2990 3000DEFPROCGetScreenSize 3010SYS"OS_ReadModeVariable",-1,4 TO ,,OS_EX%:REM Eigen 3020SYS"OS_ReadModeVariable",-1,5 TO ,,OS_EY% 3030SYS"OS_ReadModeVariable",-1,11 TO ,,OS_WX%:REM Size 3040SYS"OS_ReadModeVariable",-1,12 TO ,,OS_WY% 3050OS_MX%=(1+OS_WX%) << OS_EX% 3060OS_MY%=(1+OS_WY%) << OS_EY% 3070ENDPROC 3080 3090REMDEFPROCkeypressed 3100REMLOCAL Char% 3110REMChar%=block%!24 3120REMREM Is this the delete or backspace key? 3130REMIF (Char%=8 OR Char%=&7f) THEN 3140REMREM Is this in a menu? 3150REMPROCerror("Window handle = "+STR$~(block%!0)+" -- main_menu% = "+STR$~(main_menu%)+CHR$0) 3160REMELSE 3170REMSYS "Wimp_ProcessKey",Char% 3180REMENDIF 3190REMENDPROC 3200 3210DEFPROCReopenDummyWindow 3220 !block2%=whandle_dummyback% 3230 SYS"Wimp_GetWindowState",,block2% 3240 block2%!8=-1024:block2%!16=-1024 3250 block2%!28=-2 3260 SYS"Wimp_OpenWindow",,block2% 3270 after%=whandle_dummyback%:cascade%=0 3280 MenuIsOpenFlag%=0 3290 3300 IF (ReorganiseWindowStack=2) ReorganiseWindowStack=0 3310 IF (ReorganiseWindowStack=1) ReorganiseWindowStack+=1 3320ENDPROC 3330 3340DEF PROCcascade 3350LOCAL q%,OldAfter% 3360LOCAL sx%, sy%, ox%, oy% 3370LOCAL ReopenFlag%, StackFlag% 3380LOCAL PaneFlag%, IsOpenFlag%, IsMoveableFlag% 3390LOCAL CurrentWin%,CurrentIcon% 3400 3410q%=winblock% 3420PaneFlag%=FALSE 3430 3440REM Get Current window immediately under pointer 3450SYS"Wimp_GetPointerInfo",,block2% 3460CurrentWinPtr%=block2%!12 3470CurrentIcon%=block2%!16 3480 3490OldAfter%=after% 3500!q%=after% 3510REM _Try_ and reopen this desktop window ... 3520SYS "XWimp_GetWindowState",,q% 3530IF (after%=-1 OR ReorganiseWindowStack=1)PROCReopenDummyWindow:ENDPROC 3540CurrentWin%=!q% 3550after%=q%!28 3560IF (CurrentWin%=-1 OR (after%=OldAfter%)) THEN 3570 PROCReopenDummyWindow 3580ELSE 3590 REM Reposition window 3600 IF (cascade%=0) CascadeRow%=0:LastRightEdge%=0 3610 REM !q%=after%:SYS "Wimp_GetWindowState",,q% 3620 3630 3640 PaneFlag%=FALSE 3650 IF (((q%!32) AND ((2^22)+(2^23)))>0) PaneFlag%=TRUE 3660 IF (((q%!32) AND 32)=32) PaneFlag%=TRUE 3670 IsOpenFlag% = ((q%!32) AND (2^16)) 3680 IsMoveableFlag% = ((q%!32) AND 2) 3690 REM Has window moved at all for repositioning? 3700 3710 ReopenFlag%=TRUE 3720 StackFlag%=TRUE 3730REM IF (((q%!32) AND (2^18))>0 AND ((q%!32) AND (2^20))>0 AND ((q%!32) AND (2^27))>0) StackFlag%=FALSE:ReopenFlag%=FALSE:REM Toggled Maximise & has input focus & has toggle icon 3740IF (CurrentWin%=CurrentWinPtr% AND ((q%!32) AND (2^28))=0 AND ((q%!32) AND (2^30))=0 AND ((q%!32) AND (2^17))>0 AND after%=-1) StackFlag%=FALSE:ReopenFlag%=FALSE:REM Under pointer and _no_ horiz/vert scroll bars and fully visible (likely to be part of menu so leave alone) 3750IF (((q%!32) AND (2^18))>0 AND ((q%!32) AND (2^27))>0 AND ((q%!32) AND (2^28))>0 AND ((q%!32) AND (2^30))>0) StackFlag%=FALSE:ReopenFlag%=FALSE:REM Toggled Maximise & has toggle icon and has horiz/vert scroll bars - likely to be a word processor window 3760IF ( (q%!16 < (OS_MY%-(cascade%*40))) AND (q%!4 > 0) AND (q%!12 < (OS_MX%-40)) AND (q%!8>40) AND ((q%!32) AND (2^17))>0) StackFlag%=FALSE:ReopenFlag%=FALSE:REM Fully visible 3770 IF (CurrentWin%=whandle_tooltip%) StackFlag%=FALSE:ReopenFlag%=FALSE 3780 IF (CurrentWin%=whandle_dummyback%) StackFlag%=FALSE:ReopenFlag%=FALSE 3790 IF (PaneFlag%=TRUE) StackFlag%=FALSE:ReopenFlag%=FALSE 3800 IF (IsOpenFlag%=0 OR IsMoveableFlag%=0) StackFlag%=FALSE:ReopenFlag%=FALSE 3810 IF (MenuIsOpenFlag%=1) StackFlag%=FALSE:ReopenFlag%=FALSE 3820REM If pointer is over window and within the work area 3830REM then don't move it. 3840IF (CurrentWin%=CurrentWinPtr%) ReopenFlag%=FALSE 3850 REM Reset position of window and do a Re-Open 3860 REM Get size of window 3870 IF (StackFlag%=TRUE) THEN 3880 ox%=q%!4 3890 oy%=q%!16 3900 sx%=(q%!12)-(q%!4) 3910 sy%=(q%!16)-(q%!8) 3920 3930 IF (ReorganiseWindowStack>0) THEN 3940 REM Try and fit as many windows horizontally as possible 3950 IF ((LastRightEdge%+sx%)<(OS_MX%-40)) THEN 3960 q%!4=LastRightEdge% 3970 q%!16=(OS_MY%-40)-(CascadeRow%*40):REM 1160 3980 q%!12=(q%!4)+sx% 3990 IF ((q%!12)>(OS_MX%-40)) q%!12=(OS_MX%-40) 4000 q%!8=(q%!16)-sy% 4010 IF ((q%!8)<40) q%!8=40 4020 LastRightEdge%=(q%!12)+48 4030 ELSE 4040 LastRightEdge%=0 4050 CascadeRow%+=1 4060 q%!4=(CascadeRow%*8) 4070 q%!16=(OS_MY%-40)-(CascadeRow%*40):REM 1160 4080 q%!12=(q%!4)+sx% 4090 IF ((q%!12)>(OS_MX%-40)) q%!12=(OS_MX%-40) 4100 q%!8=(q%!16)-sy% 4110 IF ((q%!8)<40) q%!8=40 4120 LastRightEdge%=(q%!12)+48 4130 ENDIF 4140 4150 4160 4170REM REM Enable window 'drift' 4180REM IF (ox%<>q%!4) THEN 4190REM nx%=q%!4 4200REM sx%=(q%!12)-(q%!4) 4210REM dx%=nx%-ox% 4220REM IF (ABS(dx%)>40) THEN 4230REM nx%=ox%+(SGN(dx%)*40) 4240REM q%!4=nx%:q%!12=nx%+sx% 4250REM ENDIF 4260REM ENDIF 4270REM IF (oy%<>q%!16) THEN 4280REM ny%=q%!16 4290REM sy%=(q%!16)-(q%!8) 4300REM dy%=ny%-oy% 4310REM IF (ABS(dy%)>40) THEN 4320REM ny%=oy%+(SGN(dy%)*40) 4330REM q%!16=ny%:q%!8=ny%-sy% 4340REM ENDIF 4350REM ENDIF 4360 4370 REM Having allowed space for this window in the 4380 REM window cascade, are we sure we want to move 4390 REM it just yet? 4400 4410 IF (ReopenFlag%=TRUE) THEN 4420 SYS "XWimp_SendMessage",2,q%,CurrentWin% 4430 ENDIF 4440 ENDIF:REM End of IF (ReorganiseWindowStack) ... 4450 4460 cascade%+=1 4470 4480 ENDIF 4490 ENDIF 4500ENDPROC 4510 4520REM ********************************************* 4530REM * Animate the icon bar icon * 4540REM ********************************************* 4550DEFPROCAnimateIconBar 4560$iconbardata%=IconBarAnim$(IconBarAnimStep) 4570IconBarAnimStep+=IconBarAnimDir 4580IF (IconBarAnimStep<0 OR IconBarAnimStep=IconBarAnimSize%) THEN 4590IconBarAnimStep=0 4600REM IconBarAnimDir = IconBarAnimDir*-1 4610REM IconBarAnimStep+=IconBarAnimDir 4620ENDIF 4630REM Activate an update on the task bar icon ..... 4640!block2%=-2 4650block2%!4=iconbarhandle% 4660SYS"Wimp_GetIconState",,block2% 4670block2%!8=0:REM Don't change anything, 4680block2%!12=0:REM Just signal an update ... 4690SYS"Wimp_SetIconState",,block2% 4700ENDPROC 4710 4720REM ********************************************* 4730REM What shall we do during the idle wimp poll ? 4740REM This is the most important aspect of this 4750REM program and one which should enable a lot of 4760REM change with future versions of the software. 4770REM ********************************************* 4780DEFPROCnull_reason 4790LOCAL window% 4800SYS"Wimp_GetPointerInfo",,block% 4810 4820PROCalba_purge(400) 4830 4840X%=block%!0 4850Y%=block%!4 4860window%=block%!12 4870currentwindow%=window% 4880PROCGetScreenSize 4890 4900REM Are any mouse buttons pressed? 4910REM If not then reorganise [cascade] windows 4920IF (((block%!8) AND 7)=0) THEN 4930 PROCcascade 4940ENDIF 4950 4960REM Update the task bar icon each WIMP POLL 4970PROCAnimateIconBar 4980 4990REM If the task bar tool tip shows the TIME 5000REM then update it ... 5010IF (ToolTip%=1) PROCUpdateToolTipTime 5020 5030SYS"Wimp_GetPointerInfo",,block% 5040X%=block%!0 5050Y%=block%!4 5060window%=block%!12 5070currentwindow%=window% 5080 5090REM This may be needed to stop flicker 5100REM *fx19 5110 5120REMENDIF 5130REMIF (qf_timer>0) PROCfocusdelay 5140IF (X%<regionxs%) THEN 5150PROCleft_corner:ENDPROC 5160ENDIF 5170IF (X%>(OS_MX%-regionxs%)) THEN 5180PROCright_corner:ENDPROC 5190ENDIF 5200REM Is Pointer over iconbar icon? 5210REM Close tooltip if pointer moves over it (effectively push tip) 5220REM IF (((block%!12)=-2 AND (block%!16=iconbarhandle%)) OR (window%=whandle_tooltip% AND ToolTip%>0)) THEN 5230IF (((block%!12)=-2 AND (block%!16=iconbarhandle%))) THEN 5240PROCmove_overiconbar 5250ELSE 5260OldToolTip%=0 5270 5280REMIF (((TIME-tooltip_timer%)>100) AND ToolTip%>0) THEN 5290IF (ToolTip%>0) THEN 5300IF (block%!16 <> whandle_tooltip%) iconbar_timerflag%=0 5310PROCCloseToolTip 5320ELSE 5330REMiconbar_timer%=TIME 5340iconbar_timerflag%=0 5350ENDIF 5360ENDIF 5370REMIF (window%=-2) firstmenuhandle%=-2 5380REMIF (window%<>-2) PROCpointernotoniconbar:REM Must come first 5390IF ((X%>regionxs% AND X%<(OS_MX%-regionxs%)) OR Y%>regionys%) PROCoutoffocus 5400REMIF ((X%>regionxs% AND X%<(OS_MX%-regionxs%)) AND Y%=0) PROCpointeronbottomedge 5410IF (Y%=0) THEN 5420IF (BottomEdgeFlag=0) PROCpointeronbottomedge 5430ELSE 5440BottomEdgeFlag=0 5450ENDIF 5460 5470REMPROCCloseToolTip 5480REMPROCOpenToolTip(2) 5490ENDPROC 5500 5510REM *************************************************** 5520 5530DEFPROCpointeronbottomedge 5540LOCAL stackposition% 5550REM Is iconbar at top of stack? If not make it so. 5560REMSYS"Wimp_ProcessKey",&1dc 5570 5580REM PROCerror("Pointer on bottom edge."+CHR$0) 5590REM Open up start menu if it's not already open 5600BottomEdgeFlag=1 5610ReorganiseWindowStack=1 5620REM Close relevant window 5630REMSYS "Wimp_CreateMenu",,-1 5640REM Open start menu 5650REMPROCclick_iconbarmenu 5660REMENDPROC 5670 5680REM!block%=-2 5690REMSYS"Wimp_GetWindowState",,block% 5700REMstackposition%=block%!28 5710REMIF (stackposition%<>-1) THEN 5720REMblock%!28=-1 5730REMSYS"Wimp_OpenWindow",,block% 5740REM Toggle icon bar back/front 5750SYS"Wimp_ProcessKey",&1dc 5760 5770REM Reopen dummyback window at bottom of stack 5780!block%=whandle_dummyback% 5790SYS"Wimp_GetWindowState",,block% 5800block%!8=-1024:block%!16=-1024 5810block%!28=-2 5820SYS"Wimp_OpenWindow",,block% 5830after%=whandle_dummyback%:cascade%=0 5840 5850ENDPROC 5860 5870DEFPROCpointernotoniconbar 5880REM ENDPROC 5890REM Is iconbar on bottom of stack? If not make it so/ 5900REM No allowed to manually open iconbar so use our internal 5910REM value 5920IF (ToolTip%=0 OR (ToolTip%<>0 AND currentwindow%<>whandle_tooltip%)) THEN 5930IF firstmenuhandle%=-2 firstmenuhandle%=currentwindow% 5940ENDIF 5950 5960!block%=-2 5970SYS"Wimp_GetWindowState",,block% 5980stackposition%=block%!28 5990REMIF (stackposition%=oldstackposition%) THEN 6000IF (stackposition%<>oldstackposition%) THEN 6010REMblock%!28=-2 6020REMSYS"Wimp_CloseWindow",,block% 6030IF (currentwindow%<>firstmenuhandle% AND firstmenuhandle%>-2) THEN 6040SYS"Wimp_ProcessKey",&1dc 6050firstmenuhandle%=-3 6060REMENDIF 6070!block%=-2 6080SYS"Wimp_GetWindowState",,block% 6090stackposition%=block%!28 6100REMIF (stackposition%<>-1) oldstackposition%=stackposition% 6110oldstackposition%=stackposition% 6120ENDIF 6130ENDIF 6140ENDPROC 6150 6160REM IF (internalstackposition%=-1 AND currentwindow%>0) THEN 6170REM SYS"Wimp_ProcessKey",&1dc 6180REM PROCerror("Window : "+STR$(currentwindow%)+CHR$0) 6190REM internalstackposition%=-2:REM At bottom 6200REM ENDIF 6210REM ENDPROC 6220 6230DEFPROCoutoffocus 6240IF (in_leftregion) THEN PROCleaveleftregion 6250IF (in_rightregion) THEN PROCleaverightregion 6260qf_timer=TIME 6270ENDPROC 6280 6290DEFPROCleaveleftregion 6300in_leftregion=FALSE 6310ENDPROC 6320 6330DEFPROCleaverightregion 6340in_rightregion=FALSE 6350ENDPROC 6360 6370DEFPROCfocusdelay 6380IF ((TIME-pause%)>qf_timer) THEN qf_timer=-1:PROCOpenInfoBox 6390ENDPROC 6400 6410DEFPROCleft_corner 6420IF (in_leftregion=FALSE) ec_timer=TIME:ec_flag=FALSE 6430in_leftregion=TRUE 6440REM Check if windows need opening 6450IF (TIME-ec_timer>=50 AND ec_flag=FALSE) THEN 6460PROCreopenfiler:ec_flag=TRUE 6470ENDIF 6480 6490ENDPROC 6500 6510DEFPROCright_corner 6520IF (in_rightregion=FALSE) ec_timer=TIME:ec_flag=FALSE 6530in_rightregion=TRUE 6540REM Check if windows need closing 6550REMIF (TIME-ec_timer>=100 AND ec_flag=FALSE) THEN 6560IF (ec_flag=FALSE) THEN 6570PROCclosefiler:PROCCloseInfoBox:ec_flag=TRUE 6580ENDIF 6590ENDPROC 6600 6610REM *************************************************** 6620 6630DEFPROCOpenInfoBox 6640!block%=whandle_info% 6650SYS"Wimp_GetWindowState",,block% 6660SYS"Wimp_OpenWindow",,block% 6670ENDPROC 6680 6690DEFPROCCloseInfoBox 6700!block%=whandle_info% 6710SYS"Wimp_CloseWindow",,block% 6720ENDPROC 6730 6740REM *************************************************** 6750 6760DEFPROCCreateToolTip 6770LOCAL XOffset% 6780REM Create the tooltip and dummy global windows 6790REM The tooltip window displays brief info about the 6800REM icon under the pointer. 6810REM The dummy window is needed to provide a 'bottom' 6820REM window for the window re-organisation tool to 6830REM start from. 6840 6850REM Create the tooltip window 6860Tip$="Hello" 6870XS%=(LEN(Tip$)*16)+20:YS%=40 6880SYS"Wimp_GetPointerInfo",,block% 6890REM Define screen position of tooltip 6900XOffset%=XS%/2 6910IF (XOffset%>32) XOffset%=32 6920X%=(!block%)-XOffset% 6930Y%=(block%!4)+24 6940PROCGetScreenSize 6950IF ((X%+XS%)>OS_MX%) X%=OS_MX%-XS% 6960IF (X%<0) X%=0 6970IF ((Y%+YS%)>OS_MY%) Y%=(block%!4)-(YS%+24) 6980REM IF ((Y%-YS%)<0) Y%=0 6990!block%=X%:block%!4=Y%:block%!8=X%+XS%:block%!12=Y%+YS% 7000XS%=(512*16)+20:YS%=40 7010block%!16=0:block%!20=0:REM Scroll offsets 7020block%!24=-1:block%!28=&80000050:REM Depth, window flags 7030block%!32=&00070207:block%!36=&120103:REM Colours 7040block%!40=0:block%!44=-YS%:block%!48=XS%:block%!52=0 7050block%!56=&19:block%!60=3<<12:REM Titlebar/workarea flags 7060block%!64=0:block%!68=0:REM Sprite area 7070$(block%+72)=CHR$0 7080block%!84=1 7090REM Define 1 icon starting at block%!88 7100!tooltipicon%=0:REM Null validation string 7110$(tooltipicon%+4)=Tip$+CHR$0:REM Icon text 7120block%!88=4:REM Bounding box 7130block%!92=-40:REM Bounding box 7140block%!96=((512*16)+20):REM Bounding box of _largest_ tip 7150block%!100=0:REM Bounding box 7160block%!104=&17003101 7170block%!108=tooltipicon%+4 7180block%!112=tooltipicon% 7190block%!116=512:REM Buffer length 7200SYS"Wimp_CreateWindow",,block% TO whandle_tooltip% 7210XS%=(LEN(Tip$)*16)+20:YS%=40 7220SYS"Wimp_GetPointerInfo",,block% 7230REM Define screen position of tooltip 7240XOffset%=XS%/2 7250IF (XOffset%>32) XOffset%=32 7260X%=(!block%)-XOffset% 7270PROCGetScreenSize 7280IF ((X%+XS%)>OS_MX%) X%=OS_MX%-XS% 7290IF (X%<0) X%=0 7300IF ((Y%+YS%)>OS_MY%) Y%=(block%!4)-(YS%+24) 7310Y%=-1024 7320REM IF ((Y%-YS%)<0) Y%=0 7330REM Get Tooltip window state 7340!block%=whandle_tooltip% 7350SYS"Wimp_GetWindowState",,block% 7360block%!4=X%:block%!8=-1024:block%!12=X%+XS%:block%!16=-1024 7370block%!20=0:block%!24=0:REM Scroll offsets 7380REM block%!28=-1 7390SYS"Wimp_OpenWindow",,block% 7400ToolTip%=0 7410 7420 7430 7440REM Create the dummy back window 7450REM Define screen position of tooltip 7460XS%=(LEN(Tip$)*16)+20:YS%=40 7470XOffset%=XS%/2 7480IF (XOffset%>32) XOffset%=32 7490X%=64 7500Y%=-1024 7510!block%=X%:block%!4=Y%:block%!8=X%+XS%:block%!12=Y%+YS% 7520XS%=(512*16)+20:YS%=40 7530block%!16=0:block%!20=0:REM Scroll offsets 7540block%!24=-1:block%!28=&80000050:REM Depth, window flags 7550block%!32=&00070207:block%!36=&120103:REM Colours 7560block%!40=0:block%!44=-YS%:block%!48=XS%:block%!52=0 7570block%!56=&19:block%!60=3<<12:REM Titlebar/workarea flags 7580block%!64=0:block%!68=0:REM Sprite area 7590$(block%+72)=CHR$0 7600block%!84=1 7610REM Define 1 icon starting at block%!88 7620!tooltipicon%=0:REM Null validation string 7630$(tooltipicon%+4)=Tip$+CHR$0:REM Icon text 7640block%!88=4:REM Bounding box 7650block%!92=-32:REM Bounding box 7660block%!96=((512*16)+20):REM Bounding box of _largest_ tip 7670block%!100=-8:REM Bounding box 7680block%!104=&17003101 7690block%!108=tooltipicon%+4 7700block%!112=tooltipicon% 7710block%!116=512:REM Buffer length 7720SYS"Wimp_CreateWindow",,block% TO whandle_dummyback% 7730REM Get Tooltip window state 7740!block%=whandle_dummyback% 7750SYS"Wimp_GetWindowState",,block% 7760block%!28=-2 7770SYS"Wimp_OpenWindow",,block% 7780after%=whandle_dummyback%:cascade%=0 7790 7800ENDPROC 7810 7820DEFPROCDestroyToolTip 7830!block%=whandle_tooltip% 7840SYS"Wimp_CloseWindow",,block% 7850SYS"Wimp_DeleteWindow",,block% 7860 7870!block%=whandle_dummyback% 7880SYS"Wimp_CloseWindow",,block% 7890SYS"Wimp_DeleteWindow",,block% 7900ENDPROC 7910 7920DEFPROCUpdateToolTipTime 7930LOCAL XOffset%, OldTip$ 7940OldTip$=Tip$ 7950PROCGetDate 7960Tip$=AppDate$ 7970IF (OldTip$<>Tip$) THEN 7980REM IF (TipID%=1) Tip$="after% = &"+STR$~(after%) 7990XS%=(LEN(Tip$)*16)+20:YS%=40 8000SYS"Wimp_GetPointerInfo",,block2% 8010REM Adjust Tooltip window state 8020!block2%=whandle_tooltip% 8030SYS"Wimp_GetWindowState",,block2% 8040X%=block2%!4 8050Y%=block2%!8 8060!block2%=whandle_tooltip% 8070block2%!4=X%:block2%!8=Y%:block2%!12=X%+XS%:block2%!16=Y%+YS% 8080block2%!20=0:block2%!24=0:REM Scroll offsets 8090block2%!28=-1 8100$(tooltipicon%+4)=Tip$+CHR$0:REM Icon text 8110REMSYS"Wimp_OpenWindow",,block2% 8120REM Update icon 8130!block2%=whandle_tooltip% 8140block2%!4=0 8150SYS"Wimp_GetIconState",,block2% 8160block2%!8=0:REM Don't change anything, 8170block2%!12=0:REM Just signal an update ... 8180SYS"Wimp_SetIconState",,block2% 8190ENDIF 8200ENDPROC 8210 8220DEFPROCOpenToolTip(TipID%) 8230LOCAL XOffset%, RandTipID%, RSeed% 8240IF (TipID%=ToolTip%) ENDPROC 8250IF (ToolTip%>0) PROCCloseToolTip 8260REM Create ToolTip Window 8270IF (TipID%=1) THEN 8280 PROCGetDate 8290 Tip$=AppDate$ 8300ENDIF 8310IF (TipID%=2) THEN 8320 REM Tip$="Click for more ..." 8321 Tip$="" 8340 RandTipID%=RND(RandTipMax%) 8360 Tip$=Tip$+RandTip$(RandTipID%) 8380ENDIF 8390IF (TipID%=3) Tip$="currentwindow% = "+STR$(currentwindow%) 8400REM IF (TipID%=1) Tip$="after% = &"+STR$~(after%) 8410XS%=(LEN(Tip$)*16)+20:YS%=40 8420SYS"Wimp_GetPointerInfo",,block% 8430REM Define screen position of tooltip 8440XOffset%=XS%/2 8450IF (XOffset%>32) XOffset%=32 8460X%=(!block%)-XOffset% 8470Y%=(block%!4)+24 8480PROCGetScreenSize 8490IF ((X%+XS%)>OS_MX%) X%=OS_MX%-XS% 8500IF (X%<0) X%=0 8510IF ((Y%+YS%)>OS_MY%) Y%=(block%!4)-(YS%+24) 8520REM IF ((Y%-YS%)<0) Y%=0 8530 8540REM Adjust Tooltip window state 8550!block%=whandle_tooltip% 8560SYS"Wimp_GetWindowState",,block% 8570!block%=whandle_tooltip% 8580block%!4=X%:block%!8=Y%:block%!12=X%+XS%:block%!16=Y%+YS% 8590block%!20=0:block%!24=0:REM Scroll offsets 8600block%!28=-1 8610$(tooltipicon%+4)=Tip$+CHR$0:REM Icon text 8620SYS"Wimp_OpenWindow",,block% 8630ToolTip%=TipID% 8640tooltip_timer%=TIME 8650ENDPROC 8660 8670DEFPROCCloseToolTip 8680IF (ToolTip%=0) ENDPROC 8690!block%=whandle_tooltip% 8700SYS"Wimp_GetWindowState",,block% 8710!block%=whandle_tooltip% 8720block%!8=-1024 8730block%!16=-1024 8740SYS"Wimp_OpenWindow",,block% 8750REMSYS"Wimp_CloseWindow",,block% 8760REM SYS"Wimp_DeleteWindow",,block% 8770ToolTip%=0 8780ENDPROC 8790 8800DEFPROCPersistCloseToolTip 8810IF (ToolTip%=0) ENDPROC 8820OldToolTip%=ToolTip% 8830REM!block%=whandle_tooltip% 8840REMSYS"Wimp_CloseWindow",,block% 8850!block%=whandle_tooltip% 8860SYS"Wimp_GetWindowState",,block% 8870!block%=whandle_tooltip% 8880block%!8=-1024 8890block%!16=-1024 8900SYS"Wimp_OpenWindow",,block% 8910REM SYS"Wimp_DeleteWindow",,block% 8920ToolTip%=0 8930ENDPROC 8940 8950REM *************************************************** 8960 8970DEFPROCinit_drag(icon%) 8980qf_timer=-1 8990SYS"Wimp_GetPointerInfo",,block% 9000ox%=block%!0 9010oy%=block%!4 9020block%!4=icon% 9030drag_icon%=icon% 9040block%!4=drag_type% 9050block%!8=ox%-32 9060block%!12=oy%-32 9070block%!16=ox%+32 9080block%!20=oy%+32 9090block%!24=&80000000 9100block%!28=&80000000 9110block%!32=&7FFFFFFF 9120block%!36=&7FFFFFFF 9130SYS"Wimp_DragBox",,block% 9140 9150REM Start a sprite drag .... 9160IF (icon%=add_window%) $dragspritename%="yes"+CHR$0 9170IF (icon%=subtract_window%) $dragspritename%="no"+CHR$0 9180!boundspritebox%=0 9190boundspritebox%!4=0 9200boundspritebox%!8=ox%+24 9210boundspritebox%!12=oy%+24 9220SYS"DragASprite_Start",2+8+64+128,1,dragspritename%,boundspritebox% 9230ENDPROC 9240 9250DEFPROCdragdrop 9260SYS"Wimp_GetPointerInfo",,block% 9270block%!20=block%!12 9280block%!24=block%!16 9290block%!28=!block% 9300block%!32=block%!4 9310block%!36=0 9320!block%=64:block%!12=0 9330block%!16=1:block%!40=&fff 9340$(block%+44) ="" 9350SYS"Wimp_SendMessage",18,block%,block%!20,block%!24 9360 9370REM Cancel a sprite drag ....... 9380SYS"DragASprite_Stop" 9390ENDPROC 9400 9410REM *************************************************** 9420 9430DEFFNstring(ptr%) 9440LOCAL a$ 9450WHILE ?ptr%<>0 AND LEN(a$)<254 9460a$+=CHR$(?ptr%):ptr%+=1 9470ENDWHILE 9480=a$ 9490 9500DEFFNget_line(filehandle%) 9510LOCAL a$,z% 9520z%=0 9530a$="" 9540REPEAT 9550IF (NOT(EOF#filehandle%)) THEN z%=BGET#filehandle% 9560IF z%>=32 a$+=CHR$(z%) 9570UNTIL z%<32 OR EOF#filehandle% 9580=a$+CHR$0 9590 9600DEFPROCput_line(filehandle%, A$) 9610LOCAL a$,z% 9620z%=1 9630FORz%=1TO LEN(A$) 9640a$=MID$(A$,z%,1) 9650IF (ASC(a$)>0) THEN BPUT#filehandle%, ASC(a$) 9660NEXT 9670BPUT#filehandle%, 10 9680ENDPROC 9690 9700REM *************************************************** 9710 9720DEFPROCloadcache 9730cache_ext%=0 9740!cache%=0 9750REM Load in commands to open filer display 9760F%=OPENIN(AppPath$+".Users."+User$+".~~open"+CHR$0) 9770REPEAT 9780A$=FNget_line(F%) 9790IF A$<>"" THEN PROCadd_to_cache(A$, open_type%) 9800UNTIL EOF#F% 9810CLOSE#F% 9820REM Load in commands to close filer display 9830F%=OPENIN(AppPath$+".Users."+User$+".~~close"+CHR$0) 9840REPEAT 9850A$=FNget_line(F%) 9860IF A$<>"" THEN PROCadd_to_cache(A$, close_type%) 9870UNTIL EOF#F% 9880CLOSE#F% 9890ENDPROC 9900 9910DEFPROCadd_to_cache(com$, type%) 9920record_size%=LEN(com$)+1+2 9930IF (record_size%>255) THEN PROCerror("Path too big! Please shrink !Xuen and reorganise your (lengthy labeled) directory structure.") 9940?(cache%+cache_ext%)=record_size% 9950?(cache%+cache_ext%+1)=type% 9960FORX%=1 TO LEN(com$) 9970?(cache%+cache_ext%+1+X%)=ASC(MID$(com$,X%,1)) 9980NEXT 9990?(cache%+cache_ext%+1+X%)=0:REM Add terminating zero to string 10000cache_ext%+=record_size% 10010IF (cache_ext%>CACHE_SIZE%) THEN PROCerror("Too many windows! Please increase CACHE_SIZE% and rerun !Xuen.") 10020?(cache%+cache_ext%)=0:REM Initialise next record size to NULL 10030ENDPROC 10040 10050REM *************************************************** 10060 10070DEFPROCcache_open 10080cache_ptr%=0 10090REPEAT 10100r_size%=?(cache%+cache_ptr%) 10110type%=?(cache%+cache_ptr%+1) 10120IF (r_size%>0 AND type%=open_type%) THEN PROCexecute_string(cache%+cache_ptr%+2) 10130cache_ptr%+=r_size% 10140UNTILr_size%=0 10150 10160PROCOpenFSView 10170ENDPROC 10180 10190DEFPROCcache_close 10200cache_ptr%=0 10210REPEAT 10220r_size%=?(cache%+cache_ptr%) 10230type%=?(cache%+cache_ptr%+1) 10240IF (r_size%>0 AND type%=close_type%) THEN PROCexecute_string(cache%+cache_ptr%+2) 10250cache_ptr%+=r_size% 10260UNTILr_size%=0 10270 10280PROCCloseFSView 10290ENDPROC 10300 10310DEFPROCexecute_string(str_ptr%) 10320A$=FNstring(str_ptr%) 10330IF A$<>"" THEN OSCLI(A$) 10340ENDPROC 10350 10360REM *************************************************** 10370 10380DEFPROCreopenfiler 10390PROCcache_close 10400PROCcache_open 10410ENDPROC 10420 10430DEFPROCclosefiler 10440PROCcache_close 10450ENDPROC 10460 10470REM *************************************************** 10480 10490DEFPROCsavedesktop 10500DX%=OPENOUT(AppPath$+".tmpfile"+CHR$0) 10510dblock%!0=28 10520dblock%!4=task_handle% 10530dblock%!12=0 10540dblock%!16=10 10550dblock%!20=DX% 10560dblock%!24=0 10570SYS"Wimp_SendMessage",17,dblock%,0 10580ENDPROC 10590 10600REM ************************************************ 10610REM Get leaf name of a full path name 10620REM ************************************************ 10630DEFFNGetLeafName(ptr%) 10640LOCAL a$,leafptr%,size% 10650REM Determine size of zstring 10660size%=0 10670WHILE ?(ptr%+size%)>31 10680size%+=1 10690ENDWHILE 10700REM Determine offset of leafname 10710leafptr%=size% 10720WHILE (?(ptr%+leafptr%)<>ASC(".")) AND leafptr%>0 10730leafptr%-=1 10740ENDWHILE 10750leafptr%+=1 10760REM Build leafname 10770a$="" 10780WHILE leafptr%<size% 10790a$+=CHR$(?(ptr%+leafptr%)) 10800leafptr%+=1 10810ENDWHILE 10820=a$ 10830 10840REM ************************************************ 10850REM function to deal with incoming messages 10860REM ************************************************ 10870DEFPROCreceive(reason%) 10880message%=block%!16 10890REM PROCerror("Message : &"+STR$~(message%)+CHR$0) 10900CASE message% OF 10910WHEN 0:quit%=TRUE 10920WHEN 3:PROCdata_load_add_link:REM PROCerror("DataLoad:"+FNstring(block%+44)+" Leafname:"+FNGetLeafName(block%+44)+" Type:&"+STR$~(!(block%+40))+CHR$0) 10930WHEN 2:PROCdata_ack 10940WHEN 5:PROCdata_open 10950WHEN 10:PROCdesktop_ack 10960WHEN &400C0:PROCsubmenu_warning 10970WHEN &400C9:IconBarMenuOpen%=0 10980ENDCASE 10990ENDPROC 11000 11010REM User has double clicked on a fileicon 11020REM Response - store a link to this file in the ~ directory 11030DEFPROCdata_open 11040LOCAL type%, destinationdir$ 11050 11060REM Flush cache if stuff in it ... 11070IF (alba_type%>0 AND alba_type%<>4096) THEN PROCalba_purge(0) 11080 11090alba_newlinkfile$=FNstring(block%+44) 11100alba_newlinkleaf$=FNGetLeafName(block%+44) 11110type%=!(block%+40) 11120alba_type%=type% 11130REM PROCerror("Type = "+STR$(type%)+CHR$0) 11140destinationdir$=AppPath$+".Users."+User$+".Links." 11150 11160 11170IF (type%=4096) THEN 11180REM Store this directory access 11190destinationdir$=destinationdir$+CHR$(SysFilePrefix%)+"Folders" 11200ENDIF 11210 11220IF (type%=8192) THEN 11230REM Store this application access 11240destinationdir$=destinationdir$+CHR$(SysFilePrefix%)+"Programs" 11250ENDIF 11260 11270IF (type%<4096) THEN 11280 IF (type%=DocumentType%) THEN 11290 destinationdir$=destinationdir$+CHR$(SysFilePrefix%)+"Document" 11300 ENDIF 11310 11320 IF (type%=PictureType%) THEN 11330 destinationdir$=destinationdir$+CHR$(SysFilePrefix%)+"Picture" 11340 ENDIF 11350 11360 IF (type%<>PictureType% AND type%<>DocumentType%) THEN 11370 destinationdir$=destinationdir$+CHR$(SysFilePrefix%)+"Files" 11380 ENDIF 11390ENDIF 11400 11410alba_destinationdir$=destinationdir$ 11420alba_time%=TIME 11430ENDPROC 11440 11450DEFPROCautoaddnewshortcut 11460LOCAL autodropdirectory$ 11470LOCAL number%, next%,numberofitems% 11480LOCAL oldestdate%,oldestname$,oldesttype%,oldestnext%,oldnext% 11490LOCAL delstring$ 11500autodropdirectory$ = alba_destinationdir$ 11510PROCensuredir(autodropdirectory$) 11520REM Auto insert directorys have a limit of 9 items 11530REM Is link directory empty? 11540numberofitems%=0 11550next%=0 11560oldestdate%=0 11570WHILE(next%<>-1 AND numberofitems%<=16) 11580$string%=autodropdirectory$+CHR$0 11590oldnext%=next% 11600SYS "OS_GBPB",11,string%,dblock%,1,next%,63,"*" TO ,,,number%,next% 11610IF next%<>-1 THEN 11620numberofitems%+=1 11630IF ((dblock%!24)<oldestdate% OR oldestdate%=0) oldestdate%=dblock%!24:oldestname$=FNstring(dblock%+29):oldestnext%=oldnext% 11640ENDIF 11650ENDWHILE 11660IF (numberofitems%<9) THEN 11670 REM If so then automatically insert 11680 PROCaddnewshortcut(autodropdirectory$,alba_newlinkfile$,alba_newlinkleaf$) 11690ELSE 11700 REM Intelligently delete an old file and 11710 REM Get filetype of this file 11720 $string%=autodropdirectory$+CHR$0 11730 SYS "OS_GBPB",12,string%,dblock%,1,oldestnext%,63,"*" 11740 oldesttype%=dblock%!20 11750 REM PROCerror("Oldest file to remove : "+oldestname$+" of type "+STR$~(oldesttype%)+CHR$0) 11760 REM Delete the oldest link in this dir ... 11770 REM Final check - !Start can only remove a file if it's 11780 REM filetype is &af3 ... (Precaution against error) 11790 IF (oldesttype%=&af3) THEN 11800 delstring$="delete "+autodropdirectory$+"."+oldestname$ 11810 REM PROCerror("about to OSCLI "+delstring$+CHR$0) 11820 OSCLI(delstring$+CHR$0) 11830 REM insert a new one ... 11840 PROCaddnewshortcut(autodropdirectory$,alba_newlinkfile$,alba_newlinkleaf$) 11850 ENDIF 11860ENDIF 11870alba_type%=-1 11880ENDPROC 11890 11900REM Prompt user to select directory for new link 11910DEFPROCdata_load_add_link 11920LOCAL path$,leaf$,type%,leafptr%,linkname$ 11930IF (FNCheckLinksDirExists=0) ENDPROC 11940path$=FNstring(block%+44) 11950leaf$=FNGetLeafName(block%+44) 11960type%=!(block%+40) 11970linkname$=AppPath$+".Users."+User$+".Links."+leaf$ 11980newlinkleaf$=leaf$ 11990newlinkfile$=FNstring(block%+44) 12000REM Is link directory empty? 12010$string%=AppPath$+".Users."+User$+".Links"+CHR$0 12020SYS "OS_GBPB",10,string%,dblock%,1,0,63,"*" TO ,,,number% 12030IF number%=0 THEN 12040REM If so then automatically add to root directory 12050PROCaddnewshortcut(AppPath$+".Users."+User$+".Links",newlinkfile$,newlinkleaf$) 12060ELSE 12070PROCshowshortcutmenu(1) 12080ENDIF 12090ENDPROC 12100 12110REM Add new link to the shortcut directory 12120DEFPROCaddnewshortcut(dropdirectory$,add_newlinkfile$,add_newlinkleaf$) 12130LOCAL linkname$,leafptr% 12140linkname$=dropdirectory$+"."+add_newlinkleaf$ 12150$string%=add_newlinkfile$+CHR$0 12160REMPROCerror("Contents of "+linkname$+"="+add_newlinkfile$+CHR$0) 12170leafptr%=string% 12180REM Check to see if this file already exists and if so 12190REM prompt for overwrite. 12200X%=OPENOUT(linkname$+CHR$0) 12210WHILE((?leafptr%) > 31) 12220BPUT#X%, ?leafptr% 12230leafptr%+=1 12240ENDWHILE 12250BPUT#X%, 10:REM Output a terminating LF 12260CLOSE#X% 12270REM Set type appropriately 12280OSCLI("SetType "+linkname$+" af3"+CHR$0) 12290ENDPROC 12300 12310DEFPROCalba_purge(expiry%) 12320IF (alba_type%<0) THEN ENDPROC 12330IF (expiry%>0 AND (alba_time%+expiry%)>TIME) THEN ENDPROC 12340PROCautoaddnewshortcut 12350ENDPROC 12360 12370DEFPROCdata_ack 12380REM Store path in temp string 12390path$=FNstring(block%+44) 12400path$=LEFT$(path$) 12410dhandle%=block%!20 12420IF INSTR(path$,"<Wimp$ScrapDir>")>0 THEN 12430 REMIF (drag_icon%=add_window%) THEN 12440 PROCerror("You can't add that to the Filer window cache."+CHR$0) 12450 REMENDIF 12460 ENDPROC 12470ENDIF 12480REM Compile desktop boot file 12490SYS"Hourglass_On" 12500IF (drag_icon%=add_window%) THEN PROCsavedesktop 12510IF (drag_icon%=subtract_window%) THEN PROCsubtract_window 12520ENDPROC 12530 12540DEFPROCdesktop_ack 12550REM If we get a desktop_ack then that means that all 12560REM applications have responded to the request to write 12570REM to the desktop boot file. 12580IF (DX%<>0) THEN CLOSE#DX%:DX%=0 12590IF drag_icon%=add_window% THEN PROCadd_window 12600ENDPROC 12610 12620REM *************************************************** 12630 12640DEFPROCadd_window 12650REM Go through desktop bootfile looking for path string 12660REM If this line contains path_string then add relevant 12670REM line of boot file to config file. 12680newline$="" 12690X%=OPENIN(AppPath$+".tmpfile"+CHR$0) 12700REPEAT 12710A$=FNget_line(X%) 12720path_start%=INSTR(A$, path$) 12730path_length%=LEN(path$) 12740IF (INSTR(A$, "Filer_OpenDir")>0 AND path_start%>0 AND ASC(MID$(A$,path_start%+path_length%,1))<=32) THEN newline$=A$ 12750UNTIL EOF#X% 12760CLOSE#X% 12770REM No serious precautions needed here because of the 12780REM file name used ... tmpfile 12790OSCLI("Delete "+AppPath$+".tmpfile"+CHR$0) 12800 12810X%=OPENUP(AppPath$+".Users."+User$+".~~Open"+CHR$0) 12820PTR#X%=EXT#X% 12830PROCput_line(X%, newline$) 12840CLOSE#X% 12850 12860X%=OPENUP(AppPath$+".Users."+User$+".~~Close"+CHR$0) 12870PTR#X%=EXT#X% 12880PROCput_line(X%, "Filer_CloseDir "+path$) 12890CLOSE#X% 12900REM Re-initialise the Cache 12910PROCloadcache 12920SYS"Hourglass_Off" 12930ENDPROC 12940 12950REM *************************************************** 12960 12970DEFPROCsubtract_window 12980X%=OPENIN(AppPath$+".Users."+User$+".~~Open"+CHR$0) 12990Y%=OPENOUT(AppPath$+".Users."+User$+".tmpfile"+CHR$0) 13000REPEAT 13010A$=FNget_line(X%) 13020path_start%=INSTR(A$, path$) 13030path_length%=LEN(path$) 13040IF (INSTR(A$, "Filer_OpenDir")=0 OR path_start%=0 OR ASC(MID$(A$,path_start%+path_length%,1))>32) THEN PROCput_line(Y%, A$) 13050UNTIL EOF#X% 13060CLOSE#X% 13070CLOSE#Y% 13080OSCLI("Delete "+AppPath$+".Users."+User$+".~~Open"+CHR$0) 13090OSCLI("Rename "+AppPath$+".tmpfile "+AppPath$+".Users."+User$+".~~Open"+CHR$0) 13100 13110X%=OPENIN(AppPath$+".Users."+User$+".~~Close"+CHR$0) 13120Y%=OPENOUT(AppPath$+".tmpfile"+CHR$0) 13130REPEAT 13140A$=FNget_line(X%) 13150path_start%=INSTR(A$, path$) 13160path_length%=LEN(path$) 13170IF (INSTR(A$, "Filer_CloseDir")=0 OR path_start%=0 OR ASC(MID$(A$,path_start%+path_length%,1))>32) THEN PROCput_line(Y%, A$) 13180UNTIL EOF#X% 13190CLOSE#X% 13200CLOSE#Y% 13210OSCLI("Delete "+AppPath$+".Users."+User$+".~~Close"+CHR$0) 13220OSCLI("Rename "+AppPath$+".tmpfile "+AppPath$+".Users."+User$+".~~Close"+CHR$0) 13230REM Re-initialise the Cache 13240PROCloadcache 13250SYS"Hourglass_Off" 13260ENDPROC 13270 13280REM *************************************************** 13290REM *************************************************** 13300REM *************************************************** 13310REM *************************************************** 13320 13330DEFPROCinit 13340REM Do ~~Open and ~~Close files exist? If not, create empty 13350REM copies of them to prevent !Start crashing. 13360PROCensuredir(AppPath$+".Users") 13370PROCensuredir(AppPath$+".Users."+User$) 13380PROCensuredir(AppPath$+".Users."+User$+".Links") 13390 13400$string%=AppPath$+".Users."+User$+".~~Open" 13410SYS"OS_File",17,string% TO result% 13420IF (result%=0) THEN X%=OPENOUT(AppPath$+".Users."+User$+".~~Open"):CLOSE#X% 13430$string%=AppPath$+".Users."+User$+".~~Close" 13440SYS"OS_File",17,string% TO result% 13450IF (result%=0) THEN X%=OPENOUT(AppPath$+".Users."+User$+".~~Close"):CLOSE#X% 13460 13470SYS "Wimp_Initialise",200,&4B534154,app$ TO current_wimp_version%,task_handle% 13480 13490SYS"Wimp_OpenTemplate",,AppPath$+".Templates" 13500$string%="Info" 13510SYS"Wimp_LoadTemplate",,block%,infodata%,infodata%+2048,-1,string%,0 13520SYS"Wimp_CreateWindow",,block% TO whandle_info% 13530SYS"Wimp_CloseTemplate" 13540 13550RESTORE 13680 13560PROCsetupmenu(main_menu%) 13570 13580REM Install an icon on the icon bar using the shortcut icon 13590iconbarhandle%=FNcreate_icon(-2,0,-16,84,106,&1700310B,"!xuen",iconbarlabel%,iconbardata%,32) 13600 13610ENDPROC 13620 13630REM *************************************************** 13640REM *************************************************** 13650REM *************************************************** 13660REM *************************************************** 13670 13680DATA "Xuen",5 13690DATA 0,whandle_info%,"Info" 13700DATA 0,-1,"Clean Desk" 13710DATA 0,-1,"NoHourglass" 13720DATA 0,-1,"Edit Links" 13730DATA &80,-1,"Quit" 13740 13750REM ********************************************************* 13760 13770REM function to inform the wimp of the presence of an icon 13780DEFFNcreate_icon(whan%,ix%,iy%,iw%,ih%,flag%,text$,ptr1%,ptr2%,ptr3%) 13790!block%=whan% 13800block%!4=ix% 13810block%!8=iy% 13820block%!12=ix%+iw% 13830block%!16=iy%+ih% 13840block%!20=flag% 13850IF ptr1%=0 THEN 13860$(block%+24)=text$ 13870ELSE 13880block%!24=ptr1% 13890block%!28=ptr2% 13900block%!32=ptr3% 13910ENDIF 13920SYS"Wimp_CreateIcon",,block% TO ihandle% 13930=ihandle% 13940 13950REM ******************************************************** 13960 13970REM General mouse click handling routine. 13980REM Note to people who don't really have a clue about WIMP system: 13990REM All clickings on menus will never reach this procedure, 14000REM it deals with all clicks on windows and the iconbar. 14010DEFPROCclick(win%) 14020CASE win% OF 14030WHEN -2:PROCclick_iconbar(block%!8) 14040WHEN whandle_info%:PROCclick_info(block%!8) 14050ENDCASE 14060ENDPROC 14070 14080DEFPROCclick_iconbar(button%) 14090CASE button% OF 14100WHEN 0:PROCmove_overiconbar 14110WHEN 1:PROCclick_iconbaradjust 14120WHEN 2:PROCclick_iconbarmenu 14130WHEN 4:PROCclick_iconbarselect 14140ENDCASE 14150ENDPROC 14160 14170DEFPROCmove_overiconbar 14180IF IconBarMenuOpen%=1 iconbar_timerflag%=0 14190REM Is pointer over iconbar icon? If so inc iconbar_timer 14200IF (iconbar_timerflag%=0 AND IconBarMenuOpen%<>1) iconbar_timerflag%=1:iconbar_timer%=TIME 14210IF (((TIME-iconbar_timer%)>25) AND iconbar_timerflag%=1 AND OldToolTip%<>1) THEN 14220 REM What sort of tool tip? 14230 RSeed%=RND(-TIME) 14240 IF (RND(4)=1) THEN 14270 PROCOpenToolTip(2):iconbar_timerflag%=2 14271 ELSE 14280 PROCOpenToolTip(1):iconbar_timerflag%=2 14290 ENDIF 14291ENDIF 14300IF (((TIME-iconbar_timer%)>1000) AND ToolTip%>0) PROCPersistCloseToolTip:iconbar_timerflag%=0 14310ENDPROC 14320 14330DEFPROCclick_iconbargeneral 14340IF ToolTip%=1 PROCPersistCloseToolTip 14350SYS"Wimp_GetPointerInfo",,block% 14360override_tooltip%=1 14370IconBarMenuOpen%=1:REM Inhibit tool tip display over menu 14380IF (INKEY-1) THEN 14390PROCshowmenu(main_menu%,!block%-64, 96+(5*44)) 14400ELSE 14410PROCshowshortcutmenu(0) 14420ENDIF 14430ENDPROC 14440 14450DEFPROCclick_iconbarmenu 14460PROCclick_iconbargeneral 14470ENDPROC 14480 14490DEFPROCclick_iconbarselect 14500IF (INKEY-1) AND (INKEY-2) THEN 14510REM Open cache windows 14520PROCreopenfiler 14530ENDPROC 14540ENDIF 14550 14560IF (INKEY-2) THEN 14570REM Start drag to add a window 14580SYS"Wimp_GetPointerInfo",,block% 14590IF (block%!8) PROCinit_drag(add_window%) 14600ELSE 14610REM Click menu 14620PROCclick_iconbargeneral 14630ENDIF 14640ENDPROC 14650 14660DEFPROCclick_iconbaradjust 14670IF (INKEY-1) AND (INKEY-2) THEN 14680REM Close cache windows 14690PROCclosefiler:PROCCloseInfoBox 14700ENDPROC 14710ENDIF 14720IF (INKEY-2) THEN 14730SYS"Wimp_GetPointerInfo",,block% 14740REM Start drag to remove a window 14750IF (block%!8) PROCinit_drag(subtract_window%) 14760ELSE 14770PROCclick_iconbargeneral 14780ENDIF 14790ENDPROC 14800 14810DEFFNCheckLinksDirExists 14820LOCAL dir$,result% 14830dir$=AppPath$+".Users."+User$+".Links" 14840REM Does the Links directory exist? 14850$string%=dir$+CHR$0 14860SYS"OS_File",17,string% TO result% 14870REM If not, create one. 14880IF (result%=0) THEN OSCLI("CDIR "+dir$+CHR$0) 14890SYS"OS_File",17,string% TO result% 14900REM Has it created it? If not, error. 14910IF (result%=0) THEN 14920PROCerror("Fatal : Couldn't create "+dir$+CHR$0) 14930=0 14940ENDIF 14950=1 14960 14970DEFPROCensuredir(edir$) 14980LOCAL result% 14990REM Does the directory exist? 15000$string%=edir$+CHR$0 15010SYS"OS_File",17,string% TO result% 15020REM If not, create one. 15030IF (result%=0) THEN OSCLI("CDIR "+edir$+CHR$0) 15040SYS"OS_File",17,string% TO result% 15050REM Has it created it? If not, error. 15060IF (result%=0) THEN 15070PROCerror("Fatal : Couldn't create "+edir$+CHR$0) 15080REM =0 15090ENDIF 15100REM=1 15110ENDPROC 15120 15130REM ************************************************** 15140REM Start building the shortcutmenu 15150REM ************************************************** 15160DEFPROCshowshortcutmenu(arg%) 15170IF (ToolTip%=1) PROCPersistCloseToolTip 15180addlink%=arg% 15190IF (FNCheckLinksDirExists=0) ENDPROC 15200dirptr%(0)=shortcutmenu% 15210REM linkmenudepth%=0:REM At top level 15220 15230PROCSingleDirectoryRead(AppPath$+".Users."+User$+".Links", User$, 0) 15240initialmenusize%=dirlist%(0) 15250IF initialmenusize%=0 initialmenusize%=1 15260SYS"Wimp_GetPointerInfo",,block% 15270PROCshowmenu(shortcutmenu%,!block%-64, 96+((initialmenusize%)*44)) 15280ENDPROC 15290 15300 15310 15320REM ***************************************************** 15330REM Read contents of a directory into the menu data areas 15340REM ***************************************************** 15350DEFPROCSingleDirectoryRead(localdir$,dirfilename$,linkdepth%) 15360LOCAL oldlocaldir$,olddirfilename$,oldlinkdepth%, olddirptr% 15370LOCAL dirsize%, DirScan% 15380LOCAL dir$,next%,type%,item$,currentdir%,ptr% 15390LOCAL currentmenuptr%, locali%, width%,title$ 15400LOCAL TitlePtr%, MenuExtent% 15410LOCAL filetype%, filetypeinfo%,linktype%,objecttype%,linktypeinfo% 15420LOCAL ValidLoadFlag% 15430LOCAL CurrentLinkDepth% 15440LOCAL NumberOfLinks% 15450 15460CurrentLinkDepth%=linkdepth% 15470oldlocaldir$ = localdir$ 15480olddirfilename$ = dirfilename$ 15490oldlinkdepth% = linkdepth% 15500olddirptr%=dirptr%(oldlinkdepth%) 15510DirScan%=FALSE 15520 15530REPEAT:REM Repeat until loaded in directory with no errors 15540localdir$ = oldlocaldir$ 15550dirfilename$ = olddirfilename$ 15560linkdepth% = oldlinkdepth% 15570dirptr%(oldlinkdepth%)=olddirptr% 15580DirScan%=TRUE 15590 15600REM Calculate pointer to shortcutmenu% & index into 15610REM shortcutmenudata% 15620dir$=localdir$ 15630a%=0 15640currentmenuptr%=shortcutmenu% 15650i%=0 15660WHILE a%<linkdepth% 15670currentmenuptr%+=(28+(dirlist%(a%)*24)) 15680i%+=dirlist%(a%) 15690a%+=1 15700ENDWHILE 15710 15720REM Initialise start menu user/system seperator to be null 15730IF (linkdepth%=0) StartMenuSeperator%=-1 15740 15750REMPROCerror("MenuPtr = "+STR$~(currentmenuptr%)+CHR$0) 15760next%=0 15770numberofitems%=0 15780 15790REM Get number of items in current directory localdir$ 15800WHILE (next%<>-1) 15810$string%=dir$+CHR$0 15820SYS "OS_GBPB",10,string%,dblock%,1,next%,63,"*" TO ,,,number%,next% 15830IF next%<>-1 numberofitems%+=1 15840ENDWHILE 15850 15860 15870REMPROCerror("Directory size = "+STR$(numberofitems%)+CHR$0) 15880 15890dirlist%(linkdepth%)=numberofitems% 15900nextmenuptr%=currentmenuptr%+(28+(numberofitems%*24)) 15910dirptr%(linkdepth%+1)=nextmenuptr% 15920 15930locali%=i% 15940REM Build titleless menu 15950REM title$="Menu "+STR$(currentdir%)+CHR$0 15960IF (linkdepth%=1 AND LEFT$(dirfilename$,1)=CHR$(SysFilePrefix%)) THEN 15970 title$=RIGHT$(dirfilename$,LEN(dirfilename$)-1)+CHR$0 15980 ELSE 15990 title$=dirfilename$+CHR$0 16000ENDIF 16010 16020TitlePtr%=currentmenuptr% 16030$TitlePtr%=title$ 16040width%=(LEN(title$)-2)*16 16050currentmenuptr%!12 = &00070207 16060currentmenuptr%!20=44 16070currentmenuptr%!24=0 16080ptr%=currentmenuptr%+28 16090 16100next%=0 16110 16120NumberOfLinks%=numberofitems% 16130 16140WHILE (next%<NumberOfLinks% AND DirScan%=TRUE) 16150ValidLoadFlag%=TRUE 16160SYS "OS_GBPB",10,dir$,dblock%,1,next%,63,"*" 16170next%+=1 16180locali%=i% 16190REM Get Object type (2 = directory, 1 = file) 16200type% = dblock%?&10 16210REM Get name of this object 16220item$=FNgetname(dblock%+&14) 16230REM Get file attributes 16240filetypeinfo%= !dblock% >>> 20 16250filetype%=(!dblock% >> 8)AND &FFF 16260 16270REM Initialise menu object 16280!ptr%=8:REM mflags = &80 means last menu item 16290ptr%!4=-1:REM pointer to sub menu 16300REM Store this filer object, whatever it is 16310!(shortcutmenudata%+(locali%*64)+32+28) = type% 16320REM Is this object a directory? 16330IF (type% =2) THEN 16340 REM If so, then add to directory list 16350 $(shortcutmenudata%+(locali%*64)+32) = ""+CHR$0 16360 ptr%!4 = nextmenuptr%:REM Pointer to submenu 16370 ELSE 16380 REM This is a link and not a directory 16390 REM PROCerror("Processing "+item$+CHR$0) 16400 REM Get filetype of link object 16410 $string%=FNGetLinkContents(dir$+"."+item$)+CHR$0 16420 16430 IF (FNCheckValidDrive(FNstring(string%)) =1) THEN 16440 SYS "OS_File",17,string% TO objecttype%,,linkloadaddr% 16450 linktype%=(linkloadaddr%>>8) AND &FFF 16460 linktypeinfo%= linkloadaddr% >>> 20 16470 ELSE 16480 objecttype%=0 16490 ENDIF 16500 REMPROCerror(FNGetLinkContents(dir$+"."+item$)+" is a "+STR$(linktypeinfo%)+CHR$0) 16510 IF (objecttype%=0) THEN 16520 REM PROCerror("Error : Link("+FNGetLinkContents(dir$+"."+item$)+") not found."+CHR$0) 16530 REM Delete this link and rescan the directory 16540 REM Safety first - ensure this file is actually a link in 16550 REM case the <Start$Dir> system variable has become corrupt (!) 16560 IF (filetype%=&af3) THEN 16570 REM PROCerror("Invalid link "+dir$+"."+item$+" has been found and will be deleted when you click OK."+CHR$0) 16580 OSCLI("delete "+dir$+"."+item$+CHR$0) 16590 DirScan%=FALSE 16600 ValidLoadFlag%=FALSE 16610 ELSE 16620 PROCerror("Error: Another prog has altered the <Xuenbs$Dir> system variable or someone has placed a non-link "+dir$+"."+item$+" into the links directory. Rerun the !Xuen application or remove the offending file from the !Xuen.Links directory."+CHR$0) 16630 ENDIF 16640 16650 ENDIF 16660 16670 REM $(shortcutmenudata%+(locali%*64)+32) = "Ssmall_dir"+CHR$0 16680 16690 IF (objecttype%=1) THEN 16700 REM This link is a pointer to a file 16710 REM PROCerror(FNstring(string%)+" is a file"+CHR$0) 16720 $(shortcutmenudata%+(locali%*64)+32) = "Ssmall_"+STR$~(linktype%)+CHR$0 16730 ENDIF 16740 16750 REM For some wierd reason the following two variables must 16760 REM be evaluated outside of the objecttype test. I think 16770 REM it must be something to do with the pipeline and/or a 16780 REM bug in the BASIC rom. 16790 shriek%=ASC("!") 16800 namestart%=ASC(LEFT$(item$,1)) 16810 REM PROCerror(STR$(namestart%-shriek%)+CHR$0) 16820 IF (objecttype%=2) THEN 16830 REM This link is a pointer to an application or directory 16840 REM PROCerror(FirstChar$+CHR$0) 16850 IF (namestart%<>shriek%) THEN 16860 REM !ptr%=(!ptr%)+4 16870 $(shortcutmenudata%+(locali%*64)+32) = "Ssmall_dir"+CHR$0 16880 ELSE 16890 $(shortcutmenudata%+(locali%*64)+32) = "Ssm"+item$+CHR$0 16900 ENDIF 16910 ENDIF 16920 16930ENDIF 16940 16950REM Build rest of menu item attributes 16960ptr%!8=&7000313:REM icon type 16970REM IF (type%=2 AND objecttype%=0) ptr%!8=&7400313:REM Invalid line 16980IF (addlink%=1) ptr%!8=&3000313 16990$(shortcutmenudata%+(locali%*64))=item$+CHR$0 17000ptr%!12 = shortcutmenudata%+(locali%*64) 17010ptr%!16 = shortcutmenudata%+(locali%*64)+32 17020ptr%!20 = 28:REM menu item string buffer = 28 bytes 17030 17040IF (linkdepth%=0) THEN 17050IF (MID$(item$,1,1)=CHR$(SysFilePrefix%) AND StartMenuSeperator%<0) THEN 17060REM PROCerror("Name = "+FNstring(shortcutmenudata%+(locali%*64))+CHR$0) 17070StartMenuSeperator%=locali% 17080REM Does this item need a dotted line above it? 17090IF (locali%>0) !(ptr%-24)=(!(ptr%-24)) + 2 17100ENDIF 17110IF (locali%>=StartMenuSeperator% AND StartMenuSeperator%>=0) $(shortcutmenudata%+(locali%*64))=RIGHT$(item$,LEN(item$)-1)+CHR$0 17120ENDIF 17130 17140 17150a%=(LEN(item$)+4)*16 17160IF a%>width% width%=a% 17170ptr%+=24 17180i%+=1 17190ENDWHILE 17200 17210REM Has this list got anything in it? 17220IF (dirlist%(linkdepth%)>0) THEN 17230!(ptr%-24)=&88:REM Set last menu item 17240ELSE 17250width%=(LEN(title$)-2)*16 17260REM Make default first entry be greyed out label 'empty' 17270item$="Empty"+CHR$0 17280$(shortcutmenudata%+(locali%*64)+32) = ""+CHR$0 17290!ptr%=&88:REM mflags = &80 means last menu item 8=IssueWarn 17300ptr%!4=-1:REM pointer to sub menu 17310IF (addlink%=1) THEN 17320ptr%!8=&3000313:REM greyed out SELECTABLE icon type (Add link) 17330ELSE 17340ptr%!8=&2400B33:REM greyed out UNSELECTABLE icon type 17350ENDIF 17360$(shortcutmenudata%+(locali%*64))=item$ 17370$(ptr%+12)=item$ 17380ptr%!12 = shortcutmenudata%+(locali%*64) 17390ptr%!16 = shortcutmenudata%+(locali%*64)+32 17400ptr%!20 = 28:REM menu item string buffer = 28 bytes 17410a%=(LEN(item$)+4)*16 17420IF a%>width% width%=a% 17430i%+=1 17440ENDIF 17450REM Does this menu fit on the screen ? 17460REMMenuExtent% = MenuX%+(width% * MenuDirection%) 17470REMIF (MenuExtent%>OS_MX% OR MenuExtent%<0) THEN 17480REM title$="\"+title$ 17490REM $TitlePtr% = title$ 17500REM MenuDirection%=MenuDirection%*-1 17510REM REM Adjust width 17520REM IF ((LEN(title$)-2)*16) > width%) THEN 17530REM width%=(LEN(title$)-2)*16 17540REM ENDIF 17550REMENDIF 17560currentmenuptr%!16=width% 17570 17580REM ENDPROC 17590 17600REM End of directory scanning 17610UNTIL DirScan%=TRUE 17620dirlist%(linkdepth%)=numberofitems% 17630 17640IF (dirlist%(linkdepth%)=0) dirlist%(linkdepth%)=1 17650ENDPROC 17660 17670REM ************************************************* 17680REM A Submenu is about to open 17690REM ************************************************* 17700DEFPROCsubmenu_warning 17710LOCAL ptr%,localdir$,depth%,index%,selection%,leaf$,i% 17720localdir$=AppPath$+".Users."+User$+".Links" 17730REM Navigate menu index data to determine where we are 17740depth%=0 17750index%=0 17760ptr%=block%+32 17770WHILE !((block%+32)+(depth%*4)) <> -1 17780selection%=!((block%+32)+(depth%*4)) 17790leaf$=FNstring(shortcutmenudata%+((index%+selection%)*64)) 17800REM Is this a system directory name? 17810i%=selection% 17820IF (depth%=0 AND i%>=StartMenuSeperator% AND StartMenuSeperator%>=0) THEN 17830leaf$=CHR$(SysFilePrefix%)+leaf$ 17840ENDIF 17850localdir$=localdir$+"."+leaf$ 17860index%+=dirlist%(depth%) 17870depth%+=1 17880ENDWHILE 17890PROCSingleDirectoryRead(localdir$,leaf$,depth%) 17900SYS"Wimp_CreateSubMenu",,block%!20,block%!24,block%!28 17910ENDPROC 17920 17930REM ***************************************************** 17940REM Recursive Directory boot 17950REM ***************************************************** 17960DEFPROCDirectoryBoot(localdir$) 17970LOCAL dir$, next%,type%, item$, objectcount%, currentdir% 17980LOCAL number%,LD% 17990LOCAL linktype%,linkdir$ 18000dir$=localdir$ 18010next%=0 18020REMSYS"Hourglass_On" 18030WHILE next%<>-1 18040 18050PROCpoll 18060PROCpoll 18070 18080SYS "OS_GBPB",10,dir$,bootblock%,1,next%,63,"*" TO ,,,number%,next% 18090REM Get Object type (2 = directory, 1 = file) 18100type% = bootblock%?&10 18110REM Get name of this object 18120item$=FNgetname(bootblock%+&14) 18130REM Has this directory got anything in it? 18140IF (next%<>-1) THEN 18150 REM Is this a directory (ie type=2) 18160 IF (type%=2) THEN 18170 PROCDirectoryBoot(dir$+"."+item$) 18180 ELSE 18190 REM Must be a link to a file or application 18200 REM What type of thing does this link point to? 18210 REM PROCerror("Opening "+dir$+CHR$0) 18220 LD%=OPENIN(dir$+"."+item$+CHR$0) 18230 linkdir$="" 18240 REPEAT 18250 LD$=CHR$(BGET#LD%) 18260 IF (ASC(LD$)>31) linkdir$+=LD$ 18270 UNTIL ASC(LD$)<32 OR EOF#LD% 18280 CLOSE#LD% 18290 REM What type is the linkdir? 18300 $bootstring%=linkdir$+CHR$0 18310 IF (FNCheckValidDrive(linkdir$) =1) THEN 18320 SYS "XOS_File",5,bootstring% TO linktype% 18330 IF (LEFT$(item$,1)="!" OR linktype%<>2) THEN 18340 REM Must be either a file or app or dir so let's boot it 18350 REM If directory, only boot if begin with a ! (Save time) 18360 $clistring = "Filer_Boot "+linkdir$+CHR$0 18370 SYS "XOS_CLI", clistring 18380 ENDIF 18390 ENDIF 18400 ENDIF 18410ENDIF 18420ENDWHILE 18430REMSYS"Hourglass_Off" 18440ENDPROC 18450 18460DEFFNCheckValidDrive(isvpath$) 18470LOCAL fs_drive$, pptr%, char$, a% 18480REM Check that isvpath$ resides on a valid file system 18490REM and a valid drive. 18500REM If not then return 0 else return 1 18510pptr%=1 18520fs_drive$="" 18530REPEAT 18540char$=MID$(isvpath$,pptr%,1) 18550IF (char$<>".") fs_drive$=fs_drive$+char$ 18560pptr%=pptr%+1 18570UNTIL (pptr%>LEN(isvpath$) OR char$=".") 18580REM Check fs_drive$ with all currently invalid devices 18590a%=0 18600WHILE(a%<InvalidDriveCount%) 18610IF (fs_drive$=InvalidDrive$(a%)) a%=InvalidDriveCount%+1 18620a%+=1 18630ENDWHILE 18640REM return if it matches an invalid drive 18650IF (a%>InvalidDriveCount%) THEN =0 18660REM Is this device valid? 18670$clistring=fs_drive$+CHR$0 18680SYS"XOS_File",5,clistring TO result% 18690IF (result%<=8192) THEN 18700 REM This is a valid drive 18710 =1 18720ENDIF 18730REM Update list of invalid drives 18740InvalidDrive$(InvalidDriveCount%) = fs_drive$ 18750InvalidDriveCount%+=1 18760=0 18770 18780DEFFNGetLinkContents(glinkfilename$) 18790LOCAL linkdir$,LD% 18800 LD%=OPENIN(glinkfilename$+CHR$0) 18810 linkdir$="" 18820 REPEAT 18830 LD$=CHR$(BGET#LD%) 18840 IF (ASC(LD$)>31) linkdir$+=LD$ 18850 UNTIL ASC(LD$)<32 OR EOF#LD% 18860 CLOSE#LD% 18870 =linkdir$ 18880 18890 18900REM Extract the wstring stored at addr%. 18910DEF FNgetname(addr%) 18920LOCAL b$ 18930WHILE ?addr%>31 18940b$+=CHR$(?addr%) 18950addr%+=1 18960ENDWHILE 18970=b$ 18980 18990REM ************************************** 19000REM Click on shortcut menu list 19010REM ************************************** 19020DEFPROCshortcutmenuselect 19030LOCAL currentmenuptr%,dir$,linkdir$,dropdir$,currentdropdir$,leaf$ 19040LOCAL ReOpenFlag% 19050LOCAL IconFlagsAddr% 19060 19070ReOpenFlag%=FALSE 19080dir$=AppPath$+".Users."+User$+".Links" 19090dropdir$=dir$ 19100currentdropdir$=dir$ 19110currentmenuptr%=shortcutmenu% 19120globalmenuptr%=shortcutmenu% 19130REM block%+00 is selection number of menu, 19140nestlevel%=0 19150sel1%=block%!nestlevel% 19160 19170REM Recurse menu directory pointers until leaf node found 19180REPEAT 19190selection%=block%!(nestlevel%*4) 19200nextselection%=block%!((nestlevel%+1)*4) 19210REMPROCerror("Menu Selection = "+STR$(selection%)+CHR$0) 19220REM Get pointer to icon definition from menu definition 19230submenuptr%=!(currentmenuptr%+28+(selection%*24)+4) 19240dataptr%=!(currentmenuptr%+28+(selection%*24)+12) 19250leaf$=FNstring(dataptr%) 19260REM Is this a system file name? 19270 19280IF (selection%>=StartMenuSeperator% AND StartMenuSeperator%>=0 AND nestlevel%=0) leaf$=CHR$(SysFilePrefix%)+leaf$ 19290 19300currentdropdir$=dropdir$ 19310IF (selection%<>-1) THEN 19320 dir$=dir$+"."+leaf$ 19330 REM Is this menu entry a pointer to a submenu? 19340 IF (submenuptr%<>-1) THEN 19350 dropdir$=dropdir$+"."+leaf$ 19360 currentmenuptr%=submenuptr% 19370 nestlevel%+=1 19380 ENDIF 19390ENDIF 19400UNTIL nextselection%=-1 19410 19420IF (addlink%=1) THEN 19430REM PROCerror("Adding shortcut["+newlinkleaf$+"] into "+dropdir$+CHR$0) 19440PROCaddnewshortcut(currentdropdir$,newlinkfile$,newlinkleaf$) 19450ELSE 19460 REM Is this a valid object? 19470 IF (submenuptr%=-1) THEN 19480 REM Is the ALT key pressed? 19490 REM If so delete this link 19500 IF (INKEY-3) THEN 19510 OSCLI("delete "+dir$+CHR$0) 19520 REM Alter menu structure 19530 IconFlagsAddr%=currentmenuptr%+28+8+(selection%*24) 19540 !IconFlagsAddr% = (!IconFlagsAddr%)+(2^22):REM Grey out sprite 19550 !IconFlagsAddr% = !IconFlagsAddr% AND &ffffff:REM Grey out 19560 !IconFlagsAddr% = !IconFlagsAddr%+&1000000:REM text 19570 ELSE 19580 REM Get the desktop filer to run this link 19590 dir$="Filer_Run "+FNGetLinkContents(dir$) 19600 REM PROCerror("OSCLI "+dir$+CHR$0) 19610 OSCLI(dir$+CHR$0) 19620 ENDIF 19630 ENDIF 19640 REM Check if ADJUST pressed in which case, reprint menus. 19650 SYS"Wimp_GetPointerInfo",,block2% 19660 button%=block2%!8 19670IF button%=1 ReOpenFlag%=TRUE 19680 19690IF (ReOpenFlag%) THEN 19700 PROCshowmenu(shortcutmenu%,0,0) 19710 ELSE 19720 IconBarMenuOpen%=0:REM Reenable icon bar tooltip 19730ENDIF 19740ENDIF 19750ENDPROC 19760 19770DEFPROCclick_info(button%) 19780CASE button% OF 19790WHEN 2:PROCshowmenu(main_menu%,!block%-64, (block%!4)+32) 19800ENDCASE 19810ENDPROC 19820 19830DEFPROCmenuselect 19840LOCAL Skronky% 19850Skronky%=currentmenu% 19860CASE Skronky% OF 19870WHEN main_menu%:PROCmainmenuselect 19880WHEN shortcutmenu%:PROCshortcutmenuselect 19890ENDCASE 19900ENDPROC 19910 19920DEFPROCmainmenuselect 19930REM block%+00 is selection number of first menu, 19940REM block%+04 is selection number of second level etc. 19950sel1%=!block%:sel2%=block%!4 19960SYS"Wimp_GetPointerInfo",,block% 19970button%=block%!8 19980CASE sel1% OF 19990WHEN 0:PROCOpenInfoBox 20000WHEN 1:PROCclear 20010WHEN 2:PROCsmash 20020WHEN 3:PROCOpenLinks 20030WHEN 4:quit%=TRUE 20040ENDCASE 20050REM Check if ADJUST pressed in which case, reprint menus. 20060IF button%=1 THEN 20070PROCshowmenu(main_menu%,0,0) 20080ELSE 20090IconBarMenuOpen%=0:REM Reenable icon bar tooltip 20100ENDIF 20110ENDPROC 20120 20130DEFPROCOpenLinks 20140OSCLI("Filer_Opendir "+AppPath$+".Users."+User$+".Links"+CHR$0) 20150ENDPROC 20160 20170DEFPROCshowmenu(menu%,mx%,my%) 20180currentmenu%=menu% 20190SYS"Wimp_CreateMenu",,menu%,mx%,my% TO currentmenuhandle% 20200ENDPROC 20210 20220REM *************************************************** 20230 20240DEFPROCclear 20250X%=OPENOUT(AppPath$+".Users."+User$+".~~Open"):CLOSE#X% 20260X%=OPENOUT(AppPath$+".Users."+User$+".~~Close"):CLOSE#X% 20270PROCloadcache 20280ENDPROC 20290 20300REM ******************************************************* 20310 20320DEFPROCsmash 20330OSCLI("Close") 20340SYS"Hourglass_Smash" 20350ENDPROC 20360 20370REM ******************************************************* 20380 20390REM Tell WIMP to initialise a new menu. 20400REM This should really be done by loading in a MENU template. 20410DEFPROCsetupmenu(menu%) 20420READ title$,num%:$menu%=title$ 20430width%=(LEN(title$)-2)*16 20440menu%!12=&00070207:menu%!20=44:menu%!24=0 20450ptr%=menu%+28:FOR i%=1TOnum% 20460READ mflags%,subptr%,item$ 20470!ptr%=mflags%:ptr%!4=subptr% 20480ptr%!8=&7000021:$(ptr%+12)=item$ 20490a%=(LEN(item$)+1)*16 20500IF a%>width% width%=a% 20510ptr%+=24:NEXT 20520menu%!16=width% 20530ENDPROC 20540 20550REM ***************************************************** 20560 20570REM function to deal with errors 20580DEFPROCerror(err$) 20590!errorblock%=255 20600$(errorblock%+4)=err$+CHR$0 20610SYS "Wimp_ReportError",errorblock%,1,app$ 20620ENDPROC 20630 20640REM ***************************************************** 20650DEFPROCOpenFSView 20660 20670ENDPROC 20680REM ***************************************************** 20690DEFPROCCloseFSView 20700 20710ENDPROC 20720REM *****************************************************
5� *********************************************** � Name : Xuen � Version : 7.00 (2� Purpose : Make RiscOS Desktop more efficient 2� Author : Barny Short <� Date : 08-Mar-1998 F5� *********************************************** P� Revision history : Z4� 24-Aug-1997 Added Quickfile Icon to iconbar. d1� Clicking on icon open/closes. n-� 25-Aug-1997 Added ShortCuts facility. x2� Similar feature to Win95 tool. �6� 04-Sep-1997 Added nested directories facility. �0� Changed Shift+IconbarMenu to �/� include EditLinks facility. �5� Changed name to Start and changed �0� shortcuts directory to Links �/� 05-Sep-1997 Changed way window cache is �5� administered. Became version 2.00 �1� 06-Sep-1997 Changed format of link files. �2� Added entire boot at start up. �0� 07-Sep-1997 Fixed a mother of a bug that �5� probably has something to do with �1� the pipeline. Also added much �.� more intelligent file type � checking. 2� 14-Sep-1997 General improvements regarding ,� drag'n'drop and tooltip. ")� 04-Nov-1997 Changed icon bar icon ,1� 05-Nov-1997 Added the ~ history directory 61� to catch all double clicks on @� file icons. J4� Also added a ~~ directory. Can't T#� think what for. ^2� Fixed the EMPTY directory bug. h3� Changed action of TOOL_TIP when r3� pointer moved over it so now it |)� gets 'pushed' around. �5� 06-Nov-1997 Changed how destination directory �4� is selected for ADDNEWLINK. User �5� now has to explicitly move to the �"� required menu. �2� Created system directorys that �4� begin with a ~ symbol. These are �1� updated with a history of the �(� desktop filer usage. �2� 07-Nov-1997 Built the Alias$Link run tool. �1� Fixed a SysFilePrefix related �+� shortcutmenuselect bug. �1� Added icon bar toggle feature �5� when mouse hits bottom of screen. 1� Added ALT-START_MENU click to 3� efficiently delete items in the !� startup menu. &4� 09-Nov-1997 Added auto cascading for desktop 03� windows. Some windows are never :-� auto cascaded. These are: D)� a) The Tooltip window N/� b) Start's dummyback window X4� c) Any window toggled full size, b,� that has input focus, l.� and a toggle size icon. v3� 09-Nov-1997 Added animated iconbar icon and �*� alternative tool tips. �0� 11-Nov-1997 Added selective cascading of �3� windows to reduce difficulty in �0� using menus. Changed Iconbar �2� button usage and 'alternative' �� tool tips. �5� 19-Nov-1997 Added sensible task bar tool tip. �.� Included AppPath$ to guard �3� against the <Start$Dir> getting �� corrupted. �-� Added extra checks before �0� deleteing auto-create links. �0� Auto ensure ~ directorys are 3� there whenever they are needed. 1� 21-Nov-1997 Disabled window repositioning 1� when a menu is displayed with $� MenuIsOpenFlag%. *0� 21-Nov-1997 Added window drifting. Added 43� dragable yes/no icons to window >%� cache management. H,� 22-Nov-1997 Ensured all windows were R4� properly cascaded, even if still \0� waiting for a state to occur f0� when they were allowed to be p� moved. z2� 22-Feb-1998 Changed name of application to �0� Xuen, and system variable to �4� <Xuenbs$Dir> to reflect initials �1� of programmer. A millenium of �0� dire satanic consequences to �5� anyone who changes this variable. �0� 08-Mar-1998 Added 4s delay to writing of �2� desktop filer grabbed links to �4� disk. Forced new folder links to �2� overwrite old ones if still in �0� cache. Forced links still in �/� cache to be written to disc �3� forcefully if a new cache entry �2� appears (except folder links). �,� 08-Mar-1998 Changed tool tips again. 5� *********************************************** � Note: 3� When running this program, it is important $2� to ensure that the corresponding !Boot or .2� !run file is run at the same time because 8/� they ensure the system variable is set B5� correctly. ie. Use the !Run file to run this L� file. V5� *********************************************** ` j PictureType%=&d94:� Artworks t,DocumentType%=&bc5:� Impression Document ~&User$="Admin":� User name is Admin � �app$="Xuen" �AppPath$="" �AppDate$="" �/� apppath 255, apppathvar 32, appdatevar 32 �*$appdatevar="<Sys$Time> <Sys$Date>"+�0 �!$apppathvar="<Xuenbs$Dir>"+�0 � �8� Aquire the start path to use for delete operations �)È™"OS_GSTrans",apppathvar,apppath,255 �AppPath$=�string(apppath) � @� errorblock% 2048, block% 2048, block2% 2048, clistring 255 � winblock% 2048 � InvalidDrive$(255) (InvalidDriveCount%=0 2 <,� dragspritename% 32, boundspritebox% 32 F P'� � �error(�$+" at line "+Þ):�#0:� Z d � Auto link buffer add stuff nalba_destinationdir$="" x-alba_type%=-1:� -1 means nothing in cache �alba_newlinkfile$="" �alba_newlinkleaf$="" �alba_time%=0 � �CACHE_SIZE% = 4096 �pause% = 200 �open_type%=1 �close_type%=2 �add_window%=1 �subtract_window%=2 �drag_type%=5 � adjust%=1 �menu%=2 select%=4 iconbarhandle%=0 dircount%=0 "linkloadaddr%=0 ,objecttype%=0 6linkmenu%=0 @addlink%=0 J)iconbar_timer%=�:iconbar_timerflag%=0 T2whandle_tooltip%=0:ToolTip%=0:tooltip_timer%=0 ^%override_tooltip%=0:OldToolTip%=0 hinternalstackposition%=-2 roldstackposition%=0 |currentwindow%=0 �currentmenuhandle%=0 �firstmenuhandle%=-3 �IconBarMenuOpen%=0 �StartMenuSeperator%=-1 �SysFilePrefix%=126 �BottomEdgeFlag=0 �after%=0:cascade%=0 �whandle_dummyback%=0 �LastRightEdge%=0 �CascadeRow%=0 �RandTipMax%=13 �� RandTip$(RandTipMax%) RandTip$(1)="LSD" RandTip$(2)="Opium" !RandTip$(3)="Magic Mushrooms" &RandTip$(4)="Mescaline" 0RandTip$(5)="Peyote" :'RandTip$(6)="Lophophora Williamsii" DRandTip$(7)="Trips" NRandTip$(8)="Acid" XRandTip$(9)="Speed" b%RandTip$(10)="Mind Bending Drugs" lRandTip$(11)="Psychedelics" vRandTip$(12)="Fun" wRandTip$(13)="Cannabis" � �IconBarAnimSize%=11 �$� IconBarAnim$(IconBarAnimSize%) �IconBarAnim$(0)="Sxuen0" �IconBarAnim$(1)="Sxuen1" �IconBarAnim$(2)="Sxuen2" �IconBarAnim$(3)="Sxuen3" �IconBarAnim$(4)="Sxuen4" �IconBarAnim$(5)="Sxuen5" �IconBarAnim$(6)="Sxuen6" �IconBarAnim$(7)="Sxuen7" �IconBarAnim$(8)="Sxuen8" �IconBarAnim$(9)="Sxuen9" IconBarAnim$(10)="Sxuen10" IconBarAnimStep=0 IconBarAnimDir=0.5 * 4MenuIsOpenFlag%=0 >ReorganiseWindowStack=0 H RQ� dblock% 1024, bootblock% 1024, shortcutmenu% 10192, shortcutmenudata% 20384 \E� main_menu% 256, typebuf% 256, iconbarlabel% 32, iconbardata% 32 fY� string% 1024, bootstring% 1024, infodata% 2048, tooltipdata% 2048, tooltipicon% 512 p� cache% CACHE_SIZE% z� dirlist%(32), dirptr%(32) � �currentmenu%=main_menu% �cache_ext%=0 �task_handle%=0 �drag_button%=adjust% � DX%=0 �drag_icon%=0 �path$="" �in_leftregion=� �in_rightregion=� �qf_timer=� �regionxs%=16 �regionys%=64 $iconbarlabel%="Xuen"+�0 $iconbardata%="S!xuen"+�0 globalmenuptr%=shortcutmenu% $ .$iconbarlabel%=""+�0 8$$iconbardata%=IconBarAnim$(0)+�0 B L V9� *************************************************** ` jquit%=� t ~ �init �-�PROCerror("Xuen path = "+AppPath$+CHR$0) ��CreateToolTip ��loadcache �5�DirectoryBoot(AppPath$+".Users."+User$+".Links") � �ȕ � quit% � �poll �� � ��DestroyToolTip �ș "Wimp_CloseDown" �� 9� *************************************************** ��GetDate (� Aquire date and time 2)È™"OS_GSTrans",appdatevar,apppath,255 <AppDate$=�string(apppath) F� P Z9� *************************************************** d n� poll loop x ��poll �$È™"Wimp_Poll",0,block% � reason% �2� IF reason%<>0 PROCerror(STR$(reason%)+CHR$0) �Ȏ reason% � �� 0:�null_reason �� 2:�PollReason2 �%� 3:È™ "Wimp_CloseWindow",,block% �� 6:�click(block%!12) �� 7:�dragdrop �� WHEN 8:PROCkeypressed �� 9:�menuselect �� 17,18:�receive(reason%) �9� WHEN 19:PROCerror("Unsupported window definition.") �� � 9� *************************************************** " ,��PollReason2 6� ((!block%) > &ffff) � @X� PROCerror("Window tobeopened:"+STR$~(!block%)+" behind: "+STR$~(block%!28)+CHR$0) J È™ "Wimp_OpenWindow",,block% T� ^.�currentwindow%=!block%:PROCOpenToolTip(2) hA� This is very wierd - the windowhandle is invalid and equals r?� the mouse pointer x position - must be a menu I reckon or |� could be a bug in RISCOS. �MenuIsOpenFlag%=1 �� � �� � ���GetScreenSize �3È™"OS_ReadModeVariable",-1,4 � ,,OS_EX%:� Eigen �+È™"OS_ReadModeVariable",-1,5 � ,,OS_EY% �3È™"OS_ReadModeVariable",-1,11 � ,,OS_WX%:� Size �,È™"OS_ReadModeVariable",-1,12 � ,,OS_WY% �OS_MX%=(1+OS_WX%) << OS_EX% �OS_MY%=(1+OS_WY%) << OS_EY% �� �DEFPROCkeypressed �LOCAL Char% &�Char%=block%!24 0-�REM Is this the delete or backspace key? :#�IF (Char%=8 OR Char%=&7f) THEN D�REM Is this in a menu? N^�PROCerror("Window handle = "+STR$~(block%!0)+" -- main_menu% = "+STR$~(main_menu%)+CHR$0) X �ELSE b �SYS "Wimp_ProcessKey",Char% l �ENDIF v�ENDPROC � ���ReopenDummyWindow � !block2%=whandle_dummyback% �% È™"Wimp_GetWindowState",,block2% �% block2%!8=-1024:block2%!16=-1024 � block2%!28=-2 �" È™"Wimp_OpenWindow",,block2% �) after%=whandle_dummyback%:cascade%=0 � MenuIsOpenFlag%=0 � �8 � (ReorganiseWindowStack=2) ReorganiseWindowStack=0 �9 � (ReorganiseWindowStack=1) ReorganiseWindowStack+=1 �� � �cascade � q%,OldAfter% � sx%, sy%, ox%, oy% *� ReopenFlag%, StackFlag% 4-� PaneFlag%, IsOpenFlag%, IsMoveableFlag% >� CurrentWin%,CurrentIcon% H Rq%=winblock% \PaneFlag%=� f p2� Get Current window immediately under pointer z$È™"Wimp_GetPointerInfo",,block2% �CurrentWinPtr%=block2%!12 �CurrentIcon%=block2%!16 � �OldAfter%=after% �!q%=after% �.� _Try_ and reopen this desktop window ... �!È™ "XWimp_GetWindowState",,q% �?� (after%=-1 � ReorganiseWindowStack=1)�ReopenDummyWindow:� �CurrentWin%=!q% �after%=q%!28 �-� (CurrentWin%=-1 � (after%=OldAfter%)) � � �ReopenDummyWindow �� � Reposition window 2 � (cascade%=0) CascadeRow%=0:LastRightEdge%=0 / � !q%=after%:SYS "Wimp_GetWindowState",,q% $ . 8 PaneFlag%=� B2 � (((q%!32) � ((2^22)+(2^23)))>0) PaneFlag%=� L& � (((q%!32) � 32)=32) PaneFlag%=� V% IsOpenFlag% = ((q%!32) � (2^16)) `$ IsMoveableFlag% = ((q%!32) � 2) j1 � Has window moved at all for repositioning? t ~ ReopenFlag%=� � StackFlag%=� ��� IF (((q%!32) AND (2^18))>0 AND ((q%!32) AND (2^20))>0 AND ((q%!32) AND (2^27))>0) StackFlag%=FALSE:ReopenFlag%=FALSE:REM Toggled Maximise & has input focus & has toggle icon ��� (CurrentWin%=CurrentWinPtr% � ((q%!32) � (2^28))=0 � ((q%!32) � (2^30))=0 � ((q%!32) � (2^17))>0 � after%=-1) StackFlag%=�:ReopenFlag%=�:� Under pointer and _no_ horiz/vert scroll bars and fully visible (likely to be part of menu so leave alone) ��� (((q%!32) � (2^18))>0 � ((q%!32) � (2^27))>0 � ((q%!32) � (2^28))>0 � ((q%!32) � (2^30))>0) StackFlag%=�:ReopenFlag%=�:� Toggled Maximise & has toggle icon and has horiz/vert scroll bars - likely to be a word processor window ��� ( (q%!16 < (OS_MY%-(cascade%*40))) � (q%!4 > 0) � (q%!12 < (OS_MX%-40)) � (q%!8>40) � ((q%!32) � (2^17))>0) StackFlag%=�:ReopenFlag%=�:� Fully visible �@ � (CurrentWin%=whandle_tooltip%) StackFlag%=�:ReopenFlag%=� �B � (CurrentWin%=whandle_dummyback%) StackFlag%=�:ReopenFlag%=� �/ � (PaneFlag%=�) StackFlag%=�:ReopenFlag%=� �E � (IsOpenFlag%=0 � IsMoveableFlag%=0) StackFlag%=�:ReopenFlag%=� �5 � (MenuIsOpenFlag%=1) StackFlag%=�:ReopenFlag%=� �8� If pointer is over window and within the work area �� then don't move it. 0� (CurrentWin%=CurrentWinPtr%) ReopenFlag%=� 0 � Reset position of window and do a Re-Open � Get size of window � (StackFlag%=�) � ( ox%=q%!4 2 oy%=q%!16 < sx%=(q%!12)-(q%!4) F sy%=(q%!16)-(q%!8) P Z# � (ReorganiseWindowStack>0) � d> � Try and fit as many windows horizontally as possible n. � ((LastRightEdge%+sx%)<(OS_MX%-40)) � x q%!4=LastRightEdge% �2 q%!16=(OS_MY%-40)-(CascadeRow%*40):� 1160 � q%!12=(q%!4)+sx% �2 � ((q%!12)>(OS_MX%-40)) q%!12=(OS_MX%-40) � q%!8=(q%!16)-sy% � � ((q%!8)<40) q%!8=40 �" LastRightEdge%=(q%!12)+48 � � � LastRightEdge%=0 � CascadeRow%+=1 � q%!4=(CascadeRow%*8) �2 q%!16=(OS_MY%-40)-(CascadeRow%*40):� 1160 � q%!12=(q%!4)+sx% �2 � ((q%!12)>(OS_MX%-40)) q%!12=(OS_MX%-40) q%!8=(q%!16)-sy% � ((q%!8)<40) q%!8=40 " LastRightEdge%=(q%!12)+48 " � , 6 @ J � REM Enable window 'drift' T� IF (ox%<>q%!4) THEN ^� nx%=q%!4 h� sx%=(q%!12)-(q%!4) r� dx%=nx%-ox% |� IF (ABS(dx%)>40) THEN �� nx%=ox%+(SGN(dx%)*40) �� q%!4=nx%:q%!12=nx%+sx% � � ENDIF �� ENDIF �� IF (oy%<>q%!16) THEN �� ny%=q%!16 �� sy%=(q%!16)-(q%!8) �� dy%=ny%-oy% �� IF (ABS(dy%)>40) THEN �� ny%=oy%+(SGN(dy%)*40) �� q%!16=ny%:q%!8=ny%-sy% � � ENDIF �� ENDIF 5 � Having allowed space for this window in the 5 � window cascade, are we sure we want to move & � it just yet? 0 : � (ReopenFlag%=�) � D0 È™ "XWimp_SendMessage",2,q%,CurrentWin% N � X. �:� End of IF (ReorganiseWindowStack) ... b l cascade%+=1 v � � � � �� � �3� ********************************************* �3� * Animate the icon bar icon * �3� ********************************************* ���AnimateIconBar �/$iconbardata%=IconBarAnim$(IconBarAnimStep) �#IconBarAnimStep+=IconBarAnimDir �>� (IconBarAnimStep<0 � IconBarAnimStep=IconBarAnimSize%) � �IconBarAnimStep=0 �)� IconBarAnimDir = IconBarAnimDir*-1 %� IconBarAnimStep+=IconBarAnimDir � 3� Activate an update on the task bar icon ..... !block2%=-2 *block2%!4=iconbarhandle% 4"È™"Wimp_GetIconState",,block2% >(block2%!8=0:� Don't change anything, H,block2%!12=0:� Just signal an update ... R"È™"Wimp_SetIconState",,block2% \� f p3� ********************************************* z2� What shall we do during the idle wimp poll ? �/� This is the most important aspect of this �2� program and one which should enable a lot of �2� change with future versions of the software. �3� ********************************************* ���null_reason � � window% �#È™"Wimp_GetPointerInfo",,block% � ��alba_purge(400) � �X%=block%!0 �Y%=block%!4 �window%=block%!12 currentwindow%=window% �GetScreenSize $$� Are any mouse buttons pressed? ..� If not then reorganise [cascade] windows 8� (((block%!8) � 7)=0) � B �cascade L� V `-� Update the task bar icon each WIMP POLL j�AnimateIconBar t ~-� If the task bar tool tip shows the TIME �� then update it ... �%� (ToolTip%=1) �UpdateToolTipTime � �#È™"Wimp_GetPointerInfo",,block% �X%=block%!0 �Y%=block%!4 �window%=block%!12 �currentwindow%=window% � �(� This may be needed to stop flicker �� *fx19 � �ENDIF #�IF (qf_timer>0) PROCfocusdelay � (X%<regionxs%) � �left_corner:� (� 2� (X%>(OS_MX%-regionxs%)) � <�right_corner:� F� P#� Is Pointer over iconbar icon? ZC� Close tooltip if pointer moves over it (effectively push tip) dl� IF (((block%!12)=-2 AND (block%!16=iconbarhandle%)) OR (window%=whandle_tooltip% AND ToolTip%>0)) THEN n7� (((block%!12)=-2 � (block%!16=iconbarhandle%))) � x�move_overiconbar �� �OldToolTip%=0 � �9�IF (((TIME-tooltip_timer%)>100) AND ToolTip%>0) THEN �� (ToolTip%>0) � �:� (block%!16 <> whandle_tooltip%) iconbar_timerflag%=0 ��CloseToolTip �� ��iconbar_timer%=TIME �iconbar_timerflag%=0 �� �� �(�IF (window%=-2) firstmenuhandle%=-2 A�IF (window%<>-2) PROCpointernotoniconbar:REM Must come first I� ((X%>regionxs% � X%<(OS_MX%-regionxs%)) � Y%>regionys%) �outoffocus S�IF ((X%>regionxs% AND X%<(OS_MX%-regionxs%)) AND Y%=0) PROCpointeronbottomedge "� (Y%=0) � ,-� (BottomEdgeFlag=0) �pointeronbottomedge 6� @BottomEdgeFlag=0 J� T ^�PROCCloseToolTip h�PROCOpenToolTip(2) r� | �9� *************************************************** � ���pointeronbottomedge �� stackposition% �4� Is iconbar at top of stack? If not make it so. ��SYS"Wimp_ProcessKey",&1dc � �0� PROCerror("Pointer on bottom edge."+CHR$0) �1� Open up start menu if it's not already open �BottomEdgeFlag=1 �ReorganiseWindowStack=1 �� Close relevant window ��SYS "Wimp_CreateMenu",,-1 � Open start menu �PROCclick_iconbarmenu �ENDPROC & 0�!block%=-2 :%�SYS"Wimp_GetWindowState",,block% D�stackposition%=block%!28 N!�IF (stackposition%<>-1) THEN X�block%!28=-1 b!�SYS"Wimp_OpenWindow",,block% l � Toggle icon bar back/front vÈ™"Wimp_ProcessKey",&1dc � �0� Reopen dummyback window at bottom of stack �!block%=whandle_dummyback% �#È™"Wimp_GetWindowState",,block% �"block%!8=-1024:block%!16=-1024 �block%!28=-2 �ș"Wimp_OpenWindow",,block% �(after%=whandle_dummyback%:cascade%=0 � �� � ���pointernotoniconbar � � ENDPROC 7� Is iconbar on bottom of stack? If not make it so/ =� No allowed to manually open iconbar so use our internal � value G� (ToolTip%=0 � (ToolTip%<>0 � currentwindow%<>whandle_tooltip%)) � *9� firstmenuhandle%=-2 firstmenuhandle%=currentwindow% 4� > H!block%=-2 R#È™"Wimp_GetWindowState",,block% \stackposition%=block%!28 f/�IF (stackposition%=oldstackposition%) THEN p+� (stackposition%<>oldstackposition%) � z�block%!28=-2 �"�SYS"Wimp_CloseWindow",,block% �@� (currentwindow%<>firstmenuhandle% � firstmenuhandle%>-2) � �ș"Wimp_ProcessKey",&1dc �firstmenuhandle%=-3 � �ENDIF �!block%=-2 �#È™"Wimp_GetWindowState",,block% �stackposition%=block%!28 �=�IF (stackposition%<>-1) oldstackposition%=stackposition% �$oldstackposition%=stackposition% �� �� �� >� IF (internalstackposition%=-1 AND currentwindow%>0) THEN � SYS"Wimp_ProcessKey",&1dc $7� PROCerror("Window : "+STR$(currentwindow%)+CHR$0) .-� internalstackposition%=-2:REM At bottom 8� ENDIF B � ENDPROC L V��outoffocus `(� (in_leftregion) � �leaveleftregion j*� (in_rightregion) � �leaverightregion tqf_timer=� ~� � ���leaveleftregion �in_leftregion=� �� � ���leaverightregion �in_rightregion=� �� � ���focusdelay �6� ((�-pause%)>qf_timer) � qf_timer=-1:�OpenInfoBox �� ��left_corner ,� (in_leftregion=�) ec_timer=�:ec_flag=� in_leftregion=� (#� Check if windows need opening 2$� (�-ec_timer>=50 � ec_flag=�) � <�reopenfiler:ec_flag=� F� P Z� d n��right_corner x-� (in_rightregion=�) ec_timer=�:ec_flag=� �in_rightregion=� �#� Check if windows need closing �3�IF (TIME-ec_timer>=100 AND ec_flag=FALSE) THEN �� (ec_flag=�) � �'�closefiler:�CloseInfoBox:ec_flag=� �� �� � �9� *************************************************** � ���OpenInfoBox �!block%=whandle_info% �#È™"Wimp_GetWindowState",,block% È™"Wimp_OpenWindow",,block% � "��CloseInfoBox ,!block%=whandle_info% 6 È™"Wimp_CloseWindow",,block% @� J T9� *************************************************** ^ h��CreateToolTip r� XOffset% |1� Create the tooltip and dummy global windows �6� The tooltip window displays brief info about the �� icon under the pointer. �6� The dummy window is needed to provide a 'bottom' �3� window for the window re-organisation tool to �� start from. � �� Create the tooltip window �Tip$="Hello" �XS%=(�(Tip$)*16)+20:YS%=40 �#È™"Wimp_GetPointerInfo",,block% �'� Define screen position of tooltip �XOffset%=XS%/2 �� (XOffset%>32) XOffset%=32 X%=(!block%)-XOffset% Y%=(block%!4)+24 �GetScreenSize &%� ((X%+XS%)>OS_MX%) X%=OS_MX%-XS% 0� (X%<0) X%=0 :.� ((Y%+YS%)>OS_MY%) Y%=(block%!4)-(YS%+24) D� IF ((Y%-YS%)<0) Y%=0 N;!block%=X%:block%!4=Y%:block%!8=X%+XS%:block%!12=Y%+YS% XXS%=(512*16)+20:YS%=40 b,block%!16=0:block%!20=0:� Scroll offsets l:block%!24=-1:block%!28=&80000050:� Depth, window flags v3block%!32=&00070207:block%!36=&120103:� Colours �8block%!40=0:block%!44=-YS%:block%!48=XS%:block%!52=0 �;block%!56=&19:block%!60=3<<12:� Titlebar/workarea flags �)block%!64=0:block%!68=0:� Sprite area �$(block%+72)=�0 �block%!84=1 �)� Define 1 icon starting at block%!88 �,!tooltipicon%=0:� Null validation string �)$(tooltipicon%+4)=Tip$+�0:� Icon text �block%!88=4:� Bounding box � block%!92=-40:� Bounding box �;block%!96=((512*16)+20):� Bounding box of _largest_ tip �block%!100=0:� Bounding box �block%!104=&17003101 block%!108=tooltipicon%+4 block%!112=tooltipicon% "block%!116=512:� Buffer length 4È™"Wimp_CreateWindow",,block% � whandle_tooltip% *XS%=(�(Tip$)*16)+20:YS%=40 4#È™"Wimp_GetPointerInfo",,block% >'� Define screen position of tooltip HXOffset%=XS%/2 R� (XOffset%>32) XOffset%=32 \X%=(!block%)-XOffset% f�GetScreenSize p%� ((X%+XS%)>OS_MX%) X%=OS_MX%-XS% z� (X%<0) X%=0 �.� ((Y%+YS%)>OS_MY%) Y%=(block%!4)-(YS%+24) �Y%=-1024 �� IF ((Y%-YS%)<0) Y%=0 �� Get Tooltip window state �!block%=whandle_tooltip% �#È™"Wimp_GetWindowState",,block% �?block%!4=X%:block%!8=-1024:block%!12=X%+XS%:block%!16=-1024 �,block%!20=0:block%!24=0:� Scroll offsets �� block%!28=-1 �ș"Wimp_OpenWindow",,block% �ToolTip%=0 � � "� Create the dummy back window '� Define screen position of tooltip $XS%=(�(Tip$)*16)+20:YS%=40 .XOffset%=XS%/2 8� (XOffset%>32) XOffset%=32 B X%=64 LY%=-1024 V;!block%=X%:block%!4=Y%:block%!8=X%+XS%:block%!12=Y%+YS% `XS%=(512*16)+20:YS%=40 j,block%!16=0:block%!20=0:� Scroll offsets t:block%!24=-1:block%!28=&80000050:� Depth, window flags ~3block%!32=&00070207:block%!36=&120103:� Colours �8block%!40=0:block%!44=-YS%:block%!48=XS%:block%!52=0 �;block%!56=&19:block%!60=3<<12:� Titlebar/workarea flags �)block%!64=0:block%!68=0:� Sprite area �$(block%+72)=�0 �block%!84=1 �)� Define 1 icon starting at block%!88 �,!tooltipicon%=0:� Null validation string �)$(tooltipicon%+4)=Tip$+�0:� Icon text �block%!88=4:� Bounding box � block%!92=-32:� Bounding box �;block%!96=((512*16)+20):� Bounding box of _largest_ tip � block%!100=-8:� Bounding box block%!104=&17003101 block%!108=tooltipicon%+4 block%!112=tooltipicon% "block%!116=512:� Buffer length (6È™"Wimp_CreateWindow",,block% � whandle_dummyback% 2� Get Tooltip window state <!block%=whandle_dummyback% F#È™"Wimp_GetWindowState",,block% Pblock%!28=-2 ZÈ™"Wimp_OpenWindow",,block% d(after%=whandle_dummyback%:cascade%=0 n x� � ���DestroyToolTip �!block%=whandle_tooltip% � È™"Wimp_CloseWindow",,block% �!È™"Wimp_DeleteWindow",,block% � �!block%=whandle_dummyback% � È™"Wimp_CloseWindow",,block% �!È™"Wimp_DeleteWindow",,block% �� � ���UpdateToolTipTime �� XOffset%, OldTip$ OldTip$=Tip$ �GetDate Tip$=AppDate$ "� (OldTip$<>Tip$) � ,3� IF (TipID%=1) Tip$="after% = &"+STR$~(after%) 6XS%=(�(Tip$)*16)+20:YS%=40 @$È™"Wimp_GetPointerInfo",,block2% J!� Adjust Tooltip window state T!block2%=whandle_tooltip% ^$È™"Wimp_GetWindowState",,block2% hX%=block2%!4 rY%=block2%!8 |!block2%=whandle_tooltip% �Ablock2%!4=X%:block2%!8=Y%:block2%!12=X%+XS%:block2%!16=Y%+YS% �.block2%!20=0:block2%!24=0:� Scroll offsets �block2%!28=-1 �)$(tooltipicon%+4)=Tip$+�0:� Icon text �"�SYS"Wimp_OpenWindow",,block2% �� Update icon �!block2%=whandle_tooltip% �block2%!4=0 �"È™"Wimp_GetIconState",,block2% �(block2%!8=0:� Don't change anything, �,block2%!12=0:� Just signal an update ... �"È™"Wimp_SetIconState",,block2% �� � ��OpenToolTip(TipID%) &"� XOffset%, RandTipID%, RSeed% 0� (TipID%=ToolTip%) � : � (ToolTip%>0) �CloseToolTip D� Create ToolTip Window N� (TipID%=1) � X �GetDate b Tip$=AppDate$ l� v� (TipID%=2) � � � Tip$="Click for more ..." � Tip$="" � RandTipID%=�(RandTipMax%) �$ Tip$=Tip$+RandTip$(RandTipID%) �� �;� (TipID%=3) Tip$="currentwindow% = "+�(currentwindow%) �3� IF (TipID%=1) Tip$="after% = &"+STR$~(after%) �XS%=(�(Tip$)*16)+20:YS%=40 �#È™"Wimp_GetPointerInfo",,block% �'� Define screen position of tooltip �XOffset%=XS%/2 !� (XOffset%>32) XOffset%=32 !X%=(!block%)-XOffset% !Y%=(block%!4)+24 ! �GetScreenSize !*%� ((X%+XS%)>OS_MX%) X%=OS_MX%-XS% !4� (X%<0) X%=0 !>.� ((Y%+YS%)>OS_MY%) Y%=(block%!4)-(YS%+24) !H� IF ((Y%-YS%)<0) Y%=0 !R !\!� Adjust Tooltip window state !f!block%=whandle_tooltip% !p#È™"Wimp_GetWindowState",,block% !z!block%=whandle_tooltip% !�=block%!4=X%:block%!8=Y%:block%!12=X%+XS%:block%!16=Y%+YS% !�,block%!20=0:block%!24=0:� Scroll offsets !�block%!28=-1 !�)$(tooltipicon%+4)=Tip$+�0:� Icon text !�ș"Wimp_OpenWindow",,block% !�ToolTip%=TipID% !�tooltip_timer%=� !�� !� !���CloseToolTip !�� (ToolTip%=0) � !�!block%=whandle_tooltip% !�#È™"Wimp_GetWindowState",,block% "!block%=whandle_tooltip% "block%!8=-1024 "block%!16=-1024 "$È™"Wimp_OpenWindow",,block% "."�SYS"Wimp_CloseWindow",,block% "8$� SYS"Wimp_DeleteWindow",,block% "BToolTip%=0 "L� "V "`��PersistCloseToolTip "j� (ToolTip%=0) � "tOldToolTip%=ToolTip% "~�!block%=whandle_tooltip% "�"�SYS"Wimp_CloseWindow",,block% "�!block%=whandle_tooltip% "�#È™"Wimp_GetWindowState",,block% "�!block%=whandle_tooltip% "�block%!8=-1024 "�block%!16=-1024 "�ș"Wimp_OpenWindow",,block% "�$� SYS"Wimp_DeleteWindow",,block% "�ToolTip%=0 "�� "� "�9� *************************************************** # # ��init_drag(icon%) #qf_timer=-1 ##È™"Wimp_GetPointerInfo",,block% #(ox%=block%!0 #2oy%=block%!4 #<block%!4=icon% #Fdrag_icon%=icon% #Pblock%!4=drag_type% #Zblock%!8=ox%-32 #dblock%!12=oy%-32 #nblock%!16=ox%+32 #xblock%!20=oy%+32 #�block%!24=&80000000 #�block%!28=&80000000 #�block%!32=&7FFFFFFF #�block%!36=&7FFFFFFF #�ș"Wimp_DragBox",,block% #� #�� Start a sprite drag .... #�3� (icon%=add_window%) $dragspritename%="yes"+�0 #�7� (icon%=subtract_window%) $dragspritename%="no"+�0 #�!boundspritebox%=0 #�boundspritebox%!4=0 #�boundspritebox%!8=ox%+24 #�boundspritebox%!12=oy%+24 $FÈ™"DragASprite_Start",2+8+64+128,1,dragspritename%,boundspritebox% $� $ $"��dragdrop $,#È™"Wimp_GetPointerInfo",,block% $6block%!20=block%!12 $@block%!24=block%!16 $Jblock%!28=!block% $Tblock%!32=block%!4 $^block%!36=0 $h!block%=64:block%!12=0 $rblock%!16=1:block%!40=&fff $|$(block%+44) ="" $�6È™"Wimp_SendMessage",18,block%,block%!20,block%!24 $� $�"� Cancel a sprite drag ....... $�ș"DragASprite_Stop" $�� $� $�9� *************************************************** $� $�ݤstring(ptr%) $�� a$ $�ȕ ?ptr%<>0 � �(a$)<254 $�a$+=�(?ptr%):ptr%+=1 $�� %=a$ % %ݤget_line(filehandle%) %&� a$,z% %0z%=0 %: a$="" %D� %N+� (�(�#filehandle%)) � z%=�#filehandle% %X� z%>=32 a$+=�(z%) %b� z%<32 � �#filehandle% %l =a$+�0 %v %���put_line(filehandle%, A$) %�� a$,z% %�z%=1 %��z%=1� �(A$) %�a$=�A$,z%,1) %�&� (�(a$)>0) � �#filehandle%, �(a$) %�� %��#filehandle%, 10 %�� %� %�9� *************************************************** %� %���loadcache &cache_ext%=0 & !cache%=0 &,� Load in commands to open filer display & /F%=�(AppPath$+".Users."+User$+".~~open"+�0) &*� &4A$=�get_line(F%) &>,� A$<>"" � �add_to_cache(A$, open_type%) &H � �#F% &R�#F% &\-� Load in commands to close filer display &f0F%=�(AppPath$+".Users."+User$+".~~close"+�0) &p� &zA$=�get_line(F%) &�-� A$<>"" � �add_to_cache(A$, close_type%) &� � �#F% &��#F% &�� &� &���add_to_cache(com$, type%) &�record_size%=�(com$)+1+2 &ʃ� (record_size%>255) � �error("Path too big! Please shrink !Xuen and reorganise your (lengthy labeled) directory structure.") &�%?(cache%+cache_ext%)=record_size% &� ?(cache%+cache_ext%+1)=type% &��X%=1 � �(com$) &�,?(cache%+cache_ext%+1+X%)=�(�com$,X%,1)) &�� '@?(cache%+cache_ext%+1+X%)=0:� Add terminating zero to string 'cache_ext%+=record_size% 'i� (cache_ext%>CACHE_SIZE%) � �error("Too many windows! Please increase CACHE_SIZE% and rerun !Xuen.") '$@?(cache%+cache_ext%)=0:� Initialise next record size to NULL '.� '8 'B9� *************************************************** 'L 'V��cache_open '`cache_ptr%=0 'j� 't r_size%=?(cache%+cache_ptr%) '~ type%=?(cache%+cache_ptr%+1) '�K� (r_size%>0 � type%=open_type%) � �execute_string(cache%+cache_ptr%+2) '�cache_ptr%+=r_size% '��r_size%=0 '� '��OpenFSView '�� '� '���cache_close '�cache_ptr%=0 '�� '� r_size%=?(cache%+cache_ptr%) '� type%=?(cache%+cache_ptr%+1) ( L� (r_size%>0 � type%=close_type%) � �execute_string(cache%+cache_ptr%+2) ( cache_ptr%+=r_size% (�r_size%=0 ( ((�CloseFSView (2� (< (F��execute_string(str_ptr%) (PA$=�string(str_ptr%) (Z� A$<>"" � �(A$) (d� (n (x9� *************************************************** (� (���reopenfiler (��cache_close (��cache_open (�� (� (���closefiler (��cache_close (�� (� (�9� *************************************************** (� (���savedesktop )!DX%=�(AppPath$+".tmpfile"+�0) )dblock%!0=28 )dblock%!4=task_handle% )"dblock%!12=0 ),dblock%!16=10 )6dblock%!20=DX% )@dblock%!24=0 )J%È™"Wimp_SendMessage",17,dblock%,0 )T� )^ )h6� ************************************************ )r'� Get leaf name of a full path name )|6� ************************************************ )�ݤGetLeafName(ptr%) )�� a$,leafptr%,size% )�� Determine size of zstring )�size%=0 )�ȕ ?(ptr%+size%)>31 )�size%+=1 )�� )�"� Determine offset of leafname )�leafptr%=size% )�.È• (?(ptr%+leafptr%)<>�(".")) � leafptr%>0 )�leafptr%-=1 )�� )�leafptr%+=1 *� Build leafname * a$="" *È• leafptr%<size% *&a$+=�(?(ptr%+leafptr%)) *0leafptr%+=1 *:� *D=a$ *N *X6� ************************************************ *b-� function to deal with incoming messages *l6� ************************************************ *v��receive(reason%) *�message%=block%!16 *�4� PROCerror("Message : &"+STR$~(message%)+CHR$0) *�Ȏ message% � *�� 0:quit%=� *��� 3:�data_load_add_link:� PROCerror("DataLoad:"+FNstring(block%+44)+" Leafname:"+FNGetLeafName(block%+44)+" Type:&"+STR$~(!(block%+40))+CHR$0) *�� 2:�data_ack *�� 5:�data_open *�� 10:�desktop_ack *�� &400C0:�submenu_warning *�� &400C9:IconBarMenuOpen%=0 *�� *�� *� ++� User has double clicked on a fileicon +=� Response - store a link to this file in the ~ directory +��data_open + � type%, destinationdir$ +* +4$� Flush cache if stuff in it ... +>8� (alba_type%>0 � alba_type%<>4096) � �alba_purge(0) +H +R(alba_newlinkfile$=�string(block%+44) +\-alba_newlinkleaf$=�GetLeafName(block%+44) +ftype%=!(block%+40) +palba_type%=type% +z,� PROCerror("Type = "+STR$(type%)+CHR$0) +�6destinationdir$=AppPath$+".Users."+User$+".Links." +� +� +�� (type%=4096) � +�!� Store this directory access +�?destinationdir$=destinationdir$+�(SysFilePrefix%)+"Folders" +�� +� +�� (type%=8192) � +�#� Store this application access +�@destinationdir$=destinationdir$+�(SysFilePrefix%)+"Programs" +�� +� ,� (type%<4096) � , � (type%=DocumentType%) � ,A destinationdir$=destinationdir$+�(SysFilePrefix%)+"Document" ,$ � ,. ,8 � (type%=PictureType%) � ,B@ destinationdir$=destinationdir$+�(SysFilePrefix%)+"Picture" ,L � ,V ,`5 � (type%<>PictureType% � type%<>DocumentType%) � ,j> destinationdir$=destinationdir$+�(SysFilePrefix%)+"Files" ,t � ,~� ,� ,�(alba_destinationdir$=destinationdir$ ,�alba_time%=� ,�� ,� ,���autoaddnewshortcut ,�� autodropdirectory$ ,�#� number%, next%,numberofitems% ,�>� oldestdate%,oldestname$,oldesttype%,oldestnext%,oldnext% ,�� delstring$ ,�-autodropdirectory$ = alba_destinationdir$ ,�"�ensuredir(autodropdirectory$) - 4� Auto insert directorys have a limit of 9 items - � Is link directory empty? -numberofitems%=0 -next%=0 -(oldestdate%=0 -2&È•(next%<>-1 � numberofitems%<=16) -<"$string%=autodropdirectory$+�0 -Foldnext%=next% -PEÈ™ "OS_GBPB",11,string%,dblock%,1,next%,63,"*" � ,,,number%,next% -Z� next%<>-1 � -dnumberofitems%+=1 -n|� ((dblock%!24)<oldestdate% � oldestdate%=0) oldestdate%=dblock%!24:oldestname$=�string(dblock%+29):oldestnext%=oldnext% -x� -�� -�� (numberofitems%<9) � -�& � If so then automatically insert -�L �addnewshortcut(autodropdirectory$,alba_newlinkfile$,alba_newlinkleaf$) -�� -�+ � Intelligently delete an old file and -� � Get filetype of this file -�# $string%=autodropdirectory$+�0 -�9 È™ "OS_GBPB",12,string%,dblock%,1,oldestnext%,63,"*" -� oldesttype%=dblock%!20 -�^ � PROCerror("Oldest file to remove : "+oldestname$+" of type "+STR$~(oldesttype%)+CHR$0) -�- � Delete the oldest link in this dir ... -�: � Final check - !Start can only remove a file if it's .6 � filetype is &af3 ... (Precaution against error) . � (oldesttype%=&af3) � .< delstring$="delete "+autodropdirectory$+"."+oldestname$ ."4 � PROCerror("about to OSCLI "+delstring$+CHR$0) ., �(delstring$+�0) .6 � insert a new one ... .@L �addnewshortcut(autodropdirectory$,alba_newlinkfile$,alba_newlinkleaf$) .J � .T� .^alba_type%=-1 .h� .r .|2� Prompt user to select directory for new link .���data_load_add_link .�*� path$,leaf$,type%,leafptr%,linkname$ .� � (�CheckLinksDirExists=0) � .�path$=�string(block%+44) .�!leaf$=�GetLeafName(block%+44) .�type%=!(block%+40) .�6linkname$=AppPath$+".Users."+User$+".Links."+leaf$ .�newlinkleaf$=leaf$ .�#newlinkfile$=�string(block%+44) .�� Is link directory empty? .�1$string%=AppPath$+".Users."+User$+".Links"+�0 .�;È™ "OS_GBPB",10,string%,dblock%,1,0,63,"*" � ,,,number% .�� number%=0 � /4� If so then automatically add to root directory /P�addnewshortcut(AppPath$+".Users."+User$+".Links",newlinkfile$,newlinkleaf$) /� /&�showshortcutmenu(1) /0� /:� /D /N,� Add new link to the shortcut directory /XF��addnewshortcut(dropdirectory$,add_newlinkfile$,add_newlinkleaf$) /b� linkname$,leafptr% /l1linkname$=dropdirectory$+"."+add_newlinkleaf$ /v $string%=add_newlinkfile$+�0 /�C�PROCerror("Contents of "+linkname$+"="+add_newlinkfile$+CHR$0) /�leafptr%=string% /�8� Check to see if this file already exists and if so /�� prompt for overwrite. /�X%=�(linkname$+�0) /�ȕ((?leafptr%) > 31) /��#X%, ?leafptr% /�leafptr%+=1 /�� /�&�#X%, 10:� Output a terminating LF /��#X% /�� Set type appropriately /�%�("SetType "+linkname$+" af3"+�0) 0� 0 0��alba_purge(expiry%) 0 � (alba_type%<0) � � 0*.� (expiry%>0 � (alba_time%+expiry%)>�) � � 04�autoaddnewshortcut 0>� 0H 0R��data_ack 0\� Store path in temp string 0fpath$=�string(block%+44) 0ppath$=�path$) 0zdhandle%=block%!20 0�#� �path$,"<Wimp$ScrapDir>")>0 � 0�' �IF (drag_icon%=add_window%) THEN 0�@ �error("You can't add that to the Filer window cache."+�0) 0� �ENDIF 0� � 0�� 0�� Compile desktop boot file 0�ș"Hourglass_On" 0�-� (drag_icon%=add_window%) � �savedesktop 0�6� (drag_icon%=subtract_window%) � �subtract_window 0�� 0� 0���desktop_ack 16� If we get a desktop_ack then that means that all 19� applications have responded to the request to write 1� to the desktop boot file. 1$� (DX%<>0) � �#DX%:DX%=0 1.*� drag_icon%=add_window% � �add_window 18� 1B 1L9� *************************************************** 1V 1`��add_window 1j9� Go through desktop bootfile looking for path string 1t9� If this line contains path_string then add relevant 1~'� line of boot file to config file. 1�newline$="" 1� X%=�(AppPath$+".tmpfile"+�0) 1�� 1�A$=�get_line(X%) 1�path_start%=�A$, path$) 1�path_length%=�(path$) 1�f� (�A$, "Filer_OpenDir")>0 � path_start%>0 � �(�A$,path_start%+path_length%,1))<=32) � newline$=A$ 1� � �#X% 1��#X% 1�7� No serious precautions needed here because of the 1� � file name used ... tmpfile 1�'�("Delete "+AppPath$+".tmpfile"+�0) 2 2 /X%=�(AppPath$+".Users."+User$+".~~Open"+�0) 2 �#X%=�#X% 2�put_line(X%, newline$) 2(�#X% 22 2<0X%=�(AppPath$+".Users."+User$+".~~Close"+�0) 2F �#X%=�#X% 2P*�put_line(X%, "Filer_CloseDir "+path$) 2Z�#X% 2d� Re-initialise the Cache 2n�loadcache 2xÈ™"Hourglass_Off" 2�� 2� 2�9� *************************************************** 2� 2���subtract_window 2�/X%=�(AppPath$+".Users."+User$+".~~Open"+�0) 2�0Y%=�(AppPath$+".Users."+User$+".tmpfile"+�0) 2�� 2�A$=�get_line(X%) 2�path_start%=�A$, path$) 2�path_length%=�(path$) 2�k� (�A$, "Filer_OpenDir")=0 � path_start%=0 � �(�A$,path_start%+path_length%,1))>32) � �put_line(Y%, A$) 2� � �#X% 3�#X% 3�#Y% 36�("Delete "+AppPath$+".Users."+User$+".~~Open"+�0) 3"K�("Rename "+AppPath$+".tmpfile "+AppPath$+".Users."+User$+".~~Open"+�0) 3, 360X%=�(AppPath$+".Users."+User$+".~~Close"+�0) 3@ Y%=�(AppPath$+".tmpfile"+�0) 3J� 3TA$=�get_line(X%) 3^path_start%=�A$, path$) 3hpath_length%=�(path$) 3rl� (�A$, "Filer_CloseDir")=0 � path_start%=0 � �(�A$,path_start%+path_length%,1))>32) � �put_line(Y%, A$) 3| � �#X% 3��#X% 3��#Y% 3�7�("Delete "+AppPath$+".Users."+User$+".~~Close"+�0) 3�L�("Rename "+AppPath$+".tmpfile "+AppPath$+".Users."+User$+".~~Close"+�0) 3�� Re-initialise the Cache 3��loadcache 3�ș"Hourglass_Off" 3�� 3� 3�9� *************************************************** 3�9� *************************************************** 3�9� *************************************************** 3�9� *************************************************** 4 4 ��init 4=� Do ~~Open and ~~Close files exist? If not, create empty 4&0� copies of them to prevent !Start crashing. 40!�ensuredir(AppPath$+".Users") 4:(�ensuredir(AppPath$+".Users."+User$) 4D1�ensuredir(AppPath$+".Users."+User$+".Links") 4N 4X/$string%=AppPath$+".Users."+User$+".~~Open" 4b$È™"OS_File",17,string% � result% 4lA� (result%=0) � X%=�(AppPath$+".Users."+User$+".~~Open"):�#X% 4v0$string%=AppPath$+".Users."+User$+".~~Close" 4�$È™"OS_File",17,string% � result% 4�B� (result%=0) � X%=�(AppPath$+".Users."+User$+".~~Close"):�#X% 4� 4�PÈ™ "Wimp_Initialise",200,&4B534154,app$ � current_wimp_version%,task_handle% 4� 4�0È™"Wimp_OpenTemplate",,AppPath$+".Templates" 4�$string%="Info" 4�GÈ™"Wimp_LoadTemplate",,block%,infodata%,infodata%+2048,-1,string%,0 4�1È™"Wimp_CreateWindow",,block% � whandle_info% 4�ș"Wimp_CloseTemplate" 4� 4� � �Dpu 4��setupmenu(main_menu%) 5 5=� Install an icon on the icon bar using the shortcut icon 5`iconbarhandle%=�create_icon(-2,0,-16,84,106,&1700310B,"!xuen",iconbarlabel%,iconbardata%,32) 5 5*� 54 5>9� *************************************************** 5H9� *************************************************** 5R9� *************************************************** 5\9� *************************************************** 5f 5p� "Xuen",5 5z� 0,whandle_info%,"Info" 5�� 0,-1,"Clean Desk" 5�� 0,-1,"NoHourglass" 5�� 0,-1,"Edit Links" 5�� &80,-1,"Quit" 5� 5�?� ********************************************************* 5� 5�<� function to inform the wimp of the presence of an icon 5�Fݤcreate_icon(whan%,ix%,iy%,iw%,ih%,flag%,text$,ptr1%,ptr2%,ptr3%) 5�!block%=whan% 5�block%!4=ix% 5�block%!8=iy% 5�block%!12=ix%+iw% 6block%!16=iy%+ih% 6block%!20=flag% 6� ptr1%=0 � 6$$(block%+24)=text$ 6.� 68block%!24=ptr1% 6Bblock%!28=ptr2% 6Lblock%!32=ptr3% 6V� 6`*È™"Wimp_CreateIcon",,block% � ihandle% 6j =ihandle% 6t 6~>� ******************************************************** 6� 6�+� General mouse click handling routine. 6�D� Note to people who don't really have a clue about WIMP system: 6�=� All clickings on menus will never reach this procedure, 6�:� it deals with all clicks on windows and the iconbar. 6���click(win%) 6� ÈŽ win% � 6�!� -2:�click_iconbar(block%!8) 6�)� whandle_info%:�click_info(block%!8) 6�� 6�� 6� 7 ��click_iconbar(button%) 7 ÈŽ button% � 7� 0:�move_overiconbar 7� 1:�click_iconbaradjust 7(� 2:�click_iconbarmenu 72� 4:�click_iconbarselect 7<� 7F� 7P 7Z��move_overiconbar 7d-� IconBarMenuOpen%=1 iconbar_timerflag%=0 7n;� Is pointer over iconbar icon? If so inc iconbar_timer 7xX� (iconbar_timerflag%=0 � IconBarMenuOpen%<>1) iconbar_timerflag%=1:iconbar_timer%=� 7�I� (((�-iconbar_timer%)>25) � iconbar_timerflag%=1 � OldToolTip%<>1) � 7� � What sort of tool tip? 7� RSeed%=�(-�) 7� � (�(4)=1) � 7�* �OpenToolTip(2):iconbar_timerflag%=2 7� � 7�* �OpenToolTip(1):iconbar_timerflag%=2 7� � 7�� 7�X� (((�-iconbar_timer%)>1000) � ToolTip%>0) �PersistCloseToolTip:iconbar_timerflag%=0 7�� 7� 7���click_iconbargeneral 8%� ToolTip%=1 �PersistCloseToolTip 8#È™"Wimp_GetPointerInfo",,block% 8override_tooltip%=1 8";IconBarMenuOpen%=1:� Inhibit tool tip display over menu 8, � (�-1) � 86/�showmenu(main_menu%,!block%-64, 96+(5*44)) 8@� 8J�showshortcutmenu(0) 8T� 8^� 8h 8r��click_iconbarmenu 8|�click_iconbargeneral 8�� 8� 8���click_iconbarselect 8�� (�-1) � (�-2) � 8�� Open cache windows 8��reopenfiler 8�� 8�� 8� 8� � (�-2) � 8� � Start drag to add a window 8�#È™"Wimp_GetPointerInfo",,block% 8�(� (block%!8) �init_drag(add_window%) 9� 9� Click menu 9�click_iconbargeneral 9&� 90� 9: 9D��click_iconbaradjust 9N� (�-1) � (�-2) � 9X� Close cache windows 9b�closefiler:�CloseInfoBox 9l� 9v� 9� � (�-2) � 9�#È™"Wimp_GetPointerInfo",,block% 9�#� Start drag to remove a window 9�-� (block%!8) �init_drag(subtract_window%) 9�� 9��click_iconbargeneral 9�� 9�� 9� 9�ݤCheckLinksDirExists 9�� dir$,result% 9�*dir$=AppPath$+".Users."+User$+".Links" 9�%� Does the Links directory exist? :$string%=dir$+�0 :$È™"OS_File",17,string% � result% :� If not, create one. : &� (result%=0) � �("CDIR "+dir$+�0) :*$È™"OS_File",17,string% � result% :4'� Has it created it? If not, error. :>� (result%=0) � :H.�error("Fatal : Couldn't create "+dir$+�0) :R=0 :\� :f=1 :p :z��ensuredir(edir$) :� � result% :�� Does the directory exist? :�$string%=edir$+�0 :�$È™"OS_File",17,string% � result% :�� If not, create one. :�'� (result%=0) � �("CDIR "+edir$+�0) :�$È™"OS_File",17,string% � result% :�'� Has it created it? If not, error. :�� (result%=0) � :�/�error("Fatal : Couldn't create "+edir$+�0) :�� =0 :�� :��=1 ;� ; ;8� ************************************************** ;$%� Start building the shortcutmenu ;.8� ************************************************** ;8��showshortcutmenu(arg%) ;B'� (ToolTip%=1) �PersistCloseToolTip ;Laddlink%=arg% ;V � (�CheckLinksDirExists=0) � ;`dirptr%(0)=shortcutmenu% ;j'� linkmenudepth%=0:REM At top level ;t ;~E�SingleDirectoryRead(AppPath$+".Users."+User$+".Links", User$, 0) ;� initialmenusize%=dirlist%(0) ;�+� initialmenusize%=0 initialmenusize%=1 ;�#È™"Wimp_GetPointerInfo",,block% ;�C�showmenu(shortcutmenu%,!block%-64, 96+((initialmenusize%)*44)) ;�� ;� ;� ;� ;�;� ***************************************************** ;�;� Read contents of a directory into the menu data areas ;�;� ***************************************************** ;�<��SingleDirectoryRead(localdir$,dirfilename$,linkdepth%) <