diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/dktools/Dk4FcsApp.cpp |
Initial commit
Diffstat (limited to 'support/dktools/Dk4FcsApp.cpp')
-rw-r--r-- | support/dktools/Dk4FcsApp.cpp | 425 |
1 files changed, 425 insertions, 0 deletions
diff --git a/support/dktools/Dk4FcsApp.cpp b/support/dktools/Dk4FcsApp.cpp new file mode 100644 index 0000000000..b92af6f0a3 --- /dev/null +++ b/support/dktools/Dk4FcsApp.cpp @@ -0,0 +1,425 @@ +/* + WARNING: This file was generated by dkct. + 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 +*/ + +/* +Copyright (C) 2015-2017, Dirk Krause + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above opyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +* Neither the name of the author nor the names of contributors may be used + to endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** @file Dk4FcsApp.cpp The Dk4FcsApp module. +*/ + + +#line 63 "Dk4FcsApp.cpt" + +#include "wxdkfcs.h" + + + + + +#line 69 "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 156 "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://dktools.sourceforge.net"), + +/* 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 229 "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 254 "Dk4FcsApp.cpt" +}; + + + +/** Implementation of the wxApp functionality. +*/ +IMPLEMENT_APP(Dk4FcsApp) + + +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 275 "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 293 "Dk4FcsApp.cpt" + + /* Add image and file system handlers for online help. */ + phPng = new wxPNGHandler(); + if (NULL != phPng) { + wxImage::AddHandler(phPng); + } else { + ShowMemoryErrorMessage(); + goto finished; + } + phXpm = new wxXPMHandler(); + if (NULL != phXpm) { + wxImage::AddHandler(phXpm); + } else { + ShowMemoryErrorMessage(); + goto finished; + } + phIco = new wxICOHandler(); + if (NULL != phIco) { + wxImage::AddHandler(phIco); + } else { + ShowMemoryErrorMessage(); + goto finished; + } + + +#line 317 "Dk4FcsApp.cpt" + phArchiveFs = new wxArchiveFSHandler(); + if (NULL != phArchiveFs) { + wxFileSystem::AddHandler(phArchiveFs); + } else { + ShowMemoryErrorMessage(); + goto finished; + } + + pHc = new Dk4WxHelpController(); + if (NULL == pHc) { + ShowMemoryErrorMessage(); + goto finished; + } + if (!(pHc->Initialize(pAh, wxdkfcs_nl_dk[2], wxdkfcs_nl_dk[3]))) + { + goto finished; + } + + +#line 335 "Dk4FcsApp.cpt" + + localizedTexts = pAh->GetStringTable(wxdkfcs_nl_dk[1], wxdkfcs_texts); + if(!(localizedTexts)) { localizedTexts = wxdkfcs_texts; } + + + +#line 340 "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 357 "Dk4FcsApp.cpt" + frame->Show(); + frame->RestorePosition(); + + +#line 360 "Dk4FcsApp.cpt" + back = true; + + /* Release resources if initialization failed. */ + finished: + if(!(back)) { + +#line 365 "Dk4FcsApp.cpt" + if (NULL != pHc) { + pHc->Cleanup(); delete(pHc); pHc = NULL; + } + if (NULL != pAh) { + pAh->Cleanup(); delete(pAh); pAh = NULL; + } + } + + +#line 373 "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)); +} + |