 			output	work:huntwindows
			OPT o+,ow-

DEBUG			equ	0
			;0=Debugging off, 1=Debugging on
			;no includes - i use them all preassembled!

			;.... nearly all ....

			incdir	"asminc:"
			include "workbench/startup.i"
			include "workbench/workbench.i"
			include	"workbench/icon_lib.i"
			include	"libraries/commodities.i"
			include	"graphics/view.i"

			;Some helpful macros
CALL			macro
			jsr	_LVO\1(a6)
			endm
Push			macro
			movem.l	\1,-(sp)
			endm
Pull			macro
			movem.l	(sp)+,\1
			endm
RSave			macro
			movem.l	a0-a6/d0-d7,-(sp)
			endm
RLoad			macro
			movem.l	(sp)+,a0-a6/d0-d7
			endm

MaxScreens		equ	64	;Maximum of 64 Screens - who has more?
ScreenMemSize		equ	MaxScreens*8	

		;Bits for Communication
SignalWindow		equ	0
SignalScreen		equ	1
SignalButton		equ	2



MyHotkeyID	=	1
MyActionID	=	2
MyCustomID	=	3
MyLWinID	=	4
MyNWinID	=	5

			RSave

			move.l	$04,a6
			move.l	#AllocLength,d0
			move.l	#MEMF_CLEAR,d1
			CALL	AllocMem
			move.l	d0,a4
			tst.l	d0
			beq	EndeRaus

			move.l	d0,RememberA4
			move.l	a7,RememberStack

			lea	intuition(pc),a1
			moveq.l	#37,d0
			CALL	OpenLibrary
			move.l	d0,IntBase(a4)
			beq	Error2

			lea	DosName(pc),a1
			moveq.l	#37,d0
			CALL	OpenLibrary	
			move.l	d0,DosBase(a4)
			beq	Error2

			lea	GadName(pc),a1
			moveq.l	#37,d0
			CALL	OpenLibrary
			move.l	d0,GadBase(a4)
			beq	Error2

			lea	CommName(pc),a1
			moveq.l	#37,d0
			CALL	OpenLibrary
			move.l	d0,CommBase(a4)
			beq	Error2

			CALL	CreateMsgPort
			move.l	d0,MouseMsgPort(a4)
			beq	Error2

			move.l	#SIGBREAKF_CTRL_C,SignalMask(a4)

			move.l	d0,a0
			move.l	#IOSTD_SIZE,d0
			CALL	CreateIORequest
			move.l	d0,MyIORequest(a4)
			beq	Error2

			lea	InputName(pc),a0
			moveq.l	#0,d0
			move.l	MyIORequest(a4),a1
			moveq.l	#0,d1
			CALL	OpenDevice
			tst.l	d0
			bne	Error2

			lea	IconName(pc),a1
			moveq.l	#33,d0
			CALL	OpenLibrary
			move.l	d0,IconBase(a4)
			beq	Error2

			move.l	ThisTask(a6),a1
			move.l	a1,OwnTask(a4)
			tst.l	pr_CLI(a1)
			bne	CliStart
			lea	pr_MsgPort(a1),a2
			move.l	a2,a0
			CALL	WaitPort
			move.l	a2,a0
			CALL	GetMsg
			move.l	d0,WBMessage(a4)
			move.l	d0,a3
		
			move.l	sm_ArgList(a3),d7
			beq	DisableSave
			move.l	d7,a0
			move.l	wa_Lock(a0),d1
			move.l	DosBase(a4),a6
			CALL	CurrentDir

			move.l	IconBase(a4),a6
			move.l	d7,a0
			move.l	wa_Name(a0),a0
			CALL	GetDiskObject
			move.l	d0,DObject(a4)
			beq	Error2

			lea	WBTemplate(pc),a3

			move.l	d0,a0
			move.l	do_ToolTypes(a0),a0
			
GetEmLoop		tst.l	(a3)
			beq.s	FreeDobj
			move.l	TemplateText(a3),a1
			beq.s	FreeDobj
			move.l	a0,-(sp)
			CALL	FindToolType
			move.l	(sp)+,a0
			sub.l	a2,a2
			move.w	TemplateA4(a3),a2
			add.l	a4,a2
			move.l	d0,(a2)
			add.l	#TemplateSize,a3
			bra.s	GetEmLoop

FreeDobj		bsr	BuildPatterns

			bra.s	SkipReadArgs

CliStart		move.l	DosBase(a4),a6

			move.l	#Template,d1
			lea	TemplateArray(a4),a0
			move.l	a0,d2
			moveq.l	#0,d3
			CALL	ReadArgs	;Get options
			tst.l	d0
			beq	Error2
			move.l	d0,Args(a4)
	
			bsr	BuildPatterns

DisableSave		move.l	#1,TempSave(a4)

SkipReadArgs		move.l	$04,a6
			lea	GraphicsName(pc),a1
			moveq.l	#36,d0
			CALL	OpenLibrary
			move.l	d0,GraphicsBase(a4)
			beq	Error2

			tst.l	TempHADJ(a4)
			beq	GotIt1
			move.l	TempHADJ(a4),a0
			bsr	GetNexta0
			clr.l	TempHADJ(a4)
			cmp.b	#"l",d0
			beq.s	GotIt1
			add.l	#1,TempHADJ(a4)
			cmp.b	#"r",d0
			beq.s	GotIt1
			add.l	#1,TempHADJ(a4)
			cmp.b	#"c",d0
			beq.s	GotIt1
			add.l	#1,TempHADJ(a4)

GotIt1			tst.l	TempVADJ(a4)
			beq	GotIt2
			move.l	TempVADJ(a4),a0
			bsr	GetNexta0
			clr.l	TempVADJ(a4)
			cmp.b	#"t",d0
			beq.s	GotIt2
			add.l	#1,TempVADJ(a4)
			cmp.b	#"b",d0
			beq.s	GotIt2
			add.l	#1,TempVADJ(a4)
			cmp.b	#"c",d0
			beq.s	GotIt2
			add.l	#1,TempVADJ(a4)

GotIt2			tst.l	TempAction(a4)
			beq	GotIt3
			move.l	TempAction(a4),a0
			bsr	GetNexta0
			clr.l	TempAction(a4)
			cmp.b	#"n",d0
			beq.s	GotIt3
			add.l	#1,TempAction(a4)
			cmp.b	#"h",d0
			beq.s	GotIt3
			add.l	#1,TempAction(a4)

GotIt3			tst.l	TempCXPRI(a4)
			beq.s	GotIt3_1
			move.l	TempCXPRI(a4),a0
			bsr	GetNexta0
			bsr	GetInteger
			move.l	d0,TempCXPRI(a4)
			move.b	d0,MyPri

GotIt3_1		tst.l	TempDelay(a4)
			beq.s	GotIt4
			move.l	TempDelay(a4),a0
			bsr	GetNexta0
			bsr	GetInteger
			tst.l	d0
			bmi.s	GotIt4
			cmp.l	#100,d0
			bgt.s	GotIt4
			move.l	d0,TempDelay(a4)

GotIt4			move.l	$04,a6
			CALL	CreateMsgPort
			move.l	d0,BrokerPort
			move.l	d0,MyPort(a4)
			move.l	d0,a0
			move.b	MP_SIGBIT(a0),d0
			move.l	SignalMask(a4),d1	;Enter signal into
			bset	d0,d1			;mask for waiting
			move.l	d1,SignalMask(a4)

			move.l	CommBase(a4),a6
			lea	MyNewBroker(pc),a0
			clr.l	d0
			CALL	CxBroker
			tst.l	d0
			beq	QuitPrg
			move.l	d0,Broker(a4)

			move.l	d0,a0
			moveq.l	#1,d0
			CALL	ActivateCxObj
			
			;Install Handler for Mouse_Button_test

			move.l	#CX_CUSTOM,d0
			lea	TestButton(pc),a0	;My Program
			move.l	#MyCustomID,a1		;ID
			CALL	CreateCxObj
			move.l	d0,a1
			tst.l	d0
			beq	QuitPrg
			move.l	Broker(a4),a0
			CALL	AttachCxObj

			bsr	InstallHotKey

			move.l	$04,a6
	                moveq   #-1,d0			;A Signal for telling
	                jsr     _LVOAllocSignal(a6)	;our task that sth happened
	                tst.l   d0
	                bmi     Error2
	                move.l  d0,Signal(a4)
			move.l	SignalMask(a4),d1
	                bset    d0,d1
	                move.l	d1,SignalMask(a4)

			lea	MyInterrupt(a4),a1
			move.l	#Interrupt3,IS_CODE(a1)
			clr.l	IS_DATA(a1)
			move.b	#NT_INTERRUPT,LN_TYPE(a1)
			move.b	#0,LN_PRI(a1)
			move.l	#HandlerName,LN_NAME(a1)
			move.l	#5,d0			;INTB_VERTB
			jsr	_LVOAddIntServer(a6)

			tst.l	TempCXPOPUP(a4)
			beq.s	WaitOn
			bsr	OpenGUI

WaitOn			tst.w	QuitMe(a4)
			bne	QuitPrg
			move.l	$04,a6
			move.l	SignalMask(a4),d0	;Wait for Port and Break
			CALL	Wait
			btst	#SIGBREAKB_CTRL_C,d0	;This means quit
			bne	QuitPrg
			move.l	Signal(a4),d1
			btst	d1,d0			;Signal from Interrupt?
			beq.s	TryNextMsg

			tst.w	DisableHW(a4)
			bne.s	TryNextMsg		;Do nothing

			tst.l	TempDelay(a4)
			beq.s	NoDelay
			tst.w	GUIOpened(a4)
			bne	NoDelay	;Not with GUI opened

ReDelay			clr.w	DelayDo(a4)
			move.l	DosBase(a4),a6
			move.l	TempDelay(a4),d1	;Microseconds
			CALL	Delay
			tst.w	DelayDo(a4)	;Something happened again
			bne.s	ReDelay		;so wait till things calmed down
			move.l	$04,a6

NoDelay			tst.w	ButtonPressed(a4)
			bne.s	TryNextMsg		;Omit that stuff for now
			bclr	#SignalButton,What(a4)	;We will get a signal when
							;the button will be released

			cmp.l	#1,TempAction(a4)	;Only do it on Hotkey
			beq.s	TryNextMsg

OnHotKey		btst	#SignalWindow,What(a4)
			beq.s	NoWindowStuff
			bsr	DoYourJob
			bclr	#SignalWindow,What(a4)

NoWindowStuff		btst	#SignalScreen,What(a4)
			beq.s	TryNextMsg
			bsr	AdjustScreen
			bclr	#SignalScreen,What(a4)

TryNextMsg		move.l	$04,a6
			move.l	MyPort(a4),a0		;Get the message awaiting
			CALL	GetMsg
			tst.l	d0
			bne.s	GotMsg
			bsr	CheckGUI
			bra	WaitOn

GotMsg			move.l	d0,a3
			move.l	d0,a0
			move.l	CommBase(a4),a6
			CALL	CxMsgType
			move.l	d0,d6
			move.l	a3,a0
			CALL	CxMsgID
			move.l	d0,d5
			move.l	a3,a1
			move.l	$04,a6
			CALL	ReplyMsg
			cmp.w	#CXM_IEVENT,d6
			bne	OtherCommand
			cmp.l	#MyActionID,d5
			beq.s	NotGUIKey
			cmp.l	#MyLWinID,d5
			beq.s	ActivateLWIN
			cmp.l	#MyNWinID,d5
			beq.s	ActivateNWIN
			bsr	OpenGUI
			bra	OtherCommand
NotGUIKey		bset	#SignalWindow,What(a4)
			bset	#SignalScreen,What(a4)
			bra	OnHotKey

ActivateLWIN		move.l	IntBase(a4),a6
			clr.l	d0
			CALL	LockIBase
			move.l	d0,IBaseLock(a4)

			move.l	LastActive(a4),a3
			move.l	a3,d0
			beq.s	SkipLWin

LikeLWin		bsr	TestWindowPattern
			bmi.s	OkiPattern

			tst.l	d7
			bne.s	RepeatDo
			move.l	a3,d7	;Remember startwindow to prevent loop!
			bra.s	NoRepeat

RepeatDo		cmp.l	a3,d7
			beq	SkipLWin	;Repeat! All windows used!
NoRepeat		move.l	a3,a0
			cmp.l	#MyNWinID,d5
			beq.s	ActivateNWIN2
			bra.s	SkipLWin
			
OkiPattern		move.l	wd_WScreen(a3),a0
			bsr	TestWindowOnScreen
			tst.l	d0
			beq	SkipLWin

			move.l	a3,a0
			CALL	ActivateWindow

SkipLWin		move.l	IBaseLock(a4),a0
			CALL	UnlockIBase
			bra	OnHotKey

ActivateNWIN		move.l	IntBase(a4),a6
			clr.l	d0
			CALL	LockIBase
			move.l	d0,IBaseLock(a4)

			move.l	Active(a4),a0
			move.l	a0,d0
			beq	SkipLWin
			clr.l	d7
ActivateNWIN2		move.l	wd_NextWindow(a0),a3
			move.l	a3,d0
			bne.s	LikeLWin
			move.l	ib_FirstScreen(a6),a0
			move.l	a0,d0
			beq	SkipLWin
			move.l	sc_FirstWindow(a0),a3
			move.l	a3,d0
			bne.s	LikeLWin
			bra.s	SkipLWin

OtherCommand		cmp.w	#CXM_COMMAND,d6
			bne	WaitOn

			cmp.w	#CXCMD_DISABLE,d5
			bne.s	OtherI1
			move.w	#1,DisableHW(a4)

OtherI1			cmp.w	#CXCMD_ENABLE,d5
			bne.s	OtherI2
			clr.w	DisableHW(a4)

OtherI2			cmp.w	#CXCMD_UNIQUE,d5
			beq.s	OtherII
			cmp.w	#CXCMD_APPEAR,d5
			bne.s	OtherI3
OtherII			bsr	OpenGUI

OtherI3			cmp.w	#CXCMD_DISAPPEAR,d5
			bne.s	OtherI4
			bsr	CloseGUI

OtherI4			cmp.w	#CXCMD_KILL,d5
			beq	QuitPrg

			bra	TryNextMsg

Error2			lea	Text1(pc),a0		;Seems there is an error
			bsr	OpenRequester		;in the given arguments
			bra.s	QuitPrg

EndeRaus2		lea	Text2(pc),a0		;Wrong Kickstart
			bsr	PrintText

QuitPrg			move.l	RememberStack,a7
			bsr	CloseGUI
			move.l	$04,a6	
			move.l	#5,d0
			lea	MyInterrupt(a4),a1
			tst.l	IS_CODE(a1)
			beq.s	NoHandler
			CALL	RemIntServer		;Remove the Interrupt-Server

NoHandler		tst.l	MyIORequest(a4)
			beq.s	NoDevIO
			move.l	MyIORequest(a4),a1
			CALL	CloseDevice
			move.l	MyIORequest(a4),a0
			CALL	DeleteIORequest	
NoDevIO			tst.l	MouseMsgPort(a4)
			beq.s	NoMouseMsg

			move.l	MouseMsgPort(a4),a0
			bsr	CloseMsgPort

NoMouseMsg		move.l	IconBase(a4),a6
			tst.l	DObject(a4)
			beq.s	SkipFreeDobj
			move.l	DObject(a4),a0
			CALL	FreeDiskObject

SkipFreeDobj		move.l	$04,a6
			move.l	Signal(a4),d0		;Free the signal
			beq.s	DontFreeS
	                CALL	FreeSignal

DontFreeS		tst.l	Args(a4)
			beq.s	HmmNoArgs
			move.l	DosBase(a4),a6
			move.l	Args(a4),d1
			CALL	FreeArgs

HmmNoArgs		move.l	#Filter,d5
			bsr	RemovePopKey
			move.l	#Filter2,d5
			bsr	RemovePopKey

			tst.l	Broker(a4)
			beq.s	NoCX
			move.l	CommBase(a4),a6
			move.l	Broker(a4),a0
			CALL	DeleteCxObjAll

NoCX			move.l	$04,a6
			tst.l	MyPort(a4)
			beq.s	NoPort
			move.l	MyPort(a4),a0
			bsr	CloseMsgPort

NoPort			move.l	IntBase(a4),d0		;Close librarys
			beq.s	ErrorX2
			move.l	d0,a1
			CALL	CloseLibrary

ErrorX2			move.l	GraphicsBase(a4),d0
			beq.s	ErrorX1
			move.l	d0,a1
			CALL	CloseLibrary

ErrorX1			move.l	IconBase(a4),d0
			beq.s	NoIconLib
			move.l	d0,a1
			CALL	CloseLibrary
			
NoIconLib		move.l	CommBase(a4),d0
			beq.s	NoCommLib
			move.l	d0,a1
			CALL	CloseLibrary

NoCommLib		move.l	GadBase(a4),d0
			beq.s	OnlyDOS
			move.l	d0,a1
			CALL	CloseLibrary

OnlyDOS			move.l	DosBase(a4),d0
			beq.s	FreeOnly
			move.l	d0,a1
			CALL	CloseLibrary

FreeOnly		move.l	ScreenPatLen(a4),d0
			beq.s	NoScreenPat
			move.l	ScreenPattern(a4),a1
			CALL	FreeMem

NoScreenPat		move.l	WindowPatLen(a4),d0
			beq.s	NoWindowPat
			move.l	WindowPattern(a4),a1
			CALL	FreeMem

NoWindowPat		move.l	WBMessage(a4),d7
			move.l	a4,a1
			move.l	#AllocLength,d0
			CALL	FreeMem			

			move.l	d7,a1
			tst.l	d7
			beq.s	EndeRaus
			CALL	Forbid
			CALL	ReplyMsg

EndeRaus		RLoad
			moveq.l	#0,d0
			rts

CloseMsgPort		move.l	a0,a3
ClosePortRout		move.l	a3,a0
			CALL	GetMsg
			tst.l	d0
			beq.s	NoMsgLeft
			move.l	d0,a1
			CALL	ReplyMsg
			bra.s	ClosePortRout
NoMsgLeft		move.l	a3,a0
			CALL	DeleteMsgPort		;and free it
			rts


			;Subroutine to print a text to stdout
PrintText		Push	d0-d4/a0-a1/a6
			move.l	a0,a1
			moveq.l	#0,d0
TestLen			tst.b	(a1)+
			beq.s	LaengeOk
			addq	#1,d0
			bra.s	TestLen
LaengeOk		move.l	$04,a6
			lea	DosName(pc),a1
			moveq.l	#0,d0
			CALL	OpenLibrary	
			move.l	d0,DosBase(a4)
			beq	SkipWrite
			move.l	d0,a6
			move.l	a0,d2
			move.l	d0,d3
			CALL	Output
			move.l	d0,d1
			beq.s	SkipWrite
			CALL	Write
SkipWrite		Pull	d0-d4/a0-a1/a6
			rts

			;MainPart: does the scrolling if necessary
DoYourJob		RSave
			move.l	IntBase(a4),a6
			clr.l	d0
			CALL	LockIBase
			move.l	d0,IBaseLock(a4)

			move.l	ib_ActiveWindow(a6),d0
			beq	LeaveIt
			move.l	d0,a5

			move.l	wd_WScreen(a5),d0
			beq	LeaveIt
			move.l	d0,a3
			
			move.l	DosBase(a4),a6

			tst.l	TempRestrict(a4)
			bne.s	NoMatter2

			tst.b	ScreenPatternMem(a4)
			beq.s	NoMatter2
			move.l	ScreenPattern(a4),d1
			move.l	sc_DefaultTitle(a3),d2
			beq.s	NoMatter2
			CALL	MatchPatternNoCase
			beq	LeaveIt

NoMatter2		move.l	a5,d0
			bsr	TestWindowPattern
			beq	LeaveIt

NoMatter3		bsr	RememberWindow

			move.l	GraphicsBase(a4),a6	;Get the visible size
			lea	sc_ViewPort(a3),a0	;of the screen to
			move.l	vp_ColorMap(a0),a0

			;Taglist on Stack (because it gets changed)
			move.l	#TAG_DONE,-(sp)
			clr.l	-(sp)
			move.l	#VTAG_VIEWPORTEXTRA_GET,-(sp)
			move.l	a7,a1

			CALL	VideoControl
			tst.l	d0
			bne	LeaveIt
			movem.l	(sp)+,d0-d2	;Get Taglist from Stack
			move.l	d1,a0		;In the middle is our data
			lea	vpe_DisplayClip(a0),a0 ;extra

			move.w	ra_MaxX(a0),d0
			sub.w	ra_MinX(a0),d0
			addq	#1,d0
			move.w	d0,VisualX(a4)
			move.w	sc_LeftEdge(a3),d0
			sub.w	ra_MinX(a0),d0
			move.w	d0,PositionX(a4)

			move.w	ra_MaxY(a0),d0
			sub.w	ra_MinY(a0),d0
			addq	#1,d0
			move.w	d0,VisualY(a4)
			move.w	sc_TopEdge(a3),d0
			sub.w	ra_MinY(a0),d0
			move.w	d0,PositionY(a4)

			move.l	IntBase(a4),a6
			tst.l	TempSFront(a4)		;do we want screentofront?
			beq.s	NoFront
			cmp.l	ib_FirstScreen(a6),a3
			beq.s	NoFront			;Not necessary (optimize!)

			bsr	UnlockIt
			move.l	a3,a0
			CALL	ScreenToFront
			bset	#SignalScreen,What(a4)	;ScreenChange!
			bsr	RelockAndTest

NoFront			move.l	wd_Flags(a5),d0
			and.l	#WFLG_BACKDROP,d0
			bne	LeaveIt			;Not with backdrops!

			tst.l	TempWFront(a4)		;do we WindowToFront() ?
			beq.s	NoFront2
			
			bsr	UnlockIt
			move.l	a5,a0
			CALL	WindowToFront
			bsr	RelockAndTest

NoFront2		tst.l	TempMove(a4)
			beq	LeaveIt

			move.l	wd_WScreen(a5),a0	

			;Calculate how the window is located towards the view
			
			move.w	wd_LeftEdge(a5),d0
			add.w	PositionX(a4),d0
			move.w	wd_LeftEdge(a5),d1
			add.w	wd_Width(a5),d1
			move.w	PositionX(a4),d7
			sub.w	VisualX(a4),d7
			add.w	d7,d1
			move.w	wd_TopEdge(a5),d2
			add.w	PositionY(a4),d2
			move.w	wd_TopEdge(a5),d3
			add.w	wd_Height(a5),d3
			move.w	PositionY(a4),d7
			sub.w	VisualY(a4),d7
			add.w	d7,d3
			
			;d0: Pixels out left border (out = negative)
			;d1: Pixels out right border (out = positive)
			;d2: Pixels out top border (out = negative)
			;d3: Pixels out bottom border (out = positive)
			;For scrolling all these Values have to be negated

			;Horizontal Section
			

			cmp.l	#2,TempAction(a4)	;Always
			beq.s	HScrollNeeded

			tst.w	d0
			bmi.s	HScrollNeeded
			tst.w	d1
			bmi.s	NoHScrollNeeded

HScrollNeeded		cmp.l	#2,TempHADJ(a4)
			bne.s	HNoCenter

			;Center Window

			move.w	d0,d4
			add.w	d1,d4
			asr.w	#1,d4	;CenterScrollValue
			bra.s	HDone

HNoCenter		cmp.l	#1,TempHADJ(a4)
			bne.s	HNoRight

			;Adjust Window to Right Border

			move.w	d1,d4
			bra.s	HDone

HNoRight		tst.l	TempHADJ(a4)
			bne.s	HNoLeft

			;Adjust Window to Left Border

			move.w	d0,d4
			bra.s	HDone

HNoLeft			;Optimized Adjustment
			;When coming here it is shure that at least ONE scroll
			;is necessary!!!
			tst.w	d0
			beq.s	THScroll
			bpl.s	NoHScroll1
			move.w	d0,d4

THScroll		tst.w	d1
			bmi.s	HDone		;Has to be for normal windows
			;This means the window leaps out BOTH borders!
			;Then we do NOTHING
			bra.s	NoHScrollNeeded

NoHScroll1		move.w	d1,d4
			bra.s	HDone

NoHScrollNeeded		moveq.l	#0,d4

HDone			ext.l	d4
			neg.l	d4

			;The Vertical section works almost equally

			cmp.l	#2,TempAction(a4)	;Always
			beq.s	VScrollNeeded

			tst.w	d2
			bmi.s	VScrollNeeded
			tst.w	d3
			bmi.s	NoVScrollNeeded

VScrollNeeded		cmp.l	#2,TempVADJ(a4)
			bne.s	VNoCenter

			;Center Window

			move.w	d2,d5
			add.w	d3,d5
			asr.w	#1,d5	;CenterScrollValue
			bra.s	VDone

VNoCenter		cmp.l	#1,TempVADJ(a4)
			bne.s	VNoBottom

			;Adjust Window to Bottom Border

			move.w	d3,d5
			bra.s	VDone

VNoBottom		tst.l	TempVADJ(a4)
			bne.s	VNoTop

			;Adjust Window to Top Border

			move.w	d2,d5
			bra.s	VDone

VNoTop			;Optimized Adjustment
			;When coming here it is shure that at least ONE scroll
			;is necessary!!!
			tst.w	d2
			beq	TVScroll
			bpl.s	NoVScroll1
			move.w	d2,d5

TVScroll		tst.w	d3
			bmi.s	VDone		;Has to be for normal windows
			;This means the window leaps out BOTH borders!
			;Then we do NOTHING
			bra.s	NoVScrollNeeded

NoVScroll1		move.w	d3,d5
			bra.s	VDone

NoVScrollNeeded		moveq.l	#0,d5

VDone			ext.l	d5
			neg.l	d5

			move.l	d4,d0
			move.l	d5,d1

			move.w	PositionY(a4),d4	;Prevent dragging a screen
			neg.w	d4			;further down than at Pos 0
			sub.w	d1,d4
			bpl.s	NoOutRange
			tst.w	d1			;Screen already down a bit:
			bmi.s	NoOutRange		;If move up, then ok,
			move.w	PositionY(a4),d4
			neg.w	d4			;If screen up, then pull
			move.w	d4,d1			;down to Pos 0
			bpl.s	NoOutRange
			clr.l	d1			;otherwise no move at all
			;move.w	PositionY(a4),d1	;was: pull to top, if pulled
			;neg.w	d1			;down at all.

NoOutRange		move.w	sc_TopEdge(a0),d5
			move.w	sc_LeftEdge(a0),d6

			bsr	UnlockIt
			Push	a0-a1/d0-d4
			CALL	MoveScreen
			clr.l	d0
			CALL	LockIBase		;relock - no test window!
			move.l	d0,IBaseLock(a4)
			Pull	a0-a1/d0-d4

			sub.w	sc_TopEdge(a0),d5	;Find out how far the
			sub.w	sc_LeftEdge(a0),d6	;screen really moves
			move.l	d6,d0
			move.l	d5,d1
			neg.l	d0
			neg.l	d1

			tst.l	TempMoveMouse(a4)
			beq.s	LeaveIt

			;If a window becomes active without clicking, the Mouse
			;can be out of range, and moving it would scroll the
			;Screen back, so we check this here and disable movement
			;if "dangerous"
			move.w	sc_MouseX(a0),d2
			add.w	sc_LeftEdge(a0),d2
			add.w	d0,d2			;Movement in X
			bmi.s	ClearXMovement
			cmp.w	VisualX(a4),d2
			bcs.s	LeaveXMovement
ClearXMovement		moveq.l	#0,d0
LeaveXMovement		move.w	sc_MouseY(a0),d2
			add.w	sc_TopEdge(a0),d2
			add.w	d1,d2			;Movement in Y
			bmi.s	ClearYMovement
			cmp.w	VisualY(a4),d2
			bcs.s	LeaveYMoveMent
ClearYMovement		moveq.l	#0,d1
LeaveYMoveMent		bsr	UnlockIt
			tst.w	d0
			bne.s	SetIt
			tst.w	d1
			beq.s	LeaveItReal
SetIt			bsr	SetPointer
LeaveItReal		RLoad
			rts

LeaveIt			move.l	IntBase(a4),a6
			move.l	IBaseLock(a4),a0
			CALL	UnlockIBase
			bra.s	LeaveItReal

UnlockIt		Push	a0-a1/d0-d1
			move.l	IBaseLock(a4),a0
			CALL	UnlockIBase
			Pull	a0-a1/d0-d1
			rts

RelockAndTest		Push	a0-a1/d0-d1
			move.l	IntBase(a4),a6
			clr.l	d0
			CALL	LockIBase
			move.l	d0,IBaseLock(a4)

			move.l	ib_ActiveWindow(a6),d0
			beq.s	TestFailed
			cmp.l	d0,a5
			bne.s	TestFailed

			move.l	wd_WScreen(a5),d0
			beq.s	TestFailed
			cmp.l	d0,a3
			bne.s	TestFailed
			Pull	a0-a1/d0-d1
			rts

TestFailed		Pull	a0-a1/d0-d1
			tst.l	(sp)+	;rts
			;Window or Screen changed while we had Ibase unlocked
			;=> leave
			bra.s	LeaveIt

AdjustScreen		RSave				
			move.l	IntBase(a4),a6
			clr.l	d0
			CALL	LockIBase
			move.l	d0,d7
			move.l	ib_FirstScreen(a6),d0
			beq	SkipActive

			move.l	d0,a3
			tst.b	ScreenPatternMem(a4)
			beq.s	NoMatter5
			move.l	ScreenPattern(a4),d1
			move.l	sc_DefaultTitle(a3),d2
			beq.s	NoMatter5
			move.l	DosBase(a4),a6
			CALL	MatchPatternNoCase
			bne.s	NoMatter5

			tst.l	TempRestrict(a4)
			bne.s	Skip_NoPub2

			bra	SkipActive

NoMatter5		tst.l	TempPDef(a4)	;Enter FirstScreen as Default
						;PublicScreen ?
			beq.s	Skip_NoPub2
			move.l	d7,a0
			move.l	IntBase(a4),a6
			CALL	UnlockIBase

			CALL	LockPubScreenList

CarryListOn		move.l	d0,a0
			cmp.l	psn_Screen(a0),a3
			beq.s	ScreenFound
			move.l	LN_SUCC(a0),d0
			bne.s	CarryListOn
			CALL	UnlockPubScreenList
			bra.s	Skip_NoPub

ScreenFound		move.l	LN_NAME(a0),d5
			CALL	UnlockPubScreenList

			move.l	d5,a0
			CALL	SetDefaultPubScreen

Skip_NoPub		clr.l	d0
			CALL	LockIBase
			move.l	d0,d7
			move.l	ib_FirstScreen(a6),d0
			beq	SkipActive
			move.l	d0,a3

Skip_NoPub2		move.l	a3,a0
			tst.l	TempRemWin(a4)	;Activate a Window on the new
						;Screen?
			beq.s	SkipActive
			bsr	GetScreenWindow
			tst.l	d0
			bne.s	FoundActive

			tst.w	StartupFlag(a4)		;Prevent activation of
			bne.s	NormalService		;FirstWindow on Startup
			move.w	#1,StartupFlag(a4)
			bra.s	SkipActive
NormalService		move.l	sc_FirstWindow(a0),d0	;Take Firstwindow if none
			beq.s	SkipActive		;known

FoundActive		move.l	d0,a5
			bsr	TestWindowPattern
			beq	SkipActive
NoMatter4		move.l	IntBase(a4),a6
			move.l	d7,a0
			CALL	UnlockIBase
			move.l	a5,a0
			CALL	ActivateWindow
SkipOut			RLoad	
			rts
SkipActive		move.l	IntBase(a4),a6
			move.l	d7,a0
			CALL	UnlockIBase
			bra.s	SkipOut


;d0: Pointer to Window		;BEQ = Use Window Not!, BMI = USE!, BNE = Empty Title
TestWindowPattern	Push	d0-d2/a0-a1/a5-a6
			move.l	d0,a5
			beq	PatternNoMatch
			tst.b	WindowPatternMem(a4)
			beq.s	NoPatternThere
			move.l	WindowPattern(a4),d1
			move.l	wd_Title(a5),d2
			beq.s	PatternNoMatchE
			move.l	DosBase(a4),a6
			CALL	MatchPatternNoCase
			beq	PatternNoMatch

NoPatternThere		tst.l	TempWBWin(a4)
			beq.s	PatternMatch2
			move.l	wd_Flags(a5),d0
			and.l	#WFLG_WBENCHWINDOW,d0
			bne	PatternNoMatch

PatternMatch2		moveq.l	#-1,d0
			bra.s	PatternMatch
PatternNoMatchE		moveq.l	#1,d0
			bra.s	PatternMatch
PatternNoMatch		clr.l	d0
PatternMatch		Pull	d0-d2/a0-a1/a5-a6
			rts


		;a0=Screen 		Back:d0=Window
GetScreenWindow		Push	a1/d1
			lea	ScreenMem(a4),a1
			move.w	#MaxScreens-1,d1
ScreenFindLoop		cmp.l	(a1),a0
			beq.s	FoundScreen
			lea	8(a1),a1
			dbf	d1,ScreenFindLoop
			clr.l	d0
			bra.s	NoScreenF
FoundScreen		move.l	4(a1),d0
			bsr	TestWindowOnScreen
NoScreenF		Pull	a1/d1
			rts

		;a3=Screen a5=Window
RememberWindow		Push	a0-a3/a6/d1
			move.l	IntBase(a4),a6
			lea	ScreenMem(a4),a1
			move.w	#MaxScreens-1,d1
ScreenFindLoop2		tst.l	(a1)
			beq.s	FoundEmpty
			cmp.l	(a1),a3
			beq.s	FoundEmpty
			move.l	(a1),a2
			move.l	ib_FirstScreen(a6),d0
			beq.s	IgnoreOver	;No FirstScreen!
CheckAllScreens		move.l	d0,a0
			cmp.l	a0,a2
			beq	ScreenValid
			move.l	sc_NextScreen(a0),d0
			bne.s	CheckAllScreens
			bra.s	FoundEmpty	;because Entry is invalid

ScreenValid		lea	8(a1),a1
			dbf	d1,ScreenFindLoop2
			;Reaching this Point our List is full of valid
			;Screens - not the best thing, but we simply ignore...
			bra.s	IgnoreOver
FoundEmpty		move.l	a3,(a1)
			move.l	a5,4(a1)
IgnoreOver		Pull	a0-a3/a6/d1
			rts

		;d0=Window , a0=Screen	=Back: d0=0 no window
TestWindowOnScreen	tst.l	d0
			beq.s	NotWindow
			move.l	sc_FirstWindow(a0),d1
			beq.s	NotWindow
WindowListOn		move.l	d1,a1
			cmp.l	d0,a1
			beq.s	WindowIsOK
			move.l	wd_NextWindow(a1),d1
			bne.s	WindowListOn
WindowIsOK		move.l	a1,d0
			rts
NotWindow		clr.l	d0
			rts


Interrupt3		Push	d1-d4/a0-a1/a3/a4/a6
			move.l	RememberA4,a4
			move.l	IntBase(a4),a3
			move.l	ib_ActiveWindow(a3),d0
			beq.s	DoScreen
			move.l	Active(a4),a0
			cmp.l	a0,d0			;New ActiveWindow?
			beq.s	CheckSize
			move.l	Active(a4),LastActive(a4)
			move.l	d0,Active(a4)
			move.l	d0,a0
ChangedPosOrSize	move.l	wd_LeftEdge(a0),WindPosRem(a4)
			move.l	wd_Width(a0),WindSizeRem(a4)

			bsr	SignalMyself

			bset	#SignalWindow,What(a4)
			
			bra.s	DoScreen

CheckSize		move.l	wd_LeftEdge(a0),d0	;A Check on .l is faster
			cmp.l	WindPosRem(a4),d0	;because I only wanna know
			bne.s	ChangedPosOrSize	;if Position or Size changed
			move.l	wd_Width(a0),d0		;and not how
			cmp.l	WindSizeRem(a4),d0
			bne.s	ChangedPosOrSize
			
DoScreen		move.l	FirstSc(a4),d0
			cmp.l	ib_FirstScreen(a3),d0		;New FirstScreen?
			beq.s	DoNothing
			move.l	ib_FirstScreen(a3),FirstSc(a4)

			bsr	SignalMyself

			bset	#SignalScreen,What(a4)

DoNothing		Pull	d1-d4/a0-a1/a3/a4/a6
			moveq.l	#0,d0
			rts

SignalMyself		move.l  $04,a6
			move.w	#1,DelayDo(a4)
			move.l  OwnTask(a4),a1
			move.l  Signal(a4),d1		;send a signal to move Screen
			moveq.l	#0,d0
			bset	d1,d0
			jmp	_LVOSignal(a6)

OpenGUI			RSave
			tst.w	GUIOpened(a4)
			bne	OpenNoGUI
			move.l	IntBase(a4),a6
			sub.l	a0,a0
			CALL	LockPubScreen
			move.l	d0,PublicScreen(a4)
			move.l	d0,StorePublicScreen

			move.l	d0,a0
			lea	sc_RastPort(a0),a1
			move.l	a1,PublicRastport(a4)
			lea	TagListDone(pc),a1
			move.l	GadBase(a4),a6
			CALL	GetVisualInfoA
			move.l	d0,MyVisual(a4)
			lea	MyNewGadget(a4),a3
			move.l	d0,gng_VisualInfo(a3)

			lea	GadgetList(a4),a0
			CALL	CreateContext
			move.l	d0,Gadget0(a4)

			move.l	GraphicsBase(a4),a6
			move.l	PublicRastport(a4),a1
			lea	GUI_Text5(pc),a0
			moveq.l	#GUI_Text6-GUI_Text5-1,d0
			CALL	TextLength
			add.w	#40,d0		;CheckBox
			;lsr.w	#1,d0
			move.w	d0,RemLen(a4)

			moveq.l	#1,d0
			add.w	RemLen(a4),d0
			mulu	#NumberOfCols,d0
			move.l	d0,StoreInnerWidth

			move.l	PublicScreen(a4),a0
			moveq.l	#6,d0
			add.b	sc_WBorLeft(a0),d0
			move.w	d0,RemLeft(a4)

			move.l	sc_Font(a0),a1
			move.l	a1,gng_TextAttr(a3)
			moveq.l	#1,d0
			add.b	sc_WBorTop(a0),d0	;Base (Top)
			move.w	d0,RemTop(a4)

			move.w	ta_YSize(a1),d6
			add.w	#4,d6			;Height of One Line
			move.w	d6,RemHeight(a4)

			add.w	#2,d6
			mulu	#NumberOfLines,d6
			add.w	#8,d6
			move.l	d6,StoreInnerHeight

			move.l	Gadget0(a4),d7

			bsr	DoAllGadgets

			move.l	d7,LastGadget(a4)

			sub.l	a0,a0
			lea	WindowTagList(pc),a1
			move.l	IntBase(a4),a6
			CALL	OpenWindowTagList
			move.l	d0,MyWindow(a4)
			beq	FailWindow

			move.l	d0,a0
			bsr	EnterSignal
			;move.l	d0,a0
			move.l	GadgetList(a4),a1
			moveq.l	#-1,d0
			moveq.l	#-1,d1
			sub.l	a2,a2
			CALL	AddGList

			move.l	GadgetList(a4),a0
			move.l	MyWindow(a4),a1
			moveq.l	#-1,d0
			sub.l	a2,a2
			CALL	RefreshGList
			
			move.l	GadBase(a4),a6
			move.l	MyWindow(a4),a0
			sub.l	a1,a1
			CALL	GT_RefreshWindow

			move.w	#1,GUIOpened(a4)
			RLoad
			rts
OpenNoGUI		move.l	IntBase(a4),a6
			move.l	MyWindow(a4),a0
			CALL	ActivateWindow
			RLoad
			rts

			rsreset
MyGadgetText		rs.l	1
MyGadgetList		rs.l	1
MyGadgetRowNr		rs.b	1
MyGadgetXPos		rs.b	1
MyGadgetWidth		rs.b	1
MyGadgetFlags		rs.b	1
MyGadgetStore		rs.w	1
MyGadgetKind		rs.w	1
MyGadgetSize		rs.w	1
			
			;	gng_Flags      ,gng_Text ,CreateKind   ,CreateTags
			;	gng_TopEdge    ,gng_LeftEdge
AllGadgets		dc.l	GUI_Text8,CycleTagList
			dc.b	1,1,1,PLACETEXT_LEFT
			dc.w	TempHADJ,CYCLE_KIND

			dc.l	GUI_Text9,CycleTagList2
			dc.b	2,1,1,PLACETEXT_LEFT
			dc.w	TempVADJ,CYCLE_KIND

			dc.l	GUI_Text12,StringTagList
			dc.b	3,1,1,PLACETEXT_LEFT
			dc.w	TempScreen,STRING_KIND

			dc.l	GUI_Text13,StringTagList
			dc.b	4,1,1,PLACETEXT_LEFT
			dc.w	TempWindow,STRING_KIND

			dc.l	0,SlideTagList
			dc.b	5,1,1,0
			dc.w	TempDelay,SLIDER_KIND

			dc.l	GUI_Text18,CycleTagList3
			dc.b	6,1,1,PLACETEXT_LEFT
			dc.w	TempAction,CYCLE_KIND

			dc.l	GUI_Text17,StringTagList
			dc.b	7,1,1,PLACETEXT_LEFT
			dc.w	TempActionKey,STRING_KIND

			dc.l	GUI_Text16,StringTagList
			dc.b	8,1,1,PLACETEXT_LEFT
			dc.w	TempCXPOPKEY,STRING_KIND

			dc.l	GUI_Text19,StringTagList
			dc.b	9,1,1,PLACETEXT_LEFT
			dc.w	TempLWindow,STRING_KIND

			dc.l	GUI_Text19_2,StringTagList
			dc.b	10,1,1,PLACETEXT_LEFT
			dc.w	TempNWindow,STRING_KIND

			dc.l	GUI_Text1,GadgetTagList
			dc.b	1,2,1,PLACETEXT_RIGHT
			dc.w	TempMove,CHECKBOX_KIND

			dc.l	GUI_Text3,GadgetTagList
			dc.b	2,2,1,PLACETEXT_RIGHT
			dc.w	TempWFront,CHECKBOX_KIND

			dc.l	GUI_Text6,GadgetTagList
			dc.b	3,2,1,PLACETEXT_RIGHT
			dc.w	TempRestrict,CHECKBOX_KIND

			dc.l	GUI_Text20,GadgetTagList
			dc.b	4,2,1,PLACETEXT_RIGHT
			dc.w	TempWBWin,CHECKBOX_KIND

			dc.l	GUI_Text2,GadgetTagList
			dc.b	5,2,1,PLACETEXT_RIGHT
			dc.w	TempSFront,CHECKBOX_KIND

			dc.l	GUI_Text5,GadgetTagList
			dc.b	6,2,1,PLACETEXT_RIGHT
			dc.w	TempPDef,CHECKBOX_KIND

			dc.l	GUI_Text7,GadgetTagList
			dc.b	7,2,1,PLACETEXT_RIGHT
			dc.w	TempRemWin,CHECKBOX_KIND

			dc.l	GUI_Text7_1,GadgetTagList
			dc.b	8,2,1,PLACETEXT_RIGHT
			dc.w	TempMoveMouse,CHECKBOX_KIND

			dc.l	GUI_Text7_2,GadgetTagList
			dc.b	9,2,1,PLACETEXT_RIGHT
			dc.w	TempCXPOPUP,CHECKBOX_KIND


			dc.l	GUI_Text10,TagList
			dc.b	11,0,1,PLACETEXT_IN
			dc.w	TempZero,BUTTON_KIND
			dc.l	GUI_Text11,TagList
			dc.b	11,2,1,PLACETEXT_IN
			dc.w	TempZero,BUTTON_KIND
SaveGadgData		dc.l	GUI_Text14,TagList
			dc.b	11,1,1,PLACETEXT_IN
			dc.w	TempSave,BUTTON_KIND

			dc.l	-1

NumberOfLines		=	11
NumberOfCols		=	3


;a3:Pointer to the GadgetStructure
;d7:Previous Gadget

DoAllGadgets		lea	AllGadgets(pc),a5
			move.l	GadBase(a4),a6
			moveq.l	#1,d6

DoAllGadgets2		tst.l	(a5)
			bmi.s	WasLastGadget

			moveq.l	#0,d0
			move.b	MyGadgetRowNr(a5),d0
			move.w	RemHeight(a4),d1
			addq.w	#2,d1
			mulu	d1,d0
			add.w	RemTop(a4),d0		;Top
			move.w	d0,gng_TopEdge(a3)

			moveq.l	#0,d0
			move.b	MyGadgetXPos(a5),d0
			mulu	RemLen(a4),d0
			add.w	RemLeft(a4),d0
			move.w	d0,gng_LeftEdge(a3)

			moveq.l	#0,d0
			move.b	MyGadgetWidth(a5),d0
			mulu	RemLen(a4),d0
			sub.w	#8,d0
			move.w	d0,gng_Width(a3)

			move.w	RemHeight(a4),gng_Height(a3)

			moveq.l	#0,d0
			move.b	MyGadgetFlags(a5),d0
			move.l	d0,gng_Flags(a3)
			add.w	#1,gng_GadgetID(a3)

			move.l	MyGadgetText(a5),gng_GadgetText(a3)

			move.w	d6,gng_GadgetID(a3)

			sub.l	a2,a2
			move.w	MyGadgetStore(a5),a2
			add.l	a4,a2
			move.l	(a2),d4

			moveq.l	#0,d0
			move.w	MyGadgetKind(a5),d0
			move.l	d7,a0		;Previous Gadget
			move.l	a3,a1
			move.l	MyGadgetList(a5),a2
			move.l	d4,4(a2)
			CALL	CreateGadgetA
			move.l	d0,d7		;Remember Previous Gadget
			add.l	#MyGadgetSize,a5
			addq.l	#1,d6
			bra.s	DoAllGadgets2
WasLastGadget		rts

CheckGUI		RSave

			tst.w	GUIOpened(a4)
			beq	NoGUI

			move.l	GadBase(a4),a6
			move.l	MyWindow(a4),a0
			move.l  wd_UserPort(a0),a0
			CALL	GT_GetIMsg
			tst.l   d0         
			beq     NoGUI
			move.l  d0,a1
			moveq.l	#0,d6
			move.w	im_Code(a1),d6	;Value of Gadget
			move.l  im_IAddress(a1),a2

			move.l	im_Class(a1),d7
			CALL	GT_ReplyIMsg

			cmp.l	#GADGETUP,d7
			bne	Others

			move.w	gg_GadgetID(a2),d0
			move.l	gg_SpecialInfo(a2),a3
			cmp.w	#20,d0
			beq	HideGad
			cmp.w	#21,d0
			beq	QuitGad
			cmp.w	#22,d0
			beq	SaveGad

			subq.l	#1,d0

			lea	AllGadgets(pc),a5
			mulu	#MyGadgetSize,d0
			sub.l	a2,a2
			move.w	MyGadgetStore(a5,d0.w),a2
			add.l	a4,a2

StringTest		cmp.w	#STRING_KIND,MyGadgetKind(a5,d0.w)
			bne.s	CheckBoxTest
			move.l	si_Buffer(a3),a0
			move.l	(a2),a1
			bsr	CopyPattern
			bsr	BuildPatterns
			bsr	InstallHotKey
			bra.s	NoGUI

CheckBoxTest		cmp.w	#CHECKBOX_KIND,MyGadgetKind(a5,d0.w)
			bne.s	StandardGUI
			;using im_Code works only since V39, so:
			moveq.l	#1,d6
			tst.l	(a2)
			beq.s	StandardGUI
			moveq.l	#0,d6

StandardGUI		move.l	d6,(a2)
			bra.s	NoGUI

SaveGad			bsr	SaveConfig
			bra.s	NoGUI

QuitGad			bsr	CloseGUI
			move.w	#1,QuitMe(a4)
			bra.s	HideGad

Others	                cmp.l   #CLOSEWINDOW,d7
	                bne.s	NoClose
HideGad			bsr	CloseGUI
			bra.s	NoGUI
NoClose			cmp.l	#IDCMP_VANILLAKEY,d7
			bne.s	NoGUI
			cmp.b	#"q",d6
			beq.s	QuitGad
			cmp.b	#"s",d6
			beq.s	SaveGad
			cmp.b	#"h",d6
			beq.s	HideGad

NoGUI			RLoad
			rts

CloseGUI		RSave
			tst.w	GUIOpened(a4)
			beq.s	NotOpened

			bsr	RefreshStrings

			move.l	IntBase(a4),a6
			move.l	MyWindow(a4),a0
			bsr	RemoveSignal
			;move.l	MyWindow(a4),a0
			move.l	GadgetList(a4),a1
			moveq.l	#-1,d0
			CALL	RemoveGList

			move.l	MyWindow(a4),a0
			clr.l	d0
			move.w	wd_TopEdge(a0),d0
			move.l	d0,RemWindowY
			move.w	wd_LeftEdge(a0),d0
			move.l	d0,RemWindowX
			CALL	CloseWindow
			
FailWindow		move.l	GadgetList(a4),a0
			move.l	GadBase(a4),a6
			CALL	FreeGadgets

			move.l	MyVisual(a4),a0
			CALL	FreeVisualInfo

			move.l	IntBase(a4),a6
			sub.l	a0,a0
			move.l	PublicScreen(a4),a1
			CALL	UnlockPubScreen

NotOpened		clr.w	GUIOpened(a4)

			RLoad
			rts

EnterSignal		Push    d0-d1/a0          
			move.l  wd_UserPort(a0),a0
			move.b  MP_SIGBIT(a0),d0  
			move.l	SignalMask(a4),d1
			bset	d0,d1             
			move.l  d1,SignalMask(a4) 
			Pull    d0-d1/a0          
			rts                       
                                          
RemoveSignal		Push    d0-d1/a0          
			move.l  wd_UserPort(a0),a0
			move.b  MP_SIGBIT(a0),d0
			move.l	SignalMask(a4),d1
			bclr	d0,d1             
			move.l	d1,SignalMask(a4) 
			Pull    d0-d1/a0          
			rts

GetNexta0.1		tst.b	(a0)+
GetNexta0		move.b	(a0),d0
			cmp.b	#"=",d0
			beq.s	GetNexta0.1
			cmp.b	#" ",d0
			beq.s	GetNexta0.1
			or.w	#$20,d0
			rts

RefreshStrings		RSave
			move.l	GadgetList(a4),a3

ThruAll			move.w	gg_GadgetID(a3),d0
			subq.l	#1,d0
			lea	AllGadgets(pc),a5
			mulu	#MyGadgetSize,d0
			sub.l	a2,a2
			move.w	MyGadgetStore(a5,d0.w),a2
			add.l	a4,a2	;TempXXX

			cmp.w	#STRING_KIND,MyGadgetKind(a5,d0.w)
			bne.s	NextGaddie
			move.l	gg_SpecialInfo(a3),a0
			move.l	si_Buffer(a0),a0
			move.l	(a2),a1
			bsr	CopyPattern
			bsr	BuildPatterns
			bsr	InstallHotKey

NextGaddie		move.l	gg_NextGadget(a3),a3
			move.l	a3,d0
			bne.s	ThruAll
			RLoad
			rts


;Screen in a0, X-Coord(rel) in d0, Y-Coord(rel) in d1
SetPointer		Push	a0-a2/d0-d1/a6
			lea	PointerPixEvent(a4),a2
			move.l	a0,iepp_Screen(a2)
			move.w	sc_MouseX(a0),d2
			move.w	sc_MouseY(a0),d3

			move.l	MyIORequest(a4),a1
			move.w	#IND_WRITEEVENT,io_Command(a1)
			lea	MyInputEvent(a4),a0
			move.l	#0,ie_NextEvent(a0)
			move.b	#IECLASS_NEWPOINTERPOS,ie_Class(a0)
			move.w	#0,ie_Qualifier(a0)
			add.w	d0,d2
			add.w	d1,d3
			move.w	d2,iepp_PositionX(a2)
			move.w	d3,iepp_PositionY(a2)
			move.l	a2,ie_EventAddress(a0)

			move.b	#IESUBCLASS_PIXEL,ie_SubClass(a0)
			move.w	#IECODE_NOBUTTON,ie_Code(a0)
			move.l	a0,io_Data(a1)
			move.l	#ie_SIZEOF,io_Length(a1)
			move.l	$04,a6
			CALL	DoIO
			Pull	a0-a2/a6/d0-d1
			rts

BuildPatterns		RSave
			tst.l	TempScreen(a4)
			beq.s	NoScreenPattern
			move.l	TempScreen(a4),a0
			bsr	GetNexta0
			lea	ScreenPatternMem(a4),a1
			bsr	CopyPattern

			lea	ScreenPatternMem(a4),a0
			lea	ScreenPatLen(a4),a2
			lea	ScreenPattern(a4),a3
			bsr	GetLen
			bpl	NoScreenPattern
			bsr	PatternError

NoScreenPattern		lea	ScreenPatternMem(a4),a0
			move.l	a0,TempScreen(a4)
			tst.l	TempWindow(a4)
			beq.s	NoWindowPattern
			move.l	TempWindow(a4),a0
			bsr	GetNexta0
			lea	WindowPatternMem(a4),a1
			bsr	CopyPattern

			lea	WindowPatternMem(a4),a0
			lea	WindowPatLen(a4),a2
			lea	WindowPattern(a4),a3
			bsr	GetLen
			bpl.s	NoWindowPattern
			bsr	PatternError
	
NoWindowPattern		lea	WindowPatternMem(a4),a0
			move.l	a0,TempWindow(a4)
			RLoad
			rts		

PatternError		lea	Text3(pc),a0
			bra	OpenRequester

;a0:Source, a1:Dest
CopyPattern		move.w	#511,d0
CopyPattern2		move.b	(a0)+,(a1)+
			beq.s	EndCopy
			dbf	d0,CopyPattern2
			bsr	PatternError
EndCopy			rts


;In: (a2): LEN - (a3): MEMORY - a0: Source-Pattern	:back: d0=pattern ok?
GetLen			move.l	a0,d6
			clr.l	d3
GetLen2			tst.b	(a0)+
			beq.s	EndOfString
			addq.l	#1,d3
			bra.s	GetLen2
EndOfString		lsl.w	#1,d3	;StandardLen Of Pattern
			addq	#2,d3
			move.l	$04,a6
			tst.l	(a3)
			beq	AllocNew
			move.l	(a3),a1
			move.l	(a2),d0
			CALL	FreeMem
			clr.l	(a3)
AllocNew		move.l	d3,(a2)
			move.l	d3,d0
			move.l	#MEMF_CLEAR,d1
			CALL	AllocMem
			move.l	d0,d2
			beq	QuitPrg		;No Memory? Good bye !
			move.l	d0,(a3)
			move.l	d6,d1
			move.l	DosBase(a4),a6
			CALL	ParsePatternNoCase
			rts

			
;a0: Requester-Text
OpenRequester		Push	a0-a3
			lea	EasyReqStruct(a4),a1
			lea	PortName(pc),a2
			move.l	a2,es_Title(a1)
			move.l	a0,es_TextFormat(a1)
			lea	GadgetText(pc),a2
			move.l	a2,es_GadgetFormat(a1)
			move.l	IntBase(a4),a6
			sub.l	a0,a0
			;a1: EasyReq
			sub.l	a2,a2
			sub.l	a3,a3
			CALL	EasyRequestArgs
			Pull	a0-a3
			rts

SaveConfig		RSave
			tst.l	WBMessage(a4)
			beq	SkipConfig
			move.l	WBMessage(a4),a3
			move.l	sm_ArgList(a3),d0
			beq	SkipConfig
			move.l	d0,a0
			move.l	wa_Name(a0),a0
			move.l	a0,d5

			move.l	DObject(a4),d0
			beq	SkipConfig

			move.l	d0,a0
			move.l	do_ToolTypes(a0),a5	;Remember Old
			move.l	#1,TempDummy(a4)

			bsr	RefreshStrings

			Push	a0/a6
			move.l	$04,a6
			move.l	#NumberOfTemps*10+2*512+2*8,d0	;Memory for tool arrays
			move.l	#MEMF_CLEAR,d1
			CALL	AllocMem
			move.l	d0,a3
			beq	MemErrTool
			move.l	DObject(a4),a0
			move.l	d0,do_ToolTypes(a0)

			move.l	d0,a1
			add.l	#(NumberOfTemps+1)*4,a1	;Maximum Number of Pointers

			clr.l	d7
			lea	WBTemplate(pc),a2
LoopAllTemps		sub.l	a0,a0
			move.w	TemplateA4(a2),a0
			add.l	a4,a0
			move.l	(a0),d6
			beq.s	IsDefault
			move.l	a1,(a3,d7)
			move.l	TemplateText(a2),a0
			bsr	CopyPattern
			move.w	TemplateType(a2),d1
			beq	ThatsAllTemp
			move.b	#"=",-1(a1)
			
			cmp.w	#T_CYCLE,d1
			bne.s	ThatsString
			move.l	TemplateSpecial(a2),a0
			lsl.l	#2,d6
			move.l	(a0,d6.w),a0
			bsr	CopyPattern
			bra.s	ThatsAllTemp

ThatsString		cmp.w	#T_STRING,d1
			bne.s	ThatsInteger
			move.l	d6,a0
			bsr	CopyPattern
			bra.s	ThatsAllTemp

ThatsInteger		move.l	d6,d0
			bsr	PrintInteger

ThatsAllTemp		addq.l	#4,d7
			move.l	a1,d0
			and.l	#$ffffffc,d0
			move.l	d0,a1
			lea	4(a1),a1	;Align on Longwords
IsDefault		add.l	#TemplateSize,a2
			tst.l	TemplateText(a2)
			bne	LoopAllTemps

			move.l	d5,a0
			move.l	DObject(a4),a1
			move.l	IconBase(a4),a6
			CALL	PutDiskObject
			bne.s	Done
			lea	Text4(pc),a0
			bsr	OpenRequester

Done			move.l	$04,a6
			move.l	#NumberOfTemps*10+2*512+2*8,d0
			move.l	a3,a1
			CALL	FreeMem
MemErrTool		Pull	a0/a6

			move.l	a5,do_ToolTypes(a0)
				
			bra.s	DoneConfig

SkipConfig		lea	Text4(pc),a0
			bsr	OpenRequester
DoneConfig		RLoad
			rts


;Where in hell has this damned OS a atoi and itoa function???

;Quick implementation of word-only functions:

;a0:String	Back: d0: Integer
GetInteger		Push	d1-d2/a0
			moveq.l	#0,d0
			moveq.l	#0,d1
			moveq.l	#1,d2
			cmp.b	#"-",(a0)
			bne.s	GetDezNr
			tst.b	(a0)+
			moveq.l	#-1,d2
GetDezNr		move.b	(a0)+,d1
			cmp.b	#"0",d1
			bcs	StringOver
			cmp.b	#"9"+1,d1
			bcc	StringOver
			sub.w	#$30,d1
			mulu	#$0a,d0
			add.l	d1,d0
			bra.s	GetDezNr
StringOver		muls	d2,d0
			Pull	d1-d2/a0
			rts	

;d0: Integer		a1:String
PrintInteger		tst.l	d0
			bpl.s	PrDez0
			move.b	#"-",(a1)+
			neg.l	d0
PrDez0			move.w	#-1,-(sp)
PrDez			divu	#$0a,d0
			swap	d0
			move.w	d0,-(sp)
			clr.w	d0
			swap	d0
			bne.s	PrDez
PrDez1			move.w	(sp)+,d0
			bmi.s	CloseUp
			add.w	#"0",d0
			move.b	d0,(a1)+
			bra.s	PrDez1
CloseUp			clr.b	(a1)+
			rts

			rsreset
HK_Default		rs.l	1
HK_Description		rs.l	1
HK_Store		rs.l	1
HK_ID			rs.l	1
HK_Filter		rs.l	1
HK_SIZEOF		rs.l	0

HotKeyTable		dc.l	DefaultDescr4,Description4,TempNWindow,MyNWinID,Filter4
			dc.l	DefaultDescr3,Description3,TempLWindow,MyLWinID,Filter3
			dc.l	DefaultDescr2,Description2,TempActionKey,MyActionID,Filter2
			dc.l	DefaultDescr,Description,TempCXPOPKEY,MyHotkeyID,Filter
			dc.l	0

InstallHotKey		Push	a0-a1/a5-a6/d4-d5
			lea	HotKeyTable(pc),a5
InstallHotKey2		move.l	HK_Default(a5),a0
			move.l	HK_Description(a5),d0
			lea	(a4,d0),a1
			move.l	HK_Store(a5),d4
			tst.l	(a4,d4)
			beq.s	NoPOPKEY
			move.l	(a4,d4),a0
			bsr	GetNexta0
NoPOPKEY		move.l	a1,(a4,d4)
			bsr	CopyKey
			bmi.s	HotKeyError

			move.l	HK_Filter(a5),d5
			bsr	RemovePopKey

			move.l	HK_Description(a5),d0
			lea	(a4,d0),a0
			move.l	MyPort(a4),a1
			move.l	HK_ID(a5),d0
			bsr	HotKey
			bmi.s	HotKeyError
			move.l	a0,(a4,d5)
			CALL	CxObjError
			tst.l	d0
			bne.s	DeleteAndErr
			move.l	(a4,d5),a1
			move.l	Broker(a4),a0
			CALL	AttachCxObj

			lea	HK_SIZEOF(a5),a5
			tst.l	(a5)
			bne.s	InstallHotKey2
			Pull	a0-a1/a5-a6/d4-d5
			rts

DeleteAndErr		bsr	DeletePopKey
HotKeyError		lea	HotKeyErrorT(pc),a0
			bsr	OpenRequester
			clr.l	(a4,d4)
			bra	InstallHotKey2

CopyKey			move.w	#63,d0
CopyString		move.b	(a0)+,(a1)+
			beq.s	EndString
			dbf	d0,CopyString
			moveq.l	#-1,d0
EndString		rts

RemovePopKey		move.l	CommBase(a4),a6
			tst.l	(a4,d5)
			beq.s	NoFilter
			move.l	(a4,d5),a0
			CALL	RemoveCxObj
DeletePopKey		move.l	(a4,d5),a0
			CALL	DeleteCxObjAll
			clr.l	(a4,d5)
NoFilter		rts				


;Implementation of the cx.lib function
;HotKey(char *Description,MsgPort *CxPort,long Event)

;a0=Description, a1=CxPort, d0=Event	;Back: d0:Error, a0:Filter
HotKey			Push	d1-d7/a1-a2/a6
			move.l	a1,a2		;Rem Port
			move.l	d0,d6		;Rem Event
			move.l	CommBase(a4),a6
			move.l	#CX_FILTER,d0
			;Description is in a0
			sub.l	a1,a1
			CALL	CreateCxObj
			move.l	d0,d7		;Remember Filter
			beq.s	HKErr2
			move.l	#CX_SEND,d0
			move.l	a2,a0		;Given Port
			move.l	d6,a1		;Event
			CALL	CreateCxObj
			move.l	d0,d6		;Remember Sender
			beq.s	HKErr
			move.l	d7,a0		;Filter
			move.l	d6,a1		;Sender
			CALL	AttachCxObj
			move.l	#CX_TRANSLATE,d0
			sub.l	a0,a0
			move.l	a0,a1
			CALL	CreateCxObj
			move.l	d0,a1
			tst.l	d0
			beq.s	HKErr
			move.l	d7,a0			;Filter 
			;Translate is in a1
			CALL	AttachCxObj
			move.l	d7,a0		;Return Filter in a0
			moveq.l	#0,d0
			bra.s	HKOut
HKErr			move.l	d7,a0
			CALL	DeleteCxObjAll
HKErr2			moveq.l	#-1,d0
HKOut			Pull	d1-d7/a1-a2/a6
			rts

TestButton		RSave
			cmp.l	#0,a0
			beq.s	SkipTestButton
			move.l	RememberA4,a4
			move.l	CommBase(a4),a6
			CALL	CxMsgData
			tst.l	d0
			beq	SkipTestButton
			move.l	d0,a0
			cmp.b	#IECLASS_RAWMOUSE,ie_Class(a0)
			bne.s	SkipTestButton
			cmp.w	#IECODE_UP_PREFIX!IECODE_LBUTTON,ie_Code(a0)
			beq.s	RelButton
			cmp.w	#IECODE_LBUTTON,ie_Code(a0)
			bne.s	SkipTestButton
			move.w	#1,ButtonPressed(a4)
			bra.s	SkipTestButton
RelButton		clr.w	ButtonPressed(a4)
			bsr	SignalMyself

			bset	#SignalButton,What(a4)

SkipTestButton		RLoad
			rts

			IFNE	DEBUG
BLINK			RSave
			move.w	#$10,d1
blink2			move.w	#$7fff,d0
blink1			move.w	d0,$dff180
			dbf	d0,blink1
			dbf	d1,blink2
			RLoad
			rts
			ENDC

StringTagList		dc.l	GTST_String
			dc.l	0
			dc.l	GTST_MaxChars
			dc.l	511
			dc.l	TAG_DONE

CycleTagList		dc.l	GTCY_Active
			dc.l	0
			dc.l	GTCY_Labels
			dc.l	CycleList
			dc.l	TAG_DONE

CycleTagList2		dc.l	GTCY_Active
			dc.l	0
			dc.l	GTCY_Labels
			dc.l	CycleList2
			dc.l	TAG_DONE

CycleTagList3		dc.l	GTCY_Active
			dc.l	0
			dc.l	GTCY_Labels
			dc.l	CycleList3
			dc.l	TAG_DONE

GadgetTagList		dc.l	GTCB_Checked
			dc.l	0
			dc.l	TAG_DONE

SlideTagList		dc.l	GTSL_Level
			dc.l	0
			dc.l	GTSL_Min
			dc.l	0
			dc.l	GTSL_Max
			dc.l	99
			dc.l	GTSL_LevelFormat
			dc.l	SliderText
			dc.l	GTSL_LevelPlace
			dc.l	PLACETEXT_LEFT
			dc.l	GTSL_MaxLevelLen
			dc.l	50
			dc.l	GA_RelVerify
			dc.l	1
			dc.l	TAG_DONE

TagList			dc.l	GA_Disabled
			dc.l	0
			dc.l	GT_Underscore
			dc.l	'_'
TagListDone		dc.l	TAG_DONE

WindowTagList		dc.l	WA_InnerWidth
StoreInnerWidth			dc.l	0
			dc.l	WA_InnerHeight
StoreInnerHeight		dc.l	0
			dc.l	WA_IDCMP
				dc.l	BUTTONIDCMP!CLOSEWINDOW!IDCMP_VANILLAKEY
			dc.l	WA_Flags
				dc.l	WINDOWCLOSE!WINDOWDRAG!WINDOWDEPTH!ACTIVATE	
			dc.l	WA_PubScreen
StorePublicScreen		dc.l	0
			dc.l	WA_Title
				dc.l	Texth
			dc.l	WA_AutoAdjust
				dc.l	1
			dc.l	WA_Left
RemWindowX			dc.l	-1
			dc.l	WA_Top
RemWindowY			dc.l	-1
			dc.l	TAG_DONE

RememberA4		dc.l	0
RememberStack		dc.l	0

			rsreset
ScreenPatLen		rs.l	1
ScreenPattern		rs.l	1
WindowPatLen		rs.l	1
WindowPattern		rs.l	1
GadgetList		rs.l	1
WindPosRem		rs.l	1
WindSizeRem		rs.l	1
StartupFlag		rs.w	1
PositionX		rs.w	1
PositionY		rs.w	1
What			rs.w	1
DisableHW		rs.w	1
GUIOpened		rs.w	1
QuitMe			rs.w	1
RemFontSize		rs.w	1
ButtonPressed		rs.w	1
GadgetInside		rs.w	11
MyPort			rs.l	1
MyVisual		rs.l	1
Broker			rs.l	1
LastActive		rs.l	1
ScreenMem		rs.b	ScreenMemSize
IntBase			rs.l	1
IBaseLock		rs.l	1
RemLen			rs.w	1
RemHeight		rs.w	1
RemTop			rs.w	1
RemLeft			rs.w	1
DelayDo			rs.w	1
GadBase			rs.l	1
DosBase			rs.l	1
CommBase		rs.l	1
IconBase		rs.l	1
DObject			rs.l	1
Active			rs.l	1
FirstSc			rs.l	1
GraphicsBase		rs.l	1
PublicScreen		rs.l	1
PublicRastport		rs.l	1
Gadget0			rs.l	1
Filter			rs.l	1
Filter2			rs.l	1
Filter3			rs.l	1
Filter4			rs.l	1
Filter5			rs.l	1
VisualX			rs.w	1
VisualY			rs.w	1
TemplateArray		rs.l	0	;Do not change order!
TempMove		rs.l	1
TempSFront		rs.l	1
TempWFront		rs.l	1
TempPDef		rs.l	1
TempRemWin		rs.l	1
TempMoveMouse		rs.l	1
TempCXPOPUP		rs.l	1
TempRestrict		rs.l	1
TempWBWin		rs.l	1
TempCXPRI		rs.l	1
TempCXPOPKEY		rs.l	1
TempHADJ		rs.l	1
TempVADJ		rs.l	1
TempScreen		rs.l	1
TempWindow		rs.l	1
TempActionKey		rs.l	1
TempAction		rs.l	1
TempDelay		rs.l	1
TempLWindow		rs.l	1
TempNWindow		rs.l	1
TempDummy		rs.l	1
TempZero		rs.l	1
TempSave		rs.l	1

OwnTask			rs.l	1
Signal			rs.l	1
Args			rs.l	1
WBMessage		rs.l	1
SignalMask		rs.l	1
MyWindow		rs.l	1
LastGadget		rs.l	1
MyIORequest		rs.l	1
MouseMsgPort		rs.l	1
MyNewGadget		rs.b	gng_SIZEOF
MyInterrupt		rs.b	IS_SIZE
MyInputEvent		rs.b	ie_SIZEOF
PointerPixEvent		rs.b	IEPointerPixel_SIZEOF
EasyReqStruct		rs.b	es_SIZEOF
Description		rs.b	64
Description2		rs.b	64
Description3		rs.b	64
Description4		rs.b	64
Description5		rs.b	64
ScreenPatternMem	rs.b	512	;sufficient I think
WindowPatternMem	rs.b	512
AllocLength		rs.w	1

intuition		dc.b	"intuition.library",0
DosName			dc.b	"dos.library",0
InputName		dc.b	"input.device",0
GraphicsName		dc.b	"graphics.library",0
IconName		dc.b	"icon.library",0
GadName			dc.b	"gadtools.library",0
CommName		dc.b	"commodities.library",0
			even

MyNewBroker		dc.b	NB_VERSION	;Version
			dc.b	0		;Reserve1
			dc.l	HandlerName	;Name
			dc.l	PortName	;Title
			dc.l	DescText	;Description
			dc.w	NBU_NOTIFY!NBU_UNIQUE		;Unique
			dc.w	COF_SHOW_HIDE	;Flags
MyPri			dc.b	0		;Pri
			dc.b	0		;Reserve2
BrokerPort		dc.l	0		;Port
			dc.w	0		;ReservedChannel

CycleList	dc.l	GUI_Choose1.1,GUI_Choose1.2,GUI_Choose1.3,GUI_Choose1.4,0
CycleList2	dc.l	GUI_Choose2.1,GUI_Choose2.2,GUI_Choose2.3,GUI_Choose2.4,0
CycleList3	dc.l	GUI_Choose3.1,GUI_Choose3.2,GUI_Choose3.3,0

		rsreset
TemplateText	rs.l	1
TemplateSpecial	rs.l	1
TemplateA4	rs.w	1
TemplateType	rs.w	1
TemplateSize	rs.w	0

T_CHECK		=	0
T_CYCLE		=	1
T_STRING	=	2
T_INTEGER	=	3

NumberOfTemps	=	20

WBTemplate	dc.l	TextDNW,0
		dc.w	TempDummy,T_CHECK

		dc.l	TextMove,0
		dc.w	TempMove,T_CHECK

		dc.l	TextSFront,0
		dc.w	TempSFront,T_CHECK

		dc.l	TextWFront,0
		dc.w	TempWFront,T_CHECK

		dc.l	TextPDef,0
		dc.w	TempPDef,T_CHECK

		dc.l	TextRestrict,0
		dc.w	TempRestrict,T_CHECK

		dc.l	TextDelay,0
		dc.w	TempDelay,T_INTEGER

		dc.l	TextAction,CycleList3
		dc.w	TempAction,T_CYCLE

		dc.l	TextRemWin,0
		dc.w	TempRemWin,T_CHECK

		dc.l	TextMoveMouse,0
		dc.w	TempMoveMouse,T_CHECK

		dc.l	TextCXPOPUP,0
		dc.w	TempCXPOPUP,T_CHECK

		dc.l	TextWBWin,0
		dc.w	TempWBWin,T_CHECK

		dc.l	TextScreen,0
		dc.w	TempScreen,T_STRING

		dc.l	TextWindow,0
		dc.w	TempWindow,T_STRING

		dc.l	TextCXPOPKEY,0
		dc.w	TempCXPOPKEY,T_STRING

		dc.l	TextCXPRI,0
		dc.w	TempCXPRI,T_INTEGER

		dc.l	TextHADJ,CycleList
		dc.w	TempHADJ,T_CYCLE

		dc.l	TextVADJ,CycleList2
		dc.w	TempVADJ,T_CYCLE

		dc.l	TextActionKey,0
		dc.w	TempActionKey,T_STRING

		dc.l	TextLastWindow,0
		dc.w	TempLWindow,T_STRING

		dc.l	TextNextWindow,0
		dc.w	TempNWindow,T_STRING

		dc.l	0


TextDNW		dc.b	"DONOTWAIT",0
TextMove	dc.b	"MOVE",0
TextSFront	dc.b	"SFRONT",0
TextWFront	dc.b	"WFRONT",0
TextPDef	dc.b	"DEFPUB",0
TextCXPOPUP	dc.b	"CX_POPUP",0
TextRestrict	dc.b	"RESTRICT",0
TextCXPRI	dc.b	"CX_PRIORITY",0
TextCXPOPKEY	dc.b	"CX_POPKEY",0
TextRemWin	dc.b	"REMWIN",0
TextMoveMouse	dc.b	"MOVEMOUSE",0
TextHADJ	dc.b	"HADJ",0
TextVADJ	dc.b	"VADJ",0
TextScreen	dc.b	"SCREEN",0
TextWindow	dc.b	"WINDOW",0
TextActionKey	dc.b	"ACTIONKEY",0
TextAction	dc.b	"ACTION",0
TextDelay	dc.b	"DELAY",0
TextLastWindow	dc.b	"LWINDOW",0
TextNextWindow	dc.b	"NWINDOW",0
TextWBWin	dc.b	"WBWIN",0
Template	dc.b	"MOVE/S,SFRONT/S,WFRONT/S,DEFPUB/S,REMWIN/S,MOVEMOUSE/S,CX_POPUP/S,RESTRICT/S,WBWIN/S,CX_PRIORITY/K,CX_POPKEY/K,HADJ/K,VADJ/K,SCREEN/K,WINDOW/K,ACTIONKEY/K,ACTION/K,DELAY/K,LWINDOW/K,NWINDOW/K",0
PortName	dc.b	"Huntwindows 3.2",0
HandlerName	dc.b	"Huntwindows",0
GadgetText	dc.b	"Ok",0
DefaultDescr	dc.b	"control alt h",0
DefaultDescr2	dc.b	"control help",0
DefaultDescr3	dc.b	"lcommand left",0
DefaultDescr4	dc.b	"lcommand right",0
DefaultDescr5	dc.b	"lcommand help",0
HotKeyErrorT	dc.b	"Wrong hotkey description!",$0a,0
Text1		dc.b	"Error in arguments or libraries!",$0a,0
Text2		dc.b	"I need V37+ !",$0a,0
Text3		dc.b	"Error in given patterns!",$0a,0
Text4		dc.b	"Cannot Save!",$0a,0
		dc.b	"$VER: "	;for version information
Texth		dc.b	"Huntwindows 3.2 (12.7.93) by Jörg Bublath 1992-1993",0
DescText	dc.b	"Moves screen to show windows",0
GUI_Text1	dc.b	"Move Screen",0
GUI_Text2	dc.b	"ScreenToFront",0
GUI_Text3	dc.b	"WindowToFront",0
GUI_Text5	dc.b	"Set Default PubScreen",0
GUI_Text6	dc.b	"Restrict on DefPub",0
GUI_Text7	dc.b	"Remember Window",0
GUI_Text7_1	dc.b	"Move Mouse",0
GUI_Text7_2	dc.b	"GUI Popup",0
GUI_Text8	dc.b	"Horizontal Adjustment",0
GUI_Text9	dc.b	"Vertical Adjustment",0
GUI_Text10	dc.b	"_Hide",0
GUI_Text11	dc.b	"_Quit",0
GUI_Text12	dc.b	"Screen Pattern",0
GUI_Text13	dc.b	"Window Pattern",0
GUI_Text14	dc.b	"_Save",0
GUI_Text16	dc.b	"Popup Hotkey",0
GUI_Text17	dc.b	"Action Hotkey",0
GUI_Text18	dc.b	"Action Condition",0
GUI_Text19	dc.b	"'Last Window' Hotkey",0
GUI_Text19_2	dc.b	"'Next Window' Hotkey",0
GUI_Text20	dc.b	"Exclude WB-Windows",0
SliderText	dc.b	"Delay in 1/50 seconds:%ld  ",0
GUI_TextEnd	;
GUI_Choose1.1	dc.b	"left",0
GUI_Choose1.2	dc.b	"right",0
GUI_Choose1.3	dc.b	"center",0
GUI_Choose1.4	dc.b	"off",0
GUI_Choose2.1	dc.b	"top",0
GUI_Choose2.2	dc.b	"bottom",0
GUI_Choose2.3	dc.b	"center",0
GUI_Choose2.4	dc.b	"off",0
GUI_Choose3.1	dc.b	"necessary",0
GUI_Choose3.2	dc.b	"hotkey",0
GUI_Choose3.3	dc.b	"always",0
		even
