Mini Kabibi Habibi

Current Path : C:/Users/ITO/Desktop/VF9/program files/microsoft visual foxpro 9/ffc/
Upload File :
Current File : C:/Users/ITO/Desktop/VF9/program files/microsoft visual foxpro 9/ffc/_agent.vct

,�VERSION =   3.00%_agent.h�i�,..\foxpro.hU{�,_agent_agent.hPixelsClass1_custom_agent�agentcontrol Pointer to the agent object
activeagent Name of the active Agent
errorstate Determines the state of the control during an error
erroroccurred Whether an error has occurred
*load Loads an agent character from the specified location (can be file or URL)
*show Shows the active agent
*hide Hides the active agent.
*moveto Moves the default agent or agent passed to the location specificed
*play Causes the active agent to play an animation
*gestureat Causes the active agent to gesture at a given point
*speak Causes the active agent to speak the passed phrase
*moveby Moves the active agent by the passed values in the x or y direction
*localtoworld Converts local coordinates to world coordinates
*stop Stops a looping animation
*setactiveagent Sets the active agent to the agent with the passed name
*interrupt Interrupts an animation
*wait Waits for a request to complete
��� ��<%a��U�U����%%�C�this.agentControlb�O���F%�C�this.agentControl.characters("��")b�O�C��
	���T����LOAD����C��������%���
����8����������state���Showing, Speaking����T���-��B�-�����U	TCAGENTNAMETCAGENTLOCATIONTHIS
ERRORSTATEAGENTCONTROL
CHARACTERSLOAD
ERROROCCURREDGETw������%�C�tnCoordsb�N��<�
T������%�������T��C�������T��C��������%�C�tnCoordsb�N����T�������$%�C�this.activeAgentb�O��a�%�C����N��	�T��������%�C����N��5�T�����	�����C�����
����C������p�B�-���UTNXTNYTNCOORDSTOOBJTHISLOCALTOWORLD
DEFAULTCOORDSACTIVEAGENTLEFTTOPMOVETOSHOWJ$%�C�this.activeAgentb�O��4���C������C�B�-���UTHISACTIVEAGENTHIDE�������%�C�tnCoordsb�N��<�
T������%�������T��C�������T��C��������$%�C�this.activeAgentb�O������C����������B�-���UTNXTNYTNCOORDSTOOBJTHISLOCALTOWORLDACTIVEAGENTMOVETO�������$%�C�this.activeAgentb�O��f���C�state������T��C�������y�T��-���	B����UTCANIMATIONLLRETVALTHISACTIVEAGENTGETPLAY�������%�C�tnCoordsb�N��<�
T������%�������T��C�������T��C��������$%�C�this.activeAgentb�O������C����������B�-���UTNXTNYTNCOORDSTOOBJTHISLOCALTOWORLDACTIVEAGENT	GESTUREATm������$%�C�this.activeAgentb�O��J�T��C�������]�T��-���	B����UTCTEXTLLRETVALTHISACTIVEAGENTSPEAK�������%�C�tnCoordsb�N��<�
T������$%�C�this.activeAgentb�O����'��C���������������B�-���U	TNXTNYTNCOORDSTOOBJTHISMOVETOACTIVEAGENTLEFTTOP����������&T��C���
�Left��Top6��
T����� +�C�loObj.Classb�C����%�C�loObj.�b�N����!tnPos = tnPos + loObj.&lcAxis
�3%�C�loObj.Classb�C�C��f�FORM	���%�������$tnPos = tnPos + _Screen.&lcAxis.
��)%�C�
loObj.Tabsb�L���	����%�����m�T���������T���������� %�C�loObj.Parentb�U����T����	�����T��-����	B����U
TNAXISTNPOSTOOBJLCAXISLOOBJCLASS
SHOWWINDOWTABSBORDERWIDTHPARENTJ$%�C�this.activeAgentb�O��4���C������C�B�-���UTHISACTIVEAGENTSTOP�������%%�C�this.agentControlb�O����<%�C�this.agentControl.characters("��")b�O����T���C��������C�����T��a����	B����UTCAGENTNAMELLRETVALTHISACTIVEAGENTAGENTCONTROL
CHARACTERSACTIVATEU���$%�C�this.activeAgentb�O��?���C�������N�B�-���U	TOREQUESTTHISACTIVEAGENT	INTERRUPTm������$%�C�this.activeAgentb�O��J�T��C�������]�T��-���	B����U	TOREQUESTLLRETVALTHISACTIVEAGENTWAIT?"T���C�Agent.Control.2�N��T����a��	B�C��UTHISAGENTCONTROL	CONNECTEDb�����
H��F�����LOAD��F�T���a��B����C�����UNERRORCMETHODNLINETHIS
ERRORSTATE
ERROROCCURREDload,��show���hide���moveto���play��	gestureat���speak��moveby���localtoworld���stop�
��setactiveagent4��	interrupt?��wait���Init`
��Error�
��1�ScB����qAAA41��A��A�ABQ1AR1A��qA4A�qA41��A��AB��qA2qrB����A�21��A��AB��qA2qrB���A�21��AHq�qA3��c��A5AAAA���AA��AA�2A�qA2qrS���AA�2qBA�qA4qrB���A�2"�2����AAR1,Gu'��8-NA;iESEe�aS�r	s\�	Z�f}k������x�����3��������>�)�IPROCEDURE load
LParameters tcAgentName, tcAgentLocation

*-- Make sure it inited ok
If Type("this.agentControl") = "O"
	*-- Only load a character once
	If Type('this.agentControl.characters("' + tcAgentName + '")' ) <> "O" And ;
		!Empty(tcAgentLocation)
		
  		this.errorState = "LOAD"
		this.agentControl.characters.load(tcAgentName, tcAgentLocation)
		If !this.errorOccurred
			this.agentControl.characters(tcAgentName).get("state", "Showing, Speaking")
  		Else
  			this.errorOccurred = .F.
  			Return .F.
  		Endif
	Endif
Endif


ENDPROC
PROCEDURE show
LParameters tnX, tnY, tnCoords, toObj

If Type("tnCoords") <> "N"
	tnCoords = COORDS_WORLD
Endif

If tnCoords = COORDS_LOCAL
	tnX = this.localToWorld(AXIS_X, tnX, toObj)
	tnY = this.localToWorld(AXIS_Y, tnY, toObj)
Endif

If Type("tnCoords") <> "N"
	tnCoords = this.defaultCoords
Endif

If Type("this.activeAgent") = "O"
	If Vartype(tnX) <> "N"
		tnX = this.activeAgent.Left
	Endif

	If Vartype(tnY) <> "N"
		tnY = this.activeAgent.Top
	Endif

	this.activeAgent.moveTo(tnX, tnY)
	this.activeAgent.show()
Else
	Return .F.
Endif


ENDPROC
PROCEDURE hide
If Type("this.activeAgent") = "O"
	this.activeAgent.hide()
Else
	Return .F.
Endif


ENDPROC
PROCEDURE moveto
LParameters tnX, tnY, tnCoords, toObj

If Type("tnCoords") <> "N"
	tnCoords = COORDS_WORLD
Endif

If tnCoords = COORDS_LOCAL
	tnX = this.localToWorld(AXIS_X, tnX, toObj)
	tnY = this.localToWorld(AXIS_Y, tnY, toObj)
Endif

If Type("this.activeAgent") = "O"
	this.activeAgent.moveTo(tnX, tnY)
Else
	Return .F.
Endif
ENDPROC
PROCEDURE play
LParameters tcAnimation

Local llRetVal

If Type("this.activeAgent") = "O"
	this.activeAgent.get("state", tcAnimation)
	llRetVal = this.activeAgent.play(tcAnimation)
Else
	llRetVal = .F.
Endif

Return llRetVal
ENDPROC
PROCEDURE gestureat
LParameters tnX, tnY, tnCoords, toObj

If Type("tnCoords") <> "N"
	tnCoords = COORDS_WORLD
Endif

If tnCoords = COORDS_LOCAL
	tnX = this.localToWorld(AXIS_X, tnX, toObj)
	tnY = this.localToWorld(AXIS_Y, tnY, toObj)
Endif

If Type("this.activeAgent") = "O"
	this.activeAgent.gestureAt(tnX, tnY)
Else
	Return .F.
Endif
ENDPROC
PROCEDURE speak
LParameters tcText

Local llRetVal

If Type("this.activeAgent") = "O"
	llRetVal = this.activeAgent.Speak(tcText)
Else
	llRetVal = .F.
Endif

Return llRetVal
ENDPROC
PROCEDURE moveby
LParameters tnX, tnY, tnCoords, toObj

If Type("tnCoords") <> "N"
	tnCoords = COORDS_WORLD
Endif

*-- Don't need to convert because we're only moving the relative position 
*!*	If tnCoords = COORDS_LOCAL
*!*		tnX = this.localToWorld(AXIS_X, tnX, toObj)
*!*		tnY = this.localToWorld(AXIS_Y, tnY, toObj)
*!*	Endif

If Type("this.activeAgent") = "O"
	this.moveTo( this.activeAgent.left + tnX, this.activeAgent.top + tnY )
Else
	Return .F.
Endif

ENDPROC
PROCEDURE localtoworld
LParameters tnAxis, tnPos, toObj

LOCAL lcAxis, loObj

*-- Select the Axis we are converting
lcAxis = Iif(tnAxis = 0, "Left", "Top")

*-- Calculate offset of all parent containers
loObj = toObj

Do While Type("loObj.Class") = "C"

	*-- Pages in PageFrames don't have Left or Top
	If Type("loObj." + lcAxis) = "N"
		tnPos = tnPos + loObj.&lcAxis
	Endif

	*-- If loObj is a form, we should determine if it's a top level
	*-- form. If so, we've already calculated the world offset. If not
	*-- we need the screen offset.
	If Type("loObj.Class") = "C" And Upper(loObj.Class) = "FORM"
		If loObj.ShowWindow <> 2 && Top-Level Form
			tnPos = tnPos + _Screen.&lcAxis.
		EndIf
	Endif

	If Type("loObj.Tabs") = "L" And tnAxis = 1
		If loObj.Tabs
			tnPos = tnPos + 28 && This may be a sysmetric call
		Else
			tnPos = tnPos + loObj.BorderWidth * 2
		Endif
	Endif
	
	If Type("loObj.Parent") <> "U"
	  	loObj = loObj.Parent
  	Else
  		loObj = .F.
  	Endif
EndDo

Return tnPos
ENDPROC
PROCEDURE stop
If Type("this.activeAgent") = "O"
	this.activeAgent.stop()
Else
	Return .f.
Endif
ENDPROC
PROCEDURE setactiveagent
LParameters tcAgentName

Local llRetVal

*-- Make sure it inited ok
If Type("this.agentControl") = "O"
	*-- Test to make sure this is a valid character
	If Type('this.agentControl.characters("' + tcAgentName + '")' ) = "O"
		this.activeAgent = this.agentControl.characters(tcAgentName)
		this.activeAgent.Activate()
		llRetVal = .T.
	EndIf
Endif

Return llRetVal
ENDPROC
PROCEDURE interrupt
LParameters toRequest

If Type("this.activeAgent") = "O"
	this.activeAgent.interrupt(toRequest)
Else
	Return .F.
Endif


ENDPROC
PROCEDURE wait
LParameters toRequest

Local llRetVal

If Type("this.activeAgent") = "O"
	llRetVal = this.activeAgent.wait(toRequest)
Else
	llRetVal = .F.
Endif

Return llRetVal
ENDPROC
PROCEDURE Init
*-- Create the Agent control
this.agentControl = CreateObject("Agent.Control.2")
this.agentControl.connected = .T.

RETURN DoDefault()
ENDPROC
PROCEDURE Error
LParameters nError, cMethod, nLine

Do Case
Case this.errorState == "LOAD"
	this.errorOccurred = .T.
	RETURN
EndCase

DoDefault(nError, cMethod, nLine)
ENDPROC
=Height = 42
Width = 42
errorstate = LOAD
Name = "_agent"
custom	_base.vcx