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
29#include <memory>
30
34#include <wx/listctrl.h>
35#include "ocpn_frame.h" //FIXME (dave ) // for ColorScheme
36#include <wx/hyperlink.h> // toh, 2009.02.08
37#include <wx/choice.h>
38#include <wx/tglbtn.h>
39#include <wx/bmpcbox.h>
40#include <wx/notebook.h>
41#include <wx/filesys.h>
42#include <wx/clrpicker.h>
43#include <wx/odcombo.h>
44#include <wx/gbsizer.h>
45#include <wx/spinctrl.h>
46#include "LinkPropDlg.h"
47#include "model/hyperlink.h"
48#include <wx/htmllbox.h>
49#include <wx/datectrl.h>
50#include <wx/timectrl.h>
51#include <wx/dateevt.h>
52#include <wx/list.h>
53#include <wx/combobox.h>
54
55#include <wx/dialog.h>
56#include "field_text.h"
57#include "form_grid.h"
58
59#include "route_validator.h"
60
61class MarkInfoDlg; // forward
62
63extern MarkInfoDlg* g_pMarkInfoDialog;
65#ifdef __WXGTK__
66// wxTimePickerCtrl is completely broken in Gnome based desktop environments as
67// of wxGTK 3.0
68#include "time_textbox.h"
69#endif
70
71#ifdef __WXOSX__
72#define DIALOG_PARENT wxFrame
73#else
74#define DIALOG_PARENT wxDialog
75#endif
76
77#define ID_WPT_RANGERINGS_NO 7507
78#define ID_RCLK_MENU_COPY_TEXT 7013
79#define ID_RCLK_MENU_DELETE 7015
80#define ID_RCLK_MENU_COPY 7016
81#define ID_RCLK_MENU_COPY_LL 7017
82#define ID_RCLK_MENU_PASTE 7018
83#define ID_RCLK_MENU_PASTE_LL 7019
84#define ID_RCLK_MENU_DELETE_LINK 7023
85#define ID_RCLK_MENU_EDIT_LINK 7024
86#define ID_RCLK_MENU_ADD_LINK 7025
87
88#include "tcmgr.h"
89#include "OCPNPlatform.h"
90
95class wxListCtrl;
96class Route;
97class RoutePoint;
98class OCPNIconCombo;
99
105
106#define ID_MARKPROP 8000
107#define SYMBOL_MARKPROP_STYLE \
108 wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU | wxCLOSE_BOX
109#define SYMBOL_MARKPROP_TITLE _("Waypoint Properties")
110#define SYMBOL_MARKPROP_IDNAME ID_MARKPROP
111#define SYMBOL_MARKPROP_SIZE wxSize(200, 300)
112#define SYMBOL_MARKPROP_POSITION wxDefaultPosition
113#define ID_MARKPROP_CANCEL 8001
114#define ID_MARKPROP_OK 8002
115#define ID_ICONCTRL 8003
116#define ID_LATCTRL 8004
117#define ID_LONCTRL 8005
118#define ID_SHOWNAMECHECKBOXBASIC 8006
119#define ID_BITMAPCOMBOCTRL 8007
120#define ID_NAMECTRL 8008
121#define wxID_HTMLLIST 8009
122#define ID_DESCR_CTR_DESC 8010
123#define ID_DESCR_CTR_BASIC 8011
124#define ID_BTN_DESC_BASIC 8012
125#define ID_ETA_DATEPICKERCTRL 8013
126#define ID_ETA_TIMEPICKERCTRL 8014
127#define ID_SHOWNAMECHECKBOX_EXT 8015
128#define ID_CHECKBOX_VIS_EXT 8016
129#define ID_CHECKBOX_SCAMIN_VIS 8017
130#define ID_SET_DEFAULT_ICON 8018
131#define ID_SET_DEFAULT_RANGERINGS 8019
132#define ID_SET_DEFAULT_ARRIVALRADIUS 8020
133#define ID_SET_DEFAULT_SCAMIN 8021
134#define ID_SET_DEFAULT_NAMEVIS 8022
135#define ID_SET_DEFAULT_ALL 8023
136#define ID_BTN_LINK_MENU 8024
137#define ID_DEFAULT 8025
138#define ID_BTN_SHOW_TIDES 8026
139
141
146#ifndef wxCLOSE_BOX
147#define wxCLOSE_BOX 0x1000
148#endif
149#ifndef wxFIXED_MINSIZE
150#define wxFIXED_MINSIZE 0
151#endif
152
153WX_DECLARE_OBJARRAY(wxBitmap, ArrayOfBitmaps);
154
156
162class OCPNIconCombo : public wxOwnerDrawnComboBox {
163public:
164 OCPNIconCombo(wxWindow* parent, wxWindowID id, const wxString& value = _T(""),
165 const wxPoint& pos = wxDefaultPosition,
166 const wxSize& size = wxDefaultSize, int n = 0,
167 const wxString choices[] = NULL, long style = 0,
168 const wxValidator& validator = wxDefaultValidator,
169 const wxString& name = _T("OCPNIconCombo"));
170
172
173 void OnDrawItem(wxDC& dc, const wxRect& rect, int item, int flags) const;
174 wxCoord OnMeasureItem(size_t item) const;
175 wxCoord OnMeasureItemWidth(size_t item) const;
176
177 int Append(const wxString& item, wxBitmap bmp);
178 void Clear(void);
179
180private:
181 int itemHeight;
182 ArrayOfBitmaps bmpArray;
183};
184
185// LatLonTextCtrl Specification
186// We need a derived wxText control for lat/lon input in the MarkProp dialog
187// Specifically, we need to catch loss-of-focus events and signal the parent
188// dialog to update the mark's lat/lon dynamically.
189
190// DECLARE_EVENT_TYPE(EVT_LLCHANGE, -1)
191extern /*expdecl*/ const wxEventType EVT_LLCHANGE;
192
193class LatLonTextCtrl : public wxTextCtrl {
194 DECLARE_EVENT_TABLE()
195
196public:
197 LatLonTextCtrl(wxWindow* parent, wxWindowID id,
198 const wxString& value = _T(""),
199 const wxPoint& pos = wxDefaultPosition,
200 const wxSize& size = wxDefaultSize, long style = 0,
201 const wxValidator& validator = wxDefaultValidator,
202 const wxString& name = wxTextCtrlNameStr);
203
204 void OnKillFocus(wxFocusEvent& event);
205
206 wxEvtHandler* m_pParentEventHandler;
207};
208
215class MarkInfoDlg : public DIALOG_PARENT {
216 DECLARE_EVENT_TABLE()
217 friend class SaveDefaultsDialog;
218
219private:
240 RoutePoint* m_pRoutePoint;
241 static bool instanceFlag;
242 int i_htmlList_item;
243
244 bool m_bShowName_save;
245 wxString m_Name_save;
246 wxString m_IconName_save;
247 int m_current_icon_Index;
248 double m_lat_save;
249 double m_lon_save;
250 wxString m_Description_save;
251 HyperlinkList* m_pMyLinkList;
252 bool m_bIsVisible_save;
253 bool m_bUseScaMin_save;
254 int m_iScaminVal_save;
255 bool m_bShowWaypointRangeRings_save;
256 int m_iWaypointRangeRingsNumber_save;
257 float m_fWaypointRangeRingsStep_save;
258 wxColour m_wxcWaypointRangeRingsColour_save;
259 double m_WaypointArrivalRadius_save;
260 float m_PlannedSpeed_save;
261 wxDateTime m_ArrETA_save;
262 std::map<double, const IDX_entry*> m_tss;
263 wxString m_lasttspos;
264
265protected:
266 OCPNIconCombo* m_bcomboBoxIcon;
267 wxBoxSizer* bSizerBasicProperties;
268 wxBoxSizer* bSizerLinks;
269 wxButton* m_buttonOkay;
270 wxButton* m_buttonExtDescription;
271 wxButton* m_buttonLinksMenu;
272 wxBitmapButton* m_buttonShowTides;
273 wxButton* DefaultsBtn;
274 wxCheckBox* m_checkBoxScaMin;
275 wxCheckBox* m_checkBoxShowName;
276 wxCheckBox* m_checkBoxShowNameExt;
277 wxCheckBox* m_checkBoxVisible;
278 wxChoice* m_choiceWaypointRangeRingsUnits;
279 wxColourPickerCtrl* m_PickColor;
297 wxCheckBox* m_cbEtdPresent;
298 wxBoxSizer* bMainSizer;
299 FormGrid* fSizerBasicProperties;
300 wxFlexGridSizer* waypointradarGrid;
301 wxFlexGridSizer* waypointrrSelect;
302 wxGridBagSizer* bGB_SizerProperties;
303 wxFlexGridSizer* gbSizerInnerProperties;
304 wxNotebook* m_notebookProperties;
305 wxObject* m_contextObject;
306 wxScrolledWindow* m_panelBasicProperties;
307 wxPanel* m_panelDescription;
308 wxScrolledWindow* m_panelExtendedProperties;
309 wxSimpleHtmlListBox* m_htmlList;
310 wxSize m_defaultClientSize;
311 wxChoice* m_ChoiceWaypointRangeRingsNumber;
312 wxStaticBitmap* m_bitmapIcon;
313 wxStaticBoxSizer* sbS_Description;
314 wxStaticBoxSizer* sbSizerExtProperties;
315 wxStaticBoxSizer* sbSizerLinks;
316 wxStaticBoxSizer* sbSizerBasicProperties;
317 wxStaticBoxSizer* sbRangeRingsExtProperties;
318 wxStaticBoxSizer* sbSizerDescription;
319 wxStaticText* m_staticTextArrivalRadius;
320 wxStaticText* m_staticTextDescription;
321 wxStaticText* m_staticTextEditEnabled;
322 wxStaticText* m_staticTextGpx;
323 wxStaticText* m_staticTextGuid;
324 wxStaticText* m_staticTextTideStation;
325 wxStaticText* m_staticTextIcon;
326 wxStaticText* m_staticTextLatitude;
327 wxStaticText* m_staticTextLayer;
328 wxStaticText* m_staticTextLongitude;
329 wxStaticText* m_staticTextName;
330 wxStaticText* m_staticTextScaMin;
331 wxStaticText* m_staticTextShowNameExt;
332 wxStaticText* m_staticTextRR1;
333 wxStaticText* m_staticTextRR2;
334 wxChoice* m_RangeRingUnits;
335 wxStaticText* m_staticTextRR4;
336 wxStaticText* m_staticTextArrivalUnits;
337 wxStaticText* m_staticTextPlSpeed;
339 wxStaticText* m_staticTextEtd;
340 wxStaticText* m_staticTextPlSpeedUnits;
341 wxStdDialogButtonSizer* m_sdbSizerButtons;
342 wxTextCtrl* m_textArrivalRadius;
343 wxTextCtrl* m_textCtrlExtDescription;
344 wxTextCtrl* m_textCtrlGpx;
345 wxTextCtrl* m_textCtrlGuid;
346 wxScrolledWindow* m_scrolledWindowLinks;
347 wxHyperlinkCtrl* m_hyperlink17;
348 wxMenu* m_menuLink;
349 wxToggleButton* m_toggleBtnEdit;
350 wxButton* m_buttonAddLink;
351
352#ifdef __OCPN__ANDROID__
353 wxChoice* m_comboBoxTideStation;
354#else
355 wxComboBox* m_comboBoxTideStation;
356#endif
357 wxTextCtrl* m_textDescription;
358 wxTextCtrl* m_textLatitude;
359 wxTextCtrl* m_textLongitude;
360 TextField* m_textName;
361 std::unique_ptr<RoutePointNameValidator> m_name_validator;
362 wxTextCtrl* m_textScaMin;
363 wxTextCtrl* m_textWaypointRangeRingsStep;
372 wxTextCtrl* m_textCtrlPlSpeed;
373 wxBitmap _img_MUI_settings_svg;
374 wxButton* m_sdbSizerButtonsCancel;
375 wxButton* m_sdbSizerButtonsOK;
376
384 wxDatePickerCtrl* m_EtdDatePickerCtrl;
385#ifdef __WXGTK__
387#else
395 wxTimePickerCtrl* m_EtdTimePickerCtrl;
396#endif
397 wxArrayString m_choiceTideChoices;
398 wxBitmap m_bmTide;
399 int m_sizeMetric;
400 wxHyperlinkCtrl* m_pEditedLink;
401
402 void initialize_images(void);
403 void OnBitmapCombClick(wxCommandEvent& event);
404 void OnPositionCtlUpdated(wxCommandEvent& event);
405 void OnFocusEvent(wxFocusEvent& event);
406 void OnExtDescriptionClick(wxCommandEvent& event);
407 void OnDescChangedExt(wxCommandEvent& event);
408 void OnDescChangedBasic(wxCommandEvent& event);
409 void OnMarkInfoCancelClick(wxCommandEvent& event);
410 void OnMarkInfoOKClick(wxCommandEvent& event);
411 void OnShowWaypointNameSelectBasic(wxCommandEvent& event);
412 void OnShowWaypointNameSelectExt(wxCommandEvent& event);
413 void OnSelectScaMinExt(wxCommandEvent& event);
414 void OnWptRangeRingsNoChange(wxCommandEvent& event);
415 void OnCopyPasteLatLon(wxCommandEvent& event);
416 void OnWaypointRangeRingSelect(wxCommandEvent& event);
417 void m_htmlListContextMenuBtn(wxCommandEvent& event);
418 void m_htmlListContextMenu(wxMouseEvent& event);
419 void OnRightClickLatLon(wxCommandEvent& event);
420 void OnHtmlLinkClicked(wxHtmlLinkEvent& event);
421 void OnHyperLinkClick(wxHyperlinkEvent& event);
422 void OnLayoutResize(wxCommandEvent& event);
423
424 void On_html_link_popupmenu_Click(wxCommandEvent& event);
425 void DefautlBtnClicked(wxCommandEvent& event);
426 void OnNotebookPageChanged(wxNotebookEvent& event);
427 void OnTimeChanged(wxDateEvent& event) { m_cbEtdPresent->SetValue(true); }
428 void OnTideStationCombobox(wxCommandEvent& event);
429 void OnClose(wxCloseEvent& event);
430 void ShowTidesBtnClicked(wxCommandEvent& event);
431 void OnAddLink(wxCommandEvent& event);
432
433public:
434 MarkInfoDlg(wxWindow* parent, wxWindowID id = wxID_ANY,
435 const wxString& title = _("Waypoint Properties"),
436 const wxPoint& pos = wxDefaultPosition,
437 const wxSize& size = wxSize(-1, -1),
438 long style = FRAME_WITH_LINKS_STYLE);
439 ~MarkInfoDlg();
440 void Create();
441 void InitialFocus(void);
442 void RecalculateSize(void);
443 RoutePoint* GetRoutePoint(void) { return m_pRoutePoint; }
444 void SetColorScheme(ColorScheme cs);
445 void SetRoutePoint(RoutePoint* pRP);
446 void ClearData();
447 void SetBulkEdit(bool bBulkEdit);
448 void UpdateHtmlList();
449 void SetDialogTitle(const wxString& title) { SetTitle(title); }
450 bool UpdateProperties(bool positionOnly = false);
451 void ValidateMark(void);
452 bool SaveChanges();
453 void OnActivate(wxActivateEvent& event);
454
455 wxSimpleHtmlListBox* GetSimpleBox() {
456 return dynamic_cast<wxSimpleHtmlListBox*>(m_htmlList);
457 }
458 void OnHtmlCellClicked(wxHtmlCellEvent& event);
459
460 SaveDefaultsDialog* m_SaveDefaultDlg;
461};
462
468class SaveDefaultsDialog : public wxDialog {
469 friend class MarkInfoDlg;
470
471protected:
472 //(*Declarations(SaveDefaultsDialog)
473 wxCheckBox* RangRingsCB;
474 wxCheckBox* ArrivalRCB;
475 wxCheckBox* IconCB;
476 wxCheckBox* NameCB;
477 wxCheckBox* ScaleCB;
478 wxStaticText* stRR;
479 wxStaticText* stArrivalR;
480 wxStaticText* stIcon;
481 wxStaticText* stName;
482 wxStaticText* stScale;
483 wxStaticText* StaticText1;
484 //*)
485
486public:
488};
489
490#endif // _MARKINFO_H_
Grid layout with 2 columns for form labels and fields.
Definition form_grid.h:28
Dialog for displaying and editing waypoint properties.
Definition MarkInfo.h:215
wxDatePickerCtrl * m_EtdDatePickerCtrl
Date picker control for setting the Estimated Time of Departure (ETD).
Definition MarkInfo.h:384
wxStaticText * m_staticTextEtd
Label for the Estimated Time of Departure field.
Definition MarkInfo.h:339
wxCheckBox * m_cbEtdPresent
Checkbox control that enables/disables manual ETD setting for a waypoint.
Definition MarkInfo.h:297
wxTextCtrl * m_textCtrlPlSpeed
Text control for waypoint planned speed.
Definition MarkInfo.h:372
wxTimePickerCtrl * m_EtdTimePickerCtrl
Time picker control for setting the Estimated Time of Departure (ETD).
Definition MarkInfo.h:395
Custom combobox for selecting waypoint icons.
Definition MarkInfo.h:162
Represents a waypoint or mark within the navigation system.
Definition route_point.h:70
Represents a navigational route in the navigation system.
Definition route.h:98
Dialog for saving default waypoint properties.
Definition MarkInfo.h:468
Text field with validator and error handler.
Definition field_text.h:38
Text field classes and text validator base classes.
Route validators for dialog validation.