private void OnGUI()
        {
            CreateStyles();

            if (!GitManager.IsValidRepo)
            {
                GitHistoryWindow.InvalidRepoGUI();
                return;
            }

            RepositoryInformation repoInfo = GitManager.Repository.Info;

            GUILayout.BeginArea(CommitRect);
            DoCommit(repoInfo);
            GUILayout.EndArea();

            SerializedProperty diffScrollProperty = editoSerializedObject.FindProperty("diffScroll");

            if (statusList == null)
            {
                return;
            }
            DoDiffScroll(Event.current);

            editoSerializedObject.ApplyModifiedProperties();

            if (Event.current.type == EventType.MouseDown)
            {
                GUIUtility.keyboardControl = 0;
                GUI.FocusControl(null);
            }
        }
Example #2
0
        private void OnGUI()
        {
            if (gitManager == null || !gitManager.IsValidRepo)
            {
                GitHistoryWindow.InvalidRepoGUI(gitManager);
                return;
            }

            Event current = Event.current;

            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
            EditorGUI.BeginChangeCheck();
            if (tabs != null)
            {
                for (int i = 0; i < tabs.Length; i++)
                {
                    bool value = GUILayout.Toggle(tab == i, tabs[i].Name, EditorStyles.toolbarButton);
                    if (value)
                    {
                        tab = i;
                    }
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                LoseFocus();
                if (currentTab != null)
                {
                    currentTab.OnFocus();
                }
            }
            GUILayout.FlexibleSpace();
            if (GitGUI.LinkButtonLayout(GitOverlay.icons.donateSmall, GitGUI.Styles.IconButton))
            {
                GitLinks.GoTo(GitLinks.Donate);
            }
            if (GitGUI.LinkButtonLayout(GitGUI.Contents.Help, GitGUI.Styles.IconButton))
            {
                GitLinks.GoTo(GitLinks.SettingsWindowHelp);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();
            if (gitManager.Repository != null)
            {
                Rect localRect = new Rect(0, 0, position.width, position.height - EditorGUIUtility.singleLineHeight * 1.6f);
                if (currentTab != null)
                {
                    currentTab.OnGUI(localRect, current);
                }
            }
            EditorGUILayout.Space();

            if (current.type == EventType.MouseDown)
            {
                LoseFocus();
            }
        }
Example #3
0
        private void OnGUI()
        {
            if (!GitManager.IsValidRepo)
            {
                GitHistoryWindow.InvalidRepoGUI();
                return;
            }

            Event current = Event.current;

            EditorGUILayout.BeginHorizontal("Toolbar");
            EditorGUI.BeginChangeCheck();
            bool value = GUILayout.Toggle(tab == SettingTabEnum.General, GitGUI.GetTempContent("General"), "toolbarbutton");

            if (value)
            {
                tab = SettingTabEnum.General;
            }
            value = GUILayout.Toggle(tab == SettingTabEnum.Externals, GitGUI.GetTempContent("Externals"), "toolbarbutton");
            if (value)
            {
                tab = SettingTabEnum.Externals;
            }
            value = GUILayout.Toggle(tab == SettingTabEnum.Remotes, GitGUI.GetTempContent("Remotes"), "toolbarbutton");
            if (value)
            {
                tab = SettingTabEnum.Remotes;
            }
            value = GUILayout.Toggle(tab == SettingTabEnum.Branches, GitGUI.GetTempContent("Branches"), "toolbarbutton");
            if (value)
            {
                tab = SettingTabEnum.Branches;
            }
            value = GUILayout.Toggle(tab == SettingTabEnum.LFS, GitGUI.GetTempContent("LFS"), "toolbarbutton");
            if (value)
            {
                tab = SettingTabEnum.LFS;
            }
            value = GUILayout.Toggle(tab == SettingTabEnum.Security, GitGUI.GetTempContent("Security"), "toolbarbutton");
            if (value)
            {
                tab = SettingTabEnum.Security;
            }
            if (EditorGUI.EndChangeCheck())
            {
                LoseFocus();
            }
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();
            if (GitManager.Repository != null)
            {
                switch (tab)
                {
                case SettingTabEnum.Remotes:
                    DoRemotes(current);
                    break;

                case SettingTabEnum.Externals:
                    DoExternals(current);
                    break;

                case SettingTabEnum.Branches:
                    DoBranches(current);
                    break;

                case SettingTabEnum.LFS:
                    DoLFS(current);
                    break;

                case SettingTabEnum.Security:
                    DoSecurity(current);
                    break;

                default:
                    DoGeneral(current);
                    break;
                }
            }

            EditorGUILayout.Space();

            if (current.type == EventType.MouseDown)
            {
                LoseFocus();
            }
        }
Example #4
0
        private void OnGUI()
        {
            if (!GitManager.IsValidRepo)
            {
                GitHistoryWindow.InvalidRepoGUI();
                return;
            }

            Event current = Event.current;

            EditorGUILayout.BeginHorizontal("Toolbar");
            EditorGUI.BeginChangeCheck();
            bool value = GUILayout.Toggle(tab == SettingTabEnum.General, GitGUI.GetTempContent("General"), "toolbarbutton");

            if (value)
            {
                tab = SettingTabEnum.General;
            }
            value = GUILayout.Toggle(tab == SettingTabEnum.Externals, GitGUI.GetTempContent("Externals", "External Programs Helpers"), "toolbarbutton");
            if (value)
            {
                tab = SettingTabEnum.Externals;
            }
            value = GUILayout.Toggle(tab == SettingTabEnum.Remotes, GitGUI.GetTempContent("Remotes", "Remote Repositories"), "toolbarbutton");
            if (value)
            {
                tab = SettingTabEnum.Remotes;
            }
            value = GUILayout.Toggle(tab == SettingTabEnum.Branches, GitGUI.GetTempContent("Branches"), "toolbarbutton");
            if (value)
            {
                tab = SettingTabEnum.Branches;
            }
            value = GUILayout.Toggle(tab == SettingTabEnum.LFS, GitGUI.GetTempContent("LFS", "Git Large File Storage (beta)"), "toolbarbutton");
            if (value)
            {
                tab = SettingTabEnum.LFS;
            }
            value = GUILayout.Toggle(tab == SettingTabEnum.Security, GitGUI.GetTempContent("Security"), "toolbarbutton");
            if (value)
            {
                tab = SettingTabEnum.Security;
            }
            if (EditorGUI.EndChangeCheck())
            {
                LoseFocus();
                if (currentTab != null)
                {
                    currentTab.OnFocus();
                }
            }
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(GitGUI.IconContent("_Help"), "IconButton"))
            {
                GoToHelp();
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();
            if (GitManager.Repository != null)
            {
                Rect localRect = new Rect(0, 0, position.width, position.height - EditorGUIUtility.singleLineHeight * 1.6f);
                if (currentTab != null)
                {
                    currentTab.OnGUI(localRect, current);
                }
            }
            EditorGUILayout.Space();

            if (current.type == EventType.MouseDown)
            {
                LoseFocus();
            }
        }