+ Lhelp: show help contents for Help/Help menu. Should fix issue #26079

* Lhelp: hide lhelp while initially loading files. Should fix issue #26556
* Lhelp: additional debug output

git-svn-id: trunk@46252 -
This commit is contained in:
reiniero 2014-09-19 11:35:56 +00:00
parent 8a5ac12d3a
commit 15a5b4a591

View File

@ -41,7 +41,8 @@ uses
Buttons, LCLProc, IpHtml, ComCtrls, ExtCtrls, Menus, LCLType, LCLIntf, StdCtrls, Buttons, LCLProc, IpHtml, ComCtrls, ExtCtrls, Menus, LCLType, LCLIntf, StdCtrls,
BaseContentProvider, FileContentProvider, BaseContentProvider, FileContentProvider,
ChmContentProvider ChmContentProvider
{$IFDEF USE_LNET}, HTTPContentProvider{$ENDIF}, lazlogger; {$IFDEF USE_LNET}, HTTPContentProvider{$ENDIF},
lazlogger;
type type
@ -106,12 +107,13 @@ type
fServerTimer: TTimer; fServerTimer: TTimer;
fContext: LongInt; // used once when we are started on the command line with --context fContext: LongInt; // used once when we are started on the command line with --context
fConfig: TXMLConfig; fConfig: TXMLConfig;
FHasShowed: Boolean; fHasShowed: Boolean;
fHide: boolean; //If yes, start with content hidden. Otherwise start normally fHide: boolean; //If yes, start with content hidden. Otherwise start normally
// Load preferences; separate preferences per coupled server/IDE // Load preferences; separate preferences per coupled server/IDE
procedure LoadPreferences(AIPCName: String); procedure LoadPreferences(AIPCName: String);
// Saves preferences. Uses existing config loaded by LoadPreferences // Saves preferences. Uses existing config loaded by LoadPreferences
procedure SavePreferences; procedure SavePreferences;
// Add filename to recent files (MRU) list
procedure AddRecentFile(AFileName: String); procedure AddRecentFile(AFileName: String);
procedure ContentTitleChange({%H-}sender: TObject); procedure ContentTitleChange({%H-}sender: TObject);
procedure OpenRecentItemClick(Sender: TObject); procedure OpenRecentItemClick(Sender: TObject);
@ -291,6 +293,11 @@ begin
if fServerName <> '' then begin if fServerName <> '' then begin
StartComms(fServerName); StartComms(fServerName);
end; end;
// If user wants lhelp to hide, hide entire form.
// Detect this choice based on fHide set in ReadCommandLineOptions
if fHide then
WindowState := wsMinimized
else
RefreshState; RefreshState;
SetKeyUp(Self); SetKeyUp(Self);
end; end;
@ -453,7 +460,6 @@ begin
Stream := TMemoryStream.Create; Stream := TMemoryStream.Create;
try try
Stream.WriteDWord(Response); Stream.WriteDWord(Response);
if assigned(fOutputIPC) and fOutputIPC.Active then if assigned(fOutputIPC) and fOutputIPC.Active then
fOutputIPC.SendMessage(mtUnknown, Stream); fOutputIPC.SendMessage(mtUnknown, Stream);
finally finally
@ -517,12 +523,16 @@ begin
begin begin
MustClose:=true; MustClose:=true;
Res:= ord(srSuccess); Res:= ord(srSuccess);
debugln('got rtmisc/mrClose');
end; end;
mrShow: mrShow:
begin begin
fHide := false; fHide := false;
PageControl.Visible:=true; if WindowState = wsMinimized then
WindowState := wsNormal;
RefreshState;
Res := ord(srSuccess); Res := ord(srSuccess);
debugln('got rtmisc/mrShow');
end; end;
mrVersion: mrVersion:
begin begin
@ -532,16 +542,25 @@ begin
Res := ord(srSuccess) Res := ord(srSuccess)
else else
Res := ord(srError); //version not supported Res := ord(srError); //version not supported
debugln('got rtmisc/');
end end
else {Unknown} else {Unknown}
Res := ord(srUnknown); Res := ord(srUnknown);
end; end;
end; end;
end; end;
// This may take some time which may allow receiving end to get ready for
// receiving messages
if (URL<>'') and (Res = Ord(srSuccess)) then if (URL<>'') and (Res = Ord(srSuccess)) then
AddRecentFile(Url); AddRecentFile(Url);
debugln('Going to send TLHelpResponse code: '+inttostr(Res)); // Receiving end may not yet be ready (observed with an Intel Core i7),
SendResponse(Res); // so perhaps wait a bit?
// Unfortunately, the delay time is guesswork=>Sleep(80)?
SendResponse(Res); //send response again in case first wasn't picked up
// Keep after SendResponse to avoid timing issues (e.g. writing to log file):
debugln('Just sent TLHelpResponse code: '+inttostr(Res));
if MustClose then if MustClose then
begin begin
// Wait some time for the response message to go out before shutting down // Wait some time for the response message to go out before shutting down
@ -597,7 +616,7 @@ begin
end; end;
end; end;
// Loop through a second time for the url // Loop through a second time for the URL
for X := 1 to ParamCount do for X := 1 to ParamCount do
if not IsHandled[X] then begin if not IsHandled[X] then begin
//DoOpenChm(ParamStrUTF8(X)); //DoOpenChm(ParamStrUTF8(X));
@ -769,20 +788,28 @@ begin
begin begin
en := false; en := false;
// Hide content page // Hide content page
// todo: even though this code perhaps will hide the content window,
// starting laz+pressing f1 will show content while loading all chms
if Assigned(ActivePage) then if Assigned(ActivePage) then
with TChmContentProvider(ActivePage.ContentProvider) do with TChmContentProvider(ActivePage.ContentProvider) do
begin begin
ActivePage.Visible := false; ActivePage.Visible := false;
Visible := false; Visible := false;
//todo: are these necessary
TabsControl.Visible := false; TabsControl.Visible := false;
Splitter.Visible := false; Splitter.Visible := false;
end; end;
end end
else else
begin
en := Assigned(ActivePage); en := Assigned(ActivePage);
// Show content page
if en then
with TChmContentProvider(ActivePage.ContentProvider) do
begin
ActivePage.Visible := true;
Visible := true;
TabsControl.Visible := true;
Splitter.Visible := true;
end;
end;
BackBttn.Enabled := en; BackBttn.Enabled := en;
ForwardBttn.Enabled := en; ForwardBttn.Enabled := en;