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#define ID_RCLK_MENU_COPY_TEXT 7013
69
70#define ID_TRK_MENU_ADD 7014
71#define ID_TRK_MENU_EDIT 7015
72#define ID_TRK_MENU_DELETE 7016
73
78class wxListCtrl;
80class Track;
81class TrackPoint;
82class HyperlinkList;
83
87class TrackPropDlg : public wxFrame {
88private:
89 static bool instanceFlag;
90 static TrackPropDlg* single;
91 TrackPropDlg(wxWindow* parent, wxWindowID id, const wxString& title,
92 const wxPoint& pos, const wxSize& size, long style);
93
94 TrackPoint* m_pExtendPoint;
95 Track* m_pExtendTrack;
96 TrackPoint* m_pEntrackPoint;
97 bool m_bStartNow;
98
99 double m_planspeed;
100 double m_avgspeed;
101
102 int m_nSelected; // index of point selected in Properties dialog row
103
104 bool IsThisTrackExtendable();
105 bool SaveChanges(void);
106
107 HyperlinkList* m_pMyLinkList;
108 void OnHyperLinkClick(wxHyperlinkEvent& event);
109 wxHyperlinkCtrl* m_pEditedLink;
110 void PopupMenuHandler(wxCommandEvent& event);
111 void OnActivate(wxActivateEvent& event);
112
113protected:
114 wxNotebook* m_notebook1;
115 wxScrolledWindow* m_panelBasic;
116 wxStaticText* m_stName;
117 wxTextCtrl* m_tName;
118 wxStaticText* m_stFrom;
119 wxTextCtrl* m_tFrom;
120 wxStaticText* m_stTo;
121 wxTextCtrl* m_tTo;
122 wxCheckBox* m_cbShow;
123 wxStaticText* m_stColor;
124 wxChoice* m_cColor;
125 wxStaticText* m_stStyle;
126 wxChoice* m_cStyle;
127 wxStaticText* m_stWidth;
128 wxChoice* m_cWidth;
129 wxStaticText* m_stTotDistance;
130 wxTextCtrl* m_tTotDistance;
131 wxStaticText* m_stAvgSpeed;
132 wxTextCtrl* m_tAvgSpeed;
133 wxStaticText* m_stTimeEnroute;
134 wxTextCtrl* m_tTimeEnroute;
135 wxStaticText* m_stShowTime;
136 wxRadioButton* m_rbShowTimeUTC;
137 wxRadioButton* m_rbShowTimePC;
138 wxRadioButton* m_rbShowTimeLocal;
139 OCPNTrackListCtrl* m_lcPoints;
140 wxScrolledWindow* m_panelAdvanced;
141 wxStaticText* m_stDescription;
142 wxTextCtrl* m_tDescription;
143 wxScrolledWindow* m_scrolledWindowLinks;
144 wxHyperlinkCtrl* m_hyperlink1;
145 wxMenu* m_menuLink;
146 wxButton* m_buttonAddLink;
147 wxToggleButton* m_toggleBtnEdit;
148 wxStaticText* m_staticTextEditEnabled;
149 wxStdDialogButtonSizer* m_sdbBtmBtnsSizer;
150 wxButton* m_sdbBtmBtnsSizerOK;
151 wxButton* m_sdbBtmBtnsSizerCancel;
152 wxStaticBoxSizer* sbSizerLinks;
153 wxBoxSizer* bSizerLinks;
154
155 wxButton* m_sdbBtmBtnsSizerPrint;
156 wxButton* m_sdbBtmBtnsSizerSplit;
157 wxButton* m_sdbBtmBtnsSizerExtend;
158 wxButton* m_sdbBtmBtnsSizerToRoute;
159 wxButton* m_sdbBtmBtnsSizerExport;
160
161 wxMenuItem* m_menuItemEdit;
162 wxMenuItem* m_menuItemAdd;
163 wxMenuItem* m_menuItemDelete;
164
165 wxScrolledWindow* itemDialog1;
166 bool m_bcompact;
167
168 // Virtual event handlers, overide them in your derived class
169 void OnCancelBtnClick(wxCommandEvent& event);
170 void OnOKBtnClick(wxCommandEvent& event);
171 void OnPrintBtnClick(wxCommandEvent& event);
172 void OnSplitBtnClick(wxCommandEvent& event);
173 void OnExtendBtnClick(wxCommandEvent& event);
174 void OnToRouteBtnClick(wxCommandEvent& event);
175 void OnExportBtnClick(wxCommandEvent& event);
176 void OnTrackPropCopyTxtClick(wxCommandEvent& event);
177 void OnTrackPropListClick(wxListEvent& event);
178 void OnTrackPropRightClick(wxListEvent& event);
179 void OnTrackPropMenuSelected(wxCommandEvent& event);
180 void OnDeleteLink(wxCommandEvent& event);
181 void OnEditLink(wxCommandEvent& event);
182 void OnAddLink(wxCommandEvent& event);
183 void OnEditLinkToggle(wxCommandEvent& event);
184 void OnShowTimeTZ(wxCommandEvent& event);
185 void CreateControls(void);
186 void CreateControlsCompact(void);
187
188public:
189 static TrackPropDlg* getInstance(
190 wxWindow* parent, wxWindowID id = wxID_ANY,
191 const wxString& title = _("Track properties"),
192 const wxPoint& pos = wxDefaultPosition,
193 const wxSize& size = wxSize(680, 440),
194 long style = FRAME_WITH_LINKS_STYLE);
195 static bool getInstanceFlag() { return instanceFlag; }
197
198 void m_hyperlink1OnContextMenu(wxMouseEvent& event) {
199 m_hyperlink1->PopupMenu(m_menuLink, event.GetPosition());
200 }
201
202 void SetTrackAndUpdate(Track* pt);
203 bool UpdateProperties();
204 void InitializeList();
205 Track* GetTrack() { return m_pTrack; }
206
207 void RecalculateSize(void);
208
209 Track* m_pTrack;
210
211 void m_hyperlinkContextMenu(wxMouseEvent& event);
212};
213
214class OCPNTrackListCtrl : public wxListCtrl {
215public:
216 OCPNTrackListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos,
217 const wxSize& size, long style);
219
220 wxString OnGetItemText(long item, long column) const;
221 int OnGetItemColumnImage(long item, long column) const;
222
223 Track* m_pTrack;
224 int m_tz_selection;
225 int m_LMT_Offset;
226};
227
228#endif //__TRACKPROPDLG_H__
Class TrackPropDlg.
Definition: TrackPropDlg.h:87
bool UpdateProperties()
void OnDeleteLink(wxCommandEvent &event)
Definition: track.h:79