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

Commit 4255855

Browse files
Merge pull request #253 from github-for-unity/fixes/isolate-broadmode
Removing broadmode code
2 parents 2af9b0c + 93da039 commit 4255855

File tree

2 files changed

+2
-106
lines changed

2 files changed

+2
-106
lines changed

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

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,8 @@ private void HandleRepositoryBranchChangeEvent(string obj)
110110
public override void Refresh()
111111
{
112112
base.Refresh();
113-
var historyView = ((Window)Parent).HistoryTab;
114113

115-
#if ENABLE_BROADMODE
116-
if (historyView.BroadMode)
117-
historyView.Refresh();
118-
else
119-
#endif
120-
RefreshEmbedded();
114+
RefreshEmbedded();
121115
}
122116

123117
public void RefreshEmbedded()
@@ -131,23 +125,7 @@ public void RefreshEmbedded()
131125

132126
public override void OnGUI()
133127
{
134-
var historyView = ((Window)Parent).HistoryTab;
135-
136-
#if ENABLE_BROADMODE
137-
if (historyView.BroadMode)
138-
historyView.OnGUI();
139-
else
140-
#endif
141-
{
142-
OnEmbeddedGUI();
143-
144-
#if ENABLE_BROADMODE
145-
if (Event.current.type == EventType.Repaint && historyView.EvaluateBroadMode())
146-
{
147-
Refresh();
148-
}
149-
#endif
150-
}
128+
OnEmbeddedGUI();
151129
}
152130

153131
public void OnEmbeddedGUI()

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

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ class HistoryView : Subview
4848
[NonSerialized] private bool updated = true;
4949
[NonSerialized] private bool useScrollTime;
5050

51-
#if ENABLE_BROADMODE
52-
[SerializeField] private bool broadMode;
53-
#endif
5451
[SerializeField] private Vector2 detailsScroll;
5552
[SerializeField] private Object historyTarget;
5653
[SerializeField] private Vector2 scroll;
@@ -106,12 +103,6 @@ public override void Refresh()
106103
{
107104
base.Refresh();
108105
RefreshLog();
109-
#if ENABLE_BROADMODE
110-
if (broadMode)
111-
{
112-
((Window)Parent).BranchesTab.RefreshEmbedded();
113-
}
114-
#endif
115106
}
116107

117108
public override void OnSelectionChange()
@@ -131,44 +122,8 @@ public override void OnGUI()
131122
return;
132123
}
133124

134-
#if ENABLE_BROADMODE
135-
if (broadMode)
136-
OnBroadGUI();
137-
else
138-
#endif
139125
OnEmbeddedGUI();
140-
141-
#if ENABLE_BROADMODE
142-
if (Event.current.type == EventType.Repaint && EvaluateBroadMode())
143-
{
144-
Refresh();
145-
}
146-
#endif
147126
}
148-
149-
#if ENABLE_BROADMODE
150-
public void OnBroadGUI()
151-
{
152-
GUILayout.BeginHorizontal();
153-
{
154-
GUILayout.BeginVertical(
155-
GUILayout.MinWidth(Styles.BroadModeBranchesMinWidth),
156-
GUILayout.MaxWidth(Mathf.Max(Styles.BroadModeBranchesMinWidth, Position.width * Styles.BroadModeBranchesRatio))
157-
);
158-
{
159-
((Window)Parent).BranchesTab.OnEmbeddedGUI();
160-
}
161-
GUILayout.EndVertical();
162-
GUILayout.BeginVertical();
163-
{
164-
OnEmbeddedGUI();
165-
}
166-
GUILayout.EndVertical();
167-
}
168-
GUILayout.EndHorizontal();
169-
}
170-
#endif
171-
172127
private void AttachHandlers(IRepository repository)
173128
{
174129
if (repository == null)
@@ -790,43 +745,6 @@ private void DrawTimelineRectAroundIconRect(Rect parentRect, Rect iconRect)
790745
EditorGUI.DrawRect(bottomTimelineRect, timelineBarColor);
791746
}
792747

793-
#if ENABLE_BROADMODE
794-
private bool EvaluateBroadMode()
795-
{
796-
var past = broadMode;
797-
798-
// Flip when the limits are breached
799-
if (Position.width > Styles.BroadModeLimit)
800-
{
801-
broadMode = true;
802-
}
803-
else if (Position.width < Styles.NarrowModeLimit)
804-
{
805-
broadMode = false;
806-
}
807-
808-
// Show the layout notification while scaling
809-
var window = (Window)Parent;
810-
var scaled = Position.width != lastWidth;
811-
lastWidth = Position.width;
812-
813-
if (scaled)
814-
{
815-
window.ShowNotification(new GUIContent(Styles.FolderIcon), Styles.ModeNotificationDelay);
816-
}
817-
818-
// Return whether we flipped
819-
return broadMode != past;
820-
}
821-
#endif
822-
823-
#if ENABLE_BROADMODE
824-
public bool BroadMode
825-
{
826-
get { return broadMode; }
827-
}
828-
#endif
829-
830748
private float EntryHeight
831749
{
832750
get { return Styles.HistoryEntryHeight + Styles.HistoryEntryPadding; }

0 commit comments

Comments
 (0)