26#include "AboutFrameImpl.h"
28#include "OCPNPlatform.h"
32#define EXTEND_WIDTH 70
33#define EXTEND_HEIGHT 70
35#define EXTEND_WIDTH 50
36#define EXTEND_HEIGHT 50
41AboutFrameImpl::AboutFrameImpl(wxWindow* parent, wxWindowID
id,
42 const wxString& title,
const wxPoint& pos,
43 const wxSize& size,
long style)
44 :
AboutFrame(parent, id, title, pos, size, style) {
45 if (strlen(DEBIAN_PPA_VERSION))
46 m_staticTextVersion->SetLabel(wxString(DEBIAN_PPA_VERSION));
48 m_staticTextVersion->SetLabel(PACKAGE_VERSION);
50 m_staticTextCopyYears->SetLabel(
"\u00A9 2000-2024");
51 m_hyperlinkIniFile->SetLabel(g_Platform->GetConfigFileName());
52 m_hyperlinkIniFile->SetURL(g_Platform->GetConfigFileName());
53 m_hyperlinkLogFile->SetLabel(g_Platform->GetLogFileName());
54 m_hyperlinkLogFile->SetURL(g_Platform->GetLogFileName());
55 m_htmlWinAuthors->Hide();
56 m_htmlWinLicense->Hide();
57 m_htmlWinHelp->Hide();
59 m_htmlWinLicense->LoadFile(wxString::Format(
60 "%s/license.html", g_Platform->GetSharedDataDir().c_str()));
61 m_htmlWinAuthors->LoadFile(wxString::Format(
62 "%s/authors.html", g_Platform->GetSharedDataDir().c_str()));
63 wxBitmap logo(wxString::Format(
"%s/opencpn.png",
64 g_Platform->GetSharedDataDir().c_str()),
67 wxString target = wxString::Format(
"%sdoc/local/toc_flat.html",
68 g_Platform->GetSharedDataDir().c_str());
70 if (!::wxFileExists(target))
71 target = wxString::Format(
"%sdoc/help_web.html",
72 g_Platform->GetSharedDataDir().c_str());
74 target.Prepend(
"file://");
76 m_hyperlinkHelp->SetURL(target);
77#if wxUSE_WEBVIEW && defined(HAVE_WEBVIEW)
78 m_htmlWinHelp->LoadURL(target);
80 m_htmlWinHelp->LoadFile(target);
82 m_bitmapLogo->SetBitmap(logo);
84 int width = m_scrolledWindowAbout->GetSizer()->GetSize().GetWidth() +
85 m_bitmapLogo->GetSize().GetWidth() + EXTEND_WIDTH;
86 int height = m_scrolledWindowAbout->GetSizer()->GetSize().GetHeight() +
87 m_panelMainLinks->GetSizer()->GetSize().GetHeight() +
90 SetMinSize(wxSize(width, height));
94void AboutFrameImpl::OnLinkHelp(wxHyperlinkEvent& event) {
96 wxString testFile = wxString::Format(
"/%s/doc/help_web.html",
97 g_Platform->GetSharedDataDir().c_str());
98 if (!::wxFileExists(testFile)) {
99 wxString msg = _(
"OpenCPN Help documentation is not available locally.");
102 _(
"Would you like to visit the opencpn.org website for more "
106 OCPNMessageBox(NULL, msg, _(
"OpenCPN Info"), wxYES_NO | wxCENTER, 60)) {
107 wxLaunchDefaultBrowser(_T(
"https://opencpn.org"));
112 m_htmlWinAuthors->Hide();
113 m_htmlWinLicense->Hide();
114 m_htmlWinHelp->Show();
115 m_scrolledWindowAbout->Hide();
117#if wxUSE_WEBVIEW && defined(HAVE_WEBVIEW)
118 m_btnBack->Enable(m_htmlWinHelp->CanGoBack());
120 m_btnBack->Enable(m_htmlWinHelp->HistoryCanBack());
122 wxSize parentSize = m_parent->GetSize();
123 SetSize(wxSize(parentSize.x * 9 / 10, parentSize.y * 9 / 10));
128void AboutFrameImpl::OnLinkLicense(wxHyperlinkEvent& event) {
129 m_htmlWinAuthors->Hide();
130 m_htmlWinLicense->Show();
131 m_htmlWinHelp->Hide();
133 m_scrolledWindowAbout->Hide();
137void AboutFrameImpl::OnLinkAuthors(wxHyperlinkEvent& event) {
138 m_htmlWinAuthors->Show();
139 m_htmlWinLicense->Hide();
140 m_htmlWinHelp->Hide();
142 m_scrolledWindowAbout->Hide();
146void AboutFrameImpl::AboutFrameOnActivate(wxActivateEvent& event) {
147 m_htmlWinAuthors->Hide();
148 m_htmlWinLicense->Hide();
149 m_htmlWinHelp->Hide();
151 m_scrolledWindowAbout->Show();
153 m_scrolledWindowAbout->Refresh();
154 m_panelMainLinks->Refresh();
157void AboutFrameImpl::RecalculateSize(
void) {
158#ifdef __OCPN__ANDROID__
162 esize.x = GetCharWidth() * 110;
163 esize.y = GetCharHeight() * 20;
165 wxSize dsize = GetParent()->GetClientSize();
166 esize.y = wxMin(esize.y, dsize.y - (2 * GetCharHeight()));
167 esize.x = wxMin(esize.x, dsize.x - (1 * GetCharHeight()));
168 SetClientSize(esize);
170 wxSize fsize = GetSize();
171 fsize.y = wxMin(fsize.y, dsize.y - (2 * GetCharHeight()));
172 fsize.x = wxMin(fsize.x, dsize.x - (1 * GetCharHeight()));
Represents the main frame for the About dialog.
General purpose GUI support.