Skip to content

Commit

Permalink
function aligment added
Browse files Browse the repository at this point in the history
  • Loading branch information
vladk1973 authored Sep 7, 2021
1 parent 17f8805 commit 326b8c3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 21 deletions.
29 changes: 25 additions & 4 deletions AlignStringsUnit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface
TAlignStrings = class(TStringList)
private
procedure AlignDeclarations(const StartRow: Integer);
procedure AlignVars(const StartRow: Integer);
procedure AlignVars(const StartRow: Integer; AlignColumn: Integer = 0);
procedure AlignFunction(const StartRow: Integer; KeyWord: string);
public
procedure AlignFrom(const StartRow: Integer; KeyWord: string);
Expand Down Expand Up @@ -101,18 +101,39 @@ procedure TAlignStrings.AlignDeclarations(const StartRow: Integer);
end;

procedure TAlignStrings.AlignFunction(const StartRow: Integer; KeyWord: string);
var
Words: TStringList;
AlignColumn, Cnt: Integer;
begin
if StartRow+1 < Count then
AlignVars(StartRow+1);
begin
Words := WholeWords(Strings[StartRow]);
if Assigned(Words) then
try
Cnt := Words.Count;
case Cnt of
2 : AlignColumn := Pos(Words[1],Strings[StartRow])+2;
3..255 : AlignColumn := Pos(Words[2],Strings[StartRow])+2;
else
AlignColumn := 0;
end;
finally
Words.Free;
end;
AlignVars(StartRow+1, AlignColumn);
end;
end;

procedure TAlignStrings.AlignVars(const StartRow: Integer);
procedure TAlignStrings.AlignVars(const StartRow: Integer; AlignColumn: Integer = 0);
var
iStartPos, iMax, iLen, i: Integer;
Line, S: string;
begin
iMax := 0;
iStartPos := Pos(cnstAlignStartWords[3],Strings[StartRow]);
if AlignColumn = 0 then
iStartPos := Pos(cnstAlignStartWords[3],Strings[StartRow])
else
iStartPos := AlignColumn;

for i := StartRow to Count-1 do
begin
Expand Down
34 changes: 17 additions & 17 deletions dia2.notepad.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -242,27 +242,12 @@
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployClass Name="DependencyModule">
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
<DeployClass Name="ProjectiOSDeviceResourceRules">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXResource">
Expand Down Expand Up @@ -641,12 +626,27 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceResourceRules">
<DeployClass Name="DependencyModule">
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
Expand Down

0 comments on commit 326b8c3

Please sign in to comment.