android/GlueIOIOPort: fix spurious errors after IOIO baud rate change
[xcsoar.git] / src / InfoBoxes / InfoBoxSettings.cpp
blob36329cb9273bf175584d2b48dca20a55ed5ffa6e
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 "InfoBoxSettings.hpp"
25 #include "Language/Language.hpp"
27 #include <algorithm>
28 #include <stdio.h>
29 #include <tchar.h>
31 using namespace InfoBoxFactory;
33 void
34 InfoBoxSettings::Panel::Clear()
36 name.clear();
37 std::fill(contents, contents + MAX_CONTENTS, InfoBoxFactory::MIN_TYPE_VAL);
40 bool
41 InfoBoxSettings::Panel::IsEmpty() const
43 for (unsigned i = 0; i < MAX_CONTENTS; ++i)
44 if (contents[i] != 0)
45 return false;
47 return true;
50 void
51 InfoBoxSettings::SetDefaults()
53 use_final_glide = false;
55 geometry = Geometry::TOP_4_BOTTOM_4;
57 inverse = false;
58 use_colors = true;
59 border_style = BorderStyle::BOX;
61 for (unsigned i = 0; i < MAX_PANELS; ++i)
62 panels[i].Clear();
64 static constexpr unsigned DFLT_CONFIG_BOXES = 9;
65 static constexpr unsigned DFLT_CONFIG_PANELS = 4;
66 static constexpr Type contents[DFLT_CONFIG_PANELS][DFLT_CONFIG_BOXES] = {
67 { e_WP_Distance, e_TL_Avg, NavAltitude, e_HeightAGL, e_TL_Gain,
68 e_MacCready, e_TL_Time, e_Thermal_30s, e_TimeLocal },
69 { e_WP_Distance, e_Alternate_1_GR, NavAltitude, e_HeightAGL, e_WP_AltDiff,
70 e_MacCready, e_Speed_GPS, e_GR_Avg, e_GR_Cruise },
71 { e_WP_Distance, e_Alternate_1_GR, NavAltitude, e_HeightAGL, e_Fin_AltDiff,
72 e_MacCready, e_Fin_GR_TE, e_GR_Avg, e_Fin_Time },
73 { e_WP_Name, e_Fin_TimeLocal, e_WP_Distance, e_WP_Time, e_Fin_Distance,
74 e_Fin_Time, e_TimeLocal, e_TimeSinceTakeoff, e_CC_Speed }
77 assert(MAX_PANELS >= DFLT_CONFIG_PANELS);
78 assert(Panel::MAX_CONTENTS >= DFLT_CONFIG_BOXES);
80 panels[0].name = N_("Circling");
81 panels[1].name = N_("Cruise");
82 panels[2].name = N_("FinalGlide");
84 for (unsigned i = PREASSIGNED_PANELS; i < MAX_PANELS; i++)
85 panels[i].name.Format(_T("AUX-%u"), i-2);
87 for (unsigned i = 0; i < DFLT_CONFIG_PANELS; i++)
88 for (unsigned j = 0; j < DFLT_CONFIG_BOXES; j++)
89 panels[i].contents[j] = contents[i][j];