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
21b3f14e
Commit
21b3f14e
authored
12 years ago
by
jsiegle
Browse files
Options
Downloads
Patches
Plain Diff
EditorViewportButton is now free of OpenGL calls
parent
50815631
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/UI/UIComponent.cpp
+23
-35
23 additions, 35 deletions
Source/UI/UIComponent.cpp
Source/UI/UIComponent.h
+4
-11
4 additions, 11 deletions
Source/UI/UIComponent.h
with
27 additions
and
46 deletions
Source/UI/UIComponent.cpp
+
23
−
35
View file @
21b3f14e
...
...
@@ -421,6 +421,8 @@ bool UIComponent::perform (const InvocationInfo& info)
EditorViewportButton
::
EditorViewportButton
(
UIComponent
*
ui
)
:
UI
(
ui
)
{
open
=
true
;
buttonFont
=
Font
(
"Default Light"
,
25
,
Font
::
plain
);
}
EditorViewportButton
::~
EditorViewportButton
()
...
...
@@ -428,55 +430,41 @@ EditorViewportButton::~EditorViewportButton()
}
void
EditorViewportButton
::
newOpenGLContextCreated
()
{
setUp2DCanvas
();
activateAntiAliasing
();
setClearColor
(
darkgrey
);
//glClearColor(0.23f, 0.23f, 0.23f, 1.0f);
}
void
EditorViewportButton
::
paint
(
Graphics
&
g
)
{
g
.
fillAll
(
Colour
(
58
,
58
,
58
));
void
EditorViewportButton
::
renderOpenGL
()
{
glClear
(
GL_COLOR_BUFFER_BIT
);
drawName
();
drawButton
();
}
g
.
setColour
(
Colours
::
white
);
g
.
setFont
(
buttonFont
);
g
.
drawText
(
"SIGNAL CHAIN"
,
10
,
0
,
getWidth
(),
getHeight
(),
Justification
::
left
,
false
);
void
EditorViewportButton
::
drawName
()
{
glColor4f
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
);
glRasterPos2f
(
8.0
/
getWidth
(),
0.75
f
);
getFont
(
cpmono_light
)
->
FaceSize
(
23
);
getFont
(
cpmono_light
)
->
Render
(
"SIGNAL CHAIN"
);
}
g
.
setColour
(
Colours
::
white
);
void
EditorViewportButton
::
drawButton
()
{
glColor4f
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
);
glLineWidth
(
1.0
f
);
Path
p
;
glBegin
(
GL_LINE_LOOP
);
float
h
=
getHeight
();
float
w
=
getWidth
()
-
5
;
if
(
open
)
{
glVertex2f
(
0.90
,
0.65
);
glVertex2f
(
0.925
,
0.35
);
p
.
addTriangle
(
w
-
h
+
0.2
f
*
h
,
0.8
f
*
h
,
w
-
h
+
0.5
f
*
h
,
0.2
f
*
h
,
w
-
h
+
0.8
f
*
h
,
0.8
f
*
h
);
}
else
{
glVertex2f
(
0.95
,
0.35
);
glVertex2f
(
0.90
,
0.5
);
p
.
addTriangle
(
w
-
h
+
0.2
f
*
h
,
0.5
f
*
h
,
w
-
h
+
0.8
f
*
h
,
0.2
f
*
h
,
w
-
h
+
0.8
f
*
h
,
0.8
f
*
h
);
}
glVertex2f
(
0.95
,
0.65
);
glEnd
();
PathStrokeType
pst
=
PathStrokeType
(
1.0
f
,
PathStrokeType
::
curved
,
PathStrokeType
::
rounded
);
g
.
strokePath
(
p
,
pst
);
}
void
EditorViewportButton
::
mouseDown
(
const
MouseEvent
&
e
)
{
open
=
!
open
;
...
...
This diff is collapsed.
Click to expand it.
Source/UI/UIComponent.h
+
4
−
11
View file @
21b3f14e
...
...
@@ -183,7 +183,7 @@ private:
*/
class
EditorViewportButton
:
public
OpenGLCanvas
class
EditorViewportButton
:
public
Component
{
public:
EditorViewportButton
(
UIComponent
*
ui
);
...
...
@@ -192,17 +192,8 @@ public:
/** Returns the open/closed state of the button. */
bool
isOpen
()
{
return
open
;}
/** Configures a new OpenGL context for drawing. */
void
newOpenGLContextCreated
();
/** Draws the button. */
void
renderOpenGL
();
/** Draws the name of the button. */
void
drawName
();
/** Draws the button. */
void
drawButton
();
void
paint
(
Graphics
&
g
);
/** Switches the open/closed state of the button. */
void
toggleState
();
...
...
@@ -216,6 +207,8 @@ private:
UIComponent
*
UI
;
bool
open
;
Font
buttonFont
;
};
#endif // __UICOMPONENT_H_D97C73CF__
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