9 #include "AboutFrame.h"
14 AboutFrame::AboutFrame(wxWindow* parent, wxWindowID
id,
const wxString& title,
15 const wxPoint& pos,
const wxSize& size,
long style)
16 : wxFrame(parent, id, title, pos, size, style) {
17 this->SetSizeHints(wxSize(500, 300), wxDefaultSize);
19 wxBoxSizer* bSizerMain;
20 bSizerMain =
new wxBoxSizer(wxVERTICAL);
22 wxBoxSizer* bSizerContentMain;
23 bSizerContentMain =
new wxBoxSizer(wxHORIZONTAL);
25 wxBoxSizer* bSizerLeftColumn;
26 bSizerLeftColumn =
new wxBoxSizer(wxVERTICAL);
28 m_bitmapLogo =
new wxStaticBitmap(
this, wxID_ANY, wxNullBitmap,
29 wxDefaultPosition, wxSize(100, 100), 0);
30 m_bitmapLogo->SetMaxSize(wxSize(100, 100));
32 bSizerLeftColumn->Add(m_bitmapLogo, 0, wxALL, 10);
34 bSizerLeftColumn->Add(0, 0, 1, wxEXPAND, 5);
36 m_btnBack =
new wxButton(
this, wxID_ANY, _(
"< Back"), wxDefaultPosition,
37 wxDefaultSize, wxBU_EXACTFIT);
38 bSizerLeftColumn->Add(m_btnBack, 0, wxALL, 5);
40 bSizerContentMain->Add(bSizerLeftColumn, 0, wxEXPAND, 5);
42 wxBoxSizer* bSizerContent;
43 bSizerContent =
new wxBoxSizer(wxVERTICAL);
45 m_scrolledWindowAbout =
new wxScrolledWindow(
46 this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
47 m_scrolledWindowAbout->SetScrollRate(5, 5);
48 wxBoxSizer* bSizerAbout;
49 bSizerAbout =
new wxBoxSizer(wxVERTICAL);
52 new wxStaticText(m_scrolledWindowAbout, wxID_ANY, _(
"OpenCPN"),
53 wxDefaultPosition, wxDefaultSize, 0);
54 m_staticTextOCPN->Wrap(-1);
55 m_staticTextOCPN->SetFont(wxFont(30, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
56 wxFONTWEIGHT_BOLD,
false, wxEmptyString));
58 bSizerAbout->Add(m_staticTextOCPN, 0, wxALL, 5);
61 new wxStaticText(m_scrolledWindowAbout, wxID_ANY, _T(
"5.6.0"),
62 wxDefaultPosition, wxDefaultSize, 0);
63 m_staticTextVersion->Wrap(-1);
64 m_staticTextVersion->SetFont(wxFont(wxNORMAL_FONT->GetPointSize(),
65 wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
66 wxFONTWEIGHT_BOLD,
false, wxEmptyString));
68 bSizerAbout->Add(m_staticTextVersion, 0, wxALL, 5);
70 wxBoxSizer* bSizerAuthors1;
71 bSizerAuthors1 =
new wxBoxSizer(wxHORIZONTAL);
73 m_staticTextCopyYears =
74 new wxStaticText(m_scrolledWindowAbout, wxID_ANY, _(
"(c) 2000-2023"),
75 wxDefaultPosition, wxDefaultSize, 0);
76 m_staticTextCopyYears->Wrap(-1);
77 bSizerAuthors1->Add(m_staticTextCopyYears, 0, wxALL, 5);
80 new wxHyperlinkCtrl(m_scrolledWindowAbout, wxID_ANY,
81 _(
"The OpenCPN Authors"), wxT(
"https://opencpn.org"),
82 wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
83 m_hyperlinkAuthors->SetFont(
84 wxFont(wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT,
85 wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
false, wxEmptyString));
87 bSizerAuthors1->Add(m_hyperlinkAuthors, 0, wxALIGN_CENTER_VERTICAL, 5);
89 bSizerAbout->Add(bSizerAuthors1, 0, wxEXPAND, 5);
91 m_staticTextDescription =
new wxStaticText(
92 m_scrolledWindowAbout, wxID_ANY,
93 _(
"OpenCPN is a Free Software project, built by sailors.\nIt is freely "
94 "available to download and distribute without charge."),
95 wxDefaultPosition, wxDefaultSize, 0);
96 m_staticTextDescription->Wrap(380);
97 bSizerAbout->Add(m_staticTextDescription, 0, wxALL, 5);
99 wxBoxSizer* bSizerParticipate;
100 bSizerParticipate =
new wxBoxSizer(wxHORIZONTAL);
103 new wxStaticText(m_scrolledWindowAbout, wxID_ANY, _(
"Want to help?"),
104 wxDefaultPosition, wxDefaultSize, 0);
105 m_staticTextHelp->Wrap(-1);
106 bSizerParticipate->Add(m_staticTextHelp, 0, wxALL | wxTOP, 5);
108 m_hyperlinkDonate =
new wxHyperlinkCtrl(
109 m_scrolledWindowAbout, wxID_ANY, _(
"Donate"),
110 wxT(
"https://sourceforge.net/donate/index.php?group_id=180842"),
111 wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
112 m_hyperlinkDonate->SetFont(wxFont(wxNORMAL_FONT->GetPointSize(),
113 wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
114 wxFONTWEIGHT_NORMAL,
false, wxEmptyString));
116 bSizerParticipate->Add(m_hyperlinkDonate, 0, wxALIGN_CENTER_VERTICAL, 5);
118 m_staticTextOr =
new wxStaticText(m_scrolledWindowAbout, wxID_ANY, _(
"or"),
119 wxDefaultPosition, wxDefaultSize, 0);
120 m_staticTextOr->Wrap(-1);
121 bSizerParticipate->Add(m_staticTextOr, 0, wxALL, 5);
123 m_hyperlinkGetInvolved =
124 new wxHyperlinkCtrl(m_scrolledWindowAbout, wxID_ANY, _(
"get involved!"),
125 wxT(
"https://github.com/OpenCPN/OpenCPN"),
126 wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
127 m_hyperlinkGetInvolved->SetFont(
128 wxFont(wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT,
129 wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
false, wxEmptyString));
131 bSizerParticipate->Add(m_hyperlinkGetInvolved, 0, wxALIGN_CENTER_VERTICAL, 5);
133 bSizerAbout->Add(bSizerParticipate, 0, wxEXPAND, 5);
135 wxBoxSizer* bSizerLogFile;
136 bSizerLogFile =
new wxBoxSizer(wxHORIZONTAL);
138 m_staticTextLogfile =
139 new wxStaticText(m_scrolledWindowAbout, wxID_ANY, _(
"Logfile:"),
140 wxDefaultPosition, wxDefaultSize, 0);
141 m_staticTextLogfile->Wrap(-1);
142 bSizerLogFile->Add(m_staticTextLogfile, 0, wxALL, 5);
144 m_hyperlinkLogFile =
new wxHyperlinkCtrl(
145 m_scrolledWindowAbout, wxID_ANY,
146 _T(
"/Users/nohal/Library/Logs/opencpn.log"),
147 wxT(
"http://www.wxformbuilder.org"), wxDefaultPosition, wxDefaultSize,
148 wxHL_CONTEXTMENU | wxHL_ALIGN_LEFT);
149 m_hyperlinkLogFile->SetFont(
150 wxFont(wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT,
151 wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
false, wxEmptyString));
153 bSizerLogFile->Add(m_hyperlinkLogFile, 0, wxALL, 5);
155 bSizerAbout->Add(bSizerLogFile, 1, wxEXPAND | wxTOP, 15);
157 wxBoxSizer* bSizerIniFile;
158 bSizerIniFile =
new wxBoxSizer(wxHORIZONTAL);
160 m_staticTextIniFile =
161 new wxStaticText(m_scrolledWindowAbout, wxID_ANY, _(
"Config file:"),
162 wxDefaultPosition, wxDefaultSize, 0);
163 m_staticTextIniFile->Wrap(-1);
164 bSizerIniFile->Add(m_staticTextIniFile, 0, wxALL, 5);
166 m_hyperlinkIniFile =
new wxHyperlinkCtrl(
167 m_scrolledWindowAbout, wxID_ANY,
168 _T(
"/Users/nohal/Library/Preferences/opencpn/opencpn.ini"),
169 wxT(
"http://www.wxformbuilder.org"), wxDefaultPosition, wxDefaultSize,
170 wxHL_CONTEXTMENU | wxHL_ALIGN_LEFT);
171 m_hyperlinkIniFile->SetFont(
172 wxFont(wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT,
173 wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
false, wxEmptyString));
174 m_hyperlinkIniFile->SetToolTip(_(
"Copy to clipboard"));
176 bSizerIniFile->Add(m_hyperlinkIniFile, 0, wxALL, 5);
178 bSizerAbout->Add(bSizerIniFile, 1, wxEXPAND, 5);
180 auto bApiInfo =
new wxBoxSizer(wxHORIZONTAL);
181 std::ostringstream api_os;
182 api_os << _(
"Plugin API: ") << API_VERSION_MAJOR * 100 + API_VERSION_MINOR;
184 new wxStaticText(m_scrolledWindowAbout, wxID_ANY, api_os.str());
185 bApiInfo->Add(API_info, 0, wxALL, 5);
186 bSizerAbout->Add(bApiInfo, 1, wxEXPAND, 5);
188 m_scrolledWindowAbout->SetSizer(bSizerAbout);
189 m_scrolledWindowAbout->Layout();
190 bSizerAbout->Fit(m_scrolledWindowAbout);
191 bSizerContent->Add(m_scrolledWindowAbout, 1, wxEXPAND | wxALL, 5);
193 m_htmlWinAuthors =
new wxHtmlWindow(
this, wxID_ANY, wxDefaultPosition,
194 wxDefaultSize, wxHW_SCROLLBAR_AUTO);
195 bSizerContent->Add(m_htmlWinAuthors, 1, wxALL | wxEXPAND, 5);
197 m_htmlWinLicense =
new wxHtmlWindow(
this, wxID_ANY, wxDefaultPosition,
198 wxDefaultSize, wxHW_SCROLLBAR_AUTO);
199 bSizerContent->Add(m_htmlWinLicense, 1, wxALL | wxEXPAND, 5);
201 #if wxUSE_WEBVIEW && defined(HAVE_WEBVIEW)
202 m_htmlWinHelp = wxWebView::New(
this, wxID_ANY);
204 m_htmlWinHelp =
new wxHtmlWindow(
this, wxID_ANY, wxDefaultPosition,
205 wxDefaultSize, wxHW_SCROLLBAR_AUTO);
207 bSizerContent->Add(m_htmlWinHelp, 1, wxALL | wxEXPAND, 5);
209 bSizerContentMain->Add(bSizerContent, 1, wxEXPAND, 5);
211 bSizerMain->Add(bSizerContentMain, 1, wxEXPAND, 5);
213 wxBoxSizer* bSizerMainLnks;
214 bSizerMainLnks =
new wxBoxSizer(wxHORIZONTAL);
216 m_panelMainLinks =
new wxPanel(
this, wxID_ANY, wxDefaultPosition,
217 wxDefaultSize, wxTAB_TRAVERSAL);
218 m_panelMainLinks->SetBackgroundColour(wxColour(153, 153, 153));
220 wxBoxSizer* bSizerLinksInner;
221 bSizerLinksInner =
new wxBoxSizer(wxHORIZONTAL);
223 bSizerLinksInner->Add(0, 0, 1, wxEXPAND, 5);
226 new wxHyperlinkCtrl(m_panelMainLinks, wxID_ANY, _(
"OpenCPN Website"),
227 wxT(
"https://opencpn.org"), wxDefaultPosition,
228 wxDefaultSize, wxHL_DEFAULT_STYLE);
230 m_hyperlinkWebsite->SetNormalColour(wxColour(255, 255, 255));
231 m_hyperlinkWebsite->SetFont(wxFont(wxNORMAL_FONT->GetPointSize(),
232 wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
233 wxFONTWEIGHT_BOLD,
false, wxEmptyString));
235 bSizerLinksInner->Add(m_hyperlinkWebsite, 0, wxALL, 20);
237 m_hyperlinkHelp =
new wxHyperlinkCtrl(
238 m_panelMainLinks, wxID_ANY, _(
"Help"), wxT(
"file://index.html"),
239 wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
241 m_hyperlinkHelp->SetNormalColour(wxColour(255, 255, 255));
242 m_hyperlinkHelp->SetFont(wxFont(wxNORMAL_FONT->GetPointSize(),
243 wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
244 wxFONTWEIGHT_BOLD,
false, wxEmptyString));
246 bSizerLinksInner->Add(m_hyperlinkHelp, 0, wxALL, 20);
248 m_hyperlinkLicense =
new wxHyperlinkCtrl(
249 m_panelMainLinks, wxID_ANY, _(
"License"), wxT(
"file://license.html"),
250 wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
252 m_hyperlinkLicense->SetNormalColour(wxColour(255, 255, 255));
253 m_hyperlinkLicense->SetFont(wxFont(wxNORMAL_FONT->GetPointSize(),
254 wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
255 wxFONTWEIGHT_BOLD,
false, wxEmptyString));
257 bSizerLinksInner->Add(m_hyperlinkLicense, 0, wxALL, 20);
259 bSizerLinksInner->Add(0, 0, 1, wxEXPAND, 5);
261 m_panelMainLinks->SetSizer(bSizerLinksInner);
262 m_panelMainLinks->Layout();
263 bSizerLinksInner->Fit(m_panelMainLinks);
264 bSizerMainLnks->Add(m_panelMainLinks, 1, wxEXPAND, 0);
266 bSizerMain->Add(bSizerMainLnks, 0, wxEXPAND, 0);
268 this->SetSizer(bSizerMain);
271 this->Centre(wxBOTH);
274 this->Connect(wxEVT_ACTIVATE,
275 wxActivateEventHandler(AboutFrame::AboutFrameOnActivate));
276 this->Connect(wxEVT_CLOSE_WINDOW,
277 wxCloseEventHandler(AboutFrame::AboutFrameOnClose));
278 m_btnBack->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
279 wxCommandEventHandler(AboutFrame::m_btnBackOnButtonClick),
281 m_hyperlinkAuthors->Connect(
282 wxEVT_COMMAND_HYPERLINK,
283 wxHyperlinkEventHandler(AboutFrame::OnLinkAuthors), NULL,
this);
284 m_hyperlinkDonate->Connect(wxEVT_COMMAND_HYPERLINK,
285 wxHyperlinkEventHandler(AboutFrame::OnLinkDonate),
287 m_hyperlinkGetInvolved->Connect(
288 wxEVT_COMMAND_HYPERLINK,
289 wxHyperlinkEventHandler(AboutFrame::OnLinkGetInvolved), NULL,
this);
290 m_hyperlinkLogFile->Connect(
291 wxEVT_COMMAND_HYPERLINK,
292 wxHyperlinkEventHandler(AboutFrame::OnLinkLogfile), NULL,
this);
293 m_hyperlinkIniFile->Connect(
294 wxEVT_COMMAND_HYPERLINK,
295 wxHyperlinkEventHandler(AboutFrame::OnLinkConfigfile), NULL,
this);
296 m_htmlWinHelp->Connect(
297 wxEVT_COMMAND_HTML_LINK_CLICKED,
298 wxHtmlLinkEventHandler(AboutFrame::m_htmlWinHelpOnHtmlLinkClicked), NULL,
300 m_hyperlinkHelp->Connect(wxEVT_COMMAND_HYPERLINK,
301 wxHyperlinkEventHandler(AboutFrame::OnLinkHelp),
303 m_hyperlinkLicense->Connect(
304 wxEVT_COMMAND_HYPERLINK,
305 wxHyperlinkEventHandler(AboutFrame::OnLinkLicense), NULL,
this);
308 AboutFrame::~AboutFrame() {
310 this->Disconnect(wxEVT_ACTIVATE,
311 wxActivateEventHandler(AboutFrame::AboutFrameOnActivate));
312 this->Disconnect(wxEVT_CLOSE_WINDOW,
313 wxCloseEventHandler(AboutFrame::AboutFrameOnClose));
314 m_btnBack->Disconnect(
315 wxEVT_COMMAND_BUTTON_CLICKED,
316 wxCommandEventHandler(AboutFrame::m_btnBackOnButtonClick), NULL,
this);
317 m_hyperlinkAuthors->Disconnect(
318 wxEVT_COMMAND_HYPERLINK,
319 wxHyperlinkEventHandler(AboutFrame::OnLinkAuthors), NULL,
this);
320 m_hyperlinkDonate->Disconnect(
321 wxEVT_COMMAND_HYPERLINK,
322 wxHyperlinkEventHandler(AboutFrame::OnLinkDonate), NULL,
this);
323 m_hyperlinkGetInvolved->Disconnect(
324 wxEVT_COMMAND_HYPERLINK,
325 wxHyperlinkEventHandler(AboutFrame::OnLinkGetInvolved), NULL,
this);
326 m_hyperlinkLogFile->Disconnect(
327 wxEVT_COMMAND_HYPERLINK,
328 wxHyperlinkEventHandler(AboutFrame::OnLinkLogfile), NULL,
this);
329 m_hyperlinkIniFile->Disconnect(
330 wxEVT_COMMAND_HYPERLINK,
331 wxHyperlinkEventHandler(AboutFrame::OnLinkConfigfile), NULL,
this);
332 m_htmlWinHelp->Disconnect(
333 wxEVT_COMMAND_HTML_LINK_CLICKED,
334 wxHtmlLinkEventHandler(AboutFrame::m_htmlWinHelpOnHtmlLinkClicked), NULL,
336 m_hyperlinkHelp->Disconnect(wxEVT_COMMAND_HYPERLINK,
337 wxHyperlinkEventHandler(AboutFrame::OnLinkHelp),
339 m_hyperlinkLicense->Disconnect(
340 wxEVT_COMMAND_HYPERLINK,
341 wxHyperlinkEventHandler(AboutFrame::OnLinkLicense), NULL,
this);