/* Copyright (C) 2015-2020, Dirk Krause SPDX-License-Identifier: BSD-3-Clause */ /* WARNING: This file was generated by the dkct program (see http://dktools.sourceforge.net/ for details). Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: Dk4FcsApp.cpt */ /** @file Dk4FcsApp.cpp The Dk4FcsApp module. */ #line 68 "Dk4FcsApp.cpt" #include "dk4conf.h" #include "wxdkfcs.h" #line 75 "Dk4FcsApp.cpt" /** Localized wxChar texts. */ static wxChar const * wxdkfcs_texts[] = { /* 0 */ wxT("File"), /* 1 */ wxT("Quit"), /* 2 */ wxT("Exit the application"), /* 3 */ wxT("Help"), /* 4 */ wxT("About"), /* 5 */ wxT("Show version information"), /* 6 */ wxT("Contents"), /* 7 */ wxT("Open table of contents"), /* 8 */ wxT("Ready"), /* 9 */ wxT("Copyright (c) "), /* 10 */ wxT("About "), /* 11 */ wxT("This program uses the following libraries:"), /* 12 */ wxT("See:"), /* 13 */ wxT("File:"), /* 14 */ wxT("MD5"), /* 15 */ wxT("RIPEMD-160"), /* 16 */ wxT("SHA-1"), /* 17 */ wxT("SHA-224"), /* 18 */ wxT("SHA-256"), /* 19 */ wxT("SHA-384"), /* 20 */ wxT("SHA-512"), /* 21 */ wxT("Checksum"), /* 22 */ wxT("Choose a file"), /* 23 */ wxT("Open"), /* 24 */ wxT("Open a file"), NULL #line 162 "Dk4FcsApp.cpt" }; /** Non-localized wxChar texts. */ static wxChar const * wxdkfcs_nl_wx[] = { /* 0 */ wxT("wxdkfcs"), /* 1 */ wxT("4.0.0"), /* 2 */ wxT("Dirk Krause"), /* 3 */ wxT("DKrause"), /* 4 */ wxT("aaaaa"), /* 5 */ wxT(""), /* 6 */ wxT(""), /* 7 */ wxT(" "), /* 8 */ wxT("\n"), /* 9 */ wxT("DK tools, wxWidgets, OpenSSL, libpng, libjpeg, libtiff, zlib."), /* 10 */ wxT("http://sourceforge.net/p/dktools/wiki/Home/"), /* 11 */ wxT("http://www.wxwidgets.org"), /* 12 */ wxT("http://www.openssl.org"), /* 13 */ wxT("http://www.libpng.org/pub/png/libpng.html"), /* 14 */ wxT("http://www.ijg.org"), /* 15 */ wxT("http://www.remotesensing.org/libtiff"), /* 16 */ wxT("http://www.zlib.net"), /* 17 */ wxT("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"), /* 18 */ wxT("This product includes software developed by the OpenSSL Project for use in"), /* 19 */ wxT("the OpenSSL Toolkit (http://www.openssl.org/)."), /* 20 */ wxT("This product includes cryptographic software written by"), /* 21 */ wxT("Eric Young (eay@cryptsoft.com)."), /* 22 */ wxT("This product includes software written by Tim Hudson (tjh@cryptsoft.com)."), /* 23 */ wxT("Error"), /* 24 */ wxT("Not enough memory (RAM)!"), NULL #line 235 "Dk4FcsApp.cpt" }; /** Non-localized dkChar texts. */ static dkChar const * wxdkfcs_nl_dk[] = { /* 0 */ dkT("dktools"), /* 1 */ dkT("wxdkfcs.str"), /* 2 */ dkT("wxdkfcs.chm"), /* 3 */ dkT("wxdkfcs.htb"), NULL #line 260 "Dk4FcsApp.cpt" }; /** Implementation of the wxApp functionality. */ #if wxCHECK_VERSION(3,0,0) wxIMPLEMENT_APP(Dk4FcsApp); #else IMPLEMENT_APP(Dk4FcsApp) #endif bool Dk4FcsApp::OnInit() { Dk4FcsFrame *frame = NULL; wxChar const * const *localizedTexts = NULL; wxPNGHandler *phPng = NULL; wxXPMHandler *phXpm = NULL; wxICOHandler *phIco = NULL; wxArchiveFSHandler *phArchiveFs = NULL; bool back = false; #line 286 "Dk4FcsApp.cpt" /* Initialize members. */ pAh = NULL; pHc = NULL; /* Initialize further members here. */ /* Set up helper object. */ pAh = new Dk4WxApplicationHelper(); if (NULL == pAh) { ShowMemoryErrorMessage(); goto finished; } if (!(pAh->Initialize(argv[0], wxdkfcs_nl_wx[3], wxdkfcs_nl_dk[0]))) { goto finished; } #line 304 "Dk4FcsApp.cpt" /* Add image and file system handlers for online help. */ phPng = new wxPNGHandler(); if (NULL != phPng) { wxImage::AddHandler(phPng); } else { ShowMemoryErrorMessage(); goto finished; } /* CLANG STATIC ANALYSIS COMPLAINS ABOUT A POTENTIAL MEMORY LEAK, because phPng is set using the new operator but there is no matching delete. The handler object is deleted from within wxImage destructor, there is no memory leak. */ phXpm = new wxXPMHandler(); if (NULL != phXpm) { wxImage::AddHandler(phXpm); } else { ShowMemoryErrorMessage(); goto finished; } /* CLANG STATIC ANALYSIS COMPLAINS ABOUT A POTENTIAL MEMORY LEAK, because phXpm is set using the new operator but there is no matching delete. The handler object is deleted from within wxImage destructor, there is no memory leak. */ phIco = new wxICOHandler(); if (NULL != phIco) { wxImage::AddHandler(phIco); } else { ShowMemoryErrorMessage(); goto finished; } /* CLANG STATIC ANALYSIS COMPLAINS ABOUT A POTENTIAL MEMORY LEAK, because phIco is set using the new operator but there is no matching delete. The handler object is deleted from within wxImage destructor, there is no memory leak. */ #line 352 "Dk4FcsApp.cpt" phArchiveFs = new wxArchiveFSHandler(); if (NULL != phArchiveFs) { wxFileSystem::AddHandler(phArchiveFs); } else { ShowMemoryErrorMessage(); goto finished; } /* CLANG STATIC ANALYSIS COMPLAINS ABOUT A POTENTIAL MEMORY LEAK, because phArchiveFs is set using the new operator but there is no matching delete. The handler object is deleted from within wxFileSystem destructor, there is no memory leak. */ pHc = new Dk4WxHelpController(); if (NULL == pHc) { ShowMemoryErrorMessage(); goto finished; } if (!(pHc->Initialize(pAh, wxdkfcs_nl_dk[2], wxdkfcs_nl_dk[3]))) { goto finished; } #line 377 "Dk4FcsApp.cpt" localizedTexts = pAh->GetStringTable(wxdkfcs_nl_dk[1], wxdkfcs_texts); if(!(localizedTexts)) { localizedTexts = wxdkfcs_texts; } #line 382 "Dk4FcsApp.cpt" /* Create and show frame. */ frame = new Dk4FcsFrame( Dk4FcsFrame_MainWindow, pAh, pHc, argc, argv, localizedTexts, wxdkfcs_nl_wx, wxdkfcs_nl_dk ); if(!(frame)) { ShowMemoryErrorMessage(); goto finished; } #line 399 "Dk4FcsApp.cpt" frame->RestorePosition(); frame->Show(); #line 402 "Dk4FcsApp.cpt" back = true; /* Release resources if initialization failed. */ finished: if(!(back)) { #line 407 "Dk4FcsApp.cpt" if (NULL != pHc) { pHc->Cleanup(); delete(pHc); pHc = NULL; } if (NULL != pAh) { pAh->Cleanup(); delete(pAh); pAh = NULL; } } #line 415 "Dk4FcsApp.cpt" return back; } int Dk4FcsApp::OnExit() { int back = 0; /* Release resources allocated by further members. */ /* Release resources. */ if (NULL != pHc) { pHc->Cleanup(); delete(pHc); pHc = NULL; } if (NULL != pAh) { pAh->Cleanup(); delete(pAh); pAh = NULL; } /* Set back to exit status code. */ return back; } void Dk4FcsApp::ShowMemoryErrorMessage(void) { const wxChar *s_title = NULL; const wxChar *s_text = NULL; if (NULL != pAh) { s_title = pAh->GetBasicString(6); s_text = pAh->GetBasicString(7); } if (NULL == s_title) { s_title = wxdkfcs_nl_wx[23]; } if (NULL == s_text) { s_text = wxdkfcs_nl_wx[24]; } wxMessageBox(s_text, s_title, (wxOK | wxCENTRE | wxICON_ERROR)); }