;
; progInfo.s
;
; The `About this program' box (MDW)
;
;  1994-1998 Straylight
;

;----- Licensing note -------------------------------------------------------
;
; This file is part of Straylight's Sapphire library.
;
; Sapphire is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2, or (at your option)
; any later version.
;
; Sapphire is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with Sapphire.  If not, write to the Free Software Foundation,
; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

;----- Standard header ------------------------------------------------------

		GET	libs:header
		GET	libs:swis

;----- External dependencies ------------------------------------------------

		GET	sapphire:dbox
		GET	sapphire:mbox
		GET	sapphire:sapphire

;----- Icon numbers ---------------------------------------------------------

piIcon__title	EQU	0
piIcon__name	EQU	7
piIcon__purpose	EQU	5
piIcon__author	EQU	3
piIcon__version	EQU	1

;----- Main code ------------------------------------------------------------

		AREA	|Sapphire$$Code|,CODE,READONLY

; --- progInfo ---
;
; On entry:	R0 == pointer to purpose string
;		R1 == pointer to author string
;		R2 == pointer to version string
;
; On exit:	May return an error
;
; Use:		Displays an `About this program' dialogue box on the screen.

		EXPORT	progInfo
progInfo	ROUT

		STMFD	R13!,{R0-R3,R14}	;Save some registers

		; --- Create the dialogue box ---

		ADR	R0,pi__dbName		;Point to the name string
		BL	dbox_create		;Create the dialogue box
		ADDVS	R13,R13,#4		;If error, don't restore R0
		LDMVSFD	R13!,{R1-R3,PC}		;Return any errors here
		MOV	R3,R0			;Save the dialogue handle

		; --- Fill in the various fields ---

		BL	sapphire_appName	;Find the application's name
		MOV	R2,R0			;Move pointer around nicely
		MOV	R0,R3			;Get the dialogue handle
		MOV	R1,#piIcon__name	;The `Name' icon
		BL	dbox_setField		;Fill it in
		LDR	R2,[R13,#0]		;Get the purpose string
		MOV	R1,#piIcon__purpose	;The `Purpose' icon
		BL	dbox_setField		;Fill it in
		LDR	R2,[R13,#4]		;Get the author string
		MOV	R1,#piIcon__author	;The `Author' icon
		BL	dbox_setField		;Fill that in too
		LDR	R2,[R13,#8]		;Get the version string
		MOV	R1,#piIcon__version	;The `Version' icon
		BL	dbox_setField		;And fill that one in

		; --- Display the dialogue box and return ---

		ADR	R1,pi__dbHelp		;Point to the help string
		MOV	R2,#piIcon__title	;The embedded title icon
		BL	mbox			;Handle the dialogue box
		LDMFD	R13!,{R0-R3,R14}	;Restore the registers
		BICS	PC,R14,#V_flag		;Return without error

pi__dbName	DCB	"progInfo",0
pi__dbHelp	DCB	"piHELP"

;----- Workspace ------------------------------------------------------------
;
; None.

;----- That's all, folks ----------------------------------------------------

		END
