mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-16 13:19:19 +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
|
Left = 0
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 415
|
Top = 415
|
||||||
Width = 582
|
Width = 574
|
||||||
AutoHint = True
|
AutoHint = True
|
||||||
Panels = <>
|
Panels = <>
|
||||||
end
|
end
|
||||||
@ -3609,7 +3609,7 @@ object CHMForm: TCHMForm
|
|||||||
Left = 249
|
Left = 249
|
||||||
Height = 399
|
Height = 399
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 325
|
Width = 317
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BorderSpacing.Left = 4
|
BorderSpacing.Left = 4
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 8
|
||||||
@ -3617,7 +3617,7 @@ object CHMForm: TCHMForm
|
|||||||
BorderSpacing.Bottom = 8
|
BorderSpacing.Bottom = 8
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 399
|
ClientHeight = 399
|
||||||
ClientWidth = 325
|
ClientWidth = 317
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
object TableOfContentsLabel: TLabel
|
object TableOfContentsLabel: TLabel
|
||||||
AnchorSideLeft.Control = MainPanel
|
AnchorSideLeft.Control = MainPanel
|
||||||
@ -3675,7 +3675,7 @@ object CHMForm: TCHMForm
|
|||||||
Left = 0
|
Left = 0
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 73
|
Top = 73
|
||||||
Width = 249
|
Width = 241
|
||||||
OnAcceptFileName = TOCEditAcceptFileName
|
OnAcceptFileName = TOCEditAcceptFileName
|
||||||
DialogOptions = []
|
DialogOptions = []
|
||||||
Filter = 'Table of Contents Files(*.hhc)|*.hhc|All files|*'
|
Filter = 'Table of Contents Files(*.hhc)|*.hhc|All files|*'
|
||||||
@ -3698,7 +3698,7 @@ object CHMForm: TCHMForm
|
|||||||
Left = 0
|
Left = 0
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 127
|
Top = 127
|
||||||
Width = 249
|
Width = 241
|
||||||
OnAcceptFileName = IndexEditAcceptFileName
|
OnAcceptFileName = IndexEditAcceptFileName
|
||||||
DialogOptions = []
|
DialogOptions = []
|
||||||
Filter = 'Index Files(*.hhk)|*.hhk|All Files|*'
|
Filter = 'Index Files(*.hhk)|*.hhk|All Files|*'
|
||||||
@ -3718,7 +3718,7 @@ object CHMForm: TCHMForm
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = MainPanel
|
AnchorSideRight.Control = MainPanel
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 265
|
Left = 257
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 72
|
Top = 72
|
||||||
Width = 60
|
Width = 60
|
||||||
@ -3735,7 +3735,7 @@ object CHMForm: TCHMForm
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = MainPanel
|
AnchorSideRight.Control = MainPanel
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 265
|
Left = 257
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 126
|
Top = 126
|
||||||
Width = 60
|
Width = 60
|
||||||
@ -3756,7 +3756,7 @@ object CHMForm: TCHMForm
|
|||||||
Left = 0
|
Left = 0
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 181
|
Top = 181
|
||||||
Width = 325
|
Width = 317
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
AutoSelect = False
|
AutoSelect = False
|
||||||
BorderSpacing.Top = 4
|
BorderSpacing.Top = 4
|
||||||
@ -3770,7 +3770,7 @@ object CHMForm: TCHMForm
|
|||||||
AnchorSideRight.Control = CompileViewBtn
|
AnchorSideRight.Control = CompileViewBtn
|
||||||
AnchorSideBottom.Control = MainPanel
|
AnchorSideBottom.Control = MainPanel
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 84
|
Left = 76
|
||||||
Height = 33
|
Height = 33
|
||||||
Top = 366
|
Top = 366
|
||||||
Width = 93
|
Width = 93
|
||||||
@ -3788,7 +3788,7 @@ object CHMForm: TCHMForm
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = MainPanel
|
AnchorSideBottom.Control = MainPanel
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 185
|
Left = 177
|
||||||
Height = 33
|
Height = 33
|
||||||
Top = 366
|
Top = 366
|
||||||
Width = 140
|
Width = 140
|
||||||
@ -3807,9 +3807,8 @@ object CHMForm: TCHMForm
|
|||||||
Left = 0
|
Left = 0
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 337
|
Top = 337
|
||||||
Width = 325
|
Width = 317
|
||||||
OnAcceptFileName = ChmFileNameEditAcceptFileName
|
OnAcceptFileName = ChmFileNameEditAcceptFileName
|
||||||
DialogKind = dkSave
|
|
||||||
DialogTitle = 'Save CHM as...'
|
DialogTitle = 'Save CHM as...'
|
||||||
DialogOptions = []
|
DialogOptions = []
|
||||||
Filter = 'Compressed HTML Help Files|*.chm'
|
Filter = 'Compressed HTML Help Files|*.chm'
|
||||||
@ -3843,7 +3842,7 @@ object CHMForm: TCHMForm
|
|||||||
Left = 0
|
Left = 0
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 19
|
Top = 19
|
||||||
Width = 325
|
Width = 317
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Top = 4
|
BorderSpacing.Top = 4
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
@ -3858,14 +3857,14 @@ object CHMForm: TCHMForm
|
|||||||
Left = 0
|
Left = 0
|
||||||
Height = 66
|
Height = 66
|
||||||
Top = 228
|
Top = 228
|
||||||
Width = 325
|
Width = 317
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Top = 24
|
BorderSpacing.Top = 24
|
||||||
Caption = 'Compile-time options:'
|
Caption = 'Compile-time options:'
|
||||||
ChildSizing.ControlsPerLine = 1
|
ChildSizing.ControlsPerLine = 1
|
||||||
ClientHeight = 46
|
ClientHeight = 46
|
||||||
ClientWidth = 321
|
ClientWidth = 313
|
||||||
TabOrder = 6
|
TabOrder = 6
|
||||||
object ScanHtmlCheck: TCheckBox
|
object ScanHtmlCheck: TCheckBox
|
||||||
AnchorSideLeft.Control = CompileTimeOptionsGroupbox
|
AnchorSideLeft.Control = CompileTimeOptionsGroupbox
|
||||||
@ -3875,7 +3874,7 @@ object CHMForm: TCHMForm
|
|||||||
Left = 8
|
Left = 8
|
||||||
Height = 19
|
Height = 19
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 305
|
Width = 297
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
|
@ -112,6 +112,7 @@ type
|
|||||||
function Compile(ShowSuccessMsg: Boolean): Boolean;
|
function Compile(ShowSuccessMsg: Boolean): Boolean;
|
||||||
function GetModified: Boolean;
|
function GetModified: Boolean;
|
||||||
procedure Save(aAs: Boolean);
|
procedure Save(aAs: Boolean);
|
||||||
|
function StrictModified: Boolean;
|
||||||
function CloseProject: Boolean;
|
function CloseProject: Boolean;
|
||||||
|
|
||||||
procedure AddFilesToProject(Strings: TStrings);
|
procedure AddFilesToProject(Strings: TStrings);
|
||||||
@ -483,7 +484,7 @@ procedure TCHMForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
|||||||
var
|
var
|
||||||
MResult: Integer;
|
MResult: Integer;
|
||||||
begin
|
begin
|
||||||
if Modified then
|
if StrictModified then
|
||||||
begin
|
begin
|
||||||
MResult := MessageDlg(
|
MResult := MessageDlg(
|
||||||
rsProjectHasBeenModified + LineEnding + rsSaveChanges,
|
rsProjectHasBeenModified + LineEnding + rsSaveChanges,
|
||||||
@ -651,6 +652,22 @@ begin
|
|||||||
Result := (Project <> nil) and FModified;
|
Result := (Project <> nil) and FModified;
|
||||||
end;
|
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);
|
procedure TCHMForm.Save(aAs: Boolean);
|
||||||
begin
|
begin
|
||||||
if aAs or (Project.FileName = '') then
|
if aAs or (Project.FileName = '') then
|
||||||
@ -699,6 +716,7 @@ begin
|
|||||||
ChmTitleEdit.Clear();
|
ChmTitleEdit.Clear();
|
||||||
TOCEdit.Clear;
|
TOCEdit.Clear;
|
||||||
IndexEdit.Clear;
|
IndexEdit.Clear;
|
||||||
|
ChmFileNameEdit.Clear;
|
||||||
FilesGroupBox.Enabled := False;
|
FilesGroupBox.Enabled := False;
|
||||||
MainPanel.Enabled := False;
|
MainPanel.Enabled := False;
|
||||||
AcSaveAs.Enabled := False;
|
AcSaveAs.Enabled := False;
|
||||||
|
Loading…
Reference in New Issue
Block a user