dlgConfiguration: remove Logger Info panel
[xcsoar.git] / src / PageSettings.cpp
blob4ed262e79ddaafbba266fb0a88f444041d680853
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 "PageSettings.hpp"
25 #include "InfoBoxes/InfoBoxSettings.hpp"
26 #include "Language/Language.hpp"
28 #include <algorithm>
30 #include <stdio.h>
32 void
33 PageLayout::MakeTitle(const InfoBoxSettings &info_box_settings,
34 TCHAR *buffer, const bool concise) const
36 if (!valid) {
37 _tcscpy(buffer, _T("---"));
38 return;
41 switch (main) {
42 case PageLayout::Main::MAP:
43 break;
45 case PageLayout::Main::FLARM_RADAR:
46 _tcscpy(buffer, _("FLARM radar"));
47 return;
49 case PageLayout::Main::THERMAL_ASSISTANT:
50 _tcscpy(buffer, _("Thermal assistant"));
51 return;
53 case PageLayout::Main::MAX:
54 gcc_unreachable();
57 if (infobox_config.enabled) {
58 _tcscpy(buffer, concise ? _("Info") : _("Map and InfoBoxes"));
60 if (!infobox_config.auto_switch &&
61 infobox_config.panel < InfoBoxSettings::MAX_PANELS) {
62 _tcscat(buffer, _T(" "));
63 _tcscat(buffer,
64 gettext(info_box_settings.panels[infobox_config.panel].name));
66 else {
67 if (concise) {
68 _tcscat(buffer, _T(" "));
69 _tcscat(buffer, _("Auto"));
70 } else {
71 _tcscat(buffer, _T(" ("));
72 _tcscat(buffer, _("Auto"));
73 _tcscat(buffer, _T(")"));
76 } else {
77 if (concise)
78 _tcscpy(buffer, _("Info Hide"));
79 else
80 _tcscpy(buffer, _("Map (Full screen)"));
83 switch (bottom) {
84 case Bottom::NOTHING:
85 break;
87 case Bottom::CROSS_SECTION:
88 // TODO: better text and translate
89 _tcscat(buffer, _T(", XS"));
90 break;
92 case Bottom::MAX:
93 gcc_unreachable();
97 void
98 PageSettings::SetDefaults()
100 pages[0] = PageLayout::Default();
101 pages[1] = PageLayout::FullScreen();
103 std::fill(pages.begin() + 2, pages.end(), PageLayout::Undefined());
105 n_pages = 2;
107 distinct_zoom = false;
110 void
111 PageSettings::Compress()
113 auto last = std::remove_if(pages.begin(), pages.end(),
114 [](const PageLayout &layout) {
115 return !layout.IsDefined();
117 std::fill(last, pages.end(), PageLayout::Undefined());
118 n_pages = std::distance(pages.begin(), last);