OpenCPN Partial API docs
Loading...
Searching...
No Matches
RoutePropDlg.cpp
1
2// C++ code generated with wxFormBuilder (version Oct 26 2018)
3// http://www.wxformbuilder.org/
4//
5// PLEASE DO *NOT* EDIT THIS FILE! //did that. despite warning.
7
8#include <wx/button.h>
9#include <wx/choice.h>
10#include <wx/dataview.h>
11#include <wx/datectrl.h>
12#include <wx/datetime.h>
13#include <wx/font.h>
14#include <wx/gdicmn.h>
15#include <wx/menuitem.h>
16#include <wx/notebook.h>
17#include <wx/scrolwin.h>
18#include <wx/sizer.h>
19#include <wx/stattext.h>
20#include <wx/string.h>
21#include <wx/textctrl.h>
22#include <wx/timectrl.h>
23#include <wx/window.h>
24
25#include "gui_lib.h"
26#include "nav_object_database.h"
27#include "ocpn_types.h"
28#include "routeman_gui.h"
29#include "routeman.h"
30#include "RoutePropDlg.h"
31#include "styles.h"
32
33#if wxCHECK_VERSION(3, 1, 2)
34#define CELL_EDITABLE wxDATAVIEW_CELL_EDITABLE
35#else
36#define CELL_EDITABLE wxDATAVIEW_CELL_INERT
37#endif
38
40BEGIN_EVENT_TABLE(RoutePropDlg, wxFrame)
41#ifdef __OCPN__ANDROID__
42EVT_CHAR(RoutePropDlg::OnKeyChar)
43#endif
44END_EVENT_TABLE()
45
46
47extern Routeman *g_pRouteMan;
48
49RoutePropDlg::RoutePropDlg(wxWindow* parent, wxWindowID id,
50 const wxString& title, const wxPoint& pos,
51 const wxSize& size, long style)
52 : wxFrame(parent, id, title, pos, size, style) {
53 wxFont* qFont = GetOCPNScaledFont(_("Dialog"));
54 SetFont(*qFont);
55
56 this->SetSizeHints(wxSize(300, 300), wxDefaultSize);
57
58 wxBoxSizer* bSizerMain;
59 bSizerMain = new wxBoxSizer(wxVERTICAL);
60
61 m_ntbRteProp =
62 new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
63 m_pnlBasic = new wxPanel(m_ntbRteProp, wxID_ANY, wxDefaultPosition,
64 wxDefaultSize, wxTAB_TRAVERSAL);
65 wxBoxSizer* bSizerData;
66 bSizerData = new wxBoxSizer(wxVERTICAL);
67
68 wxBoxSizer* bSizerName;
69 bSizerName = new wxBoxSizer(wxHORIZONTAL);
70
71 m_stName = new wxStaticText(m_pnlBasic, wxID_ANY, _("Name"),
72 wxDefaultPosition, wxDefaultSize, 0);
73 m_stName->Wrap(-1);
74 bSizerName->Add(m_stName, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
75
76 m_tcName = new wxTextCtrl(m_pnlBasic, wxID_ANY, wxEmptyString,
77 wxDefaultPosition, wxDefaultSize, 0);
78 bSizerName->Add(m_tcName, 1, wxALL, 5);
79
80 bSizerData->Add(bSizerName, 0, wxEXPAND, 5);
81
82 wxBoxSizer* bSizerFromTo;
83 bSizerFromTo = new wxBoxSizer(wxHORIZONTAL);
84
85 m_stFrom = new wxStaticText(m_pnlBasic, wxID_ANY, _("From"),
86 wxDefaultPosition, wxDefaultSize, 0);
87 m_stFrom->Wrap(-1);
88 bSizerFromTo->Add(m_stFrom, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
89
90 m_tcFrom = new wxTextCtrl(m_pnlBasic, wxID_ANY, wxEmptyString,
91 wxDefaultPosition, wxDefaultSize, 0);
92 bSizerFromTo->Add(m_tcFrom, 1, wxALL, 5);
93
94 m_stTo = new wxStaticText(m_pnlBasic, wxID_ANY, _("To"), wxDefaultPosition,
95 wxDefaultSize, 0);
96 m_stTo->Wrap(-1);
97 bSizerFromTo->Add(m_stTo, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
98
99 m_tcTo = new wxTextCtrl(m_pnlBasic, wxID_ANY, wxEmptyString,
100 wxDefaultPosition, wxDefaultSize, 0);
101 bSizerFromTo->Add(m_tcTo, 1, wxALL, 5);
102
103 bSizerData->Add(bSizerFromTo, 0, wxEXPAND, 5);
104
105 wxWrapSizer* wSizerParams;
106 wSizerParams = new wxWrapSizer(wxHORIZONTAL, wxEXTEND_LAST_ON_EACH_LINE |
107 wxREMOVE_LEADING_SPACES |
108 wxWRAPSIZER_DEFAULT_FLAGS);
109
110 int maxFieldSize = GetCharWidth() * 10;
111
112 wxBoxSizer* bSizerDistance;
113 bSizerDistance = new wxBoxSizer(wxVERTICAL);
114
115 m_stDistTotal = new wxStaticText(m_pnlBasic, wxID_ANY, _("Distance"),
116 wxDefaultPosition, wxDefaultSize, 0);
117 m_stDistTotal->Wrap(-1);
118 bSizerDistance->Add(m_stDistTotal, 0, wxALL, 5);
119
120 m_tcDistance =
121 new wxTextCtrl(m_pnlBasic, wxID_ANY, wxEmptyString, wxDefaultPosition,
122 wxDefaultSize, wxTE_READONLY);
123 m_tcDistance->SetMaxSize(wxSize(maxFieldSize, -1));
124 m_tcDistance->SetMinSize(wxSize(maxFieldSize, -1));
125
126 bSizerDistance->Add(m_tcDistance, 0, wxALL | wxEXPAND, 5);
127
128 wSizerParams->Add(bSizerDistance, 1, wxEXPAND, 0);
129
130 wxBoxSizer* bSizerSpeed;
131 bSizerSpeed = new wxBoxSizer(wxVERTICAL);
132
133 m_stPlanSpeed = new wxStaticText(m_pnlBasic, wxID_ANY, _("Plan speed"),
134 wxDefaultPosition, wxDefaultSize, 0);
135 m_stPlanSpeed->Wrap(-1);
136 bSizerSpeed->Add(m_stPlanSpeed, 0, wxALL, 5);
137
138 m_tcPlanSpeed =
139 new wxTextCtrl(m_pnlBasic, wxID_ANY, wxEmptyString, wxDefaultPosition,
140 wxDefaultSize, wxTE_PROCESS_ENTER);
141 m_tcPlanSpeed->SetMaxSize(wxSize(maxFieldSize, -1));
142 m_tcPlanSpeed->SetMinSize(wxSize(maxFieldSize, -1));
143
144 bSizerSpeed->Add(m_tcPlanSpeed, 0, wxALL, 5);
145
146 wSizerParams->Add(bSizerSpeed, 1, wxEXPAND, 0);
147
148 //
149 wxBoxSizer* bSizerEnroute;
150 bSizerEnroute = new wxBoxSizer(wxVERTICAL);
151
152 m_stEnroute = new wxStaticText(m_pnlBasic, wxID_ANY, _("Enroute"),
153 wxDefaultPosition, wxDefaultSize, 0);
154 m_stEnroute->Wrap(-1);
155 bSizerEnroute->Add(m_stEnroute, 0, wxALL, 5);
156
157 m_tcEnroute = new wxTextCtrl(m_pnlBasic, wxID_ANY, wxEmptyString,
158 wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
159 m_tcEnroute->SetMaxSize(wxSize(maxFieldSize, -1));
160 m_tcEnroute->SetMinSize(wxSize(maxFieldSize, -1));
161
162 bSizerEnroute->Add(m_tcEnroute, 0, wxALL, 5);
163
164 wSizerParams->Add(bSizerEnroute, 1, wxEXPAND, 0);
165
166 //
167 wxBoxSizer* bSizerDeparture;
168 bSizerDeparture = new wxBoxSizer(wxVERTICAL);
169
170 m_stDeparture = new wxStaticText(m_pnlBasic, wxID_ANY, _("Departure"),
171 wxDefaultPosition, wxDefaultSize, 0);
172 m_stDeparture->Wrap(-1);
173 bSizerDeparture->Add(m_stDeparture, 0, wxALL, 5);
174
175 wxBoxSizer* bSizerDepartureTS;
176 bSizerDepartureTS = new wxBoxSizer(wxHORIZONTAL);
177 bSizerDeparture->Add(bSizerDepartureTS, 0, 0, 5);
178
179 m_dpDepartureDate =
180 new wxDatePickerCtrl(m_pnlBasic, wxID_ANY, wxDefaultDateTime,
181 wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT);
182 bSizerDepartureTS->Add(m_dpDepartureDate, 0, wxALIGN_CENTER_VERTICAL | wxALL,
183 5);
184
185#ifdef __WXGTK__
186 m_tpDepartureTime = new TimeCtrl(m_pnlBasic, wxID_ANY, wxDefaultDateTime,
187 wxDefaultPosition, wxDefaultSize);
188#else
189 m_tpDepartureTime =
190 new wxTimePickerCtrl(m_pnlBasic, wxID_ANY, wxDefaultDateTime,
191 wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT);
192#endif
193 bSizerDepartureTS->Add(m_tpDepartureTime, 0, wxALIGN_CENTER_VERTICAL | wxALL,
194 5);
195
196 wSizerParams->Add(bSizerDeparture, 1, wxEXPAND, 0);
197
198 wxBoxSizer* bSizerTime;
199 bSizerTime = new wxBoxSizer(wxVERTICAL);
200
201 m_stTimeZone = new wxStaticText(m_pnlBasic, wxID_ANY, _("Time"),
202 wxDefaultPosition, wxDefaultSize, 0);
203 m_stTimeZone->Wrap(-1);
204 bSizerTime->Add(m_stTimeZone, 0, wxALL, 5);
205
206 wxString m_choiceTimezoneChoices[] = {_("UTC"), _("Local@PC"),
207 _("LMT@Location")};
208 int m_choiceTimezoneNChoices =
209 sizeof(m_choiceTimezoneChoices) / sizeof(wxString);
210 m_choiceTimezone =
211 new wxChoice(m_pnlBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize,
212 m_choiceTimezoneNChoices, m_choiceTimezoneChoices, 0);
213 m_choiceTimezone->SetSelection(0);
214 m_choiceTimezone->SetMaxSize(wxSize(GetCharWidth() * 12, -1));
215
216 bSizerTime->Add(m_choiceTimezone, 0, wxALL, 5);
217
218 wSizerParams->Add(bSizerTime, 1, wxEXPAND, 0);
219
220 wxBoxSizer* bSizerColor;
221 bSizerColor = new wxBoxSizer(wxVERTICAL);
222
223 m_staticTextColor = new wxStaticText(m_pnlBasic, wxID_ANY, _("Color"),
224 wxDefaultPosition, wxDefaultSize, 0);
225 m_staticTextColor->Wrap(-1);
226 bSizerColor->Add(m_staticTextColor, 0, wxALL, 5);
227
228 wxString m_choiceColorChoices[] = {
229 _("Default color"), _("Black"), _("Dark Red"), _("Dark Green"),
230 _("Dark Yellow"), _("Dark Blue"), _("Dark Magenta"), _("Dark Cyan"),
231 _("Light Gray"), _("Dark Gray"), _("Red"), _("Green"),
232 _("Yellow"), _("Blue"), _("Magenta"), _("Cyan"),
233 _("White")};
234 int m_choiceColorNChoices = sizeof(m_choiceColorChoices) / sizeof(wxString);
235 m_choiceColor =
236 new wxChoice(m_pnlBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize,
237 m_choiceColorNChoices, m_choiceColorChoices, 0);
238 m_choiceColor->SetSelection(0);
239 bSizerColor->Add(m_choiceColor, 0, wxALL, 5);
240
241 wSizerParams->Add(bSizerColor, 1, wxEXPAND, 5);
242
243 wxBoxSizer* bSizerStyle;
244 bSizerStyle = new wxBoxSizer(wxVERTICAL);
245
246 m_stStyle = new wxStaticText(m_pnlBasic, wxID_ANY, _("Style"),
247 wxDefaultPosition, wxDefaultSize, 0);
248 m_stStyle->Wrap(-1);
249 bSizerStyle->Add(m_stStyle, 0, wxALL, 5);
250
251 wxString m_choiceStyleChoices[] = {_("Default"), _("Solid"),
252 _("Dot"), _("Long dash"),
253 _("Short dash"), _("Dot dash")};
254 int m_choiceStyleNChoices = sizeof(m_choiceStyleChoices) / sizeof(wxString);
255 m_choiceStyle =
256 new wxChoice(m_pnlBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize,
257 m_choiceStyleNChoices, m_choiceStyleChoices, 0);
258 m_choiceStyle->SetSelection(0);
259 bSizerStyle->Add(m_choiceStyle, 0, wxALL, 5);
260
261 wSizerParams->Add(bSizerStyle, 1, wxEXPAND, 5);
262
263 wxBoxSizer* bSizerWidth;
264 bSizerWidth = new wxBoxSizer(wxVERTICAL);
265
266 m_stWidth = new wxStaticText(m_pnlBasic, wxID_ANY, _("Width"),
267 wxDefaultPosition, wxDefaultSize, 0);
268 m_stWidth->Wrap(-1);
269 bSizerWidth->Add(m_stWidth, 0, wxALL, 5);
270
271 wxString m_choiceWidthChoices[] = {
272 _("Default"), _("1 px"), _("2px"), _("3 px"), _("4 px"), _("5 px"),
273 _("6 px"), _("7 px"), _("8 px"), _("9 px"), _("10 px")};
274 int m_choiceWidthNChoices = sizeof(m_choiceWidthChoices) / sizeof(wxString);
275 m_choiceWidth =
276 new wxChoice(m_pnlBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize,
277 m_choiceWidthNChoices, m_choiceWidthChoices, 0);
278 m_choiceWidth->SetSelection(0);
279 bSizerWidth->Add(m_choiceWidth, 0, wxALL, 5);
280
281 wSizerParams->Add(bSizerWidth, 1, wxEXPAND, 5);
282
283 // wxDataViewListCtrl has some platform dependent variability
284 // We account for this here...
285
286 wxString toLabel = _("To waypoint");
287
288#ifdef __WXQT__ // includes Android
289 int columWidths[] = {
290 wxCOL_WIDTH_AUTOSIZE, wxCOL_WIDTH_AUTOSIZE, wxCOL_WIDTH_AUTOSIZE,
291 wxCOL_WIDTH_AUTOSIZE, wxCOL_WIDTH_AUTOSIZE, wxCOL_WIDTH_AUTOSIZE,
292 wxCOL_WIDTH_AUTOSIZE, wxCOL_WIDTH_AUTOSIZE, wxCOL_WIDTH_AUTOSIZE,
293 wxCOL_WIDTH_AUTOSIZE, wxCOL_WIDTH_AUTOSIZE, wxCOL_WIDTH_AUTOSIZE,
294 wxCOL_WIDTH_AUTOSIZE, wxCOL_WIDTH_AUTOSIZE, wxCOL_WIDTH_AUTOSIZE};
295 int colFlags = 0;
296 toLabel = _("To WP");
297
298#else
299 int columWidths[] = {30, 80, 70,
300 60, // Bearing
301 100, // Distance Total
302 90, 90, 80, 120,
303 60, // Speed
304 100, // Next tide event
305 -1, 80, 120, -1};
306 int colFlags = wxDATAVIEW_COL_RESIZABLE;
307
308#endif
309
310 bSizerData->Add(wSizerParams, 0, wxEXPAND, 0);
311
312 m_dvlcWaypoints =
313 new wxDataViewListCtrl(m_pnlBasic, wxID_ANY, wxDefaultPosition,
314 wxDefaultSize, wxDV_VERT_RULES | wxDV_HORIZ_RULES);
315 m_dataViewListColumnLeg = m_dvlcWaypoints->AppendTextColumn(
316 _("Leg"), wxDATAVIEW_CELL_INERT, columWidths[0],
317 static_cast<wxAlignment>(wxALIGN_LEFT), colFlags);
318 m_dataViewListColumnLeg->GetRenderer()->EnableEllipsize(wxELLIPSIZE_NONE);
319 m_dataViewListColumnToWpt = m_dvlcWaypoints->AppendTextColumn(
320 toLabel, wxDATAVIEW_CELL_INERT, columWidths[1],
321 static_cast<wxAlignment>(wxALIGN_LEFT), colFlags);
322 m_dataViewListColumnToWpt->GetRenderer()->EnableEllipsize(wxELLIPSIZE_END);
323 m_dataViewListColumnDistance = m_dvlcWaypoints->AppendTextColumn(
324 _("Distance"), wxDATAVIEW_CELL_INERT, columWidths[2],
325 static_cast<wxAlignment>(wxALIGN_LEFT), colFlags);
326 m_dataViewListColumnDistance->GetRenderer()->EnableEllipsize(wxELLIPSIZE_END);
327 m_dataViewListColumnBearing = m_dvlcWaypoints->AppendTextColumn(
328 _("Bearing"), wxDATAVIEW_CELL_INERT, columWidths[3],
329 static_cast<wxAlignment>(wxALIGN_LEFT), colFlags);
330 m_dataViewListColumnBearing->GetRenderer()->EnableEllipsize(wxELLIPSIZE_END);
331 m_dataViewListColumnTotalDistance = m_dvlcWaypoints->AppendTextColumn(
332 _("Total Distance"), wxDATAVIEW_CELL_INERT, columWidths[4],
333 static_cast<wxAlignment>(wxALIGN_LEFT), colFlags);
334 m_dataViewListColumnTotalDistance->GetRenderer()->EnableEllipsize(
335 wxELLIPSIZE_END);
336 m_dataViewListColumnLat = m_dvlcWaypoints->AppendTextColumn(
337 _("Latitude"), wxDATAVIEW_CELL_INERT, columWidths[5],
338 static_cast<wxAlignment>(wxALIGN_LEFT), colFlags);
339 m_dataViewListColumnLat->GetRenderer()->EnableEllipsize(wxELLIPSIZE_END);
340 m_dataViewListColumnLon = m_dvlcWaypoints->AppendTextColumn(
341 _("Longitude"), wxDATAVIEW_CELL_INERT, columWidths[6],
342 static_cast<wxAlignment>(wxALIGN_LEFT), colFlags);
343 m_dataViewListColumnLon->GetRenderer()->EnableEllipsize(wxELLIPSIZE_END);
344 m_dataViewListColumnETE = m_dvlcWaypoints->AppendTextColumn(
345 _("ETE"), wxDATAVIEW_CELL_INERT, columWidths[7],
346 static_cast<wxAlignment>(wxALIGN_LEFT), colFlags);
347 m_dataViewListColumnETE->GetRenderer()->EnableEllipsize(wxELLIPSIZE_END);
348 m_dataViewListColumnETA = m_dvlcWaypoints->AppendTextColumn(
349 _("ETA"), wxDATAVIEW_CELL_INERT, columWidths[8],
350 static_cast<wxAlignment>(wxALIGN_LEFT), colFlags);
351 m_dataViewListColumnETA->GetRenderer()->EnableEllipsize(wxELLIPSIZE_END);
352 m_dataViewListColumnSpeed = m_dvlcWaypoints->AppendTextColumn(
353 _("Speed"), CELL_EDITABLE, columWidths[9],
354 static_cast<wxAlignment>(wxALIGN_LEFT), colFlags);
355 m_dataViewListColumnSpeed->GetRenderer()->EnableEllipsize(wxELLIPSIZE_END);
356 m_dataViewListColumnNTE = m_dvlcWaypoints->AppendTextColumn(
357 _("Next tide event"), wxDATAVIEW_CELL_INERT, columWidths[10],
358 static_cast<wxAlignment>(wxALIGN_LEFT), colFlags);
359 m_dataViewListColumnNTE->GetRenderer()->EnableEllipsize(wxELLIPSIZE_END);
360 m_dataViewListColumnDesc = m_dvlcWaypoints->AppendTextColumn(
361 _("Description"), wxDATAVIEW_CELL_INERT, columWidths[11],
362 static_cast<wxAlignment>(wxALIGN_LEFT), colFlags);
363 m_dataViewListColumnDesc->GetRenderer()->EnableEllipsize(wxELLIPSIZE_END);
364 m_dataViewListColumnCourse = m_dvlcWaypoints->AppendTextColumn(
365 _("Course"), wxDATAVIEW_CELL_INERT, columWidths[12],
366 static_cast<wxAlignment>(wxALIGN_LEFT), colFlags);
367 m_dataViewListColumnCourse->GetRenderer()->EnableEllipsize(wxELLIPSIZE_END);
368 m_dataViewListColumnETD = m_dvlcWaypoints->AppendTextColumn(
369 _("ETD"), CELL_EDITABLE, columWidths[13],
370 static_cast<wxAlignment>(wxALIGN_LEFT), colFlags);
371 m_dataViewListColumnETD->GetRenderer()->EnableEllipsize(wxELLIPSIZE_END);
372 m_dataViewListColumnEmpty = m_dvlcWaypoints->AppendTextColumn(
373 wxEmptyString, wxDATAVIEW_CELL_INERT, columWidths[14],
374 static_cast<wxAlignment>(wxALIGN_LEFT), colFlags);
375 bSizerData->Add(m_dvlcWaypoints, 1, wxALL | wxEXPAND, 5);
376
377 m_pnlBasic->SetSizer(bSizerData);
378 m_pnlBasic->Layout();
379 bSizerData->Fit(m_pnlBasic);
380 m_ntbRteProp->AddPage(m_pnlBasic, _("Basic"), false);
381 m_pnlAdvanced = new wxPanel(m_ntbRteProp, wxID_ANY, wxDefaultPosition,
382 wxDefaultSize, wxTAB_TRAVERSAL);
383 wxBoxSizer* bSizerAdvanced;
384 bSizerAdvanced = new wxBoxSizer(wxVERTICAL);
385
386 m_stDescription = new wxStaticText(m_pnlAdvanced, wxID_ANY, _("Description"),
387 wxDefaultPosition, wxDefaultSize, 0);
388 m_stDescription->Wrap(-1);
389 bSizerAdvanced->Add(m_stDescription, 0, wxALL, 5);
390
391 m_tcDescription =
392 new wxTextCtrl(m_pnlAdvanced, wxID_ANY, wxEmptyString, wxDefaultPosition,
393 wxDefaultSize, wxTE_MULTILINE);
394 bSizerAdvanced->Add(m_tcDescription, 0, wxALL | wxEXPAND, 5);
395
396 wxStaticBoxSizer* sbSizerLinks;
397 sbSizerLinks = new wxStaticBoxSizer(
398 new wxStaticBox(m_pnlAdvanced, wxID_ANY, _("Links")), wxVERTICAL);
399
400 m_scrolledWindowLinks = new wxScrolledWindow(
401 sbSizerLinks->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize,
402 wxHSCROLL | wxVSCROLL);
403 m_scrolledWindowLinks->SetScrollRate(5, 5);
404 wxBoxSizer* bSizerLinksWnd;
405 bSizerLinksWnd = new wxBoxSizer(wxVERTICAL);
406
407 bSizerLinks = new wxBoxSizer(wxVERTICAL);
408
409 m_hyperlink1 =
410 new wxHyperlinkCtrl(m_scrolledWindowLinks, wxID_ANY, _("wxFB Website"),
411 wxT("http://www.wxformbuilder.org"),
412 wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
413 m_hyperlink1->Enable(false);
414 m_hyperlink1->Hide();
415
416 m_menuLink = new wxMenu();
417 wxMenuItem* m_menuItemEdit;
418 m_menuItemEdit = new wxMenuItem(m_menuLink, wxID_ANY, wxString(_("Edit")),
419 wxEmptyString, wxITEM_NORMAL);
420 m_menuLink->Append(m_menuItemEdit);
421
422 wxMenuItem* m_menuItemAdd;
423 m_menuItemAdd = new wxMenuItem(m_menuLink, wxID_ANY, wxString(_("Add new")),
424 wxEmptyString, wxITEM_NORMAL);
425 m_menuLink->Append(m_menuItemAdd);
426
427 wxMenuItem* m_menuItemDelete;
428 m_menuItemDelete = new wxMenuItem(m_menuLink, wxID_ANY, wxString(_("Delete")),
429 wxEmptyString, wxITEM_NORMAL);
430 m_menuLink->Append(m_menuItemDelete);
431
432 m_hyperlink1->Connect(
433 wxEVT_RIGHT_DOWN,
434 wxMouseEventHandler(RoutePropDlg::m_hyperlink1OnContextMenu), NULL, this);
435
436 bSizerLinks->Add(m_hyperlink1, 0, wxALL, 5);
437
438 bSizerLinksWnd->Add(bSizerLinks, 1, wxEXPAND, 5);
439
440 wxBoxSizer* bSizerLinkBtns;
441 bSizerLinkBtns = new wxBoxSizer(wxHORIZONTAL);
442
443 m_btnAddLink = new wxButton(m_scrolledWindowLinks, wxID_ANY, _("Add"),
444 wxDefaultPosition, wxDefaultSize, 0);
445 bSizerLinkBtns->Add(m_btnAddLink, 0, wxALL, 5);
446
447 m_toggleBtnEdit =
448 new wxToggleButton(m_scrolledWindowLinks, wxID_ANY, _("Edit"),
449 wxDefaultPosition, wxDefaultSize, 0);
450 bSizerLinkBtns->Add(m_toggleBtnEdit, 0, wxALL, 5);
451
452 m_stEditEnabled =
453 new wxStaticText(m_scrolledWindowLinks, wxID_ANY,
454 _("Links are opened in the default browser."),
455 wxDefaultPosition, wxDefaultSize, 0);
456 m_stEditEnabled->Wrap(-1);
457 bSizerLinkBtns->Add(m_stEditEnabled, 0, wxALL, 5);
458
459 bSizerLinksWnd->Add(bSizerLinkBtns, 0, wxEXPAND, 5);
460
461 m_scrolledWindowLinks->SetSizer(bSizerLinksWnd);
462 m_scrolledWindowLinks->Layout();
463 bSizerLinksWnd->Fit(m_scrolledWindowLinks);
464 m_menuLinks = new wxMenu();
465 wxMenuItem* m_menuItemAddLink;
466 m_menuItemAddLink =
467 new wxMenuItem(m_menuLinks, wxID_ANY, wxString(_("Add new")),
468 wxEmptyString, wxITEM_NORMAL);
469 m_menuLinks->Append(m_menuItemAddLink);
470
471 m_scrolledWindowLinks->Connect(
472 wxEVT_RIGHT_DOWN,
473 wxMouseEventHandler(RoutePropDlg::m_scrolledWindowLinksOnContextMenu),
474 NULL, this);
475
476 sbSizerLinks->Add(m_scrolledWindowLinks, 1, wxEXPAND | wxALL, 5);
477
478 bSizerAdvanced->Add(sbSizerLinks, 1, wxEXPAND, 5);
479
480 m_pnlAdvanced->SetSizer(bSizerAdvanced);
481 m_pnlAdvanced->Layout();
482 bSizerAdvanced->Fit(m_pnlAdvanced);
483 m_ntbRteProp->AddPage(m_pnlAdvanced, _("Advanced"), false);
484
485 bSizerMain->Add(m_ntbRteProp, 1, wxEXPAND | wxALL, 5);
486
487 wxWrapSizer* wSizerCustomBtns;
488 wSizerCustomBtns = new wxWrapSizer(wxHORIZONTAL, wxWRAPSIZER_DEFAULT_FLAGS);
489
490 m_btnPrint = new wxButton(this, wxID_ANY, _("Print"), wxDefaultPosition,
491 wxDefaultSize, 0);
492 wSizerCustomBtns->Add(m_btnPrint, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
493
494#ifdef __OCPN__ANDROID__
495 m_btnPrint->Hide();
496#endif
497
498 m_btnExtend = new wxButton(this, wxID_ANY, _("Extend"), wxDefaultPosition,
499 wxDefaultSize, 0);
500 wSizerCustomBtns->Add(m_btnExtend, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
501
502 m_btnSplit = new wxButton(this, wxID_ANY, _("Split"), wxDefaultPosition,
503 wxDefaultSize, 0);
504 wSizerCustomBtns->Add(m_btnSplit, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
505
506 wSizerCustomBtns->Add(0, 0, 1, wxEXPAND, 5);
507
508 m_sdbSizerBtns = new wxStdDialogButtonSizer();
509 m_sdbSizerBtnsOK = new wxButton(this, wxID_OK);
510 m_sdbSizerBtns->AddButton(m_sdbSizerBtnsOK);
511 m_sdbSizerBtnsCancel = new wxButton(this, wxID_CANCEL, _("Cancel"));
512 m_sdbSizerBtns->AddButton(m_sdbSizerBtnsCancel);
513 m_sdbSizerBtns->Realize();
514
515 wSizerCustomBtns->Add(m_sdbSizerBtns, 1, wxEXPAND, 5);
516
517 bSizerMain->Add(wSizerCustomBtns, 0, wxEXPAND, 0);
518
519 this->SetSizer(bSizerMain);
520 this->Layout();
521
522 this->Centre(wxBOTH);
523
524 // Connect Events
525 this->Connect(wxEVT_CLOSE_WINDOW,
526 wxCloseEventHandler(RoutePropDlg::RoutePropDlgOnClose));
527 this->Connect(wxEVT_SIZE,
528 wxSizeEventHandler(RoutePropDlg::RoutePropDlgOnSize));
529 m_ntbRteProp->Connect(
530 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
531 wxNotebookEventHandler(RoutePropDlg::RoutePropDlgOnNotebookPageChanged),
532 NULL, this);
533 m_tcPlanSpeed->Connect(
534 wxEVT_KILL_FOCUS, wxFocusEventHandler(RoutePropDlg::PlanSpeedOnKillFocus),
535 NULL, this);
536 m_tcPlanSpeed->Connect(
537 wxEVT_COMMAND_TEXT_ENTER,
538 wxCommandEventHandler(RoutePropDlg::PlanSpeedOnTextEnter), NULL, this);
539 m_tcPlanSpeed->Connect(
540 wxEVT_COMMAND_TEXT_UPDATED,
541 wxCommandEventHandler(RoutePropDlg::PlanSpeedOnTextEnter), NULL, this);
542 m_dpDepartureDate->Connect(
543 wxEVT_DATE_CHANGED,
544 wxDateEventHandler(RoutePropDlg::DepartureDateOnDateChanged), NULL, this);
545 m_tpDepartureTime->Connect(
546 wxEVT_TIME_CHANGED,
547 wxDateEventHandler(RoutePropDlg::DepartureTimeOnTimeChanged), NULL, this);
548 m_choiceTimezone->Connect(
549 wxEVT_COMMAND_CHOICE_SELECTED,
550 wxCommandEventHandler(RoutePropDlg::TimezoneOnChoice), NULL, this);
551 m_dvlcWaypoints->Connect(
552 wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU,
553 wxDataViewEventHandler(
554 RoutePropDlg::WaypointsOnDataViewListCtrlItemContextMenu),
555 NULL, this);
556 m_dvlcWaypoints->Connect(
557 wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE,
558 wxDataViewEventHandler(
559 RoutePropDlg::WaypointsOnDataViewListCtrlItemEditingDone),
560 NULL, this);
561 m_dvlcWaypoints->Connect(
562 wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,
563 wxDataViewEventHandler(
564 RoutePropDlg::WaypointsOnDataViewListCtrlItemValueChanged),
565 NULL, this);
566 m_dvlcWaypoints->Connect(
567 wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED,
568 wxDataViewEventHandler(
569 RoutePropDlg::WaypointsOnDataViewListCtrlSelectionChanged),
570 NULL, this);
571 m_menuLink->Bind(wxEVT_COMMAND_MENU_SELECTED,
572 wxCommandEventHandler(RoutePropDlg::ItemEditOnMenuSelection),
573 this, m_menuItemEdit->GetId());
574 m_menuLink->Bind(wxEVT_COMMAND_MENU_SELECTED,
575 wxCommandEventHandler(RoutePropDlg::ItemAddOnMenuSelection),
576 this, m_menuItemAdd->GetId());
577 m_menuLink->Bind(
578 wxEVT_COMMAND_MENU_SELECTED,
579 wxCommandEventHandler(RoutePropDlg::ItemDeleteOnMenuSelection), this,
580 m_menuItemDelete->GetId());
581 m_btnAddLink->Connect(
582 wxEVT_COMMAND_BUTTON_CLICKED,
583 wxCommandEventHandler(RoutePropDlg::AddLinkOnButtonClick), NULL, this);
584 m_toggleBtnEdit->Connect(
585 wxEVT_COMMAND_TOGGLEBUTTON_CLICKED,
586 wxCommandEventHandler(RoutePropDlg::BtnEditOnToggleButton), NULL, this);
587 m_menuLinks->Bind(wxEVT_COMMAND_MENU_SELECTED,
588 wxCommandEventHandler(RoutePropDlg::ItemAddOnMenuSelection),
589 this, m_menuItemAddLink->GetId());
590 m_btnPrint->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
591 wxCommandEventHandler(RoutePropDlg::PrintOnButtonClick),
592 NULL, this);
593 m_btnExtend->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
594 wxCommandEventHandler(RoutePropDlg::ExtendOnButtonClick),
595 NULL, this);
596 m_btnSplit->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
597 wxCommandEventHandler(RoutePropDlg::SplitOnButtonClick),
598 NULL, this);
599 m_sdbSizerBtnsCancel->Connect(
600 wxEVT_COMMAND_BUTTON_CLICKED,
601 wxCommandEventHandler(RoutePropDlg::BtnsOnCancelButtonClick), NULL, this);
602 m_sdbSizerBtnsOK->Connect(
603 wxEVT_COMMAND_BUTTON_CLICKED,
604 wxCommandEventHandler(RoutePropDlg::BtnsOnOKButtonClick), NULL, this);
605
606 auto navobj = NavObjectChanges::getInstance();
607 wxDEFINE_EVENT(EVT_ROUTEMAN_DEL_TRK, ObservedEvt);
608 navobj_del_track_listener.Listen(navobj->evt_delete_track, this,
609 EVT_ROUTEMAN_DEL_TRK);
610 Bind(EVT_ROUTEMAN_DEL_TRK, [&](ObservedEvt& ev) {
611 auto t = std::const_pointer_cast<Track>(UnpackEvtPointer<Track>(ev));
612 RoutemanGui(*g_pRouteMan).DeleteTrack(t.get()); });
613
614 wxDEFINE_EVENT(EVT_ROUTEMAN_DEL_ROUTE, ObservedEvt);
615 navobj_del_route_listener.Listen(navobj->evt_delete_route, this,
616 EVT_ROUTEMAN_DEL_ROUTE);
617 Bind(EVT_ROUTEMAN_DEL_ROUTE, [&](ObservedEvt& ev) {
618 auto r = std::const_pointer_cast<Route>(UnpackEvtPointer<Route>(ev));
619 g_pRouteMan->DeleteRoute(r.get(), navobj); });
620}
621
622RoutePropDlg::~RoutePropDlg() {
623 // Disconnect Events
624 this->Disconnect(wxEVT_CLOSE_WINDOW,
625 wxCloseEventHandler(RoutePropDlg::RoutePropDlgOnClose));
626 this->Disconnect(wxEVT_SIZE,
627 wxSizeEventHandler(RoutePropDlg::RoutePropDlgOnSize));
628 m_ntbRteProp->Disconnect(
629 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
630 wxNotebookEventHandler(RoutePropDlg::RoutePropDlgOnNotebookPageChanged),
631 NULL, this);
632 m_tcPlanSpeed->Disconnect(
633 wxEVT_KILL_FOCUS, wxFocusEventHandler(RoutePropDlg::PlanSpeedOnKillFocus),
634 NULL, this);
635 m_tcPlanSpeed->Disconnect(
636 wxEVT_COMMAND_TEXT_ENTER,
637 wxCommandEventHandler(RoutePropDlg::PlanSpeedOnTextEnter), NULL, this);
638 m_tcPlanSpeed->Disconnect(
639 wxEVT_COMMAND_TEXT_UPDATED,
640 wxCommandEventHandler(RoutePropDlg::PlanSpeedOnTextEnter), NULL, this);
641 m_dpDepartureDate->Disconnect(
642 wxEVT_DATE_CHANGED,
643 wxDateEventHandler(RoutePropDlg::DepartureDateOnDateChanged), NULL, this);
644 m_tpDepartureTime->Disconnect(
645 wxEVT_TIME_CHANGED,
646 wxDateEventHandler(RoutePropDlg::DepartureTimeOnTimeChanged), NULL, this);
647 m_choiceTimezone->Disconnect(
648 wxEVT_COMMAND_CHOICE_SELECTED,
649 wxCommandEventHandler(RoutePropDlg::TimezoneOnChoice), NULL, this);
650 m_dvlcWaypoints->Disconnect(
651 wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU,
652 wxDataViewEventHandler(
653 RoutePropDlg::WaypointsOnDataViewListCtrlItemContextMenu),
654 NULL, this);
655 m_dvlcWaypoints->Disconnect(
656 wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE,
657 wxDataViewEventHandler(
658 RoutePropDlg::WaypointsOnDataViewListCtrlItemEditingDone),
659 NULL, this);
660 m_dvlcWaypoints->Disconnect(
661 wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,
662 wxDataViewEventHandler(
663 RoutePropDlg::WaypointsOnDataViewListCtrlItemValueChanged),
664 NULL, this);
665 m_dvlcWaypoints->Disconnect(
666 wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED,
667 wxDataViewEventHandler(
668 RoutePropDlg::WaypointsOnDataViewListCtrlSelectionChanged),
669 NULL, this);
670 m_btnAddLink->Disconnect(
671 wxEVT_COMMAND_BUTTON_CLICKED,
672 wxCommandEventHandler(RoutePropDlg::AddLinkOnButtonClick), NULL, this);
673 m_toggleBtnEdit->Disconnect(
674 wxEVT_COMMAND_TOGGLEBUTTON_CLICKED,
675 wxCommandEventHandler(RoutePropDlg::BtnEditOnToggleButton), NULL, this);
676 m_btnPrint->Disconnect(
677 wxEVT_COMMAND_BUTTON_CLICKED,
678 wxCommandEventHandler(RoutePropDlg::PrintOnButtonClick), NULL, this);
679 m_btnExtend->Disconnect(
680 wxEVT_COMMAND_BUTTON_CLICKED,
681 wxCommandEventHandler(RoutePropDlg::ExtendOnButtonClick), NULL, this);
682 m_btnSplit->Disconnect(
683 wxEVT_COMMAND_BUTTON_CLICKED,
684 wxCommandEventHandler(RoutePropDlg::SplitOnButtonClick), NULL, this);
685 m_sdbSizerBtnsCancel->Disconnect(
686 wxEVT_COMMAND_BUTTON_CLICKED,
687 wxCommandEventHandler(RoutePropDlg::BtnsOnCancelButtonClick), NULL, this);
688 m_sdbSizerBtnsOK->Disconnect(
689 wxEVT_COMMAND_BUTTON_CLICKED,
690 wxCommandEventHandler(RoutePropDlg::BtnsOnOKButtonClick), NULL, this);
691
692 delete m_menuLink;
693 delete m_menuLinks;
694}
695
696void RoutePropDlg::OnKeyChar(wxKeyEvent& event) {
697 int key_char = event.GetKeyCode();
698 int yyp = 4;
699}
Adds a std::shared<void> element to wxCommandEvent.
Definition: ocpn_plugin.h:1615
Class RoutePropDlg.
Definition: RoutePropDlg.h:53
bool DeleteRoute(Route *pRoute, NavObjectChanges *nav_obj_changes)
Definition: routeman.cpp:726