IDE: Harmonize the style of spaces with ":=". Issue #27441, patch from Alexey Torgashin.

git-svn-id: trunk@48140 -
This commit is contained in:
juha 2015-03-05 17:39:32 +00:00
parent b03737cc9e
commit 09bbaa4174
2 changed files with 27 additions and 8 deletions

View File

@ -247,6 +247,9 @@ function GetTranslatedAtomTypes(a: TAtomType): string;
function TranslatedAtomToType(const s: string): TAtomType;
function ReadIdentifier(const s, DefaultIdent: string): string;
function SpaceCharBeforeSymbols: string;
function SpaceCharAfterSymbols: string;
implementation
{$R lazarus_indentation.res}
@ -329,6 +332,22 @@ begin
Result:=DefaultIdent;
end;
function SpaceCharBeforeSymbols: string;
begin
if atSymbol in CodeToolsOpts.DoInsertSpaceInFront then
Result:= ' '
else
Result:= '';
end;
function SpaceCharAfterSymbols: string;
begin
if atSymbol in CodeToolsOpts.DoInsertSpaceAfter then
Result:= ' '
else
Result:= '';
end;
{ TCodeToolsOptions }
constructor TCodeToolsOptions.Create;

View File

@ -41,7 +41,8 @@ uses
Controls, Forms, SynRegExpr, FileProcs, Laz2_XMLCfg, LazUTF8,
CompOptsIntf, ProjectIntf, LazIDEIntf,
ProjectResourcesIntf,
frmCustomApplicationOptions, PublishModule, IDEProcs, LazarusIDEStrConsts;
frmCustomApplicationOptions, PublishModule, IDEProcs, LazarusIDEStrConsts,
CodeToolsOptions;
type
TOnLoadSaveFilename = procedure(var Filename:string; Load:boolean) of object;
@ -383,7 +384,6 @@ type
implementation
{ TProjectBookmark }
constructor TProjectBookmark.Create(X, Y, AnID: integer; AUnitInfo: TObject);
@ -1291,7 +1291,7 @@ begin
+' { you can add units after this };'+LineEnding
+LineEnding
+'begin'+LineEnding
+' RequireDerivedFormResource:=True;'+LineEnding
+' RequireDerivedFormResource'+SpaceCharBeforeSymbols+':='+SpaceCharAfterSymbols+'True;'+LineEnding
+' Application.Initialize;'+LineEnding
+' Application.Run;'+LineEnding
+'end.'+LineEnding
@ -1586,7 +1586,7 @@ begin
if CO then
begin
NewSource.Add(' // quick check parameters');
NewSource.Add(' ErrorMsg:=CheckOptions(''h'',''help'');');
NewSource.Add(' ErrorMsg'+SpaceCharBeforeSymbols+':='+SpaceCharAfterSymbols+'CheckOptions(''h'',''help'');');
NewSource.Add(' if ErrorMsg<>'''' then begin');
NewSource.Add(' ShowException(Exception.Create(ErrorMsg));');
NewSource.Add(' Terminate;');
@ -1616,7 +1616,7 @@ begin
NewSource.Add('begin');
NewSource.Add(' inherited Create(TheOwner);');
If CS then
NewSource.Add(' StopOnException:=True;');
NewSource.Add(' StopOnException'+SpaceCharBeforeSymbols+':='+SpaceCharAfterSymbols+'True;');
NewSource.Add('end;');
NewSource.Add('');
end;
@ -1633,19 +1633,19 @@ begin
NewSource.Add('procedure '+C+'.WriteHelp;');
NewSource.Add('begin');
NewSource.Add(' { add your help code here }');
NewSource.Add(' writeln(''Usage: '',ExeName,'' -h'');');
NewSource.Add(' Writeln(''Usage: '',ExeName,'' -h'');');
NewSource.Add('end;');
NewSource.Add('');
end;
NewSource.Add('var');
NewSource.Add(' Application: '+C+';');
NewSource.Add('begin');
NewSource.Add(' Application:='+C+'.Create(nil);');
NewSource.Add(' Application'+SpaceCharBeforeSymbols+':='+SpaceCharAfterSymbols+C+'.Create(nil);');
If (T<>'') then
begin
AProject.Flags:=AProject.Flags+[pfMainUnitHasTitleStatement];
AProject.Title:=T;
NewSource.Add(' Application.Title:='''+T+''';');
NewSource.Add(' Application.Title'+SpaceCharBeforeSymbols+':='+SpaceCharBeforeSymbols+''''+T+''';');
end;
NewSource.Add(' Application.Run;');
NewSource.Add(' Application.Free;');