OpenCPN Partial API docs
Loading...
Searching...
No Matches
routemanagerdialog.h
Go to the documentation of this file.
1/*
2 This program is free software; you can redistribute it and/or
3 modify it under the terms of the GNU General Public License
4 as published by the Free Software Foundation; either version 2
5 of the License, or (at your option) any later version.
6
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
11
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor,
15 Boston, MA 02110-1301, USA.
16
17 ---
18 Copyright (C) 2010, Anders Lund <anders@alweb.dk>
19 */
20
27#ifndef _RouteManagerDialog_h_
28#define _RouteManagerDialog_h_
29
30#include <wx/button.h>
31#include <wx/checkbox.h>
32#include <wx/frame.h>
33#include <wx/list.h>
34#include <wx/listctrl.h>
35#include <wx/notebook.h>
36#include <wx/panel.h>
37#include <wx/stattext.h>
38#include <wx/textctrl.h>
39#include <wx/timer.h>
40
41#include "observable/observable.h"
42
43#include "model/route.h"
44#include "model/route_point.h"
45#include "model/track.h"
46
47#include "layer.h"
48
49#define NAME_COLUMN 2
50#define DISTANCE_COLUMN 3
51
52enum { SORT_ON_DISTANCE = 1, SORT_ON_NAME, SORT_ON_DATE };
53
54enum TrackContextMenu { TRACK_MERGE = 1, TRACK_COPY_TEXT, TRACK_CLEAN };
55
56class RouteManagerDialog; // forward
59class RouteManagerDialog : public wxFrame {
60 DECLARE_EVENT_TABLE()
61
62public:
63 static RouteManagerDialog *getInstance(wxWindow *parent);
64 static bool getInstanceFlag() { return instanceFlag; }
66
67 void OnClose(wxCloseEvent &event);
68 void OnOK(wxCommandEvent &event);
69
70 void SetColorScheme();
71 void RecalculateSize();
72 void UpdateRouteListCtrl(); // Rebuild route list
73 void UpdateTrkListCtrl();
74 void UpdateWptListCtrl(RoutePoint *rp_select = NULL,
75 bool b_retain_sort = true);
76 void UpdateLayListCtrl();
77 void UpdateWptListCtrlViz();
78
79 void UpdateLists();
80
81 void OnTabSwitch(wxNotebookEvent &event);
82 static void WptShowPropertiesDialog(RoutePoint *wp, wxWindow *parent);
83 void TrackToRoute(Track *track);
84
85private:
86 static bool instanceFlag;
87 static RouteManagerDialog *single;
88
89 RouteManagerDialog(wxWindow *parent);
90
91 void Create();
92 void UpdateRteButtons(); // Correct button state
93 void MakeAllRoutesInvisible(); // Mark all routes as invisible. Does not
94 // flush settings.
95 void ZoomtoRoute(Route *route); // Attempt to zoom route into the view
96 void UpdateTrkButtons(); // Correct button state
97 void UpdateWptButtons(); // Correct button state
98 void UpdateLayButtons(); // Correct button state
99 void ToggleLayerContentsOnChart(Layer *layer);
100 void ToggleLayerContentsOnListing(Layer *layer);
101 void ToggleLayerContentsNames(Layer *layer);
102 void AddNewLayer(bool isPersistent);
103
104 // event handlers
105 void OnRteDeleteClick(wxCommandEvent &event);
106 void OnRtePropertiesClick(wxCommandEvent &event);
107 void OnRteZoomtoClick(wxCommandEvent &event);
108 void OnRteActivateClick(wxCommandEvent &event);
109 void OnRteReverseClick(wxCommandEvent &event);
110 void OnRteExportClick(wxCommandEvent &event);
111 void OnRteResequenceClick(wxCommandEvent &event);
112 void OnRteSendToPeerClick(wxCommandEvent &event);
113 void OnRteToggleVisibility(wxMouseEvent &event);
114 void OnRteBtnLeftDown(
115 wxMouseEvent &event); // record control key state for some action buttons
116 void OnRteDeleteAllClick(wxCommandEvent &event);
117 void OnRteSelected(wxListEvent &event);
118 void OnRteSendToGPSClick(wxCommandEvent &event);
119 void OnRteDefaultAction(wxListEvent &event);
120 void OnRteColumnClicked(wxListEvent &event);
121 void OnTrkDefaultAction(wxListEvent &event);
122 void OnTrkNewClick(wxCommandEvent &event);
123 void OnTrkPropertiesClick(wxCommandEvent &event);
124 void OnTrkDeleteClick(wxCommandEvent &event);
125 void OnTrkExportClick(wxCommandEvent &event);
126 void OnTrkRouteFromTrackClick(wxCommandEvent &event);
127 void OnTrkDeleteAllClick(wxCommandEvent &event);
128 void OnTrkSelected(wxListEvent &event);
129 void OnTrkToggleVisibility(wxMouseEvent &event);
130 void OnTrkColumnClicked(wxListEvent &event);
131 void OnTrkRightClick(wxListEvent &event);
132 void OnTrkMenuSelected(wxCommandEvent &event);
133 void OnTrkSendToPeerClick(wxCommandEvent &event);
134 void OnWptDefaultAction(wxListEvent &event);
135 void OnWptNewClick(wxCommandEvent &event);
136 void OnWptPropertiesClick(wxCommandEvent &event);
137 void OnWptZoomtoClick(wxCommandEvent &event);
138 void OnWptDeleteClick(wxCommandEvent &event);
139 void OnWptGoToClick(wxCommandEvent &event);
140 void OnWptExportClick(wxCommandEvent &event);
141 void OnWptSendToGPSClick(wxCommandEvent &event);
142 void OnWptDeleteAllClick(wxCommandEvent &event);
143 void OnWptSelected(wxListEvent &event);
144 void OnWptToggleVisibility(wxMouseEvent &event);
145 void OnWptColumnClicked(wxListEvent &event);
146 void OnWptSendToPeerClick(wxCommandEvent &event);
147 void OnLayDefaultAction(wxListEvent &event);
148 void OnLayNewClick(wxCommandEvent &event);
149 void OnPerLayNewClick(wxCommandEvent &event);
150 void OnLayPropertiesClick(wxCommandEvent &event);
151 void OnLayToggleChartClick(wxCommandEvent &event);
152 void OnLayToggleListingClick(wxCommandEvent &event);
153 void OnLayToggleNamesClick(wxCommandEvent &event);
154 void OnLayDeleteClick(wxCommandEvent &event);
155 void OnLaySelected(wxListEvent &event);
156 void OnLayToggleVisibility(wxMouseEvent &event);
157 void OnLayColumnClicked(wxListEvent &event);
158 void OnImportClick(wxCommandEvent &event);
159 void OnExportClick(wxCommandEvent &event);
160 void OnExportVizClick(wxCommandEvent &event);
161 void OnBackupClick(wxCommandEvent &event);
162 void OnFilterChanged(wxCommandEvent &event);
163 void OnKey(wxKeyEvent &ke);
164 void OnShowAllRteCBClicked(wxCommandEvent &event);
165 void OnShowAllWpCBClicked(wxCommandEvent &event);
166 void OnShowAllTrkCBClicked(wxCommandEvent &event);
167 void OnShowAllLayCBClicked(wxCommandEvent &event);
168
169 // properties
170 wxNotebook *m_pNotebook;
171 wxPanel *m_pPanelRte;
172 wxPanel *m_pPanelTrk;
173 wxPanel *m_pPanelWpt;
174 wxPanel *m_pPanelLay;
175 wxListCtrl *m_pRouteListCtrl;
176 wxListCtrl *m_pTrkListCtrl;
177 wxListCtrl *m_pWptListCtrl;
178 wxListCtrl *m_pLayListCtrl;
179 wxStaticText *m_stFilterWpt;
180 wxTextCtrl *m_tFilterWpt;
181 wxStaticText *m_stFilterRte;
182 wxTextCtrl *m_tFilterRte;
183 wxStaticText *m_stFilterTrk;
184 wxTextCtrl *m_tFilterTrk;
185 wxStaticText *m_stFilterLay;
186 wxTextCtrl *m_tFilterLay;
187
188 wxButton *btnRteProperties;
189 wxButton *btnRteActivate;
190 wxButton *btnRteZoomto;
191 wxButton *btnRteReverse;
192 wxButton *btnRteDelete;
193 wxButton *btnRteExport;
194 wxButton *btnRteResequence;
195 wxButton *btnRteSendToGPS;
196 wxButton *btnRteSendToPeer;
197 wxButton *btnRteDeleteAll;
198 wxButton *btnTrkNew;
199 wxButton *btnTrkProperties;
200 wxButton *btnTrkDelete;
201 wxButton *btnTrkExport;
202 wxButton *btnTrkRouteFromTrack;
203 wxButton *btnTrkSendToPeer;
204 wxButton *btnTrkDeleteAll;
205 wxButton *btnWptNew;
206 wxButton *btnWptProperties;
207 wxButton *btnWptZoomto;
208 wxButton *btnWptDelete;
209 wxButton *btnWptGoTo;
210 wxButton *btnWptExport;
211 wxButton *btnWptSendToGPS;
212 wxButton *btnWptSendToPeer;
213 wxButton *btnWptDeleteAll;
214 wxButton *btnLayNew;
215 wxButton *btnPerLayNew;
216 // wxButton *btnLayProperties;
217 wxCheckBox *cbLayToggleChart;
218 wxCheckBox *cbLayToggleListing;
219 wxCheckBox *cbLayToggleNames;
220 wxButton *btnLayDelete;
221 wxButton *btnImport;
222 wxButton *btnExport;
223 wxButton *btnExportViz;
224 wxButton *btnBackup;
225 wxCheckBox *m_cbShowAllRte;
226 wxCheckBox *m_cbShowAllWP;
227 wxCheckBox *m_cbShowAllTrk;
228 wxCheckBox *m_cbShowAllLay;
229
230 bool m_bPossibleClick; // do
231 bool m_bCtrlDown; // record control key state for some action buttons
232 bool m_bNeedConfigFlush; // if true, update config in destructor
233
234 int m_lastWptItem;
235 int m_lastTrkItem;
236 int m_lastRteItem;
237
238 int m_charWidth;
239 int m_listIconSize;
240
241 obs::Listener routes_update_listener;
242};
243
244#endif // _RouteManagerDialog_h_
Represents a layer of chart objects in OpenCPN.
Definition layer.h:44
Represents a waypoint or mark within the navigation system.
Definition route_point.h:71
Represents a navigational route in the navigation system.
Definition route.h:99
Represents a track, which is a series of connected track points.
Definition track.h:117
Chart object layer.
Route abstraction.
Waypoint or mark abstraction.
RouteManagerDialog * pRouteManagerDialog
Global instance.
Recorded track abstraction.