From e0e58b47c412535cf0a949ce6c7e596f7cd19b7e Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 22 Jan 2012 09:59:06 +0000 Subject: [PATCH] IDE: ide internals: fpdoc files git-svn-id: trunk@34854 - --- .gitattributes | 2 + ide/idefpdocfilesearch.lfm | 122 +++++++++++++++++++++++++++++++++++++ ide/idefpdocfilesearch.pas | 117 +++++++++++++++++++++++++++++++++++ ide/idehelpmanager.pas | 10 ++- ide/lazarus.lpi | 11 +++- ide/mainbar.pas | 1 + ide/mainbase.pas | 4 ++ 7 files changed, 264 insertions(+), 3 deletions(-) create mode 100644 ide/idefpdocfilesearch.lfm create mode 100644 ide/idefpdocfilesearch.pas diff --git a/.gitattributes b/.gitattributes index ce85fad078..9409783ab6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4283,6 +4283,8 @@ ide/idecontexthelpedit.pas svneol=native#text/plain ide/idedefs.pas svneol=native#text/pascal ide/idefpcinfo.lfm svneol=native#text/plain ide/idefpcinfo.pas svneol=native#text/plain +ide/idefpdocfilesearch.lfm svneol=native#text/plain +ide/idefpdocfilesearch.pas svneol=native#text/plain ide/ideguicmdline.pas svneol=native#text/plain ide/idehelpmanager.lfm svneol=native#text/plain ide/idehelpmanager.pas svneol=native#text/pascal diff --git a/ide/idefpdocfilesearch.lfm b/ide/idefpdocfilesearch.lfm new file mode 100644 index 0000000000..cc4b06383c --- /dev/null +++ b/ide/idefpdocfilesearch.lfm @@ -0,0 +1,122 @@ +object FPDocFileSearchDialog: TFPDocFileSearchDialog + Left = 239 + Height = 483 + Top = 201 + Width = 647 + Caption = 'FPDocFileSearchDialog' + ClientHeight = 483 + ClientWidth = 647 + KeyPreview = True + OnCreate = FormCreate + OnKeyDown = FormKeyDown + LCLVersion = '0.9.31' + object SearchTextLabel: TLabel + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = SearchTextComboBox + AnchorSideTop.Side = asrCenter + Left = 6 + Height = 15 + Top = 12 + Width = 91 + BorderSpacing.Left = 6 + Caption = 'SearchTextLabel' + ParentColor = False + end + object SearchTextComboBox: TComboBox + AnchorSideLeft.Control = SearchTextLabel + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Owner + AnchorSideRight.Control = CloseBitBtn + Left = 103 + Height = 27 + Top = 6 + Width = 457 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Around = 6 + ItemHeight = 0 + TabOrder = 0 + Text = 'SearchTextComboBox' + end + object ScopeGroupBox: TGroupBox + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = SearchTextComboBox + AnchorSideTop.Side = asrBottom + AnchorSideBottom.Control = Owner + AnchorSideBottom.Side = asrBottom + Left = 6 + Height = 438 + Top = 39 + Width = 145 + Anchors = [akTop, akLeft, akBottom] + BorderSpacing.Left = 6 + BorderSpacing.Top = 6 + BorderSpacing.Bottom = 6 + Caption = 'ScopeGroupBox' + ClientHeight = 422 + ClientWidth = 141 + TabOrder = 1 + object ScopeTreeView: TTreeView + Left = 0 + Height = 422 + Top = 0 + Width = 141 + Align = alClient + DefaultItemHeight = 16 + TabOrder = 0 + end + end + object CloseBitBtn: TBitBtn + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = Owner + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = Owner + AnchorSideBottom.Side = asrBottom + Left = 566 + Height = 26 + Top = 6 + Width = 75 + Anchors = [akTop, akRight] + AutoSize = True + BorderSpacing.Around = 6 + Caption = 'CloseBitBtn' + ModalResult = 11 + TabOrder = 2 + end + object Splitter1: TSplitter + AnchorSideLeft.Control = ScopeGroupBox + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = ScopeGroupBox + AnchorSideBottom.Control = ScopeGroupBox + AnchorSideBottom.Side = asrBottom + Left = 151 + Height = 438 + Top = 39 + Width = 5 + Align = alNone + Anchors = [akTop, akLeft, akBottom] + end + object ResultsMemo: TMemo + AnchorSideLeft.Control = Splitter1 + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Splitter1 + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = Owner + AnchorSideBottom.Side = asrBottom + Left = 156 + Height = 432 + Top = 45 + Width = 485 + Anchors = [akTop, akLeft, akRight, akBottom] + BorderSpacing.Top = 6 + BorderSpacing.Right = 6 + BorderSpacing.Bottom = 6 + Lines.Strings = ( + 'ResultsMemo' + ) + ReadOnly = True + ScrollBars = ssAutoBoth + TabOrder = 4 + end +end diff --git a/ide/idefpdocfilesearch.pas b/ide/idefpdocfilesearch.pas new file mode 100644 index 0000000000..e76f73f0bf --- /dev/null +++ b/ide/idefpdocfilesearch.pas @@ -0,0 +1,117 @@ +unit IDEFPDocFileSearch; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, + ButtonPanel, Buttons, ComCtrls, ExtCtrls, LCLType, + LazarusIDEStrConsts, PackageSystem, PackageDefs; + +type + + { TFPDocFileSearchDialog } + + TFPDocFileSearchDialog = class(TForm) + CloseBitBtn: TBitBtn; + ResultsMemo: TMemo; + ScopeGroupBox: TGroupBox; + ScopeTreeView: TTreeView; + SearchTextComboBox: TComboBox; + SearchTextLabel: TLabel; + Splitter1: TSplitter; + procedure FormCreate(Sender: TObject); + procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); + procedure OnIdle(Sender: TObject; var Done: Boolean); + private + FIdleConnected: boolean; + procedure SetIdleConnected(AValue: boolean); + procedure FillScope; + public + property IdleConnected: boolean read FIdleConnected write SetIdleConnected; + end; + +procedure ShowFPDocFileSearch; + +implementation + +procedure ShowFPDocFileSearch; +var + FPDocFileSearchDialog: TFPDocFileSearchDialog; +begin + FPDocFileSearchDialog:=TFPDocFileSearchDialog.Create(nil); + try + FPDocFileSearchDialog.ShowModal; + finally + FPDocFileSearchDialog.Free; + end; +end; + +{$R *.lfm} + +{ TFPDocFileSearchDialog } + +procedure TFPDocFileSearchDialog.FormCreate(Sender: TObject); +begin + Caption:='Search in FPDoc files'; + CloseBitBtn.Caption:='Close'; + SearchTextLabel.Caption:='Search:'; + SearchTextComboBox.Text:=''; + ActiveControl:=SearchTextComboBox; + ScopeGroupBox.Caption:='Scope'; + + ResultsMemo.Clear; + FillScope; + IdleConnected:=true; +end; + +procedure TFPDocFileSearchDialog.FormKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); +begin + if Key=VK_ESCAPE then + ModalResult:=mrCancel; +end; + +procedure TFPDocFileSearchDialog.OnIdle(Sender: TObject; var Done: Boolean); +begin + // ToDo: + + + // nothing to do + IdleConnected:=false; +end; + +procedure TFPDocFileSearchDialog.SetIdleConnected(AValue: boolean); +begin + if FIdleConnected=AValue then Exit; + FIdleConnected:=AValue; + if IdleConnected then + Application.AddOnIdleHandler(@OnIdle) + else + Application.RemoveOnIdleHandler(@OnIdle); +end; + +procedure TFPDocFileSearchDialog.FillScope; +var + PkgsNode: TTreeNode; + i: Integer; + Pkg: TLazPackage; +begin + ScopeTreeView.Items.BeginUpdate; + ScopeTreeView.Items.Clear; + + // packages with fpdoc + PkgsNode:=ScopeTreeView.Items.Add(nil,'Packages'); + for i:=0 to PackageGraph.Count-1 do begin + Pkg:=PackageGraph[i]; + if Pkg.FPDocPaths='' then continue; + ScopeTreeView.Items.AddChild(PkgsNode,Pkg.Name); + end; + PkgsNode.Expanded:=true; + + ScopeTreeView.Items.EndUpdate; +end; + +end. + diff --git a/ide/idehelpmanager.pas b/ide/idehelpmanager.pas index ccccc3d6c3..aee6e10da8 100644 --- a/ide/idehelpmanager.pas +++ b/ide/idehelpmanager.pas @@ -45,7 +45,7 @@ uses // IDE LazarusIDEStrConsts, TransferMacros, DialogProcs, IDEOptionDefs, ObjInspExt, EnvironmentOpts, AboutFrm, MsgView, Project, MainBar, OutputFilter, - PackageDefs, PackageSystem, + IDEFPDocFileSearch, PackageDefs, PackageSystem, HelpOptions, MainIntf, LazConf, HelpFPCMessages, CodeHelp, IDEContextHelpEdit, IDEWindowHelp; @@ -168,6 +168,7 @@ type { TIDEHelpManager } TIDEHelpManager = class(TBaseHelpManager) + procedure mnuSearchInFPDocFilesClick(Sender: TObject); // help menu of the IDE menu bar procedure mnuHelpAboutLazarusClicked(Sender: TObject); procedure mnuHelpOnlineHelpClicked(Sender: TObject); @@ -1109,6 +1110,11 @@ end; { TIDEHelpManager } +procedure TIDEHelpManager.mnuSearchInFPDocFilesClick(Sender: TObject); +begin + ShowFPDocFileSearch; +end; + procedure TIDEHelpManager.mnuHelpAboutLazarusClicked(Sender: TObject); begin ShowAboutForm; @@ -1291,6 +1297,8 @@ begin itmHelpAboutLazarus.OnClick := @mnuHelpAboutLazarusClicked; itmHelpOnlineHelp.OnClick := @mnuHelpOnlineHelpClicked; itmHelpReportingBug.OnClick := @mnuHelpReportBugClicked; + + itmSearchInFPDocFiles.OnClick:=@mnuSearchInFPDocFilesClick; end; end; diff --git a/ide/lazarus.lpi b/ide/lazarus.lpi index eb46c501af..5e8f4b14a1 100644 --- a/ide/lazarus.lpi +++ b/ide/lazarus.lpi @@ -63,7 +63,7 @@ - + @@ -648,6 +648,13 @@ + + + + + + + @@ -657,7 +664,7 @@ - + diff --git a/ide/mainbar.pas b/ide/mainbar.pas index 114b8372f4..17d4a8b98c 100644 --- a/ide/mainbar.pas +++ b/ide/mainbar.pas @@ -195,6 +195,7 @@ type itmViewPackageLinks: TIDEMenuCommand; itmViewFPCInfo: TIDEMenuCommand; itmViewIDEInfo: TIDEMenuCommand; + itmSearchInFPDocFiles: TIDEMenuCommand; // source menu //mnuSource: TIDEMenuSection; diff --git a/ide/mainbase.pas b/ide/mainbase.pas index c493d399ca..525c899a66 100644 --- a/ide/mainbase.pas +++ b/ide/mainbase.pas @@ -534,6 +534,10 @@ begin CreateMenuItem(itmViewIDEInternalsWindows, itmViewPackageLinks, 'itmViewPackageLinks', lisMenuPackageLinks); CreateMenuItem(itmViewIDEInternalsWindows, itmViewFPCInfo, 'itmViewFPCInfo', lisMenuAboutFPC); CreateMenuItem(itmViewIDEInternalsWindows, itmViewIDEInfo, 'itmViewIDEInfo', lisAboutIDE); + {$IFDEF EnableFPDocSearch} + CreateMenuItem(itmViewIDEInternalsWindows, itmSearchInFPDocFiles, 'itmSearchInFPDocFiles', + 'Search in FPDoc files'); + {$ENDIF} end; end; end;