mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 10:39:30 +02:00
chmhelp: undo change for 2.7.1 - it broke 2.4.4
git-svn-id: trunk@32316 -
This commit is contained in:
parent
bd5b8298a9
commit
0f86e7d221
@ -36,7 +36,6 @@ type
|
|||||||
fHelpLabel: String;
|
fHelpLabel: String;
|
||||||
fHelpConnection: TLHelpConnection;
|
fHelpConnection: TLHelpConnection;
|
||||||
fChmsFilePath: String;
|
fChmsFilePath: String;
|
||||||
fHelpExeParams: String;
|
|
||||||
function GetHelpEXE: String;
|
function GetHelpEXE: String;
|
||||||
function DBFindViewer({%H-}HelpDB: THelpDatabase; {%H-}const MimeType: string;
|
function DBFindViewer({%H-}HelpDB: THelpDatabase; {%H-}const MimeType: string;
|
||||||
var {%H-}ErrMsg: string; out Viewer: THelpViewer): TShowHelpResult;
|
var {%H-}ErrMsg: string; out Viewer: THelpViewer): TShowHelpResult;
|
||||||
@ -53,7 +52,7 @@ type
|
|||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function SupportsTableOfContents: boolean; override;
|
function SupportsTableOfContents: boolean; override;
|
||||||
procedure ShowTableOfContents({%H-}Node: THelpNode); override;
|
procedure ShowTableOfContents(Node: THelpNode); override;
|
||||||
function SupportsMimeType(const AMimeType: string): boolean; override;
|
function SupportsMimeType(const AMimeType: string): boolean; override;
|
||||||
function ShowNode(Node: THelpNode; var ErrMsg: string): TShowHelpResult; override;
|
function ShowNode(Node: THelpNode; var ErrMsg: string): TShowHelpResult; override;
|
||||||
//procedure Hide; virtual;
|
//procedure Hide; virtual;
|
||||||
@ -65,13 +64,11 @@ type
|
|||||||
property HelpEXE: String read GetHelpEXE write SetHelpEXE;
|
property HelpEXE: String read GetHelpEXE write SetHelpEXE;
|
||||||
property HelpLabel: String read GetHelpLabel write SetHelpLabel;
|
property HelpLabel: String read GetHelpLabel write SetHelpLabel;
|
||||||
property HelpFilesPath: String read fChmsFilePath write SetChmsFilePath;
|
property HelpFilesPath: String read fChmsFilePath write SetChmsFilePath;
|
||||||
property HelpExeParams: String read fHelpExeParams write fHelpExeParams;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses Process, MacroIntf, InterfaceBase, Forms, Dialogs, HelpFPDoc, IDEMsgIntf;
|
uses Process, MacroIntf, InterfaceBase, Forms, Dialogs, HelpFPDoc, IDEMsgIntf;
|
||||||
|
|
||||||
function FixSlash(AStr: String): String;
|
function FixSlash(AStr: String): String;
|
||||||
@ -190,16 +187,14 @@ begin
|
|||||||
then
|
then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
WS := '--ws='+LCLPlatformDirNames[WidgetSet.LCLPlatform];
|
WS := ' --ws='+LCLPlatformDirNames[WidgetSet.LCLPlatform]+' ';
|
||||||
|
|
||||||
//Result := MessageDlg('The help viewer is not compiled yet. Try to compile it now?', mtConfirmation, mbYesNo ,0);
|
//Result := MessageDlg('The help viewer is not compiled yet. Try to compile it now?', mtConfirmation, mbYesNo ,0);
|
||||||
//if Result <> mrYes then
|
//if Result <> mrYes then
|
||||||
// Exit;
|
// Exit;
|
||||||
|
|
||||||
Proc := TProcess.Create(nil);
|
Proc := TProcess.Create(nil);
|
||||||
Proc.Executable := Utf8ToSys(Lazbuild);
|
Proc.CommandLine := Lazbuild + WS + LHelpProject;
|
||||||
Proc.Parameters.Add(WS);
|
|
||||||
Proc.Parameters.Add(Utf8ToSys(LHelpProject));
|
|
||||||
Proc.Options := [poUsePipes, poStderrToOutPut];
|
Proc.Options := [poUsePipes, poStderrToOutPut];
|
||||||
Proc.Execute;
|
Proc.Execute;
|
||||||
|
|
||||||
@ -343,7 +338,6 @@ var
|
|||||||
Url: String;
|
Url: String;
|
||||||
Res: TLHelpResponse;
|
Res: TLHelpResponse;
|
||||||
DocsDir: String;
|
DocsDir: String;
|
||||||
Proc: TProcess;
|
|
||||||
begin
|
begin
|
||||||
if Pos('file://', Node.URL) = 1 then
|
if Pos('file://', Node.URL) = 1 then
|
||||||
begin
|
begin
|
||||||
@ -351,7 +345,7 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
Result:=shrNone;
|
Result:=shrNone;
|
||||||
if (ExtractFileNameOnly(HelpEXE) = 'lhelp') and (CheckBuildLHelp <> mrOK) then begin
|
if CheckBuildLHelp <> mrOK then begin
|
||||||
ErrMsg := 'The program "' + HelpEXE + '" doesn''t seem to exist'+LineEnding+
|
ErrMsg := 'The program "' + HelpEXE + '" doesn''t seem to exist'+LineEnding+
|
||||||
'or could not be built!';
|
'or could not be built!';
|
||||||
Exit(shrViewerNotFound);
|
Exit(shrViewerNotFound);
|
||||||
@ -382,34 +376,8 @@ begin
|
|||||||
|
|
||||||
FileName := IncludeTrailingPathDelimiter(DocsDir)+FileName;
|
FileName := IncludeTrailingPathDelimiter(DocsDir)+FileName;
|
||||||
|
|
||||||
if ExtractFileNameOnly(HelpExe) = 'lhelp' then begin
|
fHelpConnection.StartHelpServer(HelpLabel, HelpExe);
|
||||||
fHelpConnection.StartHelpServer(HelpLabel, HelpExe);
|
Res := fHelpConnection.OpenURL(FileName, Url);
|
||||||
Res := fHelpConnection.OpenURL(FileName, Url);
|
|
||||||
end else begin
|
|
||||||
if Trim(fHelpExeParams) = '' then
|
|
||||||
begin
|
|
||||||
Result := shrViewerError;
|
|
||||||
ErrMsg := 'If you do not use "lhelp" as viewer you have to setup '
|
|
||||||
+ 'HelpExeParams correctly in' + sLineBreak
|
|
||||||
+ 'Environment Options -> Help -> Help Options -> '
|
|
||||||
+ 'under HelpViewers - CHM Help Viewer' + sLineBreak
|
|
||||||
+ 'e.g. for HH.EXE (HTML Help in Windows) it must be' + sLineBreak
|
|
||||||
+ ' "%s::%s"' + sLineBreak
|
|
||||||
+ 'where first %s will be replaced by CHM file name' + sLineBreak
|
|
||||||
+ 'and the second one will be replaced by URL';
|
|
||||||
Exit;
|
|
||||||
end;
|
|
||||||
Proc := TProcess.Create(nil);
|
|
||||||
try
|
|
||||||
Proc.Executable := Utf8ToSys(fHelpExe);
|
|
||||||
Proc.Parameters.Add(Utf8ToSys(Format(fHelpExeParams, [FileName, Url])));
|
|
||||||
Proc.Execute;
|
|
||||||
Res := srSuccess;
|
|
||||||
except
|
|
||||||
Res := srUnknown;
|
|
||||||
end;
|
|
||||||
Proc.Free;
|
|
||||||
end;
|
|
||||||
|
|
||||||
case Res of
|
case Res of
|
||||||
srSuccess: Result := shrSuccess;
|
srSuccess: Result := shrSuccess;
|
||||||
@ -438,7 +406,6 @@ end;
|
|||||||
procedure TChmHelpViewer.Load(Storage: TConfigStorage);
|
procedure TChmHelpViewer.Load(Storage: TConfigStorage);
|
||||||
begin
|
begin
|
||||||
HelpEXE:=Storage.GetValue('CHMHelp/Exe','');
|
HelpEXE:=Storage.GetValue('CHMHelp/Exe','');
|
||||||
HelpExeParams := Storage.GetValue('CHMHelp/ExeParams','');
|
|
||||||
HelpLabel:=Storage.GetValue('CHMHelp/Name','lazhelp');
|
HelpLabel:=Storage.GetValue('CHMHelp/Name','lazhelp');
|
||||||
HelpFilesPath := Storage.GetValue('CHMHelp/FilesPath','');
|
HelpFilesPath := Storage.GetValue('CHMHelp/FilesPath','');
|
||||||
end;
|
end;
|
||||||
@ -446,7 +413,6 @@ end;
|
|||||||
procedure TChmHelpViewer.Save(Storage: TConfigStorage);
|
procedure TChmHelpViewer.Save(Storage: TConfigStorage);
|
||||||
begin
|
begin
|
||||||
Storage.SetDeleteValue('CHMHelp/Exe',HelpEXE,'');
|
Storage.SetDeleteValue('CHMHelp/Exe',HelpEXE,'');
|
||||||
Storage.SetDeleteValue('CHMHelp/ExeParams',HelpExeParams,'');
|
|
||||||
Storage.SetDeleteValue('CHMHelp/Name',HelpLabel,'lazhelp');
|
Storage.SetDeleteValue('CHMHelp/Name',HelpLabel,'lazhelp');
|
||||||
Storage.SetDeleteValue('CHMHelp/FilesPath',HelpFilesPath,'');
|
Storage.SetDeleteValue('CHMHelp/FilesPath',HelpFilesPath,'');
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user