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