From b6c3f2f65d224a0dd1ed178e4dfc25e5d893125c Mon Sep 17 00:00:00 2001 From: paul Date: Fri, 17 Apr 2009 01:29:27 +0000 Subject: [PATCH] ide: improve figures in the code explorer tree: - set images - don't show empty published sections if no published keyword is present - fix typo git-svn-id: trunk@19462 - --- ide/codeexplorer.lfm | 32 ++++++++++++++++---------------- ide/codeexplorer.lrs | 30 +++++++++++++++--------------- ide/codeexplorer.pas | 44 +++++++++++++++++++++++++------------------- 3 files changed, 56 insertions(+), 50 deletions(-) diff --git a/ide/codeexplorer.lfm b/ide/codeexplorer.lfm index b0a8722e90..4c8d6ef816 100644 --- a/ide/codeexplorer.lfm +++ b/ide/codeexplorer.lfm @@ -24,14 +24,14 @@ object CodeExplorerView: TCodeExplorerView TabOrder = 0 object CodePage: TPage Caption = 'CodePage' - ClientWidth = 209 - ClientHeight = 476 + ClientWidth = 207 + ClientHeight = 489 object CodeTreeview: TTreeView AnchorSideTop.Side = asrBottom Left = 0 - Height = 450 + Height = 463 Top = 26 - Width = 209 + Width = 207 Align = alClient BorderSpacing.Top = 1 HideSelection = False @@ -49,14 +49,14 @@ object CodeExplorerView: TCodeExplorerView Left = 0 Height = 25 Top = 0 - Width = 209 + Width = 207 Align = alTop BevelOuter = bvNone ClientHeight = 25 - ClientWidth = 209 + ClientWidth = 207 TabOrder = 1 object OptionsSpeedButton: TSpeedButton - Left = 182 + Left = 180 Height = 22 Hint = 'Options for CodeExplorer' Top = 1 @@ -69,7 +69,7 @@ object CodeExplorerView: TCodeExplorerView ParentShowHint = False end object RefreshSpeedButton: TSpeedButton - Left = 134 + Left = 132 Height = 22 Hint = 'Refresh CodeExplorer' Top = 1 @@ -82,7 +82,7 @@ object CodeExplorerView: TCodeExplorerView ParentShowHint = False end object ModeSpeedButton: TSpeedButton - Left = 158 + Left = 156 Height = 22 Top = 1 Width = 23 @@ -101,7 +101,7 @@ object CodeExplorerView: TCodeExplorerView Left = 0 Height = 23 Top = 0 - Width = 132 + Width = 130 Anchors = [akTop, akLeft, akRight] AutoSelect = True OnChange = CodeFilterEditChange @@ -112,8 +112,8 @@ object CodeExplorerView: TCodeExplorerView end object DirectivesPage: TPage Caption = 'DirectivesPage' - ClientWidth = 209 - ClientHeight = 476 + ClientWidth = 207 + ClientHeight = 489 object DirectivesFilterEdit: TEdit AnchorSideLeft.Control = DirectivesPage AnchorSideTop.Control = DirectivesPage @@ -122,7 +122,7 @@ object CodeExplorerView: TCodeExplorerView Left = 0 Height = 23 Top = 0 - Width = 209 + Width = 207 Anchors = [akTop, akLeft, akRight] OnChange = DirectivesFilterEditChange TabOrder = 0 @@ -132,13 +132,13 @@ object CodeExplorerView: TCodeExplorerView AnchorSideTop.Control = DirectivesFilterEdit AnchorSideTop.Side = asrBottom Left = 0 - Height = 452 + Height = 465 Top = 24 - Width = 209 + Width = 207 Align = alBottom Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Top = 1 - DefaultItemHeight = 19 + DefaultItemHeight = 15 PopupMenu = TreePopupmenu ReadOnly = True TabOrder = 1 diff --git a/ide/codeexplorer.lrs b/ide/codeexplorer.lrs index 800c69a7d7..f228e9966a 100644 --- a/ide/codeexplorer.lrs +++ b/ide/codeexplorer.lrs @@ -10,45 +10,45 @@ LazarusResources.Add('TCodeExplorerView','FORMDATA',[ +#2#3'Top'#2#2#5'Width'#3#215#0#5'Align'#7#8'alClient'#17'BorderSpacing.Top'#2 +#2#13'OnPageChanged'#7#23'MainNotebookPageChanged'#9'PageIndex'#2#1#8'TabOrd' +'er'#2#0#0#5'TPage'#8'CodePage'#7'Caption'#6#8'CodePage'#11'ClientWidth'#3 - +#209#0#12'ClientHeight'#3#220#1#0#9'TTreeView'#12'CodeTreeview'#18'AnchorSid' - +'eTop.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#3#194#1#3'Top'#2#26#5'Width' - +#3#209#0#5'Align'#7#8'alClient'#17'BorderSpacing.Top'#2#1#13'HideSelection'#8 + +#207#0#12'ClientHeight'#3#233#1#0#9'TTreeView'#12'CodeTreeview'#18'AnchorSid' + +'eTop.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#3#207#1#3'Top'#2#26#5'Width' + +#3#207#0#5'Align'#7#8'alClient'#17'BorderSpacing.Top'#2#1#13'HideSelection'#8 +#6'Images'#7#10'Imagelist1'#9'PopupMenu'#7#13'TreePopupmenu'#8'ReadOnly'#9#16 +'RightClickSelect'#9#8'TabOrder'#2#0#10'OnDblClick'#7#20'CodeTreeviewDblClic' +'k'#10'OnDeletion'#7#20'CodeTreeviewDeletion'#7'OnKeyUp'#7#17'CodeTreeviewKe' +'yUp'#7'Options'#11#17'tvoAutoItemHeight'#21'tvoKeepCollapsedNodes'#11'tvoRe' +'adOnly'#19'tvoRightClickSelect'#14'tvoShowButtons'#12'tvoShowLines'#11'tvoS' +'howRoot'#11'tvoToolTips'#22'tvoNoDoubleClickExpand'#0#0#0#6'TPanel'#23'Code' - +'TreeviewButtonPanel'#4'Left'#2#0#6'Height'#2#25#3'Top'#2#0#5'Width'#3#209#0 + +'TreeviewButtonPanel'#4'Left'#2#0#6'Height'#2#25#3'Top'#2#0#5'Width'#3#207#0 +#5'Align'#7#5'alTop'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2#25#11'Cli' - +'entWidth'#3#209#0#8'TabOrder'#2#1#0#12'TSpeedButton'#18'OptionsSpeedButton' - +#4'Left'#3#182#0#6'Height'#2#22#4'Hint'#6#24'Options for CodeExplorer'#3'Top' + +'entWidth'#3#207#0#8'TabOrder'#2#1#0#12'TSpeedButton'#18'OptionsSpeedButton' + +#4'Left'#3#180#0#6'Height'#2#22#4'Hint'#6#24'Options for CodeExplorer'#3'Top' +#2#1#5'Width'#2#23#7'Anchors'#11#5'akTop'#7'akRight'#0#5'Color'#7#9'clBtnFac' +'e'#9'NumGlyphs'#2#0#7'OnClick'#7#23'OptionsSpeedButtonClick'#8'ShowHint'#9 +#14'ParentShowHint'#8#0#0#12'TSpeedButton'#18'RefreshSpeedButton'#4'Left'#3 - +#134#0#6'Height'#2#22#4'Hint'#6#20'Refresh CodeExplorer'#3'Top'#2#1#5'Width' + +#132#0#6'Height'#2#22#4'Hint'#6#20'Refresh CodeExplorer'#3'Top'#2#1#5'Width' +#2#23#7'Anchors'#11#5'akTop'#7'akRight'#0#5'Color'#7#9'clBtnFace'#9'NumGlyph' +'s'#2#0#7'OnClick'#7#23'RefreshSpeedButtonClick'#8'ShowHint'#9#14'ParentShow' - +'Hint'#8#0#0#12'TSpeedButton'#15'ModeSpeedButton'#4'Left'#3#158#0#6'Height'#2 + +'Hint'#8#0#0#12'TSpeedButton'#15'ModeSpeedButton'#4'Left'#3#156#0#6'Height'#2 +#22#3'Top'#2#1#5'Width'#2#23#7'Anchors'#11#5'akTop'#7'akRight'#0#5'Color'#7#9 +'clBtnFace'#9'NumGlyphs'#2#0#7'OnClick'#7#20'ModeSpeedButtonClick'#8'ShowHin' +'t'#9#14'ParentShowHint'#8#0#0#5'TEdit'#14'CodeFilterEdit'#22'AnchorSideLeft' +'.Control'#7#8'CodePage'#21'AnchorSideTop.Control'#7#8'CodePage'#23'AnchorSi' +'deRight.Control'#7#8'CodePage'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Le' - +'ft'#2#0#6'Height'#2#23#3'Top'#2#0#5'Width'#3#132#0#7'Anchors'#11#5'akTop'#6 + +'ft'#2#0#6'Height'#2#23#3'Top'#2#0#5'Width'#3#130#0#7'Anchors'#11#5'akTop'#6 +'akLeft'#7'akRight'#0#10'AutoSelect'#9#8'OnChange'#7#20'CodeFilterEditChange' +#8'TabOrder'#2#0#4'Text'#6#14'CodeFilterEdit'#0#0#0#0#5'TPage'#14'Directives' - +'Page'#7'Caption'#6#14'DirectivesPage'#11'ClientWidth'#3#209#0#12'ClientHeig' - +'ht'#3#220#1#0#5'TEdit'#20'DirectivesFilterEdit'#22'AnchorSideLeft.Control'#7 + +'Page'#7'Caption'#6#14'DirectivesPage'#11'ClientWidth'#3#207#0#12'ClientHeig' + +'ht'#3#233#1#0#5'TEdit'#20'DirectivesFilterEdit'#22'AnchorSideLeft.Control'#7 +#14'DirectivesPage'#21'AnchorSideTop.Control'#7#14'DirectivesPage'#23'Anchor' +'SideRight.Control'#7#14'DirectivesPage'#20'AnchorSideRight.Side'#7#9'asrBot' - +'tom'#4'Left'#2#0#6'Height'#2#23#3'Top'#2#0#5'Width'#3#209#0#7'Anchors'#11#5 + +'tom'#4'Left'#2#0#6'Height'#2#23#3'Top'#2#0#5'Width'#3#207#0#7'Anchors'#11#5 +'akTop'#6'akLeft'#7'akRight'#0#8'OnChange'#7#26'DirectivesFilterEditChange'#8 +'TabOrder'#2#0#4'Text'#6#20'DirectivesFilterEdit'#0#0#9'TTreeView'#18'Direct' +'ivesTreeView'#21'AnchorSideTop.Control'#7#20'DirectivesFilterEdit'#18'Ancho' - +'rSideTop.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#3#196#1#3'Top'#2#24#5'W' - +'idth'#3#209#0#5'Align'#7#8'alBottom'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akR' - +'ight'#8'akBottom'#0#17'BorderSpacing.Top'#2#1#17'DefaultItemHeight'#2#19#9 + +'rSideTop.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#3#209#1#3'Top'#2#24#5'W' + +'idth'#3#207#0#5'Align'#7#8'alBottom'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akR' + +'ight'#8'akBottom'#0#17'BorderSpacing.Top'#2#1#17'DefaultItemHeight'#2#15#9 +'PopupMenu'#7#13'TreePopupmenu'#8'ReadOnly'#9#8'TabOrder'#2#1#10'OnDblClick' +#7#26'DirectivesTreeViewDblClick'#10'OnDeletion'#7#26'DirectivesTreeViewDele' +'tion'#7'OnKeyUp'#7#23'DirectivesTreeViewKeyUp'#7'Options'#11#17'tvoAutoItem' diff --git a/ide/codeexplorer.pas b/ide/codeexplorer.pas index 70850f8b64..7d994b7879 100644 --- a/ide/codeexplorer.pas +++ b/ide/codeexplorer.pas @@ -135,7 +135,7 @@ type FUpdateCount: integer; ImgIDClass: Integer; ImgIDConst: Integer; - ImgIDConstSection: Integer; + ImgIDSection: Integer; ImgIDDefault: integer; ImgIDFinalization: Integer; ImgIDImplementation: Integer; @@ -146,10 +146,9 @@ type ImgIDProgram: Integer; ImgIDProperty: Integer; ImgIDType: Integer; - ImgIDTypeSection: Integer; ImgIDUnit: Integer; ImgIDVariable: Integer; - ImgIDVarSection: Integer; + ImgIDHint: Integer; function GetCodeFilter: string; function GetCurrentPage: TCodeExplorerPage; function GetDirectivesFilter: string; @@ -365,9 +364,8 @@ begin ImgIDFunction := Imagelist1.AddLazarusResource('ce_function'); ImgIDProperty := Imagelist1.AddLazarusResource('ce_property'); // sections - ImgIDTypeSection := Imagelist1.AddLazarusResource('ce_section'); - ImgIDVarSection := Imagelist1.AddLazarusResource('ce_section'); - ImgIDConstSection := Imagelist1.AddLazarusResource('ce_section'); + ImgIDSection := Imagelist1.AddLazarusResource('ce_section'); + ImgIDHint := Imagelist1.AddLazarusResource('state_hint'); // assign the root TMenuItem to the registered menu root. // This will automatically create all registered items @@ -561,7 +559,7 @@ begin ctnImplementation: Result:=ImgIDImplementation; ctnInitialization: Result:=ImgIDInitialization; ctnFinalization: Result:=ImgIDFinalization; - ctnTypeSection: Result:=ImgIDTypeSection; + ctnTypeSection: Result:=ImgIDSection; ctnTypeDefinition: begin if (CodeNode.FirstChild <> nil) and (CodeNode.FirstChild.Desc = ctnClass) then @@ -569,9 +567,9 @@ begin else Result := ImgIDType; end; - ctnVarSection: Result:=ImgIDVarSection; + ctnVarSection: Result:=ImgIDSection; ctnVarDefinition: Result:=ImgIDVariable; - ctnConstSection,ctnResStrSection: Result:=ImgIDConstSection; + ctnConstSection,ctnResStrSection: Result:=ImgIDSection; ctnConstDefinition: Result:=ImgIDConst; ctnClass: Result:=ImgIDClass; ctnProcedure: if Tool.NodeIsFunction(CodeNode) then @@ -588,13 +586,13 @@ function TCodeExplorerView.GetDirectiveNodeImage(CodeNode: TCodeTreeNode ): integer; begin case CodeNode.SubDesc of - cdnsInclude: Result:=ImgIDVarSection; + cdnsInclude: Result:=ImgIDSection; else case CodeNode.Desc of - cdnIf: Result:=ImgIDTypeSection; - cdnElseIf: Result:=ImgIDTypeSection; - cdnElse: Result:=ImgIDTypeSection; - cdnEnd: Result:=ImgIDTypeSection; + cdnIf: Result:=ImgIDSection; + cdnElseIf: Result:=ImgIDSection; + cdnElse: Result:=ImgIDSection; + cdnEnd: Result:=ImgIDSection; cdnDefine: Result:=ImgIDConst; else Result:=ImgIDDefault; @@ -888,7 +886,7 @@ begin AddCodeNode(cefcLongProcs,ProcNode); end; end; - if (cefcLongProcs in Figures) + if (cefcEmptyProcs in Figures) and (CodeNode.Parent.Desc=ctnProcedure) then begin Tool.MoveCursorToCleanPos(CodeNode.StartPos); Tool.ReadNextAtom;// read begin @@ -966,8 +964,10 @@ begin if (cefcUnsortedClassMembers in Figures) then CheckUnsortedClassMembers(CodeNode); - if (cefcEmptyClassSections in Figures) - and (CodeNode.FirstChild=nil) then begin + if (cefcEmptyClassSections in Figures) and + (CodeNode.FirstChild=nil) and + ((CodeNode.Desc <> ctnClassPublished) or (CodeNode.EndPos - CodeNode.StartPos > 7)) then + begin // empty class section AddCodeNode(cefcEmptyClassSections,CodeNode); end; @@ -993,13 +993,17 @@ function TCodeExplorerView.CreateFigureNode(Tool: TCodeTool; var Data: TViewNodeData; begin - if fFigureCatNodes[f]=nil then begin - if fFigureNode=nil then begin + if fFigureCatNodes[f] = nil then + begin + if fFigureNode = nil then + begin fFigureNode:=CodeTreeview.Items.Add(nil, lisCEFigures); Data:=TViewNodeData.Create(Tool.Tree.Root); Data.Desc:=ctnNone; Data.StartPos:=Tool.SrcLen; fFigureNode.Data:=Data; + fFigureNode.ImageIndex:=ImgIDSection; + fFigureNode.SelectedIndex:=ImgIDSection; end; fFigureCatNodes[f]:=CodeTreeview.Items.AddChild(fFigureNode, CodeExplorerLocalizedString(f)); @@ -1007,6 +1011,8 @@ begin Data.Desc:=ctnNone; Data.StartPos:=Tool.SrcLen; fFigureCatNodes[f].Data:=Data; + fFigureCatNodes[f].ImageIndex:=ImgIDHint; + fFigureCatNodes[f].SelectedIndex:=ImgIDHint; fFigureNode.Expanded:=true; end; Result:=fFigureCatNodes[f];