Tools: Updated version of the IconTable tool showing the image count (by Roland Hahn)

This commit is contained in:
wp_xyz 2022-06-10 18:28:13 +02:00
parent f1353bf99c
commit be6696ff4b
3 changed files with 24 additions and 20 deletions

View File

@ -2203,6 +2203,9 @@
</tr>
</table>
<div class="info_container">
This folder contains 1452 icons in 242 icon groups with 6
icon sizes.
<hr>
The images in this folder can be used in Lazarus applications as toolbar or button icons.<br>
<br>
The different sizes as required by LCL scaling for high-dpi screens can be used like this, for example:<br>

View File

@ -1,7 +1,7 @@
object MainForm: TMainForm
Left = 450
Left = 1029
Height = 515
Top = 214
Top = 221
Width = 600
Caption = 'IconTable'
ClientHeight = 515

View File

@ -30,10 +30,11 @@ type
procedure btnShowClick(Sender: TObject);
procedure btnCloseClick(Sender: TObject);
private
fn: String;
ImgDir: String;
procedure ErrorMsg(const AMsg: String);
function GetDestFileName: String;
procedure InfoMsg(const AMsg: String);
procedure ErrorMsg(const AMsg: String);
public
end;
@ -86,6 +87,7 @@ var
ips: Integer;
isl: Integer;
StartIdx: Integer = 0;
IconGroups: Integer = 0;
BodyFontColor: String = ' color: #000000;';
BodyBackColor: String = ' background-color: #ffffff;';
InfoBackColor: String = ' background-color: #ffffe0;';
@ -184,24 +186,27 @@ begin
end;
SynEdit.Lines.Add(' </tr>');
StartIdx := i + 1;
IconGroups := IconGroups + 1;
end;
end;
SynEdit.Lines.Add('</table>');
SynEdit.Lines.Add('<div class="info_container">');
SynEdit.Lines.Add('This folder contains ' + IntToStr(IcoFileList.Count) + ' icons in ' + IntToStr(IconGroups) + ' icon groups with ' + IntToStr(PixSizeList.Count) + LineEnding + ' icon sizes.');
if FileExists(ImgDir + 'lazarus_general_purpose_images.txt') then
begin
SynEdit.Lines.Add('<div class="info_container">');
try
InfoTxtList := TStringList.Create;
InfoTxtList.LoadFromFile(ImgDir + 'lazarus_general_purpose_images.txt');
SynEdit.Lines.Add('<hr>');
for i := 0 to InfoTxtList.Count - 1 do
SynEdit.Lines.Add(InfoTxtList[i] + '<br>');
finally
InfoTxtList.Free;
end;
SynEdit.Lines.Add('</div>');
end;
SynEdit.Lines.Add('</div>');
SynEdit.Lines.Add('</body>');
SynEdit.Lines.Add('</html>');
@ -221,8 +226,6 @@ begin
end;
procedure TMainForm.btnSaveClick(Sender: TObject);
var
fn: String;
begin
fn := GetDestFileName;
try
@ -236,8 +239,6 @@ begin
end;
procedure TMainForm.btnShowClick(Sender: TObject);
var
fn: String;
begin
fn := GetDestFileName;
if FileExists(fn) then
@ -250,17 +251,6 @@ begin
Close;
end;
procedure TMainForm.ErrorMsg(const AMsg: String);
begin
TaskDialog.Caption := 'Error';
TaskDialog.MainIcon := tdiError;
TaskDialog.Title := 'Error';
TaskDialog.CommonButtons := [tcbOk];
TaskDialog.DefaultButton := tcbOk;
TaskDialog.Text := AMsg;
TaskDialog.Execute;
end;
function TMainForm.GetDestFileName: String;
begin
Result := AppendPathDelim(DirectoryEdit.Text) + 'IconTable.html';
@ -277,4 +267,15 @@ begin
TaskDialog.Execute;
end;
procedure TMainForm.ErrorMsg(const AMsg: String);
begin
TaskDialog.Caption := 'Error';
TaskDialog.MainIcon := tdiError;
TaskDialog.Title := 'Error';
TaskDialog.CommonButtons := [tcbOk];
TaskDialog.DefaultButton := tcbOk;
TaskDialog.Text := AMsg;
TaskDialog.Execute;
end;
end.