android/GlueIOIOPort: fix spurious errors after IOIO baud rate change
[xcsoar.git] / src / Look / InfoBoxLook.cpp
blob64d5f91114a760e4be47b4893f24bf51bb79fcc3
1 /*
2 Copyright_License {
4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "InfoBoxLook.hpp"
25 #include "Screen/Layout.hpp"
27 #include <algorithm>
29 #define COLOR_INVERSE_RED Color(0xff, 0x70, 0x70)
30 #define COLOR_INVERSE_BLUE Color(0x90, 0x90, 0xff)
31 #define COLOR_INVERSE_YELLOW COLOR_YELLOW
32 #define COLOR_INVERSE_GREEN COLOR_GREEN
33 #define COLOR_INVERSE_MAGENTA COLOR_MAGENTA
35 void
36 InfoBoxLook::Initialise(bool _inverse, bool use_colors,
37 const Font &value_font,
38 const Font &_small_font,
39 #ifndef GNAV
40 const Font &_unit_font,
41 #endif
42 const Font &title_font)
44 inverse = _inverse;
46 value.fg_color = title.fg_color = comment.fg_color =
47 inverse ? COLOR_WHITE : COLOR_BLACK;
48 background_color = inverse ? COLOR_BLACK : COLOR_WHITE;
49 caption_background_color = inverse
50 ? Color(0x40, 0x40, 0x40)
51 : Color(0xe0, 0xe0, 0xe0);
52 focused_background_color = COLOR_XCSOAR_LIGHT;
53 pressed_background_color = COLOR_YELLOW;
55 Color border_color = Color(128, 128, 128);
56 border_pen.Set(BORDER_WIDTH, border_color);
57 selector_pen.Set(Layout::Scale(1) + 2, value.fg_color);
59 value.font = &value_font;
60 title.font = &title_font;
61 comment.font = &title_font;
62 small_font = &_small_font;
63 #ifndef GNAV
64 unit_font = &_unit_font;
65 unit_fraction_pen.Set(1, value.fg_color);
66 #endif
68 colors[0] = border_color;
69 if (use_colors) {
70 colors[1] = inverse ? COLOR_INVERSE_RED : COLOR_RED;
71 colors[2] = inverse ? COLOR_INVERSE_BLUE : COLOR_BLUE;
72 colors[3] = inverse ? COLOR_INVERSE_GREEN : COLOR_GREEN;
73 colors[4] = inverse ? COLOR_INVERSE_YELLOW : COLOR_YELLOW;
74 colors[5] = inverse ? COLOR_INVERSE_MAGENTA : COLOR_MAGENTA;
75 } else
76 std::fill(colors + 1, colors + 6, inverse ? COLOR_WHITE : COLOR_BLACK);