	*««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««*
	*
	*   Example name
	*
	*	DFProgressBar.s -- 1.0
	*
	*   Function
	*	This example shows the DFProgressBarInit() function and the
	*	DFProgressUpdate() function in action.
	*
	*   Inputs
	*	structure - pointer to an initialized progressbar structure
	*
	*   Outputs
	*	The progress bar in rastport
	*
	*   Notes
	*	You may need to modify some of the include paths.
	*	You will of course also need the dfunc package which should
	*	contain includes and macros for the dfunc.library.
	*
	*	Also set UCASE = LCASE for my sources.
	*
	*   Bugs
	*	
	*   Created	: 7.3.96
	*   Last change	: 12.3.96
	*»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*

*## For the Startup.asm:

StartSkip	=	0		;0=WB/CLI, 1=CLI only  (AsmOne)
Processor	=	0		;0/680x0/0x0
MathProc	=	0		;0/68881/68882/68040/68060

*## Default includes:

		Incdir	""

** external includes and lvos:

		Include	lvo:intuition.lvo

** includes from our DFuncXXXX.library archive:

		Include	lvo:dfunc.lvo

		Incdir	inc:

		Include	digital.macs
		Include	digital.i
		Include	dfunc/dfunc.i

		Include	startup.asm

		Incdir	""

	dc.b	"$VER: DFProgressBar 1.0 (12.3.96)",0
	even
*»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
Init	DefLib	dfunc,38		;open our library (macro)
	DefLib	intuition,37		;open intuition.library
	DefEnd

Start	LibBase	intuition	;use intuition base in A6 (macro)

* We will here get the frontmost screen

	moveq	#0,d0
	Call	LockIBase	;lock intuition.library base so we can
	move.l	d0,ILock	;examine it.

	move.l	60(a6),ScreenBase	;get pointer to frontmost screen

	move.l	ILock(pc),a0
	Call	UnlockIBase	;free intuition base so others can use it

	sub.l	a0,a0			;no structure
	lea	WindowTags(pc),a1	;our tag list
	move.l	ScreenBase(pc),4(a1)	;init screen pointer
	Call	OpenWindowtaglist	;try open a window
	move.l	d0,WindowBase		;store pointer to window
	beq.w	Close			;if =0 then exit, couldn't open window

	move.l	d0,a1
	move.l	50(a1),Rastport		;rastport of window
	move.l	86(a1),Userport		;userport of window

;init progressbar structure:

	lea	Progress(pc),a0
	move.l	Rastport(pc),prg_rastport(a0)	;pointer to our rastport!!

Total	=	300

	move.l	#Total,prg_total(a0)		;total amount
	clr.l	prg_current(a0)			;we have current amount (=0)
	move.w	#13,prg_x1(a0)			;position to start draw
	move.w	#20,prg_y1(a0)
	move.w	#285,prg_x2(a0)			;end positions:
	move.w	#30,prg_y2(a0)
	move.b	#1,prg_locolor(a0)		;border hilight color
	move.b	#2,prg_hicolor(a0)		;border shadow color
	move.b	#7,prg_fillcolor(a0)		;fillcolor on bar
	move.b	#4,prg_clearcolor(a0)		;clear color

*** This is the dfunc.library function we demostrate:

	LibBase	dfunc

	lea	Progress(pc),a0
	DCall	ProgressBarInit		;draw progress bar

***
*	You need an initialized Progressbar structure (progressbar_stucture)
***

;DEMOSTRATION LOOP: first upto 100% then down to 0%

	moveq	#0,d5
.loop1	addq	#1,d5			;add one to amount
	lea	Progress(pc),a0		;the structure
	move.l	d5,prg_current(a0)	;update current amount

*** This is the dfunc.library function we demostrate:

	DCall	ProgressUpdate		;update progress bar

***
*	You need an initialized Progressbar structure (progressbar_stucture)
***

	cmp.l	#Total,d5		;100% ?
	bne.b	.loop1			;no, continue

.loop2	lea	Progress(pc),a0		;structure
	move.l	d5,prg_current(a0)	;update current amount
	DCall	ProgressUpdate		;update progress bar

	subq	#1,d5			;pull one from amount
	bne.b	.loop2			;=0, no, then continue

;	btst	#6,$bfe001		;if you want a loop on the progressbar
;	bne.b	.loop1			;remove the comments..

	move.l	Rastport(pc),a0
	lea	Gadgets(pc),a1
	DCall	RenderGadgets		;draw <ok> gadget

.wait	move.l	Rastport(pc),a0
	move.l	Userport(pc),a1
	lea	Gadgets(pc),a2
	DCall	WaitGad

	tst.l	d0
	beq.b	.wait
*·············································································*
Close	LibBase	intuition

	move.l	WindowBase(pc),d0
	beq.b	.noWindow
	move.l	d0,a0
	Call	CloseWindow		;close our window if any

.noWindow

	Return	0			;Exit
*»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
ILock		dc.l	0
ScreenBase	dc.l	0
WindowBase	dc.l	0

Rastport	dc.l	0
Userport	dc.l	0

Font	dc.l	FontName
	dc.w	8,0
*·············································································*
Progress	dcb.b	prg_SizeOf,0

* You can also initialize the structure like this:
*
*Progress:	
*	dc.l	0	;rastport
*	dc.l	Total	;total amount
*	dc.l	0	;current amount
*	dc.w	13	;x1
*	dc.w	20	;y1
*	dc.w	285	;x2
*	dc.w	30	;y2
*	dc.b	1	;hicolor
*	dc.b	2	;shadowcolor
*	dc.b	7	;fill color
*	dc.b	4	;clear color
*·············································································*
Gadgets		dc.w	100,40,100,12,0
		dc.l	GOk,0,0,0
		dc.l	$21101223
		dc.l	dg_HotKeys
		dc.l	0,0,-1
*·············································································*
WindowTags

	dc.l	WA_CustomScreen,0,WA_IDCMP,DF_IDCMP
	dc.l	WA_Width,300,WA_Height,60,WA_Left,30,WA_Top,30
	dc.l	WA_Title,WinTitle
	dc.l	WA_Activate,-1
	dc.l	WA_ReportMouse,-1
	dc.l	WA_RMBTrap,-1
	dc.l	WA_Dragbar,-1
	dc.l	0,0
*·············································································*
GOk		dc.b	13,"OK",0
FontName	dc.b	'topaz.font',0
WinTitle	dc.b	'Example: DFProgressBar',0
*»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
