OpenCPN Partial API docs
Loading...
Searching...
No Matches
base_platform.h
1/***************************************************************************
2 *
3 * Project: OpenCPN
4 * Purpose: Basic platform specific support utilities without GUI deps.
5 * Author: David Register
6 *
7 ***************************************************************************
8 * Copyright (C) 2015 by David S. Register *
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
24 **************************************************************************/
25
26#ifndef BASEPLATFORM_H
27#define BASEPLATFORM_H
28
29#include <stdio.h>
30#include <vector>
31
32#include <wx/wxprec.h>
33
34#ifndef WX_PRECOMP
35#include <wx/wx.h>
36#endif // precompiled headers
37
38#include <wx/gdicmn.h>
39#include <wx/log.h>
40#include <wx/stdpaths.h>
41#include <wx/clrpicker.h>
42#include <wx/colourdata.h>
43#include <wx/colordlg.h>
44
45
46#define PLATFORM_CAP_PLUGINS 1
47#define PLATFORM_CAP_FASTPAN 2
48
49typedef struct {
50 char tsdk[20];
51 char hn[20];
52 char msdk[20];
53} PlatSpec;
54
55void appendOSDirSlash(wxString* path);
56
58 OCPN_OSDetail(){};
60
61 std::string osd_name;
62 std::string osd_version;
63 std::vector<std::string> osd_names_like;
64 std::string osd_arch;
65 std::string osd_ID;
66};
67
69public:
71 virtual ~BasePlatform() {}
72
73 wxString& GetPrivateDataDir();
74 wxString* GetPluginDirPtr();
75 wxString* GetSharedDataDirPtr();
76 wxString* GetPrivateDataDirPtr();
77
79 wxString& GetPluginDir();
80
81 wxStandardPaths& GetStdPaths();
82
87 wxString GetWinPluginBaseDir();
88
89 wxString& GetSharedDataDir();
90 wxString& GetExePath();
91 wxString& GetHomeDir();
92 wxString GetWritableDocumentsDir();
93
102 wxString GetPluginDataPath();
103
104 wxString& GetConfigFileName();
105 wxString& GetLogFileName() { return mlog_file; }
106
107 bool isFlatpacked() { return m_isFlatpacked; }
108
109 bool isPlatformCapable(int flag);
110 OCPN_OSDetail* GetOSDetail() { return m_osDetail; }
111
112 void CloseLogFile(void);
113 bool InitializeLogFile(void);
114 wxString& GetLargeLogMessage(void) { return large_log_message; }
115 FILE* GetLogFilePtr() { return flog; }
116
117 wxString NormalizePath(const wxString& full_path);
118
119 virtual wxSize getDisplaySize();
120 virtual double GetDisplaySizeMM();
121 virtual double GetDisplayDPmm();
122 virtual unsigned int GetSelectRadiusPix();
123 double GetDisplayDIPMult(wxWindow *win);
124
125 void ShowBusySpinner();
126 void HideBusySpinner();
127
128protected:
129 bool DetectOSDetail(OCPN_OSDetail* detail);
130
131 wxString m_PrivateDataDir;
132 wxString m_PluginsDir;
133 bool m_isFlatpacked;
134 wxString m_homeDir;
135 wxString m_exePath;
136 wxString m_SData_Dir;
137 wxString m_config_file_name;
138 wxString m_pluginDataPath;
139 wxString mlog_file;
140
141 OCPN_OSDetail* m_osDetail;
142
143 FILE* flog;
144 wxLog* m_Oldlogger;
145 wxString large_log_message;
146
147 wxSize m_displaySize;
148 wxSize m_displaySizeMM;
149 int m_displaySizeMMOverride;
150
151
152#ifdef _MSC_VER
153 bool GetWindowsMonitorSize(int *width, int *height);
154#endif
155 int m_monitorWidth, m_monitorHeight;
156 bool m_bdisableWindowsDisplayEnum;
157};
158
159#endif // BASEPLATFORM_H
wxString GetWinPluginBaseDir()
Base directory for user writable windows plugins, reflects winPluginDir option, defaults to LOCALAPPD...
wxString & GetPluginDir()
The original in-tree plugin directory, sometimes not user-writable.
wxString GetPluginDataPath()
Return ';'-separated list of base directories for plugin data.