10#include <wx/dataview.h>
11#include <wx/datectrl.h>
12#include <wx/datetime.h>
15#include <wx/menuitem.h>
16#include <wx/notebook.h>
17#include <wx/scrolwin.h>
19#include <wx/stattext.h>
21#include <wx/textctrl.h>
22#include <wx/timectrl.h>
26#include "nav_object_database.h"
27#include "ocpn_types.h"
28#include "routeman_gui.h"
30#include "RoutePropDlg.h"
33#if wxCHECK_VERSION(3, 1, 2)
34#define CELL_EDITABLE wxDATAVIEW_CELL_EDITABLE
36#define CELL_EDITABLE wxDATAVIEW_CELL_INERT
41#ifdef __OCPN__ANDROID__
42EVT_CHAR(RoutePropDlg::OnKeyChar)
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"));
56 this->SetSizeHints(wxSize(300, 300), wxDefaultSize);
58 wxBoxSizer* bSizerMain;
59 bSizerMain =
new wxBoxSizer(wxVERTICAL);
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);
68 wxBoxSizer* bSizerName;
69 bSizerName =
new wxBoxSizer(wxHORIZONTAL);
71 m_stName =
new wxStaticText(m_pnlBasic, wxID_ANY, _(
"Name"),
72 wxDefaultPosition, wxDefaultSize, 0);
74 bSizerName->Add(m_stName, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
76 m_tcName =
new wxTextCtrl(m_pnlBasic, wxID_ANY, wxEmptyString,
77 wxDefaultPosition, wxDefaultSize, 0);
78 bSizerName->Add(m_tcName, 1, wxALL, 5);
80 bSizerData->Add(bSizerName, 0, wxEXPAND, 5);
82 wxBoxSizer* bSizerFromTo;
83 bSizerFromTo =
new wxBoxSizer(wxHORIZONTAL);
85 m_stFrom =
new wxStaticText(m_pnlBasic, wxID_ANY, _(
"From"),
86 wxDefaultPosition, wxDefaultSize, 0);
88 bSizerFromTo->Add(m_stFrom, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
90 m_tcFrom =
new wxTextCtrl(m_pnlBasic, wxID_ANY, wxEmptyString,
91 wxDefaultPosition, wxDefaultSize, 0);
92 bSizerFromTo->Add(m_tcFrom, 1, wxALL, 5);
94 m_stTo =
new wxStaticText(m_pnlBasic, wxID_ANY, _(
"To"), wxDefaultPosition,
97 bSizerFromTo->Add(m_stTo, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
99 m_tcTo =
new wxTextCtrl(m_pnlBasic, wxID_ANY, wxEmptyString,
100 wxDefaultPosition, wxDefaultSize, 0);
101 bSizerFromTo->Add(m_tcTo, 1, wxALL, 5);
103 bSizerData->Add(bSizerFromTo, 0, wxEXPAND, 5);
105 wxWrapSizer* wSizerParams;
106 wSizerParams =
new wxWrapSizer(wxHORIZONTAL, wxEXTEND_LAST_ON_EACH_LINE |
107 wxREMOVE_LEADING_SPACES |
108 wxWRAPSIZER_DEFAULT_FLAGS);
110 int maxFieldSize = GetCharWidth() * 10;
112 wxBoxSizer* bSizerDistance;
113 bSizerDistance =
new wxBoxSizer(wxVERTICAL);
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);
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));
126 bSizerDistance->Add(m_tcDistance, 0, wxALL | wxEXPAND, 5);
128 wSizerParams->Add(bSizerDistance, 1, wxEXPAND, 0);
130 wxBoxSizer* bSizerSpeed;
131 bSizerSpeed =
new wxBoxSizer(wxVERTICAL);
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);
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));
144 bSizerSpeed->Add(m_tcPlanSpeed, 0, wxALL, 5);
146 wSizerParams->Add(bSizerSpeed, 1, wxEXPAND, 0);
149 wxBoxSizer* bSizerEnroute;
150 bSizerEnroute =
new wxBoxSizer(wxVERTICAL);
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);
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));
162 bSizerEnroute->Add(m_tcEnroute, 0, wxALL, 5);
164 wSizerParams->Add(bSizerEnroute, 1, wxEXPAND, 0);
167 wxBoxSizer* bSizerDeparture;
168 bSizerDeparture =
new wxBoxSizer(wxVERTICAL);
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);
175 wxBoxSizer* bSizerDepartureTS;
176 bSizerDepartureTS =
new wxBoxSizer(wxHORIZONTAL);
177 bSizerDeparture->Add(bSizerDepartureTS, 0, 0, 5);
180 new wxDatePickerCtrl(m_pnlBasic, wxID_ANY, wxDefaultDateTime,
181 wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT);
182 bSizerDepartureTS->Add(m_dpDepartureDate, 0, wxALIGN_CENTER_VERTICAL | wxALL,
186 m_tpDepartureTime =
new TimeCtrl(m_pnlBasic, wxID_ANY, wxDefaultDateTime,
187 wxDefaultPosition, wxDefaultSize);
190 new wxTimePickerCtrl(m_pnlBasic, wxID_ANY, wxDefaultDateTime,
191 wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT);
193 bSizerDepartureTS->Add(m_tpDepartureTime, 0, wxALIGN_CENTER_VERTICAL | wxALL,
196 wSizerParams->Add(bSizerDeparture, 1, wxEXPAND, 0);
198 wxBoxSizer* bSizerTime;
199 bSizerTime =
new wxBoxSizer(wxVERTICAL);
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);
206 wxString m_choiceTimezoneChoices[] = {_(
"UTC"), _(
"Local@PC"),
208 int m_choiceTimezoneNChoices =
209 sizeof(m_choiceTimezoneChoices) /
sizeof(wxString);
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));
216 bSizerTime->Add(m_choiceTimezone, 0, wxALL, 5);
218 wSizerParams->Add(bSizerTime, 1, wxEXPAND, 0);
220 wxBoxSizer* bSizerColor;
221 bSizerColor =
new wxBoxSizer(wxVERTICAL);
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);
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"),
234 int m_choiceColorNChoices =
sizeof(m_choiceColorChoices) /
sizeof(wxString);
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);
241 wSizerParams->Add(bSizerColor, 1, wxEXPAND, 5);
243 wxBoxSizer* bSizerStyle;
244 bSizerStyle =
new wxBoxSizer(wxVERTICAL);
246 m_stStyle =
new wxStaticText(m_pnlBasic, wxID_ANY, _(
"Style"),
247 wxDefaultPosition, wxDefaultSize, 0);
249 bSizerStyle->Add(m_stStyle, 0, wxALL, 5);
251 wxString m_choiceStyleChoices[] = {_(
"Default"), _(
"Solid"),
252 _(
"Dot"), _(
"Long dash"),
253 _(
"Short dash"), _(
"Dot dash")};
254 int m_choiceStyleNChoices =
sizeof(m_choiceStyleChoices) /
sizeof(wxString);
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);
261 wSizerParams->Add(bSizerStyle, 1, wxEXPAND, 5);
263 wxBoxSizer* bSizerWidth;
264 bSizerWidth =
new wxBoxSizer(wxVERTICAL);
266 m_stWidth =
new wxStaticText(m_pnlBasic, wxID_ANY, _(
"Width"),
267 wxDefaultPosition, wxDefaultSize, 0);
269 bSizerWidth->Add(m_stWidth, 0, wxALL, 5);
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);
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);
281 wSizerParams->Add(bSizerWidth, 1, wxEXPAND, 5);
286 wxString toLabel = _(
"To waypoint");
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};
296 toLabel = _(
"To WP");
299 int columWidths[] = {30, 80, 70,
306 int colFlags = wxDATAVIEW_COL_RESIZABLE;
310 bSizerData->Add(wSizerParams, 0, wxEXPAND, 0);
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(
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);
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);
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);
392 new wxTextCtrl(m_pnlAdvanced, wxID_ANY, wxEmptyString, wxDefaultPosition,
393 wxDefaultSize, wxTE_MULTILINE);
394 bSizerAdvanced->Add(m_tcDescription, 0, wxALL | wxEXPAND, 5);
396 wxStaticBoxSizer* sbSizerLinks;
397 sbSizerLinks =
new wxStaticBoxSizer(
398 new wxStaticBox(m_pnlAdvanced, wxID_ANY, _(
"Links")), wxVERTICAL);
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);
407 bSizerLinks =
new wxBoxSizer(wxVERTICAL);
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();
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);
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);
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);
432 m_hyperlink1->Connect(
434 wxMouseEventHandler(RoutePropDlg::m_hyperlink1OnContextMenu), NULL,
this);
436 bSizerLinks->Add(m_hyperlink1, 0, wxALL, 5);
438 bSizerLinksWnd->Add(bSizerLinks, 1, wxEXPAND, 5);
440 wxBoxSizer* bSizerLinkBtns;
441 bSizerLinkBtns =
new wxBoxSizer(wxHORIZONTAL);
443 m_btnAddLink =
new wxButton(m_scrolledWindowLinks, wxID_ANY, _(
"Add"),
444 wxDefaultPosition, wxDefaultSize, 0);
445 bSizerLinkBtns->Add(m_btnAddLink, 0, wxALL, 5);
448 new wxToggleButton(m_scrolledWindowLinks, wxID_ANY, _(
"Edit"),
449 wxDefaultPosition, wxDefaultSize, 0);
450 bSizerLinkBtns->Add(m_toggleBtnEdit, 0, wxALL, 5);
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);
459 bSizerLinksWnd->Add(bSizerLinkBtns, 0, wxEXPAND, 5);
461 m_scrolledWindowLinks->SetSizer(bSizerLinksWnd);
462 m_scrolledWindowLinks->Layout();
463 bSizerLinksWnd->Fit(m_scrolledWindowLinks);
464 m_menuLinks =
new wxMenu();
465 wxMenuItem* m_menuItemAddLink;
467 new wxMenuItem(m_menuLinks, wxID_ANY, wxString(_(
"Add new")),
468 wxEmptyString, wxITEM_NORMAL);
469 m_menuLinks->Append(m_menuItemAddLink);
471 m_scrolledWindowLinks->Connect(
473 wxMouseEventHandler(RoutePropDlg::m_scrolledWindowLinksOnContextMenu),
476 sbSizerLinks->Add(m_scrolledWindowLinks, 1, wxEXPAND | wxALL, 5);
478 bSizerAdvanced->Add(sbSizerLinks, 1, wxEXPAND, 5);
480 m_pnlAdvanced->SetSizer(bSizerAdvanced);
481 m_pnlAdvanced->Layout();
482 bSizerAdvanced->Fit(m_pnlAdvanced);
483 m_ntbRteProp->AddPage(m_pnlAdvanced, _(
"Advanced"),
false);
485 bSizerMain->Add(m_ntbRteProp, 1, wxEXPAND | wxALL, 5);
487 wxWrapSizer* wSizerCustomBtns;
488 wSizerCustomBtns =
new wxWrapSizer(wxHORIZONTAL, wxWRAPSIZER_DEFAULT_FLAGS);
490 m_btnPrint =
new wxButton(
this, wxID_ANY, _(
"Print"), wxDefaultPosition,
492 wSizerCustomBtns->Add(m_btnPrint, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
494#ifdef __OCPN__ANDROID__
498 m_btnExtend =
new wxButton(
this, wxID_ANY, _(
"Extend"), wxDefaultPosition,
500 wSizerCustomBtns->Add(m_btnExtend, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
502 m_btnSplit =
new wxButton(
this, wxID_ANY, _(
"Split"), wxDefaultPosition,
504 wSizerCustomBtns->Add(m_btnSplit, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
506 wSizerCustomBtns->Add(0, 0, 1, wxEXPAND, 5);
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();
515 wSizerCustomBtns->Add(m_sdbSizerBtns, 1, wxEXPAND, 5);
517 bSizerMain->Add(wSizerCustomBtns, 0, wxEXPAND, 0);
519 this->SetSizer(bSizerMain);
522 this->Centre(wxBOTH);
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),
533 m_tcPlanSpeed->Connect(
534 wxEVT_KILL_FOCUS, wxFocusEventHandler(RoutePropDlg::PlanSpeedOnKillFocus),
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(
544 wxDateEventHandler(RoutePropDlg::DepartureDateOnDateChanged), NULL,
this);
545 m_tpDepartureTime->Connect(
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),
556 m_dvlcWaypoints->Connect(
557 wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE,
558 wxDataViewEventHandler(
559 RoutePropDlg::WaypointsOnDataViewListCtrlItemEditingDone),
561 m_dvlcWaypoints->Connect(
562 wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,
563 wxDataViewEventHandler(
564 RoutePropDlg::WaypointsOnDataViewListCtrlItemValueChanged),
566 m_dvlcWaypoints->Connect(
567 wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED,
568 wxDataViewEventHandler(
569 RoutePropDlg::WaypointsOnDataViewListCtrlSelectionChanged),
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());
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),
593 m_btnExtend->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
594 wxCommandEventHandler(RoutePropDlg::ExtendOnButtonClick),
596 m_btnSplit->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
597 wxCommandEventHandler(RoutePropDlg::SplitOnButtonClick),
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);
606 auto navobj = NavObjectChanges::getInstance();
608 navobj_del_track_listener.Listen(navobj->evt_delete_track,
this,
609 EVT_ROUTEMAN_DEL_TRK);
611 auto t = std::const_pointer_cast<Track>(UnpackEvtPointer<Track>(ev));
612 RoutemanGui(*g_pRouteMan).DeleteTrack(t.get()); });
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));
622RoutePropDlg::~RoutePropDlg() {
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),
632 m_tcPlanSpeed->Disconnect(
633 wxEVT_KILL_FOCUS, wxFocusEventHandler(RoutePropDlg::PlanSpeedOnKillFocus),
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(
643 wxDateEventHandler(RoutePropDlg::DepartureDateOnDateChanged), NULL,
this);
644 m_tpDepartureTime->Disconnect(
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),
655 m_dvlcWaypoints->Disconnect(
656 wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE,
657 wxDataViewEventHandler(
658 RoutePropDlg::WaypointsOnDataViewListCtrlItemEditingDone),
660 m_dvlcWaypoints->Disconnect(
661 wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,
662 wxDataViewEventHandler(
663 RoutePropDlg::WaypointsOnDataViewListCtrlItemValueChanged),
665 m_dvlcWaypoints->Disconnect(
666 wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED,
667 wxDataViewEventHandler(
668 RoutePropDlg::WaypointsOnDataViewListCtrlSelectionChanged),
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);
696void RoutePropDlg::OnKeyChar(wxKeyEvent& event) {
697 int key_char =
event.GetKeyCode();
Adds a std::shared<void> element to wxCommandEvent.
bool DeleteRoute(Route *pRoute, NavObjectChanges *nav_obj_changes)