mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-08 09:20:49 +02:00
tools/chmmaker: Fix missing save-prompt when main form is closed with modified filenames.
This commit is contained in:
parent
656592c16d
commit
06e568e69b
@ -3465,7 +3465,7 @@ object CHMForm: TCHMForm
|
||||
Left = 0
|
||||
Height = 23
|
||||
Top = 415
|
||||
Width = 582
|
||||
Width = 574
|
||||
AutoHint = True
|
||||
Panels = <>
|
||||
end
|
||||
@ -3609,7 +3609,7 @@ object CHMForm: TCHMForm
|
||||
Left = 249
|
||||
Height = 399
|
||||
Top = 8
|
||||
Width = 325
|
||||
Width = 317
|
||||
Align = alClient
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Top = 8
|
||||
@ -3617,7 +3617,7 @@ object CHMForm: TCHMForm
|
||||
BorderSpacing.Bottom = 8
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 399
|
||||
ClientWidth = 325
|
||||
ClientWidth = 317
|
||||
TabOrder = 2
|
||||
object TableOfContentsLabel: TLabel
|
||||
AnchorSideLeft.Control = MainPanel
|
||||
@ -3675,7 +3675,7 @@ object CHMForm: TCHMForm
|
||||
Left = 0
|
||||
Height = 23
|
||||
Top = 73
|
||||
Width = 249
|
||||
Width = 241
|
||||
OnAcceptFileName = TOCEditAcceptFileName
|
||||
DialogOptions = []
|
||||
Filter = 'Table of Contents Files(*.hhc)|*.hhc|All files|*'
|
||||
@ -3698,7 +3698,7 @@ object CHMForm: TCHMForm
|
||||
Left = 0
|
||||
Height = 23
|
||||
Top = 127
|
||||
Width = 249
|
||||
Width = 241
|
||||
OnAcceptFileName = IndexEditAcceptFileName
|
||||
DialogOptions = []
|
||||
Filter = 'Index Files(*.hhk)|*.hhk|All Files|*'
|
||||
@ -3718,7 +3718,7 @@ object CHMForm: TCHMForm
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = MainPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 265
|
||||
Left = 257
|
||||
Height = 25
|
||||
Top = 72
|
||||
Width = 60
|
||||
@ -3735,7 +3735,7 @@ object CHMForm: TCHMForm
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = MainPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 265
|
||||
Left = 257
|
||||
Height = 25
|
||||
Top = 126
|
||||
Width = 60
|
||||
@ -3756,7 +3756,7 @@ object CHMForm: TCHMForm
|
||||
Left = 0
|
||||
Height = 23
|
||||
Top = 181
|
||||
Width = 325
|
||||
Width = 317
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSelect = False
|
||||
BorderSpacing.Top = 4
|
||||
@ -3770,7 +3770,7 @@ object CHMForm: TCHMForm
|
||||
AnchorSideRight.Control = CompileViewBtn
|
||||
AnchorSideBottom.Control = MainPanel
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 84
|
||||
Left = 76
|
||||
Height = 33
|
||||
Top = 366
|
||||
Width = 93
|
||||
@ -3788,7 +3788,7 @@ object CHMForm: TCHMForm
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = MainPanel
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 185
|
||||
Left = 177
|
||||
Height = 33
|
||||
Top = 366
|
||||
Width = 140
|
||||
@ -3807,9 +3807,8 @@ object CHMForm: TCHMForm
|
||||
Left = 0
|
||||
Height = 23
|
||||
Top = 337
|
||||
Width = 325
|
||||
Width = 317
|
||||
OnAcceptFileName = ChmFileNameEditAcceptFileName
|
||||
DialogKind = dkSave
|
||||
DialogTitle = 'Save CHM as...'
|
||||
DialogOptions = []
|
||||
Filter = 'Compressed HTML Help Files|*.chm'
|
||||
@ -3843,7 +3842,7 @@ object CHMForm: TCHMForm
|
||||
Left = 0
|
||||
Height = 23
|
||||
Top = 19
|
||||
Width = 325
|
||||
Width = 317
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 4
|
||||
TabOrder = 0
|
||||
@ -3858,14 +3857,14 @@ object CHMForm: TCHMForm
|
||||
Left = 0
|
||||
Height = 66
|
||||
Top = 228
|
||||
Width = 325
|
||||
Width = 317
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 24
|
||||
Caption = 'Compile-time options:'
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 46
|
||||
ClientWidth = 321
|
||||
ClientWidth = 313
|
||||
TabOrder = 6
|
||||
object ScanHtmlCheck: TCheckBox
|
||||
AnchorSideLeft.Control = CompileTimeOptionsGroupbox
|
||||
@ -3875,7 +3874,7 @@ object CHMForm: TCHMForm
|
||||
Left = 8
|
||||
Height = 19
|
||||
Top = 0
|
||||
Width = 305
|
||||
Width = 297
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Right = 8
|
||||
|
@ -112,6 +112,7 @@ type
|
||||
function Compile(ShowSuccessMsg: Boolean): Boolean;
|
||||
function GetModified: Boolean;
|
||||
procedure Save(aAs: Boolean);
|
||||
function StrictModified: Boolean;
|
||||
function CloseProject: Boolean;
|
||||
|
||||
procedure AddFilesToProject(Strings: TStrings);
|
||||
@ -483,7 +484,7 @@ procedure TCHMForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
var
|
||||
MResult: Integer;
|
||||
begin
|
||||
if Modified then
|
||||
if StrictModified then
|
||||
begin
|
||||
MResult := MessageDlg(
|
||||
rsProjectHasBeenModified + LineEnding + rsSaveChanges,
|
||||
@ -651,6 +652,22 @@ begin
|
||||
Result := (Project <> nil) and FModified;
|
||||
end;
|
||||
|
||||
function TCHMForm.StrictModified: Boolean;
|
||||
begin
|
||||
Result := Modified;
|
||||
|
||||
// The following case happens that one of the FileNameEdits has been changed
|
||||
// and the project is closed in a way which does not fire the OnEditingDone
|
||||
// event (e.g., close form by 'x' button).
|
||||
if (not Result) and Assigned(Project) and (
|
||||
(ExtractFileName(CHMFilenameEdit.FileName) <> Project.OutputFileName) or
|
||||
(ExtractFileName(TOCEdit.FileName) <> Project.TableOfContentsFileName) or
|
||||
(ExtractFileName(IndexEdit.FileName) <> Project.IndexFileName)
|
||||
)
|
||||
then
|
||||
Result := true;
|
||||
end;
|
||||
|
||||
procedure TCHMForm.Save(aAs: Boolean);
|
||||
begin
|
||||
if aAs or (Project.FileName = '') then
|
||||
@ -699,6 +716,7 @@ begin
|
||||
ChmTitleEdit.Clear();
|
||||
TOCEdit.Clear;
|
||||
IndexEdit.Clear;
|
||||
ChmFileNameEdit.Clear;
|
||||
FilesGroupBox.Enabled := False;
|
||||
MainPanel.Enabled := False;
|
||||
AcSaveAs.Enabled := False;
|
||||
|
Loading…
Reference in New Issue
Block a user