From 9a7c586fea03b24e654f7e5912dc05541c4d724f Mon Sep 17 00:00:00 2001 From: mattias Date: Mon, 17 Jun 2013 19:43:16 +0000 Subject: [PATCH] cody: unit deps: all units: expand all, collapse all git-svn-id: trunk@41756 - --- components/codetools/ide/codyunitdepwnd.lfm | 14 +++++++ components/codetools/ide/codyunitdepwnd.pas | 45 +++++++++++++++++---- 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/components/codetools/ide/codyunitdepwnd.lfm b/components/codetools/ide/codyunitdepwnd.lfm index b59529ba5d..a0b6daa4cf 100644 --- a/components/codetools/ide/codyunitdepwnd.lfm +++ b/components/codetools/ide/codyunitdepwnd.lfm @@ -227,6 +227,7 @@ object UnitDependenciesWindow: TUnitDependenciesWindow Width = 244 Anchors = [akTop, akLeft, akRight, akBottom] DefaultItemHeight = 18 + PopupMenu = UnitsTVPopupMenu ReadOnly = True TabOrder = 1 OnMouseDown = AllUnitsTreeViewMouseDown @@ -336,6 +337,7 @@ object UnitDependenciesWindow: TUnitDependenciesWindow Width = 359 Anchors = [akTop, akLeft, akRight, akBottom] DefaultItemHeight = 18 + PopupMenu = UnitsTVPopupMenu ReadOnly = True TabOrder = 1 Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw] @@ -357,4 +359,16 @@ object UnitDependenciesWindow: TUnitDependenciesWindow end end end + object UnitsTVPopupMenu: TPopupMenu + left = 120 + top = 193 + object UnitsTVExpandAllMenuItem: TMenuItem + Caption = 'UnitsTVExpandAllMenuItem' + OnClick = UnitsTVExpandAllMenuItemClick + end + object UnitsTVCollapseAllMenuItem: TMenuItem + Caption = 'UnitsTVCollapseAllMenuItem' + OnClick = UnitsTVCollapseAllMenuItemClick + end + end end diff --git a/components/codetools/ide/codyunitdepwnd.pas b/components/codetools/ide/codyunitdepwnd.pas index 8a1669998e..9aa723bff9 100644 --- a/components/codetools/ide/codyunitdepwnd.pas +++ b/components/codetools/ide/codyunitdepwnd.pas @@ -30,10 +30,7 @@ - additional files as start units - view: - text search with highlight - - double click on package open package editor - popup menu: copy file name of unit, project lpi, package lpk, directory - - popup menu: expand all - - popup menu: collapse all - hint for unit, project lpi, package lpk, directory: full filename - selected units - expand node: show connected units @@ -43,8 +40,6 @@ - double click on project open project inspector - double click on package open package editor - popup menu: copy file name of unit, project lpi, package lpk, directory - - popup menu: expand all - - popup menu: collapse all - hint for unit, project lpi, package lpk, directory: full filename - resourcestrings } @@ -56,7 +51,7 @@ interface uses Classes, SysUtils, AVL_Tree, LazLogger, LazFileUtils, LazUTF8, Forms, - Controls, ExtCtrls, ComCtrls, StdCtrls, Buttons, Dialogs, LvlGraphCtrl, + Controls, ExtCtrls, ComCtrls, StdCtrls, Buttons, Dialogs, Menus, LvlGraphCtrl, LazIDEIntf, ProjectIntf, IDEWindowIntf, PackageIntf, SrcEditorIntf, IDEDialogs, IDEImagesIntf, IDECommands, CodeToolManager, DefineTemplates, CodeToolsStructs, CTUnitGraph, CTUnitGroupGraph, FileProcs; @@ -128,6 +123,8 @@ type AllUnitsTreeView: TTreeView; // Node.Data is TUDNode BtnPanel: TPanel; MainPageControl: TPageControl; + UnitsTVCollapseAllMenuItem: TMenuItem; + UnitsTVExpandAllMenuItem: TMenuItem; ProgressBar1: TProgressBar; GroupsTabSheet: TTabSheet; GroupsSplitter: TSplitter; @@ -144,6 +141,7 @@ type SearchCustomFilesComboBox: TComboBox; UnitsSplitter: TSplitter; UnitsTabSheet: TTabSheet; + UnitsTVPopupMenu: TPopupMenu; procedure AllUnitsFilterEditChange(Sender: TObject); procedure AllUnitsFilterEditEnter(Sender: TObject); procedure AllUnitsFilterEditExit(Sender: TObject); @@ -173,6 +171,8 @@ type procedure SearchCustomFilesBrowseButtonClick(Sender: TObject); procedure SearchCustomFilesCheckBoxChange(Sender: TObject); procedure SearchCustomFilesComboBoxChange(Sender: TObject); + procedure UnitsTVCollapseAllMenuItemClick(Sender: TObject); + procedure UnitsTVExpandAllMenuItemClick(Sender: TObject); private FAllUnitsMultiSelect: boolean; FCurrentUnit: TUGUnit; @@ -407,7 +407,6 @@ var TVNode: TTreeNode; UDNode: TUDNode; UGGroup: TUGGroup; - Pkg: TIDEPackage; begin TVNode:=AllUnitsTreeView.GetNodeAt(X,Y); if TVNode=nil then exit; @@ -593,6 +592,34 @@ begin IdleConnected:=true; end; +procedure TUnitDependenciesWindow.UnitsTVCollapseAllMenuItemClick( + Sender: TObject); +var + TV: TTreeView; + i: Integer; +begin + TV:=TTreeView(UnitsTVPopupMenu.PopupComponent); + if not (TV is TTreeView) then exit; + TV.BeginUpdate; + for i:=0 to TV.Items.TopLvlCount-1 do + TV.Items.TopLvlItems[i].Collapse(true); + TV.EndUpdate; +end; + +procedure TUnitDependenciesWindow.UnitsTVExpandAllMenuItemClick(Sender: TObject + ); +var + TV: TTreeView; + i: Integer; +begin + TV:=TTreeView(UnitsTVPopupMenu.PopupComponent); + if not (TV is TTreeView) then exit; + TV.BeginUpdate; + for i:=0 to TV.Items.TopLvlCount-1 do + TV.Items.TopLvlItems[i].Expand(true); + TV.EndUpdate; +end; + procedure TUnitDependenciesWindow.SetIdleConnected(AValue: boolean); begin if FIdleConnected=AValue then Exit; @@ -1143,6 +1170,10 @@ begin SelUnitsSearchPrevSpeedButton.Hint:='Search previous unit of this phrase'; SelUnitsSearchPrevSpeedButton.LoadGlyphFromLazarusResource('arrow_up'); + // popup menu + UnitsTVExpandAllMenuItem.Caption:='Expand all nodes'; + UnitsTVCollapseAllMenuItem.Caption:='Collapse all nodes'; + UpdateUnitsButtons; end;