From d03fb89621f4d79824f1c394fc85a0ed008c32b5 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Tue, 23 Feb 2010 11:47:09 +0200 Subject: Fix closing of open files. * Files field variable was not used, so removed it * On closing file, it used the Files field variable instead of the CurrentOpenFiles field variable. * Cleared the Search and History tab controls when closing files. --- docview/src/frm_main.pas | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/docview/src/frm_main.pas b/docview/src/frm_main.pas index 0735eb47..ae584596 100644 --- a/docview/src/frm_main.pas +++ b/docview/src/frm_main.pas @@ -69,7 +69,7 @@ type btnHelp: TfpgButton; {@VFD_HEAD_END: MainForm} miOpenRecentMenu: TfpgPopupMenu; - Files: TList; // current open help files. +// Files: TList; // current open help files. Debug: boolean; FFileOpenRecent: TfpgMenuItem; FHistorySelection: Boolean; @@ -1128,8 +1128,6 @@ begin // Now load the various parts of the file(s) // into the user interface - tvContents.RootNode.Clear; - DisplayFiles( tmpHelpFiles, FirstContentsNode ); //if CmdLineParameters.getHelpManagerFlag then @@ -1182,6 +1180,11 @@ var begin tvContents.Selection := nil; tvContents.RootNode.Clear; + + lbSearchResults.Items.Clear; + edSearchText.Clear; + lbHistory.Items.Clear; + RichView.Clear(ADestroying); if not ADestroying then begin @@ -1192,9 +1195,9 @@ begin // First save notes. It's important we do this first // since we scan all notes each time to find the ones // belonging to this file. - for FileIndex := 0 to Files.Count - 1 do + for FileIndex := 0 to CurrentOpenFiles.Count - 1 do begin - lHelpFile := THelpFile(Files[FileIndex]); + lHelpFile := THelpFile(CurrentOpenFiles[FileIndex]); SaveNotes( lHelpFile ); end; @@ -1202,13 +1205,13 @@ begin ClearAllWordSequences; // Now destroy help files - for FileIndex := 0 to Files.Count - 1 do + for FileIndex := 0 to CurrentOpenFiles.Count - 1 do begin - lHelpFile := THelpFile(Files[FileIndex]); + lHelpFile := THelpFile(CurrentOpenFiles[FileIndex]); lHelpFile.Free; end; - Files.Clear; + CurrentOpenFiles.Clear; ClearNotes; end; @@ -1682,7 +1685,7 @@ begin fpgApplication.OnException := @MainFormException; OnShow := @MainFormShow; OnDestroy :=@MainFormDestroy; - Files := TList.Create; +// Files := TList.Create; AllFilesWordSequences := TList.Create; CurrentOpenFiles := TList.Create; DisplayedIndex := TStringList.Create; @@ -1715,7 +1718,7 @@ begin CurrentTopic := nil; // it was a reference only FFileOpenRecent := nil; // it was a reference only miOpenRecentMenu.Free; - DestroyListAndObjects(Files); +// DestroyListAndObjects(Files); DestroyListAndObjects(AllFilesWordSequences); DestroyListAndObjects(CurrentOpenFiles); inherited Destroy; -- cgit v1.2.3-70-g09d2