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