OpenCPN Partial API docs
Loading...
Searching...
No Matches
TrackPropDlg.h
1/***************************************************************************
2 *
3 * Project: OpenCPN
4 * Purpose: Track Properties Dialog
5 * Author: David Register
6 *
7 ***************************************************************************
8 * Copyright (C) 2013 by David S. Register *
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
24 **************************************************************************/
25
26#ifndef __TRACKPROPDLG_H__
27#define __TRACKPROPDLG_H__
28
29#include <wx/clipbrd.h>
30#include <wx/artprov.h>
31#include <wx/xrc/xmlres.h>
32#include <wx/intl.h>
33#include <wx/string.h>
34#include <wx/stattext.h>
35#include <wx/gdicmn.h>
36#include <wx/font.h>
37#include <wx/colour.h>
38#include <wx/settings.h>
39#include <wx/textctrl.h>
40#include <wx/sizer.h>
41#include <wx/checkbox.h>
42#include <wx/choice.h>
43#include <wx/clipbrd.h>
44#include <wx/colour.h>
45#include <wx/font.h>
46#include <wx/frame.h>
47#include <wx/gdicmn.h>
48#include <wx/hyperlink.h>
49#include <wx/icon.h>
50#include <wx/image.h>
51#include <wx/intl.h>
52#include <wx/listctrl.h>
53#include <wx/panel.h>
54#include <wx/radiobut.h>
55#include <wx/scrolwin.h>
56#include <wx/button.h>
57#include <wx/tglbtn.h>
58#include <wx/notebook.h>
59
60#if wxCHECK_VERSION(2, 9, 0)
61#include <wx/dialog.h>
62#else
63#include "scrollingdialog.h"
64#endif
65
66#include "LinkPropDlg.h"
67
68#ifdef __WXOSX__
69#define DIALOG_PARENT wxFrame
70#else
71#define DIALOG_PARENT wxDialog
72#endif
73
74#define ID_RCLK_MENU_COPY_TEXT 7013
75
76#define ID_TRK_MENU_ADD 7014
77#define ID_TRK_MENU_EDIT 7015
78#define ID_TRK_MENU_DELETE 7016
79
80class TrackPropDlg; // forward
81extern TrackPropDlg* pTrackPropDialog;
87class wxListCtrl;
89class Track;
90class TrackPoint;
91class HyperlinkList;
92
96class TrackPropDlg : public DIALOG_PARENT {
97private:
98 static bool instanceFlag;
99 static TrackPropDlg* single;
100 TrackPropDlg(wxWindow* parent, wxWindowID id, const wxString& title,
101 const wxPoint& pos, const wxSize& size, long style);
102
103 TrackPoint* m_pExtendPoint;
104 Track* m_pExtendTrack;
105 TrackPoint* m_pEntrackPoint;
106 bool m_bStartNow;
107
108 double m_planspeed;
109 double m_avgspeed;
110
111 int m_nSelected; // index of point selected in Properties dialog row
112
113 bool IsThisTrackExtendable();
114 bool SaveChanges(void);
115
116 HyperlinkList* m_pMyLinkList;
117 void OnHyperLinkClick(wxHyperlinkEvent& event);
118 wxHyperlinkCtrl* m_pEditedLink;
119 void PopupMenuHandler(wxCommandEvent& event);
120 void OnActivate(wxActivateEvent& event);
121
122protected:
123 wxNotebook* m_notebook1;
124 wxScrolledWindow* m_panelBasic;
125 wxStaticText* m_stName;
126 wxTextCtrl* m_tName;
127 wxStaticText* m_stFrom;
128 wxTextCtrl* m_tFrom;
129 wxStaticText* m_stTo;
130 wxTextCtrl* m_tTo;
131 wxCheckBox* m_cbShow;
132 wxStaticText* m_stColor;
133 wxChoice* m_cColor;
134 wxStaticText* m_stStyle;
135 wxChoice* m_cStyle;
136 wxStaticText* m_stWidth;
137 wxChoice* m_cWidth;
138 wxStaticText* m_stTotDistance;
139 wxTextCtrl* m_tTotDistance;
140 wxStaticText* m_stAvgSpeed;
141 wxTextCtrl* m_tAvgSpeed;
142 wxStaticText* m_stTimeEnroute;
143 wxTextCtrl* m_tTimeEnroute;
144 wxStaticText* m_stShowTime;
145 wxRadioButton* m_rbShowTimeUTC;
148 wxRadioButton* m_rbShowTimePC;
150 wxRadioButton* m_rbShowTimeLocal;
157 OCPNTrackListCtrl* m_lcPoints;
158 wxScrolledWindow* m_panelAdvanced;
159 wxStaticText* m_stDescription;
160 wxTextCtrl* m_tDescription;
161 wxScrolledWindow* m_scrolledWindowLinks;
162 wxHyperlinkCtrl* m_hyperlink1;
163 wxMenu* m_menuLink;
164 wxButton* m_buttonAddLink;
165 wxToggleButton* m_toggleBtnEdit;
166 wxStaticText* m_staticTextEditEnabled;
167 wxStdDialogButtonSizer* m_sdbBtmBtnsSizer;
168 wxButton* m_sdbBtmBtnsSizerOK;
169 wxButton* m_sdbBtmBtnsSizerCancel;
170 wxStaticBoxSizer* sbSizerLinks;
171 wxBoxSizer* bSizerLinks;
172
173 wxButton* m_sdbBtmBtnsSizerPrint;
174 wxButton* m_sdbBtmBtnsSizerSplit;
175 wxButton* m_sdbBtmBtnsSizerExtend;
176 wxButton* m_sdbBtmBtnsSizerToRoute;
177 wxButton* m_sdbBtmBtnsSizerExport;
178
179 wxMenuItem* m_menuItemEdit;
180 wxMenuItem* m_menuItemAdd;
181 wxMenuItem* m_menuItemDelete;
182
183 wxScrolledWindow* itemDialog1;
184 bool m_bcompact;
185
186 // Virtual event handlers, overide them in your derived class
187 void OnCancelBtnClick(wxCommandEvent& event);
188 void OnOKBtnClick(wxCommandEvent& event);
189 void OnPrintBtnClick(wxCommandEvent& event);
190 void OnSplitBtnClick(wxCommandEvent& event);
191 void OnExtendBtnClick(wxCommandEvent& event);
192 void OnToRouteBtnClick(wxCommandEvent& event);
193 void OnExportBtnClick(wxCommandEvent& event);
194 void OnTrackPropCopyTxtClick(wxCommandEvent& event);
195 void OnTrackPropListClick(wxListEvent& event);
196 void OnTrackPropRightClick(wxListEvent& event);
197 void OnTrackPropMenuSelected(wxCommandEvent& event);
198 void OnDeleteLink(wxCommandEvent& event);
199 void OnEditLink(wxCommandEvent& event);
200 void OnAddLink(wxCommandEvent& event);
201 void OnEditLinkToggle(wxCommandEvent& event);
202 void OnShowTimeTZ(wxCommandEvent& event);
203 void CreateControls(void);
204 void CreateControlsCompact(void);
205
206public:
207 static TrackPropDlg* getInstance(
208 wxWindow* parent, wxWindowID id = wxID_ANY,
209 const wxString& title = _("Track properties"),
210 const wxPoint& pos = wxDefaultPosition,
211 const wxSize& size = wxSize(680, 440),
212 long style = FRAME_WITH_LINKS_STYLE);
213 static bool getInstanceFlag() { return instanceFlag; }
215
216 void m_hyperlink1OnContextMenu(wxMouseEvent& event) {
217 m_hyperlink1->PopupMenu(m_menuLink, event.GetPosition());
218 }
219
220 void SetTrackAndUpdate(Track* pt);
221 bool UpdateProperties();
222 void InitializeList();
223 Track* GetTrack() { return m_pTrack; }
224
225 void RecalculateSize(void);
226
227 Track* m_pTrack;
228
229 void m_hyperlinkContextMenu(wxMouseEvent& event);
230};
231
232class OCPNTrackListCtrl : public wxListCtrl {
233protected:
235 double getStartPointLongitude() const;
236
237public:
238 OCPNTrackListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos,
239 const wxSize& size, long style);
241
242 wxString OnGetItemText(long item, long column) const;
243 int OnGetItemColumnImage(long item, long column) const;
244
245 Track* m_pTrack;
257 int m_LMT_Offset;
258};
259
260#endif //__TRACKPROPDLG_H__
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.
Definition track.h:56
Class TrackPropDlg.
bool UpdateProperties()
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.
Definition track.h:114