@@ -349,6 +349,9 @@ class HistoryView : Subview
349
349
350
350
[ SerializeField ] private int statusAhead ;
351
351
[ SerializeField ] private int statusBehind ;
352
+
353
+ [ SerializeField ] private Vector2 treeScroll ;
354
+ [ SerializeField ] private ChangesTree treeChanges ;
352
355
353
356
[ SerializeField ] private CacheUpdateEvent lastCurrentRemoteChangedEvent ;
354
357
[ SerializeField ] private CacheUpdateEvent lastLogChangedEvent ;
@@ -357,6 +360,7 @@ class HistoryView : Subview
357
360
public override void OnEnable ( )
358
361
{
359
362
base . OnEnable ( ) ;
363
+ TreeOnEnable ( ) ;
360
364
AttachHandlers ( Repository ) ;
361
365
362
366
if ( Repository != null )
@@ -380,11 +384,6 @@ public override void OnDataUpdate()
380
384
}
381
385
382
386
public override void OnGUI ( )
383
- {
384
- OnEmbeddedGUI ( ) ;
385
- }
386
-
387
- public void OnEmbeddedGUI ( )
388
387
{
389
388
// History toolbar
390
389
GUILayout . BeginHorizontal ( EditorStyles . toolbar ) ;
@@ -456,6 +455,7 @@ public void OnEmbeddedGUI()
456
455
var requiresRepaint = historyControl . Render ( historyControlRect ,
457
456
entry => {
458
457
selectedEntry = entry ;
458
+ BuildTree ( ) ;
459
459
} ,
460
460
entry => { } ,
461
461
entry => { } ) ;
@@ -490,9 +490,35 @@ public void OnEmbeddedGUI()
490
490
GUILayout . Label ( "Files changed" , EditorStyles . boldLabel ) ;
491
491
GUILayout . Space ( - 5 ) ;
492
492
493
+ rect = GUILayoutUtility . GetLastRect ( ) ;
493
494
GUILayout . BeginHorizontal ( Styles . HistoryFileTreeBoxStyle ) ;
494
495
{
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 ( ) ;
496
522
}
497
523
GUILayout . EndHorizontal ( ) ;
498
524
@@ -698,6 +724,31 @@ private void Fetch()
698
724
. Start ( ) ;
699
725
}
700
726
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
+
701
752
public override bool IsBusy
702
753
{
703
754
get { return false ; }
0 commit comments