home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
utilities
/
f
/
formed2
/
!FormEd2
/
!RunImage
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1993-04-12
|
101KB
|
4,272 lines
> <FormEd2$Dir>.!RunImage
/// Forms Editor program (for designing Wimp Templates) ///
Buggered about with with by The RISC Squad
Now on version 2.84b
Directory Structure: . . . Snore !
!Formed.!Boot
!Formed.!Help
!Formed.!Run
!Formed.!RunImage (this file) - run when !Run is executed
!Formed.!Sprites
!Formed.Default
!Formed.Sprites
!Formed.Templates
"XHourglass_On"
"OS_GetEnv"
commandstring$
:hwic%=-2
fontcounts% 255
I%=0
255:fontcounts%?I%=0:
-- Start Wimp going
"Wimp_Initialise",200,&4B534154,"FormEd2"
version%,task_handle%
errordisplay(
after calling Wimp_Initialise!
)`wbcol=&0:`tbcol=&D:`sco=&3:`mbcol=&B
*`wfcol=&7:`tfcol=&7:`sci=&D:`tbcol2=&C
DragASprite%=
inv% 27,outv% 23
px2% 1,px4% 3,px256% 255
getmodeinfo
switched%=
factors% 15,pixtrans% 15
-- dimension arrays
pal%(2),bright%(15),uncolour%(15)
q% &2000,erroraddr%(4),oldq% &100,_Q% 256
indexdata% 32*24+20,fontbinding% 255
maxbuf%=&3000
buffer% maxbuf%:curbuff%=buffer%
nh%=32
handle%(nh%+1),wident$(nh%),wptr%(nh%),tempind% nh%*16,temppatch%(nh%)
I%=0
nh%:handle%(I%)=I%-1:wident$(I%)="":
:handleSP%=nh%
spritename% 12
menufree% &2500:menuend%=menufree%+&2500
menulist% &100
brx%=400:bry%=740
/>currentwindow%=-1:currenticon%=-1:dialogue%=-1:def_menu%=1
spritef$="":clear%=
ib_text% 256,ib_sprite% 12,ib_buffersize% 6,ib_validation% 256
tb_text% 40,tb_sprite% 12,tb_buffersize% 6
mb_fsize% 6:$mb_fsize%="30"
mb_wident% 12
mb_renumber% 5:$mb_renumber%="0"
mb_delete% 5:$mb_delete%=""
mb_Hspacing% 6:$mb_Hspacing%="8"
mb_Vspacing% 6:$mb_Vspacing%="8"
mb_crsprite% 12,mb_rnsprite% 12
nsp=80:ns%=10
spw%(nsp),sph%(nsp),spwx%(nsp),minx%(nsp),miny%(nsp),spname$(nsp)
spritew%(ns%+1),nsprite%(ns%)
spritei%(ns%),sprxscale%(ns%),spryscale%(ns%),spriten$(ns%)
I%=0
ns%:spritew%(I%)=I%-1:spriten$(I%)="":
:sprSP%=ns%:sprSP2%=-1
"OS_File",5,"<FormEd2$Dir>.Sprites"
type%,,,,systemareasize%
type%<>1
1,"Can't find 'Sprites' file"
systemareasize%+=4
systemsprites% systemareasize%
C$systemsprites%!0=systemareasize%
"OS_SpriteOp",&10A,systemsprites%,"<FormEd2$Dir>.Sprites"
SYS "OS_SpriteOp",&10F,systemsprites%,"editbuffer",0,1280/dx%,1024/dy%,MODE
editbuffer%=FNspriteaddr(systemsprites%,"editbuffer")
editbufferwidth%=(sptr%!16+1)*4
spriteareasize%=
-16*1024
spritearea% spriteareasize%
J1!spritearea%=spriteareasize%:spritearea%!8=16
"OS_SpriteOp",&109,spritearea%
loadsprites("<FormEd2$Dir>.Default"):spritef$="Default"
loadchoices
N.undoname$="":undoscreen%=-1:editbuffer%=-2
-- Create windows
defaultwindows
paltable% 79:
"Wimp_ReadPalette",,paltable%
palcolour%=7:sprcolour%=7
S.paintmode%=16:
select(palette%,paintmode%)
T*grid%=
grid%
select(palette%,31)
-- Create Menus
m_palette%=
crmenu
"#Colours,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15"
i_esg%=
crmenu
"#ESG,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15"
i_button%=
crmenu
"#Button type,Never,Always,Auto-repeat,Click,Release,Double click,++"
"Click/Drag,Release/Drag,Double/Drag,Menu icon,Double/Click/Drag,++"
"Radio,Reserved,Reserved,Write/Click/Drag,Writeable"
m_fsize%=
crmenu
"#Point size,10 point,12 point,14 point,20 point,$mb_fsize%(6)"
i_font%=
crmenu
"#Text style,&"
i_txt%=
crmenu
"#Icon text,$ib_text%(256)"
i_sprite%=
crmenu
"#Sprite name,$ib_sprite%(12)"
i_validation=
crmenu
"#Validation,$ib_validation%(256)"
i_buffersize%=
crmenu
"#Max size,$ib_buffersize%(6),Valid>i_validation"
i_flags%=
crmenu
"#Icon flags,Text>i_txt%,Sprite>i_sprite%,Border,H centred,++"
"V centred,Filled,Anti-aliased>i_font%,Needs help,++"
"Indirected>i_buffersize%,R justified,Allow adjust,Half size,++"
"Button type>i_button%,ESG>i_esg%,++"
"Fg colour?m_palette%,Bg colour?m_palette%"
t_text%=
crmenu
"#Title text,$tb_text%(40)"
t_sprite%=
crmenu
"#Sprite name,$tb_sprite%(12)"
t_buffersize%=
crmenu
"#Max size,$tb_buffersize%(6)"
t_flags%=
crmenu
"#Title flags,Text>t_text%,Sprite>t_sprite%,Border,H centred,++"
"V centred,Filled,Anti-aliased>i_font%,Indirected>t_buffersize%,++"
"R justified"
w_scroll%=
crmenu
"Auto-repeat,Debounced"
w_flags%=
crmenu
"#Flags,Title>t_flags%,Moveable,V scroll,H scroll,Auto-redraw,Pane,++"
"No bounds,No quit box,User scroll>w_scroll%,Real colours,++"
"Back,Keys,Work area#>i_button%,New format,Back icon,++"
"Quit icon,Title icon>t_flags%,Toggle icon,V scroll,Size icon,H scroll"
w_colours%=
crmenu
"Title fg?m_palette%,Title bg?m_palette%,Work fg?m_palette%,Work bg?m_palette%,Scroll outer?m_palette%,Scroll inner?m_palette%,Input focus?m_palette%"
w_ident%=
crmenu
"#Window name:,$mb_wident%(12)"
i_renumber%=
crmenu
"#Icon #,$mb_renumber%(5)"
i_delete%=
crmenu
"#Icon #,$mb_delete%(5)"
i_copy%=
crmenu
"#Copy,left,right,up,down"
i_move%=
crmenu
"#Move,left,right,up,down"
i_arrows%=
crmenu
"#Arrow,left,right,down,up"
i_3darrows%=
crmenu
"#3D Arrow,left,right,down,up"
i_align%=
crmenu
"#Align,Left,Right,Top,Bottom,V Centre,H Centre"
i_Hspacing%=
crmenu
"#Spacing,$mb_Hspacing%(6)"
i_Vspacing%=
crmenu
"#Spacing,$mb_Vspacing%(6)"
i_arrange%=
crmenu
"#Arrange,Horizontal>i_Hspacing%,Vertical>i_Vspacing%,Both"
i_new%=
crmenu
"#New icon,Text>i_txt%,Sprite>i_sprite%,Arrow>i_arrows%,++"
"Option>i_txt%,Radio>i_txt%,Writeable>i_txt%,Menu>i_txt%,++"
"Comment#>i_txt%,Group,Raised>i_txt%,Sunken>i_txt%,Writeable>i_txt%,Default>i_txt%,++"
"Groove,Double,Option>i_txt%,Radio>i_txt%,Arrows>i_3darrows%"
i_sel%=
crmenu
"#Selection,Edit>i_flags%,Copy>i_copy%,Move>i_move%,Resize?m_resize%,Same size,Align>i_align%,Arrange>i_arrange%,Wipe>i_delete%,++"
"Renumber nnnn>i_renumber%"
i_general%=
crmenu
"#Icons,Edit window,Create icon?i_new%,Selected xxxxx?i_sel%,++"
"Select all,Deselect all,Tidy icons,Delete window"
w_general%=
crmenu
"#Window,Edit icons,Window flags?w_flags%,Colours>w_colours%,++"
"Work area?m_workarea%,Identifier>w_ident%,Delete window,++"
"Save?m_savetemp%"
m_templates%=
crmenu
"#Filename:,$mb_templates%(256)"
m_show%=
crmenu
"#Show,Handles,Templates"
main_w%=
crmenu
"#Templates,Create>w_ident%,Clear,Load>m_templates%,Save?m_savetemp%"
main_s%=
crmenu
"#Sprites,Show sprites,Show tools"
mainmenu%=
crmenu
"#FormEd2,Info>proginfo%,Sprites,Show>m_show%,Options,Finish,Quit"
m_rowcol%=
crmenu
"Row,Column"
m_sprite%=
crmenu
"#Sprite,Undo,Colour>m_palette%,Transparent,Create mask,Delete mask,++"
"Extend>m_rowcol%,Reduce>m_rowcol%,Insert>m_rowcol%,Delete>m_rowcol%,++"
"Flip X,Flip Y,Blob size>m_scale%"
m_crsprite%=
crmenu
"#New name,$mb_crsprite%(12)"
m_rnsprite%=
crmenu
"#New name,$mb_rnsprite%(12)"
m_spritef%=
crmenu
"#Filename,$mb_spritef%(256)"
m_append%=
crmenu
"Horizontally,Vertically"
m_spritelist%=
crmenu
"#Sprites,Delete,Copy>m_rnsprite%,Rename#>m_rnsprite%,Load>m_spritef%,Save>m_savespr%,Merge>m_spritef%"
t_sel%=
crmenu
"#Selection,Open,Close#,Copy?w_ident%,Rename?w_ident%#,Wipe"
t_file%=
crmenu
"#Templates,'12345678901'>t_sel%,Select all,Clear selection,Create?w_ident%,Clear,Load>m_templates%,Save?m_savetemp%"
loaded%=
setloaded(
-- if command was '*FormEd2 <filename>', load a template file
ic_window%=
iconbar
commandstring$," -quit ")
I%+=
" -quit "
commandstring$,I%,1)=" ":I%+=1:
( I%=
commandstring$+" "," ",I%+1)
*
I%+=1:
commandstring$,I%,1)<>" "
f$=
commandstring$,I%)
f$=
f$+" "," ")-1)
f$<>""
filetype(f$)
#
&FEC:
loadtemplates(f$)
-
&FF9:
loadsprites(f$):
spriteinfo
-
-2:
1,"File '"+f$+"' not found"
E
1,"File '"+f$+"' is not a sprite file or template file"
f$=""
encodepal(0,15)
initbuf%=curbuff%
front(handlew%)
movehandles(
updatefile(1)
-- Error handler - drops through to Wimp_Poll
saveref%=-1:scrapref%=-1
dragtype%=0:pdrag%=-1
paint_drag%=-1
inerror%=
:oldhelp%=1
"XHourglass_Off":*Pointer 1
"Wimp_DragBox",,-1:menuhandle%=-1:
errorbox(
-- Main Polling loop
hw%
?hndident%<>13
handledoicon
"Wimp_Poll",0,q%
action%
interface%
"XWimp_PollPointer",action%,,task_handle%
action%
redraw(!q%)
open(!q%,q%!4,q%!8,q%!12,q%!16,q%!20,q%!24,q%!28)
close(!q%)
leave(!q%)
enter(!q%)
mouse(!q%,q%!4,q%!8,q%!12,q%!16,q%!20)
decodedrag(!q%,q%!4,q%!8,q%!12)
8: key%=q%!24:
processkey(q%!0,q%!4,key%)
9: I%=0:
:menulist%!I%=q%!I%:I%=I%+4:
q%!(I%-4)=-1
.
decodemenu(menuhandle%,menulist%)
.
getpointer:
buttons%
remenu
open(!q%,q%!4,q%!8,q%!12,q%!16,q%!20+q%!32*32,q%!24+q%!36*32,q%!28)
17,18:
receive(q%)
receive(q%)
I%=0
!q%-1
4:oldq%!I%=q%!I%:
q%!16
finish:
q%!40
5
&FF9,&FEC:
do the scrap file business
D
"XOS_ReadVarVal","Wimp$Scrap",,-1,0,3
,,exists%
<
exists%=0
1,"<Wimp$Scrap> not defined"
7 q%!36=-1:
string0(q%+44,"<Wimp$Scrap>")
+ !q%=(48+
"<Wimp$Scrap>")
C q%!12=q%!8:q%!16=2:
"Wimp_SendMessage",17,q%,q%!4
scrapref%=q%!8
q%!12<>saveref%
1,"Unexpected DataSave packet received"
q%!40
;
&FEC:
savetemplates(
string0(q%+44),q%!36<>-1)
1
clear%
wipealltemplates
9
&FF9:
savesprites(
string0(q%+44),q%!36<>-1)
8
1,"Unexpected DataSave filetype received"
M oldq%!12=oldq%!8:oldq%!16=3:
"Wimp_SendMessage",17,oldq%,oldq%!4
3:typ%=q%!40:file$=
string0(q%+44)
typ%=&2000
G
"OS_File",5,file$+"."+auto$
T%,,R%:typ%=(R%>>8)
&FFF
typ%=&FEC
; file$+="."+auto$:
loaded%
wipealltemplates
L void%=
warning(q%,1,"This application has no '"+auto$+"' file")
typ%=&1000:name$=""
typ%
'
&FEC:
loadtemplates(file$)
&FF9:
q%!20=-2
!9
loadsprites(file$):
spriteinfo
"7
mergesprites(file$):
spriteinfo
&6
oldq%!12=scrapref%
*Delete <Wimp$Scrap>
'M oldq%!12=oldq%!8:oldq%!16=4:
"Wimp_SendMessage",17,oldq%,oldq%!4
q%!40=&FEC
A%=
+%
wident$(I%)<>""
.,
loadtemplates(
string0(q%+44))
/O oldq%!12=oldq%!8:oldq%!16=4:
"Wimp_SendMessage",17,oldq%,oldq%!4
encodepal(0,15)
bootmessage(q%)
&400C0:
59 submenu%=q%!20:subx%=q%!24:suby%=q%!28:menus%=q%+32
submenu%>&8000
encodemenu(submenu%)
9(
submenu%=m_savetemp%
clear%=
"Wimp_CreateSubMenu",,submenu%,subx%,suby%
&400C1:
getmodeinfo:
movehandles(
sendsave(ft%,fn%)
filename%
"Wimp_CreateMenu",,-1
filename%=fn%:fn%+=
$fn%,"."):
fn%=filename%
getpointer :
sets up handle%,icon%,mousex%,mousey%
!q%=(48+
$filename%)
q%!12=0:q%!16=1
F9q%!20=handle%:q%!24=icon%:q%!28=mousex%:q%!32=mousey%
G(q%!36=0 :
file size (inaccurate)
q%!40=ft% :
file type
string0(q%+44,$filename%)
"Wimp_SendMessage",17,q%,handle%,icon%
saveref%=q%!8
string0(a%)
a$:a$="":
?a%:a$+=
?a%:a%+=1:
string0(a%,a$) $a%=a$:a%?
a$=0:
getmodeinfo
inv%!0 = 4
inv%!4 = 5
inv%!8 = 6
inv%!12= 7
inv%!16= 11
inv%!20= 12
inv%!24= -1
"OS_ReadVduVariables",inv%,outv%
dx%=1<<(outv%!0)
dy%=1<<(outv%!4)
linelen%=outv%!8
screensize%=outv%!12
scrx1%=(outv%!16+1)*dx%
scry1%=(outv%!20+1)*dy%
redraw(handle%):!q%=handle%:
"Wimp_RedrawWindow",,q%
more%
info(q%+4):
dx%:dx%=48
more%
hatch%
whichwindow(handle%)>0)
d- x0%=q%!28:y0%=q%!32:x1%=q%!36:y1%=q%!40
e/ minx0%=x0%-(by%-y0%):maxx0%=x1%-(by%-y1%)
f/ minx1%=x0%+(by%-y1%):maxx1%=x1%+(by%-y0%)
g1 minx0%=(minx0%-bx%+10000)
dx%*dx%+bx%-10000
h1 minx1%=(minx1%-bx%+10000)
dx%*dx%+bx%-10000
x%=minx0%
maxx0%
x%,by%:
1,3E4,-3E4:
x%=minx1%
maxx1%
x%,by%:
1,-3E4,-3E4:
interface%
"XWimp_BorderWindow",,q%
"Wimp_GetRectangle",,q%
more%
front(handle%)
r,!q%=handle%:
"Wimp_GetWindowState",,q%
s%q%!28=-1:
"Wimp_OpenWindow",,q%
reopen(handle%)
vE!q%=handle%:
"Wimp_GetWindowState",,q%:
"Wimp_OpenWindow",,q%
getw(handle%)
y8!q%=handle%:
"Wimp_GetWindowState",,q%:
info(q%+4)
geti(h%,i%)
|-!q%=h%:q%!4=i%:
"Wimp_GetIconState",,q%
}.ix0%=q%!8:iy0%=q%!12:ix1%=q%!16:iy1%=q%!20
iflags%=q%!24:idata%=q%+28
info(p%)
'x0%=!p%:y0%=p%!4:x1%=p%!8:y1%=p%!12
5scx%=p%!16:scy%=p%!20:bhandle%=p%!24:flags%=p%!28
Kbx%=x0%-scx%:by%=y1%-scy% :
all drawing should be relative to bx%,by%
update(handle%,x0%,y0%,x1%,y1%)
5!q%=handle%:q%!4=x0%:q%!8=y0%:q%!12=x1%:q%!16=y1%
"Wimp_UpdateWindow",,q%
more%
upicon(handle%,icon%)
D!q%=handle%:q%!4=icon%:q%!8=0:q%!12=0:
"Wimp_SetIconState",,q%
lc(a$):
b$,A%:
a$>"":A%=
a$:a$=
a$,2):
A%>64
A%<91 A%+=32
b$+=
newdef(a$)
a$=""
warning(q%,2,"Templates must be named"):
matchident(a$)<>-1
warning(q%,2,"Template already exists"):
createwindow(brx%,bry%,a$):brx%+=60:bry%-=40
setloaded(
updatefile(0)
bry%<340 bry%=1000
brx%>1040 brx%=40
setloaded(T%):
loaded%=T%
T% loaded%=
loaded%=
:templatef$=deffile$:
I%=0
nh%:handle%(I%)=I%-1:wident$(I%)="":
:handleSP%=nh%
open(handle%,x0%,y0%,x1%,y1%,scx%,scy%,bhandle%)
!q%=handle%
)q%!4=x0%:q%!8=y0%:q%!12=x1%:q%!16=y1%
q%!20=scx%:q%!24=scy%
q%!28=bhandle%
"Wimp_OpenWindow",,q%
close(handle%)
whichwindow(handle%):
I%<>-1
setfileopen(I%,
handle%=spritelist%
spop%=
handle%=options%
interface%
"XWimp_ReleaseInterface",task_handle%
geti(options%,2):
iflags%
(1<<21) finac%=0
geti(options%,3):
iflags%
(1<<21) finac%=1
geti(options%,4):
iflags%
(1<<21) finac%=2
geti(options%,8):interface%=(iflags%
(1<<21))>0
geti(options%,9): hatch%=(iflags%
(1<<21))>0
handle%=handlew%
hw%=
)!q%=handle%:
"Wimp_CloseWindow",,q%
mouse(mousex%,mousey%,buttons%,handle%,icon%,oldbuttons%)
void%
buttons%
&02 :
-- MENU button
I%=
whichwindow(handle%)
menuwindow%=handle%
I%<>-1
(-1)
K !q%=handle%:q%!4=icon%:q%!8=1<<21:q%!12=0:
"Wimp_SetIconState",,q%
(-2)
icon%>-1
! renumber%=
$mb_renumber%
&
renumber(I%,icon%,renumber%)
6
renumber%<9999 $mb_renumber%=
(renumber%+1)
N oldhandle%=handle%:oldicon%=icon%:mmousex%=mousex%:mmousey%=mousey%+44
" mmousey%-=44*(def_menu%=1)
windowmenu(I%)
8 I%=
whichsprite(handle%):
I%<>-1
spritemenu(I%):
handle%
menu(mainmenu%)
spritelist%:
menu(m_spritelist%)
tempfile%:I%=q%+40:
"Wimp_WhichIcon",tempfile%,I%,5<<21,1<<21
!I%=-1
I%!4=-1
-
!I%>-1
deselect(tempfile%,!I%)
/
icon%>-1
select(tempfile%,icon%)
menu(t_file%)
&01,&04 :
-- SELECT/ADJUST buttons
9 I%=
whichsprite(handle%):
I%<>-1
spritepixel(I%):
handle%
icon%
ic_window%
$mb_name%=deftem$
<
"Wimp_CreateMenu",,new_temp%,mousex%-192,160
palette%:
palette
spritelist%
icon%=-1
buttons%=&04
deselectsprites
)
geti(spritelist%,icon%
m_scale%
*
setxy(xsc%,ysc%,$sprbuff%,"x")
xs%=xsc%
icon%
xs%<48 xs%+=dx%
!
xs%>dx% xs%-=dx%
xs%<>xsc%
ys%=xs%*ysc%/xsc%
$ $sprbuff%=
xs%+"x"+
4
upicon(m_scale%,2):
upicon(m_scale%,3)
0
changesize(currentsprite%,xs%,ys%)
m_workarea%
%
setwork(q%,mb_workarea0%)
'
setwork(q%+8,mb_workarea1%)
. x0%=!q%:y0%=q%!4:x1%=q%!8:y1%=q%!12
icon%
0:y1%+=4
1:x1%+=2
2:x0%-=2
3:y0%-=4
+
5:x0%+=2:
x0%>mwx0% x0%=mwx0%
+
6:x1%-=2:
x1%<mwx1% x1%=mwx1%
+
7:y1%-=4:
y1%<mwy1% y1%=mwy1%
+
8:y0%+=4:
y0%>mwy0% y0%=mwy0%
&
xor(m_workarea%,11,6)
/
setworkarea(currentwindow%)
<
(buttons%
1)=0
"Wimp_CreateMenu",,-1
w0$=
x0%+","+
w1$=
x1%+","+
I
w0$<>$mb_workarea0% $mb_workarea0%=w0$:
upicon(m_workarea%,9)
J
w1$<>$mb_workarea1% $mb_workarea1%=w1$:
upicon(m_workarea%,10)
dial_delete%
icon%
%
xor(dial_delete%,2,6)
"
godeletesprites
&
close(dial_delete%)
#
close(dial_delete%)
m_savetemp%
icon%=2
&
checkfull($mb_templates%)
,
savetemplates($mb_templates%,
7
buttons%
&01
"Wimp_CreateMenu",,-1
&
clear%
wipealltemplates
m_savespr%
icon%=2
%
checkfull($mb_spritef%)
)
savesprites($mb_spritef%,
8
buttons%
&01
"Wimp_CreateMenu",,-1
new_temp%
icon%=1
newdef($mb_name%)
close(new_temp%)
options%
(%
icon%<2
close(options%)
icon%=1
** X%=
("<FormEd2$Dir>.Choices")
+9
#X%,deftem$,deffile$:
#X%,finac%:
#X%,auto$
,6
#X%,interface%:
#X%,hatch%:
#X%,country$
-?
#X%:*SetType <FormEd2$Dir>.Choices Text
.) *Stamp <FormEd2$Dir>.Choices
m_resize%
Hilke
2L C%=q%+&80:
"Wimp_WhichIcon",handle%(currentwindow%),C%,5<<21,1<<21
3;
currenticon%>-1
geti(menuwindow%,currenticon%)
icon%
increase max x
6'
handle_resize(6,4,0,0,4,0)
decrease max x
8)
handle_resize(6,-4,0,0,-4,0)
decrease max y
:)
handle_resize(5,-4,0,0,0,-4)
increase max y
<'
handle_resize(5,4,0,0,0,4)
increase min x
>(
handle_resize(6,-4,4,0,0,0)
decrease min x
@(
handle_resize(6,4,-4,0,0,0)
increase min y
B(
handle_resize(5,4,0,-4,0,0)
decrease min y
D(
handle_resize(5,-4,0,4,0,0)
handle_resizeOK
G3
buttons%=4
"Wimp_CreateMenu",,-1
H<
"Wimp_ForceRedraw",menuwindow%,0,-5000,5000,0
I
tempfile%
icon%>-1
LQ I%=
backreffile(icon%):q%!40=handle%(I%):
"Wimp_GetWindowState",,q%+40
M%
q%!72
(1<<16)
(-1)
close(q%!40)
P+
front(q%!40):
setfileopen(I%,
S> I%=q%+40:
"Wimp_WhichIcon",tempfile%,I%,5<<21,1<<21
T3
!I%>-1:
deselect(tempfile%,!I%):I%+=4:
&10,&40 :
-- SELECT/ADJUST dragging
handle%
m_savetemp%,m_savespr%:
dragicon(mousex%,mousey%,handle%,icon%)
icon%<>-1
drag(buttons%,handle%,icon%)
&100,&400:
-- selection if button type = 10
handle%
spritelist%
_+
buttons%=&400
deselectsprites
`!
geti(handle%,icon%
a"
(iflags%
&400000)=0
b3
seti(spritelist%,icon%
1,&200000,0)
c2
seti(spritelist%,icon%
1,&200000,0)
processkey(handle%,icon%,key%)
handle%
m_workarea%
key%=13
l!
xor(m_workarea%,11,6)
m'
setworkarea(currentwindow%)
n#
"Wimp_CreateMenu",,-1
m_savetemp%
key%=13
s%
checkfull($mb_templates%)
t+
savetemplates($mb_templates%,
u%
clear%
wipealltemplates
v#
"Wimp_CreateMenu",,-1
m_savespr%
key%=13
{#
checkfull($mb_spritef%)
|'
savesprites($mb_spritef%,
}#
"Wimp_CreateMenu",,-1
new_temp%
key%=13
newdef($mb_name%)
close(new_temp%)
options%
icon%
5:N%= 6: deftem$=$mb_deft%
6:N%= 7:deffile$=$mb_deff%:
loaded% templatef$=deffile$
7:N%=10: auto$=$mb_auto%
10:N%= 5
"Wimp_SetCaretPosition",handle%,N%,0,0,-1,
iconaddr(handle%,N%)
m_resize%
key% =13
icon%
Q
"Wimp_SetCaretPosition",handle%,6,0,0,-1,
iconaddr(handle%,6)
handle_resizeOK
close(new_temp%)
'
"Wimp_CreateMenu",,-1
?
"Wimp_ForceRedraw",menuwindow%,0,-5000,5000,0
"Wimp_ProcessKey",key%
R------------------------------------------------------------------------------
drag(b%,handle%,icon%)
whichwindow(handle%):
I%=-1
(currentwindow%=I%:currenticon%=icon%
4dragtype%=b%:draghandle%=handle%:dragicon%=icon%
getcurw
getcuri(currenticon%)
+cx0%+=bx%:cy0%+=by%:cx1%+=bx%:cy1%+=by%
%x0%=0:y0%=0:x1%=scrx1%:y1%=scry1%
home_x%=cx0%:home_y%=cy0%
b%=&10
getminxy(flags%,text$,sprite$)
) mx0%=mousex%-cx0%:mx1%=cx1%-mousex%
) my0%=mousey%-cy0%:my1%=cy1%-mousey%
4 x0%=cx0%+minx%:y0%=0:x1%=scrx1%:y1%=cy1%-miny%
mx0%<mx1%
swapx:x0%=0:x1%=cx0%-minx%:x0%+=1:x1%-=1
my0%>my1%
swapy:y0%=cy1%+miny%:y1%=scry1%:y0%+=1:y1%-=1
. x0%+=cx0%-cx1%:y1%+=cy1%-cy0% :
bodge
many_icon%=
many_icon%=
(!q%=handle%:
b%=&40 q%!4=5
q%!4=6
.q%!8=cx0%:q%!12=cy0%:q%!16=cx1%:q%!20=cy1%
+q%!24=x0%:q%!28=y0%:q%!32=x1%:q%!36=y1%
"Wimp_DragBox",,q%
R------------------------------------------------------------------------------
dragicon(mousex%,mousey%,handle%,icon%)
f%,area%,name%,spr_name$,flags%
%dragtype%=&FF:draghandle%=handle%
handle%=m_savetemp%
spr_name$="file_FEC"
handle%=m_savespr%
spr_name$="file_FF9"
getw(handle%)
geti(handle%,icon%)
flags%=q%!24
!q%=handle%:q%!4=5
>q%!8=bx%+ix0%:q%!12=by%+iy0%:q%!16=bx%+ix1%:q%!20=by%+iy1%
*q%!24=q%!8-mousex%:q%!28=q%!12-mousey%
9q%!32=scrx1%+q%!16-mousex%:q%!36=scry1%+q%!20-mousey%
"OS_Byte",161,28
,,f%
DragASprite%=((f%
2)=2)
DragASprite%
f%=flags%
(f%
2)=0
99,"Not a sprite icon to drag"
"DragASprite_Start",%10000101,1,spr_name$,q%+8
"Wimp_DragBox",,q%
R------------------------------------------------------------------------------
swapx
@cx0%=cx0%
cx1%:cx1%=cx1%
cx0%:cx0%=cx0%
cx1%:cx0%-=1:cx1%+=1
R------------------------------------------------------------------------------
swapy
@cy0%=cy0%
cy1%:cy1%=cy1%
cy0%:cy0%=cy0%
cy1%:cy0%-=1:cy1%+=1
R------------------------------------------------------------------------------
getminxy(flags%,text$,sprite$)
x0%,y0%,x1%,y1%,mx%,my%
minx%=0:miny%=0
flags%
text$<>""
flags%
5
"Font_ReadInfo",flags%>>24
,,y0%,,y1%
D
"Font_StringBBox",,
(flags%>>24)+text$
,x0%,,x1%
,
"Font_ConverttoOS",,x0%
,x0%
,
"Font_ConverttoOS",,x1%
,x1%
& minx%=x1%-x0%:miny%=y1%-y0%
minx%=6*dx%+16*
text$:miny%=32
flags%
&04 miny%+=2*dy%
flags%
sprite$<>""
"XOS_SpriteOp",&128,spritearea%,sprite$
,,,mx%,my%,,spm% ; P%
1)=0
A
"XOS_ReadModeVariable",spm%,4
,,spx%:mx%=mx%<<spx%
A
"XOS_ReadModeVariable",spm%,5
,,spy%:my%=my%<<spy%
+
flags%
&800 mx%=mx%/2:my%=my%/2
B
(flags%
&21B)=&13 mx%=minx%+mx% :
sprite+text (V~H~R)
mx%>minx% minx%=mx%
my%>miny% miny%=my%
R------------------------------------------------------------------------------
decodedrag(cx0%,cy0%,cx1%,cy1%)
dragtype%=0
DragASprite%
DragASprite%=
"DragASprite_Stop"
draghandle%=m_savetemp%
sendsave(&FEC,mb_templates%):
draghandle%=m_savespr%
sendsave(&FF9,mb_spritef%):
getw(draghandle%)
'd_x%=cx0%-home_x%:d_y%=cy0%-home_y%
+cx0%-=bx%:cx1%-=bx%:cy0%-=by%:cy1%-=by%
cx0%>cx1%
swapx
cy0%>cy1%
swapy
many_icon%
moveicon(draghandle%,dragicon%,d_x%,d_y%)
<I%=q%+&80:
"Wimp_WhichIcon",draghandle%,I%,5<<21,1<<21
!I%>-1:
!I%<>dragicon%
moveicon(draghandle%,!I%,d_x%,d_y%)
I%+=4:
geti(draghandle%,dragicon%)
-od0%=idata%!0:od1%=idata%!4:od2%=idata%!8
deleteicon(draghandle%,dragicon%)
Pcurrenticon%=
cricon(draghandle%,cx0%,cy0%,cx1%,cy1%,iflags%,od0%,od1%,od2%)
R------------------------------------------------------------------------------
cricon(handle%,x0%,y0%,x1%,y1%,flags%,dt0%,dt1%,dt2%)
!q%=handle%
1q%!20=flags%:q%!24=dt0%:q%!28=dt1%:q%!32=dt2%
text$="":sprite$=""
flags%
flags%
&100 text$=$(q%!24)
text$=$(q%+24)
flags%
flags%
&100
$ sprite$=
getcommand(q%!28,"S")
sprite$=$(q%+24)
getminxy(flags%,text$,sprite$) :
bodge
x1%-x0%<minx% x1%=x0%+minx%
y1%-y0%<miny% y1%=y0%+miny%
!)q%!4=x0%:q%!8=y0%:q%!12=x1%:q%!16=y1%
"Wimp_CreateIcon",,q%
due to interface icon borders redraw a larger area than before!
"Wimp_ForceRedraw",!q%,q%!4-50,q%!8-50,q%!12+50,q%!16+50
"Wimp_GetCaretPosition",,q%
!q%=handle%
q%!4=ic%:
"Wimp_SetCaretPosition",handle%,ic%,0,0,-1,0
(R------------------------------------------------------------------------------
moveicon(handle%,icon%,d_x%,d_y%)
new_handle%
geti(handle%,icon%)
,Boldflags%=iflags%:odt0%=idata%!0:odt1%=idata%!4:odt2%=idata%!8
ix0%+=d_x%:ix1%+=d_x%
iy0%+=d_y%:iy1%+=d_y%
deleteicon(handle%,icon%)
ix0%>ix1%
ix0%,ix1%:ix0%-=1:ix1%+=1
iy0%>iy1%
iy0%,iy1%:iy0%-=1:iy1%+=1
2Pnew_handle%=
cricon(handle%,ix0%,iy0%,ix1%,iy1%,oldflags%,odt0%,odt1%,odt2%)
currenticon%<>-1
currenticon%=new_handle%
5R------------------------------------------------------------------------------
deleteicon(handle%,icon%)
bd%:bd%=20
85!q%=handle%:q%!4=icon%:
"Wimp_GetIconState",,q%
"Wimp_DeleteIcon",,q%
##PH increased redrawn area to erase interface type icons when dragging
"Wimp_ForceRedraw",!q%,q%!8-bd%,q%!12-bd%,q%!16+bd%,q%!20+bd%
=R------------------------------------------------------------------------------
menu(m%)
menuhandle%=m%
getpointer:mmousex%=mousex%:mmousey%=mousey%
encodemenu(m%)
handle%=-2
C+ I%=m%!20+m%!24:J%=m%+28:K%=96-m%!24
D#
K%+=I%:J%+=24:
J%!-24
K%=mousey%+12+44
"Wimp_CreateMenu",,-1
"Wimp_CreateMenu",,menuhandle%,mousex%-102,K%
J' oldhandle%=handle%:oldicon%=icon%
remenu:
menuhandle%=-1
N%handle%=oldhandle%:icon%=oldicon%
encodemenu(menuhandle%)
"Wimp_CreateMenu",,menuhandle%,mmousex%-102,mmousey%+12 :
default coords
crmenu
menufree%+28 > menuend%
1,"Menu area full"
m%,menu$,m$:
menu$
menu$,2)="++":
m$:menu$=
menu$,
menu$-2)+m$:
menu$,1)="=" menu$=
menu$,2)
menuptr%=menufree%
i%=0:ctr%=0
menu$,1)="#" i%=1:menutitle$=
par(",")
menutitle$=""
menutitle$,">")
I%>0
]) menuptr%!20=
menutitle$,I%+1))
^% menutitle$=
menutitle$,I%-1)
menuptr%!20=40
$menuptr%=menutitle$
bJmenuptr%?12=`tfcol:menuptr%?13=2:menuptr%?14=`wfcol:menuptr%?15=`wbcol
c$menuptr%!16=196-24:menuptr%!24=0
d$menuptr%+=28:maxx%=
menutitle$-3
menu$,1)="~"
menu$=
menu$,
menu$-1)
item$=
par(","):
menuitem(item$):
item$=""
menu$
item$=
par(","):
menuitem(item$):
item$=""
menuptr%-menufree% <= 28
= -1 :
null menu
l#menuptr%!-24=(menuptr%!-24)
m"m%=menufree%:m%!16=maxx%*16+12
menufree%=menuptr%
menuitem(text$)
text$=""
menuptr%+24 > menuend%
1,"Menu area full"
text$="&"
"Font_ListFonts",,q%,ctr%
,,ctr%
ctr%>=0 text$=$q%+">m_fsize%":i%-=2
i%,flg%
flg%=&00
text$,"?")
i%<2 i%=
text$,">")
flg%+=&08
i%>0 subptr%=
text$,i%+1):text$=
text$,i%-1)
subptr%=-1
text$,1)="#" text$=
text$,
text$-1):flg%+=&02
menuptr%!0=flg%
menuptr%!4=subptr%
menuptr%!8=&07000021
text$,1)="?"
menuptr%!8=&0700011A
) I%=
workspace(
text$):$I%=
text$,2)
B menuptr%!12=I%:menuptr%!16=systemsprites%:menuptr%!20=
text$
text$,1)="$"
!menuptr%+=&04
menuptr%!8+=&100
i%=
text$,"(")
7
i%>0 L%=
text$,i%+1):text$=
text$,i%-1)
L%=12
< menuptr%!12=
text$,2):menuptr%!16=-1:menuptr%!20=L%
*
L%>15 L%=15 :
icons can scroll
3 text$=
L%-1," ") :
1 char was terminator
text$<=12
! $(menuptr%+12)=text$
)
workspace(
text$):$I%=text$
? menuptr%!12=I%:menuptr%!16=-1:menuptr%!20=
text$+1
) menuptr%!8=menuptr%!8
&100
text$>maxx% maxx%=
text$
menuptr%+=24
par(sep$)
%i1%=i%+1:i%=
menu$+sep$,sep$,i1%)
menu$,i1%,i%-i1%)
R------------------------------------------------------------------------------
windowmenu(I%)
currentwindow%=I%
def_menu%
0:menuhandle%=w_general%
1:currenticon%=oldicon%:menuhandle%=i_general%
remenu
spritemenu(I%)
7currentsprite%=I%:mmousex%=mousex%:mmousey%=mousey%
menu(m_sprite%)
R------------------------------------------------------------------------------
encodemenu(menuhandle%)
encodemenu(menuhandle%)
1,"Menu shouldn't be allowed"
encodemenu(menuhandle%)
menuhandle%<&8000
I%=menuhandle%+28
!I%=!I%
&01:I%!8=I%!8
&400000:I%+=24:
I%!-24
menuhandle%
mainmenu%
encodemenu(m_show%)
m_show%
hw%
tick(m_show%,0)
8 q%!40=tempfile%:
"Wimp_GetWindowState",,q%+40
+
q%!72
(1<<16)
tick(m_show%,1)
%
shade(mainmenu%,4,
loaded%)
i_flags%
currenticon%=-1
N C%=q%+&80:
"Wimp_WhichIcon",handle%(currentwindow%),C%,5<<21,1<<21
C%=!C%
shade(i_flags%,0,1)
shade(i_flags%,1,1)
shade(i_flags%,6,1)
shade(i_flags%,8,1)
C%=currenticon%
C%>-1
getcuri(C%)
C
encodeicon(i_flags%,11,flags%,q%+28,ib_text%,ib_sprite%)
$ib_buffersize%=
$ib_validation%=""
$
encodemenu(i_buffersize%)
(flags%
&01)=0
$
shade(i_buffersize%,1,1)
flags%
&100
E
q%!32>0 $ib_validation%=$(q%!32):
tick(i_buffersize%,1)
- $(i_flags%+28+12+24*14)="Fg colour"
- $(i_flags%+28+12+24*15)="Bg colour"
?
flags%
&02
$(i_flags%+28+12+24*14)="EOR colour"
?
flags%
&20
$(i_flags%+28+12+24*15)="EOR colour"
flags%
&40
# i_flags%?(28+11+24*14)=7
# i_flags%?(28+11+24*15)=7
6
shade(i_flags%,14,1):
shade(i_flags%,15,1)
< i_flags%?(28+11+24*14)=
foreback((flags%>>24)
< i_flags%?(28+11+24*15)=
foreback((flags%>>28)
encodemenu(i_button%)
encodemenu(i_esg%)
i_esg%
'
tick(i_esg%,(flags%>>16)
i_button%
*
tick(i_button%,(flags%>>12)
shade(i_button%,12,1)
shade(i_button%,13,1)
w_general%
.
currentwindow%=-1
deleted!
encodemenu(w_flags%)
- $mb_workarea0%=
(q%!44)+","+
(q%!48)
- $mb_workarea1%=
(q%!52)+","+
(q%!56)
# $mb_minx%=
(q%!72
&FFFF)
! $mb_miny%=
(q%!72 >> 16)
- mwx0%=q%!20:mwy0%=q%!24+(q%!8-q%!16)
- mwx1%=q%!20+(q%!12-q%!4):mwy1%=q%!24
I%=w_colours%+28
B
J%=q%+36
q%+42:I%?11=(?J%<<4)
uncolour%(?J%):I%+=24:
/ $mb_wident% =wident$(currentwindow%)
4 $mb_templates%=
wident$(currentwindow%),10)
i_general%
getcuri(currenticon%)
?
flags%
&800000 currenticon%=-1 :
has been deleted!
I C%=q%+&80:
"Wimp_WhichIcon",handle%(currentwindow%),C%,4<<21,0
!C%=-1
/ $(i_general%!(28+24*2+12))="No icons"
.
A%=2
shade(i_general%,A%,1):
N C%=q%+&80:
"Wimp_WhichIcon",handle%(currentwindow%),C%,5<<21,1<<21
)
!C%=-1
shade(i_general%,4,1)
currenticon%>-1
< $(i_general%!(28+24*2+12))="Icon #"+
currenticon%
!C%=-1
1 $(i_general%!(28+24*2+12))="No icons"
"
shade(i_general%,2,1)
7 $(i_general%!(28+24*2+12))="Selected icons"
i_sel%
M C%=q%+&80:
"Wimp_WhichIcon",handle%(currentwindow%),C%,5<<21,1<<21
!C%=-1
C%!4=-1
@
shade(i_sel%,4,1):
shade 'Same size' if <2 selected
i_sel%!16=152
currenticon%>-1
+ $i_sel%="Icon":i_renumber%!16=160
= $(i_sel%!(28+24*8+12))="Renumber #"+
$mb_renumber%
$i_sel%="Selected"
> $(i_sel%!(28+24*8+12))="Renumber":i_renumber%!16=128
shade(i_sel%,8,1)
encodemenu(i_flags%)
encodemenu(i_align%)
encodemenu(i_arrange%)
encodemenu(i_delete%)
i_delete%
currenticon%>-1
$ $mb_delete%=
currenticon%
$mb_delete%=""
i_align%
#0
if <2 icons are selected then shade..
$M I%=q%+&80:
"Wimp_WhichIcon",handle%(currentwindow%),I%,5<<21,1<<21
!I%=-1
I%!4=-1
shade(i_align%,0,1)
shade(i_align%,1,1)
shade(i_align%,2,1)
shade(i_align%,3,1)
shade(i_align%,4,1)
shade(i_align%,5,1)
i_arrange%
.0
if <2 icons are selected then shade..
/M I%=q%+&80:
"Wimp_WhichIcon",handle%(currentwindow%),I%,5<<21,1<<21
!I%=-1
I%!4=-1
1!
shade(i_arrange%,0,1)
2!
shade(i_arrange%,1,1)
3!
shade(i_arrange%,2,1)
58
shade(i_arrange%,2,1):
shade 'Both' for now..
w_flags%
7$ !q%=handle%(currentwindow%)
8$
"Wimp_GetWindowInfo",,q%
I%=0
:.
q%!32
(1<<I%)
tick(w_flags%,I%)
<,
q%!32
(3<<8)
tick(w_flags%,8)
=>
q%!32
(1<<10)
tick(w_flags%,9) :
real colours
>=
q%!32
(1<<11)
tick(w_flags%,10) :
back window
?;
q%!32
(1<<12)
tick(w_flags%,11) :
grab keys
encodemenu(t_flags%)
currenticon%=-1
BD flags%=q%!64:
encodemenu(i_button%):
shade(i_button%,14,1)
shade(w_flags%,12,1)
I%=14
G6
q%!32
(1<<(I%+24-14))
tick(w_flags%,I%)
q%!32
&80000000
tick(w_flags%,13)
shade(w_flags%,0,1)
shade(w_flags%,2,1)
shade(w_flags%,3,1)
shade(w_flags%,7,1)
P/
I%=14
shade(w_flags%,I%,1):
t_flags%
SM q%!60=q%!60
&24 :
must be filled with border
T@
encodeicon(t_flags%,6,q%!60,q%+76,tb_text%,tb_sprite%)
$tb_buffersize%=
V&
q%!60
&100
tick(t_flags%,7)
W&
q%!60
&200
tick(t_flags%,8)
w_scroll%
getcurw
Z(
flags%
&100
tick(w_scroll%,0)
[(
flags%
&200
tick(w_scroll%,1)
m_spritelist%
]. $mb_spritef%=spritef$:iflags%=&400000
^(
icon%<>-1
geti(handle%,icon%)
iflags%
&400000
`$
shade(m_spritelist%,1,1)
a$
shade(m_spritelist%,2,1)
c4 renamesprite$=
iconstring(iflags%,idata%)
d& $mb_rnsprite%=renamesprite$
f;
"Wimp_WhichIcon",spritelist%,q%,&200001,&200001
g+
!q%=-1
shade(m_spritelist%,0,1)
i_new%
$ib_text%=""
$ib_sprite%=""
m_palette%
def_menu%
m7
0:C%=((w_colours%!(36+24*menus%!4)>>28)
n7
1:C%= ((i_flags%!(36+24*menus%!8)>>28)
:C%=13
encodepalmenu(C%)
t_file%
s; I%=q%:
"Wimp_WhichIcon",tempfile%,I%,5<<21,1<<21
t" $mb_templates%=templatef$
!I%=-1
v3
shade(t_file%,0,1):m$="Nothing":curw%=-1
xW
I%!4>-1 m$="Selection":curw%=-1
curw%=
backreffile(!I%):m$=wident$(curw%)
y?
shade(t_sel%,2,(I%!4>-1)):
shade(t_sel%,3,(I%!4>-1))
{# $(t_file%!(28+24*0+12))=m$
loaded%
~1
shade(t_file%,:,1):
shade(t_file%,2,1)
1
shade(t_file%,4,1):
shade(t_file%,6,1)
m_resize%
currenticon%<>-1
*
geti(menuwindow%,currenticon%)
9
shell_IconPutData(m_resize%,5,
(iy1%-iy0%),0)
9
shell_IconPutData(m_resize%,6,
(ix1%-ix0%),0)
B
if no icons are selected and currenticon%=-1 then the
E
resize menu entry is greyed already, so a selection must
"
exist to reach here..
O C%=q%+&80:
"Wimp_WhichIcon",handle%(currentwindow%),C%,5<<21,1<<21
C%>-1
B
geti(menuwindow%,C%!0):
take coords of first icon..
;
shell_IconPutData(m_resize%,5,
(iy1%-iy0%),0)
;
shell_IconPutData(m_resize%,6,
(ix1%-ix0%),0)
shade(mh%,I%,T%):mh%+=28+8+24*I%:T%=(T%<>0)
,!mh%=!mh%
&400000)
(T%
(1<<22)):
tick(mh%,I%):mh%!(28+24*I%)=mh%!(28+24*I%)
select(h%,i%):!q%=h%:q%!4=i%:q%!8=&200000
0 q%!12=&200000:
"Wimp_SetIconState",,q%:
deselect(h%,i%)
B!q%=h%:q%!4=i%:q%!8=0:q%!12=&200000:
"Wimp_SetIconState",,q%
encodeicon(iconmenu%,nmenu%,flags%,q%,itext%,isprite%)
i_font%<0
shade(iconmenu%,6,1)
$itext%="":$isprite%=""
flags%
&01 $itext%=
iconstring(flags%,q%)
(flags%
&03)=&02 $isprite%=
iconstring(flags%,q%)
flags%
&100 L%=q%!8
L%=12 :
returned to caller
I%=iconmenu%+28:J%=1
item%=0
nmenu%:
flags%
J% !I%=!I%
I%+=24:J%+=J%:
decodemenu(MenuHandle%,menus%)
temp%,minix%,miniy%,maxix%,maxiy%,ref_cl%,nr_left_side%
nr_right_side%,x_centre%,y_centre%
MenuHandle%
mainmenu%
!menus%
D
getpointer:
&400D4,,proginfo%,mousex%-160,mousey%+64
spriteinfo
menus%!4
$
movehandles(
#
updatefile(1)
A
3:$mb_deft%=deftem$:$mb_deff%=deffile$:$mb_auto%=auto$
%
deselect(options%,2)
%
deselect(options%,3)
%
deselect(options%,4)
%
deselect(options%,8)
%
deselect(options%,9)
*
select(options%,finac%+2)
0
interface%
select(options%,8)
0
hatch%
select(options%,9)
9 !q%=options%:
"Wimp_GetWindowState",,q%
4
"Wimp_CreateMenu",,!q%,q%!4,q%!16
G
"Wimp_SetCaretPosition",options%,5,0,0,-1,
$mb_deft%
finac%
/
checkfull($mb_templates%)
8
savetemplates($mb_templates%,
)
wipealltemplates
C
1:clear%=
getpointer:$mb_templates%=templatef$
P
"Wimp_CreateMenu",,m_savetemp%,mousex%-112,mousey%+64
&
wipealltemplates
finish:
i_general%
!menus%
A
0:def_menu%=0:
getmenuposn:
windowmenu(currentwindow%)
getcurw
= mx%=mmousex%-bx%:my%=mmousey%-by%:t$="":s$=""
menus%!4
/
0:t$=$ib_text%:fl%=&C700603D
0 ix%=16*(
(t$)+2):iy%=&30
1
1:s$=$ib_sprite%:fl%=&0700601A
,
getminxy(fl%,"",s$)
+ ix%=minx%:iy%=miny%
@
menus%!8>-1 t$=
((menus%!8)+136)
t$="?"
5 fl%=&C700603D:ix%=&28:iy%=&30
B
3:t$=$ib_text%:s$="Soptoff,opton":fl%=&1700B113
0 ix%=16*(
(t$)+4):iy%=&30
J
4:t$=" "+$ib_text%:s$="Sradiooff,radioon":fl%=&1700B113
0 ix%=16*(
(t$)+4):iy%=&30
/
5:t$=$ib_text%:fl%=&0700E13D
0 ix%=16*(
(t$)+2):iy%=&30
/
6:t$=$ib_text%:fl%=&C71F903D
0 ix%=16*(
(t$)+2):iy%=&30
/
7:t$=$ib_text%:fl%=&17006019
0 ix%=16*(
(t$)+2):iy%=&30
--------------------##PH Interface mods ---------------------------------------------
4
8:t$=" ":fl%=&17006139:s$="b1"
0 ix%=16*(
(t$)+2):iy%=&30
!
9:t$=$ib_text%
0 ix%=16*(
(t$)+2):iy%=&30
- s$="b0":fl%=&17006139
"
10:t$=$ib_text%
1 ix%=16*(
(t$)+2):iy%=&30
. s$="b3":fl%=&17006139
"
11:t$=$ib_text%
1 ix%=16*(
(t$)+2):iy%=&30
- s$="b3":fl%=&700E13D
"
12:t$=$ib_text%
1 ix%=16*(
(t$)+2):iy%=&30
. s$="b2":fl%=&17006139
13:t$=" "
1 ix%=16*(
(t$)+2):iy%=&30
. s$="b6":fl%=&17006139
14:t$=" "
1 ix%=16*(
(t$)+2):iy%=&30
. s$="b5":fl%=&17006139
G
15:t$=$ib_text%:s$="S3doptoff,3dopton":fl%=&1700B113
1 ix%=16*(
(t$)+4):iy%=&30
O
16:t$=" "+$ib_text%:s$="S3dradiooff,3dradioon":fl%=&1700B113
1 ix%=16*(
(t$)+4):iy%=&30
#
menus%!8
L
0:t$="":s$="3dleft" :fl%=&700601A:ix%=&28:iy%=&30
L
1:t$="":s$="3dright":fl%=&700601A:ix%=&28:iy%=&30
L
2:t$="":s$="3ddown" :fl%=&700601A:ix%=&28:iy%=&30
L
3:t$="":s$="3dup" :fl%=&700601A:ix%=&28:iy%=&30
--------------------##PH Interface mods ---------------------------------------------
.
:t$="Untitled":fl%=&C700603D
' ix%=192:iy%=&30
M q%!4=mx%-ix%/2:q%!8=my%-iy%*3/2:q%!12=q%!4+ix%:q%!16=q%!8+iy%
/
t$>11
s$>11 fl%=fl%
q%!20=fl%
fl%
256
2
(((fl%
3)=3)
(fl%
257))
3 q%!24=
workspace(
t$):$(q%!24)=t$
3 q%!28=
workspace(
s$):$(q%!28)=s$
q%!32=
s$=""
4 q%!24=
workspace(
t$):$(q%!24)=t$
q%!28=-1
q%!32=
4 q%!24=
workspace(
s$):$(q%!24)=s$
$ q%!28=spritearea%
q%!32=
4
fl%
1 $(q%+24)=t$
$(q%+24)=s$
7
"Wimp_CreateIcon",,q%
currenticon%
S
"Wimp_ForceRedraw",!q%,(q%!4)-50,(q%!8)-50,(q%!12)+50,(q%!16)+50
menus%!4
#
currenticon%>-1
'
getcuri(currenticon%)
&
deleteicon(!q%,q%!4)
e
decodeicon(menus%+8,q%+24,q%+28,ib_text%,ib_sprite%,ib_buffersize%,$ib_validation%)
Y currenticon%=
cricon(!q%,q%!8,q%!12,q%!16,q%!20,q%!24,q%!28,q%!32,q%!36)
!$
encodemenu(i_sel%)
I%=q%+&80
$K
"Wimp_WhichIcon",handle%(currentwindow%),I%,5<<21,1<<21
!I%>-1
getcuri(!I%)
''
deleteicon(!q%,q%!4)
menus%!8
)I
2,3,4,5,7,8,9,10,11:B%=1<<(menus%!8):A%=(q%!24)
*4
12:B%=15<<12:A%=(menus%!12)<<12
+4
13:B%=31<<16:A%=(menus%!12)<<16
,4
14:B%=15<<24:A%=(menus%!12)<<24
-4
15:B%=15<<28:A%=(menus%!12)<<28
/6 A%=A%
B%:q%!24=(q%!24
B%))
0O
cricon(!q%,q%!8,q%!12,q%!16,q%!20,q%!24,q%!28,q%!32,q%!36)
I%+=4
!I%>-1
3
getcuri(!I%)
4(
deleteicon(!q%,q%!4)
5, q%!24=(q%!24
B%))
6P
cricon(!q%,q%!8,q%!12,q%!16,q%!20,q%!24,q%!28,q%!32,q%!36)
I%+=4
9;
(menus%!8)>13
encodepalmenu(menus%!12)
:%
encodemenu(i_sel%)
>#
currenticon%>-1
?&
getcuri(currenticon%)
flags%
A9 B%=
workspace(q%!36):$B%=text$:q%!28=B%
BK
q%!32>0 B%=
workspace(
$(q%!32)+1):$B%=$(q%!32):q%!32=B%
D6 x0%=q%!8:y0%=q%!12:x1%=q%!16:y1%=q%!20
menus%!8
F)
-1:copyx%=16:copyy%=-16
G-
0:copyx%=x0%-x1%-8:copyy%=0
H-
1:copyx%=x1%-x0%+8:copyy%=0
I-
2:copyx%=0:copyy%=y1%-y0%+4
J-
3:copyx%=0:copyy%=y0%-y1%-4
L? x0%+=copyx%:y0%+=copyy%:x1%+=copyx%:y1%+=copyy%
MQ currenticon%=
cricon(!q%,x0%,y0%,x1%,y1%,q%!24,q%!28,q%!32,q%!36)
OR I%=q%+&80:
"Wimp_WhichIcon",handle%(currentwindow%),I%,5<<21,1<<21
P= min_x%=1E8:max_x%=-1E8:min_y%=1E8:max_y%=-1E8
!I%>-1
R#
getcuri(!I%):I%+=4
S)
cx0%<min_x% min_x%=cx0%
T)
cx1%>max_x% max_x%=cx1%
U)
cy0%<min_y% min_y%=cy0%
V)
cy1%>max_y% max_y%=cy1%
menus%!8
Y)
-1:copyx%=16:copyy%=-16
Z3
0:copyx%=min_x%-max_x%-8:copyy%=0
[3
1:copyx%=max_x%-min_x%+8:copyy%=0
\3
2:copyx%=0:copyy%=max_y%-min_y%+4
]3
3:copyx%=0:copyy%=min_y%-max_y%-4
I%=q%+&80
!I%>-1
getcuri(!I%)
flags%
c9 B%=
workspace(q%!36):$B%=text$:q%!28=B%
dK
q%!32>0 B%=
workspace(
$(q%!32)+1):$B%=$(q%!32):q%!32=B%
f6 x0%=q%!8:y0%=q%!12:x1%=q%!16:y1%=q%!20
g? x0%+=copyx%:y0%+=copyy%:x1%+=copyx%:y1%+=copyy%
hF
cricon(!q%,x0%,y0%,x1%,y1%,q%!24,q%!28,q%!32,q%!36)
i<
deselect(handle%(currentwindow%),!I%):I%+=4
m* h%=handle%(currentwindow%)
menus%!8
o#
0:ix%=-dx%:iy%=0
p#
1:ix%=+dx%:iy%=0
q#
2:iy%=+dy%:ix%=0
r#
3:iy%=-dy%:ix%=0
t#
currenticon%=-1
I%=q%+&80
vK
"Wimp_WhichIcon",handle%(currentwindow%),I%,5<<21,1<<21
!I%>-1
x1
moveicon(h%,!I%,ix%,iy%):I%+=4
{3
moveicon(h%,currenticon%,ix%,iy%)
~7
PH mod - add resize dialog for icons
"
Handle_Same_size
I%=q%+&80
K
"Wimp_WhichIcon",handle%(currentwindow%),I%,5<<21,1<<21
8 J%=q%+&400:J%!0=handle%(currentwindow%)
$
currenticon%=-1
4 J%!4=
pick_referenceicon(J%!0,I%)
$ J%!4=currenticon%
K
"Wimp_GetIconState",,J% :
get position of first icon..
menus%!8
!
left align
minix%=J%!8
!I%>-1
J%!4=!I%
/
"Wimp_GetIconState",,J%
;
moveicon(!J%,!I%,minix%-J%!8,0):I%+=4
"
right align
maxix%=J%!16
!I%>-1
J%!4=!I%
/
"Wimp_GetIconState",,J%
<
moveicon(!J%,!I%,maxix%-J%!16,0):I%+=4
top align
miniy%=J%!20
!I%>-1
J%!4=!I%
/
"Wimp_GetIconState",,J%
<
moveicon(!J%,!I%,0,miniy%-J%!20):I%+=4
#
bottom align
maxiy%=J%!12
!I%>-1
J%!4=!I%
/
"Wimp_GetIconState",,J%
<
moveicon(!J%,!I%,0,maxiy%-J%!12):I%+=4
V Centre
2 x_centre%=((J%!16-J%!8)/2)+J%!8
!I%>-1
J%!4=!I%
/
"Wimp_GetIconState",,J%
O
moveicon(!J%,!I%,x_centre%-((J%!16-J%!8)/2+J%!8),0):I%+=4
H Centre
. y_centre%=((J%!12+J%!20)/2)
!I%>-1
J%!4=!I%
/
"Wimp_GetIconState",,J%
N
moveicon(!J%,!I%,0,y_centre%+
(((J%!12+J%!20)/2))):I%+=4
I%=q%+&80
K
"Wimp_WhichIcon",handle%(currentwindow%),I%,5<<21,1<<21
8 J%=q%+&400:J%!0=handle%(currentwindow%)
$
currenticon%=-1
4 J%!4=
pick_referenceicon(J%!0,I%)
$ J%!4=currenticon%
% reference_icon%=J%!4
menus%!8
>
arrange_horizontal(J%!0,reference_icon%)
<
arrange_vertical(J%!0,reference_icon%)
menus%!8=-1
$
currenticon%=-1
I%=q%+&80
L
"Wimp_WhichIcon",handle%(currentwindow%),I%,5<<21,1<<21
!I%>-1
A
deleteicon(handle%(currentwindow%),!I%):I%+=4
C
deleteicon(handle%(currentwindow%),currenticon%)
#
$mb_delete%=""
I !q%=handle%(currentwindow%):
"Wimp_GetWindowInfo",,q%
(
q%!88>
$mb_delete%
D
deleteicon(handle%(currentwindow%),
$mb_delete%)
>
warning(q%,2,"Icon number out of range")
( renumber%=
$mb_renumber%
@
renumber(currentwindow%,currenticon%,renumber%)
=
renumber%<9999 $mb_renumber%=
(renumber%+1)
I
3:I%=q%+&40:!q%=handle%(currentwindow%):q%!8=1<<21:q%!12=1<<21
6
"Wimp_WhichIcon",!q%,I%,5<<21,0<<21
E
!I%>-1:q%!4=!I%:
"Wimp_SetIconState",,q%:I%+=4:
E
4:I%=q%+&40:!q%=handle%(currentwindow%):q%!8=0:q%!12=1<<21
6
"Wimp_WhichIcon",!q%,I%,5<<21,1<<21
E
!I%>-1:q%!4=!I%:
"Wimp_SetIconState",,q%:I%+=4:
1
5:I%=q%+48:!q%=handle%(currentwindow%)
+
"Wimp_GetWindowInfo",,q%
3 A%=q%!44:B%=q%!48:C%=q%!52:D%=q%!56
2
"Wimp_WhichIcon",!q%,I%,1<<23,0
!I%<>-1
getcuri(!I%)
((cx0%<A%
cx1%<A%)
(cx0%>C%
cx1%>C%))
((cy0%<B%
cy1%<B%)
(cy0%>D%
cy1%>D%))
deleteicon(!q%,!I%)
I%+=4
<
deletewindow(currentwindow%):currentwindow%=-1
w_general%
!menus%
A
0:def_menu%=1:
getmenuposn:
windowmenu(currentwindow%)
+
decodemenu(w_flags%,menus%+4)
,
menus%!4<>-1
menus%!8<>-1
- !q%=handle%(currentwindow%)
-
"Wimp_GetWindowInfo",,q%
D q%?(36+menus%!4)=menus%!8:
encodepalmenu(menus%!8)
& curw%=currentwindow%
0
crwindow(q%+4,wident$(curw%))
&
deletewindow(curw%)
)
setworkarea(currentwindow%)
$mb_wident%=""
;
warning(q%,2,"Templates must be named")
A
checkident($mb_wident%,wident$(currentwindow%))
4 wident$(currentwindow%)=$mb_wident%
<
deletewindow(currentwindow%):currentwindow%=-1
w_flags%
!menus%=-1
$ !q%=handle%(currentwindow%)
$
"Wimp_GetWindowInfo",,q%
!menus%
decodetitle(1)
1:q%!32=q%!32
2:q%!32=q%!32
3:q%!32=q%!32
4:q%!32=q%!32
5:q%!32=q%!32
6:q%!32=q%!32
7:q%!32=q%!32
8:q%!32=q%!32
menus%!4
$
0:q%!32=q%!32
$
1:q%!32=q%!32
9:q%!32=q%!32
10:q%!32=q%!32
11:q%!32=q%!32
&1000
1
menus%!4<>-1 q%!64=(menus%!4)<<12
#
13:q%!32=q%!32
&80000000
<
14,15,17,18,19,20:q%!32=q%!32
(1<<(10+!menus%))
!
decodetitle(1<<26)
curw%=currentwindow%
""
changewindow(q%+4,curw%)
m_spritelist%
!menus%
%W
0:A%=
warning(q%,3,"Are you sure you want to delete the selected sprites ?")
&'
A%=1
godeletesprites
'+
$mb_rnsprite%<>renamesprite$
(L
"OS_SpriteOp",&11B,spritearea%,renamesprite$,mb_rnsprite%
spriteinfo
++
$mb_rnsprite%<>renamesprite$
,L
"OS_SpriteOp",&11A,spritearea%,renamesprite$,mb_rnsprite%
spriteinfo
/3
loadsprites($mb_spritef%):
spriteinfo
0%
checkfull($mb_spritef%)
1,
savesprites($mb_spritef%,
24
mergesprites($mb_spritef%):
spriteinfo
t_file%
!menus%
6B
0:J%=q%+40:
"Wimp_WhichIcon",tempfile%,J%,5<<21,1<<21
menus%!4
8a
!J%>-1:B%=
backreffile(!J%):
front(handle%(B%)):
setfileopen(B%,1):J%+=4:
9a
!J%>-1:B%=
backreffile(!J%):q%!36=handle%(B%):
"Wimp_CloseWindow",,q%+36
:1
setfileopen(B%,0):J%+=4:
;5
2:a$=$mb_wident%:W%=
matchident(a$)
<R
a$=""
warning(q%,2,"Templates must be named")
1,""
=S
W%<>-1
warning(q%,2,"Template already exists")
1,""
>E !q%=handle%(curw%):
"Wimp_GetWindowInfo",,q%
?:
crwindow(q%+4,a$,0):
updatefile(0)
@5
3:a$=$mb_wident%:W%=
matchident(a$)
AR
a$=""
warning(q%,2,"Templates must be named")
1,""
B_
W%<>-1
W%<>curw%
warning(q%,2,"Template already exists")
1,""
C? wident$(curw%)=a$:
updatefilename(curw%)
DU
!J%>-1:
deletewindow(
backreffile(!J%)):J%+=4:
updatefile(0)
F>
1:I%=q%+40:
"Wimp_WhichIcon",tempfile%,I%,5<<21,0
G8
!I%>-1:
select(tempfile%,!I%):I%+=4:
HB
2:I%=q%+40:
"Wimp_WhichIcon",tempfile%,I%,5<<21,1<<21
I:
!I%>-1:
deselect(tempfile%,!I%):I%+=4:
J-
getpointer:
newdef($mb_wident%)
Ko
4:A%=
warning(q%,3,"Are you sure you want to clear all of the templates ?"):
A%=1
wipealltemplates
L7
"XOS_File",5,$mb_templates%
T%,,R%;F%
M# typ%=(R%>>8)
&FFF
P1
warning(q%,1,
string0(T%+4))
T%=1
Rs
typ%<>&FEC A%=
warning(q%,3,"This is not a template file - Are you sure you want to load it ?")
SC
typ%=&FEC
A%=1
loadtemplates($mb_templates%)
UF
warning(q%,1,"File "+$mb_templates%+" not found")
W'
checkfull($mb_templates%)
X0
savetemplates($mb_templates%,
loadsprites(f$):
"OS_SpriteOp",&10A,spritearea%,f$
f$<>"<Wimp$Scrap>" spritef$=f$
following added by Paul Hobbs to redraw all windows after loading
a sprite file so that sprites appear immediately
"Wimp_ForceRedraw",-1,0,0,10000,10000
savesprites(f$,safe%):
"OS_SpriteOp",&10C,spritearea%,f$
safe%
spritef$=f$
$spritef%<>
spfname(spritef$)
h" $spritef%=
spfname(spritef$)
i. !q%=spritelist%:
"Wimp_CloseWindow",,q%
front(spritelist%)
mergesprites(f$)
"OS_SpriteOp",&10B,spritearea%,f$
following added by Paul Hobbs to redraw all windows after loading
a sprite file so that sprites appear immediately
"Wimp_ForceRedraw",-1,0,0,10000,10000
filetype(f$)
f%,type%
"OS_File",17,f$
type%,,f%
type%<>1
= -2
(f%>>>20)=&FFF
= (f%>>>8)
&FFF
= -1
decodetitle(bit%)
menus%!4
-1:q%!32=q%!32
:q%!32=q%!32
menus%!4=8 menus%!4=9 :
bodge for 'right-justified' bit
menus%!4=7 menus%!4=8 :
bodge for 'indirected' bit
decodeicon(menus%+4,q%+60,q%+76,tb_text%,tb_sprite%,tb_buffersize%,"")
setxy(
y%,a$,sep$)
a$:y%=
a$,sep$)+1)
setwork(q%,v%)
"!q%=
$v%:q%!4=
$(v%+
$v%,","))
setworkarea(curw%)
h%=handle%(curw%)
setwork(q%,mb_workarea0%)
setwork(q%+8,mb_workarea1%)
"Wimp_SetExtent",h%,q%
4min% = (
$mb_minx%
&FFFF)
$mb_miny% << 16)
&!q%=h%:
"Wimp_GetWindowInfo",,q%
q%!72<>min%
> q%!72=min%:
"Wimp_CreateWindow",,q%+4
handle%(curw%)
1 !q%=handle%(curw%):
"Wimp_OpenWindow",,q%
' !q%=h%:
"Wimp_DeleteWindow",,q%
godeletesprites
@I%=q%+&40:
"Wimp_WhichIcon",spritelist%,I%,&200001,&200001
!q%=spritelist%
!I%<>-1
'q%!4=!I%:
"Wimp_GetIconState",,q%
"OS_SpriteOp",&119,spritearea%,q%+28
I%+=4:
spriteinfo
decodeicon(menus%,fptr%,qptr%,mb_text%,mb_sprite%,mb_buffersize%,v$)
!menus%
0:oldf%=!fptr%
menus%!4
#
-1:!fptr%=!fptr%
:!fptr%=!fptr%
7
(oldf%
&01)=0 !fptr%=!fptr%
6
puticonstring(oldf%,fptr%,qptr%,$mb_text%)
1:oldf%=!fptr%
menus%!4
#
-1:!fptr%=!fptr%
%
:!fptr%=(!fptr%
7
!fptr%
&01 A$=$mb_text%
A$=$mb_sprite%
/
puticonstring(oldf%,fptr%,qptr%,A$)
2:!fptr%=!fptr%
3:!fptr%=!fptr%
4:!fptr%=!fptr%
5:!fptr%=!fptr%
"Wimp_DecodeMenu",,i_font%,menus%+4,
100," ")
,,,fontname$
:
menus%!4<>-1
menus%!8=4 fontname$+=" point"
fontname$=""
" !fptr%=!fptr%
fptr%?3=&D7
!fptr%=!fptr%
)
fontname$,5)="point"
" I%=
fontname$
3
I%=I%-1:
fontname$,I%,1)="."
, psiz%=
fontname$,I%+1)
/ fontname$=
fontname$,I%-1)
psiz%=12
2 fptr%?3=
findfont(fontname$,psiz%)
7:!fptr%=!fptr%
!fptr%
&100 B$=$!qptr%
B$=$qptr%
?
menus%!4=-1 !fptr%=!fptr%
&100
!fptr%=!fptr%
!fptr%
% qptr%!8=
$mb_buffersize%
> !qptr%=
workspace(qptr%!8):$!qptr%=
B$,qptr%!8-1)
v$=""
qptr%!4=-1
#
(!fptr%
&03)=&02
* qptr%!4=spritearea%
;
qptr%!4=
workspace(
v$+1):$(qptr%!4)=v$
$qptr%=
B$,11)
%
(!fptr%
&103) = &102
0
qptr%!4 > 1 !fptr%=!fptr%
9:!fptr%=!fptr%
10:!fptr%=!fptr%
11:!fptr%=!fptr%
12:!fptr%=
field(!fptr%,12,4,menus%!4)
13:!fptr%=
field(!fptr%,16,5,menus%!4)
14:!fptr%=
field(!fptr%,24,4,menus%!4):
encodepalmenu(menus%!4)
15:!fptr%=
field(!fptr%,28,4,menus%!4):
encodepalmenu(menus%!4)
field(flg%,b0%,nb%,i%)
i%<>-1
=flg%
(((1<<nb%)-1)<<b0%)
(i%<<b0%)
=flg%
puticonstring(oldf%,fptr%,qptr%,A$)
oldf%
&100
;
(!fptr%
&03)=&02 qptr%!4=-1 :
no sprite area
A$<qptr%!8
+ $!qptr%=A$:!fptr%=!fptr%
&100:
A$<12
+ $qptr%=A$:!fptr%=!fptr%
&100:
!fptr%=!fptr%
&100
*!qptr%=
workspace(
A$+1):qptr%!8=
$!qptr%=A$
(oldf%
&100)=0 qptr%!4=-1 :
keep old validation string, if any
R------------------------------------------------------------------------------
renumber(curw%,curi%,newi%):
curi%<0
newi%<0
M%,N%:!q%=handle%(curw%):
"Wimp_GetWindowInfo",,q%
q%!88 <= newi%
warning(q%,2,"Icon number out of range"):
+M%=q%+4+88+32*curi%:N%=q%+4+88+32*newi%
I%=0
M%!I%,N%!I%:
crwindow(q%+4,wident$(curw%)):
deletewindow(curw%)
R------------------------------------------------------------------------------
dialogue(handle%,mx%,my%)
getw(handle%):
open(handle%,mx%,my%+y0%-y1%,mx%+x1%-x0%,my%,0,0,-1)
"Wimp_SetCaretPosition",handle%,-1,0,0,&3000000,0:
getw(handle%)
x0%,y0%,x1%-x0%,y1%-y0%+40:dialogue%=handle%
R------------------------------------------------------------------------------
standardwindow(brx%,bry%,n$)
I%=0
4:q%!I%=default%!I%:
:q%!84=0:q%!64=spritearea%
NI%=q%!8-q%!0:q%!0=brx%:q%!8=q%!0+I%:I%=q%!4-q%!12:q%!12=bry%:q%!4=q%!12+I%
$(q%+72)=n$:
createwindow(brx%,bry%,wident$)
standardwindow(brx%,bry%,wident$)
crwindow(q%,wident$,1)
crwindow(q%,wident$,F%)
IF handle%(handleSP%)=-1 IF FNwarning(q%,1,FNmsg0("TEMPFL"))OR1 ERROR 1,""
"Wimp_CreateWindow",,q%
handle%
Am%=handleSP%:handleSP%=handle%(handleSP%):handle%(m%)=handle%
!q%=handle%:
"Wimp_GetWindowState",,q%:
"Wimp_OpenWindow",,q%
)currentwindow%=m%:wident$(m%)=wident$
currenticon%=-1
whichwindow(handle%)
handle%=-1
handle%(nh%+1)=handle%
&I%=-1:
I%+=1:
handle%(I%)=handle%
I%>nh%
whichsprite(handle%)
handle%=-1
spritew%(ns%+1)=handle%
'I%=-1:
I%+=1:
spritew%(I%)=handle%
I%>ns%
deletewindow(I%):!q%=handle%(I%):handle%(I%)=handleSP%:handleSP%=I%
"Wimp_DeleteWindow",,q%:wident$(I%)=""
9I%=0:C%=
I%<=nh%
C%:C%=(wident$(I%)=""):I%+=1:
C% curbuff%=initbuf%:
setloaded(
deletesprite(I%)
((paint_drag%>>16)
&7FFF)=I% paint_drag%=-1
sprSP2%=I%
sprSP2%=nsprite%(I%)
i%=sprSP2%:
i1%=i%:i%=nsprite%(i%):
i%=I%
&# nsprite%(i1%)=nsprite%(i%)
seti(spritelist%,spritei%(I%)
1,0,&600000)
!q%=spritew%(I%)
*!spritew%(I%)=sprSP%:sprSP%=I%
"Wimp_DeleteWindow",,q%
getcurw:!q%=handle%(currentwindow%):
"Wimp_GetWindowState",,q%
info(q%+4):
getcuri(currenticon%):!q%=handle%(currentwindow%)
00q%!4=currenticon%:
"Wimp_GetIconState",,q%
1;cx0%=q%!8:cy0%=q%!12:cx1%=q%!16:cy1%=q%!20:flags%=q%!24
flags%
&100 text$=$(q%!28)
text$=$(q%+28)
(flags%
&103)=&103 sprite$=
getcommand(q%!32,"S")
sprite$=text$
getcommand(v%,c$):
v%<=0
=""
6$I%=
";"+$v%,";"+c$):
I%=0
$(v%+I%),
$(v%+I%)+";",";")-1)
iconstring(flg%,p%):
i%,i$
flg%
&100 i$=$!p%
i%=p%?12:p%?12=13:i$=$p%:p%?12=i%
getpointer:
"Wimp_GetPointerInfo",,q%:mousex%=!q%:mousey%=q%!4
<-buttons%=q%!8:handle%=q%!12:icon%=q%!16:
=R------------------------------------------------------------------------------
warning(b%,f%,a$):!b%=1:$(b%+4)=a$+
"Wimp_DragBox",,-1
?Bmenuhandle%=-1:
"Wimp_ReportError",b%,f%,"FormEd2"
,A%:=A%
errorbox(err%,err$,erl%)
editoff("")
B!Err%=err%:Err$=err$:Erl%=erl%
inerror%
errordisplay(err%,err$,erl%)
inerror%=
"Wimp_DragBox",,-1 : dragtype%=0:pdrag%=-1
dialogue%<>-1
close(dialogue%)
G0!q%=err%:$(q%+4)=err$+" [Ref. "+
erl%+"]"+
"Wimp_ReportError",q%,1,"FormEd2"
inerror%=
errordisplay(err%,err$,erl%)
M0!q%=err%:$(q%+4)=err$+" [Ref. "+
erl%+"]"+
"Wimp_ReportError",q%,2,"FormEd2"
finish
finish
fontcounts%?I%>0:
"Font_LoseFont",I%:fontcounts%?I%-=1:
"Wimp_CloseDown"
XR------------------------------------------------------------------------------
workspace(L%):L%+=1
curbuff%+L%>buffer%+maxbuf%
1,"No more buffer space"
(buffer%+maxbuf%-curbuff%)<256
warning(q%+100,1,"Buffer space running short, Save off quick ! !")
curbuff%+=L%:=curbuff%-L%
]R------------------------------------------------------------------------------
findfont(f$,p):
"Font_FindFont",,f$,p*16,p*16,0,0
_Jfontcounts%?f%+=1:
fontcounts%?f%>=255
1,"Internal font table full"
aR------------------------------------------------------------------------------
spriteinfo
d8I%=q%+4:
"Wimp_WhichIcon",spritelist%,I%,&800000,0
!I%<>-1:I%!-4=spritelist%:
"Wimp_DeleteIcon",,I%-4:I%+=4:
f:i%=sprSP2%:
i%<>-1:spritei%(i%)=-1:i%=nsprite%(i%):
g-!q%=spritelist%:
"Wimp_CloseWindow",,q%
h $spritef%=
spfname(spritef$)
"OS_SpriteOp",&108,spritearea%
,,,nsprites%
j?maxspwidth%=scrx1%-80:curx%=0:cury%=0:maxw%=0:maxh%=0:ix%=0
nsprites%>0
I%=1
nsprites%
readsprite(I%)
nG flags%=&1701A429:text$=$spritename%:
getminxy(flags%,text$,text$)
minx%>spw% spwx%=minx%+32
spwx%=spw%+32
curx%+spwx%>maxspwidth%
lineofsprites
spwx%(ix%)=spwx%
-32-sph%-miny%-8<maxh% maxh%=-32-sph%-miny%-8
sE spw%(ix%)=spw%:sph%(ix%)=sph%:minx%(ix%)=minx%:miny%(ix%)=miny%
spname$(ix%)=$spritename%
curx%+=spwx%(ix%):ix%+=1
lineofsprites
y'!q%=0:q%!4=cury%:q%!8=maxw%:q%!12=0
"Wimp_SetExtent",spritelist%,q%
front(spritelist%)
i%=sprSP2%:
i%<>-1
i2%=nsprite%(i%)
close(spritew%(i%))
spritei%(i%)>=0
opensprite(spritei%(i%))
i%=i2%:
"Wimp_ForceRedraw",spritelist%,0,-30000,30000,0
spfname(sp$)
sp$>spflen%-2 ="..."+
sp$,spflen%-5)
=sp$
lineofsprites
curx%=0:cury%+=maxh%:maxh%=0
ix%>0
ix%-1
O !q%=spritelist%:q%!4=curx%+(spwx%(J%)-spw%(J%))
2:q%!8=cury%+miny%(J%)+16
M q%!12=curx%+(spwx%(J%)+spw%(J%))
2:q%!16=cury%+miny%(J%)+16+sph%(J%)+16
" q%!20=
sprflags(spname$(J%))
9 $(q%+24)=spname$(J%):
"Wimp_CreateIcon",,q%
f%=flags%:i%=sprSP2%
i%<>-1:
spriten$(i%)=spname$(J%) f%=f%
&400000:spritei%(i%)=ic%
i%=nsprite%(i%):
F !q%=spritelist%:q%!4=curx%+(spwx%(J%)-minx%(J%))
2:q%!8=cury%+16
B q%!12=curx%+(spwx%(J%)+minx%(J%))
2:q%!16=cury%+miny%(J%)+16
< q%!20=f%:$(q%+24)=spname$(J%):
"Wimp_CreateIcon",,q%
curx%+=spwx%(J%)
curx%>maxw% maxw%=curx%
ix%=0:curx%=0
sprflags(sp$)
"OS_SpriteOp",&128,spritearea%,sp$
,,,,,hasmask%
hasmask%
= &1701A032
= &1701A012
readsprite(I%)
S%:S%=spritearea%
"OS_SpriteOp",&10D,S%,spritename%,12,I%
,,,splen%:spritename%?splen%=13
"OS_SpriteOp",&128,S%,spritename%
,,,spw%,sph%,hasmask%,spm%
"OS_ReadModeVariable",spm%,4
,,spx%:spw%=spw%<<spx%
"OS_ReadModeVariable",spm%,5
,,spy%:sph%=sph%<<spy%
deselectsprites
I%=q%+16
"Wimp_WhichIcon",spritelist%,I%,&200000,&200000
!I%>-1:
deselect(spritelist%,!I%):I%+=4:
opensprite(icon%)
sprSP%=-1
1,"No more sprite windows!"
geti(spritelist%,icon%
6idata0%=idata%!0:idata4%=idata%!4:idata8%=idata%!8
%text$=
iconstring(iflags%,idata%)
standardwindow(0,0,"Sprites")
q%!28=&0F
q%?35=-1
q%!56=(iflags%
&100)
<q%!72=idata0%:q%!76=idata4%:q%!80=idata8% :
share data
q%!60=&3000
"OS_SpriteOp",&128,spritearea%,text$
,,,spw%,sph%,,spm%
"OS_ReadModeVariable",spm%,4
,,spx%:xsc%=6<<spx%
"OS_ReadModeVariable",spm%,5
,,spy%:ysc%=6<<spy%
wx%=spw%*xsc%:wy%=sph%*ysc%
+q%!4=-wy%:q%!8=wx%:q%!44=-wy%:q%!48=wx%
"Wimp_CreateWindow",,q%
handle%
6m%=sprSP%:sprSP%=spritew%(m%):spritew%(m%)=handle%
#nsprite%(m%)=sprSP2%:sprSP2%=m%
>spriten$(m%)=text$:sprxscale%(m%)=xsc%:spryscale%(m%)=ysc%
spritei%(m%)=icon%
deselect(spritelist%,icon%
seti(spritelist%,icon%
1,&400000,&600000) :
shaded and deselected
(!q%=handle%:q%!20=0:q%!24=0:q%!28=-1
Iq%!4=mousex%-wx%
2:q%!8=mousey%-wy%:q%!12=mousex%+wx%
2:q%!16=mousey%
"Wimp_OpenWindow",,q%
getspritexy(I%,mx%,my%)
)xs%=sprxscale%(I%):ys%=spryscale%(I%)
x%=(mx%-bx%)/xs%
y%=(by%-my%-dy%)/ys%
"OS_SpriteOp",&128,spritearea%,spriten$(I%)
,,,spw%,sph%,hasmask%,spm%
"OS_ReadModeVariable",spm%,4
,,spx%
"OS_ReadModeVariable",spm%,5
,,spy%
wx%=spw%*xs%:wy%=sph%*ys%
x%<0x%=0
y%<0y%=0
x%>=spw%x%=spw%-1
y%>=sph%y%=sph%-1
adjustsize(I%,insdel%,rowcol%)
getw(spritew%(I%))
getspritexy(I%,mmousex%,mmousey%)
owx%=wx%:owy%=wy%
rowcol%
insdel%
*
0:rcode%=31:rc%=sph%:wy%+=ys%
5
1:rcode%=32:rc%=sph%-1:wy%-=ys%:
wy%<1
/
2:rcode%=31:rc%=sph%-1-y%:wy%+=ys%
8
3:rcode%=32:rc%=sph%-1-y%:wy%-=ys%:
wy%<1
insdel%
*
0:rcode%=45:rc%=spw%:wx%+=xs%
5
1:rcode%=46:rc%=spw%-1:wx%-=xs%:
wx%<1
(
2:rcode%=45:rc%=x%:wx%+=xs%
1
3:rcode%=46:rc%=x%:wx%-=xs%:
wx%<1
"OS_SpriteOp",&100+rcode%,spritearea%,spriten$(I%),rc%
newsize(I%,owx%,owy%,wx%,wy%)
upicon(spritelist%,spritei%(I%))
newsize(I%,wx%,wy%,newwx%,newwy%)
getw(spritew%(I%))
limitx%=
:limity%=
limitx%=(x1%-bx%>=wx%):limity%=(by%-y0%>=wy%)
wx%=newwx%:wy%=newwy%
limitx%
(wx%<x1%-bx%) newx%=bx%+wx%
newx%=x1%
limity%
(wy%<by%-y0%) newy%=by%-wy%
newy%=y0%
newx%<x1%
newy%>y0% q%!8=newy%:q%!12=newx%:
"Wimp_OpenWindow",,q%
,q%!&80=0:q%!&84=-wy%:q%!&88=wx%:q%!&8C=0
"Wimp_SetExtent",spritew%(I%),q%+&80
newx%>x1%
newy%<y0% q%!8=newy%:q%!12=newx%:
"Wimp_OpenWindow",,q%
"Wimp_ForceRedraw",spritew%(I%),0,-30000,30000,0
updatesprite(I%)
"Wimp_ForceRedraw",spritew%(I%),0,-30000,30000,0
upicon(spritelist%,spritei%(I%))
changesize(I%,xsc%,ysc%)
)xs%=sprxscale%(I%):ys%=spryscale%(I%)
+sprxscale%(I%)=xsc%:spryscale%(I%)=ysc%
"OS_SpriteOp",&128,spritearea%,spriten$(I%)
,,,spw%,sph%
newsize(I%,spw%*xs%,sph%*ys%,spw%*xsc%,sph%*ysc%)
flipx(I%)
"OS_SpriteOp",&12F,spritearea%,spriten$(I%)
"Wimp_ForceRedraw",spritew%(I%),0,-30000,30000,0
upicon(spritelist%,spritei%(I%))
flipy(I%)
"OS_SpriteOp",&121,spritearea%,spriten$(I%)
"Wimp_ForceRedraw",spritew%(I%),0,-30000,30000,0
upicon(spritelist%,spritei%(I%))
bigsprite(I%)
xs%,ys%,By%,paint%
Dpaint%=
paint_drag%>=0 paint%=(!q%=spritew%(paint_drag%>>16))
$spritename%=spriten$(I%)
)xs%=sprxscale%(I%):ys%=spryscale%(I%)
23,12,0,7,0,7,0,7,0,7
"OS_SpriteOp",&128,spritearea%,spritename%
,,,spw%,sph%,hasmask%
By%=by%-sph%*ys%
more%
hasmask%
16,128:
"Wimp_ReadPixTrans",&100,spritearea%,spritename%,,,,factors%,pixtrans%
!factors%!0=xs%:factors%!4=ys%
"OS_SpriteOp",&134,spritearea%,spritename%,bx%,By%,8,factors%,pixtrans%
paint%
drgoff
"Wimp_GetRectangle",,q%
more%
R------------------------------------------------------------------------------
spritepixel(I%)
getw(spritew%(I%))
)xs%=sprxscale%(I%):ys%=spryscale%(I%)
getspritexy(I%,mousex%,mousey%)
y%=sph%-1-y%
x%<0
y%<0
x%>=spw%
y%>=sph%
paintmode%
paint_pixel(&40)
paint_spray
paint_flood(&80)
paint_line(&00)
paint_ellipse(&C0)
paint_ellipse(&C8)
paint_circle(&90)
paint_circle(&98)
paint_arc(&A0)
paint_segment(&A8)
paint_sector(&B0)
paint_triangle(&50)
paint_blockcopy(&BE)
paint_blockmove(&BD)
paint_typetext
1,"Unknown paint mode!"
upicon(spritelist%,spritei%(I%))
paint_pixel(void%)
5(paint_drag%=I%<<16 :
auto-repeat
sprcolour%=16
hasmask%
buttons%=&01 c%=1
c%=0
"OS_SpriteOp",&12C,spritearea%,spriten$(I%),x%,y%,c%
c%=0
c%=16
"OS_SpriteOp",&129,spritearea%,spriten$(I%),x%,y%
,,,,,c%
buttons%=&01 c%=0
c%=sprcolour%
c%=16 c%=0
"OS_SpriteOp",&12A,spritearea%,spriten$(I%),x%,y%,c%
hasmask%
"OS_SpriteOp",&12C,spritearea%,spriten$(I%),x%,y%,1
update(spritew%(I%),x%*xs%,-(sph%-y%)*ys%,(x%+1)*xs%,-(sph%-1-y%)*ys%)
more%
c%=16
23,12,0,7,0,7,0,7,0,7:
16,0
bx%+x%*xs%,by%-(sph%-y%)*ys%
&65,bx%+(x%+1)*xs%-1,by%-(sph%-1-y%)*ys%-1
"Wimp_GetRectangle",,q%
more%:
paint_flood(code%)
buttons%
&01
undo(I%):
"OS_SpriteOp",&129,spritearea%,spriten$(I%),x%,y%
,,,,,c%
edit(spriten$(I%))
0,128+c%:
0,sprcolour%
code%+5,x%<<spx%,y%<<spy%
editoff(spriten$(I%))
updatesprite(I%)
paint_line(code%)
paint_circle(code%)
dragclick(1,code%)
paint_ellipse(code%)
paint_arc(code%)
paint_segment(code%)
paint_sector(code%)
paint_triangle(code%)
paint_blockcopy(code%)
paint_blockmove(code%)
dragclick(2,code%)
dragclick(nclicks%,code%)
buttons%
&01
dragoff:paint_drag%=-1:
paint_drag%>=0
dragoff
((paint_drag%>>4)
&F)-(paint_drag%
f' dragx1%=dragx0%:dragy1%=dragy0%
g# sprx1%=sprx0%:spry1%=spry0%
h/ dragx0%=mousex%-bx%:dragy0%=mousey%-by%
i9 dragx%=dragx0%:dragy%=dragy0%:sprx0%=x%:spry0%=y%
paint_drag%+=1
edit(spriten$(I%))
0,sprcolour%
0,128+sprcolour%
o;
(paint_drag%
&F0)=&10
sprx1%<<spx%,spry1%<<spy%
p#
sprx0%<<spx%,spry0%<<spy%
paintmode%
28,29
s-
sprx1%-sprx0%<0 x%+=sprx1%-sprx0%
t-
spry1%-spry0%<0 y%+=spry1%-spry0%
u#
code%,x%<<spx%,y%<<spy%
v
w%
code%+5,x%<<spx%,y%<<spy%
x
editoff(spriten$(I%))
updatesprite(I%)
paintmode%
}=
28:dragx%=mousex%-bx%:dragy%=mousey%-by%:
dragoff:
~,
27:dragx1%=dragx0%:dragy1%=dragy0%
+ sprx1%=sprx0%:spry1%=spry0%
:paint_drag%=-1
5 paint_drag%=(I%<<16)
(code%<<8)
(nclicks%-1<<4)
+dragx0%=mousex%-bx%:dragy0%=mousey%-by%
5dragx%=dragx0%:dragy%=dragy0%:sprx0%=x%:spry0%=y%
dragoff
paintdrag(mousex%,mousey%,buttons%,handle%,icon%,oldbuttons%)
getw(spritew%(paint_drag%>>16))
dragoff
handle%<>spritew%(paint_drag%>>16) paint_drag%=-1:
)dragx%=mousex%-bx%:dragy%=mousey%-by%
(paintmode%=20
paintmode%=21)
(paint_drag%
&F)=0 dragy%=dragy0%
dragon(buttons%)
dragoff
paint_drag%=-1
paintmode%
16,18:
do nothing
K !q%=spritew%(paint_drag%>>16):q%!4=-1E8:q%!8=-1E8:q%!12=1E8:q%!16=1E8
"Wimp_UpdateWindow",,q%
more%
more%:
drgoff:
"Wimp_GetRectangle",,q%
more%:
drgoff
code%=(paint_drag%>>8)
paintmode%
28,29
paint_drag%
bx%+dragx0%,by%+dragy0%,dragx%-dragx0%,dragy%-dragy0%
bx%+dragx%,by%+dragy%,dragx1%-dragx0%,dragy1%-dragy0%
!
bx%+dragx0%,by%+dragy0%
A
29,bx%+dragx1%,by%+dragy0%:
29,bx%+dragx1%,by%+dragy1%
A
29,bx%+dragx0%,by%+dragy1%:
29,bx%+dragx0%,by%+dragy0%
19,20,21,22,23,24,25,26,27
paint_drag%
paint_drag%
?
&10:
bx%+dragx0%,by%+dragy0%:
bx%+dragx%,by%+dragy%
G
&00:
bx%+dragx0%,by%+dragy0%:
code%+5,bx%+dragx%,by%+dragy%
1:code%=(paint_drag%>>8)
!
bx%+dragx1%,by%+dragy1%
code%
(
&00:
bx%+dragx0%,by%+dragy0%
)
bx%+dragx%,by%+dragy%
+
bx%+dragx1%,by%+dragy1%
#
bx%+dragx0%,by%+dragy0%
1
code%+5,bx%+dragx%,by%+dragy%
dragon(buttons%)
paintmode%
buttons%
(
spritepixel(paint_drag%>>16)
paint_drag%=-1
do nothing
dragoff
edit(spname$)
"OS_SpriteOp",&13C,spritearea%,spname$,0
oldR0%,oldR1%,oldR2%,oldR3%
switched%=
A%,B%,sptr%
); A%=
spriteaddr(spritearea%,spname$)
(sptr%!16+1)*4=linelen%
; !vduscreen%=A%
6;
"OS_ReadModeVariable",sptr%!40,10
,,B%
%;
29,(sptr%!24>>B%)*dx%;0;
!vduscreen%=editbuffer%:
F;
"OS_SpriteOp",&122,spritearea%,spname$,0,1024-sph%*dy%,0
24,0;1024-sph%*dy%;spw%*dx%;1023;
editoff(spname$)
switched%
"OS_SpriteOp",oldR0%,oldR1%,oldR2%,oldR3%
undoname$=spname$
switched%=
A%,B%,E%,H%,L%,W%,I%,J%,T%
!vduscreen%=editbuffer%
IF hasmask% THEN
+; A%=
spriteaddr(spritearea%,spname$)
sptr%!24<>0
5;
"OS_ReadModeVariable",sptr%!40,10
,,B%
&; J%=sptr%!24 >> B%:sptr%!24=0
A;
I%=1
"OS_SpriteOp",&22E,spritearea%,sptr%,0:
;
'; W%=(sptr%!16+1)*4:H%=sptr%!20+1
*; E%=editbuffer%:L%=editbufferwidth%
O; sgetpars!0=A%:sgetpars!4=E%:sgetpars!8=W%:sgetpars!12=H%:sgetpars!16=L%
sget
FOR J%=1 TO H%:FOR I%=0 TO W%-1 STEP4:T%=A%!I%:A%!I%=E%!I%:E%!I%=T%:NEXT
A%+=W%:E%+=L%:NEXT
ELSE
SYS"OS_SpriteOp",&110,spritearea%,spname$,0,0,1024-sph%*dy%,spw%*dx%-1,1023
ENDIF
/; undoscreen%=!vduscreen%:undoname$=spname$
$; !vduscreen%=oldvdu%:
29,0;0;26
undo(sprite%)
undoname$<>spriten$(I%)
undoscreen%<>editbuffer%
; !vduscreen%=undoscreen%
editoff(spriten$(I%))
updatesprite(I%)
spriteaddr(A%,name$)
N%,N1%,N2%,N3%,I%
:$spritename%=name$:
name$
11:spritename%?I%=0:
9N1%=spritename%!0:N2%=spritename%!4:N3%=spritename%!8
N%=A%+A%!12:A%=A%+A%!8
A%<N%:
A%!4=N1%
A%!8=N2%
A%!12=N3% sptr%=A%:=A%+A%!32
A%+=!A%:
1,"Sprite '"+name$+"' not found by FNspriteaddr"
R------------------------------------------------------------------------------
palette
icon%
seti(palette%,icon%,&200000,0)
grid%=
grid%
icon%<16
unhtpal
palcolour%=icon%
sprcolour%=palcolour%
htpal
icon%<>paintmode%
+
deselect(palette%,paintmode%)
$
select(palette%,icon%)
, paintmode%=icon%:paint_drag%=-1
xor(handle%,icon%,ntimes%)
ntimes%:
seti(handle%,icon%,&200000,0)
tempt%=
-tempt%>3:
unhtpal
palcolour%=-1
seti(palette%,palcolour%,&00,&05)
htpal
palcolour%=-1
#!c3%=uncolour%(palcolour%)<<24
seti(palette%,palcolour%,c3%
&05,&0F000005)
seti(handle%,icon%,eor%,bic%)
'J!q%=handle%:q%!4=icon%:q%!8=eor%:q%!12=bic%:
"Wimp_SetIconState",,q%
setrgbvals(r%,g%,b%)
+$pal%(0)=r%:pal%(1)=g%:pal%(2)=b%
seti(palette%,I%,0,0)
readpal(c%,c2%)
c2%=16
3" palword%=paltable%!(4*c%)
"OS_ReadPalette",c%,c2%
,,palword%
r%=(palword%>> 8)
g%=(palword%>>16)
b%=(palword%>>24)
;R------------------------------------------------------------------------------
encodepalmenu(tickcolour%)
=JI%=m_palette%+28:
c%=0
15:I%!0=(c%=tickcolour%
(c%=15
128)
I%+=24:
encodepal(c1%,c2%)
c%,d%,e%,br%,maxd%,maxe%
"Wimp_ReadPalette",,paltable%
c%=c1%
c2%:bright%(c%)=
brightness(c%):
c%=c1%
c2%:br%=bright%(c%):maxe%=-1
15:e%=
(bright%(d%)-br%)
e%>maxe% maxe%=e%:maxd%=d%
:uncolour%(c%)=maxd%:
I%=m_palette%+28
c%=0
15:I%!8=(((c%<<4)+uncolour%(c%))<<24)
9:I%+=24:
brightness(c%)
r%,g%,b%
readpal(c%,16)
=r%+g%+g%+b%
foreback(c%) = (c%<<4)
uncolour%(c%)
colourdiff(rgb1%,rgb2%)
r%,g%,b%,R%,G%,B%
Q;r%=(rbg1%>>8)
&FF:g%=(rbg1%>>16)
&FF:b%=(rbg1%>>24)
R;R%=(rbg2%>>8)
&FF:G%=(rbg2%>>16)
&FF:B%=(rbg2%>>24)
S#= (R%-r%)^2+(G%-g%)^2+(B%-b%)^2
TR------------------------------------------------------------------------------
checkfull(f$)
f$,".")
f$,":")
1,"To save, drag the file icon to a directory viewer"
checkident(A$,B$)
lc(A$)=
lc(B$)
matchident(A$)<>-1
1,"Template already exists"
matchident(A$)
A$=""
lc(A$)
`/I%=nh%+1:
I%=I%-1:
lc(wident$(I%))
lc(wident$(I%))
wipealltemplates
e)
wident$(I%)<>""
deletewindow(I%)
updatefile(0)
savetemplates(tfile$,safe%)
loaded%
warning(q%,1,
msg0("NTMPSV"))
l;all%=(menuhandle%=mainmenu%
menuhandle%=t_file%):J%=0
I%=nh%
wident$(I%)<>""
(all%
I%=currentwindow%) wptr%(J%)=I%:J%+=1
255:fontbinding%?I%=0:
:freef%=1:
internal font handle allocator
q<tf_hdr%=16:tf_fsize%=48:
"XOS_Find",&80,tfile$
E%;F%
E%=&108C2
"XOS_Find",0,0:
"XOS_Find",&80,tfile$
E%;F%:
warning(q%,1,
msg0("CLOSED"))
warning(q%,1,
string0(E%+4))
1,""
E%=0
warning(q%,1,
msg1("NOOPEN",tfile$))
tf_handle%=E%:
#tf_handle%:
tf_dataptr%=tf_hdr%+J%*24+4
tf_hdr%-1:indexdata%?I%=0:
:tf_index%=indexdata%+tf_hdr%
I%=0
z7 !q%=handle%(wptr%(I%)):
"Wimp_GetWindowInfo",,q%
{? q%!68=1:tf_datasize%=88+32*q%!88:
processicon(q%+60,q%+76)
q%!88>0
processicons
"OS_GBPB",1,tf_handle%,q%+4,tf_datasize%,tf_dataptr%
~C tf_index%!0=tf_dataptr%:tf_index%!4=tf_datasize%:tf_index%!8=1
O $(tf_index%+12)=wident$(wptr%(I%)):tf_index%+=24:tf_dataptr%+=tf_datasize%
D!tf_index%=0:
freef%=1 !indexdata%=-1
!indexdata%=tf_dataptr%
"OS_GBPB",1,tf_handle%,indexdata%,tf_index%+4-indexdata%,0
freef%>1
I%=0
tf_fsize%-1:indexdata%?I%=0:
I%=1
freef%-1
% J%=0:
J%+=1:
fontbinding%?J%=I%
"Font_ReadDefn",J%,indexdata%+8
,,indexdata%!0,indexdata%!4
"OS_GBPB",1,tf_handle%,indexdata%,tf_fsize%,tf_dataptr%
tf_dataptr%+=tf_fsize%
#tf_handle%:
("Settype "+tfile$+" Template"):
("Stamp "+tfile$)
safe%
menuhandle%=t_file% templatef$=tfile$
processicons
I%,J%
J%=q%+92
I%=0
q%!88-1:
processicon(J%+16,J%+20):J%+=32:
processicon(fptr%,qptr%)
!fptr%
&40
, extf%=fptr%?3:intf%=fontbinding%?extf%
intf%=0 intf%=freef%:freef%+=1:fontbinding%?extf%=intf%
fptr%?3=intf%
!fptr%
&100
B%=q%+4+tf_datasize%
: $B%=$!qptr%:!qptr%=tf_datasize%:tf_datasize%+=
$B%+1
qptr%!4>0
B%=q%+4+tf_datasize%
@ $B%=$(qptr%!4):qptr%!4=tf_datasize%:tf_datasize%+=
$B%+1
loadtemplates(tfile$)
I%,f$
"Hourglass_On"
"Wimp_OpenTemplate",,tfile$
tfile$<>"<Wimp$Scrap>"
loaded% templatef$=tfile$
"Wimp_CloseTemplate":
updatefile(0):
tf_index%=0:
$mb_wident%="*"
"Wimp_LoadTemplate",,q%+4,curbuff%,buffer%+maxbuf%,fontcounts%,mb_wident%,tf_index%
,,curbuff%,,,,tf_index%
tf_index%<>0
loadtemp($mb_wident%)
tf_index%=0
"Wimp_CloseTemplate":
setloaded(
updatefile(0)
"Hourglass_Off"
loadtemp(wident$)
matchident(wident$):
I%<>-1
deletewindow(I%)
'q%!68=spritearea%:P%=q%+92:I%=q%!88
I%>0:
((P%!16)
&103)=&102 P%!24=spritearea%
,P%+=32:I%-=1:
crwindow(q%+4,wident$,0)
R------------------------------------------------------------------------------
defaultwindows
"Wimp_OpenTemplate",,"<FormEd2$Dir>.Templates"
default% (88+1*32)
loadcrtemp("default",default%)
'spritelist% =
crtemp("spritelist")
$m_scale% =
crtemp("m_scale")
'm_workarea% =
crtemp("m_workarea")
%m_resize% =
crtemp("m_resize")
$palette% =
crtemp("palette")
&m_savetemp% =
crtemp("save_temp")
(m_savespr% =
crtemp("save_sprite")
%proginfo% =
crtemp("ProgInfo")
(dial_delete%=
crtemp("dial_delete")
(new_temp% =
crtemp("NewTemplate")
$options% =
crtemp("Options")
$handlew% =
crtemp("Handles")
&tempfile% =
crtemp("Templates")
"Wimp_CloseTemplate"
"sprbuff%=
iconaddr(m_scale%,3)
*mb_templates%=
iconaddr(m_savetemp%,1)
'mb_spritef%=
iconaddr(m_savespr%,1)
*mb_workarea0%=
iconaddr(m_workarea%,9)
+mb_workarea1%=
iconaddr(m_workarea%,10)
&mb_minx%=
iconaddr(m_workarea%,14)
&mb_miny%=
iconaddr(m_workarea%,15)
#mb_name%=
iconaddr(new_temp%,0)
"mb_deft%=
iconaddr(options%,5)
"mb_deff%=
iconaddr(options%,6)
"mb_auto%=
iconaddr(options%,7)
#hndident%=
iconaddr(handlew%,1)
"hndicon%=
iconaddr(handlew%,3)
geti(m_scale%,2):sprxoff%=(ix0%+ix1%)
2:spryoff%=(iy0%+iy1%)
R------------------------------------------------------------------------------
crtemp(wident$)
loadcrtemp(wident$,q%)
"Wimp_CreateWindow",,q%
R------------------------------------------------------------------------------
loadcrtemp(wident$,q%)
I%,c%,c2%,w$
#c%=curbuff%:c2%=buffer%+maxbuf%
w$=wident$+
wident$,
"Wimp_LoadTemplate",,q%,c%,c2%,fontcounts%,w$,0
,,curbuff%,,,,c%
c%=0
1,"Window definition not found"
wident$="iconbar" q%!28=q%!28
q%!64=systemsprites%
wident$="spritelist" q%!64=spritearea%
wident$="save_temp"
wident$="save_sprite" q%!64=1
wident$="spritelist" spritef%=q%!72:spflen%=q%!80-1:q%!68=100
wident$="Options" q%!64=systemsprites%
R------------------------------------------------------------------------------
iconaddr(h%,i%)
-!q%=h%:q%!4=i%:
"Wimp_GetIconState",,q%
q%!24
&100
=q%!28
1,"Icon is not indirected"
iconbar:!q%=-1:q%!4=0:q%!8=0:q%!12=68:q%!16=72:q%!20=&3002
;$(q%+24)="!FormEd2":
"Wimp_CreateIcon",,q%
ic%:=ic%
spname$=$(icon%+20)
q%!24=FNworkspace(LENspname$+1):$(q%!24)=spname$
q%!28=systemsprites%
q%!32=LENspname$+1
R------------------------------------------------------------------------------
createmenu
1,"Not yet implemented - sorry!" :
Weddun ! - The RISC Squad
R------------------------------------------------------------------------------
printscreen
ensure
:
"Print_PageSize"
,xs%,ys%,px0%,py0%,px1%,py1%
O q%!&90=0:q%!&94=0:q%!&98=scrx1%:q%!&9C=scry1% :
input bounding box
M
"Print_AbortJob":
invalidate(-1,0,0,scrx1%,scry1%):
"Print_StartJob"
'
23,25,&80,1,&F0,&F0,&F0,0,0,0
14,0
matrix(q%+&A0,300,0,0,300,(xs%-scrx1%*300)/2,py1%-scry1%*300-18000):
PROCmatrix(q%+&A0,0,-400,400,0,0,ys%):PROCpage
PROCmatrix(q%+&A0,0,500,-400,0,xs%,0):PROCpage
"Print_EndJob"
:
"Print_DrawPage",,q%+&80,q%+&90,q%+&A0
pmore%
pmore%
3
invalidate(-1,q%!&80,q%!&84,q%!&88,q%!&8C)
PROCinvalidate(-1,0,0,scrx1%,scry1%)
ensure
1
"Print_NextRectangle",,q%+&80
pmore%
matrix(q%,a,b,c,d,e,f)
4 q%!0=a:q%!4=b:q%!8=c:q%!12=d:q%!16=e:q%!20=f
invalidate(h%,x0%,y0%,x1%,y1%)
0
"Wimp_ForceRedraw",h%,x0%,y0%,x1%,y1%
ensure
#(
"Wimp_Poll",
3,q%
action%
$
action%=1
redraw(!q%)
action%=0
handle_resize(info_ic%,change_info_ic%,x0%,y0%,x1%,y1%)
newval%,void%,ctr%
*Enewval%=
shell_IconGetData(m_resize%,info_ic%))+change_info_ic%
newval%>=1
shell_IconPutData(m_resize%,info_ic%,
newval%,-1)
currenticon%>-1
.` void%=
shell_IconResize(menuwindow%,currenticon%,ix0%+x0%,iy0%+y0%,ix1%+x1%,iy1%+y1%,20)
ctr%=0
C%!ctr%>-1
3&
geti(menuwindow%,C%!ctr%)
4_ void%=
shell_IconResize(menuwindow%,C%!ctr%,ix0%+x0%,iy0%+y0%,ix1%+x1%,iy1%+y1%,20)
ctr%+=4
C%!ctr%=-1
7
handle_resizeOK
ctr%,void%
currenticon%>-1
void%=
shell_IconResize(menuwindow%,currenticon%,ix0%,iy0%,ix0%+
shell_IconGetData(m_resize%,6)),iy0%+
shell_IconGetData(m_resize%,5)),20)
ctr%=0
C"
geti(menuwindow%,C%!ctr%)
void%=
shell_IconResize(menuwindow%,C%!ctr%,ix0%,iy0%,ix0%+
shell_IconGetData(m_resize%,6)),iy0%+
shell_IconGetData(m_resize%,5)),20)
ctr%+=4
C%!ctr%=-1
------------------ Added PH Routines --------------------------------
shell_IconPutData(whandle%,ihandle%,data$,redraw)
_Q%!0=whandle%
_Q%!4=ihandle%
"Wimp_GetIconState",,_Q%
(_Q%!24
(1<<8))<>0
data$>_Q%!36
99,"Icon overflow - attempt to place too many characters in a indirected icon"
$(_Q%!28)=data$
$(_Q%+28)=
data$,11)
redraw<>0
_Q%!8=0:_Q%!12=0
"Wimp_SetIconState",,_Q%
shell_IconGetData(whandle%,ihandle%)
result$
_Q%!0=whandle%
_Q%!4=ihandle%
"Wimp_GetIconState",,_Q%
(_Q%!24
(1<<8))<>0
result$=$(_Q%!28)
result$=$(_Q%+28)
=result$
shell_IconResize(wh%,ih%,x0%,y0%,x1%,y1%,bdr%)
e3_Q%!0=wh%:_Q%!4=ih%:
"Wimp_GetIconState",,_Q%
"Wimp_DeleteIcon",,_Q%
g._Q%!8=x0%:_Q%!12=y0%:_Q%!16=x1%:_Q%!20=y1%
h/_Q%!4=wh%:
"Wimp_CreateIcon",,_Q%+4
"Wimp_ForceRedraw",wh%,x0%-bdr%,y0%-bdr%,x1%+bdr%,y1%+bdr%
pick_referenceicon(wh%,selection%)
icon%,max_y%,ptr%,Q%
n.Q%=q%+&500:Q%!0=wh%:ptr%=0:max_y%=-9999999
selection%!ptr%<>-1
Q%!4=selection%!ptr%
"Wimp_GetIconState",,Q%
Q%!20>max_y%
s! max_y%=Q%!20:icon%=ptr%/4
ptr%+=4
=icon%
arrange_horizontal(wh%,reference_icon%)
ref_cl%,RIGHT%,LEFT%,ref_minx%,ref_miny%,ref_maxx%,ref_,maxy%
nr_left_side%,nr_right_side%,icon_cl%
"Hourglass_On"
calculate centre line of reference icon..
J%!0=wh%
"Wimp_GetIconState",,J%
"Interface_BoundingBox",,J%+8
ref_cl%=J%!8+(J%!16-J%!8)/2
Bref_minx%=J%!8:ref_miny%=J%!12:ref_maxx%=J%!16:ref_maxy%=J%!20
RIGHT%=q%+&1000
+LEFT% =q%+&1300:
space for 192 icons..
$nr_left_side%=0:nr_right_side%=0
!I%<>-1
!I%<>reference_icon%
&
icon is not reference icon..
J%!4=!I%
"
"Wimp_GetIconState",,J%
1
check if centre line is left or right..
$ icon_cl%=J%!8+(J%!16-J%!8)/2
icon_cl%>=ref_cl%
( RIGHT%!(nr_right_side%*4)=J%!4
nr_right_side%+=1
& LEFT%!(nr_left_side%*4)=J%!4
nr_left_side%+=1
I%+=4
LEFT%!(nr_left_side%*4)=-1
RIGHT%!(nr_right_side%*4)=-1
do_icon_sort(wh%,LEFT%,nr_left_side%,-1)
do_icon_sort(wh%,RIGHT%,nr_right_side%,-1)
arrange_horizontal_right(RIGHT%,ref_maxx%)
arrange_horizontal_left(LEFT%,ref_minx%,nr_left_side%)
"Hourglass_Off"
arrange_vertical(wh%,reference_icon%)
ref_cl%,ref_minx%,ref_miny%,ref_maxx%,ref_,maxy%
ABOVE%,BELOW%,nr_below%,nr_above%,icon_cl%
"Hourglass_On"
J%!0=wh%
"Wimp_GetIconState",,J%
"Interface_BoundingBox",,J%+8
!ref_cl%=J%!20+(J%!12-J%!20)/2
Bref_minx%=J%!8:ref_miny%=J%!12:ref_maxx%=J%!16:ref_maxy%=J%!20
ABOVE%=q%+&1000
+BELOW%=q%+&1300:
space for 192 icons..
nr_below%=0:nr_above%=0
!I%<>-1
!I%<>reference_icon%
&
icon is not reference icon..
J%!4=!I%
"
"Wimp_GetIconState",,J%
2
check if centre line is above or below..
& icon_cl%=J%!20+(J%!12-J%!20)/2
icon_cl%>=ref_cl%
# ABOVE%!(nr_above%*4)=J%!4
nr_above%+=1
# BELOW%!(nr_below%*4)=J%!4
nr_below%+=1
I%+=4
ABOVE%!(nr_above%*4)=-1
BELOW%!(nr_below%*4)=-1
do_icon_sort(wh%,ABOVE%,nr_above%,0)
do_icon_sort(wh%,BELOW%,nr_below%,0)
arrange_vertical_above(ABOVE%,ref_maxy%)
arrange_vertical_below(BELOW%,ref_miny%,nr_below%)
"Hourglass_Off"
arrange_vertical_above(ABOVE%,ref_maxy%)
maxiy%
maxiy%=ref_maxy%
!ABOVE%<>-1
J%!4=!ABOVE%
"Wimp_GetIconState",,J%
"Interface_BoundingBox",,J%+8
maxiy%<=0
D
moveicon(!J%,!ABOVE%,0,
(J%!12)-
(maxiy%)+
($mb_Vspacing%))
D
moveicon(!J%,!ABOVE%,0,
(J%!12)+
(maxiy%)+
($mb_Vspacing%))
"Wimp_GetIconState",,J%
"Interface_BoundingBox",,J%+8
maxiy%=J%!20
ABOVE%+=4
arrange_vertical_below(BELOW%,ref_miny%,nr_below%)
miniy%,loop%
miniy%=ref_miny%
loop%=(nr_below%-1)*4
J%!4=BELOW%!loop%
"Wimp_GetIconState",,J%
"Interface_BoundingBox",,J%+8
moveicon(!J%,BELOW%!loop%,0,
(J%!20)-
(miniy%)-
($mb_Vspacing%))
"Wimp_GetIconState",,J%
"Interface_BoundingBox",,J%+8
miniy%=J%!12
loop%
arrange_horizontal_right(RIGHT%,ref_maxx%)
maxix%
maxix%=ref_maxx%
!RIGHT%<>-1
J%!4=!RIGHT%
"Wimp_GetIconState",,J%
"Interface_BoundingBox",,J%+8
moveicon(!J%,!RIGHT%,
(maxix%)-
(J%!8)+
($mb_Hspacing%),0)
"Wimp_GetIconState",,J%
"Interface_BoundingBox",,J%+8
maxix%=J%!16
RIGHT%+=4
arrange_horizontal_left(LEFT%,ref_minx%,nr_left_side%)
minix%,loop%
minix%=ref_minx%
loop%=(nr_left_side%-1)*4
J%!4=LEFT%!loop%
"Wimp_GetIconState",,J%
"Interface_BoundingBox",,J%+8
moveicon(!J%,LEFT%!loop%,minix%-J%!16-
($mb_Hspacing%),0)
"Wimp_GetIconState",,J%
"Interface_BoundingBox",,J%+8
minix%=J%!8
loop%
do_icon_sort(wh%,selection%,nr_icons%,horiz%)
flag%,loop%,cl1%,cl2%,I%,temp%
I%=q%+&1600
nr_icons%<2
!I%=wh%
flag%=
loop%=0
((nr_icons%-2)*4)
+
sort icons on centre line coord..
I%!4=selection%!loop%
"
"Wimp_GetIconState",,I%
horiz%
" cl1%=I%!8+(I%!16-I%!8)/2
# I%!4=selection%!(loop%+4)
$
"Wimp_GetIconState",,I%
" cl2%=I%!8+(I%!16-I%!8)/2
$ cl1%=I%!20+(I%!12-I%!20)/2
# I%!4=selection%!(loop%+4)
$
"Wimp_GetIconState",,I%
$ cl2%=I%!20+(I%!12-I%!20)/2
cl1%>cl2%
flag%=
6
SWAP selection%!loop%,selection%!(loop%+4)
temp%=selection%!loop%
/ selection%!loop%=selection%!(loop%+4)
$ selection%!(loop%+4)=temp%
loop%
flag%=
Handle_Same_size
I%,J%,void%,width%,height%
Handle 'Same size' item..
I%=q%+&80
"Wimp_WhichIcon",handle%(currentwindow%),I%,5<<21,1<<21
*+J%=q%+&400:J%!0=handle%(currentwindow%)
currenticon%=-1
,' J%!4=
pick_referenceicon(J%!0,I%)
J%!4=currenticon%
"Wimp_GetIconState",,J%:
get size of reference icon..
1,width%=J%!16-J%!8:height%=
(J%!20-J%!12)
!I%>-1
J%!4=!I%
"Wimp_GetIconState",,J%
5P void%=
shell_IconResize(J%!0,J%!4,J%!8,J%!20-height%,J%!8+width%,J%!20,50)
I%+=4
"Wimp_ForceRedraw",J%!0,0,-10000,10000,0
bootmessage(Q%)
boot$
=Cboot$="Run "+
shell_OSVarGetVal(Q%+256,256,"FormEd2$Dir",0)+
"OS_GBPB",2,Q%!20,boot$,
boot$
shell_OSVarGetVal(buffer%,size%,varname$,expand)
value$,nr_bytes,nameptr%,type%
"XOS_ReadVarVal",varname$,buffer%,size%,0,-3*(expand=
,,nr_bytes,nameptr%,type%
loop%=0
nr_bytes-1
E$ value$=value$+
(buffer%?loop%)
loop%
=value$
updatefile(F%)
JPq%!40=tempfile%:
"Wimp_GetWindowInfo",,q%+40:
"Wimp_DeleteWindow",,q%+40
K1I%=0:A%=tempind%:B%=nh%:C%=q%+132:Y%=-4:D%=40
wident$(B%)<>""
N2 !q%=handle%(B%):
"Wimp_GetWindowState",,q%
$A%=" "+wident$(B%)
q%!32
(1<<16) ?A%=128
QS P%=C%:[OPT2:DCD8:DCDY%-D%:DCD248:DCDY%:DCD&17018531:DCDA%:DCD-1:DCD16:]:C%=P%
R+ temppatch%(B%)=I%:A%+=16:I%+=1:Y%-=D%
temppatch%(B%)=-1
B%-=1
B%<0
q%!128=I%:
Y%>-96 Y%=-96
q%!88=Y%-4
Y%<-20*D%-8 q%!48=q%!56-20*D%-8
q%!48=q%!56+Y%-8
"Wimp_CreateWindow",,q%+44
tempfile%
q%!72
(1<<16)
q%!72
(1<<16)
q%!64=0
^/q%!40=tempfile%:
"Wimp_OpenWindow",,q%+40
movehandles(F%)
b6!q%=handlew%:
"Wimp_GetWindowState",,q%:q%!28=-1
(q%!32
(1<<16))
d4q%!40=handlew%:
"Wimp_GetWindowOutline",,q%+40
e%x1%=scrx1%-q%!52:y1%=scry1%-q%!56
f?q%!4=q%!4+x1%:q%!12=q%!12+x1%:q%!8=q%!8+y1%:q%!16=q%!16+y1%
"Wimp_SendMessage",2,q%,task_handle%:hw%=
:hwic%=-2
backreffile(A%)
k.B%=-1:
:B%+=1:
B%=nh%
temppatch%(B%)=A%
temppatch%(B%)=A%
=B%
1,"Bad icon reference"
setfileopen(I%,O%)
o#A%=tempind%+16*(temppatch%(I%))
O% ?A%=128
?A%=32
q.!q%=tempfile%:
"Wimp_GetWindowState",,q%
(q%!32)
(1<<16)
upicon(tempfile%,temppatch%(I%))
getmenuposn
"Wimp_GetPointerInfo",,q%:
"Wimp_GetWindowState",,q%+12
x(mmousex%=q%!16+102:mmousey%=q%!28-12
changewindow(q%,curw%)
"Wimp_CreateWindow",,q%
handle%
}1!q%=handle%(curw%):
"Wimp_DeleteWindow",,q%
handle%(curw%)=handle%
E!q%=handle%:
"Wimp_GetWindowState",,q%:
"Wimp_OpenWindow",,q%
loadchoices
Fdeftem$="Template":deffile$="Templates":finac%=1:auto$="Templates"
'interface%=
:hatch%=
:country$="UK"
("<FormEd2$Dir>.Choices")
X%=0
#X%,deftem$ :
deftem$ >11 deftem$ ="Template"
#X%,deffile$:
deffile$>10 deffile$="Templates"
.finac%=
#X% :
finac% >2 finac% =1
#X%,auto$ :
auto$ >10 auto$ ="Templates"
interface%=(
#X%>0)
hatch%=(
#X%>0)
#X%,country$:
country$>10 country$="UK"
"OS_File",5,"<FormEd$Dir>.Messages."+country$
T%<>1 country$="UK"
updatehatch
I%=0
wident$(I%)<>""
2 !q%=handle%(I%):
"Wimp_GetWindowState",,q%
q%!32
(1<<4)
"Wimp_ForceRedraw",!q%,-1E5,-1E5,1E5,1E5
leave(handle%)
whichwindow(handle%):
I%=-1
%$hndident%="":
upicon(handlew%,1)
$$hndicon%="":
upicon(handlew%,3)
enter(handle%)
whichwindow(handle%):
I%=-1
.$hndident%=wident$(I%):
upicon(handlew%,1)
handledoicon
"Wimp_GetPointerInfo",,q%:
hwic%=q%!16
9hwic%=q%!16:
hwic%<0 $hndicon%=""
$hndicon%=
hwic%
upicon(handlew%,3)