diff --git a/components/chmhelp/lhelp/chmcontentprovider.pas b/components/chmhelp/lhelp/chmcontentprovider.pas
index 4731dc1e2f..6c36613ffe 100644
--- a/components/chmhelp/lhelp/chmcontentprovider.pas
+++ b/components/chmhelp/lhelp/chmcontentprovider.pas
@@ -303,7 +303,7 @@ begin
exit;
end;
fFillingToc := True;
- fContentsTree.Visible := False;
+ //fContentsTree.Visible := False;
fContentsPanel.Caption := 'Table of Contents Loading. Please Wait...';
Application.ProcessMessages;
fChm := TChmReader(Data);
@@ -705,7 +705,7 @@ begin
if (Length(DocURL) > 0) and (DocURL[1] <> '/') then
Insert('/', DocURL, 1);
if DocTitle = '' then
- Doctitle := 'untitled';
+ DocTitle := 'untitled';
ListItem := fSearchResults.Items.Add;
ListItem.Caption := DocTitle;
ListItem.Data := fChms.Chm[i];
diff --git a/components/chmhelp/lhelp/lhelp.lpi b/components/chmhelp/lhelp/lhelp.lpi
index c3381c00cf..bdefa7df3e 100644
--- a/components/chmhelp/lhelp/lhelp.lpi
+++ b/components/chmhelp/lhelp/lhelp.lpi
@@ -97,6 +97,7 @@
+
diff --git a/components/chmhelp/lhelp/lhelp.lpr b/components/chmhelp/lhelp/lhelp.lpr
index f8aeba4b3d..5e4369e932 100644
--- a/components/chmhelp/lhelp/lhelp.lpr
+++ b/components/chmhelp/lhelp/lhelp.lpr
@@ -26,7 +26,7 @@ uses
Controls,
Dialogs,
Forms
- { add your units here }, TurboPowerIPro, chmpopup, lhelpcontrolpkg, lhelpcore;
+ { add your units here }, SimpleIPC, TurboPowerIPro, chmpopup, lhelpcontrolpkg, lhelpcore;
var
X: Integer;
@@ -60,6 +60,15 @@ begin
end;
Application.CreateForm(THelpForm, HelpForm);
Application.CreateForm(THelpPopupForm, HelpPopupForm);
+ try
Application.Run;
+ except
+ // try to remove stale names pipes so that a new instance can use them
+ if IPCServer <> nil then
+ try
+ FreeAndNil(IPCServer);
+ except
+ end;
+ end;
end.
diff --git a/components/chmhelp/lhelp/lhelpcore.lfm b/components/chmhelp/lhelp/lhelpcore.lfm
index bc0dea4c39..5ab9713d8d 100644
--- a/components/chmhelp/lhelp/lhelpcore.lfm
+++ b/components/chmhelp/lhelp/lhelpcore.lfm
@@ -5,7 +5,7 @@ object HelpForm: THelpForm
Width = 758
ActiveControl = Panel1
Caption = 'LHelp'
- ClientHeight = 515
+ ClientHeight = 512
ClientWidth = 758
Icon.Data = {
7E04000000000100010010100000010020006804000016000000280000001000
@@ -49,9 +49,11 @@ object HelpForm: THelpForm
Menu = MainMenu1
OnClose = FormClose
OnCreate = FormCreate
+ OnKeyUp = FormKeyUp
Position = poScreenCenter
ShowInTaskBar = stAlways
LCLVersion = '0.9.29'
+ Visible = True
object Panel1: TPanel
Left = 0
Height = 32
@@ -242,7 +244,7 @@ object HelpForm: THelpForm
end
object PageControl: TPageControl
Left = 0
- Height = 483
+ Height = 503
Top = 32
Width = 758
Align = alClient
diff --git a/components/chmhelp/lhelp/lhelpcore.pas b/components/chmhelp/lhelp/lhelpcore.pas
index bdd4bff324..87a881b6cf 100644
--- a/components/chmhelp/lhelp/lhelpcore.pas
+++ b/components/chmhelp/lhelp/lhelpcore.pas
@@ -30,7 +30,7 @@ interface
uses
Classes, SysUtils, SimpleIPC,
FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
- Buttons, LCLProc, StdCtrls, IpHtml, ComCtrls, ExtCtrls, Menus,
+ Buttons, LCLProc, StdCtrls, IpHtml, ComCtrls, ExtCtrls, Menus, LCLType,
BaseContentProvider, FileContentProvider, ChmContentProvider{$IFDEF USE_LNET}, HTTPContentProvider{$ENDIF};
type
@@ -78,6 +78,7 @@ type
procedure FileMenuOpenURLItemClick(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
+ procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure ForwardToolBtnClick(Sender: TObject);
procedure HomeToolBtnClick(Sender: TObject);
procedure PageControlChange(Sender: TObject);
@@ -101,6 +102,7 @@ type
function ActivePage: TContentTab;
procedure RefreshState;
procedure ShowError(AError: String);
+ procedure SetKeyUp(AControl: TControl);
public
{ public declarations }
end;
@@ -108,6 +110,7 @@ type
var
HelpForm: THelpForm;
+ IPCServer: TSimpleIPCServer;
const INVALID_FILE_TYPE = 1;
implementation
@@ -188,6 +191,8 @@ end;
procedure THelpForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
+ Visible:= False;
+ Application.ProcessMessages;
FileMenuCloseItemClick(Sender);
StopServer;
end;
@@ -200,6 +205,15 @@ begin
StartServer(fServerName);
end;
RefreshState;
+
+ SetKeyUp(Self);
+end;
+
+procedure THelpForm.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState
+ );
+begin
+ if Key = VK_ESCAPE then
+ Close;
end;
procedure THelpForm.ForwardToolBtnClick(Sender: TObject);
@@ -344,6 +358,8 @@ begin
fInputIPC.ServerID := ServerName;
fInputIPC.Global := True;
fInputIPC.Active := True;
+ IPCServer := fInputIPC;
+
fServerTimer := TTimer.Create(nil);
fServerTimer.OnTimer := @ServerMessage;
fServerTimer.Interval := 200;
@@ -362,6 +378,7 @@ begin
fInputIPC.Active := False;
FreeAndNil(fInputIPC);
+ IPCServer := nil;
FreeAndNil(fServerTimer);
end;
@@ -415,7 +432,7 @@ begin
fNewPage := TContentTab.Create(PageControl);
fNewPage.ContentProvider := fRealContentProvider.Create(fNewPage, ImageList1);
fNewPage.Parent := PageControl;
-
+ SetKeyUp(fNewPage);
ShowOnTop;
if fNewPage.ContentProvider.LoadURL(AURL, AContext) then
@@ -463,6 +480,18 @@ begin
ShowMessage(AError);
end;
+procedure THelpForm.SetKeyUp(AControl: TControl);
+var
+ WCont: TWinControl absolute AControl;
+ i: Integer;
+begin
+ if (AControl = nil) or not (AControl.InheritsFrom(TWinControl)) then
+ Exit;
+ for i := 0 to WCont.ControlCount-1 do
+ SetKeyUp(WCont.Controls[i]);
+ WCont.OnKeyUp:=@FormKeyUp;
+end;
+
{ TContentTab }
constructor TContentTab.Create(AOwner: TComponent);
@@ -476,5 +505,12 @@ begin
inherited Destroy;
end;
+finalization
+ if IPCServer <> nil then
+ try
+ FreeAndNil(IPCServer);
+ except
+ end;
+
end.