private void Construct(GitManager gitManager, GitOverlay gitOverlay, ILogger logger, GitAnimation gitAnimation)
 {
     this.gitManager   = gitManager;
     this.gitOverlay   = gitOverlay;
     this.logger       = logger;
     this.gitAnimation = gitAnimation;
 }
 private void Construct(InjectionHelper parentInjectionHelper, GitAnimation gitAnimation)
 {
     this.gitAnimation = gitAnimation;
     injectionHelper.SetParent(parentInjectionHelper);
     injectionHelper.Bind <GitSettingsTab>().To <GitGeneralSettingsTab>();
     injectionHelper.Bind <GitSettingsTab>().To <GitExternalsSettingsTab>();
     injectionHelper.Bind <GitSettingsTab>().To <GitRemotesSettingsTab>();
     injectionHelper.Bind <GitSettingsTab>().To <GitBranchesSettingsTab>();
     injectionHelper.Bind <GitSettingsTab>().To <GitLFSSettingsTab>();
     injectionHelper.Bind <GitSettingsTab>().To <GitSecuritySettingsTab>();
     animationTween = GitAnimation.Empty;
 }
        private void AnimateTabs()
        {
            if (animationTween.Valid)
            {
                float animTime = GitAnimation.ApplyEasing(animationTween.Percent);
                int   animDir  = (int)Mathf.Sign(tab - lastTabIndex);

                if (lastTabElement != null)
                {
                    float pos = (1 - animTime) * -animDir * settingsTabsElement.contentRect.width;

                    lastTabElement.style.right = -pos;
                    lastTabElement.style.left  = pos;

                    lastTabElement.style.display = DisplayStyle.Flex;
                }

                if (currentTabElement != null)
                {
                    float pos = animTime * animDir * settingsTabsElement.contentRect.width;
                    currentTabElement.style.right   = -pos;
                    currentTabElement.style.left    = pos;
                    currentTabElement.style.display = DisplayStyle.Flex;
                }
            }
            else
            {
                if (currentTabElement != null)
                {
                    currentTabElement.style.display = DisplayStyle.Flex;
                }

                if (lastTabElement != null)
                {
                    lastTabElement.style.display = DisplayStyle.None;
                }
            }
        }
        private void OnGUI()
        {
            InitStyles();

            if (isBinary)
            {
                EditorGUILayout.HelpBox("File Is Binary", MessageType.Warning);
                return;
            }

            if (changeSections == null)
            {
                if (gitManager.Repository != null)
                {
                    var commit = string.IsNullOrEmpty(commitSha) ? null : gitManager.Repository.Lookup <Commit>(commitSha);
                    BuildChangeSections(commit);
                }
                GitGUI.DrawLoading(new Rect(0, 0, position.width, position.height), GitGUI.GetTempContent("Loading Changes"));
                Repaint();
                return;
            }

            if (changeSections.Count <= 0)
            {
                EditorGUILayout.HelpBox("No Difference", MessageType.Info);
                return;
            }

            if (animationTween == null)
            {
                animationTween = gitAnimation.StartManualAnimation(AnimationDuration, this, out animationTime, GitSettingsJson.AnimationTypeEnum.DiffInspector);
            }

            float toolbarHeight = EditorStyles.toolbar.fixedHeight;
            float difHeight     = position.height - toolbarHeight;

            DrawToolbar();

            Rect resizeRect          = new Rect(position.width * otherFileWindowWidth - 3, toolbarHeight, 6, difHeight);
            Rect indexFileRect       = new Rect(position.width * otherFileWindowWidth + (resizeRect.width / 2), toolbarHeight, position.width * (1 - otherFileWindowWidth) - (resizeRect.width / 2), difHeight);
            Rect otherFileScrollRect = new Rect(0, toolbarHeight, position.width * otherFileWindowWidth - (resizeRect.width / 2), difHeight);

            gitAnimation.Update(animationTween, ref animationTime);
            float animTime = GitAnimation.ApplyEasing(animationTween.Percent);

            if (Event.current.type == EventType.MouseDown && otherFileScrollRect.Contains(Event.current.mousePosition))
            {
                selectedFile = FileType.OtherFile;
                Repaint();
            }
            else if (Event.current.type == EventType.MouseDown && indexFileRect.Contains(Event.current.mousePosition))
            {
                selectedFile = FileType.IndexFile;
                Repaint();
            }

            GUI.Box(resizeRect, GUIContent.none);

            if (Event.current.type == EventType.MouseUp)
            {
                isResizingFileWindow = false;
            }
            if (Event.current.type == EventType.MouseDown && resizeRect.Contains(Event.current.mousePosition))
            {
                isResizingFileWindow = true;
            }

            if (isResizingFileWindow)
            {
                otherFileWindowWidth = Mathf.Clamp(Event.current.mousePosition.x / position.width, 0.1f, 0.9f);
                EditorGUIUtility.AddCursorRect(position, MouseCursor.ResizeHorizontal);
                Repaint();
            }
            else
            {
                EditorGUIUtility.AddCursorRect(resizeRect, MouseCursor.ResizeHorizontal);
            }

            GUI.Box(otherFileScrollRect, GUIContent.none, EditorStyles.textArea);
            GUI.Box(indexFileRect, GUIContent.none, EditorStyles.textArea);

            DrawBlobs(false, otherFileScrollRect, indexFileRect);
            DrawBlobs(true, indexFileRect, otherFileScrollRect);

            if (selectedFile == FileType.IndexFile)
            {
                GUI.Box(indexFileRect, GUIContent.none, GitGUI.Styles.SelectionBoxGlow);
            }
            else
            {
                GUI.Box(otherFileScrollRect, GUIContent.none, GitGUI.Styles.SelectionBoxGlow);
            }

            GUI.color = new Color(1, 1, 1, Mathf.Lerp(0, 1, animTime));
            GUI.Box(new Rect(0, 0, position.width, position.height - toolbarHeight), GUIContent.none);
            GUI.color = Color.white;
        }