home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
programs
/
desktop
/
twitcher
/
!Twitcher
/
!Source
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1997-06-05
|
9KB
|
322 lines
> !Twitcher
Version 0.08
temp_blk% 256,blk% 700,fonts% 256:end% = 0
end% =
report(2,
$+" - "+
"XOS_CLI","Set Twitcher$Running TRUE"
V!blk% = 0:
"Wimp_Initialise",350,&4B534154,"Twitcher",blk%
wimp_version%,task%
0task_manager% =
task_loaded("Task Manager")
task_manager% = 0
(1<<30),"Task Manager is not present. Patch can be applied."
task_manager_icon% = 0
?icon_bar_toggle% =
system_var("Twitcher$IconBarToggle"))
=desktop_stop% =
system_var("Twitcher$QuestionEnd"))
twitcher_started_it% = 0
icbar_switch% = 0
load_templates
set_os_version
hide_taskmanager
create_menus
create_icon
end% =
report(2,
$+" - "+
icon_bar_toggle%
mask% = 0
mask% = 1
end%
"OS_ReadMonotonicTime"
time%
"Wimp_PollIdle",mask%,blk%,time%+20
icon_bar_toggle%
icon_bar_toggle
"XWimp_OpenWindow",,blk%
"XWimp_CloseWindow",,blk%
mouse_command(blk%!12,blk%!16,blk%!8)
blk%!24 = 10
mouse_command(com_h%,1,4)
menu_selection(blk%)
17,18:
messages(blk%)
unhide_taskmanager
lose_fonts
"XOS_CLI","Set Twitcher$Running FALSE"
"Wimp_CloseDown",task%,&4B534154
icon_bar_toggle
x%,y%,b%
y% < 10
icbar_switch% = 0
menu_open = 0
43 !blk% = -2:
"Wimp_GetWindowState",,blk%
5H
blk%!28 <> -1
"Wimp_ProcessKey",&1DC:icbar_switch% = -1
6
(y% > 164)
(icbar_switch% = -1)
"Wimp_ProcessKey",&1DC:icbar_switch% = 0
load_templates
=1info_h% = -1:
lp% = 0
256:fonts%?lp% = 0:
>0indir% = 600:
`% indir%:J%=`%:ca%=`%+indir%
"Wimp_OpenTemplate",,"Twitcher:Templates"
"Wimp_LoadTemplate",,blk%,J%,ca%,fonts%,"rosinfo",0
,,J%,,,,f%
"Wimp_CreateWindow",,blk%
info_h%
"Wimp_LoadTemplate",,blk%,J%,ca%,fonts%,"command",0
,,J%,,,,f%
"Wimp_CreateWindow",,blk%
com_h%
"Wimp_CloseTemplate"
set_os_version
!blk% = info_h%:blk%!4 = 3
"Wimp_GetIconState",,blk%
"XOS_Byte",0,0
"XOS_WriteN",a%+4,0
L!$(blk%!28) =
a$,"OS")+3)
create_icon
blk%!0 = -8
Q)blk%!4 = ic_minx%:blk%!8 = ic_miny%
R)blk%!12 = ic_maxx%:blk%!16 = ic_maxy%
S3blk%!20 = &1700200A:$(blk%+24)="!twitcher"+
"Wimp_CreateIcon",&6<<28,blk%
hide_taskmanager
X/!blk% = -2:
"Wimp_GetWindowInfo",,blk%+1
icons% = blk%!92
lp% = 0
icons%
blk%!0 = 20
blk%!8 = 0
blk%!12= 0
blk%!16= 0
"Wimp_SendMessage",19,blk%,-2,lp%
,,handle%
handle% = task_manager%
task_manager_icon% = lp%
c*!blk% = -2:blk%!4 = task_manager_icon%
"Wimp_GetIconState",,blk%
e'ic_minx%= blk%!8 :ic_miny%= blk%!12
f'ic_maxx%= blk%!16:ic_maxy%= blk%!20
wimp_version% >= 350
"Wimp_ResizeIcon",-2,0,-100,-100,-99,-99
create_menus
k-dmenu% =
create_menu_title("*Command",3)
create_menu_item(dmenu%,0,&80+%100,-1,&7000111,"",255)
n1cmenu% =
create_menu_title("Command line",4)
create_menu_item(cmenu%,0,&00,-1,&7000111,"Task window ^F12",-1)
create_menu_item(cmenu%,1,&00,com_h% ,&7000111,"New task",-1)
create_menu_item(cmenu%,2,&00,-1,&7000111,"*Commands F12",-1)
create_menu_item(cmenu%,3,&80,-1,&7000111,"Exit",-1)
t-mmenu% =
create_menu_title("Twitcher",4)
create_menu_item(mmenu%,0,&00,info_h%,&7000111,"Info",-1)
create_menu_item(mmenu%,1,&00,cmenu%,&7000111,"Command line",-1)
create_menu_item(mmenu%,2,&00,-1,&7000111,"Display help",-1)
create_menu_item(mmenu%,3,&80,-1,&7000111,"Shutdown ^
F12",-1)
Wimp_PollIdle commands
mouse_command(win%,ic%,b%)
"Wimp_CreateMenu",,-1
win% = -2
2 com$ =
system_var("Twitcher$Button_"+
(b%))
convert_lower(com$)
/
"ic_toggle":
"Wimp_ProcessKey",&1DC
2
"open_menu":mx% = blk%!0:my% = 96+(4*44)
-
"Wimp_CreateMenu",,mmenu%,mx%,my%
A
"pass_on" :
emulate_mouse_click(task_manager%,b%,-2,0)
@
"button1" :
emulate_mouse_click(task_manager%,1,-2,0)
@
"button2" :
emulate_mouse_click(task_manager%,2,-2,0)
@
"button4" :
emulate_mouse_click(task_manager%,4,-2,0)
"Wimp_StartTask",com$
blk%!0 = com_h%:blk%!4 = 0
"Wimp_GetIconState",,blk%
"OS_WriteN",blk%!28,0
command$
"Wimp_StartTask",command$
menu_selection(ptr%)
path$ =
(blk%!0):lp% = 4
blk%!lp% <> -1:path$+="."+
(blk%!lp%):lp%+=4:
path$
"0":
"1":
"2":
"Wimp_StartTask",
system_var("Twitcher$HelpApp")
"3":
"TaskManager_Shutdown",%0
"1.0":
"Wimp_ProcessKey",&1EC
"1.1":
x%,y%,b%:
"Wimp_CreateMenu",,com_h%,x%,y%
"1.2":
"Wimp_ProcessKey",&1CC
"1.3":
"TaskManager_Shutdown",%1:twitcher_started_it% = -1
"1.1.0":
"OS_WriteN",!(dmenu%+12+28),0
"Wimp_StartTask",a$
"Wimp_GetPointerInfo",,blk%
blk%!8 <> 4
"Wimp_CreateMenu",,mmenu%,mx%,my%
messages(ptr%)
ptr%!16
0:end% = -1
ptr%!4 <> this_task%
, ptr%!0 = 60:ptr%!12 = ptr%!8
( ptr%!16 = 2 :ptr%!36 = -1
$ $(ptr%+44) = "<Wimp$Scrap>"
-
"Wimp_SendMessage",17,ptr%,ptr%!4
D blk%!12=blk%!8:blk%!16=4:
"Wimp_SendMessage",17,blk%,blk%!4
"OS_WriteN",(blk%+44),0
type$ =
~blk%!40
4 com$ =
system_var("Twitcher$Command_"+type$)
com$ = ""
com$ =
system_var("Twitcher$Command_None")
com$,"%*0") <> 0
pos% =
com$,"%*0")
. com$ =
com$,pos%-1)+a$+
com$,pos%+3)
"Wimp_StartTask",com$
(blk%?20 = 0)
(desktop_stop% = -1)
$
twitcher_started_it% = 0
j report% =
report(3,"Are you sure you want to shut down the desktop. Click on cancel to abort.")
report% = 0
A blk%!12 = blk%!8:
"Wimp_SendMessage",19,blk%,blk%!4
" twitcher_started_it% = 0
unhide_taskmanager
wimp_version% >= 350
"Wimp_ResizeIcon",-2,task_manager_icon%,ic_minx%,ic_miny%,ic_maxx%,ic_maxy%
lose_fonts
lp% = 0
fonts%?lp% <> 0:
"XFont_LoseFont",lp%:fonts%?lp%-=1:
create_menu_title(title$,items%)
text%,menu%
menu% (24*items%)+28
lp% = 0
(24*items%)+28:menu%?lp% = 0:
text%
(title$)+5:$(text%) = title$+
menu%!0 = text%
menu%!4 = text%+
(title$)+2
menu%!8 =
(title$)
%menu%?12=7 :menu%?13=2:menu%?14=7
*menu%?15=0 :menu%!16=(
(title$)*16)+16
menu%!20=44:menu%!24=0
menu%!28=(1<<8)
= menu%
create_menu_item(menu%,line%,flags%,sub%,icon%,text$,size%)
menu%!16 < (
(text$)*16)+16
menu%!16 = (
(text$)*16)+16
size% = -1
size% =
(text$)
vali% (size%+10):
ptr% = 0
size%+10:vali%?ptr% = 0:
$(vali%) = text$+
%!(menu%+(line%*24)+28+00)+=flags%
$!(menu%+(line%*24)+28+04) = sub%
%!(menu%+(line%*24)+28+08) = icon%
%!(menu%+(line%*24)+28+12) = vali%
-!(menu%+(line%*24)+28+16) = vali%+size%+2
%!(menu%+(line%*24)+28+20) = size%
task_loaded(taskname$)
loaded%,task%
"XWimp_ReadSysInfo",0
apps_running%
"TaskManager_EnumerateTasks",task%,temp_blk%,16
task%
"OS_WriteN",temp_blk%!4,0
taskname$ = a$
loaded% = temp_blk%!0:task% = -1
task% = -1
=loaded%
emulate_mouse_click(task%,button%,window%,icon%)
blk%!0,blk%!4,b%
6blk%!8 = button%:blk%!12 = window%:blk%!16 = icon%
"Wimp_SendMessage",6,blk%,task%
system_var(sys_var$)
length%,text$
"XOS_ReadVarVal",sys_var$+
(0),temp_blk%,-1
,,length%
length% <> 0
"XOS_ReadVarVal",sys_var$+
(0),temp_blk%,255,0,1
,,length%
lp% = 0
length%-1:text$+=
(temp_blk%?lp%):
= text$
report(base%,message$)
flags%
$message$=
0+message$+
-256 > &A4
flags% = (%1<<9)+256+base%
flags% = base%
"Wimp_ReportError",message$,flags%,"Twitcher","!Twitcher",1
,sent%
= sent%-2
menu_open
convert_lower(text$)
"XTerritory_LowerCaseTable",-1
ptr%
lp% = 1
(text$)
text$,lp%,1) =
(ptr%?
text$,lp%,1)))
= text$