OpenCPN Partial API docs
Loading...
Searching...
No Matches
TCWin.h
1/******************************************************************************
2 *
3 * Project: OpenCPN
4 *
5 ***************************************************************************
6 * Copyright (C) 2013 by David S. Register *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
22 ***************************************************************************
23 */
24
25#ifndef __TCWIN_H__
26#define __TCWIN_H__
27
28#include <list>
29
30#include <wx/frame.h>
31#include <wx/button.h>
32#include <wx/choice.h>
33#include <wx/datetime.h>
34#include <wx/event.h>
35#include <wx/panel.h>
36#include <wx/listctrl.h>
37#include <wx/textctrl.h>
38#include <wx/timer.h>
39#include <wx/list.h>
40
41class IDX_entry;
42class ChartCanvas;
43class RolloverWin;
44
45class TCWin : public wxFrame {
46public:
47 TCWin(ChartCanvas *parent, int x, int y, void *pvIDX);
48 ~TCWin();
49
50 void OnSize(wxSizeEvent &event);
51 void OnPaint(wxPaintEvent &event);
52 void MouseEvent(wxMouseEvent &event);
53 void OnTCWinPopupTimerEvent(wxTimerEvent &event);
54 void OnTimeIndicatorTimer(wxTimerEvent &event);
55 void OKEvent(wxCommandEvent &event);
56 void NXEvent(wxCommandEvent &event);
57 void PREvent(wxCommandEvent &event);
58 void OnCloseWindow(wxCloseEvent &event);
59 void TimezoneOnChoice(wxCommandEvent &event);
60
61 void RePosition(void);
62
63 void RecalculateSize();
64 void SetTimeFactors();
65 void CreateLayout();
66 void InitializeStationText();
67 void PaintChart(wxDC &dc, const wxRect &chartRect);
68 void HandleChartMouseMove(int mainWindowX, int mainWindowY,
69 const wxPoint &chartPanelPos);
70
73 IDX_entry *GetCurrentIDX() const { return pIDX; }
74
75private:
76 // Forward declaration for custom chart panel
77 class TideChartPanel;
78
79 wxPanel *m_topPanel; // Panel containing station info and tide list
80 TideChartPanel *m_chartPanel; // Panel for the tide chart
81 wxPanel *m_buttonPanel; // Panel for buttons and controls
82
83 wxTextCtrl *m_ptextctrl;
84 wxTimer m_TCWinPopupTimer;
85 wxTimer m_TimeIndicatorTimer;
86 RolloverWin *m_pTCRolloverWin;
87 int curs_x;
88 int curs_y;
89 int m_plot_type;
90 wxSize m_tc_size;
91 wxPoint m_position; // window ULC in screen coordinates
92 int m_x; // x coord of mouse click that launched window
93 int m_y; // y coord of mouse click that launched window
94 bool m_created;
95 int m_refDIM;
96 bool m_bcompactText;
97 int m_tsx; // test button width
98 int m_tsy; // test button height
99 float m_tcwin_scaler; // factor to scale TCWin and contents by
100 int m_choiceSize_x;
101
102 IDX_entry *pIDX;
103 wxButton *OK_button;
104 wxButton *NX_button;
105 wxButton *PR_button;
106 wxChoice *m_choiceTimezone;
107 int m_tzoneDisplay;
108
109 int im; // span of values to graph
110 int ib; // minimum value to graph
111 int it; // maximum value to graph
112 int val_off; // offset
113 int i_skip; // vertical stride in graph
114 wxRect m_graph_rect;
115
116 float tcv[26];
117 time_t tt_tcv[26];
118
119 wxListCtrl *m_tList;
120 bool btc_valid;
121 ChartCanvas *pParent;
122 int m_stationOffset_mins;
123 int m_diff_mins;
124 wxString m_stz;
125 int m_t_graphday_GMT;
126 wxDateTime m_graphday;
127 int m_plot_y_offset;
128
129 std::list<wxPoint *> m_sList;
130
131 wxFont *pSFont;
132 wxFont *pSMFont;
133 wxFont *pMFont;
134 wxFont *pLFont;
135
136 wxPen *pblack_1;
137 wxPen *pblack_2;
138 wxPen *pblack_3;
139 wxPen *pblack_4;
140 wxPen *pred_2;
141 wxPen *pred_time;
142 wxPen *pgraph;
143 wxBrush *pltgray;
144 wxBrush *pltgray2;
145
146 int m_button_height;
147 int m_refTextHeight;
148
149 int xSpot;
150 int ySpot;
151
152 DECLARE_EVENT_TABLE()
153};
154
155#endif
ChartCanvas - Main chart display and interaction component.
Definition chcanv.h:151
Represents an index entry for tidal and current data.
Definition IDX_entry.h:49
Definition TCWin.h:45
IDX_entry * GetCurrentIDX() const
Definition TCWin.h:73