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();
516 g_toolbar_scalefactor = GetToolbarScaleFactor(g_GUIScaleFactor);
518 if (!configdir.DirExists()) {
519 if (!configdir.Mkdir()) {
520 auto msg = std::string(
"Cannot create config directory: ");
521 wxLogWarning(msg + configdir.GetFullPath());
528void OCPNPlatform::Initialize_3() {
529 bool bcapable = IsGLCapable();
535 bool bAndroid =
false;
544 g_bdisable_opengl =
false;
552 if ((g_bFirstRun || g_bUpgradeInProcess || bAndroid) && bcapable) {
556 g_GLOptions.m_bUseAcceleratedPanning =
true;
557 g_GLOptions.m_bTextureCompression =
true;
558 g_GLOptions.m_bTextureCompressionCaching =
true;
560 g_GLOptions.m_iTextureDimension = 512;
561 g_GLOptions.m_iTextureMemorySize = 64;
563 g_GLOptions.m_GLPolygonSmoothing =
true;
564 g_GLOptions.m_GLLineSmoothing =
true;
574 if (g_bFirstRun || g_bUpgradeInProcess) {
579 g_FlushNavobjChangesTimeout = 300;
583void OCPNPlatform::Initialize_4() {
585 if (
pSelect)
pSelect->SetSelectPixelRadius(wxMax(25, 6.0 * getAndroidDPmm()));
587 pSelectTC->SetSelectPixelRadius(wxMax(25, 6.0 * getAndroidDPmm()));
589 pSelectAIS->SetSelectPixelRadius(wxMax(25, 6.0 * getAndroidDPmm()));
596 options_lastPage = 1;
600void OCPNPlatform::OnExit_1() {}
602void OCPNPlatform::OnExit_2() {
603#ifdef OCPN_USE_CRASHREPORT
613bool HasGLExt(
wxJSONValue &glinfo,
const std::string ext) {
614 if (!glinfo.
HasMember(
"GL_EXTENSIONS")) {
617 for (
int i = 0; i < glinfo[
"GL_EXTENSIONS"].
Size(); i++) {
618 if (glinfo[
"GL_EXTENSIONS"][i].AsString() == ext) {
625bool OCPNPlatform::BuildGLCaps(
void *pbuf) {
627 fs::path ep(GetExePath().ToStdString());
629 std::string gl_util_exe =
"opencpn-glutil";
631 std::string gl_util_exe =
"opencpn-glutil.exe";
633 fs::path gl_util_path = ep.parent_path().append(gl_util_exe);
635 if (!fs::exists(gl_util_path)) {
637 ep.parent_path().parent_path().append(
"libexec").append(gl_util_exe);
639 if (!fs::exists(gl_util_path)) {
642 wxLogMessage(
"OpenGL test utility not found at %s.", gl_util_path.c_str());
647 .append(
"gl_caps.json")
650 wxString cmd = wxString::Format(
"\"%s\" opengl-info \"%s\"",
651 gl_util_path.c_str(), gl_json.c_str());
653 wxLogMessage(
"Starting OpenGL test utility: %s", cmd);
655 wxArrayString output;
656 if (
long res = wxExecute(cmd, output); res != 0) {
657 wxLogMessage(
"OpenGL test utility failed with exit code %d", res);
658 for (
const auto &l : output) {
664 wxFileInputStream fis(gl_json);
667 reader.
Parse(fis, &root);
669 wxLogMessage(
"Failed to parse JSON output from OpenGL test utility.");
670 for (
const auto &l : reader.GetErrors()) {
679 pcaps->Renderer = root[
"GL_RENDERER"].
AsString();
681 wxLogMessage(
"GL_RENDERER not found.");
685 pcaps->Version = root[
"GL_VERSION"].
AsString();
687 wxLogMessage(
"GL_VERSION not found.");
690 if (root.
HasMember(
"GL_SHADING_LANGUAGE_VERSION")) {
691 pcaps->GLSL_Version = root[
"GL_SHADING_LANGUAGE_VERSION"].
AsString();
693 wxLogMessage(
"GL_SHADING_LANGUAGE_VERSION not found.");
697 if (!root[
"GL_USABLE"].AsBool()) {
698 wxLogMessage(
"OpenGL test utility reports that OpenGL is not usable.");
702 wxLogMessage(
"GL_USABLE not found.");
705 pcaps->dGLSL_Version = 0;
706 pcaps->dGLSL_Version = ::atof(pcaps->GLSL_Version.c_str());
707 if (pcaps->dGLSL_Version < 1.2) {
709 msg.Printf(
"GLCaps Probe: OpenGL-> GLSL Version reported: ");
710 msg += wxString(pcaps->GLSL_Version.c_str());
711 msg +=
"\n OpenGL disabled due to insufficient OpenGL capabilities";
713 pcaps->bCanDoGLSL =
false;
716 pcaps->bCanDoGLSL =
true;
717 if (HasGLExt(root,
"GL_ARB_texture_non_power_of_two")) {
718 pcaps->TextureRectangleFormat = GL_TEXTURE_2D;
719 }
else if (HasGLExt(root,
"GL_OES_texture_npot")) {
720 pcaps->TextureRectangleFormat = GL_TEXTURE_2D;
721 }
else if (HasGLExt(root,
"GL_ARB_texture_rectangle")) {
722 pcaps->TextureRectangleFormat = GL_TEXTURE_RECTANGLE_ARB;
725 pcaps->bOldIntel =
false;
727 pcaps->bCanDoFBO = HasGLExt(root,
"GL_EXT_framebuffer_object");
728 if (!pcaps->TextureRectangleFormat) {
729 pcaps->bCanDoFBO =
false;
732 pcaps->bCanDoVBO = HasGLExt(
733 root,
"GL_ARB_vertex_buffer_object");
736 top_frame::Get()->Show();
741 top_frame::Get()->Show();
745 wxGLContext *pctx =
new wxGLContext(tcanvas);
746 tcanvas->SetCurrent(*pctx);
750 char *str = (
char *)glGetString(GL_RENDERER);
752 wxLogMessage(
"GL_RENDERER not found.");
757 pcaps->Renderer = std::string(str);
759 char *stv = (
char *)glGetString(GL_VERSION);
761 wxLogMessage(
"GL_VERSION not found");
766 pcaps->Version = std::string(stv);
768 char *stsv = (
char *)glGetString(GL_SHADING_LANGUAGE_VERSION);
770 wxLogMessage(
"GL_SHADING_LANGUAGE_VERSION not found");
775 pcaps->GLSL_Version = std::string(stsv);
777 pcaps->dGLSL_Version = 0;
778 pcaps->dGLSL_Version = ::atof(pcaps->GLSL_Version.c_str());
780 if (pcaps->dGLSL_Version < 1.2) {
782 msg.Printf(
"GLCaps Probe: OpenGL-> GLSL Version reported: ");
783 msg += wxString(pcaps->GLSL_Version.c_str());
784 msg +=
"\n OpenGL disabled due to insufficient OpenGL capabilities";
786 pcaps->bCanDoGLSL =
false;
792 pcaps->bCanDoGLSL =
true;
794 if (QueryExtension(
"GL_ARB_texture_non_power_of_two"))
795 pcaps->TextureRectangleFormat = GL_TEXTURE_2D;
796 else if (QueryExtension(
"GL_OES_texture_npot"))
797 pcaps->TextureRectangleFormat = GL_TEXTURE_2D;
798 else if (QueryExtension(
"GL_ARB_texture_rectangle"))
799 pcaps->TextureRectangleFormat = GL_TEXTURE_RECTANGLE_ARB;
801 pcaps->bOldIntel =
false;
804 pcaps->bCanDoVBO =
true;
806#if defined(__WXMSW__) || defined(__WXOSX__)
807 if (pcaps->bOldIntel) pcaps->bCanDoVBO =
false;
811 pcaps->bCanDoVBO =
false;
815 pcaps->bCanDoFBO =
true;
819 if (!pcaps->TextureRectangleFormat) pcaps->bCanDoFBO =
false;
822 if (!QueryExtension(
"GL_EXT_framebuffer_object")) pcaps->bCanDoFBO =
false;
832bool OCPNPlatform::IsGLCapable() {
841 if (g_bdisable_opengl)
return false;
843 wxLogMessage(
"Starting OpenGL test...");
844 wxLog::FlushActive();
848 bool bcaps = BuildGLCaps(GL_Caps);
850 wxLogMessage(
"OpenGL test complete.");
852 wxLogMessage(
"BuildGLCaps fails.");
853 wxLog::FlushActive();
861 if (!GL_Caps->bCanDoGLSL) {
867 if (!GL_Caps->bCanDoFBO) {
872 wxLogMessage(
"OpenGL determined CAPABLE.");
873 wxLog::FlushActive();
875 g_bdisable_opengl =
false;
888void OCPNPlatform::SetLocaleSearchPrefixes() {
891#if defined(__WINDOWS__)
894 wxString locale_location = GetSharedDataDir();
895 locale_location +=
"share\\locale";
896 wxLocale::AddCatalogLookupPathPrefix(locale_location);
897 wxString imsg =
"Adding catalog lookup path: ";
898 imsg += locale_location;
903 usrShare.RemoveLastDir();
904 locale_location = usrShare.GetFullPath() + (
"share\\locale");
905 wxLocale::AddCatalogLookupPathPrefix(locale_location);
906 imsg =
"Adding catalog lookup path: ";
907 imsg += locale_location;
910#elif defined(__ANDROID__)
912 wxString locale_location = GetSharedDataDir() +
"locale";
913 wxLocale::AddCatalogLookupPathPrefix(locale_location);
915#elif defined(__UNIX__) && !defined(__WINE__)
920 wxString locale_location;
921 if (!wxGetEnv(
"OPENCPN_PREFIX", &locale_location)) {
922 locale_location =
"/usr/local";
930 location.AssignDir(locale_location);
931 location.AppendDir(
"share");
932 location.SetName(
"locale");
933 locale_location = location.GetFullPath();
934 wxLocale::AddCatalogLookupPathPrefix(locale_location);
938 wxString managed_locale_location(dir +
"/locale");
939 wxLocale::AddCatalogLookupPathPrefix(managed_locale_location);
945 "/Library/Application Support/OpenCPN/Contents/Resources";
946 wxString Mac_managed_locale_location(macDir);
947 wxLocale::AddCatalogLookupPathPrefix(Mac_managed_locale_location);
953wxString OCPNPlatform::GetDefaultSystemLocale() {
954 wxLogMessage(
"Getting DefaultSystemLocale...");
956 wxString retval =
"en_US";
960 const wxLanguageInfo *languageInfo =
961 wxLocale::GetLanguageInfo(wxLANGUAGE_DEFAULT);
962 if (languageInfo) retval = languageInfo->CanonicalName;
964#if defined(__WXMSW__)
965 LANGID lang_id = GetUserDefaultUILanguage();
968 const wxLanguageInfo *languageInfoW = 0;
969 if (0 != GetLocaleInfo(MAKELCID(lang_id, SORT_DEFAULT), LOCALE_SENGLANGUAGE,
971 wxString lstring = wxString(lngcp);
973 languageInfoW = wxLocale::FindLanguageInfo(lngcp);
975 wxLogMessage(
"Found LanguageInfo for: " + lstring);
977 wxLogMessage(
"Could not find LanguageInfo for: " + lstring);
979 wxLogMessage(
"Could not get LocaleInfo, using wxLANGUAGE_DEFAULT");
980 languageInfoW = wxLocale::GetLanguageInfo(wxLANGUAGE_DEFAULT);
983 if (languageInfoW) retval = languageInfoW->CanonicalName;
986#if defined(__ANDROID__)
987 retval = androidGetAndroidSystemLocale();
995#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
996wxString OCPNPlatform::GetAdjustedAppLocale() {
997 wxString adjLocale = g_locale;
1002#if defined(__WXMSW__)
1003 if (g_bFirstRun || wxIsEmpty(adjLocale)) {
1004 wxRegKey RegKey(wxString(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\OpenCPN"));
1005 if (RegKey.Exists()) {
1007 "Retrieving initial language selection from Windows Registry");
1008 RegKey.QueryValue(wxString(
"InstallerLanguage"), adjLocale);
1011 if (wxIsEmpty(adjLocale)) {
1012 if (g_localeOverride.Length())
1013 adjLocale = g_localeOverride;
1015 adjLocale = GetDefaultSystemLocale();
1018#if defined(__ANDROID__)
1019 if (g_localeOverride.Length())
1020 adjLocale = g_localeOverride;
1022 adjLocale = GetDefaultSystemLocale();
1028wxString OCPNPlatform::ChangeLocale(wxString &newLocaleID,
1029 wxLocale *presentLocale,
1030 wxLocale **newLocale) {
1031 wxString return_val;
1033 wxString imsg =
"ChangeLocale: Language load for: ";
1034 imsg += newLocaleID;
1038 delete (wxLocale *)presentLocale;
1040 wxLocale *locale =
new wxLocale;
1041 if (isFlatpacked()) {
1042 std::string path(getenv(
"HOME"));
1043 path +=
"/.var/app/org.opencpn.OpenCPN/data/locale";
1044 locale->AddCatalogLookupPathPrefix(path);
1045 wxLogMessage(
"Using flatpak locales at %s", path.c_str());
1047 wxString loc_lang_canonical;
1049 const wxLanguageInfo *pli = wxLocale::FindLanguageInfo(newLocaleID);
1050 bool b_initok =
false;
1053 locale->Init(pli->Language, 1);
1057 if (!locale->IsOk()) {
1058 wxString imsg =
"ChangeLocale: could not initialize: ";
1059 imsg += newLocaleID;
1063 locale =
new wxLocale;
1064 locale->Init(pli->Language, 0);
1066 loc_lang_canonical = pli->CanonicalName;
1068 b_initok = locale->IsOk();
1075 wxString imsg =
"ChangeLocale: Fall back to en_US";
1079 locale =
new wxLocale;
1080 locale->Init(wxLANGUAGE_ENGLISH_US, 0);
1081 loc_lang_canonical =
1082 wxLocale::GetLanguageInfo(wxLANGUAGE_ENGLISH_US)->CanonicalName;
1086 wxString imsg =
"ChangeLocale: Locale Init OK for: ";
1087 imsg += loc_lang_canonical;
1101 wxString emsg =
"ERROR Loading translation catalog for: ";
1105 wxString imsg =
"Loaded translation catalog for: ";
1112 wxLogMessage(
"Loading catalog for opencpn core.");
1113 locale->AddCatalog(
"opencpn");
1115 return_val = locale->GetCanonicalName();
1118 if (return_val != GetDefaultSystemLocale())
1119 g_localeOverride = return_val;
1121 g_localeOverride =
"";
1124 *newLocale = locale;
1127 setlocale(LC_NUMERIC,
"C");
1138void OCPNPlatform::SetDefaultOptions() {
1140 g_bShowOutlines =
true;
1146 g_MarkLost_Mins = 8;
1147 g_bRemoveLost =
true;
1148 g_RemoveLost_Mins = 10;
1151 g_bSyncCogPredictors =
false;
1152 g_bHideMoored =
false;
1153 g_ShowMoored_Kts = 0.2;
1154 g_SOGminCOG_kts = 0.2;
1155 g_bTrackDaily =
false;
1157 g_bFullScreenQuilt =
true;
1158 g_bQuiltEnable =
true;
1159 g_bskew_comp =
false;
1160 g_bShowAreaNotices =
false;
1161 g_bDrawAISSize =
false;
1162 g_bDrawAISRealtime =
false;
1163 g_AIS_RealtPred_Kts = 0.7;
1164 g_bShowAISName =
false;
1165 g_nTrackPrecision = 2;
1166 g_bPreserveScaleOnX =
true;
1170 g_n_ownship_min_mm = 8;
1171 g_bShowMuiZoomButtons =
true;
1172 g_bresponsive =
false;
1176 pConfig->SetPath(
"/Settings/GlobalState");
1177 pConfig->Write(
"bShowS57Text",
true);
1178 pConfig->Write(
"bShowS57ImportantTextOnly",
false);
1179 pConfig->Write(
"nDisplayCategory", (
int)(_DisCat)OTHER);
1180 pConfig->Write(
"nSymbolStyle", (
int)(_LUPname)PAPER_CHART);
1181 pConfig->Write(
"nBoundaryStyle", (
int)(_LUPname)PLAIN_BOUNDARIES);
1183 pConfig->Write(
"bShowSoundg",
true);
1184 pConfig->Write(
"bShowMeta",
false);
1185 pConfig->Write(
"bUseSCAMIN",
true);
1186 pConfig->Write(
"bShowAtonText",
false);
1187 pConfig->Write(
"bShowLightDescription",
false);
1188 pConfig->Write(
"bExtendLightSectors",
true);
1189 pConfig->Write(
"bDeClutterText",
true);
1190 pConfig->Write(
"bShowNationalText",
true);
1192 pConfig->Write(
"S52_MAR_SAFETY_CONTOUR", 3);
1193 pConfig->Write(
"S52_MAR_SHALLOW_CONTOUR", 2);
1194 pConfig->Write(
"S52_MAR_DEEP_CONTOUR", 6);
1195 pConfig->Write(
"S52_MAR_TWO_SHADES", 0);
1196 pConfig->Write(
"S52_DEPTH_UNIT_SHOW", 1);
1198 pConfig->Write(
"ZoomDetailFactorVector", 3);
1200 pConfig->Write(
"nColorScheme", 1);
1204 g_bEnableZoomToCursor =
true;
1206 g_bShowMenuBar =
true;
1211 g_bShowMenuBar =
false;
1214 pConfig->SetPath(
"/PlugIns/chartdldr_pi.dll");
1215 pConfig->Write(
"bEnabled",
true);
1217 pConfig->SetPath(
"/PlugIns/wmm_pi.dll");
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.dylib");
1230 pConfig->Write(
"bEnabled",
true);
1232 pConfig->SetPath(
"/PlugIns/libwmm_pi.dylib");
1233 pConfig->Write(
"bEnabled",
true);
1235 pConfig->SetPath(
"/Settings/WMM");
1236 pConfig->Write(
"ShowIcon",
true);
1237 pConfig->Write(
"ShowLiveIcon",
true);
1244 pConfig->SetPath(
"/PlugIns/libchartdldr_pi.so");
1245 pConfig->Write(
"bEnabled",
true);
1247 pConfig->SetPath(
"/PlugIns/libwmm_pi.so");
1248 pConfig->Write(
"bEnabled",
true);
1250 pConfig->SetPath(
"/Settings/WMM");
1251 pConfig->Write(
"ShowIcon",
true);
1252 pConfig->Write(
"ShowLiveIcon",
true);
1260 g_GLOptions.m_bTextureCompression = 1;
1261 g_GLOptions.m_bTextureCompressionCaching = 1;
1264 qDebug() <<
"SetDefaultOptions";
1267 g_bresponsive =
true;
1268 g_default_font_size = 18;
1271 g_bShowStatusBar =
true;
1272 g_cm93_zoom_factor = 0;
1273 g_oz_vector_scale =
false;
1274 g_fog_overzoom =
false;
1277 g_bShowMuiZoomButtons =
true;
1279 g_GUIScaleFactor = 0;
1280 g_ChartNotRenderScaleFactor = 2.0;
1284 g_toolbarConfig =
"X.....XX.......XX.XXXXXXXXXXX";
1285 g_bPermanentMOBIcon =
false;
1287 wxString sGPS =
"2;3;;0;0;;0;1;0;0;;0;;1;0;0;0;0";
1290 new_params->bEnabled =
true;
1291 TheConnectionParams().push_back(new_params);
1298 pConfig->SetPath(
"/PlugIns/libchartdldr_pi.so");
1299 pConfig->Write(
"bEnabled",
true);
1301 pConfig->SetPath(
"/PlugIns/libwmm_pi.so");
1302 pConfig->Write(
"bEnabled",
true);
1304 pConfig->SetPath(
"/Settings/WMM");
1305 pConfig->Write(
"ShowIcon",
true);
1306 pConfig->Write(
"ShowLiveIcon",
true);
1308 pConfig->SetPath(
"/PlugIns/libgrib_pi.so");
1309 pConfig->Write(
"bEnabled",
true);
1311 pConfig->SetPath(
"/PlugIns/libdashboard_pi.so");
1312 pConfig->Write(
"bEnabled",
true);
1314 pConfig->SetPath(
"/PlugIns/GRIB");
1315 pConfig->Write(
"GRIBCtrlBarPosX", 100);
1316 pConfig->Write(
"GRIBCtrlBarPosY", 0);
1318 pConfig->SetPath(
"/Settings/GRIB");
1319 pConfig->Write(
"CursorDataShown", 0);
1323 pConfig->SetPath(
"/PlugIns/liboesenc_pi.so");
1324 pConfig->Write(
"bEnabled",
true);
1326 pConfig->SetPath(
"/Settings/QTFonts");
1329 wxString str =
"en_US-b25a3899";
1330 wxString pval =
"StatusBar:Roboto,26,-1,5,75,0,0,0,0,0:rgb(0, 0, 0)";
1335 str =
"en_US-9c3b3a0d";
1336 pval =
"DialogStatusBar:Roboto,18,-1,5,50,0,0,0,0,0:rgb(0, 0, 0)";
1341 pConfig->SetPath(
"/Settings/Others");
1342 pConfig->Write(
"TrackLineColour",
"#C545C3");
1343 g_colourTrackLineColour.Set(197, 69, 195);
1345 qDebug() <<
"SetDefaultOptions.Config";
1356void OCPNPlatform::SetUpgradeOptions(wxString vNew, wxString vOld) {
1359 qDebug() <<
"Upgrade check"
1360 <<
"from: " << vOld.mb_str() <<
" to: " << vNew.mb_str();
1362 if (androidGetVersionCode() > g_AndroidVersionCode) {
1363 qDebug() <<
"Upgrade detected"
1364 <<
"from VC: " << g_AndroidVersionCode
1365 <<
" to VC: " << androidGetVersionCode();
1369 pConfig->SetPath(
"/Settings/GlobalState");
1370 pConfig->Write(
"bShowS57Text",
true);
1373 g_ChartNotRenderScaleFactor = 2.0;
1374 g_n_ownship_min_mm = 8;
1375 g_toolbarConfig =
"X.....XX.......XX.XXXXXXXXXXX";
1384 g_bShowMuiZoomButtons =
true;
1388 pInit_Chart_Dir->Clear();
1392 pConfig->SetPath(
"/Settings/WMM");
1393 pConfig->Write(
"ShowIcon",
true);
1394 pConfig->Write(
"ShowLiveIcon",
true);
1396 pConfig->SetPath(
"/Canvas/CanvasConfig1");
1397 pConfig->Write(
"canvasENCShowVisibleSectorLights", 0);
1407 AndroidRemoveSystemFile(
1408 "/data/user/0/org.opencpn.opencpn/manPlug/libchartscale_pi.so");
1412 g_colourTrackLineColour.Set(197, 69, 195);
1416 if (!vOld.IsSameAs(vNew)) {
1422 wxChar sep = wxFileName::GetPathSeparator();
1423 if (UserIconPath.Last() != sep) UserIconPath.Append(sep);
1424 UserIconPath.Append(
"UserIcons");
1426 if (!::wxDirExists(UserIconPath)) {
1427 ::wxMkdir(UserIconPath);
1432 if (LayersPath.Last() != sep) LayersPath.Append(sep);
1433 LayersPath.Append(
"layers");
1435 if (!::wxDirExists(LayersPath)) {
1436 ::wxMkdir(LayersPath);
1442 g_CmdSoundString = wxString(OCPN_SOUND_CMD);
1443 pConfig->SetPath(
"/Settings");
1444 pConfig->Write(
"CmdSoundString", g_CmdSoundString);
1448 g_bAIS_GCPA_Alert_Audio =
true;
1449 g_bAIS_SART_Alert_Audio =
true;
1450 g_bAIS_DSC_Alert_Audio =
true;
1453 g_maintoolbar_x = -1;
1457 std::vector<std::string> TCDS_temp;
1458 for (
unsigned int i = 0; i < TideCurrentDataSet.size(); i++)
1459 TCDS_temp.push_back(TideCurrentDataSet[i]);
1461 TideCurrentDataSet.clear();
1462 for (
unsigned int i = 0; i < TCDS_temp.size(); i++) {
1463 wxString tide = TCDS_temp[i];
1464 wxFileName ft(tide);
1465 if (ft.FileExists()) TideCurrentDataSet.push_back(TCDS_temp[i]);
1472 g_compatOsVersion =
"";
1473 pConfig->SetPath(
"/Settings");
1474 pConfig->Write(
"CompatOS", g_compatOS);
1475 pConfig->Write(
"CompatOsVersion", g_compatOsVersion);
1479int OCPNPlatform::platformApplyPrivateSettingsString(wxString settings,
1480 ArrayOfCDI *pDirArray) {
1483 ret_val = androidApplySettingsString(settings, pDirArray);
1489void OCPNPlatform::applyExpertMode(
bool mode) {
1493 g_bBasicMenus = !mode;
1501static wxString ExpandPaths(wxString paths,
OCPNPlatform *platform);
1503int OCPNPlatform::DoFileSelectorDialog(wxWindow *parent, wxString *file_spec,
1504 wxString Title, wxString initDir,
1505 wxString suggestedName,
1506 wxString wildcard) {
1508 int result = wxID_CANCEL;
1512 wxString idir = initDir;
1513 if (initDir.StartsWith(
1517 result = androidFileChooser(&file, idir, Title, suggestedName, wildcard);
1518 if (file_spec) *file_spec = file;
1520 long flag = wxFD_DEFAULT_STYLE;
1521 if (suggestedName.Length()) {
1525 wxString mask = wildcard;
1526 if (wxNOT_FOUND != mask.Find(
"gpx")) mask.Prepend(
"GPX files (*.gpx)|");
1528 wxFileDialog *psaveDialog =
1529 new wxFileDialog(parent, Title, initDir, suggestedName, mask, flag);
1537 if (parent) parent->HideWithEffect(wxSHOW_EFFECT_BLEND);
1540 result = psaveDialog->ShowModal();
1543 if (parent) parent->ShowWithEffect(wxSHOW_EFFECT_BLEND);
1546 if (file_spec) *file_spec = psaveDialog->GetPath();
1554int OCPNPlatform::DoDirSelectorDialog(wxWindow *parent, wxString *file_spec,
1555 wxString Title, wxString initDir,
1558 int result = wxID_CANCEL;
1562 wxString idir = initDir;
1563 if (initDir.StartsWith(
1567 result = androidFileChooser(&dir, idir, Title,
"",
"",
true,
1569 if (file_spec) *file_spec = dir;
1571 wxDirDialog *dirSelector =
new wxDirDialog(
1572 parent, Title, initDir, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
1575 dirSelector->SetFont(*qFont);
1582 if (parent) parent->HideWithEffect(wxSHOW_EFFECT_BLEND);
1585 result = dirSelector->ShowModal();
1588 if (parent) parent->ShowWithEffect(wxSHOW_EFFECT_BLEND);
1591 if (result == wxID_CANCEL) {
1594 *file_spec = dirSelector->GetPath();
1604MyConfig *OCPNPlatform::GetConfigObject() {
1607 result =
new MyConfig(GetConfigFileName());
1616bool OCPNPlatform::hasInternalGPS(wxString profile) {
1618 bool t = androidDeviceHasGPS();
1632void OCPNPlatform::ShowBusySpinner() { AbstractPlatform::ShowBusySpinner(); }
1634void OCPNPlatform::HideBusySpinner() { AbstractPlatform::HideBusySpinner(); }
1636double OCPNPlatform::GetDisplayDensityFactor() {
1638 return getAndroidDisplayDensity();
1644long OCPNPlatform::GetDefaultToolbarOrientation() {
1646 return wxTB_VERTICAL;
1648 return wxTB_VERTICAL;
1652int OCPNPlatform::GetStatusBarFieldCount() {
1658 wxFont *templateFont = FontMgr::Get().
GetFont(_(
"StatusBar"), 0);
1659 dc.SetFont(*templateFont);
1662 dc.GetTextExtent(
"WWWWWW", &width, NULL, NULL, NULL, templateFont);
1663 double font_size_pix = (double)width / 6.0;
1667 double nChars = dispSize.x / font_size_pix;
1677 return kStatFieldCount;
1681double OCPNPlatform::getFontPointsperPixel() {
1682 double pt_per_pixel = 1.0;
1692 if (m_pt_per_pixel == 0) {
1697 12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, FALSE,
1698 wxString(
""), wxFONTENCODING_SYSTEM);
1702 dc.GetTextExtent(
"H", &width, &height, NULL, NULL, f);
1704 if (height > 0) m_pt_per_pixel = 12.0 / (double)height;
1706 if (m_pt_per_pixel > 0) pt_per_pixel = m_pt_per_pixel;
1709 return pt_per_pixel;
1714 return getAndroidDisplayDimensions();
1731 ret = GetAndroidDisplaySize();
1737double OCPNPlatform::GetDisplayAreaCM2() {
1742 ratio = (double)sz.x / (
double)sz.y;
1744 ratio = (double)sz.y / (
double)sz.x;
1746 double area = size1 * (size1 * ratio) / 100.;
1752 if (monitor < m_displaySizeMMOverride.size()) {
1753 m_displaySizeMMOverride[monitor] = sizeMM;
1757double OCPNPlatform::GetDisplayDPmm() {
1759 return getAndroidDPmm();
1766unsigned int OCPNPlatform::GetSelectRadiusPix() {
1767 return GetDisplayDPmm() *
1768 (g_btouch ? g_selection_radius_touch_mm : g_selection_radius_mm);
1771bool OCPNPlatform::GetFullscreen() {
1774 bret = androidGetFullscreen();
1782bool OCPNPlatform::SetFullscreen(
bool bFull) {
1785 bret = androidSetFullscreen(bFull);
1792void OCPNPlatform::PositionAISAlert(wxWindow *alert_window) {
1795 alert_window->SetSize(g_ais_alert_dialog_x, g_ais_alert_dialog_y,
1796 g_ais_alert_dialog_sx, g_ais_alert_dialog_sy);
1800 alert_window->Centre();
1806wxDirDialog *OCPNPlatform::AdjustDirDialogFont(wxWindow *container,
1808 wxDirDialog *ret_dlg = dlg;
1812 dlg->SetSize(container->GetSize());
1815 wxSize sds = dlg->GetSize();
1816 wxSize ss = container->GetSize();
1821 wxString msg = dlg->GetMessage();
1822 wxString default_dir = dlg->GetPath();
1826 ret_dlg =
new wxDirDialog(NULL, msg, default_dir,
1827 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
1830 wxFont *smallFont =
new wxFont(*dialogFont);
1831 smallFont->SetPointSize((smallFont->GetPointSize() / 2) +
1833 ret_dlg->SetFont(*smallFont);
1835 ret_dlg->SetSize(container->GetSize());
1843wxFileDialog *OCPNPlatform::AdjustFileDialogFont(wxWindow *container,
1844 wxFileDialog *dlg) {
1845 wxFileDialog *ret_dlg = dlg;
1849 dlg->SetSize(container->GetSize());
1852 wxSize sds = dlg->GetSize();
1853 wxSize ss = container->GetSize();
1858 wxString msg = dlg->GetMessage();
1859 wxString default_dir = dlg->GetDirectory();
1860 wxString default_file = dlg->GetFilename();
1861 wxString wildcard = dlg->GetWildcard();
1865 ret_dlg =
new wxFileDialog(NULL, msg, default_dir, default_file, wildcard,
1869 wxFont *smallFont =
new wxFont(*dialogFont);
1870 smallFont->SetPointSize((smallFont->GetPointSize() / 2) +
1872 ret_dlg->SetFont(*smallFont);
1874 ret_dlg->SetSize(container->GetSize());
1882double OCPNPlatform::GetToolbarScaleFactor(
int GUIScaleFactor) {
1890 wxSize style_tool_size(32, 32);
1892 if (g_StyleManager) {
1894 if (style) style_tool_size = style->GetToolSize();
1896 double tool_size = style_tool_size.x;
1902 double premult = 1.0;
1905 double target_size = 9.0;
1906 double basic_tool_size_mm = tool_size / GetDisplayDPmm();
1907 premult = target_size / basic_tool_size_mm;
1910 premult = wxMax(45 * getAndroidDisplayDensity(), 45) /
1916 double postmult = exp(GUIScaleFactor * (log(2.0) / 5.0));
1920 rv = premult * postmult;
1921 rv = wxMin(rv, getAndroidDisplayDensity() *
1925 double premult = 1.0;
1927 if (g_bresponsive) {
1930 wxSize style_tool_size = style->GetToolSize();
1931 double tool_size = style_tool_size.x;
1935 double target_size = 9.0;
1937 double basic_tool_size_mm = tool_size / GetDisplayDPmm();
1938 premult = target_size / basic_tool_size_mm;
1942 double postmult = exp(GUIScaleFactor * (0.693 / 5.0));
1944 rv = premult * postmult;
1945 rv = wxMin(rv, 3.0);
1946 rv = wxMax(rv, 0.5);
1955double OCPNPlatform::GetCompassScaleFactor(
int GUIScaleFactor) {
1962 if (g_bresponsive) {
1965 wxSize style_tool_size = style->GetToolSize();
1966 double compass_size = style_tool_size.x;
1972 double premult = wxMax(28 * getAndroidDisplayDensity(), 50) / compass_size;
1975 double postmult = exp(GUIScaleFactor * (log(2.0) / 5.0));
1978 rv = premult * postmult;
1979 rv = wxMin(rv, getAndroidDisplayDensity() *
1984 double premult = 1.0;
1986 if (g_bresponsive) {
1988 wxSize style_tool_size = style->GetToolSize();
1989 double compass_size = style_tool_size.x;
1992 double target_size = 6.0;
1994 double basic_tool_size_mm = compass_size / GetDisplayDPmm();
1995 premult = target_size / basic_tool_size_mm;
1998 double postmult = exp(GUIScaleFactor * (0.693 / 5.0));
2000 rv = premult * postmult;
2002 rv = wxMin(rv, 3.0);
2003 rv = wxMax(rv, 0.5);
2005#if defined(__WXOSX__) || defined(__WXGTK3__)
2008 if (top_frame::Get()) rv *= top_frame::Get()->GetContentScaleFactor();
2018float OCPNPlatform::GetChartScaleFactorExp(
float scale_linear) {
2019 double factor = 1.0;
2021 factor = exp(scale_linear * (log(3.0) / 5.0));
2026 factor = exp(scale_linear * (0.693 / 5.0));
2030 factor = wxMax(factor, .5);
2031 factor = wxMin(factor, 6.);
2036float OCPNPlatform::GetMarkScaleFactorExp(
float scale_linear) {
2037 if (scale_linear <= 0)
2038 return GetChartScaleFactorExp(scale_linear);
2040 return GetChartScaleFactorExp(scale_linear - 1);
2057bool OCPNPlatform::hasInternalBT(wxString profile) {
2059 bool t = androidDeviceHasBlueTooth();
2068bool OCPNPlatform::startBluetoothScan() {
2070 return androidStartBluetoothScan();
2077bool OCPNPlatform::stopBluetoothScan() {
2079 return androidStopBluetoothScan();
2086wxArrayString OCPNPlatform::getBluetoothScanResults() {
2087 wxArrayString ret_val;
2089 return androidGetBluetoothScanResults();
2092 ret_val.Add(
"line 1");
2093 ret_val.Add(
"line 2");
2094 ret_val.Add(
"line 3");
2104bool OCPNPlatform::AllowAlertDialog(
const wxString &class_name) {
2109 wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
2111 wxWindow *win = node->GetData();
2112 if (win->IsShown()) nTLW++;
2114 node = node->GetNext();
2128void OCPNPlatform::setChartTypeMaskSel(
int mask, wxString &indicator) {
2130 return androidSetChartTypeMaskSel(mask, indicator);
2135QString g_qtStyleSheet;
2137bool LoadQtStyleSheet(wxString &sheet_file) {
2138 if (wxFileExists(sheet_file)) {
2141 QString file(sheet_file.c_str());
2143 File.open(QFile::ReadOnly);
2144 g_qtStyleSheet = QLatin1String(File.readAll());
2154QString getQtStyleSheet() {
return g_qtStyleSheet; }
2158bool OCPNPlatform::isPlatformCapable(
int flag) {
2162 if (flag == PLATFORM_CAP_PLUGINS) {
2164 wxString tsdk(android_plat_spc.msdk);
2165 if (tsdk.ToLong(&platver)) {
2166 if (platver >= 11)
return true;
2168 }
else if (flag == PLATFORM_CAP_FASTPAN) {
2170 wxString tsdk(android_plat_spc.msdk);
2171 if (tsdk.ToLong(&platver)) {
2172 if (platver >= 14)
return true;
2180void OCPNPlatform::platformLaunchDefaultBrowser(wxString URL) {
2182 androidLaunchBrowser(URL);
2184 ::wxLaunchDefaultBrowser(URL);
2194EVT_PAINT(OCPNColourPickerCtrl::OnPaint)
2203 const wxColour &initial,
2205 const wxSize &size,
long style,
2206 const wxValidator &validator,
2207 const wxString &name) {
2208 Create(parent,
id, initial, pos, size, style, validator, name);
2211bool OCPNColourPickerCtrl::Create(wxWindow *parent, wxWindowID
id,
2212 const wxColour &col,
const wxPoint &pos,
2213 const wxSize &size,
long style,
2214 const wxValidator &validator,
2215 const wxString &name) {
2216 m_bitmap = wxBitmap(60, 13);
2219 if (!wxBitmapButton::Create(parent,
id, m_bitmap, pos, size,
2220 style | wxBU_AUTODRAW, validator, name)) {
2221 wxFAIL_MSG(
"OCPNColourPickerCtrl creation failed");
2226 Connect(GetId(), wxEVT_BUTTON,
2227 wxCommandEventHandler(OCPNColourPickerCtrl::OnButtonClick), NULL,
2237void OCPNColourPickerCtrl::InitColourData() {
2239 ms_data.SetChooseFull(
true);
2240 unsigned char grey = 0;
2241 for (
int i = 0; i < 16; i++, grey += 16)
2244 wxColour colour(grey, grey, grey);
2245 ms_data.SetCustomColour(i, colour);
2250void OCPNColourPickerCtrl::OnButtonClick(wxCommandEvent &WXUNUSED(ev)) {
2252 unsigned int cco = 0;
2255 cco |= m_colour.Red();
2257 cco |= m_colour.Green();
2259 cco |= m_colour.Blue();
2260 unsigned int cc = androidColorPicker(cco);
2263 unsigned char blue = (
unsigned char)cc % 256;
2264 unsigned char green = (
unsigned char)(cc >> 8) % 256;
2266 unsigned char red = (
unsigned char)(cc >> 16) % 256;
2267 cnew.Set(red, green, blue);
2273 ms_data.SetColour(m_colour);
2276 wxColourDialog dlg(
this, &ms_data);
2277 if (dlg.ShowModal() == wxID_OK) {
2278 ms_data = dlg.GetColourData();
2279 SetColour(ms_data.GetColour());
2284void OCPNColourPickerCtrl::UpdateColour() {
2286 SetBitmapLabel(wxBitmap());
2289 wxMemoryDC dc(m_bitmap);
2290 dc.SetPen(*wxTRANSPARENT_PEN);
2291 dc.SetBrush(wxBrush(m_colour));
2292 dc.DrawRectangle(0, 0, m_bitmap.GetWidth(), m_bitmap.GetHeight());
2294 dc.SelectObject(wxNullBitmap);
2295 SetBitmapLabel(m_bitmap);
2298void OCPNColourPickerCtrl::SetColour(wxColour &c) {
2300 m_bitmap = wxBitmap(GetSize().x - 20, GetSize().y - 20);
2304wxColour OCPNColourPickerCtrl::GetColour() {
return m_colour; }
2306wxSize OCPNColourPickerCtrl::DoGetBestSize()
const {
2307 wxSize sz(wxBitmapButton::DoGetBestSize());
2314 if (HasFlag(wxCLRP_SHOW_LABEL))
return sz;
2322void OCPNColourPickerCtrl::OnPaint(wxPaintEvent &event) {
2325 int offset_x = (GetSize().x - m_bitmap.GetWidth()) / 2;
2326 int offset_y = (GetSize().y - m_bitmap.GetHeight()) / 2;
2328 dc.SetPen(*wxTRANSPARENT_PEN);
2329 dc.SetBrush(wxBrush(m_colour));
2330 dc.DrawRectangle(offset_x, offset_y, m_bitmap.GetWidth(),
2331 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.