More code review for UI job

This commit is contained in:
atlante45 2013-07-09 15:29:12 +02:00
parent c3b0be5c63
commit b3c0f3fedb
2 changed files with 15 additions and 15 deletions

View file

@ -2470,22 +2470,22 @@ void Application::displayOverlay() {
const char line1[] = "Assign this color to a swatch";
const char line2[] = "by choosing a key from 1 to 8.";
int left = (_glWidget->width() - WIDTH - 2 * MARGIN) / 2;
int left = (_glWidget->width() - POPUP_WIDTH - 2 * POPUP_MARGIN) / 2;
int top = _glWidget->height() / 40;
glBegin(GL_POLYGON);
glColor3f(0.0f, 0.0f, 0.0f);
for (double a = M_PI; a < 1.5f * M_PI; a += STEP) {
glVertex2f(left + MARGIN * cos(a) , top + MARGIN * sin(a));
for (double a = M_PI; a < 1.5f * M_PI; a += POPUP_STEP) {
glVertex2f(left + POPUP_MARGIN * cos(a) , top + POPUP_MARGIN * sin(a));
}
for (double a = 1.5f * M_PI; a < 2.0f*M_PI; a += STEP) {
glVertex2f(left + WIDTH + MARGIN * cos(a), top + MARGIN * sin(a));
for (double a = 1.5f * M_PI; a < 2.0f * M_PI; a += POPUP_STEP) {
glVertex2f(left + POPUP_WIDTH + POPUP_MARGIN * cos(a), top + POPUP_MARGIN * sin(a));
}
for (double a = 0.0f; a < 0.5f * M_PI; a += STEP) {
glVertex2f(left + WIDTH + MARGIN * cos(a), top + HEIGHT + MARGIN * sin(a));
for (double a = 0.0f; a < 0.5f * M_PI; a += POPUP_STEP) {
glVertex2f(left + POPUP_WIDTH + POPUP_MARGIN * cos(a), top + POPUP_HEIGHT + POPUP_MARGIN * sin(a));
}
for (double a = 0.5f*M_PI; a < 1.0f*M_PI; a += STEP) {
glVertex2f(left + MARGIN*cos(a) , top + HEIGHT + MARGIN*sin(a));
for (double a = 0.5f * M_PI; a < 1.0f * M_PI; a += POPUP_STEP) {
glVertex2f(left + POPUP_MARGIN * cos(a) , top + POPUP_HEIGHT + POPUP_MARGIN * sin(a));
}
glEnd();
@ -2500,8 +2500,8 @@ void Application::displayOverlay() {
glEnd();
glColor3f(1.0f, 1.0f, 1.0f);
textRenderer.draw(left + SWATCH_WIDTH + MARGIN, top + FIRST_LINE_OFFSET , line1);
textRenderer.draw(left + SWATCH_WIDTH + MARGIN, top + SECOND_LINE_OFFSET, line2);
textRenderer.draw(left + SWATCH_WIDTH + POPUP_MARGIN, top + FIRST_LINE_OFFSET , line1);
textRenderer.draw(left + SWATCH_WIDTH + POPUP_MARGIN, top + SECOND_LINE_OFFSET, line2);
}
else {
_swatch.checkColor();

View file

@ -26,10 +26,10 @@ static const float TOOLS_RATIO = 40.0f / 60.0f; // ratio height/width of tools i
static const float PAL_SCREEN_RATIO = 3.0f / 100.0f; // Percentage of the screeen width the palette is going to occupy
// Swatch popup consts
static const float STEP = 0.05f;
static const float MARGIN = 10.0f;
static const int WIDTH = 280;
static const int HEIGHT = 30;
static const float POPUP_STEP = 0.05f;
static const float POPUP_MARGIN = 10.0f;
static const int POPUP_WIDTH = 280;
static const int POPUP_HEIGHT = 30;
static const int SWATCH_WIDTH = 64;
static const int SWATCH_HEIGHT = 30;
static const int FIRST_LINE_OFFSET = 12;