From: Erik B. <eb...@us...> - 2006-09-22 02:21:01
|
Update of /cvsroot/gexperts/gexperts/unstable/Src In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv22947/Src Modified Files: GX_CompsToCode.pas Log Message: Add Delphi support for multiline strings in the DFM Index: GX_CompsToCode.pas =================================================================== RCS file: /cvsroot/gexperts/gexperts/unstable/Src/GX_CompsToCode.pas,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- GX_CompsToCode.pas 17 Apr 2006 06:13:41 -0000 1.32 +++ GX_CompsToCode.pas 22 Sep 2006 02:20:58 -0000 1.33 @@ -622,7 +622,33 @@ end; //while end; - procedure ProcSL(propName: string; compName: string); + procedure ProcessMultilineString(propName: string; compName: string); + var + LastLineInString: Boolean; + LineSuffix: string; + begin + if CFmtWith = '' then + Log(Impl, '%s%s%s%s := ', [CFmtIndent, compName, CFmtPropertyAccess, PropName]) + else + Log(Impl, CFmtIndent + CFmtIndent + '%s := ', [PropName]); + while not Eof do + begin + Readln; + LastLineInString := not StrEndsWith('+', ccLn); + if LastLineInString then + LineSuffix := ';' + else + LineSuffix := ''; + if CFmtWith = '' then + Log(Impl, CFmtIndent + CFmtIndent + '%s%s', [ccLn, LineSuffix]) + else + Log(Impl, CFmtIndent + CFmtIndent + CFmtIndent + '%s%s', [ccLn, LineSuffix]); + if LastLineInString then + Exit; + end; + end; + + procedure ProcessStringList(propName: string; compName: string); var p: Integer; last: Boolean; @@ -669,7 +695,7 @@ end; end; - procedure ProcItems(const propName: string; compName: string); + procedure ProcessCollectionItems(const propName: string; compName: string); var pVal: string; pName: string; @@ -816,9 +842,11 @@ if propVal = '{' then // glyphs etc - skip ProcGlyph(propName, compName) else if propVal = '(' then // string lists - ProcSL(propName, compName) + ProcessStringList(propName, compName) else if propVal = '<' then // ListView columns etc - ProcItems(propName, compName) + ProcessCollectionItems(propName, compName) + else if propVal = '' then // Multi-line strings where the value starts on the next line (TADOConnection.ConnectionString, a long TLabel.Caption, etc.) + ProcessMultilineString(propName, compName) else if (propName = 'Top') or (propName = 'Left') then begin if propType(propName) <> '' then @@ -841,7 +869,7 @@ if CFmtPropertyAccess = '.' then Log(impl, CFmtIndent + compName + CFmtPropertyAccess + TrimLeft(CFmtAssign), [propName, propVal]) else - Log(impl, CFmtIndent + compName + CFmtPropertyAccess + TrimLeft(CFmtAssign), [StringReplace(propName,'.',CFmtPropertyAccess,[rfReplaceAll]), PropC(propVal,propName)]) + Log(impl, CFmtIndent + compName + CFmtPropertyAccess + TrimLeft(CFmtAssign), [StringReplace(propName, '.', CFmtPropertyAccess, [rfReplaceAll]), PropC(propVal, propName)]); end; //if p > 0 end; //else if not skip end; //while not EOF @@ -903,7 +931,7 @@ while not EOF do begin Readln; - if Copy(ccULn, 1, Length('object')) = 'OBJECT' then + if StrBeginsWith('object', ccULn, False) then ParseComponent(Comp, decl, crea, impl, sub); end; finally @@ -921,7 +949,7 @@ 'The code to create the selected components has been copied to the clipboard.' + sLineBreak + sLineBreak + 'You can now paste the generated code into the IDE ' + - 'editor at the appropriate position.'; + 'editor at the appropriate position.'; begin Result := SCopyToClipboardComplete; end; |