27#include "model/georef.h"
28#include "model/navutil_base.h"
29#include "model/own_ship.h"
31#include "model/route.h"
32#include "model/routeman.h"
33#include "model/select.h"
34#include "model/track.h"
40#include "ocpn_frame.h"
41#include "OCPNPlatform.h"
42#include "pluginmanager.h"
43#include "routemanagerdialog.h"
44#include "routeman_gui.h"
45#include "trackprintout.h"
46#include "TrackPropDlg.h"
49#include "androidUTIL.h"
58#define GLOBAL_SETTINGS_INPUT 3
61#define DISPLAY_FORMAT 2
62#define TIMESTAMP_FORMAT 3
64extern std::vector<Track*> g_TrackList;
72bool TrackPropDlg::instanceFlag =
false;
74TrackPropDlg* TrackPropDlg::getInstance(wxWindow* parent, wxWindowID
id,
75 const wxString& title,
76 const wxPoint& pos,
const wxSize& size,
79 single =
new TrackPropDlg(parent,
id, title, pos, size, style);
87TrackPropDlg::TrackPropDlg(wxWindow* parent, wxWindowID
id,
88 const wxString& title,
const wxPoint& pos,
89 const wxSize& size,
long style)
90 : DIALOG_PARENT(parent, id, title, pos, size, style) {
94 SetWindowStyleFlag(style);
96 m_scrolledWindowLinks = NULL;
97 m_tDescription = NULL;
103 CreateControlsCompact();
113 m_sdbBtmBtnsSizerCancel->Connect(
114 wxEVT_COMMAND_BUTTON_CLICKED,
115 wxCommandEventHandler(TrackPropDlg::OnCancelBtnClick), NULL,
this);
116 m_sdbBtmBtnsSizerOK->Connect(
117 wxEVT_COMMAND_BUTTON_CLICKED,
118 wxCommandEventHandler(TrackPropDlg::OnOKBtnClick), NULL,
this);
119 if (m_sdbBtmBtnsSizerPrint)
120 m_sdbBtmBtnsSizerPrint->Connect(
121 wxEVT_COMMAND_BUTTON_CLICKED,
122 wxCommandEventHandler(TrackPropDlg::OnPrintBtnClick), NULL,
this);
123 m_sdbBtmBtnsSizerSplit->Connect(
124 wxEVT_COMMAND_BUTTON_CLICKED,
125 wxCommandEventHandler(TrackPropDlg::OnSplitBtnClick), NULL,
this);
126 m_sdbBtmBtnsSizerExtend->Connect(
127 wxEVT_COMMAND_BUTTON_CLICKED,
128 wxCommandEventHandler(TrackPropDlg::OnExtendBtnClick), NULL,
this);
129 m_sdbBtmBtnsSizerToRoute->Connect(
130 wxEVT_COMMAND_BUTTON_CLICKED,
131 wxCommandEventHandler(TrackPropDlg::OnToRouteBtnClick), NULL,
this);
132 if (m_sdbBtmBtnsSizerExport)
133 m_sdbBtmBtnsSizerExport->Connect(
134 wxEVT_COMMAND_BUTTON_CLICKED,
135 wxCommandEventHandler(TrackPropDlg::OnExportBtnClick), NULL,
this);
136 m_lcPoints->Connect(wxEVT_COMMAND_LIST_ITEM_SELECTED,
137 wxListEventHandler(TrackPropDlg::OnTrackPropListClick),
139 Connect(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK,
140 wxListEventHandler(TrackPropDlg::OnTrackPropRightClick), NULL,
this);
141 Connect(wxEVT_COMMAND_MENU_SELECTED,
142 wxCommandEventHandler(TrackPropDlg::OnTrackPropMenuSelected), NULL,
146 Connect(wxEVT_ACTIVATE, wxActivateEventHandler(TrackPropDlg::OnActivate),
151 m_buttonAddLink->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
152 wxCommandEventHandler(TrackPropDlg::OnAddLink),
154 m_toggleBtnEdit->Connect(
155 wxEVT_COMMAND_TOGGLEBUTTON_CLICKED,
156 wxCommandEventHandler(TrackPropDlg::OnEditLinkToggle), NULL,
this);
160 m_rbShowTimeUTC->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
161 wxCommandEventHandler(TrackPropDlg::OnShowTimeTZ),
164 m_rbShowTimePC->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
165 wxCommandEventHandler(TrackPropDlg::OnShowTimeTZ),
167 if (m_rbShowTimeLocal)
168 m_rbShowTimeLocal->Connect(
169 wxEVT_COMMAND_RADIOBUTTON_SELECTED,
170 wxCommandEventHandler(TrackPropDlg::OnShowTimeTZ), NULL,
this);
172 if (m_rbShowTimeGlobalSettings)
173 m_rbShowTimeGlobalSettings->Connect(
174 wxEVT_COMMAND_RADIOBUTTON_SELECTED,
175 wxCommandEventHandler(TrackPropDlg::OnShowTimeTZ), NULL,
this);
177 m_pMyLinkList = NULL;
180TrackPropDlg::~TrackPropDlg() {
182 m_sdbBtmBtnsSizerCancel->Disconnect(
183 wxEVT_COMMAND_BUTTON_CLICKED,
184 wxCommandEventHandler(TrackPropDlg::OnCancelBtnClick), NULL,
this);
185 m_sdbBtmBtnsSizerOK->Disconnect(
186 wxEVT_COMMAND_BUTTON_CLICKED,
187 wxCommandEventHandler(TrackPropDlg::OnOKBtnClick), NULL,
this);
188 if (m_sdbBtmBtnsSizerPrint)
189 m_sdbBtmBtnsSizerPrint->Disconnect(
190 wxEVT_COMMAND_BUTTON_CLICKED,
191 wxCommandEventHandler(TrackPropDlg::OnPrintBtnClick), NULL,
this);
192 m_sdbBtmBtnsSizerSplit->Disconnect(
193 wxEVT_COMMAND_BUTTON_CLICKED,
194 wxCommandEventHandler(TrackPropDlg::OnSplitBtnClick), NULL,
this);
195 m_sdbBtmBtnsSizerExtend->Disconnect(
196 wxEVT_COMMAND_BUTTON_CLICKED,
197 wxCommandEventHandler(TrackPropDlg::OnExtendBtnClick), NULL,
this);
198 m_sdbBtmBtnsSizerToRoute->Disconnect(
199 wxEVT_COMMAND_BUTTON_CLICKED,
200 wxCommandEventHandler(TrackPropDlg::OnToRouteBtnClick), NULL,
this);
201 if (m_sdbBtmBtnsSizerExport)
202 m_sdbBtmBtnsSizerExport->Disconnect(
203 wxEVT_COMMAND_BUTTON_CLICKED,
204 wxCommandEventHandler(TrackPropDlg::OnExportBtnClick), NULL,
this);
205 m_lcPoints->Disconnect(wxEVT_COMMAND_LIST_ITEM_SELECTED,
206 wxListEventHandler(TrackPropDlg::OnTrackPropListClick),
208 Disconnect(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK,
209 wxListEventHandler(TrackPropDlg::OnTrackPropRightClick), NULL,
211 Disconnect(wxEVT_COMMAND_MENU_SELECTED,
212 wxCommandEventHandler(TrackPropDlg::OnTrackPropMenuSelected), NULL,
215 Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED,
217 Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED,
218 wxCommandEventHandler(TrackPropDlg::OnEditLink));
219 Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED,
220 wxCommandEventHandler(TrackPropDlg::OnAddLink));
223 m_buttonAddLink->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED,
224 wxCommandEventHandler(TrackPropDlg::OnAddLink),
226 m_toggleBtnEdit->Disconnect(
227 wxEVT_COMMAND_TOGGLEBUTTON_CLICKED,
228 wxCommandEventHandler(TrackPropDlg::OnEditLinkToggle), NULL,
this);
232 m_rbShowTimeUTC->Disconnect(
233 wxEVT_COMMAND_RADIOBUTTON_SELECTED,
234 wxCommandEventHandler(TrackPropDlg::OnShowTimeTZ), NULL,
this);
237 wxEVT_COMMAND_RADIOBUTTON_SELECTED,
238 wxCommandEventHandler(TrackPropDlg::OnShowTimeTZ), NULL,
this);
241 wxEVT_COMMAND_RADIOBUTTON_SELECTED,
242 wxCommandEventHandler(TrackPropDlg::OnShowTimeTZ), NULL,
this);
245 wxEVT_COMMAND_RADIOBUTTON_SELECTED,
246 wxCommandEventHandler(TrackPropDlg::OnShowTimeTZ), NULL,
this);
248 instanceFlag =
false;
251static wxString getDatetimeTimezoneSelector(
int selection) {
259 case GLOBAL_SETTINGS_INPUT:
261 return wxEmptyString;
265void TrackPropDlg::OnActivate(wxActivateEvent& event) {
266 auto pWin =
dynamic_cast<DIALOG_PARENT*
>(
event.GetEventObject());
267 long int style = pWin->GetWindowStyle();
268 if (event.GetActive())
269 pWin->SetWindowStyle(style | wxSTAY_ON_TOP);
271 pWin->SetWindowStyle(style ^ wxSTAY_ON_TOP);
274void TrackPropDlg::RecalculateSize(
void) {
278 esize.x = GetCharWidth() * 110;
279 esize.y = GetCharHeight() * 40;
281 wxSize dsize = GetParent()->GetClientSize();
282 esize.y = wxMin(esize.y, dsize.y - (2 * GetCharHeight()));
283 esize.x = wxMin(esize.x, dsize.x - (2 * GetCharHeight()));
284 SetClientSize(esize);
286 wxSize fsize = GetSize();
287 fsize.y = wxMin(fsize.y, dsize.y - (2 * GetCharHeight()));
288 fsize.x = wxMin(fsize.x, dsize.x - (2 * GetCharHeight()));
292 int sy = GetCharHeight() * m_lcPoints->GetItemCount();
295 m_lcPoints->SetSize(wxSize(GetClientSize().x - 40, sy));
297 if (m_lcPoints->GetItemCount()) Layout();
303static void addColumns(wxListCtrl* lctrl,
int dx) {
304 lctrl->InsertColumn(0, _(
"Leg"), wxLIST_FORMAT_LEFT, dx * 6);
305 lctrl->InsertColumn(1, _(
"Distance"), wxLIST_FORMAT_LEFT, dx * 11);
306 lctrl->InsertColumn(2, _(
"Bearing"), wxLIST_FORMAT_LEFT, dx * 8);
308 lctrl->InsertColumn(3, _(
"Latitude"), wxLIST_FORMAT_LEFT, dx * 15);
309 lctrl->InsertColumn(4, _(
"Longitude"), wxLIST_FORMAT_LEFT, dx * 15);
312 lctrl->InsertColumn(5, _(
"Timestamp"), wxLIST_FORMAT_LEFT, dx * 26);
313 lctrl->InsertColumn(6, _(
"Speed"), wxLIST_FORMAT_CENTER, dx * 8);
315 lctrl->SetMinSize(wxSize(-1, 50));
318void TrackPropDlg::CreateControlsCompact() {
319 wxBoxSizer* itemBoxSizer1 =
new wxBoxSizer(wxVERTICAL);
320 SetSizer(itemBoxSizer1);
322 itemDialog1 =
new wxScrolledWindow(
this, wxID_ANY, wxDefaultPosition,
323 wxSize(-1, -1), wxVSCROLL);
324 itemDialog1->SetScrollRate(0, 1);
330 wxString wqs = getFontQtStylesheet(qFont);
331 wxCharBuffer sbuf = wqs.ToUTF8();
332 QString qsb = QString(sbuf.data());
334 QString qsbq = getQtStyleSheet();
336 itemDialog1->GetHandle()->setStyleSheet(qsb +
340 itemBoxSizer1->Add(itemDialog1, 1, wxEXPAND | wxALL, 0);
342 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
343 itemDialog1->SetSizer(itemBoxSizer2);
345 wxStaticText* itemStaticText4 =
new wxStaticText(
346 itemDialog1, wxID_STATIC, _(
"Name"), wxDefaultPosition, wxDefaultSize, 0);
347 itemBoxSizer2->Add(itemStaticText4, 0,
348 wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5);
350 m_tName =
new wxTextCtrl(itemDialog1, wxID_ANY, _T(
""), wxDefaultPosition,
352 itemBoxSizer2->Add(m_tName, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5);
354 wxStaticText* itemStaticText7 =
355 new wxStaticText(itemDialog1, wxID_STATIC, _(
"Depart From"),
356 wxDefaultPosition, wxDefaultSize, 0);
357 itemBoxSizer2->Add(itemStaticText7, 0,
358 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
361 m_tFrom =
new wxTextCtrl(itemDialog1, wxID_ANY, _T(
""), wxDefaultPosition,
363 itemBoxSizer2->Add(m_tFrom, 0,
364 wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
365 wxLEFT | wxRIGHT | wxBOTTOM,
368 wxStaticText* itemStaticText8 =
369 new wxStaticText(itemDialog1, wxID_STATIC, _(
"Destination"),
370 wxDefaultPosition, wxDefaultSize, 0);
371 itemBoxSizer2->Add(itemStaticText8, 0,
372 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
375 m_tTo =
new wxTextCtrl(itemDialog1, wxID_ANY, _T(
""), wxDefaultPosition,
377 itemBoxSizer2->Add(m_tTo, 0,
378 wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
379 wxLEFT | wxRIGHT | wxBOTTOM,
382 m_cbShow =
new wxCheckBox(itemDialog1, wxID_ANY, _(
"Show on chart"),
383 wxDefaultPosition, wxDefaultSize, 0);
384 itemBoxSizer2->Add(m_cbShow, 0, wxALL, 5);
386 wxFlexGridSizer* itemFlexGridSizer6a =
new wxFlexGridSizer(4, 2, 0, 0);
387 itemFlexGridSizer6a->AddGrowableCol(1, 0);
389 itemBoxSizer2->Add(itemFlexGridSizer6a, 0, wxEXPAND | wxALIGN_LEFT | wxALL,
392 wxStaticText* itemStaticText11 =
393 new wxStaticText(itemDialog1, wxID_STATIC, _(
"Total distance"),
394 wxDefaultPosition, wxDefaultSize, 0);
395 itemFlexGridSizer6a->Add(
397 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxTOP, 5);
400 new wxTextCtrl(itemDialog1, wxID_ANY, _T(
""), wxDefaultPosition,
401 wxSize(-1, -1), wxTE_READONLY);
402 itemFlexGridSizer6a->Add(m_tTotDistance, 0,
403 wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
404 wxLEFT | wxRIGHT | wxBOTTOM,
407 m_stAvgSpeed =
new wxStaticText(itemDialog1, wxID_STATIC, _(
"Avg. speed"),
408 wxDefaultPosition, wxDefaultSize, 0);
409 itemFlexGridSizer6a->Add(
411 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxTOP, 5);
413 m_tAvgSpeed =
new wxTextCtrl(itemDialog1, wxID_ANY, _T(
""), wxDefaultPosition,
414 wxSize(150, -1), wxTE_PROCESS_ENTER);
415 itemFlexGridSizer6a->Add(
417 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM, 5);
420 new wxStaticText(itemDialog1, wxID_STATIC, _(
"Time Enroute"),
421 wxDefaultPosition, wxDefaultSize, 0);
422 itemFlexGridSizer6a->Add(
424 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxTOP, 5);
427 new wxTextCtrl(itemDialog1, wxID_ANY, _T(
""), wxDefaultPosition,
428 wxSize(-1, -1), wxTE_READONLY);
429 itemFlexGridSizer6a->Add(m_tTimeEnroute, 0,
430 wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
431 wxLEFT | wxRIGHT | wxBOTTOM,
448 wxString pDispTimeZone[] = {_(
"UTC"), _(
"Local Time"), _(
"LMT@Location"),
449 _(
"Honor Global Settings")};
451 wxStaticText* itemStaticText12b =
452 new wxStaticText(itemDialog1, wxID_STATIC, _(
"Time shown as"),
453 wxDefaultPosition, wxDefaultSize, 0);
454 itemBoxSizer2->Add(itemStaticText12b, 0, wxEXPAND | wxALL, 5);
457 new wxRadioButton(itemDialog1, wxID_ANY, _(
"UTC"), wxDefaultPosition,
458 wxDefaultSize, wxRB_GROUP);
461 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM, 5);
463 m_rbShowTimePC =
new wxRadioButton(itemDialog1, wxID_ANY, _(
"Local Time"));
466 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM, 5);
469 new wxRadioButton(itemDialog1, wxID_ANY, _(
"LMT@Location"));
472 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM, 5);
475 new wxRadioButton(itemDialog1, wxID_ANY, _(
"Honor Global Settings"));
478 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM, 5);
480 wxFlexGridSizer* itemFlexGridSizer6b =
new wxFlexGridSizer(3, 2, 0, 0);
481 itemBoxSizer2->Add(itemFlexGridSizer6b, 0, wxEXPAND | wxALIGN_LEFT | wxALL,
484 wxStaticText* m_staticText1 =
485 new wxStaticText(itemDialog1, wxID_ANY, _(
"Color") + _T(
":"),
486 wxDefaultPosition, wxDefaultSize, 0);
487 itemFlexGridSizer6b->Add(m_staticText1, 0, wxALIGN_CENTER_VERTICAL | wxALL,
490 wxString m_chColorChoices[] = {
491 _(
"Default color"), _(
"Black"), _(
"Dark Red"), _(
"Dark Green"),
492 _(
"Dark Yellow"), _(
"Dark Blue"), _(
"Dark Magenta"), _(
"Dark Cyan"),
493 _(
"Light Gray"), _(
"Dark Gray"), _(
"Red"), _(
"Green"),
494 _(
"Yellow"), _(
"Blue"), _(
"Magenta"), _(
"Cyan"),
496 int m_chColorNChoices =
sizeof(m_chColorChoices) /
sizeof(wxString);
498 new wxChoice(itemDialog1, wxID_ANY, wxDefaultPosition, wxSize(250, -1),
499 m_chColorNChoices, m_chColorChoices, 0);
500 m_cColor->SetSelection(0);
501 itemFlexGridSizer6b->Add(m_cColor, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
503 wxStaticText* staticTextStyle =
504 new wxStaticText(itemDialog1, wxID_ANY, _(
"Style") + _T(
":"),
505 wxDefaultPosition, wxDefaultSize, 0);
506 itemFlexGridSizer6b->Add(staticTextStyle, 0, wxALIGN_CENTER_VERTICAL | wxALL,
509 wxString m_chStyleChoices[] = {_(
"Default"), _(
"Solid"), _(
"Dot"),
510 _(
"Long dash"), _(
"Short dash")};
511 int m_chStyleNChoices =
sizeof(m_chStyleChoices) /
sizeof(wxString);
513 new wxChoice(itemDialog1, wxID_ANY, wxDefaultPosition, wxDefaultSize,
514 m_chStyleNChoices, m_chStyleChoices, 0);
515 m_cStyle->SetSelection(0);
516 itemFlexGridSizer6b->Add(m_cStyle, 0,
517 wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 5);
520 staticTextStyle->Hide();
524 m_stWidth =
new wxStaticText(itemDialog1, wxID_ANY, _(
"Width") + _T(
":"),
525 wxDefaultPosition, wxDefaultSize, 0);
526 itemFlexGridSizer6b->Add(m_stWidth, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
528 wxString m_chWidthChoices[] = {_(
"Default"), _(
"1 pixel"), _(
"2 pixels"),
529 _(
"3 pixels"), _(
"4 pixels"), _(
"5 pixels"),
530 _(
"6 pixels"), _(
"7 pixels"), _(
"8 pixels"),
531 _(
"9 pixels"), _(
"10 pixels")};
532 int m_chWidthNChoices =
sizeof(m_chWidthChoices) /
sizeof(wxString);
534 new wxChoice(itemDialog1, wxID_ANY, wxDefaultPosition, wxSize(150, -1),
535 m_chWidthNChoices, m_chWidthChoices, 0);
536 m_cWidth->SetSelection(0);
537 itemFlexGridSizer6b->Add(m_cWidth, 0,
538 wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 5);
540 wxStaticBox* itemStaticBoxSizer14Static =
541 new wxStaticBox(itemDialog1, wxID_ANY, _(
"Waypoints"));
542 wxStaticBoxSizer* m_pListSizer =
543 new wxStaticBoxSizer(itemStaticBoxSizer14Static, wxVERTICAL);
544 itemBoxSizer2->Add(m_pListSizer, 1, wxEXPAND | wxALL, 1);
546 wxScrolledWindow* itemlistWin =
547 new wxScrolledWindow(itemDialog1, wxID_ANY, wxDefaultPosition,
548 wxDefaultSize, wxHSCROLL | wxVSCROLL);
549 itemlistWin->SetScrollRate(2, 2);
551 m_pListSizer->Add(itemlistWin, 0, wxEXPAND | wxALL, 6);
553 long flags = wxLC_REPORT | wxLC_HRULES | wxLC_VRULES | wxLC_EDIT_LABELS;
555 flags |= wxLC_VIRTUAL;
559 wxSize(100, 500), flags);
560 addColumns(m_lcPoints, GetCharWidth());
565 m_lcPoints->GetHandle()->setStyleSheet(getQtStyleSheet());
570 wxBoxSizer* itemBoxSizerBottom =
new wxBoxSizer(wxVERTICAL);
571 itemBoxSizer1->Add(itemBoxSizerBottom, 0, wxALIGN_LEFT | wxALL | wxEXPAND, 5);
575 wxFlexGridSizer* itemBoxSizerAux =
new wxFlexGridSizer(0, n_col, 0, 0);
576 itemBoxSizerAux->SetFlexibleDirection(wxBOTH);
577 itemBoxSizerAux->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
579 itemBoxSizerBottom->Add(itemBoxSizerAux, 1, wxALIGN_LEFT | wxALL, 5);
583 m_sdbBtmBtnsSizerPrint =
new wxButton(
this, wxID_ANY, _(
"Print"),
584 wxDefaultPosition, wxDefaultSize, 0);
585 itemBoxSizerAux->Add(m_sdbBtmBtnsSizerPrint, 0,
586 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5);
587 m_sdbBtmBtnsSizerPrint->Enable(
true);
589 m_sdbBtmBtnsSizerPrint = NULL;
592 m_sdbBtmBtnsSizerSplit =
new wxButton(
this, wxID_ANY, _(
"Split"),
593 wxDefaultPosition, wxDefaultSize, 0);
594 itemBoxSizerAux->Add(m_sdbBtmBtnsSizerSplit, 0,
595 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5);
596 m_sdbBtmBtnsSizerSplit->Enable(
false);
598 m_sdbBtmBtnsSizerExtend =
new wxButton(
this, wxID_ANY, _(
"Extend"),
599 wxDefaultPosition, wxDefaultSize, 0);
600 itemBoxSizerAux->Add(m_sdbBtmBtnsSizerExtend, 0,
601 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5);
603 m_sdbBtmBtnsSizerToRoute =
new wxButton(
this, wxID_ANY, _(
"To route"),
604 wxDefaultPosition, wxDefaultSize, 0);
605 itemBoxSizerAux->Add(m_sdbBtmBtnsSizerToRoute, 0,
606 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5);
608 m_sdbBtmBtnsSizerExport = NULL;
614 wxBoxSizer* itemBoxSizer16 =
new wxBoxSizer(wxHORIZONTAL);
615 itemBoxSizerBottom->Add(itemBoxSizer16, 0, wxALIGN_RIGHT | wxALL, 5);
617 m_sdbBtmBtnsSizerCancel =
new wxButton(
this, wxID_CANCEL, _(
"Cancel"),
618 wxDefaultPosition, wxDefaultSize, 0);
619 itemBoxSizer16->Add(m_sdbBtmBtnsSizerCancel, 0,
620 wxALIGN_RIGHT | wxALIGN_BOTTOM | wxALL, 5);
622 m_sdbBtmBtnsSizerOK =
623 new wxButton(
this, wxID_OK, _(
"OK"), wxDefaultPosition, wxDefaultSize, 0);
624 itemBoxSizer16->Add(m_sdbBtmBtnsSizerOK, 0,
625 wxALIGN_RIGHT | wxALIGN_BOTTOM | wxALL, 5);
626 m_sdbBtmBtnsSizerOK->SetDefault();
628 int char_size = GetCharWidth();
631 width = g_monitor_info[g_current_monitor].width;
632 height = g_monitor_info[g_current_monitor].height;
633 SetSizeHints(-1, -1, width - 100, height - 100);
636void TrackPropDlg::CreateControls(
void) {
637 wxBoxSizer* bSizerMain;
638 bSizerMain =
new wxBoxSizer(wxVERTICAL);
639 SetSizer(bSizerMain);
642 new wxNotebook(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
644 bSizerMain->Add(m_notebook1, 1, wxEXPAND | wxALL, 5);
647 new wxPanel(m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize);
648 m_notebook1->AddPage(m_panel0, _(
"Basic"),
true);
650 wxBoxSizer* bSizer0 =
new wxBoxSizer(wxVERTICAL);
651 m_panel0->SetSizer(bSizer0);
653 wxBoxSizer* bSizer1 =
new wxBoxSizer(wxVERTICAL);
654 bSizer0->Add(bSizer1, 1, wxEXPAND | wxALL, 5);
656 m_panelBasic =
new wxScrolledWindow(m_panel0, wxID_ANY, wxDefaultPosition,
658 wxHSCROLL | wxVSCROLL | wxTAB_TRAVERSAL);
664 wxString wqs = getFontQtStylesheet(qFont);
665 wxCharBuffer sbuf = wqs.ToUTF8();
666 QString qsb = QString(sbuf.data());
668 QString qsbq = getQtStyleSheet();
670 m_panelBasic->GetHandle()->setStyleSheet(qsb +
679 wxBoxSizer* bSizerBasic =
new wxBoxSizer(wxVERTICAL);
680 m_panelBasic->SetSizer(bSizerBasic);
682 bSizer1->Add(m_panelBasic, 1, wxEXPAND | wxALL, 5);
684 wxBoxSizer* bSizerName;
685 bSizerName =
new wxBoxSizer(wxHORIZONTAL);
686 bSizerBasic->Add(bSizerName, 0, wxALL | wxEXPAND, 5);
688 m_stName =
new wxStaticText(m_panelBasic, wxID_ANY, _(
"Name"),
689 wxDefaultPosition, wxDefaultSize, 0);
691 bSizerName->Add(m_stName, 0, wxALL, 5);
693 m_tName =
new wxTextCtrl(m_panelBasic, wxID_ANY, wxEmptyString,
694 wxDefaultPosition, wxDefaultSize, 0);
695 bSizerName->Add(m_tName, 1, 0, 5);
697 wxBoxSizer* bSizerFromTo;
698 bSizerFromTo =
new wxBoxSizer(wxHORIZONTAL);
699 bSizerBasic->Add(bSizerFromTo, 0, wxALL | wxEXPAND, 5);
701 m_stFrom =
new wxStaticText(m_panelBasic, wxID_ANY, _(
"From"),
702 wxDefaultPosition, wxDefaultSize, 0);
704 bSizerFromTo->Add(m_stFrom, 0, wxALL, 5);
706 m_tFrom =
new wxTextCtrl(m_panelBasic, wxID_ANY, wxEmptyString,
707 wxDefaultPosition, wxDefaultSize, 0);
708 bSizerFromTo->Add(m_tFrom, 1, 0, 5);
710 m_stTo =
new wxStaticText(m_panelBasic, wxID_ANY, _(
"To"), wxDefaultPosition,
713 bSizerFromTo->Add(m_stTo, 0, wxALL, 5);
715 m_tTo =
new wxTextCtrl(m_panelBasic, wxID_ANY, wxEmptyString,
716 wxDefaultPosition, wxDefaultSize, 0);
717 bSizerFromTo->Add(m_tTo, 1, 0, 5);
719 wxStaticBoxSizer* sbSizerParams;
720 sbSizerParams =
new wxStaticBoxSizer(
721 new wxStaticBox(m_panelBasic, wxID_ANY, _(
"Display parameters")),
723 bSizerBasic->Add(sbSizerParams, 0, wxALL | wxEXPAND, 5);
725 m_cbShow =
new wxCheckBox(m_panelBasic, wxID_ANY, _(
"Show on chart"),
726 wxDefaultPosition, wxDefaultSize, 0);
727 sbSizerParams->Add(m_cbShow, 0, wxALL, 5);
729 m_stColor =
new wxStaticText(m_panelBasic, wxID_ANY, _(
"Color"),
730 wxDefaultPosition, wxDefaultSize, 0);
732 sbSizerParams->Add(m_stColor, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
734 wxString m_cColorChoices[] = {
735 _(
"Default color"), _(
"Black"), _(
"Dark Red"), _(
"Dark Green"),
736 _(
"Dark Yellow"), _(
"Dark Blue"), _(
"Dark Magenta"), _(
"Dark Cyan"),
737 _(
"Light Gray"), _(
"Dark Gray"), _(
"Red"), _(
"Green"),
738 _(
"Yellow"), _(
"Blue"), _(
"Magenta"), _(
"Cyan"),
740 int m_cColorNChoices =
sizeof(m_cColorChoices) /
sizeof(wxString);
741 m_cColor =
new wxChoice(m_panelBasic, wxID_ANY, wxDefaultPosition,
742 wxDefaultSize, m_cColorNChoices, m_cColorChoices, 0);
743 m_cColor->SetSelection(0);
744 sbSizerParams->Add(m_cColor, 1, 0, 5);
746 m_stStyle =
new wxStaticText(m_panelBasic, wxID_ANY, _(
"Style"),
747 wxDefaultPosition, wxDefaultSize, 0);
749 sbSizerParams->Add(m_stStyle, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
751 wxString m_cStyleChoices[] = {_(
"Default"), _(
"Solid"), _(
"Dot"),
752 _(
"Long dash"), _(
"Short dash")};
753 int m_cStyleNChoices =
sizeof(m_cStyleChoices) /
sizeof(wxString);
754 m_cStyle =
new wxChoice(m_panelBasic, wxID_ANY, wxDefaultPosition,
755 wxDefaultSize, m_cStyleNChoices, m_cStyleChoices, 0);
756 m_cStyle->SetSelection(0);
757 sbSizerParams->Add(m_cStyle, 1, 0, 5);
759 m_stWidth =
new wxStaticText(m_panelBasic, wxID_ANY, _(
"Width"),
760 wxDefaultPosition, wxDefaultSize, 0);
762 sbSizerParams->Add(m_stWidth, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
764 wxString m_cWidthChoices[] = {_(
"Default"), _(
"1 pixel"), _(
"2 pixels"),
765 _(
"3 pixels"), _(
"4 pixels"), _(
"5 pixels"),
766 _(
"6 pixels"), _(
"7 pixels"), _(
"8 pixels"),
767 _(
"9 pixels"), _(
"10 pixels")};
768 int m_cWidthNChoices =
sizeof(m_cWidthChoices) /
sizeof(wxString);
769 m_cWidth =
new wxChoice(m_panelBasic, wxID_ANY, wxDefaultPosition,
770 wxDefaultSize, m_cWidthNChoices, m_cWidthChoices, 0);
771 m_cWidth->SetSelection(0);
772 sbSizerParams->Add(m_cWidth, 1, 0, 5);
774 wxStaticBoxSizer* sbSizerStats;
775 sbSizerStats =
new wxStaticBoxSizer(
776 new wxStaticBox(m_panelBasic, wxID_ANY, _(
"Statistics")), wxVERTICAL);
777 bSizerBasic->Add(sbSizerStats, 0, wxALL | wxEXPAND, 5);
779 wxBoxSizer* bSizerStats;
780 bSizerStats =
new wxBoxSizer(wxHORIZONTAL);
783 new wxStaticText(m_panelBasic, wxID_ANY, _(
"Total distance"),
784 wxDefaultPosition, wxDefaultSize, 0);
786 bSizerStats->Add(m_stTotDistance, 0, wxALL, 5);
789 new wxTextCtrl(m_panelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition,
790 wxDefaultSize, wxTE_READONLY);
791 bSizerStats->Add(m_tTotDistance, 1, 0, 5);
793 m_stAvgSpeed =
new wxStaticText(m_panelBasic, wxID_ANY, _(
"Avg. speed"),
794 wxDefaultPosition, wxDefaultSize, 0);
796 bSizerStats->Add(m_stAvgSpeed, 0, wxALL, 5);
798 m_tAvgSpeed =
new wxTextCtrl(m_panelBasic, wxID_ANY, wxEmptyString,
799 wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
800 bSizerStats->Add(m_tAvgSpeed, 1, 0, 5);
802 m_stTimeEnroute =
new wxStaticText(m_panelBasic, wxID_ANY, _(
"Time enroute"),
803 wxDefaultPosition, wxDefaultSize, 0);
805 bSizerStats->Add(m_stTimeEnroute, 0, wxALL, 5);
808 new wxTextCtrl(m_panelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition,
809 wxDefaultSize, wxTE_READONLY);
810 bSizerStats->Add(m_tTimeEnroute, 2, 0, 5);
812 sbSizerStats->Add(bSizerStats, 0, wxEXPAND, 5);
814 wxStaticBoxSizer* sbSizerPoints;
815 sbSizerPoints =
new wxStaticBoxSizer(
816 new wxStaticBox(m_panel0, wxID_ANY, _(
"Recorded points")), wxVERTICAL);
817 bSizer1->Add(sbSizerPoints, 1, wxALL | wxEXPAND, 5);
819 wxBoxSizer* bSizerShowTime;
820 bSizerShowTime =
new wxBoxSizer(wxHORIZONTAL);
822 m_stShowTime =
new wxStaticText(m_panel0, wxID_ANY, _(
"Time shown as"),
823 wxDefaultPosition, wxDefaultSize, 0);
825 bSizerShowTime->Add(m_stShowTime, 0, wxALL, 5);
827 m_rbShowTimeUTC =
new wxRadioButton(m_panel0, wxID_ANY, _(
"UTC"),
828 wxDefaultPosition, wxDefaultSize, 0);
829 bSizerShowTime->Add(m_rbShowTimeUTC, 0,
830 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
833 m_rbShowTimePC =
new wxRadioButton(m_panel0, wxID_ANY, _(
"Local Time"),
834 wxDefaultPosition, wxDefaultSize, 0);
836 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
840 new wxRadioButton(m_panel0, wxID_ANY, _(
"LMT@Track Start"),
841 wxDefaultPosition, wxDefaultSize, 0);
843 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
847 new wxRadioButton(m_panel0, wxID_ANY, _(
"Honor Global Settings"),
848 wxDefaultPosition, wxDefaultSize, 0);
850 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
855 sbSizerPoints->Add(bSizerShowTime, 0, wxEXPAND, 5);
857 long flags = wxLC_REPORT | wxLC_HRULES | wxLC_VRULES | wxLC_EDIT_LABELS;
859 flags |= wxLC_VIRTUAL;
863 wxDefaultSize, flags);
864 addColumns(m_lcPoints, GetCharWidth());
866 sbSizerPoints->Add(m_lcPoints, 1, wxALL | wxEXPAND, 5);
869 m_lcPoints->GetHandle()->setStyleSheet(getQtStyleSheet());
883 m_panelAdvanced =
new wxScrolledWindow(
884 m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
886 wxBoxSizer* bSizerAdvanced;
887 bSizerAdvanced =
new wxBoxSizer(wxVERTICAL);
890 new wxStaticText(m_panelAdvanced, wxID_ANY, _(
"Description"),
891 wxDefaultPosition, wxDefaultSize, 0);
893 bSizerAdvanced->Add(m_stDescription, 0, wxALL, 5);
896 new wxTextCtrl(m_panelAdvanced, wxID_ANY, wxEmptyString,
897 wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
898 bSizerAdvanced->Add(m_tDescription, 1, wxALL | wxEXPAND, 5);
900 sbSizerLinks =
new wxStaticBoxSizer(
901 new wxStaticBox(m_panelAdvanced, wxID_ANY, _(
"Links")), wxVERTICAL);
903 m_scrolledWindowLinks =
904 new wxScrolledWindow(m_panelAdvanced, wxID_ANY, wxDefaultPosition,
905 wxDefaultSize, wxHSCROLL | wxVSCROLL);
906 m_scrolledWindowLinks->SetScrollRate(5, 5);
907 bSizerLinks =
new wxBoxSizer(wxVERTICAL);
910 new wxHyperlinkCtrl(m_scrolledWindowLinks, wxID_ANY, _(
"wxFB Website"),
911 wxT(
"http://www.wxformbuilder.org"),
912 wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
913 m_menuLink =
new wxMenu();
915 new wxMenuItem(m_menuLink, ID_TRK_MENU_EDIT, wxString(_(
"Edit")),
916 wxEmptyString, wxITEM_NORMAL);
917 m_menuLink->Append(m_menuItemEdit);
920 new wxMenuItem(m_menuLink, ID_TRK_MENU_ADD, wxString(_(
"Add new")),
921 wxEmptyString, wxITEM_NORMAL);
922 m_menuLink->Append(m_menuItemAdd);
925 new wxMenuItem(m_menuLink, ID_TRK_MENU_DELETE, wxString(_(
"Delete")),
926 wxEmptyString, wxITEM_NORMAL);
927 m_menuLink->Append(m_menuItemDelete);
929 m_hyperlink1->Connect(
931 wxMouseEventHandler(TrackPropDlg::m_hyperlink1OnContextMenu), NULL,
this);
933 bSizerLinks->Add(m_hyperlink1, 0, wxALL, 5);
935 m_scrolledWindowLinks->SetSizer(bSizerLinks);
936 m_scrolledWindowLinks->Layout();
937 bSizerLinks->Fit(m_scrolledWindowLinks);
938 sbSizerLinks->Add(m_scrolledWindowLinks, 1, wxEXPAND | wxALL, 5);
940 wxBoxSizer* bSizerLinkBtns;
941 bSizerLinkBtns =
new wxBoxSizer(wxHORIZONTAL);
944 new wxButton(m_panelAdvanced, wxID_ANY, _(
"Add"), wxDefaultPosition,
945 wxDefaultSize, wxBU_EXACTFIT);
946 bSizerLinkBtns->Add(m_buttonAddLink, 0, wxALL, 5);
948 m_toggleBtnEdit =
new wxToggleButton(m_panelAdvanced, wxID_ANY, _(
"Edit"),
949 wxDefaultPosition, wxDefaultSize, 0);
950 bSizerLinkBtns->Add(m_toggleBtnEdit, 0, wxALL, 5);
952 m_staticTextEditEnabled =
new wxStaticText(
953 m_panelAdvanced, wxID_ANY, _(
"Links are opened in the default browser."),
954 wxDefaultPosition, wxDefaultSize, 0);
956 bSizerLinkBtns->Add(m_staticTextEditEnabled, 0,
957 wxALIGN_CENTER_VERTICAL | wxALL, 5);
959 sbSizerLinks->Add(bSizerLinkBtns, 0, wxEXPAND, 5);
961 bSizerAdvanced->Add(sbSizerLinks, 1, wxEXPAND, 5);
963 m_panelAdvanced->SetSizer(bSizerAdvanced);
964 m_notebook1->AddPage(m_panelAdvanced, _(
"Advanced"),
false);
968 wxBoxSizer* itemBoxSizerBottom =
new wxBoxSizer(wxVERTICAL);
969 bSizerMain->Add(itemBoxSizerBottom, 0, wxALIGN_LEFT | wxALL | wxEXPAND, 5);
975 wxFlexGridSizer* itemBoxSizerAux =
new wxFlexGridSizer(0, n_col, 0, 0);
976 itemBoxSizerAux->SetFlexibleDirection(wxBOTH);
977 itemBoxSizerAux->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
979 itemBoxSizerBottom->Add(itemBoxSizerAux, 1, wxALIGN_LEFT | wxALL, 5);
983 m_sdbBtmBtnsSizerPrint =
new wxButton(
this, wxID_ANY, _(
"Print"),
984 wxDefaultPosition, wxDefaultSize, 0);
985 itemBoxSizerAux->Add(m_sdbBtmBtnsSizerPrint, 0,
986 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5);
987 m_sdbBtmBtnsSizerPrint->Enable(
true);
989 m_sdbBtmBtnsSizerPrint = NULL;
992 m_sdbBtmBtnsSizerSplit =
new wxButton(
this, wxID_ANY, _(
"Split"),
993 wxDefaultPosition, wxDefaultSize, 0);
994 itemBoxSizerAux->Add(m_sdbBtmBtnsSizerSplit, 0,
995 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5);
996 m_sdbBtmBtnsSizerSplit->Enable(
false);
998 m_sdbBtmBtnsSizerExtend =
new wxButton(
this, wxID_ANY, _(
"Extend track"),
999 wxDefaultPosition, wxDefaultSize, 0);
1000 itemBoxSizerAux->Add(m_sdbBtmBtnsSizerExtend, 0,
1001 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5);
1003 m_sdbBtmBtnsSizerToRoute =
new wxButton(
this, wxID_ANY, _(
"To route"),
1004 wxDefaultPosition, wxDefaultSize, 0);
1005 itemBoxSizerAux->Add(m_sdbBtmBtnsSizerToRoute, 0,
1006 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5);
1008 m_sdbBtmBtnsSizerExport =
new wxButton(
this, wxID_ANY, _(
"Export"),
1009 wxDefaultPosition, wxDefaultSize, 0);
1010 itemBoxSizerAux->Add(m_sdbBtmBtnsSizerExport, 0,
1011 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5);
1013 wxBoxSizer* itemBoxSizer16 =
new wxBoxSizer(wxHORIZONTAL);
1014 itemBoxSizerBottom->Add(itemBoxSizer16, 0, wxALIGN_RIGHT | wxALL, 5);
1016 m_sdbBtmBtnsSizerCancel =
new wxButton(
this, wxID_CANCEL, _(
"Cancel"),
1017 wxDefaultPosition, wxDefaultSize, 0);
1018 itemBoxSizer16->Add(m_sdbBtmBtnsSizerCancel, 0, wxALIGN_BOTTOM | wxALL, 5);
1020 m_sdbBtmBtnsSizerOK =
1021 new wxButton(
this, wxID_OK, _(
"OK"), wxDefaultPosition, wxDefaultSize, 0);
1022 itemBoxSizer16->Add(m_sdbBtmBtnsSizerOK, 0, wxALIGN_BOTTOM | wxALL, 5);
1023 m_sdbBtmBtnsSizerOK->SetDefault();
1027 ((wxWindowBase*)m_stName)->GetSize(&w1, &h);
1028 ((wxWindowBase*)m_stFrom)->GetSize(&w2, &h);
1029 ((wxWindowBase*)m_stName)->SetMinSize(wxSize(wxMax(w1, w2), h));
1030 ((wxWindowBase*)m_stFrom)->SetMinSize(wxSize(wxMax(w1, w2), h));
1032 m_panelBasic->SetScrollRate(5, 5);
1033 m_panelAdvanced->SetScrollRate(5, 5);
1036void TrackPropDlg::SetTrackAndUpdate(
Track* pt) {
1039 m_lcPoints->DeleteAllItems();
1041 if (m_pMyLinkList)
delete m_pMyLinkList;
1042 m_pMyLinkList =
new HyperlinkList();
1044 int NbrOfLinks = m_pTrack->m_HyperlinkList->GetCount();
1045 if (NbrOfLinks > 0) {
1046 wxHyperlinkListNode* linknode = m_pTrack->m_HyperlinkList->GetFirst();
1051 h->DescrText = link->DescrText;
1052 h->Link = link->Link;
1053 h->LType = link->LType;
1055 m_pMyLinkList->Append(h);
1057 linknode = linknode->GetNext();
1067void TrackPropDlg::InitializeList() {
1068 if (NULL == m_pTrack)
return;
1070 m_lcPoints->m_pTrack = m_pTrack;
1072 if (m_pTrack->GetnPoints()) {
1075 m_lcPoints->m_LMT_Offset = long((prp->m_lon) * 3600. / 15.);
1077 m_lcPoints->m_LMT_Offset = 0;
1080 if (m_lcPoints->IsVirtual())
1081 m_lcPoints->SetItemCount(m_pTrack->GetnPoints());
1084 for (
int in = 0; in < m_pTrack->GetnPoints(); in++) {
1088 m_lcPoints->InsertItem(item);
1089 for (
int j = 0; j < 7; j++) {
1091 item.SetText(m_lcPoints->OnGetItemText(in, j));
1092 m_lcPoints->SetItem(item);
1099 if (NULL == m_pTrack)
return false;
1101 ::wxBeginBusyCursor();
1103 if (m_scrolledWindowLinks) {
1104 wxWindowList kids = m_scrolledWindowLinks->GetChildren();
1105 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
1106 wxWindowListNode* node = kids.Item(i);
1107 wxWindow* win = node->GetData();
1109 auto link_win =
dynamic_cast<wxHyperlinkCtrl*
>(win);
1111 link_win->Disconnect(
1112 wxEVT_COMMAND_HYPERLINK,
1113 wxHyperlinkEventHandler(TrackPropDlg::OnHyperLinkClick));
1114 link_win->Disconnect(
1116 wxMouseEventHandler(TrackPropDlg::m_hyperlinkContextMenu));
1121 int NbrOfLinks = m_pTrack->m_HyperlinkList->GetCount();
1122 HyperlinkList* hyperlinklist = m_pTrack->m_HyperlinkList;
1124 if (NbrOfLinks > 0) {
1125 wxHyperlinkListNode* linknode = hyperlinklist->GetFirst();
1128 wxString Link = link->Link;
1129 wxString Descr = link->DescrText;
1131 wxHyperlinkCtrl* ctrl =
new wxHyperlinkCtrl(
1132 m_scrolledWindowLinks, wxID_ANY, Descr, Link, wxDefaultPosition,
1133 wxDefaultSize, wxHL_DEFAULT_STYLE);
1134 ctrl->Connect(wxEVT_COMMAND_HYPERLINK,
1135 wxHyperlinkEventHandler(TrackPropDlg::OnHyperLinkClick),
1137 if (!m_pTrack->m_bIsInLayer)
1140 wxMouseEventHandler(TrackPropDlg::m_hyperlinkContextMenu), NULL,
1143 bSizerLinks->Add(ctrl, 0, wxALL, 5);
1145 linknode = linknode->GetNext();
1148 bSizerLinks->Fit(m_scrolledWindowLinks);
1151 m_tName->SetValue(m_pTrack->GetName());
1152 m_tFrom->SetValue(m_pTrack->m_TrackStartString);
1153 m_tTo->SetValue(m_pTrack->m_TrackEndString);
1154 if (m_tDescription) m_tDescription->SetValue(m_pTrack->m_TrackDescription);
1156 m_tTotDistance->SetValue(_T(
""));
1157 m_tTimeEnroute->SetValue(_T(
""));
1159 m_sdbBtmBtnsSizerSplit->Enable(
false);
1160 m_sdbBtmBtnsSizerExtend->Enable(
false);
1163 TrackPoint* last_point = m_pTrack->GetLastPoint();
1164 TrackPoint* first_point = m_pTrack->GetPoint(0);
1165 double trackLength = m_pTrack->Length();
1166 double total_seconds = 0.;
1168 wxString speed(_T(
"--"));
1170 if (last_point && first_point) {
1171 if (last_point->GetCreateTime().IsValid() &&
1172 first_point->GetCreateTime().IsValid()) {
1173 total_seconds = last_point->GetCreateTime()
1174 .Subtract(first_point->GetCreateTime())
1177 if (total_seconds != 0.) {
1178 m_avgspeed = trackLength / total_seconds * 3600;
1182 speed.Printf(_T(
"%5.2f"), toUsrSpeed(m_avgspeed));
1186 m_tAvgSpeed->SetValue(speed);
1190 slen.Printf(wxT(
"%5.2f ") + getUsrDistanceUnit(), toUsrDistance(trackLength));
1192 m_tTotDistance->SetValue(slen);
1196 wxTimeSpan time(0, 0, (
int)total_seconds, 0);
1198 if (total_seconds > 3600. * 24.)
1199 time_form = time.Format(
"%H:%M");
1200 else if (total_seconds > 0.)
1201 time_form = time.Format(
"%H:%M");
1203 time_form = _T(
"--");
1204 m_tTimeEnroute->SetValue(time_form);
1206 m_cbShow->SetValue(m_pTrack->IsVisible());
1208 if (m_pTrack->m_Colour == wxEmptyString)
1209 m_cColor->Select(0);
1211 for (
unsigned int i = 0; i <
sizeof(::GpxxColorNames) /
sizeof(wxString);
1213 if (m_pTrack->m_Colour == ::GpxxColorNames[i]) {
1214 m_cColor->Select(i + 1);
1220 for (
unsigned int i = 0; i <
sizeof(::StyleValues) /
sizeof(
int); i++) {
1221 if (m_pTrack->m_style == ::StyleValues[i]) {
1222 m_cStyle->Select(i);
1227 for (
unsigned int i = 0; i <
sizeof(::WidthValues) /
sizeof(
int); i++) {
1228 if (m_pTrack->m_width == ::WidthValues[i]) {
1229 m_cWidth->Select(i);
1234 if (m_pTrack->m_bIsInLayer) {
1235 m_tName->SetEditable(
false);
1236 m_tFrom->SetEditable(
false);
1237 m_tTo->SetEditable(
false);
1238 if (m_tDescription) m_tDescription->SetEditable(
false);
1239 m_cbShow->Enable(
false);
1240 m_cColor->Enable(
false);
1241 m_cStyle->Enable(
false);
1242 m_cWidth->Enable(
false);
1243 m_sdbBtmBtnsSizerExtend->Enable(
false);
1244 m_sdbBtmBtnsSizerSplit->Enable(
false);
1245 SetTitle(wxString::Format(_T(
"%s, %s: %d"), _(
"Track properties"),
1246 _T(
"Layer"), m_pTrack->m_LayerID));
1248 m_tName->SetEditable(
true);
1249 m_tFrom->SetEditable(
true);
1250 m_tTo->SetEditable(
true);
1251 if (m_tDescription) m_tDescription->SetEditable(
true);
1252 m_cbShow->Enable(
true);
1253 m_cColor->Enable(
true);
1254 m_cStyle->Enable(
true);
1255 m_cWidth->Enable(
true);
1257 m_sdbBtmBtnsSizerExtend->Enable(IsThisTrackExtendable());
1259 SetTitle(_(
"Track properties"));
1262 ::wxEndBusyCursor();
1267bool TrackPropDlg::IsThisTrackExtendable() {
1268 m_pExtendTrack = NULL;
1269 m_pExtendPoint = NULL;
1270 if (m_pTrack == g_pActiveTrack || m_pTrack->m_bIsInLayer) {
1274 TrackPoint* pLastPoint = m_pTrack->GetPoint(0);
1275 if (!pLastPoint->GetCreateTime().IsValid()) {
1279 for (
Track* ptrack : g_TrackList) {
1280 if (ptrack->IsVisible() && (ptrack->m_GUID != m_pTrack->m_GUID)) {
1281 TrackPoint* track_node = ptrack->GetLastPoint();
1283 if (track_node->GetCreateTime().IsValid()) {
1284 if (track_node->GetCreateTime() <= pLastPoint->GetCreateTime()) {
1285 if (!m_pExtendPoint ||
1286 track_node->GetCreateTime() > m_pExtendPoint->GetCreateTime()) {
1287 m_pExtendPoint = track_node;
1288 m_pExtendTrack = ptrack;
1295 if (m_pExtendTrack) {
1296 return (!m_pExtendTrack->m_bIsInLayer);
1302void TrackPropDlg::OnExtendBtnClick(wxCommandEvent& event) {
1303 TrackPoint* pFirstPoint = m_pTrack->GetPoint(0);
1305 if (IsThisTrackExtendable()) {
1307 if (pFirstPoint->GetCreateTime() == m_pExtendPoint->GetCreateTime()) {
1310 pSelect->DeleteAllSelectableTrackSegments(m_pExtendTrack);
1311 m_pExtendTrack->Clone(m_pTrack, begin, m_pTrack->GetnPoints(), _(
"_plus"));
1312 pSelect->AddAllSelectableTrackSegments(m_pExtendTrack);
1313 pSelect->DeleteAllSelectableTrackSegments(m_pTrack);
1316 SetTrackAndUpdate(m_pExtendTrack);
1319 if (pRouteManagerDialog && pRouteManagerDialog->IsShown()) {
1320 pRouteManagerDialog->UpdateTrkListCtrl();
1325void TrackPropDlg::OnSplitBtnClick(wxCommandEvent& event) {
1326 m_sdbBtmBtnsSizerSplit->Enable(
false);
1328 if (m_pTrack->m_bIsInLayer) {
1332 if ((m_nSelected > 1) && (m_nSelected < m_pTrack->GetnPoints())) {
1335 pHead->Clone(m_pTrack, 0, m_nSelected - 1, _(
"_A"));
1336 pTail->Clone(m_pTrack, m_nSelected - 1, m_pTrack->GetnPoints(), _(
"_B"));
1337 g_TrackList.push_back(pHead);
1338 pConfig->AddNewTrack(pHead);
1340 g_TrackList.push_back(pTail);
1341 pConfig->AddNewTrack(pTail);
1343 pConfig->DeleteConfigTrack(m_pTrack);
1345 pSelect->DeleteAllSelectableTrackSegments(m_pTrack);
1347 pSelect->AddAllSelectableTrackSegments(pTail);
1348 pSelect->AddAllSelectableTrackSegments(pHead);
1350 SetTrackAndUpdate(pTail);
1353 if (pRouteManagerDialog && pRouteManagerDialog->IsShown()) {
1354 pRouteManagerDialog->UpdateTrkListCtrl();
1359void TrackPropDlg::OnTrackPropCopyTxtClick(wxCommandEvent& event) {
1360 wxString tab(
"\t", wxConvUTF8);
1361 wxString eol(
"\n", wxConvUTF8);
1364 csvString << this->GetTitle() << eol << _(
"Name") << tab
1365 << m_pTrack->GetName() << eol << _(
"Depart From") << tab
1366 << m_pTrack->m_TrackStartString << eol << _(
"Destination") << tab
1367 << m_pTrack->m_TrackEndString << eol << _(
"Total distance") << tab
1368 << m_tTotDistance->GetValue() << eol << _(
"Speed") << tab
1369 << m_tAvgSpeed->GetValue() << eol
1370 << _(
"Departure Time") + _T(
" ") + _(
"(m/d/y h:m)") << tab
1371 << m_pTrack->GetPoint(1)->GetCreateTime().Format() << eol
1372 << _(
"Time enroute") << tab << m_tTimeEnroute->GetValue() << eol
1377 noCols = m_lcPoints->GetColumnCount();
1378 noRows = m_lcPoints->GetItemCount();
1380 item.SetMask(wxLIST_MASK_TEXT);
1382 for (
int i = 0; i < noCols; i++) {
1383 m_lcPoints->GetColumn(i, item);
1384 csvString << item.GetText() << tab;
1388 for (
int j = 0; j < noRows; j++) {
1390 for (
int i = 0; i < noCols; i++) {
1392 m_lcPoints->GetItem(item);
1393 csvString << item.GetText() << tab;
1398 if (wxTheClipboard->Open()) {
1399 wxTextDataObject* data =
new wxTextDataObject;
1400 data->SetText(csvString);
1401 wxTheClipboard->SetData(data);
1402 wxTheClipboard->Close();
1406void TrackPropDlg::OnPrintBtnClick(wxCommandEvent& event) {
1410 dlg->ShowWindowModalThenDo([
this, dlg](
int retcode) {
1411 if (retcode == wxID_OK) {
1416void TrackPropDlg::OnTrackPropRightClick(wxListEvent& event) {
1419 wxMenuItem* copyItem =
1420 menu.Append(ID_RCLK_MENU_COPY_TEXT, _(
"&Copy all as text"));
1425void TrackPropDlg::OnTrackPropListClick(wxListEvent& event) {
1431 m_lcPoints->GetNextItem(itemno, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
1435 selected_no = itemno;
1437 m_pTrack->m_HighlightedTrackPoint = -1;
1440 TrackPoint* prp = m_pTrack->GetPoint(itemno);
1442 m_pTrack->m_HighlightedTrackPoint = itemno;
1444 if (!(m_pTrack->m_bIsInLayer) && !(m_pTrack == g_pActiveTrack)) {
1445 m_nSelected = selected_no + 1;
1446 m_sdbBtmBtnsSizerSplit->Enable(
true);
1448 if (gFrame->GetFocusCanvas()) {
1449 gFrame->JumpToPosition(gFrame->GetFocusCanvas(), prp->m_lat, prp->m_lon,
1450 gFrame->GetFocusCanvas()->GetVPScale());
1453 if (m_lcPoints) m_lcPoints->SetFocus();
1457 if (selected_no == 0 || selected_no == m_pTrack->GetnPoints() - 1)
1458 m_sdbBtmBtnsSizerSplit->Enable(
false);
1461void TrackPropDlg::OnTrackPropMenuSelected(wxCommandEvent& event) {
1462 switch (event.GetId()) {
1463 case ID_RCLK_MENU_COPY_TEXT:
1464 OnTrackPropCopyTxtClick(event);
1469void TrackPropDlg::OnToRouteBtnClick(wxCommandEvent& event) {
1470 pRouteManagerDialog->TrackToRoute(m_pTrack);
1471 if (NULL != pRouteManagerDialog && pRouteManagerDialog->IsVisible())
1472 pRouteManagerDialog->UpdateRouteListCtrl();
1475void TrackPropDlg::OnExportBtnClick(wxCommandEvent& event) {
1476 wxString suggested_name = _(
"track");
1477 std::vector<Track*> list = {m_pTrack};
1478 if (m_pTrack->GetName() != wxEmptyString)
1479 suggested_name = m_pTrack->GetName();
1480 ExportGPXTracks(
this, &list, suggested_name);
1483void TrackPropDlg::m_hyperlinkContextMenu(wxMouseEvent& event) {
1484 m_pEditedLink = (wxHyperlinkCtrl*)event.GetEventObject();
1486 wxEVT_COMMAND_MENU_SELECTED,
1487 (wxObjectEventFunction)(wxEventFunction)&TrackPropDlg::PopupMenuHandler);
1488 m_scrolledWindowLinks->PopupMenu(
1489 m_menuLink, m_pEditedLink->GetPosition().x + event.GetPosition().x,
1490 m_pEditedLink->GetPosition().y + event.GetPosition().y);
1493void TrackPropDlg::PopupMenuHandler(wxCommandEvent& event) {
1494 switch (event.GetId()) {
1495 case ID_TRK_MENU_ADD:
1498 case ID_TRK_MENU_EDIT:
1501 case ID_TRK_MENU_DELETE:
1510 wxHyperlinkListNode* nodeToDelete = NULL;
1511 wxString findurl = m_pEditedLink->GetURL();
1512 wxString findlabel = m_pEditedLink->GetLabel();
1514 wxWindowList kids = m_scrolledWindowLinks->GetChildren();
1515 for (
unsigned int i = 0; i < kids.GetCount(); i++) {
1516 wxWindowListNode* node = kids.Item(i);
1517 wxWindow* win = node->GetData();
1519 auto link_win =
dynamic_cast<wxHyperlinkCtrl*
>(win);
1521 link_win->Disconnect(
1522 wxEVT_COMMAND_HYPERLINK,
1523 wxHyperlinkEventHandler(TrackPropDlg::OnHyperLinkClick));
1524 link_win->Disconnect(
1526 wxMouseEventHandler(TrackPropDlg::m_hyperlinkContextMenu));
1532 int NbrOfLinks = m_pTrack->m_HyperlinkList->GetCount();
1533 HyperlinkList* hyperlinklist = m_pTrack->m_HyperlinkList;
1535 if (NbrOfLinks > 0) {
1536 wxHyperlinkListNode* linknode = hyperlinklist->GetFirst();
1539 wxString Link = link->Link;
1540 wxString Descr = link->DescrText;
1541 if (Link == findurl &&
1542 (Descr == findlabel || (Link == findlabel && Descr == wxEmptyString)))
1543 nodeToDelete = linknode;
1545 wxHyperlinkCtrl* ctrl =
new wxHyperlinkCtrl(
1546 m_scrolledWindowLinks, wxID_ANY, Descr, Link, wxDefaultPosition,
1547 wxDefaultSize, wxHL_DEFAULT_STYLE);
1548 ctrl->Connect(wxEVT_COMMAND_HYPERLINK,
1549 wxHyperlinkEventHandler(TrackPropDlg::OnHyperLinkClick),
1551 ctrl->Connect(wxEVT_RIGHT_DOWN,
1552 wxMouseEventHandler(TrackPropDlg::m_hyperlinkContextMenu),
1555 bSizerLinks->Add(ctrl, 0, wxALL, 5);
1557 linknode = linknode->GetNext();
1560 if (nodeToDelete) hyperlinklist->DeleteNode(nodeToDelete);
1561 m_scrolledWindowLinks->InvalidateBestSize();
1562 m_scrolledWindowLinks->Layout();
1563 sbSizerLinks->Layout();
1567void TrackPropDlg::OnEditLink(wxCommandEvent& event) {
1568 wxString findurl = m_pEditedLink->GetURL();
1569 wxString findlabel = m_pEditedLink->GetLabel();
1572 LinkPropDlg->m_textCtrlLinkDescription->SetValue(findlabel);
1573 LinkPropDlg->m_textCtrlLinkUrl->SetValue(findurl);
1574 DimeControl(LinkPropDlg);
1575 LinkPropDlg->ShowWindowModalThenDo([
this, LinkPropDlg, findurl,
1576 findlabel](
int retcode) {
1577 if (retcode == wxID_OK) {
1578 int NbrOfLinks = m_pTrack->m_HyperlinkList->GetCount();
1579 HyperlinkList* hyperlinklist = m_pTrack->m_HyperlinkList;
1581 if (NbrOfLinks > 0) {
1582 wxHyperlinkListNode* linknode = hyperlinklist->GetFirst();
1585 wxString Link = link->Link;
1586 wxString Descr = link->DescrText;
1587 if (Link == findurl &&
1588 (Descr == findlabel ||
1589 (Link == findlabel && Descr == wxEmptyString))) {
1590 link->Link = LinkPropDlg->m_textCtrlLinkUrl->GetValue();
1592 LinkPropDlg->m_textCtrlLinkDescription->GetValue();
1593 wxHyperlinkCtrl* h =
1594 (wxHyperlinkCtrl*)m_scrolledWindowLinks->FindWindowByLabel(
1597 h->SetLabel(LinkPropDlg->m_textCtrlLinkDescription->GetValue());
1598 h->SetURL(LinkPropDlg->m_textCtrlLinkUrl->GetValue());
1601 linknode = linknode->GetNext();
1605 m_scrolledWindowLinks->InvalidateBestSize();
1606 m_scrolledWindowLinks->Layout();
1607 sbSizerLinks->Layout();
1613void TrackPropDlg::OnAddLink(wxCommandEvent& event) {
1615 LinkPropDlg->m_textCtrlLinkDescription->SetValue(wxEmptyString);
1616 LinkPropDlg->m_textCtrlLinkUrl->SetValue(wxEmptyString);
1617 DimeControl(LinkPropDlg);
1618 LinkPropDlg->ShowWindowModalThenDo([
this, LinkPropDlg](
int retcode) {
1619 if (retcode == wxID_OK) {
1620 wxString desc = LinkPropDlg->m_textCtrlLinkDescription->GetValue();
1621 if (desc == wxEmptyString)
1622 desc = LinkPropDlg->m_textCtrlLinkUrl->GetValue();
1623 wxHyperlinkCtrl* ctrl =
new wxHyperlinkCtrl(
1624 m_scrolledWindowLinks, wxID_ANY, desc,
1625 LinkPropDlg->m_textCtrlLinkUrl->GetValue(), wxDefaultPosition,
1626 wxDefaultSize, wxHL_DEFAULT_STYLE);
1627 ctrl->Connect(wxEVT_COMMAND_HYPERLINK,
1628 wxHyperlinkEventHandler(TrackPropDlg::OnHyperLinkClick),
1630 ctrl->Connect(wxEVT_RIGHT_DOWN,
1631 wxMouseEventHandler(TrackPropDlg::m_hyperlinkContextMenu),
1634 bSizerLinks->Add(ctrl, 0, wxALL, 5);
1635 bSizerLinks->Fit(m_scrolledWindowLinks);
1639 h->DescrText = LinkPropDlg->m_textCtrlLinkDescription->GetValue();
1640 h->Link = LinkPropDlg->m_textCtrlLinkUrl->GetValue();
1641 h->LType = wxEmptyString;
1642 m_pTrack->m_HyperlinkList->Append(h);
1647 m_scrolledWindowLinks->InvalidateBestSize();
1648 m_scrolledWindowLinks->Layout();
1649 sbSizerLinks->Layout();
1654void TrackPropDlg::OnEditLinkToggle(wxCommandEvent& event) {
1655 if (m_toggleBtnEdit->GetValue())
1656 m_staticTextEditEnabled->SetLabel(_(
"Links are opened for editing."));
1658 m_staticTextEditEnabled->SetLabel(
1659 _(
"Links are opened in the default browser."));
1663void TrackPropDlg::OnHyperLinkClick(wxHyperlinkEvent& event) {
1664 if (m_toggleBtnEdit->GetValue()) {
1665 m_pEditedLink = (wxHyperlinkCtrl*)event.GetEventObject();
1680 wxString cc =
event.GetURL();
1681 if (cc.Find(_T(
"#")) != wxNOT_FOUND) {
1683 wxString(_T(
"HKEY_CLASSES_ROOT\\HTTP\\shell\\open\\command")));
1684 if (RegKey.Exists()) {
1685 wxString command_line;
1686 RegKey.QueryValue(wxString(_T(
"")), command_line);
1689 command_line.Replace(wxString(_T(
"\"")), wxString(_T(
"")));
1692 int l = command_line.Find(_T(
".exe"));
1693 if (wxNOT_FOUND == l) l = command_line.Find(_T(
".EXE"));
1695 if (wxNOT_FOUND != l) {
1696 wxString cl = command_line.Mid(0, l + 4);
1698 cc.Prepend(_T(
"\""));
1699 cc.Append(_T(
"\""));
1707 wxString url =
event.GetURL();
1708 url.Replace(_T(
" "), _T(
"%20"));
1709 ::wxLaunchDefaultBrowser(url);
1714void TrackPropDlg::OnShowTimeTZ(wxCommandEvent& event) {
1715 if (m_rbShowTimeUTC && m_rbShowTimeUTC->GetValue())
1724 throw std::logic_error(
"Unexpected time zone selection");
1725 m_lcPoints->DeleteAllItems();
1729bool TrackPropDlg::SaveChanges(
void) {
1730 if (m_pTrack && !m_pTrack->m_bIsInLayer) {
1732 m_pTrack->SetName(m_tName->GetValue());
1733 m_pTrack->m_TrackStartString = m_tFrom->GetValue();
1734 m_pTrack->m_TrackEndString = m_tTo->GetValue();
1736 m_pTrack->m_TrackDescription = m_tDescription->GetValue();
1737 m_pTrack->SetVisible(m_cbShow->GetValue());
1738 if (m_cColor->GetSelection() == 0)
1739 m_pTrack->m_Colour = wxEmptyString;
1741 m_pTrack->m_Colour = ::GpxxColorNames[m_cColor->GetSelection() - 1];
1742 m_pTrack->m_style = (wxPenStyle)::StyleValues[m_cStyle->GetSelection()];
1743 m_pTrack->m_width = ::WidthValues[m_cWidth->GetSelection()];
1745 pConfig->UpdateTrack(m_pTrack);
1746 pConfig->UpdateSettings();
1749 if (m_pTrack && m_pTrack->IsRunning()) {
1751 v[_T(
"Changed")] =
true;
1752 v[_T(
"Name")] = m_pTrack->GetName();
1753 v[_T(
"GUID")] = m_pTrack->m_GUID;
1754 wxString msg_id(_T(
"OCPN_TRK_ACTIVATED"));
1755 SendJSONMessageToAllPlugins(msg_id, v);
1761void TrackPropDlg::OnOKBtnClick(wxCommandEvent& event) {
1765 bool b_found_track = std::find(g_TrackList.begin(), g_TrackList.end(),
1766 m_pTrack) != g_TrackList.end();
1768 if (b_found_track) {
1770 m_pTrack->ClearHighlights();
1773 m_bStartNow =
false;
1775 if (pRouteManagerDialog && pRouteManagerDialog->IsShown())
1776 pRouteManagerDialog->UpdateTrkListCtrl();
1779 gFrame->InvalidateAllGL();
1780 gFrame->RefreshAllCanvas(
false);
1785void TrackPropDlg::OnCancelBtnClick(wxCommandEvent& event) {
1786 bool b_found_track = std::find(g_TrackList.begin(), g_TrackList.end(),
1787 m_pTrack) != g_TrackList.end();
1789 if (b_found_track) m_pTrack->ClearHighlights();
1792 gFrame->InvalidateAllGL();
1793 gFrame->RefreshAllCanvas(
false);
1802OCPNTrackListCtrl::OCPNTrackListCtrl(wxWindow* parent, wxWindowID
id,
1803 const wxPoint& pos,
const wxSize& size,
1805 : wxListCtrl(parent, id, pos, size, style) {
1807 m_tz_selection = GLOBAL_SETTINGS_INPUT;
1811OCPNTrackListCtrl::~OCPNTrackListCtrl() {}
1814 if (m_pTrack->GetnPoints()) {
1816 if (prp)
return prp->m_lon;
1821wxString OCPNTrackListCtrl::OnGetItemText(
long item,
long column)
const {
1824 if (item < 0 || item >= m_pTrack->GetnPoints())
return wxEmptyString;
1826 TrackPoint* this_point = m_pTrack->GetPoint(item);
1827 TrackPoint* prev_point = item > 0 ? m_pTrack->GetPoint(item - 1) : NULL;
1829 if (!this_point)
return wxEmptyString;
1831 double gt_brg, gt_leg_dist;
1837 slat = prev_point->m_lat;
1838 slon = prev_point->m_lon;
1846 ret.Printf(_T(
"%ld"), item);
1850 DistanceBearingMercator(this_point->m_lat, this_point->m_lon, slat, slon,
1851 >_brg, >_leg_dist);
1853 ret.Printf(_T(
"%6.2f ") + getUsrDistanceUnit(),
1854 toUsrDistance(gt_leg_dist));
1858 DistanceBearingMercator(this_point->m_lat, this_point->m_lon, slat, slon,
1859 >_brg, >_leg_dist);
1860 ret.Printf(
"%03.0f %cT", gt_brg, 0x00B0);
1864 ret = toSDMM(1, this_point->m_lat, 1);
1868 ret = toSDMM(2, this_point->m_lon, 1);
1872 wxDateTime timestamp = this_point->GetCreateTime();
1873 if (timestamp.IsValid()) {
1878 ret = ocpn::toUsrDateTimeFormat(timestamp, opts);
1884 if ((item > 0) && this_point->GetCreateTime().IsValid() &&
1885 prev_point->GetCreateTime().IsValid()) {
1886 DistanceBearingMercator(this_point->m_lat, this_point->m_lon, slat,
1887 slon, >_brg, >_leg_dist);
1889 double seconds = this_point->GetCreateTime()
1890 .Subtract(prev_point->GetCreateTime())
1894 if (seconds > 0.) speed = gt_leg_dist / seconds * 3600;
1896 ret.Printf(_T(
"%5.2f"), toUsrSpeed(speed));
1908int OCPNTrackListCtrl::OnGetItemColumnImage(
long item,
long column)
const {
Represents an active track that is currently being recorded.
int m_tz_selection
The timezone to use when formatting date/time.
double getStartPointLongitude() const
Return the longitude at the start point of the track.
Represents a single point in a track.
void OnDeleteLink(wxCommandEvent &event)
wxRadioButton * m_rbShowTimeLocal
Use Local Mean Time (LMT) at the location to format date/time.
wxRadioButton * m_rbShowTimePC
Use system timezone to format date/time, i.e.
wxRadioButton * m_rbShowTimeGlobalSettings
Honor OpenCPN global setting to format date/time.
Represents a track, which is a series of connected track points.
The JSON value class implementation.
wxFont * GetOCPNScaledFont(wxString item, int default_size)
Retrieves a font from FontMgr, optionally scaled for physical readability.
General purpose GUI support.
Tools to send data to plugins.