home *** CD-ROM | disk | FTP | other *** search
RISC OS BBC BASIC V Source | 1993-03-02 | 8.4 KB | 376 lines |
- ><BasCrunch$Dir>.!RunImage
- This application is FreeWare. (c) 1993 Dick Alstein
- error
- quit%=
- .mask%=(1<<4)+(1<<5)+(1<<7)+(1<<11)+(1<<12)
- "Wimp_Poll",mask%,blk%
- reason%
- reason%
- (
- 2 :
- "Wimp_OpenWindow",,blk%
- )
- 3 :
- "Wimp_CloseWindow",,blk%
- ?
- 6 :
- mouseclick(blk%!0,blk%!4,blk%!8,blk%!12,blk%!16)
-
- 7 :
- startsavedialogue
- *
- 8 :
- "Wimp_ProcessKey",blk%!24
- 9 :
- menuselect(blk%)
- 1
- 17,18 :
- receive(blk%!4,blk%!8,blk%!16)
- quit%
- "Wimp_CloseDown"
- defaultstatus
- keeprems%=
- keepemptylines%=
- keepvarnames%=
- keepprocnames%=
- keepswinames%=
- nomultilines%=
- editableoutput%=
- make0rem%=
- $(exceptionsfname%)=""
- errbox(err$,boxes%)
- errblk%!0=0
- $(errblk%+4)=err$+
- "Wimp_ReportError",errblk%,boxes%,Appl$
- ,click%
- =(click%=1)
- error
- "Wimp_CloseDown" :
- errbox(
- $+" (line "+
- )+")",3)
- "Wimp_CloseDown"
- Appl$="BasCrunch"
- errblk% &100
- "Wimp_Initialise",200,&4B534154,Appl$
- ,thistask%
- error
- scrapblk% 64
- blk% &500
- indsize%=&400
- indir% indsize%
- indirend%=indir%+indsize%
- ptrinfo% 24
- scrapblk%!0=-1
- >!scrapblk%!4=0 : scrapblk%!8=0
- ?%scrapblk%!12=68 : scrapblk%!16=68
- scrapblk%!20=&7000301A
- A $(scrapblk%+24)="!bascrunch"
- "Wimp_CreateIcon",,scrapblk%
- baricon%
- "Wimp_OpenTemplate",,"<BasCrunch$Dir>.Templates"
- D"infowin%=
- loadtemplate("Info")
- E$optwin%=
- loadtemplate("Options")
- F'exceptionsfname%=blk%!(92+13*32+20)
- G%savewin%=
- loadtemplate("SaveBox")
- H savefname%=blk%!(92+0*32+20)
- "Wimp_CloseTemplate"
- initmenus
- readscreenvars
- loadstatus
- selecticon(optwin%,2,
- keeprems%)
- selecticon(optwin%,3,
- keepemptylines%)
- selecticon(optwin%,4,
- keepvarnames%)
- selecticon(optwin%,5,
- keepprocnames%)
- selecticon(optwin%,6,
- keepswinames%)
- selecticon(optwin%,7,
- nomultilines%)
- selecticon(optwin%,8,editableoutput%)
- selecticon(optwin%,9,make0rem%)
- shadeicons
- initmenus
- "MenuUtil_Initialise",010,0
- "MenuUtil_New",,Appl$
- mainmenu%
- "MenuUtil_Add",mainmenu%,"Info"
- item_info%
- "MenuUtil_Add",mainmenu%,"Options..."
- item_options%
- "MenuUtil_Add",mainmenu%,"Quit"
- item_quit%
- "MenuUtil_SubMenu",item_info%,infowin%
- leafname(f$)
- p%,q%
- p%=q%+1
- q%=
- f$,".",p%)
- q%=0
- f$,p%)
- loadstatus
- efn$
- m$F%=
- ("<BasCrunch$Dir>.Options")
- #F% :
- error :
- defaultstatus :
- #F%,keeprems%,keepemptylines%,keepvarnames%,keepprocnames%
- #F%,keepswinames%,nomultilines%,editableoutput%,make0rem%
- #F%,efn$
- $(exceptionsfname%)=efn$
- loadtemplate(name$)
- handle%
- "Wimp_CloseTemplate" :
- error
- "Wimp_LoadTemplate",,blk%+4,indir%,indirend%,-1,name$,0
- ,,indir%
- "Wimp_CreateWindow",,blk%+4
- handle%
- =handle%
- menuselect(selection%)
- "Wimp_GetPointerInfo",,ptrinfo%
- selection%!0
- blk%!0=optwin%
- &
- "Wimp_GetWindowState",,blk%
- "
- "Wimp_OpenWindow",,blk%
- quit%=
- (ptrinfo%!8
- showmenu(0)
- mouseclick(xpos%,ypos%,button%,wndw%,icon%)
- wndw%
- button%
-
-
- showmenu(blk%)
-
- blk%!0=optwin%
- *
- "Wimp_GetWindowState",,blk%
- &
- "Wimp_OpenWindow",,blk%
-
- optwin%
- icon%
- %
- 2 : keeprems%=
- keeprems%
- 1
- 3 : keepemptylines%=
- keepemptylines%
- -
- 4 : keepvarnames%=
- keepvarnames%
-
- shadeicons
- /
- 5 : keepprocnames%=
- keepprocnames%
- -
- 6 : keepswinames%=
- keepswinames%
- -
- 7 : nomultilines%=
- nomultilines%
- 1
- 8 : editableoutput%=
- editableoutput%
- %
- 9 : make0rem%=
- make0rem%
-
-
- savestatus
-
- scrapblk%!0=optwin%
- ,
- "Wimp_CloseWindow",,scrapblk%
-
- savewin%
- icon%
-
- 1 :
- startsavedrag
-
- readscreenvars
- xeig%,yeig%,xpixels%,ypixels%
- "OS_ReadModeVariable",-1,4
- ,,xeig%
- "OS_ReadModeVariable",-1,5
- ,,yeig%
- "OS_ReadModeVariable",-1,11
- ,,xpixels%
- "OS_ReadModeVariable",-1,12
- ,,ypixels%
- Escreensize_x%=(xpixels%+1)*(1<<xeig%) :
- screen size in OS units
- )screensize_y%=(ypixels%+1)*(1<<yeig%)
- receive(sender%,ref%,code%)
- ack%,icon%,window%,fname$,ftype%,fsize%
- ack%=0
- sender% <> thistask%
- code%
- 0 : quit%=
- $ outputfname$=
- str(blk%+44)
-
- startcrunch
- ack%=3
- window%=blk%!20
- icon%=blk%!24
- fname$=
- str(blk%+44)
- ftype%=blk%!40
- -
- (window%=optwin%)
- (ftype%=&FFF)
-
- icon%
-
- 10,11,12,13
- * $(exceptionsfname%)=fname$
- )
- selecticon(optwin%,13,0)
-
-
- 9
- (window%=-2)
- (icon%=baricon%)
- (ftype%=&FFB)
- inputfname$=fname$
- inputfsize%=blk%!36
- + $(savefname%)=
- leafname(fname$)
- scrapblk%!0=savewin%
- /
- "Wimp_GetWindowState",,scrapblk%
- .
- "Wimp_GetPointerInfo",,ptrinfo%
- < xpos%=ptrinfo%!0-((scrapblk%!12-scrapblk%!4)
- - ypos%=96+scrapblk%!16-scrapblk%!8
- 6
- "Wimp_CreateMenu",,savewin%,xpos%,ypos%
-
- &400C1
-
- readscreenvars
- ack%<>0
- blk%!0=256
- blk%!12=ref%
- blk%!16=ack%
- -
- "Wimp_SendMessage",17,blk%,sender%
- savestatus
- ("<BasCrunch$Dir>.Options")
- #F% :
- error :
- #F%,keeprems%,keepemptylines%,keepvarnames%,keepprocnames%
- #F%,keepswinames%,nomultilines%,editableoutput%,make0rem%
- #F%,$(exceptionsfname%)
- selecticon(window%,icon%,f%)
- scrapblk%!0=window%
- scrapblk%!4=icon%
- scrapblk%!8=1<<21
- scrapblk%!8=0
- scrapblk%!12=1<<21
- "Wimp_SetIconState",,scrapblk%
- iconselected(window%,icon%)
- scrapblk%!0=window%
- scrapblk%!4=icon%
- "Wimp_GetIconState",,scrapblk%
- #=((scrapblk%!24)
- (1<<21)) > 0
- shadeicon(window%,icon%,f%)
- scrapblk%!0=window%
- scrapblk%!4=icon%
- scrapblk%!8=(1<<22)
- scrapblk%!8=0
- scrapblk%!12=1<<22
- "Wimp_SetIconState",,scrapblk%
- shadeicons
- shadeicon(optwin%,5,
- iconselected(optwin%,4))
- showmenu(blkptr%)
- "MenuUtil_Show",mainmenu%,blkptr%
- startsavedialogue
- dragasprite%
- "DragASprite_Stop"
- blk%!0=64
- blk%!12=0
- blk%!16=1
- "Wimp_GetPointerInfo",,ptrinfo%
- blk%!20=ptrinfo%!12
- blk%!24=ptrinfo%!16
- blk%!28=ptrinfo%!0
- blk%!32=ptrinfo%!4
- blk%!36=inputfsize%
- blk%!40=&FFB
- !*$(blk%+44)=
- leafname($(savefname%))+
- "Wimp_SendMessage",17,blk%,ptrinfo%!12,ptrinfo%!16
- startsavedrag
- b%,win0x%,win0y%
- scrapblk%!0=savewin%
- "Wimp_GetWindowState",,scrapblk%
- )#win0x%=scrapblk%!4-scrapblk%!20
- *$win0y%=scrapblk%!16-scrapblk%!24
- scrapblk%!0=savewin%
- scrapblk%!4=1
- "Wimp_GetIconState",,scrapblk%
- blk%!4=5
- blk%!8=scrapblk%!8+win0x%
- blk%!12=scrapblk%!12+win0y%
- blk%!16=scrapblk%!16+win0x%
- blk%!20=scrapblk%!20+win0y%
- "Wimp_GetPointerInfo",,ptrinfo%
- blk%!24=blk%!8-ptrinfo%!0
- blk%!28=blk%!12-ptrinfo%!4
- 6,blk%!32=screensize_x%+blk%!16-ptrinfo%!0
- 7,blk%!36=screensize_y%+blk%!20-ptrinfo%!4
- "OS_Byte",161,&1C
- ,,b%
- dragasprite%=(b%
- 2)<>0
- dragasprite%
- "DragASprite_Start",&A1,1,"file_ffb",blk%+8,blk%+24
- "Wimp_DragBox",1,blk%
- startcrunch
- cmd$
- C#cmd$="<BasCrunch$Dir>.ccrunch "
- keeprems%
- cmd$+="-r "
- keepemptylines%
- cmd$+="-e "
- keepvarnames%
- cmd$+="-s "
- keepprocnames%
- cmd$+="-f "
- keepswinames%
- cmd$+="-n "
- nomultilines%
- cmd$+="-m "
- editableoutput%
- cmd$+="-t "
- make0rem%
- cmd$+="-0 "
- $(exceptionsfname%)<>""
- ^( cmd$+="-x"+$(exceptionsfname%)+" "
- `&cmd$+=inputfname$+" "+outputfname$
- "Wimp_StartTask",cmd$
- "Wimp_CreateMenu",,-1
- str(s%)
- i%,n$
- (s%?i%>=32)
- (i%<255)
- n$+=
- (s%?i%)
- i%+=1
-