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;
1205 g_bShowMenuBar =
false;
1208 pConfig->SetPath(
"/PlugIns/chartdldr_pi.dll");
1209 pConfig->Write(
"bEnabled",
true);
1211 pConfig->SetPath(
"/PlugIns/wmm_pi.dll");
1212 pConfig->Write(
"bEnabled",
true);
1214 pConfig->SetPath(
"/Settings/WMM");
1215 pConfig->Write(
"ShowIcon",
true);
1216 pConfig->Write(
"ShowLiveIcon",
true);
1223 pConfig->SetPath(
"/PlugIns/libchartdldr_pi.dylib");
1224 pConfig->Write(
"bEnabled",
true);
1226 pConfig->SetPath(
"/PlugIns/libwmm_pi.dylib");
1227 pConfig->Write(
"bEnabled",
true);
1229 pConfig->SetPath(
"/Settings/WMM");
1230 pConfig->Write(
"ShowIcon",
true);
1231 pConfig->Write(
"ShowLiveIcon",
true);
1238 pConfig->SetPath(
"/PlugIns/libchartdldr_pi.so");
1239 pConfig->Write(
"bEnabled",
true);
1241 pConfig->SetPath(
"/PlugIns/libwmm_pi.so");
1242 pConfig->Write(
"bEnabled",
true);
1244 pConfig->SetPath(
"/Settings/WMM");
1245 pConfig->Write(
"ShowIcon",
true);
1246 pConfig->Write(
"ShowLiveIcon",
true);
1254 g_GLOptions.m_bTextureCompression = 1;
1255 g_GLOptions.m_bTextureCompressionCaching = 1;
1258 qDebug() <<
"SetDefaultOptions";
1261 g_bresponsive =
true;
1262 g_default_font_size = 18;
1265 g_bShowStatusBar =
true;
1266 g_cm93_zoom_factor = 0;
1267 g_oz_vector_scale =
false;
1268 g_fog_overzoom =
false;
1271 g_bShowMuiZoomButtons =
true;
1273 g_GUIScaleFactor = 0;
1274 g_ChartNotRenderScaleFactor = 2.0;
1278 g_toolbarConfig =
"X.....XX.......XX.XXXXXXXXXXX";
1279 g_bPermanentMOBIcon =
false;
1281 wxString sGPS =
"2;3;;0;0;;0;1;0;0;;0;;1;0;0;0;0";
1284 new_params->bEnabled =
true;
1285 TheConnectionParams().push_back(new_params);
1292 pConfig->SetPath(
"/PlugIns/libchartdldr_pi.so");
1293 pConfig->Write(
"bEnabled",
true);
1295 pConfig->SetPath(
"/PlugIns/libwmm_pi.so");
1296 pConfig->Write(
"bEnabled",
true);
1298 pConfig->SetPath(
"/Settings/WMM");
1299 pConfig->Write(
"ShowIcon",
true);
1300 pConfig->Write(
"ShowLiveIcon",
true);
1302 pConfig->SetPath(
"/PlugIns/libgrib_pi.so");
1303 pConfig->Write(
"bEnabled",
true);
1305 pConfig->SetPath(
"/PlugIns/libdashboard_pi.so");
1306 pConfig->Write(
"bEnabled",
true);
1308 pConfig->SetPath(
"/PlugIns/GRIB");
1309 pConfig->Write(
"GRIBCtrlBarPosX", 100);
1310 pConfig->Write(
"GRIBCtrlBarPosY", 0);
1312 pConfig->SetPath(
"/Settings/GRIB");
1313 pConfig->Write(
"CursorDataShown", 0);
1317 pConfig->SetPath(
"/PlugIns/liboesenc_pi.so");
1318 pConfig->Write(
"bEnabled",
true);
1320 pConfig->SetPath(
"/Settings/QTFonts");
1323 wxString str =
"en_US-b25a3899";
1324 wxString pval =
"StatusBar:Roboto,26,-1,5,75,0,0,0,0,0:rgb(0, 0, 0)";
1329 str =
"en_US-9c3b3a0d";
1330 pval =
"DialogStatusBar:Roboto,18,-1,5,50,0,0,0,0,0:rgb(0, 0, 0)";
1335 pConfig->SetPath(
"/Settings/Others");
1336 pConfig->Write(
"TrackLineColour",
"#C545C3");
1337 g_colourTrackLineColour.Set(197, 69, 195);
1339 qDebug() <<
"SetDefaultOptions.Config";
1350void OCPNPlatform::SetUpgradeOptions(wxString vNew, wxString vOld) {
1353 qDebug() <<
"Upgrade check"
1354 <<
"from: " << vOld.mb_str() <<
" to: " << vNew.mb_str();
1356 if (androidGetVersionCode() > g_AndroidVersionCode) {
1357 qDebug() <<
"Upgrade detected"
1358 <<
"from VC: " << g_AndroidVersionCode
1359 <<
" to VC: " << androidGetVersionCode();
1363 pConfig->SetPath(
"/Settings/GlobalState");
1364 pConfig->Write(
"bShowS57Text",
true);
1367 g_ChartNotRenderScaleFactor = 2.0;
1368 g_n_ownship_min_mm = 8;
1369 g_toolbarConfig =
"X.....XX.......XX.XXXXXXXXXXX";
1372 pConfig->DeleteGroup(
"/Settings/QTFonts");
1373 g_default_font_size = 20;
1376 FontMgr::Get().Shutdown();
1379 g_bShowMuiZoomButtons =
true;
1383 pInit_Chart_Dir->Clear();
1387 pConfig->SetPath(
"/Settings/WMM");
1388 pConfig->Write(
"ShowIcon",
true);
1389 pConfig->Write(
"ShowLiveIcon",
true);
1391 pConfig->SetPath(
"/Canvas/CanvasConfig1");
1392 pConfig->Write(
"canvasENCShowVisibleSectorLights", 0);
1402 AndroidRemoveSystemFile(
1403 "/data/user/0/org.opencpn.opencpn/manPlug/libchartscale_pi.so");
1407 g_colourTrackLineColour.Set(197, 69, 195);
1411 if (!vOld.IsSameAs(vNew)) {
1417 wxChar sep = wxFileName::GetPathSeparator();
1418 if (UserIconPath.Last() != sep) UserIconPath.Append(sep);
1419 UserIconPath.Append(
"UserIcons");
1421 if (!::wxDirExists(UserIconPath)) {
1422 ::wxMkdir(UserIconPath);
1427 if (LayersPath.Last() != sep) LayersPath.Append(sep);
1428 LayersPath.Append(
"layers");
1430 if (!::wxDirExists(LayersPath)) {
1431 ::wxMkdir(LayersPath);
1437 g_CmdSoundString = wxString(OCPN_SOUND_CMD);
1438 pConfig->SetPath(
"/Settings");
1439 pConfig->Write(
"CmdSoundString", g_CmdSoundString);
1443 g_bAIS_GCPA_Alert_Audio =
true;
1444 g_bAIS_SART_Alert_Audio =
true;
1445 g_bAIS_DSC_Alert_Audio =
true;
1448 g_maintoolbar_x = -1;
1452 std::vector<std::string> TCDS_temp;
1453 for (
unsigned int i = 0; i < TideCurrentDataSet.size(); i++)
1454 TCDS_temp.push_back(TideCurrentDataSet[i]);
1456 TideCurrentDataSet.clear();
1457 for (
unsigned int i = 0; i < TCDS_temp.size(); i++) {
1458 wxString tide = TCDS_temp[i];
1459 wxFileName ft(tide);
1460 if (ft.FileExists()) TideCurrentDataSet.push_back(TCDS_temp[i]);
1467 g_compatOsVersion =
"";
1468 pConfig->SetPath(
"/Settings");
1469 pConfig->Write(
"CompatOS", g_compatOS);
1470 pConfig->Write(
"CompatOsVersion", g_compatOsVersion);
1474int OCPNPlatform::platformApplyPrivateSettingsString(wxString settings,
1475 ArrayOfCDI *pDirArray) {
1478 ret_val = androidApplySettingsString(settings, pDirArray);
1484void OCPNPlatform::applyExpertMode(
bool mode) {
1488 g_bBasicMenus = !mode;
1496static wxString ExpandPaths(wxString paths,
OCPNPlatform *platform);
1498int OCPNPlatform::DoFileSelectorDialog(wxWindow *parent, wxString *file_spec,
1499 wxString Title, wxString initDir,
1500 wxString suggestedName,
1501 wxString wildcard) {
1503 int result = wxID_CANCEL;
1507 wxString idir = initDir;
1508 if (initDir.StartsWith(
1512 result = androidFileChooser(&file, idir, Title, suggestedName, wildcard);
1513 if (file_spec) *file_spec = file;
1515 long flag = wxFD_DEFAULT_STYLE;
1516 if (suggestedName.Length()) {
1520 wxString mask = wildcard;
1521 if (wxNOT_FOUND != mask.Find(
"gpx")) mask.Prepend(
"GPX files (*.gpx)|");
1523 wxFileDialog *psaveDialog =
1524 new wxFileDialog(parent, Title, initDir, suggestedName, mask, flag);
1532 if (parent) parent->HideWithEffect(wxSHOW_EFFECT_BLEND);
1535 result = psaveDialog->ShowModal();
1538 if (parent) parent->ShowWithEffect(wxSHOW_EFFECT_BLEND);
1541 if (file_spec) *file_spec = psaveDialog->GetPath();
1549int OCPNPlatform::DoDirSelectorDialog(wxWindow *parent, wxString *file_spec,
1550 wxString Title, wxString initDir,
1553 int result = wxID_CANCEL;
1557 wxString idir = initDir;
1558 if (initDir.StartsWith(
1562 result = androidFileChooser(&dir, idir, Title,
"",
"",
true,
1564 if (file_spec) *file_spec = dir;
1566 wxDirDialog *dirSelector =
new wxDirDialog(
1567 parent, Title, initDir, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
1570 dirSelector->SetFont(*qFont);
1577 if (parent) parent->HideWithEffect(wxSHOW_EFFECT_BLEND);
1580 result = dirSelector->ShowModal();
1583 if (parent) parent->ShowWithEffect(wxSHOW_EFFECT_BLEND);
1586 if (result == wxID_CANCEL) {
1589 *file_spec = dirSelector->GetPath();
1599MyConfig *OCPNPlatform::GetConfigObject() {
1602 result =
new MyConfig(GetConfigFileName());
1611bool OCPNPlatform::hasInternalGPS(wxString profile) {
1613 bool t = androidDeviceHasGPS();
1627void OCPNPlatform::ShowBusySpinner() { AbstractPlatform::ShowBusySpinner(); }
1629void OCPNPlatform::HideBusySpinner() { AbstractPlatform::HideBusySpinner(); }
1631double OCPNPlatform::GetDisplayDensityFactor() {
1633 return getAndroidDisplayDensity();
1639long OCPNPlatform::GetDefaultToolbarOrientation() {
1641 return wxTB_VERTICAL;
1643 return wxTB_VERTICAL;
1647int OCPNPlatform::GetStatusBarFieldCount() {
1653 wxFont *templateFont = FontMgr::Get().
GetFont(_(
"StatusBar"), 0);
1654 dc.SetFont(*templateFont);
1657 dc.GetTextExtent(
"WWWWWW", &width, NULL, NULL, NULL, templateFont);
1658 double font_size_pix = (double)width / 6.0;
1662 double nChars = dispSize.x / font_size_pix;
1672 return kStatFieldCount;
1676double OCPNPlatform::getFontPointsperPixel() {
1677 double pt_per_pixel = 1.0;
1687 if (m_pt_per_pixel == 0) {
1692 12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, FALSE,
1693 wxString(
""), wxFONTENCODING_SYSTEM);
1697 dc.GetTextExtent(
"H", &width, &height, NULL, NULL, f);
1699 if (height > 0) m_pt_per_pixel = 12.0 / (double)height;
1701 if (m_pt_per_pixel > 0) pt_per_pixel = m_pt_per_pixel;
1704 return pt_per_pixel;
1709 return getAndroidDisplayDimensions();
1726 ret = GetAndroidDisplaySize();
1732double OCPNPlatform::GetDisplayAreaCM2() {
1737 ratio = (double)sz.x / (
double)sz.y;
1739 ratio = (double)sz.y / (
double)sz.x;
1741 double area = size1 * (size1 * ratio) / 100.;
1747 if (monitor < m_displaySizeMMOverride.size()) {
1748 m_displaySizeMMOverride[monitor] = sizeMM;
1752double OCPNPlatform::GetDisplayDPmm() {
1754 return getAndroidDPmm();
1761unsigned int OCPNPlatform::GetSelectRadiusPix() {
1762 return GetDisplayDPmm() *
1763 (g_btouch ? g_selection_radius_touch_mm : g_selection_radius_mm);
1766bool OCPNPlatform::GetFullscreen() {
1769 bret = androidGetFullscreen();
1777bool OCPNPlatform::SetFullscreen(
bool bFull) {
1780 bret = androidSetFullscreen(bFull);
1787void OCPNPlatform::PositionAISAlert(wxWindow *alert_window) {
1790 alert_window->SetSize(g_ais_alert_dialog_x, g_ais_alert_dialog_y,
1791 g_ais_alert_dialog_sx, g_ais_alert_dialog_sy);
1795 alert_window->Centre();
1801wxDirDialog *OCPNPlatform::AdjustDirDialogFont(wxWindow *container,
1803 wxDirDialog *ret_dlg = dlg;
1807 dlg->SetSize(container->GetSize());
1810 wxSize sds = dlg->GetSize();
1811 wxSize ss = container->GetSize();
1816 wxString msg = dlg->GetMessage();
1817 wxString default_dir = dlg->GetPath();
1821 ret_dlg =
new wxDirDialog(NULL, msg, default_dir,
1822 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
1825 wxFont *smallFont =
new wxFont(*dialogFont);
1826 smallFont->SetPointSize((smallFont->GetPointSize() / 2) +
1828 ret_dlg->SetFont(*smallFont);
1830 ret_dlg->SetSize(container->GetSize());
1838wxFileDialog *OCPNPlatform::AdjustFileDialogFont(wxWindow *container,
1839 wxFileDialog *dlg) {
1840 wxFileDialog *ret_dlg = dlg;
1844 dlg->SetSize(container->GetSize());
1847 wxSize sds = dlg->GetSize();
1848 wxSize ss = container->GetSize();
1853 wxString msg = dlg->GetMessage();
1854 wxString default_dir = dlg->GetDirectory();
1855 wxString default_file = dlg->GetFilename();
1856 wxString wildcard = dlg->GetWildcard();
1860 ret_dlg =
new wxFileDialog(NULL, msg, default_dir, default_file, wildcard,
1864 wxFont *smallFont =
new wxFont(*dialogFont);
1865 smallFont->SetPointSize((smallFont->GetPointSize() / 2) +
1867 ret_dlg->SetFont(*smallFont);
1869 ret_dlg->SetSize(container->GetSize());
1877double OCPNPlatform::GetToolbarScaleFactor(
int GUIScaleFactor) {
1885 wxSize style_tool_size(32, 32);
1887 if (g_StyleManager) {
1889 if (style) style_tool_size = style->GetToolSize();
1891 double tool_size = style_tool_size.x;
1897 double premult = 1.0;
1899 double target_size = 9.0;
1901 double basic_tool_size_mm = tool_size / GetDisplayDPmm();
1902 premult = target_size / basic_tool_size_mm;
1905 premult = wxMax(45 * getAndroidDisplayDensity(), 45) /
1911 double postmult = exp(GUIScaleFactor * (log(2.0) / 5.0));
1915 rv = premult * postmult;
1916 rv = wxMin(rv, getAndroidDisplayDensity() *
1920 double premult = 1.0;
1922 if (g_bresponsive) {
1925 wxSize style_tool_size = style->GetToolSize();
1926 double tool_size = style_tool_size.x;
1930 double target_size = 9.0;
1932 double basic_tool_size_mm = tool_size / GetDisplayDPmm();
1933 premult = target_size / basic_tool_size_mm;
1937 double postmult = exp(GUIScaleFactor * (0.693 / 5.0));
1939 rv = premult * postmult;
1940 rv = wxMin(rv, 3.0);
1941 rv = wxMax(rv, 0.5);
1950double OCPNPlatform::GetCompassScaleFactor(
int GUIScaleFactor) {
1957 if (g_bresponsive) {
1960 wxSize style_tool_size = style->GetToolSize();
1961 double compass_size = style_tool_size.x;
1967 double premult = wxMax(28 * getAndroidDisplayDensity(), 50) / compass_size;
1970 double postmult = exp(GUIScaleFactor * (log(2.0) / 5.0));
1973 rv = premult * postmult;
1974 rv = wxMin(rv, getAndroidDisplayDensity() *
1979 double premult = 1.0;
1981 if (g_bresponsive) {
1983 wxSize style_tool_size = style->GetToolSize();
1984 double compass_size = style_tool_size.x;
1987 double target_size = 6.0;
1989 double basic_tool_size_mm = compass_size / GetDisplayDPmm();
1990 premult = target_size / basic_tool_size_mm;
1993 double postmult = exp(GUIScaleFactor * (0.693 / 5.0));
1995 rv = premult * postmult;
1997 rv = wxMin(rv, 3.0);
1998 rv = wxMax(rv, 0.5);
2000#if defined(__WXOSX__) || defined(__WXGTK3__)
2003 if (top_frame::Get()) rv *= top_frame::Get()->GetContentScaleFactor();
2013float OCPNPlatform::GetChartScaleFactorExp(
float scale_linear) {
2014 double factor = 1.0;
2016 factor = exp(scale_linear * (log(3.0) / 5.0));
2021 factor = exp(scale_linear * (0.693 / 5.0));
2025 factor = wxMax(factor, .5);
2026 factor = wxMin(factor, 6.);
2031float OCPNPlatform::GetMarkScaleFactorExp(
float scale_linear) {
2032 if (scale_linear <= 0)
2033 return GetChartScaleFactorExp(scale_linear);
2035 return GetChartScaleFactorExp(scale_linear - 1);
2052bool OCPNPlatform::hasInternalBT(wxString profile) {
2054 bool t = androidDeviceHasBlueTooth();
2063bool OCPNPlatform::startBluetoothScan() {
2065 return androidStartBluetoothScan();
2072bool OCPNPlatform::stopBluetoothScan() {
2074 return androidStopBluetoothScan();
2081wxArrayString OCPNPlatform::getBluetoothScanResults() {
2082 wxArrayString ret_val;
2084 return androidGetBluetoothScanResults();
2087 ret_val.Add(
"line 1");
2088 ret_val.Add(
"line 2");
2089 ret_val.Add(
"line 3");
2099bool OCPNPlatform::AllowAlertDialog(
const wxString &class_name) {
2104 wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
2106 wxWindow *win = node->GetData();
2107 if (win->IsShown()) nTLW++;
2109 node = node->GetNext();
2123void OCPNPlatform::setChartTypeMaskSel(
int mask, wxString &indicator) {
2125 return androidSetChartTypeMaskSel(mask, indicator);
2130QString g_qtStyleSheet;
2132bool LoadQtStyleSheet(wxString &sheet_file) {
2133 if (wxFileExists(sheet_file)) {
2136 QString file(sheet_file.c_str());
2138 File.open(QFile::ReadOnly);
2139 g_qtStyleSheet = QLatin1String(File.readAll());
2149QString getQtStyleSheet() {
return g_qtStyleSheet; }
2153bool OCPNPlatform::isPlatformCapable(
int flag) {
2157 if (flag == PLATFORM_CAP_PLUGINS) {
2159 wxString tsdk(android_plat_spc.msdk);
2160 if (tsdk.ToLong(&platver)) {
2161 if (platver >= 11)
return true;
2163 }
else if (flag == PLATFORM_CAP_FASTPAN) {
2165 wxString tsdk(android_plat_spc.msdk);
2166 if (tsdk.ToLong(&platver)) {
2167 if (platver >= 14)
return true;
2175void OCPNPlatform::platformLaunchDefaultBrowser(wxString URL) {
2177 androidLaunchBrowser(URL);
2179 ::wxLaunchDefaultBrowser(URL);
2189EVT_PAINT(OCPNColourPickerCtrl::OnPaint)
2198 const wxColour &initial,
2200 const wxSize &size,
long style,
2201 const wxValidator &validator,
2202 const wxString &name) {
2203 Create(parent,
id, initial, pos, size, style, validator, name);
2206bool OCPNColourPickerCtrl::Create(wxWindow *parent, wxWindowID
id,
2207 const wxColour &col,
const wxPoint &pos,
2208 const wxSize &size,
long style,
2209 const wxValidator &validator,
2210 const wxString &name) {
2211 m_bitmap = wxBitmap(60, 13);
2214 if (!wxBitmapButton::Create(parent,
id, m_bitmap, pos, size,
2215 style | wxBU_AUTODRAW, validator, name)) {
2216 wxFAIL_MSG(
"OCPNColourPickerCtrl creation failed");
2221 Connect(GetId(), wxEVT_BUTTON,
2222 wxCommandEventHandler(OCPNColourPickerCtrl::OnButtonClick), NULL,
2232void OCPNColourPickerCtrl::InitColourData() {
2234 ms_data.SetChooseFull(
true);
2235 unsigned char grey = 0;
2236 for (
int i = 0; i < 16; i++, grey += 16)
2239 wxColour colour(grey, grey, grey);
2240 ms_data.SetCustomColour(i, colour);
2245void OCPNColourPickerCtrl::OnButtonClick(wxCommandEvent &WXUNUSED(ev)) {
2247 unsigned int cco = 0;
2250 cco |= m_colour.Red();
2252 cco |= m_colour.Green();
2254 cco |= m_colour.Blue();
2255 unsigned int cc = androidColorPicker(cco);
2258 unsigned char blue = (
unsigned char)cc % 256;
2259 unsigned char green = (
unsigned char)(cc >> 8) % 256;
2261 unsigned char red = (
unsigned char)(cc >> 16) % 256;
2262 cnew.Set(red, green, blue);
2268 ms_data.SetColour(m_colour);
2271 wxColourDialog dlg(
this, &ms_data);
2272 if (dlg.ShowModal() == wxID_OK) {
2273 ms_data = dlg.GetColourData();
2274 SetColour(ms_data.GetColour());
2279void OCPNColourPickerCtrl::UpdateColour() {
2281 SetBitmapLabel(wxBitmap());
2284 wxMemoryDC dc(m_bitmap);
2285 dc.SetPen(*wxTRANSPARENT_PEN);
2286 dc.SetBrush(wxBrush(m_colour));
2287 dc.DrawRectangle(0, 0, m_bitmap.GetWidth(), m_bitmap.GetHeight());
2289 dc.SelectObject(wxNullBitmap);
2290 SetBitmapLabel(m_bitmap);
2293void OCPNColourPickerCtrl::SetColour(wxColour &c) {
2295 m_bitmap = wxBitmap(GetSize().x - 20, GetSize().y - 20);
2299wxColour OCPNColourPickerCtrl::GetColour() {
return m_colour; }
2301wxSize OCPNColourPickerCtrl::DoGetBestSize()
const {
2302 wxSize sz(wxBitmapButton::DoGetBestSize());
2309 if (HasFlag(wxCLRP_SHOW_LABEL))
return sz;
2317void OCPNColourPickerCtrl::OnPaint(wxPaintEvent &event) {
2320 int offset_x = (GetSize().x - m_bitmap.GetWidth()) / 2;
2321 int offset_y = (GetSize().y - m_bitmap.GetHeight()) / 2;
2323 dc.SetPen(*wxTRANSPARENT_PEN);
2324 dc.SetBrush(wxBrush(m_colour));
2325 dc.DrawRectangle(offset_x, offset_y, m_bitmap.GetWidth(),
2326 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.