OpenCPN Partial API docs
Loading...
Searching...
No Matches
tc_win.h
Go to the documentation of this file.
1/**************************************************************************
2 * Copyright (C) 2013 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 TCWIN_H_
25#define TCWIN_H_
26
27#include <list>
28
29#include <wx/frame.h>
30#include <wx/button.h>
31#include <wx/choice.h>
32#include <wx/datetime.h>
33#include <wx/event.h>
34#include <wx/panel.h>
35#include <wx/listctrl.h>
36#include <wx/textctrl.h>
37#include <wx/timer.h>
38#include <wx/list.h>
39
40#include "abstract_chart_canv.h"
41#include "chcanv.h"
42#include "idx_entry.h"
43#include "rollover_win.h"
44#include "top_frame.h"
45
46class TCWin : public wxFrame {
47public:
48 TCWin(ChartCanvas *parent, int x, int y, void *pvIDX);
49
50 TCWin(AbstractChartCanvas *parent, int x, int y, void *pvIDX);
51
52 virtual ~TCWin();
53
54 void OnSize(wxSizeEvent &event);
55 void OnPaint(wxPaintEvent &event);
56 void MouseEvent(wxMouseEvent &event);
57 void OnTCWinPopupTimerEvent(wxTimerEvent &event);
58 void OnTimeIndicatorTimer(wxTimerEvent &event);
59 void OKEvent(wxCommandEvent &event);
60 void NXEvent(wxCommandEvent &event);
61 void PREvent(wxCommandEvent &event);
62 void OnCloseWindow(wxCloseEvent &event);
63 void TimezoneOnChoice(wxCommandEvent &event);
64
65 void RePosition();
66
67 void RecalculateSize();
68 void SetTimeFactors();
69 void CreateLayout();
70 void InitializeStationText();
71 void PaintChart(wxDC &dc, const wxRect &chartRect);
72 void HandleChartMouseMove(int mainWindowX, int mainWindowY,
73 const wxPoint &chartPanelPos);
74
77 IDX_entry *GetCurrentIDX() const { return pIDX; }
78
79private:
80 // Forward declaration for custom chart panel
81 class TideChartPanel;
82
83 wxPanel *m_topPanel; // Panel containing station info and tide list
84 TideChartPanel *m_chartPanel; // Panel for the tide chart
85 wxPanel *m_buttonPanel; // Panel for buttons and controls
86
87 wxTextCtrl *m_ptextctrl;
88 wxTimer m_TCWinPopupTimer;
89 wxTimer m_TimeIndicatorTimer;
90 RolloverWin *m_pTCRolloverWin;
91 int curs_x;
92 int curs_y;
93 int m_plot_type;
94 wxSize m_tc_size;
95 wxPoint m_position; // window ULC in screen coordinates
96 int m_x; // x coord of mouse click that launched window
97 int m_y; // y coord of mouse click that launched window
98 bool m_created;
99 int m_refDIM;
100 bool m_bcompactText;
101 int m_tsx; // test button width
102 int m_tsy; // test button height
103 float m_tcwin_scaler; // factor to scale TCWin and contents by
104 int m_choiceSize_x;
105
106 IDX_entry *pIDX;
107 wxButton *OK_button;
108 wxButton *NX_button;
109 wxButton *PR_button;
110 wxChoice *m_choiceTimezone;
111 int m_tzoneDisplay;
112
113 int im; // span of values to graph
114 int ib; // minimum value to graph
115 int it; // maximum value to graph
116 int val_off; // offset
117 int i_skip; // vertical stride in graph
118 wxRect m_graph_rect;
119
120 float tcv[26];
121 time_t tt_tcv[26];
122
123 wxListCtrl *m_tList;
124 bool btc_valid;
125 ChartCanvas *pParent;
126 int m_stationOffset_mins;
127 int m_diff_mins;
128 wxString m_stz;
129 int m_t_graphday_GMT;
130 wxDateTime m_graphday;
131 int m_plot_y_offset;
132
133 std::list<wxPoint *> m_sList;
134
135 wxFont *pSFont;
136 wxFont *pSMFont;
137 wxFont *pMFont;
138 wxFont *pLFont;
139
140 wxPen *pblack_1;
141 wxPen *pblack_2;
142 wxPen *pblack_3;
143 wxPen *pblack_4;
144 wxPen *pred_2;
145 wxPen *pred_time;
146 wxPen *pgraph;
147 wxBrush *pltgray;
148 wxBrush *pltgray2;
149
150 int m_button_height;
151 int m_refTextHeight;
152
153 int xSpot;
154 int ySpot;
155
156 DECLARE_EVENT_TABLE()
157};
158
159#endif
Minimal ChartCanvas interfaces.
Generic Chart canvas base.
Minimal ChartCAnvas interface with very little dependencies.
ChartCanvas - Main chart display and interaction component.
Definition chcanv.h:173
Represents an index entry for tidal and current data.
Definition idx_entry.h:48
Definition tc_win.h:46
IDX_entry * GetCurrentIDX() const
Definition tc_win.h:77
Tidal data container.
Abstract gFrame/MyFrame interface.