Renderer, ...: use PixelRect::GetCenter()
[xcsoar.git] / src / Input / InputEventsTraffic.cpp
blobc098a0c77fc08f24d18c1efac19e31796d59d45c
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 "InputEvents.hpp"
25 #include "PageActions.hpp"
26 #include "Interface.hpp"
27 #include "MainWindow.hpp"
28 #include "Gauge/BigTrafficWidget.hpp"
29 #include "FLARM/Glue.hpp"
30 #include "Dialogs/Message.hpp"
31 #include "Dialogs/TextEntry.hpp"
32 #include "Dialogs/Traffic/TrafficDialogs.hpp"
33 #include "Language/Language.hpp"
34 #include "FLARM/FlarmDetails.hpp"
35 #include "FLARM/Glue.hpp"
37 void
38 InputEvents::eventFLARMRadar(gcc_unused const TCHAR *misc)
40 if (StringIsEqual(misc, _T("ForceToggle"))) {
41 CommonInterface::main_window->ToggleForceFLARMRadar();
42 } else
43 CommonInterface::main_window->ToggleSuppressFLARMRadar();
46 // FLARM Traffic
47 // Displays the FLARM traffic dialog
48 void
49 InputEvents::eventFlarmTraffic(gcc_unused const TCHAR *misc)
51 PageActions::ShowTrafficRadar();
54 void
55 InputEvents::eventTraffic(const TCHAR *misc)
57 LoadFlarmDatabases();
59 if (StringIsEqual(misc, _T("show"))) {
60 PageActions::ShowTrafficRadar();
61 return;
64 TrafficWidget *traffic_widget = (TrafficWidget *)
65 CommonInterface::main_window->GetFlavourWidget(_T("Traffic"));
66 if (traffic_widget == nullptr)
67 return;
69 if (StringIsEqual(misc, _T("zoom auto toggle"))) {
70 traffic_widget->ToggleAutoZoom();
71 } else if (StringIsEqual(misc, _T("zoom in"))) {
72 traffic_widget->ZoomIn();
73 } else if (StringIsEqual(misc, _T("zoom out"))) {
74 traffic_widget->ZoomOut();
75 } else if (StringIsEqual(misc, _T("northup toggle"))) {
76 traffic_widget->ToggleNorthUp();
77 } else if (StringIsEqual(misc, _T("details"))) {
78 traffic_widget->OpenDetails();
79 } else if (StringIsEqual(misc, _T("label toggle"))) {
80 traffic_widget->SwitchData();
84 void
85 InputEvents::eventFlarmDetails(gcc_unused const TCHAR *misc)
87 LoadFlarmDatabases();
88 TrafficListDialog();