@@ -349,6 +349,9 @@ class HistoryView : Subview
349349
350350 [ SerializeField ] private int statusAhead ;
351351 [ SerializeField ] private int statusBehind ;
352+
353+ [ SerializeField ] private Vector2 treeScroll ;
354+ [ SerializeField ] private ChangesTree treeChanges ;
352355
353356 [ SerializeField ] private CacheUpdateEvent lastCurrentRemoteChangedEvent ;
354357 [ SerializeField ] private CacheUpdateEvent lastLogChangedEvent ;
@@ -357,6 +360,7 @@ class HistoryView : Subview
357360 public override void OnEnable ( )
358361 {
359362 base . OnEnable ( ) ;
363+ TreeOnEnable ( ) ;
360364 AttachHandlers ( Repository ) ;
361365
362366 if ( Repository != null )
@@ -380,11 +384,6 @@ public override void OnDataUpdate()
380384 }
381385
382386 public override void OnGUI ( )
383- {
384- OnEmbeddedGUI ( ) ;
385- }
386-
387- public void OnEmbeddedGUI ( )
388387 {
389388 // History toolbar
390389 GUILayout . BeginHorizontal ( EditorStyles . toolbar ) ;
@@ -456,6 +455,7 @@ public void OnEmbeddedGUI()
456455 var requiresRepaint = historyControl . Render ( historyControlRect ,
457456 entry => {
458457 selectedEntry = entry ;
458+ BuildTree ( ) ;
459459 } ,
460460 entry => { } ,
461461 entry => { } ) ;
@@ -490,9 +490,35 @@ public void OnEmbeddedGUI()
490490 GUILayout . Label ( "Files changed" , EditorStyles . boldLabel ) ;
491491 GUILayout . Space ( - 5 ) ;
492492
493+ rect = GUILayoutUtility . GetLastRect ( ) ;
493494 GUILayout . BeginHorizontal ( Styles . HistoryFileTreeBoxStyle ) ;
494495 {
495- //changesetTree.OnGUI();
496+ treeScroll = GUILayout . BeginScrollView ( treeScroll ) ;
497+ {
498+ var treeControlRect = new Rect ( 0f , 0f , Position . width , Position . height - rect . height + Styles . CommitAreaPadding ) ;
499+ var treeRect = Rect . zero ;
500+ if ( treeChanges != null )
501+ {
502+ treeChanges . FolderStyle = Styles . Foldout ;
503+ treeChanges . TreeNodeStyle = Styles . TreeNode ;
504+ treeChanges . ActiveTreeNodeStyle = Styles . ActiveTreeNode ;
505+ treeChanges . FocusedTreeNodeStyle = Styles . FocusedTreeNode ;
506+ treeChanges . FocusedActiveTreeNodeStyle = Styles . FocusedActiveTreeNode ;
507+
508+ treeRect = treeChanges . Render ( treeControlRect , treeControlRect , treeScroll ,
509+ node => { } ,
510+ node => {
511+ } ,
512+ node => {
513+ } ) ;
514+
515+ if ( treeChanges . RequiresRepaint )
516+ Redraw ( ) ;
517+ }
518+
519+ GUILayout . Space ( treeRect . y - treeControlRect . y ) ;
520+ }
521+ GUILayout . EndScrollView ( ) ;
496522 }
497523 GUILayout . EndHorizontal ( ) ;
498524
@@ -698,6 +724,31 @@ private void Fetch()
698724 . Start ( ) ;
699725 }
700726
727+ private void BuildTree ( )
728+ {
729+ if ( treeChanges == null )
730+ {
731+ treeChanges = new ChangesTree ( ) ;
732+ treeChanges . Title = "Changes" ;
733+ treeChanges . DisplayRootNode = false ;
734+ treeChanges . PathSeparator = Environment . FileSystem . DirectorySeparatorChar . ToString ( ) ;
735+
736+ TreeOnEnable ( ) ;
737+ }
738+
739+ treeChanges . Load ( selectedEntry . changes . Select ( entry => new GitStatusEntryTreeData ( entry ) ) ) ;
740+ Redraw ( ) ;
741+ }
742+
743+ private void TreeOnEnable ( )
744+ {
745+ if ( treeChanges != null )
746+ {
747+ treeChanges . OnEnable ( ) ;
748+ treeChanges . UpdateIcons ( Styles . FolderIcon ) ;
749+ }
750+ }
751+
701752 public override bool IsBusy
702753 {
703754 get { return false ; }
0 commit comments