IDE: code explorer: clear when no source editor shown, bug #29050

git-svn-id: trunk@50559 -
This commit is contained in:
mattias 2015-12-02 10:51:02 +00:00
parent 9f61b39bd4
commit 26910afd1e
3 changed files with 45 additions and 19 deletions

View File

@ -198,6 +198,8 @@ type
ImgIDUnit: Integer;
ImgIDVariable: Integer;
ImgIDHint: Integer;
procedure ClearCodeTreeView;
procedure ClearDirectivesTreeView;
function GetCodeFilter: string;
function GetCurrentPage: TCodeExplorerPage;
function GetDirectivesFilter: string;
@ -594,7 +596,19 @@ begin
if not (cevCheckOnIdle in FFlags) then exit;
if (Screen.ActiveCustomForm<>nil)
and (fsModal in Screen.ActiveCustomForm.FormState) then
begin
// do not update while a modal form is shown, except for clear
if SourceEditorManagerIntf=nil then exit;
if SourceEditorManagerIntf.SourceEditorCount=0 then
begin
Exclude(FFlags,cevCheckOnIdle);
FLastCodeValid:=false;
ClearCodeTreeView;
FDirectivesFilename:='';
ClearDirectivesTreeView;
end;
exit;
end;
if not IsVisible then exit;
Exclude(FFlags,cevCheckOnIdle);
case CurrentPage of
@ -807,6 +821,25 @@ begin
Result:=CodeFilterEdit.Text;
end;
procedure TCodeExplorerView.ClearCodeTreeView;
var
f: TCEObserverCategory;
c: TCodeExplorerCategory;
begin
for c:=low(TCodeExplorerCategory) to high(TCodeExplorerCategory) do
fCategoryNodes[c]:=nil;
fObserverNode:=nil;
for f:=low(TCEObserverCategory) to high(TCEObserverCategory) do
fObserverCatNodes[f]:=nil;
fSurroundingNode:=nil;
CodeTreeview.Items.Clear;
end;
procedure TCodeExplorerView.ClearDirectivesTreeView;
begin
DirectivesTreeView.Items.Clear;
end;
function TCodeExplorerView.GetCurrentPage: TCodeExplorerPage;
begin
if MainNotebook.ActivePage=CodePage then
@ -2035,8 +2068,6 @@ procedure TCodeExplorerView.RefreshCode(OnlyVisible: boolean);
var
OldExpanded: TTreeNodeExpandedState;
ACodeTool: TCodeTool;
c: TCodeExplorerCategory;
f: TCEObserverCategory;
SrcEdit: TSourceEditorInterface;
Filename: String;
Code: TCodeBuffer;
@ -2142,14 +2173,8 @@ begin
if not CurFollowNode then
OldExpanded:=TTreeNodeExpandedState.Create(CodeTreeView);
for c:=low(TCodeExplorerCategory) to high(TCodeExplorerCategory) do
fCategoryNodes[c]:=nil;
fObserverNode:=nil;
for f:=low(TCEObserverCategory) to high(TCEObserverCategory) do
fObserverCatNodes[f]:=nil;
fSurroundingNode:=nil;
ClearCodeTreeView;
CodeTreeview.Items.Clear;
if (ACodeTool<>nil) and (ACodeTool.Tree<>nil) and (ACodeTool.Tree.Root<>nil)
then begin
CreateIdentifierNodes(ACodeTool,ACodeTool.Tree.Root,nil,nil,true);
@ -2251,12 +2276,10 @@ begin
DirectivesTreeView.BeginUpdate;
OldExpanded:=TTreeNodeExpandedState.Create(DirectivesTreeView);
if (ADirectivesTool=nil) or (ADirectivesTool.Tree=nil)
or (ADirectivesTool.Tree.Root=nil) then
ClearDirectivesTreeView;
if (ADirectivesTool<>nil) and (ADirectivesTool.Tree<>nil)
and (ADirectivesTool.Tree.Root<>nil) then
begin
DirectivesTreeView.Items.Clear;
end else begin
DirectivesTreeView.Items.Clear;
CreateDirectiveNodes(ADirectivesTool,ADirectivesTool.Tree.Root,nil,nil,true);
end;

View File

@ -10661,8 +10661,8 @@ end;
procedure TMainIDE.OnSrcNotebookCurCodeBufferChanged(Sender: TObject);
begin
if SourceEditorManager.SourceEditorCount = 0 then Exit;
if CodeExplorerView<>nil then CodeExplorerView.CurrentCodeBufferChanged;
if CodeExplorerView<>nil then
CodeExplorerView.CurrentCodeBufferChanged;
end;
procedure TMainIDE.OnSrcNotebookShowHintForSource(SrcEdit: TSourceEditor;

View File

@ -7284,9 +7284,12 @@ var
begin
// Todo: Move to manager, include window changes
SrcEdit:=GetActiveSE;
if SrcEdit = nil then Exit;
if FLastCodeBuffer=SrcEdit.CodeBuffer then exit;
FLastCodeBuffer:=SrcEdit.CodeBuffer;
if SrcEdit <> nil then
begin
if FLastCodeBuffer=SrcEdit.CodeBuffer then exit;
FLastCodeBuffer:=SrcEdit.CodeBuffer;
end else if FLastCodeBuffer=nil then
exit;
if assigned(Manager) and Assigned(Manager.OnCurrentCodeBufferChanged) then
Manager.OnCurrentCodeBufferChanged(Self);
end;