IDE: Unify formatting in CharacterMap code.

git-svn-id: trunk@54376 -
This commit is contained in:
juha 2017-03-08 22:04:48 +00:00
parent 3439d5486e
commit 54800c48bf

View File

@ -163,9 +163,9 @@ end;
function RoundUp(Value, Divi:integer):integer; function RoundUp(Value, Divi:integer):integer;
begin begin
if Value mod Divi=0 then if Value mod Divi = 0 then
Result:=Value div Divi else Result:=Value div Divi else
Result:=(Value div Divi)+1; Result:=(Value div Divi)+1;
end; end;
procedure TCharacterMapDialog.cbCodePageSelect(Sender: TObject); procedure TCharacterMapDialog.cbCodePageSelect(Sender: TObject);
@ -174,38 +174,38 @@ begin
end; end;
procedure TCharacterMapDialog.cbUniRangeSelect(Sender: TObject); procedure TCharacterMapDialog.cbUniRangeSelect(Sender: TObject);
var cnt, x, y :integer; var
S,E:Integer; cnt, x, y: integer;
S, E: integer;
begin begin
S:=UnicodeBlocks[cbUniRange.ItemIndex].S; S:=UnicodeBlocks[cbUniRange.ItemIndex].S;
E:=UnicodeBlocks[cbUniRange.ItemIndex].E; E:=UnicodeBlocks[cbUniRange.ItemIndex].E;
StringGrid2.Clear; StringGrid2.Clear;
StringGrid2.ColCount:=16; StringGrid2.ColCount:=16;
StringGrid2.RowCount:=RoundUp(E-S,16); StringGrid2.RowCount:=RoundUp(E-S,16);
cnt:=0; cnt:=0;
for y:=0 to StringGrid2.RowCount-1 do for y:=0 to StringGrid2.RowCount-1 do
for x:=0 to StringGrid2.ColCount-1 do for x:=0 to StringGrid2.ColCount-1 do
begin begin
if S+Cnt<=E then if S+Cnt<=E then
StringGrid2.Cells[x,y]:=UnicodeToUTF8(S+Cnt); StringGrid2.Cells[x,y]:=UnicodeToUTF8(S+Cnt);
inc(cnt); inc(cnt);
end; end;
StringGrid2.AutoSizeColumns; StringGrid2.AutoSizeColumns;
end; end;
procedure TCharacterMapDialog.FormKeyDown(Sender: TObject; var Key: Word; procedure TCharacterMapDialog.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
Shift: TShiftState);
begin begin
if Key=VK_ESCAPE then if Key=VK_ESCAPE then
begin begin
Close; Close;
Key:= 0; Key:= 0;
Exit
end; end;
end; end;
procedure TCharacterMapDialog.FormShow(Sender: TObject); procedure TCharacterMapDialog.FormShow(Sender: TObject);
var i:integer; var
i:integer;
begin begin
StringGrid1.Font.Name := EditorOpts.EditorFont; StringGrid1.Font.Name := EditorOpts.EditorFont;
StringGrid2.Font.Name := EditorOpts.EditorFont; StringGrid2.Font.Name := EditorOpts.EditorFont;
@ -215,7 +215,8 @@ begin
StringGrid1.AutoSizeColumns; StringGrid1.AutoSizeColumns;
cbUniRange.Items.Clear; cbUniRange.Items.Clear;
for i:=0 to MaxUnicodeBlocks do cbUniRange.Items.Add(UnicodeBlocks[i].PG); for i:=0 to MaxUnicodeBlocks do
cbUniRange.Items.Add(UnicodeBlocks[i].PG);
cbUniRange.ItemIndex:=0; cbUniRange.ItemIndex:=0;
cbUniRangeSelect(nil); cbUniRangeSelect(nil);
end; end;
@ -237,7 +238,8 @@ var
sg: TStringGrid; sg: TStringGrid;
s: string; s: string;
begin begin
if Key = #13 then begin if Key = #13 then
begin
sg := Sender as TStringGrid; sg := Sender as TStringGrid;
s := sg.Cells[sg.Col, sg.Row]; s := sg.Cells[sg.Col, sg.Row];
if (s <> '') and (Assigned(OnInsertCharacter)) then if (s <> '') and (Assigned(OnInsertCharacter)) then
@ -281,9 +283,7 @@ begin
DoStatusGrid1(Col, Row); DoStatusGrid1(Col, Row);
end end
else else
begin
CharInfoLabel.Caption := '-'; CharInfoLabel.Caption := '-';
end;
end; end;
procedure TCharacterMapDialog.DoStatusGrid2(ACol, ARow: integer); procedure TCharacterMapDialog.DoStatusGrid2(ACol, ARow: integer);
@ -313,9 +313,7 @@ begin
DoStatusGrid2(Col, Row); DoStatusGrid2(Col, Row);
end end
else else
begin
CharInfoLabel.Caption := '-'; CharInfoLabel.Caption := '-';
end;
end; end;
procedure TCharacterMapDialog.FillCharMap; procedure TCharacterMapDialog.FillCharMap;