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