Commit f17ade0a authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Split large source file into 2

Move 1500 lines of the desktop front end into 'DesktopFE', to help see the distinction.
parent 26b528fc
......@@ -268,9 +268,10 @@ clean:
${DDIR}.ChangeFSI: n.ChangeFSI
${RUN}crunch.ChangeFSI; BASIC
n.ChangeFSI: ${SDIR}.ChangeFSI
n.ChangeFSI: ${SDIR}.ChangeFSI ${SDIR}.DesktopFE
${MKDIR} n
${NUMBER} ${SDIR}.ChangeFSI $@
${FAPPEND} n._CFSI_ ${SDIR}.DesktopFE ${SDIR}.ChangeFSI
${NUMBER} n._CFSI_ $@
#------------------------------------------------------------------------------
# JPEGprint
......
......@@ -12,1432 +12,6 @@ REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.
REM
REM > ChangeFSI
REM
REM
REM This program written by Roger Wilson at Acorn Computers Apr 1989-Jun 1994
REM and by Sophie Wilson Aug 1994-
REM - please send bugs back!
REM Subject to change without notice
REM
REM All information is held in 32 bit fixed point with the . at bit 28
REM this gives an integer range of 0-15 (OR negative numbers!)
REM
REM ChangeFSI is written so as to allow use from CLI and from other BASIC
REM programs such as WIMP front ends, plus use of its own wimp front end.
REM
areanumber%=0
leaf$=""
SYS "OS_GetEnv" TO A$
REM Read CLI string
task%=INSTR(A$," -wimp")
SYS "OS_SWINumberFromString",,"OS_ReadMonotonicTime" TO Time%
SYS "OS_SWINumberFromString",,"ColourTrans_ReturnColourNumber" TO ctran%
IF task% THEN
DIM z%(1),p%(3),s%(3)
SYS"MessageTrans_FileInfo",,"<ChangeFSI$Dir>.Messages" TO,,S%
DIM msgb% 16,msgf% S%
SYS"MessageTrans_OpenFile",msgb%,"<ChangeFSI$Dir>.Messages",msgf%
startfile%=RIGHT$(A$,6)<>"-wimp "
DIM taskid% 4,taskmsg% 4
$taskid%="TASK"
!taskmsg%=0:REM All messages
SYS "Wimp_Initialise",310,!taskid%,FNmsg0("_TaskName"),taskmsg% TO version%
IF version%>=350 THEN
SYS "XOS_Memory",8+(2<<8) TO ,r1,r2;F%
IF F% AND 1 vramsize%=0 ELSE vramsize%=r1*r2
IF vramsize%>0 vram%= TRUE ELSE vram%= FALSE
ELSE
vram%= FALSE
ENDIF
Wimp = (1<<18) + (3<<6)
CreateW = Wimp+1
OpenW = Wimp+5
CloseW = Wimp+6
RedrawW = Wimp+8
UpdateW = Wimp+9
GetR% = Wimp+10
GetW = Wimp+11
SetI = Wimp+13
GetI = Wimp+14
GetP = Wimp+15
Drag = Wimp+16
CrMenu = Wimp+20
DcMenu = Wimp+21
SYS "OS_SWINumberFromString",,"Wimp_PollIdle" TO Poll%
SYS "OS_SWINumberFromString",,"Wimp_SetCaretPosition" TO Caretpos%
SYS "OS_SWINumberFromString",,"Wimp_GetCaretPosition" TO Getcaret%
SYS "XOS_SWINumberFromString",,"DragASprite_Start" TO dstart%;f%
IF f% AND 1 dstart%=0
SYS "XOS_SWINumberFromString",,"JPEG_PlotScaled" TO jpegpaint%;f%
IF f% AND 1 jpegpaint%=0
SYS "OS_Byte",161,&1C TO ,,f%
IF (f% AND 2)=0 dstart%=0
nextlocation%=HIMEM
SYS "Wimp_SlotSize",-1,-1 TO originalslot%
PROClocale_initialise
IF version%>=300 THEN
DIM q% 255,ifactors% 15,factors% 15,pixtrans% 255,paltemp% 1023,buffer% 255,idata% 1023
ELSE
DIM z% 1699,q% 255,ifactors% 15,factors% 15,pixtrans% 255,paltemp% 1023,buffer% 255,idata% 2399
eidata%=idata%+2400
ENDIF
scrap%= FALSE
sprite%= FALSE
sar%= FALSE
saved%= TRUE
isopen%= FALSE
lastm%= 0
z$= STRING$(12,CHR$13)
SYS "OS_Byte",161,&8C TO ,,f%
IF f% AND 1 THEN
SYS "Wimp_OpenTemplate",,"<ChangeFSI$Dir>.Template3d"
ELSE
SYS "Wimp_OpenTemplate",,"<ChangeFSI$Dir>.Templates"
ENDIF
LOCAL ERROR
ON ERROR SYS "Wimp_CloseTemplate":ERROR 0,REPORT$+" (code "+ STR$ERL+")"
IF version%>=300 THEN
DIM z% FNlargest_buffer
indsize%=FNsize_indirect("Info")
DIM info_wind% indsize%
SYS "Wimp_LoadTemplate",,z%,info_wind%,info_wind%+indsize%,-1,"Info"+z$,0
ELSE
SYS "Wimp_LoadTemplate",,z%,idata%,eidata%,-1,"Info"+z$,0 TO ,,idata%
ENDIF
SYS CreateW,,z% TO infow%
$!(z%+88+7*32+20)=FNmsg0("_Version")
PROCdotemplate("Processing")
SYS CreateW,,z% TO proc%
p%(0)=!(z%+88+8*32+20)
p%(1)=!(z%+88+9*32+20)
p%(2)=!(z%+88+10*32+20)
p%(3)=!(z%+88+11*32+20)
PROCdotemplate("Output")
SYS CreateW,,z% TO output%
admode%=!(z%+88+20*32+20)
adspcl%=!(z%+88+19*32+20)
oldmode%=!(z%+88+33*32+20)
PROCdotemplate("Scaling")
SYS CreateW,,z% TO scalew%
adscale%=!(z%+88+1*32+20)
s%(0)=!(z%+88+10*32+20)
s%(1)=!(z%+88+11*32+20)
s%(2)=!(z%+88+12*32+20)
s%(3)=!(z%+88+13*32+20)
PROCdotemplate("Save")
SYS CreateW,,z% TO save%
adsave%=!(z%+88+1*32+20)
adsavesprite%=!(z%+88+0*32+20)
PROCdotemplate("Sprite")
SYS CreateW,,z% TO sinfo%
adsname%=!(z%+88+5*32+20)
adsbytes%=!(z%+88+8*32+20)
adsx%=!(z%+88+7*32+20)
adsy%=!(z%+88+9*32+20)
adsm%=!(z%+88+6*32+20)
PROCdotemplate("Source")
SYS CreateW,,z% TO srcinfo%
adsrc%=!(z%+88+0*32+20)
PROCdotemplate("Range")
SYS CreateW,,z% TO raninfo%
adran%=!(z%+88+0*32+20)
PROCdotemplate("Zoom")
SYS CreateW,,z% TO zoom%
z%(0)=!(z%+88+4*32+20)
z%(1)=!(z%+88+5*32+20)
PROCdotemplate("JPEGOutput")
SYS CreateW,,z% TO jpego%
adjpegq%=!(z%+88+5*32+20)
PROCdotemplate("Pic")
SYS CreateW,,z% TO pic%
adtitle%=z%!72
RESTORE ERROR
SYS "Wimp_CloseTemplate"
!q%=-1
q%!4=0
q%!8=0
q%!12=68
q%!16=68
q%!20=%11000000000010
$(q%+24)="!"+FNmsg0("_TaskName")
SYS "Wimp_CreateIcon",,q% TO iconbar%
SYS "XOS_Find",&40,"Choices:ChangeFSI.Choices" TO A%;V%
IF (A%=0) OR ((V% AND 1)=1) THEN
fast%= FALSE
dest%=1
statescale%=%10000000100
stateproc%=0
stateoutput%=&4052008
statejpeg%=&2
$p%(0)=""
$p%(1)="2"+decimal_point$+"2"
$p%(2)="24"
$p%(3)="4"
$adspcl%=""
$admode%="28"
$s%(0)="1"
$s%(1)="4"
$s%(2)="1"
$s%(3)="4"
$adjpegq%="75"
$oldmode%=""
ELSE
INPUT#A%,fast%,dest%,statescale%,stateproc%,stateoutput%,statejpeg%,$adjpegq%,$oldmode%
INPUT#A%,$p%(0),$p%(1),$p%(2),$p%(3),$admode%,$adspcl%
$p%(1)=FNlocale_convert($p%(1),".",decimal_point$)
INPUT#A%,$s%(0),$s%(1),$s%(2),$s%(3)
CLOSE#A%
ENDIF
q%!12=1<<21
!q%=scalew%
FOR I%=0 TO 9
IF statescale%>>I% AND 1 q%!8=1<<21 ELSE q%!8=0
q%!4=I%
SYS SetI,,q%
NEXT
FOR I%=10 TO 13
IF statescale%>>I% AND 1 q%!8=1<<21 ELSE q%!8=0
q%!4=I%+6
SYS SetI,,q%
NEXT
!q%=proc%
FOR I%=0 TO 7
IF stateproc%>>I% AND 1 q%!8=1<<21 ELSE q%!8=0
q%!4=I%
SYS SetI,,q%
NEXT
!q%=output%
FOR I%=0 TO 26
IF stateoutput%>>I% AND 1 q%!8=1<<21 ELSE q%!8=0
q%!4=I%
SYS SetI,,q%
NEXT
!q%=jpego%
FOR I%=0 TO 3
IF statejpeg%>>I% AND 1 q%!8=1<<21 ELSE q%!8=0
q%!4=I%
SYS SetI,,q%
NEXT
IF stateoutput%>>17 AND 1 q%!8=1<<22 ELSE q%!8=0
!q%=output%
q%!12=1<<22
q%!4=7
SYS SetI,,q%
q%!4=8
SYS SetI,,q%
q%!4=13
SYS SetI,,q%
q%!4=14
SYS SetI,,q%
PROCshowscaletofit
$z%(0)="1"
$z%(1)="1"
SYS "OS_UpdateMEMC" TO oldmemc
jpegsave%= FALSE
ON ERROR SYS "OS_UpdateMEMC",oldmemc,&700:PROCerrorbox:SYS CrMenu,,-1 : REM close menus!
SYS Drag,,-1
IF NOT sprite% SYS "Wimp_SlotSize",originalslot%,-1
F$=""
IF startfile% startfile%= FALSE :F$=MID$(A$,INSTR(A$,"-wimp")+6):PROCcallFSI
REPEAT
SYS Poll%,1,q% TO A%
CASE A% OF
WHEN 1
IF sprite% PROCredraw_window(!q%)
WHEN 2
PROCopen_window(!q%,q%!4,q%!8,q%!12,q%!16,q%!20,q%!24,q%!28)
WHEN 3
SYS &400c3,,q%
nextlocation%=HIMEM
PROCremovearea
SYS "Wimp_SlotSize",originalslot%,-1
saved%= TRUE
sprite%= FALSE
isopen%= FALSE
WHEN 6
PROCcheckmouse(!q%,q%!4,q%!8,q%!12,q%!16,q%!20)
WHEN 7
SYS GetP,,q%
dw%=q%!12
di%=q%!16
IF dstart% SYS "DragASprite_Stop"
q%!12=0
q%!16=1
q%!20=dw%
q%!24=di%
q%!28=!q%
q%!32=q%!4
q%!36=!sar%+3
IF jpegsave% THEN
q%!40=&c85
ELSE
q%!40=&ff9
ENDIF
temp$=FNZS(adsave%)
foo%=INSTR(temp$,".")
WHILE foo%
temp$=MID$(temp$,foo%+1)
foo%=INSTR(temp$,".")
ENDWHILE
$(q%+44)=temp$+CHR$0
!q%=44+(LEN temp$+1+3 AND NOT 3)
SYS "Wimp_SendMessage",17,q%,dw%,di%
myref%=q%!8
WHEN 8
PROCkey(!q%,q%!4,q%!24)
WHEN 9
PROCmenuselect(q%)
WHEN 17,18
PROCreceive(q%)
ENDCASE
UNTIL FALSE
ELSE
Q%=HIMEM
REM Remember memory size
END=&4000000
REM Grab all the memory
ON ERROR ON ERROR OFF:OSCLI"Set ChangeFSI$ReturnCode "+REPORT$+" (code "+ STR$ERL+")":PROCremovearea:CLEAR:END=Q%:END
foo%=0
REM Call program
A%=FNChangeFSI(A$,-1,-1,0,-1,-1,foo%,TRUE)
PROCremovearea
OSCLI"unset ChangeFSI$ReturnCode"
CLEAR
END=Q%
REM Return it all again
ENDIF
END
:
REM
DEF PROCdotemplate(a$)
LOCAL A%
IF version%>=300 THEN
SYS "Wimp_LoadTemplate",,0,,,,a$+z$,0 TO ,,indsize%
DIM A% indsize%
SYS "Wimp_LoadTemplate",,z%,A%,A%+indsize%,-1,a$+z$,0
ELSE
SYS "Wimp_LoadTemplate",,z%,idata%,eidata%,-1,a$+z$,0 TO ,,idata%
ENDIF
ENDPROC
:
REM
DEF PROClocale_initialise
LOCAL p%
LOCAL ERROR
ON ERROR LOCAL decimal_point$=".":ENDPROC
SYS "Territory_ReadSymbols",-1,0 TO p%
decimal_point$=CHR$?p%
ENDPROC
:
REM
DEF FNlocale_convert(n$,f$,t$)
IF f$=t$ THEN =n$
LOCAL i%
i%=INSTR(n$,f$)
IF i%<>0 : =LEFT$(n$,i%-1)+t$+MID$(n$,i%+1)
=n$
:
REM
DEF FNsize_indirect(name$)
LOCAL size%
SYS "Wimp_LoadTemplate",,0,,,,name$+z$,0 TO ,,size%
=size%
:
REM Returns the largest buffer size necessary for passing
REM to R1 on a Wimp_LoadTemplate
DEF FNlargest_buffer
LOCAL largest_tem%,size%,here%,name
DIM name 12
$name="*"
here%=0
largest_tem%=0
SYS "Wimp_LoadTemplate", ,0,,,,name,0 TO ,size%,,,,,here%
WHILE here%
IF largest_tem%<size% largest_tem%=size%
$name= "*"
SYS "Wimp_LoadTemplate", ,0,,,,name,here% TO ,size%,,,,,here%
ENDWHILE
=largest_tem%
:
REM
DEF PROCreceive(q%)
CASE q%!16 OF
WHEN 0
PROCfinishandquit
WHEN 1
IF q%!20<>save% THEN
!q%=60
q%!12=q%!8
q%!16=2
q%!36=-1
$(q%+44)="<Wimp$Scrap>"+CHR$0
SYS "Wimp_SendMessage",17,q%,q%!4
scrap%=q%!8
ENDIF
WHEN 2
IF jpegsave% THEN
SYS "OS_File",10,FNZS(q%+44),&c85,,sar%,sar%+jpegsize%
ELSE
SYS &2E,&10C,sar%,FNZS(q%+44)
ENDIF
$adsave%=FNZS(q%+44)
q%!12=q%!8
q%!16=3
SYS "Wimp_SendMessage",18,q%,q%!4
IF q%!36<>-1 saved%= TRUE
SYS CrMenu,,-1
WHEN 3
F$=FNZS(q%+44)
IF scrap% scrap%=scrap%=q%!12
q%!12=q%!8
q%!16=4
SYS "Wimp_SendMessage",17,q%,q%!4
PROCcallFSI
WHEN 5
CASE q%!40 OF
WHEN &ff0,&c85
q%!12=q%!8
q%!16=4
SYS "Wimp_SendMessage",17,q%,q%!4
F$=FNZS(q%+44)
PROCcallFSI
ENDCASE
WHEN 8
PROCchecksaved(q%)
WHEN 9,&400C1
IF sprite% PROCgetmodeinfo:SYS &400d1,pic%,0,-32767,32767,0
PROCshowscaletofit
WHEN 10
SYS "XOS_ReadVarVal","ChangeFSI$Dir",paltemp%,256,0,3 TO ,,bootlen%
paltemp%?bootlen%=13
BPUT#q%!20,"Run "+$paltemp%
WHEN &502
REM Interactive help
PROCgethelp(q%!32,q%!36)
ENDCASE
ENDPROC
:
REM
DEF PROCgethelp(w%,i%)
IF i%<-1 THEN ENDPROC
CASE w% OF
WHENinfow%
$(q%+20)=FNmsg0("Hinfo"+STR$(i%))
WHENproc%
$(q%+20)=FNmsg0("Hproc"+STR$(i%))
WHENoutput%
$(q%+20)=FNmsg0("Hout"+STR$(i%))
WHENscalew%
$(q%+20)=FNmsg0("Hscale"+STR$(i%))
WHENsave%
$(q%+20)=FNmsg0("Hsave"+STR$(i%))
WHENsinfo%
$(q%+20)=FNmsg0("Hsprite"+STR$(i%))
WHENsrcinfo%
$(q%+20)=FNmsg0("Hsrc"+STR$(i%))
WHENraninfo%
$(q%+20)=FNmsg0("Hrange"+STR$(i%))
WHENzoom%
$(q%+20)=FNmsg0("Hzoom"+STR$(i%))
WHENjpego%
$(q%+20)=FNmsg0("Hjpeg"+STR$(i%))
WHENpic%
$(q%+20)=FNmsg0("Hpic"+STR$(i%))
WHEN-2
ENDPROC:REM Default from !Help used
OTHERWISE
IF i%<>-1 THEN
REM Must be a menu then
SYS "Wimp_GetMenuState",1,q%+20,w%,i%
IF lastm%=101 THEN
REM The iconbar menu
LOCAL grey$
IF (q%!20=6) AND vram% THEN grey$="g"
IF (q%!20=5) AND (F$="" OR F$="SpriteFile" OR F$="JPEGImage") THEN grey$="g"
$(q%+20)=FNmsg0("Himnu"+STR$(q%!20)+grey$)
ELSE
IF lastm%=pic% THEN
REM The picture menu
$(q%+20)=FNmsg0("Hpmnu"+STR$(q%!20))
ELSE
REM Yikes, some menu we didn't open
ENDPROC
ENDIF
ENDIF
ENDIF
ENDCASE
q%!0=((20+LEN($(q%+20))+1)+3)ANDNOT3
q%!12=q%!8
q%!16=&503:REM Message_HelpReply
SYS "Wimp_SendMessage",17,q%,q%!4
ENDPROC
:
REM
DEF PROCcallFSI
IF FNcheckvalues <> 0 THEN ENDPROC
A$=FNdeducemode
A%=47
jpegsave%= FALSE
IF dest%=0 THEN
jpegsave%= TRUE
A$="JPEG"
IF FNgeticonstate(jpego%,2) A$="JPEGMONO"
A$+=$adjpegq%
ELSE
IF FNgeticonstate(output%,15) THEN
A$+=$adspcl%
ELSE
IF FNgeticonstate(output%,16) THEN
IF FNgeticonstate(output%,5) OR FNgeticonstate(output%,11) A$+="R"
ELSE
SYS 53,VAL A$,3 TO ,,A%
IF A%=63 THEN
IF FNgeticonstate(output%,6) A$="27t"
IF FNgeticonstate(output%,12) A$="12t"
ELSE
IF A%=255 A$+="d"
ENDIF
ENDIF
ENDIF
ENDIF
A$="garbage "+F$+" <ChangeFSI$Dir>.Foo "+A$
PROCChangeFSISuffix
info$=""
range$=FNmsg0("NoRange")
cputime%=0
IF sprite% !q%=pic%:SYS &400c3,,q%:saved%= TRUE :sprite%= FALSE
nextlocation%=HIMEM
SYS "Wimp_SlotSize",originalslot%,-1
PROCremovearea
IF fast% SYS "OS_UpdateMEMC",&300,&700 TO oldmemc
A%=FNChangeFSI(A$,-1,-1,nextlocation%,0,0,sar%,0)
IF fast% SYS "OS_UpdateMEMC",oldmemc,&700
IF scrap% scrap%= FALSE :SYS "OS_File",6,F$
IF A%<2 AND sar%<>0 THEN
$adsx%= STR$xsp%
$adsy%= STR$ysp%
IF jpegsave% THEN
$adsm%="JPEG"
$adsname%="JPEG"
$adsbytes%= STR$jpegsize%
x=xsp%*2
y=ysp%*2
SYS &35,-1,4 TO ,,nx
SYS &35,-1,5 TO ,,ny
!ifactors%=1
ifactors%!4=1
ifactors%!8=nx
ifactors%!12=ny
$adsavesprite%="file_c85"
IF LEFT$(F$,7)="<Wimp$S" F$="JPEGImage"
ELSE
SYS &2002E,&10d,sar%,pixtrans%,255,1
n$=FNZS(pixtrans%)
SYS &2002E,&128,sar%,n$ TO ,,,x,y,,m
IF (m<256 AND SGN(m)<>-1) THEN $adsm%=STR$m ELSE $adsm%="&"+STR$~m
$adsname%=n$
$adsbytes%= STR$sar%!12
SYS &35,m,4 TO ,,nx
x=x<<nx
SYS &35,m,5 TO ,,ny
y=y<<ny
PROCgetmodeinfo
$adsavesprite%="file_ff9"
IF LEFT$(F$,7)="<Wimp$S" F$="SpriteFile"
ENDIF
!q%=save%
q%!4=0
q%!8=0
q%!12=0
SYS SetI,,q%
$adran%=range$
$adsrc%=info$+" "+FNmsg1("Proc",STR$(cputime% DIV 100)+decimal_point$+RIGHT$("0"+ STR$(cputime%MOD 100),2))
saved%= FALSE
sprite%= TRUE
REM Get the leafname of F$ for the save box (so you don't overwrite the source),but have the full path in the title bar
A%=LEN F$
WHILE MID$("."+F$,A%,1)<>"."
A%-=1
ENDWHILE
$adsave%=MID$("."+F$,A%+1)
pic%=FNcreate_window(x,y,F$)
PROCpopup(pic%,-1)
ENDIF
ENDPROC
:
REM
DEF FNcheckvalues
LOCAL e,error$,flag%
REM Is the JPEG quality within the correct range?
IF dest%=0 AND VAL ($adjpegq%) > 100 THEN
e = 1
error$ = FNmsg0("BadJQ")
ENDIF
REM Is it a numerical mode?
IF LEFT$($admode%,1) < "A" AND dest%=1 THEN
SYS &35, VAL ($admode%), 0 TO ;flag%
REM Is the numerical mode valid?
IF LEN ($admode%) = 0 flag%=2
IF VAL ($admode%) > 127 AND VAL ($admode%) < 256 flag%=2
IF (flag% AND 2) > 0 THEN
e = 2
error$ = FNmsg0("BadMode")
ENDIF
ENDIF
IF e <> 0 THEN
SYS Drag,,-1
!buffer%=e
$(buffer%+4)=error$+CHR$0
SYS "Wimp_ReportError",buffer%,%01,FNmsg0("_TaskName") TO ,A%
IF A%=2 THEN PROCfinishandquit
ENDIF
=e
:
REM
DEF PROCChangeFSISuffix
safe%= TRUE
IF FNgeticonstate(scalew%,1) A$+=" "+ STR$tofitx+": "+ STR$tofity+":":safe%= FALSE
IF FNgeticonstate(scalew%,5) A$+=" 1:2":safe%= FALSE
IF FNgeticonstate(scalew%,4) A$+=" 1:2 1:1":safe%= FALSE
IF FNgeticonstate(scalew%,3) A$+=" 1:1 1:2":safe%= FALSE
IF FNgeticonstate(scalew%,9) THEN
safe%= FALSE
IF VAL $s%(0) A$+=" "+$s%(0) ELSE A$+=" 1"
A$+=":"+$s%(1)
IF VAL $s%(2) A$+=" "+$s%(2) ELSE A$+=" 1"
A$+=":"+$s%(3)
ENDIF
IF FNgeticonstate(scalew%,0) A$+=" -nosize"
IF FNgeticonstate(scalew%,18) A$+=" -noscale"
IF FNgeticonstate(scalew%,19) A$+=" -lock"
IF FNgeticonstate(scalew%,6) THEN
safe%= FALSE
IF FNgeticonstate(scalew%,16) A$+=" -rotate" ELSE A$+=" -rotate-"
ENDIF
IF FNgeticonstate(scalew%,7) A$+=" -hflip":safe%= FALSE
IF FNgeticonstate(scalew%,8) A$+=" -vflip":safe%= FALSE
IF FNgeticonstate(proc%,0) A$+=" -range":safe%= FALSE
IF FNgeticonstate(proc%,1) A$+=" -equal":safe%= FALSE
IF FNgeticonstate(proc%,2) A$+=" -nodither"
IF FNgeticonstate(proc%,3) A$+=" -invert":safe%= FALSE
IF FNgeticonstate(proc%,4) A$+=" -brighten"
IF FNgeticonstate(proc%,5) A$+=" -black"+$p%(0)
IF FNgeticonstate(proc%,6) A$+=" -gamma"+FNlocale_convert($p%(1),decimal_point$,"."):safe%= FALSE
IF FNgeticonstate(proc%,7) A$+=" -sharpen"+$p%(2):safe%= FALSE
IF FNgeticonstate(proc%,11) A$+=" -smooth"+$p%(3)
ENDPROC
:
REM
DEF PROCfinishandquit
PROCremovearea
SYS "Wimp_CloseDown"
SYS "XMessageTrans_CloseFile",msgb%
END
ENDPROC
:
REM
DEF PROCcheckandfinish
IF saved% OR NOT sprite% THEN PROCfinishandquit
!buffer%=ERR
$(buffer%+4)=FNmsg1("Unsaved",F$)+CHR$0
SYS "Wimp_ReportError",buffer%,%010100000000,FNmsg0("_TaskName"),"!changefsi",1,FNmsg0("ButCon") TO ,A%
IF A%=4 THEN PROCfinishandquit
ENDPROC
:
REM
DEF PROCchecksaved(q%)
IF saved% OR NOT sprite% ENDPROC
!buffer%=ERR
$(buffer%+4)=FNmsg1("Unsaved",F$)+CHR$0
SYS "Wimp_ReportError",buffer%,%010100000000,FNmsg0("_TaskName"),"!changefsi",1,FNmsg0("ButCon") TO ,A%
q%!12=q%!8
IF A%<>4 SYS "Wimp_SendMessage" ,19, q%, 0
ENDPROC
:
REM
DEF PROCkey(handle%,icon%,key%)
IF key%=&1b SYS CrMenu,,-1:ENDPROC