25 #include "NMEALogWindow.h"
26 #include "TTYWindow.h"
27 #include "OCPNPlatform.h"
29 #ifdef __OCPN__ANDROID__
38 if (instance == NULL) {
44 NMEALogWindow::NMEALogWindow()
45 : m_window(NULL), m_width(0), m_height(0), m_pos_x(0), m_pos_y(0) {}
47 void NMEALogWindow::Shutdown() {
56 void NMEALogWindow::Create(wxWindow *parent,
int num_lines) {
57 if (m_window == NULL) {
58 m_window =
new TTYWindow(parent, num_lines,
this);
59 m_window->SetTitle(_(
"NMEA Debug Window"));
62 m_pos_x = wxMax(m_pos_x, 40);
63 m_pos_y = wxMax(m_pos_y, 40);
65 m_window->SetSize(m_pos_x, m_pos_y, m_width, m_height);
71 if (m_window) m_window->Add(s);
74 void NMEALogWindow::Refresh(
bool do_refresh) {
75 if (m_window) m_window->Refresh(do_refresh);
78 void NMEALogWindow::SetSize(
const wxSize &size) {
79 m_width = size.GetWidth();
80 m_width = wxMax(m_width, 400 * g_Platform->GetDisplayDensityFactor());
81 m_width = wxMin(m_width, g_Platform->getDisplaySize().x - 20);
82 m_height = size.GetHeight();
83 m_height = wxMax(m_height, 300 * g_Platform->GetDisplayDensityFactor());
84 m_height = wxMin(m_height, g_Platform->getDisplaySize().y - 20);
87 void NMEALogWindow::SetPos(
const wxPoint &pos) {
92 int NMEALogWindow::GetSizeW() {
97 int NMEALogWindow::GetSizeH() {
102 int NMEALogWindow::GetPosX() {
107 int NMEALogWindow::GetPosY() {
112 void NMEALogWindow::SetSize(
int w,
int h) {
114 m_width = wxMax(m_width, 400 * g_Platform->GetDisplayDensityFactor());
115 m_width = wxMin(m_width, g_Platform->getDisplaySize().x - 20);
118 m_height = wxMax(m_height, 300 * g_Platform->GetDisplayDensityFactor());
119 m_height = wxMin(m_height, g_Platform->getDisplaySize().y - 20);
123 void NMEALogWindow::SetPos(
int x,
int y) {
128 void NMEALogWindow::CheckPos(
int display_width,
int display_height) {
129 if ((m_pos_x < 0) || (m_pos_x > display_width)) m_pos_x = 5;
130 if ((m_pos_y < 0) || (m_pos_y > display_height)) m_pos_y = 5;
133 void NMEALogWindow::DestroyWindow() {
141 void NMEALogWindow::Move() {
143 m_window->Move(m_pos_x, m_pos_y);
155 void NMEALogWindow::UpdateGeometry() {
157 SetSize(m_window->GetSize());
158 SetPos(m_window->GetPosition());
This class provides access to the NMEA log/debug window.
bool Active() const
Return true if log is visible i.
void Add(const wxString &s)
Add an formatted string to log output.