50#include <wx/apptrait.h>
51#include <wx/stdpaths.h>
52#include <wx/filename.h>
53#include <wx/tokenzr.h>
54#include <wx/textfile.h>
55#include <wx/jsonval.h>
56#include <wx/jsonreader.h>
83#include "snd_config.h"
84#include "std_filesystem.h"
88#include "androidUTIL.h"
96#ifdef OCPN_USE_CRASHREPORT
118void appendOSDirSlash(wxString *pString);
121struct sigaction sa_all;
122struct sigaction sa_all_old;
129#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
130extern wxLocale *plocale_def_lang;
141static const char *
const DEFAULT_XDG_DATA_DIRS =
142 "~/.local/share:/usr/local/share:/usr/share";
145static const char PATH_SEP =
';';
147static const char PATH_SEP =
':';
150static bool checkIfFlatpacked() {
152 if (!wxGetEnv(
"FLATPAK_ID", &
id)) {
155 return id ==
"org.opencpn.OpenCPN";
158OCPNPlatform::OCPNPlatform() {
160 m_bdisableWindowsDisplayEnum =
false;
161 m_monitorWidth = m_monitorHeight = 0;
164 m_displaySizeMMOverride.push_back(0);
166 m_pluginDataPath =
"";
169OCPNPlatform::~OCPNPlatform() {
181int MyNewHandler(
size_t size) {
183 throw std::bad_alloc();
204void catch_signals(
int signo) {
235#ifdef OCPN_USE_CRASHREPORT
237int CALLBACK CrashCallback(CR_CRASH_CALLBACK_INFO *pInfo) {
238 wxLog::GetActiveTarget()->Flush();
239 return CR_CB_DODEFAULT;
244void OCPNPlatform::Initialize_1() {
245#ifdef OCPN_USE_CRASHREPORT
249 CR_INSTALL_INFO info;
250 memset(&info, 0,
sizeof(CR_INSTALL_INFO));
251 info.cb =
sizeof(CR_INSTALL_INFO);
252 info.pszAppName = L
"OpenCPN";
254 info.pszAppVersion = wxString(VERSION_FULL).c_str();
256 int type = MiniDumpNormal;
259 type |= MiniDumpWithDataSegs;
270 info.uMiniDumpType = (MINIDUMP_TYPE)type;
273 info.dwFlags = CR_INST_ALL_POSSIBLE_HANDLERS;
276 info.dwFlags &= ~CR_INST_NEW_OPERATOR_ERROR_HANDLER;
279 info.dwFlags |= CR_INST_ALLOW_ATTACH_MORE_FILES;
282 info.dwFlags |= CR_INST_SHOW_ADDITIONAL_INFO_FIELDS;
286 if (g_bEmailCrashReport) {
287 info.pszUrl = L
"https://bigdumboat.com/crashrpt/ocpn_crashrpt.php";
288 info.uPriorities[CR_HTTP] = 3;
290 info.dwFlags |= CR_INST_DONT_SEND_REPORT;
291 info.uPriorities[CR_HTTP] = CR_NEGATIVE_PRIORITY;
294 info.uPriorities[CR_SMTP] =
295 CR_NEGATIVE_PRIORITY;
296 info.uPriorities[CR_SMAPI] =
297 CR_NEGATIVE_PRIORITY;
299 wxStandardPaths &crash_std_path =
g_Platform->GetStdPaths();
301 wxString crash_rpt_save_locn = crash_std_path.GetConfigDir();
303 wxFileName exec_path_crash(crash_std_path.GetExecutablePath());
304 crash_rpt_save_locn =
305 exec_path_crash.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
308 wxString locn = crash_rpt_save_locn +
"\\CrashReports";
310 if (!wxDirExists(locn)) wxMkdir(locn);
312 if (wxDirExists(locn)) {
313 wxCharBuffer buf = locn.ToUTF8();
315 if (buf && (locn.Length() <
sizeof(wlocn))) {
316 MultiByteToWideChar(0, 0, buf.data(), -1, wlocn,
sizeof(wlocn) - 1);
317 info.pszErrorReportSaveDir = (LPCWSTR)wlocn;
322 wxFileName exec_path_crash(crash_std_path.GetExecutablePath());
323 wxString policy_file =
324 exec_path_crash.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
325 policy_file +=
"PrivacyPolicy.txt";
326 policy_file.Prepend(
"file:");
328 info.pszPrivacyPolicyURL = policy_file.c_str();
331 int nResult = crInstall(&info);
334 crGetLastErrorMsg(buff, 256);
341 crSetCrashCallback(CrashCallback, NULL);
344 crAddScreenshot2(CR_AS_PROCESS_WINDOWS | CR_AS_USE_JPEG_FORMAT, 95);
347 wxString home_data_crash = crash_std_path.GetConfigDir();
349 wxFileName f(crash_std_path.GetExecutablePath());
350 home_data_crash = f.GetPath();
352 appendOSDirSlash(&home_data_crash);
354 wxString config_crash =
"opencpn.ini";
355 config_crash.Prepend(home_data_crash);
356 crAddFile2(config_crash.c_str(), NULL, NULL,
357 CR_AF_MISSING_FILE_OK | CR_AF_ALLOW_DELETE);
359 wxString log_crash =
"opencpn.log";
360 log_crash.Prepend(home_data_crash);
361 crAddFile2(log_crash.c_str(), NULL, NULL,
362 CR_AF_MISSING_FILE_OK | CR_AF_ALLOW_DELETE);
368#if wxUSE_ON_FATAL_EXCEPTION
370 wxHandleFatalExceptions(
true);
376 _set_new_handler(MyNewHandler);
386 HANDLE hProc = GetCurrentProcess();
390 DuplicateHandle( hProc, hProc, hProc, &hDup, 0, FALSE, DUPLICATE_SAME_ACCESS );
393 GetProcessAffinityMask( hDup, &procMask, &sysMask );
397 if( ( procMask & 1 ) == 1 ) newMask = 1;
399 if( ( procMask & 2 ) == 2 ) newMask = 2;
401 if( ( procMask & 4 ) == 4 ) newMask = 4;
403 if( ( procMask & 8 ) == 8 ) newMask = 8;
406 BOOL res = SetProcessAffinityMask( hDup, (DWORD_PTR) newMask );
420 wxPlatformInfo Platform;
421 if (Platform.GetOperatingSystemId() == wxOS_WINDOWS_9X)
422 SetUnhandledExceptionFilter(&MyUnhandledExceptionFilter);
433 sa_all.sa_handler = catch_signals;
434 sigemptyset(&sa_all.sa_mask);
440 sigaction(SIGUSR1, NULL,
444 sigaction(SIGUSR1, &sa_all, NULL);
445 sigaction(SIGUSR1, NULL,
448 sigaction(SIGTERM, &sa_all, NULL);
449 sigaction(SIGTERM, NULL, &sa_all_old);
451 sigaction(SIGHUP, &sa_all, NULL);
452 sigaction(SIGHUP, NULL, &sa_all_old);
457 qDebug() <<
"Initialize_1()";
467void OCPNPlatform::Initialize_2() {
469 wxLogMessage(androidGetDeviceInfo());
473 wxChar sep = wxFileName::GetPathSeparator();
476 if (ChartDir.Last() != sep) ChartDir.Append(sep);
477 ChartDir.Append(
"Charts");
478 if (!::wxDirExists(ChartDir)) {
483 if (GRIBDir.Last() != sep) GRIBDir.Append(sep);
484 GRIBDir.Append(
"GRIBS");
485 if (!::wxDirExists(GRIBDir)) {
490 if (VDRDir.Last() != sep) VDRDir.Append(sep);
491 VDRDir.Append(
"VDR");
492 if (!::wxDirExists(VDRDir)) {
497 if (g_Android_SDK_Version >= 30) {
498 if (!g_gpx_path.StartsWith(androidGetDocumentsDirectory())) {
499 g_gpx_path = androidGetDocumentsDirectory();
506 g_toolbar_scalefactor = GetToolbarScaleFactor(g_GUIScaleFactor);
508 if (!configdir.DirExists()) {
509 if (!configdir.Mkdir()) {
510 auto msg = std::string(
"Cannot create config directory: ");
511 wxLogWarning(msg + configdir.GetFullPath());
518void OCPNPlatform::Initialize_3() {
519 bool bcapable = IsGLCapable();
525 bool bAndroid =
false;
534 g_bdisable_opengl =
false;
535 pConfig->UpdateSettings();
542 if ((g_bFirstRun || g_bUpgradeInProcess || bAndroid) && bcapable) {
546 g_GLOptions.m_bUseAcceleratedPanning =
true;
547 g_GLOptions.m_bTextureCompression =
true;
548 g_GLOptions.m_bTextureCompressionCaching =
true;
550 g_GLOptions.m_iTextureDimension = 512;
551 g_GLOptions.m_iTextureMemorySize = 64;
553 g_GLOptions.m_GLPolygonSmoothing =
true;
554 g_GLOptions.m_GLLineSmoothing =
true;
558 gFrame->SetGPSCompassScale();
566 if (g_bFirstRun || g_bUpgradeInProcess) {
571 g_FlushNavobjChangesTimeout = 300;
575void OCPNPlatform::Initialize_4() {
577 if (
pSelect)
pSelect->SetSelectPixelRadius(wxMax(25, 6.0 * getAndroidDPmm()));
579 pSelectTC->SetSelectPixelRadius(wxMax(25, 6.0 * getAndroidDPmm()));
581 pSelectAIS->SetSelectPixelRadius(wxMax(25, 6.0 * getAndroidDPmm()));
588 options_lastPage = 1;
592void OCPNPlatform::OnExit_1() {}
594void OCPNPlatform::OnExit_2() {
595#ifdef OCPN_USE_CRASHREPORT
605bool HasGLExt(
wxJSONValue &glinfo,
const std::string ext) {
606 if (!glinfo.
HasMember(
"GL_EXTENSIONS")) {
609 for (
int i = 0; i < glinfo[
"GL_EXTENSIONS"].
Size(); i++) {
610 if (glinfo[
"GL_EXTENSIONS"][i].AsString() == ext) {
617bool OCPNPlatform::BuildGLCaps(
void *pbuf) {
619 fs::path ep(GetExePath().ToStdString());
621 std::string gl_util_exe =
"opencpn-glutil";
623 std::string gl_util_exe =
"opencpn-glutil.exe";
625 fs::path gl_util_path = ep.parent_path().append(gl_util_exe);
627 if (!fs::exists(gl_util_path)) {
630 wxLogMessage(
"OpenGL test utility not found at %s.", gl_util_path.c_str());
635 .append(
"gl_caps.json")
638 wxString cmd = wxString::Format(
"\"%s\" opengl-info \"%s\"",
639 gl_util_path.c_str(), gl_json.c_str());
641 wxLogMessage(
"Starting OpenGL test utility: %s", cmd);
643 wxArrayString output;
644 if (
long res = wxExecute(cmd, output); res != 0) {
645 wxLogMessage(
"OpenGL test utility failed with exit code %d", res);
646 for (
const auto &l : output) {
652 wxFileInputStream fis(gl_json);
655 reader.
Parse(fis, &root);
657 wxLogMessage(
"Failed to parse JSON output from OpenGL test utility.");
658 for (
const auto &l : reader.GetErrors()) {
667 pcaps->Renderer = root[
"GL_RENDERER"].
AsString();
669 wxLogMessage(
"GL_RENDERER not found.");
673 pcaps->Version = root[
"GL_VERSION"].
AsString();
675 wxLogMessage(
"GL_VERSION not found.");
678 if (root.
HasMember(
"GL_SHADING_LANGUAGE_VERSION")) {
679 pcaps->GLSL_Version = root[
"GL_SHADING_LANGUAGE_VERSION"].
AsString();
681 wxLogMessage(
"GL_SHADING_LANGUAGE_VERSION not found.");
685 if (!root[
"GL_USABLE"].AsBool()) {
686 wxLogMessage(
"OpenGL test utility reports that OpenGL is not usable.");
690 wxLogMessage(
"GL_USABLE not found.");
693 pcaps->dGLSL_Version = 0;
694 pcaps->dGLSL_Version = ::atof(pcaps->GLSL_Version.c_str());
695 if (pcaps->dGLSL_Version < 1.2) {
697 msg.Printf(
"GLCaps Probe: OpenGL-> GLSL Version reported: ");
698 msg += wxString(pcaps->GLSL_Version.c_str());
699 msg +=
"\n OpenGL disabled due to insufficient OpenGL capabilities";
701 pcaps->bCanDoGLSL =
false;
704 pcaps->bCanDoGLSL =
true;
705 if (HasGLExt(root,
"GL_ARB_texture_non_power_of_two")) {
706 pcaps->TextureRectangleFormat = GL_TEXTURE_2D;
707 }
else if (HasGLExt(root,
"GL_OES_texture_npot")) {
708 pcaps->TextureRectangleFormat = GL_TEXTURE_2D;
709 }
else if (HasGLExt(root,
"GL_ARB_texture_rectangle")) {
710 pcaps->TextureRectangleFormat = GL_TEXTURE_RECTANGLE_ARB;
713 pcaps->bOldIntel =
false;
715 pcaps->bCanDoFBO = HasGLExt(root,
"GL_EXT_framebuffer_object");
716 if (!pcaps->TextureRectangleFormat) {
717 pcaps->bCanDoFBO =
false;
720 pcaps->bCanDoVBO = HasGLExt(
721 root,
"GL_ARB_vertex_buffer_object");
733 wxGLContext *pctx =
new wxGLContext(tcanvas);
734 tcanvas->SetCurrent(*pctx);
738 char *str = (
char *)glGetString(GL_RENDERER);
740 wxLogMessage(
"GL_RENDERER not found.");
745 pcaps->Renderer = std::string(str);
747 char *stv = (
char *)glGetString(GL_VERSION);
749 wxLogMessage(
"GL_VERSION not found");
754 pcaps->Version = std::string(stv);
756 char *stsv = (
char *)glGetString(GL_SHADING_LANGUAGE_VERSION);
758 wxLogMessage(
"GL_SHADING_LANGUAGE_VERSION not found");
763 pcaps->GLSL_Version = std::string(stsv);
765 pcaps->dGLSL_Version = 0;
766 pcaps->dGLSL_Version = ::atof(pcaps->GLSL_Version.c_str());
768 if (pcaps->dGLSL_Version < 1.2) {
770 msg.Printf(
"GLCaps Probe: OpenGL-> GLSL Version reported: ");
771 msg += wxString(pcaps->GLSL_Version.c_str());
772 msg +=
"\n OpenGL disabled due to insufficient OpenGL capabilities";
774 pcaps->bCanDoGLSL =
false;
780 pcaps->bCanDoGLSL =
true;
782 if (QueryExtension(
"GL_ARB_texture_non_power_of_two"))
783 pcaps->TextureRectangleFormat = GL_TEXTURE_2D;
784 else if (QueryExtension(
"GL_OES_texture_npot"))
785 pcaps->TextureRectangleFormat = GL_TEXTURE_2D;
786 else if (QueryExtension(
"GL_ARB_texture_rectangle"))
787 pcaps->TextureRectangleFormat = GL_TEXTURE_RECTANGLE_ARB;
789 pcaps->bOldIntel =
false;
792 pcaps->bCanDoVBO =
true;
794#if defined(__WXMSW__) || defined(__WXOSX__)
795 if (pcaps->bOldIntel) pcaps->bCanDoVBO =
false;
799 pcaps->bCanDoVBO =
false;
803 pcaps->bCanDoFBO =
true;
807 if (!pcaps->TextureRectangleFormat) pcaps->bCanDoFBO =
false;
810 if (!QueryExtension(
"GL_EXT_framebuffer_object")) pcaps->bCanDoFBO =
false;
820bool OCPNPlatform::IsGLCapable() {
829 if (g_bdisable_opengl)
return false;
831 wxLogMessage(
"Starting OpenGL test...");
832 wxLog::FlushActive();
836 bool bcaps = BuildGLCaps(GL_Caps);
838 wxLogMessage(
"OpenGL test complete.");
840 wxLogMessage(
"BuildGLCaps fails.");
841 wxLog::FlushActive();
849 if (!GL_Caps->bCanDoGLSL) {
855 if (!GL_Caps->bCanDoFBO) {
860 wxLogMessage(
"OpenGL determined CAPABLE.");
861 wxLog::FlushActive();
863 g_bdisable_opengl =
false;
867 pConfig->UpdateSettings();
876void OCPNPlatform::SetLocaleSearchPrefixes() {
879#if defined(__WINDOWS__)
882 wxString locale_location = GetSharedDataDir();
883 locale_location +=
"share\\locale";
884 wxLocale::AddCatalogLookupPathPrefix(locale_location);
885 wxString imsg =
"Adding catalog lookup path: ";
886 imsg += locale_location;
891 usrShare.RemoveLastDir();
892 locale_location = usrShare.GetFullPath() + (
"share\\locale");
893 wxLocale::AddCatalogLookupPathPrefix(locale_location);
894 imsg =
"Adding catalog lookup path: ";
895 imsg += locale_location;
898#elif defined(__ANDROID__)
900 wxString locale_location = GetSharedDataDir() +
"locale";
901 wxLocale::AddCatalogLookupPathPrefix(locale_location);
903#elif defined(__UNIX__) && !defined(__WINE__)
908 wxString locale_location;
909 if (!wxGetEnv(
"OPENCPN_PREFIX", &locale_location)) {
910 locale_location =
"/usr/local";
918 location.AssignDir(locale_location);
919 location.AppendDir(
"share");
920 location.SetName(
"locale");
921 locale_location = location.GetFullPath();
922 wxLocale::AddCatalogLookupPathPrefix(locale_location);
926 wxString managed_locale_location(dir +
"/locale");
927 wxLocale::AddCatalogLookupPathPrefix(managed_locale_location);
933 "/Library/Application Support/OpenCPN/Contents/Resources";
934 wxString Mac_managed_locale_location(macDir);
935 wxLocale::AddCatalogLookupPathPrefix(Mac_managed_locale_location);
941wxString OCPNPlatform::GetDefaultSystemLocale() {
942 wxLogMessage(
"Getting DefaultSystemLocale...");
944 wxString retval =
"en_US";
948 const wxLanguageInfo *languageInfo =
949 wxLocale::GetLanguageInfo(wxLANGUAGE_DEFAULT);
950 if (languageInfo) retval = languageInfo->CanonicalName;
952#if defined(__WXMSW__)
953 LANGID lang_id = GetUserDefaultUILanguage();
956 const wxLanguageInfo *languageInfoW = 0;
957 if (0 != GetLocaleInfo(MAKELCID(lang_id, SORT_DEFAULT), LOCALE_SENGLANGUAGE,
959 wxString lstring = wxString(lngcp);
961 languageInfoW = wxLocale::FindLanguageInfo(lngcp);
963 wxLogMessage(
"Found LanguageInfo for: " + lstring);
965 wxLogMessage(
"Could not find LanguageInfo for: " + lstring);
967 wxLogMessage(
"Could not get LocaleInfo, using wxLANGUAGE_DEFAULT");
968 languageInfoW = wxLocale::GetLanguageInfo(wxLANGUAGE_DEFAULT);
971 if (languageInfoW) retval = languageInfoW->CanonicalName;
974#if defined(__ANDROID__)
975 retval = androidGetAndroidSystemLocale();
983#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
984wxString OCPNPlatform::GetAdjustedAppLocale() {
985 wxString adjLocale = g_locale;
990#if defined(__WXMSW__)
991 if (g_bFirstRun || wxIsEmpty(adjLocale)) {
992 wxRegKey RegKey(wxString(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\OpenCPN"));
993 if (RegKey.Exists()) {
995 "Retrieving initial language selection from Windows Registry");
996 RegKey.QueryValue(wxString(
"InstallerLanguage"), adjLocale);
999 if (wxIsEmpty(adjLocale)) {
1000 if (g_localeOverride.Length())
1001 adjLocale = g_localeOverride;
1003 adjLocale = GetDefaultSystemLocale();
1006#if defined(__ANDROID__)
1007 if (g_localeOverride.Length())
1008 adjLocale = g_localeOverride;
1010 adjLocale = GetDefaultSystemLocale();
1016wxString OCPNPlatform::ChangeLocale(wxString &newLocaleID,
1017 wxLocale *presentLocale,
1018 wxLocale **newLocale) {
1019 wxString return_val;
1021 wxString imsg =
"ChangeLocale: Language load for: ";
1022 imsg += newLocaleID;
1026 delete (wxLocale *)presentLocale;
1028 wxLocale *locale =
new wxLocale;
1029 if (isFlatpacked()) {
1030 std::string path(getenv(
"HOME"));
1031 path +=
"/.var/app/org.opencpn.OpenCPN/data/locale";
1032 locale->AddCatalogLookupPathPrefix(path);
1033 wxLogMessage(
"Using flatpak locales at %s", path.c_str());
1035 wxString loc_lang_canonical;
1037 const wxLanguageInfo *pli = wxLocale::FindLanguageInfo(newLocaleID);
1038 bool b_initok =
false;
1041 locale->Init(pli->Language, 1);
1045 if (!locale->IsOk()) {
1046 wxString imsg =
"ChangeLocale: could not initialize: ";
1047 imsg += newLocaleID;
1051 locale =
new wxLocale;
1052 locale->Init(pli->Language, 0);
1054 loc_lang_canonical = pli->CanonicalName;
1056 b_initok = locale->IsOk();
1063 wxString imsg =
"ChangeLocale: Fall back to en_US";
1067 locale =
new wxLocale;
1068 locale->Init(wxLANGUAGE_ENGLISH_US, 0);
1069 loc_lang_canonical =
1070 wxLocale::GetLanguageInfo(wxLANGUAGE_ENGLISH_US)->CanonicalName;
1074 wxString imsg =
"ChangeLocale: Locale Init OK for: ";
1075 imsg += loc_lang_canonical;
1089 wxString emsg =
"ERROR Loading translation catalog for: ";
1093 wxString imsg =
"Loaded translation catalog for: ";
1100 wxLogMessage(
"Loading catalog for opencpn core.");
1101 locale->AddCatalog(
"opencpn");
1103 return_val = locale->GetCanonicalName();
1106 if (return_val != GetDefaultSystemLocale())
1107 g_localeOverride = return_val;
1109 g_localeOverride =
"";
1112 *newLocale = locale;
1115 setlocale(LC_NUMERIC,
"C");
1126void OCPNPlatform::SetDefaultOptions() {
1128 g_bShowOutlines =
true;
1134 g_MarkLost_Mins = 8;
1135 g_bRemoveLost =
true;
1136 g_RemoveLost_Mins = 10;
1139 g_bSyncCogPredictors =
false;
1140 g_bHideMoored =
false;
1141 g_ShowMoored_Kts = 0.2;
1142 g_SOGminCOG_kts = 0.2;
1143 g_bTrackDaily =
false;
1145 g_bFullScreenQuilt =
true;
1146 g_bQuiltEnable =
true;
1147 g_bskew_comp =
false;
1148 g_bShowAreaNotices =
false;
1149 g_bDrawAISSize =
false;
1150 g_bDrawAISRealtime =
false;
1151 g_AIS_RealtPred_Kts = 0.7;
1152 g_bShowAISName =
false;
1153 g_nTrackPrecision = 2;
1154 g_bPreserveScaleOnX =
true;
1157 gps_watchdog_timeout_ticks = GPS_TIMEOUT_SECONDS;
1158 g_n_ownship_min_mm = 8;
1159 g_bShowMuiZoomButtons =
true;
1160 g_bresponsive =
false;
1164 pConfig->SetPath(
"/Settings/GlobalState");
1165 pConfig->Write(
"bShowS57Text",
true);
1166 pConfig->Write(
"bShowS57ImportantTextOnly",
false);
1167 pConfig->Write(
"nDisplayCategory", (
int)(_DisCat)OTHER);
1168 pConfig->Write(
"nSymbolStyle", (
int)(_LUPname)PAPER_CHART);
1169 pConfig->Write(
"nBoundaryStyle", (
int)(_LUPname)PLAIN_BOUNDARIES);
1171 pConfig->Write(
"bShowSoundg",
true);
1172 pConfig->Write(
"bShowMeta",
false);
1173 pConfig->Write(
"bUseSCAMIN",
true);
1174 pConfig->Write(
"bShowAtonText",
false);
1175 pConfig->Write(
"bShowLightDescription",
false);
1176 pConfig->Write(
"bExtendLightSectors",
true);
1177 pConfig->Write(
"bDeClutterText",
true);
1178 pConfig->Write(
"bShowNationalText",
true);
1180 pConfig->Write(
"S52_MAR_SAFETY_CONTOUR", 3);
1181 pConfig->Write(
"S52_MAR_SHALLOW_CONTOUR", 2);
1182 pConfig->Write(
"S52_MAR_DEEP_CONTOUR", 6);
1183 pConfig->Write(
"S52_MAR_TWO_SHADES", 0);
1184 pConfig->Write(
"S52_DEPTH_UNIT_SHOW", 1);
1186 pConfig->Write(
"ZoomDetailFactorVector", 3);
1188 pConfig->Write(
"nColorScheme", 1);
1192 g_bEnableZoomToCursor =
true;
1194 g_bShowMenuBar =
true;
1201 pConfig->SetPath(
"/PlugIns/chartdldr_pi.dll");
1202 pConfig->Write(
"bEnabled",
true);
1204 pConfig->SetPath(
"/PlugIns/wmm_pi.dll");
1205 pConfig->Write(
"bEnabled",
true);
1207 pConfig->SetPath(
"/Settings/WMM");
1208 pConfig->Write(
"ShowIcon",
true);
1209 pConfig->Write(
"ShowLiveIcon",
true);
1216 pConfig->SetPath(
"/PlugIns/libchartdldr_pi.dylib");
1217 pConfig->Write(
"bEnabled",
true);
1219 pConfig->SetPath(
"/PlugIns/libwmm_pi.dylib");
1220 pConfig->Write(
"bEnabled",
true);
1222 pConfig->SetPath(
"/Settings/WMM");
1223 pConfig->Write(
"ShowIcon",
true);
1224 pConfig->Write(
"ShowLiveIcon",
true);
1231 pConfig->SetPath(
"/PlugIns/libchartdldr_pi.so");
1232 pConfig->Write(
"bEnabled",
true);
1234 pConfig->SetPath(
"/PlugIns/libwmm_pi.so");
1235 pConfig->Write(
"bEnabled",
true);
1237 pConfig->SetPath(
"/Settings/WMM");
1238 pConfig->Write(
"ShowIcon",
true);
1239 pConfig->Write(
"ShowLiveIcon",
true);
1247 g_GLOptions.m_bTextureCompression = 1;
1248 g_GLOptions.m_bTextureCompressionCaching = 1;
1251 qDebug() <<
"SetDefaultOptions";
1254 g_bresponsive =
true;
1255 g_default_font_size = 18;
1258 g_bShowStatusBar =
true;
1259 g_cm93_zoom_factor = 0;
1260 g_oz_vector_scale =
false;
1261 g_fog_overzoom =
false;
1264 g_bShowMuiZoomButtons =
true;
1266 g_GUIScaleFactor = 0;
1267 g_ChartNotRenderScaleFactor = 2.0;
1271 g_toolbarConfig =
"X.....XX.......XX.XXXXXXXXXXX";
1272 g_bPermanentMOBIcon =
false;
1274 wxString sGPS =
"2;3;;0;0;;0;1;0;0;;0;;1;0;0;0;0";
1277 new_params->bEnabled =
true;
1278 TheConnectionParams().push_back(new_params);
1285 pConfig->SetPath(
"/PlugIns/libchartdldr_pi.so");
1286 pConfig->Write(
"bEnabled",
true);
1288 pConfig->SetPath(
"/PlugIns/libwmm_pi.so");
1289 pConfig->Write(
"bEnabled",
true);
1291 pConfig->SetPath(
"/Settings/WMM");
1292 pConfig->Write(
"ShowIcon",
true);
1293 pConfig->Write(
"ShowLiveIcon",
true);
1295 pConfig->SetPath(
"/PlugIns/libgrib_pi.so");
1296 pConfig->Write(
"bEnabled",
true);
1298 pConfig->SetPath(
"/PlugIns/libdashboard_pi.so");
1299 pConfig->Write(
"bEnabled",
true);
1301 pConfig->SetPath(
"/PlugIns/GRIB");
1302 pConfig->Write(
"GRIBCtrlBarPosX", 100);
1303 pConfig->Write(
"GRIBCtrlBarPosY", 0);
1305 pConfig->SetPath(
"/Settings/GRIB");
1306 pConfig->Write(
"CursorDataShown", 0);
1310 pConfig->SetPath(
"/PlugIns/liboesenc_pi.so");
1311 pConfig->Write(
"bEnabled",
true);
1313 pConfig->SetPath(
"/Settings/QTFonts");
1316 wxString str =
"en_US-b25a3899";
1317 wxString pval =
"StatusBar:Roboto,26,-1,5,75,0,0,0,0,0:rgb(0, 0, 0)";
1318 pConfig->Write(str, pval);
1322 str =
"en_US-9c3b3a0d";
1323 pval =
"DialogStatusBar:Roboto,18,-1,5,50,0,0,0,0,0:rgb(0, 0, 0)";
1324 pConfig->Write(str, pval);
1328 pConfig->SetPath(
"/Settings/Others");
1329 pConfig->Write(
"TrackLineColour",
"#C545C3");
1330 g_colourTrackLineColour.Set(197, 69, 195);
1332 qDebug() <<
"SetDefaultOptions.Config";
1343void OCPNPlatform::SetUpgradeOptions(wxString vNew, wxString vOld) {
1346 qDebug() <<
"Upgrade check"
1347 <<
"from: " << vOld.mb_str() <<
" to: " << vNew.mb_str();
1349 if (androidGetVersionCode() > g_AndroidVersionCode) {
1350 qDebug() <<
"Upgrade detected"
1351 <<
"from VC: " << g_AndroidVersionCode
1352 <<
" to VC: " << androidGetVersionCode();
1356 pConfig->SetPath(
"/Settings/GlobalState");
1357 pConfig->Write(
"bShowS57Text",
true);
1360 g_ChartNotRenderScaleFactor = 2.0;
1361 g_n_ownship_min_mm = 8;
1362 g_toolbarConfig =
"X.....XX.......XX.XXXXXXXXXXX";
1365 pConfig->DeleteGroup(
"/Settings/QTFonts");
1366 g_default_font_size = 20;
1369 FontMgr::Get().Shutdown();
1372 g_bShowMuiZoomButtons =
true;
1376 pInit_Chart_Dir->Clear();
1380 pConfig->SetPath(
"/Settings/WMM");
1381 pConfig->Write(
"ShowIcon",
true);
1382 pConfig->Write(
"ShowLiveIcon",
true);
1384 pConfig->SetPath(
"/Canvas/CanvasConfig1");
1385 pConfig->Write(
"canvasENCShowVisibleSectorLights", 0);
1395 AndroidRemoveSystemFile(
1396 "/data/user/0/org.opencpn.opencpn/manPlug/libchartscale_pi.so");
1400 g_colourTrackLineColour.Set(197, 69, 195);
1404 if (!vOld.IsSameAs(vNew)) {
1410 wxChar sep = wxFileName::GetPathSeparator();
1411 if (UserIconPath.Last() != sep) UserIconPath.Append(sep);
1412 UserIconPath.Append(
"UserIcons");
1414 if (!::wxDirExists(UserIconPath)) {
1415 ::wxMkdir(UserIconPath);
1420 if (LayersPath.Last() != sep) LayersPath.Append(sep);
1421 LayersPath.Append(
"layers");
1423 if (!::wxDirExists(LayersPath)) {
1424 ::wxMkdir(LayersPath);
1430 g_CmdSoundString = wxString(OCPN_SOUND_CMD);
1431 pConfig->SetPath(
"/Settings");
1432 pConfig->Write(
"CmdSoundString", g_CmdSoundString);
1436 g_bAIS_GCPA_Alert_Audio =
true;
1437 g_bAIS_SART_Alert_Audio =
true;
1438 g_bAIS_DSC_Alert_Audio =
true;
1441 g_maintoolbar_x = -1;
1445 std::vector<std::string> TCDS_temp;
1446 for (
unsigned int i = 0; i < TideCurrentDataSet.size(); i++)
1447 TCDS_temp.push_back(TideCurrentDataSet[i]);
1449 TideCurrentDataSet.clear();
1450 for (
unsigned int i = 0; i < TCDS_temp.size(); i++) {
1451 wxString tide = TCDS_temp[i];
1452 wxFileName ft(tide);
1453 if (ft.FileExists()) TideCurrentDataSet.push_back(TCDS_temp[i]);
1460 g_compatOsVersion =
"";
1461 pConfig->SetPath(
"/Settings");
1462 pConfig->Write(
"CompatOS", g_compatOS);
1463 pConfig->Write(
"CompatOsVersion", g_compatOsVersion);
1467int OCPNPlatform::platformApplyPrivateSettingsString(wxString settings,
1468 ArrayOfCDI *pDirArray) {
1471 ret_val = androidApplySettingsString(settings, pDirArray);
1477void OCPNPlatform::applyExpertMode(
bool mode) {
1481 g_bBasicMenus = !mode;
1489static wxString ExpandPaths(wxString paths,
OCPNPlatform *platform);
1491int OCPNPlatform::DoFileSelectorDialog(wxWindow *parent, wxString *file_spec,
1492 wxString Title, wxString initDir,
1493 wxString suggestedName,
1494 wxString wildcard) {
1496 int result = wxID_CANCEL;
1500 wxString idir = initDir;
1501 if (initDir.StartsWith(
1505 result = androidFileChooser(&file, idir, Title, suggestedName, wildcard);
1506 if (file_spec) *file_spec = file;
1508 long flag = wxFD_DEFAULT_STYLE;
1509 if (suggestedName.Length()) {
1513 wxString mask = wildcard;
1514 if (wxNOT_FOUND != mask.Find(
"gpx")) mask.Prepend(
"GPX files (*.gpx)|");
1516 wxFileDialog *psaveDialog =
1517 new wxFileDialog(parent, Title, initDir, suggestedName, mask, flag);
1525 if (parent) parent->HideWithEffect(wxSHOW_EFFECT_BLEND);
1528 result = psaveDialog->ShowModal();
1531 if (parent) parent->ShowWithEffect(wxSHOW_EFFECT_BLEND);
1534 if (file_spec) *file_spec = psaveDialog->GetPath();
1542int OCPNPlatform::DoDirSelectorDialog(wxWindow *parent, wxString *file_spec,
1543 wxString Title, wxString initDir,
1546 int result = wxID_CANCEL;
1550 wxString idir = initDir;
1551 if (initDir.StartsWith(
1555 result = androidFileChooser(&dir, idir, Title,
"",
"",
true,
1557 if (file_spec) *file_spec = dir;
1559 wxDirDialog *dirSelector =
new wxDirDialog(
1560 parent, Title, initDir, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
1563 dirSelector->SetFont(*qFont);
1570 if (parent) parent->HideWithEffect(wxSHOW_EFFECT_BLEND);
1573 result = dirSelector->ShowModal();
1576 if (parent) parent->ShowWithEffect(wxSHOW_EFFECT_BLEND);
1579 if (result == wxID_CANCEL) {
1582 *file_spec = dirSelector->GetPath();
1592MyConfig *OCPNPlatform::GetConfigObject() {
1595 result =
new MyConfig(GetConfigFileName());
1604bool OCPNPlatform::hasInternalGPS(wxString profile) {
1606 bool t = androidDeviceHasGPS();
1620void OCPNPlatform::ShowBusySpinner() { AbstractPlatform::ShowBusySpinner(); }
1622void OCPNPlatform::HideBusySpinner() { AbstractPlatform::HideBusySpinner(); }
1624double OCPNPlatform::GetDisplayDensityFactor() {
1626 return getAndroidDisplayDensity();
1632long OCPNPlatform::GetDefaultToolbarOrientation() {
1634 return wxTB_VERTICAL;
1636 return wxTB_VERTICAL;
1640int OCPNPlatform::GetStatusBarFieldCount() {
1646 wxFont *templateFont = FontMgr::Get().
GetFont(_(
"StatusBar"), 0);
1647 dc.SetFont(*templateFont);
1650 dc.GetTextExtent(
"WWWWWW", &width, NULL, NULL, NULL, templateFont);
1651 double font_size_pix = (double)width / 6.0;
1655 double nChars = dispSize.x / font_size_pix;
1665 return STAT_FIELD_COUNT;
1669double OCPNPlatform::getFontPointsperPixel() {
1670 double pt_per_pixel = 1.0;
1680 if (m_pt_per_pixel == 0) {
1685 12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, FALSE,
1686 wxString(
""), wxFONTENCODING_SYSTEM);
1690 dc.GetTextExtent(
"H", &width, &height, NULL, NULL, f);
1692 if (height > 0) m_pt_per_pixel = 12.0 / (double)height;
1694 if (m_pt_per_pixel > 0) pt_per_pixel = m_pt_per_pixel;
1697 return pt_per_pixel;
1702 return getAndroidDisplayDimensions();
1719 ret = GetAndroidDisplaySize();
1725double OCPNPlatform::GetDisplayAreaCM2() {
1730 ratio = (double)sz.x / (
double)sz.y;
1732 ratio = (double)sz.y / (
double)sz.x;
1734 double area = size1 * (size1 * ratio) / 100.;
1740 if (monitor < m_displaySizeMMOverride.size()) {
1741 m_displaySizeMMOverride[monitor] = sizeMM;
1745double OCPNPlatform::GetDisplayDPmm() {
1747 return getAndroidDPmm();
1754unsigned int OCPNPlatform::GetSelectRadiusPix() {
1755 return GetDisplayDPmm() *
1756 (g_btouch ? g_selection_radius_touch_mm : g_selection_radius_mm);
1759bool OCPNPlatform::GetFullscreen() {
1762 bret = androidGetFullscreen();
1770bool OCPNPlatform::SetFullscreen(
bool bFull) {
1773 bret = androidSetFullscreen(bFull);
1780void OCPNPlatform::PositionAISAlert(wxWindow *alert_window) {
1783 alert_window->SetSize(g_ais_alert_dialog_x, g_ais_alert_dialog_y,
1784 g_ais_alert_dialog_sx, g_ais_alert_dialog_sy);
1788 alert_window->Centre();
1794wxDirDialog *OCPNPlatform::AdjustDirDialogFont(wxWindow *container,
1796 wxDirDialog *ret_dlg = dlg;
1800 dlg->SetSize(container->GetSize());
1803 wxSize sds = dlg->GetSize();
1804 wxSize ss = container->GetSize();
1809 wxString msg = dlg->GetMessage();
1810 wxString default_dir = dlg->GetPath();
1814 ret_dlg =
new wxDirDialog(NULL, msg, default_dir,
1815 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
1818 wxFont *smallFont =
new wxFont(*dialogFont);
1819 smallFont->SetPointSize((smallFont->GetPointSize() / 2) +
1821 ret_dlg->SetFont(*smallFont);
1823 ret_dlg->SetSize(container->GetSize());
1831wxFileDialog *OCPNPlatform::AdjustFileDialogFont(wxWindow *container,
1832 wxFileDialog *dlg) {
1833 wxFileDialog *ret_dlg = dlg;
1837 dlg->SetSize(container->GetSize());
1840 wxSize sds = dlg->GetSize();
1841 wxSize ss = container->GetSize();
1846 wxString msg = dlg->GetMessage();
1847 wxString default_dir = dlg->GetDirectory();
1848 wxString default_file = dlg->GetFilename();
1849 wxString wildcard = dlg->GetWildcard();
1853 ret_dlg =
new wxFileDialog(NULL, msg, default_dir, default_file, wildcard,
1857 wxFont *smallFont =
new wxFont(*dialogFont);
1858 smallFont->SetPointSize((smallFont->GetPointSize() / 2) +
1860 ret_dlg->SetFont(*smallFont);
1862 ret_dlg->SetSize(container->GetSize());
1870double OCPNPlatform::GetToolbarScaleFactor(
int GUIScaleFactor) {
1878 wxSize style_tool_size(32, 32);
1880 if (g_StyleManager) {
1882 if (style) style_tool_size = style->GetToolSize();
1884 double tool_size = style_tool_size.x;
1890 double premult = 1.0;
1892 double target_size = 9.0;
1894 double basic_tool_size_mm = tool_size / GetDisplayDPmm();
1895 premult = target_size / basic_tool_size_mm;
1898 premult = wxMax(45 * getAndroidDisplayDensity(), 45) /
1904 double postmult = exp(GUIScaleFactor * (log(2.0) / 5.0));
1908 rv = premult * postmult;
1909 rv = wxMin(rv, getAndroidDisplayDensity() *
1913 double premult = 1.0;
1915 if (g_bresponsive) {
1918 wxSize style_tool_size = style->GetToolSize();
1919 double tool_size = style_tool_size.x;
1923 double target_size = 9.0;
1925 double basic_tool_size_mm = tool_size / GetDisplayDPmm();
1926 premult = target_size / basic_tool_size_mm;
1930 double postmult = exp(GUIScaleFactor * (0.693 / 5.0));
1932 rv = premult * postmult;
1933 rv = wxMin(rv, 3.0);
1934 rv = wxMax(rv, 0.5);
1943double OCPNPlatform::GetCompassScaleFactor(
int GUIScaleFactor) {
1950 if (g_bresponsive) {
1953 wxSize style_tool_size = style->GetToolSize();
1954 double compass_size = style_tool_size.x;
1960 double premult = wxMax(28 * getAndroidDisplayDensity(), 50) / compass_size;
1963 double postmult = exp(GUIScaleFactor * (log(2.0) / 5.0));
1966 rv = premult * postmult;
1967 rv = wxMin(rv, getAndroidDisplayDensity() *
1972 double premult = 1.0;
1974 if (g_bresponsive) {
1976 wxSize style_tool_size = style->GetToolSize();
1977 double compass_size = style_tool_size.x;
1980 double target_size = 6.0;
1982 double basic_tool_size_mm = compass_size / GetDisplayDPmm();
1983 premult = target_size / basic_tool_size_mm;
1986 double postmult = exp(GUIScaleFactor * (0.693 / 5.0));
1988 rv = premult * postmult;
1990 rv = wxMin(rv, 3.0);
1991 rv = wxMax(rv, 0.5);
1993#if defined(__WXOSX__) || defined(__WXGTK3__)
1995 if (gFrame) rv *= gFrame->GetContentScaleFactor();
2005float OCPNPlatform::GetChartScaleFactorExp(
float scale_linear) {
2006 double factor = 1.0;
2008 factor = exp(scale_linear * (log(3.0) / 5.0));
2013 factor = exp(scale_linear * (0.693 / 5.0));
2017 factor = wxMax(factor, .5);
2018 factor = wxMin(factor, 6.);
2023float OCPNPlatform::GetMarkScaleFactorExp(
float scale_linear) {
2024 if (scale_linear <= 0)
2025 return GetChartScaleFactorExp(scale_linear);
2027 return GetChartScaleFactorExp(scale_linear - 1);
2044bool OCPNPlatform::hasInternalBT(wxString profile) {
2046 bool t = androidDeviceHasBlueTooth();
2055bool OCPNPlatform::startBluetoothScan() {
2057 return androidStartBluetoothScan();
2064bool OCPNPlatform::stopBluetoothScan() {
2066 return androidStopBluetoothScan();
2073wxArrayString OCPNPlatform::getBluetoothScanResults() {
2074 wxArrayString ret_val;
2076 return androidGetBluetoothScanResults();
2079 ret_val.Add(
"line 1");
2080 ret_val.Add(
"line 2");
2081 ret_val.Add(
"line 3");
2091bool OCPNPlatform::AllowAlertDialog(
const wxString &class_name) {
2096 wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
2098 wxWindow *win = node->GetData();
2099 if (win->IsShown()) nTLW++;
2101 node = node->GetNext();
2115void OCPNPlatform::setChartTypeMaskSel(
int mask, wxString &indicator) {
2117 return androidSetChartTypeMaskSel(mask, indicator);
2122QString g_qtStyleSheet;
2124bool LoadQtStyleSheet(wxString &sheet_file) {
2125 if (wxFileExists(sheet_file)) {
2128 QString file(sheet_file.c_str());
2130 File.open(QFile::ReadOnly);
2131 g_qtStyleSheet = QLatin1String(File.readAll());
2141QString getQtStyleSheet() {
return g_qtStyleSheet; }
2145bool OCPNPlatform::isPlatformCapable(
int flag) {
2149 if (flag == PLATFORM_CAP_PLUGINS) {
2151 wxString tsdk(android_plat_spc.msdk);
2152 if (tsdk.ToLong(&platver)) {
2153 if (platver >= 11)
return true;
2155 }
else if (flag == PLATFORM_CAP_FASTPAN) {
2157 wxString tsdk(android_plat_spc.msdk);
2158 if (tsdk.ToLong(&platver)) {
2159 if (platver >= 14)
return true;
2167void OCPNPlatform::platformLaunchDefaultBrowser(wxString URL) {
2169 androidLaunchBrowser(URL);
2171 ::wxLaunchDefaultBrowser(URL);
2181EVT_PAINT(OCPNColourPickerCtrl::OnPaint)
2190 const wxColour &initial,
2192 const wxSize &size,
long style,
2193 const wxValidator &validator,
2194 const wxString &name) {
2195 Create(parent,
id, initial, pos, size, style, validator, name);
2198bool OCPNColourPickerCtrl::Create(wxWindow *parent, wxWindowID
id,
2199 const wxColour &col,
const wxPoint &pos,
2200 const wxSize &size,
long style,
2201 const wxValidator &validator,
2202 const wxString &name) {
2203 m_bitmap = wxBitmap(60, 13);
2206 if (!wxBitmapButton::Create(parent,
id, m_bitmap, pos, size,
2207 style | wxBU_AUTODRAW, validator, name)) {
2208 wxFAIL_MSG(
"OCPNColourPickerCtrl creation failed");
2213 Connect(GetId(), wxEVT_BUTTON,
2214 wxCommandEventHandler(OCPNColourPickerCtrl::OnButtonClick), NULL,
2224void OCPNColourPickerCtrl::InitColourData() {
2226 ms_data.SetChooseFull(
true);
2227 unsigned char grey = 0;
2228 for (
int i = 0; i < 16; i++, grey += 16)
2231 wxColour colour(grey, grey, grey);
2232 ms_data.SetCustomColour(i, colour);
2237void OCPNColourPickerCtrl::OnButtonClick(wxCommandEvent &WXUNUSED(ev)) {
2239 unsigned int cco = 0;
2242 cco |= m_colour.Red();
2244 cco |= m_colour.Green();
2246 cco |= m_colour.Blue();
2247 unsigned int cc = androidColorPicker(cco);
2250 unsigned char blue = (
unsigned char)cc % 256;
2251 unsigned char green = (
unsigned char)(cc >> 8) % 256;
2253 unsigned char red = (
unsigned char)(cc >> 16) % 256;
2254 cnew.Set(red, green, blue);
2260 ms_data.SetColour(m_colour);
2263 wxColourDialog dlg(
this, &ms_data);
2264 if (dlg.ShowModal() == wxID_OK) {
2265 ms_data = dlg.GetColourData();
2266 SetColour(ms_data.GetColour());
2271void OCPNColourPickerCtrl::UpdateColour() {
2273 SetBitmapLabel(wxBitmap());
2276 wxMemoryDC dc(m_bitmap);
2277 dc.SetPen(*wxTRANSPARENT_PEN);
2278 dc.SetBrush(wxBrush(m_colour));
2279 dc.DrawRectangle(0, 0, m_bitmap.GetWidth(), m_bitmap.GetHeight());
2281 dc.SelectObject(wxNullBitmap);
2282 SetBitmapLabel(m_bitmap);
2285void OCPNColourPickerCtrl::SetColour(wxColour &c) {
2287 m_bitmap = wxBitmap(GetSize().x - 20, GetSize().y - 20);
2291wxColour OCPNColourPickerCtrl::GetColour() {
return m_colour; }
2293wxSize OCPNColourPickerCtrl::DoGetBestSize()
const {
2294 wxSize sz(wxBitmapButton::DoGetBestSize());
2301 if (HasFlag(wxCLRP_SHOW_LABEL))
return sz;
2309void OCPNColourPickerCtrl::OnPaint(wxPaintEvent &event) {
2312 int offset_x = (GetSize().x - m_bitmap.GetWidth()) / 2;
2313 int offset_y = (GetSize().y - m_bitmap.GetHeight()) / 2;
2315 dc.SetPen(*wxTRANSPARENT_PEN);
2316 dc.SetBrush(wxBrush(m_colour));
2317 dc.DrawRectangle(offset_x, offset_y, m_bitmap.GetWidth(),
2318 m_bitmap.GetHeight());
Select * pSelectAIS
Global instance.
Class AisDecoder and helpers.
Global state for AIS decoder.
wxFont * FindOrCreateFont(int point_size, wxFontFamily family, wxFontStyle style, wxFontWeight weight, bool underline=false, const wxString &facename=wxEmptyString, wxFontEncoding encoding=wxFONTENCODING_DEFAULT)
Creates or finds a matching font in the font cache.
void LoadFontNative(wxString *pConfigString, wxString *pNativeDesc)
Loads font settings from a string descriptor.
wxFont * GetFont(const wxString &TextElement, int requested_font_size=0)
Get a font object for a UI element.
std::string Homedir() const
home directory, convenience stuff.
std::string UserDatadir()
The single, user-writable common parent for plugin data directories, typically ending in 'plugins'.
static PluginPaths * GetInstance()
Return the singleton instance.
int GetErrorCount() const
Return the size of the error message's array.
int Parse(const wxString &doc, wxJSONValue *val)
Parse the JSON document.
The JSON value class implementation.
int Size() const
Return the size of the array or map stored in this value.
bool HasMember(unsigned index) const
Return TRUE if the object contains an element at the specified index.
wxString AsString() const
Return the stored value as a wxWidget's string.
Global variables reflecting command line options and arguments.
bool g_bsmoothpanzoom
Controls how the chart panning and zooming smoothing is done during user interactions.
wxString g_default_font_facename
Default font size for user interface elements such as menus, dialogs, etc.
bool g_bRollover
enable/disable mouse rollover GUI effects
std::vector< size_t > g_config_display_size_mm
Size of pysical screen in millimeters.
Global variables stored in configuration file.
Dump debug info on crash.
Extern C linked utilities.
std::vector< OCPN_MonitorInfo > g_monitor_info
Information about the monitors connected to the system.
void EnumerateMonitors()
Enumerate the monitors connected to the system.
bool g_running
Android only.
OpenGL chart rendering canvas.
wxFont * GetOCPNScaledFont(wxString item, int default_size)
Retrieves a font from FontMgr, optionally scaled for physical readability.
General purpose GUI support.
size_t g_current_monitor
Current monitor displaying main application frame.
Miscellaneous globals primarely used by gui layer, not persisted in configuration file.
Enhanced logging interface on top of wx/log.h.
MacOS hardware probing functions.
void cache_clear()
Remove all files in cache:
Miscellaneous utilities, many of which string related.
options * g_options
Global instance.
Downloaded plugins cache.
Plugin installation and data paths support.
wxString GetWritableDocumentsDir()
Returns the platform-specific default documents directory.
Select * pSelect
Global instance.
Select * pSelectTC
Global instance.
Selected route, segment, waypoint, etc.