OpenCPN Partial API docs
Loading...
Searching...
No Matches
MarkInfo.h
1/***************************************************************************
2 *
3 * Project: OpenCPN
4 * Purpose: Mark Properties Support
5 * Author: David Register
6 *
7 ***************************************************************************
8 * Copyright (C) 2010 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 _MARKINFO_H_
27#define _MARKINFO_H_
28
32#include <wx/listctrl.h>
33#include "ocpn_frame.h" //FIXME (dave ) // for ColorScheme
34#include <wx/hyperlink.h> // toh, 2009.02.08
35#include <wx/choice.h>
36#include <wx/tglbtn.h>
37#include <wx/bmpcbox.h>
38#include <wx/notebook.h>
39#include <wx/filesys.h>
40#include <wx/clrpicker.h>
41#include <wx/odcombo.h>
42#include <wx/gbsizer.h>
43#include <wx/spinctrl.h>
44#include "LinkPropDlg.h"
45#include "hyperlink.h"
46#include <wx/htmllbox.h>
47#include <wx/datectrl.h>
48#include <wx/timectrl.h>
49#include <wx/dateevt.h>
50#include <wx/list.h>
51#include <wx/combobox.h>
52
53#include <wx/dialog.h>
54
55#ifdef __WXGTK__
56// wxTimePickerCtrl is completely broken in Gnome based desktop environments as
57// of wxGTK 3.0
58#include "time_textbox.h"
59#endif
60
61#define ID_WPT_RANGERINGS_NO 7507
62#define ID_RCLK_MENU_COPY_TEXT 7013
63#define ID_RCLK_MENU_DELETE 7015
64#define ID_RCLK_MENU_COPY 7016
65#define ID_RCLK_MENU_COPY_LL 7017
66#define ID_RCLK_MENU_PASTE 7018
67#define ID_RCLK_MENU_PASTE_LL 7019
68#define ID_RCLK_MENU_DELETE_LINK 7023
69#define ID_RCLK_MENU_EDIT_LINK 7024
70#define ID_RCLK_MENU_ADD_LINK 7025
71
72#include "tcmgr.h"
73#include "OCPNPlatform.h"
74
79class wxListCtrl;
80class Route;
81class RoutePoint;
82class HyperlinkList;
83class OCPNIconCombo;
84
90
91#define ID_MARKPROP 8000
92#define SYMBOL_MARKPROP_STYLE \
93 wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU | wxCLOSE_BOX
94#define SYMBOL_MARKPROP_TITLE _("Waypoint Properties")
95#define SYMBOL_MARKPROP_IDNAME ID_MARKPROP
96#define SYMBOL_MARKPROP_SIZE wxSize(200, 300)
97#define SYMBOL_MARKPROP_POSITION wxDefaultPosition
98#define ID_MARKPROP_CANCEL 8001
99#define ID_MARKPROP_OK 8002
100#define ID_ICONCTRL 8003
101#define ID_LATCTRL 8004
102#define ID_LONCTRL 8005
103#define ID_SHOWNAMECHECKBOXBASIC 8006
104#define ID_BITMAPCOMBOCTRL 8007
105#define ID_NAMECTRL 8008
106#define wxID_HTMLLIST 8009
107#define ID_DESCR_CTR_DESC 8010
108#define ID_DESCR_CTR_BASIC 8011
109#define ID_BTN_DESC_BASIC 8012
110#define ID_ETA_DATEPICKERCTRL 8013
111#define ID_ETA_TIMEPICKERCTRL 8014
112#define ID_SHOWNAMECHECKBOX_EXT 8015
113#define ID_CHECKBOX_VIS_EXT 8016
114#define ID_CHECKBOX_SCAMIN_VIS 8017
115#define ID_SET_DEFAULT_ICON 8018
116#define ID_SET_DEFAULT_RANGERINGS 8019
117#define ID_SET_DEFAULT_ARRIVALRADIUS 8020
118#define ID_SET_DEFAULT_SCAMIN 8021
119#define ID_SET_DEFAULT_NAMEVIS 8022
120#define ID_SET_DEFAULT_ALL 8023
121#define ID_BTN_LINK_MENU 8024
122#define ID_DEFAULT 8025
123#define ID_BTN_SHOW_TIDES 8026
124
126
131#ifndef wxCLOSE_BOX
132#define wxCLOSE_BOX 0x1000
133#endif
134#ifndef wxFIXED_MINSIZE
135#define wxFIXED_MINSIZE 0
136#endif
137
138WX_DECLARE_OBJARRAY(wxBitmap, ArrayOfBitmaps);
139
141
146class OCPNIconCombo : public wxOwnerDrawnComboBox {
147public:
148 OCPNIconCombo(wxWindow* parent, wxWindowID id, const wxString& value = _T(""),
149 const wxPoint& pos = wxDefaultPosition,
150 const wxSize& size = wxDefaultSize, int n = 0,
151 const wxString choices[] = NULL, long style = 0,
152 const wxValidator& validator = wxDefaultValidator,
153 const wxString& name = _T("OCPNIconCombo"));
154
156
157 void OnDrawItem(wxDC& dc, const wxRect& rect, int item, int flags) const;
158 wxCoord OnMeasureItem(size_t item) const;
159 wxCoord OnMeasureItemWidth(size_t item) const;
160
161 int Append(const wxString& item, wxBitmap bmp);
162 void Clear(void);
163
164private:
165 int itemHeight;
166 ArrayOfBitmaps bmpArray;
167};
168
169// LatLonTextCtrl Specification
170// We need a derived wxText control for lat/lon input in the MarkProp dialog
171// Specifically, we need to catch loss-of-focus events and signal the parent
172// dialog to update the mark's lat/lon dynamically.
173
174// DECLARE_EVENT_TYPE(EVT_LLCHANGE, -1)
175extern /*expdecl*/ const wxEventType EVT_LLCHANGE;
176
177class LatLonTextCtrl : public wxTextCtrl {
178 // DECLARE_DYNAMIC_CLASS( LatLonTextCtrl )
179 DECLARE_EVENT_TABLE()
180
181public:
182 LatLonTextCtrl(wxWindow* parent, wxWindowID id,
183 const wxString& value = _T(""),
184 const wxPoint& pos = wxDefaultPosition,
185 const wxSize& size = wxDefaultSize, long style = 0,
186 const wxValidator& validator = wxDefaultValidator,
187 const wxString& name = wxTextCtrlNameStr);
188
189 void OnKillFocus(wxFocusEvent& event);
190
191 wxEvtHandler* m_pParentEventHandler;
192};
193
197class MarkInfoDlg : public wxFrame {
198 DECLARE_EVENT_TABLE()
199 friend class SaveDefaultsDialog;
200
201private:
202 RoutePoint* m_pRoutePoint;
203 static bool instanceFlag;
204 int i_htmlList_item;
205
206 bool m_bShowName_save;
207 wxString m_Name_save;
208 wxString m_IconName_save;
209 int m_current_icon_Index;
210 double m_lat_save;
211 double m_lon_save;
212 wxString m_Description_save;
213 HyperlinkList* m_pMyLinkList;
214 bool m_bIsVisible_save;
215 bool m_bUseScaMin_save;
216 int m_iScaminVal_save;
217 bool m_bShowWaypointRangeRings_save;
218 int m_iWaypointRangeRingsNumber_save;
219 float m_fWaypointRangeRingsStep_save;
220 wxColour m_wxcWaypointRangeRingsColour_save;
221 double m_WaypointArrivalRadius_save;
222 float m_PlannedSpeed_save;
223 wxDateTime m_ArrETA_save;
224 std::map<double, const IDX_entry*> m_tss;
225 wxString m_lasttspos;
226
227protected:
228 OCPNIconCombo* m_bcomboBoxIcon;
229 wxBoxSizer* bSizerBasicProperties;
230 wxBoxSizer* bSizerLinks;
231 wxButton* m_buttonExtDescription;
232 wxButton* m_buttonLinksMenu;
233 wxBitmapButton* m_buttonShowTides;
234 wxButton* DefaultsBtn;
235 wxCheckBox* m_checkBoxScaMin;
236 wxCheckBox* m_checkBoxShowName;
237 wxCheckBox* m_checkBoxShowNameExt;
238 wxCheckBox* m_checkBoxVisible;
239 wxChoice* m_choiceWaypointRangeRingsUnits;
240 wxColourPickerCtrl* m_PickColor;
241 wxCheckBox* m_cbEtaPresent;
242 wxBoxSizer* bMainSizer;
243 wxFlexGridSizer* fSizerBasicProperties;
244 wxFlexGridSizer* waypointradarGrid;
245 wxFlexGridSizer* waypointrrSelect;
246 wxGridBagSizer* bGB_SizerProperties;
247 wxFlexGridSizer* gbSizerInnerProperties;
248 wxNotebook* m_notebookProperties;
249 wxObject* m_contextObject;
250 wxScrolledWindow* m_panelBasicProperties;
251 wxPanel* m_panelDescription;
252 wxScrolledWindow* m_panelExtendedProperties;
253 wxSimpleHtmlListBox* m_htmlList;
254 wxSize m_defaultClientSize;
255 wxChoice* m_ChoiceWaypointRangeRingsNumber;
256 wxStaticBitmap* m_bitmapIcon;
257 wxStaticBoxSizer* sbS_Description;
258 wxStaticBoxSizer* sbSizerExtProperties;
259 wxStaticBoxSizer* sbSizerLinks;
260 wxStaticBoxSizer* sbSizerBasicProperties;
261 wxStaticBoxSizer* sbRangeRingsExtProperties;
262 wxStaticBoxSizer* sbSizerDescription;
263 wxStaticText* m_staticTextArrivalRadius;
264 wxStaticText* m_staticTextDescription;
265 wxStaticText* m_staticTextEditEnabled;
266 wxStaticText* m_staticTextGpx;
267 wxStaticText* m_staticTextGuid;
268 wxStaticText* m_staticTextTideStation;
269 wxStaticText* m_staticTextIcon;
270 wxStaticText* m_staticTextLatitude;
271 wxStaticText* m_staticTextLayer;
272 wxStaticText* m_staticTextLongitude;
273 wxStaticText* m_staticTextName;
274 wxStaticText* m_staticTextScaMin;
275 wxStaticText* m_staticTextShowNameExt;
276 wxStaticText* m_staticTextRR1;
277 wxStaticText* m_staticTextRR2;
278 wxChoice* m_RangeRingUnits;
279 wxStaticText* m_staticTextRR4;
280 wxStaticText* m_staticTextArrivalUnits;
281 wxStaticText* m_staticTextPlSpeed;
282 wxStaticText* m_staticTextEta;
283 wxStaticText* m_staticTextPlSpeedUnits;
284 wxStdDialogButtonSizer* m_sdbSizerButtons;
285 wxTextCtrl* m_textArrivalRadius;
286 wxTextCtrl* m_textCtrlExtDescription;
287 wxTextCtrl* m_textCtrlGpx;
288 wxTextCtrl* m_textCtrlGuid;
289 wxScrolledWindow* m_scrolledWindowLinks;
290 wxHyperlinkCtrl* m_hyperlink17;
291 wxMenu* m_menuLink;
292 wxToggleButton* m_toggleBtnEdit;
293 wxButton* m_buttonAddLink;
294
295#ifdef __OCPN__ANDROID__
296 wxChoice* m_comboBoxTideStation;
297#else
298 wxComboBox* m_comboBoxTideStation;
299#endif
300 wxTextCtrl* m_textDescription;
301 wxTextCtrl* m_textLatitude;
302 wxTextCtrl* m_textLongitude;
303 wxTextCtrl* m_textName;
304 wxTextCtrl* m_textScaMin;
305 wxTextCtrl* m_textWaypointRangeRingsStep;
306 wxTextCtrl* m_textCtrlPlSpeed;
307 wxBitmap _img_MUI_settings_svg;
308 wxButton* m_sdbSizerButtonsCancel;
309 wxButton* m_sdbSizerButtonsOK;
310
311 wxDatePickerCtrl* m_EtaDatePickerCtrl;
312#ifdef __WXGTK__
313 TimeCtrl* m_EtaTimePickerCtrl;
314#else
315 wxTimePickerCtrl* m_EtaTimePickerCtrl;
316#endif
317 wxArrayString m_choiceTideChoices;
318 wxBitmap m_bmTide;
319 int m_sizeMetric;
320 wxHyperlinkCtrl* m_pEditedLink;
321
322 void initialize_images(void);
323 void OnBitmapCombClick(wxCommandEvent& event);
324 void OnPositionCtlUpdated(wxCommandEvent& event);
325 void OnExtDescriptionClick(wxCommandEvent& event);
326 void OnDescChangedExt(wxCommandEvent& event);
327 void OnDescChangedBasic(wxCommandEvent& event);
328 void OnMarkInfoCancelClick(wxCommandEvent& event);
329 void OnMarkInfoOKClick(wxCommandEvent& event);
330 void OnShowWaypointNameSelectBasic(wxCommandEvent& event);
331 void OnShowWaypointNameSelectExt(wxCommandEvent& event);
332 void OnSelectScaMinExt(wxCommandEvent& event);
333 void OnWptRangeRingsNoChange(wxCommandEvent& event);
334 void OnCopyPasteLatLon(wxCommandEvent& event);
335 void OnWaypointRangeRingSelect(wxCommandEvent& event);
336 void m_htmlListContextMenuBtn(wxCommandEvent& event);
337 void m_htmlListContextMenu(wxMouseEvent& event);
338 void OnRightClickLatLon(wxCommandEvent& event);
339 void OnHtmlLinkClicked(wxHtmlLinkEvent& event);
340 void OnHyperLinkClick(wxHyperlinkEvent& event);
341
342 void On_html_link_popupmenu_Click(wxCommandEvent& event);
343 void DefautlBtnClicked(wxCommandEvent& event);
344 void OnNotebookPageChanged(wxNotebookEvent& event);
345 void OnTimeChanged(wxDateEvent& event) { m_cbEtaPresent->SetValue(true); }
346 void OnTideStationCombobox(wxCommandEvent& event);
347 void OnClose(wxCloseEvent& event);
348 void ShowTidesBtnClicked(wxCommandEvent& event);
349 void OnAddLink(wxCommandEvent& event);
350
351public:
352 MarkInfoDlg(wxWindow* parent, wxWindowID id = wxID_ANY,
353 const wxString& title = _("Waypoint Properties"),
354 const wxPoint& pos = wxDefaultPosition,
355 const wxSize& size = wxSize(-1, -1),
356 long style = FRAME_WITH_LINKS_STYLE);
357 ~MarkInfoDlg();
358 void Create();
359 void InitialFocus(void);
360 void RecalculateSize(void);
361 RoutePoint* GetRoutePoint(void) { return m_pRoutePoint; }
362 void SetColorScheme(ColorScheme cs);
363 void SetRoutePoint(RoutePoint* pRP);
364 void UpdateHtmlList();
365 void SetDialogTitle(const wxString& title) { SetTitle(title); }
366 bool UpdateProperties(bool positionOnly = false);
367 void ValidateMark(void);
368 bool SaveChanges();
369 void OnActivate(wxActivateEvent& event);
370
371 wxSimpleHtmlListBox* GetSimpleBox() {
372 return wxDynamicCast(m_htmlList, wxSimpleHtmlListBox);
373 }
374 void OnHtmlCellClicked(wxHtmlCellEvent& event);
375
376 SaveDefaultsDialog* m_SaveDefaultDlg;
377};
378
382
383class SaveDefaultsDialog : public wxDialog {
384 friend class MarkInfoDlg;
385
386protected:
387 //(*Declarations(SaveDefaultsDialog)
388 wxCheckBox* RangRingsCB;
389 wxCheckBox* ArrivalRCB;
390 wxCheckBox* IconCB;
391 wxCheckBox* NameCB;
392 wxCheckBox* ScaleCB;
393 wxStaticText* stRR;
394 wxStaticText* stArrivalR;
395 wxStaticText* stIcon;
396 wxStaticText* stName;
397 wxStaticText* stScale;
398 wxStaticText* StaticText1;
399 //*)
400
401public:
403};
404
405#endif // _MARKINFO_H_
Class MarkInfoDef.
Definition: MarkInfo.h:197
Definition: route.h:70
Class SaveDefaultsDialog.
Definition: MarkInfo.h:383