mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-23 19:06:00 +02:00
IDE: codebrowser: add package to project
git-svn-id: trunk@21506 -
This commit is contained in:
parent
ee7a5a1f0f
commit
2cf81da62e
@ -1,7 +1,7 @@
|
||||
object CodeBrowserView: TCodeBrowserView
|
||||
Left = 320
|
||||
Left = 303
|
||||
Height = 563
|
||||
Top = 333
|
||||
Top = 292
|
||||
Width = 623
|
||||
ActiveControl = ScopeComboBox
|
||||
Caption = 'CodeBrowserView'
|
||||
@ -51,7 +51,7 @@ object CodeBrowserView: TCodeBrowserView
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 41
|
||||
Height = 26
|
||||
Top = 190
|
||||
Width = 611
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
@ -63,7 +63,7 @@ object CodeBrowserView: TCodeBrowserView
|
||||
ChildSizing.EnlargeHorizontal = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 3
|
||||
ClientHeight = 22
|
||||
ClientHeight = 7
|
||||
ClientWidth = 607
|
||||
TabOrder = 1
|
||||
object ShowPrivateCheckBox: TCheckBox
|
||||
@ -98,8 +98,8 @@ object CodeBrowserView: TCodeBrowserView
|
||||
AnchorSideTop.Control = OptionsGroupBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 285
|
||||
Top = 237
|
||||
Height = 300
|
||||
Top = 222
|
||||
Width = 623
|
||||
Align = alBottom
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
@ -326,6 +326,13 @@ object CodeBrowserView: TCodeBrowserView
|
||||
object CopySeparatorMenuItem: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object AddPkgToProjectMenuItem: TMenuItem
|
||||
Caption = 'AddPkgToProjectMenuItem'
|
||||
OnClick = AddPkgToProjectMenuItemClick
|
||||
end
|
||||
object UseSeparatorMenuItem: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object ExpandAllPackagesMenuItem: TMenuItem
|
||||
Caption = 'ExpandAllPackagesMenuItem'
|
||||
OnClick = ExpandAllPackagesMenuItemClick
|
||||
|
@ -1,8 +1,8 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TCodeBrowserView','FORMDATA',[
|
||||
'TPF0'#16'TCodeBrowserView'#15'CodeBrowserView'#4'Left'#3'@'#1#6'Height'#3'3'
|
||||
+#2#3'Top'#3'M'#1#5'Width'#3'o'#2#13'ActiveControl'#7#13'ScopeComboBox'#7'Cap'
|
||||
'TPF0'#16'TCodeBrowserView'#15'CodeBrowserView'#4'Left'#3'/'#1#6'Height'#3'3'
|
||||
+#2#3'Top'#3'$'#1#5'Width'#3'o'#2#13'ActiveControl'#7#13'ScopeComboBox'#7'Cap'
|
||||
+'tion'#6#15'CodeBrowserView'#12'ClientHeight'#3'3'#2#11'ClientWidth'#3'o'#2#7
|
||||
+'OnClose'#7#9'FormClose'#8'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7#11'Form'
|
||||
+'Destroy'#10'LCLVersion'#6#6'0.9.29'#0#9'TGroupBox'#13'ScopeGroupBox'#4'Left'
|
||||
@ -18,12 +18,12 @@ LazarusResources.Add('TCodeBrowserView','FORMDATA',[
|
||||
+'OptionsGroupBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Con'
|
||||
+'trol'#7#14'LevelsGroupBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorS'
|
||||
+'ideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#21'Anc'
|
||||
+'horSideBottom.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2')'#3'Top'#3#190#0
|
||||
+'horSideBottom.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#26#3'Top'#3#190#0
|
||||
+#5'Width'#3'c'#2#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoSize'#9
|
||||
+#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#19'BorderSpacing.Right'
|
||||
+#2#6#7'Caption'#6#15'OptionsGroupBox'#29'ChildSizing.EnlargeHorizontal'#7#14
|
||||
+'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cclLeftToRightThenTopToBottom'
|
||||
+#27'ChildSizing.ControlsPerLine'#2#3#12'ClientHeight'#2#22#11'ClientWidth'#3
|
||||
+#27'ChildSizing.ControlsPerLine'#2#3#12'ClientHeight'#2#7#11'ClientWidth'#3
|
||||
+'_'#2#8'TabOrder'#2#1#0#9'TCheckBox'#19'ShowPrivateCheckBox'#4'Left'#2#0#6'H'
|
||||
+'eight'#2#22#3'Top'#2#0#5'Width'#3#182#0#7'Caption'#6#19'ShowPrivateCheckBox'
|
||||
+#8'OnChange'#7#25'ShowPrivateCheckBoxChange'#8'TabOrder'#2#0#0#0#9'TCheckBox'
|
||||
@ -34,7 +34,7 @@ LazarusResources.Add('TCodeBrowserView','FORMDATA',[
|
||||
+'ShowEmptyNodesCheckBox'#13'OnEditingDone'#7#25'ShowPrivateCheckBoxChange'#8
|
||||
+'TabOrder'#2#2#0#0#0#9'TTreeView'#14'BrowseTreeView'#21'AnchorSideTop.Contro'
|
||||
+'l'#7#15'OptionsGroupBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#0#6
|
||||
+'Height'#3#29#1#3'Top'#3#237#0#5'Width'#3'o'#2#5'Align'#7#8'alBottom'#7'Anch'
|
||||
+'Height'#3','#1#3'Top'#3#222#0#5'Width'#3'o'#2#5'Align'#7#8'alBottom'#7'Anch'
|
||||
+'ors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#17'BorderSpacing.Top'#2
|
||||
+#6#17'DefaultItemHeight'#2#19#6'Images'#7#10'ImageList1'#14'ParentShowHint'#8
|
||||
+#9'PopupMenu'#7#10'PopupMenu1'#8'ReadOnly'#9#8'ShowHint'#9#8'TabOrder'#2#2#11
|
||||
@ -112,21 +112,24 @@ LazarusResources.Add('TCodeBrowserView','FORMDATA',[
|
||||
+'nMenuItem'#7'OnClick'#7#28'CopyDescriptionMenuItemClick'#0#0#9'TMenuItem'#22
|
||||
+'CopyIdentifierMenuItem'#7'Caption'#6#22'CopyIdentifierMenuItem'#7'OnClick'#7
|
||||
+#27'CopyIdentifierMenuItemClick'#0#0#9'TMenuItem'#21'CopySeparatorMenuItem'#7
|
||||
+'Caption'#6#1'-'#0#0#9'TMenuItem'#25'ExpandAllPackagesMenuItem'#7'Caption'#6
|
||||
+#25'ExpandAllPackagesMenuItem'#7'OnClick'#7#30'ExpandAllPackagesMenuItemClic'
|
||||
+'k'#0#0#9'TMenuItem'#27'CollapseAllPackagesMenuItem'#7'Caption'#6#27'Collaps'
|
||||
+'eAllPackagesMenuItem'#7'OnClick'#7' CollapseAllPackagesMenuItemClick'#0#0#9
|
||||
+'TMenuItem'#28'AllPackagesSeparatorMenuItem'#7'Caption'#6#1'-'#0#0#9'TMenuIt'
|
||||
+'em'#22'ExpandAllUnitsMenuItem'#7'Caption'#6#22'ExpandAllUnitsMenuItem'#7'On'
|
||||
+'Click'#7#27'ExpandAllUnitsMenuItemClick'#0#0#9'TMenuItem'#24'CollapseAllUni'
|
||||
+'tsMenuItem'#7'Caption'#6#24'CollapseAllUnitsMenuItem'#7'OnClick'#7#29'Colla'
|
||||
+'pseAllUnitsMenuItemClick'#0#0#9'TMenuItem'#25'AllUnitsSeparatorMenuItem'#7
|
||||
+'Caption'#6#1'-'#0#0#9'TMenuItem'#24'ExpandAllClassesMenuItem'#7'Caption'#6
|
||||
+#24'ExpandAllClassesMenuItem'#7'OnClick'#7#29'ExpandAllClassesMenuItemClick'
|
||||
+#0#0#9'TMenuItem'#26'CollapseAllClassesMenuItem'#7'Caption'#6#26'CollapseAll'
|
||||
+'ClassesMenuItem'#7'OnClick'#7#31'CollapseAllClassesMenuItemClick'#0#0#9'TMe'
|
||||
+'nuItem'#27'AllClassesSeparatorMenuItem'#7'Caption'#6#1'-'#0#0#9'TMenuItem'
|
||||
+#14'ExportMenuItem'#7'Caption'#6#14'ExportMenuItem'#7'OnClick'#7#19'ExportMe'
|
||||
+'nuItemClick'#0#0#0#10'TIdleTimer'#10'IdleTimer1'#7'OnTimer'#7#15'IdleTimer1'
|
||||
+'Timer'#4'left'#3'^'#1#3'top'#3#196#0#0#0#0
|
||||
+'Caption'#6#1'-'#0#0#9'TMenuItem'#23'AddPkgToProjectMenuItem'#7'Caption'#6#23
|
||||
+'AddPkgToProjectMenuItem'#7'OnClick'#7#28'AddPkgToProjectMenuItemClick'#0#0#9
|
||||
+'TMenuItem'#20'UseSeparatorMenuItem'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#25'E'
|
||||
+'xpandAllPackagesMenuItem'#7'Caption'#6#25'ExpandAllPackagesMenuItem'#7'OnCl'
|
||||
+'ick'#7#30'ExpandAllPackagesMenuItemClick'#0#0#9'TMenuItem'#27'CollapseAllPa'
|
||||
+'ckagesMenuItem'#7'Caption'#6#27'CollapseAllPackagesMenuItem'#7'OnClick'#7' '
|
||||
+'CollapseAllPackagesMenuItemClick'#0#0#9'TMenuItem'#28'AllPackagesSeparatorM'
|
||||
+'enuItem'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#22'ExpandAllUnitsMenuItem'#7'Ca'
|
||||
+'ption'#6#22'ExpandAllUnitsMenuItem'#7'OnClick'#7#27'ExpandAllUnitsMenuItemC'
|
||||
+'lick'#0#0#9'TMenuItem'#24'CollapseAllUnitsMenuItem'#7'Caption'#6#24'Collaps'
|
||||
+'eAllUnitsMenuItem'#7'OnClick'#7#29'CollapseAllUnitsMenuItemClick'#0#0#9'TMe'
|
||||
+'nuItem'#25'AllUnitsSeparatorMenuItem'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#24
|
||||
+'ExpandAllClassesMenuItem'#7'Caption'#6#24'ExpandAllClassesMenuItem'#7'OnCli'
|
||||
+'ck'#7#29'ExpandAllClassesMenuItemClick'#0#0#9'TMenuItem'#26'CollapseAllClas'
|
||||
+'sesMenuItem'#7'Caption'#6#26'CollapseAllClassesMenuItem'#7'OnClick'#7#31'Co'
|
||||
+'llapseAllClassesMenuItemClick'#0#0#9'TMenuItem'#27'AllClassesSeparatorMenuI'
|
||||
+'tem'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#14'ExportMenuItem'#7'Caption'#6#14
|
||||
,'ExportMenuItem'#7'OnClick'#7#19'ExportMenuItemClick'#0#0#0#10'TIdleTimer'#10
|
||||
+'IdleTimer1'#7'OnTimer'#7#15'IdleTimer1Timer'#4'left'#3'^'#1#3'top'#3#196#0#0
|
||||
+#0#0
|
||||
]);
|
||||
|
@ -32,9 +32,6 @@
|
||||
The codetools provides TCodeTree of every unit.
|
||||
|
||||
ToDo:
|
||||
- double click on package: open package editor
|
||||
- double click on project: open project inspector
|
||||
- add package to project
|
||||
- add package to package of editor unit
|
||||
- add package+unit to editor unit
|
||||
- add package+unit+identifier to editor caret
|
||||
@ -59,7 +56,7 @@ uses
|
||||
DialogProcs,
|
||||
// IDE
|
||||
PackageSystem, PackageDefs, LazarusIDEStrConsts, IDEOptionDefs,
|
||||
EnvironmentOpts, Menus;
|
||||
BasePkgManager, AddToProjectDlg, EnvironmentOpts, Menus;
|
||||
|
||||
|
||||
type
|
||||
@ -174,6 +171,8 @@ type
|
||||
AllUnitsSeparatorMenuItem: TMenuItem;
|
||||
BrowseTreeView: TTreeView;
|
||||
IdleTimer1: TIdleTimer;
|
||||
AddPkgToProjectMenuItem: TMenuItem;
|
||||
UseSeparatorMenuItem: TMenuItem;
|
||||
ShowEmptyNodesCheckBox: TCheckBox;
|
||||
CollapseAllClassesMenuItem: TMenuItem;
|
||||
CollapseAllPackagesMenuItem: TMenuItem;
|
||||
@ -208,6 +207,7 @@ type
|
||||
UnitFilterBeginsSpeedButton: TSpeedButton;
|
||||
UnitFilterContainsSpeedButton: TSpeedButton;
|
||||
UnitFilterEdit: TEdit;
|
||||
procedure AddPkgToProjectMenuItemClick(Sender: TObject);
|
||||
procedure BrowseTreeViewMouseDown(Sender: TOBject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
procedure BrowseTreeViewShowHint(Sender: TObject; HintInfo: PHintInfo);
|
||||
@ -314,6 +314,7 @@ type
|
||||
Expand: boolean);
|
||||
procedure CopyNode(TVNode: TTreeNode; NodeType: TCopyNodeType);
|
||||
procedure InvalidateStage(AStage: TCodeBrowserWorkStage);
|
||||
function GetSelectedPackage: TLazPackage;
|
||||
public
|
||||
procedure BeginUpdate;
|
||||
procedure EndUpdate;
|
||||
@ -404,6 +405,7 @@ begin
|
||||
ExpandAllClassesMenuItem.Caption:=lisExpandAllClasses;
|
||||
CollapseAllClassesMenuItem.Caption:=lisCollapseAllClasses;
|
||||
ExportMenuItem.Caption:=lisExport;
|
||||
AddPkgToProjectMenuItem.Caption:=lisAddPackageDependencyToProject;
|
||||
|
||||
PackageFilterBeginsSpeedButton.Caption:=lisBegins;
|
||||
PackageFilterBeginsSpeedButton.Hint:=lisPackageNameBeginsWith;
|
||||
@ -458,6 +460,9 @@ var
|
||||
TVNode: TTreeNode;
|
||||
Node: TObject;
|
||||
Identifier: String;
|
||||
UnitList: TCodeBrowserUnitList;
|
||||
EnableAddPkgToProject: Boolean;
|
||||
APackage: TLazPackage;
|
||||
begin
|
||||
ExpandAllPackagesMenuItem.Visible:=Options.HasLevel(cblPackages);
|
||||
CollapseAllPackagesMenuItem.Visible:=ExpandAllPackagesMenuItem.Visible;
|
||||
@ -475,11 +480,30 @@ begin
|
||||
Node:=nil;
|
||||
if TVNode<>nil then
|
||||
Node:=TOBject(TVNode.Data);
|
||||
EnableAddPkgToProject:=false;
|
||||
if Node<>nil then begin
|
||||
if Node is TCodeBrowserNode then
|
||||
Identifier:=TCodeBrowserNode(Node).Identifier
|
||||
else
|
||||
Identifier:='';
|
||||
APackage:=nil;
|
||||
if Node is TCodeBrowserUnitList then begin
|
||||
UnitList:=TCodeBrowserUnitList(Node);
|
||||
if UnitList.Owner=CodeBrowserProjectName then begin
|
||||
// project
|
||||
end else if UnitList.Owner=CodeBrowserIDEName then begin
|
||||
// IDE
|
||||
end else if UnitList.Owner=CodeBrowserHidden then begin
|
||||
// nothing
|
||||
end else begin
|
||||
// package
|
||||
APackage:=PackageGraph.FindAPackageWithName(UnitList.Owner,nil);
|
||||
if APackage<>nil then begin
|
||||
if Project1.FindDependencyByName(APackage.Name)=nil then
|
||||
EnableAddPkgToProject:=true;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
CopyDescriptionMenuItem.Caption:=lisCopyDescription;
|
||||
CopyIdentifierMenuItem.Caption:=Format(lisCopyIdentifier, ['"', Identifier,
|
||||
'"']);
|
||||
@ -491,6 +515,7 @@ begin
|
||||
CopyIdentifierMenuItem.Visible:=false;
|
||||
CopySeparatorMenuItem.Visible:=false;
|
||||
end;
|
||||
AddPkgToProjectMenuItem.Enabled:=EnableAddPkgToProject;
|
||||
end;
|
||||
|
||||
procedure TCodeBrowserView.ScopeComboBoxGetItems(Sender: TObject);
|
||||
@ -2161,6 +2186,22 @@ begin
|
||||
fStage:=AStage;
|
||||
end;
|
||||
|
||||
function TCodeBrowserView.GetSelectedPackage: TLazPackage;
|
||||
var
|
||||
TVNode: TTreeNode;
|
||||
Node: TObject;
|
||||
UnitList: TCodeBrowserUnitList;
|
||||
begin
|
||||
Result:=nil;
|
||||
TVNode:=BrowseTreeView.Selected;
|
||||
if TVNode=nil then exit;
|
||||
Node:=TObject(TVNode.Data);
|
||||
if Node=nil then exit;
|
||||
if not (Node is TCodeBrowserUnitList) then exit;
|
||||
UnitList:=TCodeBrowserUnitList(Node);
|
||||
Result:=PackageGraph.FindAPackageWithName(UnitList.Owner,nil);
|
||||
end;
|
||||
|
||||
procedure TCodeBrowserView.BeginUpdate;
|
||||
begin
|
||||
inc(fUpdateCount);
|
||||
@ -2359,6 +2400,15 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCodeBrowserView.AddPkgToProjectMenuItemClick(Sender: TObject);
|
||||
var
|
||||
APackage: TLazPackage;
|
||||
begin
|
||||
APackage:=GetSelectedPackage;
|
||||
if APackage=nil then exit;
|
||||
PkgBoss.AddProjectDependency(Project1,APackage);
|
||||
end;
|
||||
|
||||
{ TCodeBrowserViewOptions }
|
||||
|
||||
procedure TCodeBrowserViewOptions.SetModified(const AValue: boolean);
|
||||
|
@ -1859,6 +1859,7 @@ resourcestring
|
||||
lisCollapseAllClasses = 'Collapse all classes';
|
||||
lisExport = 'Export ...';
|
||||
lisBegins = 'begins';
|
||||
lisAddPackageDependencyToProject = 'Add package dependency to project';
|
||||
lisIdentifierBeginsWith = 'Identifier begins with ...';
|
||||
lisUnitNameBeginsWith = 'Unit name begins with ...';
|
||||
lisPackageNameBeginsWith = 'Package name begins with ...';
|
||||
|
Loading…
Reference in New Issue
Block a user