From 933d3a352f5984c4a5b66f5ca4437d999aac1351 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sun, 4 Nov 2018 10:46:48 +0100 Subject: [PATCH] proj inspector, group folders on top of the tree --- src/ce_projinspect.pas | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ce_projinspect.pas b/src/ce_projinspect.pas index 10e7a70a..c7bd93f1 100644 --- a/src/ce_projinspect.pas +++ b/src/ce_projinspect.pas @@ -670,7 +670,9 @@ begin itm.SelectedIndex := 2; end else - for i := 0 to fProject.sourcesCount-1 do + // first pass only creates the folders so that they're shown on top + for j := 0 to 1 do + for i := 0 to fProject.sourcesCount-1 do begin fld := ''; rng.init(fProject.sourceRelative(i)); @@ -680,11 +682,12 @@ begin chd := nil; fld := rng.takeUntil(['/','\']).yield; chd := itm.FindNode(fld); - if chd.isNil then + if chd.isNil and ((rng.empty and (j = 1)) or (not rng.empty and (j = 0))) then chd := Tree.Items.AddChild(itm, fld); - itm := chd; + if chd.isNotNil then + itm := chd; // reached fname - if rng.empty then + if rng.empty and (j = 1) then begin itm.Data:= NewStr(fProject.sourceAbsolute(i)); itm.ImageIndex := 2;