/* Copyright (C) 2019-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: WximgszApp.cpt */ /** @file WximgszApp.cpp The WximgszApp module. */ #line 67 "WximgszApp.cpt" #include "wximgsz.h" #line 73 "WximgszApp.cpt" /** Localized wxChar texts. */ static wxChar const * wximgsz_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("Input"), /* 14 */ wxT("Width: "), /* 15 */ wxT("Height: "), /* 16 */ wxT("Enter original image width"), /* 17 */ wxT("Enter original image height"), /* 18 */ wxT("Change"), /* 19 */ wxT("Operation: "), /* 20 */ wxT("Select the intended operation"), /* 21 */ wxT("Downscale"), /* 22 */ wxT("Width range"), /* 23 */ wxT("Height range"), /* 24 */ wxT("Minimum: "), /* 25 */ wxT("Maximum: "), /* 26 */ wxT("Enter range minimum"), /* 27 */ wxT("Enter range maximum"), /* 28 */ wxT("Results"), /* 29 */ wxT("Run"), /* 30 */ wxT("Width"), /* 31 */ wxT("Height"), /* 32 */ wxT("Factor"), /* 33 */ wxT(""), /* 34 */ wxT(""), /* 35 */ wxT("+"), /* 36 */ wxT("++"), /* 37 */ wxT(" / "), /* 38 */ wxT("Too many results"), /* 39 */ wxT("Too many output rows, output limited."), /* 40 */ wxT("Open"), /* 41 */ wxT("Open bitmap image file and retrieve dimensions"), /* 42 */ wxT("Open image file"), /* 43 */ wxT("Open image failed"), /* 44 */ wxT("Failed to open image!"), /* 45 */ wxT("No such file:\n\""), /* 46 */ wxT("\"!"), /* 47 */ wxT("Insufficient permissions to file:\n\""), /* 48 */ wxT("\"!"), /* 49 */ wxT("Not a supported file type:\n\""), /* 50 */ wxT("\"!"), NULL #line 225 "WximgszApp.cpt" }; /** Non-localized wxChar texts. */ static wxChar const * wximgsz_nl_wx[] = { /* 0 */ wxT("wximgsz"), /* 1 */ wxT("1.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, libpng, libjpeg, libtiff, zlib."), /* 10 */ wxT("http://sourceforge.net/p/dktools/wiki/Home/"), /* 11 */ wxT("http://www.wxwidgets.org"), /* 12 */ wxT("http://www.libpng.org/pub/png/libpng.html"), /* 13 */ wxT("http://www.ijg.org"), /* 14 */ wxT("http://www.remotesensing.org/libtiff"), /* 15 */ wxT("http://www.zlib.net"), /* 16 */ wxT("Error"), /* 17 */ wxT("Not enough memory (RAM)!"), NULL #line 290 "WximgszApp.cpt" }; /** Non-localized dkChar texts. */ static dkChar const * wximgsz_nl_dk[] = { /* 0 */ dkT("dktools"), /* 1 */ dkT("wximgsz.str"), /* 2 */ dkT("wximgsz.chm"), /* 3 */ dkT("wximgsz.htb"), NULL #line 315 "WximgszApp.cpt" }; /** Implementation of the wxApp functionality. */ IMPLEMENT_APP(WximgszApp) bool WximgszApp::OnInit() { WximgszFrame *frame = NULL; wxChar const * const *localizedTexts = NULL; #if !(wxCHECK_VERSION(3,0,0)) wxPNGHandler *phPng = NULL; wxJPEGHandler *phJpg = NULL; wxTIFFHandler *phTiff = NULL; wxPNMHandler *phPnm = NULL; wxXPMHandler *phXpm = NULL; wxICOHandler *phIco = NULL; wxGIFHandler *phGif = NULL; wxPCXHandler *phPcx = NULL; wxTGAHandler *phTga = NULL; wxIFFHandler *phIff = NULL; wxCURHandler *phCur = NULL; wxANIHandler *phAni = NULL; #endif wxArchiveFSHandler *phArchiveFS = NULL; bool back = false; #line 347 "WximgszApp.cpt" /* Initialize members. */ pAh = NULL; pHc = NULL; /* __CHANGE__ 009: Initialize further members here. */ /* Set up helper object. */ pAh = new Dk4WxApplicationHelper(); if (NULL == pAh) { ShowMemoryErrorMessage(); goto finished; } if (!(pAh->Initialize(argv[0], wximgsz_nl_wx[3], wximgsz_nl_dk[0]))) { goto finished; } #if wxCHECK_VERSION(3,0,0) wxInitAllImageHandlers(); #else /* Add image and file system handlers for online help. */ phPng = new wxPNGHandler(); if (NULL != phPng) { wxImage::AddHandler(phPng); } else { ShowMemoryErrorMessage(); goto finished; } phJpg = new wxJPEGHandler(); if (NULL != phJpg) { wxImage::AddHandler(phJpg); } else { ShowMemoryErrorMessage(); goto finished; } phTiff = new wxTIFFHandler(); if (NULL != phTiff) { wxImage::AddHandler(phTiff); } else { ShowMemoryErrorMessage(); goto finished; } phPnm = new wxPNMHandler(); if (NULL != phPnm) { wxImage::AddHandler(phPnm); } 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; } phGif = new wxGIFHandler(); if (NULL != phGif) { wxImage::AddHandler(phGif); } else { ShowMemoryErrorMessage(); goto finished; } phPcx = new wxPCXHandler(); if (NULL != phPcx) { wxImage::AddHandler(phPcx); } else { ShowMemoryErrorMessage(); goto finished; } phTga = new wxTGAHandler(); if (NULL != phTga) { wxImage::AddHandler(phTga); } else { ShowMemoryErrorMessage(); goto finished; } phIff = new wxIFFHandler(); if (NULL != phIff) { wxImage::AddHandler(phIff); } else { ShowMemoryErrorMessage(); goto finished; } phCur = new wxCURHandler(); if (NULL != phCur) { wxImage::AddHandler(phCur); } else { ShowMemoryErrorMessage(); goto finished; } phAni = new wxANIHandler(); if (NULL != phAni) { wxImage::AddHandler(phAni); } else { ShowMemoryErrorMessage(); goto finished; } #endif phArchiveFS = new wxArchiveFSHandler(); if (NULL != phArchiveFS) { wxFileSystem::AddHandler(phArchiveFS); } else { ShowMemoryErrorMessage(); goto finished; } /* Set up help controller. */ pHc = new Dk4WxHelpController(); if (NULL == pHc) { ShowMemoryErrorMessage(); goto finished; } if (!(pHc->Initialize(pAh, wximgsz_nl_dk[2], wximgsz_nl_dk[3]))) { goto finished; } /* Attempt to obtain localized texts in users preferred language. */ localizedTexts = pAh->GetStringTable(wximgsz_nl_dk[1], wximgsz_texts); if(!(localizedTexts)) { localizedTexts = wximgsz_texts; } /* Create and show frame. */ frame = new WximgszFrame( WximgszFrame::ID_FRAME, pAh, pHc, argc, argv, localizedTexts, wximgsz_nl_wx, wximgsz_nl_dk ); if(!(frame)) { ShowMemoryErrorMessage(); goto finished; } /* Show frame, restore position and indicate success. */ frame->RestorePosition(); frame->Show(); frame->ActivateIdleProcessing(); back = true; /* Release resources if initialization failed. */ finished: if(!(back)) { if (NULL != pHc) { pHc->Cleanup(); delete(pHc); pHc = NULL; } if (NULL != pAh) { pAh->Cleanup(); delete(pAh); pAh = NULL; } } #line 544 "WximgszApp.cpt" return back; } int WximgszApp::OnExit() { int back = 0; #line 555 "WximgszApp.cpt" /* __CHANGE__ 009: 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; } /* __CHANGE__ 010: Set exit status code. */ #line 571 "WximgszApp.cpt" return back; } void WximgszApp::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 = wximgsz_nl_wx[16]; } if (NULL == s_text) { s_text = wximgsz_nl_wx[17]; } wxMessageBox(s_text, s_title, (wxOK | wxCENTRE | wxICON_ERROR)); } /* vim: set ai sw=4 ts=4 : */