cody: dictionary: started hide other projects

git-svn-id: trunk@33809 -
This commit is contained in:
mattias 2011-11-27 00:07:55 +00:00
parent aa7511f8c6
commit d87be2153f
2 changed files with 55 additions and 18 deletions

View File

@ -1,12 +1,12 @@
object CodyIdentifiersDlg: TCodyIdentifiersDlg
Left = 250
Height = 300
Height = 305
Top = 250
Width = 521
Width = 543
ActiveControl = FilterEdit
Caption = 'CodyIdentifiersDlg'
ClientHeight = 300
ClientWidth = 521
ClientHeight = 305
ClientWidth = 543
OnClose = FormClose
OnCreate = FormCreate
Position = poScreenCenter
@ -14,8 +14,8 @@ object CodyIdentifiersDlg: TCodyIdentifiersDlg
object ButtonPanel1: TButtonPanel
Left = 6
Height = 42
Top = 252
Width = 509
Top = 257
Width = 531
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton'
@ -38,14 +38,14 @@ object CodyIdentifiersDlg: TCodyIdentifiersDlg
end
object FilterEdit: TEdit
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = InfoLabel
AnchorSideTop.Control = HideOtherProjectsCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 26
Top = 35
Width = 509
Top = 63
Width = 531
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 10
@ -64,9 +64,9 @@ object CodyIdentifiersDlg: TCodyIdentifiersDlg
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = UnitLabel
Left = 6
Height = 149
Top = 61
Width = 509
Height = 126
Top = 89
Width = 531
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Right = 6
@ -74,7 +74,7 @@ object CodyIdentifiersDlg: TCodyIdentifiersDlg
ItemHeight = 0
OnClick = ItemsListBoxClick
OnSelectionChange = ItemsListBoxSelectionChange
ScrollWidth = 507
ScrollWidth = 529
TabOrder = 2
TopIndex = -1
end
@ -83,7 +83,7 @@ object CodyIdentifiersDlg: TCodyIdentifiersDlg
AnchorSideBottom.Control = PackageLabel
Left = 8
Height = 17
Top = 211
Top = 216
Width = 59
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 1
@ -95,11 +95,24 @@ object CodyIdentifiersDlg: TCodyIdentifiersDlg
AnchorSideBottom.Control = ButtonPanel1
Left = 8
Height = 17
Top = 229
Top = 234
Width = 84
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 1
Caption = 'PackageLabel'
ParentColor = False
end
object HideOtherProjectsCheckBox: TCheckBox
AnchorSideLeft.Control = InfoLabel
AnchorSideTop.Control = InfoLabel
AnchorSideTop.Side = asrBottom
Left = 8
Height = 22
Top = 31
Width = 193
BorderSpacing.Top = 6
Caption = 'HideOtherProjectsCheckBox'
OnChange = HideOtherProjectsCheckBoxChange
TabOrder = 3
end
end

View File

@ -112,6 +112,7 @@ type
TCodyIdentifiersDlg = class(TForm)
ButtonPanel1: TButtonPanel;
FilterEdit: TEdit;
HideOtherProjectsCheckBox: TCheckBox;
InfoLabel: TLabel;
ItemsListBox: TListBox;
PackageLabel: TLabel;
@ -124,11 +125,13 @@ type
{%H-}Shift: TShiftState);
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure HideOtherProjectsCheckBoxChange(Sender: TObject);
procedure ItemsListBoxClick(Sender: TObject);
procedure ItemsListBoxSelectionChange(Sender: TObject; {%H-}User: boolean);
procedure OnIdle(Sender: TObject; var {%H-}Done: Boolean);
private
FLastFilter: string;
FLastHideOtherProjects: boolean;
FIdleConnected: boolean;
FMaxItems: integer;
FNoFilterText: string;
@ -147,8 +150,8 @@ type
function GetFPCSrcDir(const Directory: string): string;
public
CurIdentifier: string;
CurIdentStart: integer;
CurIdentEnd: integer;
CurIdentStart: integer; // column
CurIdentEnd: integer; // column
CurInitError: TCUParseError;
CurTool: TCodeTool;
CurCleanPos: integer;
@ -571,6 +574,12 @@ begin
FMaxItems:=20;
FNoFilterText:=crsFilter;
FItems:=TStringList.Create;
HideOtherProjectsCheckBox.Checked:=true;
end;
procedure TCodyIdentifiersDlg.HideOtherProjectsCheckBoxChange(Sender: TObject);
begin
IdleConnected:=true;
end;
procedure TCodyIdentifiersDlg.ItemsListBoxClick(Sender: TObject);
@ -590,7 +599,8 @@ begin
CodyUnitDictionary.Load;
UpdateGeneralInfo;
end;
if FLastFilter<>GetFilterEditText then
if (FLastFilter<>GetFilterEditText)
or (FLastHideOtherProjects<>HideOtherProjectsCheckBox.Checked) then
UpdateItemsList;
IdleConnected:=false;
end;
@ -629,7 +639,11 @@ var
UseGroup: Boolean;
begin
Filter:=GetFilterEditText;
FLastFilter:=Filter;
FilterP:=PChar(Filter);
FLastHideOtherProjects:=HideOtherProjectsCheckBox.Checked;
FItems.Clear;
sl:=TStringList.Create;
try
@ -655,6 +669,7 @@ begin
// => check if it is the current one
Dir:=ExtractFilePath(Group.Filename);
UseGroup:=CompareFilenames(Dir,FPCSrcDir)=0;
// ToDo: check if ppu is there
end else if FileExistsCached(Group.Filename) then begin
// lpk exists
UseGroup:=true;
@ -774,6 +789,7 @@ begin
CurIdentifier:=copy(Line,CurIdentStart,CurIdentEnd-CurIdentStart);
end;
GetCurOwnerOfUnit;
UpdateGeneralInfo;
FLastFilter:='...'; // force one update
if CurIdentifier='' then
@ -831,11 +847,19 @@ procedure TCodyIdentifiersDlg.GetCurOwnerOfUnit;
end;
begin
CurOwner:=nil;
if CurMainFilename='' then exit;
GetBest(PackageEditingInterface.GetOwnersOfUnit(CurMainFilename));
if CurOwner=nil then
GetBest(PackageEditingInterface.GetPossibleOwnersOfUnit(CurMainFilename,
[piosfIncludeSourceDirectories]));
if CurOwner<>nil then begin
if CurOwner is TLazProject then begin
//TLazProject(CurOwner).LazCompilerOptions.GetUnitOutputDirectory();
end else if CurOwner is TIDEPackage then begin
//TIDEPackage(CurOwner);
end;
end;
end;
procedure TCodyIdentifiersDlg.AddToUsesSection;