/* Copyright (C) 2013-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: DkClockApp.cpt */ /** @file DkClockApp.cpp The DkClockApp module. */ #line 64 "DkClockApp.cpt" #include "dk3conf.h" #include "wxdkclock.h" #line 70 "DkClockApp.cpt" /** Localized wxChar texts. */ static wxChar const * wxdkclock_texts[] = { /* 0 */ wxT("File"), /* 1 */ wxT("Exit"), /* 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("Alert "), /* 9 */ wxT("Copyright (c) "), /* 10 */ wxT("About "), /* 11 */ wxT("This program uses the following libraries:"), /* 12 */ wxT("See:"), /* 13 */ wxT("Options"), /* 14 */ wxT("Alert"), /* 15 */ wxT("Enable/disable alert, set alert time"), /* 16 */ wxT("Options"), /* 17 */ wxT("OK"), /* 18 */ wxT("Apply settings and close dialog box."), /* 19 */ wxT("Cancel"), /* 20 */ wxT("Close dialog box and discard settings"), /* 21 */ wxT("Minute:"), /* 22 */ wxT("Hour:"), /* 23 */ wxT("Enable or disable alert"), /* 24 */ wxT("Choose alert time (hour)"), /* 25 */ wxT("Choose alert time (minute)"), /* 26 */ wxT("Restore window"), /* 27 */ wxT("Exit application"), /* 28 */ wxT("Hide"), /* 29 */ wxT("Hide main window"), /* 30 */ wxT("Colour"), /* 31 */ wxT("Normal"), /* 32 */ wxT("Clock colour in normal state"), /* 33 */ wxT("Alert"), /* 34 */ wxT("Clock colour in alert state"), NULL #line 194 "DkClockApp.cpt" }; /** Non-localized wxChar texts. */ static wxChar const * wxdkclock_nl_wx[] = { /* 0 */ wxT("WxDkClock"), /* 1 */ wxT("3.0.6"), /* 2 */ wxT("Dirk Krause"), /* 3 */ wxT("DKrause"), /* 4 */ wxT("aaaaa"), /* 5 */ wxT("wxdkclock.chm"), /* 6 */ wxT("wxdkclock.htb"), /* 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 254 "DkClockApp.cpt" }; /** Non-localized dkChar texts. */ static dkChar const * wxdkclock_nl_dk[] = { /* 0 */ dkT("dktools"), /* 1 */ dkT("wxdkclock.str"), NULL #line 271 "DkClockApp.cpt" }; /** Implementation of the wxApp functionality. */ #if wxCHECK_VERSION(3,0,0) wxIMPLEMENT_APP(DkClockApp); #else IMPLEMENT_APP(DkClockApp) #endif bool DkClockApp::OnInit() { DkClockFrame *frame = NULL; wxChar const * const *localizedTexts = NULL; wxPNGHandler *phPng = NULL; wxXPMHandler *phXpm = NULL; wxICOHandler *phIco = NULL; wxArchiveFSHandler *phArchiveFs = NULL; bool back = false; #if USE_WXAPP_ONINIT if(wxApp::OnInit()) { #endif #line 300 "DkClockApp.cpt" #line 301 "DkClockApp.cpt" /* Initialize members. */ pHelper = NULL; helpController = NULL; /* Set up helper object. */ pHelper = new DkWxAppHelper( argv[0], wxdkclock_nl_wx[3], wxdkclock_nl_dk[0] ); if(!(pHelper)) { ShowMemoryErrorMessage(); goto finished; } if(!(pHelper->checkSetup())) { goto finished; } /* 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. */ 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. */ localizedTexts = pHelper->getStringTable( wxdkclock_texts, wxdkclock_nl_dk[1] ); if(!(localizedTexts)) { localizedTexts = wxdkclock_texts; } /* Set up online help controller. */ helpController = new DkWxHelpController( pHelper, wxdkclock_nl_wx[5], wxdkclock_nl_wx[6] ); if(!(helpController)) { ShowMemoryErrorMessage(); goto finished; } /* Create and show frame. */ frame = new DkClockFrame( DkClockFrame_MainWindow, pHelper, helpController, argc, argv, localizedTexts, wxdkclock_nl_wx, wxdkclock_nl_dk ); if(!(frame)) { ShowMemoryErrorMessage(); goto finished; } frame->restorePosition(); frame->Show(); back = true; /* Release resources if initialization failed. */ finished: if(!(back)) { if(helpController) { delete(helpController); helpController = NULL; } if(pHelper) { delete(pHelper); pHelper = NULL; } } #line 416 "DkClockApp.cpt" #if USE_WXAPP_ONINIT } #endif return back; } int DkClockApp::OnExit() { int back = 0; #line 429 "DkClockApp.cpt" /* Release resources. */ if(helpController) { delete(helpController); helpController = NULL; } if(pHelper) { delete(pHelper); pHelper = NULL; } #line 439 "DkClockApp.cpt" #line 440 "DkClockApp.cpt" return back; } void DkClockApp::ShowMemoryErrorMessage(void) { const wxChar *s_title = NULL; const wxChar *s_text = NULL; if (NULL != pHelper) { s_title = pHelper->getBasicString(3); s_text = pHelper->getBasicString(9); } if (NULL == s_title) { s_title = wxdkclock_nl_wx[16]; } if (NULL == s_text) { s_text = wxdkclock_nl_wx[17]; } wxMessageBox(s_text, s_title, (wxOK | wxCENTRE | wxICON_ERROR)); }