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

View File

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

View File

@ -390,7 +390,8 @@ begin
Result:=mrOK;
for i:=aNewProps.Count-1 downto 0 do begin
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.',
[Entry.NewText, Entry.ParentType]));
end;