25#include "NMEALogWindow.h"
27#include "OCPNPlatform.h"
29#ifdef __OCPN__ANDROID__
38 if (instance == NULL) {
44NMEALogWindow::NMEALogWindow()
45 : window(NULL), width(0), height(0), pos_x(0), pos_y(0) {}
47void NMEALogWindow::Shutdown() {
54bool NMEALogWindow::Active()
const {
return window != NULL; }
56void NMEALogWindow::Create(wxWindow *parent,
int num_lines) {
58 window =
new TTYWindow(parent, num_lines,
this);
59 window->SetTitle(_(
"NMEA Debug Window"));
62 pos_x = wxMax(pos_x, 40);
63 pos_y = wxMax(pos_y, 40);
65 window->SetSize(pos_x, pos_y, width, height);
70void NMEALogWindow::Add(
const wxString &s) {
71 if (window) window->Add(s);
74void NMEALogWindow::Refresh(
bool do_refresh) {
75 if (window) window->Refresh(do_refresh);
78void NMEALogWindow::SetSize(
const wxSize &size) {
79 width = size.GetWidth();
80 width = wxMax(width, 400 * g_Platform->GetDisplayDensityFactor());
81 width = wxMin(width, g_Platform->getDisplaySize().x - 20);
82 height = size.GetHeight();
83 height = wxMax(height, 300 * g_Platform->GetDisplayDensityFactor());
84 height = wxMin(height, g_Platform->getDisplaySize().y - 20);
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 width = wxMax(width, 400 * g_Platform->GetDisplayDensityFactor());
115 width = wxMin(width, g_Platform->getDisplaySize().x - 20);
118 height = wxMax(height, 300 * g_Platform->GetDisplayDensityFactor());
119 height = wxMin(height, g_Platform->getDisplaySize().y - 20);
123void NMEALogWindow::SetPos(
int x,
int y) {
128void NMEALogWindow::CheckPos(
int display_width,
int display_height) {
129 if ((pos_x < 0) || (pos_x > display_width)) pos_x = 5;
130 if ((pos_y < 0) || (pos_y > display_height)) pos_y = 5;
133void NMEALogWindow::DestroyWindow() {
141void NMEALogWindow::Move() {
143 window->Move(pos_x, pos_y);
155void NMEALogWindow::UpdateGeometry() {
157 SetSize(window->GetSize());
158 SetPos(window->GetPosition());
This class provides access to the NMEA log/debug window.