Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 8b49a44

Browse files
Merge pull request #523 from github-for-unity/enhancements/history-list-view
Refactoring history display into HistoryControl
2 parents 82b0489 + 55b4a5d commit 8b49a44

File tree

3 files changed

+384
-347
lines changed

3 files changed

+384
-347
lines changed

src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class Styles
6464
headerDescriptionStyle,
6565
historyToolbarButtonStyle,
6666
historyLockStyle,
67+
historyEntrySummaryStyle,
6768
historyEntryDetailsStyle,
6869
historyEntryDetailsRightStyle,
6970
historyFileTreeBoxStyle,
@@ -396,6 +397,20 @@ public static GUIStyle HistoryLockStyle
396397
return historyLockStyle;
397398
}
398399
}
400+
public static GUIStyle HistoryEntrySummaryStyle
401+
{
402+
get
403+
{
404+
if (historyEntrySummaryStyle == null)
405+
{
406+
historyEntrySummaryStyle = new GUIStyle(Label);
407+
historyEntrySummaryStyle.name = "HistoryEntrySummaryStyle";
408+
409+
historyEntrySummaryStyle.contentOffset = new Vector2(BaseSpacing * 2, 0);
410+
}
411+
return historyEntrySummaryStyle;
412+
}
413+
}
399414

400415
public static GUIStyle HistoryEntryDetailsStyle
401416
{
@@ -412,6 +427,8 @@ public static GUIStyle HistoryEntryDetailsStyle
412427
historyEntryDetailsStyle.onNormal.textColor = Label.onNormal.textColor;
413428
historyEntryDetailsStyle.onFocused.background = Label.onFocused.background;
414429
historyEntryDetailsStyle.onFocused.textColor = Label.onFocused.textColor;
430+
431+
historyEntryDetailsStyle.contentOffset = new Vector2(BaseSpacing * 2, 0);
415432
}
416433
return historyEntryDetailsStyle;
417434
}

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ChangesView.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,17 @@ class ChangesView : Subview
2525
[SerializeField] private string commitBody = "";
2626
[SerializeField] private string commitMessage = "";
2727
[SerializeField] private string currentBranch = "[unknown]";
28-
[SerializeField] private Vector2 scroll;
29-
[SerializeField] private CacheUpdateEvent lastCurrentBranchChangedEvent;
30-
[SerializeField] private CacheUpdateEvent lastStatusEntriesChangedEvent;
28+
29+
[SerializeField] private Vector2 treeScroll;
3130
[SerializeField] private ChangesTree treeChanges;
31+
3232
[SerializeField] private List<GitStatusEntry> gitStatusEntries;
33+
3334
[SerializeField] private string changedFilesText = NoChangedFilesLabel;
3435

36+
[SerializeField] private CacheUpdateEvent lastCurrentBranchChangedEvent;
37+
[SerializeField] private CacheUpdateEvent lastStatusEntriesChangedEvent;
38+
3539
public override void OnEnable()
3640
{
3741
base.OnEnable();
@@ -81,7 +85,7 @@ public override void OnGUI()
8185
GUILayout.BeginHorizontal();
8286
GUILayout.BeginVertical(Styles.CommitFileAreaStyle);
8387
{
84-
scroll = GUILayout.BeginScrollView(scroll);
88+
treeScroll = GUILayout.BeginScrollView(treeScroll);
8589
{
8690
OnTreeGUI(new Rect(0f, 0f, Position.width, Position.height - rect.height + Styles.CommitAreaPadding));
8791
}
@@ -110,7 +114,7 @@ private void OnTreeGUI(Rect rect)
110114
treeChanges.FocusedTreeNodeStyle = Styles.FocusedTreeNode;
111115
treeChanges.FocusedActiveTreeNodeStyle = Styles.FocusedActiveTreeNode;
112116

113-
var treeRenderRect = treeChanges.Render(rect, scroll,
117+
var treeRenderRect = treeChanges.Render(rect, treeScroll,
114118
node => { },
115119
node => { },
116120
node => { });

0 commit comments

Comments
 (0)