diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-02-23 12:24:02 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-02-23 12:24:02 +0200 |
commit | 4290a12a7478707ab24b602faca78fe1ade8e817 (patch) | |
tree | 04d8434364faa3864a9fdf5a1e83535640bac273 | |
parent | 24baeac6a59e795623b088b93476d80355d1ba72 (diff) | |
download | fpGUI-4290a12a7478707ab24b602faca78fe1ade8e817.tar.xz |
Add various checks for open files before doing processing.
-rw-r--r-- | docview/src/frm_main.pas | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/docview/src/frm_main.pas b/docview/src/frm_main.pas index 7d84209a..ee7cd670 100644 --- a/docview/src/frm_main.pas +++ b/docview/src/frm_main.pas @@ -307,6 +307,9 @@ end; procedure TMainForm.IndexSearchEditKeyPress(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean); begin + if CurrentOpenFiles.Count = 0 then + Exit; + if (KeyCode = keyEnter) or (KeyCode = keyPEnter) then begin Consumed := True; @@ -331,7 +334,6 @@ begin LoadSettings; CreateMRUMenuItems; ProcessCommandLineParams; - end; procedure TMainForm.MainFormDestroy(Sender: TObject); @@ -602,12 +604,18 @@ end; procedure TMainForm.tvContentsChange(Sender: TObject); begin + if CurrentOpenFiles.Count = 0 then + Exit; + DisplayTopic(nil); end; procedure TMainForm.edSearchTextKeyPress(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean); begin + if CurrentOpenFiles.Count = 0 then + Exit; + if (KeyCode = keyReturn) or (KeyCode = keyPEnter) then begin Consumed := True; @@ -623,6 +631,9 @@ end; procedure TMainForm.lbSearchResultsKeyPress(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean); begin + if CurrentOpenFiles.Count = 0 then + Exit; + if (KeyCode = keyReturn) or (KeyCode = keyPEnter) then begin Consumed := True; @@ -650,6 +661,9 @@ end; procedure TMainForm.tvContentsDoubleClick(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); begin + if CurrentOpenFiles.Count = 0 then + Exit; + if tvContents.Selection <> nil then DisplayTopic(nil); end; @@ -687,6 +701,9 @@ end; procedure TMainForm.lbHistoryKeyPress(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean); begin + if CurrentOpenFiles.Count = 0 then + Exit; + if (KeyCode = keyReturn) or (KeyCode = keyPEnter) then begin Consumed := True; @@ -817,6 +834,9 @@ var FileWordSequences: TList; Query: TTextSearchQuery; begin + if CurrentOpenFiles.Count = 0 then + Exit; + SearchText := Trim(edSearchText.Text); lbSearchResults.Items.Clear; @@ -1330,6 +1350,8 @@ var tmpIndex: TStringList; i: longint; begin + if CurrentOpenFiles.Count = 0 then + Exit; LogEvent(LogStartup, 'Create index' ); SetWaitCursor; LogEvent(LogStartup, ' Get/sort lists' ); @@ -1563,7 +1585,10 @@ var Topic: TTopic; HighlightWordSequences: TList; FileIndex: integer; -Begin +begin + if CurrentOpenFiles.Count = 0 then + Exit; + ProfileEvent('DisplayTopic >>>>'); if ATopic = nil then begin @@ -1717,7 +1742,6 @@ begin fpgImages.AddMaskedBMP( 'dv.arrowdown', @usr_arrow_down, sizeof(usr_arrow_down), 0, 0); - end; destructor TMainForm.Destroy; |