Skip to content
Snippets Groups Projects
Commit e427b8d2 authored by jsiegle's avatar jsiegle
Browse files

InfoLabel now uses an FTSimpleLayout to draw its text

To simplify text alignment, the InfoLabel now uses an FTSimpleLayout object
to automatically wrap text within the bounds of the OpenGLCanvas. This will
allow a welcome message and simple instructions to be displayed.
parent 7f898c89
No related branches found
No related tags found
No related merge requests found
......@@ -68,7 +68,7 @@ public:
{quit();}
//==============================================================================
const String getApplicationName() { return "Open Ephys Data Acquisition Software";}
const String getApplicationName() { return "Open Ephys GUI";}
const String getApplicationVersion() {return ProjectInfo::versionString;}
bool moreThanOneInstanceAllowed() {return true;}
void anotherInstanceStarted (const String& commandLine)
......
......@@ -25,7 +25,12 @@
InfoLabel::InfoLabel() : xBuffer(10), yBuffer(10)
{
layout.SetAlignment(FTGL::ALIGN_LEFT);
layout.SetFont(getFont(String("miso-regular")));
infoString = "Welcome to the Open Ephys GUI!\n \n"
"The GUI is still in the early stages of development, so we expect there to be a lot of bugs.\n \n"
;
}
InfoLabel::~InfoLabel()
......@@ -64,51 +69,76 @@ void InfoLabel::drawLabel()
{
glViewport(xBuffer,
yBuffer-getScrollAmount(),
getHeight()-getTotalHeight()-yBuffer + getScrollAmount(),
getWidth()-2*xBuffer,
jmax(getHeight(),getTotalHeight())-2*yBuffer);
getTotalHeight());
//jmax(getHeight(),getTotalHeight())-2*yBuffer);
float mult = 1/float(getWidth());
// float mult = 1/float(getWidth());
glColor4f(0.5,0.5,0.5,0.6);
// glColor4f(0.5,0.5,0.5,0.6);
glBegin(GL_LINE_STRIP);
glVertex2f(0.1,0);
glVertex2f(0.1,1.0);
glEnd();
// glBegin(GL_LINE_STRIP);
// glVertex2f(0.1,0);
// glVertex2f(0.1,1.0);
// glEnd();
glBegin(GL_LINE_STRIP);
glVertex2f(0,0.1);
glVertex2f(1.0,0.1);
glEnd();
// glBegin(GL_LINE_STRIP);
// glVertex2f(0,0.1);
// glVertex2f(1.0,0.1);
// glEnd();
glBegin(GL_LINE_STRIP);
glVertex2f(0.9,0);
glVertex2f(0.9,1.0);
glEnd();
// glBegin(GL_LINE_STRIP);
// glVertex2f(0.9,0);
// glVertex2f(0.9,1.0);
// glEnd();
glBegin(GL_LINE_STRIP);
glVertex2f(0,0.9);
glVertex2f(1.0,0.9);
glEnd();
// glBegin(GL_LINE_STRIP);
// glVertex2f(0,0.9);
// glVertex2f(1.0,0.9);
// glEnd();
glColor4f(0.5,0.5,0.5,0.8);
getFont(String("miso-regular"))->FaceSize(12.0f);
// getFont(String("miso-regular"))->FaceSize(12.0f);
for (float x = 0.1f; x < 1.0f; x += 0.8f)
{
for (float y = 0.1f; y < 1.0f; y += 0.8f)
{
glRasterPos2f(x+0.005f,y+0.025f);
String s = String("(0.");
s += int(x*10);
s += String(", 0.");
s += int(y*10);
s += String(")");
getFont(String("miso-regular"))->Render(s);
}
}
// for (float x = 0.1f; x < 1.0f; x += 0.8f)
// {
// for (float y = 0.1f; y < 1.0f; y += 0.8f)
// {
// glRasterPos2f(x+0.005f,y+0.025f);
// String s = String("(0.");
// s += int(x*10);
// s += String(", 0.");
// s += int(y*10);
// s += String(")");
// getFont(String("miso-regular"))->Render(s);
// }
// }
// glColor4f(0.9,0.9,0.9,1.0);
// glRasterPos2f(7.0/float(getWidth()),0.099f);
// getFont(String("miso-bold"))->FaceSize(40.0f);
// getFont(String("miso-bold"))->Render("open ephys gui");
// glColor4f(0.3,0.3,0.3,1.0);
// glRasterPos2f(5.0/float(getWidth()),0.1f);
// getFont(String("miso-bold"))->FaceSize(40.0f);
// getFont(String("miso-bold"))->Render("open ephys gui");
glColor4f(0.3,0.3,0.3,1.0);
glRasterPos2f(15.0/float(getWidth()),0.1f);
getFont(String("miso-regular"))->FaceSize(18.0f);
layout.Render(infoString, -1, FTPoint(), FTGL::RENDER_FRONT);
//
//
//getFont(String("miso-regular"))->Render("Open Ephys GUI");
}
void InfoLabel::resized()
......@@ -116,6 +146,7 @@ void InfoLabel::resized()
//std::cout << getWidth() << " " << getHeight()
// << std::endl;
layout.SetLineLength(getWidth()-45);
canvasWasResized();
......
......@@ -61,8 +61,12 @@ private:
void mouseUp(const MouseEvent& e);
void mouseWheelMove(const MouseEvent&, float, float);
FTSimpleLayout layout;
String infoString;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (InfoLabel);
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment