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 "model/route.h"
42#include "model/route_point.h"
43#include "model/track.h"
44
45#include "observable.h"
46#include "layer.h"
47
48#define NAME_COLUMN 2
49#define DISTANCE_COLUMN 3
50
51enum { SORT_ON_DISTANCE = 1, SORT_ON_NAME, SORT_ON_DATE };
52
53enum TrackContextMenu { TRACK_MERGE = 1, TRACK_COPY_TEXT, TRACK_CLEAN };
54
55class RouteManagerDialog; // forward
58class RouteManagerDialog : public wxFrame {
59 DECLARE_EVENT_TABLE()
60
61public:
62 static RouteManagerDialog *getInstance(wxWindow *parent);
63 static bool getInstanceFlag() { return instanceFlag; }
65
66 void OnClose(wxCloseEvent &event);
67 void OnOK(wxCommandEvent &event);
68
69 void SetColorScheme();
70 void RecalculateSize();
71 void UpdateRouteListCtrl(); // Rebuild route list
72 void UpdateTrkListCtrl();
73 void UpdateWptListCtrl(RoutePoint *rp_select = NULL,
74 bool b_retain_sort = true);
75 void UpdateLayListCtrl();
76 void UpdateWptListCtrlViz();
77
78 void UpdateLists();
79
80 void OnTabSwitch(wxNotebookEvent &event);
81 static void WptShowPropertiesDialog(RoutePoint *wp, wxWindow *parent);
82 void TrackToRoute(Track *track);
83
84private:
85 static bool instanceFlag;
86 static RouteManagerDialog *single;
87
88 RouteManagerDialog(wxWindow *parent);
89
90 void Create();
91 void UpdateRteButtons(); // Correct button state
92 void MakeAllRoutesInvisible(); // Mark all routes as invisible. Does not
93 // flush settings.
94 void ZoomtoRoute(Route *route); // Attempt to zoom route into the view
95 void UpdateTrkButtons(); // Correct button state
96 void UpdateWptButtons(); // Correct button state
97 void UpdateLayButtons(); // Correct button state
98 void ToggleLayerContentsOnChart(Layer *layer);
99 void ToggleLayerContentsOnListing(Layer *layer);
100 void ToggleLayerContentsNames(Layer *layer);
101 void AddNewLayer(bool isPersistent);
102
103 // event handlers
104 void OnRteDeleteClick(wxCommandEvent &event);
105 void OnRtePropertiesClick(wxCommandEvent &event);
106 void OnRteZoomtoClick(wxCommandEvent &event);
107 void OnRteActivateClick(wxCommandEvent &event);
108 void OnRteReverseClick(wxCommandEvent &event);
109 void OnRteExportClick(wxCommandEvent &event);
110 void OnRteResequenceClick(wxCommandEvent &event);
111 void OnRteSendToPeerClick(wxCommandEvent &event);
112 void OnRteToggleVisibility(wxMouseEvent &event);
113 void OnRteBtnLeftDown(
114 wxMouseEvent &event); // record control key state for some action buttons
115 void OnRteDeleteAllClick(wxCommandEvent &event);
116 void OnRteSelected(wxListEvent &event);
117 void OnRteSendToGPSClick(wxCommandEvent &event);
118 void OnRteDefaultAction(wxListEvent &event);
119 void OnRteColumnClicked(wxListEvent &event);
120 void OnTrkDefaultAction(wxListEvent &event);
121 void OnTrkNewClick(wxCommandEvent &event);
122 void OnTrkPropertiesClick(wxCommandEvent &event);
123 void OnTrkDeleteClick(wxCommandEvent &event);
124 void OnTrkExportClick(wxCommandEvent &event);
125 void OnTrkRouteFromTrackClick(wxCommandEvent &event);
126 void OnTrkDeleteAllClick(wxCommandEvent &event);
127 void OnTrkSelected(wxListEvent &event);
128 void OnTrkToggleVisibility(wxMouseEvent &event);
129 void OnTrkColumnClicked(wxListEvent &event);
130 void OnTrkRightClick(wxListEvent &event);
131 void OnTrkMenuSelected(wxCommandEvent &event);
132 void OnTrkSendToPeerClick(wxCommandEvent &event);
133 void OnWptDefaultAction(wxListEvent &event);
134 void OnWptNewClick(wxCommandEvent &event);
135 void OnWptPropertiesClick(wxCommandEvent &event);
136 void OnWptZoomtoClick(wxCommandEvent &event);
137 void OnWptDeleteClick(wxCommandEvent &event);
138 void OnWptGoToClick(wxCommandEvent &event);
139 void OnWptExportClick(wxCommandEvent &event);
140 void OnWptSendToGPSClick(wxCommandEvent &event);
141 void OnWptDeleteAllClick(wxCommandEvent &event);
142 void OnWptSelected(wxListEvent &event);
143 void OnWptToggleVisibility(wxMouseEvent &event);
144 void OnWptColumnClicked(wxListEvent &event);
145 void OnWptSendToPeerClick(wxCommandEvent &event);
146 void OnLayDefaultAction(wxListEvent &event);
147 void OnLayNewClick(wxCommandEvent &event);
148 void OnPerLayNewClick(wxCommandEvent &event);
149 void OnLayPropertiesClick(wxCommandEvent &event);
150 void OnLayToggleChartClick(wxCommandEvent &event);
151 void OnLayToggleListingClick(wxCommandEvent &event);
152 void OnLayToggleNamesClick(wxCommandEvent &event);
153 void OnLayDeleteClick(wxCommandEvent &event);
154 void OnLaySelected(wxListEvent &event);
155 void OnLayToggleVisibility(wxMouseEvent &event);
156 void OnLayColumnClicked(wxListEvent &event);
157 void OnImportClick(wxCommandEvent &event);
158 void OnExportClick(wxCommandEvent &event);
159 void OnExportVizClick(wxCommandEvent &event);
160 void OnBackupClick(wxCommandEvent &event);
161 void OnFilterChanged(wxCommandEvent &event);
162 void OnKey(wxKeyEvent &ke);
163 void OnShowAllRteCBClicked(wxCommandEvent &event);
164 void OnShowAllWpCBClicked(wxCommandEvent &event);
165 void OnShowAllTrkCBClicked(wxCommandEvent &event);
166 void OnShowAllLayCBClicked(wxCommandEvent &event);
167
168 // properties
169 wxNotebook *m_pNotebook;
170 wxPanel *m_pPanelRte;
171 wxPanel *m_pPanelTrk;
172 wxPanel *m_pPanelWpt;
173 wxPanel *m_pPanelLay;
174 wxListCtrl *m_pRouteListCtrl;
175 wxListCtrl *m_pTrkListCtrl;
176 wxListCtrl *m_pWptListCtrl;
177 wxListCtrl *m_pLayListCtrl;
178 wxStaticText *m_stFilterWpt;
179 wxTextCtrl *m_tFilterWpt;
180 wxStaticText *m_stFilterRte;
181 wxTextCtrl *m_tFilterRte;
182 wxStaticText *m_stFilterTrk;
183 wxTextCtrl *m_tFilterTrk;
184 wxStaticText *m_stFilterLay;
185 wxTextCtrl *m_tFilterLay;
186
187 wxButton *btnRteProperties;
188 wxButton *btnRteActivate;
189 wxButton *btnRteZoomto;
190 wxButton *btnRteReverse;
191 wxButton *btnRteDelete;
192 wxButton *btnRteExport;
193 wxButton *btnRteResequence;
194 wxButton *btnRteSendToGPS;
195 wxButton *btnRteSendToPeer;
196 wxButton *btnRteDeleteAll;
197 wxButton *btnTrkNew;
198 wxButton *btnTrkProperties;
199 wxButton *btnTrkDelete;
200 wxButton *btnTrkExport;
201 wxButton *btnTrkRouteFromTrack;
202 wxButton *btnTrkSendToPeer;
203 wxButton *btnTrkDeleteAll;
204 wxButton *btnWptNew;
205 wxButton *btnWptProperties;
206 wxButton *btnWptZoomto;
207 wxButton *btnWptDelete;
208 wxButton *btnWptGoTo;
209 wxButton *btnWptExport;
210 wxButton *btnWptSendToGPS;
211 wxButton *btnWptSendToPeer;
212 wxButton *btnWptDeleteAll;
213 wxButton *btnLayNew;
214 wxButton *btnPerLayNew;
215 // wxButton *btnLayProperties;
216 wxCheckBox *cbLayToggleChart;
217 wxCheckBox *cbLayToggleListing;
218 wxCheckBox *cbLayToggleNames;
219 wxButton *btnLayDelete;
220 wxButton *btnImport;
221 wxButton *btnExport;
222 wxButton *btnExportViz;
223 wxButton *btnBackup;
224 wxCheckBox *m_cbShowAllRte;
225 wxCheckBox *m_cbShowAllWP;
226 wxCheckBox *m_cbShowAllTrk;
227 wxCheckBox *m_cbShowAllLay;
228
229 bool m_bPossibleClick; // do
230 bool m_bCtrlDown; // record control key state for some action buttons
231 bool m_bNeedConfigFlush; // if true, update config in destructor
232
233 int m_lastWptItem;
234 int m_lastTrkItem;
235 int m_lastRteItem;
236
237 int m_charWidth;
238 int m_listIconSize;
239
240 ObsListener routes_update_listener;
241};
242
243#endif // _RouteManagerDialog_h_
Represents a layer of chart objects in OpenCPN.
Definition layer.h:44
Define an action to be performed when a KeyProvider is notified.
Definition observable.h:257
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.
General observable implementation with several specializations.
Route abstraction.
Waypoint or mark abstraction.
RouteManagerDialog * pRouteManagerDialog
Global instance.
Recorded track abstraction.