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

Removing broadmode code #253

Merged
merged 3 commits into from
Sep 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 2 additions & 24 deletions src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,8 @@ private void HandleRepositoryBranchChangeEvent(string obj)
public override void Refresh()
{
base.Refresh();
var historyView = ((Window)Parent).HistoryTab;

#if ENABLE_BROADMODE
if (historyView.BroadMode)
historyView.Refresh();
else
#endif
RefreshEmbedded();
RefreshEmbedded();
}

public void RefreshEmbedded()
Expand All @@ -131,23 +125,7 @@ public void RefreshEmbedded()

public override void OnGUI()
{
var historyView = ((Window)Parent).HistoryTab;

#if ENABLE_BROADMODE
if (historyView.BroadMode)
historyView.OnGUI();
else
#endif
{
OnEmbeddedGUI();

#if ENABLE_BROADMODE
if (Event.current.type == EventType.Repaint && historyView.EvaluateBroadMode())
{
Refresh();
}
#endif
}
OnEmbeddedGUI();
}

public void OnEmbeddedGUI()
Expand Down
82 changes: 0 additions & 82 deletions src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ class HistoryView : Subview
[NonSerialized] private bool updated = true;
[NonSerialized] private bool useScrollTime;

#if ENABLE_BROADMODE
[SerializeField] private bool broadMode;
#endif
[SerializeField] private Vector2 detailsScroll;
[SerializeField] private Object historyTarget;
[SerializeField] private Vector2 scroll;
Expand Down Expand Up @@ -106,12 +103,6 @@ public override void Refresh()
{
base.Refresh();
RefreshLog();
#if ENABLE_BROADMODE
if (broadMode)
{
((Window)Parent).BranchesTab.RefreshEmbedded();
}
#endif
}

public override void OnSelectionChange()
Expand All @@ -131,44 +122,8 @@ public override void OnGUI()
return;
}

#if ENABLE_BROADMODE
if (broadMode)
OnBroadGUI();
else
#endif
OnEmbeddedGUI();

#if ENABLE_BROADMODE
if (Event.current.type == EventType.Repaint && EvaluateBroadMode())
{
Refresh();
}
#endif
}

#if ENABLE_BROADMODE
public void OnBroadGUI()
{
GUILayout.BeginHorizontal();
{
GUILayout.BeginVertical(
GUILayout.MinWidth(Styles.BroadModeBranchesMinWidth),
GUILayout.MaxWidth(Mathf.Max(Styles.BroadModeBranchesMinWidth, Position.width * Styles.BroadModeBranchesRatio))
);
{
((Window)Parent).BranchesTab.OnEmbeddedGUI();
}
GUILayout.EndVertical();
GUILayout.BeginVertical();
{
OnEmbeddedGUI();
}
GUILayout.EndVertical();
}
GUILayout.EndHorizontal();
}
#endif

private void AttachHandlers(IRepository repository)
{
if (repository == null)
Expand Down Expand Up @@ -790,43 +745,6 @@ private void DrawTimelineRectAroundIconRect(Rect parentRect, Rect iconRect)
EditorGUI.DrawRect(bottomTimelineRect, timelineBarColor);
}

#if ENABLE_BROADMODE
private bool EvaluateBroadMode()
{
var past = broadMode;

// Flip when the limits are breached
if (Position.width > Styles.BroadModeLimit)
{
broadMode = true;
}
else if (Position.width < Styles.NarrowModeLimit)
{
broadMode = false;
}

// Show the layout notification while scaling
var window = (Window)Parent;
var scaled = Position.width != lastWidth;
lastWidth = Position.width;

if (scaled)
{
window.ShowNotification(new GUIContent(Styles.FolderIcon), Styles.ModeNotificationDelay);
}

// Return whether we flipped
return broadMode != past;
}
#endif

#if ENABLE_BROADMODE
public bool BroadMode
{
get { return broadMode; }
}
#endif

private float EntryHeight
{
get { return Styles.HistoryEntryHeight + Styles.HistoryEntryPadding; }
Expand Down