Exemple #1
0
        public void getUpdateItem(Commit commit, Commit lastCommit, Rect windowRect, onCommitSelected onCommitSelected)
        {
            CommitItem item = new CommitItem(commit);

            float horizontalWidth = (windowRect.width) - (WINDOW_PADDING * 2) - 25;
            float halfWidth       = (horizontalWidth / 2) - (WINDOW_PADDING * 2);
            float quarterWidth    = (horizontalWidth / 4) - (WINDOW_PADDING * 2);

            Rect r = EditorGUILayout.BeginHorizontal("Button", GUILayout.Width(horizontalWidth));

            if (GUI.Button(r, GUIContent.none))
            {
                try {
                    changesetViewWindow.reset(repo.Diff.Compare(lastCommit.Tree, commit.Tree), this);
                } catch (System.Exception e) {
                    changesetViewWindow.reset(e);
                } finally {
                    onCommitSelected(commit);
                }
            }

            GUILayout.Label(item.commitMessage.Substring(0, Mathf.Min(item.commitMessage.Length, 100)), GUILayout.Width(halfWidth));
            GUILayout.Label("\t\t" + commit.Author.Name, GUILayout.Width(quarterWidth));
            GUILayout.Label(item.dateString, GUILayout.Width(quarterWidth));

            GUILayout.EndHorizontal();
        }
        public void getUpdateItem( Commit commit, Commit lastCommit, Rect windowRect, onCommitSelected onCommitSelected )
        {
            CommitItem item = new CommitItem( commit );

            float horizontalWidth = ( windowRect.width ) - ( WINDOW_PADDING * 2 ) - 25;
            float halfWidth = ( horizontalWidth / 2 ) - ( WINDOW_PADDING * 2 );
            float quarterWidth = ( horizontalWidth / 4 ) - ( WINDOW_PADDING * 2 );

            Rect r = EditorGUILayout.BeginHorizontal( "Button", GUILayout.Width( horizontalWidth ) );

            if ( GUI.Button( r, GUIContent.none ) ) {
                try {
                    changesetViewWindow.reset( repo.Diff.Compare( lastCommit.Tree, commit.Tree ), this );
                } catch ( System.Exception e ) {
                    changesetViewWindow.reset( e );
                } finally {
                    onCommitSelected( commit );
                }
            }

            GUILayout.Label( item.commitMessage.Substring( 0, Mathf.Min( item.commitMessage.Length, 100 ) ), GUILayout.Width( halfWidth ) );
            GUILayout.Label( "\t\t" + commit.Author.Name, GUILayout.Width( quarterWidth ) );
            GUILayout.Label( item.dateString, GUILayout.Width( quarterWidth ) );

            GUILayout.EndHorizontal();
        }