25#include "NMEALogWindow.h"
27#include "OCPNPlatform.h"
29#ifdef __OCPN__ANDROID__
38 if (instance == NULL) {
44NMEALogWindow::NMEALogWindow()
45 : m_window(NULL), m_width(0), m_height(0), m_pos_x(0), m_pos_y(0) {}
47void NMEALogWindow::Shutdown() {
56void 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);
74void NMEALogWindow::Refresh(
bool do_refresh) {
75 if (m_window) m_window->Refresh(do_refresh);
78void NMEALogWindow::SetSize(
const wxSize &size) {
79 m_width = size.GetWidth();
80 m_width = wxMax(m_width, 400 * g_Platform->GetDisplayDensityFactor());
82 m_height = size.GetHeight();
83 m_height = wxMax(m_height, 300 * g_Platform->GetDisplayDensityFactor());
87void NMEALogWindow::SetPos(
const wxPoint &pos) {
92int NMEALogWindow::GetSizeW() {
97int NMEALogWindow::GetSizeH() {
102int NMEALogWindow::GetPosX() {
107int NMEALogWindow::GetPosY() {
112void NMEALogWindow::SetSize(
int w,
int h) {
114 m_width = wxMax(m_width, 400 * g_Platform->GetDisplayDensityFactor());
118 m_height = wxMax(m_height, 300 * g_Platform->GetDisplayDensityFactor());
123void NMEALogWindow::SetPos(
int x,
int y) {
128void 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;
133void NMEALogWindow::DestroyWindow() {
141void NMEALogWindow::Move() {
143 m_window->Move(m_pos_x, m_pos_y);
155void 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.