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