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