Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
Unity
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Shane Veasy
Unity
Commits
14a3558d
Commit
14a3558d
authored
8 years ago
by
Emil "AngryAnt" Johansen
Browse files
Options
Downloads
Patches
Plain Diff
Readonly changeset views, improved layout integration.
parent
bd24f331
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/GitHub.Unity/Assets/Plugins/GitHub/Editor/Views/ChangesetTreeView.cs
+58
-42
58 additions, 42 deletions
...y/Assets/Plugins/GitHub/Editor/Views/ChangesetTreeView.cs
with
58 additions
and
42 deletions
src/GitHub.Unity/Assets/Plugins/GitHub/Editor/Views/ChangesetTreeView.cs
+
58
−
42
View file @
14a3558d
...
...
@@ -142,6 +142,7 @@ namespace GitHub.Unity
public
float
Height
{
get
;
protected
set
;
}
public
bool
Readonly
{
get
;
set
;
}
public
IList
<
GitStatusEntry
>
Entries
...
...
@@ -293,45 +294,47 @@ namespace GitHub.Unity
public
override
void
OnGUI
()
{
// The file tree (when available)
if
(
tree
!=
null
&&
entries
.
Any
())
{
// Base path label
if
(!
string
.
IsNullOrEmpty
(
tree
.
Path
))
GUILayout
.
BeginVertical
();
// The file tree (when available)
if
(
tree
!=
null
&&
entries
.
Any
())
{
GUILayout
.
Label
(
string
.
Format
(
BasePathLabel
,
tree
.
Path
));
}
// Base path label
if
(!
string
.
IsNullOrEmpty
(
tree
.
Path
))
{
GUILayout
.
Label
(
string
.
Format
(
BasePathLabel
,
tree
.
Path
));
}
GUILayout
.
BeginHorizontal
();
GUILayout
.
Space
(
Styles
.
TreeIndentation
+
Styles
.
TreeRootIndentation
);
GUILayout
.
BeginVertical
();
// Root nodes
foreach
(
FileTreeNode
node
in
tree
.
Children
)
{
TreeNode
(
node
);
}
GUILayout
.
EndVertical
();
GUILayout
.
EndHorizontal
();
GUILayout
.
BeginHorizontal
();
GUILayout
.
Space
(
Styles
.
TreeIndentation
+
Styles
.
TreeRootIndentation
);
GUILayout
.
BeginVertical
();
// Root nodes
foreach
(
FileTreeNode
node
in
tree
.
Children
)
{
TreeNode
(
node
);
}
GUILayout
.
EndVertical
();
GUILayout
.
EndHorizontal
();
if
(
Height
==
0f
&&
Event
.
current
.
type
==
EventType
.
Repaint
)
// If we have no minimum height calculated, do that now and repaint so it can be used
{
Height
=
GUILayoutUtility
.
GetLastRect
().
yMax
+
Styles
.
MinCommitTreePadding
;
Repaint
();
}
if
(
Height
==
0f
&&
Event
.
current
.
type
==
EventType
.
Repaint
)
// If we have no minimum height calculated, do that now and repaint so it can be used
{
Height
=
GUILayoutUtility
.
GetLastRect
().
yMax
+
Styles
.
MinCommitTreePadding
;
Repaint
();
}
GUILayout
.
FlexibleSpace
();
}
else
{
GUILayout
.
FlexibleSpace
();
GUILayout
.
BeginHorizontal
();
GUILayout
.
FlexibleSpace
();
GUILayout
.
Label
(
NoChangesLabel
);
}
else
{
GUILayout
.
FlexibleSpace
();
GUILayout
.
EndHorizontal
();
GUILayout
.
FlexibleSpace
();
}
GUILayout
.
BeginHorizontal
();
GUILayout
.
FlexibleSpace
();
GUILayout
.
Label
(
NoChangesLabel
);
GUILayout
.
FlexibleSpace
();
GUILayout
.
EndHorizontal
();
GUILayout
.
FlexibleSpace
();
}
GUILayout
.
EndVertical
();
}
...
...
@@ -341,21 +344,34 @@ namespace GitHub.Unity
bool
isFolder
=
node
.
Children
.
Any
();
GUILayout
.
BeginHorizontal
();
// Commit inclusion toggle
CommitState
state
=
node
.
State
;
bool
toggled
=
state
==
CommitState
.
All
;
EditorGUI
.
BeginChangeCheck
();
toggled
=
GUILayout
.
Toggle
(
toggled
,
""
,
state
==
CommitState
.
Some
?
Styles
.
ToggleMixedStyle
:
GUI
.
skin
.
toggle
,
GUILayout
.
ExpandWidth
(
false
));
if
(
EditorGUI
.
EndChangeCheck
())
if
(!
Readonly
)
{
node
.
State
=
toggled
?
CommitState
.
All
:
CommitState
.
None
;
// Commit inclusion toggle
CommitState
state
=
node
.
State
;
bool
toggled
=
state
==
CommitState
.
All
;
EditorGUI
.
BeginChangeCheck
();
toggled
=
GUILayout
.
Toggle
(
toggled
,
""
,
state
==
CommitState
.
Some
?
Styles
.
ToggleMixedStyle
:
GUI
.
skin
.
toggle
,
GUILayout
.
ExpandWidth
(
false
));
if
(
EditorGUI
.
EndChangeCheck
())
{
node
.
State
=
toggled
?
CommitState
.
All
:
CommitState
.
None
;
}
}
// Foldout
if
(
isFolder
)
{
Rect
foldoutRect
=
GUILayoutUtility
.
GetLastRect
();
Rect
foldoutRect
;
if
(
Readonly
)
{
foldoutRect
=
GUILayoutUtility
.
GetRect
(
1
,
1
);
foldoutRect
.
Set
(
foldoutRect
.
x
-
5f
,
foldoutRect
.
y
,
0f
,
EditorGUIUtility
.
singleLineHeight
);
}
else
{
foldoutRect
=
GUILayoutUtility
.
GetLastRect
();
}
foldoutRect
.
Set
(
foldoutRect
.
x
-
Styles
.
FoldoutWidth
+
Styles
.
FoldoutIndentation
,
foldoutRect
.
y
,
Styles
.
FoldoutWidth
,
foldoutRect
.
height
);
EditorGUI
.
BeginChangeCheck
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment