48#include <wx/apptrait.h>
49#include <wx/stdpaths.h>
50#include <wx/filename.h>
51#include <wx/tokenzr.h>
52#include <wx/textfile.h>
53#include <wx/jsonval.h>
54#include <wx/jsonreader.h>
81#include "snd_config.h"
82#include "std_filesystem.h"
86#include "androidUTIL.h"
94#ifdef OCPN_USE_CRASHREPORT
116void appendOSDirSlash(wxString *pString);
119struct sigaction sa_all;
120struct sigaction sa_all_old;
127#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
128extern wxLocale *plocale_def_lang;
139static const char *
const DEFAULT_XDG_DATA_DIRS =
140 "~/.local/share:/usr/local/share:/usr/share";
143static const char PATH_SEP =
';';
145static const char PATH_SEP =
':';
148static bool checkIfFlatpacked() {
150 if (!wxGetEnv(
"FLATPAK_ID", &
id)) {
153 return id ==
"org.opencpn.OpenCPN";
156OCPNPlatform::OCPNPlatform() {
158 m_bdisableWindowsDisplayEnum =
false;
159 m_monitorWidth = m_monitorHeight = 0;
162 m_displaySizeMMOverride.push_back(0);
164 m_pluginDataPath =
"";
167OCPNPlatform::~OCPNPlatform() {
179int MyNewHandler(
size_t size) {
181 throw std::bad_alloc();
202void catch_signals(
int signo) {
233#ifdef OCPN_USE_CRASHREPORT
235int CALLBACK CrashCallback(CR_CRASH_CALLBACK_INFO *pInfo) {
236 wxLog::GetActiveTarget()->Flush();
237 return CR_CB_DODEFAULT;
242void OCPNPlatform::Initialize_1() {
243#ifdef OCPN_USE_CRASHREPORT
247 CR_INSTALL_INFO info;
248 memset(&info, 0,
sizeof(CR_INSTALL_INFO));
249 info.cb =
sizeof(CR_INSTALL_INFO);
250 info.pszAppName = L
"OpenCPN";
252 info.pszAppVersion = wxString(VERSION_FULL).c_str();
254 int type = MiniDumpNormal;
257 type |= MiniDumpWithDataSegs;
268 info.uMiniDumpType = (MINIDUMP_TYPE)type;
271 info.dwFlags = CR_INST_ALL_POSSIBLE_HANDLERS;
274 info.dwFlags &= ~CR_INST_NEW_OPERATOR_ERROR_HANDLER;
277 info.dwFlags |= CR_INST_ALLOW_ATTACH_MORE_FILES;
280 info.dwFlags |= CR_INST_SHOW_ADDITIONAL_INFO_FIELDS;
284 if (g_bEmailCrashReport) {
285 info.pszUrl = L
"https://bigdumboat.com/crashrpt/ocpn_crashrpt.php";
286 info.uPriorities[CR_HTTP] = 3;
288 info.dwFlags |= CR_INST_DONT_SEND_REPORT;
289 info.uPriorities[CR_HTTP] = CR_NEGATIVE_PRIORITY;
292 info.uPriorities[CR_SMTP] =
293 CR_NEGATIVE_PRIORITY;
294 info.uPriorities[CR_SMAPI] =
295 CR_NEGATIVE_PRIORITY;
297 wxStandardPaths &crash_std_path =
g_Platform->GetStdPaths();
299 wxString crash_rpt_save_locn = crash_std_path.GetConfigDir();
301 wxFileName exec_path_crash(crash_std_path.GetExecutablePath());
302 crash_rpt_save_locn =
303 exec_path_crash.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
306 wxString locn = crash_rpt_save_locn +
"\\CrashReports";
308 if (!wxDirExists(locn)) wxMkdir(locn);
310 if (wxDirExists(locn)) {
311 wxCharBuffer buf = locn.ToUTF8();
313 if (buf && (locn.Length() <
sizeof(wlocn))) {
314 MultiByteToWideChar(0, 0, buf.data(), -1, wlocn,
sizeof(wlocn) - 1);
315 info.pszErrorReportSaveDir = (LPCWSTR)wlocn;
320 wxFileName exec_path_crash(crash_std_path.GetExecutablePath());
321 wxString policy_file =
322 exec_path_crash.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
323 policy_file +=
"PrivacyPolicy.txt";
324 policy_file.Prepend(
"file:");
326 info.pszPrivacyPolicyURL = policy_file.c_str();
329 int nResult = crInstall(&info);
332 crGetLastErrorMsg(buff, 256);
339 crSetCrashCallback(CrashCallback, NULL);
342 crAddScreenshot2(CR_AS_PROCESS_WINDOWS | CR_AS_USE_JPEG_FORMAT, 95);
345 wxString home_data_crash = crash_std_path.GetConfigDir();
347 wxFileName f(crash_std_path.GetExecutablePath());
348 home_data_crash = f.GetPath();
350 appendOSDirSlash(&home_data_crash);
352 wxString config_crash =
"opencpn.ini";
353 config_crash.Prepend(home_data_crash);
354 crAddFile2(config_crash.c_str(), NULL, NULL,
355 CR_AF_MISSING_FILE_OK | CR_AF_ALLOW_DELETE);
357 wxString log_crash =
"opencpn.log";
358 log_crash.Prepend(home_data_crash);
359 crAddFile2(log_crash.c_str(), NULL, NULL,
360 CR_AF_MISSING_FILE_OK | CR_AF_ALLOW_DELETE);
366#if wxUSE_ON_FATAL_EXCEPTION
368 wxHandleFatalExceptions(
true);
374 _set_new_handler(MyNewHandler);
384 HANDLE hProc = GetCurrentProcess();
388 DuplicateHandle( hProc, hProc, hProc, &hDup, 0, FALSE, DUPLICATE_SAME_ACCESS );
391 GetProcessAffinityMask( hDup, &procMask, &sysMask );
395 if( ( procMask & 1 ) == 1 ) newMask = 1;
397 if( ( procMask & 2 ) == 2 ) newMask = 2;
399 if( ( procMask & 4 ) == 4 ) newMask = 4;
401 if( ( procMask & 8 ) == 8 ) newMask = 8;
404 BOOL res = SetProcessAffinityMask( hDup, (DWORD_PTR) newMask );
418 wxPlatformInfo Platform;
419 if (Platform.GetOperatingSystemId() == wxOS_WINDOWS_9X)
420 SetUnhandledExceptionFilter(&MyUnhandledExceptionFilter);
431 sa_all.sa_handler = catch_signals;
432 sigemptyset(&sa_all.sa_mask);
438 sigaction(SIGUSR1, NULL,
442 sigaction(SIGUSR1, &sa_all, NULL);
443 sigaction(SIGUSR1, NULL,
446 sigaction(SIGTERM, &sa_all, NULL);
447 sigaction(SIGTERM, NULL, &sa_all_old);
449 sigaction(SIGHUP, &sa_all, NULL);
450 sigaction(SIGHUP, NULL, &sa_all_old);
455 qDebug() <<
"Initialize_1()";
465void OCPNPlatform::Initialize_2() {
467 wxLogMessage(androidGetDeviceInfo());
471 wxChar sep = wxFileName::GetPathSeparator();
474 if (ChartDir.Last() != sep) ChartDir.Append(sep);
475 ChartDir.Append(
"Charts");
476 if (!::wxDirExists(ChartDir)) {
481 if (GRIBDir.Last() != sep) GRIBDir.Append(sep);
482 GRIBDir.Append(
"GRIBS");
483 if (!::wxDirExists(GRIBDir)) {
488 if (VDRDir.Last() != sep) VDRDir.Append(sep);
489 VDRDir.Append(
"VDR");
490 if (!::wxDirExists(VDRDir)) {
495 if (g_Android_SDK_Version >= 30) {
496 if (!g_gpx_path.StartsWith(androidGetDocumentsDirectory())) {
497 g_gpx_path = androidGetDocumentsDirectory();
504 g_toolbar_scalefactor = GetToolbarScaleFactor(g_GUIScaleFactor);
506 if (!configdir.DirExists()) {
507 if (!configdir.Mkdir()) {
508 auto msg = std::string(
"Cannot create config directory: ");
509 wxLogWarning(msg + configdir.GetFullPath());
516void OCPNPlatform::Initialize_3() {
517 bool bcapable = IsGLCapable();
523 bool bAndroid =
false;
532 g_bdisable_opengl =
false;
533 pConfig->UpdateSettings();
540 if ((g_bFirstRun || g_bUpgradeInProcess || bAndroid) && bcapable) {
544 g_GLOptions.m_bUseAcceleratedPanning =
true;
545 g_GLOptions.m_bTextureCompression =
true;
546 g_GLOptions.m_bTextureCompressionCaching =
true;
548 g_GLOptions.m_iTextureDimension = 512;
549 g_GLOptions.m_iTextureMemorySize = 64;
551 g_GLOptions.m_GLPolygonSmoothing =
true;
552 g_GLOptions.m_GLLineSmoothing =
true;
556 gFrame->SetGPSCompassScale();
564 if (g_bFirstRun || g_bUpgradeInProcess) {
569 g_FlushNavobjChangesTimeout = 300;
573void OCPNPlatform::Initialize_4() {
575 if (
pSelect)
pSelect->SetSelectPixelRadius(wxMax(25, 6.0 * getAndroidDPmm()));
577 pSelectTC->SetSelectPixelRadius(wxMax(25, 6.0 * getAndroidDPmm()));
579 pSelectAIS->SetSelectPixelRadius(wxMax(25, 6.0 * getAndroidDPmm()));
586 options_lastPage = 1;
590void OCPNPlatform::OnExit_1() {}
592void OCPNPlatform::OnExit_2() {
593#ifdef OCPN_USE_CRASHREPORT
603bool HasGLExt(
wxJSONValue &glinfo,
const std::string ext) {
604 if (!glinfo.
HasMember(
"GL_EXTENSIONS")) {
607 for (
int i = 0; i < glinfo[
"GL_EXTENSIONS"].
Size(); i++) {
608 if (glinfo[
"GL_EXTENSIONS"][i].AsString() == ext) {
615bool OCPNPlatform::BuildGLCaps(
void *pbuf) {
617 fs::path ep(GetExePath().ToStdString());
619 std::string gl_util_exe =
"opencpn-glutil";
621 std::string gl_util_exe =
"opencpn-glutil.exe";
623 fs::path gl_util_path = ep.parent_path().append(gl_util_exe);
625 if (!fs::exists(gl_util_path)) {
628 wxLogMessage(
"OpenGL test utility not found at %s.", gl_util_path.c_str());
633 .append(
"gl_caps.json")
636 wxString cmd = wxString::Format(
"\"%s\" opengl-info \"%s\"",
637 gl_util_path.c_str(), gl_json.c_str());
639 wxLogMessage(
"Starting OpenGL test utility: %s", cmd);
641 wxArrayString output;
642 if (
long res = wxExecute(cmd, output); res != 0) {
643 wxLogMessage(
"OpenGL test utility failed with exit code %d", res);
644 for (
const auto &l : output) {
650 wxFileInputStream fis(gl_json);
653 reader.
Parse(fis, &root);
655 wxLogMessage(
"Failed to parse JSON output from OpenGL test utility.");
656 for (
const auto &l : reader.GetErrors()) {
665 pcaps->Renderer = root[
"GL_RENDERER"].
AsString();
667 wxLogMessage(
"GL_RENDERER not found.");
671 pcaps->Version = root[
"GL_VERSION"].
AsString();
673 wxLogMessage(
"GL_VERSION not found.");
676 if (root.
HasMember(
"GL_SHADING_LANGUAGE_VERSION")) {
677 pcaps->GLSL_Version = root[
"GL_SHADING_LANGUAGE_VERSION"].
AsString();
679 wxLogMessage(
"GL_SHADING_LANGUAGE_VERSION not found.");
683 if (!root[
"GL_USABLE"].AsBool()) {
684 wxLogMessage(
"OpenGL test utility reports that OpenGL is not usable.");
688 wxLogMessage(
"GL_USABLE not found.");
691 pcaps->dGLSL_Version = 0;
692 pcaps->dGLSL_Version = ::atof(pcaps->GLSL_Version.c_str());
693 if (pcaps->dGLSL_Version < 1.2) {
695 msg.Printf(
"GLCaps Probe: OpenGL-> GLSL Version reported: ");
696 msg += wxString(pcaps->GLSL_Version.c_str());
697 msg +=
"\n OpenGL disabled due to insufficient OpenGL capabilities";
699 pcaps->bCanDoGLSL =
false;
702 pcaps->bCanDoGLSL =
true;
703 if (HasGLExt(root,
"GL_ARB_texture_non_power_of_two")) {
704 pcaps->TextureRectangleFormat = GL_TEXTURE_2D;
705 }
else if (HasGLExt(root,
"GL_OES_texture_npot")) {
706 pcaps->TextureRectangleFormat = GL_TEXTURE_2D;
707 }
else if (HasGLExt(root,
"GL_ARB_texture_rectangle")) {
708 pcaps->TextureRectangleFormat = GL_TEXTURE_RECTANGLE_ARB;
711 pcaps->bOldIntel =
false;
713 pcaps->bCanDoFBO = HasGLExt(root,
"GL_EXT_framebuffer_object");
714 if (!pcaps->TextureRectangleFormat) {
715 pcaps->bCanDoFBO =
false;
718 pcaps->bCanDoVBO = HasGLExt(
719 root,
"GL_ARB_vertex_buffer_object");
731 wxGLContext *pctx =
new wxGLContext(tcanvas);
732 tcanvas->SetCurrent(*pctx);
736 char *str = (
char *)glGetString(GL_RENDERER);
738 wxLogMessage(
"GL_RENDERER not found.");
743 pcaps->Renderer = std::string(str);
745 char *stv = (
char *)glGetString(GL_VERSION);
747 wxLogMessage(
"GL_VERSION not found");
752 pcaps->Version = std::string(stv);
754 char *stsv = (
char *)glGetString(GL_SHADING_LANGUAGE_VERSION);
756 wxLogMessage(
"GL_SHADING_LANGUAGE_VERSION not found");
761 pcaps->GLSL_Version = std::string(stsv);
763 pcaps->dGLSL_Version = 0;
764 pcaps->dGLSL_Version = ::atof(pcaps->GLSL_Version.c_str());
766 if (pcaps->dGLSL_Version < 1.2) {
768 msg.Printf(
"GLCaps Probe: OpenGL-> GLSL Version reported: ");
769 msg += wxString(pcaps->GLSL_Version.c_str());
770 msg +=
"\n OpenGL disabled due to insufficient OpenGL capabilities";
772 pcaps->bCanDoGLSL =
false;
778 pcaps->bCanDoGLSL =
true;
780 if (QueryExtension(
"GL_ARB_texture_non_power_of_two"))
781 pcaps->TextureRectangleFormat = GL_TEXTURE_2D;
782 else if (QueryExtension(
"GL_OES_texture_npot"))
783 pcaps->TextureRectangleFormat = GL_TEXTURE_2D;
784 else if (QueryExtension(
"GL_ARB_texture_rectangle"))
785 pcaps->TextureRectangleFormat = GL_TEXTURE_RECTANGLE_ARB;
787 pcaps->bOldIntel =
false;
790 pcaps->bCanDoVBO =
true;
792#if defined(__WXMSW__) || defined(__WXOSX__)
793 if (pcaps->bOldIntel) pcaps->bCanDoVBO =
false;
797 pcaps->bCanDoVBO =
false;
801 pcaps->bCanDoFBO =
true;
805 if (!pcaps->TextureRectangleFormat) pcaps->bCanDoFBO =
false;
808 if (!QueryExtension(
"GL_EXT_framebuffer_object")) pcaps->bCanDoFBO =
false;
818bool OCPNPlatform::IsGLCapable() {
827 if (g_bdisable_opengl)
return false;
829 wxLogMessage(
"Starting OpenGL test...");
830 wxLog::FlushActive();
834 bool bcaps = BuildGLCaps(GL_Caps);
836 wxLogMessage(
"OpenGL test complete.");
838 wxLogMessage(
"BuildGLCaps fails.");
839 wxLog::FlushActive();
847 if (!GL_Caps->bCanDoGLSL) {
853 if (!GL_Caps->bCanDoFBO) {
858 wxLogMessage(
"OpenGL determined CAPABLE.");
859 wxLog::FlushActive();
861 g_bdisable_opengl =
false;
865 pConfig->UpdateSettings();
874void OCPNPlatform::SetLocaleSearchPrefixes() {
877#if defined(__WINDOWS__)
880 wxString locale_location = GetSharedDataDir();
881 locale_location +=
"share\\locale";
882 wxLocale::AddCatalogLookupPathPrefix(locale_location);
883 wxString imsg =
"Adding catalog lookup path: ";
884 imsg += locale_location;
889 usrShare.RemoveLastDir();
890 locale_location = usrShare.GetFullPath() + (
"share\\locale");
891 wxLocale::AddCatalogLookupPathPrefix(locale_location);
892 imsg =
"Adding catalog lookup path: ";
893 imsg += locale_location;
896#elif defined(__ANDROID__)
898 wxString locale_location = GetSharedDataDir() +
"locale";
899 wxLocale::AddCatalogLookupPathPrefix(locale_location);
901#elif defined(__UNIX__) && !defined(__WINE__)
906 wxString locale_location;
907 if (!wxGetEnv(
"OPENCPN_PREFIX", &locale_location)) {
908 locale_location =
"/usr/local";
916 location.AssignDir(locale_location);
917 location.AppendDir(
"share");
918 location.SetName(
"locale");
919 locale_location = location.GetFullPath();
920 wxLocale::AddCatalogLookupPathPrefix(locale_location);
924 wxString managed_locale_location(dir +
"/locale");
925 wxLocale::AddCatalogLookupPathPrefix(managed_locale_location);
931 "/Library/Application Support/OpenCPN/Contents/Resources";
932 wxString Mac_managed_locale_location(macDir);
933 wxLocale::AddCatalogLookupPathPrefix(Mac_managed_locale_location);
939wxString OCPNPlatform::GetDefaultSystemLocale() {
940 wxLogMessage(
"Getting DefaultSystemLocale...");
942 wxString retval =
"en_US";
946 const wxLanguageInfo *languageInfo =
947 wxLocale::GetLanguageInfo(wxLANGUAGE_DEFAULT);
948 if (languageInfo) retval = languageInfo->CanonicalName;
950#if defined(__WXMSW__)
951 LANGID lang_id = GetUserDefaultUILanguage();
954 const wxLanguageInfo *languageInfoW = 0;
955 if (0 != GetLocaleInfo(MAKELCID(lang_id, SORT_DEFAULT), LOCALE_SENGLANGUAGE,
957 wxString lstring = wxString(lngcp);
959 languageInfoW = wxLocale::FindLanguageInfo(lngcp);
961 wxLogMessage(
"Found LanguageInfo for: " + lstring);
963 wxLogMessage(
"Could not find LanguageInfo for: " + lstring);
965 wxLogMessage(
"Could not get LocaleInfo, using wxLANGUAGE_DEFAULT");
966 languageInfoW = wxLocale::GetLanguageInfo(wxLANGUAGE_DEFAULT);
969 if (languageInfoW) retval = languageInfoW->CanonicalName;
972#if defined(__ANDROID__)
973 retval = androidGetAndroidSystemLocale();
981#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
982wxString OCPNPlatform::GetAdjustedAppLocale() {
983 wxString adjLocale = g_locale;
988#if defined(__WXMSW__)
989 if (g_bFirstRun || wxIsEmpty(adjLocale)) {
990 wxRegKey RegKey(wxString(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\OpenCPN"));
991 if (RegKey.Exists()) {
993 "Retrieving initial language selection from Windows Registry");
994 RegKey.QueryValue(wxString(
"InstallerLanguage"), adjLocale);
997 if (wxIsEmpty(adjLocale)) {
998 if (g_localeOverride.Length())
999 adjLocale = g_localeOverride;
1001 adjLocale = GetDefaultSystemLocale();
1004#if defined(__ANDROID__)
1005 if (g_localeOverride.Length())
1006 adjLocale = g_localeOverride;
1008 adjLocale = GetDefaultSystemLocale();
1014wxString OCPNPlatform::ChangeLocale(wxString &newLocaleID,
1015 wxLocale *presentLocale,
1016 wxLocale **newLocale) {
1017 wxString return_val;
1019 wxString imsg =
"ChangeLocale: Language load for: ";
1020 imsg += newLocaleID;
1024 delete (wxLocale *)presentLocale;
1026 wxLocale *locale =
new wxLocale;
1027 if (isFlatpacked()) {
1028 std::string path(getenv(
"HOME"));
1029 path +=
"/.var/app/org.opencpn.OpenCPN/data/locale";
1030 locale->AddCatalogLookupPathPrefix(path);
1031 wxLogMessage(
"Using flatpak locales at %s", path.c_str());
1033 wxString loc_lang_canonical;
1035 const wxLanguageInfo *pli = wxLocale::FindLanguageInfo(newLocaleID);
1036 bool b_initok =
false;
1039 locale->Init(pli->Language, 1);
1043 if (!locale->IsOk()) {
1044 wxString imsg =
"ChangeLocale: could not initialize: ";
1045 imsg += newLocaleID;
1049 locale =
new wxLocale;
1050 locale->Init(pli->Language, 0);
1052 loc_lang_canonical = pli->CanonicalName;
1054 b_initok = locale->IsOk();
1061 wxString imsg =
"ChangeLocale: Fall back to en_US";
1065 locale =
new wxLocale;
1066 locale->Init(wxLANGUAGE_ENGLISH_US, 0);
1067 loc_lang_canonical =
1068 wxLocale::GetLanguageInfo(wxLANGUAGE_ENGLISH_US)->CanonicalName;
1072 wxString imsg =
"ChangeLocale: Locale Init OK for: ";
1073 imsg += loc_lang_canonical;
1087 wxString emsg =
"ERROR Loading translation catalog for: ";
1091 wxString imsg =
"Loaded translation catalog for: ";
1098 wxLogMessage(
"Loading catalog for opencpn core.");
1099 locale->AddCatalog(
"opencpn");
1101 return_val = locale->GetCanonicalName();
1104 if (return_val != GetDefaultSystemLocale())
1105 g_localeOverride = return_val;
1107 g_localeOverride =
"";
1110 *newLocale = locale;
1113 setlocale(LC_NUMERIC,
"C");
1124void OCPNPlatform::SetDefaultOptions() {
1126 g_bShowOutlines =
true;
1132 g_MarkLost_Mins = 8;
1133 g_bRemoveLost =
true;
1134 g_RemoveLost_Mins = 10;
1137 g_bSyncCogPredictors =
false;
1138 g_bHideMoored =
false;
1139 g_ShowMoored_Kts = 0.2;
1140 g_SOGminCOG_kts = 0.2;
1141 g_bTrackDaily =
false;
1143 g_bFullScreenQuilt =
true;
1144 g_bQuiltEnable =
true;
1145 g_bskew_comp =
false;
1146 g_bShowAreaNotices =
false;
1147 g_bDrawAISSize =
false;
1148 g_bDrawAISRealtime =
false;
1149 g_AIS_RealtPred_Kts = 0.7;
1150 g_bShowAISName =
false;
1151 g_nTrackPrecision = 2;
1152 g_bPreserveScaleOnX =
true;
1155 gps_watchdog_timeout_ticks = GPS_TIMEOUT_SECONDS;
1156 g_n_ownship_min_mm = 8;
1157 g_bShowMuiZoomButtons =
true;
1158 g_bresponsive =
false;
1162 pConfig->SetPath(
"/Settings/GlobalState");
1163 pConfig->Write(
"bShowS57Text",
true);
1164 pConfig->Write(
"bShowS57ImportantTextOnly",
false);
1165 pConfig->Write(
"nDisplayCategory", (
int)(_DisCat)OTHER);
1166 pConfig->Write(
"nSymbolStyle", (
int)(_LUPname)PAPER_CHART);
1167 pConfig->Write(
"nBoundaryStyle", (
int)(_LUPname)PLAIN_BOUNDARIES);
1169 pConfig->Write(
"bShowSoundg",
true);
1170 pConfig->Write(
"bShowMeta",
false);
1171 pConfig->Write(
"bUseSCAMIN",
true);
1172 pConfig->Write(
"bShowAtonText",
false);
1173 pConfig->Write(
"bShowLightDescription",
false);
1174 pConfig->Write(
"bExtendLightSectors",
true);
1175 pConfig->Write(
"bDeClutterText",
true);
1176 pConfig->Write(
"bShowNationalText",
true);
1178 pConfig->Write(
"S52_MAR_SAFETY_CONTOUR", 3);
1179 pConfig->Write(
"S52_MAR_SHALLOW_CONTOUR", 2);
1180 pConfig->Write(
"S52_MAR_DEEP_CONTOUR", 6);
1181 pConfig->Write(
"S52_MAR_TWO_SHADES", 0);
1182 pConfig->Write(
"S52_DEPTH_UNIT_SHOW", 1);
1184 pConfig->Write(
"ZoomDetailFactorVector", 3);
1186 pConfig->Write(
"nColorScheme", 1);
1190 g_bEnableZoomToCursor =
true;
1192 g_bShowMenuBar =
true;
1199 pConfig->SetPath(
"/PlugIns/chartdldr_pi.dll");
1200 pConfig->Write(
"bEnabled",
true);
1202 pConfig->SetPath(
"/PlugIns/wmm_pi.dll");
1203 pConfig->Write(
"bEnabled",
true);
1205 pConfig->SetPath(
"/Settings/WMM");
1206 pConfig->Write(
"ShowIcon",
true);
1207 pConfig->Write(
"ShowLiveIcon",
true);
1214 pConfig->SetPath(
"/PlugIns/libchartdldr_pi.dylib");
1215 pConfig->Write(
"bEnabled",
true);
1217 pConfig->SetPath(
"/PlugIns/libwmm_pi.dylib");
1218 pConfig->Write(
"bEnabled",
true);
1220 pConfig->SetPath(
"/Settings/WMM");
1221 pConfig->Write(
"ShowIcon",
true);
1222 pConfig->Write(
"ShowLiveIcon",
true);
1229 pConfig->SetPath(
"/PlugIns/libchartdldr_pi.so");
1230 pConfig->Write(
"bEnabled",
true);
1232 pConfig->SetPath(
"/PlugIns/libwmm_pi.so");
1233 pConfig->Write(
"bEnabled",
true);
1235 pConfig->SetPath(
"/Settings/WMM");
1236 pConfig->Write(
"ShowIcon",
true);
1237 pConfig->Write(
"ShowLiveIcon",
true);
1245 g_GLOptions.m_bTextureCompression = 1;
1246 g_GLOptions.m_bTextureCompressionCaching = 1;
1249 qDebug() <<
"SetDefaultOptions";
1252 g_bresponsive =
true;
1253 g_default_font_size = 18;
1256 g_bShowStatusBar =
true;
1257 g_cm93_zoom_factor = 0;
1258 g_oz_vector_scale =
false;
1259 g_fog_overzoom =
false;
1262 g_bShowMuiZoomButtons =
true;
1264 g_GUIScaleFactor = 0;
1265 g_ChartNotRenderScaleFactor = 2.0;
1269 g_toolbarConfig =
"X.....XX.......XX.XXXXXXXXXXX";
1270 g_bPermanentMOBIcon =
false;
1272 wxString sGPS =
"2;3;;0;0;;0;1;0;0;;0;;1;0;0;0;0";
1275 new_params->bEnabled =
true;
1276 TheConnectionParams().push_back(new_params);
1283 pConfig->SetPath(
"/PlugIns/libchartdldr_pi.so");
1284 pConfig->Write(
"bEnabled",
true);
1286 pConfig->SetPath(
"/PlugIns/libwmm_pi.so");
1287 pConfig->Write(
"bEnabled",
true);
1289 pConfig->SetPath(
"/Settings/WMM");
1290 pConfig->Write(
"ShowIcon",
true);
1291 pConfig->Write(
"ShowLiveIcon",
true);
1293 pConfig->SetPath(
"/PlugIns/libgrib_pi.so");
1294 pConfig->Write(
"bEnabled",
true);
1296 pConfig->SetPath(
"/PlugIns/libdashboard_pi.so");
1297 pConfig->Write(
"bEnabled",
true);
1299 pConfig->SetPath(
"/PlugIns/GRIB");
1300 pConfig->Write(
"GRIBCtrlBarPosX", 100);
1301 pConfig->Write(
"GRIBCtrlBarPosY", 0);
1303 pConfig->SetPath(
"/Settings/GRIB");
1304 pConfig->Write(
"CursorDataShown", 0);
1308 pConfig->SetPath(
"/PlugIns/liboesenc_pi.so");
1309 pConfig->Write(
"bEnabled",
true);
1311 pConfig->SetPath(
"/Settings/QTFonts");
1314 wxString str =
"en_US-b25a3899";
1315 wxString pval =
"StatusBar:Roboto,26,-1,5,75,0,0,0,0,0:rgb(0, 0, 0)";
1316 pConfig->Write(str, pval);
1320 str =
"en_US-9c3b3a0d";
1321 pval =
"DialogStatusBar:Roboto,18,-1,5,50,0,0,0,0,0:rgb(0, 0, 0)";
1322 pConfig->Write(str, pval);
1326 pConfig->SetPath(
"/Settings/Others");
1327 pConfig->Write(
"TrackLineColour",
"#C545C3");
1328 g_colourTrackLineColour.Set(197, 69, 195);
1330 qDebug() <<
"SetDefaultOptions.Config";
1341void OCPNPlatform::SetUpgradeOptions(wxString vNew, wxString vOld) {
1344 qDebug() <<
"Upgrade check"
1345 <<
"from: " << vOld.mb_str() <<
" to: " << vNew.mb_str();
1347 if (androidGetVersionCode() > g_AndroidVersionCode) {
1348 qDebug() <<
"Upgrade detected"
1349 <<
"from VC: " << g_AndroidVersionCode
1350 <<
" to VC: " << androidGetVersionCode();
1354 pConfig->SetPath(
"/Settings/GlobalState");
1355 pConfig->Write(
"bShowS57Text",
true);
1358 g_ChartNotRenderScaleFactor = 2.0;
1359 g_n_ownship_min_mm = 8;
1360 g_toolbarConfig =
"X.....XX.......XX.XXXXXXXXXXX";
1363 pConfig->DeleteGroup(
"/Settings/QTFonts");
1364 g_default_font_size = 20;
1367 FontMgr::Get().Shutdown();
1370 g_bShowMuiZoomButtons =
true;
1374 pInit_Chart_Dir->Clear();
1378 pConfig->SetPath(
"/Settings/WMM");
1379 pConfig->Write(
"ShowIcon",
true);
1380 pConfig->Write(
"ShowLiveIcon",
true);
1382 pConfig->SetPath(
"/Canvas/CanvasConfig1");
1383 pConfig->Write(
"canvasENCShowVisibleSectorLights", 0);
1393 AndroidRemoveSystemFile(
1394 "/data/user/0/org.opencpn.opencpn/manPlug/libchartscale_pi.so");
1398 g_colourTrackLineColour.Set(197, 69, 195);
1402 if (!vOld.IsSameAs(vNew)) {
1408 wxChar sep = wxFileName::GetPathSeparator();
1409 if (UserIconPath.Last() != sep) UserIconPath.Append(sep);
1410 UserIconPath.Append(
"UserIcons");
1412 if (!::wxDirExists(UserIconPath)) {
1413 ::wxMkdir(UserIconPath);
1418 if (LayersPath.Last() != sep) LayersPath.Append(sep);
1419 LayersPath.Append(
"layers");
1421 if (!::wxDirExists(LayersPath)) {
1422 ::wxMkdir(LayersPath);
1428 g_CmdSoundString = wxString(OCPN_SOUND_CMD);
1429 pConfig->SetPath(
"/Settings");
1430 pConfig->Write(
"CmdSoundString", g_CmdSoundString);
1434 g_bAIS_GCPA_Alert_Audio =
true;
1435 g_bAIS_SART_Alert_Audio =
true;
1436 g_bAIS_DSC_Alert_Audio =
true;
1439 g_maintoolbar_x = -1;
1443 std::vector<std::string> TCDS_temp;
1444 for (
unsigned int i = 0; i < TideCurrentDataSet.size(); i++)
1445 TCDS_temp.push_back(TideCurrentDataSet[i]);
1447 TideCurrentDataSet.clear();
1448 for (
unsigned int i = 0; i < TCDS_temp.size(); i++) {
1449 wxString tide = TCDS_temp[i];
1450 wxFileName ft(tide);
1451 if (ft.FileExists()) TideCurrentDataSet.push_back(TCDS_temp[i]);
1458 g_compatOsVersion =
"";
1459 pConfig->SetPath(
"/Settings");
1460 pConfig->Write(
"CompatOS", g_compatOS);
1461 pConfig->Write(
"CompatOsVersion", g_compatOsVersion);
1465int OCPNPlatform::platformApplyPrivateSettingsString(wxString settings,
1466 ArrayOfCDI *pDirArray) {
1469 ret_val = androidApplySettingsString(settings, pDirArray);
1475void OCPNPlatform::applyExpertMode(
bool mode) {
1479 g_bBasicMenus = !mode;
1487static wxString ExpandPaths(wxString paths,
OCPNPlatform *platform);
1489int OCPNPlatform::DoFileSelectorDialog(wxWindow *parent, wxString *file_spec,
1490 wxString Title, wxString initDir,
1491 wxString suggestedName,
1492 wxString wildcard) {
1494 int result = wxID_CANCEL;
1498 wxString idir = initDir;
1499 if (initDir.StartsWith(
1503 result = androidFileChooser(&file, idir, Title, suggestedName, wildcard);
1504 if (file_spec) *file_spec = file;
1506 long flag = wxFD_DEFAULT_STYLE;
1507 if (suggestedName.Length()) {
1511 wxString mask = wildcard;
1512 if (wxNOT_FOUND != mask.Find(
"gpx")) mask.Prepend(
"GPX files (*.gpx)|");
1514 wxFileDialog *psaveDialog =
1515 new wxFileDialog(parent, Title, initDir, suggestedName, mask, flag);
1523 if (parent) parent->HideWithEffect(wxSHOW_EFFECT_BLEND);
1526 result = psaveDialog->ShowModal();
1529 if (parent) parent->ShowWithEffect(wxSHOW_EFFECT_BLEND);
1532 if (file_spec) *file_spec = psaveDialog->GetPath();
1540int OCPNPlatform::DoDirSelectorDialog(wxWindow *parent, wxString *file_spec,
1541 wxString Title, wxString initDir,
1544 int result = wxID_CANCEL;
1548 wxString idir = initDir;
1549 if (initDir.StartsWith(
1553 result = androidFileChooser(&dir, idir, Title,
"",
"",
true,
1555 if (file_spec) *file_spec = dir;
1557 wxDirDialog *dirSelector =
new wxDirDialog(
1558 parent, Title, initDir, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
1561 dirSelector->SetFont(*qFont);
1568 if (parent) parent->HideWithEffect(wxSHOW_EFFECT_BLEND);
1571 result = dirSelector->ShowModal();
1574 if (parent) parent->ShowWithEffect(wxSHOW_EFFECT_BLEND);
1577 if (result == wxID_CANCEL) {
1580 *file_spec = dirSelector->GetPath();
1590MyConfig *OCPNPlatform::GetConfigObject() {
1593 result =
new MyConfig(GetConfigFileName());
1602bool OCPNPlatform::hasInternalGPS(wxString profile) {
1604 bool t = androidDeviceHasGPS();
1618void OCPNPlatform::ShowBusySpinner() { AbstractPlatform::ShowBusySpinner(); }
1620void OCPNPlatform::HideBusySpinner() { AbstractPlatform::HideBusySpinner(); }
1622double OCPNPlatform::GetDisplayDensityFactor() {
1624 return getAndroidDisplayDensity();
1630long OCPNPlatform::GetDefaultToolbarOrientation() {
1632 return wxTB_VERTICAL;
1634 return wxTB_VERTICAL;
1638int OCPNPlatform::GetStatusBarFieldCount() {
1644 wxFont *templateFont = FontMgr::Get().
GetFont(_(
"StatusBar"), 0);
1645 dc.SetFont(*templateFont);
1648 dc.GetTextExtent(
"WWWWWW", &width, NULL, NULL, NULL, templateFont);
1649 double font_size_pix = (double)width / 6.0;
1653 double nChars = dispSize.x / font_size_pix;
1663 return STAT_FIELD_COUNT;
1667double OCPNPlatform::getFontPointsperPixel() {
1668 double pt_per_pixel = 1.0;
1678 if (m_pt_per_pixel == 0) {
1683 12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, FALSE,
1684 wxString(
""), wxFONTENCODING_SYSTEM);
1688 dc.GetTextExtent(
"H", &width, &height, NULL, NULL, f);
1690 if (height > 0) m_pt_per_pixel = 12.0 / (double)height;
1692 if (m_pt_per_pixel > 0) pt_per_pixel = m_pt_per_pixel;
1695 return pt_per_pixel;
1700 return getAndroidDisplayDimensions();
1717 ret = GetAndroidDisplaySize();
1723double OCPNPlatform::GetDisplayAreaCM2() {
1728 ratio = (double)sz.x / (
double)sz.y;
1730 ratio = (double)sz.y / (
double)sz.x;
1732 double area = size1 * (size1 * ratio) / 100.;
1738 if (monitor < m_displaySizeMMOverride.size()) {
1739 m_displaySizeMMOverride[monitor] = sizeMM;
1743double OCPNPlatform::GetDisplayDPmm() {
1745 return getAndroidDPmm();
1752unsigned int OCPNPlatform::GetSelectRadiusPix() {
1753 return GetDisplayDPmm() *
1754 (g_btouch ? g_selection_radius_touch_mm : g_selection_radius_mm);
1757bool OCPNPlatform::GetFullscreen() {
1760 bret = androidGetFullscreen();
1768bool OCPNPlatform::SetFullscreen(
bool bFull) {
1771 bret = androidSetFullscreen(bFull);
1778void OCPNPlatform::PositionAISAlert(wxWindow *alert_window) {
1781 alert_window->SetSize(g_ais_alert_dialog_x, g_ais_alert_dialog_y,
1782 g_ais_alert_dialog_sx, g_ais_alert_dialog_sy);
1786 alert_window->Centre();
1792wxDirDialog *OCPNPlatform::AdjustDirDialogFont(wxWindow *container,
1794 wxDirDialog *ret_dlg = dlg;
1798 dlg->SetSize(container->GetSize());
1801 wxSize sds = dlg->GetSize();
1802 wxSize ss = container->GetSize();
1807 wxString msg = dlg->GetMessage();
1808 wxString default_dir = dlg->GetPath();
1812 ret_dlg =
new wxDirDialog(NULL, msg, default_dir,
1813 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
1816 wxFont *smallFont =
new wxFont(*dialogFont);
1817 smallFont->SetPointSize((smallFont->GetPointSize() / 2) +
1819 ret_dlg->SetFont(*smallFont);
1821 ret_dlg->SetSize(container->GetSize());
1829wxFileDialog *OCPNPlatform::AdjustFileDialogFont(wxWindow *container,
1830 wxFileDialog *dlg) {
1831 wxFileDialog *ret_dlg = dlg;
1835 dlg->SetSize(container->GetSize());
1838 wxSize sds = dlg->GetSize();
1839 wxSize ss = container->GetSize();
1844 wxString msg = dlg->GetMessage();
1845 wxString default_dir = dlg->GetDirectory();
1846 wxString default_file = dlg->GetFilename();
1847 wxString wildcard = dlg->GetWildcard();
1851 ret_dlg =
new wxFileDialog(NULL, msg, default_dir, default_file, wildcard,
1855 wxFont *smallFont =
new wxFont(*dialogFont);
1856 smallFont->SetPointSize((smallFont->GetPointSize() / 2) +
1858 ret_dlg->SetFont(*smallFont);
1860 ret_dlg->SetSize(container->GetSize());
1868double OCPNPlatform::GetToolbarScaleFactor(
int GUIScaleFactor) {
1876 wxSize style_tool_size(32, 32);
1878 if (g_StyleManager) {
1880 if (style) style_tool_size = style->GetToolSize();
1882 double tool_size = style_tool_size.x;
1888 double premult = 1.0;
1890 double target_size = 9.0;
1892 double basic_tool_size_mm = tool_size / GetDisplayDPmm();
1893 premult = target_size / basic_tool_size_mm;
1896 premult = wxMax(45 * getAndroidDisplayDensity(), 45) /
1902 double postmult = exp(GUIScaleFactor * (log(2.0) / 5.0));
1906 rv = premult * postmult;
1907 rv = wxMin(rv, getAndroidDisplayDensity() *
1911 double premult = 1.0;
1913 if (g_bresponsive) {
1916 wxSize style_tool_size = style->GetToolSize();
1917 double tool_size = style_tool_size.x;
1921 double target_size = 9.0;
1923 double basic_tool_size_mm = tool_size / GetDisplayDPmm();
1924 premult = target_size / basic_tool_size_mm;
1928 double postmult = exp(GUIScaleFactor * (0.693 / 5.0));
1930 rv = premult * postmult;
1931 rv = wxMin(rv, 3.0);
1932 rv = wxMax(rv, 0.5);
1941double OCPNPlatform::GetCompassScaleFactor(
int GUIScaleFactor) {
1948 if (g_bresponsive) {
1951 wxSize style_tool_size = style->GetToolSize();
1952 double compass_size = style_tool_size.x;
1958 double premult = wxMax(28 * getAndroidDisplayDensity(), 50) / compass_size;
1961 double postmult = exp(GUIScaleFactor * (log(2.0) / 5.0));
1964 rv = premult * postmult;
1965 rv = wxMin(rv, getAndroidDisplayDensity() *
1970 double premult = 1.0;
1972 if (g_bresponsive) {
1974 wxSize style_tool_size = style->GetToolSize();
1975 double compass_size = style_tool_size.x;
1978 double target_size = 6.0;
1980 double basic_tool_size_mm = compass_size / GetDisplayDPmm();
1981 premult = target_size / basic_tool_size_mm;
1984 double postmult = exp(GUIScaleFactor * (0.693 / 5.0));
1986 rv = premult * postmult;
1988 rv = wxMin(rv, 3.0);
1989 rv = wxMax(rv, 0.5);
1991#if defined(__WXOSX__) || defined(__WXGTK3__)
1993 if (gFrame) rv *= gFrame->GetContentScaleFactor();
2003float OCPNPlatform::GetChartScaleFactorExp(
float scale_linear) {
2004 double factor = 1.0;
2006 factor = exp(scale_linear * (log(3.0) / 5.0));
2011 factor = exp(scale_linear * (0.693 / 5.0));
2015 factor = wxMax(factor, .5);
2016 factor = wxMin(factor, 6.);
2021float OCPNPlatform::GetMarkScaleFactorExp(
float scale_linear) {
2022 if (scale_linear <= 0)
2023 return GetChartScaleFactorExp(scale_linear);
2025 return GetChartScaleFactorExp(scale_linear - 1);
2042bool OCPNPlatform::hasInternalBT(wxString profile) {
2044 bool t = androidDeviceHasBlueTooth();
2053bool OCPNPlatform::startBluetoothScan() {
2055 return androidStartBluetoothScan();
2062bool OCPNPlatform::stopBluetoothScan() {
2064 return androidStopBluetoothScan();
2071wxArrayString OCPNPlatform::getBluetoothScanResults() {
2072 wxArrayString ret_val;
2074 return androidGetBluetoothScanResults();
2077 ret_val.Add(
"line 1");
2078 ret_val.Add(
"line 2");
2079 ret_val.Add(
"line 3");
2089bool OCPNPlatform::AllowAlertDialog(
const wxString &class_name) {
2094 wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
2096 wxWindow *win = node->GetData();
2097 if (win->IsShown()) nTLW++;
2099 node = node->GetNext();
2113void OCPNPlatform::setChartTypeMaskSel(
int mask, wxString &indicator) {
2115 return androidSetChartTypeMaskSel(mask, indicator);
2120QString g_qtStyleSheet;
2122bool LoadQtStyleSheet(wxString &sheet_file) {
2123 if (wxFileExists(sheet_file)) {
2126 QString file(sheet_file.c_str());
2128 File.open(QFile::ReadOnly);
2129 g_qtStyleSheet = QLatin1String(File.readAll());
2139QString getQtStyleSheet() {
return g_qtStyleSheet; }
2143bool OCPNPlatform::isPlatformCapable(
int flag) {
2147 if (flag == PLATFORM_CAP_PLUGINS) {
2149 wxString tsdk(android_plat_spc.msdk);
2150 if (tsdk.ToLong(&platver)) {
2151 if (platver >= 11)
return true;
2153 }
else if (flag == PLATFORM_CAP_FASTPAN) {
2155 wxString tsdk(android_plat_spc.msdk);
2156 if (tsdk.ToLong(&platver)) {
2157 if (platver >= 14)
return true;
2165void OCPNPlatform::platformLaunchDefaultBrowser(wxString URL) {
2167 androidLaunchBrowser(URL);
2169 ::wxLaunchDefaultBrowser(URL);
2179EVT_PAINT(OCPNColourPickerCtrl::OnPaint)
2188 const wxColour &initial,
2190 const wxSize &size,
long style,
2191 const wxValidator &validator,
2192 const wxString &name) {
2193 Create(parent,
id, initial, pos, size, style, validator, name);
2196bool OCPNColourPickerCtrl::Create(wxWindow *parent, wxWindowID
id,
2197 const wxColour &col,
const wxPoint &pos,
2198 const wxSize &size,
long style,
2199 const wxValidator &validator,
2200 const wxString &name) {
2201 m_bitmap = wxBitmap(60, 13);
2204 if (!wxBitmapButton::Create(parent,
id, m_bitmap, pos, size,
2205 style | wxBU_AUTODRAW, validator, name)) {
2206 wxFAIL_MSG(
"OCPNColourPickerCtrl creation failed");
2211 Connect(GetId(), wxEVT_BUTTON,
2212 wxCommandEventHandler(OCPNColourPickerCtrl::OnButtonClick), NULL,
2222void OCPNColourPickerCtrl::InitColourData() {
2224 ms_data.SetChooseFull(
true);
2225 unsigned char grey = 0;
2226 for (
int i = 0; i < 16; i++, grey += 16)
2229 wxColour colour(grey, grey, grey);
2230 ms_data.SetCustomColour(i, colour);
2235void OCPNColourPickerCtrl::OnButtonClick(wxCommandEvent &WXUNUSED(ev)) {
2237 unsigned int cco = 0;
2240 cco |= m_colour.Red();
2242 cco |= m_colour.Green();
2244 cco |= m_colour.Blue();
2245 unsigned int cc = androidColorPicker(cco);
2248 unsigned char blue = (
unsigned char)cc % 256;
2249 unsigned char green = (
unsigned char)(cc >> 8) % 256;
2251 unsigned char red = (
unsigned char)(cc >> 16) % 256;
2252 cnew.Set(red, green, blue);
2258 ms_data.SetColour(m_colour);
2261 wxColourDialog dlg(
this, &ms_data);
2262 if (dlg.ShowModal() == wxID_OK) {
2263 ms_data = dlg.GetColourData();
2264 SetColour(ms_data.GetColour());
2269void OCPNColourPickerCtrl::UpdateColour() {
2271 SetBitmapLabel(wxBitmap());
2274 wxMemoryDC dc(m_bitmap);
2275 dc.SetPen(*wxTRANSPARENT_PEN);
2276 dc.SetBrush(wxBrush(m_colour));
2277 dc.DrawRectangle(0, 0, m_bitmap.GetWidth(), m_bitmap.GetHeight());
2279 dc.SelectObject(wxNullBitmap);
2280 SetBitmapLabel(m_bitmap);
2283void OCPNColourPickerCtrl::SetColour(wxColour &c) {
2285 m_bitmap = wxBitmap(GetSize().x - 20, GetSize().y - 20);
2289wxColour OCPNColourPickerCtrl::GetColour() {
return m_colour; }
2291wxSize OCPNColourPickerCtrl::DoGetBestSize()
const {
2292 wxSize sz(wxBitmapButton::DoGetBestSize());
2299 if (HasFlag(wxCLRP_SHOW_LABEL))
return sz;
2307void OCPNColourPickerCtrl::OnPaint(wxPaintEvent &event) {
2310 int offset_x = (GetSize().x - m_bitmap.GetWidth()) / 2;
2311 int offset_y = (GetSize().y - m_bitmap.GetHeight()) / 2;
2313 dc.SetPen(*wxTRANSPARENT_PEN);
2314 dc.SetBrush(wxBrush(m_colour));
2315 dc.DrawRectangle(offset_x, offset_y, m_bitmap.GetWidth(),
2316 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.