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.
25 #include "UIState.hpp"
26 #include "Interface.hpp"
27 #include "ActionInterface.hpp"
28 #include "MainWindow.hpp"
29 #include "CrossSection/CrossSectionWidget.hpp"
30 #include "InfoBoxes/InfoBoxManager.hpp"
31 #include "InfoBoxes/InfoBoxSettings.hpp"
32 #include "Language/Language.hpp"
38 static unsigned current_page
= 0;
44 const PageSettings
&settings
= CommonInterface::GetUISettings().pages
;
46 if (!settings
.pages
[current_page
].IsDefined())
47 current_page
= NextIndex();
49 OpenLayout(settings
.pages
[current_page
]);
56 const PageSettings
&settings
= CommonInterface::GetUISettings().pages
;
58 unsigned i
= current_page
;
60 i
= (i
+ 1) % PageSettings::MAX_PAGES
;
61 } while (!settings
.pages
[i
].IsDefined());
69 current_page
= NextIndex();
77 const PageSettings
&settings
= CommonInterface::GetUISettings().pages
;
79 unsigned i
= current_page
;
81 i
= (i
== 0) ? PageSettings::MAX_PAGES
- 1 : i
- 1;
82 } while (!settings
.pages
[i
].IsDefined());
90 current_page
= PrevIndex();
95 Pages::Open(unsigned page
)
97 const PageSettings
&settings
= CommonInterface::GetUISettings().pages
;
99 if (page
>= PageSettings::MAX_PAGES
)
102 if (!settings
.pages
[page
].IsDefined())
111 Pages::OpenLayout(const PageSettings::PageLayout
&layout
)
113 UIState
&ui_state
= CommonInterface::SetUIState();
118 if (!layout
.infobox_config
.enabled
) {
119 CommonInterface::main_window
->SetFullScreen(true);
120 ui_state
.auxiliary_enabled
= false;
122 if (!layout
.infobox_config
.auto_switch
&&
123 layout
.infobox_config
.panel
< InfoBoxSettings::MAX_PANELS
) {
124 CommonInterface::main_window
->SetFullScreen(false);
125 ui_state
.auxiliary_enabled
= true;
126 ui_state
.auxiliary_index
= layout
.infobox_config
.panel
;
129 CommonInterface::main_window
->SetFullScreen(false);
130 ui_state
.auxiliary_enabled
= false;
134 switch (layout
.bottom
) {
135 case PageSettings::PageLayout::Bottom::NOTHING
:
136 CommonInterface::main_window
->SetBottomWidget(nullptr);
139 case PageSettings::PageLayout::Bottom::CROSS_SECTION
:
140 CommonInterface::main_window
->SetBottomWidget(new CrossSectionWidget());
144 ActionInterface::UpdateDisplayMode();
145 ActionInterface::SendUIState();