home *** CD-ROM | disk | FTP | other *** search
/ Total C++ 2 / TOTALCTWO.iso / vfp5.0 / vfp / tools / transfrm / transfrm.prg < prev    next >
Text File  |  1996-08-21  |  32KB  |  1,180 lines

  1. * TRANSFRM.PRG - Transformer.
  2. *
  3. * Copyright (c) 1996 Microsoft Corp.
  4. * 1 Microsoft Way
  5. * Redmond, WA 98052
  6. *
  7. * Description:
  8. * Transformer for PJX/VCX/SCX files.
  9. *
  10.  
  11. #INCLUDE "transfrm.h"
  12.  
  13. LPARAMETERS tcFormClass,tcTransformClass
  14. LOCAL lcFormClass,lcTransformClass,lcFormClassLibrary,lcTransformClass
  15. LOCAL oForm,lcProgramName,lnAtPos,llAbort
  16. LOCAL lcLastSetClassLib,lcLastSetProcedure
  17. LOCAL lcLastSetTalk,lcLastSetESC,lcLastSetUDFParms
  18. LOCAL laInstances[1]
  19.  
  20. lcLastSetTalk=SET('TALK')
  21. SET TALK OFF
  22. lcLastSetESC=SET('ESCAPE')
  23. SET ESCAPE OFF
  24. lcLastSetUDFParms=SET('UDFPARMS')
  25. SET UDFPARMS VALUE
  26. SET COLLATE TO 'MACHINE'
  27. llAbort=.F.
  28. lcProgramName=LOWER(SYS(16))
  29. lcLastSetClassLib=SET('CLASSLIB')
  30. lcLastSetProcedure=SET('PROCEDURE')
  31. lcFormClass=IIF(TYPE('tcFormClass')#'C' OR EMPTY(tcFormClass), ;
  32.         'Transformer',tcFormClass)
  33. lcTransformClass=IIF(TYPE('tcTransformClass')#'C' OR ;
  34.         EMPTY(tcTransformClass),'TransformFiles',tcTransformClass)
  35. lcFormClassLibrary=LOWER(FULLPATH('transfrm',lcProgramName))
  36. lcTransformClassLibrary=''
  37. SET CLASSLIB TO (lcFormClassLibrary) ADDITIVE
  38. lnAtPos=AT(',',lcFormClass)
  39. IF lnAtPos>0
  40.     lcFormClassLibrary=LOWER(ALLTRIM(MLINE(LEFT(lcFormClass,lnAtPos-1),1)))
  41.     IF NOT '.'$lcFormClassLibrary
  42.         lcFormClassLibrary=lcFormClassLibrary+'.vcx'
  43.     ENDIF
  44.     lcFormClass=LOWER(ALLTRIM(SUBSTR(lcFormClass,lnAtPos+1)))
  45.     IF NOT FILE(lcFormClassLibrary)
  46.         =FileNotFoundMsg(lcFormClassLibrary)
  47.         llAbort=.T.
  48.     ENDIF
  49. ENDIF
  50. lnAtPos=AT(',',lcTransformClass)
  51. IF lnAtPos>0
  52.     lcTransformClassLibrary=LOWER(ALLTRIM(MLINE(LEFT(lcTransformClass,lnAtPos-1),1)))
  53.     IF NOT '.'$lcTransformClassLibrary
  54.         lcTransformClassLibrary=lcTransformClassLibrary+'.vcx'
  55.     ENDIF
  56.     lcTransformClass=LOWER(ALLTRIM(SUBSTR(lcTransformClass,lnAtPos+1)))
  57.     IF NOT FILE(lcTransformClassLibrary)
  58.         =FileNotFoundMsg(lcTransformClassLibrary)
  59.         llAbort=.T.
  60.     ENDIF
  61. ENDIF
  62. IF lcFormClassLibrary==lcTransformClassLibrary
  63.     lcTransformClassLibrary=''
  64. ENDIF
  65. IF NOT llAbort AND AINSTANCE(laInstances,lcFormClass)=0
  66.     IF RIGHT(lcFormClassLibrary,4)=='.prg'
  67.         SET PROCEDURE TO (lcFormClassLibrary) ADDITIVE
  68.     ELSE
  69.         SET CLASSLIB TO (lcFormClassLibrary) ADDITIVE
  70.     ENDIF
  71.     oForm=CREATEOBJECT(lcFormClass)
  72.     IF TYPE('oForm')#'O'
  73.         llAbort=.T.
  74.     ENDIF
  75.     IF NOT llAbort AND TYPE('oForm.oTransform')=='U'
  76.         IF NOT EMPTY(lcTransformClassLibrary)
  77.             IF RIGHT(lcTransformClassLibrary,4)=='.prg'
  78.                 SET PROCEDURE TO (lcTransformClassLibrary) ADDITIVE
  79.             ELSE
  80.                 SET CLASSLIB TO (lcTransformClassLibrary) ADDITIVE
  81.             ENDIF
  82.         ENDIF
  83.         oForm.AddObject('oTransform',lcTransformClass)
  84.         oForm.oTransform.Name='oTransform'
  85.         IF TYPE('oForm.oTransform')#'O'
  86.             llAbort=.T.
  87.         ENDIF
  88.     ENDIF
  89.     IF NOT SET('CLASSLIB')==lcLastSetClassLib
  90.         IF NOT RIGHT(lcFormClassLibrary,4)=='.prg'
  91.             RELEASE CLASSLIB (lcFormClassLibrary)
  92.         ENDIF
  93.         IF NOT EMPTY(lcTransformClassLibrary) AND ;
  94.                 NOT RIGHT(lcTransformClassLibrary,4)=='.prg'
  95.             RELEASE CLASSLIB (lcTransformClassLibrary)
  96.         ENDIF
  97.     ENDIF
  98.     IF NOT SET('PROCEDURE')==lcLastSetProcedure
  99.         IF RIGHT(lcFormClassLibrary,4)=='.prg'
  100.             RELEASE PROCEDURE (lcFormClassLibrary)
  101.         ENDIF
  102.         IF NOT EMPTY(lcTransformClassLibrary) AND ;
  103.                 RIGHT(lcTransformClassLibrary,4)=='.prg'
  104.             RELEASE PROCEDURE (lcTransformClassLibrary)
  105.         ENDIF
  106.     ENDIF
  107.     IF NOT llAbort
  108.         oForm.Show()
  109.     ENDIF
  110. ENDIF
  111. IF TYPE('lcLastSetUDFParms')=='C' AND lcLastSetUDFParms=='REFERENCE'
  112.     SET UDFPARMS REFERENCE
  113. ELSE
  114.     SET UDFPARMS VALUE
  115. ENDIF
  116. IF TYPE('lcLastSetESC')=='C' AND lcLastSetESC=='ON'
  117.     SET ESCAPE ON
  118. ELSE
  119.     SET ESCAPE OFF
  120. ENDIF
  121. IF TYPE('lcLastSetTalk')=='C' AND lcLastSetTalk=='ON'
  122.     SET TALK ON
  123. ELSE
  124.     SET TALK OFF
  125. ENDIF
  126. IF TYPE('llAbort')#'L'
  127.     RETURN .T.
  128. ENDIF
  129. RETURN llAbort
  130.  
  131.  
  132.  
  133. FUNCTION ShowMsgBox
  134. LPARAMETERS tcMessage,tnType,tcTitle
  135. LOCAL lcMessage,lnResult,lnType,lcTitle
  136.  
  137. lcMessage=IIF(TYPE('tcMessage')=='C',tcMessage,'')
  138. lnType=IIF(TYPE('tnType')=='N',tnType,48)
  139. lcTitle=IIF(TYPE('tcTitle')=='C',tcTitle,'Visual FoxPro Transformer')
  140. WAIT CLEAR
  141. lnResult=MESSAGEBOX(lcMessage,lnType,lcTitle)
  142. RETURN lnResult
  143.  
  144.  
  145.  
  146. FUNCTION FileNotFoundMsg
  147. LPARAMETERS tcFileName
  148.  
  149. RETURN ShowMsgBox("File '"+LOWER(tcFileName)+"' not found.")
  150.  
  151.  
  152.  
  153. DEFINE CLASS TransformFiles AS Custom
  154.  
  155.  
  156.     Name='oTransformFiles'
  157.     PROTECTED lAddFontRules
  158.     cGetFileExt='pjx|scx|vcx'
  159.     PROTECTED cText
  160.     cText=''
  161.     PROTECTED cFileName
  162.     cFileName=''
  163.     PROTECTED lSearchSubfolders
  164.     PROTECTED lCreateLogOnly
  165.     PROTECTED lLogToFile
  166.     PROTECTED cLogToFile
  167.     cLogToFile=''
  168.     PROTECTED nStartSeconds
  169.     nStartSeconds=0
  170.     PROTECTED nEndSeconds
  171.     nEndSeconds=0
  172.     PROTECTED aProcessedFiles[1]
  173.     PROTECTED nProcessedFileCount
  174.     nProcessedFileCount=0
  175.     PROTECTED nTransformedFileCount
  176.     nTransformedFileCount=0
  177.     PROTECTED nFileCount
  178.     nFileCount=0
  179.     PROTECTED aFileList[1]
  180.     PROTECTED nRuleCount
  181.     nRuleCount=0
  182.     PROTECTED aRules[1]
  183.     PROTECTED aFileRule[1]
  184.     PROTECTED nFileRuleCount
  185.     nFileRuleCount=0
  186.     PROTECTED lOverridePropertyDefaults
  187.     PROTECTED aExcludeFilesRule[1]
  188.     PROTECTED aClassRule[1]
  189.     PROTECTED nClassRuleCount
  190.     nClassRuleCount=0
  191.     PROTECTED aExcludeClassesRule[1]
  192.     PROTECTED lLastLockScreen
  193.     PROTECTED nFontMatchCount
  194.     nFontMatchCount=0
  195.  
  196.  
  197.     FUNCTION Do(tlAddFontRules)
  198.     LOCAL lcMsg
  199.  
  200.     this.parent.lError=.F.
  201.     this.lLastLockScreen=this.parent.LockScreen
  202.     this.lAddFontRules=tlAddFontRules
  203.     this.lSearchSubfolders=this.parent.pgfTransformer. ;
  204.             fpgFiles.chkSearchSubfolders.Value
  205.     this.lCreateLogOnly=this.parent.pgfTransformer. ;
  206.             fpgFiles.chkCreateLogOnly.Value
  207.     this.lLogToFile=this.parent.pgfTransformer. ;
  208.             fpgFiles.chkLogToFile.Value
  209.     this.cLogToFile=ALLTRIM(this.parent.pgfTransformer. ;
  210.             fpgFiles.txtLogToFile.Value)
  211.     this.nFileCount=this.parent.pgfTransformer.fpgFiles. ;
  212.             lstSelectedFiles.ListCount
  213.     IF this.nFileCount=0
  214.         this.NoFilesErrorMsg()
  215.         RETURN ''
  216.     ENDIF
  217.     IF NOT this.lAddFontRules AND NOT this.lCreateLogOnly AND ;
  218.             ShowMsgBox('Transformer will may permenantly alter files.  '+ ;
  219.             'Backup of files to be processed is recommended.  Continue?',289)#1
  220.         RETURN ''
  221.     ENDIF
  222.     this.nStartSeconds=SECONDS()
  223.     ACTIVATE SCREEN
  224.     this.InitalizeRules()
  225.     this.ProcessStart()
  226.     IF NOT this.ProcessFileList() OR this.parent.lError
  227.         this.AddText('',1)
  228.         IF this.parent.lError
  229.             this.AddText('Process aborted due to error.',1)
  230.         ELSE
  231.             this.AddText('Process aborted manually.',1)
  232.         ENDIF
  233.     ENDIF
  234.     this.nEndSeconds=SECONDS()
  235.     IF NOT RIGHT(this.cText,2)==(CR+CR)
  236.         this.AddText('',1)
  237.     ENDIF
  238.     DO CASE
  239.         CASE this.nTransformedFileCount=0
  240.             this.AddText('No files')
  241.         CASE this.nTransformedFileCount=1
  242.             this.AddText('1 file')
  243.         OTHERWISE
  244.             this.AddText(ALLTRIM(STR(this.nTransformedFileCount))+ ;
  245.                     ' files')
  246.     ENDCASE
  247.     this.AddText(' '+IIF(this.lCreateLogOnly,'scanned','processed')+' in '+ ;
  248.             ALLTRIM(STR(ABS(this.nEndSeconds-this.nStartSeconds),9,3))+ ;
  249.             ' seconds.',1)
  250.     this.ProcessEnd()
  251.     this.DisplayText()
  252.     this.parent.lError=.F.
  253.     this.parent.Refresh()
  254.     this.parent.LockScreen=this.lLastLockScreen
  255.     CLEAR TYPEAHEAD
  256.     IF this.lAddFontRules
  257.         WAIT CLEAR
  258.         lcMsg=IIF(this.nFontMatchCount=0,'No font rules', ;
  259.                 ALLTRIM(STR(this.nFontMatchCount))+' font rule'+ ;
  260.                 IIF(this.nFontMatchCount=1,'','s'))+' added.'
  261.         =ShowMsgBox(lcMsg,64,'Transformer Add Font Rules')
  262.         RETURN ''
  263.     ENDIF
  264.     this.parent.pgfTransformer.fpgLog.edtTransformerLog.SetFocus()
  265.     KEYBOARD '{DNARROW}' PLAIN
  266.     RETURN this.cText
  267.     ENDFUNC
  268.     
  269.     
  270.     FUNCTION WildCardMatch(tcMatchExpList,tcExpressionSearched)
  271.     LOCAL lcMatchExpList,lcMatchExp,lcExpressionSearched
  272.     LOCAL lnMatchLen,lnExpressionLen,lnMatchCount,lnCount,lnCount2,lnAtPos
  273.  
  274.     IF EMPTY(tcExpressionSearched)
  275.         RETURN .F.
  276.     ENDIF
  277.     lcExpressionSearched=LOWER(ALLTRIM(tcExpressionSearched))
  278.     lnExpressionLen=LEN(lcExpressionSearched)
  279.     lcMatchExpList=LOWER(ALLTRIM(tcMatchExpList))
  280.     lnMatchCount=OCCURS(',',lcMatchExpList)+1
  281.     IF lnMatchCount>1
  282.         lcMatchExpList=','+ALLTRIM(lcMatchExpList)+','
  283.     ENDIF
  284.     FOR lnCount = 1 TO lnMatchCount
  285.         IF lnMatchCount=1
  286.             lcMatchExp=LOWER(ALLTRIM(lcMatchExpList))
  287.             lnMatchLen=LEN(lcMatchExp)
  288.         ELSE
  289.             lnAtPos=AT(',',lcMatchExpList,lnCount)
  290.             lnMatchLen=AT(',',lcMatchExpList,lnCount+1)-lnAtPos-1
  291.             lcMatchExp=LOWER(ALLTRIM(SUBSTR(lcMatchExpList,lnAtPos+1, ;
  292.                     lnMatchLen)))
  293.         ENDIF
  294.         FOR lnCount2 = 1 TO OCCURS('?',lcMatchExp)
  295.             lnAtPos=AT('?',lcMatchExp)
  296.             IF lnAtPos>lnExpressionLen
  297.                 IF (lnAtPos-1)=lnExpressionLen
  298.                     lcExpressionSearched=lcExpressionSearched+'?'
  299.                 ENDIF
  300.                 EXIT
  301.             ENDIF
  302.             lcMatchExp=STUFF(lcMatchExp,lnAtPos,1, ;
  303.                     SUBSTR(lcExpressionSearched,lnAtPos,1))
  304.         ENDFOR
  305.         IF EMPTY(lcMatchExp) OR lcExpressionSearched==lcMatchExp OR ;
  306.                 lcMatchExp=='*' OR lcMatchExp=='?' OR lcMatchExp=='%%'
  307.             RETURN
  308.         ENDIF
  309.         IF LEFT(lcMatchExp,1)=='*'
  310.             RETURN (SUBSTR(lcMatchExp,2)==RIGHT(lcExpressionSearched, ;
  311.                     LEN(lcMatchExp)-1))
  312.         ENDIF
  313.         IF LEFT(lcMatchExp,1)=='%' AND RIGHT(lcMatchExp,1)=='%' AND ;
  314.                 SUBSTR(lcMatchExp,2,lnMatchLen-2)$lcExpressionSearched
  315.             RETURN
  316.         ENDIF
  317.         lnAtPos=AT('*',lcMatchExp)
  318.         IF lnAtPos>0 AND (lnAtPos-1)<=lnExpressionLen AND ;
  319.                 LEFT(lcExpressionSearched,lnAtPos-1)==LEFT(lcMatchExp, ;
  320.                         lnAtPos-1)
  321.             RETURN
  322.         ENDIF
  323.     ENDFOR
  324.     RETURN .F.
  325.     ENDFUNC
  326.  
  327.  
  328.     FUNCTION TrimPath(tcFileName,tlTrimExt)
  329.     LOCAL lcFileName,lnAtPos
  330.  
  331.     IF EMPTY(tcFileName)
  332.         RETURN ''
  333.     ENDIF
  334.     lcFileName=tcFileName
  335.     lnAtPos=AT(':',lcFileName)
  336.     IF lnAtPos>0
  337.         lcFileName=SUBSTR(lcFileName,lnAtPos+1)
  338.     ENDIF
  339.     IF tlTrimExt
  340.         lcFileName=this.TrimExt(lcFileName)
  341.     ENDIF
  342.     lcFileName=ALLTRIM(SUBSTR(lcFileName,AT('\',lcFileName,;
  343.             MAX(OCCURS('\',lcFileName),1))+1))
  344.     DO WHILE LEFT(lcFileName,1)=='.'
  345.         lcFileName=ALLTRIM(SUBSTR(lcFileName,2))
  346.     ENDDO
  347.     DO WHILE RIGHT(lcFileName,1)=='.'
  348.         lcFileName=ALLTRIM(LEFT(lcFileName,LEN(lcFileName)-1))
  349.     ENDDO
  350.     RETURN lcFileName
  351.     ENDFUNC
  352.  
  353.  
  354.     FUNCTION TrimExt(tcFileName)
  355.     LOCAL lcFileName,lnAtPos,lnAtPos2
  356.  
  357.     lcFileName=tcFileName
  358.     lnAtPos=RAT('.',lcFileName)
  359.     IF lnAtPos>0
  360.         lnAtPos2=RAT(':',lcFileName)
  361.         IF lnAtPos>lnAtPos2
  362.             lcFileName=LEFT(lcFileName,lnAtPos-1)
  363.         ENDIF
  364.     ENDIF
  365.     RETURN ALLTRIM(lcFileName)
  366.     ENDFUNC
  367.  
  368.  
  369.     PROTECTED FUNCTION Error(tnError,tcMethod,tnLine)
  370.  
  371.     RETURN thisform.Error(tnError,tcMethod,tnLine,this)
  372.     ENDFUNC
  373.  
  374.  
  375.     PROTECTED FUNCTION FormatValue(tcProperty,tcValue)
  376.     LOCAL lcValue,lcType
  377.  
  378.     lcType=TYPE('tcValue')
  379.     DO CASE
  380.         CASE lcType=='C'
  381.             =.F.
  382.         CASE lcType=='U'
  383.             RETURN tcValue
  384.         CASE lcType=='L'
  385.             tcValue=IIF(tcValue,'.T.','.F.')
  386.         CASE lcType=='N'
  387.             tcValue=ALLTRIM(STR(tcValue))
  388.         CASE lcType=='D'
  389.             tcValue=DTOC(tcValue)
  390.         CASE lcType=='T'
  391.             tcValue=TTOC(tcValue)
  392.         CASE lcType=='Y'
  393.             tcValue=ALLTRIM(STR(MTON(tcValue)))
  394.         OTHERWISE
  395.             RETURN tcValue
  396.     ENDCASE
  397.     lcType=TYPE(tcValue)
  398.     DO CASE
  399.         CASE lcType=='N' OR lcType=='D' OR lcType=='T'
  400.             lcValue=ALLTRIM(tcValue)
  401.         CASE lcType=='L'
  402.             lcValue=IIF(EVALUATE(tcValue),'.T.','.F.')
  403.         CASE EMPTY(tcValue)
  404.             lcValue=ALLTRIM(tcValue)
  405.         CASE LEFT(tcValue,1)=='='
  406.             lcValue='('+SUBSTR(tcValue,2)+')'
  407.         CASE NOT LEFT(tcValue,1)=='"' AND ;
  408.                 INLIST(tcProperty,'caption','tag','comment','name','fontname', ;
  409.                 'controlsource','recordsource','format','inputmask', ;
  410.                 'statusbartext','tooltiptext','memowindow','passwordchar', ;
  411.                 'columnwidths','rowsource','lineslant','childorder') OR ;
  412.                 INLIST(tcProperty,'linkmaster','dynamicbackcolor', ;
  413.                 'dynamicforecolor','dynamicfontbold','dynamicfontitalic', ;
  414.                 'dynamicfontname','dynamicfontoutline','dynamicfontsize', ;
  415.                 'dynamicfontshadow','dynamicfontstrikethru', ;
  416.                 'dynamicfontunderline','dynamicalignment', ;
  417.                 'dynamiccurrentcontrol','hostname','relationalexpr')
  418.             lcValue='"'+tcValue+'"'
  419.         OTHERWISE
  420.             lcValue=ALLTRIM(tcValue)
  421.     ENDCASE
  422.     RETURN lcValue
  423.     ENDFUNC
  424.  
  425.  
  426.     PROTECTED FUNCTION DisplayMessage(tcText)
  427.     
  428.     IF ISNULL(tcText)
  429.         SET MESSAGE TO
  430.         RETURN
  431.     ENDIF
  432.     IF EMPTY(tcText)
  433.         SET MESSAGE TO 'Scanning ...'
  434.         RETURN
  435.     ENDIF
  436.     SET MESSAGE TO [Scanning:  ]+tcText
  437.     ENDFUNC
  438.  
  439.  
  440.     PROTECTED FUNCTION NoFilesErrorMsg
  441.     RETURN ShowMsgBox('There are no files to process.',,this.parent.Caption)
  442.     ENDFUNC
  443.     
  444.     
  445.     PROTECTED FUNCTION ClearText
  446.     
  447.     IF this.lAddFontRules
  448.         RETURN .F.
  449.     ENDIF
  450.     this.cText=''
  451.     ENDFUNC
  452.  
  453.  
  454.     PROTECTED FUNCTION AddText(tcText,tnLines)
  455.     LOCAL lnLines
  456.     
  457.     IF this.lAddFontRules
  458.         RETURN .F.
  459.     ENDIF
  460.     lnLines=IIF(TYPE('tnLines')=='N',tnLines,0)
  461.     this.cText=this.cText+tcText+REPLICATE(CR,lnLines)
  462.     ENDFUNC
  463.     
  464.     
  465.     PROTECTED FUNCTION LogToFile
  466.     LOCAL lcFileName
  467.  
  468.     IF this.lAddFontRules
  469.         RETURN .F.
  470.     ENDIF
  471.     lcFileName=this.cLogToFile
  472.     IF NOT this.lLogToFile OR EMPTY(lcFileName)
  473.         RETURN .F.
  474.     ENDIF
  475.     SET TEXTMERGE OFF
  476.     SET TEXTMERGE TO (lcFileName)
  477.     IF NOT FILE(lcFileName)
  478.         SET TEXTMERGE OFF
  479.         RETURN .F.
  480.     ENDIF
  481.     SET TEXTMERGE ON NOSHOW
  482.     TEXT
  483.     <<this.cText+CR>>
  484.     ENDTEXT
  485.     SET TEXTMERGE OFF
  486.     SET TEXTMERGE TO
  487.     ENDFUNC
  488.  
  489.  
  490.     PROTECTED FUNCTION HeaderText
  491.  
  492.     this.TitleText('Transformer Log Start')
  493.     this.LineBreakText()
  494.     ENDFUNC
  495.     
  496.  
  497.     PROTECTED FUNCTION FooterText
  498.  
  499.     this.LineBreakText()
  500.     this.TitleText('Transformer Log End')
  501.     ENDFUNC
  502.     
  503.  
  504.     PROTECTED FUNCTION TitleText(tcText)
  505.  
  506.     this.AddText('*** '+tcText+' ***  '+TTOC(DATETIME()),1)
  507.     ENDFUNC
  508.  
  509.  
  510.     PROTECTED FUNCTION UnableToProcessFileText(tcFileName)
  511.  
  512.     this.AddText('Unabled to process file:  '+tcFileName,1)
  513.     ENDFUNC
  514.  
  515.  
  516.     PROTECTED FUNCTION LineBreakText
  517.  
  518.     this.AddText(REPLICATE('_',65),2)
  519.     ENDFUNC
  520.     
  521.  
  522.     PROTECTED FUNCTION DisplayText
  523.  
  524.     IF this.lAddFontRules
  525.         RETURN .F.
  526.     ENDIF
  527.     this.parent.pgfTransformer.fpgLog.edtTransformerLog.Value=this.cText
  528.     ENDFUNC
  529.     
  530.  
  531.     PROTECTED FUNCTION InitalizeRules
  532.     LOCAL lcItem,lnCount,lcFiles,lcClasses
  533.  
  534.     this.nRuleCount=this.parent.pgfTransformer.fpgRules.lstSelectedRules. ;
  535.             ListCount
  536.     DIMENSION this.aRules[MAX(this.nRuleCount,1)]
  537.     this.aRules=''
  538.     this.nFileRuleCount=0
  539.     DIMENSION this.aFileRule[1]
  540.     this.aFileRule=''
  541.     DIMENSION this.aExcludeFilesRule[1]
  542.     this.aExcludeFilesRule=.F.
  543.     this.nClassRuleCount=0
  544.     DIMENSION this.aClassRule[1]
  545.     this.aClassRule=''
  546.     DIMENSION this.aExcludeClassesRule[1]
  547.     this.aExcludeClassesRule=.F.
  548.     this.lOverridePropertyDefaults=.F.
  549.     FOR lnCount = 1 TO this.nRuleCount
  550.         lcItem=this.parent.pgfTransformer.fpgRules. ;
  551.                 lstSelectedRules.List[lnCount]
  552.         this.aRules[lnCount]=lcItem
  553.         this.parent.GetRule(lcItem)
  554.         IF NOT EMPTY(this.parent.aRule[1])
  555.             LOOP
  556.         ENDIF
  557.         lcFiles=LOWER(this.parent.aRule[4])
  558.         lcClasses=LOWER(this.parent.aRule[6])
  559.         IF NOT EMPTY(lcFiles)
  560.             this.nFileRuleCount=this.nFileRuleCount+1
  561.             DIMENSION this.aFileRule[this.nFileRuleCount]
  562.             DIMENSION this.aExcludeFilesRule[this.nFileRuleCount]
  563.             this.aFileRule[this.nFileRuleCount]=lcFiles
  564.             this.aExcludeFilesRule[this.nFileRuleCount]=this.parent.aRule[5]
  565.         ENDIF
  566.         IF NOT EMPTY(lcClasses)
  567.             this.nClassRuleCount=this.nClassRuleCount+1
  568.             DIMENSION this.aClassRule[this.nClassRuleCount]
  569.             DIMENSION this.aExcludeClassesRule[this.nClassRuleCount]
  570.             this.aClassRule[this.nClassRuleCount]=lcClasses
  571.             this.aExcludeClassesRule[this.nClassRuleCount]=this.parent.aRule[7]
  572.         ENDIF
  573.         IF this.parent.aRule[8]
  574.             this.lOverridePropertyDefaults=.T.
  575.         ENDIF
  576.     ENDFOR
  577.     this.nFontMatchCount=0
  578.     ENDFUNC
  579.  
  580.  
  581.     PROTECTED FUNCTION ProcessStart
  582.     LOCAL lnFileNo,lcFileName
  583.  
  584.     this.DisplayMessage()
  585.     this.ClearText()
  586.     this.DisplayText()
  587.     IF this.lAddFontRules
  588.         this.parent.pgfTransformer.ActivePage= ;
  589.                 this.parent.pgfTransformer.fpgRules.PageOrder
  590.         this.parent.pgfTransformer.fpgRules.lstSelectedRules.SetFocus()
  591.         this.parent.LockScreen=.T.
  592.     ELSE
  593.         this.parent.pgfTransformer.ActivePage= ;
  594.                 this.parent.pgfTransformer.fpgLog.PageOrder
  595.         this.parent.pgfTransformer.fpgLog.edtTransformerLog.SetFocus()
  596.     ENDIF
  597.     this.cFileName=''
  598.     this.nProcessedFileCount=0
  599.     DIMENSION this.aProcessedFiles[1]
  600.     this.aProcessedFiles=''
  601.     this.nTransformedFileCount=0
  602.     DIMENSION this.aFileList[MAX(this.nFileCount,1)]
  603.     this.aFileList=''
  604.     FOR lnFileNo = 1 TO this.nFileCount
  605.         lcFileName=ALLTRIM(this.parent.pgfTransformer.fpgFiles. ;
  606.                 lstSelectedFiles.List[lnFileNo])
  607.         this.aFileList[lnFileNo]=lcFileName
  608.     ENDFOR
  609.     this.HeaderText()
  610.     ENDFUNC
  611.     
  612.  
  613.     PROTECTED FUNCTION ProcessEnd
  614.  
  615.     this.FooterText()
  616.     this.LogToFile()
  617.     this.DisplayMessage(.NULL.)
  618.     ENDFUNC
  619.  
  620.  
  621.     PROTECTED FUNCTION ProcessFileList
  622.     LOCAL lnFileNo,lcFileName
  623.  
  624.     FOR lnFileNo = 1 TO this.nFileCount
  625.         IF this.parent.lError
  626.             RETURN .F.
  627.         ENDIF
  628.         lcFileName=this.aFileList[lnFileNo]
  629.         IF FILE(lcFileName)
  630.             IF NOT this.ProcessFile(lcFileName)
  631.                 RETURN .F.
  632.             ENDIF
  633.         ELSE
  634.             IF NOT this.ProcessFolder(lcFileName)
  635.                 RETURN .F.
  636.             ENDIF
  637.         ENDIF
  638.     ENDFOR
  639.     ENDFUNC
  640.  
  641.  
  642.     PROTECTED FUNCTION ProcessFolder(tcFolderName)
  643.     LOCAL lnFileCount,lnFileNo,lcFileName,lcAttrib
  644.     LOCAL laFiles[1,5]
  645.  
  646.     IF this.parent.lError OR (CHRSAW() AND INKEY('HM')=27)
  647.         RETURN .F.
  648.     ENDIF
  649.     this.DisplayMessage(tcFolderName)
  650.     lnFileCount=ADIR(laFiles,tcFolderName+'*.*','D')
  651.     IF lnFileCount=0
  652.         RETURN
  653.     ENDIF
  654.     FOR lnFileNo = 1 TO lnFileCount
  655.         lcFileName=laFiles[lnFileNo,1]
  656.         lcAttrib=laFiles[lnFileNo,5]
  657.         IF EMPTY(lcFileName) OR LEFT(lcFileName,1)=='.'
  658.             LOOP
  659.         ENDIF
  660.         lcFileName=LOWER(tcFolderName+lcFileName)
  661.         IF 'D'$lcAttrib
  662.             IF NOT this.lSearchSubfolders
  663.                 LOOP
  664.             ENDIF
  665.             lcFileName=lcFileName+'\'
  666.             IF NOT this.ProcessFolder(lcFileName)
  667.                 RETURN .F.
  668.             ENDIF
  669.         ELSE
  670.             IF NOT this.ProcessFile(lcFileName)
  671.                 RETURN .F.
  672.             ENDIF
  673.         ENDIF
  674.     ENDFOR
  675.     ENDFUNC
  676.  
  677.  
  678.     PROTECTED FUNCTION ProcessFile(tcFileName)
  679.     LOCAL lcFileName,lcFileExt,lcFileExt2,lcFileName,lcAttrib
  680.     LOCAL lcObjName,lcBaseClass,lcClasses,lnRecNo,lcGetFileList
  681.     LOCAL lnLastSelect,lcAlias,lnCount,llMatch,llWildCardMatch
  682.     LOCAL laFiles[1,5]
  683.  
  684.     IF this.parent.lError OR (CHRSAW() AND INKEY('HM')=27)
  685.         RETURN .F.
  686.     ENDIF
  687.     IF this.nProcessedFileCount>0 AND ;
  688.             ASCAN(this.aProcessedFiles,tcFileName+MARKER)>0
  689.         RETURN
  690.     ENDIF
  691.     lcFileName=LOWER(this.TrimPath(tcFileName))
  692.     IF this.nFileRuleCount>0
  693.         llMatch=.T.
  694.         FOR lnCount = 1 TO this.nFileRuleCount
  695.             llWildCardMatch=this.WildCardMatch(this.aFileRule[lnCount], ;
  696.                     lcFileName)
  697.             IF this.aExcludeFilesRule[lnCount]
  698.                 llWildCardMatch=(NOT llWildCardMatch)
  699.             ENDIF
  700.             IF NOT llWildCardMatch
  701.                 llMatch=.F.
  702.                 EXIT
  703.             ENDIF
  704.         ENDFOR
  705.         IF NOT llMatch
  706.             RETURN
  707.         ENDIF
  708.     ENDIF
  709.     lcGetFileList=LOWER(STRTRAN('|'+this.cGetFileExt,'|','.'))
  710.     lcFileExt=LOWER(RIGHT(tcFileName,4))
  711.     IF NOT lcFileExt$lcGetFileList OR ADIR(laFiles,tcFileName)=0
  712.         RETURN
  713.     ENDIF
  714.     this.nProcessedFileCount=this.nProcessedFileCount+1
  715.     DIMENSION this.aProcessedFiles[this.nProcessedFileCount]
  716.     this.aProcessedFiles[this.nProcessedFileCount]=tcFileName+MARKER
  717.     lcAttrib=laFiles[1,5]
  718.     IF NOT lcFileExt=='.pjx' AND LEFT(lcAttrib,1)=='R'
  719.         this.AddText('Unabled to process read-only file:  '+tcFileName,1)
  720.         RETURN
  721.     ENDIF
  722.     lnLastSelect=SELECT()
  723.     lcAlias='_'+SYS(3)
  724.     IF USED(lcAlias)
  725.         USE IN (lcAlias)
  726.     ENDIF
  727.     IF lcFileExt=='.pjx'
  728.         SELECT 0
  729.         USE (tcFileName) ALIAS (lcAlias)
  730.         IF NOT USED(lcAlias)
  731.             SELECT (lnLastSelect)
  732.             this.UnableToProcessFileText(tcFileName)
  733.             RETURN .F.
  734.         ENDIF
  735.         IF FCOUNT()#28
  736.             USE IN (lcAlias)
  737.             SELECT (lnLastSelect)
  738.             RETURN
  739.         ENDIF
  740.         SET FILTER TO NOT DELETED()
  741.         LOCATE
  742.         this.DisplayMessage(tcFileName)
  743.         this.AddText('Project:  '+tcFileName,1)
  744.         SCAN ALL FOR NOT Type=='H' AND NOT EMPTY(Name)
  745.             lcFileName=LOWER(ALLTRIM(STRTRAN(MLINE(Name,1),CHR(0),'')))
  746.             lcFileExt2=LOWER(RIGHT(lcFileName,4))
  747.             IF NOT lcFileExt2$lcGetFileList
  748.                 LOOP
  749.             ENDIF
  750.             lcFileName=LOWER(FULLPATH(lcFileName,tcFileName))
  751.             this.ProcessFile(lcFileName)
  752.         ENDSCAN
  753.         USE IN (lcAlias)
  754.         SELECT (lnLastSelect)
  755.         RETURN
  756.     ENDIF
  757.     SELECT 0
  758.     USE (tcFileName) ALIAS (lcAlias)
  759.     IF NOT USED(lcAlias)
  760.         SELECT (lnLastSelect)
  761.         this.UnableToProcessFileText(tcFileName)
  762.         RETURN .F.
  763.     ENDIF
  764.     SET FILTER TO NOT DELETED()
  765.     LOCATE
  766.     IF (INLIST(lcFileExt,'.vcx','.scx','.mnx') AND FCOUNT()#23) OR ;
  767.             (lcFileExt=='.frx' AND FCOUNT()#75)
  768.         USE IN (lcAlias)
  769.         SELECT (lnLastSelect)
  770.         RETURN
  771.     ENDIF
  772.     this.DisplayMessage(tcFileName)
  773.     this.nTransformedFileCount=this.nTransformedFileCount+1
  774.     this.cFileName=tcFileName
  775.     DO CASE
  776.         CASE lcFileExt=='.vcx'
  777.             this.AddText('Class Library:  '+tcFileName,1)
  778.         CASE lcFileExt=='.scx'
  779.             this.AddText('Form:  '+tcFileName,1)
  780.         CASE lcFileExt=='.mnx'
  781.             this.AddText('Menu:  '+tcFileName,1)
  782.         CASE lcFileExt=='.frx'
  783.             this.AddText('Report:  '+tcFileName,1)
  784.         OTHERWISE
  785.             SELECT (lnLastSelect)
  786.             this.cFileName=''
  787.             this.UnableToProcessFileText(tcFileName)
  788.             RETURN .F.
  789.     ENDCASE
  790.     SCAN ALL
  791.         IF lcFileExt=='.mnx'
  792.             this.ProcessMenuRules()
  793.             LOOP
  794.         ENDIF
  795.         IF lcFileExt=='.frx'
  796.             this.ProcessReportRules()
  797.             LOOP
  798.         ENDIF
  799.         IF EMPTY(Platform) OR Platform=='COMMENT '
  800.             LOOP
  801.         ENDIF
  802.         lcObjName=LOWER(ALLTRIM(MLINE(ObjName,1)))
  803.         lcBaseClass=LOWER(ALLTRIM(MLINE(BaseClass,1)))
  804.         IF INLIST(lcBaseClass,'dataenvironment','cursor','relation')
  805.             LOOP
  806.         ENDIF
  807.         IF this.nClassRuleCount>0
  808.             llMatch=.T.
  809.             IF EMPTY(lcBaseClass)
  810.                 LOOP
  811.             ENDIF
  812.             FOR lnCount = 1 TO this.nClassRuleCount
  813.                 lcClasses=LOWER(this.aClassRule[lnCount])
  814.                 llWildCardMatch=(this.WildCardMatch(lcClasses,lcBaseClass) OR ;
  815.                         this.WildCardMatch(lcClasses,lcObjName))
  816.                 IF this.aExcludeClassesRule[lnCount]
  817.                     llWildCardMatch=(NOT llWildCardMatch)
  818.                 ENDIF
  819.                 IF NOT llWildCardMatch
  820.                     llMatch=.F.
  821.                     EXIT
  822.                 ENDIF
  823.             ENDFOR
  824.             IF NOT llMatch
  825.                 LOOP
  826.             ENDIF
  827.         ENDIF
  828.         IF NOT this.lAddFontRules
  829.             IF NOT this.ProcessRules()
  830.                 USE IN (lcAlias)
  831.                 SELECT (lnLastSelect)
  832.                 this.cFileName=''
  833.                 RETURN .F.
  834.             ENDIF
  835.             LOOP
  836.         ENDIF
  837.         IF lcFileExt=='.scx'
  838.             LOCATE FOR Platform=='COMMENT ' AND UniqueID=='FONTINFO  '
  839.             IF NOT EOF()
  840.                 this.AddFontRules(lcFileName)
  841.             ENDIF
  842.             EXIT
  843.         ENDIF
  844.         lnRecNo=RECNO()
  845.         LOCATE FOR LOWER(ALLTRIM(MLINE(ObjName,1)))==lcObjName AND ;
  846.                 Platform=='COMMENT ' AND UniqueID=='FONTINFO  '
  847.         IF EOF()
  848.             GO lnRecNo
  849.             LOOP
  850.         ENDIF
  851.         this.AddFontRules(lcFileName,lcObjName)
  852.         GO lnRecNo
  853.     ENDSCAN
  854.     USE IN (lcAlias)
  855.     SELECT (lnLastSelect)
  856.     this.cFileName=''
  857.     ENDFUNC
  858.  
  859.  
  860.     PROTECTED FUNCTION AddFontRules(tcFileName,tcObjName)
  861.     LOCAL lcFileName,lcObjName,lcFontInfo,lnFontStyle
  862.     LOCAL lcProperties,oListBox,lcProperty,lcValue,lcCondition
  863.     LOCAL lcFontName,lcFontStyle,lnFontSize,lnHeight,lnWidth
  864.     LOCAL lcFontName2,lcFontStyle2,lnFontSize2,lnHeight2,lnWidth2
  865.     LOCAL lnFM1,lnFM5,lnFM6
  866.     LOCAL lnFontNo,lnFontSizeCount,lnFontSizeNo,lnAtPos
  867.     LOCAL laFont[1],laFonts[1]
  868.  
  869.     IF NOT AFONT(laFonts)
  870.         RETURN .F.
  871.     ENDIF
  872.     lcFileName=IIF(TYPE('tcFileName')=='C',tcFileName,'')
  873.     lcObjName=IIF(TYPE('tcObjName')=='C',tcObjName,'')
  874.     oListBox=this.parent.pgfTransformer.fpgRules.lstSelectedRules
  875.     lcProperties=STRTRAN(ALLTRIM(Properties),LF,CR_LF)
  876.     lcCondition=IIF(_windows,'_WINDOWS','_MAC')
  877.     _mline=0
  878.     DO WHILE .T.
  879.         lcFontInfo=ALLTRIM(MLINE(lcProperties,1,_mline))
  880.         IF EMPTY(lcFontInfo)
  881.             EXIT
  882.         ENDIF
  883.         IF NOT RIGHT(lcFontInfo,1)==','
  884.             lcFontInfo=lcFontInfo+','
  885.         ENDIF
  886.         lnAtPos=AT(',',lcFontInfo)
  887.         IF lnAtPos<=1
  888.             LOOP
  889.         ENDIF
  890.         lcFontName=ALLTRIM(LEFT(lcFontInfo,lnAtPos-1))
  891.         lcFontInfo=ALLTRIM(SUBSTR(lcFontInfo,lnAtPos+1))
  892.         lnAtPos=AT(',',lcFontInfo)
  893.         IF lnAtPos<=1
  894.             LOOP
  895.         ENDIF
  896.         lnFontStyle=VAL(LEFT(lcFontInfo,lnAtPos-1))
  897.         IF lnFontStyle=0
  898.             lcFontStyle='N'
  899.         ELSE
  900.             lcFontStyle=''
  901.             IF BITTEST(lnFontStyle,0)
  902.                 lcFontStyle=lcFontStyle+'B'
  903.             ENDIF
  904.             IF BITTEST(lnFontStyle,1)
  905.                 lcFontStyle=lcFontStyle+'I'
  906.             ENDIF
  907.         ENDIF
  908.         lcFontInfo=ALLTRIM(SUBSTR(lcFontInfo,lnAtPos+1))
  909.         lnAtPos=AT(',',lcFontInfo)
  910.         IF lnAtPos<=1
  911.             LOOP
  912.         ENDIF
  913.         lnFontSize=VAL(LEFT(lcFontInfo,lnAtPos-1))
  914.         lcFontInfo=ALLTRIM(SUBSTR(lcFontInfo,lnAtPos+1))
  915.         lnAtPos=AT(',',lcFontInfo)
  916.         IF lnAtPos<=1
  917.             LOOP
  918.         ENDIF
  919.         lnFM6=VAL(LEFT(lcFontInfo,lnAtPos-1))
  920.         lcFontInfo=ALLTRIM(SUBSTR(lcFontInfo,lnAtPos+1))
  921.         lnAtPos=AT(',',lcFontInfo)
  922.         IF lnAtPos<=1
  923.             LOOP
  924.         ENDIF
  925.         lnFM1=VAL(LEFT(lcFontInfo,lnAtPos-1))
  926.         lcFontInfo=ALLTRIM(SUBSTR(lcFontInfo,lnAtPos+1))
  927.         lnAtPos=AT(',',lcFontInfo,3)
  928.         IF lnAtPos<=1
  929.             LOOP
  930.         ENDIF
  931.         lcFontInfo=ALLTRIM(SUBSTR(lcFontInfo,lnAtPos+1))
  932.         lnAtPos=AT(',',lcFontInfo)
  933.         IF lnAtPos<=1
  934.             LOOP
  935.         ENDIF
  936.         lnFM5=VAL(LEFT(lcFontInfo,lnAtPos-1))
  937.         lcFontInfo=ALLTRIM(SUBSTR(lcFontInfo,lnAtPos+1))
  938.         IF AFONT(laFont,lcFontName,lnFontSize)
  939.             LOOP
  940.         ENDIF
  941.         lnHeight=FONTMETRIC(1,lcFontName,lnFontSize,lcFontStyle)+ ;
  942.                 FONTMETRIC(5,lcFontName,lnFontSize,lcFontStyle)
  943.         lnWidth=FONTMETRIC(6,lcFontName,lnFontSize,lcFontStyle)
  944.         FOR lnFontNo = 1 TO ALEN(laFonts)
  945.             lcFontName2=laFonts[lnFontNo]
  946.             IF NOT AFONT(laFont,lcFontName2)
  947.                 LOOP
  948.             ENDIF
  949.             lcFontStyle2=lcFontStyle
  950.             IF laFont[1]>0
  951.                 lnFontSizeCount=ALEN(laFont)
  952.                 lnFontSizeNo=0
  953.             ELSE
  954.                 lnFontSizeCount=0
  955.                 lnFontSizeNo=-1
  956.             ENDIF
  957.             DO WHILE .T.
  958.                 IF lnFontSizeCount>0
  959.                     lnFontSizeNo=lnFontSizeNo+1
  960.                     IF lnFontSizeNo>lnFontSizeCount
  961.                         EXIT
  962.                     ENDIF
  963.                     lnFontSize2=laFont[lnFontSizeNo]
  964.                 ELSE
  965.                     lnFontSizeNo=lnFontSizeNo+1
  966.                     IF lnFontSizeNo>8
  967.                         EXIT
  968.                     ENDIF
  969.                     IF lnFontSizeNo<=4
  970.                         lnFontSize2=lnFontSize+lnFontSizeNo
  971.                     ELSE
  972.                         lnFontSize2=lnFontSize-lnFontSizeNo
  973.                     ENDIF
  974.                 ENDIF
  975.                 lnHeight2=FONTMETRIC(1,lcFontName2,lnFontSize2,lcFontStyle2)+ ;
  976.                         FONTMETRIC(5,lcFontName2,lnFontSize2,lcFontStyle2)
  977.                 lnWidth2=FONTMETRIC(6,lcFontName2,lnFontSize2,lcFontStyle2)
  978.                 IF lnHeight2#lnHeight OR lnWidth2#lnWidth
  979.                     LOOP
  980.                 ENDIF
  981.             ENDDO
  982.         ENDFOR
  983.         IF oListBox.AddItem(this.parent.AddRule('FontName',lcFontName, ;
  984.                 lcCondition,lcFileName,,lcObjName))
  985.             this.nFontMatchCount=this.nFontMatchCount+1
  986.         ENDIF
  987.         IF oListBox.AddItem(this.parent.AddRule('FontSize', ;
  988.                 ALLTRIM(STR(lnFontSize)),lcCondition,lcFileName,,lcObjName))
  989.             this.nFontMatchCount=this.nFontMatchCount+1
  990.         ENDIF
  991.     ENDDO
  992.     ENDFUNC
  993.  
  994.  
  995.     PROTECTED FUNCTION ProcessRules
  996.     LOCAL lcItem,lcFileName,lcObjName,lcClass,lcBaseClass,lcParent
  997.     LOCAL llWildCardMatch,lnRuleNo,lnCount,lcText,lcObjectName,lnObjectCount
  998.     LOCAL lnPropertyAtPos,lnNameAtPos,lnAtPos,lnOccurance,lnStartPos,lnEndPos
  999.     LOCAL lcProperties,lcMembers,lcMember,lcOldExpr,lcNewExpr
  1000.     LOCAL lcProperty,lcValue,lcCondition,lcFiles,llExcludeFiles
  1001.     LOCAL lcClasses,llExcludeClasses,llOverridePropertyDefaults
  1002.     LOCAL laObjects[1]
  1003.  
  1004.     lcFileName=LOWER(this.TrimPath(this.cFileName))
  1005.     lcObjName=LOWER(ALLTRIM(MLINE(ObjName,1)))
  1006.     lcClass=LOWER(ALLTRIM(MLINE(Class,1)))
  1007.     lcBaseClass=LOWER(ALLTRIM(MLINE(BaseClass,1)))
  1008.     lcParent=LOWER(ALLTRIM(MLINE(Parent,1)))
  1009.     FOR lnRuleNo = 1 TO this.nRuleCount
  1010.         lcItem=this.aRules[lnRuleNo]
  1011.         this.parent.GetRule(lcItem)
  1012.         lcProperty=LOWER(this.parent.aRule[1])
  1013.         lcValue=this.parent.aRule[2]
  1014.         IF EMPTY(lcProperty) OR EMPTY(lcValue)
  1015.             LOOP
  1016.         ENDIF
  1017.         lcCondition=this.parent.aRule[3]
  1018.         lcFiles=LOWER(this.parent.aRule[4])
  1019.         llExcludeFiles=this.parent.aRule[5]
  1020.         lcClasses=LOWER(this.parent.aRule[6])
  1021.         llExcludeClasses=this.parent.aRule[7]
  1022.         llOverridePropertyDefaults=(this.lOverridePropertyDefaults OR this.parent.aRule[8])
  1023.         IF NOT EMPTY(lcFiles)
  1024.             llWildCardMatch=this.WildCardMatch(lcFiles,lcFileName)
  1025.             IF llExcludeFiles
  1026.                 llWildCardMatch=(NOT llWildCardMatch)
  1027.             ENDIF
  1028.             IF NOT llWildCardMatch
  1029.                 LOOP
  1030.             ENDIF
  1031.         ENDIF
  1032.         IF NOT EMPTY(lcClasses)
  1033.             llWildCardMatch=(this.WildCardMatch(lcClasses,lcBaseClass) OR ;
  1034.                     this.WildCardMatch(lcClasses,lcObjName))
  1035.             IF llExcludeClasses
  1036.                 llWildCardMatch=(NOT llWildCardMatch)
  1037.             ENDIF
  1038.             IF NOT llWildCardMatch
  1039.                 LOOP
  1040.             ENDIF
  1041.         ENDIF
  1042.         lcValue=this.FormatValue(lcProperty,lcValue)
  1043.         lcProperties=ALLTRIM(Properties)
  1044.         lcMembers=ALLTRIM(Reserved3)
  1045.         DIMENSION laObjects[1]
  1046.         laObjects=''
  1047.         lnObjectCount=0
  1048.         lnPropertyAtPos=-1
  1049.         lnNameAtPos=-1
  1050.         lnOccurance=0
  1051.         DO WHILE lnPropertyAtPos#0 OR lnNameAtPos#0
  1052.             IF this.parent.lError OR (CHRSAW() AND INKEY('HM')=27)
  1053.                 RETURN .F.
  1054.             ENDIF
  1055.             lcNewExpr=lcValue
  1056.             lnPropertyAtPos=0
  1057.             IF lnOccurance=0
  1058.                 lnPropertyAtPos=ATC(CR_LF+lcProperty+' = ',CR_LF+lcProperties+CR_LF)
  1059.                 lnOccurance=lnOccurance+1
  1060.                 lcObjectName=''
  1061.             ELSE
  1062.                 lnNameAtPos=ATC('.name = ',CR_LF+lcProperties+CR_LF, ;
  1063.                         lnOccurance)
  1064.                 lnOccurance=lnOccurance+1
  1065.                 IF lnNameAtPos=0
  1066.                     LOOP
  1067.                 ENDIF
  1068.                 lnNameAtPos=lnNameAtPos-1
  1069.                 lnAtPos=RAT(CR_LF,LEFT(lcProperties,lnNameAtPos))
  1070.                 lcObjectName=LOWER(SUBSTR(lcProperties,lnAtPos+2, ;
  1071.                         lnNameAtPos-lnAtPos-3))
  1072.                 IF lnObjectCount>0 AND ASCAN(laObjects,lcObjectName)>0
  1073.                     LOOP
  1074.                 ENDIF
  1075.                 lnPropertyAtPos=ATC(CR_LF+lcObjectName+'.'+lcProperty+' = ', ;
  1076.                         CR_LF+lcProperties+CR_LF)
  1077.                 lnObjectCount=lnObjectCount+1
  1078.                 DIMENSION laObjects[lnObjectCount]
  1079.                 laObjects[lnObjectCount]=lcObjectName
  1080.             ENDIF
  1081.              IF lnPropertyAtPos=0 AND NOT llOverridePropertyDefaults AND ;
  1082.                     ATC(CR_LF+lcProperty+CR_LF,CR_LF+lcMembers+CR_LF)=0
  1083.                 LOOP
  1084.             ENDIF
  1085.             lcText='    '+IIF(EMPTY(lcParent),'','    ')+lcObjName
  1086.             IF NOT EMPTY(lcObjectName)
  1087.                 lcText=lcText+'.'+lcObjectName
  1088.             ENDIF
  1089.             lcText=lcText+' ('+lcBaseClass+'):  '+lcItem
  1090.             IF this.lCreateLogOnly
  1091.                 this.AddText(lcText,1)
  1092.                 LOOP
  1093.             ENDIF
  1094.             lcOldExpr=''
  1095.             lnStartPos=0
  1096.             lnEndPos=0
  1097.             IF lnPropertyAtPos>0
  1098.                 lnStartPos=lnPropertyAtPos+LEN(lcProperty)-2
  1099.                 IF NOT EMPTY(lcObjectName)
  1100.                     lnStartPos=lnStartPos+LEN(lcObjectName)+1
  1101.                 ENDIF
  1102.                 DO WHILE .T.
  1103.                     lcOldExpr=SUBSTR(lcProperties,lnStartPos)
  1104.                     lnEndPos=AT(CR,lcOldExpr)
  1105.                     IF lnEndPos>0
  1106.                         EXIT
  1107.                     ENDIF
  1108.                     lcProperties=lcProperties+CR_LF
  1109.                 ENDDO
  1110.                 lcOldExpr=MLINE(SUBSTR(lcOldExpr,6),1)
  1111.                 lnEndPos=lnStartPos+lnEndPos
  1112.             ENDIF
  1113.             IF NOT EMPTY(lcCondition)
  1114.                 IF EMPTY(lcOldExpr)
  1115.                     lcOldExpr=PROPER(IIF(EMPTY(lcClass),lcBaseClass, ;
  1116.                             lcClass))+'::'+lcProperty
  1117.                 ENDIF
  1118.                 IF UPPER(LEFT(lcOldExpr,5))=='(IIF('
  1119.                     lnAtPos=AT(',',lcOldExpr)
  1120.                     IF lnAtPos>0
  1121.                         IF LOWER(lcCondition)==LOWER(SUBSTR(lcOldExpr,6,lnAtPos-6))
  1122.                             lnAtPos=RAT(',',lcOldExpr)
  1123.                             IF lnAtPos>0
  1124.                                 lcOldExpr=SUBSTR(lcOldExpr,lnAtPos+1, ;
  1125.                                         LEN(lcOldExpr)-lnAtPos-2)
  1126.                             ENDIF
  1127.                         ENDIF
  1128.                     ENDIF
  1129.                 ENDIF
  1130.                 IF lcNewExpr==lcOldExpr
  1131.                     lcNewExpr=this.FormatValue(lcProperty,lcNewExpr)
  1132.                 ELSE
  1133.                     lcNewExpr='(IIF('+lcCondition+','+lcNewExpr+','+ ;
  1134.                             lcOldExpr+'))'
  1135.                 ENDIF
  1136.             ENDIF
  1137.             IF lnStartPos>0
  1138.                 lcProperties=LEFT(lcProperties,lnStartPos+4)+lcNewExpr+ ;
  1139.                         SUBSTR(lcProperties,lnEndPos-1)
  1140.             ELSE
  1141.                 IF EMPTY(lcObjectName)
  1142.                     lnAtPos=ATC(CR_LF+'name = ',CR_LF+lcProperties+CR_LF)
  1143.                     lcObjectName=lcProperty
  1144.                 ELSE
  1145.                     lnAtPos=ATC(CR_LF+lcObjectName+'.name = ', ;
  1146.                             CR_LF+lcProperties+CR_LF)
  1147.                     lcObjectName=lcObjectName+'.'+lcProperty
  1148.                 ENDIF
  1149.                 IF lnAtPos>0
  1150.                     lcProperties=LEFT(lcProperties,lnAtPos-1)+ ;
  1151.                             lcObjectName+' = '+lcNewExpr+CR_LF+ ;
  1152.                             SUBSTR(lcProperties,lnAtPos)
  1153.                 ELSE
  1154.                     lcProperties=lcProperties+lcObjectName+' = '+lcNewExpr+CR_LF
  1155.                 ENDIF
  1156.             ENDIF
  1157.         ENDDO
  1158.         DO WHILE LEFT(lcProperties,2)==CR_LF
  1159.             lcProperties=SUBSTR(lcProperties,3)
  1160.         ENDDO
  1161.         IF NOT Properties==lcProperties
  1162.             REPLACE Properties WITH lcProperties
  1163.             this.AddText(lcText,1)
  1164.         ENDIF
  1165.     ENDFOR
  1166.     ENDFUNC
  1167.  
  1168.  
  1169.     PROTECTED FUNCTION ProcessMenuRules
  1170.     ENDFUNC
  1171.  
  1172.  
  1173.     PROTECTED FUNCTION ProcessReportRules
  1174.     ENDFUNC
  1175.  
  1176.  
  1177. ENDDEFINE
  1178.  
  1179. *-- end TRANSFRM.PRG
  1180.