Skip to content

Commit

Permalink
Improved code formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
RRUZ committed Jan 22, 2021
1 parent 03056b6 commit b38c475
Show file tree
Hide file tree
Showing 37 changed files with 730 additions and 738 deletions.
46 changes: 23 additions & 23 deletions Firemonkey/Firemonkey Style Equalizer/uFMEqualizer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@ interface

type
TFMStyleLine=record
Index : Integer;
IsColor : Boolean;
Name : string;
Value : string;
Color : TAlphaColor;
Index: Integer;
IsColor: Boolean;
Name: string;
Value: string;
Color: TAlphaColor;
end;

TStyleEqualizer=class
private
FCount : integer;
FLines : TList<TFMStyleLine>;
FMod : TList<TFMStyleLine>;
FResource : TStringList;
FCount: integer;
FLines: TList<TFMStyleLine>;
FMod: TList<TFMStyleLine>;
FResource: TStringList;
FStyleBook: TStyleBook;
FLayout: TLayout;
Context : TRttiContext;
Context: TRttiContext;
procedure SetStyleBook(const Value: TStyleBook);
procedure FillList;
function PropIsColor(const Name, Value : string):Boolean;
function PropIsColor(const Name, Value: string):Boolean;
public
property StyleBook : TStyleBook read FStyleBook write SetStyleBook;
property Layout : TLayout read FLayout write FLayout;
property StyleBook: TStyleBook read FStyleBook write SetStyleBook;
property Layout: TLayout read FLayout write FLayout;
procedure Refresh;
procedure Restore;
procedure ChangeHSL(dH, dS, dL: Single);
Expand Down Expand Up @@ -76,9 +76,9 @@ function TStyleEqualizer.PropIsColor(const Name, Value: string): Boolean;

procedure TStyleEqualizer.FillList;
var
i : integer;
ALine : TFMStyleLine;
p : integer;
i: integer;
ALine: TFMStyleLine;
p: integer;
begin
FLines.Clear;
FResource.Clear;
Expand Down Expand Up @@ -129,9 +129,9 @@ procedure TStyleEqualizer.FillList;

procedure TStyleEqualizer.Refresh;
Var
i : Integer;
s : string;
Index : Integer;
i: Integer;
s: string;
Index: Integer;
begin
FStyleBook.Resource.BeginUpdate;
try
Expand Down Expand Up @@ -172,8 +172,8 @@ procedure TStyleEqualizer.SetStyleBook(const Value: TStyleBook);

procedure TStyleEqualizer.ChangeRGB(dR, dG, dB: Byte);
var
i : Integer;
v : TFMStyleLine;
i: Integer;
v: TFMStyleLine;

begin
for i := 0 to FLines.Count-1 do
Expand All @@ -190,8 +190,8 @@ procedure TStyleEqualizer.ChangeRGB(dR, dG, dB: Byte);

procedure TStyleEqualizer.ChangeHSL(dH, dS, dL: Single);
var
i : Integer;
v : TFMStyleLine;
i: Integer;
v: TFMStyleLine;
begin
for i := 0 to FLines.Count-1 do
if FLines[i].IsColor and (FLines[i].Color<>claNull) then
Expand Down
20 changes: 10 additions & 10 deletions Firemonkey/Firemonkey Style Equalizer/uFrmStyleEqualizer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ TFrmStyleEqualizer = class(TForm)
procedure Timer1Timer(Sender: TObject);
procedure TrackBarRedChange(Sender: TObject);
private
StyleEqualizer : TStyleEqualizer;
StyleEqualizer: TStyleEqualizer;
FStyleBook: TStyleBook;
FApplied : Boolean;
FIdleMSec : DWord;
FApplied: Boolean;
FIdleMSec: DWord;
procedure SetStyleBook(const Value: TStyleBook);
procedure GetCurrentHSLValues(var dh, ds, dl : single);
procedure GetCurrentRGBValues(var dr, dg, db : byte);
procedure GetCurrentHSLValues(var dh, ds, dl: single);
procedure GetCurrentRGBValues(var dr, dg, db: byte);
procedure ApplyHSLChanges;
procedure ApplyRGBChanges;
public
property StyleBook : TStyleBook read FStyleBook write SetStyleBook;
property StyleBook: TStyleBook read FStyleBook write SetStyleBook;
end;


Expand Down Expand Up @@ -99,8 +99,8 @@ function MSecIdle: DWord;

procedure TFrmStyleEqualizer.ApplyHSLChanges;
var
dh, ds, dl : single;
s : TStopwatch;
dh, ds, dl: single;
s: TStopwatch;
begin
GetCurrentHSLValues(dh, ds, dl);
s:=TStopwatch.Create;
Expand All @@ -115,8 +115,8 @@ procedure TFrmStyleEqualizer.ApplyHSLChanges;

procedure TFrmStyleEqualizer.ApplyRGBChanges;
var
dr, dg, db : byte;
s : TStopwatch;
dr, dg, db: byte;
s: TStopwatch;
begin
GetCurrentRGBValues(dr, dg, db);
if (dr>0) or (dg>0) or (db>0) then
Expand Down
2 changes: 1 addition & 1 deletion Firemonkey/Firemonkey Style Equalizer/uMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ procedure TFrmMain.BtnLoadClick(Sender: TObject);

procedure TFrmMain.BtnEQClick(Sender: TObject);
var
Frm : TFrmStyleEqualizer;
Frm: TFrmStyleEqualizer;
begin
Frm:=TFrmStyleEqualizer.Create(Self);
Frm.StyleBook:=StyleBook1;
Expand Down
4 changes: 2 additions & 2 deletions Google/Maps/Google Maps Basic Sample/fMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ implementation

procedure TfrmMain.FormCreate(Sender: TObject);
var
aStream : TMemoryStream;
aStream: TMemoryStream;
begin
WebBrowser1.Navigate('about:blank');
if Assigned(WebBrowser1.Document) then
Expand Down Expand Up @@ -173,7 +173,7 @@ procedure TfrmMain.ButtonClearMarkersClick(Sender: TObject);

procedure TfrmMain.ButtonGotoAddressClick(Sender: TObject);
var
address : string;
address: string;
begin
address := MemoAddress.Lines.Text;
address := StringReplace(StringReplace(Trim(address), #13, ' ', [rfReplaceAll]), #10, ' ', [rfReplaceAll]);
Expand Down
20 changes: 10 additions & 10 deletions Google/Maps/Google Maps ClickEvent/uMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ implementation

procedure TFrmMain.FormCreate(Sender: TObject);
var
aStream : TMemoryStream;
aStream: TMemoryStream;
begin
WebBrowser1.Navigate('about:blank');
if Assigned(WebBrowser1.Document) then
Expand All @@ -144,16 +144,16 @@ procedure TFrmMain.FormCreate(Sender: TObject);

procedure TFrmMain.WebBrowser1CommandStateChange(ASender: TObject; Command: Integer; Enable: WordBool);
var
ADocument : IHTMLDocument2;
ABody : IHTMLElement2;
Lat : string;
Lng : string;
ADocument: IHTMLDocument2;
ABody: IHTMLElement2;
Lat: string;
Lng: string;

function GetIdValue(const Id : string):string;
function GetIdValue(const Id: string):string;
var
Tag : IHTMLElement;
TagsList : IHTMLElementCollection;
Index : Integer;
Tag: IHTMLElement;
TagsList: IHTMLElementCollection;
Index: Integer;
begin
Result:='';
TagsList := ABody.getElementsByTagName('input');
Expand Down Expand Up @@ -188,7 +188,7 @@ procedure TFrmMain.WebBrowser1CommandStateChange(ASender: TObject; Command: Int

procedure TFrmMain.AddLatLngToList(const Lat, Lng: string);
var
Item : TListItem;
Item: TListItem;
begin
if (Lat<>'') and (Lng<>'') then
begin
Expand Down
8 changes: 4 additions & 4 deletions Google/Maps/Google Maps Static/UnitMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ procedure TFormMain.FormCreate(Sender: TObject);
procedure TFormMain.GetMapImage;
var
StreamData :TMemoryStream;
JPEGImage : TJPEGImage;
JPEGImage: TJPEGImage;
begin
EditURL.Text:=buildUrl;
StreamData := TMemoryStream.Create;
JPEGImage := TJPEGImage.Create;
JPEGImage := TJPEGImage.Create;
try
try
idhttp1.Get(EditURL.Text, StreamData);
Expand All @@ -125,7 +125,7 @@ procedure TFormMain.GetMapImage;
LY := (ImageMap.Height - ScrollBoxMap.ClientHeight) * -1;

ImageMap.Picture.Assign(JPEGImage);
Except On E : Exception Do
Except On E: Exception Do
MessageDlg('Exception: '+E.Message,mtError, [mbOK], 0);
End;
finally
Expand All @@ -144,7 +144,7 @@ procedure TFormMain.IdHTTP10WorkBegin(ASender: TObject; AWorkMode: TWorkMode;
AWorkCountMax: Integer);
begin
ProgressBar1.Position := 0;
ProgressBar1.Max := IdHTTP1.Response.ContentLength;
ProgressBar1.Max := IdHTTP1.Response.ContentLength;
end;

procedure TFormMain.IdHTTP10WorkEnd(ASender: TObject; AWorkMode: TWorkMode);
Expand Down
4 changes: 2 additions & 2 deletions Google/Maps/Google Maps Styles/fMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ implementation

procedure TfrmMain.FormCreate(Sender: TObject);
var
aStream : TMemoryStream;
aStream: TMemoryStream;
begin
WebBrowser1.Navigate('about:blank');
if Assigned(WebBrowser1.Document) then
Expand All @@ -298,7 +298,7 @@ procedure TfrmMain.ButtonGotoLocationClick(Sender: TObject);

procedure TfrmMain.ButtonGotoAddressClick(Sender: TObject);
var
address : string;
address: string;
begin
address := MemoAddress.Lines.Text;
address := StringReplace(StringReplace(Trim(address), #13, ' ', [rfReplaceAll]), #10, ' ', [rfReplaceAll]);
Expand Down
14 changes: 7 additions & 7 deletions Google/QrCode/Main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ implementation

const
UrlGoogleQrCode='http://chart.apis.google.com/chart?chs=%dx%d&cht=qr&chld=%s&chl=%s';
QrImgCorrStr : array [TQrImage_ErrCorrLevel] of string=('L','M','Q','H');
QrImgCorrStr: array [TQrImage_ErrCorrLevel] of string=('L','M','Q','H');


procedure WinInet_HttpGet(const Url: string;Stream:TStream);
const
BuffSize = 1024*1024;
var
hInter : HINTERNET;
hInter: HINTERNET;
UrlHandle: HINTERNET;
BytesRead: DWORD;
Buffer : Pointer;
Buffer: Pointer;
begin
hInter := InternetOpen('', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
if Assigned(hInter) then
Expand All @@ -76,9 +76,9 @@ procedure WinInet_HttpGet(const Url: string;Stream:TStream);
end
end;

procedure GetQrCode(Width,Height:Word;Correction_Level:TQrImage_ErrCorrLevel;const Data:string;StreamImage : TMemoryStream);
procedure GetQrCode(Width,Height:Word;Correction_Level:TQrImage_ErrCorrLevel;const Data:string;StreamImage: TMemoryStream);
Var
EncodedURL : string;
EncodedURL: string;
begin
EncodedURL:=Format(UrlGoogleQrCode,[Width,Height,QrImgCorrStr[Correction_Level],HTTPEncode(Data)]);
WinInet_HttpGet(EncodedURL,StreamImage);
Expand All @@ -87,8 +87,8 @@ procedure GetQrCode(Width,Height:Word;Correction_Level:TQrImage_ErrCorrLevel;con

procedure TFrmMain.BtnGenerateClick(Sender: TObject);
var
ImageStream : TMemoryStream;
PngImage : TPngImage;
ImageStream: TMemoryStream;
PngImage: TPngImage;
begin
Image1.Picture:=nil;
ImageStream:=TMemoryStream.Create;
Expand Down
4 changes: 2 additions & 2 deletions Misc/SFX/Common.pas
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ interface

type
TRecSFX= record
Size : Integer;
Name : Array [0..MAX_PATH] of AnsiChar;
Size: Integer;
Name: Array [0..MAX_PATH] of AnsiChar;
end;

implementation
Expand Down
18 changes: 9 additions & 9 deletions Misc/SFX/MainCreateSFX.pas
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ TFrmCreateSFX = class(TForm)
procedure ButtonSelectClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
FSrcFileName : string;
FSfxFileName : string;
FSrcFileName: string;
FSfxFileName: string;
function CreateStub:Boolean;
function GetCompressionLevel: TCompressionLevel;
procedure CreateSFX;
Expand Down Expand Up @@ -61,13 +61,13 @@ procedure TFrmCreateSFX.ButtonSelectClick(Sender: TObject);

procedure TFrmCreateSFX.CreateSFX;
var
SrcFileStream : TFileStream;
SrcFileStream: TFileStream;
CompressedStream: TMemoryStream;
hDestRes : THANDLE;
Compressor : TCompressionStream;
RecSFX : TRecSFX;
hDestRes: THANDLE;
Compressor: TCompressionStream;
RecSFX: TRecSFX;
begin
SrcFileStream := TFileStream.Create(FSrcFileName,fmOpenRead or fmShareDenyNone);
SrcFileStream := TFileStream.Create(FSrcFileName,fmOpenRead or fmShareDenyNone);
ProgressBarSfx.Max := SrcFileStream.Size;
try
try
Expand Down Expand Up @@ -118,7 +118,7 @@ procedure TFrmCreateSFX.CreateSFX;
finally
SrcFileStream.Free;
end;
except on e : exception do
except on e: exception do
Application.MessageBox(PAnsiChar(e.Message),'Error',MB_OK+MB_ICONERROR);
end;
end;
Expand Down Expand Up @@ -153,7 +153,7 @@ procedure TFrmCreateSFX.FormCreate(Sender: TObject);

function TFrmCreateSFX.GetCompressionLevel: TCompressionLevel;
var
i : Integer;
i: Integer;
begin
Result:=clMax;
for i:= 0 to ComponentCount - 1 do
Expand Down
Loading

0 comments on commit b38c475

Please sign in to comment.