mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-23 09:20:12 +01:00
wiki test: started options
git-svn-id: trunk@35792 -
This commit is contained in:
parent
6fdd286ea2
commit
46191839c5
@ -682,7 +682,7 @@ begin
|
|||||||
Page:=TW2XHTMLPage(Pages[i]);
|
Page:=TW2XHTMLPage(Pages[i]);
|
||||||
Page.Filename:=PageToFilename(Page,false);
|
Page.Filename:=PageToFilename(Page,false);
|
||||||
if Page.WikiPage<>nil then
|
if Page.WikiPage<>nil then
|
||||||
Page.WikiPage.LanguageTags:=LanguageTags;
|
Page.WikiPage.LanguageTags:=CodeTags;
|
||||||
ShortFilenameToPage[Page.Filename]:=Page;
|
ShortFilenameToPage[Page.Filename]:=Page;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|||||||
@ -52,7 +52,7 @@ type
|
|||||||
|
|
||||||
TWiki2FormatConverter = class
|
TWiki2FormatConverter = class
|
||||||
private
|
private
|
||||||
FLanguageTags: TKeyWordFunctionList;
|
FCodeTags: TKeyWordFunctionList;
|
||||||
FNoWarnBaseURLs: TStringToStringTree;
|
FNoWarnBaseURLs: TStringToStringTree;
|
||||||
FOnLog: TWikiOnLog;
|
FOnLog: TWikiOnLog;
|
||||||
FTitle: string;
|
FTitle: string;
|
||||||
@ -86,7 +86,8 @@ type
|
|||||||
property Title: string read FTitle write SetTitle;
|
property Title: string read FTitle write SetTitle;
|
||||||
property WarnMissingPageLinks: boolean read FWarnMissingPageLinks write FWarnMissingPageLinks; // warn if an internal link links to non existing page
|
property WarnMissingPageLinks: boolean read FWarnMissingPageLinks write FWarnMissingPageLinks; // warn if an internal link links to non existing page
|
||||||
property NoWarnBaseURLs: TStringToStringTree read FNoWarnBaseURLs;
|
property NoWarnBaseURLs: TStringToStringTree read FNoWarnBaseURLs;
|
||||||
property LanguageTags: TKeyWordFunctionList read FLanguageTags write FLanguageTags;
|
property CodeTags: TKeyWordFunctionList read FCodeTags write FCodeTags;
|
||||||
|
function CollectAllLangCodes(Delimiter: char = ','): string;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function WikiPageToFilename(Page: string; IsInternalLink, AppendCaseID: boolean): string;
|
function WikiPageToFilename(Page: string; IsInternalLink, AppendCaseID: boolean): string;
|
||||||
@ -94,7 +95,7 @@ function WikiFilenameToPage(Filename: string): string;
|
|||||||
function WikiImageToFilename(Image: string; IsInternalLink, InsertCaseID: boolean;
|
function WikiImageToFilename(Image: string; IsInternalLink, InsertCaseID: boolean;
|
||||||
KeepScheme: boolean = false): string;
|
KeepScheme: boolean = false): string;
|
||||||
function WikiHeaderToLink(Header: string): string;
|
function WikiHeaderToLink(Header: string): string;
|
||||||
function WikiCreateCommonLanguageList(AddLazWikiLangs: boolean): TKeyWordFunctionList;
|
function WikiCreateCommonCodeTagList(AddLazWikiLangs: boolean): TKeyWordFunctionList;
|
||||||
function GetWikiPageLanguage(const Page: string): string;
|
function GetWikiPageLanguage(const Page: string): string;
|
||||||
function WikiPageHasLanguage(const Page, Languages: string): boolean;
|
function WikiPageHasLanguage(const Page, Languages: string): boolean;
|
||||||
|
|
||||||
@ -222,7 +223,7 @@ begin
|
|||||||
// load wiki pages
|
// load wiki pages
|
||||||
for i:=0 to Count-1 do begin
|
for i:=0 to Count-1 do begin
|
||||||
Page:=Pages[i];
|
Page:=Pages[i];
|
||||||
Page.WikiPage.LanguageTags:=LanguageTags;
|
Page.WikiPage.LanguageTags:=CodeTags;
|
||||||
Page.ParseWikiDoc(false);
|
Page.ParseWikiDoc(false);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -240,6 +241,29 @@ begin
|
|||||||
Result:=fPages.Count;
|
Result:=fPages.Count;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TWiki2FormatConverter.CollectAllLangCodes(Delimiter: char): string;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
Page: TW2FormatPage;
|
||||||
|
Lang: String;
|
||||||
|
Langs: TStringToStringTree;
|
||||||
|
begin
|
||||||
|
Result:='';
|
||||||
|
Langs:=TStringToStringTree.Create(false);
|
||||||
|
try
|
||||||
|
for i:=0 to Count-1 do begin
|
||||||
|
Page:=Pages[i];
|
||||||
|
Lang:=GetWikiPageLanguage(Page.WikiDocumentName);
|
||||||
|
if Lang='' then continue;
|
||||||
|
if Langs.Contains(Lang) then continue;
|
||||||
|
Langs[Lang]:='1';
|
||||||
|
Result+=Delimiter+Lang;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
Langs.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TW2FormatPage }
|
{ TW2FormatPage }
|
||||||
|
|
||||||
constructor TW2FormatPage.Create(TheConverter: TWiki2FormatConverter);
|
constructor TW2FormatPage.Create(TheConverter: TWiki2FormatConverter);
|
||||||
@ -404,7 +428,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function WikiCreateCommonLanguageList(AddLazWikiLangs: boolean): TKeyWordFunctionList;
|
function WikiCreateCommonCodeTagList(AddLazWikiLangs: boolean): TKeyWordFunctionList;
|
||||||
begin
|
begin
|
||||||
Result:=TKeyWordFunctionList.Create('LanguageTags');
|
Result:=TKeyWordFunctionList.Create('LanguageTags');
|
||||||
with Result do begin
|
with Result do begin
|
||||||
|
|||||||
@ -233,6 +233,11 @@ type
|
|||||||
property Aborting: boolean read FAborting;
|
property Aborting: boolean read FAborting;
|
||||||
function LoadComplete: boolean;
|
function LoadComplete: boolean;
|
||||||
|
|
||||||
|
// languages
|
||||||
|
function CollectAllLanguages(AsCaption: boolean): TStrings;
|
||||||
|
function LangCodeToCaption(LangCode: string): string;
|
||||||
|
function LangCaptionToCode(Caption: string): string;
|
||||||
|
|
||||||
// search
|
// search
|
||||||
procedure Search(const Term: string; const Languages: string = '');
|
procedure Search(const Term: string; const Languages: string = '');
|
||||||
procedure Search(aQuery: TWikiHelpQuery);
|
procedure Search(aQuery: TWikiHelpQuery);
|
||||||
@ -1426,7 +1431,7 @@ begin
|
|||||||
InitCriticalSection(FCritSec);
|
InitCriticalSection(FCritSec);
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
FConverter:=TWiki2HelpConverter.Create;
|
FConverter:=TWiki2HelpConverter.Create;
|
||||||
FConverter.LanguageTags:=WikiCreateCommonLanguageList(true);
|
FConverter.CodeTags:=WikiCreateCommonCodeTagList(true);
|
||||||
FConverter.FHelp:=Self;
|
FConverter.FHelp:=Self;
|
||||||
FScoring:=TWHScoring.Create;
|
FScoring:=TWHScoring.Create;
|
||||||
FScoring.Phrases[whfcPageTitle,whfsWholeWord]:=128;
|
FScoring.Phrases[whfcPageTitle,whfsWholeWord]:=128;
|
||||||
@ -1444,7 +1449,7 @@ end;
|
|||||||
destructor TWikiHelp.Destroy;
|
destructor TWikiHelp.Destroy;
|
||||||
begin
|
begin
|
||||||
AbortLoading(true);
|
AbortLoading(true);
|
||||||
FConverter.LanguageTags.Free;
|
FConverter.CodeTags.Free;
|
||||||
FreeAndNil(FConverter);
|
FreeAndNil(FConverter);
|
||||||
FreeAndNil(FScoring);
|
FreeAndNil(FScoring);
|
||||||
FreeAndNil(FQuery);
|
FreeAndNil(FQuery);
|
||||||
@ -1508,6 +1513,45 @@ begin
|
|||||||
Result:=(fProgressStep>=whpsWikiLoadComplete);
|
Result:=(fProgressStep>=whpsWikiLoadComplete);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TWikiHelp.CollectAllLanguages(AsCaption: boolean): TStrings;
|
||||||
|
|
||||||
|
procedure Add(Code: string);
|
||||||
|
begin
|
||||||
|
if AsCaption then
|
||||||
|
Code:=LangCodeToCaption(Code);
|
||||||
|
CollectAllLanguages.Add(Code);
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
Codes: String;
|
||||||
|
p: SizeInt;
|
||||||
|
Code: String;
|
||||||
|
begin
|
||||||
|
Result:=TStringList.Create;
|
||||||
|
Add('');
|
||||||
|
if LoadComplete then begin
|
||||||
|
Codes:=Converter.CollectAllLangCodes(';')+';';
|
||||||
|
repeat
|
||||||
|
p:=Pos(';',Codes);
|
||||||
|
if p<1 then p:=length(Codes)+1;
|
||||||
|
Code:=LeftStr(Codes,p-1);
|
||||||
|
Delete(Codes,1,p);
|
||||||
|
if Code<>'' then
|
||||||
|
Add(Code);
|
||||||
|
until Codes='';
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWikiHelp.LangCodeToCaption(LangCode: string): string;
|
||||||
|
begin
|
||||||
|
Result:=LangCode;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWikiHelp.LangCaptionToCode(Caption: string): string;
|
||||||
|
begin
|
||||||
|
Result:=Caption;
|
||||||
|
end;
|
||||||
|
|
||||||
function TWikiHelp.GetProgressCaption: string;
|
function TWikiHelp.GetProgressCaption: string;
|
||||||
begin
|
begin
|
||||||
EnterCritSect;
|
EnterCritSect;
|
||||||
|
|||||||
@ -44,7 +44,7 @@
|
|||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item4>
|
</Item4>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="3">
|
<Units Count="4">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="wikisearchdemo.lpr"/>
|
<Filename Value="wikisearchdemo.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
@ -62,6 +62,13 @@
|
|||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="WikiHelpManager"/>
|
<UnitName Value="WikiHelpManager"/>
|
||||||
</Unit2>
|
</Unit2>
|
||||||
|
<Unit3>
|
||||||
|
<Filename Value="wikisearchoptions.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="WikiSearchOptsWnd"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
<UnitName Value="WikiSearchOptions"/>
|
||||||
|
</Unit3>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
|||||||
@ -7,7 +7,7 @@ uses
|
|||||||
cthreads,
|
cthreads,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Interfaces, // this includes the LCL widgetset
|
Interfaces, // this includes the LCL widgetset
|
||||||
Forms, WikiSearchMain, WikiHelpManager
|
Forms, WikiSearchMain, WikiHelpManager, WikiSearchOptions
|
||||||
{ you can add units after this };
|
{ you can add units after this };
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
@ -17,6 +17,7 @@ begin
|
|||||||
RequireDerivedFormResource := True;
|
RequireDerivedFormResource := True;
|
||||||
Application.Initialize;
|
Application.Initialize;
|
||||||
Application.CreateForm(TWikiSearchDemoForm, WikiSearchDemoForm);
|
Application.CreateForm(TWikiSearchDemoForm, WikiSearchDemoForm);
|
||||||
|
Application.CreateForm(TWikiSearchOptsWnd, WikiSearchOptsWnd);
|
||||||
Application.Run;
|
Application.Run;
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
object WikiSearchDemoForm: TWikiSearchDemoForm
|
object WikiSearchDemoForm: TWikiSearchDemoForm
|
||||||
Left = 717
|
Left = 635
|
||||||
Height = 501
|
Height = 501
|
||||||
Top = 218
|
Top = 222
|
||||||
Width = 663
|
Width = 663
|
||||||
Caption = 'WikiSearchDemoForm'
|
Caption = 'WikiSearchDemoForm'
|
||||||
ClientHeight = 501
|
ClientHeight = 501
|
||||||
@ -75,11 +75,11 @@ object WikiSearchDemoForm: TWikiSearchDemoForm
|
|||||||
ClientWidth = 320
|
ClientWidth = 320
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
object ResultsIpHtmlPanel: TIpHtmlPanel
|
object ResultsIpHtmlPanel: TIpHtmlPanel
|
||||||
AnchorSideTop.Control = ProgressLabel
|
AnchorSideTop.Control = OptionsButton
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 1
|
Left = 1
|
||||||
Height = 412
|
Height = 431
|
||||||
Top = 88
|
Top = 69
|
||||||
Width = 318
|
Width = 318
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
FixedTypeface = 'Courier New'
|
FixedTypeface = 'Courier New'
|
||||||
@ -123,42 +123,14 @@ object WikiSearchDemoForm: TWikiSearchDemoForm
|
|||||||
Caption = 'SearchLabel'
|
Caption = 'SearchLabel'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object LanguagesEdit: TEdit
|
|
||||||
AnchorSideLeft.Control = LanguagesLabel
|
|
||||||
AnchorSideLeft.Side = asrBottom
|
|
||||||
AnchorSideTop.Control = SearchEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
Left = 105
|
|
||||||
Height = 24
|
|
||||||
Top = 37
|
|
||||||
Width = 80
|
|
||||||
BorderSpacing.Around = 6
|
|
||||||
OnChange = LanguagesEditChange
|
|
||||||
ParentShowHint = False
|
|
||||||
ShowHint = True
|
|
||||||
TabOrder = 2
|
|
||||||
Text = 'LanguagesEdit'
|
|
||||||
end
|
|
||||||
object LanguagesLabel: TLabel
|
|
||||||
AnchorSideLeft.Control = SearchPanel
|
|
||||||
AnchorSideTop.Control = LanguagesEdit
|
|
||||||
AnchorSideTop.Side = asrCenter
|
|
||||||
Left = 7
|
|
||||||
Height = 15
|
|
||||||
Top = 42
|
|
||||||
Width = 92
|
|
||||||
BorderSpacing.Around = 6
|
|
||||||
Caption = 'LanguagesLabel'
|
|
||||||
ParentColor = False
|
|
||||||
end
|
|
||||||
object ProgressLabel: TLabel
|
object ProgressLabel: TLabel
|
||||||
AnchorSideLeft.Control = SearchPanel
|
AnchorSideLeft.Control = SearchPanel
|
||||||
AnchorSideTop.Control = LanguagesEdit
|
AnchorSideTop.Control = OptionsButton
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 7
|
Left = 7
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 67
|
Top = 43
|
||||||
Width = 79
|
Width = 79
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'ProgressLabel'
|
Caption = 'ProgressLabel'
|
||||||
@ -178,6 +150,21 @@ object WikiSearchDemoForm: TWikiSearchDemoForm
|
|||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'HideSearchButton'
|
Caption = 'HideSearchButton'
|
||||||
OnClick = HideSearchButtonClick
|
OnClick = HideSearchButtonClick
|
||||||
|
TabOrder = 2
|
||||||
|
end
|
||||||
|
object OptionsButton: TButton
|
||||||
|
AnchorSideLeft.Control = SearchPanel
|
||||||
|
AnchorSideRight.Control = SearchPanel
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 222
|
||||||
|
Height = 26
|
||||||
|
Top = 37
|
||||||
|
Width = 91
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
AutoSize = True
|
||||||
|
BorderSpacing.Around = 6
|
||||||
|
Caption = 'OptionsButton'
|
||||||
|
OnClick = OptionsButtonClick
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,3 +1,23 @@
|
|||||||
|
{ Browse and search form for offline wiki
|
||||||
|
|
||||||
|
Copyright (C) 2012 Mattias Gaertner mattias@freepascal.org
|
||||||
|
|
||||||
|
This source is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License as published by the Free
|
||||||
|
Software Foundation; either version 2 of the License, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This code is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details.
|
||||||
|
|
||||||
|
A copy of the GNU General Public License is available on the World Wide Web
|
||||||
|
at <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by writing
|
||||||
|
to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||||
|
MA 02111-1307, USA.
|
||||||
|
|
||||||
|
}
|
||||||
unit WikiSearchMain;
|
unit WikiSearchMain;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
@ -6,8 +26,10 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, math, FileUtil, LazLogger, LazUTF8, LazFileUtils, laz2_DOM,
|
Classes, SysUtils, math, FileUtil, LazLogger, LazUTF8, LazFileUtils, laz2_DOM,
|
||||||
IpHtml, Ipfilebroker, IpMsg, CodeToolManager, CodeCache, Forms, Controls,
|
Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||||
Graphics, Dialogs, StdCtrls, ExtCtrls, ComCtrls, WikiHelpManager;
|
IpHtml, Ipfilebroker, IpMsg,
|
||||||
|
CodeToolManager, CodeCache,
|
||||||
|
WikiHelpManager, WikiSearchOptions;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -24,8 +46,7 @@ type
|
|||||||
|
|
||||||
TWikiSearchDemoForm = class(TForm)
|
TWikiSearchDemoForm = class(TForm)
|
||||||
HideSearchButton: TButton;
|
HideSearchButton: TButton;
|
||||||
LanguagesEdit: TEdit;
|
OptionsButton: TButton;
|
||||||
LanguagesLabel: TLabel;
|
|
||||||
PagePanel: TPanel;
|
PagePanel: TPanel;
|
||||||
PageIpHtmlPanel: TIpHtmlPanel;
|
PageIpHtmlPanel: TIpHtmlPanel;
|
||||||
PageToolBar: TToolBar;
|
PageToolBar: TToolBar;
|
||||||
@ -44,13 +65,11 @@ type
|
|||||||
procedure FormDestroy(Sender: TObject);
|
procedure FormDestroy(Sender: TObject);
|
||||||
procedure HideSearchButtonClick(Sender: TObject);
|
procedure HideSearchButtonClick(Sender: TObject);
|
||||||
procedure LanguagesEditChange(Sender: TObject);
|
procedure LanguagesEditChange(Sender: TObject);
|
||||||
procedure OnIdle(Sender: TObject; var {%H-}Done: Boolean);
|
|
||||||
procedure IpHtmlPanelHotClick(Sender: TObject);
|
procedure IpHtmlPanelHotClick(Sender: TObject);
|
||||||
|
procedure OptionsButtonClick(Sender: TObject);
|
||||||
procedure SearchEditChange(Sender: TObject);
|
procedure SearchEditChange(Sender: TObject);
|
||||||
procedure ShowSearchToolButtonClick(Sender: TObject);
|
procedure ShowSearchToolButtonClick(Sender: TObject);
|
||||||
procedure Timer1Timer(Sender: TObject);
|
procedure Timer1Timer(Sender: TObject);
|
||||||
procedure WikiHelpScanned(Sender: TObject);
|
|
||||||
procedure WikiHelpSearched(Sender: TObject);
|
|
||||||
private
|
private
|
||||||
fLastSearchText: string;
|
fLastSearchText: string;
|
||||||
fLastLanguages: string;
|
fLastLanguages: string;
|
||||||
@ -61,12 +80,17 @@ type
|
|||||||
procedure UpdateProgress;
|
procedure UpdateProgress;
|
||||||
procedure LoadHTML(Target: TIpHtmlPanel; HTML: string); overload;
|
procedure LoadHTML(Target: TIpHtmlPanel; HTML: string); overload;
|
||||||
procedure LoadHTML(Target: TIpHtmlPanel; aStream: TStream); overload;
|
procedure LoadHTML(Target: TIpHtmlPanel; aStream: TStream); overload;
|
||||||
|
procedure ShowOptions;
|
||||||
|
procedure WikiHelpScanned(Sender: TObject);
|
||||||
|
procedure WikiHelpSearched(Sender: TObject);
|
||||||
|
procedure OnIdle(Sender: TObject; var {%H-}Done: Boolean);
|
||||||
|
function GetLanguages: string;
|
||||||
public
|
public
|
||||||
property IdleConnected: boolean read FIdleConnected write SetIdleConnected;
|
property IdleConnected: boolean read FIdleConnected write SetIdleConnected;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
WikiSearchDemoForm: TWikiSearchDemoForm;
|
WikiSearchDemoForm: TWikiSearchDemoForm = nil;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -101,10 +125,8 @@ begin
|
|||||||
SearchLabel.Caption:='Search:';
|
SearchLabel.Caption:='Search:';
|
||||||
SearchEdit.Text:='Documentation';
|
SearchEdit.Text:='Documentation';
|
||||||
SearchEdit.Hint:='Type one or more words separated by space, use " for phrases with spaces';
|
SearchEdit.Hint:='Type one or more words separated by space, use " for phrases with spaces';
|
||||||
LanguagesLabel.Caption:='Languages:';
|
|
||||||
LanguagesEdit.Text:='';
|
|
||||||
LanguagesEdit.Hint:='Empty for only original/untranslated pages, "de" to include german pages, "-,de" for german pages only';
|
|
||||||
HideSearchButton.Caption:='Hide';
|
HideSearchButton.Caption:='Hide';
|
||||||
|
OptionsButton.Caption:='Options';
|
||||||
|
|
||||||
// page panel
|
// page panel
|
||||||
ShowSearchToolButton.Caption:='Search';
|
ShowSearchToolButton.Caption:='Search';
|
||||||
@ -200,6 +222,14 @@ begin
|
|||||||
IdleConnected:=false;
|
IdleConnected:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TWikiSearchDemoForm.GetLanguages: string;
|
||||||
|
begin
|
||||||
|
if WikiSearchOptsWnd<>nil then
|
||||||
|
Result:=WikiSearchOptsWnd.Languages
|
||||||
|
else
|
||||||
|
Result:='';
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TWikiSearchDemoForm.IpHtmlPanelHotClick(Sender: TObject);
|
procedure TWikiSearchDemoForm.IpHtmlPanelHotClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
HotNode: TIpHtmlNode;
|
HotNode: TIpHtmlNode;
|
||||||
@ -244,6 +274,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TWikiSearchDemoForm.OptionsButtonClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
ShowOptions;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TWikiSearchDemoForm.SearchEditChange(Sender: TObject);
|
procedure TWikiSearchDemoForm.SearchEditChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
IdleConnected:=true;
|
IdleConnected:=true;
|
||||||
@ -273,6 +308,8 @@ end;
|
|||||||
procedure TWikiSearchDemoForm.WikiHelpScanned(Sender: TObject);
|
procedure TWikiSearchDemoForm.WikiHelpScanned(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
UpdateProgress;
|
UpdateProgress;
|
||||||
|
if WikiSearchOptsWnd<>nil then
|
||||||
|
WikiSearchOptsWnd.UpdateAvailableLanguages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TWikiSearchDemoForm.WikiHelpSearched(Sender: TObject);
|
procedure TWikiSearchDemoForm.WikiHelpSearched(Sender: TObject);
|
||||||
@ -292,7 +329,7 @@ var
|
|||||||
NewLanguages: String;
|
NewLanguages: String;
|
||||||
begin
|
begin
|
||||||
NewSearchText:=UTF8Trim(SearchEdit.Text);
|
NewSearchText:=UTF8Trim(SearchEdit.Text);
|
||||||
NewLanguages:=UTF8Trim(LanguagesEdit.Text);
|
NewLanguages:=GetLanguages;
|
||||||
if (NewSearchText=fLastSearchText) and (NewLanguages=fLastLanguages) then
|
if (NewSearchText=fLastSearchText) and (NewLanguages=fLastLanguages) then
|
||||||
exit;
|
exit;
|
||||||
fLastSearchText:=NewSearchText;
|
fLastSearchText:=NewSearchText;
|
||||||
@ -355,5 +392,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TWikiSearchDemoForm.ShowOptions;
|
||||||
|
begin
|
||||||
|
if WikiSearchOptsWnd=nil then
|
||||||
|
WikiSearchOptsWnd:=TWikiSearchOptsWnd.Create(Self);
|
||||||
|
WikiSearchOptsWnd.UpdateAvailableLanguages;
|
||||||
|
WikiSearchOptsWnd.ShowOnTop;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|||||||
@ -257,15 +257,15 @@ constructor TWiki2FPDocApplication.Create(TheOwner: TComponent);
|
|||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
StopOnException:=True;
|
StopOnException:=True;
|
||||||
FLanguageTags:=WikiCreateCommonLanguageList(true);
|
FLanguageTags:=WikiCreateCommonCodeTagList(true);
|
||||||
FFPDocConverter:=TWiki2FPDocConverter.Create;
|
FFPDocConverter:=TWiki2FPDocConverter.Create;
|
||||||
FPDocConverter.LanguageTags:=LanguageTags;
|
FPDocConverter.CodeTags:=LanguageTags;
|
||||||
FXHTMLConverter:=TWiki2XHTMLConverter.Create;
|
FXHTMLConverter:=TWiki2XHTMLConverter.Create;
|
||||||
XHTMLConverter.LanguageTags:=LanguageTags;
|
XHTMLConverter.CodeTags:=LanguageTags;
|
||||||
FHTMLConverter:=TWiki2HTMLConverter.Create;
|
FHTMLConverter:=TWiki2HTMLConverter.Create;
|
||||||
HTMLConverter.LanguageTags:=LanguageTags;
|
HTMLConverter.CodeTags:=LanguageTags;
|
||||||
FCHMConverter:=TWiki2CHMConverter.Create;
|
FCHMConverter:=TWiki2CHMConverter.Create;
|
||||||
CHMConverter.LanguageTags:=LanguageTags;
|
CHMConverter.CodeTags:=LanguageTags;
|
||||||
FConverter:=FHTMLConverter;
|
FConverter:=FHTMLConverter;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user