OpenCPN Partial API docs
RoutePropDlgImpl.h
1 /***************************************************************************
2  *
3  * Project: OpenCPN
4  *
5  ***************************************************************************
6  * Copyright (C) 2013 by David S. Register *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
22  **************************************************************************/
23 
24 #pragma once
25 #ifndef _ROUTEPROPDLGIMPL_H_
26 #define _ROUTEPROPDLGIMPL_H_
27 
28 #include "RoutePropDlg.h"
29 #include "model/route.h"
30 #include <wx/dataview.h>
31 #include <wx/dvrenderers.h>
32 #include "model/ocpn_types.h"
33 #include "color_types.h"
34 #include <cmath>
35 #include "LinkPropDlg.h"
36 
38 public:
40 
41  static RoutePropDlgImpl* getInstance(wxWindow* parent);
42  void SetRouteAndUpdate(Route* pR, bool only_points = FALSE);
43  Route* GetRoute(void) { return m_pRoute; }
44  void SetEnroutePoint(RoutePoint* rp) { return; } // TODO
45  void UpdatePoints();
46  void SetColorScheme(ColorScheme cs);
47  void RecalculateSize(void);
48  static bool getInstanceFlag();
49 
50 protected:
51  void RoutePropDlgOnClose(wxCloseEvent& event) {
52  SaveGeometry();
53  ResetChanges();
54  Hide();
55  event.Veto();
56  }
57  void RoutePropDlgOnSize(wxSizeEvent& event) { event.Skip(); }
58  void RoutePropDlgOnNotebookPageChanged(wxNotebookEvent& event) {
59  event.Skip();
60  }
61  void PlanSpeedOnKillFocus(wxFocusEvent& event);
62  void PlanSpeedOnTextEnter(wxCommandEvent& event);
63  void DepartureDateOnDateChanged(wxDateEvent& event);
64  void DepartureTimeOnTimeChanged(wxDateEvent& event);
65  void TimezoneOnChoice(wxCommandEvent& event);
66  void WaypointsOnDataViewListCtrlItemContextMenu(wxDataViewEvent& event);
67  void WaypointsOnDataViewListCtrlItemEditingDone(wxDataViewEvent& event);
68  void WaypointsOnDataViewListCtrlItemValueChanged(wxDataViewEvent& event);
69  void WaypointsOnDataViewListCtrlSelectionChanged(wxDataViewEvent& event);
70  void PrintOnButtonClick(wxCommandEvent& event);
71  void ExtendOnButtonClick(wxCommandEvent& event);
72  void SplitOnButtonClick(wxCommandEvent& event);
73  void BtnsOnCancelButtonClick(wxCommandEvent& event) {
74  SaveGeometry();
75  ResetChanges();
76  Hide();
77  }
78  void BtnsOnOKButtonClick(wxCommandEvent& event);
79  void OnRoutePropMenuSelected(wxCommandEvent& event);
80  void OnRoutepropCopyTxtClick(wxCommandEvent& event);
81  void ItemEditOnMenuSelection(wxCommandEvent& event);
82  void ItemAddOnMenuSelection(wxCommandEvent& event);
83  void ItemDeleteOnMenuSelection(wxCommandEvent& event);
84  void AddLinkOnButtonClick(wxCommandEvent& event);
85  void BtnEditOnToggleButton(wxCommandEvent& event);
86  void OnHyperlinkClick(wxHyperlinkEvent& event);
87  void HyperlinkContextMenu(wxMouseEvent& event);
88  void m_scrolledWindowLinksOnContextMenu(wxMouseEvent& event);
89 
90  wxDateTime GetDepartureTS();
91  void SaveChanges();
92  void ResetChanges();
93 
94  void OnActivate(wxActivateEvent& event);
95 
96  RoutePropDlgImpl(wxWindow* parent, wxWindowID id = wxID_ANY,
97  const wxString& title = _("Route Properties"),
98  const wxPoint& pos = wxDefaultPosition,
99  const wxSize& size = wxSize(550, 450),
100  long style = FRAME_WITH_LINKS_STYLE );
101 private:
102  void SaveGeometry();
103  static bool instanceFlag;
104  static RoutePropDlgImpl* single;
105 
106  Route* m_pRoute;
107  Route m_OrigRoute;
108  Route* m_pHead; // for route splitting
109  Route* m_pTail;
110  RoutePoint* m_pExtendPoint;
111  Route* m_pExtendRoute;
112  RoutePoint* m_pEnroutePoint;
113  bool m_bStartNow;
114 
115  int m_tz_selection;
116 
117  wxDataViewColumn* etd_col;
118 
119  wxHyperlinkCtrl* m_pEditedLink;
120 
121  bool IsThisRouteExtendable();
122  wxDateTime toUsrDateTime(const wxDateTime ts, const int format,
123  const double lon = INFINITY - INFINITY);
124  wxDateTime fromUsrDateTime(const wxDateTime ts, const int format,
125  const double lon = INFINITY - INFINITY);
126  wxString MakeTideInfo(wxString stationName, double lat, double lon,
127  wxDateTime utcTime);
128 };
129 
130 #endif // _ROUTEPROPDLGIMPL_H_
void ItemDeleteOnMenuSelection(wxCommandEvent &event)
Class RoutePropDlg.
Definition: RoutePropDlg.h:62
Definition: route.h:75