78 int GetAPIVersionMajor();
79 int GetAPIVersionMinor();
80 int GetPlugInVersionMajor();
81 int GetPlugInVersionMinor();
83 wxString GetCommonName();
84 wxString GetShortDescription();
85 wxString GetLongDescription();
87 void OnSetupOptions(
void);
88 void OnCloseToolboxPanel(
int page_sel,
int ok_apply_cancel);
91 void ShowPreferencesDialog(wxWindow* parent);
94 bool SaveConfig(
void);
95 bool ProcessFile(
const wxString& aFile,
const wxString& aTargetDir,
96 bool aStripPath =
true,
97 wxDateTime aMTime = wxDateTime::Now());
98 bool ExtractZipFiles(
const wxString& aZipFile,
const wxString& aTargetDir,
99 bool aStripPath =
true,
100 wxDateTime aMTime = wxDateTime::Now(),
101 bool aRemoveZip =
false);
102#ifdef DLDR_USE_LIBARCHIVE
103 bool ExtractLibArchiveFiles(
const wxString& aArchiveFile,
104 const wxString& aTargetDir,
105 bool aStripPath =
true,
106 wxDateTime aMTime = wxDateTime::Now(),
107 bool aRemoveArchive =
false);
109#if defined(CHARTDLDR_RAR_UNARR) || !defined(DLDR_USE_LIBARCHIVE)
110 bool ExtractUnarrFiles(
const wxString& aRarFile,
const wxString& aTargetDir,
111 bool aStripPath =
true,
112 wxDateTime aMTime = wxDateTime::Now(),
113 bool aRemoveRar =
false);
119 std::vector<std::unique_ptr<ChartSource>> m_ChartSources;
120 wxWindow* m_parent_window;
123 void SetSourceId(
int id) { m_selected_source = id; }
124 int GetSourceId() {
return m_selected_source; }
125 wxString GetBaseChartDir() {
return m_base_chart_dir; }
126 bool m_preselect_new;
127 bool m_preselect_updated;
128 bool m_allow_bulk_update;
131 wxFileConfig* m_pconfig;
132 wxScrolledWindow* m_pOptionsPage;
133 bool LoadConfig(
void);
135 int m_leftclick_tool_id;
137 wxString m_schartdldr_sources;
138 int m_selected_source;
141 wxString m_base_chart_dir;
146 ChartSource(wxString name, wxString url, wxString localdir);
149 wxString GetName() {
return m_name; }
150 wxString GetUrl() {
return m_url; }
151 wxString GetDir() {
return m_dir; }
152 void SetDir(wxString dir) { m_dir = dir; }
153 void SetName(wxString name) { m_name = name; }
154 void SetUrl(wxString url) { m_url = url; }
155 bool ExistsLocaly(wxString chart_number, wxString filename);
156 bool IsNewerThanLocal(wxString chart_number, wxString filename,
157 wxDateTime validDate);
158 void UpdateLocalFiles() { GetLocalFiles(); }
160 bool UpdateDataExists();
161 void LoadUpdateData();
162 void SaveUpdateData();
163 void ChartUpdated(wxString chart_number, time_t timestamp);
166 wxArrayString m_localfiles;
167 std::vector<wxDateTime> m_localdt;
168 void GetLocalFiles();
172 std::map<std::string, time_t> m_update_data;
180 bool DownloadChart(wxString url, wxString file, wxString title);
181 bool downloadInProgress;
186 bool DownloadIsCancel;
190 void OnPopupClick(wxCommandEvent& evt);
191 int GetSelectedCatalog();
192 void AppendCatalog(std::unique_ptr<ChartSource>& cs);
195 bool m_bTransferComplete;
196 bool m_bTransferSuccess;
197 wxString m_totalsize;
198 wxString m_transferredsize;
199 int m_failed_downloads;
202 void DisableForDownload(
bool enabled);
206 size_t m_updatedCharts;
210 void SetSource(
int id);
211 void SelectSource(wxListEvent& event);
212 void AddSource(wxCommandEvent& event);
213 void DeleteSource(wxCommandEvent& event);
214 void EditSource(wxCommandEvent& event);
215 void UpdateChartList(wxCommandEvent& event);
216 void OnDownloadCharts(wxCommandEvent& event);
218 void OnSelectChartItem(wxCommandEvent& event);
219 void OnSelectNewCharts(wxCommandEvent& event);
220 void OnSelectUpdatedCharts(wxCommandEvent& event);
221 void OnSelectAllCharts(wxCommandEvent& event);
224 void DoHelp(wxCommandEvent& event) {
226 wxLaunchDefaultBrowser(_T(
"file:///") + *GetpSharedDataLocation() +
227 _T(
"plugins/chartdldr_pi/data/doc/index.html"));
229 wxLaunchDefaultBrowser(_T(
"file://") + *GetpSharedDataLocation() +
230 _T(
"plugins/chartdldr_pi/data/doc/index.html"));
233 void UpdateAllCharts(wxCommandEvent& event);
234 void OnShowLocalDir(wxCommandEvent& event);
235 void OnPaint(wxPaintEvent& event);
236 void OnLeftDClick(wxMouseEvent& event);
239 void FillFromFile(wxString url, wxString dir,
bool selnew =
false,
240 bool selupd =
false);
242 void OnContextMenu(wxMouseEvent& event);
243 void SetBulkUpdate(
bool bulk_update);
246 int GetCheckedChartCount();
247 bool isChartChecked(
int i);
248 void CheckAllCharts(
bool value);
249 void InvertCheckAllCharts();
251 void CheckNewCharts(
bool value);
252 void CheckUpdatedCharts(
bool value);
258 wxWindowID
id = wxID_ANY,
259 const wxPoint& pos = wxDefaultPosition,
260 const wxSize& size = wxDefaultSize,
261 long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
262 void SelectCatalog(
int item);
264 void CancelDownload() {
266 wxEVT_DOWNLOAD_EVENT,
267 (wxObjectEventFunction)(wxEventFunction)&ChartDldrPanelImpl::onDLEvent);
269 m_bconnected =
false;
273 DECLARE_EVENT_TABLE()
278 void OnChangeType(wxCommandEvent& event);
279 void OnSourceSelected(wxTreeEvent& event);
280 void OnOkClick(wxCommandEvent& event);
281 void OnCancelClick(wxCommandEvent& event);
284 bool LoadSections(
const wxTreeItemId& root,
pugi::xml_node& node);
286 bool LoadCatalogs(
const wxTreeItemId& root,
pugi::xml_node& node);
292 void SetBasePath(
const wxString path) { m_base_path = path; }
293 void SetSourceEdit(std::unique_ptr<ChartSource>& cs);
296 bool ValidateUrl(
const wxString Url,
bool catalog_xml =
true);
297 wxString FixPath(wxString path);
298 wxString m_base_path;
299 wxString m_last_path;
300 wxImageList* p_iconList;
301#ifdef __OCPN__ANDROID__
302 wxImageList* p_buttonIconList;