*--------------------------------------------------------------------------------------------------------------------------------------------------------
* (EN) AUTOGENERATED - ATTENTION!! - NOT INTENDED FOR EXECUTION!! USE ONLY FOR MERGING CHANGES AND STORING WITH SCM TOOLS!!
*--------------------------------------------------------------------------------------------------------------------------------------------------------
*< FOXBIN2PRG: Version="1.21" SourceFile="wwdialogs.vcx" CPID="1252" /> (Solo para binarios VFP 9 / Only for VFP 9 binaries)
*
*
DEFINE CLASS wwprogresscontainer AS container 
 	*< CLASSDATA: Baseclass="container" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="oProgress" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblRemaining" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: setprogress
		*p: nmaxvalue
		*p: nstartseconds
	*</DefinedPropArrayMethod>

	*<PropValue>
		BackStyle = 0
		BorderWidth = 0
		Height = 41
		Name = "wwprogresscontainer"
		Width = 250
	*</PropValue>

	ADD OBJECT 'lblRemaining' AS label WITH ;
		BackStyle = 0, ;
		Caption = "Estimated Time Remaining: ", ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		Height = 15, ;
		Left = 3, ;
		Name = "lblRemaining", ;
		Top = 26, ;
		Width = 285
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'oProgress' AS olecontrol WITH ;
		Height = 17, ;
		Left = 1, ;
		Name = "oProgress", ;
		Top = 4, ;
		Width = 248
		*< END OBJECT: BaseClass="olecontrol" OLEObject="d:\program files\microsoft visual studio 7\common7\controls\mscomctl.ocx" Value="0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAEAAAAgAAAAEAAAD+////AAAAAAAAAAD////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////9/////v////7////+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////1IAbwBvAHQAIABFAG4AdAByAHkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWAAUA//////////8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEB087LlTr8BAwAAAEABAAAAAAAAAwBPAGwAZQBPAGIAagBlAGMAdABEAGEAdABhAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4AAgEDAAAAAgAAAP////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAADAEEAYwBjAGUAcwBzAE8AYgBqAFMAaQB0AGUARABhAHQAYQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJgACAP///////////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAABcAAAAAAAAAAMAQwBoAGEAbgBnAGUAZABQAHIAbwBwAHMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAIA////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAQAAAAAAAAABAAAAAIAAAD+/////v////7///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8iOgU1iYXREbFqAMDwKDYoIUM0EggAAACiGQAAwgEAAAGKq5cAAAYAHAAAAAAAAAAAAMhCAAAAAAHvzasAAAUAXAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAACQAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA5MzY4MjY1RS04NUZFLTExZDEtOEJFMy0wMDAwRjg3NTREQTEkACUAJgAnACgAKQAqACsALAAtAC4ALwAwADEAMgAzADQANQABAACAOAA5ADoAOwA8AD0APgA/AEAAQQBCAEMARABFAEYARwBIAEkASgBLAEwATQBOAE8AUABRAFIAUwBUAFUAqD/oCwYAAAD//////////6juEgAf3uy9AQAFAKjuEgBFZGl0aW5nXHNlcnZlcgBuZ1xzZXJ2ZXIAdmVyAHIAAHIAcgBydmVyAHZlcgB2ZXIAcgBcc2VydmVyAHRpbmdcc2VydmVyACBgATkgUgGNAH0BjwCQABggGSAcIB0gIiATIBQg3AIiIWEBOiBTAZ0AfgF4AaAAoQCiAKMApAClAKYApwCoAKkAqgCrAKwArQCuAK8AsACxALIAswC0ALUAtgC3ALgAuQC6ALsAvAC9AL4AvwDAAMEAwgDDAMQAxQDGAMcAyADJAMoAywDMAM0AzgDPANAA0QDSANMA1ADVAA==" />
	
	PROCEDURE Resize
		THIS.oProgress.Width= THIS.Width - 10
	ENDPROC

	PROCEDURE setprogress
		LPARAMETER lnValue
		
		*** Refresh the progress bar
		THIS.oProgress.Value = lnValue
		
		lnTime = SECONDS()
		IF THIS.nstartseconds = 0
		   THIS.nstartseconds= lnTime
		ENDIF
		
		IF !THIS.lshowtimeremaining
		   THIS.lblRemaining.Caption = ""
		   RETURN
		ENDIF
		
		*** Took this long
		lnTaken = lnTime - THIS.nStartSeconds
		
		*** We're at this percentage
		lnPercent = lnValue / THIS.nmaxvalue * 100
		
		lnRemainingSecs = (lnTaken * (100/lnPercent) ) - lnTaken  + 1
		
		IF lnRemainingSecs < 60
		   THIS.lblRemaining.Caption = "Estimated Time Remaining: " + TRANSFORM(lnRemainingSecs,"999") + " seconds " 
		ELSE
		   THIS.lblRemaining.Caption = "Estimated Time Remaining: " + TRANSFORM(lnRemainingSecs/60,"999") + " minutes"
		ENDIF   
		
		
		
	ENDPROC

ENDDEFINE

DEFINE CLASS wwprogressform AS form 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="lblDescript" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblRemaining" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cmdCancel" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_progressbar1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: cancel		&& This method is called when the user clicks the Cancel button.
		*m: enablecancel		&& Shows a Cancel button. Note your code must handle this button.
		*m: hideprogressbar
		*m: loadanimation
		*m: setcaption		&& Sets the caption of the form
		*m: setdescription
		*m: setmaxvalue
		*m: setprogress		&& Sets the progress bar and computes remaining time.
		*m: setprogressbar		&& Sets only the progressbar.
		*m: showcancelbutton		&& Resizes the form to display the Cancel button.
		*m: width_assign
		*p: lcancelled		&& Set when the Cancel button is clicked
		*p: lshowtimeremaining
		*p: nmaxvalue
		*p: nstartseconds
	*</DefinedPropArrayMethod>

	*<PropValue>
		AutoCenter = .T.
		BackColor = 255,255,255
		BorderStyle = 0
		Caption = "Progress"
		ControlBox = .F.
		DoCreate = .T.
		FontName = "Tahoma"
		FontSize = 8
		ForeColor = 0,0,0
		Height = 86
		lshowtimeremaining = .T.
		Name = "wwprogressform"
		nmaxvalue = 100
		nstartseconds = 0
		ShowWindow = 2
		TitleBar = 0
		Width = 383
	*</PropValue>

	ADD OBJECT '_progressbar1' AS _progressbar WITH ;
		Left = 26, ;
		Name = "_progressbar1", ;
		Top = 36, ;
		Shape5.Name = "Shape5", ;
		shpThermBar.Name = "shpThermBar", ;
		lblPercentage.Name = "lblPercentage", ;
		lblPercentage2.Name = "lblPercentage2", ;
		shape1.Name = "shape1", ;
		shape2.Name = "shape2", ;
		Shape3.Name = "Shape3", ;
		Shape4.Name = "Shape4"
		*< END OBJECT: ClassLib="_therm.vcx" BaseClass="container" />

	ADD OBJECT 'cmdCancel' AS commandbutton WITH ;
		Caption = "\<Renunță", ;
		FontCharSet = 238, ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		Height = 25, ;
		Left = 305, ;
		Name = "cmdCancel", ;
		Top = 56, ;
		Visible = .F., ;
		Width = 73
		*< END OBJECT: BaseClass="commandbutton" />

	ADD OBJECT 'lblDescript' AS label WITH ;
		BackStyle = 0, ;
		Caption = "", ;
		FontCharSet = 238, ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		Height = 31, ;
		Left = 12, ;
		Name = "lblDescript", ;
		Top = 0, ;
		Visible = .T., ;
		Width = 360
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'lblRemaining' AS label WITH ;
		BackStyle = 0, ;
		Caption = "Estimated Time Remaining: ", ;
		FontCharSet = 238, ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		Height = 15, ;
		Left = 12, ;
		Name = "lblRemaining", ;
		Top = 60, ;
		Width = 288
		*< END OBJECT: BaseClass="label" />
	
	PROCEDURE cancel		&& This method is called when the user clicks the Cancel button.
	ENDPROC

	PROCEDURE enablecancel		&& Shows a Cancel button. Note your code must handle this button.
	ENDPROC

	PROCEDURE hideprogressbar
		LPARAMETER llShow
		
		IF !llShow
		  THISFORM.Height = 66
		ELSE
		  THISFORM.Height = 100
		ENDIF  
	ENDPROC

	PROCEDURE loadanimation
		Lparameter lcFile, lnHeight, lnWidth, llCaptionBelowImage
		
		lcExt = lower(JUSTEXT(lcFile))
		
		llImage = .F.
		If lcExt $ ",gif,jpg,bmp,"
			*** Load a picture instead
			If TYPE("THISFORM.oAnimation") # "O"
		       THISFORM.AddObject("oAnimation","Image")
			ENDIF
			llImage = .T.
		Else
			If !IsCOMObject("MSComCtl2.Animation") && AND FILE(ForceExt(lcFile,"bmp"))
				Return
			Endif
			If TYPE("THISFORM.oAnimation") # "O"
				Thisform.AddObject("oAnimation","OleControl","mscomctl2.animation")
			Endif
		Endif
		
		Thisform.oAnimation.Top = 6
		Thisform.oAnimation.Left = 6
		
		lcFile = FULLPATH(lcFile)
		
		If EMPTY(lnHeight)
		   lnHeight = 50
		   lnWidth = 50
		ENDIF   
		
		Thisform.LockScreen = .T.
		Thisform.oAnimation.Width = lnWidth
		Thisform.oAnimation.Height = lnHeight
		If !llCaptionBelowImage
			Thisform.lblDescript.Left = THISFORM.oAnimation.Left  +  THISFORM.oAnimation.Width + 10
			Thisform.Width = THISFORM.lblDescript.Left + THISFORM.lblDescript.Width + 5
		*	Thisform.oProgress.Width = THISFORM.Width - 15
		*	Thisform.oProgress.Top = THISFORM.oAnimation.Top + THISFORM.oAnimation.Height + 10
		*	Thisform.lblRemaining.Top = THISFORM.oProgress.Top + 20
			Thisform.Height = THISFORM.lblRemaining.Top + 20
		Else
			Thisform.lblDescript.Left = 6
			Thisform.lblDescript.Top = THISFORM.oAnimation.Top + THISFORM.oAnimation.Height + 5
			Thisform.Width = THISFORM.oAnimation.Width + 20
			Thisform.lblDescript.Width = THISFORM.Width - 10
		*	Thisform.oProgress.Top = THISFORM.lblDescript.Top + 40
		*	Thisform.oProgress.Width = THISFORM.width - 15
		*	Thisform.lblRemaining.Top = THISFORM.oProgress.Top + 20
			Thisform.Height = THISFORM.lblRemaining.Top + 20
		Endif
		Thisform.Lockscreen = .F.
		
		
		Thisform.oAnimation.Visible = .T.
		
		IF llImage
		   THISFORM.oAnimation.Picture = lcFile
		ELSE
		   Thisform.oAnimation.Open(lcFile)
		   
			** We need to resize the animation control
			** to get it to refresh itself correctly
			Thisform.oAnimation.Width = ThisForm.oAnimation.Width + 1
			Thisform.oAnimation.Width = ThisForm.oAnimation.Width - 1
		
			Thisform.oAnimation.Play()
		ENDIF   
		
	ENDPROC

	PROCEDURE setcaption		&& Sets the caption of the form
		LPARAMETER lcCaption
		
		IF VARTYPE(lcCaption) # "C"
		   lcCaption = ""
		ENDIF
		
		THISFORM.Caption = lcCaption
	ENDPROC

	PROCEDURE setdescription
		LPARAMETER lcDescription 
		
		IF VARTYPE(lcDescription) # "C"
		  RETURN
		ENDIF
		
		Thisform.lblDescript.Caption = lcDescription
	ENDPROC

	PROCEDURE setmaxvalue
	ENDPROC

	PROCEDURE setprogress		&& Sets the progress bar and computes remaining time.
		LPARAMETER lnValue
		LOCAL lnTaken, lnPercent, lnRemainingSecs, lnTime
		
		IF VARTYPE(lnValue) = "C"
		   THISFORM.Caption = lnValue
		   RETURN
		ENDIF   
		IF VARTYPE(lnValue) # "N" or lnValue < 0
		   lnValue = 0
		ENDIF   
		
		*** Refresh the progress bar
		thisform._progressbar1.update(lnvalue)
		
		lnTime = SECONDS()
		IF THIS.nstartseconds = 0
		   THIS.nstartseconds= lnTime
		ENDIF
		
		IF !THISFORM.lshowtimeremaining
		   THISFORM.lblRemaining.Caption = ""
		   RETURN
		ENDIF
		
		*** Took this long
		lnTaken = lnTime - THIS.nStartSeconds
		
		*** We're at this percentage
		lnPercent = lnValue / THIS.nmaxvalue * 100
		
		lnRemainingSecs = (lnTaken * (100/lnPercent) ) - lnTaken  + 1
		
		IF lnRemainingSecs < 60
		   THISFORM.lblRemaining.Caption = "Timp ramas : " + TRANSFORM(lnRemainingSecs,"999") + " sec. " 
		ELSE
				IF ALLTRIM(TRANSFORM(lnRemainingSecs/60,"999")) # "1" 
				   THISFORM.lblRemaining.Caption = "Timp ramas : " + TRANSFORM(lnRemainingSecs/60,"999") + " minute"
		   		ELSE
				   THISFORM.lblRemaining.Caption = "Timp ramas : " + TRANSFORM(lnRemainingSecs/60,"999") + " minut"   		
		   		ENDIF
		ENDIF   
		
		
	ENDPROC

	PROCEDURE setprogressbar		&& Sets only the progressbar.
		LPARAMETERS llON
		
		IF !llOn
		   THISFORM.lblRemaining.Visible = .F.
		*   THISFORM.oProgress.Visible = .F.
		   THISFORM.Height = 75
		ELSE
		   THISFORM.lblRemaining.Visible = .F.
		*   THISFORM.oProgress.Visible = .F.
		   THISFORM.Height = 100
		ENDIF   
	ENDPROC

	PROCEDURE showcancelbutton		&& Resizes the form to display the Cancel button.
		LPARAMETERS llNoShow
		
		IF llNoShow
		   THISFORM.Height =175
		   THISFORM.cmdCancel.visible = .F.
		ELSE
		   THISFORM.Height = 100
		   THISFORM.cmdCancel.visible = .T.
		ENDIF
	ENDPROC

	PROCEDURE width_assign
		LPARAMETERS vNewVal
		
		THIS.Width = m.vNewVal
		
		THIS.lblDescript.Width = THIS.Width - 2
		*THIS.oProgress.Width = THIS.Width - 12
	ENDPROC

	PROCEDURE cmdCancel.Click
		THISFORM.lCancelled = .T.
		THISFORM.Cancel()
		
	ENDPROC

ENDDEFINE

DEFINE CLASS wwquickfill AS combobox 
 	*< CLASSDATA: Baseclass="combobox" Timestamp="" Scale="Pixels" Uniqueid="" />

	*<DefinedPropArrayMethod>
		*p: lnoichange		&& When set don't do InteractiveChange Code
	*</DefinedPropArrayMethod>

	*<PropValue>
		FontName = "Tahoma"
		FontSize = 8
		Format = "K"
		Height = 24
		Name = "wwquickfill"
		Value = 
		Width = 100
	*</PropValue>
	
	PROCEDURE InteractiveChange
		LOCAL x, lcLookup
		
		IF THIS.lNoIChange
		   RETURN
		ENDIF
		
		lnSelStart = THIS.SelStart
		lcLookup = UPPER(TRIM(THIS.DisplayValue))
		lcLookupFull = THIS.DisplayValue
		IF EMPTY(lclookup)
		   RETURN
		ENDIF
		
		llFound = .f.
		
		*** Search through the list
		FOR x=1 to THIS.ListCount
		   IF UPPER(THIS.ListItem[x]) = lcLookup
		      THIS.Value = TRIM(THIS.ListItem[x])
		      THIS.SelStart = lnSelStart
		      THIS.SelLength = LEN(THIS.Value) - THIS.SelStart
		      llFound = .T.
		      EXIT
		   ENDIF
		ENDFOR
		
		
	ENDPROC

	PROCEDURE KeyPress
		LPARAMETERS nKeyCode, nShiftAltCtrl
		
		DO CASE
		  CASE nKeyCode = 7  && Delete
		     THIS.lNoIChange =  .T.
		     THIS.SelText = ""
		     RETURN
		  CASE nKeyCode = 127
		     THIS.lNoIChange = .T.
		     THIS.SelText = ""
		     RETURN
		ENDCASE
		
		THIS.lNoIChange = .F.
	ENDPROC

ENDDEFINE

DEFINE CLASS wwselectionlist AS form 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Command1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Command2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblCaption" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="oList" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*p: cresultvalue
		*p: lcancelled
		*a: alist[1,0]
	*</DefinedPropArrayMethod>

	*<PropValue>
		AutoCenter = .T.
		BorderStyle = 3
		Caption = ""
		ControlBox = .F.
		cresultvalue = 
		DoCreate = .T.
		Height = 83
		lcancelled = .F.
		Name = "wwselectionlist"
		ShowWindow = 1
		Visible = .T.
		Width = 320
		WindowType = 1
	*</PropValue>

	ADD OBJECT 'Command1' AS commandbutton WITH ;
		Caption = "OK", ;
		Default = .T., ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		Height = 25, ;
		Left = 172, ;
		Name = "Command1", ;
		TabIndex = 2, ;
		Top = 55, ;
		Width = 70
		*< END OBJECT: BaseClass="commandbutton" />

	ADD OBJECT 'Command2' AS commandbutton WITH ;
		Caption = "\<Cancel", ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		Height = 25, ;
		Left = 245, ;
		Name = "Command2", ;
		TabIndex = 3, ;
		Top = 55, ;
		Width = 70
		*< END OBJECT: BaseClass="commandbutton" />

	ADD OBJECT 'lblCaption' AS label WITH ;
		BackStyle = 0, ;
		Caption = "", ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		Height = 15, ;
		Left = 7, ;
		Name = "lblCaption", ;
		TabIndex = 4, ;
		Top = 7, ;
		Width = 240
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'oList' AS wwquickfill WITH ;
		Height = 22, ;
		Left = 5, ;
		Name = "oList", ;
		TabIndex = 1, ;
		Top = 25, ;
		Width = 309
		*< END OBJECT: ClassLib="wwdialogs.vcx" BaseClass="combobox" />
	
	PROCEDURE Init
		LPARAMETER laList, lcCaption, lcFormCaption, lcDefault
		
		EXTERNAL ARRAY laList
		
		ACOPY(laList,THIS.aList)
		
		THISFORM.oList.RowSourceType = 5
		THISFORM.oList.RowSource = "THISFORM.aList"
		IF EMPTY(lcDefault)
		   THISFORM.oList.Value = laList[1]
		ELSE
		   THISFORM.oList.Value = lcDefault
		ENDIF
		
		IF EMPTY(lcCaption)
		   lcCaption = "Please select:"
		ENDIF
		THISFORM.lblCaption.Caption = lcCaption
		
		IF EMPTY(lcFormCaption)
		  lcFormCaption = "Select Item"
		ENDIF
		
		THISFORM.Caption = lcFormCaption  
	ENDPROC

	PROCEDURE Command1.Click
		THISFORM.cResultValue = TRIM(THISFORM.oList.DisplayValue)
		THISFORM.HIDE()
	ENDPROC

	PROCEDURE Command2.Click
		THISFORM.lCancelled = .T.
		THISFORM.HIDE()
		
	ENDPROC

ENDDEFINE
