Converter: improve log message for adding "SimplePanel = False" to StatusBar.

git-svn-id: trunk@41702 -
This commit is contained in:
juha 2013-06-13 10:47:12 +00:00
parent 93903dc029
commit 6945bd6608
3 changed files with 15 additions and 10 deletions

View File

@ -74,13 +74,16 @@ type
private private
fStartPos: integer; fStartPos: integer;
fEndPos: integer; fEndPos: integer;
fNewPrefix: string;
fNewText: string; fNewText: string;
fParentType: string; fParentType: string;
public public
constructor Create(aStartPos, aEndPos: Integer; const aNewText, aParentType: string); constructor Create(aStartPos, aEndPos: Integer;
const aNewPrefix, aNewText, aParentType: string);
destructor Destroy; override; destructor Destroy; override;
property StartPos: integer read fStartPos; property StartPos: integer read fStartPos;
property EndPos: integer read fEndPos; property EndPos: integer read fEndPos;
property NewPrefix: string read fNewPrefix;
property NewText: string read fNewText; property NewText: string read fNewText;
property ParentType: string read fParentType; property ParentType: string read fParentType;
end; end;
@ -188,11 +191,13 @@ end;
{ TAddPropEntry } { TAddPropEntry }
constructor TAddPropEntry.Create(aStartPos, aEndPos: Integer; const aNewText, aParentType: string); constructor TAddPropEntry.Create(aStartPos, aEndPos: Integer;
const aNewPrefix, aNewText, aParentType: string);
begin begin
inherited Create; inherited Create;
fStartPos:=aStartPos; fStartPos:=aStartPos;
fEndPos:=aEndPos; fEndPos:=aEndPos;
fNewPrefix:=aNewPrefix;
fNewText:=aNewText; fNewText:=aNewText;
fParentType:=aParentType; fParentType:=aParentType;
end; end;

View File

@ -75,19 +75,18 @@ end;
procedure TFormFileConverter.AddStatusbarProp(ParentType: string); procedure TFormFileConverter.AddStatusbarProp(ParentType: string);
// Add 'SimplePanel = False' property if it is needed. // Add 'SimplePanel = False' property if it is needed.
var var
sp, StartPos: integer; SpaceCnt, StartPos: integer;
s: string; s: string;
i: Integer; i: Integer;
begin begin
if fSBEndPos<>-1 then begin if fSBEndPos<>-1 then begin
if fSBHasPanels and (not fSBHasSimpleText) and (not fSBHasSimplePanelProp) then begin if fSBHasPanels and (not fSBHasSimpleText) and (not fSBHasSimplePanelProp) then begin
sp:=LeadingSpaceCount(fSBEndPos); SpaceCnt:=LeadingSpaceCount(fSBEndPos);
s:=' '; // First 2 spaces indentation, then the spaces in front of 'end'. // 2 spaces for indentation, then spaces in front of 'end'.
for i:=1 to sp do s:=StringOfChar(' ', SpaceCnt+2);
s:=s+' ';
StartPos:=FindLineEndOrCodeInFrontOfPosition(fLFMBuf.Source,fSBEndPos,1,false); StartPos:=FindLineEndOrCodeInFrontOfPosition(fLFMBuf.Source,fSBEndPos,1,false);
fSrcNewProps.Add(TAddPropEntry.Create(StartPos,StartPos, fSrcNewProps.Add(TAddPropEntry.Create(StartPos, StartPos, LineEnding+s,
LineEnding+s+'SimplePanel = False',ParentType)); 'SimplePanel = False', ParentType));
end; end;
fSBHasPanels:=False; fSBHasPanels:=False;
fSBHasSimplePanelProp:=False; fSBHasSimplePanelProp:=False;

View File

@ -390,7 +390,8 @@ begin
Result:=mrOK; Result:=mrOK;
for i:=aNewProps.Count-1 downto 0 do begin for i:=aNewProps.Count-1 downto 0 do begin
Entry:=TAddPropEntry(aNewProps[i]); Entry:=TAddPropEntry(aNewProps[i]);
fLFMBuffer.Replace(Entry.StartPos, Entry.EndPos-Entry.StartPos,Entry.NewText); fLFMBuffer.Replace(Entry.StartPos, Entry.EndPos-Entry.StartPos,
Entry.NewPrefix+Entry.NewText);
fSettings.AddLogLine(Format('Added property "%s" for %s.', fSettings.AddLogLine(Format('Added property "%s" for %s.',
[Entry.NewText, Entry.ParentType])); [Entry.NewText, Entry.ParentType]));
end; end;