Icons_to_html: replaced some SpeedButtons with ToolBar/ToolButtons, patch by Roland Hahn

This commit is contained in:
Maxim Ganetsky 2024-10-27 14:38:18 +03:00
parent 7123dc549d
commit d11f653783
3 changed files with 102 additions and 114 deletions
tools/icons_to_html

View File

@ -1,7 +1,7 @@
object MainForm: TMainForm
Left = 607
Left = 904
Height = 515
Top = 222
Top = 149
Width = 700
AllowDropFiles = True
Caption = 'IconTable'
@ -9,46 +9,23 @@ object MainForm: TMainForm
ClientWidth = 700
Constraints.MinHeight = 515
Constraints.MinWidth = 700
Position = poScreenCenter
ShowHint = True
OnClose = FormClose
OnCreate = FormCreate
OnDropFiles = FormDropFiles
OnShow = FormShow
object DirectoryEdit: TDirectoryEdit
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = sbtnLastDirs
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = sbtnLastDirs
Left = 10
Height = 33
Hint = 'Folder with images for which the HTML preview should be created'
Top = 5
Width = 630
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
Images = ImageList
ImageIndex = 1
Flat = True
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 10
BorderSpacing.Top = 10
BorderSpacing.Right = 2
MaxLength = 0
TabOrder = 0
OnChange = DirectoryEditChange
end
Position = poScreenCenter
ShowHint = True
LCLVersion = '3.6.0.0'
inline SynEdit: TSynEdit
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = DirectoryEdit
AnchorSideTop.Control = ToolBar
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = bbtnClose
Left = 0
Height = 415
Top = 48
Height = 425
Top = 44
Width = 700
BorderSpacing.Top = 10
BorderSpacing.Bottom = 10
@ -59,7 +36,7 @@ object MainForm: TMainForm
Font.Quality = fqCleartype
ParentColor = False
ParentFont = False
TabOrder = 1
TabOrder = 6
TabStop = False
Gutter.Width = 0
Gutter.MouseActions = <>
@ -515,33 +492,16 @@ object MainForm: TMainForm
inline SynLeftGutterPartList1: TSynGutterPartList
end
end
object sbtnLastDirs: TSpeedButton
AnchorSideTop.Control = sbtnMenu
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = sbtnMenu
Left = 642
Height = 23
Hint = 'Last used'
Top = 10
Width = 23
Anchors = [akTop, akRight]
BorderSpacing.Right = 2
Flat = True
Images = ImageList
ImageIndex = 2
Spacing = -1
OnClick = sbtnLastDirsClick
end
object bbtnClose: TBitBtn
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 619
Height = 32
Left = 614
Height = 26
Hint = 'Close application'
Top = 473
Width = 71
Top = 479
Width = 76
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Right = 10
@ -550,19 +510,21 @@ object MainForm: TMainForm
Caption = 'Close'
Images = ImageList
ImageIndex = 6
OnClick = bbtnCloseClick
ParentShowHint = False
ShowHint = True
Spacing = 5
TabOrder = 5
OnClick = bbtnCloseClick
end
object bbtnSave: TBitBtn
AnchorSideTop.Control = bbtnClose
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = bbtnClose
Left = 544
Height = 32
Left = 535
Height = 26
Hint = 'Save created HTML page as "IconTable.html" file in the specified folder'
Top = 473
Width = 67
Top = 479
Width = 71
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Right = 8
@ -570,18 +532,18 @@ object MainForm: TMainForm
Enabled = False
Images = ImageList
ImageIndex = 5
OnClick = bbtnSaveClick
Spacing = 5
TabOrder = 4
OnClick = bbtnSaveClick
end
object bbtnCreateHTML: TBitBtn
AnchorSideTop.Control = bbtnPreview
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = bbtnPreview
Left = 329
Height = 32
Left = 316
Height = 26
Hint = 'Create HTML page for images found in the selected directory'
Top = 473
Top = 479
Width = 116
Anchors = [akTop, akRight]
AutoSize = True
@ -591,17 +553,17 @@ object MainForm: TMainForm
Enabled = False
Images = ImageList
ImageIndex = 3
OnClick = bbtnCreateHTMLClick
Spacing = 5
TabOrder = 2
OnClick = bbtnCreateHTMLClick
end
object bbtnPreview: TBitBtn
AnchorSideTop.Control = bbtnSave
AnchorSideRight.Control = bbtnSave
Left = 453
Height = 32
Top = 473
Width = 83
Left = 440
Height = 26
Top = 479
Width = 87
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Right = 8
@ -609,44 +571,86 @@ object MainForm: TMainForm
Enabled = False
Images = ImageList
ImageIndex = 4
TabOrder = 3
OnClick = bbtnPreviewClick
TabOrder = 3
end
object sbtnMenu: TSpeedButton
object ToolBar: TToolBar
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 667
Height = 23
Hint = 'Options'
Left = 641
Height = 24
Top = 10
Width = 23
Width = 49
Align = alNone
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Top = 10
BorderSpacing.Right = 10
Flat = True
ButtonHeight = 24
ButtonWidth = 24
EdgeBorders = []
EdgeInner = esNone
EdgeOuter = esNone
Images = ImageList
ImageIndex = 7
Spacing = -1
OnClick = sbtnMenuClick
TabOrder = 1
TabStop = True
Transparent = True
Wrapable = False
object tbLastDirs: TToolButton
Left = 1
Hint = 'Last used'
Top = 0
DropdownMenu = popLastDirs
ImageIndex = 2
end
object tbMenu: TToolButton
AnchorSideRight.Side = asrBottom
Left = 25
Hint = 'Options'
Top = 0
DropdownMenu = popMenu
ImageIndex = 7
end
end
object DirectoryEdit: TDirectoryEdit
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = ToolBar
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = ToolBar
Left = 10
Height = 23
Hint = 'Folder with images for which the HTML preview should be created'
Top = 11
Width = 631
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
Images = ImageList
ImageIndex = 1
Flat = True
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 10
MaxLength = 0
TabOrder = 0
OnChange = DirectoryEditChange
end
object TaskDialog: TTaskDialog
Buttons = <>
RadioButtons = <>
QueryItemIndex = 0
Left = 96
Top = 64
Top = 104
end
object SynHTMLSyn: TSynHTMLSyn
DefaultFilter = 'HTML Document (*.htm,*.html)|*.htm;*.html'
Enabled = False
Left = 176
Top = 64
Top = 104
end
object ImageList: TImageList
Scaled = True
Left = 256
Top = 64
Top = 104
Bitmap = {
4C7A080000001000000010000000950700000000000078DAED587B70536516FF
7C002952677C21E00C33A0B3EEE8AAE3BAEBAAA332CA435D15055C11C5D91D59
@ -933,13 +937,12 @@ object MainForm: TMainForm
end
object popLastDirs: TPopupMenu
Images = ImageList
Alignment = paRight
Left = 330
Top = 64
Top = 104
end
object popMenu: TPopupMenu
Left = 408
Top = 64
Top = 104
object menuDarkHTMLpage: TMenuItem
Caption = 'Dark HTML page'
OnClick = menuDarkHTMLpageClick

View File

@ -1,7 +1,5 @@
{"version":1,"strings":[
{"hash":104478853,"name":"tmainform.caption","sourcebytes":[73,99,111,110,84,97,98,108,101],"value":"IconTable"},
{"hash":150702596,"name":"tmainform.directoryedit.hint","sourcebytes":[70,111,108,100,101,114,32,119,105,116,104,32,105,109,97,103,101,115,32,102,111,114,32,119,104,105,99,104,32,116,104,101,32,72,84,77,76,32,112,114,101,118,105,101,119,32,115,104,111,117,108,100,32,98,101,32,99,114,101,97,116,101,100],"value":"Folder with images for which the HTML preview should be created"},
{"hash":174562100,"name":"tmainform.sbtnlastdirs.hint","sourcebytes":[76,97,115,116,32,117,115,101,100],"value":"Last used"},
{"hash":146468846,"name":"tmainform.bbtnclose.hint","sourcebytes":[67,108,111,115,101,32,97,112,112,108,105,99,97,116,105,111,110],"value":"Close application"},
{"hash":4863637,"name":"tmainform.bbtnclose.caption","sourcebytes":[67,108,111,115,101],"value":"Close"},
{"hash":121132146,"name":"tmainform.bbtnsave.hint","sourcebytes":[83,97,118,101,32,99,114,101,97,116,101,100,32,72,84,77,76,32,112,97,103,101,32,97,115,32,34,73,99,111,110,84,97,98,108,101,46,104,116,109,108,34,32,102,105,108,101,32,105,110,32,116,104,101,32,115,112,101,99,105,102,105,101,100,32,102,111,108,100,101,114],"value":"Save created HTML page as \"IconTable.html\" file in the specified folder"},
@ -9,7 +7,9 @@
{"hash":119190121,"name":"tmainform.bbtncreatehtml.hint","sourcebytes":[67,114,101,97,116,101,32,72,84,77,76,32,112,97,103,101,32,102,111,114,32,105,109,97,103,101,115,32,102,111,117,110,100,32,105,110,32,116,104,101,32,115,101,108,101,99,116,101,100,32,100,105,114,101,99,116,111,114,121],"value":"Create HTML page for images found in the selected directory"},
{"hash":171857052,"name":"tmainform.bbtncreatehtml.caption","sourcebytes":[67,114,101,97,116,101,32,72,84,77,76],"value":"Create HTML"},
{"hash":126668695,"name":"tmainform.bbtnpreview.caption","sourcebytes":[80,114,101,118,105,101,119],"value":"Preview"},
{"hash":108725763,"name":"tmainform.sbtnmenu.hint","sourcebytes":[79,112,116,105,111,110,115],"value":"Options"},
{"hash":174562100,"name":"tmainform.tblastdirs.hint","sourcebytes":[76,97,115,116,32,117,115,101,100],"value":"Last used"},
{"hash":108725763,"name":"tmainform.tbmenu.hint","sourcebytes":[79,112,116,105,111,110,115],"value":"Options"},
{"hash":150702596,"name":"tmainform.directoryedit.hint","sourcebytes":[70,111,108,100,101,114,32,119,105,116,104,32,105,109,97,103,101,115,32,102,111,114,32,119,104,105,99,104,32,116,104,101,32,72,84,77,76,32,112,114,101,118,105,101,119,32,115,104,111,117,108,100,32,98,101,32,99,114,101,97,116,101,100],"value":"Folder with images for which the HTML preview should be created"},
{"hash":157953765,"name":"tmainform.menudarkhtmlpage.caption","sourcebytes":[68,97,114,107,32,72,84,77,76,32,112,97,103,101],"value":"Dark HTML page"},
{"hash":2540136,"name":"tmainform.menuhtmlpageenglish.caption","sourcebytes":[72,84,77,76,32,112,97,103,101,32,105,110,32,69,110,103,108,105,115,104],"value":"HTML page in English"}
]}

View File

@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils, StrUtils, Forms, FPImage, Controls, Dialogs, EditBtn, FileUtil,
LazUTF8, LazFileUtils, LCLIntf, LCLType, Buttons, Menus, IniFiles,
SynEdit, SynHighlighterHTML, DefaultTranslator;
SynEdit, SynHighlighterHTML, DefaultTranslator, ComCtrls;
type
@ -24,11 +24,12 @@ type
menuHTMLpageEnglish: TMenuItem;
popLastDirs: TPopupMenu;
popMenu: TPopupMenu;
sbtnLastDirs: TSpeedButton;
sbtnMenu: TSpeedButton;
SynEdit: TSynEdit;
SynHTMLSyn: TSynHTMLSyn;
TaskDialog: TTaskDialog;
ToolBar: TToolBar;
tbLastDirs: TToolButton;
tbMenu: TToolButton;
procedure bbtnCloseClick(Sender: TObject);
procedure bbtnCreateHTMLClick(Sender: TObject);
procedure bbtnPreviewClick(Sender: TObject);
@ -42,8 +43,6 @@ type
procedure LastDirClick(Sender: TObject);
procedure menuDarkHTMLpageClick(Sender: TObject);
procedure menuHTMLpageEnglishClick(Sender: TObject);
procedure sbtnLastDirsClick(Sender: TObject);
procedure sbtnMenuClick(Sender: TObject);
private
ImgDirectory: String;
function GetImgDirectory(P: String): String;
@ -98,7 +97,6 @@ resourcestring
rsLicense = 'License:' + LineEnding + '%s';
rsFreelyAvailable = '(freely available, no restrictions in usage)';
{ TMainForm }
procedure TMainForm.FormCreate(Sender: TObject);
@ -161,7 +159,7 @@ begin
if DirectoryExists(popLastDirs.Items[0].Caption) then
DirectoryEdit.Directory := popLastDirs.Items[0].Caption;
sbtnLastDirs.Enabled := popLastDirs.Items[0].Caption > '';
tbLastDirs.Enabled := popLastDirs.Items[0].Caption > '';
end;
procedure TMainForm.FormDropFiles(Sender: TObject; const FileNames: array of String);
@ -225,9 +223,12 @@ begin
SynEdit.Lines.Clear;
CreateHTML(SynEdit.Lines, False);
bbtnPreview.Enabled := True;
bbtnSave.Enabled := True;
bbtnPreview.SetFocus;
if SynEdit.Text > '' then
begin
bbtnPreview.Enabled := True;
bbtnSave.Enabled := True;
bbtnPreview.SetFocus;
end;
UpdateLastDirs(ImgDirectory, False);
end;
@ -515,22 +516,6 @@ begin
bbtnCreateHTML.Click;
end;
procedure TMainForm.sbtnLastDirsClick(Sender: TObject);
var
pt: TPoint;
begin
pt := sbtnLastDirs.ClientToScreen(Point(sbtnLastDirs.Width, sbtnLastDirs.Height));
popLastDirs.PopUp(pt.X, pt.Y);
end;
procedure TMainForm.sbtnMenuClick(Sender: TObject);
var
pt: TPoint;
begin
pt := sbtnMenu.ClientToScreen(Point(sbtnMenu.Width, sbtnMenu.Height));
popMenu.PopUp(pt.X, pt.Y);
end;
procedure TMainForm.UpdateLastDirs(ImgDir: String; Delete: Boolean);
var
i: Integer;
@ -552,7 +537,7 @@ begin
popLastDirs.Items[LastDirsMax].Visible := True;
popLastDirs.Items[LastDirsMax].MenuIndex := 0;
end;
sbtnLastDirs.Enabled := popLastDirs.Items[0].Caption > '';
tbLastDirs.Enabled := popLastDirs.Items[0].Caption > '';
end;
procedure TMainForm.ShowMsg(const AMsgCaption: String; const AMsg: String);