Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
plugin-GUI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
yehaojie
plugin-GUI
Commits
21d604fc
Commit
21d604fc
authored
11 years ago
by
Josh Siegle
Browse files
Options
Downloads
Patches
Plain Diff
Update GraphViewer code
parent
f8c2146c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/UI/GraphViewer.cpp
+52
-0
52 additions, 0 deletions
Source/UI/GraphViewer.cpp
Source/UI/GraphViewer.h
+5
-0
5 additions, 0 deletions
Source/UI/GraphViewer.h
with
57 additions
and
0 deletions
Source/UI/GraphViewer.cpp
+
52
−
0
View file @
21d604fc
...
...
@@ -66,14 +66,45 @@ void GraphViewer::removeAllNodes()
void
GraphViewer
::
updateNodeLocations
()
{
// set the initial locations
for
(
int
i
=
0
;
i
<
availableNodes
.
size
();
i
++
)
{
availableNodes
[
i
]
->
updateBoundaries
();
}
// perform checks
//checkLayout(); // not helpful...yet
repaint
();
}
void
GraphViewer
::
checkLayout
()
{
for
(
int
i
=
0
;
i
<
availableNodes
.
size
();
i
++
)
{
int
sourceIndex
=
indexOfEditor
(
availableNodes
[
i
]
->
getSource
());
if
(
sourceIndex
>
-
1
)
{
if
(
availableNodes
[
i
]
->
getHorzShift
()
<
availableNodes
[
sourceIndex
]
->
getHorzShift
())
{
availableNodes
[
i
]
->
setHorzShift
(
availableNodes
[
sourceIndex
]
->
getHorzShift
());
}
}
int
destIndex
=
indexOfEditor
(
availableNodes
[
i
]
->
getDest
());
if
(
destIndex
>
-
1
)
{
if
(
availableNodes
[
i
]
->
getLevel
()
>
availableNodes
[
destIndex
]
->
getLevel
())
{
availableNodes
[
destIndex
]
->
setLevel
(
availableNodes
[
i
]
->
getLevel
()
+
1
);
}
}
}
}
int
GraphViewer
::
indexOfEditor
(
GenericEditor
*
editor
)
{
int
index
=
-
1
;
...
...
@@ -221,6 +252,22 @@ int GraphNode::getLevel()
return
level
;
}
void
GraphNode
::
setLevel
(
int
level
)
{
setBounds
(
getX
(),
20
+
getLevel
()
*
40
,
getWidth
(),
getHeight
());
}
int
GraphNode
::
getHorzShift
()
{
return
gv
->
getHorizontalShift
(
this
);
}
void
GraphNode
::
setHorzShift
(
int
shift
)
{
setBounds
(
20
+
shift
*
140
,
getY
(),
getWidth
(),
getHeight
());
}
void
GraphNode
::
mouseEnter
(
const
MouseEvent
&
m
)
{
...
...
@@ -261,6 +308,11 @@ GenericEditor* GraphNode::getDest()
return
editor
->
getDestEditor
();
}
GenericEditor
*
GraphNode
::
getSource
()
{
return
editor
->
getSourceEditor
();
}
Array
<
GenericEditor
*>
GraphNode
::
getConnectedEditors
()
{
return
editor
->
getConnectedEditors
();
...
...
This diff is collapsed.
Click to expand it.
Source/UI/GraphViewer.h
+
5
−
0
View file @
21d604fc
...
...
@@ -58,6 +58,7 @@ public:
Point
<
float
>
getCenterPoint
();
GenericEditor
*
getDest
();
GenericEditor
*
getSource
();
Array
<
GenericEditor
*>
getConnectedEditors
();
void
switchIO
(
int
path
);
...
...
@@ -67,6 +68,9 @@ public:
const
String
getName
();
int
getLevel
();
void
setLevel
(
int
);
int
getHorzShift
();
void
setHorzShift
(
int
);
private:
...
...
@@ -100,6 +104,7 @@ public:
private:
void
connectNodes
(
int
,
int
,
Graphics
&
);
void
checkLayout
();
void
updateNodeLocations
();
int
indexOfEditor
(
GenericEditor
*
editor
);
...
...
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