From f128b88574694d0c27f4d24d01204285abcf6e0c Mon Sep 17 00:00:00 2001 From: wp_xyz Date: Tue, 20 May 2025 23:01:56 +0200 Subject: [PATCH] tools/chmmaker: Fix missing AutoSize instructions. Fix failure to build LHelp. Clean-up message dialogs. Issue #41657. --- tools/chmmaker/chmmain.lfm | 60 +++++++++++++++-------------- tools/chmmaker/chmmain.pas | 34 +++++++++------- tools/chmmaker/chmsitemapeditor.pas | 7 +++- 3 files changed, 57 insertions(+), 44 deletions(-) diff --git a/tools/chmmaker/chmmain.lfm b/tools/chmmaker/chmmain.lfm index 7834f0eadc..e9b40d5bb8 100644 --- a/tools/chmmaker/chmmain.lfm +++ b/tools/chmmaker/chmmain.lfm @@ -1,15 +1,15 @@ object CHMForm: TCHMForm Left = 368 - Height = 447 + Height = 453 Top = 154 - Width = 583 + Width = 643 HorzScrollBar.Page = 582 VertScrollBar.Page = 399 ActiveControl = FileListBox AutoScroll = True Caption = 'Compiled HTML Help Project - [Made with Freepascal]' - ClientHeight = 447 - ClientWidth = 583 + ClientHeight = 453 + ClientWidth = 643 Menu = MainMenu1 ShowInTaskBar = stAlways LCLVersion = '4.99.0.0' @@ -20,13 +20,13 @@ object CHMForm: TCHMForm object StatusBar1: TStatusBar Left = 0 Height = 23 - Top = 424 - Width = 583 + Top = 430 + Width = 643 Panels = <> end object GroupBox1: TGroupBox Left = 8 - Height = 408 + Height = 414 Top = 8 Width = 228 Align = alLeft @@ -35,12 +35,12 @@ object CHMForm: TCHMForm BorderSpacing.Right = 4 BorderSpacing.Bottom = 8 Caption = 'Files' - ClientHeight = 388 + ClientHeight = 394 ClientWidth = 224 TabOrder = 0 object FileListBox: TListBox Left = 8 - Height = 238 + Height = 243 Top = 8 Width = 208 Align = alClient @@ -54,12 +54,13 @@ object CHMForm: TCHMForm end object Panel2: TPanel Left = 0 - Height = 134 - Top = 254 + Height = 135 + Top = 259 Width = 224 Align = alBottom + AutoSize = True BevelOuter = bvNone - ClientHeight = 134 + ClientHeight = 135 ClientWidth = 224 TabOrder = 1 object FilesNoteLabel: TLabel @@ -69,7 +70,7 @@ object CHMForm: TCHMForm AnchorSideRight.Control = Panel2 AnchorSideRight.Side = asrBottom Left = 6 - Height = 29 + Height = 30 Top = 99 Width = 212 Anchors = [akTop, akLeft, akRight, akBottom] @@ -161,17 +162,17 @@ object CHMForm: TCHMForm end object MainPanel: TPanel Left = 249 - Height = 408 + Height = 414 Top = 8 - Width = 326 + Width = 386 Align = alClient BorderSpacing.Left = 4 BorderSpacing.Top = 8 BorderSpacing.Right = 8 BorderSpacing.Bottom = 8 BevelOuter = bvNone - ClientHeight = 408 - ClientWidth = 326 + ClientHeight = 414 + ClientWidth = 386 TabOrder = 2 object TableOfContentsLabel: TLabel AnchorSideLeft.Control = MainPanel @@ -229,7 +230,7 @@ object CHMForm: TCHMForm Left = 0 Height = 23 Top = 73 - Width = 250 + Width = 310 OnAcceptFileName = TOCEditAcceptFileName DialogOptions = [] Filter = 'Table of Contents Files(*.hhc)|*.hhc|All files|*' @@ -272,7 +273,7 @@ object CHMForm: TCHMForm AnchorSideTop.Side = asrCenter AnchorSideRight.Control = MainPanel AnchorSideRight.Side = asrBottom - Left = 266 + Left = 326 Height = 25 Top = 72 Width = 60 @@ -289,7 +290,7 @@ object CHMForm: TCHMForm AnchorSideTop.Side = asrCenter AnchorSideRight.Control = MainPanel AnchorSideRight.Side = asrBottom - Left = 266 + Left = 326 Height = 25 Top = 126 Width = 60 @@ -310,7 +311,7 @@ object CHMForm: TCHMForm Left = 0 Height = 23 Top = 181 - Width = 326 + Width = 386 Anchors = [akTop, akLeft, akRight] AutoSelect = False BorderSpacing.Top = 4 @@ -323,9 +324,9 @@ object CHMForm: TCHMForm AnchorSideRight.Control = CompileViewBtn AnchorSideBottom.Control = MainPanel AnchorSideBottom.Side = asrBottom - Left = 109 + Left = 169 Height = 33 - Top = 375 + Top = 381 Width = 79 Anchors = [akRight, akBottom] AutoSize = True @@ -342,9 +343,9 @@ object CHMForm: TCHMForm AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = MainPanel AnchorSideBottom.Side = asrBottom - Left = 196 + Left = 256 Height = 33 - Top = 375 + Top = 381 Width = 130 Anchors = [akRight, akBottom] AutoSize = True @@ -362,7 +363,7 @@ object CHMForm: TCHMForm Left = 0 Height = 23 Top = 337 - Width = 326 + Width = 386 OnAcceptFileName = ChmFileNameEditAcceptFileName DialogKind = dkSave DialogTitle = 'Save CHM as...' @@ -399,7 +400,7 @@ object CHMForm: TCHMForm Left = 0 Height = 23 Top = 19 - Width = 326 + Width = 386 Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 4 TabOrder = 0 @@ -425,10 +426,13 @@ object CHMForm: TCHMForm object ScanHtmlCheck: TCheckBox AnchorSideLeft.Control = CompileTimeOptionsGroupbox AnchorSideTop.Control = CompileTimeOptionsGroupbox + AnchorSideRight.Control = CompileTimeOptionsGroupbox + AnchorSideRight.Side = asrBottom Left = 8 Height = 19 Top = 0 Width = 305 + Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 8 BorderSpacing.Right = 8 Caption = 'Parse *.htm* files to include '#10'linked pages and images' @@ -454,7 +458,7 @@ object CHMForm: TCHMForm end object Splitter: TSplitter Left = 240 - Height = 424 + Height = 430 Top = 0 Width = 5 ResizeStyle = rsPattern diff --git a/tools/chmmaker/chmmain.pas b/tools/chmmaker/chmmain.pas index ac53a6e7c0..b592e5a098 100644 --- a/tools/chmmaker/chmmain.pas +++ b/tools/chmmaker/chmmain.pas @@ -191,8 +191,8 @@ var end; end; begin - if MessageDlg('This will add all files in the project directory ' + LineEnding + - 'recursively. Do you want to continue?', + if MessageDlg('This will add all files in the project directory recursively.' + LineEnding + + 'Do you want to continue?', mtConfirmation, [mbYes, mbNo],0) <> mrYes then exit; Modified := True; Files := TStringList.Create; @@ -257,7 +257,7 @@ var begin if (Project.OutputFileName = '') then begin - MessageDlg('You must set a filename for the output CHM file!', mtError, [mbCancel], 0); + MessageDlg('You must set a filename for the output CHM file.', mtError, [mbCancel], 0); Exit; end; Save(False); @@ -280,7 +280,7 @@ var begin if Project.OutputFileName = '' then begin - MessageDlg('You must set a filename for the output CHM file!', mtError, [mbCancel], 0); + MessageDlg('You must set a filename for the output CHM file.', mtError, [mbCancel], 0); Exit; end; CompileBtnClick(Sender); @@ -290,22 +290,26 @@ begin LHelpName := '../../components/chmhelp/lhelp/lhelp' + ext; if not FileExists(LHelpName) then begin - if MessageDlg('LHelp could not be located at '+ LHelpName +' Try to build using lazbuild?', mtError, [mbCancel, mbYes], 0) = mrYes then + if MessageDlg( + 'LHelp could not be located at '+ LHelpName + + LineEnding + LineEnding + + 'Try to build using LazBuild?', mtError, [mbCancel, mbYes], 0) = mrYes then begin if not FileExists('../../lazbuild' + ext) then begin - MessageDlg('lazbuild coul not be found.', mtError, [mbCancel], 0); + MessageDlg('LazBuild could not be found.', mtError, [mbCancel], 0); Exit; end; Proc := TProcessUTF8.Create(Self); - Proc.Parameters.Add('../../../lazbuild ./lhelp.lpi'); + Proc.Executable := '../../../lazbuild'; + Proc.Parameters.Add('./lhelp.lpi'); SetCurrentDir('../../components/chmhelp/lhelp/'); Proc.Options := [poWaitOnExit]; Proc.Execute; SetCurrentDir('../../../tools/chmmaker/'); if Proc.ExitStatus <> 0 then begin - MessageDlg('lhelp failed to build', mtError, [mbCancel], 0); + MessageDlg('LHelp failed to build.', mtError, [mbCancel], 0); Exit; end; Proc.Free; @@ -367,8 +371,11 @@ var begin if Modified then begin - MResult := MessageDlg('Project is modified would you like to save the changes?', mtConfirmation, - [mbYes, mbNo, mbCancel], 0); + MResult := MessageDlg( + 'Project has been modified.' + LineEnding + + 'Would you like to save the changes?', + mtConfirmation, [mbYes, mbNo, mbCancel], 0 + ); case MResult of mrYes: Save(False); mrNo: CloseAction := caFree; @@ -450,7 +457,7 @@ begin bOverwrite := False; if FileExists(SaveDialog1.FileName) then begin - bOverwrite := (MessageDlg('File Already Exists! Ovewrite?', mtWarning, [mbYes, mbNo],0) = mrYes); + bOverwrite := (MessageDlg('File already exists. Overwrite?', mtWarning, [mbYes, mbNo],0) = mrYes); if not bOverwrite then Exit; end; if (not CloseProject()) then Exit; @@ -585,7 +592,7 @@ begin if Modified then begin - case (MessageDlg('Save Changes?', mtConfirmation, [mbYes, mbNo, mbCancel],0)) of + case (MessageDlg('Save changes?', mtConfirmation, [mbYes, mbNo, mbCancel],0)) of mrCancel: Exit(False); mrYes: Save(False); end; @@ -597,12 +604,11 @@ begin TOCEdit.Clear; IndexEdit.Clear; GroupBox1.Enabled := False; - MainPanel.Enabled := False; + MainPanel.Enabled := False; CompileItem.Enabled := False; ProjSaveAsItem.Enabled := False; ProjSaveItem.Enabled := False; ProjCloseItem.Enabled := False; - ScanHtmlCheck.Checked := False; CreateSearchableCHMCheck.Checked := False; FreeAndNil(Project); diff --git a/tools/chmmaker/chmsitemapeditor.pas b/tools/chmmaker/chmsitemapeditor.pas index eff308a3b7..b5be25d6e4 100644 --- a/tools/chmmaker/chmsitemapeditor.pas +++ b/tools/chmmaker/chmsitemapeditor.pas @@ -112,7 +112,7 @@ var begin if (LocalCombo.ItemIndex = -1) then begin - MessageDlg('You must select a Local file first', mtError, [mbCancel], 0); + MessageDlg('You must select a local file first.', mtError, [mbCancel], 0); Exit; end; @@ -367,13 +367,16 @@ begin LoadFromStream(AStream); LocalCombo.Items.Assign(AvailableLinks); - + + Result := ShowModal = mrOK; + { ShowModal; while ModalResult = mrNone do Application.HandleMessage; Result := ModalResult = mrOK; + } end; end.