*--------------------------------------------------------------------------------------------------------------------------------------------------------
* (ES) AUTOGENERADO - ¡¡ATENCIÓN!! - ¡¡NO PENSADO PARA EJECUTAR!! USAR SOLAMENTE PARA INTEGRAR CAMBIOS Y ALMACENAR CON HERRAMIENTAS SCM!!
* (EN) AUTOGENERATED - ATTENTION!! - NOT INTENDED FOR EXECUTION!! USE ONLY FOR MERGING CHANGES AND STORING WITH SCM TOOLS!!
*--------------------------------------------------------------------------------------------------------------------------------------------------------
*< FOXBIN2PRG: Version="1.19" SourceFile="fb2p_diff.scx" /> (Solo para binarios VFP 9 / Only for VFP 9 binaries)
*
*
DEFINE CLASS dataenvironment AS dataenvironment 
 	*< CLASSDATA: Baseclass="dataenvironment" Timestamp="" Scale="" Uniqueid="" ClassIcon="1" />

	DataSource = .NULL.
	Height = 0
	Left = 0
	Name = "Dataenvironment"
	Top = 0
	Width = 0

ENDDEFINE

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

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="pgfDiff" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagFilesDiff.lbl_File1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagFilesDiff.lbl_File2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagFilesDiff.txtFile1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagFilesDiff.txtFile2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagFilesDiff.cmdFile1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagFilesDiff.cmdFile2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagFilesDiff.txtDiffToolName" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagFilesDiff.lbl_DiffTool" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagFilesDiff.cmdDiff" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagFilesDiff.shpFile1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagFilesDiff.shpFile2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagFilesDiff.chkShowCall" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagDiffToolConfig.lbl_DiffTool" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagDiffToolConfig.txtDiffToolConfig" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagDiffToolConfig.cboDiffToolName" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagDiffToolConfig.Label1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagDiffToolConfig.cmgEditPanel" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagDiffToolConfig.cmdResetAll" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagDiffToolConfig.cmdSave" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagDiffToolConfig.cmdCancel" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagDiffToolConfig.cmdSetDefault" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagDiffToolConfig.txtDiffToolPath" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagDiffToolConfig.Label2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfDiff.pagDiffToolConfig.cmdDiffToolPath" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="chkAlwaysOnTop" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: cancel		&& Specifies if a CommandButton is the Cancel button.
		*m: checkfilenames_dt
		*m: create_default_cfg
		*m: deletetool
		*m: difftoolchanged
		*m: difftoolcombo_refresh
		*m: edittool
		*m: filesdiff
		*m: initialize
		*m: load_cfg_data
		*m: newtool
		*m: resetalltools
		*m: savetool
		*m: save_cfg_data
		*m: updateglobalenabled
		*p: colorgreen
		*p: coloryellow
		*p: c_cfg_data		&& Contenido del archivo de configuración
		*p: c_cfg_file		&& Ruta del archivo de configuración
		*p: c_curdir		&& Ruta actual de la llamada
		*p: c_fb2p_diff_fullpath		&& Ruta de este form
		*p: difftoolconfig		&& Configuration for the Diff tool
		*p: difftoolname		&& Name of the Diff tool
		*p: difftoolpath
		*p: filename1
		*p: filename1_dt
		*p: filename2
		*p: filename2_dt
		*p: lastfilename1
		*p: lastfilename2
		*p: l_editmode
		*p: l_showcallonly		&& Show Diff Call Only, but don't Diff. (For testing)
		*p: n_editoption
		*p: n_selectedtoolindex
		*p: n_toolcount
		*p: ofb2p
		*a: a_tools[1,3]
		*p: _memberdata		&& XML Metadata for customizable properties
	*</DefinedPropArrayMethod>

	AllowOutput = .F.
	AlwaysOnTop = .T.
	AutoCenter = .T.
	BackColor = 255,255,255
	Caption = "Diff VFP 9 binary files (scx,vcx,mnx,pjx,frx,lbx,dbc,dbf)"
	colorgreen = (RGB(35,245,24))
	coloryellow = (RGB(239,245,165))
	c_cfg_data = 		&& Contenido del archivo de configuración
	c_cfg_file = 		&& Ruta del archivo de configuración
	c_curdir = 		&& Ruta actual de la llamada
	c_fb2p_diff_fullpath = 		&& Ruta de este form
	difftoolconfig = 		&& Configuration for the Diff tool
	difftoolname = 		&& Name of the Diff tool
	difftoolpath = 
	DoCreate = .T.
	filename1 = 
	filename1_dt = {}
	filename2 = 
	filename2_dt = {}
	Height = 191
	Icon = fb2p_diff.ico
	lastfilename1 = 
	lastfilename2 = 
	l_editmode = .F.
	l_showcallonly = .F.		&& Show Diff Call Only, but don't Diff. (For testing)
	MaxButton = .F.
	Name = "frmDiff"
	n_editoption = 0
	n_selectedtoolindex = 0
	n_toolcount = 0
	ofb2p = .NULL.
	ShowTips = .T.
	ShowWindow = 2
	Width = 760
	_memberdata = <VFPData>
		<memberdata name="updateglobalenabled" display="updateGlobalEnabled"/>
		<memberdata name="filesdiff" display="filesDiff"/>
		<memberdata name="l_editmode" display="l_EditMode"/>
		<memberdata name="difftoolconfig" display="diffToolConfig"/>
		<memberdata name="newtool" display="newTool"/>
		<memberdata name="edittool" display="editTool"/>
		<memberdata name="n_editoption" display="n_EditOption"/>
		<memberdata name="deletetool" display="deleteTool"/>
		<memberdata name="savetool" display="saveTool"/>
		<memberdata name="resetalltools" display="resetAllTools"/>
		<memberdata name="n_toolcount" display="n_ToolCount"/>
		<memberdata name="n_selectedtoolindex" display="n_SelectedToolIndex"/>
		<memberdata name="difftoolchanged" display="diffToolChanged"/>
		<memberdata name="c_cfg_file" display="c_CFG_File"/>
		<memberdata name="c_cfg_data" display="c_CFG_Data"/>
		<memberdata name="load_cfg_data" display="load_CFG_Data"/>
		<memberdata name="save_cfg_data" display="save_CFG_Data"/>
		<memberdata name="ofb2p" display="oFB2P"/>
		<memberdata name="create_default_cfg" display="create_Default_CFG"/>
		<memberdata name="difftoolcombo_refresh" display="diffToolCombo_Refresh"/>
		<memberdata name="checkfilenames_dt" display="checkFilenames_dt"/>
		<memberdata name="lastfilename1" display="lastFilename1"/>
		<memberdata name="lastfilename2" display="lastFilename2"/>
		<memberdata name="colorgreen" display="colorGreen"/>
		<memberdata name="coloryellow" display="colorYellow"/>
		<memberdata name="difftoolname" display="diffToolName"/>
		<memberdata name="difftoolpath" display="diffToolPath"/>
		<memberdata name="a_tools" display="a_Tools"/>
		<memberdata name="l_showcallonly" display="l_ShowCallOnly"/>
		<memberdata name="c_curdir" display="c_CurDir"/>
		<memberdata name="c_fb2p_diff_fullpath" display="c_fb2p_diff_FullPath"/>
		</VFPData>		&& XML Metadata for customizable properties

	ADD OBJECT 'chkAlwaysOnTop' AS checkbox WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		BackStyle = 0, ;
		Caption = "Always on top", ;
		ControlSource = "thisform.alwaysontop", ;
		Height = 17, ;
		Left = 652, ;
		Name = "chkAlwaysOnTop", ;
		TabIndex = 2, ;
		Top = 8, ;
		Value = .F., ;
		Width = 96
		*< END OBJECT: BaseClass="checkbox" />

	ADD OBJECT 'pgfDiff' AS pageframe WITH ;
		Anchor = 15, ;
		ErasePage = .T., ;
		Height = 180, ;
		Left = 8, ;
		Name = "pgfDiff", ;
		PageCount = 2, ;
		TabIndex = 1, ;
		TabStyle = 1, ;
		Top = 4, ;
		Width = 744, ;
		Page1.Caption = "Files Diff", ;
		Page1.Name = "pagFilesDiff", ;
		Page2.Caption = "Diff tool configure", ;
		Page2.Name = "pagDiffToolConfig"
		*< END OBJECT: BaseClass="pageframe" />

	ADD OBJECT 'pgfDiff.pagDiffToolConfig.cboDiffToolName' AS combobox WITH ;
		Anchor = 10, ;
		BorderColor = 0,128,192, ;
		Height = 24, ;
		Left = 63, ;
		Name = "cboDiffToolName", ;
		SelectOnEntry = .T., ;
		SpecialEffect = 1, ;
		Style = 2, ;
		TabIndex = 1, ;
		Top = 12, ;
		Width = 572
		*< END OBJECT: BaseClass="combobox" />

	ADD OBJECT 'pgfDiff.pagDiffToolConfig.cmdCancel' AS commandbutton WITH ;
		Anchor = 8, ;
		Caption = "Cancel", ;
		Height = 27, ;
		Left = 639, ;
		Name = "cmdCancel", ;
		TabIndex = 8, ;
		Top = 116, ;
		Width = 84
		*< END OBJECT: BaseClass="commandbutton" />

	ADD OBJECT 'pgfDiff.pagDiffToolConfig.cmdDiffToolPath' AS commandbutton WITH ;
		Anchor = 8, ;
		Caption = "...", ;
		Height = 27, ;
		Left = 695, ;
		Name = "cmdDiffToolPath", ;
		TabIndex = 3, ;
		Top = 42, ;
		Width = 28
		*< END OBJECT: BaseClass="commandbutton" />

	ADD OBJECT 'pgfDiff.pagDiffToolConfig.cmdResetAll' AS commandbutton WITH ;
		Anchor = 8, ;
		Caption = "Reset All", ;
		Height = 27, ;
		Left = 399, ;
		Name = "cmdResetAll", ;
		TabIndex = 6, ;
		Top = 116, ;
		Width = 84
		*< END OBJECT: BaseClass="commandbutton" />

	ADD OBJECT 'pgfDiff.pagDiffToolConfig.cmdSave' AS commandbutton WITH ;
		Anchor = 8, ;
		Caption = "Save", ;
		Height = 27, ;
		Left = 551, ;
		Name = "cmdSave", ;
		TabIndex = 7, ;
		Top = 116, ;
		Width = 84
		*< END OBJECT: BaseClass="commandbutton" />

	ADD OBJECT 'pgfDiff.pagDiffToolConfig.cmdSetDefault' AS commandbutton WITH ;
		Anchor = 8, ;
		Caption = "Set Default", ;
		Height = 27, ;
		Left = 639, ;
		Name = "cmdSetDefault", ;
		TabIndex = 9, ;
		Top = 10, ;
		Width = 84
		*< END OBJECT: BaseClass="commandbutton" />

	ADD OBJECT 'pgfDiff.pagDiffToolConfig.cmgEditPanel' AS commandgroup WITH ;
		Anchor = 2, ;
		BackStyle = 0, ;
		BorderStyle = 0, ;
		ButtonCount = 3, ;
		ControlSource = "THISFORM.n_EditOption", ;
		Height = 36, ;
		Left = 63, ;
		Name = "cmgEditPanel", ;
		SpecialEffect = 1, ;
		TabIndex = 5, ;
		Top = 112, ;
		Value = 1, ;
		Width = 268, ;
		Command1.Caption = "New tool", ;
		Command1.Height = 27, ;
		Command1.Left = 4, ;
		Command1.Name = "cmdNew", ;
		Command1.Top = 4, ;
		Command1.Width = 84, ;
		Command2.Caption = "Edit tool", ;
		Command2.Height = 27, ;
		Command2.Left = 92, ;
		Command2.Name = "cmdEdit", ;
		Command2.Top = 4, ;
		Command2.Width = 84, ;
		Command3.Caption = "Delete tool", ;
		Command3.Height = 27, ;
		Command3.Left = 180, ;
		Command3.Name = "cmdDelete", ;
		Command3.Top = 4, ;
		Command3.Width = 84
		*< END OBJECT: BaseClass="commandgroup" />

	ADD OBJECT 'pgfDiff.pagDiffToolConfig.Label1' AS label WITH ;
		BackStyle = 0, ;
		Caption = "Config", ;
		Height = 17, ;
		Left = 15, ;
		Name = "Label1", ;
		TabIndex = 11, ;
		Top = 80, ;
		Width = 48
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'pgfDiff.pagDiffToolConfig.Label2' AS label WITH ;
		BackStyle = 0, ;
		Caption = "Path", ;
		Height = 17, ;
		Left = 15, ;
		Name = "Label2", ;
		TabIndex = 12, ;
		Top = 48, ;
		Width = 48
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'pgfDiff.pagDiffToolConfig.lbl_DiffTool' AS label WITH ;
		BackStyle = 0, ;
		Caption = "Diff tool", ;
		Height = 17, ;
		Left = 15, ;
		Name = "lbl_DiffTool", ;
		TabIndex = 10, ;
		Top = 16, ;
		Width = 48
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'pgfDiff.pagDiffToolConfig.txtDiffToolConfig' AS textbox WITH ;
		Anchor = 10, ;
		BorderColor = 0,128,192, ;
		Enabled = .F., ;
		Format = "T", ;
		Height = 23, ;
		Left = 63, ;
		MaxLength = 255, ;
		Name = "txtDiffToolConfig", ;
		SelectOnEntry = .T., ;
		SpecialEffect = 1, ;
		TabIndex = 4, ;
		ToolTipText = "Keywords: <<Filename1>>, <<Filename2>>", ;
		Top = 76, ;
		Width = 660
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'pgfDiff.pagDiffToolConfig.txtDiffToolPath' AS textbox WITH ;
		Anchor = 10, ;
		BorderColor = 0,128,192, ;
		Enabled = .F., ;
		Format = "T", ;
		Height = 23, ;
		Left = 63, ;
		MaxLength = 255, ;
		Name = "txtDiffToolPath", ;
		SelectOnEntry = .T., ;
		SpecialEffect = 1, ;
		TabIndex = 2, ;
		ToolTipText = "Keywords: <<FoxBin2PrgDir>>, <<ProgramFiles>>", ;
		Top = 44, ;
		Width = 628
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'pgfDiff.pagFilesDiff.chkShowCall' AS checkbox WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		BackStyle = 0, ;
		Caption = "Only show Diff call (for testing)", ;
		ControlSource = "THISFORM.l_ShowCallOnly", ;
		Height = 17, ;
		Left = 443, ;
		Name = "chkShowCall", ;
		TabIndex = 2, ;
		Top = 116, ;
		Value = .F., ;
		Width = 192
		*< END OBJECT: BaseClass="checkbox" />

	ADD OBJECT 'pgfDiff.pagFilesDiff.cmdDiff' AS commandbutton WITH ;
		Anchor = 8, ;
		Caption = "Diff", ;
		Height = 60, ;
		Left = 643, ;
		Name = "cmdDiff", ;
		TabIndex = 6, ;
		Top = 80, ;
		Width = 84
		*< END OBJECT: BaseClass="commandbutton" />

	ADD OBJECT 'pgfDiff.pagFilesDiff.cmdFile1' AS commandbutton WITH ;
		Anchor = 8, ;
		Caption = "...", ;
		Height = 27, ;
		Left = 667, ;
		Name = "cmdFile1", ;
		TabIndex = 2, ;
		Top = 10, ;
		Width = 28
		*< END OBJECT: BaseClass="commandbutton" />

	ADD OBJECT 'pgfDiff.pagFilesDiff.cmdFile2' AS commandbutton WITH ;
		Anchor = 8, ;
		Caption = "...", ;
		Height = 27, ;
		Left = 667, ;
		Name = "cmdFile2", ;
		TabIndex = 4, ;
		Top = 42, ;
		Width = 28
		*< END OBJECT: BaseClass="commandbutton" />

	ADD OBJECT 'pgfDiff.pagFilesDiff.lbl_DiffTool' AS label WITH ;
		BackStyle = 0, ;
		Caption = "Diff tool", ;
		Height = 17, ;
		Left = 11, ;
		Name = "lbl_DiffTool", ;
		TabIndex = 9, ;
		Top = 88, ;
		Width = 48
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'pgfDiff.pagFilesDiff.lbl_File1' AS label WITH ;
		BackStyle = 0, ;
		Caption = "File 1", ;
		Height = 17, ;
		Left = 11, ;
		Name = "lbl_File1", ;
		TabIndex = 7, ;
		Top = 16, ;
		Width = 36
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'pgfDiff.pagFilesDiff.lbl_File2' AS label WITH ;
		BackStyle = 0, ;
		Caption = "File 2", ;
		Height = 17, ;
		Left = 11, ;
		Name = "lbl_File2", ;
		TabIndex = 8, ;
		Top = 48, ;
		Width = 36
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'pgfDiff.pagFilesDiff.shpFile1' AS shape WITH ;
		Anchor = 8, ;
		BorderStyle = 0, ;
		Curvature = 10, ;
		Height = 23, ;
		Left = 699, ;
		Name = "shpFile1", ;
		SpecialEffect = 1, ;
		ToolTipText = "TXTStatus: Green=Unchanged, Yellow=Changed", ;
		Top = 12, ;
		Width = 24
		*< END OBJECT: BaseClass="shape" />

	ADD OBJECT 'pgfDiff.pagFilesDiff.shpFile2' AS shape WITH ;
		Anchor = 8, ;
		BorderStyle = 0, ;
		Curvature = 10, ;
		Height = 23, ;
		Left = 699, ;
		Name = "shpFile2", ;
		SpecialEffect = 1, ;
		ToolTipText = "TXTStatus: Green=Unchanged, Yellow=Changed", ;
		Top = 44, ;
		Width = 24
		*< END OBJECT: BaseClass="shape" />

	ADD OBJECT 'pgfDiff.pagFilesDiff.txtDiffToolName' AS textbox WITH ;
		Anchor = 10, ;
		BorderColor = 232,232,232, ;
		ControlSource = "THISFORM.diffToolName", ;
		Enabled = .F., ;
		Format = "T", ;
		Height = 23, ;
		Left = 63, ;
		MaxLength = 255, ;
		Name = "txtDiffToolName", ;
		SelectOnEntry = .T., ;
		SpecialEffect = 1, ;
		TabIndex = 5, ;
		Top = 84, ;
		Width = 564
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'pgfDiff.pagFilesDiff.txtFile1' AS textbox WITH ;
		Anchor = 10, ;
		BorderColor = 0,128,192, ;
		ControlSource = "THISFORM.filename1", ;
		Format = "T", ;
		Height = 23, ;
		Left = 63, ;
		MaxLength = 255, ;
		Name = "txtFile1", ;
		OLEDropMode = 1, ;
		SelectOnEntry = .T., ;
		SpecialEffect = 1, ;
		TabIndex = 1, ;
		Top = 12, ;
		Width = 600
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'pgfDiff.pagFilesDiff.txtFile2' AS textbox WITH ;
		Anchor = 10, ;
		BorderColor = 0,128,192, ;
		ControlSource = "THISFORM.filename2", ;
		Format = "T", ;
		Height = 23, ;
		Left = 63, ;
		MaxLength = 255, ;
		Name = "txtFile2", ;
		OLEDropMode = 1, ;
		SelectOnEntry = .T., ;
		SpecialEffect = 1, ;
		TabIndex = 3, ;
		Top = 44, ;
		Width = 600
		*< END OBJECT: BaseClass="textbox" />
	
	PROCEDURE Activate
		*-- activate
		THISFORM.updateGlobalEnabled()
		
	ENDPROC

	PROCEDURE cancel		&& Specifies if a CommandButton is the Cancel button.
		*-- cancel
		THISFORM.l_EditMode	= .F.
		THISFORM.updateGlobalEnabled()
		
		WITH THISFORM.pgfDiff.pagDiffToolConfig.cboDiffToolName
			.Style			= 2	&& Dropdown List
			.RowSourceType= 5
			.RowSource		= 'THISFORM.a_Tools'
			.ControlSource	= 'THISFORM.diffToolName'
			.Value			= THISFORM.diffToolName
			THISFORM.pgfDiff.pagDiffToolConfig.txtDiffToolConfig.Value	= THISFORM.diffToolConfig
			THISFORM.pgfDiff.pagDiffToolConfig.txtDiffToolPath.Value	= THISFORM.diffToolPath
			.SetFocus()
		ENDWITH
		
	ENDPROC

	PROCEDURE checkfilenames_dt
		LPARAMETERS tnFilename
		
		LOCAL laFile1(1,5), laFile2(1,5), ltFilename1_dt, ltFilename2_dt, lnCodError, lcMessage, lnIcon ;
			, lcFilename1, lcFilename2, lcExt, lcExt2, lcDir, lcFilename1_dt, lcFilename2_dt ;
			, loFB2P as c_foxbin2prg OF foxbin2prg.prg
		
		#DEFINE CR_LF CHR(13)+CHR(10)
		
		TRY
			lnCodError	= 0
			STORE '' TO lcMessage, lcFilename1, lcFilename2, lcExt, lcExt2, lcDir
			loFB2P		= THIS.oFB2P
			tnFilename	= EVL(tnFilename, 0)
		
			DO CASE
			CASE INLIST(tnFilename, 0, 1) AND EMPTY(THIS.filename1)
				EXIT
			CASE INLIST(tnFilename, 0, 2) AND EMPTY(THIS.filename2)
				EXIT
			ENDCASE
		
			IF INLIST(tnFilename, 0, 1) THEN
				lcExt			= JUSTEXT(THIS.filename1)
				lcDir			= JUSTPATH(THIS.filename1)
				lcExt2			= loFB2P.get_Ext2FromExt( lcExt, lcDir )
				lcFilename1		= FORCEEXT( THIS.filename1, lcExt2 )
		
				IF ADIR(laFile1, lcFilename1) = 1 THEN
					lcFilename1_dt	= '{^' + TRANSFORM( DTOS( laFile1(1,3) ), '@R ####/##/##' ) + ' ' + laFile1(1,4) + '}'
					ltFilename1_dt	= EVALUATE( lcFilename1_dt )
		
					DO CASE
					CASE EMPTY(THIS.filename1_dt)
						THIS.filename1_dt	= ltFilename1_dt
						THIS.pgfDiff.pagFilesDiff.shpFile1.BackColor= THIS.colorGreen
						THIS.lastFilename1	= THIS.filename1
		
					CASE NOT THIS.filename1 == THIS.lastFilename1
						THIS.filename1_dt	= ltFilename1_dt
						THIS.pgfDiff.pagFilesDiff.shpFile1.BackColor= THIS.colorGreen
						THIS.lastFilename1	= THIS.filename1
		
					CASE THIS.filename1_dt <> ltFilename1_dt
						THIS.pgfDiff.pagFilesDiff.shpFile1.BackColor= THIS.colorYellow
		
					OTHERWISE
						THIS.pgfDiff.pagFilesDiff.shpFile1.BackColor= THIS.colorGreen
		
					ENDCASE
				ENDIF
		
			ENDIF
		
			IF INLIST(tnFilename, 0, 2) THEN
				lcExt			= JUSTEXT(THIS.filename2)
				lcDir			= JUSTPATH(THIS.filename2)
				lcExt2			= loFB2P.get_Ext2FromExt( lcExt, lcDir )
				lcFilename2		= FORCEEXT( THIS.filename2, lcExt2 )
		
				IF ADIR(laFile2, lcFilename2) = 1 THEN
					lcFilename2_dt	= '{^' + TRANSFORM( DTOS( laFile2(1,3) ), '@R ####/##/##' ) + ' ' + laFile2(1,4) + '}'
					ltFilename2_dt	= EVALUATE( lcFilename2_dt )
		
					DO CASE
					CASE EMPTY(THIS.filename2_dt)
						THIS.filename2_dt	= ltFilename2_dt
						THIS.pgfDiff.pagFilesDiff.shpFile2.BackColor= THIS.colorGreen
						THIS.lastFilename2	= THIS.filename2
		
					CASE NOT THIS.filename2 == THIS.lastFilename2
						THIS.filename2_dt	= ltFilename2_dt
						THIS.pgfDiff.pagFilesDiff.shpFile2.BackColor= THIS.colorGreen
						THIS.lastFilename2	= THIS.filename2
		
					CASE THIS.filename2_dt <> ltFilename2_dt
						THIS.pgfDiff.pagFilesDiff.shpFile2.BackColor= THIS.colorYellow
		
					OTHERWISE
						THIS.pgfDiff.pagFilesDiff.shpFile2.BackColor= THIS.colorGreen
		
					ENDCASE
				ENDIF
			ENDIF
		
		CATCH TO loEx
			lnCodError	= loEx.ErrorNo
			lnIcon		= 16
			*IF NOT EMPTY(loEx.UserValue)
				loEx.UserValue	= CR_LF ;
					+ 'lcDir = ' + TRANSFORM(lcDir) + CR_LF ;
					+ 'lcExt = ' + TRANSFORM(lcExt) + CR_LF ;
					+ 'lcExt2 = ' + TRANSFORM(lcExt2) + CR_LF ;
					+ 'tnFilename = ' + TRANSFORM(tnFilename) + CR_LF ;
					+ 'filename1 = "' + THIS.filename1 + '"' + CR_LF ;
					+ 'lcFilename1 = "' + lcFilename1 + '"' + CR_LF ;
					+ 'lcFilename1_dt = ' + TRANSFORM(lcFilename1_dt) + CR_LF ;
					+ 'laFile1(1,3) = ' + TRANSFORM(laFile1(1,3)) + CR_LF ;
					+ 'laFile1(1,4) = ' + TRANSFORM(laFile1(1,4)) + CR_LF ;
					+ 'filename2 = "' + THIS.filename2 + '"' + CR_LF ;
					+ 'lcFilename2 = "' + lcFilename2 + '"' + CR_LF ;
					+ 'lcFilename2_dt = ' + TRANSFORM(lcFilename2_dt) + CR_LF ;
					+ 'laFile2(1,3) = ' + TRANSFORM(laFile2(1,3)) + CR_LF ;
					+ 'laFile2(1,4) = ' + TRANSFORM(laFile2(1,4)) + CR_LF
			*ENDIF
			TEXT TO lcMessage TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2+4
				Error <<loEx.ErrorNo>>, <<loEx.Message>>
				Procedure <<loEx.Procedure>>, Line <<loEx.LineNo>>
				LineContents: <<loEx.LineContents>>
				Details: <<loEx.Details>>
				UserValue: <<loEx.UserValue>>
			ENDTEXT
		
		FINALLY
			IF lnCodError > 0 THEN
				MESSAGEBOX( lcMessage, 0+lnIcon, 'FoxBin2Prg checkFilenames_dt' )
			ENDIF
		
		ENDTRY
		
		#UNDEF CR_LF
		
	ENDPROC

	PROCEDURE create_default_cfg
		*-- create_Default_CFG
		LOCAL lcPath
		
		lcPath	= EVL( JUSTPATH(THISFORM.c_CFG_File), JUSTPATH(SYS(16)) )
		
		IF LEFT(lcPath,10) == 'PROCEDURE ' THEN
			lcPath	= SUBSTR( lcPath, AT(' ', lcPath, 2) + 1 )
		ENDIF
		
		*-- Configuración de Herramientas DIFF predefinidas
		THIS.n_ToolCount	= 1
		DIMENSION THIS.a_Tools( THIS.n_ToolCount, 3 )
		THIS.a_Tools( THIS.n_ToolCount, 1 )	= 'WinMergePortable'
		THIS.a_Tools( THIS.n_ToolCount, 2 )	= '/e /x /u /maximize <<filename1>> <<filename2>>'
		THIS.a_Tools( THIS.n_ToolCount, 3 )	= '<<FoxBin2PrgDir>>WinMergePortable\WinMergePortable.exe'
		
		THIS.n_ToolCount	= 2
		DIMENSION THIS.a_Tools( THIS.n_ToolCount, 3 )
		THIS.a_Tools( THIS.n_ToolCount, 1 )	= 'Beyond Compare 2'
		THIS.a_Tools( THIS.n_ToolCount, 2 )	= '<<filename1>> <<filename2>>'
		THIS.a_Tools( THIS.n_ToolCount, 3 )	= '<<ProgramFiles>>Beyond Compare 2\BC2.exe'
		
		*--
		THIS.diffToolName	= THIS.a_Tools( 1, 1 )
		THIS.diffToolConfig	= THIS.a_Tools( 1, 2 )
		THIS.diffToolPath	= THIS.a_Tools( 1, 3 )
		THIS.save_CFG_Data()
		THIS.diffToolCombo_Refresh()
		THIS.diffToolChanged()
		THIS.Refresh()
		
	ENDPROC

	PROCEDURE deletetool
		*-- deleteTool
		LOCAL locboDiffToolName as ComboBox, loTxtDiffToolCfg as TextBox, loTxtDiffToolPath as TextBox, lnListIndex
		
		locboDiffToolName		= THIS.pgfDiff.pagDiffToolConfig.cboDiffToolName
		loTxtDiffToolCfg		= THIS.pgfDiff.pagDiffToolConfig.txtDiffToolConfig
		loTxtDiffToolPath		= THIS.pgfDiff.pagDiffToolConfig.txtDiffToolPath
		
		IF MESSAGEBOX( '¿Confirm Delete?',4+32+256+4096, 'FoxBin2Prg: Delete tool config' ) = 6 THEN
		
			IF THIS.n_ToolCount > 0 THEN
				lnListIndex			= locboDiffToolName.ListIndex
				THIS.n_ToolCount	= THIS.n_ToolCount - 1
		
				IF THIS.n_ToolCount > 0 THEN
					ADEL(THIS.a_Tools, lnListIndex)
					DIMENSION THIS.a_Tools( THIS.n_ToolCount, 3 )
				ELSE
					THIS.a_Tools	= ''
				ENDIF
		
				IF THIS.n_ToolCount > 0 THEN
					IF lnListIndex > THIS.n_ToolCount THEN
						lnListIndex	= THIS.n_ToolCount
					ENDIF
					locboDiffToolName.ListIndex	= lnListIndex
					THIS.diffToolConfig		= THIS.a_Tools(lnListIndex,2)
					THIS.diffToolPath		= THIS.a_Tools(lnListIndex,3)
					loTxtDiffToolCfg.Value	= THIS.diffToolConfig
					loTxtDiffToolPath.Value	= THIS.diffToolPath
				ELSE
					locboDiffToolName.ListIndex	= 0
					THIS.diffToolName		= ''
					THIS.diffToolPath		= ''
					THIS.diffToolConfig		= ''
					loTxtDiffToolCfg.Value	= ''
					loTxtDiffToolPath.Value	= ''
				ENDIF
		
				locboDiffToolName.RowSource		= locboDiffToolName.RowSource
				locboDiffToolName.Refresh()
				THIS.save_CFG_Data()
				THIS.updateGlobalEnabled()
			ENDIF
		ENDIF
		
	ENDPROC

	PROCEDURE Destroy
		*-- destroy
		THIS.oFB2P = NULL
		
		IF _VFP.StartMode = 0 THEN
			lcFB2P_App	= 'foxbin2prg.prg'
		ELSE
			lcFB2P_App	= 'foxbin2prg.exe'
		ENDIF
		
		DO CASE
		CASE ATC( lcFB2P_App, SET("Procedure") ) > 0
			RELEASE PROCEDURE (lcFB2P_App)
		CASE ATC( FORCEEXT(lcFB2P_App, 'FXP'), SET("Procedure") ) > 0
			RELEASE PROCEDURE (FORCEEXT(lcFB2P_App, 'FXP'))
		ENDCASE
		
	ENDPROC

	PROCEDURE difftoolchanged
		*-- diffToolChanged
		
		WITH THISFORM.pgfDiff.pagDiffToolConfig.cboDiffToolName
			IF .ListCount > 0 THEN
				THISFORM.diffToolConfig			= THISFORM.a_Tools(.ListIndex,2)
				THISFORM.diffToolPath			= THISFORM.a_Tools(.ListIndex,3)
				THISFORM.n_SelectedToolIndex	= .ListIndex
				.Parent.txtDiffToolConfig.Value	= THISFORM.diffToolConfig
				.Parent.txtDiffToolPath.Value	= THISFORM.diffToolPath
			ENDIF
		ENDWITH
		
	ENDPROC

	PROCEDURE difftoolcombo_refresh
		WITH THIS.pgfDiff.pagDiffToolConfig.cboDiffToolName
			IF THIS.l_EditMode THEN
				.Clear()
				.ControlSource	= ''
				.RowSourceType	= 1	&& Value
				.RowSource		= ''
				.Style			= 0	&& Dropdown Combo
				.AddItem(THIS.diffToolName)
				.Value			= THIS.diffToolName
				.SelectOnEntry	= .T.
			ELSE
				.Style			= 2	&& Dropdown List
				.RowSourceType	= 5	&& Array
				.RowSource		= 'THISFORM.a_Tools'
				.ControlSource	= 'THISFORM.diffToolName'
				.Value			= THIS.diffToolName
				
				IF .ListIndex > THIS.n_ToolCount THEN
					.ListIndex = THIS.n_ToolCount
				ENDIF
		
				THIS.n_SelectedToolIndex	= .ListIndex
			ENDIF
		ENDWITH
		
	ENDPROC

	PROCEDURE edittool
		*-- editTool
		
		THISFORM.l_EditMode	= .T.
		THISFORM.updateGlobalEnabled()
		
		WITH THISFORM.pgfDiff.pagDiffToolConfig.cboDiffToolName
			THISFORM.diffToolCombo_Refresh()
			.SetFocus()
		ENDWITH
		
	ENDPROC

	PROCEDURE filesdiff
		*-- filesDiff
		
		LOCAL laFile(1,5), lcMessage, lnIcon, lcFilename1, lcFilename2, lcDiffToolConfig ;
			, llAlwaysOnTop, lnCodError, lcDiffToolPath ;
			, loShell AS WScript.Shell ;
			, loEx as Exception ;
			, loFB2P as c_foxbin2prg OF foxbin2prg.prg
		
		#DEFINE CR_LF CHR(13)+CHR(10)
		
		TRY
			loFB2P			= THIS.oFB2P
			lnCodError		= 0
		
			WITH THISFORM as Form
				llAlwaysOnTop		= .AlwaysOnTop
				lcFilename1			= '"' + FORCEEXT( .filename1, loFB2P.get_Ext2FromExt( JUSTEXT(.filename1), JUSTPATH(.filename1) ) ) + '"'
				lcFilename2			= '"' + FORCEEXT( .filename2, loFB2P.get_Ext2FromExt( JUSTEXT(.filename2), JUSTPATH(.filename2) ) ) + '"'
		
				lcDiffToolConfig	= THIS.diffToolConfig
				lcDiffToolConfig	= STRTRAN( lcDiffToolConfig, '<<filename1>>', '<<lcFilename1>>', 1, 1, 1 )
				lcDiffToolConfig	= STRTRAN( lcDiffToolConfig, '<<filename2>>', '<<lcFilename2>>', 1, 1, 1 )
				lcDiffToolConfig	= TEXTMERGE(lcDiffToolConfig)
				
				lcDiffToolPath		= '"' + THISFORM.diffToolPath + '"'
				lcDiffToolPath		= STRTRAN( lcDiffToolPath, '<<ProgramFiles>>', '<<ADDBS(GETENV("ProgramFiles"))>>', 1, 1, 1 )
				lcDiffToolPath		= STRTRAN( lcDiffToolPath, '<<FoxBin2PrgDir>>', '<<ADDBS(JUSTPATH(loFB2P.c_Foxbin2prg_FullPath))>>', 1, 1, 1 )
				lcDiffToolPath		= TEXTMERGE(lcDiffToolPath)
		
				IF THISFORM.l_ShowCallOnly THEN
					MESSAGEBOX( lcDiffToolPath + ' ' + lcDiffToolConfig )
					EXIT
				ENDIF
		
				IF ADIR(laFile, .Filename1) = 0 THEN
					lcMessage	= 'File not found'
					ERROR lcMessage + ': [' + .Filename1 + ']'
				ENDIF
		
				IF ADIR(laFile, .Filename2) = 0 THEN
					lcMessage	= 'File not found'
					ERROR lcMessage + ': [' + .Filename2 + ']'
				ENDIF
		
				IF ADIR(laFile, lcDiffToolPath) = 0 THEN
					lcMessage	= 'File not found'
					ERROR lcMessage + ': [' + lcDiffToolPath + ']'
				ENDIF
				
				IF NOT loFB2P.hasSupport_Bin2Prg( .filename1 )
					lcMessage	= 'File type not supported'
					ERROR lcMessage + ': [' + .filename1 + ']'
				ENDIF
				
				lcMessage	= 'File is in use [' + .filename1 + ']'
				USE (.filename1) EXCLUSIVE
				USE
		
				IF NOT loFB2P.hasSupport_Bin2Prg( .filename2 )
					lcMessage	= 'File type not supported'
					ERROR lcMessage + ': [' + .filename1 + ']'
				ENDIF
		
				lcMessage	= 'File is in use [' + .filename2 + ']'
				USE (.filename2) EXCLUSIVE
				USE
		
				lcMessage			= .Filename1
				loFB2P.execute( .Filename1, '', '', '', '1', '0', '0', NULL, NULL, .T. )
		
				lcMessage			= .Filename2
				loFB2P.execute( .Filename2, '', '', '', '1', '0', '0', NULL, NULL, .T. )
		
				lcMessage			= ''
		
				IF llAlwaysOnTop THEN
					THIS.AlwaysOnTop	= .F.
				ENDIF
				
				loShell				= CREATEOBJECT('WScript.Shell')
		
				THIS.filename1_dt	= {//::}
				THIS.filename2_dt	= {//::}
				THIS.checkFilenames_dt()
		
				lnResp				= loShell.Run( lcDiffToolPath + ' ' + lcDiffToolConfig, 1, 1)
		
				IF lnResp = 0 THEN
					*-- OK
					THIS.checkFilenames_dt()
				ELSE
					MESSAGEBOX( 'DIFF operation returned the code ' + TRANSFORM(lnResp), 0+48, 'FoxBin2Prg: Diff VFP 9 binary files' )
				ENDIF
				
				*THIS.lastFilename1	= THIS.filename1
				*THIS.lastFilename2	= THIS.filename2
		
			ENDWITH
		
		CATCH TO loEx WHEN loEx.ErrorNo = 3
			lnCodError	= loEx.ErrorNo
			lnIcon		= 48
		
		CATCH TO loEx WHEN loEx.ErrorNo = 1098
			lnCodError	= loEx.ErrorNo
			lnIcon		= 48
			lcMessage	= loEx.Message
		
		CATCH TO loEx
			lnCodError	= loEx.ErrorNo
			lnIcon		= 16
			IF NOT EMPTY(lcMessage)
				loEx.UserValue	= lcMessage
			ENDIF
			TEXT TO lcMessage TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2+4
				Error <<loEx.ErrorNo>>, <<loEx.Message>>
				Procedure <<loEx.Procedure>>, Line <<loEx.LineNo>>
				LineContents: <<loEx.LineContents>>
				Details: <<loEx.Details>>
				UserValue: <<loEx.UserValue>>
			ENDTEXT
		
		FINALLY
			IF lnCodError > 0 THEN
				MESSAGEBOX( lcMessage, 0+lnIcon, 'FoxBin2Prg Diff Status' )
			ENDIF
		
			THIS.AlwaysOnTop	= llAlwaysOnTop
			STORE NULL TO loShell, loFB2P
			RELEASE loShell, loFB2P
		ENDTRY
		
		#UNDEF CR_LF
		
		RETURN
		
	ENDPROC

	PROCEDURE Init
		LOCAL lcSys16, lnPosProg
		
		*-- init
		THISFORM.MinHeight	= THISFORM.Height
		THISFORM.MaxHeight	= THISFORM.Height
		THISFORM.MinWidth	= THISFORM.Width
		
		THISFORM.a_Tools	= ''
		
		lcSys16 = SYS(16)
		IF LEFT(lcSys16,10) == 'PROCEDURE '
			lnPosProg	= AT(" ", lcSys16, 2) + 1
		ELSE
			lnPosProg	= 1
		ENDIF
		
		THIS.c_CurDir				= SYS(5) + CURDIR()		&& Directorio actual, que no necesariamente es donde está FoxBin2Prg
		THIS.c_fb2p_diff_FullPath	= SUBSTR( lcSys16, lnPosProg )
		THIS.c_CFG_File				= FORCEEXT( THIS.c_fb2p_diff_FullPath, 'CFG' )
		
	ENDPROC

	PROCEDURE initialize
		*-- initialize
		LOCAL lcFB2P_App
		
		IF VARTYPE(THIS.oFB2P) <> "O" OR ISNULL(THIS.oFB2P)
			IF _VFP.StartMode = 0 THEN
				lcFB2P_App	= 'foxbin2prg.prg'
			ELSE
				lcFB2P_App	= 'foxbin2prg.exe'
			ENDIF
		
			SET PROCEDURE TO (lcFB2P_App)
			THIS.oFB2P	= CREATEOBJECT('c_foxbin2prg')
		ENDIF
		
		THIS.load_CFG_Data()
		THIS.diffToolCombo_Refresh()
		THIS.diffToolChanged()
		THIS.updateGlobalEnabled()
		
	ENDPROC

	PROCEDURE load_cfg_data
		*-- load_CFG_Data
		LOCAL laFile(1,5), llCreateNewCFGFile, I, lcDiffTool
		
		#DEFINE CR_LF	CHR(13) + CHR(10)
		
		*-- Estructura de CFG_Data:
		*-- <tool>tool-name</tool><config>tool-config</config>
		*-- <tool>tool-name</tool><config>tool-config</config>
		*-- <default_tool>tool-name</default_tool>
		
		IF ADIR(laFile, THIS.c_CFG_File) = 1
			THIS.c_CFG_Data	= FILETOSTR( THIS.c_CFG_File )
		
			DO CASE
			CASE EMPTY(THIS.c_CFG_Data) OR EMPTY( STREXTRACT(THIS.c_CFG_Data, '<name>', '</name>', 1, 1) )
				llCreateNewCFGFile	= .T.
			CASE EMPTY( STREXTRACT(THIS.c_CFG_Data, '<default_tool>', '</default_tool>', 1, 1) )
				THIS.diffToolName	= STREXTRACT(THIS.c_CFG_Data, '<name>', '</name>', 1, 1)
				THIS.c_CFG_Data	= THIS.c_CFG_Data + CR_LF + '<default_tool>' + THIS.diffToolName + '</default_tool>'
				THIS.save_CFG_Data()
			OTHERWISE
				THIS.diffToolName	= STREXTRACT(THIS.c_CFG_Data, '<default_tool>', '</default_tool>', 1, 1)
			ENDCASE
		ELSE
			llCreateNewCFGFile	= .T.
		ENDIF
		
		*-- Si no hay CFG, creo uno por defecto
		IF llCreateNewCFGFile
			THIS.create_Default_CFG()
		ENDIF
		
		*-- Lo cargo en el combobox
		THIS.diffToolName		= STREXTRACT(THIS.c_CFG_Data, '<default_tool>', '</default_tool>', 1, 1)
		THIS.n_ToolCount	= 0
		
		FOR I = 1 TO OCCURS('<difftool>', THIS.c_CFG_Data )
			THIS.n_ToolCount	= THIS.n_ToolCount + 1
			DIMENSION THIS.a_Tools( THIS.n_ToolCount, 3 )
			lcDiffTool	= STREXTRACT(THIS.c_CFG_Data, '<difftool>', '</difftool>', I, 1)
			THIS.a_Tools( THIS.n_ToolCount, 1 )	= STREXTRACT(lcDiffTool, '<name>', '</name>', 1, 1)
			THIS.a_Tools( THIS.n_ToolCount, 2 )	= STREXTRACT(lcDiffTool, '<config>', '</config>', 1, 1)
			THIS.a_Tools( THIS.n_ToolCount, 3 )	= STREXTRACT(lcDiffTool, '<path>', '</path>', 1, 1)
		
			IF EMPTY(THIS.diffToolConfig) AND THIS.a_Tools( THIS.n_ToolCount, 1 ) == THIS.diffToolName THEN
				THIS.diffToolConfig	= THIS.a_Tools( THIS.n_ToolCount, 2 )
			ENDIF
		
			IF EMPTY(THIS.diffToolPath) AND THIS.a_Tools( THIS.n_ToolCount, 1 ) == THIS.diffToolName THEN
				THIS.diffToolPath	= THIS.a_Tools( THIS.n_ToolCount, 3 )
			ENDIF
		ENDFOR
		
		#UNDEF CR_LF
		
	ENDPROC

	PROCEDURE newtool
		*-- newTool
		
		THISFORM.l_EditMode	= .T.
		THISFORM.updateGlobalEnabled()
		
		WITH THISFORM.pgfDiff.pagDiffToolConfig.cboDiffToolName
			.RowSourceType= 0
			.RowSource		= ''
			.ControlSource	= ''
			.Style			= 0	&& Dropdown Combo
			.Value			= ''
			.SetFocus()
		ENDWITH
		
		THISFORM.pgfDiff.pagDiffToolConfig.txtDiffToolConfig.Value	= ''
		THISFORM.pgfDiff.pagDiffToolConfig.txtDiffToolPath.Value	= ''
		
	ENDPROC

	PROCEDURE QueryUnload
		CLEAR EVENTS
		
	ENDPROC

	PROCEDURE resetalltools
		*-- resetAllTools
		THIS.cancel()
		THIS.create_Default_CFG()
		THIS.initialize()
		THIS.updateGlobalEnabled()
		
	ENDPROC

	PROCEDURE savetool
		*-- saveTool
		LOCAL lnItem
		
		THIS.l_EditMode	= .F.
		THIS.updateGlobalEnabled()
		
		WITH THIS.pgfDiff.pagDiffToolConfig.cboDiffToolName
			THIS.diffToolName	= .Text
			THIS.diffToolConfig	= THIS.pgfDiff.pagDiffToolConfig.txtDiffToolConfig.Value
			THIS.diffToolPath	= THIS.pgfDiff.pagDiffToolConfig.txtDiffToolPath.Value
			
			IF THIS.n_EditOption = 1 THEN
				*-- New tool
				THIS.n_ToolCount	= THIS.n_ToolCount + 1
				DIMENSION THIS.a_Tools( THIS.n_ToolCount, 3 )
				lnItem	= THIS.n_ToolCount
			ELSE
				*-- Edit tool
				lnItem	= THIS.n_SelectedToolIndex
			ENDIF
		
			THIS.a_Tools( lnItem, 1 )	= THIS.diffToolName
			THIS.a_Tools( lnItem, 2 )	= THIS.diffToolConfig
			THIS.a_Tools( lnItem, 3 )	= THIS.diffToolPath
			THIS.diffToolCombo_Refresh()
			.SetFocus()
		
			THIS.n_SelectedToolIndex	= .ListIndex
			THIS.save_CFG_Data()
			THIS.updateGlobalEnabled()
		ENDWITH
		
	ENDPROC

	PROCEDURE save_cfg_data
		*-- save_CFG_Data
		LOCAL I
		
		#DEFINE CR_LF	CHR(13) + CHR(10)
		
		THIS.c_CFG_Data	= ''
		
		TEXT TO THISFORM.c_CFG_Data ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2+4
			<<>><difftools>
		ENDTEXT
		
		FOR I = 1 TO THIS.n_ToolCount
			TEXT TO THISFORM.c_CFG_Data ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2+4
				<<>>	<difftool>
				<<>>		<name><<ALLTRIM(THIS.a_Tools(I,1))>></name>
				<<>>		<path><<ALLTRIM(THIS.a_Tools(I,3))>></path>
				<<>>		<config><<ALLTRIM(THIS.a_Tools(I,2))>></config>
				<<>>	</difftool>
			ENDTEXT
		ENDFOR
		
		IF EMPTY(THIS.diffToolName) THEN
			IF NOT EMPTY(THIS.a_Tools(1,1)) THEN
				TEXT TO THISFORM.c_CFG_Data ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2+4
					<<>>	<default_tool><<ALLTRIM(THIS.a_Tools(1,1))>></default_tool>
				ENDTEXT
			ENDIF
		ELSE
			TEXT TO THISFORM.c_CFG_Data ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2+4
				<<>>	<default_tool><<ALLTRIM(THIS.diffToolName)>></default_tool>
			ENDTEXT
		ENDIF
		
		TEXT TO THISFORM.c_CFG_Data ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2+4
			<<>></difftools>
		ENDTEXT
		
		STRTOFILE( THIS.c_CFG_Data, THIS.c_CFG_File )
		
		#UNDEF CR_LF
		
	ENDPROC

	PROCEDURE updateglobalenabled
		*-- updateGlobalEnabled
		LOCAL lopagFilesDiff as Page, loPagConfig as Page, cmgPanel as CommandGroup
		
		WITH THIS AS Form
			lopagFilesDiff	= .pgfDiff.pagFilesDiff
			loPagConfig	= .pgfDiff.pagDiffToolConfig
			cmgPanel	= loPagConfig.cmgEditPanel
		
			*-- Edit?
			loPagConfig.txtDiffToolConfig.Enabled	= .l_EditMode
			loPagConfig.txtDiffToolPath.Enabled		= .l_EditMode
			cmgPanel.cmdNew.Enabled					= NOT .l_EditMode
			cmgPanel.cmdEdit.Enabled				= NOT .l_EditMode AND .n_ToolCount > 0
			cmgPanel.cmdDelete.Enabled				= NOT .l_EditMode AND .n_ToolCount > 0
			loPagConfig.cmdDiffToolPath.Enabled		= .l_EditMode
			loPagConfig.cmdSetDefault.Enabled		= NOT .l_EditMode AND .n_ToolCount > 0
			loPagConfig.cmdSave.Enabled				= .l_EditMode
			loPagConfig.cmdCancel.Enabled			= .l_EditMode
			lopagFilesDiff.Enabled						= NOT .l_EditMode
		
			*-- cmdDiff
			lopagFilesDiff.cmdDiff.Enabled 				= NOT .l_EditMode ;
				AND NOT EMPTY(.filename1) AND NOT EMPTY(.filename2) ;
				AND NOT .filename1 == .filename2 ;
				AND NOT EMPTY(.diffToolName) AND NOT EMPTY(.diffToolPath) AND NOT EMPTY(.diffToolConfig)
		
			THIS.checkFilenames_dt()
		ENDWITH && THISFORM
		
	ENDPROC

	PROCEDURE pgfDiff.pagDiffToolConfig.Activate
		THISFORM.updateGlobalEnabled()
		THIS.cboDiffToolName.SetFocus()
		
	ENDPROC

	PROCEDURE pgfDiff.pagDiffToolConfig.cboDiffToolName.DropDown
		IF THISFORM.l_EditMode OR THIS.ListCount = 0 THEN
			NODEFAULT
		ENDIF
		
	ENDPROC

	PROCEDURE pgfDiff.pagDiffToolConfig.cboDiffToolName.InteractiveChange
		IF NOT THISFORM.l_EditMode
			THISFORM.diffToolChanged()
		ENDIF
		
	ENDPROC

	PROCEDURE pgfDiff.pagDiffToolConfig.cmdCancel.Click
		THISFORM.cancel()
		
	ENDPROC

	PROCEDURE pgfDiff.pagDiffToolConfig.cmdDiffToolPath.Click
		LOCAL lcFile
		
		lcFile = GETFILE('exe')
		
		IF NOT EMPTY(lcFile) THEN
			THIS.Parent.txtDiffToolPath.Value		= lcFile
			THIS.Parent.txtDiffToolPath.Refresh()
			*THISFORM.updateGlobalEnabled()
		ENDIF
		
	ENDPROC

	PROCEDURE pgfDiff.pagDiffToolConfig.cmdResetAll.Click
		THISFORM.resetAllTools()
		
	ENDPROC

	PROCEDURE pgfDiff.pagDiffToolConfig.cmdSave.Click
		THISFORM.saveTool()
		
	ENDPROC

	PROCEDURE pgfDiff.pagDiffToolConfig.cmdSetDefault.Click
		THISFORM.save_CFG_Data()
		
	ENDPROC

	PROCEDURE pgfDiff.pagDiffToolConfig.cmgEditPanel.cmdDelete.Click
		THISFORM.deleteTool()
		
	ENDPROC

	PROCEDURE pgfDiff.pagDiffToolConfig.cmgEditPanel.cmdEdit.Click
		THISFORM.editTool()
		
	ENDPROC

	PROCEDURE pgfDiff.pagDiffToolConfig.cmgEditPanel.cmdNew.Click
		THISFORM.newTool()
		
	ENDPROC

	PROCEDURE pgfDiff.pagFilesDiff.Activate
		THISFORM.updateGlobalEnabled()
		THIS.txtFile1.SetFocus()
		*THIS.txtDiffToolName.Refresh()
		
	ENDPROC

	PROCEDURE pgfDiff.pagFilesDiff.cmdDiff.Click
		THISFORM.filesDiff()
		
	ENDPROC

	PROCEDURE pgfDiff.pagFilesDiff.cmdFile1.Click
		LOCAL lcFile
		
		lcFile = GETFILE('scx;vcx;mnx;pjx;frx;lbx;dbc;dbf')
		
		IF NOT EMPTY(lcFile) THEN
			THISFORM.filename1		= lcFile
			THIS.Parent.txtFile1.Refresh()
			THISFORM.updateGlobalEnabled()
		ENDIF
		
	ENDPROC

	PROCEDURE pgfDiff.pagFilesDiff.cmdFile2.Click
		LOCAL lcFile
		
		lcFile = GETFILE('scx;vcx;mnx;pjx;frx;lbx;dbc;dbf')
		
		IF NOT EMPTY(lcFile) THEN
			THISFORM.filename2		= lcFile
			THIS.Parent.txtFile2.Refresh()
			THISFORM.updateGlobalEnabled()
		ENDIF
		
	ENDPROC

	PROCEDURE pgfDiff.pagFilesDiff.txtFile1.InteractiveChange
		THISFORM.updateGlobalEnabled()
		
	ENDPROC

	PROCEDURE pgfDiff.pagFilesDiff.txtFile1.OLEDragDrop
		LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord
		LOCAL aValues, i, cText, nOperation
		
		*-- Check to see whether the user wants to copy or move
		*IF nShift == 1
			nOperation = 1	&&DROPEFFECT_COPY
		*ELSE
		*	nOperation = 2	&&DROPEFFECT_MOVE
		*ENDIF
		
		*Thisform.LockScreen = .T.
		
		DO CASE
		CASE oDataObject.GetFormat(1)		&& Text
			cText = oDataObject.GetData(1)
		
			*-- Add the text as a new item in the list
			*This.AddItem( cText )
			*? 2, cText
		
		CASE oDataObject.GetFormat(15)	&& Files CF_DROP
			DIMENSION aValues[1]
			oDataObject.GetData(15, @aValues )
			
			*-- Add each filename as a new item in the list
		*!*		FOR i = 1 to alen(aValues)
		*!*			This.AddItem(aValues[m.i])
		*!*		NEXT
			*? 3, aValues[1]
			THIS.Value	= aValues[1]
		ENDCASE
		
		*Thisform.LockScreen = .F.
		
		*-- Set the nEffect parameter for communication back to the source object
		nEffect = nOperation
		*NODEFAULT
		THISFORM.updateGlobalEnabled()
		
	ENDPROC

	PROCEDURE pgfDiff.pagFilesDiff.txtFile1.OLEDragOver
		LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState
		
		DO CASE
		CASE nState == 0		&&DRAG_ENTER
			DO CASE
			*CASE oDataObject.GetFormat("OLE Variant Array")	&& Array
			*	This.OLEDropHasData = 1		&&DROPHASDATA_USEFUL
			*	This.OLEDropEffects = 1+2	&&DROPEFFECT_COPY + DROPEFFECT_MOVE
				
			CASE oDataObject.GetFormat(1)				&& Text
				This.OLEDropHasData = 1		&&DROPHASDATA_USEFUL
				This.OLEDropEffects = 1+2	&&DROPEFFECT_COPY + DROPEFFECT_MOVE
				
			CASE oDataObject.GetFormat(15)				&& Files CF_HDROP
				This.OLEDropHasData = 1		&&DROPHASDATA_USEFUL
				*This.OLEDropEffects = 4		&&DROPEFFECT_LINK
				This.OLEDropEffects = 1		&&DROPEFFECT_COPY
			OTHERWISE
				This.OLEDropHasData = 0		&&DROPHASDATA_NOTUSEFUL
			ENDCASE
		
		CASE nState == 1	&& Drag Leave
		CASE nState == 2	&& Drag Over
		ENDCASE
		
	ENDPROC

	PROCEDURE pgfDiff.pagFilesDiff.txtFile1.Valid
		THISFORM.updateGlobalEnabled()
		*THISFORM.checkFilenames_dt(1)
		THIS.Refresh()
		
	ENDPROC

	PROCEDURE pgfDiff.pagFilesDiff.txtFile2.InteractiveChange
		THISFORM.updateGlobalEnabled()
		
	ENDPROC

	PROCEDURE pgfDiff.pagFilesDiff.txtFile2.OLEDragDrop
		LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord
		LOCAL aValues, i, cText, nOperation
		
		*-- Check to see whether the user wants to copy or move
		*IF nShift == 1
			nOperation = 1	&&DROPEFFECT_COPY
		*ELSE
		*	nOperation = 2	&&DROPEFFECT_MOVE
		*ENDIF
		
		*Thisform.LockScreen = .T.
		
		DO CASE
		CASE oDataObject.GetFormat(1)		&& Text
			cText = oDataObject.GetData(1)
		
			*-- Add the text as a new item in the list
			*This.AddItem( cText )
			*? 2, cText
		
		CASE oDataObject.GetFormat(15)	&& Files CF_DROP
			DIMENSION aValues[1]
			oDataObject.GetData(15, @aValues )
			
			*-- Add each filename as a new item in the list
		*!*		FOR i = 1 to alen(aValues)
		*!*			This.AddItem(aValues[m.i])
		*!*		NEXT
			*? 3, aValues[1]
			THIS.Value	= aValues[1]
		ENDCASE
		
		*Thisform.LockScreen = .F.
		
		*-- Set the nEffect parameter for communication back to the source object
		nEffect = nOperation
		*NODEFAULT
		THISFORM.updateGlobalEnabled()
		
	ENDPROC

	PROCEDURE pgfDiff.pagFilesDiff.txtFile2.OLEDragOver
		LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState
		
		DO CASE
		CASE nState == 0		&&DRAG_ENTER
			DO CASE
			*CASE oDataObject.GetFormat("OLE Variant Array")	&& Array
			*	This.OLEDropHasData = 1		&&DROPHASDATA_USEFUL
			*	This.OLEDropEffects = 1+2	&&DROPEFFECT_COPY + DROPEFFECT_MOVE
				
			CASE oDataObject.GetFormat(1)				&& Text
				This.OLEDropHasData = 1		&&DROPHASDATA_USEFUL
				This.OLEDropEffects = 1+2	&&DROPEFFECT_COPY + DROPEFFECT_MOVE
				
			CASE oDataObject.GetFormat(15)				&& Files CF_HDROP
				This.OLEDropHasData = 1		&&DROPHASDATA_USEFUL
				*This.OLEDropEffects = 4		&&DROPEFFECT_LINK
				This.OLEDropEffects = 1		&&DROPEFFECT_COPY
			OTHERWISE
				This.OLEDropHasData = 0		&&DROPHASDATA_NOTUSEFUL
			ENDCASE
		
		CASE nState == 1	&& Drag Leave
		CASE nState == 2	&& Drag Over
		ENDCASE
		
	ENDPROC

	PROCEDURE pgfDiff.pagFilesDiff.txtFile2.Valid
		THISFORM.updateGlobalEnabled()
		*THISFORM.checkFilenames_dt(2)
		THIS.Refresh()
		
	ENDPROC

ENDDEFINE
