1 /******************************************************************************
2  *
3  * Project:  OpenCPN
4  * Purpose:  Console Canvas
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  */
27 
28 #ifndef __concanv_H__
29 #define __concanv_H__
30 
31 
32 //----------------------------------------------------------------------------
33 //   constants
34 //----------------------------------------------------------------------------
35 
36 #include "chart1.h"             // for ColorScheme
37 
38 
39 #define SPEED_VMG 0
40 #define SPEED_SOG 1
41 
42 #define ID_LEGROUTE 1000
43 #define SECONDS_PER_DAY 86400
44 
45 // Class declarations
46 class Routeman;
47 
48 //----------------------------------------------------------------------------
49 // CDI
50 //----------------------------------------------------------------------------
51 
52 class CDI:public wxWindow
53 {
54 public:
55       CDI(wxWindow* parent, wxWindowID id, long style, const wxString& name);
56 
57       void OnPaint(wxPaintEvent& event);
58       void SetColorScheme(ColorScheme cs);
59       void MouseEvent( wxMouseEvent& event );
60 
61       wxBrush *m_pbackBrush;
62       wxBrush *m_proadBrush;
63       wxPen   *m_proadPen;
64 
65 DECLARE_EVENT_TABLE()
66 
67 };
68 
69 //----------------------------------------------------------------------------
70 // AnnunText
71 //----------------------------------------------------------------------------
72 class AnnunText : public wxWindow
73 {
74 public:
75       AnnunText(wxWindow *parent, wxWindowID id, const wxString& LegendElement, const wxString& ValueElement);
76 
77       ~AnnunText();
78 
79       void SetALabel(const wxString &l);
80       void SetAValue(const wxString &v);
81       void OnPaint(wxPaintEvent& event);
82       void RefreshFonts(void);
83       void SetLegendElement(const wxString &element);
84       void SetValueElement(const wxString &element);
85       void SetColorScheme(ColorScheme cs);
86       void MouseEvent( wxMouseEvent& event );
87 
88 private:
89       void CalculateMinSize(void);
90 
91       wxBrush     m_backBrush;
92       wxColour    m_default_text_color;
93 
94       wxString    m_label;
95       wxString    m_value;
96       wxFont      *m_plabelFont;
97       wxFont      *m_pvalueFont;
98 
99       wxString    m_LegendTextElement;
100       wxString    m_ValueTextElement;
101       wxColour    m_legend_color;
102       wxColour    m_val_color;
103 
104 DECLARE_EVENT_TABLE()
105 
106 };
107 
108 
109 
110 
111 //----------------------------------------------------------------------------
112 // ConsoleCanvas
113 //----------------------------------------------------------------------------
114 class ConsoleCanvas: public wxFrame
115 {
116 public:
117       ConsoleCanvas(wxWindow *frame);
118       ~ConsoleCanvas();
119       void UpdateRouteData();
120       void ShowWithFreshFonts(void);
121       void UpdateFonts(void);
122       void SetColorScheme(ColorScheme cs);
123       void LegRoute();
124       void OnContextMenu( wxContextMenuEvent& event );
125       void OnContextMenuSelection( wxCommandEvent& event );
126       void RefreshConsoleData(void);
127       void ToggleRouteTotalDisplay();
128 
129       wxWindow          *m_pParent;
130       wxStaticText      *pThisLegText;
131       wxBoxSizer        *m_pitemBoxSizerLeg;
132 
133       AnnunText         *pXTE;
134       AnnunText         *pBRG;
135       AnnunText         *pRNG;
136       AnnunText         *pTTG;
137       AnnunText         *pVMG;
138       CDI               *pCDI;
139 
140       wxFont            *pThisLegFont;
141       bool              m_bNeedClear;
142       wxBrush           *pbackBrush;
143 
144 private:
145       void OnPaint(wxPaintEvent& event);
146       void OnShow(wxShowEvent& event);
147       char m_speedUsed;
148 
149 DECLARE_EVENT_TABLE()
150 };
151 
152 #endif
153