More consts for UI job

This commit is contained in:
atlante45 2013-07-09 14:49:01 +02:00
parent f0cf96353d
commit c3b0be5c63
2 changed files with 25 additions and 21 deletions

View file

@ -2469,29 +2469,23 @@ void Application::displayOverlay() {
TextRenderer textRenderer(SANS_FONT_FAMILY, 11, 50);
const char line1[] = "Assign this color to a swatch";
const char line2[] = "by choosing a key from 1 to 8.";
double step = 0.05f;
int width = 280, height = 30;
double margin = 10.0f;
int left = (_glWidget->width() - width - 2 * margin) / 2;
int left = (_glWidget->width() - WIDTH - 2 * MARGIN) / 2;
int top = _glWidget->height() / 40;
int swatchWidth = 64, swatchHeight = 30;
int firstLineOffset = 12, secondLineOffset = 28;
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 += STEP) {
glVertex2f(left + MARGIN * cos(a) , top + 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 += STEP) {
glVertex2f(left + WIDTH + MARGIN * cos(a), top + 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 += STEP) {
glVertex2f(left + WIDTH + MARGIN * cos(a), top + HEIGHT + 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 += STEP) {
glVertex2f(left + MARGIN*cos(a) , top + HEIGHT + MARGIN*sin(a));
}
glEnd();
@ -2499,15 +2493,15 @@ void Application::displayOverlay() {
glColor3f(color.redF(),
color.greenF(),
color.blueF());
glVertex2f(left , top);
glVertex2f(left + swatchWidth, top);
glVertex2f(left + swatchWidth, top + swatchHeight);
glVertex2f(left , top + swatchHeight);
glVertex2f(left , top);
glVertex2f(left + SWATCH_WIDTH, top);
glVertex2f(left + SWATCH_WIDTH, top + SWATCH_HEIGHT);
glVertex2f(left , top + SWATCH_HEIGHT);
glEnd();
glColor3f(1.0f, 1.0f, 1.0f);
textRenderer.draw(left + swatchWidth + margin, top + firstLineOffset , line1);
textRenderer.draw(left + swatchWidth + margin, top + secondLineOffset, line2);
textRenderer.draw(left + SWATCH_WIDTH + MARGIN, top + FIRST_LINE_OFFSET , line1);
textRenderer.draw(left + SWATCH_WIDTH + MARGIN, top + SECOND_LINE_OFFSET, line2);
}
else {
_swatch.checkColor();

View file

@ -25,6 +25,16 @@ static const int WIDTH_MIN = 47; // Minimal tools width
static const float TOOLS_RATIO = 40.0f / 60.0f; // ratio height/width of tools icons
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 int SWATCH_WIDTH = 64;
static const int SWATCH_HEIGHT = 30;
static const int FIRST_LINE_OFFSET = 12;
static const int SECOND_LINE_OFFSET = 28;
class Tool {
public:
Tool(QAction* action, GLuint texture, int x, int y);