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