OpenCPN Partial API docs
Loading...
Searching...
No Matches
mark_info.h
Go to the documentation of this file.
1/**************************************************************************
2 * Copyright (C) 2010 by David S. Register *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, see <https://www.gnu.org/licenses/>. *
16 **************************************************************************/
17
24#ifndef _MARKINFO_H_
25#define _MARKINFO_H_
26
27#include <memory>
28
32#include <wx/bmpcbox.h>
33#include <wx/choice.h>
34#include <wx/clrpicker.h>
35#include <wx/combobox.h>
36#include <wx/datectrl.h>
37#include <wx/dateevt.h>
38#include <wx/dialog.h>
39#include <wx/filesys.h>
40#include <wx/gbsizer.h>
41#include <wx/htmllbox.h>
42#include <wx/hyperlink.h> // toh, 2009.02.08
43#include <wx/listctrl.h>
44#include <wx/list.h>
45#include <wx/notebook.h>
46#include <wx/odcombo.h>
47#include <wx/spinctrl.h>
48#include <wx/tglbtn.h>
49#include <wx/timectrl.h>
50
51#include "model/hyperlink.h"
52#include "model/route.h"
53
54#include "field_text.h"
55#include "form_grid.h"
56#include "link_prop_dlg.h"
57#include "route_validator.h"
58#include "tcmgr.h"
59
60#ifdef __WXGTK__
61// wxTimePickerCtrl is completely broken in Gnome based desktop environments as
62// of wxGTK 3.0
63#include "time_textbox.h"
64#endif
65
66class MarkInfoDlg; // forward
69#ifdef __WXOSX__
70#define DIALOG_PARENT wxFrame
71#else
72#define DIALOG_PARENT wxDialog
73#endif
74
75#define ID_WPT_RANGERINGS_NO 7507
76#define ID_RCLK_MENU_COPY_TEXT 7013
77#define ID_RCLK_MENU_DELETE 7015
78#define ID_RCLK_MENU_COPY 7016
79#define ID_RCLK_MENU_COPY_LL 7017
80#define ID_RCLK_MENU_PASTE 7018
81#define ID_RCLK_MENU_PASTE_LL 7019
82#define ID_RCLK_MENU_DELETE_LINK 7023
83#define ID_RCLK_MENU_EDIT_LINK 7024
84#define ID_RCLK_MENU_ADD_LINK 7025
85
91
92#define ID_MARKPROP 8000
93#define SYMBOL_MARKPROP_STYLE \
94 wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU | wxCLOSE_BOX
95#define SYMBOL_MARKPROP_TITLE _("Waypoint Properties")
96#define SYMBOL_MARKPROP_IDNAME ID_MARKPROP
97#define SYMBOL_MARKPROP_SIZE wxSize(200, 300)
98#define SYMBOL_MARKPROP_POSITION wxDefaultPosition
99#define ID_MARKPROP_CANCEL 8001
100#define ID_MARKPROP_OK 8002
101#define ID_ICONCTRL 8003
102#define ID_LATCTRL 8004
103#define ID_LONCTRL 8005
104#define ID_SHOWNAMECHECKBOXBASIC 8006
105#define ID_BITMAPCOMBOCTRL 8007
106#define ID_NAMECTRL 8008
107#define wxID_HTMLLIST 8009
108#define ID_DESCR_CTR_DESC 8010
109#define ID_DESCR_CTR_BASIC 8011
110#define ID_BTN_DESC_BASIC 8012
111#define ID_ETA_DATEPICKERCTRL 8013
112#define ID_ETA_TIMEPICKERCTRL 8014
113#define ID_SHOWNAMECHECKBOX_EXT 8015
114#define ID_CHECKBOX_VIS_EXT 8016
115#define ID_CHECKBOX_SCAMIN_VIS 8017
116#define ID_SET_DEFAULT_ICON 8018
117#define ID_SET_DEFAULT_RANGERINGS 8019
118#define ID_SET_DEFAULT_ARRIVALRADIUS 8020
119#define ID_SET_DEFAULT_SCAMIN 8021
120#define ID_SET_DEFAULT_NAMEVIS 8022
121#define ID_SET_DEFAULT_ALL 8023
122#define ID_BTN_LINK_MENU 8024
123#define ID_DEFAULT 8025
124#define ID_BTN_SHOW_TIDES 8026
125
127
132#ifndef wxCLOSE_BOX
133#define wxCLOSE_BOX 0x1000
134#endif
135#ifndef wxFIXED_MINSIZE
136#define wxFIXED_MINSIZE 0
137#endif
138
139class OCPNIconCombo; // forward
140class SaveDefaultsDialog; // forward
141
142WX_DECLARE_OBJARRAY(wxBitmap, ArrayOfBitmaps);
143
149class OCPNIconCombo : public wxOwnerDrawnComboBox {
150public:
151 OCPNIconCombo(wxWindow* parent, wxWindowID id, const wxString& value = "",
152 const wxPoint& pos = wxDefaultPosition,
153 const wxSize& size = wxDefaultSize, int n = 0,
154 const wxString choices[] = NULL, long style = 0,
155 const wxValidator& validator = wxDefaultValidator,
156 const wxString& name = "OCPNIconCombo");
157
159
160 void OnDrawItem(wxDC& dc, const wxRect& rect, int item, int flags) const;
161 wxCoord OnMeasureItem(size_t item) const;
162 wxCoord OnMeasureItemWidth(size_t item) const;
163
164 int Append(const wxString& item, wxBitmap bmp);
165 void Clear();
166
167private:
168 int itemHeight;
169 ArrayOfBitmaps bmpArray;
170};
171
172// LatLonTextCtrl Specification
173// We need a derived wxText control for lat/lon input in the MarkProp dialog
174// Specifically, we need to catch loss-of-focus events and signal the parent
175// dialog to update the mark's lat/lon dynamically.
176
177// DECLARE_EVENT_TYPE(EVT_LLCHANGE, -1)
178extern /*expdecl*/ const wxEventType EVT_LLCHANGE;
179
180class LatLonTextCtrl : public wxTextCtrl {
181 DECLARE_EVENT_TABLE()
182
183public:
184 LatLonTextCtrl(wxWindow* parent, wxWindowID id, const wxString& value = "",
185 const wxPoint& pos = wxDefaultPosition,
186 const wxSize& size = wxDefaultSize, long style = 0,
187 const wxValidator& validator = wxDefaultValidator,
188 const wxString& name = wxTextCtrlNameStr);
189
190 void OnKillFocus(wxFocusEvent& event);
191
192 wxEvtHandler* m_pParentEventHandler;
193};
194
201class MarkInfoDlg : public DIALOG_PARENT {
202 DECLARE_EVENT_TABLE()
203 friend class SaveDefaultsDialog;
204
205private:
226 RoutePoint* m_pRoutePoint;
227 static bool instanceFlag;
228 int i_htmlList_item;
229
230 bool m_bShowName_save;
231 wxString m_Name_save;
232 wxString m_IconName_save;
233 int m_current_icon_Index;
234 double m_lat_save;
235 double m_lon_save;
236 wxString m_Description_save;
237 HyperlinkList* m_pMyLinkList;
238 bool m_bIsVisible_save;
239 bool m_bUseScaMin_save;
240 int m_iScaminVal_save;
241 int m_iScamaxVal_save;
242 bool m_bShowWaypointRangeRings_save;
243 int m_iWaypointRangeRingsNumber_save;
244 float m_fWaypointRangeRingsStep_save;
245 wxColour m_wxcWaypointRangeRingsColour_save;
246 double m_WaypointArrivalRadius_save;
247 float m_PlannedSpeed_save;
248 wxDateTime m_ArrETA_save;
249 std::map<double, const IDX_entry*> m_tss;
250 wxString m_lasttspos;
251
252protected:
253 OCPNIconCombo* m_bcomboBoxIcon;
254 wxBoxSizer* bSizerBasicProperties;
255 wxBoxSizer* bSizerLinks;
256 wxButton* m_buttonOkay;
257 wxButton* m_buttonExtDescription;
258 wxButton* m_buttonLinksMenu;
259 wxBitmapButton* m_buttonShowTides;
260 wxButton* DefaultsBtn;
261 wxCheckBox* m_checkBoxScaMin;
262 wxCheckBox* m_checkBoxShowName;
263 wxCheckBox* m_checkBoxShowNameExt;
264 wxCheckBox* m_checkBoxVisible;
265 wxChoice* m_choiceWaypointRangeRingsUnits;
266 wxColourPickerCtrl* m_PickColor;
284 wxCheckBox* m_cbEtdPresent;
285 wxBoxSizer* bMainSizer;
286 FormGrid* fSizerBasicProperties;
287 wxFlexGridSizer* waypointradarGrid;
288 wxFlexGridSizer* waypointrrSelect;
289 wxGridBagSizer* bGB_SizerProperties;
290 wxFlexGridSizer* gbSizerInnerProperties;
291 wxNotebook* m_notebookProperties;
292 wxObject* m_contextObject;
293 wxScrolledWindow* m_panelBasicProperties;
294 wxPanel* m_panelDescription;
295 wxScrolledWindow* m_panelExtendedProperties;
296 wxSimpleHtmlListBox* m_htmlList;
297 wxSize m_defaultClientSize;
298 wxChoice* m_ChoiceWaypointRangeRingsNumber;
299 wxStaticBitmap* m_bitmapIcon;
300 wxStaticBoxSizer* sbS_Description;
301 wxStaticBoxSizer* sbSizerExtProperties;
302 wxStaticBoxSizer* sbSizerLinks;
303 wxStaticBoxSizer* sbSizerBasicProperties;
304 wxStaticBoxSizer* sbRangeRingsExtProperties;
305 wxStaticBoxSizer* sbSizerDescription;
306 wxStaticText* m_staticTextArrivalRadius;
307 wxStaticText* m_staticTextDescription;
308 wxStaticText* m_staticTextEditEnabled;
309 wxStaticText* m_staticTextGpx;
310 wxStaticText* m_staticTextGuid;
311 wxStaticText* m_staticTextTideStation;
312 wxStaticText* m_staticTextIcon;
313 wxStaticText* m_staticTextLatitude;
314 wxStaticText* m_staticTextLayer;
315 wxStaticText* m_staticTextLongitude;
316 wxStaticText* m_staticTextName;
317 wxStaticText* m_staticTextScaMin;
318 wxStaticText* m_staticTextScaMax;
319 wxStaticText* m_staticTextShowNameExt;
320 wxStaticText* m_staticTextRR1;
321 wxStaticText* m_staticTextRR2;
322 wxChoice* m_RangeRingUnits;
323 wxStaticText* m_staticTextRR4;
324 wxStaticText* m_staticTextArrivalUnits;
325 wxStaticText* m_staticTextPlSpeed;
327 wxStaticText* m_staticTextEtd;
328 wxStaticText* m_staticTextPlSpeedUnits;
329 wxStdDialogButtonSizer* m_sdbSizerButtons;
330 wxTextCtrl* m_textArrivalRadius;
331 wxTextCtrl* m_textCtrlExtDescription;
332 wxTextCtrl* m_textCtrlGpx;
333 wxTextCtrl* m_textCtrlGuid;
334 wxScrolledWindow* m_scrolledWindowLinks;
335 wxHyperlinkCtrl* m_hyperlink17;
336 wxMenu* m_menuLink;
337 wxToggleButton* m_toggleBtnEdit;
338 wxButton* m_buttonAddLink;
339
340#ifdef __ANDROID__
341 wxChoice* m_comboBoxTideStation;
342#else
343 wxComboBox* m_comboBoxTideStation;
344#endif
345 wxTextCtrl* m_textDescription;
346 wxTextCtrl* m_textLatitude;
347 wxTextCtrl* m_textLongitude;
348 TextField* m_textName;
349 std::unique_ptr<RoutePointNameValidator> m_name_validator;
350 wxTextCtrl* m_textScaMin;
351 wxTextCtrl* m_textScaMax;
352 wxTextCtrl* m_textWaypointRangeRingsStep;
361 wxTextCtrl* m_textCtrlPlSpeed;
362 wxBitmap _img_MUI_settings_svg;
363 wxButton* m_sdbSizerButtonsCancel;
364 wxButton* m_sdbSizerButtonsOK;
365
373 wxDatePickerCtrl* m_EtdDatePickerCtrl;
374#ifdef __WXGTK__
376#else
384 wxTimePickerCtrl* m_EtdTimePickerCtrl;
385#endif
386 wxArrayString m_choiceTideChoices;
387 wxBitmap m_bmTide;
388 int m_sizeMetric;
389 wxHyperlinkCtrl* m_pEditedLink;
390
391 void initialize_images();
392 void OnBitmapCombClick(wxCommandEvent& event);
393 void OnPositionCtlUpdated(wxCommandEvent& event);
394 void OnFocusEvent(wxFocusEvent& event);
395 void OnExtDescriptionClick(wxCommandEvent& event);
396 void OnDescChangedExt(wxCommandEvent& event);
397 void OnDescChangedBasic(wxCommandEvent& event);
398 void OnMarkInfoCancelClick(wxCommandEvent& event);
399 void OnMarkInfoOKClick(wxCommandEvent& event);
400 void OnShowWaypointNameSelectBasic(wxCommandEvent& event);
401 void OnShowWaypointNameSelectExt(wxCommandEvent& event);
402 void OnSelectScaMinExt(wxCommandEvent& event);
403 void OnWptRangeRingsNoChange(wxCommandEvent& event);
404 void OnCopyPasteLatLon(wxCommandEvent& event);
405 void OnWaypointRangeRingSelect(wxCommandEvent& event);
406 void m_htmlListContextMenuBtn(wxCommandEvent& event);
407 void m_htmlListContextMenu(wxMouseEvent& event);
408 void OnRightClickLatLon(wxCommandEvent& event);
409 void OnHtmlLinkClicked(wxHtmlLinkEvent& event);
410 void OnHyperLinkClick(wxHyperlinkEvent& event);
411 void OnLayoutResize(wxCommandEvent& event);
412
413 void On_html_link_popupmenu_Click(wxCommandEvent& event);
414 void DefautlBtnClicked(wxCommandEvent& event);
415 void OnNotebookPageChanged(wxNotebookEvent& event);
416 void OnTimeChanged(wxDateEvent& event) { m_cbEtdPresent->SetValue(true); }
417 void OnTideStationCombobox(wxCommandEvent& event);
418 void OnClose(wxCloseEvent& event);
419 void ShowTidesBtnClicked(wxCommandEvent& event);
420 void OnAddLink(wxCommandEvent& event);
421
422public:
423 MarkInfoDlg(wxWindow* parent, wxWindowID id = wxID_ANY,
424 const wxString& title = _("Waypoint Properties"),
425 const wxPoint& pos = wxDefaultPosition,
426 const wxSize& size = wxSize(-1, -1),
427 long style = FRAME_WITH_LINKS_STYLE);
428 ~MarkInfoDlg();
429 void Create();
430 void InitialFocus();
431 void RecalculateSize();
432 RoutePoint* GetRoutePoint() { return m_pRoutePoint; }
433 void SetColorScheme(ColorScheme cs);
434 void SetRoutePoint(RoutePoint* pRP);
435 void ClearData();
436 void SetBulkEdit(bool bBulkEdit);
437 void UpdateHtmlList();
438 void SetDialogTitle(const wxString& title) { SetTitle(title); }
439 bool UpdateProperties(bool positionOnly = false);
440 void ValidateMark();
441 bool SaveChanges();
442 void OnActivate(wxActivateEvent& event);
443
444 wxSimpleHtmlListBox* GetSimpleBox() {
445 return dynamic_cast<wxSimpleHtmlListBox*>(m_htmlList);
446 }
447 void OnHtmlCellClicked(wxHtmlCellEvent& event);
448
449 SaveDefaultsDialog* m_SaveDefaultDlg;
450};
451
457class SaveDefaultsDialog : public wxDialog {
458 friend class MarkInfoDlg;
459
460protected:
461 //(*Declarations(SaveDefaultsDialog)
462 wxCheckBox* RangRingsCB;
463 wxCheckBox* ArrivalRCB;
464 wxCheckBox* IconCB;
465 wxCheckBox* NameCB;
466 wxCheckBox* ScaleCB;
467 wxStaticText* stRR;
468 wxStaticText* stArrivalR;
469 wxStaticText* stIcon;
470 wxStaticText* stName;
471 wxStaticText* stScale;
472 wxStaticText* StaticText1;
473 //*)
474
475public:
477};
478
479#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 mark_info.h:201
wxDatePickerCtrl * m_EtdDatePickerCtrl
Date picker control for setting the Estimated Time of Departure (ETD).
Definition mark_info.h:373
wxStaticText * m_staticTextEtd
Label for the Estimated Time of Departure field.
Definition mark_info.h:327
wxCheckBox * m_cbEtdPresent
Checkbox control that enables/disables manual ETD setting for a waypoint.
Definition mark_info.h:284
wxTextCtrl * m_textCtrlPlSpeed
Text control for waypoint planned speed.
Definition mark_info.h:361
wxTimePickerCtrl * m_EtdTimePickerCtrl
Time picker control for setting the Estimated Time of Departure (ETD).
Definition mark_info.h:384
Custom combobox for selecting waypoint icons.
Definition mark_info.h:149
Represents a waypoint or mark within the navigation system.
Definition route_point.h:71
Dialog for saving default waypoint properties.
Definition mark_info.h:457
Text field with validator and error handler.
Definition field_text.h:38
Text field classes and text validator base classes.
MarkInfoDlg * g_pMarkInfoDialog
global instance
Definition mark_info.cpp:76
const wxEventType EVT_LLCHANGE
Route abstraction.
Route dialog validation checks.
Tide and Current Manager @TODO Add original author copyright.
Time textbox to replace broken wxTimePickerCtrl on wxGTK.