ùúùú  Üw Oó  Z  Z  Z  Z  Z  Z  Z  Z*******************************************************************************
*
*	$VER: AnyProgram 0.01ß   (21-Feb-95  20:30)
*
* Beginning of a program that uses the GadUtil.library. This code may be
* used by everyone who wants to develop assembly language programs using
* GadUtil for layout, hotkeys and listview special functions.
*
* Subroutines:
*
*	DoStartup - minimal Workbench and CLI startup code. No arguments
*		    are checked.
*
*	EndStartup - replies the Workbench startup message.
*
*	process_events - main loop of the program.
*
*	GetIMessage - get a message from a window's UserPort. This routine
*		      will also check for IDCMP_REFRESHWINDOW, and refresh
*		      all gadgets and bevel boxes automatically. The message
*		      will be replied in this routine and you will have some
*		      of the message contents in some registers.
*
*	GetLocStr - get a localized string using the programs catalog.
*
*	About - display the requester containing some information about the
*		program and its author.
*
*	DoRequester - display a requester with the given gadget, body and
*		      title text.
*
*	You may change all routines in this code, but you may not spread any
*	modified versions of this file (all your programs may be spread even
*	if you use this code, as this is the purpose of these routines).
*
*	See the documentation for GadUtil.library for distribution of the
*	programs you create.
*
* Macros:
*
*	_PROGNAME - the name of your program
*
*	_SHORTAUTHOR - the name to be placed in the window title. Can be
*		       the author's or a company's name etc.
*
*	_FULLAUTHOR - the author's full name and address. This text will
*		      be shown in the about window
*
*	_VERSION - the version of your program
*
*	_DATE - the compilation date of the program. This example uses
*		RevTimer by Staffan Hämälä. If you don't have this program,
*		you may need to change this macro to a dc.b statement. The
*		date here is in a free format (not used by the version cmd).
*
*	_VERTAG - the version tag. The Version command will search for this
*		  string in the program. The string is in a strict format,
*		  and the best thing is to avoid changing anything else than
*		  the date (dd.mm.yy format).
*
*******************************************************************************

	incdir	include:
	include	libraries/gadtools.i
	include	libraries/gadutil.i
	include	libraries/gadutil_lib.i
	include	libraries/asl.i
	include	dos/dosextens.i
	include	exec/lists.i
	include	exec/memory.i
	include	LVOs.i
	include	gadutil_20to30comp.i

DEBUG:	equ	0

_PROGNAME:	MACRO
		dc.b	'AnyProgram '
		ENDM
		
_SHORTAUTHOR:	MACRO
		dc.b	"P-O Yliniemi",0
		ENDM

_FULLAUTHOR:	MACRO
		dc.b	10,10
		dc.b	"         Per-Olof Yliniemi",10
		dc.b	"         Box 78",10
		dc.b	"         SE-980 61 Tärendö",10
		dc.b	"         SWEDEN",10,10,0
		ENDM

_VERSION:	MACRO
		dc.b	'0.01ß'
		ENDM

_DATE:		MACRO
		incbin	env:date
		ENDM

_VERTAG:	MACRO
		dc.b	'$VER: '
		_PROGNAME
		_VERSION
		dc.b	' (12.07.96)',0
		ENDM

;------------------------ Open libraries and run. ----------------------------
Main:
	move.l	_AbsExecBase.w,a6
	lea.l	BSS_Data,a5		; Get pointer to all program data
	bsr.b	DoStartup		; Simple startup code
	lea.l	libdatas(pc),a2
	move.w	(a2)+,d2
.openlib:
	moveq.l	#0,d0			; Get required version of library
	move.w	(a2)+,d0
	move.l	(a2),a1			; Get pointer to library name
	CallLib	OpenLibrary
	move.l	d0,(a2)+		; Save library base address
	dbeq	d2,.openlib
	beq.b	.closelibs		; Close opened libraries on error

	bsr.w	Program			; Start the actual program
	bra.b	.nodos			; Don't print error message

.closelibs:
	move.l	DosBase(pc),d0		; Check for dos.library
	beq.b	.nodos
	lea.l	errstr(pc),a0		; Tell that the program needs the
	move.l	a0,d1			;  gadutil.library
	CallLib	PutStr,d0
	move.l	_AbsExecBase.w,a6
.nodos:
	lea.l	libdatas(pc),a2		; Get library bases
	move.w	(a2)+,d2		; Get num of libraries to close
.closelib:
	tst.w	(a2)+			; Skip version number
	move.l	(a2)+,d0		; Get library base
	beq.b	.closedone		; Done if NULL
	move.l	d0,a1
	CallLib	CloseLibrary
	dbra	d2,.closelib
.closedone:
	bsr.b	EndStartup
	moveq.l	#0,d0
	rts

;**************************** Startup code ************************************
;------------------------- Workbench startup ----------------------------------
;	Get WB startup message
;
DoStartup:
	movem.l	d0-d1/a0-a2/a6,-(sp)

	move.l	_AbsExecBase.w,a6
	suba.l	a1,a1			; Find this task
	CallLib	FindTask
	move.l	d0,a2			; Save pointer to task

	tst.l	pr_CLI(a2)		; Check if started from WB or CLI
	bne.s	.startupdone		; Program was started from CLI

	lea.l	pr_MsgPort(a2),a0	; Wait for Workbench startup message
	CallLib	WaitPort
	lea.l	pr_MsgPort(a2),a0	; Get the WB startup message
	CallLib	GetMsg
	move.l	d0,WBMessage(a5)	; and save it for later use

.startupdone:
	movem.l	(sp)+,d0-d1/a0-a2/a6
	rts	

;************************* Reversed Startup code ******************************
;	Reply WB startup message

EndStartup:
	move.l	_AbsExecBase.w,a6	; Return the WB startup message
	move.l	WBMessage(a5),d2
	beq.s	.nowbmsg		; No WB startup message
	CallLib	Forbid
	move.l	d2,a1
	CallLib	ReplyMsg
.nowbmsg:
	rts

;-------------------------- Data for init routines ----------------------------
libdatas:	dc.w	4-1
		dc.w	37
DosBase:	dc.l	dosname
		dc.w	37
GfxBase:	dc.l	gfxname
		dc.w	37
IntuiBase:	dc.l	intuiname
		dc.w	36
GUtilBase:	dc.l	gadutilname

AslBase:	dc.l	0			; Optional libraries
AslLibName:	dc.b	'asl.library',0

dosname:	dc.b	'dos.library',0
gadutilname:	dc.b	'gadutil.library',0
gfxname:	dc.b	'graphics.library',0
intuiname:	dc.b	'intuition.library',0

errstr:		dc.b	'This program requires GadUtil.library v36+',10,0
	_VERTAG
	even

;------------------------- The program starts here ---------------------------
Program:
	movem.l	d0-a6,-(sp)
	suba.l	a0,a0			; Lock the default public screen
	CallLib	LockPubScreen,IntuiBase(pc)
	move.l	d0,screen(a5)		; Save screen pointer
	beq.w	.noscreen

	lea.l	catalogname(pc),a0	; Open catalog for translated strings
	moveq.l	#0,d0
	CallLib	GU_OpenCatalog,GUtilBase(pc)
	move.l	d0,catalog

	move.l	screen(a5),a2		; Screen pointer
	move.l	sc_Font(a2),textattr	; Use the screen's font for gadgets
	lea.l	glist(pc),a0		; Gadget list pointer
	lea.l	gadgets(pc),a1		; LayoutGadget structures
	lea.l	LayoutTags(pc),a3	; Layout tags

	move.l	GUtilBase(pc),a6	; Create all gadgets
	CallLib	GU_LayoutGadgetsA
	move.l	a0,priv_info(a5)	; Save structure pointer
	beq.w	.unlockscreen		; Could not create gadgets!

	lea.l	window_tags(pc),a1	; Get pointer to window tag list
	move.l	textattr(pc),a0		; Get the screen's font

	movem.l	a0-a1,-(sp)		; Save regs
	move.l	a0,a1			; Font to calculate text width with
	lea.l	MainWTitle(pc),a0	; Get length of zoomed window's title
	clr.b	moretitle		; Mark end of "zoomed" title
	CallLib	GU_TextWidth
	move.b	#" ",moretitle		; Restore removed char
	movem.l	(sp)+,a0-a1		; Restore regs

	add.w	#87,d0			; Adjust width for system gadgets
	move.w	d0,zoomw(a1)		; Set zoomed window's width

	moveq.l	#0,d0			; WinTop = ZoomY = ZoomH =
	move.w	ta_YSize(a0),d0		; fontheight + 3
	addq.w	#3,d0
	move.l	d0,wintop(a1)
	move.w	d0,zoomy(a1)
	move.w	d0,zoomh(a1)

	move.l	farright(pc),d0		; WA_InnerWidth = farright+LEFT_OFFSET
	addq.l	#LEFT_OFFSET,d0
	move.l	d0,winwid(a1)

	move.l	farbottom(pc),d0	; WA_InnerHeight = farbottom+TOP_OFFSET
	addq.l	#TOP_OFFSET,d0
	move.l	d0,winhei(a1)

	suba.l	a0,a0			; Open the window
	CallLib	OpenWindowTagList,IntuiBase(pc)
	move.l	d0,main_win(a5)
	beq.b	.freegads		; Error opening the window

	move.l	d0,a0			; Refresh everything in the window
	move.l	priv_info(a5),a1
	CallLib	GU_RefreshWindow,GUtilBase(pc)

	lea.l	NewMenus(pc),a0		; Create menu structure
	move.l	priv_info(a5),a1
	suba.l	a2,a2
	lea.l	layoutmenutags(pc),a3
	CallLib	GU_CreateLocMenuA
	move.l	d0,menustrip(a5)
	beq.b	.closewin		; Could not create menus

	move.l	d0,a1			; Attach the menus to the window
	move.l	IntuiBase(pc),a6
	move.l	main_win(a5),a0
	CallLib	SetMenuStrip
	tst.l	d0
	beq.b	.freemenus

	move.l	main_win(a5),a0		; Wait for and process all events
	bsr.b	process_events	

.clearmenus:
	move.l	IntuiBase(pc),a6	; Remove menus from window
	CallLib	ClearMenuStrip
.freemenus:
	move.l	GUtilBase(pc),a6	; Deallocate menu structures
	move.l	menustrip(a5),a0
	CallLib	GU_FreeMenus
.closewin:
	move.l	main_win(a5),a0		; Close the main window	
	CallLib	CloseWindow,IntuiBase(pc)
.freegads:
	move.l	priv_info(a5),a0	; Free all gadgets
	move.l	GUtilBase(pc),a6
	CallLib	GU_FreeLayoutGadgets
.unlockscreen:
	suba.l	a0,a0			; No name pointer
	move.l	screen(a5),a1		; Pointer to locked screen
	CallLib	UnlockPubScreen,IntuiBase(pc)
.noscreen:
	move.l	catalog(pc),a0
	CallLib	GU_CloseCatalog,GUtilBase(pc)
	movem.l	(sp)+,d0-a6
	rts

;----------------------- Process all window events ---------------------------
WINDOW:	set	32			; Stack offset for window address

process_events:
	movem.l	d0-a6,-(sp)
.WaitEvent:
	move.l	_AbsExecBase.w,a6
	move.l	WINDOW(sp),a0		; Get pointer to window
	move.l	wd_UserPort(a0),a0	; Get UserPort
	CallLib	WaitPort		; Wait for a message
.GetEvent:
	move.l	WINDOW(sp),a0		; Get window pointer
	bsr.w	GetIMessage		; Get the message and process REFRESH
	bmi.s	.GetEvent		; Get next event if IDCMP_REFRESHWIN
	beq.s	.WaitEvent		; Continue waiting if no message

.checkmenus:
	cmp.l	#IDCMP_MENUPICK,d3	; Any menu picked ?
	bne.b	.checkgadup
.checkitem:
	move.w	d2,d0			; Packed menu number to D0
	move.l	menustrip(a5),a0	; Menustrip address
	move.l	IntuiBase(pc),a6
	CallLib	ItemAddress		; Get address of this menu item
	tst.l	d0
	beq.b	.GetEvent		; No item
	move.l	d0,a0			; Get userdata from item
	move.l	mi_SIZEOF(a0),d0	; MenuItem->UserData
	move.w	mi_NextSelect(a0),d2	; Get next selected menu item

	cmp.w	#MNI_PRJ_QUIT,d0	; Check for Quit menu item
	beq.w	.Exit			; Exit immediately

	cmp.w	#MNI_PRJ_ABOUT,d0	; Check for About selection
	bne.b	.checknextmni
	bsr.w	About			; Display the information requester
	bra.b	.checkitem		; Check next item
.checknextmni:
	bra.b	.checkitem		; Check next item

;------------------------ Check for gadget up events -------------------------
.checkgadup:
	cmp.l	#IDCMP_GADGETUP,d3	; Any gadget released ?
	bne.w	.CheckGadDn		; Nope! Check for gadget down
	move.w	gg_GadgetID(a2),d1	; Get GadgetID

	move.l	DosBase(pc),a6
	cmp.w	#FIRST_GAD,d1		; Check for first gadget
	bne.b	.checksecond
	bchg	#1,$bfe001
	moveq.l	#25,d1
	CallLib	Delay
	bchg	#1,$bfe001
	bra.b	.GetEvent

.checksecond:
	cmp.w	#SECOND_GAD,d1		; Check for second gadget
	bne.b	.checkthird
	moveq.l	#2-1,d2
.blink2:
	bchg	#1,$bfe001
	moveq.l	#25,d1
	CallLib	Delay
	bchg	#1,$bfe001
	moveq.l	#25,d1
	CallLib	Delay
	dbra	d2,.blink2

	bra.w	.GetEvent

.checkthird:
	cmp.w	#THIRD_GAD,d1		; Check for third gadget
	bne.b	.checknextgad
	moveq.l	#3-1,d2
.blink3:
	bchg	#1,$bfe001
	moveq.l	#25,d1
	CallLib	Delay
	bchg	#1,$bfe001
	moveq.l	#25,d1
	CallLib	Delay
	dbra	d2,.blink3

	bra.w	.GetEvent

.checknextgad:
	bra.w	.GetEvent

;---------------------- Check for gadget down events -------------------------
.CheckGadDn:
	cmp.l	#IDCMP_GADGETDOWN,d3	; Gadget down message ?
	bne.b	.CheckClose
	move.w	gg_GadgetID(a2),d1	; Get GadgetID

	bra.w	.GetEvent

;------------------------ Check for the close gadget ------------------------
.CheckClose:
	cmp.l	#IDCMP_CLOSEWINDOW,d3	; Close gadget pressed ?
	bne.w	.GetEvent		; Nope! Get next message
.Exit
	movem.l	(sp)+,d0-a6
	rts
	
;---------------------- Get a message from the window ------------------------
; Input:
;	A0 = pointer to window
; Output:
;	A2 = Message IAddress
;	D2 = Message Code
;	D3 = Message Class
; Flags:
;	 Z =  1 for no message (use BEQ)
;	 Z =  0 for a valid message other than IDCMP_REFRESHWINDOW
;	 N =  1 for a IDCMP_REFRESHWINDOW message (use BMI)
;
;------------------------------------------------------------------------------
GetIMessage:
	move.l	a0,-(sp)		; Save window pointer
	move.l	wd_UserPort(a0),a0	; Get UserPort

	CallLib	GU_GetIMsg,GUtilBase(pc)
	beq.s	.NoMessage		; No message - return
	move.l	d0,a1
	move.l	im_IAddress(a1),a2	; IAddress to A2
	moveq.l	#0,d2			; Clear code longword
	move.w	im_Code(a1),d2		; Code to D2
	move.l	im_Class(a1),d3		; Class to D3
	CallLib	GU_ReplyIMsg		; Reply the message

	cmp.l	#IDCMP_REFRESHWINDOW,d3	; Do window need to be refreshed ?
	bne.b	.NoMessage		; Nope! Check next message!
	move.l	(sp),a0
	CallLib	GU_BeginRefresh		; Start refreshing window
	move.l	(sp),a0
	move.l	priv_info(a5),a1
	CallLib	GU_RefreshBoxes
	moveq.l	#TRUE,d0
	CallLib	GU_EndRefresh		; Refreshing done
	moveq.l	#-1,d0			; Set N flag
.NoMessage:
	move.l	(sp)+,a0
	rts

;----------------------- Get a string from the catalog -----------------------
; Inputs:
;	D0 - ID of string to get
; Result:
;	D0 - Localized or default string
;
GetLocStr:
	movem.l	d1/a0-a1,-(sp)
	lea.l	AppStrings(pc),a1	; Get default strings
	move.l	catalog(pc),a0		; Get catalog pointer
	move.l	GUtilBase(pc),a6
	CallLib	GU_GetLocaleStr		; Get the localized string
	movem.l	(sp)+,d1/a0-a1
	rts

;----------------------- Show some info about the program ---------------------
About:
	lea.l	FmtParams(a5),a0	; Get parameter block
	lea.l	version(pc),a1		; Insert version string pointer
	move.l	a1,(a0)+
	lea.l	date(pc),a1		; Insert date string pointer
	move.l	a1,(a0)+
	lea.l	author(pc),a1		; Insert author string pointer
	move.l	a1,(a0)+

	moveq.l	#ABOUT_TEXT,d0		; Get localized about text
	bsr.b	GetLocStr
	move.l	d0,a0
	moveq.l	#ABOUT_TIT,d0		; Get localized title text
	bsr.b	GetLocStr
	move.l	d0,a1
	moveq.l	#ABOUT_OK,d0		; Get localized gadget text
	bsr.b	GetLocStr
	bsr.b	DoRequester
	rts

;------------------------- Display a requester --------------------------------
; Purpose:
;	Display a requester on the same screen as the program main window.
;	Block all input to the main window while the requester is up.
; Inputs:
;	D0 - Gadget format string
;	A0 - Pointer to requester body text
;	A1 - Pointer to requester title text
;------------------------------------------------------------------------------
DoRequester:
	movem.l	d0-d1/a0-a3/a6,-(sp)
	move.l	a1,a2			; Save Requester title pointer
	lea.l	.myeasystruct(pc),a1	; Pointer to EasyStruct
	move.l	d0,.gadgform(a1)	; Insert gadget format string
	move.l	a0,es_TextFormat(a1)	; Set pointer to body text
	move.l	a2,es_Title(a1)		; Set pointer to title text
		
	move.l	main_win(a5),a0		; Window
	move.l	GUtilBase(pc),a6
	CallLib	GU_BlockInput		; Block input to main window
	suba.l	a2,a2			; No terminating IDCMP flags
	lea.l	FmtParams(a5),a3	; Pointer to parameters (2 longwords)
	CallLib	EasyRequestArgs,IntuiBase(pc),keep
	move.l	main_win(a5),a0
	CallLib	GU_FreeInput		; Unblock input to main window

	movem.l	(sp)+,d0-d1/a0-a3/a6
	rts

.myeasystruct:
	dc.l	EasyStruct_SIZEOF
	dc.l	0,0			; Flags and requester title
	dc.l	0			; Body text
.gadgform:	equ	*-.myeasystruct
	dc.l	0			; Gadget text
	even

;------------------------------- Window datas --------------------------------

INTUIIDCMP:	equ	IDCMP_REFRESHWINDOW!IDCMP_CLOSEWINDOW!IDCMP_MOUSEMOVE
WINGADS:	equ	WFLG_DRAGBAR!WFLG_DEPTHGADGET!WFLG_CLOSEGADGET

window_tags:
	dc.l	WA_Left,	0,	WA_Top,	0
wintop:	equ	*-window_tags-4
winwid:	equ	*-window_tags+4
	dc.l	WA_InnerWidth,	0,	WA_InnerHeight,0
winhei:	equ	*-window_tags-4
	dc.l	WA_IDCMP,	INTUIIDCMP!IDCMP_MENUPICK
MinimumIDCMP:	equ	*-4
	dc.l	WA_Flags,	WINGADS!WFLG_ACTIVATE!WFLG_SMART_REFRESH!WFLG_REPORTMOUSE
	dc.l	WA_NewLookMenus,TRUE
	dc.l	WA_Gadgets,	0
glist:	equ	*-4
	dc.l	WA_Title,	MainWTitle
	dc.l	WA_Zoom,	zooms
emptytag:
	dc.l	TAG_DONE

zooms:	dc.w	0,11,240,11
zoomy:	equ	*-window_tags-6
zoomw:	equ	*-window_tags-4
zoomh:	equ	*-window_tags-2

layoutmenutags:
	dc.l	GTMN_NewLookMenus,	TRUE,	TAG_DONE
	
MainWTitle:	_PROGNAME
		dc.b	"v"
		_VERSION
moretitle:	dc.b	" © 1995 by "
		_SHORTAUTHOR

	even

;------------------------ Datas for LayoutGadgetsA ---------------------------
LayoutTags:
	dc.l	GU_RightExtreme,	farright
	dc.l	GU_LowerExtreme,	farbottom
	dc.l	GU_MinimumIDCMP,	MinimumIDCMP
ta:	dc.l	GU_DefTextAttr,		0
cat:	dc.l	GU_Catalog,		0
	dc.l	GU_AppStrings,		AppStrings
	dc.l	TAG_DONE

textattr:	equ	ta+4	
catalog:	equ	cat+4

farright:	dc.l	0
farbottom:	dc.l	0

;------------------------ Start of localized data -----------------------------

BEVELBOX_1:	equ	0
FIRST_GAD:	equ	1
SECOND_GAD:	equ	2
THIRD_GAD:	equ	3
HELPGAD_HELP:	equ	4
BEVELBOX_HELP:	equ	5
FIRST_GAD_HELP:	equ	6
SECOND_GAD_HELP:	equ	7
THIRD_GAD_HELP:	equ	8
MNU_PRJ_TITLE:	equ	9
MNI_PRJ_OPEN:	equ	10
MNI_PRJ_SAVE:	equ	11
MNI_PRJ_PRINT:	equ	12
MNS_PRJ_PRINT_DRAFT:	equ	13
MNS_PRJ_PRINT_NLQ:	equ	14
MNI_PRJ_ABOUT:	equ	15
MNI_PRJ_QUIT:	equ	16
MNU_EDIT_TITLE:	equ	17
MNI_EDIT_CUT:	equ	18
MNI_EDIT_COPY:	equ	19
MNI_EDIT_PASTE:	equ	20
MNI_EDIT_UNDO:	equ	21
ABOUT_TIT:	equ	22
ABOUT_TEXT:	equ	23
ABOUT_OK:	equ	24

AppStrings:
	dc.l	BEVELBOX_1,	BEVELBOX_1_STR
	dc.l	FIRST_GAD,	FIRST_GAD_STR
	dc.l	SECOND_GAD,	SECOND_GAD_STR
	dc.l	THIRD_GAD,	THIRD_GAD_STR
	dc.l	HELPGAD_HELP,	HELPGAD_HELP_STR
	dc.l	BEVELBOX_HELP,	BEVELBOX_HELP_STR
	dc.l	FIRST_GAD_HELP,	FIRST_GAD_HELP_STR
	dc.l	SECOND_GAD_HELP,	SECOND_GAD_HELP_STR
	dc.l	THIRD_GAD_HELP,	THIRD_GAD_HELP_STR
	dc.l	MNU_PRJ_TITLE,	MNU_PRJ_TITLE_STR
	dc.l	MNI_PRJ_OPEN,	MNI_PRJ_OPEN_STR
	dc.l	MNI_PRJ_SAVE,	MNI_PRJ_SAVE_STR
	dc.l	MNI_PRJ_PRINT,	MNI_PRJ_PRINT_STR
	dc.l	MNS_PRJ_PRINT_DRAFT,	MNS_PRJ_PRINT_DRAFT_STR
	dc.l	MNS_PRJ_PRINT_NLQ,	MNS_PRJ_PRINT_NLQ_STR
	dc.l	MNI_PRJ_ABOUT,	MNI_PRJ_ABOUT_STR
	dc.l	MNI_PRJ_QUIT,	MNI_PRJ_QUIT_STR
	dc.l	MNU_EDIT_TITLE,	MNU_EDIT_TITLE_STR
	dc.l	MNI_EDIT_CUT,	MNI_EDIT_CUT_STR
	dc.l	MNI_EDIT_COPY,	MNI_EDIT_COPY_STR
	dc.l	MNI_EDIT_PASTE,	MNI_EDIT_PASTE_STR
	dc.l	MNI_EDIT_UNDO,	MNI_EDIT_UNDO_STR
	dc.l	ABOUT_TIT,	ABOUT_TIT_STR
	dc.l	ABOUT_TEXT,	ABOUT_TEXT_STR
	dc.l	ABOUT_OK,	ABOUT_OK_STR

BEVELBOX_1_STR:
	dc.b	'Gadgets',0
FIRST_GAD_STR:
	dc.b	'_First Gadget',0
SECOND_GAD_STR:
	dc.b	'_Second Gadget',0
THIRD_GAD_STR:
	dc.b	'_Third Gadget',0
HELPGAD_HELP_STR:
	dc.b	'This gadget shows some help!',0
BEVELBOX_HELP_STR:
	dc.b	'Point at any gadget!',0
FIRST_GAD_HELP_STR:
	dc.b	'Help for 1:st gadget',0
SECOND_GAD_HELP_STR:
	dc.b	'Help for 2:nd gadget',0
THIRD_GAD_HELP_STR:
	dc.b	'Help for 3:rd gadget',0
MNU_PRJ_TITLE_STR:
	dc.b	' ',$00,'Project',0
MNI_PRJ_OPEN_STR:
	dc.b	'O',$00,'Open...',0
MNI_PRJ_SAVE_STR:
	dc.b	'S',$00,'Save...',0
MNI_PRJ_PRINT_STR:
	dc.b	' ',$00,'Print...',0
MNS_PRJ_PRINT_DRAFT_STR:
	dc.b	' ',$00,'Draft',0
MNS_PRJ_PRINT_NLQ_STR:
	dc.b	' ',$00,'NLQ',0
MNI_PRJ_ABOUT_STR:
	dc.b	'?',$00,'About',0
MNI_PRJ_QUIT_STR:
	dc.b	'Q',$00,'Quit',0
MNU_EDIT_TITLE_STR:
	dc.b	' ',$00,'Edit',0
MNI_EDIT_CUT_STR:
	dc.b	'X',$00,'Cut',0
MNI_EDIT_COPY_STR:
	dc.b	'C',$00,'Copy',0
MNI_EDIT_PASTE_STR:
	dc.b	'V',$00,'Paste',0
MNI_EDIT_UNDO_STR:
	dc.b	'U',$00,'Undo',0
ABOUT_TIT_STR:
	dc.b	'               About AnyProgram',0
ABOUT_TEXT_STR:
	dc.b	'AnyProgram v%s (%s)',$0a,$0a,'Copyright © 1995 by:%sThis program is DiskWare. Send me one or',$0a,'more  disks  with  freely  distributable',$0a,'programs if you use it.',$0a,$0a,'Bug reports and  suggestions should also',$0a,'be sent to the same address.',$0a,$0a,'This program uses gadutil.library, which',$0a,'is Copyright © 1994-1995 by P-O Yliniemi',$0a,'and Staffan Hämälä.',0
ABOUT_OK_STR:
	dc.b	'OK',0

catalogname:	dc.b	'anyprogram.catalog',0

;-------------------------- End of localized data -----------------------------

version:	_VERSION
empstr:		dc.b	0
date:		_DATE
		dc.b	0
author:		_FULLAUTHOR
		even
;----------------------------- Gadget datas ----------------------------------
LEFT_OFFSET:	equ	6
TOP_OFFSET:	equ	3
SHOWHELP_GAD:	equ	1000

StdGTTags:
	dc.l	GT_Underscore,	'_',		TAG_DONE
	
BevelBox_1:
	dc.l	GU_GadgetKind,	BEVELBOX_KIND,	GU_Left,	LEFT_OFFSET
	dc.l	GU_HelpGadget,	SHOWHELP_GAD,	GU_HelpText,	0
	dc.l	GU_Top,		TOP_OFFSET,	GU_LocaleText,	BEVELBOX_1
	dc.l	GU_AdjustTop,	-4
	dc.l	GU_AlignRight,	FIRST_GAD,	GU_AddWidth,	8
	dc.l	GU_AlignBottom,	SHOWHELP_GAD,	GU_AddHeight,	INTERHEIGHT

	dc.l	GUBB_Flags,	BB_TEXT_IN,	GUBB_TextPen,	SHINEPEN
	dc.l	GUBB_FrameType,	BFT_RIDGE,	GUBB_Recessed,	TRUE
	dc.l	TAG_DONE

First_Gad:
	dc.l	GU_GadgetKind,	BUTTON_KIND,	GU_LocaleText,	FIRST_GAD
	dc.l	GU_HelpGadget,	SHOWHELP_GAD,	GU_LocaleHelp,	FIRST_GAD_HELP
	dc.l	GU_AddLeft,	INTERWIDTH,	GU_AdjustTop,	0
	dc.l	GU_AutoWidth,	50,		GU_AutoHeight,	4
StdButtonTags:
	dc.l	GU_Flags,	PLACETEXT_IN
StdGadTags:
	dc.l	GU_LabelHotkey,	TRUE		GU_TextAttr,	mytextattr
	dc.l	TAG_DONE

Second_Gad:
	dc.l	GU_GadgetKind,	BUTTON_KIND,	GU_LocaleText,	SECOND_GAD
	dc.l	GU_HelpGadget,	SHOWHELP_GAD,	GU_LocaleHelp,	SECOND_GAD_HELP
	dc.l	GU_AlignLeft,	FIRST_GAD,	GU_TopRel,	FIRST_GAD
	dc.l	GU_DupeHeight,	FIRST_GAD,	GU_DupeWidth,	FIRST_GAD
	dc.l	GU_AddTop,	INTERHEIGHT,	TAG_MORE,	StdButtonTags

Third_Gad:
	dc.l	GU_GadgetKind,	BUTTON_KIND,	GU_LocaleText,	THIRD_GAD
	dc.l	GU_HelpGadget,	SHOWHELP_GAD,	GU_LocaleHelp,	THIRD_GAD_HELP
	dc.l	GU_AlignLeft,	FIRST_GAD,	GU_TopRel,	SECOND_GAD
	dc.l	GU_DupeHeight,	FIRST_GAD,	GU_DupeWidth,	FIRST_GAD
	dc.l	GU_AddTop,	INTERHEIGHT,	TAG_MORE,	StdButtonTags

ShowHelpGad:
	dc.l	GU_GadgetKind,	TEXT_KIND,	GU_AlignLeft,	FIRST_GAD
	dc.l	GU_HelpGadget,	SHOWHELP_GAD,	GU_LocaleHelp,	HELPGAD_HELP
	dc.l	GU_TopRel,	THIRD_GAD,	GU_DupeWidth,	FIRST_GAD
	dc.l	GU_DupeHeight,	FIRST_GAD,	GU_AddTop,	INTERHEIGHT
	dc.l	TAG_DONE
	
TextKTags:
	dc.l	GTTX_Border,	TRUE,		TAG_DONE
	
gadgets:
	GADGET	BEVELBOX_1,	BevelBox_1,	StdGTTags
	GADGET	FIRST_GAD,	First_Gad,	StdGTTags
	GADGET	SECOND_GAD,	Second_Gad,	StdGTTags
	GADGET	THIRD_GAD,	Third_Gad,	StdGTTags
	GADGET	SHOWHELP_GAD,	ShowHelpGad,	TextKTags
	GADGET	-1,	NULL,	NULL

NewMenus:	
	LOCMENU	NM_TITLE, MNU_PRJ_TITLE,0,	0,	0	; | Project |
	LOCMENU	NM_ITEM,  MNI_PRJ_OPEN,	0,	0,MNI_PRJ_OPEN	; Open... [O]
	LOCMENU	NM_ITEM,  MNI_PRJ_SAVE,	0,	0,MNI_PRJ_SAVE	; Save... [S]
	LOCMENU	NM_ITEM,  NM_BARLABEL,	0,	0,	0	; -----------

	LOCMENU	NM_ITEM,  MNI_PRJ_PRINT,0,	0,	0	; Print...
	LOCMENU	NM_SUB,MNS_PRJ_PRINT_DRAFT,0,0,MNS_PRJ_PRINT_DRAFT ;     Draft
	LOCMENU	NM_SUB,	  MNS_PRJ_PRINT_NLQ,0,0,MNS_PRJ_PRINT_NLQ  ;     NLQ
	LOCMENU	NM_ITEM,  NM_BARLABEL,	0,	0,	0	; -----------
	LOCMENU	NM_ITEM,  MNI_PRJ_ABOUT,0,	0,MNI_PRJ_ABOUT	; About   [?]
	LOCMENU NM_ITEM,  MNI_PRJ_QUIT,	0,	0,MNI_PRJ_QUIT	; Quit    [Q]

	LOCMENU	NM_END,	  NULL,		0,	0,	0

;------------------------------------ BSS ------------------------------------
	SECTION	MemTest_BSS,BSS
	
	STRUCTURE	MemTest_BSS,0
		LONG	WBMessage

		LONG	screen		; Locked public screen
		LONG	priv_info	; PrivateInfo from GU_LayoutGadgetsA
		LONG	main_win	; The program's main window
		LONG	menustrip	; Menus for main window
		STRUCT	FmtParams,12	; 3 longwords for text formatting
	LABEL	BSS_SIZEOF
		
BSS_Data:	ds.b	BSS_SIZEOF
