public void ClipRangeGUI(ref float startFrame, ref float stopFrame, out bool changedStart, out bool changedStop)
{
changedStart = false;
changedStop = false;
this.m_DraggingRangeBegin = false;
this.m_DraggingRangeEnd = false;
bool disabled = ((((startFrame + 0.01f) < (this.m_Clip.startTime * this.m_Clip.frameRate)) || ((startFrame - 0.01f) > (this.m_Clip.stopTime * this.m_Clip.frameRate))) || ((stopFrame + 0.01f) < (this.m_Clip.startTime * this.m_Clip.frameRate))) || ((stopFrame - 0.01f) > (this.m_Clip.stopTime * this.m_Clip.frameRate));
bool flag2 = false;
if (disabled)
{
GUILayout.BeginHorizontal(EditorStyles.helpBox, new GUILayoutOption[0]);
GUILayout.Label("The clip range is outside of the range of the source take.", EditorStyles.wordWrappedMiniLabel, new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
GUILayout.BeginVertical(new GUILayoutOption[0]);
GUILayout.Space(5f);
if (GUILayout.Button("Clamp Range", new GUILayoutOption[0]))
{
flag2 = true;
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
Rect position = GUILayoutUtility.GetRect((float) 10f, (float) 33f);
GUI.Label(position, string.Empty, "TE Toolbar");
if (Event.current.type == EventType.Repaint)
{
this.m_TimeArea.rect = position;
}
this.m_TimeArea.BeginViewGUI();
this.m_TimeArea.EndViewGUI();
position.height -= 15f;
int controlID = GUIUtility.GetControlID(0x2fb605, FocusType.Passive);
int id = GUIUtility.GetControlID(0x2fb605, FocusType.Passive);
GUI.BeginGroup(new Rect(position.x + 1f, position.y + 1f, position.width - 2f, position.height - 2f));
float num8 = -1f;
position.y = num8;
position.x = num8;
float x = this.m_TimeArea.FrameToPixel(startFrame, this.m_Clip.frameRate, position);
float num4 = this.m_TimeArea.FrameToPixel(stopFrame, this.m_Clip.frameRate, position);
GUI.Label(new Rect(x, position.y, num4 - x, position.height), string.Empty, EditorStyles.selectionRect);
this.m_TimeArea.TimeRuler(position, this.m_Clip.frameRate);
float num5 = this.m_TimeArea.TimeToPixel(this.m_AvatarPreview.timeControl.currentTime, position) - 0.5f;
Handles.color = new Color(1f, 0f, 0f, 0.5f);
Handles.DrawLine((Vector3) new Vector2(num5, position.yMin), (Vector3) new Vector2(num5, position.yMax));
Handles.DrawLine((Vector3) new Vector2(num5 + 1f, position.yMin), (Vector3) new Vector2(num5 + 1f, position.yMax));
Handles.color = Color.white;
EditorGUI.BeginDisabledGroup(disabled);
float time = startFrame / this.m_Clip.frameRate;
TimeArea.TimeRulerDragMode mode = this.m_TimeArea.BrowseRuler(position, controlID, ref time, 0f, false, "TL InPoint");
if (mode == TimeArea.TimeRulerDragMode.Cancel)
{
startFrame = this.m_DraggingStartFrame;
}
else if (mode != TimeArea.TimeRulerDragMode.None)
{
startFrame = time * this.m_Clip.frameRate;
startFrame = MathUtils.RoundBasedOnMinimumDifference(startFrame, (this.m_TimeArea.PixelDeltaToTime(position) * this.m_Clip.frameRate) * 10f);
changedStart = true;
}
float num7 = stopFrame / this.m_Clip.frameRate;
TimeArea.TimeRulerDragMode mode2 = this.m_TimeArea.BrowseRuler(position, id, ref num7, 0f, false, "TL OutPoint");
if (mode2 == TimeArea.TimeRulerDragMode.Cancel)
{
stopFrame = this.m_DraggingStopFrame;
}
else if (mode2 != TimeArea.TimeRulerDragMode.None)
{
stopFrame = num7 * this.m_Clip.frameRate;
stopFrame = MathUtils.RoundBasedOnMinimumDifference(stopFrame, (this.m_TimeArea.PixelDeltaToTime(position) * this.m_Clip.frameRate) * 10f);
changedStop = true;
}
EditorGUI.EndDisabledGroup();
if (GUIUtility.hotControl == controlID)
{
changedStart = true;
}
if (GUIUtility.hotControl == id)
{
changedStop = true;
}
GUI.EndGroup();
EditorGUI.BeginDisabledGroup(disabled);
EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
EditorGUI.BeginChangeCheck();
startFrame = EditorGUILayout.FloatField(styles.StartFrame, startFrame, new GUILayoutOption[0]);
if (EditorGUI.EndChangeCheck())
{
changedStart = true;
}
GUILayout.FlexibleSpace();
EditorGUI.BeginChangeCheck();
stopFrame = EditorGUILayout.FloatField(styles.EndFrame, stopFrame, new GUILayoutOption[0]);
if (EditorGUI.EndChangeCheck())
{
changedStop = true;
}
EditorGUILayout.EndHorizontal();
EditorGUI.EndDisabledGroup();
changedStart |= flag2;
changedStop |= flag2;
if (changedStart)
{
startFrame = Mathf.Clamp(startFrame, this.m_Clip.startTime * this.m_Clip.frameRate, Mathf.Clamp(stopFrame, this.m_Clip.startTime * this.m_Clip.frameRate, stopFrame));
}
if (changedStop)
{
stopFrame = Mathf.Clamp(stopFrame, startFrame, this.m_Clip.stopTime * this.m_Clip.frameRate);
}
if (changedStart || changedStop)
{
if (!this.m_DraggingRange)
{
this.m_DraggingRangeBegin = true;
}
this.m_DraggingRange = true;
}
else if ((this.m_DraggingRange && (GUIUtility.hotControl == 0)) && (Event.current.type == EventType.Repaint))
{
this.m_DraggingRangeEnd = true;
this.m_DraggingRange = false;
this.m_DirtyQualityCurves = true;
base.Repaint();
}
GUILayout.Space(10f);
}