cody: started dictionary

git-svn-id: trunk@33550 -
This commit is contained in:
mattias 2011-11-16 05:50:48 +00:00
parent 77a636308b
commit 3d59e27e15
15 changed files with 189 additions and 5 deletions

2
.gitattributes vendored
View File

@ -573,6 +573,8 @@ components/codetools/ide/codycopydeclaration.pas svneol=native#text/plain
components/codetools/ide/codyctrls.pas svneol=native#text/plain
components/codetools/ide/codyfrm.lfm svneol=native#text/plain
components/codetools/ide/codyfrm.pas svneol=native#text/plain
components/codetools/ide/codyidentifiersdlg.lfm svneol=native#text/plain
components/codetools/ide/codyidentifiersdlg.pas svneol=native#text/plain
components/codetools/ide/codynodeinfodlg.lfm svneol=native#text/plain
components/codetools/ide/codynodeinfodlg.pas svneol=native#text/plain
components/codetools/ide/codyregistration.pas svneol=native#text/plain

View File

@ -5224,6 +5224,7 @@ begin
// Note: IdentifierList nodes do not need to be cleared, because Node
// is accessed via GetNode, which checks if nodes were deleted
end;
end;
function TCodeToolManager.OnScannerProgress(Sender: TLinkScanner): boolean;

View File

@ -18,7 +18,7 @@ uses
PascalReaderTool, PPUCodeTools, PPUGraph, PPUParser, ResourceCodeTool,
SourceChanger, SourceLog, StdCodeTools, OtherIdentifierTree,
CodeToolsCfgScript, CTXMLFixFragment, CTUnitGraph, ChangeDeclarationTool,
CodeToolsFPCMsgs, unitdictionary, LazarusPackageIntf;
CodeToolsFPCMsgs, UnitDictionary, LazarusPackageIntf;
implementation

View File

@ -19,7 +19,7 @@
<Description Value="IDE extensions using Codetools."/>
<License Value="GPL2"/>
<Version Major="1" Minor="1"/>
<Files Count="11">
<Files Count="12">
<Item1>
<Filename Value="ppulistdlg.pas"/>
<UnitName Value="PPUListDlg"/>
@ -65,6 +65,10 @@
<Filename Value="addwithblockdlg.pas"/>
<UnitName Value="AddWithBlockDlg"/>
</Item11>
<Item12>
<Filename Value="codyidentifiersdlg.pas"/>
<UnitName Value="codyidentifiersdlg"/>
</Item12>
</Files>
<LazDoc Paths="doc"/>
<i18n>

View File

@ -9,7 +9,7 @@ interface
uses
PPUListDlg, CodyStrConsts, AddAssignMethodDlg, CodyCtrls, CodyFrm,
CodyRegistration, DeclareVarDlg, CodyUtils, CodyNodeInfoDlg,
CodyCopyDeclaration, AddWithBlockDlg, LazarusPackageIntf;
CodyCopyDeclaration, AddWithBlockDlg, CodyIdentifiersDlg, LazarusPackageIntf;
implementation

View File

@ -0,0 +1,34 @@
object CodyIdentifiersDlg: TCodyIdentifiersDlg
Left = 250
Height = 300
Top = 250
Width = 428
Caption = 'CodyIdentifiersDlg'
ClientHeight = 300
ClientWidth = 428
LCLVersion = '0.9.31'
object ButtonPanel1: TButtonPanel
Left = 6
Height = 42
Top = 252
Width = 416
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton'
HelpButton.DefaultCaption = True
CloseButton.Name = 'CloseButton'
CloseButton.DefaultCaption = True
CancelButton.Name = 'CancelButton'
CancelButton.DefaultCaption = True
TabOrder = 0
ShowButtons = [pbOK, pbCancel, pbHelp]
end
object InfoLabel: TLabel
Left = 28
Height = 17
Top = 25
Width = 59
Caption = 'InfoLabel'
ParentColor = False
end
end

View File

@ -0,0 +1,113 @@
{
***************************************************************************
* *
* 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. *
* *
***************************************************************************
Author: Mattias Gaertner
Abstract:
Dictionary of identifiers.
}
unit CodyIdentifiersDlg;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ButtonPanel, StdCtrls, CodeToolManager, UnitDictionary;
type
{ TCodyUnitDictionary }
TCodyUnitDictionary = class(TUnitDictionary)
public
constructor Create;
destructor Destroy; override;
end;
{ TCodyIdentifiersDlg }
TCodyIdentifiersDlg = class(TForm)
ButtonPanel1: TButtonPanel;
InfoLabel: TLabel;
private
public
procedure Init;
end;
var
CodyUnitDictionary: TCodyUnitDictionary = nil;
procedure ShowUnitDictionaryDialog(Sender: TObject);
procedure InitUnitDictionary;
implementation
{$R *.lfm}
procedure ShowUnitDictionaryDialog(Sender: TObject);
var
CodyIdentifiersDlg: TCodyIdentifiersDlg;
begin
CodyIdentifiersDlg:=TCodyIdentifiersDlg.Create(nil);
try
CodyIdentifiersDlg.Init;
CodyIdentifiersDlg.ShowModal;
finally
CodyIdentifiersDlg.Free;
end;
end;
procedure InitUnitDictionary;
begin
CodyUnitDictionary:=TCodyUnitDictionary.Create;
end;
{ TCodyUnitDictionary }
constructor TCodyUnitDictionary.Create;
begin
inherited Create;
end;
destructor TCodyUnitDictionary.Destroy;
begin
inherited Destroy;
end;
{ TCodyIdentifiersDlg }
procedure TCodyIdentifiersDlg.Init;
var
s: String;
begin
s:='Packages: '+IntToStr(CodyUnitDictionary.UnitGroupsByFilename.Count)
+', Units: '+IntToStr(CodyUnitDictionary.UnitsByFilename.Count)
+', Identifiers: '+IntToStr(CodyUnitDictionary.Identifiers.Count);
InfoLabel.Caption:=s;
end;
finalization
FreeAndNil(CodyUnitDictionary);
end.

View File

@ -33,7 +33,8 @@ uses
Classes, SysUtils, LResources, Controls,
IDECommands, MenuIntf, IDEWindowIntf, SrcEditorIntf,
CodyStrConsts, CodyCtrls, PPUListDlg, AddAssignMethodDlg, AddWithBlockDlg,
CodyUtils, CodyNodeInfoDlg, CodyFrm, DeclareVarDlg, CodyCopyDeclaration;
CodyUtils, CodyNodeInfoDlg, CodyFrm, DeclareVarDlg, CodyCopyDeclaration,
CodyIdentifiersDlg;
procedure Register;
@ -57,6 +58,7 @@ var
ViewCodyWindowCommand: TIDECommand;
CopyDeclarationToClipboardCommand: TIDECommand;
CutDeclarationToClipboardCommand: TIDECommand;
ShowIdentifierDictionaryCommand: TIDECommand;
begin
CmdCatFileMenu:=IDECommandList.FindCategoryByName('FileMenu');
if CmdCatFileMenu=nil then
@ -148,6 +150,13 @@ begin
RegisterIDEMenuCommand(itmViewIDEInternalsWindows, 'ShowCodeNodeInfo',
crsShowCodeToolsNodeInfo, nil, nil, ShowCodeNodeInfoCommand);
// Show unit/identifier dictionary
InitUnitDictionary;
ShowIdentifierDictionaryCommand:=RegisterIDECommand(CmdCatCodeTools, 'ShowUnitDictionary',
crsShowUnitIdentifierDictionary,
CleanIDEShortCut,CleanIDEShortCut,nil,@ShowUnitDictionaryDialog);
RegisterIDEMenuCommand(itmViewIDEInternalsWindows, 'ShowIdentifierDictionary',
crsShowUnitIdentifierDictionary, nil, nil, ShowIdentifierDictionaryCommand);
// View menu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ViewCodyWindowCommand:=RegisterIDECommand(CmdCatView, 'Cody',

View File

@ -75,6 +75,7 @@ resourcestring
crsClose = '&Close';
crsAddAssignMethod = 'Add Assign method';
crsShowCodeToolsNodeInfo = 'Show CodeTools node info ...';
crsShowUnitIdentifierDictionary = 'Show unit/identifier dictionary ...';
crsAddAssignMethod2 = 'Add Assign method ...';
crsCopyDeclarationToClipboard = 'Copy declaration to clipboard';
crsCutDeclarationToClipboard = 'Cut declaration to clipboard';

View File

@ -398,6 +398,10 @@ msgstr ""
msgid "Show CodeTools node info ..."
msgstr ""
#: codystrconsts.crsshowunitidentifierdictionary
msgid "Show unit/identifier dictionary ..."
msgstr ""
#: codystrconsts.crsshowusedppufiles
#, fuzzy
#| msgid "Show used .ppu files"

View File

@ -389,6 +389,10 @@ msgstr ""
msgid "Show CodeTools node info ..."
msgstr ""
#: codystrconsts.crsshowunitidentifierdictionary
msgid "Show unit/identifier dictionary ..."
msgstr ""
#: codystrconsts.crsshowusedppufiles
msgid "Show used .ppu files ..."
msgstr ""

View File

@ -397,6 +397,10 @@ msgstr "Selecionar expressão"
msgid "Show CodeTools node info ..."
msgstr "Exibir info do nó CodeTools ..."
#: codystrconsts.crsshowunitidentifierdictionary
msgid "Show unit/identifier dictionary ..."
msgstr ""
#: codystrconsts.crsshowusedppufiles
#| msgid "Show used .ppu files"
msgid "Show used .ppu files ..."

View File

@ -398,6 +398,10 @@ msgstr "Выберите выражение"
msgid "Show CodeTools node info ..."
msgstr "Показать сведения об элементе CodeTools ..."
#: codystrconsts.crsshowunitidentifierdictionary
msgid "Show unit/identifier dictionary ..."
msgstr ""
#: codystrconsts.crsshowusedppufiles
#| msgid "Show used .ppu files"
msgid "Show used .ppu files ..."

View File

@ -397,6 +397,10 @@ msgstr ""
msgid "Show CodeTools node info ..."
msgstr "Показати інфо про вузол CodeTools ..."
#: codystrconsts.crsshowunitidentifierdictionary
msgid "Show unit/identifier dictionary ..."
msgstr ""
#: codystrconsts.crsshowusedppufiles
msgid "Show used .ppu files ..."
msgstr "Показати використовувані .ppu файли ..."

View File

@ -23,7 +23,7 @@
Abstract:
Quick lookup database for identifiers in units.
}
unit unitdictionary;
unit UnitDictionary;
{$mode objfpc}{$H+}