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>
84#include "snd_config.h"
85#include "std_filesystem.h"
90#include "androidUTIL.h"
98#ifdef OCPN_USE_CRASHREPORT
120void appendOSDirSlash(wxString *pString);
123struct sigaction sa_all;
124struct sigaction sa_all_old;
131#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
132extern wxLocale *plocale_def_lang;
143static const char *
const DEFAULT_XDG_DATA_DIRS =
144 "~/.local/share:/usr/local/share:/usr/share";
147static const char PATH_SEP =
';';
149static const char PATH_SEP =
':';
153constexpr int kStatFieldCount = 2;
155constexpr int kStatFieldCount = 5;
158static bool checkIfFlatpacked() {
160 if (!wxGetEnv(
"FLATPAK_ID", &
id)) {
163 return id ==
"org.opencpn.OpenCPN";
166OCPNPlatform::OCPNPlatform() {
168 m_bdisableWindowsDisplayEnum =
false;
169 m_monitorWidth = m_monitorHeight = 0;
172 m_displaySizeMMOverride.push_back(0);
174 m_pluginDataPath =
"";
177OCPNPlatform::~OCPNPlatform() {
189int MyNewHandler(
size_t size) {
191 throw std::bad_alloc();
212void catch_signals(
int signo) {
225 top_frame::Get()->FastClose();
232 top_frame::Get()->FastClose();
243#ifdef OCPN_USE_CRASHREPORT
245int CALLBACK CrashCallback(CR_CRASH_CALLBACK_INFO *pInfo) {
246 wxLog::GetActiveTarget()->Flush();
247 return CR_CB_DODEFAULT;
252void OCPNPlatform::Initialize_1() {
253#ifdef OCPN_USE_CRASHREPORT
257 CR_INSTALL_INFO info;
258 memset(&info, 0,
sizeof(CR_INSTALL_INFO));
259 info.cb =
sizeof(CR_INSTALL_INFO);
260 info.pszAppName = L
"OpenCPN";
262 info.pszAppVersion = wxString(VERSION_FULL).c_str();
264 int type = MiniDumpNormal;
267 type |= MiniDumpWithDataSegs;
278 info.uMiniDumpType = (MINIDUMP_TYPE)type;
281 info.dwFlags = CR_INST_ALL_POSSIBLE_HANDLERS;
284 info.dwFlags &= ~CR_INST_NEW_OPERATOR_ERROR_HANDLER;
287 info.dwFlags |= CR_INST_ALLOW_ATTACH_MORE_FILES;
290 info.dwFlags |= CR_INST_SHOW_ADDITIONAL_INFO_FIELDS;
294 if (g_bEmailCrashReport) {
295 info.pszUrl = L
"https://bigdumboat.com/crashrpt/ocpn_crashrpt.php";
296 info.uPriorities[CR_HTTP] = 3;
298 info.dwFlags |= CR_INST_DONT_SEND_REPORT;
299 info.uPriorities[CR_HTTP] = CR_NEGATIVE_PRIORITY;
302 info.uPriorities[CR_SMTP] =
303 CR_NEGATIVE_PRIORITY;
304 info.uPriorities[CR_SMAPI] =
305 CR_NEGATIVE_PRIORITY;
307 wxStandardPaths &crash_std_path =
g_Platform->GetStdPaths();
309 wxString crash_rpt_save_locn = crash_std_path.GetConfigDir();
311 wxFileName exec_path_crash(crash_std_path.GetExecutablePath());
312 crash_rpt_save_locn =
313 exec_path_crash.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
316 wxString locn = crash_rpt_save_locn +
"\\CrashReports";
318 if (!wxDirExists(locn)) wxMkdir(locn);
320 if (wxDirExists(locn)) {
321 wxCharBuffer buf = locn.ToUTF8();
323 if (buf && (locn.Length() <
sizeof(wlocn))) {
324 MultiByteToWideChar(0, 0, buf.data(), -1, wlocn,
sizeof(wlocn) - 1);
325 info.pszErrorReportSaveDir = (LPCWSTR)wlocn;
330 wxFileName exec_path_crash(crash_std_path.GetExecutablePath());
331 wxString policy_file =
332 exec_path_crash.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
333 policy_file +=
"PrivacyPolicy.txt";
334 policy_file.Prepend(
"file:");
336 info.pszPrivacyPolicyURL = policy_file.c_str();
339 int nResult = crInstall(&info);
342 crGetLastErrorMsg(buff, 256);
349 crSetCrashCallback(CrashCallback, NULL);
352 crAddScreenshot2(CR_AS_PROCESS_WINDOWS | CR_AS_USE_JPEG_FORMAT, 95);
355 wxString home_data_crash = crash_std_path.GetConfigDir();
357 wxFileName f(crash_std_path.GetExecutablePath());
358 home_data_crash = f.GetPath();
360 appendOSDirSlash(&home_data_crash);
362 wxString config_crash =
"opencpn.ini";
363 config_crash.Prepend(home_data_crash);
364 crAddFile2(config_crash.c_str(), NULL, NULL,
365 CR_AF_MISSING_FILE_OK | CR_AF_ALLOW_DELETE);
367 wxString log_crash =
"opencpn.log";
368 log_crash.Prepend(home_data_crash);
369 crAddFile2(log_crash.c_str(), NULL, NULL,
370 CR_AF_MISSING_FILE_OK | CR_AF_ALLOW_DELETE);
376#if wxUSE_ON_FATAL_EXCEPTION
378 wxHandleFatalExceptions(
true);
384 _set_new_handler(MyNewHandler);
394 HANDLE hProc = GetCurrentProcess();
398 DuplicateHandle( hProc, hProc, hProc, &hDup, 0, FALSE, DUPLICATE_SAME_ACCESS );
401 GetProcessAffinityMask( hDup, &procMask, &sysMask );
405 if( ( procMask & 1 ) == 1 ) newMask = 1;
407 if( ( procMask & 2 ) == 2 ) newMask = 2;
409 if( ( procMask & 4 ) == 4 ) newMask = 4;
411 if( ( procMask & 8 ) == 8 ) newMask = 8;
414 BOOL res = SetProcessAffinityMask( hDup, (DWORD_PTR) newMask );
428 wxPlatformInfo Platform;
429 if (Platform.GetOperatingSystemId() == wxOS_WINDOWS_9X)
430 SetUnhandledExceptionFilter(&MyUnhandledExceptionFilter);
441 sa_all.sa_handler = catch_signals;
442 sigemptyset(&sa_all.sa_mask);
448 sigaction(SIGUSR1, NULL,
452 sigaction(SIGUSR1, &sa_all, NULL);
453 sigaction(SIGUSR1, NULL,
456 sigaction(SIGTERM, &sa_all, NULL);
457 sigaction(SIGTERM, NULL, &sa_all_old);
459 sigaction(SIGHUP, &sa_all, NULL);
460 sigaction(SIGHUP, NULL, &sa_all_old);
465 qDebug() <<
"Initialize_1()";
475void OCPNPlatform::Initialize_2() {
477 wxLogMessage(androidGetDeviceInfo());
481 wxChar sep = wxFileName::GetPathSeparator();
484 if (ChartDir.Last() != sep) ChartDir.Append(sep);
485 ChartDir.Append(
"Charts");
486 if (!::wxDirExists(ChartDir)) {
491 if (GRIBDir.Last() != sep) GRIBDir.Append(sep);
492 GRIBDir.Append(
"GRIBS");
493 if (!::wxDirExists(GRIBDir)) {
498 if (VDRDir.Last() != sep) VDRDir.Append(sep);
499 VDRDir.Append(
"VDR");
500 if (!::wxDirExists(VDRDir)) {
505 if (g_Android_SDK_Version >= 30) {
506 if (!g_gpx_path.StartsWith(androidGetDocumentsDirectory())) {
507 g_gpx_path = androidGetDocumentsDirectory();
514 g_toolbar_scalefactor = GetToolbarScaleFactor(g_GUIScaleFactor);
516 if (!configdir.DirExists()) {
517 if (!configdir.Mkdir()) {
518 auto msg = std::string(
"Cannot create config directory: ");
519 wxLogWarning(msg + configdir.GetFullPath());
526void OCPNPlatform::Initialize_3() {
527 bool bcapable = IsGLCapable();
533 bool bAndroid =
false;
542 g_bdisable_opengl =
false;
550 if ((g_bFirstRun || g_bUpgradeInProcess || bAndroid) && bcapable) {
554 g_GLOptions.m_bUseAcceleratedPanning =
true;
555 g_GLOptions.m_bTextureCompression =
true;
556 g_GLOptions.m_bTextureCompressionCaching =
true;
558 g_GLOptions.m_iTextureDimension = 512;
559 g_GLOptions.m_iTextureMemorySize = 64;
561 g_GLOptions.m_GLPolygonSmoothing =
true;
562 g_GLOptions.m_GLLineSmoothing =
true;
572 if (g_bFirstRun || g_bUpgradeInProcess) {
577 g_FlushNavobjChangesTimeout = 300;
581void OCPNPlatform::Initialize_4() {
583 if (
pSelect)
pSelect->SetSelectPixelRadius(wxMax(25, 6.0 * getAndroidDPmm()));
585 pSelectTC->SetSelectPixelRadius(wxMax(25, 6.0 * getAndroidDPmm()));
587 pSelectAIS->SetSelectPixelRadius(wxMax(25, 6.0 * getAndroidDPmm()));
594 options_lastPage = 1;
598void OCPNPlatform::OnExit_1() {}
600void OCPNPlatform::OnExit_2() {
601#ifdef OCPN_USE_CRASHREPORT
611bool HasGLExt(
wxJSONValue &glinfo,
const std::string ext) {
612 if (!glinfo.
HasMember(
"GL_EXTENSIONS")) {
615 for (
int i = 0; i < glinfo[
"GL_EXTENSIONS"].
Size(); i++) {
616 if (glinfo[
"GL_EXTENSIONS"][i].AsString() == ext) {
623bool OCPNPlatform::BuildGLCaps(
void *pbuf) {
625 fs::path ep(GetExePath().ToStdString());
627 std::string gl_util_exe =
"opencpn-glutil";
629 std::string gl_util_exe =
"opencpn-glutil.exe";
631 fs::path gl_util_path = ep.parent_path().append(gl_util_exe);
633 if (!fs::exists(gl_util_path)) {
636 wxLogMessage(
"OpenGL test utility not found at %s.", gl_util_path.c_str());
641 .append(
"gl_caps.json")
644 wxString cmd = wxString::Format(
"\"%s\" opengl-info \"%s\"",
645 gl_util_path.c_str(), gl_json.c_str());
647 wxLogMessage(
"Starting OpenGL test utility: %s", cmd);
649 wxArrayString output;
650 if (
long res = wxExecute(cmd, output); res != 0) {
651 wxLogMessage(
"OpenGL test utility failed with exit code %d", res);
652 for (
const auto &l : output) {
658 wxFileInputStream fis(gl_json);
661 reader.
Parse(fis, &root);
663 wxLogMessage(
"Failed to parse JSON output from OpenGL test utility.");
664 for (
const auto &l : reader.GetErrors()) {
673 pcaps->Renderer = root[
"GL_RENDERER"].
AsString();
675 wxLogMessage(
"GL_RENDERER not found.");
679 pcaps->Version = root[
"GL_VERSION"].
AsString();
681 wxLogMessage(
"GL_VERSION not found.");
684 if (root.
HasMember(
"GL_SHADING_LANGUAGE_VERSION")) {
685 pcaps->GLSL_Version = root[
"GL_SHADING_LANGUAGE_VERSION"].
AsString();
687 wxLogMessage(
"GL_SHADING_LANGUAGE_VERSION not found.");
691 if (!root[
"GL_USABLE"].AsBool()) {
692 wxLogMessage(
"OpenGL test utility reports that OpenGL is not usable.");
696 wxLogMessage(
"GL_USABLE not found.");
699 pcaps->dGLSL_Version = 0;
700 pcaps->dGLSL_Version = ::atof(pcaps->GLSL_Version.c_str());
701 if (pcaps->dGLSL_Version < 1.2) {
703 msg.Printf(
"GLCaps Probe: OpenGL-> GLSL Version reported: ");
704 msg += wxString(pcaps->GLSL_Version.c_str());
705 msg +=
"\n OpenGL disabled due to insufficient OpenGL capabilities";
707 pcaps->bCanDoGLSL =
false;
710 pcaps->bCanDoGLSL =
true;
711 if (HasGLExt(root,
"GL_ARB_texture_non_power_of_two")) {
712 pcaps->TextureRectangleFormat = GL_TEXTURE_2D;
713 }
else if (HasGLExt(root,
"GL_OES_texture_npot")) {
714 pcaps->TextureRectangleFormat = GL_TEXTURE_2D;
715 }
else if (HasGLExt(root,
"GL_ARB_texture_rectangle")) {
716 pcaps->TextureRectangleFormat = GL_TEXTURE_RECTANGLE_ARB;
719 pcaps->bOldIntel =
false;
721 pcaps->bCanDoFBO = HasGLExt(root,
"GL_EXT_framebuffer_object");
722 if (!pcaps->TextureRectangleFormat) {
723 pcaps->bCanDoFBO =
false;
726 pcaps->bCanDoVBO = HasGLExt(
727 root,
"GL_ARB_vertex_buffer_object");
730 top_frame::Get()->Show();
735 top_frame::Get()->Show();
739 wxGLContext *pctx =
new wxGLContext(tcanvas);
740 tcanvas->SetCurrent(*pctx);
744 char *str = (
char *)glGetString(GL_RENDERER);
746 wxLogMessage(
"GL_RENDERER not found.");
751 pcaps->Renderer = std::string(str);
753 char *stv = (
char *)glGetString(GL_VERSION);
755 wxLogMessage(
"GL_VERSION not found");
760 pcaps->Version = std::string(stv);
762 char *stsv = (
char *)glGetString(GL_SHADING_LANGUAGE_VERSION);
764 wxLogMessage(
"GL_SHADING_LANGUAGE_VERSION not found");
769 pcaps->GLSL_Version = std::string(stsv);
771 pcaps->dGLSL_Version = 0;
772 pcaps->dGLSL_Version = ::atof(pcaps->GLSL_Version.c_str());
774 if (pcaps->dGLSL_Version < 1.2) {
776 msg.Printf(
"GLCaps Probe: OpenGL-> GLSL Version reported: ");
777 msg += wxString(pcaps->GLSL_Version.c_str());
778 msg +=
"\n OpenGL disabled due to insufficient OpenGL capabilities";
780 pcaps->bCanDoGLSL =
false;
786 pcaps->bCanDoGLSL =
true;
788 if (QueryExtension(
"GL_ARB_texture_non_power_of_two"))
789 pcaps->TextureRectangleFormat = GL_TEXTURE_2D;
790 else if (QueryExtension(
"GL_OES_texture_npot"))
791 pcaps->TextureRectangleFormat = GL_TEXTURE_2D;
792 else if (QueryExtension(
"GL_ARB_texture_rectangle"))
793 pcaps->TextureRectangleFormat = GL_TEXTURE_RECTANGLE_ARB;
795 pcaps->bOldIntel =
false;
798 pcaps->bCanDoVBO =
true;
800#if defined(__WXMSW__) || defined(__WXOSX__)
801 if (pcaps->bOldIntel) pcaps->bCanDoVBO =
false;
805 pcaps->bCanDoVBO =
false;
809 pcaps->bCanDoFBO =
true;
813 if (!pcaps->TextureRectangleFormat) pcaps->bCanDoFBO =
false;
816 if (!QueryExtension(
"GL_EXT_framebuffer_object")) pcaps->bCanDoFBO =
false;
826bool OCPNPlatform::IsGLCapable() {
835 if (g_bdisable_opengl)
return false;
837 wxLogMessage(
"Starting OpenGL test...");
838 wxLog::FlushActive();
842 bool bcaps = BuildGLCaps(GL_Caps);
844 wxLogMessage(
"OpenGL test complete.");
846 wxLogMessage(
"BuildGLCaps fails.");
847 wxLog::FlushActive();
855 if (!GL_Caps->bCanDoGLSL) {
861 if (!GL_Caps->bCanDoFBO) {
866 wxLogMessage(
"OpenGL determined CAPABLE.");
867 wxLog::FlushActive();
869 g_bdisable_opengl =
false;
882void OCPNPlatform::SetLocaleSearchPrefixes() {
885#if defined(__WINDOWS__)
888 wxString locale_location = GetSharedDataDir();
889 locale_location +=
"share\\locale";
890 wxLocale::AddCatalogLookupPathPrefix(locale_location);
891 wxString imsg =
"Adding catalog lookup path: ";
892 imsg += locale_location;
897 usrShare.RemoveLastDir();
898 locale_location = usrShare.GetFullPath() + (
"share\\locale");
899 wxLocale::AddCatalogLookupPathPrefix(locale_location);
900 imsg =
"Adding catalog lookup path: ";
901 imsg += locale_location;
904#elif defined(__ANDROID__)
906 wxString locale_location = GetSharedDataDir() +
"locale";
907 wxLocale::AddCatalogLookupPathPrefix(locale_location);
909#elif defined(__UNIX__) && !defined(__WINE__)
914 wxString locale_location;
915 if (!wxGetEnv(
"OPENCPN_PREFIX", &locale_location)) {
916 locale_location =
"/usr/local";
924 location.AssignDir(locale_location);
925 location.AppendDir(
"share");
926 location.SetName(
"locale");
927 locale_location = location.GetFullPath();
928 wxLocale::AddCatalogLookupPathPrefix(locale_location);
932 wxString managed_locale_location(dir +
"/locale");
933 wxLocale::AddCatalogLookupPathPrefix(managed_locale_location);
939 "/Library/Application Support/OpenCPN/Contents/Resources";
940 wxString Mac_managed_locale_location(macDir);
941 wxLocale::AddCatalogLookupPathPrefix(Mac_managed_locale_location);
947wxString OCPNPlatform::GetDefaultSystemLocale() {
948 wxLogMessage(
"Getting DefaultSystemLocale...");
950 wxString retval =
"en_US";
954 const wxLanguageInfo *languageInfo =
955 wxLocale::GetLanguageInfo(wxLANGUAGE_DEFAULT);
956 if (languageInfo) retval = languageInfo->CanonicalName;
958#if defined(__WXMSW__)
959 LANGID lang_id = GetUserDefaultUILanguage();
962 const wxLanguageInfo *languageInfoW = 0;
963 if (0 != GetLocaleInfo(MAKELCID(lang_id, SORT_DEFAULT), LOCALE_SENGLANGUAGE,
965 wxString lstring = wxString(lngcp);
967 languageInfoW = wxLocale::FindLanguageInfo(lngcp);
969 wxLogMessage(
"Found LanguageInfo for: " + lstring);
971 wxLogMessage(
"Could not find LanguageInfo for: " + lstring);
973 wxLogMessage(
"Could not get LocaleInfo, using wxLANGUAGE_DEFAULT");
974 languageInfoW = wxLocale::GetLanguageInfo(wxLANGUAGE_DEFAULT);
977 if (languageInfoW) retval = languageInfoW->CanonicalName;
980#if defined(__ANDROID__)
981 retval = androidGetAndroidSystemLocale();
989#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
990wxString OCPNPlatform::GetAdjustedAppLocale() {
991 wxString adjLocale = g_locale;
996#if defined(__WXMSW__)
997 if (g_bFirstRun || wxIsEmpty(adjLocale)) {
998 wxRegKey RegKey(wxString(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\OpenCPN"));
999 if (RegKey.Exists()) {
1001 "Retrieving initial language selection from Windows Registry");
1002 RegKey.QueryValue(wxString(
"InstallerLanguage"), adjLocale);
1005 if (wxIsEmpty(adjLocale)) {
1006 if (g_localeOverride.Length())
1007 adjLocale = g_localeOverride;
1009 adjLocale = GetDefaultSystemLocale();
1012#if defined(__ANDROID__)
1013 if (g_localeOverride.Length())
1014 adjLocale = g_localeOverride;
1016 adjLocale = GetDefaultSystemLocale();
1022wxString OCPNPlatform::ChangeLocale(wxString &newLocaleID,
1023 wxLocale *presentLocale,
1024 wxLocale **newLocale) {
1025 wxString return_val;
1027 wxString imsg =
"ChangeLocale: Language load for: ";
1028 imsg += newLocaleID;
1032 delete (wxLocale *)presentLocale;
1034 wxLocale *locale =
new wxLocale;
1035 if (isFlatpacked()) {
1036 std::string path(getenv(
"HOME"));
1037 path +=
"/.var/app/org.opencpn.OpenCPN/data/locale";
1038 locale->AddCatalogLookupPathPrefix(path);
1039 wxLogMessage(
"Using flatpak locales at %s", path.c_str());
1041 wxString loc_lang_canonical;
1043 const wxLanguageInfo *pli = wxLocale::FindLanguageInfo(newLocaleID);
1044 bool b_initok =
false;
1047 locale->Init(pli->Language, 1);
1051 if (!locale->IsOk()) {
1052 wxString imsg =
"ChangeLocale: could not initialize: ";
1053 imsg += newLocaleID;
1057 locale =
new wxLocale;
1058 locale->Init(pli->Language, 0);
1060 loc_lang_canonical = pli->CanonicalName;
1062 b_initok = locale->IsOk();
1069 wxString imsg =
"ChangeLocale: Fall back to en_US";
1073 locale =
new wxLocale;
1074 locale->Init(wxLANGUAGE_ENGLISH_US, 0);
1075 loc_lang_canonical =
1076 wxLocale::GetLanguageInfo(wxLANGUAGE_ENGLISH_US)->CanonicalName;
1080 wxString imsg =
"ChangeLocale: Locale Init OK for: ";
1081 imsg += loc_lang_canonical;
1095 wxString emsg =
"ERROR Loading translation catalog for: ";
1099 wxString imsg =
"Loaded translation catalog for: ";
1106 wxLogMessage(
"Loading catalog for opencpn core.");
1107 locale->AddCatalog(
"opencpn");
1109 return_val = locale->GetCanonicalName();
1112 if (return_val != GetDefaultSystemLocale())
1113 g_localeOverride = return_val;
1115 g_localeOverride =
"";
1118 *newLocale = locale;
1121 setlocale(LC_NUMERIC,
"C");
1132void OCPNPlatform::SetDefaultOptions() {
1134 g_bShowOutlines =
true;
1140 g_MarkLost_Mins = 8;
1141 g_bRemoveLost =
true;
1142 g_RemoveLost_Mins = 10;
1145 g_bSyncCogPredictors =
false;
1146 g_bHideMoored =
false;
1147 g_ShowMoored_Kts = 0.2;
1148 g_SOGminCOG_kts = 0.2;
1149 g_bTrackDaily =
false;
1151 g_bFullScreenQuilt =
true;
1152 g_bQuiltEnable =
true;
1153 g_bskew_comp =
false;
1154 g_bShowAreaNotices =
false;
1155 g_bDrawAISSize =
false;
1156 g_bDrawAISRealtime =
false;
1157 g_AIS_RealtPred_Kts = 0.7;
1158 g_bShowAISName =
false;
1159 g_nTrackPrecision = 2;
1160 g_bPreserveScaleOnX =
true;
1164 g_n_ownship_min_mm = 8;
1165 g_bShowMuiZoomButtons =
true;
1166 g_bresponsive =
false;
1170 pConfig->SetPath(
"/Settings/GlobalState");
1171 pConfig->Write(
"bShowS57Text",
true);
1172 pConfig->Write(
"bShowS57ImportantTextOnly",
false);
1173 pConfig->Write(
"nDisplayCategory", (
int)(_DisCat)OTHER);
1174 pConfig->Write(
"nSymbolStyle", (
int)(_LUPname)PAPER_CHART);
1175 pConfig->Write(
"nBoundaryStyle", (
int)(_LUPname)PLAIN_BOUNDARIES);
1177 pConfig->Write(
"bShowSoundg",
true);
1178 pConfig->Write(
"bShowMeta",
false);
1179 pConfig->Write(
"bUseSCAMIN",
true);
1180 pConfig->Write(
"bShowAtonText",
false);
1181 pConfig->Write(
"bShowLightDescription",
false);
1182 pConfig->Write(
"bExtendLightSectors",
true);
1183 pConfig->Write(
"bDeClutterText",
true);
1184 pConfig->Write(
"bShowNationalText",
true);
1186 pConfig->Write(
"S52_MAR_SAFETY_CONTOUR", 3);
1187 pConfig->Write(
"S52_MAR_SHALLOW_CONTOUR", 2);
1188 pConfig->Write(
"S52_MAR_DEEP_CONTOUR", 6);
1189 pConfig->Write(
"S52_MAR_TWO_SHADES", 0);
1190 pConfig->Write(
"S52_DEPTH_UNIT_SHOW", 1);
1192 pConfig->Write(
"ZoomDetailFactorVector", 3);
1194 pConfig->Write(
"nColorScheme", 1);
1198 g_bEnableZoomToCursor =
true;
1200 g_bShowMenuBar =
true;
1207 pConfig->SetPath(
"/PlugIns/chartdldr_pi.dll");
1208 pConfig->Write(
"bEnabled",
true);
1210 pConfig->SetPath(
"/PlugIns/wmm_pi.dll");
1211 pConfig->Write(
"bEnabled",
true);
1213 pConfig->SetPath(
"/Settings/WMM");
1214 pConfig->Write(
"ShowIcon",
true);
1215 pConfig->Write(
"ShowLiveIcon",
true);
1222 pConfig->SetPath(
"/PlugIns/libchartdldr_pi.dylib");
1223 pConfig->Write(
"bEnabled",
true);
1225 pConfig->SetPath(
"/PlugIns/libwmm_pi.dylib");
1226 pConfig->Write(
"bEnabled",
true);
1228 pConfig->SetPath(
"/Settings/WMM");
1229 pConfig->Write(
"ShowIcon",
true);
1230 pConfig->Write(
"ShowLiveIcon",
true);
1237 pConfig->SetPath(
"/PlugIns/libchartdldr_pi.so");
1238 pConfig->Write(
"bEnabled",
true);
1240 pConfig->SetPath(
"/PlugIns/libwmm_pi.so");
1241 pConfig->Write(
"bEnabled",
true);
1243 pConfig->SetPath(
"/Settings/WMM");
1244 pConfig->Write(
"ShowIcon",
true);
1245 pConfig->Write(
"ShowLiveIcon",
true);
1253 g_GLOptions.m_bTextureCompression = 1;
1254 g_GLOptions.m_bTextureCompressionCaching = 1;
1257 qDebug() <<
"SetDefaultOptions";
1260 g_bresponsive =
true;
1261 g_default_font_size = 18;
1264 g_bShowStatusBar =
true;
1265 g_cm93_zoom_factor = 0;
1266 g_oz_vector_scale =
false;
1267 g_fog_overzoom =
false;
1270 g_bShowMuiZoomButtons =
true;
1272 g_GUIScaleFactor = 0;
1273 g_ChartNotRenderScaleFactor = 2.0;
1277 g_toolbarConfig =
"X.....XX.......XX.XXXXXXXXXXX";
1278 g_bPermanentMOBIcon =
false;
1280 wxString sGPS =
"2;3;;0;0;;0;1;0;0;;0;;1;0;0;0;0";
1283 new_params->bEnabled =
true;
1284 TheConnectionParams().push_back(new_params);
1291 pConfig->SetPath(
"/PlugIns/libchartdldr_pi.so");
1292 pConfig->Write(
"bEnabled",
true);
1294 pConfig->SetPath(
"/PlugIns/libwmm_pi.so");
1295 pConfig->Write(
"bEnabled",
true);
1297 pConfig->SetPath(
"/Settings/WMM");
1298 pConfig->Write(
"ShowIcon",
true);
1299 pConfig->Write(
"ShowLiveIcon",
true);
1301 pConfig->SetPath(
"/PlugIns/libgrib_pi.so");
1302 pConfig->Write(
"bEnabled",
true);
1304 pConfig->SetPath(
"/PlugIns/libdashboard_pi.so");
1305 pConfig->Write(
"bEnabled",
true);
1307 pConfig->SetPath(
"/PlugIns/GRIB");
1308 pConfig->Write(
"GRIBCtrlBarPosX", 100);
1309 pConfig->Write(
"GRIBCtrlBarPosY", 0);
1311 pConfig->SetPath(
"/Settings/GRIB");
1312 pConfig->Write(
"CursorDataShown", 0);
1316 pConfig->SetPath(
"/PlugIns/liboesenc_pi.so");
1317 pConfig->Write(
"bEnabled",
true);
1319 pConfig->SetPath(
"/Settings/QTFonts");
1322 wxString str =
"en_US-b25a3899";
1323 wxString pval =
"StatusBar:Roboto,26,-1,5,75,0,0,0,0,0:rgb(0, 0, 0)";
1328 str =
"en_US-9c3b3a0d";
1329 pval =
"DialogStatusBar:Roboto,18,-1,5,50,0,0,0,0,0:rgb(0, 0, 0)";
1334 pConfig->SetPath(
"/Settings/Others");
1335 pConfig->Write(
"TrackLineColour",
"#C545C3");
1336 g_colourTrackLineColour.Set(197, 69, 195);
1338 qDebug() <<
"SetDefaultOptions.Config";
1349void OCPNPlatform::SetUpgradeOptions(wxString vNew, wxString vOld) {
1352 qDebug() <<
"Upgrade check"
1353 <<
"from: " << vOld.mb_str() <<
" to: " << vNew.mb_str();
1355 if (androidGetVersionCode() > g_AndroidVersionCode) {
1356 qDebug() <<
"Upgrade detected"
1357 <<
"from VC: " << g_AndroidVersionCode
1358 <<
" to VC: " << androidGetVersionCode();
1362 pConfig->SetPath(
"/Settings/GlobalState");
1363 pConfig->Write(
"bShowS57Text",
true);
1366 g_ChartNotRenderScaleFactor = 2.0;
1367 g_n_ownship_min_mm = 8;
1368 g_toolbarConfig =
"X.....XX.......XX.XXXXXXXXXXX";
1371 pConfig->DeleteGroup(
"/Settings/QTFonts");
1372 g_default_font_size = 20;
1375 FontMgr::Get().Shutdown();
1378 g_bShowMuiZoomButtons =
true;
1382 pInit_Chart_Dir->Clear();
1386 pConfig->SetPath(
"/Settings/WMM");
1387 pConfig->Write(
"ShowIcon",
true);
1388 pConfig->Write(
"ShowLiveIcon",
true);
1390 pConfig->SetPath(
"/Canvas/CanvasConfig1");
1391 pConfig->Write(
"canvasENCShowVisibleSectorLights", 0);
1401 AndroidRemoveSystemFile(
1402 "/data/user/0/org.opencpn.opencpn/manPlug/libchartscale_pi.so");
1406 g_colourTrackLineColour.Set(197, 69, 195);
1410 if (!vOld.IsSameAs(vNew)) {
1416 wxChar sep = wxFileName::GetPathSeparator();
1417 if (UserIconPath.Last() != sep) UserIconPath.Append(sep);
1418 UserIconPath.Append(
"UserIcons");
1420 if (!::wxDirExists(UserIconPath)) {
1421 ::wxMkdir(UserIconPath);
1426 if (LayersPath.Last() != sep) LayersPath.Append(sep);
1427 LayersPath.Append(
"layers");
1429 if (!::wxDirExists(LayersPath)) {
1430 ::wxMkdir(LayersPath);
1436 g_CmdSoundString = wxString(OCPN_SOUND_CMD);
1437 pConfig->SetPath(
"/Settings");
1438 pConfig->Write(
"CmdSoundString", g_CmdSoundString);
1442 g_bAIS_GCPA_Alert_Audio =
true;
1443 g_bAIS_SART_Alert_Audio =
true;
1444 g_bAIS_DSC_Alert_Audio =
true;
1447 g_maintoolbar_x = -1;
1451 std::vector<std::string> TCDS_temp;
1452 for (
unsigned int i = 0; i < TideCurrentDataSet.size(); i++)
1453 TCDS_temp.push_back(TideCurrentDataSet[i]);
1455 TideCurrentDataSet.clear();
1456 for (
unsigned int i = 0; i < TCDS_temp.size(); i++) {
1457 wxString tide = TCDS_temp[i];
1458 wxFileName ft(tide);
1459 if (ft.FileExists()) TideCurrentDataSet.push_back(TCDS_temp[i]);
1466 g_compatOsVersion =
"";
1467 pConfig->SetPath(
"/Settings");
1468 pConfig->Write(
"CompatOS", g_compatOS);
1469 pConfig->Write(
"CompatOsVersion", g_compatOsVersion);
1473int OCPNPlatform::platformApplyPrivateSettingsString(wxString settings,
1474 ArrayOfCDI *pDirArray) {
1477 ret_val = androidApplySettingsString(settings, pDirArray);
1483void OCPNPlatform::applyExpertMode(
bool mode) {
1487 g_bBasicMenus = !mode;
1495static wxString ExpandPaths(wxString paths,
OCPNPlatform *platform);
1497int OCPNPlatform::DoFileSelectorDialog(wxWindow *parent, wxString *file_spec,
1498 wxString Title, wxString initDir,
1499 wxString suggestedName,
1500 wxString wildcard) {
1502 int result = wxID_CANCEL;
1506 wxString idir = initDir;
1507 if (initDir.StartsWith(
1511 result = androidFileChooser(&file, idir, Title, suggestedName, wildcard);
1512 if (file_spec) *file_spec = file;
1514 long flag = wxFD_DEFAULT_STYLE;
1515 if (suggestedName.Length()) {
1519 wxString mask = wildcard;
1520 if (wxNOT_FOUND != mask.Find(
"gpx")) mask.Prepend(
"GPX files (*.gpx)|");
1522 wxFileDialog *psaveDialog =
1523 new wxFileDialog(parent, Title, initDir, suggestedName, mask, flag);
1531 if (parent) parent->HideWithEffect(wxSHOW_EFFECT_BLEND);
1534 result = psaveDialog->ShowModal();
1537 if (parent) parent->ShowWithEffect(wxSHOW_EFFECT_BLEND);
1540 if (file_spec) *file_spec = psaveDialog->GetPath();
1548int OCPNPlatform::DoDirSelectorDialog(wxWindow *parent, wxString *file_spec,
1549 wxString Title, wxString initDir,
1552 int result = wxID_CANCEL;
1556 wxString idir = initDir;
1557 if (initDir.StartsWith(
1561 result = androidFileChooser(&dir, idir, Title,
"",
"",
true,
1563 if (file_spec) *file_spec = dir;
1565 wxDirDialog *dirSelector =
new wxDirDialog(
1566 parent, Title, initDir, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
1569 dirSelector->SetFont(*qFont);
1576 if (parent) parent->HideWithEffect(wxSHOW_EFFECT_BLEND);
1579 result = dirSelector->ShowModal();
1582 if (parent) parent->ShowWithEffect(wxSHOW_EFFECT_BLEND);
1585 if (result == wxID_CANCEL) {
1588 *file_spec = dirSelector->GetPath();
1598MyConfig *OCPNPlatform::GetConfigObject() {
1601 result =
new MyConfig(GetConfigFileName());
1610bool OCPNPlatform::hasInternalGPS(wxString profile) {
1612 bool t = androidDeviceHasGPS();
1626void OCPNPlatform::ShowBusySpinner() { AbstractPlatform::ShowBusySpinner(); }
1628void OCPNPlatform::HideBusySpinner() { AbstractPlatform::HideBusySpinner(); }
1630double OCPNPlatform::GetDisplayDensityFactor() {
1632 return getAndroidDisplayDensity();
1638long OCPNPlatform::GetDefaultToolbarOrientation() {
1640 return wxTB_VERTICAL;
1642 return wxTB_VERTICAL;
1646int OCPNPlatform::GetStatusBarFieldCount() {
1652 wxFont *templateFont = FontMgr::Get().
GetFont(_(
"StatusBar"), 0);
1653 dc.SetFont(*templateFont);
1656 dc.GetTextExtent(
"WWWWWW", &width, NULL, NULL, NULL, templateFont);
1657 double font_size_pix = (double)width / 6.0;
1661 double nChars = dispSize.x / font_size_pix;
1671 return kStatFieldCount;
1675double OCPNPlatform::getFontPointsperPixel() {
1676 double pt_per_pixel = 1.0;
1686 if (m_pt_per_pixel == 0) {
1691 12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, FALSE,
1692 wxString(
""), wxFONTENCODING_SYSTEM);
1696 dc.GetTextExtent(
"H", &width, &height, NULL, NULL, f);
1698 if (height > 0) m_pt_per_pixel = 12.0 / (double)height;
1700 if (m_pt_per_pixel > 0) pt_per_pixel = m_pt_per_pixel;
1703 return pt_per_pixel;
1708 return getAndroidDisplayDimensions();
1725 ret = GetAndroidDisplaySize();
1731double OCPNPlatform::GetDisplayAreaCM2() {
1736 ratio = (double)sz.x / (
double)sz.y;
1738 ratio = (double)sz.y / (
double)sz.x;
1740 double area = size1 * (size1 * ratio) / 100.;
1746 if (monitor < m_displaySizeMMOverride.size()) {
1747 m_displaySizeMMOverride[monitor] = sizeMM;
1751double OCPNPlatform::GetDisplayDPmm() {
1753 return getAndroidDPmm();
1760unsigned int OCPNPlatform::GetSelectRadiusPix() {
1761 return GetDisplayDPmm() *
1762 (g_btouch ? g_selection_radius_touch_mm : g_selection_radius_mm);
1765bool OCPNPlatform::GetFullscreen() {
1768 bret = androidGetFullscreen();
1776bool OCPNPlatform::SetFullscreen(
bool bFull) {
1779 bret = androidSetFullscreen(bFull);
1786void OCPNPlatform::PositionAISAlert(wxWindow *alert_window) {
1789 alert_window->SetSize(g_ais_alert_dialog_x, g_ais_alert_dialog_y,
1790 g_ais_alert_dialog_sx, g_ais_alert_dialog_sy);
1794 alert_window->Centre();
1800wxDirDialog *OCPNPlatform::AdjustDirDialogFont(wxWindow *container,
1802 wxDirDialog *ret_dlg = dlg;
1806 dlg->SetSize(container->GetSize());
1809 wxSize sds = dlg->GetSize();
1810 wxSize ss = container->GetSize();
1815 wxString msg = dlg->GetMessage();
1816 wxString default_dir = dlg->GetPath();
1820 ret_dlg =
new wxDirDialog(NULL, msg, default_dir,
1821 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
1824 wxFont *smallFont =
new wxFont(*dialogFont);
1825 smallFont->SetPointSize((smallFont->GetPointSize() / 2) +
1827 ret_dlg->SetFont(*smallFont);
1829 ret_dlg->SetSize(container->GetSize());
1837wxFileDialog *OCPNPlatform::AdjustFileDialogFont(wxWindow *container,
1838 wxFileDialog *dlg) {
1839 wxFileDialog *ret_dlg = dlg;
1843 dlg->SetSize(container->GetSize());
1846 wxSize sds = dlg->GetSize();
1847 wxSize ss = container->GetSize();
1852 wxString msg = dlg->GetMessage();
1853 wxString default_dir = dlg->GetDirectory();
1854 wxString default_file = dlg->GetFilename();
1855 wxString wildcard = dlg->GetWildcard();
1859 ret_dlg =
new wxFileDialog(NULL, msg, default_dir, default_file, wildcard,
1863 wxFont *smallFont =
new wxFont(*dialogFont);
1864 smallFont->SetPointSize((smallFont->GetPointSize() / 2) +
1866 ret_dlg->SetFont(*smallFont);
1868 ret_dlg->SetSize(container->GetSize());
1876double OCPNPlatform::GetToolbarScaleFactor(
int GUIScaleFactor) {
1884 wxSize style_tool_size(32, 32);
1886 if (g_StyleManager) {
1888 if (style) style_tool_size = style->GetToolSize();
1890 double tool_size = style_tool_size.x;
1896 double premult = 1.0;
1898 double target_size = 9.0;
1900 double basic_tool_size_mm = tool_size / GetDisplayDPmm();
1901 premult = target_size / basic_tool_size_mm;
1904 premult = wxMax(45 * getAndroidDisplayDensity(), 45) /
1910 double postmult = exp(GUIScaleFactor * (log(2.0) / 5.0));
1914 rv = premult * postmult;
1915 rv = wxMin(rv, getAndroidDisplayDensity() *
1919 double premult = 1.0;
1921 if (g_bresponsive) {
1924 wxSize style_tool_size = style->GetToolSize();
1925 double tool_size = style_tool_size.x;
1929 double target_size = 9.0;
1931 double basic_tool_size_mm = tool_size / GetDisplayDPmm();
1932 premult = target_size / basic_tool_size_mm;
1936 double postmult = exp(GUIScaleFactor * (0.693 / 5.0));
1938 rv = premult * postmult;
1939 rv = wxMin(rv, 3.0);
1940 rv = wxMax(rv, 0.5);
1949double OCPNPlatform::GetCompassScaleFactor(
int GUIScaleFactor) {
1956 if (g_bresponsive) {
1959 wxSize style_tool_size = style->GetToolSize();
1960 double compass_size = style_tool_size.x;
1966 double premult = wxMax(28 * getAndroidDisplayDensity(), 50) / compass_size;
1969 double postmult = exp(GUIScaleFactor * (log(2.0) / 5.0));
1972 rv = premult * postmult;
1973 rv = wxMin(rv, getAndroidDisplayDensity() *
1978 double premult = 1.0;
1980 if (g_bresponsive) {
1982 wxSize style_tool_size = style->GetToolSize();
1983 double compass_size = style_tool_size.x;
1986 double target_size = 6.0;
1988 double basic_tool_size_mm = compass_size / GetDisplayDPmm();
1989 premult = target_size / basic_tool_size_mm;
1992 double postmult = exp(GUIScaleFactor * (0.693 / 5.0));
1994 rv = premult * postmult;
1996 rv = wxMin(rv, 3.0);
1997 rv = wxMax(rv, 0.5);
1999#if defined(__WXOSX__) || defined(__WXGTK3__)
2002 if (top_frame::Get()) rv *= top_frame::Get()->GetContentScaleFactor();
2012float OCPNPlatform::GetChartScaleFactorExp(
float scale_linear) {
2013 double factor = 1.0;
2015 factor = exp(scale_linear * (log(3.0) / 5.0));
2020 factor = exp(scale_linear * (0.693 / 5.0));
2024 factor = wxMax(factor, .5);
2025 factor = wxMin(factor, 6.);
2030float OCPNPlatform::GetMarkScaleFactorExp(
float scale_linear) {
2031 if (scale_linear <= 0)
2032 return GetChartScaleFactorExp(scale_linear);
2034 return GetChartScaleFactorExp(scale_linear - 1);
2051bool OCPNPlatform::hasInternalBT(wxString profile) {
2053 bool t = androidDeviceHasBlueTooth();
2062bool OCPNPlatform::startBluetoothScan() {
2064 return androidStartBluetoothScan();
2071bool OCPNPlatform::stopBluetoothScan() {
2073 return androidStopBluetoothScan();
2080wxArrayString OCPNPlatform::getBluetoothScanResults() {
2081 wxArrayString ret_val;
2083 return androidGetBluetoothScanResults();
2086 ret_val.Add(
"line 1");
2087 ret_val.Add(
"line 2");
2088 ret_val.Add(
"line 3");
2098bool OCPNPlatform::AllowAlertDialog(
const wxString &class_name) {
2103 wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
2105 wxWindow *win = node->GetData();
2106 if (win->IsShown()) nTLW++;
2108 node = node->GetNext();
2122void OCPNPlatform::setChartTypeMaskSel(
int mask, wxString &indicator) {
2124 return androidSetChartTypeMaskSel(mask, indicator);
2129QString g_qtStyleSheet;
2131bool LoadQtStyleSheet(wxString &sheet_file) {
2132 if (wxFileExists(sheet_file)) {
2135 QString file(sheet_file.c_str());
2137 File.open(QFile::ReadOnly);
2138 g_qtStyleSheet = QLatin1String(File.readAll());
2148QString getQtStyleSheet() {
return g_qtStyleSheet; }
2152bool OCPNPlatform::isPlatformCapable(
int flag) {
2156 if (flag == PLATFORM_CAP_PLUGINS) {
2158 wxString tsdk(android_plat_spc.msdk);
2159 if (tsdk.ToLong(&platver)) {
2160 if (platver >= 11)
return true;
2162 }
else if (flag == PLATFORM_CAP_FASTPAN) {
2164 wxString tsdk(android_plat_spc.msdk);
2165 if (tsdk.ToLong(&platver)) {
2166 if (platver >= 14)
return true;
2174void OCPNPlatform::platformLaunchDefaultBrowser(wxString URL) {
2176 androidLaunchBrowser(URL);
2178 ::wxLaunchDefaultBrowser(URL);
2188EVT_PAINT(OCPNColourPickerCtrl::OnPaint)
2197 const wxColour &initial,
2199 const wxSize &size,
long style,
2200 const wxValidator &validator,
2201 const wxString &name) {
2202 Create(parent,
id, initial, pos, size, style, validator, name);
2205bool OCPNColourPickerCtrl::Create(wxWindow *parent, wxWindowID
id,
2206 const wxColour &col,
const wxPoint &pos,
2207 const wxSize &size,
long style,
2208 const wxValidator &validator,
2209 const wxString &name) {
2210 m_bitmap = wxBitmap(60, 13);
2213 if (!wxBitmapButton::Create(parent,
id, m_bitmap, pos, size,
2214 style | wxBU_AUTODRAW, validator, name)) {
2215 wxFAIL_MSG(
"OCPNColourPickerCtrl creation failed");
2220 Connect(GetId(), wxEVT_BUTTON,
2221 wxCommandEventHandler(OCPNColourPickerCtrl::OnButtonClick), NULL,
2231void OCPNColourPickerCtrl::InitColourData() {
2233 ms_data.SetChooseFull(
true);
2234 unsigned char grey = 0;
2235 for (
int i = 0; i < 16; i++, grey += 16)
2238 wxColour colour(grey, grey, grey);
2239 ms_data.SetCustomColour(i, colour);
2244void OCPNColourPickerCtrl::OnButtonClick(wxCommandEvent &WXUNUSED(ev)) {
2246 unsigned int cco = 0;
2249 cco |= m_colour.Red();
2251 cco |= m_colour.Green();
2253 cco |= m_colour.Blue();
2254 unsigned int cc = androidColorPicker(cco);
2257 unsigned char blue = (
unsigned char)cc % 256;
2258 unsigned char green = (
unsigned char)(cc >> 8) % 256;
2260 unsigned char red = (
unsigned char)(cc >> 16) % 256;
2261 cnew.Set(red, green, blue);
2267 ms_data.SetColour(m_colour);
2270 wxColourDialog dlg(
this, &ms_data);
2271 if (dlg.ShowModal() == wxID_OK) {
2272 ms_data = dlg.GetColourData();
2273 SetColour(ms_data.GetColour());
2278void OCPNColourPickerCtrl::UpdateColour() {
2280 SetBitmapLabel(wxBitmap());
2283 wxMemoryDC dc(m_bitmap);
2284 dc.SetPen(*wxTRANSPARENT_PEN);
2285 dc.SetBrush(wxBrush(m_colour));
2286 dc.DrawRectangle(0, 0, m_bitmap.GetWidth(), m_bitmap.GetHeight());
2288 dc.SelectObject(wxNullBitmap);
2289 SetBitmapLabel(m_bitmap);
2292void OCPNColourPickerCtrl::SetColour(wxColour &c) {
2294 m_bitmap = wxBitmap(GetSize().x - 20, GetSize().y - 20);
2298wxColour OCPNColourPickerCtrl::GetColour() {
return m_colour; }
2300wxSize OCPNColourPickerCtrl::DoGetBestSize()
const {
2301 wxSize sz(wxBitmapButton::DoGetBestSize());
2308 if (HasFlag(wxCLRP_SHOW_LABEL))
return sz;
2316void OCPNColourPickerCtrl::OnPaint(wxPaintEvent &event) {
2319 int offset_x = (GetSize().x - m_bitmap.GetWidth()) / 2;
2320 int offset_y = (GetSize().y - m_bitmap.GetHeight()) / 2;
2322 dc.SetPen(*wxTRANSPARENT_PEN);
2323 dc.SetBrush(wxBrush(m_colour));
2324 dc.DrawRectangle(offset_x, offset_y, m_bitmap.GetWidth(),
2325 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.
GUI constant definitions.
Enhanced logging interface on top of wx/log.h.
MacOS hardware probing functions.
void cache_clear()
Remove all files in cache:
MyConfig * pConfig
Global instance.
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.
Abstract gFrame/MyFrame interface.