home *** CD-ROM | disk | FTP | other *** search
RISC OS BBC BASIC V Source | 1993-01-27 | 5.7 KB | 208 lines |
- >NormalSrc
- Demonstration of use of FontWindow module
- Simple menu bar + dboxes
- Windows are created at time of load.
- Look for REM### to see where I've put FontModule code
- MACHINE: Archimedes
- LANGUAGE: BBC BASIC V (v1.05)
- AUTHOR: Cy Booker,
- 86 Church View, Main Road, Crockenhill, Swanley, Kent.
- BR8 8JW
- apologies for the crappy coding, but it is done in a hurry
- main(FontWindow, Title$)
- = &8000+64*1024
- Debug% =
- q% 256
- $q%="TASK"
- "Wimp_Initialise",200,!q%, Title$
- , TaskHandle%
- need local error handlers before poll loop...
- FontWindow
- Q
- "FontWindow_Initialise", TaskHandle%, 0,0, 0,0, 0, 0, 100
- FontTable%
- =
- FontTable% 256:
- i%= 0
- 255:FontTable%?i% = 0:
- loadtemplates
- makemenus
- makeiconbaricon
- reporterror
- )"
- "Wimp_Poll",&31,q%
- +%
- "Wimp_OpenWindow",, q%
- ,&
- "Wimp_CloseWindow",, q%
- mouseclick
- menuselect
- 17,18:
- message
- 0
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- closedown
- FontWindow
- 94
- "FontWindow_CloseDown", TaskHandle%,
- i%=0
-
- FontTable%?i%
- =#
- "XFont_LoseFont", i%
- FontTable%?i% -= 1
-
- "Wimp_CloseDown"
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- loadtemplate(name$,
- wh%)
- $q% = name$+
- "Wimp_LoadTemplate",, buf%, indrove%, ind%+bufsiz%, FontTable%, q%, 0
- ,, indrove%,,,, pos%
- pos%=0
- 1, "Can't find template "+ name$
- FontWindow
- NE
- "FontWindow_CreateWindow", TaskHandle%, buf%, 0
- wh%, qq%
- P+
- "Wimp_CreateWindow",, buf%
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- message_modechange
- FontWindow
- Y/
- "FontWindow_ModeChange", TaskHandle%
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- message_menuwarning
- x% = q%!24
- y% = q%!28
- item% = q%!32
- item%
- FontWindow
- g@
- "FontWindow_UpdateWindow", TaskHandle%, ProgInfo_W%
- h
- i5
- "Wimp_CreateSubMenu",, ProgInfo_W%, x%, y%
- FontWindow
- m>
- "FontWindow_UpdateWindow", TaskHandle%, SaveAs_W%
- n
- o3
- "Wimp_CreateSubMenu",, SaveAs_W%, x%, y%
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- mouseclick
- (q%!12 = -2)
- (q%!16 = IconBarIcon%)
- (q%!8
- xL
- "Wimp_CreateMenu",, Menu%, q%!0 - ((Menu%!16)>>1), 96+44*3+24*0
- y
- !q% = Document_W%
- {'
- "Wimp_GetWindowState",, q%
- q%!28 = -1
-
- FontWindow
- D
- "FontWindow_OpenWindow", TaskHandle%, q%, Document_W%
-
- %
- "Wimp_OpenWindow",, q%
-
-
- menuselect
- !q% = 2
- closedown
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- reporterror
- !q% =
- Debug%
- '
- putz(q%+4,
- $+ " code "+
- putz(q%+4,
- "Wimp_ReportError", q%, 3, Title$
- , choice%
- choice% = 2
- closedown
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- loadtemplates
- bufsiz% = 10*1024
- buf% bufsiz% :
- kludge
- ind% bufsiz% :
- kludge
- indrove% = ind%
- "Wimp_OpenTemplate",, "<DemoFontWindow$Dir>.Templates"
- local error handler...
- loadtemplate("ProgInfo", ProgInfo_W%)
- loadtemplate("SaveAs", SaveAs_W%)
- loadtemplate("Test", Document_W%)
- the following window will not be cached, as it contains no
- anti-aliased fonts.
- loadtemplate("Query", Query_W%)
- "Wimp_CloseTemplate"
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- makemenus
- menusiz% = 10*1024
- Menu% menusiz%
- menu% = Menu%
- menutitle(Title$)
- menuitem("Info", 1 << 3, &8004)
- menuitem("Save as", 1 << 3, &8004)
- menuitem("Quit", 1 << 7, -1)
- menutitle(title$)
- $menu% = title$
- menu%?12 = 7
- menu%?13 = 2
- menu%?14 = 7
- menu%?15 = 0
- menu%!16 = 11*16
- menu%!20 = 44
- menu%!24 = 0
- menu% += 28
- menuitem(item$, flags%, data%)
- menu%!0 = flags%
- menu%!4 = data%
- menu%!8 = &07000021
- & $(menu%+12) = item$+
- (13))
- menu%+=24
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- makeiconbaricon
- name% 13
- $name% = "!demo"
- q%!0 = -1
- q%!4 = 0
- q%!8 = 0
- q%!12 = 68
- q%!16 = 68
- q%!20 = &07006102
- q%!24 = name%
- q%!28 = +1
- q%!32 =
- ($name%) + 1
- "Wimp_CreateIcon",, q%
- IconBarIcon%
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- message
- q%!16
- closedown
- &400C0:
- message_menuwarning
- &400C1:
- message_modechange
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Debug%
- !
- $+ ", ["+
- )+ "]"
- getz(q%)
- ?q%:V$+=
- (?q%):q%+=1:
- putz(z%, z$)
- $z% = z$
- z%?
- z$ = 0
-