/*
	MUI Progress bar for 0800Timer
*/

/* ;;; Initialise */
options results
address command
signal on error
VerStr  = '$VER: 0800Timer.mrx 1.0 (6.2.00)'
VerStr  = subword(VerStr,2)||'0a'x||'(c) Neil Bothwick, Wirenet'
GuiPort = '0800TIMER'
PrgPort = GuiPort'-PRG'
WinTitle = 'Wirenet 0800 Timer'
MaxMins = 360
;;;
/* ;;; Define MUI variables */
MUIA_List_Quiet                   = 0x8042d8c7
MUIM_List_Select                  = 0x804252d8
MUIV_List_Select_All              = -2
MUIV_List_Select_On               = 1
MUIV_List_Select_Ask              = 3
MUIA_List_First                   = 0x804238d4
MUIM_List_Remove                  = 0x8042647e
MUIV_List_Remove_Selected         = -3
MUIA_List_Entries                 = 0x80421654
MUIA_List_Quiet                   = 0x8042d8c7
MUIA_Listview_MultiSelect         = 0x80427e08
MUIV_Listview_MultiSelect_Default = 1
MUIA_Gauge_Current                = 0x8042f0dd
MUIA_Gauge_Divide                 = 0x8042d8df
MUIA_Gauge_Horiz                  = 0x804232dd
MUIA_Gauge_InfoText               = 0x8042bf15
MUIA_Gauge_Max                    = 0x8042bcdb
MUIA_Group_Columns                = 0x8042f416
MUIA_Menuitem_Shortcut            = 0x80422030
MUIA_Application_Active           = 0x804260ab
MUIA_Application_Author           = 0x80424842
MUIA_Application_Copyright        = 0x8042ef4d
MUIA_Application_Description      = 0x80421fc6
MUIA_Application_HelpFile         = 0x804293f4
MUIA_Application_Iconified        = 0x8042a07f
MUIA_Application_Title            = 0x804281b8
MUIA_Application_Version          = 0x8042b33f
MUIA_Application_Sleep            = 0x80425711
MUIM_Application_AboutMUI         = 0x8042d21d
MUIA_Slider_Horiz                 = 0x8042fad1
MUIA_Slider_Level                 = 0x8042ae3a
MUIA_Slider_Max                   = 0x8042d78a
MUIA_Slider_Min                   = 0x8042e404
MUIA_Slider_Quiet                 = 0x80420b26
MUIA_Slider_Reverse               = 0x8042f2a0
TRUE = 1
FALSE = 0
;;;
/* ;;; Open arexx port and GUI */
thisport = openport(PrgPort)
if thisport = 0 then exit
address(GuiPort)
window id MAIN port PrgPort command 'QUIT' title '"'WinTitle'"'
	gauge id TIME attrs MUIA_Gauge_Horiz MUIA_Gauge_InfoText '' MUIA_Gauge_Max MaxMins label '%ld minutes used'
	endwindow

'application' MUIA_Application_Version '$VER: 0800Timer 1.0 (6.2.00)'
'application' MUIA_Application_Author 'Neil Bothwick'
'application' MUIA_Application_Copyright '© 2000 by Neil Bothwick, Wirenet'
'application' MUIA_Application_Title '0800Timer'
'application' MUIA_Application_Description 'Keeps track of 0800 time used'
;;;
/* ;;; Main loop */
do forever
	call waitpkt(PrgPort)
	packet = getpkt(PrgPort)
	if packet = '0000 0000'x then iterate
	cmd = getarg(packet)
	call reply(packet,0)
	select
		when cmd = 'QUIT' then call CleanUp()
		when cmd = 'ONLINE' then nop
		when cmd = 'OFFLINE' then nop
		otherwise do
			'gauge id TIME attrs' MUIA_Gauge_Current cmd
			/*'gauge id TIME attrs' MUIA_Gauge_InfoText '"'cmd'"'*/
			end
		end
	end
;;;
/* ;;; Cleanup and exit */
CleanUp:
	address(GuiPort)
	'QUIT'
	exit
;;;
/* ;;; Show a message in a requester */
ReqMsg:
	parse arg msg
	oldaddr = address()
	address(GuiPort)
	'request id MAIN title "'WinTitle'" gadgets "OK" string' msg
	choice = result
	address(oldaddr)
	return choice
;;;
/* ;;; Error handler */
Error:
	if RC = 5 then return
	oldaddress = address()
	address(GuiPort)
	call ReqMsg('Error' RC 'in line' sigl)
	address(oldaddress)
	call Cleanup()
	return
;;;




